target
stringlengths 5
300
| feat_repo_name
stringlengths 6
76
| text
stringlengths 26
1.05M
|
---|---|---|
src/components/Main.js | Aikk/gallery-by-react | require('normalize.css/normalize.css');
require('styles/App.scss');
import React from 'react';
import ReactDOM from 'react-dom';
let imageDatas = require('json!../data/images.json');
imageDatas = (function genImageURL(imageDatasArr) {
for (let i = 0, n = imageDatasArr.length; i < n; i++) {
let singleImageData = imageDatasArr[i];
singleImageData.imageURL = require('../images/' + singleImageData.fileName);
imageDatasArr[i] = singleImageData;
}
return imageDatasArr;
})(imageDatas);
/**
* 获取坐标区间内的一个随机值
* @param {[type]} low 最小值
* @param {[type]} high 最大值
* @return {[type]} 坐标随机值
*/
let getRangeRandom = (low, high) => Math.floor(Math.random() * (high - low) + low);
/**
* 获取偏转角度随机值 -30° ~ 30°
* @return {[type]} 角度随机值
*/
let get30DegRandom = () => ((Math.random() < 0.5 ? '' : '-') + Math.ceil(Math.random() * 30));
/**
* 划分为三个区域:左侧、右侧、上侧
* 左侧:
* -图片宽度/2 < x < 舞台宽度一半 - 图片宽度/2*3
* -图片高度/2 < y < 舞台高度 - 图片高度/2
* 右侧:
* 舞台宽度/2-图片宽度/2 < x < 舞台宽度-图片宽度/2
* -图片高度/2 < y < 舞台高度 - 图片高度/2
* 上侧:
* 舞台宽度/2 - 图片宽度 < x < 舞台宽度/2
* -图片高度/2 < y < 舞台高度/2 - 图片高度/2*3
*/
class ImgFigure extends React.Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
// 图片点击事件处理函数
handleClick(e) {
if (this.props.arrange.center) {
this.props.inverse();
} else {
this.props.center();
}
e.stopPropagation();
e.preventDefault();
}
render() {
let styleObj = {};
if (this.props.arrange.pos) {
styleObj = this.props.arrange.pos;
}
if (this.props.arrange.rotate) {
(['-moz-', '-ms-', 'webkit', '']).forEach((value) => {
styleObj[value + 'transform'] = 'rotate(' + this.props.arrange.rotate + 'deg)';
});
}
let imgFigureClassName = 'img-figure';
if (this.props.arrange.center) {
imgFigureClassName += ' center';
if (this.props.arrange.inverse) {
imgFigureClassName += ' inverse';
}
}
return (
<figure className={imgFigureClassName} style={styleObj} onClick={this.handleClick}>
<img src={this.props.data.imageURL}
alt={this.props.data.fileName}
/>
<figcaption>
<h2 className="img-title">{this.props.data.desc}</h2>
<div className="img-back">
<p>{this.props.data.desc}</p>
</div>
</figcaption>
</figure>
);
}
}
class ControllerUnit extends React.Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick(e) {
if (this.props.arrange.center) {
this.props.inverse();
} else {
this.props.center();
}
e.stopPropagation();
e.preventDefault();
}
render() {
let ctrlUnitClassName = 'ctrl-unit';
if (this.props.arrange.center) {
ctrlUnitClassName += ' center';
if (this.props.arrange.inverse) {
ctrlUnitClassName += ' inverse';
}
}
return (
<span className={ctrlUnitClassName} onClick={this.handleClick}>
</span>
);
}
}
class AppComponent extends React.Component {
constructor(props) {
super(props);
// 左侧、右侧、上侧、中心 各部分的坐标范围
this.Constant = {
centerPos: {
top: 0,
right: 0
},
hPosRange: {
leftX: [0, 0],
rightX: [0, 0],
y: [0, 0]
},
vPosRange: {
x: [0, 0],
topY: [0, 0]
}
},
this.state = {
imgsArrangeArr: []
}
}
/**
* 重新布局所有图片
* @param centerIndex 指定居中的图片
*/
arrange(centerIndex) {
let imgsArrangeArr = this.state.imgsArrangeArr,
Constant = this.Constant,
centerPos = Constant.centerPos,
hPosRange = Constant.hPosRange,
vPosRange = Constant.vPosRange,
hPosRangeLeftX = hPosRange.leftX,
hPosRangeRightX = hPosRange.rightX,
hPosRangeY = hPosRange.y,
vPosRangeX = vPosRange.x,
vPosRangeTopY = vPosRange.topY,
// 上侧的图片信息
imgsArrangeTopArr = [],
topNum = Math.floor(Math.random() * 2),
topIndex = 0,
// 居中的图片信息
imgsArrangeCenterArr = imgsArrangeArr.splice(centerIndex, 1);
imgsArrangeCenterArr[0] = {
pos: centerPos,
rotate: 0,
center: true
}
topIndex = Math.floor(Math.random() * (imgsArrangeArr.length - topNum));
imgsArrangeTopArr = imgsArrangeArr.splice(topIndex, topNum);
imgsArrangeTopArr.forEach((value, index) => {
imgsArrangeTopArr[index] = {
pos: {
top: getRangeRandom(vPosRangeTopY[0], vPosRangeTopY[1]),
left: getRangeRandom(vPosRangeX[0], vPosRangeX[1])
},
rotate: get30DegRandom(),
center: false
}
});
// 布局左右两侧的图片
for (let i = 0, j = imgsArrangeArr.length, k = j / 2; i < j; i++) {
let hPosRangeLORX = (i < k) ? hPosRangeLeftX : hPosRangeRightX;
imgsArrangeArr[i] = {
pos: {
top: getRangeRandom(hPosRangeY[0], hPosRangeY[1]),
left: getRangeRandom(hPosRangeLORX[0], hPosRangeLORX[1])
},
rotate: get30DegRandom(),
center: false
}
}
if (imgsArrangeTopArr && imgsArrangeTopArr[0]) {
imgsArrangeArr.splice(topIndex, 0, imgsArrangeTopArr[0]);
}
imgsArrangeArr.splice(centerIndex, 0, imgsArrangeCenterArr[0]);
this.setState({
imgsArrangeArr: imgsArrangeArr
});
}
/**
* 翻转图片
* param index 图片下标
* return 图片状态信息
*/
inverse(index) {
return () => {
var imgsArrangeArr = this.state.imgsArrangeArr;
imgsArrangeArr[index].inverse = !imgsArrangeArr[index].inverse;
this.setState({
imgsArrangeArr: imgsArrangeArr
});
}
}
/**
* 图片居中
* param index 图片下标
* return 重新排列
*/
center(index) {
return () => {
this.arrange(index);
}
}
// 组件加载后,为每张图片计算其位置
componentDidMount() {
var stageDOM = ReactDOM.findDOMNode(this.refs.stage),
stageW = stageDOM.scrollWidth,
stageH = stageDOM.scrollHeight,
halfStageW = Math.ceil(stageW / 2),
halfStageH = Math.ceil(stageH / 2);
var imgFigureDOM = ReactDOM.findDOMNode(this.refs.imgFigure0),
imgFigureW = imgFigureDOM.scrollWidth,
imgFigureH = imgFigureDOM.scrollHeight,
halfImgFigureW = Math.ceil(imgFigureW / 2),
halfImgFigureH = Math.ceil(imgFigureH / 2);
this.Constant.centerPos = {
top: halfStageH - halfImgFigureH,
left: halfStageW - halfImgFigureW
}
this.Constant.hPosRange = {
leftX: [-halfImgFigureW, halfStageW - halfImgFigureW * 3],
rightX: [halfStageW + halfImgFigureW, stageW - halfImgFigureW],
y: [-halfImgFigureH, stageH - halfImgFigureH]
}
this.Constant.vPosRange = {
x: [halfStageW - imgFigureW, halfStageW],
topY: [-halfImgFigureH, halfStageH - halfImgFigureH * 3]
}
this.arrange(0);
}
render() {
let ctrlUnits = [],
imgFigures = [];
imageDatas.forEach(function(value, index) {
if (!this.state.imgsArrangeArr[index]) {
this.state.imgsArrangeArr[index] = {
pos: {
top: 0,
left: 0
},
rotate: 0,
inverse: false,
center: false
}
}
imgFigures.push(<ImgFigure key={index} data={value} ref={'imgFigure' + index} arrange={this.state.imgsArrangeArr[index]} inverse={this.inverse(index)} center={this.center(index)} />);
ctrlUnits.push(<ControllerUnit key={index} arrange={this.state.imgsArrangeArr[index]} inverse={this.inverse(index)} center={this.center(index)} />);
}.bind(this));
return (
<section className="stage" ref="stage">
<section className="img-sec">
{imgFigures}
</section>
<section className="ctrl-sec">
{ctrlUnits}
</section>
</section>
);
}
}
AppComponent.defaultProps = {
};
export default AppComponent;
|
logspace-frontend-new/src/main/time-series/components/suggestions/Suggestions.react.js | Indoqa/logspace | /*
* Logspace
* Copyright (c) 2015 Indoqa Software Design und Beratung GmbH. All rights reserved.
* This program and the accompanying materials are made available under the terms of
* the Eclipse Public License Version 1.0, which accompanies this distribution and
* is available at http://www.eclipse.org/legal/epl-v10.html.
*/
import React, {PropTypes} from 'react'
import SuggestionResult from './SuggestionsResult.react'
import debounceFunc from '../../../app/utils/debounce'
require('./Suggestions.styl')
export default class Suggestions extends React.Component {
constructor(props) {
super(props)
this.state = {
input: props.suggestions.get('request').get('text')
}
}
componentDidMount() {
const {setSuggestionQuery} = this.props
this.debouncedChangeFunction = debounceFunc(() => setSuggestionQuery(this.state.input), 350)
}
handleQueryChange(event) {
this.setState({input: event.target.value})
this.debouncedChangeFunction()
}
render() {
return (
<div className={'suggestions'}>
<div className={'query'}>
<input
onChange={(event) => this.handleQueryChange(event)}
value={this.state.input}
placeholder="Filter by agent, space, system or property name"
/>
</div>
<SuggestionResult
result={this.props.suggestions.get('result')}
request={this.props.suggestions.get('request')}
addTimeseries={this.props.addTimeseries}
selectSystem={this.props.selectSystem}
clearSystem={this.props.clearSystem}
selectProperty={this.props.selectProperty}
clearProperty={this.props.clearProperty}
selectSpace={this.props.selectSpace}
clearSpace={this.props.clearSpace}
/>
</div>
)
}
}
Suggestions.propTypes = {
suggestions: PropTypes.object.isRequired,
addTimeseries: PropTypes.func.isRequired,
setSuggestionQuery: PropTypes.func.isRequired,
selectSystem: PropTypes.func.isRequired,
clearSystem: PropTypes.func.isRequired,
selectProperty: PropTypes.func.isRequired,
clearProperty: PropTypes.func.isRequired,
selectSpace: PropTypes.func.isRequired,
clearSpace: PropTypes.func.isRequired
}
|
docs/app/Examples/modules/Dropdown/Types/DropdownExampleSelection.js | ben174/Semantic-UI-React | import React from 'react'
import { Dropdown } from 'semantic-ui-react'
import { friendOptions } from '../common'
const DropdownExampleSelection = () => (
<Dropdown placeholder='Select Friend' fluid selection options={friendOptions} />
)
export default DropdownExampleSelection
|
fields/components/columns/IdColumn.js | belafontestudio/keystone | import React from 'react';
import ItemsTableCell from '../../../admin/src/components/ItemsTableCell';
import ItemsTableValue from '../../../admin/src/components/ItemsTableValue';
var IdColumn = React.createClass({
displayName: 'IdColumn',
propTypes: {
col: React.PropTypes.object,
data: React.PropTypes.object,
list: React.PropTypes.object,
},
renderValue () {
let value = this.props.data.id;
if (!value) return null;
return (
<ItemsTableValue padded interior title={value} href={'/keystone/' + this.props.list.path + '/' + value} field={this.props.col.type}>
{value}
</ItemsTableValue>
);
},
render () {
return (
<ItemsTableCell>
{this.renderValue()}
</ItemsTableCell>
);
}
});
module.exports = IdColumn;
|
src/js/view/stats.js | chemdemo/react-webpack-todos | /*
* @Author: dmyang
* @Date: 2015-07-31 18:39:12
* @Last Modified by: dmyang
* @Last Modified time: 2015-08-18 21:47:16
*/
'use strict';
import React from 'react';
let Stats = React.createClass({
render() {
let props = this.props;
let filter = props.filter;
return (
<section className="stats">
<div className="todo-count">
<strong>{props.left}</strong> left
</div>
<div className="filters" onClick={this.onSelect}>
<a className={filter === -1 ? 'selected' : ''} data-filter="-1">All</a>
<a className={filter === 1 ? 'selected' : ''} data-filter="1">Done</a>
<a className={filter === 0 ? 'selected' : ''} data-filter="0">Undo</a>
</div>
<a className="clean" href="javascript:void(0);" onClick={props.clean}>Clear completed</a>
</section>
);
},
onSelect(e) {
let flag = e.target.getAttribute('data-filter');
this.props.setFilter(flag - 0);
}
});
function getClassName(value) {
return this.props.filter === value ? 'selected' : '';
};
export default Stats;
|
src/App.js | mdkalish/json_selector | import React, { Component } from 'react';
import SocialProfiles from './components/social_profiles.js'
var App = React.createClass({
render: function() {
return (
<div>
<h1>Diff Tables</h1>
<div className="socialProfiles">
<SocialProfiles
fullcontactData={this.props.fullcontactData.socialProfiles}
sObjectData={this.props.sObjectData.socialProfiles}
onChange={this.props.onChange}
/>
</div>
</div>
);
}
});
module.exports = App;
|
src/components/editor/TempoButton.js | calesce/tab-editor | import React, { Component } from 'react';
import { connect } from 'react-redux';
import Popover from 'react-popover';
import { StyleSheet, css } from 'aphrodite';
import { changeTempo } from '../../actions/track';
const styles = StyleSheet.create({
hover: {
':hover': {
MozUserSelect: 'none',
WebkitUserSelect: 'none',
msUserSelect: 'none',
cursor: 'pointer',
fill: '#b3caf5',
stroke: '#b3caf5'
},
fill: 'black',
stroke: 'black'
},
text: {
fontSize: 12,
fontWeight: 600,
fontFamily: 'Optima, Segoe, Segoe UI, Candara, Calibri, Arial, sans-serif'
},
light: { fontWeight: 300, fontSize: 12, paddingTop: 3 },
textInput: {
width: 70,
margin: '5px 15px 0px 15px',
':focus': { outline: 'none' }
},
popover: { zIndex: 5, fill: '#FEFBF7', marginLeft: -10 },
popoverContainer: {
background: '#FEFBF7',
height: 80,
display: 'flex',
flexDirection: 'column',
justifyContent: 'space-around'
},
flexToEnd: { display: 'flex', justifyContent: 'flex-end', paddingRight: 12 },
flexAllMeasures: {
display: 'flex',
justifyContent: 'flex-end',
paddingRight: 12
}
});
const TempoButton = ({ tempo, onClick }) => (
<svg onClick={onClick} width="80" height="50" className={css(styles.hover)}>
<g transform="translate(25, 12)">
<g transform="scale(0.5)">
<path
strokeWidth={0.2}
d="M 11.09297,35.38984 C 14.48881,33.56987 16.29825,30.27529 15.18519,27.79688 C 13.99793,25.15324 9.91818,24.40716 6.07861,26.13151 C 2.23905,27.85587 0.08645,31.40091 1.27371,34.04454 C 2.46098,36.68818 6.54072,37.43426 10.38029,35.70991 C 10.62026,35.60214 10.86657,35.51117 11.09297,34.38984 z "
/>
<path strokeWidth={1.5} d="M 14.72547,29.05645 L 14.72547,0.46888" />
</g>
<g transform="translate(10, 17)">
<text strokeWidth={0} className={css(styles.text)}>
={tempo}
</text>
</g>
</g>
</svg>
);
class TempoPopover extends Component {
constructor(props) {
super(props);
this.state = { tempo: props.tempo, toEndChecked: false, allChecked: false };
}
componentDidMount() {
if (this.textInput) {
this.textInput.select();
}
}
componentWillUnmount() {
const { tempo, toEndChecked, allChecked } = this.state;
this.props.changeTempo(this.props.cursor, tempo, toEndChecked, allChecked);
}
onTextChanged = e => {
if (!isNaN(parseInt(e.target.value)) || e.target.value === '') {
this.setState({ tempo: e.target.value });
}
};
toEndChanged = () => {
this.setState({ toEndChecked: !this.state.toEndChecked });
};
allChanged = () => {
this.setState({ allChecked: !this.state.allChecked });
};
setInputRef = el => {
this.textInput = el;
};
render() {
return (
<div className={css(styles.popoverContainer)}>
<input
ref={this.setInputRef}
className={css(styles.textInput)}
type="text"
value={this.state.tempo}
onChange={this.onTextChanged}
/>
<span className={css(styles.flexToEnd)}>
<small className={css(styles.text, styles.light)}>To End</small>
<input
type="checkbox"
value={this.state.toEndChecked}
onChange={this.toEndChanged}
/>
</span>
<span className={css(styles.flexAllMeasures)}>
<small className={css(styles.text, styles.light)}>All Measures</small>
<input
type="checkbox"
value={this.state.allChecked}
onChange={this.allChanged}
/>
</span>
</div>
);
}
}
const ConnectedPopover = connect(null, { changeTempo })(TempoPopover);
class Tempo extends Component {
constructor() {
super();
this.state = { popoverOpen: false };
}
onClick = () => {
if (this.state.popoverOpen) {
this.onPopoverClose();
} else {
this.props.onClick();
this.setState({ popoverOpen: true });
}
};
onPopoverClose = () => {
this.setState({ popoverOpen: false });
this.props.onClose();
};
render() {
const { tempo, color, cursor } = this.props;
const body = <ConnectedPopover cursor={cursor} tempo={tempo} />;
return (
<div>
<Popover
preferPlace="right"
className={css(styles.popover)}
isOpen={this.state.popoverOpen}
onOuterAction={this.onPopoverClose}
body={body}
>
<TempoButton onClick={this.onClick} tempo={tempo} color={color} />
</Popover>
</div>
);
}
}
export default connect(state => ({
tempo:
state.tracks.present[state.currentTrackIndex].measures[
state.cursor.measureIndex
].tempo,
cursor: state.cursor
}))(Tempo);
|
RNTester/js/XHRExampleOnTimeOut.js | negativetwelve/react-native | /**
* 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.
*
* @flow
* @providesModule XHRExampleOnTimeOut
*/
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
StyleSheet,
Text,
TouchableHighlight,
View,
} = ReactNative;
class XHRExampleOnTimeOut extends React.Component {
state: any;
xhr: XMLHttpRequest;
constructor(props: any) {
super(props);
this.state = {
status: '',
loading: false
};
}
loadTimeOutRequest() {
this.xhr && this.xhr.abort();
var xhr = this.xhr || new XMLHttpRequest();
xhr.onerror = ()=> {
console.log('Status ', xhr.status);
console.log('Error ', xhr.responseText);
};
xhr.ontimeout = () => {
this.setState({
status: xhr.responseText,
loading: false
});
};
xhr.onload = () => {
console.log('Status ', xhr.status);
console.log('Response ', xhr.responseText);
};
xhr.open('GET', 'https://httpbin.org/delay/5'); // request to take 5 seconds to load
xhr.timeout = 2000; // request times out in 2 seconds
xhr.send();
this.xhr = xhr;
this.setState({loading: true});
}
componentWillUnmount() {
this.xhr && this.xhr.abort();
}
render() {
var button = this.state.loading ? (
<View style={styles.wrapper}>
<View style={styles.button}>
<Text>Loading...</Text>
</View>
</View>
) : (
<TouchableHighlight
style={styles.wrapper}
onPress={this.loadTimeOutRequest.bind(this)}>
<View style={styles.button}>
<Text>Make Time Out Request</Text>
</View>
</TouchableHighlight>
);
return (
<View>
{button}
<Text>{this.state.status}</Text>
</View>
);
}
}
var styles = StyleSheet.create({
wrapper: {
borderRadius: 5,
marginBottom: 5,
},
button: {
backgroundColor: '#eeeeee',
padding: 8,
},
});
module.exports = XHRExampleOnTimeOut;
|
node_modules/react-icons/fa/cc-mastercard.js | bengimbel/Solstice-React-Contacts-Project |
import React from 'react'
import Icon from 'react-icon-base'
const FaCcMastercard = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m11.7 20.6h-0.2q-0.8 0-0.8 0.6 0 0.4 0.3 0.4 0.3 0 0.5-0.3t0.2-0.7z m7-0.6h1v0q0.1-0.1 0.1-0.1t-0.1-0.2 0-0.1-0.1-0.1-0.1-0.1-0.2 0q-0.5 0-0.6 0.6z m9.4 0.6h-0.2q-0.8 0-0.8 0.6 0 0.4 0.3 0.4 0.3 0 0.5-0.3t0.2-0.7z m5.6-0.4q0-0.7-0.5-0.7-0.4 0-0.6 0.3t-0.2 0.9q0 0.8 0.5 0.8 0.4 0 0.6-0.4t0.2-0.9z m-25.3-2.5h1.5l-0.7 4.6h-1l0.5-3.5-1.2 3.5h-0.7l-0.1-3.5-0.6 3.5h-0.9l0.8-4.6h1.4l0 2.9z m4.4 1.9q0 0.1 0 0.7-0.3 1.8-0.3 2h-0.9l0.1-0.4q-0.4 0.5-1.1 0.5-0.4 0-0.6-0.3t-0.3-0.7q0-0.7 0.5-1.1t1.3-0.4q0.2 0 0.4 0 0 0 0 0t0-0.1 0-0.1q0-0.3-0.6-0.3-0.5 0-1.1 0.1 0 0 0.2-0.8 0.6-0.2 1.1-0.2 1.3 0 1.3 1.1z m2.8-1l-0.2 0.8q-0.4 0-0.7 0-0.5 0-0.5 0.3 0 0.1 0.1 0.2t0.4 0.2q0.7 0.3 0.7 1 0 1.3-1.5 1.3-0.6 0-1.1-0.1 0-0.1 0.2-0.9 0.5 0.2 0.9 0.2 0.5 0 0.5-0.4 0-0.1-0.1-0.2t-0.3-0.2q-0.8-0.3-0.8-1 0-1.3 1.5-1.3 0.5 0 0.9 0.1z m1.5 0h0.5l-0.1 0.9h-0.5q-0.1 0.3-0.1 0.7t-0.2 0.7 0 0.3q0 0.3 0.3 0.3 0.2 0 0.3-0.1l-0.1 0.9q-0.4 0.1-0.7 0.1-0.8 0-0.8-0.8 0-0.3 0.1-1 0.1-0.4 0.4-2.6h1z m3.6 1.3q0 0.4-0.2 0.9h-1.9q-0.1 0.4 0.2 0.5t0.6 0.2q0.6 0 1-0.2l-0.1 0.9q-0.5 0.2-1 0.2-1.7 0-1.7-1.7 0-0.9 0.5-1.6t1.2-0.6q0.6 0 1 0.4t0.4 1z m2.4-1.3q-0.2 0.4-0.4 1.1-0.4-0.1-0.5 0.4t-0.5 2.2h-1l0.1-0.2q0.4-2.3 0.5-3.5h0.9l-0.1 0.6q0.3-0.4 0.5-0.6t0.5 0z m3.3-0.8l-0.2 1q-0.5-0.2-0.9-0.2-0.5 0-0.9 0.5t-0.3 1.2q0 0.5 0.2 0.8t0.7 0.3q0.4 0 0.8-0.2l-0.1 1q-0.5 0.2-0.9 0.2-0.8 0-1.3-0.6t-0.4-1.4q0-1.2 0.6-2t1.6-0.8q0.5 0 1.1 0.2z m2.8 1.8q0 0.3-0.1 0.7-0.2 1.4-0.3 2h-0.8l0-0.4q-0.3 0.5-1 0.5-0.4 0-0.6-0.3t-0.3-0.7q0-0.7 0.5-1.1t1.2-0.4q0.3 0 0.4 0 0.1-0.1 0.1-0.2 0-0.3-0.7-0.3-0.5 0-1 0.1 0 0 0.1-0.8 0.7-0.2 1.2-0.2 1.3 0 1.3 1.1z m2.5-1q-0.3 0.4-0.4 1.1-0.4-0.1-0.6 0.4t-0.4 2.2h-1l0.1-0.2q0.3-1.9 0.5-3.5h0.9q0 0.2-0.1 0.6 0.3-0.4 0.5-0.6t0.5 0z m2.4-0.9h1l-0.7 4.6h-1l0.1-0.3q-0.4 0.4-0.9 0.4-0.6 0-0.9-0.4t-0.3-1.2q0-0.9 0.5-1.6t1.1-0.7q0.5 0 0.9 0.6z m2 2.3q0-2.6-1.3-4.8t-3.5-3.4-4.7-1.3q-3.2 0-5.8 1.9 2.2 2 3 5h-0.9q-0.7-2.7-2.7-4.5-2 1.8-2.8 4.5h-0.9q0.8-3 3-5-2.6-1.9-5.7-1.9-2.6 0-4.8 1.3t-3.5 3.4-1.2 4.8 1.2 4.8 3.5 3.4 4.8 1.3q3.1 0 5.7-1.9-2.1-1.9-2.9-4.6h0.9q0.8 2.4 2.7 4.1 1.8-1.7 2.6-4.1h0.9q-0.8 2.7-2.9 4.6 2.6 1.9 5.8 1.9 2.5 0 4.7-1.3t3.5-3.4 1.3-4.8z m4.2-11.2v22.4q0 0.9-0.6 1.6t-1.6 0.6h-35.9q-0.9 0-1.5-0.6t-0.7-1.6v-22.4q0-0.9 0.7-1.6t1.5-0.6h35.9q0.9 0 1.6 0.6t0.6 1.6z"/></g>
</Icon>
)
export default FaCcMastercard
|
src/components/ChooseBusiness/ChooseBusiness.js | TheModevShop/craft-app | import React from 'react';
import {Link} from 'react-router';
import _ from 'lodash';
import './choose-business.less';
class ChooseBusiness extends React.Component {
constructor(...args) {
super(...args);
this.state = {
};
}
render() {
return (
<div className="choose-business">
</div>
);
}
}
ChooseBusiness.propTypes = {
};
export default ChooseBusiness; |
node_modules/node_modules/recharts/lib/chart/PieChart.js | SerendpityZOEY/Fixr-RelevantCodeSearch | '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 _class, _class2, _temp2; /**
* @fileOverview Pie Chart
*/
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _Surface = require('../container/Surface');
var _Surface2 = _interopRequireDefault(_Surface);
var _Legend = require('../component/Legend');
var _Legend2 = _interopRequireDefault(_Legend);
var _Tooltip = require('../component/Tooltip');
var _Tooltip2 = _interopRequireDefault(_Tooltip);
var _Pie = require('../polar/Pie');
var _Pie2 = _interopRequireDefault(_Pie);
var _Cell = require('../component/Cell');
var _Cell2 = _interopRequireDefault(_Cell);
var _DataUtils = require('../util/DataUtils');
var _ReactUtils = require('../util/ReactUtils');
var _PolarUtils = require('../util/PolarUtils');
var _PureRender = require('../util/PureRender');
var _PureRender2 = _interopRequireDefault(_PureRender);
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 PieChart = (0, _PureRender2.default)(_class = (_temp2 = _class2 = function (_Component) {
_inherits(PieChart, _Component);
function PieChart() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, PieChart);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = PieChart.__proto__ || Object.getPrototypeOf(PieChart)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
activeTooltipLabel: '',
activeTooltipCoord: { x: 0, y: 0 },
activeTooltipPayload: [],
isTooltipActive: false
}, _this.handleMouseEnter = function (el, index, e) {
var _this$props = _this.props;
var children = _this$props.children;
var onMouseEnter = _this$props.onMouseEnter;
var cx = el.cx;
var cy = el.cy;
var outerRadius = el.outerRadius;
var midAngle = el.midAngle;
var tooltipItem = (0, _ReactUtils.findChildByType)(children, _Tooltip2.default);
if (tooltipItem) {
_this.setState({
isTooltipActive: true,
activeTooltipCoord: (0, _PolarUtils.polarToCartesian)(cx, cy, outerRadius, midAngle),
activeTooltipPayload: [el]
}, function () {
if (onMouseEnter) {
onMouseEnter(el, index, e);
}
});
} else if (onMouseEnter) {
onMouseEnter(el, index, e);
}
}, _this.handleMouseLeave = function (el, index, e) {
var _this$props2 = _this.props;
var children = _this$props2.children;
var onMouseLeave = _this$props2.onMouseLeave;
var tooltipItem = (0, _ReactUtils.findChildByType)(children, _Tooltip2.default);
if (tooltipItem) {
_this.setState({
isTooltipActive: false
}, function () {
if (onMouseLeave) {
onMouseLeave(el, index, e);
}
});
} else if (onMouseLeave) {
onMouseLeave(el, index, e);
}
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(PieChart, [{
key: 'getComposedData',
value: function getComposedData(item) {
var _item$props = item.props;
var data = _item$props.data;
var children = _item$props.children;
var props = (0, _ReactUtils.getPresentationAttributes)(item.props);
var cells = (0, _ReactUtils.findAllByType)(children, _Cell2.default);
if (data && data.length) {
return data.map(function (entry, index) {
return _extends({}, props, entry, cells && cells[index] && cells[index].props);
});
}
if (cells && cells.length) {
return cells.map(function (cell) {
return _extends({}, props, cell.props);
});
}
return [];
}
}, {
key: 'renderLegend',
/**
* Draw legend
* @param {Array} items The instances of Pie
* @return {ReactElement} The instance of Legend
*/
value: function renderLegend(items) {
var _this2 = this;
var children = this.props.children;
var legendItem = (0, _ReactUtils.findChildByType)(children, _Legend2.default);
if (!legendItem) {
return null;
}
var _props = this.props;
var width = _props.width;
var height = _props.height;
var margin = _props.margin;
var legendData = legendItem.props && legendItem.props.payload || items.reduce(function (result, child) {
var nameKey = child.props.nameKey;
var data = _this2.getComposedData(child);
return result.concat(data.map(function (entry) {
return _extends({}, entry, { type: child.props.legendType, value: entry[nameKey],
color: entry.fill
});
}));
}, []);
return _react2.default.cloneElement(legendItem, _extends({}, _Legend2.default.getWithHeight(legendItem, width, height), {
payload: legendData,
chartWidth: width,
chartHeight: height,
margin: margin
}));
}
}, {
key: 'renderTooltip',
value: function renderTooltip() {
var children = this.props.children;
var tooltipItem = (0, _ReactUtils.findChildByType)(children, _Tooltip2.default);
if (!tooltipItem) {
return null;
}
var _props2 = this.props;
var width = _props2.width;
var height = _props2.height;
var _state = this.state;
var isTooltipActive = _state.isTooltipActive;
var activeTooltipLabel = _state.activeTooltipLabel;
var activeTooltipCoord = _state.activeTooltipCoord;
var activeTooltipPayload = _state.activeTooltipPayload;
var viewBox = { x: 0, y: 0, width: width, height: height };
return _react2.default.cloneElement(tooltipItem, {
viewBox: viewBox,
active: isTooltipActive,
label: activeTooltipLabel,
payload: activeTooltipPayload,
coordinate: activeTooltipCoord
});
}
/**
* Draw the main part of bar chart
* @param {Array} items All the instance of Pie
* @return {ReactComponent} All the instance of Pie
*/
}, {
key: 'renderItems',
value: function renderItems(items) {
var _this3 = this;
var _props3 = this.props;
var width = _props3.width;
var height = _props3.height;
var margin = _props3.margin;
var onClick = _props3.onClick;
return items.map(function (child, i) {
var _child$props = child.props;
var innerRadius = _child$props.innerRadius;
var outerRadius = _child$props.outerRadius;
var data = _child$props.data;
var cx = (0, _DataUtils.getPercentValue)(child.props.cx, width, width / 2);
var cy = (0, _DataUtils.getPercentValue)(child.props.cy, height, height / 2);
var maxRadius = (0, _PolarUtils.getMaxRadius)(width, height, margin);
return _react2.default.cloneElement(child, {
key: 'recharts-pie-' + i,
cx: cx,
cy: cy,
maxRadius: child.props.maxRadius || Math.sqrt(width * width + height * height) / 2,
innerRadius: (0, _DataUtils.getPercentValue)(innerRadius, maxRadius, 0),
outerRadius: (0, _DataUtils.getPercentValue)(outerRadius, maxRadius, maxRadius * 0.8),
composedData: _this3.getComposedData(child),
onMouseEnter: _this3.handleMouseEnter,
onMouseLeave: _this3.handleMouseLeave,
onClick: onClick
});
});
}
}, {
key: 'render',
value: function render() {
if (!(0, _ReactUtils.validateWidthHeight)(this)) {
return null;
}
var _props4 = this.props;
var style = _props4.style;
var children = _props4.children;
var className = _props4.className;
var width = _props4.width;
var height = _props4.height;
var others = _objectWithoutProperties(_props4, ['style', 'children', 'className', 'width', 'height']);
var items = (0, _ReactUtils.findAllByType)(children, _Pie2.default);
var attrs = (0, _ReactUtils.getPresentationAttributes)(others);
return _react2.default.createElement(
'div',
{
className: (0, _classnames2.default)('recharts-wrapper', className),
style: _extends({}, style, { position: 'relative', cursor: 'default', width: width, height: height })
},
_react2.default.createElement(
_Surface2.default,
_extends({}, attrs, { width: width, height: height }),
this.renderItems(items),
(0, _ReactUtils.filterSvgElements)(children)
),
this.renderLegend(items),
this.renderTooltip()
);
}
}]);
return PieChart;
}(_react.Component), _class2.displayName = 'PieChart', _class2.propTypes = {
width: _react.PropTypes.number,
height: _react.PropTypes.number,
margin: _react.PropTypes.shape({
top: _react.PropTypes.number,
right: _react.PropTypes.number,
bottom: _react.PropTypes.number,
left: _react.PropTypes.number
}),
title: _react.PropTypes.string,
style: _react.PropTypes.object,
children: _react.PropTypes.oneOfType([_react.PropTypes.arrayOf(_react.PropTypes.node), _react.PropTypes.node]),
className: _react.PropTypes.string,
onMouseEnter: _react.PropTypes.func,
onMouseLeave: _react.PropTypes.func,
onClick: _react.PropTypes.func
}, _class2.defaultProps = {
style: {},
margin: { top: 0, right: 0, bottom: 0, left: 0 }
}, _temp2)) || _class;
exports.default = PieChart; |
packages/material-ui-icons/src/ControlPointRounded.js | allanalexandre/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><g><path d="M12 7c-.55 0-1 .45-1 1v3H8c-.55 0-1 .45-1 1s.45 1 1 1h3v3c0 .55.45 1 1 1s1-.45 1-1v-3h3c.55 0 1-.45 1-1s-.45-1-1-1h-3V8c0-.55-.45-1-1-1zm0-5C6.49 2 2 6.49 2 12s4.49 10 10 10 10-4.49 10-10S17.51 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z" /></g></React.Fragment>
, 'ControlPointRounded');
|
server/sonar-web/src/main/js/apps/project-permissions/main.js | abbeyj/sonarqube | import $ from 'jquery';
import _ from 'underscore';
import React from 'react';
import Permissions from './permissions';
import PermissionsFooter from './permissions-footer';
import Search from './search';
import ApplyTemplateView from './apply-template-view';
const PERMISSIONS_ORDER = ['user', 'codeviewer', 'issueadmin', 'admin'];
export default React.createClass({
propTypes: {
permissionTemplates: React.PropTypes.arrayOf(React.PropTypes.object).isRequired
},
getInitialState() {
return { permissions: [], projects: [], total: 0 };
},
componentDidMount() {
this.requestPermissions();
},
sortPermissions(permissions) {
return _.sortBy(permissions, p => PERMISSIONS_ORDER.indexOf(p.key));
},
mergePermissionsToProjects(projects, basePermissions) {
return projects.map(project => {
// it's important to keep the order of the project permissions the same as the order of base permissions
let permissions = basePermissions.map(basePermission => {
let projectPermission = _.findWhere(project.permissions, { key: basePermission.key });
return _.extend({ usersCount: 0, groupsCount: 0 }, basePermission, projectPermission);
});
return _.extend({}, project, { permissions: permissions });
});
},
requestPermissions(page = 1, query = '') {
let url = `${window.baseUrl}/api/permissions/search_project_permissions`;
let data = { p: page, q: query };
if (this.props.componentId) {
data = { projectId: this.props.componentId };
}
$.get(url, data).done(r => {
let permissions = this.sortPermissions(r.permissions);
let projects = this.mergePermissionsToProjects(r.projects, permissions);
if (page > 1) {
projects = [].concat(this.state.projects, projects);
}
this.setState({
projects: projects,
permissions: permissions,
total: r.paging.total,
page: r.paging.pageIndex,
query: query
});
});
},
loadMore() {
this.requestPermissions(this.state.page + 1, this.state.query);
},
search(query) {
this.requestPermissions(1, query);
},
refresh() {
this.requestPermissions(1, this.state.query);
},
bulkApplyTemplate(e) {
e.preventDefault();
new ApplyTemplateView({
projects: this.state.projects,
permissionTemplates: this.props.permissionTemplates,
refresh: this.requestPermissions
}).render();
},
renderBulkApplyButton() {
if (this.props.componentId) {
return null;
}
return (
<button onClick={this.bulkApplyTemplate} className="js-bulk-apply-template">Bulk Apply Template</button>
);
},
render() {
return (
<div className="page">
<header id="project-permissions-header" className="page-header">
<h1 className="page-title">{window.t('roles.page')}</h1>
<div className="page-actions">
{this.renderBulkApplyButton()}
</div>
<p className="page-description">{window.t('roles.page.description2')}</p>
</header>
<Search {...this.props}
search={this.search}/>
<Permissions
projects={this.state.projects}
permissions={this.state.permissions}
permissionTemplates={this.props.permissionTemplates}
refresh={this.refresh}/>
<PermissionsFooter {...this.props}
count={this.state.projects.length}
total={this.state.total}
loadMore={this.loadMore}/>
</div>
);
}
});
|
node_modules/bower/lib/node_modules/rx-lite/rx.lite.js | bdhoff/angular-playground | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (undefined) {
var objectTypes = {
'function': true,
'object': true
};
var
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeSelf = objectTypes[typeof self] && self.Object && self,
freeWindow = objectTypes[typeof window] && window && window.Object && window,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
var root = root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
var Rx = {
internals: {},
config: {
Promise: root.Promise
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
identity = Rx.helpers.identity = function (x) { return x; },
defaultNow = Rx.helpers.defaultNow = Date.now,
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; },
isFunction = Rx.helpers.isFunction = (function () {
var isFn = function (value) {
return typeof value == 'function' || false;
}
// fallback for older versions of Chrome and Safari
if (isFn(/x/)) {
isFn = function(value) {
return typeof value == 'function' && toString.call(value) == '[object Function]';
};
}
return isFn;
}());
function cloneArray(arr) {
var len = arr.length, a = new Array(len);
for(var i = 0; i < len; i++) { a[i] = arr[i]; }
return a;
}
var errorObj = {e: {}};
function tryCatcherGen(tryCatchTarget) {
return function tryCatcher() {
try {
return tryCatchTarget.apply(this, arguments);
} catch (e) {
errorObj.e = e;
return errorObj;
}
}
}
var tryCatch = Rx.internals.tryCatch = function tryCatch(fn) {
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
return tryCatcherGen(fn);
}
function thrower(e) {
throw e;
}
Rx.config.longStackSupport = false;
var hasStacks = false, stacks = tryCatch(function () { throw new Error(); })();
hasStacks = !!stacks.e && !!stacks.e.stack;
// All code after this point will be filtered from stack traces reported by RxJS
var rStartingLine = captureLine(), rFileName;
var STACK_JUMP_SEPARATOR = 'From previous event:';
function makeStackTraceLong(error, observable) {
// If possible, transform the error stack trace by removing Node and RxJS
// cruft, then concatenating with the stack trace of `observable`.
if (hasStacks &&
observable.stack &&
typeof error === 'object' &&
error !== null &&
error.stack &&
error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
) {
var stacks = [];
for (var o = observable; !!o; o = o.source) {
if (o.stack) {
stacks.unshift(o.stack);
}
}
stacks.unshift(error.stack);
var concatedStacks = stacks.join('\n' + STACK_JUMP_SEPARATOR + '\n');
error.stack = filterStackString(concatedStacks);
}
}
function filterStackString(stackString) {
var lines = stackString.split('\n'), desiredLines = [];
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i];
if (!isInternalFrame(line) && !isNodeFrame(line) && line) {
desiredLines.push(line);
}
}
return desiredLines.join('\n');
}
function isInternalFrame(stackLine) {
var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
if (!fileNameAndLineNumber) {
return false;
}
var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];
return fileName === rFileName &&
lineNumber >= rStartingLine &&
lineNumber <= rEndingLine;
}
function isNodeFrame(stackLine) {
return stackLine.indexOf('(module.js:') !== -1 ||
stackLine.indexOf('(node.js:') !== -1;
}
function captureLine() {
if (!hasStacks) { return; }
try {
throw new Error();
} catch (e) {
var lines = e.stack.split('\n');
var firstLine = lines[0].indexOf('@') > 0 ? lines[1] : lines[2];
var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
if (!fileNameAndLineNumber) { return; }
rFileName = fileNameAndLineNumber[0];
return fileNameAndLineNumber[1];
}
}
function getFileNameAndLineNumber(stackLine) {
// Named functions: 'at functionName (filename:lineNumber:columnNumber)'
var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
if (attempt1) { return [attempt1[1], Number(attempt1[2])]; }
// Anonymous functions: 'at filename:lineNumber:columnNumber'
var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
if (attempt2) { return [attempt2[1], Number(attempt2[2])]; }
// Firefox style: 'function@filename:lineNumber or @filename:lineNumber'
var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
if (attempt3) { return [attempt3[1], Number(attempt3[2])]; }
}
var EmptyError = Rx.EmptyError = function() {
this.message = 'Sequence contains no elements.';
this.name = 'EmptyError';
Error.call(this);
};
EmptyError.prototype = Object.create(Error.prototype);
var ObjectDisposedError = Rx.ObjectDisposedError = function() {
this.message = 'Object has been disposed';
this.name = 'ObjectDisposedError';
Error.call(this);
};
ObjectDisposedError.prototype = Object.create(Error.prototype);
var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () {
this.message = 'Argument out of range';
this.name = 'ArgumentOutOfRangeError';
Error.call(this);
};
ArgumentOutOfRangeError.prototype = Object.create(Error.prototype);
var NotSupportedError = Rx.NotSupportedError = function (message) {
this.message = message || 'This operation is not supported';
this.name = 'NotSupportedError';
Error.call(this);
};
NotSupportedError.prototype = Object.create(Error.prototype);
var NotImplementedError = Rx.NotImplementedError = function (message) {
this.message = message || 'This operation is not implemented';
this.name = 'NotImplementedError';
Error.call(this);
};
NotImplementedError.prototype = Object.create(Error.prototype);
var notImplemented = Rx.helpers.notImplemented = function () {
throw new NotImplementedError();
};
var notSupported = Rx.helpers.notSupported = function () {
throw new NotSupportedError();
};
// Shim in iterator support
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
'_es6shim_iterator_';
// Bug for mozilla version
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
$iterator$ = '@@iterator';
}
var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined };
var isIterable = Rx.helpers.isIterable = function (o) {
return o[$iterator$] !== undefined;
}
var isArrayLike = Rx.helpers.isArrayLike = function (o) {
return o && o.length !== undefined;
}
Rx.helpers.iterator = $iterator$;
var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) {
if (typeof thisArg === 'undefined') { return func; }
switch(argCount) {
case 0:
return function() {
return func.call(thisArg)
};
case 1:
return function(arg) {
return func.call(thisArg, arg);
}
case 2:
return function(value, index) {
return func.call(thisArg, value, index);
};
case 3:
return function(value, index, collection) {
return func.call(thisArg, value, index, collection);
};
}
return function() {
return func.apply(thisArg, arguments);
};
};
/** Used to determine if values are of the language type Object */
var dontEnums = ['toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'],
dontEnumsLength = dontEnums.length;
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
errorClass = '[object Error]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
var toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
supportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
stringProto = String.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch (e) {
supportNodeClass = true;
}
var nonEnumProps = {};
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
nonEnumProps[objectClass] = { 'constructor': true };
var support = {};
(function () {
var ctor = function() { this.x = 1; },
props = [];
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var key in new ctor) { props.push(key); }
for (key in arguments) { }
// Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
// Detect if `prototype` properties are enumerable by default.
support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
// Detect if `arguments` object indexes are non-enumerable
support.nonEnumArgs = key != 0;
// Detect if properties shadowing those on `Object.prototype` are non-enumerable.
support.nonEnumShadows = !/valueOf/.test(props);
}(1));
var isObject = Rx.internals.isObject = function(value) {
var type = typeof value;
return value && (type == 'function' || type == 'object') || false;
};
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
}
if (support.nonEnumArgs && object.length && isArguments(object)) {
object = slice.call(object);
}
var skipProto = support.enumPrototypes && typeof object == 'function',
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name'))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var ctor = object.constructor,
index = -1,
length = dontEnumsLength;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
nonEnum = nonEnumProps[className];
}
while (++index < length) {
key = dontEnums[index];
if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
result.push(key);
}
}
}
return result;
}
function internalFor(object, callback, keysFunc) {
var index = -1,
props = keysFunc(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
}
function internalForIn(object, callback) {
return internalFor(object, callback, keysIn);
}
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
var isArguments = function(value) {
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
}
// fallback for browsers that can't detect `arguments` objects by [[Class]]
if (!supportsArgsClass) {
isArguments = function(value) {
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
};
}
var isEqual = Rx.internals.isEqual = function (x, y) {
return deepEquals(x, y, [], []);
};
/** @private
* Used for deep comparison
**/
function deepEquals(a, b, stackA, stackB) {
// exit early for identical values
if (a === b) {
// treat `+0` vs. `-0` as not equal
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
// exit early for unlike primitive values
if (a === a && (a == null || b == null ||
(type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) {
return false;
}
// compare [[Class]] names
var className = toString.call(a),
otherClass = toString.call(b);
if (className == argsClass) {
className = objectClass;
}
if (otherClass == argsClass) {
otherClass = objectClass;
}
if (className != otherClass) {
return false;
}
switch (className) {
case boolClass:
case dateClass:
// coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
return +a == +b;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (a != +a) ?
b != +b :
// but treat `-0` vs. `+0` as not equal
(a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass:
case stringClass:
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and their corresponding object instances as equal
return a == String(b);
}
var isArr = className == arrayClass;
if (!isArr) {
// exit for functions and DOM nodes
if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
return false;
}
// in older versions of Opera, `arguments` objects have `Array` constructors
var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
// non `Object` object instances with different constructors are not equal
if (ctorA != ctorB &&
!(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) &&
!(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
('constructor' in a && 'constructor' in b)
) {
return false;
}
}
// assume cyclic structures are equal
// the algorithm for detecting cyclic structures is adapted from ES 5.1
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
var initedStack = !stackA;
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == a) {
return stackB[length] == b;
}
}
var size = 0;
var result = true;
// add `a` and `b` to the stack of traversed objects
stackA.push(a);
stackB.push(b);
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
// compare lengths to determine if a deep comparison is necessary
length = a.length;
size = b.length;
result = size == length;
if (result) {
// deep compare the contents, ignoring non-numeric properties
while (size--) {
var index = length,
value = b[size];
if (!(result = deepEquals(a[size], value, stackA, stackB))) {
break;
}
}
}
}
else {
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
// which, in this case, is more costly
internalForIn(b, function(value, key, b) {
if (hasOwnProperty.call(b, key)) {
// count the number of properties.
size++;
// deep compare each property value.
return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB));
}
});
if (result) {
// ensure both objects have the same number of properties
internalForIn(a, function(value, key, a) {
if (hasOwnProperty.call(a, key)) {
// `size` will be `-1` if `a` has more properties than `b`
return (result = --size > -1);
}
});
}
}
stackA.pop();
stackB.pop();
return result;
}
var hasProp = {}.hasOwnProperty,
slice = Array.prototype.slice;
var inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
var addProperties = Rx.internals.addProperties = function (obj) {
for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
for (var idx = 0, ln = sources.length; idx < ln; idx++) {
var source = sources[idx];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
var args = [], i, len;
if (Array.isArray(arguments[0])) {
args = arguments[0];
len = args.length;
} else {
len = arguments.length;
args = new Array(len);
for(i = 0; i < len; i++) { args[i] = arguments[i]; }
}
for(i = 0; i < len; i++) {
if (!isDisposable(args[i])) { throw new TypeError('Not a disposable'); }
}
this.disposables = args;
this.isDisposed = false;
this.length = args.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var len = this.disposables.length, currentDisposables = new Array(len);
for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; }
this.disposables = [];
this.length = 0;
for (i = 0; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Provides a set of static methods for creating Disposables.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
/** Performs the task of cleaning up resources. */
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
/**
* Validates whether the given object is a disposable
* @param {Object} Object to test whether it has a dispose method
* @returns {Boolean} true if a disposable object, else false.
*/
var isDisposable = Disposable.isDisposable = function (d) {
return d && isFunction(d.dispose);
};
var checkDisposed = Disposable.checkDisposed = function (disposable) {
if (disposable.isDisposed) { throw new ObjectDisposedError(); }
};
// Single assignment
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () {
this.isDisposed = false;
this.current = null;
};
SingleAssignmentDisposable.prototype.getDisposable = function () {
return this.current;
};
SingleAssignmentDisposable.prototype.setDisposable = function (value) {
if (this.current) { throw new Error('Disposable has already been assigned'); }
var shouldDispose = this.isDisposed;
!shouldDispose && (this.current = value);
shouldDispose && value && value.dispose();
};
SingleAssignmentDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var old = this.current;
this.current = null;
}
old && old.dispose();
};
// Multiple assignment disposable
var SerialDisposable = Rx.SerialDisposable = function () {
this.isDisposed = false;
this.current = null;
};
SerialDisposable.prototype.getDisposable = function () {
return this.current;
};
SerialDisposable.prototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed;
if (!shouldDispose) {
var old = this.current;
this.current = value;
}
old && old.dispose();
shouldDispose && value && value.dispose();
};
SerialDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var old = this.current;
this.current = null;
}
old && old.dispose();
};
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed && !this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed && !this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
ScheduledItem.prototype.invoke = function () {
this.disposable.setDisposable(this.invokeCore());
};
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
/** Determines whether the given object is a scheduler */
Scheduler.isScheduler = function (s) {
return s instanceof Scheduler;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
timeSpan < 0 && (timeSpan = 0);
return timeSpan;
};
return Scheduler;
}());
var normalizeTime = Scheduler.normalize, isScheduler = Scheduler.isScheduler;
(function (schedulerProto) {
function invokeRecImmediate(scheduler, pair) {
var state = pair[0], action = pair[1], group = new CompositeDisposable();
action(state, innerAction);
return group;
function innerAction(state2) {
var isAdded = false, isDone = false;
var d = scheduler.scheduleWithState(state2, scheduleWork);
if (!isDone) {
group.add(d);
isAdded = true;
}
function scheduleWork(_, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
action(state3, innerAction);
return disposableEmpty;
}
}
}
function invokeRecDate(scheduler, pair, method) {
var state = pair[0], action = pair[1], group = new CompositeDisposable();
action(state, innerAction);
return group;
function innerAction(state2, dueTime1) {
var isAdded = false, isDone = false;
var d = scheduler[method](state2, dueTime1, scheduleWork);
if (!isDone) {
group.add(d);
isAdded = true;
}
function scheduleWork(_, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
action(state3, innerAction);
return disposableEmpty;
}
}
}
function invokeRecDateRelative(s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
}
function invokeRecDateAbsolute(s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
}
function scheduleInnerRecursive(action, self) {
action(function(dt) { self(action, dt); });
}
/**
* Schedules an action to be executed recursively.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState([state, action], invokeRecImmediate);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative([state, action], dueTime, invokeRecDateRelative);
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute([state, action], dueTime, invokeRecDateAbsolute);
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, action);
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) {
if (typeof root.setInterval === 'undefined') { throw new NotSupportedError(); }
period = normalizeTime(period);
var s = state, id = root.setInterval(function () { s = action(s); }, period);
return disposableCreate(function () { root.clearInterval(id); });
};
}(Scheduler.prototype));
/** Gets a scheduler that schedules work immediately on the current thread. */
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) { return action(this, state); }
return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function runTrampoline () {
while (queue.length > 0) {
var item = queue.shift();
!item.isCancelled() && item.invoke();
}
}
function scheduleNow(state, action) {
var si = new ScheduledItem(this, state, action, this.now());
if (!queue) {
queue = [si];
var result = tryCatch(runTrampoline)();
queue = null;
if (result === errorObj) { return thrower(result.e); }
} else {
queue.push(si);
}
return si.disposable;
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
currentScheduler.scheduleRequired = function () { return !queue; };
return currentScheduler;
}());
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
function SchedulePeriodicRecursive(scheduler, state, period, action) {
this._scheduler = scheduler;
this._state = state;
this._period = period;
this._action = action;
}
SchedulePeriodicRecursive.prototype.start = function () {
var d = new SingleAssignmentDisposable();
this._cancel = d;
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
return d;
};
return SchedulePeriodicRecursive;
}());
var scheduleMethod, clearMethod;
var localTimer = (function () {
var localSetTimeout, localClearTimeout = noop;
if (!!root.setTimeout) {
localSetTimeout = root.setTimeout;
localClearTimeout = root.clearTimeout;
} else if (!!root.WScript) {
localSetTimeout = function (fn, time) {
root.WScript.Sleep(time);
fn();
};
} else {
throw new NotSupportedError();
}
return {
setTimeout: localSetTimeout,
clearTimeout: localClearTimeout
};
}());
var localSetTimeout = localTimer.setTimeout,
localClearTimeout = localTimer.clearTimeout;
(function () {
var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false;
clearMethod = function (handle) {
delete tasksByHandle[handle];
};
function runTask(handle) {
if (currentlyRunning) {
localSetTimeout(function () { runTask(handle) }, 0);
} else {
var task = tasksByHandle[handle];
if (task) {
currentlyRunning = true;
var result = tryCatch(task)();
clearMethod(handle);
currentlyRunning = false;
if (result === errorObj) { return thrower(result.e); }
}
}
}
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate;
function postMessageSupported () {
// Ensure not in a worker
if (!root.postMessage || root.importScripts) { return false; }
var isAsync = false, oldHandler = root.onmessage;
// Test for async
root.onmessage = function () { isAsync = true; };
root.postMessage('', '*');
root.onmessage = oldHandler;
return isAsync;
}
// Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout
if (isFunction(setImmediate)) {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
setImmediate(function () { runTask(id); });
return id;
};
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
process.nextTick(function () { runTask(id); });
return id;
};
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random();
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
runTask(event.data.substring(MSG_PREFIX.length));
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else if (root.attachEvent) {
root.attachEvent('onmessage', onGlobalPostMessage);
} else {
root.onmessage = onGlobalPostMessage;
}
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
return id;
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel();
channel.port1.onmessage = function (e) { runTask(e.data); };
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
channel.port2.postMessage(id);
return id;
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
var id = nextHandle++;
tasksByHandle[id] = action;
scriptElement.onreadystatechange = function () {
runTask(id);
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
return id;
};
} else {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
localSetTimeout(function () {
runTask(id);
}, 0);
return id;
};
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = Scheduler['default'] = (function () {
function scheduleNow(state, action) {
var scheduler = this, disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
!disposable.isDisposed && disposable.setDisposable(action(scheduler, state));
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this, dt = Scheduler.normalize(dueTime), disposable = new SingleAssignmentDisposable();
if (dt === 0) { return scheduler.scheduleWithState(state, action); }
var id = localSetTimeout(function () {
!disposable.isDisposed && disposable.setDisposable(action(scheduler, state));
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
localClearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, value, exception, accept, acceptObservable, toString) {
this.kind = kind;
this.value = value;
this.exception = exception;
this._accept = accept;
this._acceptObservable = acceptObservable;
this.toString = toString;
}
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
return observerOrOnNext && typeof observerOrOnNext === 'object' ?
this._acceptObservable(observerOrOnNext) :
this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notifications
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
Notification.prototype.toObservable = function (scheduler) {
var self = this;
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithState(self, function (_, notification) {
notification._acceptObservable(observer);
notification.kind === 'N' && observer.onCompleted();
});
});
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept(onNext) { return onNext(this.value); }
function _acceptObservable(observer) { return observer.onNext(this.value); }
function toString() { return 'OnNext(' + this.value + ')'; }
return function (value) {
return new Notification('N', value, null, _accept, _acceptObservable, toString);
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) { return onError(this.exception); }
function _acceptObservable(observer) { return observer.onError(this.exception); }
function toString () { return 'OnError(' + this.exception + ')'; }
return function (e) {
return new Notification('E', null, e, _accept, _acceptObservable, toString);
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) { return onCompleted(); }
function _acceptObservable(observer) { return observer.onCompleted(); }
function toString () { return 'OnCompleted()'; }
return function () {
return new Notification('C', null, null, _accept, _acceptObservable, toString);
};
}());
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {
inherits(AbstractObserver, __super__);
/**
* Creates a new observer in a non-stopped state.
*/
function AbstractObserver() {
this.isStopped = false;
}
// Must be implemented by other observers
AbstractObserver.prototype.next = notImplemented;
AbstractObserver.prototype.error = notImplemented;
AbstractObserver.prototype.completed = notImplemented;
/**
* Notifies the observer of a new element in the sequence.
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
!this.isStopped && this.next(value);
};
/**
* Notifies the observer that an exception has occurred.
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () { this.isStopped = true; };
AbstractObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.error(e);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) {
inherits(AnonymousObserver, __super__);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
__super__.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
* @param {Any} error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (error) {
this._onError(error);
};
/**
* Calls the onCompleted action.
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
function makeSubscribe(self, subscribe) {
return function (o) {
var oldOnError = o.onError;
o.onError = function (e) {
makeStackTraceLong(e, self);
oldOnError.call(o, e);
};
return subscribe.call(self, o);
};
}
function Observable(subscribe) {
if (Rx.config.longStackSupport && hasStacks) {
var e = tryCatch(thrower)(new Error()).e;
this.stack = e.stack.substring(e.stack.indexOf('\n') + 1);
this._subscribe = makeSubscribe(this, subscribe);
} else {
this._subscribe = subscribe;
}
}
observableProto = Observable.prototype;
/**
* Determines whether the given object is an Observable
* @param {Any} An object to determine whether it is an Observable
* @returns {Boolean} true if an Observable, else false.
*/
Observable.isObservable = function (o) {
return o && isFunction(o.subscribe);
}
/**
* Subscribes an o to the observable sequence.
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribe = observableProto.forEach = function (oOrOnNext, onError, onCompleted) {
return this._subscribe(typeof oOrOnNext === 'object' ?
oOrOnNext :
observerCreate(oOrOnNext, onError, onCompleted));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnNext = function (onNext, thisArg) {
return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { onNext.call(thisArg, x); } : onNext));
};
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnError = function (onError, thisArg) {
return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { onError.call(thisArg, e); } : onError));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {
return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { onCompleted.call(thisArg); } : onCompleted));
};
return Observable;
})();
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) {
inherits(ScheduledObserver, __super__);
function ScheduledObserver(scheduler, observer) {
__super__.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () { self.observer.onNext(value); });
};
ScheduledObserver.prototype.error = function (e) {
var self = this;
this.queue.push(function () { self.observer.onError(e); });
};
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () { self.observer.onCompleted(); });
};
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursiveWithState(this, function (parent, self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
var res = tryCatch(work)();
if (res === errorObj) {
parent.queue = [];
parent.hasFaulted = true;
return thrower(res.e);
}
self(parent);
}));
}
};
ScheduledObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
var ObservableBase = Rx.ObservableBase = (function (__super__) {
inherits(ObservableBase, __super__);
function fixSubscriber(subscriber) {
return subscriber && isFunction(subscriber.dispose) ? subscriber :
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
}
function setDisposable(s, state) {
var ado = state[0], self = state[1];
var sub = tryCatch(self.subscribeCore).call(self, ado);
if (sub === errorObj) {
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
}
ado.setDisposable(fixSubscriber(sub));
}
function subscribe(observer) {
var ado = new AutoDetachObserver(observer), state = [ado, this];
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.scheduleWithState(state, setDisposable);
} else {
setDisposable(null, state);
}
return ado;
}
function ObservableBase() {
__super__.call(this, subscribe);
}
ObservableBase.prototype.subscribeCore = notImplemented;
return ObservableBase;
}(Observable));
var FlatMapObservable = (function(__super__){
inherits(FlatMapObservable, __super__);
function FlatMapObservable(source, selector, resultSelector, thisArg) {
this.resultSelector = Rx.helpers.isFunction(resultSelector) ?
resultSelector : null;
this.selector = Rx.internals.bindCallback(Rx.helpers.isFunction(selector) ? selector : function() { return selector; }, thisArg, 3);
this.source = source;
__super__.call(this);
}
FlatMapObservable.prototype.subscribeCore = function(o) {
return this.source.subscribe(new InnerObserver(o, this.selector, this.resultSelector, this));
};
function InnerObserver(observer, selector, resultSelector, source) {
this.i = 0;
this.selector = selector;
this.resultSelector = resultSelector;
this.source = source;
this.isStopped = false;
this.o = observer;
}
InnerObserver.prototype._wrapResult = function(result, x, i) {
return this.resultSelector ?
result.map(function(y, i2) { return this.resultSelector(x, y, i, i2); }, this) :
result;
};
InnerObserver.prototype.onNext = function(x) {
if (this.isStopped) return;
var i = this.i++;
var result = tryCatch(this.selector)(x, i, this.source);
if (result === errorObj) {
return this.o.onError(result.e);
}
Rx.helpers.isPromise(result) && (result = Rx.Observable.fromPromise(result));
(Rx.helpers.isArrayLike(result) || Rx.helpers.isIterable(result)) && (result = Rx.Observable.from(result));
this.o.onNext(this._wrapResult(result, x, i));
};
InnerObserver.prototype.onError = function(e) {
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
};
InnerObserver.prototype.onCompleted = function() {
if (!this.isStopped) {this.isStopped = true; this.o.onCompleted(); }
};
return FlatMapObservable;
}(ObservableBase));
var Enumerable = Rx.internals.Enumerable = function () { };
var ConcatEnumerableObservable = (function(__super__) {
inherits(ConcatEnumerableObservable, __super__);
function ConcatEnumerableObservable(sources) {
this.sources = sources;
__super__.call(this);
}
ConcatEnumerableObservable.prototype.subscribeCore = function (o) {
var isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursiveWithState(this.sources[$iterator$](), function (e, self) {
if (isDisposed) { return; }
var currentItem = tryCatch(e.next).call(e);
if (currentItem === errorObj) { return o.onError(currentItem.e); }
if (currentItem.done) {
return o.onCompleted();
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(new InnerObserver(o, self, e)));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
};
function InnerObserver(o, s, e) {
this.o = o;
this.s = s;
this.e = e;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.o.onNext(x); } };
InnerObserver.prototype.onError = function (err) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(err);
}
};
InnerObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.s(this.e);
}
};
InnerObserver.prototype.dispose = function () { this.isStopped = true; };
InnerObserver.prototype.fail = function (err) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(err);
return true;
}
return false;
};
return ConcatEnumerableObservable;
}(ObservableBase));
Enumerable.prototype.concat = function () {
return new ConcatEnumerableObservable(this);
};
var CatchErrorObservable = (function(__super__) {
inherits(CatchErrorObservable, __super__);
function CatchErrorObservable(sources) {
this.sources = sources;
__super__.call(this);
}
CatchErrorObservable.prototype.subscribeCore = function (o) {
var e = this.sources[$iterator$]();
var isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) {
if (isDisposed) { return; }
var currentItem = tryCatch(e.next).call(e);
if (currentItem === errorObj) { return o.onError(currentItem.e); }
if (currentItem.done) {
return lastException !== null ? o.onError(lastException) : o.onCompleted();
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
self,
function() { o.onCompleted(); }));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
};
return CatchErrorObservable;
}(ObservableBase));
Enumerable.prototype.catchError = function () {
return new CatchErrorObservable(this);
};
Enumerable.prototype.catchErrorWhen = function (notificationHandler) {
var sources = this;
return new AnonymousObservable(function (o) {
var exceptions = new Subject(),
notifier = new Subject(),
handled = notificationHandler(exceptions),
notificationDisposable = handled.subscribe(notifier);
var e = sources[$iterator$]();
var isDisposed,
lastException,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
var currentItem = tryCatch(e.next).call(e);
if (currentItem === errorObj) { return o.onError(currentItem.e); }
if (currentItem.done) {
if (lastException) {
o.onError(lastException);
} else {
o.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var outer = new SingleAssignmentDisposable();
var inner = new SingleAssignmentDisposable();
subscription.setDisposable(new CompositeDisposable(inner, outer));
outer.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
function (exn) {
inner.setDisposable(notifier.subscribe(self, function(ex) {
o.onError(ex);
}, function() {
o.onCompleted();
}));
exceptions.onNext(exn);
},
function() { o.onCompleted(); }));
});
return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
var RepeatEnumerable = (function (__super__) {
inherits(RepeatEnumerable, __super__);
function RepeatEnumerable(v, c) {
this.v = v;
this.c = c == null ? -1 : c;
}
RepeatEnumerable.prototype[$iterator$] = function () {
return new RepeatEnumerator(this);
};
function RepeatEnumerator(p) {
this.v = p.v;
this.l = p.c;
}
RepeatEnumerator.prototype.next = function () {
if (this.l === 0) { return doneEnumerator; }
if (this.l > 0) { this.l--; }
return { done: false, value: this.v };
};
return RepeatEnumerable;
}(Enumerable));
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
return new RepeatEnumerable(value, repeatCount);
};
var OfEnumerable = (function(__super__) {
inherits(OfEnumerable, __super__);
function OfEnumerable(s, fn, thisArg) {
this.s = s;
this.fn = fn ? bindCallback(fn, thisArg, 3) : null;
}
OfEnumerable.prototype[$iterator$] = function () {
return new OfEnumerator(this);
};
function OfEnumerator(p) {
this.i = -1;
this.s = p.s;
this.l = this.s.length;
this.fn = p.fn;
}
OfEnumerator.prototype.next = function () {
return ++this.i < this.l ?
{ done: false, value: !this.fn ? this.s[this.i] : this.fn(this.s[this.i], this.i, this.s) } :
doneEnumerator;
};
return OfEnumerable;
}(Enumerable));
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
return new OfEnumerable(source, selector, thisArg);
};
var ToArrayObservable = (function(__super__) {
inherits(ToArrayObservable, __super__);
function ToArrayObservable(source) {
this.source = source;
__super__.call(this);
}
ToArrayObservable.prototype.subscribeCore = function(o) {
return this.source.subscribe(new InnerObserver(o));
};
function InnerObserver(o) {
this.o = o;
this.a = [];
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.o.onNext(this.a);
this.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function () { this.isStopped = true; }
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return ToArrayObservable;
}(ObservableBase));
/**
* Creates an array from an observable sequence.
* @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
return new ToArrayObservable(this);
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
* @example
* var res = Rx.Observable.create(function (observer) { return function () { } );
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* var res = Rx.Observable.create(function (observer) { } );
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = function (subscribe, parent) {
return new AnonymousObservable(subscribe, parent);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
isPromise(result) && (result = observableFromPromise(result));
return result.subscribe(observer);
});
};
var EmptyObservable = (function(__super__) {
inherits(EmptyObservable, __super__);
function EmptyObservable(scheduler) {
this.scheduler = scheduler;
__super__.call(this);
}
EmptyObservable.prototype.subscribeCore = function (observer) {
var sink = new EmptySink(observer, this.scheduler);
return sink.run();
};
function EmptySink(observer, scheduler) {
this.observer = observer;
this.scheduler = scheduler;
}
function scheduleItem(s, state) {
state.onCompleted();
return disposableEmpty;
}
EmptySink.prototype.run = function () {
return this.scheduler.scheduleWithState(this.observer, scheduleItem);
};
return EmptyObservable;
}(ObservableBase));
var EMPTY_OBSERVABLE = new EmptyObservable(immediateScheduler);
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* var res = Rx.Observable.empty();
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return scheduler === immediateScheduler ? EMPTY_OBSERVABLE : new EmptyObservable(scheduler);
};
var FromObservable = (function(__super__) {
inherits(FromObservable, __super__);
function FromObservable(iterable, mapper, scheduler) {
this.iterable = iterable;
this.mapper = mapper;
this.scheduler = scheduler;
__super__.call(this);
}
FromObservable.prototype.subscribeCore = function (o) {
var sink = new FromSink(o, this);
return sink.run();
};
return FromObservable;
}(ObservableBase));
var FromSink = (function () {
function FromSink(o, parent) {
this.o = o;
this.parent = parent;
}
FromSink.prototype.run = function () {
var list = Object(this.parent.iterable),
it = getIterable(list),
o = this.o,
mapper = this.parent.mapper;
function loopRecursive(i, recurse) {
var next = tryCatch(it.next).call(it);
if (next === errorObj) { return o.onError(next.e); }
if (next.done) { return o.onCompleted(); }
var result = next.value;
if (isFunction(mapper)) {
result = tryCatch(mapper)(result, i);
if (result === errorObj) { return o.onError(result.e); }
}
o.onNext(result);
recurse(i + 1);
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
return FromSink;
}());
var maxSafeInteger = Math.pow(2, 53) - 1;
function StringIterable(s) {
this._s = s;
}
StringIterable.prototype[$iterator$] = function () {
return new StringIterator(this._s);
};
function StringIterator(s) {
this._s = s;
this._l = s.length;
this._i = 0;
}
StringIterator.prototype[$iterator$] = function () {
return this;
};
StringIterator.prototype.next = function () {
return this._i < this._l ? { done: false, value: this._s.charAt(this._i++) } : doneEnumerator;
};
function ArrayIterable(a) {
this._a = a;
}
ArrayIterable.prototype[$iterator$] = function () {
return new ArrayIterator(this._a);
};
function ArrayIterator(a) {
this._a = a;
this._l = toLength(a);
this._i = 0;
}
ArrayIterator.prototype[$iterator$] = function () {
return this;
};
ArrayIterator.prototype.next = function () {
return this._i < this._l ? { done: false, value: this._a[this._i++] } : doneEnumerator;
};
function numberIsFinite(value) {
return typeof value === 'number' && root.isFinite(value);
}
function isNan(n) {
return n !== n;
}
function getIterable(o) {
var i = o[$iterator$], it;
if (!i && typeof o === 'string') {
it = new StringIterable(o);
return it[$iterator$]();
}
if (!i && o.length !== undefined) {
it = new ArrayIterable(o);
return it[$iterator$]();
}
if (!i) { throw new TypeError('Object is not iterable'); }
return o[$iterator$]();
}
function sign(value) {
var number = +value;
if (number === 0) { return number; }
if (isNaN(number)) { return number; }
return number < 0 ? -1 : 1;
}
function toLength(o) {
var len = +o.length;
if (isNaN(len)) { return 0; }
if (len === 0 || !numberIsFinite(len)) { return len; }
len = sign(len) * Math.floor(Math.abs(len));
if (len <= 0) { return 0; }
if (len > maxSafeInteger) { return maxSafeInteger; }
return len;
}
/**
* This method creates a new Observable sequence from an array-like or iterable object.
* @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.
* @param {Function} [mapFn] Map function to call on every element of the array.
* @param {Any} [thisArg] The context to use calling the mapFn if provided.
* @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
*/
var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isFunction(mapFn)) {
throw new Error('mapFn when provided must be a function');
}
if (mapFn) {
var mapper = bindCallback(mapFn, thisArg, 2);
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromObservable(iterable, mapper, scheduler);
}
var FromArrayObservable = (function(__super__) {
inherits(FromArrayObservable, __super__);
function FromArrayObservable(args, scheduler) {
this.args = args;
this.scheduler = scheduler;
__super__.call(this);
}
FromArrayObservable.prototype.subscribeCore = function (observer) {
var sink = new FromArraySink(observer, this);
return sink.run();
};
return FromArrayObservable;
}(ObservableBase));
function FromArraySink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
FromArraySink.prototype.run = function () {
var observer = this.observer, args = this.parent.args, len = args.length;
function loopRecursive(i, recurse) {
if (i < len) {
observer.onNext(args[i]);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
* @deprecated use Observable.from or Observable.of
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromArrayObservable(array, scheduler)
};
var NeverObservable = (function(__super__) {
inherits(NeverObservable, __super__);
function NeverObservable() {
__super__.call(this);
}
NeverObservable.prototype.subscribeCore = function (observer) {
return disposableEmpty;
};
return NeverObservable;
}(ObservableBase));
var NEVER_OBSERVABLE = new NeverObservable();
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return NEVER_OBSERVABLE;
};
function observableOf (scheduler, array) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromArrayObservable(array, scheduler);
}
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.of = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new FromArrayObservable(args, currentThreadScheduler);
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.ofWithScheduler = function (scheduler) {
var len = arguments.length, args = new Array(len - 1);
for(var i = 1; i < len; i++) { args[i - 1] = arguments[i]; }
return new FromArrayObservable(args, scheduler);
};
var PairsObservable = (function(__super__) {
inherits(PairsObservable, __super__);
function PairsObservable(obj, scheduler) {
this.obj = obj;
this.keys = Object.keys(obj);
this.scheduler = scheduler;
__super__.call(this);
}
PairsObservable.prototype.subscribeCore = function (observer) {
var sink = new PairsSink(observer, this);
return sink.run();
};
return PairsObservable;
}(ObservableBase));
function PairsSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
PairsSink.prototype.run = function () {
var observer = this.observer, obj = this.parent.obj, keys = this.parent.keys, len = keys.length;
function loopRecursive(i, recurse) {
if (i < len) {
var key = keys[i];
observer.onNext([key, obj[key]]);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
/**
* Convert an object into an observable sequence of [key, value] pairs.
* @param {Object} obj The object to inspect.
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} An observable sequence of [key, value] pairs from the object.
*/
Observable.pairs = function (obj, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new PairsObservable(obj, scheduler);
};
var RangeObservable = (function(__super__) {
inherits(RangeObservable, __super__);
function RangeObservable(start, count, scheduler) {
this.start = start;
this.rangeCount = count;
this.scheduler = scheduler;
__super__.call(this);
}
RangeObservable.prototype.subscribeCore = function (observer) {
var sink = new RangeSink(observer, this);
return sink.run();
};
return RangeObservable;
}(ObservableBase));
var RangeSink = (function () {
function RangeSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
RangeSink.prototype.run = function () {
var start = this.parent.start, count = this.parent.rangeCount, observer = this.observer;
function loopRecursive(i, recurse) {
if (i < count) {
observer.onNext(start + i);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
return RangeSink;
}());
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new RangeObservable(start, count, scheduler);
};
var RepeatObservable = (function(__super__) {
inherits(RepeatObservable, __super__);
function RepeatObservable(value, repeatCount, scheduler) {
this.value = value;
this.repeatCount = repeatCount == null ? -1 : repeatCount;
this.scheduler = scheduler;
__super__.call(this);
}
RepeatObservable.prototype.subscribeCore = function (observer) {
var sink = new RepeatSink(observer, this);
return sink.run();
};
return RepeatObservable;
}(ObservableBase));
function RepeatSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
RepeatSink.prototype.run = function () {
var observer = this.observer, value = this.parent.value;
function loopRecursive(i, recurse) {
if (i === -1 || i > 0) {
observer.onNext(value);
i > 0 && i--;
}
if (i === 0) { return observer.onCompleted(); }
recurse(i);
}
return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount, loopRecursive);
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new RepeatObservable(value, repeatCount, scheduler);
};
var JustObservable = (function(__super__) {
inherits(JustObservable, __super__);
function JustObservable(value, scheduler) {
this.value = value;
this.scheduler = scheduler;
__super__.call(this);
}
JustObservable.prototype.subscribeCore = function (observer) {
var sink = new JustSink(observer, this.value, this.scheduler);
return sink.run();
};
function JustSink(observer, value, scheduler) {
this.observer = observer;
this.value = value;
this.scheduler = scheduler;
}
function scheduleItem(s, state) {
var value = state[0], observer = state[1];
observer.onNext(value);
observer.onCompleted();
return disposableEmpty;
}
JustSink.prototype.run = function () {
var state = [this.value, this.observer];
return this.scheduler === immediateScheduler ?
scheduleItem(null, state) :
this.scheduler.scheduleWithState(state, scheduleItem);
};
return JustObservable;
}(ObservableBase));
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'just' or browsers <IE9.
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new JustObservable(value, scheduler);
};
var ThrowObservable = (function(__super__) {
inherits(ThrowObservable, __super__);
function ThrowObservable(error, scheduler) {
this.error = error;
this.scheduler = scheduler;
__super__.call(this);
}
ThrowObservable.prototype.subscribeCore = function (o) {
var sink = new ThrowSink(o, this);
return sink.run();
};
function ThrowSink(o, p) {
this.o = o;
this.p = p;
}
function scheduleItem(s, state) {
var e = state[0], o = state[1];
o.onError(e);
}
ThrowSink.prototype.run = function () {
return this.p.scheduler.scheduleWithState([this.p.error, this.o], scheduleItem);
};
return ThrowObservable;
}(ObservableBase));
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwError' for browsers <IE9.
* @param {Mixed} error An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable['throw'] = function (error, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new ThrowObservable(error, scheduler);
};
var CatchObserver = (function(__super__) {
inherits(CatchObserver, __super__);
function CatchObserver(o, s, fn) {
this._o = o;
this._s = s;
this._fn = fn;
__super__.call(this);
}
CatchObserver.prototype.next = function (x) { this._o.onNext(x); };
CatchObserver.prototype.completed = function () { return this._o.onCompleted(); };
CatchObserver.prototype.error = function (e) {
var result = tryCatch(this._fn)(e);
if (result === errorObj) { return this._o.onError(result.e); }
isPromise(result) && (result = observableFromPromise(result));
var d = new SingleAssignmentDisposable();
this._s.setDisposable(d);
d.setDisposable(result.subscribe(this._o));
};
return CatchObserver;
}(AbstractObserver));
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (o) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(new CatchObserver(o, subscription, handler)));
return subscription;
}, source);
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto['catch'] = function (handlerOrSecond) {
return isFunction(handlerOrSecond) ? observableCatchHandler(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable['catch'] = function () {
var items;
if (Array.isArray(arguments[0])) {
items = arguments[0];
} else {
var len = arguments.length;
items = new Array(len);
for(var i = 0; i < len; i++) { items[i] = arguments[i]; }
}
return enumerableOf(items).catchError();
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
function falseFactory() { return false; }
function argumentsToArray() {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return args;
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;
Array.isArray(args[0]) && (args = args[0]);
return new AnonymousObservable(function (o) {
var n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
var res = resultSelector.apply(null, values);
} catch (e) {
return o.onError(e);
}
o.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
o.onCompleted();
}
}
function done (i) {
isDone[i] = true;
isDone.every(identity) && o.onCompleted();
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
values[i] = x;
next(i);
},
function(e) { o.onError(e); },
function () { done(i); }
));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
}, this);
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
args.unshift(this);
return observableConcat.apply(null, args);
};
var ConcatObservable = (function(__super__) {
inherits(ConcatObservable, __super__);
function ConcatObservable(sources) {
this.sources = sources;
__super__.call(this);
}
ConcatObservable.prototype.subscribeCore = function(o) {
var sink = new ConcatSink(this.sources, o);
return sink.run();
};
function ConcatSink(sources, o) {
this.sources = sources;
this.o = o;
}
ConcatSink.prototype.run = function () {
var isDisposed, subscription = new SerialDisposable(), sources = this.sources, length = sources.length, o = this.o;
var cancelable = immediateScheduler.scheduleRecursiveWithState(0, function (i, self) {
if (isDisposed) { return; }
if (i === length) {
return o.onCompleted();
}
// Check if promise
var currentValue = sources[i];
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
function (x) { o.onNext(x); },
function (e) { o.onError(e); },
function () { self(i + 1); }
));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
};
return ConcatObservable;
}(ObservableBase));
/**
* Concatenates all the observable sequences.
* @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
args = new Array(arguments.length);
for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; }
}
return new ConcatObservable(args);
};
/**
* Concatenates an observable sequence of observable sequences.
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatAll = function () {
return this.merge(1);
};
var MergeObservable = (function (__super__) {
inherits(MergeObservable, __super__);
function MergeObservable(source, maxConcurrent) {
this.source = source;
this.maxConcurrent = maxConcurrent;
__super__.call(this);
}
MergeObservable.prototype.subscribeCore = function(observer) {
var g = new CompositeDisposable();
g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g)));
return g;
};
return MergeObservable;
}(ObservableBase));
var MergeObserver = (function () {
function MergeObserver(o, max, g) {
this.o = o;
this.max = max;
this.g = g;
this.done = false;
this.q = [];
this.activeCount = 0;
this.isStopped = false;
}
MergeObserver.prototype.handleSubscribe = function (xs) {
var sad = new SingleAssignmentDisposable();
this.g.add(sad);
isPromise(xs) && (xs = observableFromPromise(xs));
sad.setDisposable(xs.subscribe(new InnerObserver(this, sad)));
};
MergeObserver.prototype.onNext = function (innerSource) {
if (this.isStopped) { return; }
if(this.activeCount < this.max) {
this.activeCount++;
this.handleSubscribe(innerSource);
} else {
this.q.push(innerSource);
}
};
MergeObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
MergeObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.done = true;
this.activeCount === 0 && this.o.onCompleted();
}
};
MergeObserver.prototype.dispose = function() { this.isStopped = true; };
MergeObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
function InnerObserver(parent, sad) {
this.parent = parent;
this.sad = sad;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.parent.o.onNext(x); } };
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
var parent = this.parent;
parent.g.remove(this.sad);
if (parent.q.length > 0) {
parent.handleSubscribe(parent.q.shift());
} else {
parent.activeCount--;
parent.done && parent.activeCount === 0 && parent.o.onCompleted();
}
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return MergeObserver;
}());
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
return typeof maxConcurrentOrOther !== 'number' ?
observableMerge(this, maxConcurrentOrOther) :
new MergeObservable(this, maxConcurrentOrOther);
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources = [], i, len = arguments.length;
if (!arguments[0]) {
scheduler = immediateScheduler;
for(i = 1; i < len; i++) { sources.push(arguments[i]); }
} else if (isScheduler(arguments[0])) {
scheduler = arguments[0];
for(i = 1; i < len; i++) { sources.push(arguments[i]); }
} else {
scheduler = immediateScheduler;
for(i = 0; i < len; i++) { sources.push(arguments[i]); }
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableOf(scheduler, sources).mergeAll();
};
var CompositeError = Rx.CompositeError = function(errors) {
this.name = "NotImplementedError";
this.innerErrors = errors;
this.message = 'This contains multiple errors. Check the innerErrors';
Error.call(this);
}
CompositeError.prototype = Error.prototype;
/**
* Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to
* receive all successfully emitted items from all of the source Observables without being interrupted by
* an error notification from one of them.
*
* This behaves like Observable.prototype.mergeAll except that if any of the merged Observables notify of an
* error via the Observer's onError, mergeDelayError will refrain from propagating that
* error notification until all of the merged Observables have finished emitting items.
* @param {Array | Arguments} args Arguments or an array to merge.
* @returns {Observable} an Observable that emits all of the items emitted by the Observables emitted by the Observable
*/
Observable.mergeDelayError = function() {
var args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
var len = arguments.length;
args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
}
var source = observableOf(null, args);
return new AnonymousObservable(function (o) {
var group = new CompositeDisposable(),
m = new SingleAssignmentDisposable(),
isStopped = false,
errors = [];
function setCompletion() {
if (errors.length === 0) {
o.onCompleted();
} else if (errors.length === 1) {
o.onError(errors[0]);
} else {
o.onError(new CompositeError(errors));
}
}
group.add(m);
m.setDisposable(source.subscribe(
function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
// Check for promises support
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(
function (x) { o.onNext(x); },
function (e) {
errors.push(e);
group.remove(innerSubscription);
isStopped && group.length === 1 && setCompletion();
},
function () {
group.remove(innerSubscription);
isStopped && group.length === 1 && setCompletion();
}));
},
function (e) {
errors.push(e);
isStopped = true;
group.length === 1 && setCompletion();
},
function () {
isStopped = true;
group.length === 1 && setCompletion();
}));
return group;
});
};
var MergeAllObservable = (function (__super__) {
inherits(MergeAllObservable, __super__);
function MergeAllObservable(source) {
this.source = source;
__super__.call(this);
}
MergeAllObservable.prototype.subscribeCore = function (observer) {
var g = new CompositeDisposable(), m = new SingleAssignmentDisposable();
g.add(m);
m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g)));
return g;
};
function MergeAllObserver(o, g) {
this.o = o;
this.g = g;
this.isStopped = false;
this.done = false;
}
MergeAllObserver.prototype.onNext = function(innerSource) {
if(this.isStopped) { return; }
var sad = new SingleAssignmentDisposable();
this.g.add(sad);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
sad.setDisposable(innerSource.subscribe(new InnerObserver(this, sad)));
};
MergeAllObserver.prototype.onError = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
MergeAllObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
this.done = true;
this.g.length === 1 && this.o.onCompleted();
}
};
MergeAllObserver.prototype.dispose = function() { this.isStopped = true; };
MergeAllObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
function InnerObserver(parent, sad) {
this.parent = parent;
this.sad = sad;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if (!this.isStopped) { this.parent.o.onNext(x); } };
InnerObserver.prototype.onError = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
var parent = this.parent;
this.isStopped = true;
parent.g.remove(this.sad);
parent.done && parent.g.length === 1 && parent.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return MergeAllObservable;
}(ObservableBase));
/**
* Merges an observable sequence of observable sequences into an observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeAll = function () {
return new MergeAllObservable(this);
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (o) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
isOpen && o.onNext(left);
}, function (e) { o.onError(e); }, function () {
isOpen && o.onCompleted();
}));
isPromise(other) && (other = observableFromPromise(other));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, function (e) { o.onError(e); }, function () {
rightSubscription.dispose();
}));
return disposables;
}, source);
};
var SwitchObservable = (function(__super__) {
inherits(SwitchObservable, __super__);
function SwitchObservable(source) {
this.source = source;
__super__.call(this);
}
SwitchObservable.prototype.subscribeCore = function (o) {
var inner = new SerialDisposable(), s = this.source.subscribe(new SwitchObserver(o, inner));
return new CompositeDisposable(s, inner);
};
function SwitchObserver(o, inner) {
this.o = o;
this.inner = inner;
this.stopped = false;
this.latest = 0;
this.hasLatest = false;
this.isStopped = false;
}
SwitchObserver.prototype.onNext = function (innerSource) {
if (this.isStopped) { return; }
var d = new SingleAssignmentDisposable(), id = ++this.latest;
this.hasLatest = true;
this.inner.setDisposable(d);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
d.setDisposable(innerSource.subscribe(new InnerObserver(this, id)));
};
SwitchObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
SwitchObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.stopped = true;
!this.hasLatest && this.o.onCompleted();
}
};
SwitchObserver.prototype.dispose = function () { this.isStopped = true; };
SwitchObserver.prototype.fail = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
function InnerObserver(parent, id) {
this.parent = parent;
this.id = id;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
this.parent.latest === this.id && this.parent.o.onNext(x);
};
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.latest === this.id && this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
if (this.parent.latest === this.id) {
this.parent.hasLatest = false;
this.parent.isStopped && this.parent.o.onCompleted();
}
}
};
InnerObserver.prototype.dispose = function () { this.isStopped = true; }
InnerObserver.prototype.fail = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return SwitchObservable;
}(ObservableBase));
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto['switch'] = observableProto.switchLatest = function () {
return new SwitchObservable(this);
};
var TakeUntilObservable = (function(__super__) {
inherits(TakeUntilObservable, __super__);
function TakeUntilObservable(source, other) {
this.source = source;
this.other = isPromise(other) ? observableFromPromise(other) : other;
__super__.call(this);
}
TakeUntilObservable.prototype.subscribeCore = function(o) {
return new CompositeDisposable(
this.source.subscribe(o),
this.other.subscribe(new InnerObserver(o))
);
};
function InnerObserver(o) {
this.o = o;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
this.o.onCompleted();
};
InnerObserver.prototype.onError = function (err) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(err);
}
};
InnerObserver.prototype.onCompleted = function () {
!this.isStopped && (this.isStopped = true);
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return TakeUntilObservable;
}(ObservableBase));
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
return new TakeUntilObservable(this, other);
};
function falseFactory() { return false; }
/**
* Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.withLatestFrom = function () {
var len = arguments.length, args = new Array(len)
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = args.pop(), source = this;
Array.isArray(args[0]) && (args = args[0]);
return new AnonymousObservable(function (observer) {
var n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
values = new Array(n);
var subscriptions = new Array(n + 1);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var other = args[i], sad = new SingleAssignmentDisposable();
isPromise(other) && (other = observableFromPromise(other));
sad.setDisposable(other.subscribe(function (x) {
values[i] = x;
hasValue[i] = true;
hasValueAll = hasValue.every(identity);
}, function (e) { observer.onError(e); }, noop));
subscriptions[i] = sad;
}(idx));
}
var sad = new SingleAssignmentDisposable();
sad.setDisposable(source.subscribe(function (x) {
var allValues = [x].concat(values);
if (!hasValueAll) { return; }
var res = tryCatch(resultSelector).apply(null, allValues);
if (res === errorObj) { return observer.onError(res.e); }
observer.onNext(res);
}, function (e) { observer.onError(e); }, function () {
observer.onCompleted();
}));
subscriptions[n] = sad;
return new CompositeDisposable(subscriptions);
}, this);
};
function falseFactory() { return false; }
function emptyArrayFactory() { return []; }
function argumentsToArray() {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return args;
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.
* @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.
*/
observableProto.zip = function () {
if (arguments.length === 0) { throw new Error('invalid arguments'); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;
Array.isArray(args[0]) && (args = args[0]);
var parent = this;
args.unshift(parent);
return new AnonymousObservable(function (o) {
var n = args.length,
queues = arrayInitialize(n, emptyArrayFactory),
isDone = arrayInitialize(n, falseFactory);
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
if (queues.every(function (x) { return x.length > 0; })) {
var queuedValues = queues.map(function (x) { return x.shift(); }),
res = tryCatch(resultSelector).apply(parent, queuedValues);
if (res === errorObj) { return o.onError(res.e); }
o.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
o.onCompleted();
}
}, function (e) { o.onError(e); }, function () {
isDone[i] = true;
isDone.every(identity) && o.onCompleted();
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
}, parent);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
* @param arguments Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
if (Array.isArray(args[0])) {
args = isFunction(args[1]) ? args[0].concat(args[1]) : args[0];
}
var first = args.shift();
return first.zip.apply(first, args);
};
function falseFactory() { return false; }
function emptyArrayFactory() { return []; }
function argumentsToArray() {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return args;
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.
* @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.
*/
observableProto.zipIterable = function () {
if (arguments.length === 0) { throw new Error('invalid arguments'); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;
var parent = this;
args.unshift(parent);
return new AnonymousObservable(function (o) {
var n = args.length,
queues = arrayInitialize(n, emptyArrayFactory),
isDone = arrayInitialize(n, falseFactory);
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
(isArrayLike(source) || isIterable(source)) && (source = observableFrom(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
if (queues.every(function (x) { return x.length > 0; })) {
var queuedValues = queues.map(function (x) { return x.shift(); }),
res = tryCatch(resultSelector).apply(parent, queuedValues);
if (res === errorObj) { return o.onError(res.e); }
o.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
o.onCompleted();
}
}, function (e) { o.onError(e); }, function () {
isDone[i] = true;
isDone.every(identity) && o.onCompleted();
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
}, parent);
};
function asObservable(source) {
return function subscribe(o) { return source.subscribe(o); };
}
/**
* Hides the identity of an observable sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
return new AnonymousObservable(asObservable(this), this);
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (o) {
return source.subscribe(function (x) { return x.accept(o); }, function(e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
var DistinctUntilChangedObservable = (function(__super__) {
inherits(DistinctUntilChangedObservable, __super__);
function DistinctUntilChangedObservable(source, keyFn, comparer) {
this.source = source;
this.keyFn = keyFn;
this.comparer = comparer;
__super__.call(this);
}
DistinctUntilChangedObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new DistinctUntilChangedObserver(o, this.keyFn, this.comparer));
};
return DistinctUntilChangedObservable;
}(ObservableBase));
var DistinctUntilChangedObserver = (function(__super__) {
inherits(DistinctUntilChangedObserver, __super__);
function DistinctUntilChangedObserver(o, keyFn, comparer) {
this.o = o;
this.keyFn = keyFn;
this.comparer = comparer;
this.hasCurrentKey = false;
this.currentKey = null;
__super__.call(this);
}
DistinctUntilChangedObserver.prototype.next = function (x) {
var key = x, comparerEquals;
if (isFunction(this.keyFn)) {
key = tryCatch(this.keyFn)(x);
if (key === errorObj) { return this.o.onError(key.e); }
}
if (this.hasCurrentKey) {
comparerEquals = tryCatch(this.comparer)(this.currentKey, key);
if (comparerEquals === errorObj) { return this.o.onError(comparerEquals.e); }
}
if (!this.hasCurrentKey || !comparerEquals) {
this.hasCurrentKey = true;
this.currentKey = key;
this.o.onNext(x);
}
};
DistinctUntilChangedObserver.prototype.error = function(e) {
this.o.onError(e);
};
DistinctUntilChangedObserver.prototype.completed = function () {
this.o.onCompleted();
};
return DistinctUntilChangedObserver;
}(AbstractObserver));
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keyFn and the comparer.
* @param {Function} [keyFn] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keyFn, comparer) {
comparer || (comparer = defaultComparer);
return new DistinctUntilChangedObservable(this, keyFn, comparer);
};
var TapObservable = (function(__super__) {
inherits(TapObservable,__super__);
function TapObservable(source, observerOrOnNext, onError, onCompleted) {
this.source = source;
this._oN = observerOrOnNext;
this._oE = onError;
this._oC = onCompleted;
__super__.call(this);
}
TapObservable.prototype.subscribeCore = function(o) {
return this.source.subscribe(new InnerObserver(o, this));
};
function InnerObserver(o, p) {
this.o = o;
this.t = !p._oN || isFunction(p._oN) ?
observerCreate(p._oN || noop, p._oE || noop, p._oC || noop) :
p._oN;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var res = tryCatch(this.t.onNext).call(this.t, x);
if (res === errorObj) { this.o.onError(res.e); }
this.o.onNext(x);
};
InnerObserver.prototype.onError = function(err) {
if (!this.isStopped) {
this.isStopped = true;
var res = tryCatch(this.t.onError).call(this.t, err);
if (res === errorObj) { return this.o.onError(res.e); }
this.o.onError(err);
}
};
InnerObserver.prototype.onCompleted = function() {
if (!this.isStopped) {
this.isStopped = true;
var res = tryCatch(this.t.onCompleted).call(this.t);
if (res === errorObj) { return this.o.onError(res.e); }
this.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return TapObservable;
}(ObservableBase));
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an o.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
return new TapObservable(this, observerOrOnNext, onError, onCompleted);
};
/**
* Invokes an action for each element in the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onNext Action to invoke for each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {
return this.tap(typeof thisArg !== 'undefined' ? function (x) { onNext.call(thisArg, x); } : onNext);
};
/**
* Invokes an action upon exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {
return this.tap(noop, typeof thisArg !== 'undefined' ? function (e) { onError.call(thisArg, e); } : onError);
};
/**
* Invokes an action upon graceful termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {
return this.tap(noop, null, typeof thisArg !== 'undefined' ? function () { onCompleted.call(thisArg); } : onCompleted);
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto['finally'] = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription = tryCatch(source.subscribe).call(source, observer);
if (subscription === errorObj) {
action();
return thrower(subscription.e);
}
return disposableCreate(function () {
var r = tryCatch(subscription.dispose).call(subscription);
action();
r === errorObj && thrower(r.e);
});
}, this);
};
var IgnoreElementsObservable = (function(__super__) {
inherits(IgnoreElementsObservable, __super__);
function IgnoreElementsObservable(source) {
this.source = source;
__super__.call(this);
}
IgnoreElementsObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new InnerObserver(o));
};
function InnerObserver(o) {
this.o = o;
this.isStopped = false;
}
InnerObserver.prototype.onNext = noop;
InnerObserver.prototype.onError = function (err) {
if(!this.isStopped) {
this.isStopped = true;
this.o.onError(err);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
this.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
return IgnoreElementsObservable;
}(ObservableBase));
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
return new IgnoreElementsObservable(this);
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (e) {
observer.onNext(notificationCreateOnError(e));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
}, source);
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
* Note if you encounter an error and want it to retry once, then you must use .retry(2);
*
* @example
* var res = retried = retry.repeat();
* var res = retried = retry.repeat(2);
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchError();
};
/**
* Repeats the source observable sequence upon error each time the notifier emits or until it successfully terminates.
* if the notifier completes, the observable sequence completes.
*
* @example
* var timer = Observable.timer(500);
* var source = observable.retryWhen(timer);
* @param {Observable} [notifier] An observable that triggers the retries or completes the observable with onNext or onCompleted respectively.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retryWhen = function (notifier) {
return enumerableRepeat(this).catchErrorWhen(notifier);
};
var ScanObservable = (function(__super__) {
inherits(ScanObservable, __super__);
function ScanObservable(source, accumulator, hasSeed, seed) {
this.source = source;
this.accumulator = accumulator;
this.hasSeed = hasSeed;
this.seed = seed;
__super__.call(this);
}
ScanObservable.prototype.subscribeCore = function(o) {
return this.source.subscribe(new InnerObserver(o,this));
};
return ScanObservable;
}(ObservableBase));
function InnerObserver(o, parent) {
this.o = o;
this.accumulator = parent.accumulator;
this.hasSeed = parent.hasSeed;
this.seed = parent.seed;
this.hasAccumulation = false;
this.accumulation = null;
this.hasValue = false;
this.isStopped = false;
}
InnerObserver.prototype = {
onNext: function (x) {
if (this.isStopped) { return; }
!this.hasValue && (this.hasValue = true);
if (this.hasAccumulation) {
this.accumulation = tryCatch(this.accumulator)(this.accumulation, x);
} else {
this.accumulation = this.hasSeed ? tryCatch(this.accumulator)(this.seed, x) : x;
this.hasAccumulation = true;
}
if (this.accumulation === errorObj) { return this.o.onError(this.accumulation.e); }
this.o.onNext(this.accumulation);
},
onError: function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
},
onCompleted: function () {
if (!this.isStopped) {
this.isStopped = true;
!this.hasValue && this.hasSeed && this.o.onNext(this.seed);
this.o.onCompleted();
}
},
dispose: function() { this.isStopped = true; },
fail: function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
}
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var hasSeed = false, seed, accumulator = arguments[0];
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[1];
}
return new ScanObservable(this, accumulator, hasSeed, seed);
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
* @description
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && o.onNext(q.shift());
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
* @example
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
* @param {Arguments} args The specified values to prepend to the observable sequence
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && isScheduler(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
for(var args = [], i = start, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
return enumerableOf([observableFromArray(args, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence.
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, function (e) { o.onError(e); }, function () {
while (q.length > 0) { o.onNext(q.shift()); }
o.onCompleted();
});
}, source);
};
observableProto.flatMapConcat = observableProto.concatMap = function(selector, resultSelector, thisArg) {
return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(1);
};
var MapObservable = (function (__super__) {
inherits(MapObservable, __super__);
function MapObservable(source, selector, thisArg) {
this.source = source;
this.selector = bindCallback(selector, thisArg, 3);
__super__.call(this);
}
function innerMap(selector, self) {
return function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); }
}
MapObservable.prototype.internalMap = function (selector, thisArg) {
return new MapObservable(this.source, innerMap(selector, this), thisArg);
};
MapObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new InnerObserver(o, this.selector, this));
};
function InnerObserver(o, selector, source) {
this.o = o;
this.selector = selector;
this.source = source;
this.i = 0;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var result = tryCatch(this.selector)(x, this.i++, this.source);
if (result === errorObj) { return this.o.onError(result.e); }
this.o.onNext(result);
};
InnerObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return MapObservable;
}(ObservableBase));
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.map = observableProto.select = function (selector, thisArg) {
var selectorFn = typeof selector === 'function' ? selector : function () { return selector; };
return this instanceof MapObservable ?
this.internalMap(selectorFn, thisArg) :
new MapObservable(this, selectorFn, thisArg);
};
function plucker(args, len) {
return function mapper(x) {
var currentProp = x;
for (var i = 0; i < len; i++) {
var p = currentProp[args[i]];
if (typeof p !== 'undefined') {
currentProp = p;
} else {
return undefined;
}
}
return currentProp;
}
}
/**
* Retrieves the value of a specified nested property from all elements in
* the Observable sequence.
* @param {Arguments} arguments The nested properties to pluck.
* @returns {Observable} Returns a new Observable sequence of property values.
*/
observableProto.pluck = function () {
var len = arguments.length, args = new Array(len);
if (len === 0) { throw new Error('List of properties cannot be empty.'); }
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return this.map(plucker(args, len));
};
observableProto.flatMap = observableProto.selectMany = function(selector, resultSelector, thisArg) {
return new FlatMapObservable(this, selector, resultSelector, thisArg).mergeAll();
};
//
//Rx.Observable.prototype.flatMapWithMaxConcurrent = function(limit, selector, resultSelector, thisArg) {
// return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(limit);
//};
//
Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisArg) {
return new FlatMapObservable(this, selector, resultSelector, thisArg).switchLatest();
};
var SkipObservable = (function(__super__) {
inherits(SkipObservable, __super__);
function SkipObservable(source, count) {
this.source = source;
this.skipCount = count;
__super__.call(this);
}
SkipObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new InnerObserver(o, this.skipCount));
};
function InnerObserver(o, c) {
this.c = c;
this.r = c;
this.o = o;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
if (this.r <= 0) {
this.o.onNext(x);
} else {
this.r--;
}
};
InnerObserver.prototype.onError = function(e) {
if (!this.isStopped) { this.isStopped = true; this.o.onError(e); }
};
InnerObserver.prototype.onCompleted = function() {
if (!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function(e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return SkipObservable;
}(ObservableBase));
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
return new SkipObservable(this, count);
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* var res = source.skipWhile(function (value) { return value < 10; });
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate, thisArg) {
var source = this,
callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !callback(x, i++, source);
} catch (e) {
o.onError(e);
return;
}
}
running && o.onNext(x);
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* var res = source.take(5);
* var res = source.take(0, Rx.Scheduler.timeout);
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
if (count === 0) { return observableEmpty(scheduler); }
var source = this;
return new AnonymousObservable(function (o) {
var remaining = count;
return source.subscribe(function (x) {
if (remaining-- > 0) {
o.onNext(x);
remaining <= 0 && o.onCompleted();
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var source = this,
callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0, running = true;
return source.subscribe(function (x) {
if (running) {
try {
running = callback(x, i++, source);
} catch (e) {
o.onError(e);
return;
}
if (running) {
o.onNext(x);
} else {
o.onCompleted();
}
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
var FilterObservable = (function (__super__) {
inherits(FilterObservable, __super__);
function FilterObservable(source, predicate, thisArg) {
this.source = source;
this.predicate = bindCallback(predicate, thisArg, 3);
__super__.call(this);
}
FilterObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new InnerObserver(o, this.predicate, this));
};
function innerPredicate(predicate, self) {
return function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); }
}
FilterObservable.prototype.internalFilter = function(predicate, thisArg) {
return new FilterObservable(this.source, innerPredicate(predicate, this), thisArg);
};
function InnerObserver(o, predicate, source) {
this.o = o;
this.predicate = predicate;
this.source = source;
this.i = 0;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var shouldYield = tryCatch(this.predicate)(x, this.i++, this.source);
if (shouldYield === errorObj) {
return this.o.onError(shouldYield.e);
}
shouldYield && this.o.onNext(x);
};
InnerObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return FilterObservable;
}(ObservableBase));
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.filter = observableProto.where = function (predicate, thisArg) {
return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) :
new FilterObservable(this, predicate, thisArg);
};
function createCbObservable(fn, ctx, selector, args) {
var o = new AsyncSubject();
args.push(createCbHandler(o, ctx, selector));
fn.apply(ctx, args);
return o.asObservable();
}
function createCbHandler(o, ctx, selector) {
return function handler () {
var len = arguments.length, results = new Array(len);
for(var i = 0; i < len; i++) { results[i] = arguments[i]; }
if (isFunction(selector)) {
results = tryCatch(selector).apply(ctx, results);
if (results === errorObj) { return o.onError(results.e); }
o.onNext(results);
} else {
if (results.length <= 1) {
o.onNext(results[0]);
} else {
o.onNext(results);
}
}
o.onCompleted();
};
}
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} fn Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [ctx] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
Observable.fromCallback = function (fn, ctx, selector) {
return function () {
typeof ctx === 'undefined' && (ctx = this);
var len = arguments.length, args = new Array(len)
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return createCbObservable(fn, ctx, selector, args);
};
};
function createNodeObservable(fn, ctx, selector, args) {
var o = new AsyncSubject();
args.push(createNodeHandler(o, ctx, selector));
fn.apply(ctx, args);
return o.asObservable();
}
function createNodeHandler(o, ctx, selector) {
return function handler () {
var err = arguments[0];
if (err) { return o.onError(err); }
var len = arguments.length, results = [];
for(var i = 1; i < len; i++) { results[i - 1] = arguments[i]; }
if (isFunction(selector)) {
var results = tryCatch(selector).apply(ctx, results);
if (results === errorObj) { return o.onError(results.e); }
o.onNext(results);
} else {
if (results.length <= 1) {
o.onNext(results[0]);
} else {
o.onNext(results);
}
}
o.onCompleted();
};
}
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} fn The function to call
* @param {Mixed} [ctx] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
Observable.fromNodeCallback = function (fn, ctx, selector) {
return function () {
typeof ctx === 'undefined' && (ctx = this);
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return createNodeObservable(fn, ctx, selector, args);
};
};
function ListenDisposable(e, n, fn) {
this._e = e;
this._n = n;
this._fn = fn;
this._e.addEventListener(this._n, this._fn, false);
this.isDisposed = false;
}
ListenDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this._e.removeEventListener(this._n, this._fn, false);
this.isDisposed = true;
}
};
function createEventListener (el, eventName, handler) {
var disposables = new CompositeDisposable();
// Asume NodeList or HTMLCollection
var elemToString = Object.prototype.toString.call(el);
if (elemToString === '[object NodeList]' || elemToString === '[object HTMLCollection]') {
for (var i = 0, len = el.length; i < len; i++) {
disposables.add(createEventListener(el.item(i), eventName, handler));
}
} else if (el) {
disposables.add(new ListenDisposable(el, eventName, handler));
}
return disposables;
}
/**
* Configuration option to determine whether to use native events only
*/
Rx.config.useNativeEvents = false;
function eventHandler(o, selector) {
return function handler () {
var results = arguments[0];
if (isFunction(selector)) {
results = tryCatch(selector).apply(null, arguments);
if (results === errorObj) { return o.onError(results.e); }
}
o.onNext(results);
};
}
/**
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
* @param {Object} element The DOMElement or NodeList to attach a listener.
* @param {String} eventName The event name to attach the observable sequence.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
*/
Observable.fromEvent = function (element, eventName, selector) {
// Node.js specific
if (element.addListener) {
return fromEventPattern(
function (h) { element.addListener(eventName, h); },
function (h) { element.removeListener(eventName, h); },
selector);
}
// Use only if non-native events are allowed
if (!Rx.config.useNativeEvents) {
// Handles jq, Angular.js, Zepto, Marionette, Ember.js
if (typeof element.on === 'function' && typeof element.off === 'function') {
return fromEventPattern(
function (h) { element.on(eventName, h); },
function (h) { element.off(eventName, h); },
selector);
}
}
return new AnonymousObservable(function (o) {
return createEventListener(
element,
eventName,
eventHandler(o, selector));
}).publish().refCount();
};
/**
* Creates an observable sequence from an event emitter via an addHandler/removeHandler pair.
* @param {Function} addHandler The function to add a handler to the emitter.
* @param {Function} [removeHandler] The optional function to remove a handler from an emitter.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @param {Scheduler} [scheduler] A scheduler used to schedule the remove handler.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (o) {
function innerHandler () {
var result = arguments[0];
if (isFunction(selector)) {
result = tryCatch(selector).apply(null, arguments);
if (result === errorObj) { return o.onError(result.e); }
}
o.onNext(result);
}
var returnValue = addHandler(innerHandler);
return disposableCreate(function () {
isFunction(removeHandler) && removeHandler(innerHandler, returnValue);
});
}).publish().refCount();
};
var FromPromiseObservable = (function(__super__) {
inherits(FromPromiseObservable, __super__);
function FromPromiseObservable(p) {
this.p = p;
__super__.call(this);
}
FromPromiseObservable.prototype.subscribeCore = function(o) {
this.p.then(function (data) {
o.onNext(data);
o.onCompleted();
}, function (err) { o.onError(err); });
return disposableEmpty;
};
return FromPromiseObservable;
}(ObservableBase));
/**
* Converts a Promise to an Observable sequence
* @param {Promise} An ES6 Compliant promise.
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
*/
var observableFromPromise = Observable.fromPromise = function (promise) {
return new FromPromiseObservable(promise);
};
/*
* Converts an existing observable sequence to an ES6 Compatible Promise
* @example
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
*
* // With config
* Rx.config.Promise = RSVP.Promise;
* var promise = Rx.Observable.return(42).toPromise();
* @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.
* @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.
*/
observableProto.toPromise = function (promiseCtor) {
promiseCtor || (promiseCtor = Rx.config.Promise);
if (!promiseCtor) { throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); }
var source = this;
return new promiseCtor(function (resolve, reject) {
// No cancellation can be done
var value, hasValue = false;
source.subscribe(function (v) {
value = v;
hasValue = true;
}, reject, function () {
hasValue && resolve(value);
});
});
};
/**
* Invokes the asynchronous function, surfacing the result through an observable sequence.
* @param {Function} functionAsync Asynchronous function which returns a Promise to run.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*/
Observable.startAsync = function (functionAsync) {
var promise;
try {
promise = functionAsync();
} catch (e) {
return observableThrow(e);
}
return observableFromPromise(promise);
}
/**
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
* subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
* invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param {Function|Subject} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
* Or:
* Subject to push source elements into.
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.multicast = function (subjectOrSubjectSelector, selector) {
var source = this;
return typeof subjectOrSubjectSelector === 'function' ?
new AnonymousObservable(function (observer) {
var connectable = source.multicast(subjectOrSubjectSelector());
return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect());
}, source) :
new ConnectableObservable(source, subjectOrSubjectSelector);
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of Multicast using a regular Subject.
*
* @example
* var resres = source.publish();
* var res = source.publish(function (x) { return x; });
*
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publish = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new Subject(); }, selector) :
this.multicast(new Subject());
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.share = function () {
return this.publish().refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
* This operator is a specialization of Multicast using a AsyncSubject.
*
* @example
* var res = source.publishLast();
* var res = source.publishLast(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishLast = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new AsyncSubject(); }, selector) :
this.multicast(new AsyncSubject());
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
* This operator is a specialization of Multicast using a BehaviorSubject.
*
* @example
* var res = source.publishValue(42);
* var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishValue = function (initialValueOrSelector, initialValue) {
return arguments.length === 2 ?
this.multicast(function () {
return new BehaviorSubject(initialValue);
}, initialValueOrSelector) :
this.multicast(new BehaviorSubject(initialValueOrSelector));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareValue = function (initialValue) {
return this.publishValue(initialValue).refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of Multicast using a ReplaySubject.
*
* @example
* var res = source.replay(null, 3);
* var res = source.replay(null, 3, 500);
* var res = source.replay(null, 3, 500, scheduler);
* var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param windowSize [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.replay = function (selector, bufferSize, windowSize, scheduler) {
return selector && isFunction(selector) ?
this.multicast(function () { return new ReplaySubject(bufferSize, windowSize, scheduler); }, selector) :
this.multicast(new ReplaySubject(bufferSize, windowSize, scheduler));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareReplay(3);
* var res = source.shareReplay(3, 500);
* var res = source.shareReplay(3, 500, scheduler);
*
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareReplay = function (bufferSize, windowSize, scheduler) {
return this.replay(null, bufferSize, windowSize, scheduler).refCount();
};
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
inherits(ConnectableObservable, __super__);
function ConnectableObservable(source, subject) {
var hasSubscription = false,
subscription,
sourceObservable = source.asObservable();
this.connect = function () {
if (!hasSubscription) {
hasSubscription = true;
subscription = new CompositeDisposable(sourceObservable.subscribe(subject), disposableCreate(function () {
hasSubscription = false;
}));
}
return subscription;
};
__super__.call(this, function (o) { return subject.subscribe(o); });
}
ConnectableObservable.prototype.refCount = function () {
var connectableSubscription, count = 0, source = this;
return new AnonymousObservable(function (observer) {
var shouldConnect = ++count === 1,
subscription = source.subscribe(observer);
shouldConnect && (connectableSubscription = source.connect());
return function () {
subscription.dispose();
--count === 0 && connectableSubscription.dispose();
};
});
};
return ConnectableObservable;
}(Observable));
function observableTimerDate(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithAbsolute(dueTime, function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerDateAndPeriod(dueTime, period, scheduler) {
return new AnonymousObservable(function (observer) {
var d = dueTime, p = normalizeTime(period);
return scheduler.scheduleRecursiveWithAbsoluteAndState(0, d, function (count, self) {
if (p > 0) {
var now = scheduler.now();
d = d + p;
d <= now && (d = now + p);
}
observer.onNext(count);
self(count + 1, d);
});
});
}
function observableTimerTimeSpan(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithRelative(normalizeTime(dueTime), function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) {
return dueTime === period ?
new AnonymousObservable(function (observer) {
return scheduler.schedulePeriodicWithState(0, period, function (count) {
observer.onNext(count);
return count + 1;
});
}) :
observableDefer(function () {
return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler);
});
}
/**
* Returns an observable sequence that produces a value after each period.
*
* @example
* 1 - res = Rx.Observable.interval(1000);
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
*
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @returns {Observable} An observable sequence that produces a value after each period.
*/
var observableinterval = Observable.interval = function (period, scheduler) {
return observableTimerTimeSpanAndPeriod(period, period, isScheduler(scheduler) ? scheduler : timeoutScheduler);
};
/**
* Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/
var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {
var period;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (periodOrScheduler != null && typeof periodOrScheduler === 'number') {
period = periodOrScheduler;
} else if (isScheduler(periodOrScheduler)) {
scheduler = periodOrScheduler;
}
if (dueTime instanceof Date && period === undefined) {
return observableTimerDate(dueTime.getTime(), scheduler);
}
if (dueTime instanceof Date && period !== undefined) {
return observableTimerDateAndPeriod(dueTime.getTime(), periodOrScheduler, scheduler);
}
return period === undefined ?
observableTimerTimeSpan(dueTime, scheduler) :
observableTimerTimeSpanAndPeriod(dueTime, period, scheduler);
};
function observableDelayRelative(source, dueTime, scheduler) {
return new AnonymousObservable(function (o) {
var active = false,
cancelable = new SerialDisposable(),
exception = null,
q = [],
running = false,
subscription;
subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) {
var d, shouldRun;
if (notification.value.kind === 'E') {
q = [];
q.push(notification);
exception = notification.value.exception;
shouldRun = !running;
} else {
q.push({ value: notification.value, timestamp: notification.timestamp + dueTime });
shouldRun = !active;
active = true;
}
if (shouldRun) {
if (exception !== null) {
o.onError(exception);
} else {
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleRecursiveWithRelative(dueTime, function (self) {
var e, recurseDueTime, result, shouldRecurse;
if (exception !== null) {
return;
}
running = true;
do {
result = null;
if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) {
result = q.shift().value;
}
if (result !== null) {
result.accept(o);
}
} while (result !== null);
shouldRecurse = false;
recurseDueTime = 0;
if (q.length > 0) {
shouldRecurse = true;
recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now());
} else {
active = false;
}
e = exception;
running = false;
if (e !== null) {
o.onError(e);
} else if (shouldRecurse) {
self(recurseDueTime);
}
}));
}
}
});
return new CompositeDisposable(subscription, cancelable);
}, source);
}
function observableDelayAbsolute(source, dueTime, scheduler) {
return observableDefer(function () {
return observableDelayRelative(source, dueTime - scheduler.now(), scheduler);
});
}
function delayWithSelector(source, subscriptionDelay, delayDurationSelector) {
var subDelay, selector;
if (isFunction(subscriptionDelay)) {
selector = subscriptionDelay;
} else {
subDelay = subscriptionDelay;
selector = delayDurationSelector;
}
return new AnonymousObservable(function (o) {
var delays = new CompositeDisposable(), atEnd = false, subscription = new SerialDisposable();
function start() {
subscription.setDisposable(source.subscribe(
function (x) {
var delay = tryCatch(selector)(x);
if (delay === errorObj) { return o.onError(delay.e); }
var d = new SingleAssignmentDisposable();
delays.add(d);
d.setDisposable(delay.subscribe(
function () {
o.onNext(x);
delays.remove(d);
done();
},
function (e) { o.onError(e); },
function () {
o.onNext(x);
delays.remove(d);
done();
}
));
},
function (e) { o.onError(e); },
function () {
atEnd = true;
subscription.dispose();
done();
}
));
}
function done () {
atEnd && delays.length === 0 && o.onCompleted();
}
if (!subDelay) {
start();
} else {
subscription.setDisposable(subDelay.subscribe(start, function (e) { o.onError(e); }, start));
}
return new CompositeDisposable(subscription, delays);
}, this);
}
/**
* Time shifts the observable sequence by dueTime.
* The relative time intervals between the values are preserved.
*
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delay = function () {
if (typeof arguments[0] === 'number' || arguments[0] instanceof Date) {
var dueTime = arguments[0], scheduler = arguments[1];
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return dueTime instanceof Date ?
observableDelayAbsolute(this, dueTime, scheduler) :
observableDelayRelative(this, dueTime, scheduler);
} else if (isFunction(arguments[0])) {
return delayWithSelector(this, arguments[0], arguments[1]);
} else {
throw new Error('Invalid arguments');
}
};
function debounce(source, dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var cancelable = new SerialDisposable(), hasvalue = false, value, id = 0;
var subscription = source.subscribe(
function (x) {
hasvalue = true;
value = x;
id++;
var currentId = id,
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleWithRelative(dueTime, function () {
hasvalue && id === currentId && observer.onNext(value);
hasvalue = false;
}));
},
function (e) {
cancelable.dispose();
observer.onError(e);
hasvalue = false;
id++;
},
function () {
cancelable.dispose();
hasvalue && observer.onNext(value);
observer.onCompleted();
hasvalue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
}, this);
}
function debounceWithSelector(source, durationSelector) {
return new AnonymousObservable(function (o) {
var value, hasValue = false, cancelable = new SerialDisposable(), id = 0;
var subscription = source.subscribe(
function (x) {
var throttle = tryCatch(durationSelector)(x);
if (throttle === errorObj) { return o.onError(throttle.e); }
isPromise(throttle) && (throttle = observableFromPromise(throttle));
hasValue = true;
value = x;
id++;
var currentid = id, d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(throttle.subscribe(
function () {
hasValue && id === currentid && o.onNext(value);
hasValue = false;
d.dispose();
},
function (e) { o.onError(e); },
function () {
hasValue && id === currentid && o.onNext(value);
hasValue = false;
d.dispose();
}
));
},
function (e) {
cancelable.dispose();
o.onError(e);
hasValue = false;
id++;
},
function () {
cancelable.dispose();
hasValue && o.onNext(value);
o.onCompleted();
hasValue = false;
id++;
}
);
return new CompositeDisposable(subscription, cancelable);
}, source);
}
observableProto.debounce = function () {
if (isFunction (arguments[0])) {
return debounceWithSelector(this, arguments[0]);
} else if (typeof arguments[0] === 'number') {
return debounce(this, arguments[0], arguments[1]);
} else {
throw new Error('Invalid arguments');
}
};
/**
* Records the timestamp for each value in an observable sequence.
*
* @example
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
* 2 - res = source.timestamp(Rx.Scheduler.default);
*
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the default scheduler is used.
* @returns {Observable} An observable sequence with timestamp information on values.
*/
observableProto.timestamp = function (scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return this.map(function (x) {
return { value: x, timestamp: scheduler.now() };
});
};
function sampleObservable(source, sampler) {
return new AnonymousObservable(function (o) {
var atEnd = false, value, hasValue = false;
function sampleSubscribe() {
if (hasValue) {
hasValue = false;
o.onNext(value);
}
atEnd && o.onCompleted();
}
var sourceSubscription = new SingleAssignmentDisposable();
sourceSubscription.setDisposable(source.subscribe(
function (newValue) {
hasValue = true;
value = newValue;
},
function (e) { o.onError(e); },
function () {
atEnd = true;
sourceSubscription.dispose();
}
));
return new CompositeDisposable(
sourceSubscription,
sampler.subscribe(sampleSubscribe, function (e) { o.onError(e); }, sampleSubscribe)
);
}, source);
}
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
observableProto.sample = observableProto.throttleLatest = function (intervalOrSampler, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return typeof intervalOrSampler === 'number' ?
sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :
sampleObservable(this, intervalOrSampler);
};
var TimeoutError = Rx.TimeoutError = function(message) {
this.message = message || 'Timeout has occurred';
this.name = 'TimeoutError';
Error.call(this);
};
TimeoutError.prototype = Object.create(Error.prototype);
function timeoutWithSelector(source, firstTimeout, timeoutDurationSelector, other) {
if (isFunction(firstTimeout)) {
other = timeoutDurationSelector;
timeoutDurationSelector = firstTimeout;
firstTimeout = observableNever();
}
other || (other = observableThrow(new TimeoutError()));
return new AnonymousObservable(function (o) {
var subscription = new SerialDisposable(), timer = new SerialDisposable(), original = new SingleAssignmentDisposable();
subscription.setDisposable(original);
var id = 0, switched = false;
function setTimer(timeout) {
var myId = id, d = new SingleAssignmentDisposable();
timer.setDisposable(d);
d.setDisposable(timeout.subscribe(function () {
id === myId && subscription.setDisposable(other.subscribe(o));
d.dispose();
}, function (e) {
id === myId && o.onError(e);
}, function () {
id === myId && subscription.setDisposable(other.subscribe(o));
}));
};
setTimer(firstTimeout);
function oWins() {
var res = !switched;
if (res) { id++; }
return res;
}
original.setDisposable(source.subscribe(function (x) {
if (oWins()) {
o.onNext(x);
var timeout = tryCatch(timeoutDurationSelector)(x);
if (timeout === errorObj) { return o.onError(timeout.e); }
setTimer(isPromise(timeout) ? observableFromPromise(timeout) : timeout);
}
}, function (e) {
oWins() && o.onError(e);
}, function () {
oWins() && o.onCompleted();
}));
return new CompositeDisposable(subscription, timer);
}, source);
}
function timeout(source, dueTime, other, scheduler) {
if (other == null) { throw new Error('other or scheduler must be specified'); }
if (isScheduler(other)) {
scheduler = other;
other = observableThrow(new TimeoutError());
}
if (other instanceof Error) { other = observableThrow(other); }
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var schedulerMethod = dueTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (o) {
var id = 0,
original = new SingleAssignmentDisposable(),
subscription = new SerialDisposable(),
switched = false,
timer = new SerialDisposable();
subscription.setDisposable(original);
function createTimer() {
var myId = id;
timer.setDisposable(scheduler[schedulerMethod](dueTime, function () {
if (id === myId) {
isPromise(other) && (other = observableFromPromise(other));
subscription.setDisposable(other.subscribe(o));
}
}));
}
createTimer();
original.setDisposable(source.subscribe(function (x) {
if (!switched) {
id++;
o.onNext(x);
createTimer();
}
}, function (e) {
if (!switched) {
id++;
o.onError(e);
}
}, function () {
if (!switched) {
id++;
o.onCompleted();
}
}));
return new CompositeDisposable(subscription, timer);
}, source);
}
observableProto.timeout = function () {
var firstArg = arguments[0];
if (firstArg instanceof Date || typeof firstArg === 'number') {
return timeout(this, firstArg, arguments[1], arguments[2]);
} else if (Observable.isObservable(firstArg) || isFunction(firstArg)) {
return timeoutWithSelector(this, firstArg, arguments[1], arguments[2]);
} else {
throw new Error('Invalid arguments');
}
};
/**
* Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.
* @param {Number} windowDuration time to wait before emitting another item after emitting the last item
* @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.
* @returns {Observable} An Observable that performs the throttle operation.
*/
observableProto.throttle = function (windowDuration, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var duration = +windowDuration || 0;
if (duration <= 0) { throw new RangeError('windowDuration cannot be less or equal zero.'); }
var source = this;
return new AnonymousObservable(function (o) {
var lastOnNext = 0;
return source.subscribe(
function (x) {
var now = scheduler.now();
if (lastOnNext === 0 || now - lastOnNext >= duration) {
lastOnNext = now;
o.onNext(x);
}
},function (e) { o.onError(e); }, function () { o.onCompleted(); }
);
}, source);
};
var PausableObservable = (function (__super__) {
inherits(PausableObservable, __super__);
function subscribe(observer) {
var conn = this.source.publish(),
subscription = conn.subscribe(observer),
connection = disposableEmpty;
var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {
if (b) {
connection = conn.connect();
} else {
connection.dispose();
connection = disposableEmpty;
}
});
return new CompositeDisposable(subscription, connection, pausable);
}
function PausableObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
__super__.call(this, subscribe, source);
}
PausableObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausable(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausable = function (pauser) {
return new PausableObservable(this, pauser);
};
function combineLatestSource(source, subject, resultSelector) {
return new AnonymousObservable(function (o) {
var hasValue = [false, false],
hasValueAll = false,
isDone = false,
values = new Array(2),
err;
function next(x, i) {
values[i] = x;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
if (err) { return o.onError(err); }
var res = tryCatch(resultSelector).apply(null, values);
if (res === errorObj) { return o.onError(res.e); }
o.onNext(res);
}
isDone && values[1] && o.onCompleted();
}
return new CompositeDisposable(
source.subscribe(
function (x) {
next(x, 0);
},
function (e) {
if (values[1]) {
o.onError(e);
} else {
err = e;
}
},
function () {
isDone = true;
values[1] && o.onCompleted();
}),
subject.subscribe(
function (x) {
next(x, 1);
},
function (e) { o.onError(e); },
function () {
isDone = true;
next(true, 1);
})
);
}, source);
}
var PausableBufferedObservable = (function (__super__) {
inherits(PausableBufferedObservable, __super__);
function subscribe(o) {
var q = [], previousShouldFire;
function drainQueue() { while (q.length > 0) { o.onNext(q.shift()); } }
var subscription =
combineLatestSource(
this.source,
this.pauser.startWith(false).distinctUntilChanged(),
function (data, shouldFire) {
return { data: data, shouldFire: shouldFire };
})
.subscribe(
function (results) {
if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) {
previousShouldFire = results.shouldFire;
// change in shouldFire
if (results.shouldFire) { drainQueue(); }
} else {
previousShouldFire = results.shouldFire;
// new data
if (results.shouldFire) {
o.onNext(results.data);
} else {
q.push(results.data);
}
}
},
function (err) {
drainQueue();
o.onError(err);
},
function () {
drainQueue();
o.onCompleted();
}
);
return subscription;
}
function PausableBufferedObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
__super__.call(this, subscribe, source);
}
PausableBufferedObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableBufferedObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableBufferedObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false,
* and yields the values that were buffered while paused.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausableBuffered(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausableBuffered = function (subject) {
return new PausableBufferedObservable(this, subject);
};
var ControlledObservable = (function (__super__) {
inherits(ControlledObservable, __super__);
function subscribe (observer) {
return this.source.subscribe(observer);
}
function ControlledObservable (source, enableQueue, scheduler) {
__super__.call(this, subscribe, source);
this.subject = new ControlledSubject(enableQueue, scheduler);
this.source = source.multicast(this.subject).refCount();
}
ControlledObservable.prototype.request = function (numberOfItems) {
return this.subject.request(numberOfItems == null ? -1 : numberOfItems);
};
return ControlledObservable;
}(Observable));
var ControlledSubject = (function (__super__) {
function subscribe (observer) {
return this.subject.subscribe(observer);
}
inherits(ControlledSubject, __super__);
function ControlledSubject(enableQueue, scheduler) {
enableQueue == null && (enableQueue = true);
__super__.call(this, subscribe);
this.subject = new Subject();
this.enableQueue = enableQueue;
this.queue = enableQueue ? [] : null;
this.requestedCount = 0;
this.requestedDisposable = null;
this.error = null;
this.hasFailed = false;
this.hasCompleted = false;
this.scheduler = scheduler || currentThreadScheduler;
}
addProperties(ControlledSubject.prototype, Observer, {
onCompleted: function () {
this.hasCompleted = true;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onCompleted();
this.disposeCurrentRequest()
} else {
this.queue.push(Notification.createOnCompleted());
}
},
onError: function (error) {
this.hasFailed = true;
this.error = error;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onError(error);
this.disposeCurrentRequest()
} else {
this.queue.push(Notification.createOnError(error));
}
},
onNext: function (value) {
if (this.requestedCount <= 0) {
this.enableQueue && this.queue.push(Notification.createOnNext(value));
} else {
(this.requestedCount-- === 0) && this.disposeCurrentRequest();
this.subject.onNext(value);
}
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
while (this.queue.length > 0 && (numberOfItems > 0 || this.queue[0].kind !== 'N')) {
var first = this.queue.shift();
first.accept(this.subject);
if (first.kind === 'N') {
numberOfItems--;
} else {
this.disposeCurrentRequest();
this.queue = [];
}
}
}
return numberOfItems;
},
request: function (number) {
this.disposeCurrentRequest();
var self = this;
this.requestedDisposable = this.scheduler.scheduleWithState(number,
function(s, i) {
var remaining = self._processRequest(i);
var stopped = self.hasCompleted || self.hasFailed
if (!stopped && remaining > 0) {
self.requestedCount = remaining;
return disposableCreate(function () {
self.requestedCount = 0;
});
// Scheduled item is still in progress. Return a new
// disposable to allow the request to be interrupted
// via dispose.
}
});
return this.requestedDisposable;
},
disposeCurrentRequest: function () {
if (this.requestedDisposable) {
this.requestedDisposable.dispose();
this.requestedDisposable = null;
}
}
});
return ControlledSubject;
}(Observable));
/**
* Attaches a controller to the observable sequence with the ability to queue.
* @example
* var source = Rx.Observable.interval(100).controlled();
* source.request(3); // Reads 3 values
* @param {bool} enableQueue truthy value to determine if values should be queued pending the next request
* @param {Scheduler} scheduler determines how the requests will be scheduled
* @returns {Observable} The observable sequence which only propagates values on request.
*/
observableProto.controlled = function (enableQueue, scheduler) {
if (enableQueue && isScheduler(enableQueue)) {
scheduler = enableQueue;
enableQueue = true;
}
if (enableQueue == null) { enableQueue = true; }
return new ControlledObservable(this, enableQueue, scheduler);
};
/**
* Pipes the existing Observable sequence into a Node.js Stream.
* @param {Stream} dest The destination Node.js stream.
* @returns {Stream} The destination stream.
*/
observableProto.pipe = function (dest) {
var source = this.pausableBuffered();
function onDrain() {
source.resume();
}
dest.addListener('drain', onDrain);
source.subscribe(
function (x) {
!dest.write(String(x)) && source.pause();
},
function (err) {
dest.emit('error', err);
},
function () {
// Hack check because STDIO is not closable
!dest._isStdio && dest.end();
dest.removeListener('drain', onDrain);
});
source.resume();
return dest;
};
/**
* Executes a transducer to transform the observable sequence
* @param {Transducer} transducer A transducer to execute
* @returns {Observable} An Observable sequence containing the results from the transducer.
*/
observableProto.transduce = function(transducer) {
var source = this;
function transformForObserver(o) {
return {
'@@transducer/init': function() {
return o;
},
'@@transducer/step': function(obs, input) {
return obs.onNext(input);
},
'@@transducer/result': function(obs) {
return obs.onCompleted();
}
};
}
return new AnonymousObservable(function(o) {
var xform = transducer(transformForObserver(o));
return source.subscribe(
function(v) {
var res = tryCatch(xform['@@transducer/step']).call(xform, o, v);
if (res === errorObj) { o.onError(res.e); }
},
function (e) { o.onError(e); },
function() { xform['@@transducer/result'](o); }
);
}, source);
};
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
inherits(AnonymousObservable, __super__);
// Fix subscriber to check for undefined or function returned to decorate as Disposable
function fixSubscriber(subscriber) {
return subscriber && isFunction(subscriber.dispose) ? subscriber :
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
}
function setDisposable(s, state) {
var ado = state[0], self = state[1];
var sub = tryCatch(self.__subscribe).call(self, ado);
if (sub === errorObj) {
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
}
ado.setDisposable(fixSubscriber(sub));
}
function innerSubscribe(observer) {
var ado = new AutoDetachObserver(observer), state = [ado, this];
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.scheduleWithState(state, setDisposable);
} else {
setDisposable(null, state);
}
return ado;
}
function AnonymousObservable(subscribe, parent) {
this.source = parent;
this.__subscribe = subscribe;
__super__.call(this, innerSubscribe);
}
return AnonymousObservable;
}(Observable));
var AutoDetachObserver = (function (__super__) {
inherits(AutoDetachObserver, __super__);
function AutoDetachObserver(observer) {
__super__.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
AutoDetachObserverPrototype.next = function (value) {
var result = tryCatch(this.observer.onNext).call(this.observer, value);
if (result === errorObj) {
this.dispose();
thrower(result.e);
}
};
AutoDetachObserverPrototype.error = function (err) {
var result = tryCatch(this.observer.onError).call(this.observer, err);
this.dispose();
result === errorObj && thrower(result.e);
};
AutoDetachObserverPrototype.completed = function () {
var result = tryCatch(this.observer.onCompleted).call(this.observer);
this.dispose();
result === errorObj && thrower(result.e);
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); };
AutoDetachObserverPrototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (__super__) {
function subscribe(observer) {
checkDisposed(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, __super__);
/**
* Creates a subject.
*/
function Subject() {
__super__.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
this.hasError = false;
}
addProperties(Subject.prototype, Observer.prototype, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () { return this.observers.length > 0; },
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
this.error = error;
this.hasError = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed(this);
if (!this.isStopped) {
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
} else if (this.hasValue) {
observer.onNext(this.value);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, __super__);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
* @constructor
*/
function AsyncSubject() {
__super__.call(this, subscribe);
this.isDisposed = false;
this.isStopped = false;
this.hasValue = false;
this.observers = [];
this.hasError = false;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
checkDisposed(this);
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*/
onCompleted: function () {
var i, len;
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
var os = cloneArray(this.observers), len = os.length;
if (this.hasValue) {
for (i = 0; i < len; i++) {
var o = os[i];
o.onNext(this.value);
o.onCompleted();
}
} else {
for (i = 0; i < len; i++) {
os[i].onCompleted();
}
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the error.
* @param {Mixed} error The Error to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
this.hasError = true;
this.error = error;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed(this);
if (this.isStopped) { return; }
this.value = value;
this.hasValue = true;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
inherits(AnonymousSubject, __super__);
function subscribe(observer) {
return this.observable.subscribe(observer);
}
function AnonymousSubject(observer, observable) {
this.observer = observer;
this.observable = observable;
__super__.call(this, subscribe);
}
addProperties(AnonymousSubject.prototype, Observer.prototype, {
onCompleted: function () {
this.observer.onCompleted();
},
onError: function (error) {
this.observer.onError(error);
},
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
/**
* Represents a value that changes over time.
* Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
*/
var BehaviorSubject = Rx.BehaviorSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed(this);
if (!this.isStopped) {
this.observers.push(observer);
observer.onNext(this.value);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(BehaviorSubject, __super__);
/**
* Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value.
* @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet.
*/
function BehaviorSubject(value) {
__super__.call(this, subscribe);
this.value = value,
this.observers = [],
this.isDisposed = false,
this.isStopped = false,
this.hasError = false;
}
addProperties(BehaviorSubject.prototype, Observer, {
/**
* Gets the current value or throws an exception.
* Value is frozen after onCompleted is called.
* After onError is called always throws the specified exception.
* An exception is always thrown after dispose is called.
* @returns {Mixed} The initial value passed to the constructor until onNext is called; after which, the last value passed to onNext.
*/
getValue: function () {
checkDisposed(this);
if (this.hasError) {
throw this.error;
}
return this.value;
},
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () { return this.observers.length > 0; },
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.hasError = true;
this.error = error;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed(this);
if (this.isStopped) { return; }
this.value = value;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onNext(value);
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.value = null;
this.exception = null;
}
});
return BehaviorSubject;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
*/
var ReplaySubject = Rx.ReplaySubject = (function (__super__) {
var maxSafeInteger = Math.pow(2, 53) - 1;
function createRemovableDisposable(subject, observer) {
return disposableCreate(function () {
observer.dispose();
!subject.isDisposed && subject.observers.splice(subject.observers.indexOf(observer), 1);
});
}
function subscribe(observer) {
var so = new ScheduledObserver(this.scheduler, observer),
subscription = createRemovableDisposable(this, so);
checkDisposed(this);
this._trim(this.scheduler.now());
this.observers.push(so);
for (var i = 0, len = this.q.length; i < len; i++) {
so.onNext(this.q[i].value);
}
if (this.hasError) {
so.onError(this.error);
} else if (this.isStopped) {
so.onCompleted();
}
so.ensureActive();
return subscription;
}
inherits(ReplaySubject, __super__);
/**
* Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.
* @param {Number} [bufferSize] Maximum element count of the replay buffer.
* @param {Number} [windowSize] Maximum time length of the replay buffer.
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
*/
function ReplaySubject(bufferSize, windowSize, scheduler) {
this.bufferSize = bufferSize == null ? maxSafeInteger : bufferSize;
this.windowSize = windowSize == null ? maxSafeInteger : windowSize;
this.scheduler = scheduler || currentThreadScheduler;
this.q = [];
this.observers = [];
this.isStopped = false;
this.isDisposed = false;
this.hasError = false;
this.error = null;
__super__.call(this, subscribe);
}
addProperties(ReplaySubject.prototype, Observer.prototype, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
_trim: function (now) {
while (this.q.length > this.bufferSize) {
this.q.shift();
}
while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) {
this.q.shift();
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed(this);
if (this.isStopped) { return; }
var now = this.scheduler.now();
this.q.push({ interval: now, value: value });
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onNext(value);
observer.ensureActive();
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.error = error;
this.hasError = true;
var now = this.scheduler.now();
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onError(error);
observer.ensureActive();
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
var now = this.scheduler.now();
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onCompleted();
observer.ensureActive();
}
this.observers.length = 0;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
return ReplaySubject;
}(Observable));
/**
* Used to pause and resume streams.
*/
Rx.Pauser = (function (__super__) {
inherits(Pauser, __super__);
function Pauser() {
__super__.call(this);
}
/**
* Pauses the underlying sequence.
*/
Pauser.prototype.pause = function () { this.onNext(false); };
/**
* Resumes the underlying sequence.
*/
Pauser.prototype.resume = function () { this.onNext(true); };
return Pauser;
}(Subject));
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
});
} else if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Rx).Rx = Rx;
} else {
freeExports.Rx = Rx;
}
} else {
// in a browser or Rhino
root.Rx = Rx;
}
// All code before this point will be filtered from stack traces.
var rEndingLine = captureLine();
}.call(this));
|
test/specs/form/form.spec.js | rafaelfbs/realizejs | import React from 'react'
import $ from 'jquery'
import Realize from 'realize'
import { Form } from 'components/form'
import { assert } from 'chai';
import { shallow } from 'enzyme';
describe('<Form/>', () => {
it('exists', () => {
assert(Form);
});
it('renders with the default props', () => {
const content = shallow(
<Form />
);
assert(content.find('Form'));
});
it('renders with isLoading', () => {
const content = shallow(
<Form
isLoading
/>
);
assert(content.find('isLoading'));
});
it('renders with otherButtons', () => {
const content = shallow(
<Form
otherButtons= {[
{
name: 'actions.clear',
icon: 'delete',
element: 'button',
type: 'reset'
}
]}
/>
);
assert(content.find('otherButtons'));
});
it('renders with onSubmit', () => {
const content = shallow(
<Form
onSubmit={function(){
alert('Product Created')
}}
/>
);
assert(content.find('onSubmit'));
});
});
|
src/components/web/Input.js | Manuelandro/Universal-Commerce | import React from 'react'
import styled from 'styled-components'
const { View, Text, TextInput } = {
View: styled.div`
display: flex;
flex: 1;
flex-direction: row;
align-items: center;
border-width: 1px;
border-color: #ccc;
margin-left: 5px;
margin-right: 5px;
`,
Text: styled.label`
height: 40px;
flex: 3;
padding-left: 5px;
padding-right: 5px;
font-size: 18px;
line-height: 40px;
`,
TextInput: styled.input`
font-size: 18px;
padding-left: 5px;
flex: 1;
text-transform: ${props => props.autoCapitalize ? 'capitalize' : 'none'};
`
}
const Input = ({ label, value, onChange, placeholder, secureTextEntry, autoCapitalize }) => {
const type = (!secureTextEntry) ? 'text' : 'password'
const handleChange = e => onChange(e.target.value)
return (
<View>
<Text>{label}</Text>
<TextInput
type={type}
placeholder={placeholder}
autoCapitalize={autoCapitalize}
value={value}
onChange={handleChange}
/>
</View>
)
}
export { Input } |
packages/material-ui-icons/src/TouchAppRounded.js | kybarg/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><defs><path id="a" d="M0 0h24v24H0z" /></defs><path d="M9 11.24V7.5C9 6.12 10.12 5 11.5 5S14 6.12 14 7.5v3.74c1.21-.81 2-2.18 2-3.74C16 5.01 13.99 3 11.5 3S7 5.01 7 7.5c0 1.56.79 2.93 2 3.74zm5.5 2.47c-.28-.14-.58-.21-.89-.21H13v-6c0-.83-.67-1.5-1.5-1.5S10 6.67 10 7.5v10.74l-3.44-.72c-.37-.08-.76.04-1.03.31-.43.44-.43 1.14 0 1.58l4.01 4.01c.38.37.89.58 1.42.58h6.1c1 0 1.84-.73 1.98-1.72l.63-4.47c.12-.85-.32-1.69-1.09-2.07l-4.08-2.03z" /></React.Fragment>
, 'TouchAppRounded');
|
__tests__/components/List.spec.js | zupzup/reactgym | 'use strict';
jest.dontMock('../../scripts/components/List.js');
let React = require('react/addons'),
ListItem = require('../../scripts/components/ListItem.js'),
List = require('../../scripts/components/List.js');
let TestUtils = React.addons.TestUtils;
describe("List", () => {
it("renders a List", () => {
let list = TestUtils.renderIntoDocument(<List items={[]} />);
expect(TestUtils.isCompositeComponent(list)).toEqual(true);
});
it("renders multiple list items", () => {
let list = TestUtils.renderIntoDocument(<List activeIndex={0} items={[{label: 'hello'}, {label: 'hola'}]} />);
let listItems = TestUtils.scryRenderedDOMComponentsWithClass(list, 'listitem');
expect(listItems[0].getDOMNode().textContent).toContain('hello');
expect(listItems[1].getDOMNode().textContent).toContain('hola');
});
it("triggers the given handler", () => {
let mockHandler = jest.genMockFunction();
let handlers = {
default: mockHandler
};
let list = TestUtils.renderIntoDocument(<List handlers={handlers} items={[{
label: 'hello'
}]} />);
let listItem = TestUtils.findRenderedDOMComponentWithClass(list, 'listitem');
TestUtils.Simulate.click(listItem.getDOMNode());
expect(mockHandler.mock.calls.length).toBe(1);
});
it("triggers the default handler if no handler was given", () => {
let handlers = {
default: null
};
let list = TestUtils.renderIntoDocument(<List handlers={handlers} items={[{
label: 'hello'
}]} />);
let listItem = TestUtils.findRenderedComponentWithType(list, ListItem);
TestUtils.Simulate.click(listItem.getDOMNode());
});
});
|
src/components/WelcomeHeader.js | hansenjl/circuit-builder-client | import React from 'react';
import NavBar from '../components/NavBar';
const WelcomeHeader = () => (
<div>
<header className="App-header">
<h1 className="App-title">Welcome to Circuit Builder</h1>
</header>
<NavBar />
</div>
)
export default WelcomeHeader; |
packages/material-ui-icons/src/PhoneIphone.js | cherniavskii/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<g><path d="M15.5 1h-8C6.12 1 5 2.12 5 3.5v17C5 21.88 6.12 23 7.5 23h8c1.38 0 2.5-1.12 2.5-2.5v-17C18 2.12 16.88 1 15.5 1zm-4 21c-.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.5zm4.5-4H7V4h9v14z" /></g>
, 'PhoneIphone');
|
react-router-training/src/index.js | wefine/reactjs-guide | import React from 'react';
import ReactDOM from 'react-dom';
import { browserHistory, IndexRoute, Route, Router } from 'react-router'
import App from './App';
import './index.css';
import About from './modules/About'
import Home from './modules/Home'
import NotFound from './modules/NotFound'
import Repo from './modules/Repo'
import Repos from './modules/Repos'
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(
<Router history={browserHistory}>
<Route path="/" component={App}>
<IndexRoute component={Home} />
<Route path="repos" component={Repos}>
<Route path=":userName/:repoName" component={Repo} />
</Route>
<Route path="about" component={About} />
</Route>
<Route path="*" component={NotFound} />
</Router>
, document.getElementById('root'));
registerServiceWorker();
|
src/app.js | adamw523/ssh-tunnel-manager | import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import { ipcRenderer } from 'electron';
import sshTunnelApp from './reducers'
import App from './components/app'
import * as actions from './actions'
import manager from './manager'
let store = createStore(sshTunnelApp);
store.dispatch(actions.addConnection('devbox4.tbcn.ca', '10.4.4.4', 9988, 9988));
store.dispatch(actions.addConnection('devbox4.tbcn.ca', '10.4.4.4', 7788, 7788));
store.dispatch(actions.addConnection('devbox4.tbcn.ca', '10.4.4.4', 8888, 7888));
store.dispatch(actions.addConnection('devbox4.tbcn.ca', '10.4.4.4', 8882, 8882));
ipcRenderer.on('update-connection-status', (event, id, status, message) => {
console.log('got update-connection-status', 'event', event, 'id', id, 'status', status);
store.dispatch(actions.updateConnectionStatus(id, status, message));
});
ipcRenderer.on('received-error', (event, id, code, error) => {
console.log('got received-error', event, 'id', id, 'code', code, 'error', error);
console.log(error.reason == "CONNECT_FAILED");
// store.dispatch(actions.updateConnectionStatus(id, status, message));
});
render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('app')
)
|
tests/components/Counter/Counter.spec.js | dunglas/calavera-react-client | import React from 'react'
import { bindActionCreators } from 'redux'
import { Counter } from 'components/Counter/Counter'
import { shallow } from 'enzyme'
describe('(Component) Counter', () => {
let _props, _spies, _wrapper
beforeEach(() => {
_spies = {}
_props = {
counter: 5,
...bindActionCreators({
doubleAsync: (_spies.doubleAsync = sinon.spy()),
increment: (_spies.increment = sinon.spy())
}, _spies.dispatch = sinon.spy())
}
_wrapper = shallow(<Counter {..._props} />)
})
it('Should render as a <div>.', () => {
expect(_wrapper.is('div')).to.equal(true)
})
it('Should render with an <h2> that includes Sample Counter text.', () => {
expect(_wrapper.find('h2').text()).to.match(/Counter:/)
})
it('Should render props.counter at the end of the sample counter <h2>.', () => {
expect(_wrapper.find('h2').text()).to.match(/5$/)
_wrapper.setProps({ counter: 8 })
expect(_wrapper.find('h2').text()).to.match(/8$/)
})
it('Should render exactly two buttons.', () => {
expect(_wrapper).to.have.descendants('.btn')
})
//
describe('An increment button...', () => {
let _button
beforeEach(() => {
_button = _wrapper.find('button').filterWhere(a => a.text() === 'Increment')
})
it('has bootstrap classes', () => {
expect(_button.hasClass('btn btn-default')).to.be.true
})
it('Should dispatch a `increment` action when clicked', () => {
_spies.dispatch.should.have.not.been.called
_button.simulate('click')
_spies.dispatch.should.have.been.called
_spies.increment.should.have.been.called
});
})
describe('A Double (Async) button...', () => {
let _button
beforeEach(() => {
_button = _wrapper.find('button').filterWhere(a => a.text() === 'Double (Async)')
})
it('has bootstrap classes', () => {
expect(_button.hasClass('btn btn-default')).to.be.true
})
it('Should dispatch a `doubleAsync` action when clicked', () => {
_spies.dispatch.should.have.not.been.called
_button.simulate('click')
_spies.dispatch.should.have.been.called
_spies.doubleAsync.should.have.been.called
});
})
})
|
ajax/libs/survey-jquery/0.12.24/survey.jquery.min.js | wout/cdnjs | /*!
* surveyjs - Survey JavaScript library v0.12.24
* Copyright (c) 2015-2017 Devsoft Baltic OÜ - http://surveyjs.io/
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery")):"function"==typeof define&&define.amd?define("Survey",["jquery"],t):"object"==typeof exports?exports.Survey=t(require("jquery")):e.Survey=t(e.jQuery)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=98)}([function(e,t,n){"use strict";function r(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)}n.d(t,"a",function(){return i}),t.b=r,n.d(t,"c",function(){return o});var i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},o=function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a}},function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"b",function(){return i});var r={currentLocale:"",defaultLocale:"en",locales:{},supportedLocales:[],getString:function(e){var t=this.currentLocale?this.locales[this.currentLocale]:this.locales[this.defaultLocale];return t&&t[e]||(t=this.locales[this.defaultLocale]),t[e]},getLocales:function(){var e=[];if(e.push(""),this.supportedLocales&&this.supportedLocales.length>0)for(var t=0;t<this.supportedLocales.length;t++)e.push(this.supportedLocales[t]);else for(var n in this.locales)e.push(n);return e.sort(),e}},i={pagePrevText:"Previous",pageNextText:"Next",completeText:"Complete",otherItemText:"Other (describe)",progressText:"Page {0} of {1}",emptySurvey:"There is no visible page or question in the survey.",completingSurvey:"Thank you for completing the survey!",completingSurveyBefore:"Our records show that you have already completed this survey.",loadingSurvey:"Survey is loading...",optionsCaption:"Choose...",value:"value",requiredError:"Please answer the question.",requiredInAllRowsError:"Please answer questions in all rows.",numericError:"The value should be numeric.",textMinLength:"Please enter at least {0} symbols.",textMaxLength:"Please enter less than {0} symbols.",textMinMaxLength:"Please enter more than {0} and less than {1} symbols.",minRowCountError:"Please fill in at least {0} rows.",minSelectError:"Please select at least {0} variants.",maxSelectError:"Please select no more than {0} variants.",numericMinMax:"The '{0}' should be equal or more than {1} and equal or less than {2}",numericMin:"The '{0}' should be equal or more than {1}",numericMax:"The '{0}' should be equal or less than {1}",invalidEmail:"Please enter a valid e-mail address.",urlRequestError:"The request returned error '{0}'. {1}",urlGetChoicesError:"The request returned empty data or the 'path' property is incorrect",exceedMaxSize:"The file size should not exceed {0}.",otherRequiredError:"Please enter the other value.",uploadingFile:"Your file is uploading. Please wait several seconds and try again.",confirmDelete:"Do you want to delete the record?",keyDuplicationError:"This value should be unique.",addRow:"Add row",removeRow:"Remove",addPanel:"Add new",removePanel:"Remove",choices_Item:"item",matrix_column:"Column",matrix_row:"Row",savingData:"The results are saving on the server...",savingDataError:"An error occurred and we could not save the results.",savingDataSuccess:"The results were saved successfully!",saveAgainButton:"Try again"};r.locales.en=i,String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,function(t,n){return void 0!==e[n]?e[n]:t})})},function(e,t,n){"use strict";(function(e){function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return null}function a(e){var t=e.nodeName,n=e.attributes;e.attributes={},t.defaultProps&&w(e.attributes,t.defaultProps),n&&w(e.attributes,n)}function s(e,t){var n=void 0,r=void 0,i=void 0;if(t){for(i in t)if(n=K.test(i))break;if(n){r=e.attributes={};for(i in t)t.hasOwnProperty(i)&&(r[K.test(i)?i.replace(/([A-Z0-9])/,"-$1").toLowerCase():i]=t[i])}}}function u(e,t,n){var r=t&&t._preactCompatRendered;r&&r.parentNode!==t&&(r=null),r||(r=t.children[0]);for(var i=t.childNodes.length;i--;)t.childNodes[i]!==r&&t.removeChild(t.childNodes[i]);var o=(0,H.render)(e,t,r);return t&&(t._preactCompatRendered=o),"function"==typeof n&&n(),o&&o._component||o.base}function l(e,t,n,r){var i=(0,H.h)(te,{context:e.context},t),o=u(i,n);return r&&r(o),o}function c(e){var t=e._preactCompatRendered;return!(!t||t.parentNode!==e)&&((0,H.render)((0,H.h)(o),e,t),!0)}function h(e){return g.bind(null,e)}function p(e,t){for(var n=t||0;n<e.length;n++){var r=e[n];Array.isArray(r)?p(r):r&&"object"===(void 0===r?"undefined":_(r))&&!b(r)&&(r.props&&r.type||r.attributes&&r.nodeName||r.children)&&(e[n]=g(r.type||r.nodeName,r.props||r.attributes,r.children))}}function d(e){return"function"==typeof e&&!(e.prototype&&e.prototype.render)}function f(e){return S({displayName:e.displayName||e.name,render:function(){return e(this.props,this.context)}})}function m(e){var t=e[J];return t?!0===t?e:t:(t=f(e),Object.defineProperty(t,J,{configurable:!0,value:!0}),t.displayName=e.displayName,t.propTypes=e.propTypes,t.defaultProps=e.defaultProps,Object.defineProperty(e,J,{configurable:!0,value:t}),t)}function g(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return p(t,2),y(H.h.apply(void 0,t))}function y(e){e.preactCompatNormalized=!0,P(e),d(e.nodeName)&&(e.nodeName=m(e.nodeName));var t=e.attributes.ref,n=t&&(void 0===t?"undefined":_(t));return!ie||"string"!==n&&"number"!==n||(e.attributes.ref=C(t,ie)),x(e),e}function v(e,t){if(!b(e))return e;for(var n=e.attributes||e.props,r=(0,H.h)(e.nodeName||e.type,n,e.children||n&&n.children),i=arguments.length,o=Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];return y(H.cloneElement.apply(void 0,[r,t].concat(o)))}function b(e){return e&&(e instanceof $||e.$$typeof===U)}function C(e,t){return t._refProxies[e]||(t._refProxies[e]=function(n){t&&t.refs&&(t.refs[e]=n,null===n&&(delete t._refProxies[e],t=null))})}function x(e){var t=e.nodeName,n=e.attributes;if(n&&"string"==typeof t){var r={};for(var i in n)r[i.toLowerCase()]=i;if(r.ondoubleclick&&(n.ondblclick=n[r.ondoubleclick],delete n[r.ondoubleclick]),r.onchange&&("textarea"===t||"input"===t.toLowerCase()&&!/^fil|che|rad/i.test(n.type))){var o=r.oninput||"oninput";n[o]||(n[o]=N([n[o],n[r.onchange]]),delete n[r.onchange])}}}function P(e){var t=e.attributes;if(t){var n=t.className||t.class;n&&(t.className=n)}}function w(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function V(e,t){for(var n in e)if(!(n in t))return!0;for(var r in t)if(e[r]!==t[r])return!0;return!1}function T(e){return e&&e.base||e}function O(){}function S(e){function t(e,t){q(this),D.call(this,e,t,Z),j.call(this,e,t)}return e=w({constructor:t},e),e.mixins&&E(e,R(e.mixins)),e.statics&&w(t,e.statics),e.propTypes&&(t.propTypes=e.propTypes),e.defaultProps&&(t.defaultProps=e.defaultProps),e.getDefaultProps&&(t.defaultProps=e.getDefaultProps()),O.prototype=D.prototype,t.prototype=w(new O,e),t.displayName=e.displayName||"Component",t}function R(e){for(var t={},n=0;n<e.length;n++){var r=e[n];for(var i in r)r.hasOwnProperty(i)&&"function"==typeof r[i]&&(t[i]||(t[i]=[])).push(r[i])}return t}function E(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=N(t[n].concat(e[n]||ne),"getDefaultProps"===n||"getInitialState"===n||"getChildContext"===n))}function q(e){for(var t in e){var n=e[t];"function"!=typeof n||n.__bound||G.hasOwnProperty(t)||((e[t]=n.bind(e)).__bound=!0)}}function k(e,t,n){if("string"==typeof t&&(t=e.constructor.prototype[t]),"function"==typeof t)return t.apply(e,n)}function N(e,t){return function(){for(var n=void 0,r=0;r<e.length;r++){var i=k(this,e[r],arguments);if(t&&null!=i){n||(n={});for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])}else void 0!==i&&(n=i)}return n}}function j(e,t){I.call(this,e,t),this.componentWillReceiveProps=N([I,this.componentWillReceiveProps||"componentWillReceiveProps"]),this.render=N([I,L,this.render||"render",M])}function I(e,t){if(e){var n=e.children;if(n&&Array.isArray(n)&&1===n.length&&(e.children=n[0],e.children&&"object"===_(e.children)&&(e.children.length=1,e.children[0]=e.children)),X){var r="function"==typeof this?this:this.constructor,i=this.propTypes||r.propTypes;if(i)for(var o in i)if(i.hasOwnProperty(o)&&"function"==typeof i[o]){var a=this.displayName||r.name,s=i[o](e,o,a,"prop");s&&console.error(new Error(s.message||s))}}}}function L(e){ie=this}function M(){ie===this&&(ie=null)}function D(e,t,n){H.Component.call(this,e,t),this.state=this.getInitialState?this.getInitialState():{},this.refs={},this._refProxies={},n!==Z&&j.call(this,e,t)}function A(e,t){D.call(this,e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.unstable_renderSubtreeIntoContainer=t.PureComponent=t.Component=t.unmountComponentAtNode=t.findDOMNode=t.isValidElement=t.cloneElement=t.createElement=t.createFactory=t.createClass=t.render=t.Children=t.PropTypes=t.DOM=t.version=void 0;var _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),B=n(43),Q=r(B),H=n(41),F="15.1.0",W="a abbr address area article aside audio b base bdi bdo big blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd keygen label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt ruby s samp script section select small source span strong style sub summary sup table tbody td textarea tfoot th thead time title tr track u ul var video wbr circle clipPath defs ellipse g image line linearGradient mask path pattern polygon polyline radialGradient rect stop svg text tspan".split(" "),U="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,J="undefined"!=typeof Symbol?Symbol.for("__preactCompatWrapper"):"__preactCompatWrapper",G={constructor:1,render:1,shouldComponentUpdate:1,componentWillReceiveProps:1,componentWillUpdate:1,componentDidUpdate:1,componentWillMount:1,componentDidMount:1,componentWillUnmount:1,componentDidUnmount:1},K=/^(?:accent|alignment|arabic|baseline|cap|clip|color|fill|flood|font|glyph|horiz|marker|overline|paint|stop|strikethrough|stroke|text|underline|unicode|units|v|vert|word|writing|x)[A-Z]/,Z={},X=void 0===e||!e.env||"production"!==e.env.NODE_ENV,$=(0,H.h)("a",null).constructor;$.prototype.$$typeof=U,$.prototype.preactCompatUpgraded=!1,$.prototype.preactCompatNormalized=!1,Object.defineProperty($.prototype,"type",{get:function(){return this.nodeName},set:function(e){this.nodeName=e},configurable:!0}),Object.defineProperty($.prototype,"props",{get:function(){return this.attributes},set:function(e){this.attributes=e},configurable:!0});var Y=H.options.event;H.options.event=function(e){return Y&&(e=Y(e)),e.persist=Object,e.nativeEvent=e,e};var ee=H.options.vnode;H.options.vnode=function(e){if(!e.preactCompatUpgraded){e.preactCompatUpgraded=!0;var t=e.nodeName,n=e.attributes;n||(n=e.attributes={}),"function"==typeof t?(!0===t[J]||t.prototype&&"isReactComponent"in t.prototype)&&(e.children&&!e.children.length&&(e.children=void 0),e.children&&(n.children=e.children),e.preactCompatNormalized||y(e),a(e)):(e.children&&!e.children.length&&(e.children=void 0),e.children&&(n.children=e.children),n.defaultValue&&(n.value||0===n.value||(n.value=n.defaultValue),delete n.defaultValue),s(e,n))}ee&&ee(e)};for(var te=function(){function e(){i(this,e)}return z(e,[{key:"getChildContext",value:function(){return this.props.context}},{key:"render",value:function(e){return e.children[0]}}]),e}(),ne=[],re={map:function(e,t,n){return null==e?null:(e=re.toArray(e),n&&n!==e&&(t=t.bind(n)),e.map(t))},forEach:function(e,t,n){if(null==e)return null;e=re.toArray(e),n&&n!==e&&(t=t.bind(n)),e.forEach(t)},count:function(e){return e&&e.length||0},only:function(e){if(e=re.toArray(e),1!==e.length)throw new Error("Children.only() expects only one child.");return e[0]},toArray:function(e){return Array.isArray&&Array.isArray(e)?e:ne.concat(e)}},ie=void 0,oe={},ae=W.length;ae--;)oe[W[ae]]=h(W[ae]);w(D.prototype=new H.Component,{constructor:D,isReactComponent:{},replaceState:function(e,t){this.setState(e,t);for(var n in this.state)n in e||delete this.state[n]},getDOMNode:function(){return this.base},isMounted:function(){return!!this.base}}),O.prototype=D.prototype,A.prototype=new O,A.prototype.shouldComponentUpdate=function(e,t){return V(this.props,e)||V(this.state,t)},t.version=F,t.DOM=oe,t.PropTypes=Q.default,t.Children=re,t.render=u,t.createClass=S,t.createFactory=h,t.createElement=g,t.cloneElement=v,t.isValidElement=b,t.findDOMNode=T,t.unmountComponentAtNode=c,t.Component=D,t.PureComponent=A,t.unstable_renderSubtreeIntoContainer=l,t.default={version:F,DOM:oe,PropTypes:Q.default,Children:re,render:u,createClass:S,createFactory:h,createElement:g,cloneElement:v,isValidElement:b,findDOMNode:T,unmountComponentAtNode:c,Component:D,PureComponent:A,unstable_renderSubtreeIntoContainer:l}}).call(t,n(42))},function(e,t,n){"use strict";var r=n(0);n.d(t,"h",function(){return i}),n.d(t,"e",function(){return o}),n.d(t,"d",function(){return a}),n.d(t,"b",function(){return s}),n.d(t,"j",function(){return u}),n.d(t,"g",function(){return l}),n.d(t,"f",function(){return c}),n.d(t,"c",function(){return h}),n.d(t,"i",function(){return p}),n.d(t,"a",function(){return d});var i=function(){function e(e,t){void 0===t&&(t=!1),this.name=e,this.typeValue=null,this.choicesValue=null,this.isRequiredValue=!1,this.choicesfunc=null,this.className=null,this.alternativeName=null,this.classNamePart=null,this.baseClassName=null,this.defaultValue=null,this.readOnly=!1,this.visible=!0,this.isLocalizable=!1,this.serializationProperty=null,this.onGetValue=null,this.isRequiredValue=t}return Object.defineProperty(e.prototype,"type",{get:function(){return this.typeValue?this.typeValue:"string"},set:function(e){this.typeValue=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isRequired",{get:function(){return this.isRequiredValue},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasToUseGetValue",{get:function(){return this.onGetValue||this.serializationProperty},enumerable:!0,configurable:!0}),e.prototype.isDefaultValue=function(e){return this.defaultValue?this.defaultValue==e:!e},e.prototype.getValue=function(e){return this.onGetValue?this.onGetValue(e):this.serializationProperty?e[this.serializationProperty].getJson():e[this.name]},e.prototype.getPropertyValue=function(e){return this.isLocalizable?e[this.serializationProperty].text:this.getValue(e)},Object.defineProperty(e.prototype,"hasToUseSetValue",{get:function(){return this.onSetValue||this.serializationProperty},enumerable:!0,configurable:!0}),e.prototype.setValue=function(e,t,n){this.onSetValue?this.onSetValue(e,t,n):this.serializationProperty?e[this.serializationProperty].setJson(t):(t&&"string"==typeof t&&("number"==this.type&&(t=parseInt(t)),"boolean"==this.type&&(t="true"===t.toLowerCase())),e[this.name]=t)},e.prototype.getObjType=function(e){return this.classNamePart?e.replace(this.classNamePart,""):e},e.prototype.getClassName=function(e){return this.classNamePart&&e.indexOf(this.classNamePart)<0?e+this.classNamePart:e},Object.defineProperty(e.prototype,"choices",{get:function(){return null!=this.choicesValue?this.choicesValue:null!=this.choicesfunc?this.choicesfunc():null},enumerable:!0,configurable:!0}),e.prototype.setChoices=function(e,t){this.choicesValue=e,this.choicesfunc=t},e}(),o=function(){function e(e,t,n,r){void 0===n&&(n=null),void 0===r&&(r=null),this.name=e,this.creator=n,this.parentName=r,this.properties=null,this.requiredProperties=null,this.properties=new Array;for(var i=0;i<t.length;i++){var o=this.createProperty(t[i]);o&&this.properties.push(o)}}return e.prototype.find=function(e){for(var t=0;t<this.properties.length;t++)if(this.properties[t].name==e)return this.properties[t];return null},e.prototype.createProperty=function(t){var n="string"==typeof t?t:t.name;if(n){var r=null,o=n.indexOf(e.typeSymbol);o>-1&&(r=n.substring(o+1),n=n.substring(0,o));var a=this.getIsPropertyNameRequired(n);n=this.getPropertyName(n);var s=new i(n,a);if(r&&(s.type=r),"object"==typeof t){if(t.type&&(s.type=t.type),t.default&&(s.defaultValue=t.default),!1===t.visible&&(s.visible=!1),t.isRequired&&this.makePropertyRequired(s.name),t.choices){var u="function"==typeof t.choices?t.choices:null,l="function"!=typeof t.choices?t.choices:null;s.setChoices(l,u)}if(t.onGetValue&&(s.onGetValue=t.onGetValue),t.onSetValue&&(s.onSetValue=t.onSetValue),t.serializationProperty){s.serializationProperty=t.serializationProperty;s.serializationProperty&&0==s.serializationProperty.indexOf("loc")&&(s.isLocalizable=!0)}t.isLocalizable&&(s.isLocalizable=t.isLocalizable),t.className&&(s.className=t.className),t.baseClassName&&(s.baseClassName=t.baseClassName),t.classNamePart&&(s.classNamePart=t.classNamePart),t.alternativeName&&(s.alternativeName=t.alternativeName)}return s}},e.prototype.getIsPropertyNameRequired=function(t){return t.length>0&&t[0]==e.requiredSymbol},e.prototype.getPropertyName=function(e){return this.getIsPropertyNameRequired(e)?(e=e.slice(1),this.makePropertyRequired(e),e):e},e.prototype.makePropertyRequired=function(e){this.requiredProperties||(this.requiredProperties=new Array),this.requiredProperties.push(e)},e}();o.requiredSymbol="!",o.typeSymbol=":";var a=function(){function e(){this.classes={},this.childrenClasses={},this.classProperties={},this.classRequiredProperties={}}return e.prototype.addClass=function(e,t,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var i=new o(e,t,n,r);if(this.classes[e]=i,r){this.childrenClasses[r]||(this.childrenClasses[r]=[]),this.childrenClasses[r].push(i)}return i},e.prototype.overrideClassCreatore=function(e,t){var n=this.findClass(e);n&&(n.creator=t)},e.prototype.getProperties=function(e){var t=this.classProperties[e];return t||(t=new Array,this.fillProperties(e,t),this.classProperties[e]=t),t},e.prototype.findProperty=function(e,t){for(var n=this.getProperties(e),r=0;r<n.length;r++)if(n[r].name==t)return n[r];return null},e.prototype.createClass=function(e){var t=this.findClass(e);return t?t.creator():null},e.prototype.getChildrenClasses=function(e,t){void 0===t&&(t=!1);var n=[];return this.fillChildrenClasses(e,t,n),n},e.prototype.getRequiredProperties=function(e){var t=this.classRequiredProperties[e];return t||(t=new Array,this.fillRequiredProperties(e,t),this.classRequiredProperties[e]=t),t},e.prototype.addProperty=function(e,t){var n=this.findClass(e);if(n){var r=n.createProperty(t);r&&(this.addPropertyToClass(n,r),this.emptyClassPropertiesHash(n))}},e.prototype.removeProperty=function(e,t){var n=this.findClass(e);if(!n)return!1;var r=n.find(t);r&&(this.removePropertyFromClass(n,r),this.emptyClassPropertiesHash(n))},e.prototype.addPropertyToClass=function(e,t){null==e.find(t.name)&&e.properties.push(t)},e.prototype.removePropertyFromClass=function(e,t){var n=e.properties.indexOf(t);n<0||(e.properties.splice(n,1),e.requiredProperties&&(n=e.requiredProperties.indexOf(t.name))>=0&&e.requiredProperties.splice(n,1))},e.prototype.emptyClassPropertiesHash=function(e){this.classProperties[e.name]=null;for(var t=this.getChildrenClasses(e.name),n=0;n<t.length;n++)this.classProperties[t[n].name]=null},e.prototype.fillChildrenClasses=function(e,t,n){var r=this.childrenClasses[e];if(r)for(var i=0;i<r.length;i++)t&&!r[i].creator||n.push(r[i]),this.fillChildrenClasses(r[i].name,t,n)},e.prototype.findClass=function(e){return this.classes[e]},e.prototype.fillProperties=function(e,t){var n=this.findClass(e);if(n){n.parentName&&this.fillProperties(n.parentName,t);for(var r=0;r<n.properties.length;r++)this.addPropertyCore(n.properties[r],t,t.length)}},e.prototype.addPropertyCore=function(e,t,n){for(var r=-1,i=0;i<n;i++)if(t[i].name==e.name){r=i;break}r<0?t.push(e):t[r]=e},e.prototype.fillRequiredProperties=function(e,t){var n=this.findClass(e);n&&(n.requiredProperties&&Array.prototype.push.apply(t,n.requiredProperties),n.parentName&&this.fillRequiredProperties(n.parentName,t))},e}(),s=function(){function e(e,t){this.type=e,this.message=t,this.description="",this.at=-1}return e.prototype.getFullDescription=function(){return this.message+(this.description?"\n"+this.description:"")},e}(),u=function(e){function t(t,n){var r=e.call(this,"unknownproperty","The property '"+t+"' in class '"+n+"' is unknown.")||this;r.propertyName=t,r.className=n;var i=d.metaData.getProperties(n);if(i){r.description="The list of available properties are: ";for(var o=0;o<i.length;o++)o>0&&(r.description+=", "),r.description+=i[o].name;r.description+="."}return r}return r.b(t,e),t}(s),l=function(e){function t(t,n,r){var i=e.call(this,n,r)||this;i.baseClassName=t,i.type=n,i.message=r,i.description="The following types are available: ";for(var o=d.metaData.getChildrenClasses(t,!0),a=0;a<o.length;a++)a>0&&(i.description+=", "),i.description+="'"+o[a].name+"'";return i.description+=".",i}return r.b(t,e),t}(s),c=function(e){function t(t,n){var r=e.call(this,n,"missingtypeproperty","The property type is missing in the object. Please take a look at property: '"+t+"'.")||this;return r.propertyName=t,r.baseClassName=n,r}return r.b(t,e),t}(l),h=function(e){function t(t,n){var r=e.call(this,n,"incorrecttypeproperty","The property type is incorrect in the object. Please take a look at property: '"+t+"'.")||this;return r.propertyName=t,r.baseClassName=n,r}return r.b(t,e),t}(l),p=function(e){function t(t,n){var r=e.call(this,"requiredproperty","The property '"+t+"' is required in class '"+n+"'.")||this;return r.propertyName=t,r.className=n,r}return r.b(t,e),t}(s),d=function(){function e(){this.errors=new Array}return Object.defineProperty(e,"metaData",{get:function(){return e.metaDataValue},enumerable:!0,configurable:!0}),e.prototype.toJsonObject=function(e){return this.toJsonObjectCore(e,null)},e.prototype.toObject=function(t,n){if(t){var r=null;if(n.getType&&(r=e.metaData.getProperties(n.getType())),r){n.startLoadingFromJson&&n.startLoadingFromJson();for(var i in t)if(i!=e.typePropertyName)if(i!=e.positionPropertyName){var o=this.findProperty(r,i);o?this.valueToObj(t[i],n,i,o):this.addNewError(new u(i.toString(),n.getType()),t)}else n[i]=t[i];n.endLoadingFromJson&&n.endLoadingFromJson()}}},e.prototype.toJsonObjectCore=function(t,n){if(!t.getType)return t;var r={};null==n||n.className||(r[e.typePropertyName]=n.getObjType(t.getType()));for(var i=e.metaData.getProperties(t.getType()),o=0;o<i.length;o++)this.valueToJson(t,r,i[o]);return r},e.prototype.valueToJson=function(e,t,n){var r=n.getValue(e);if(void 0!==r&&null!==r&&!n.isDefaultValue(r)){if(this.isValueArray(r)){for(var i=[],o=0;o<r.length;o++)i.push(this.toJsonObjectCore(r[o],n));r=i.length>0?i:null}else r=this.toJsonObjectCore(r,n);n.isDefaultValue(r)||(t[n.name]=r)}},e.prototype.valueToObj=function(e,t,n,r){if(null!=e){if(null!=r&&r.hasToUseSetValue)return void r.setValue(t,e,this);if(this.isValueArray(e))return void this.valueToArray(e,t,r.name,r);var i=this.createNewObj(e,r);i.newObj&&(this.toObject(e,i.newObj),e=i.newObj),i.error||(null!=r?r.setValue(t,e,this):t[r.name]=e)}},e.prototype.isValueArray=function(e){return e&&Array.isArray(e)},e.prototype.createNewObj=function(t,n){var r={newObj:null,error:null},i=t[e.typePropertyName];return!i&&null!=n&&n.className&&(i=n.className),i=n.getClassName(i),r.newObj=i?e.metaData.createClass(i):null,r.error=this.checkNewObjectOnErrors(r.newObj,t,n,i),r},e.prototype.checkNewObjectOnErrors=function(t,n,r,i){var o=null;if(t){var a=e.metaData.getRequiredProperties(i);if(a)for(var s=0;s<a.length;s++)if(!n[a[s]]){o=new p(a[s],i);break}}else r.baseClassName&&(o=i?new h(r.name,r.baseClassName):new c(r.name,r.baseClassName));return o&&this.addNewError(o,n),o},e.prototype.addNewError=function(t,n){n&&n[e.positionPropertyName]&&(t.at=n[e.positionPropertyName].start),this.errors.push(t)},e.prototype.valueToArray=function(e,t,n,r){t[n]&&e.length>0&&t[n].splice(0,t[n].length);for(var i=0;i<e.length;i++){var o=this.createNewObj(e[i],r);o.newObj?(t[n].push(o.newObj),this.toObject(e[i],o.newObj)):o.error||t[n].push(e[i])}},e.prototype.findProperty=function(e,t){if(!e)return null;for(var n=0;n<e.length;n++){var r=e[n];if(r.name==t||r.alternativeName==t)return r}return null},e}();d.typePropertyName="type",d.positionPropertyName="pos",d.metaDataValue=new a},function(e,t,n){"use strict";var r=n(0),i=n(2);n.n(i);n.d(t,"a",function(){return o}),n.d(t,"c",function(){return a}),n.d(t,"b",function(){return s});var o=function(e){function t(t){var n=e.call(this,t)||this;return n.isDisplayMode=t.isDisplayMode||!1,n}return r.b(t,e),t.renderLocString=function(e,t){if(void 0===t&&(t=null),e.hasHtml){var n={__html:e.renderedHtml};return i.createElement("span",{style:t,dangerouslySetInnerHTML:n})}return i.createElement("span",{style:t},e.renderedHtml)},t.prototype.componentWillReceiveProps=function(e){this.isDisplayMode=e.isDisplayMode||!1},t.prototype.renderLocString=function(e,n){return void 0===n&&(n=null),t.renderLocString(e,n)},t}(i.Component),a=function(e){function t(t){var n=e.call(this,t)||this;return n.cssClasses=t.cssClasses,n}return r.b(t,e),t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.cssClasses=t.cssClasses},t}(o),s=function(e){function t(t){var n=e.call(this,t)||this;return n.questionBase=t.question,n.creator=t.creator,n}return r.b(t,e),t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.questionBase=t.question,this.creator=t.creator},t.prototype.shouldComponentUpdate=function(){return!this.questionBase.customWidget||!!this.questionBase.customWidgetData.isNeedRender||!!this.questionBase.customWidget.widgetJson.render},t}(o)},function(e,t,n){"use strict";var r=n(0),i=n(7);n.d(t,"b",function(){return o}),n.d(t,"d",function(){return s}),n.d(t,"e",function(){return a}),n.d(t,"a",function(){return u}),n.d(t,"c",function(){return l});var o=function(){function e(){this.propertyHash={},this.localizableStrings={},this.arrayOnPush={},this.isLoadingFromJsonValue=!1,this.onPropertyChanged=new l}return e.isValueEmpty=function(e){return!(!Array.isArray(e)||0!==e.length)||(e&&("string"==typeof e||e instanceof String)&&(e=e.trim()),!e&&0!==e&&!1!==e)},e.prototype.getType=function(){throw new Error("This method is abstract")},Object.defineProperty(e.prototype,"isLoadingFromJson",{get:function(){return this.isLoadingFromJsonValue},enumerable:!0,configurable:!0}),e.prototype.startLoadingFromJson=function(){this.isLoadingFromJsonValue=!0},e.prototype.endLoadingFromJson=function(){this.isLoadingFromJsonValue=!1},e.prototype.getPropertyValue=function(t,n){void 0===n&&(n=null);var r=this.propertyHash[t];return e.isValueEmpty(r)&&null!=n?n:r},e.prototype.setPropertyValueCore=function(e,t,n){e[t]=n},e.prototype.setPropertyValue=function(e,t){var n=this.propertyHash[e];if(n&&Array.isArray(n)){if(this.isTwoValueEquals(n,t))return;this.setArray(n,t,this.arrayOnPush[e]),this.propertyValueChanged(e,n,n)}else this.setPropertyValueCore(this.propertyHash,e,t),this.isTwoValueEquals(n,t)||this.propertyValueChanged(e,n,t)},e.prototype.propertyValueChanged=function(e,t,n){this.isLoadingFromJson||this.onPropertyChanged.fire(this,{name:e,oldValue:t,newValue:n})},e.prototype.createLocalizableString=function(e,t,n){void 0===n&&(n=!1);var r=new i.a(t,n);return this.localizableStrings[e]=r,r},e.prototype.getLocalizableString=function(e){return this.localizableStrings[e]},e.prototype.getLocalizableStringText=function(e,t){void 0===t&&(t="");var n=this.getLocalizableString(e);if(!n)return"";var r=n.text;return r||t},e.prototype.setLocalizableStringText=function(e,t){var n=this.getLocalizableString(e);if(n){var r=n.text;r!==t&&(n.text=t,this.propertyValueChanged(e,r,t))}},e.prototype.createNewArray=function(e,t,n){void 0===t&&(t=null),void 0===n&&(n=null);var r=new Array;this.propertyHash[e]=r,this.arrayOnPush[e]=t;var i=this;return r.push=function(n){var o=Array.prototype.push.call(r,n);return t&&t(n),i.propertyValueChanged(e,r,r),o},r.pop=function(){var t=Array.prototype.pop.call(r);return n&&n(t),i.propertyValueChanged(e,r,r),t},r.splice=function(o,a){for(var s=[],u=2;u<arguments.length;u++)s[u-2]=arguments[u];o||(o=0),a||(a=0);for(var l=[],c=0;c<a;c++)c+o>=r.length||l.push(r[c+o]);var h=(p=Array.prototype.splice).call.apply(p,[r,o,a].concat(s));if(s||(s=[]),n)for(var c=0;c<l.length;c++)n(l[c]);if(t)for(var c=0;c<s.length;c++)t(s[c],o+c);return i.propertyValueChanged(e,r,r),h;var p},r},e.prototype.setArray=function(e,t,n){e.length=0;for(var r=0;r<t.length;r++)Array.prototype.push.call(e,t[r]),n&&n(e[r])},e.prototype.isTwoValueEquals=function(e,t){if(e===t)return!0;if(!(e instanceof Object&&t instanceof Object))return!1;for(var n in e)if(e.hasOwnProperty(n)){if(!t.hasOwnProperty(n))return!1;if(e[n]!==t[n]){if("object"!=typeof e[n])return!1;if(!this.isTwoValueEquals(e[n],t[n]))return!1}}for(n in t)if(t.hasOwnProperty(n)&&!e.hasOwnProperty(n))return!1;return!0},e}();o.commentPrefix="-Comment";var a,s=function(){function e(){}return e.prototype.getText=function(){throw new Error("This method is abstract")},e}();a="sq_page";var u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.selectedElementInDesignValue=t,t}return r.b(t,e),t.ScrollElementToTop=function(e){if(!e)return!1;var t=document.getElementById(e);if(!t||!t.scrollIntoView)return!1;var n=t.getBoundingClientRect().top;return n<0&&t.scrollIntoView(),n<0},t.GetFirstNonTextElement=function(e){if(e&&e.length){for(var t=0;t<e.length;t++)if("#text"!=e[t].nodeName&&"#comment"!=e[t].nodeName)return e[t];return null}},t.FocusElement=function(e){if(!e)return!1;var t=document.getElementById(e);return!!t&&(t.focus(),!0)},t.prototype.setSurveyImpl=function(e){this.surveyImplValue=e,this.surveyImplValue&&(this.surveyDataValue=this.surveyImplValue.geSurveyData(),this.surveyValue=this.surveyImplValue.getSurvey(),this.textProcessorValue=this.surveyImplValue.getTextProcessor(),this.onSetData())},t.setVisibleIndex=function(e,t,n){for(var r=t,i=0;i<e.length;i++){var o=e[i];n&&o.visible&&o.hasTitle?t+=o.setVisibleIndex(t):o.setVisibleIndex(-1)}return t-r},Object.defineProperty(t.prototype,"surveyImpl",{get:function(){return this.surveyImplValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.surveyDataValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"survey",{get:function(){return this.surveyValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isLoadingFromJson",{get:function(){return this.survey?this.survey.isLoadingFromJson:this.isLoadingFromJsonValue},enumerable:!0,configurable:!0}),t.prototype.getElementsInDesign=function(e){return void 0===e&&(e=!1),[]},Object.defineProperty(t.prototype,"selectedElementInDesign",{get:function(){return this.selectedElementInDesignValue},set:function(e){this.selectedElementInDesignValue=e},enumerable:!0,configurable:!0}),t.prototype.updateCustomWidgets=function(){},t.prototype.onSurveyLoad=function(){},t.prototype.endLoadingFromJson=function(){e.prototype.endLoadingFromJson.call(this),this.survey||this.onSurveyLoad()},Object.defineProperty(t.prototype,"textProcessor",{get:function(){return this.textProcessorValue},enumerable:!0,configurable:!0}),t.prototype.onSetData=function(){},t}(o),l=function(){function e(){}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return null==this.callbacks||0==this.callbacks.length},enumerable:!0,configurable:!0}),e.prototype.fire=function(e,t){if(null!=this.callbacks)for(var n=0;n<this.callbacks.length;n++){this.callbacks[n](e,t)}},e.prototype.add=function(e){null==this.callbacks&&(this.callbacks=new Array),this.callbacks.push(e)},e.prototype.remove=function(e){if(null!=this.callbacks){var t=this.callbacks.indexOf(e,0);void 0!=t&&this.callbacks.splice(t,1)}},e}()},function(e,t,n){"use strict";var r=n(1);n.d(t,"a",function(){return i}),n.d(t,"b",function(){return o});var i=function(){function e(){this.creatorHash={}}return Object.defineProperty(e,"DefaultChoices",{get:function(){return[r.a.getString("choices_Item")+"1",r.a.getString("choices_Item")+"2",r.a.getString("choices_Item")+"3"]},enumerable:!0,configurable:!0}),Object.defineProperty(e,"DefaultColums",{get:function(){var e=r.a.getString("matrix_column")+" ";return[e+"1",e+"2",e+"3"]},enumerable:!0,configurable:!0}),Object.defineProperty(e,"DefaultRows",{get:function(){var e=r.a.getString("matrix_row")+" ";return[e+"1",e+"2"]},enumerable:!0,configurable:!0}),e.prototype.registerQuestion=function(e,t){this.creatorHash[e]=t},e.prototype.clear=function(){this.creatorHash={}},e.prototype.getAllTypes=function(){var e=new Array;for(var t in this.creatorHash)e.push(t);return e.sort()},e.prototype.createQuestion=function(e,t){var n=this.creatorHash[e];return null==n?null:n(t)},e}();i.Instance=new i;var o=function(){function e(){this.creatorHash={}}return e.prototype.registerElement=function(e,t){this.creatorHash[e]=t},e.prototype.clear=function(){this.creatorHash={}},e.prototype.getAllTypes=function(){var e=i.Instance.getAllTypes();for(var t in this.creatorHash)e.push(t);return e.sort()},e.prototype.createElement=function(e,t){var n=this.creatorHash[e];return null==n?i.Instance.createQuestion(e,t):n(t)},e}();o.Instance=new o},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(e,t){void 0===t&&(t=!1),this.owner=e,this.useMarkdown=t,this.values={},this.htmlValues={},this.onGetTextCallback=null,this.onCreating()}return Object.defineProperty(e.prototype,"locale",{get:function(){return this.owner?this.owner.getLocale():""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){var e=this.pureText;return this.onGetTextCallback&&(e=this.onGetTextCallback(e)),e},set:function(e){this.setLocaleText(this.locale,e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pureText",{get:function(){var t=this.locale;t||(t=e.defaultLocale);var n=this.values[t];return n||t===e.defaultLocale||(n=this.values[e.defaultLocale]),n||(n=""),n},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasHtml",{get:function(){return this.hasHtmlValue()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"html",{get:function(){return this.hasHtml?this.getHtmlValue():""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textOrHtml",{get:function(){return this.hasHtml?this.getHtmlValue():this.text},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderedHtml",{get:function(){var e=this.textOrHtml;return this.onRenderedHtmlCallback?this.onRenderedHtmlCallback(e):e},enumerable:!0,configurable:!0}),e.prototype.getLocaleText=function(t){t||(t=e.defaultLocale);var n=this.values[t];return n||""},e.prototype.setLocaleText=function(t,n){n!=this.getLocaleText(t)&&(t||(t=e.defaultLocale),delete this.htmlValues[t],n?"string"==typeof n&&(t!=e.defaultLocale&&n==this.getLocaleText(e.defaultLocale)?this.setLocaleText(t,null):(this.values[t]=n,t==e.defaultLocale&&this.deleteValuesEqualsToDefault(n))):this.values[t]&&delete this.values[t],this.onChanged())},e.prototype.getJson=function(){var t=Object.keys(this.values);return 0==t.length?null:1==t.length&&t[0]==e.defaultLocale?this.values[t[0]]:this.values},e.prototype.setJson=function(e){if(this.values={},this.htmlValues={},e){if("string"==typeof e)this.setLocaleText(null,e);else for(var t in e)this.setLocaleText(t,e[t]);this.onChanged()}},e.prototype.onChanged=function(){},e.prototype.onCreating=function(){},e.prototype.hasHtmlValue=function(){if(!this.owner||!this.useMarkdown)return!1;var t=this.text;if(!t)return!1;var n=this.locale;return n||(n=e.defaultLocale),n in this.htmlValues||(this.htmlValues[n]=this.owner.getMarkdownHtml(t)),!!this.htmlValues[n]},e.prototype.getHtmlValue=function(){var t=this.locale;return t||(t=e.defaultLocale),this.htmlValues[t]},e.prototype.deleteValuesEqualsToDefault=function(t){for(var n=Object.keys(this.values),r=0;r<n.length;r++)n[r]!=e.defaultLocale&&this.values[n[r]]==t&&delete this.values[n[r]]},e}();r.defaultLocale="default"},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(){this.creatorHash={}}return e.prototype.registerQuestion=function(e,t){this.creatorHash[e]=t},e.prototype.getAllTypes=function(){var e=new Array;for(var t in this.creatorHash)e.push(t);return e.sort()},e.prototype.createQuestion=function(e,t){var n=this.creatorHash[e];return null==n?null:n(t)},e}();r.Instance=new r},function(e,t,n){"use strict";var r=n(0),i=n(3),o=n(23),a=n(5),s=n(1),u=n(10),l=n(29),c=n(17),h=n(7),p=n(15);n.d(t,"a",function(){return d});var d=function(e){function t(t){var n=e.call(this,t)||this;n.name=t,n.isRequiredValue=!1,n.hasCommentValue=!1,n.hasOtherValue=!1,n.readOnlyValue=!1,n.errors=[],n.validators=new Array,n.enableIf="",n.isvalueChangedCallbackFiring=!1,n.isValueChangedInSurvey=!1;var r=n;return n.locTitleValue=new h.a(n,!0),n.locTitleValue.onRenderedHtmlCallback=function(e){return r.fullTitle},n.locDescriptionValue=new h.a(n,!0),n.locDescriptionValue.onRenderedHtmlCallback=function(e){return r.getProcessedHtml(e)},n.locCommentTextValue=new h.a(n,!0),n.locRequiredErrorTextValue=new h.a(n),n}return r.b(t,e),Object.defineProperty(t.prototype,"hasTitle",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasDescription",{get:function(){return""!=this.description},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"titleLocation",{get:function(){return this.survey?this.survey.questionTitleLocation:"top"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"errorLocation",{get:function(){return this.survey?this.survey.questionErrorLocation:"top"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasInput",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputId",{get:function(){return this.id+"i"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){var e=this.locTitle.text;return e||this.name},set:function(e){this.locTitle.text=e,this.fireCallback(this.titleChangedCallback)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locTitle",{get:function(){return this.locTitleValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"description",{get:function(){return this.locDescription.text?this.locDescription.text:""},set:function(e){this.locDescription.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locDescription",{get:function(){return this.locDescriptionValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"requiredErrorText",{get:function(){return this.locRequiredErrorText.text?this.locRequiredErrorText.text:""},set:function(e){this.locRequiredErrorText.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locRequiredErrorText",{get:function(){return this.locRequiredErrorTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locCommentText",{get:function(){return this.locCommentTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locTitleHtml",{get:function(){var e=this.locTitle.textOrHtml;return e||this.name},enumerable:!0,configurable:!0}),t.prototype.getAllErrors=function(){return this.errors.slice()},t.prototype.onLocaleChanged=function(){e.prototype.onLocaleChanged.call(this),this.locTitle.onChanged(),this.locCommentText.onChanged()},t.prototype.getProcessedHtml=function(e){return e&&this.textProcessor?this.textProcessor.processText(e,!0):e},Object.defineProperty(t.prototype,"processedTitle",{get:function(){return this.getProcessedHtml(this.locTitleHtml)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fullTitle",{get:function(){if(this.survey&&this.survey.getQuestionTitleTemplate()){if(!this.textPreProcessor){var e=this;this.textPreProcessor=new c.a,this.textPreProcessor.onHasValue=function(t){return e.canProcessedTextValues(t.toLowerCase())},this.textPreProcessor.onProcess=function(t){return e.getProcessedTextValue(t)}}return this.textPreProcessor.process(this.survey.getQuestionTitleTemplate())}var t=this.requiredText;t&&(t+=" ");var n=this.no;return n&&(n+=". "),n+t+this.processedTitle},enumerable:!0,configurable:!0}),t.prototype.focus=function(e){void 0===e&&(e=!1),a.a.ScrollElementToTop(this.id);var t=e?this.getFirstErrorInputElementId():this.getFirstInputElementId();a.a.FocusElement(t)&&this.fireCallback(this.focusCallback)},t.prototype.updateCssClasses=function(t,n){e.prototype.updateCssClasses.call(this,t,n),this.isRequired&&(n.question.required&&(t.root+=" "+n.question.required),n.question.titleRequired&&(t.title+=" "+n.question.titleRequired))},t.prototype.getFirstInputElementId=function(){return this.inputId},t.prototype.getFirstErrorInputElementId=function(){return this.getFirstInputElementId()},t.prototype.canProcessedTextValues=function(e){return"no"==e||"title"==e||"require"==e},t.prototype.getProcessedTextValue=function(e){return"no"==e?this.no:"title"==e?this.processedTitle:"require"==e?this.requiredText:null},t.prototype.supportComment=function(){return!1},t.prototype.supportOther=function(){return!1},Object.defineProperty(t.prototype,"isRequired",{get:function(){return this.isRequiredValue},set:function(e){this.isRequired!=e&&(this.isRequiredValue=e,this.fireCallback(this.titleChangedCallback))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasComment",{get:function(){return this.hasCommentValue},set:function(e){this.supportComment()&&(this.hasCommentValue=e,this.hasComment&&(this.hasOther=!1))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"commentText",{get:function(){var e=this.locCommentText.text;return e||s.a.getString("otherItemText")},set:function(e){this.locCommentText.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasOther",{get:function(){return this.hasOtherValue},set:function(e){this.supportOther()&&this.hasOther!=e&&(this.hasOtherValue=e,this.hasOther&&(this.hasComment=!1),this.hasOtherChanged())},enumerable:!0,configurable:!0}),t.prototype.hasOtherChanged=function(){},Object.defineProperty(t.prototype,"isReadOnly",{get:function(){return this.readOnly||null!=this.survey&&this.survey.isDisplayMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"readOnly",{get:function(){return this.readOnlyValue},set:function(e){this.readOnly!=e&&(this.readOnlyValue=e,this.onReadOnlyChanged())},enumerable:!0,configurable:!0}),t.prototype.runCondition=function(t){e.prototype.runCondition.call(this,t),this.enableIf&&(this.conditionEnabelRunner||(this.conditionEnabelRunner=new p.a(this.enableIf)),this.conditionEnabelRunner.expression=this.enableIf,this.readOnly=!this.conditionEnabelRunner.run(t))},t.prototype.onReadOnlyChanged=function(){this.fireCallback(this.readOnlyChangedCallback)},t.prototype.onAnyValueChanged=function(e){if(e){var t=this.locTitle.text;t&&t.toLocaleLowerCase().indexOf("{"+e.toLowerCase())>-1&&this.fireCallback(this.titleChangedCallback)}},Object.defineProperty(t.prototype,"no",{get:function(){if(this.visibleIndex<0)return"";var e=1,t=!0,n="";return this.survey&&this.survey.questionStartIndex&&(n=this.survey.questionStartIndex,parseInt(n)?e=parseInt(n):1==n.length&&(t=!1)),t?(this.visibleIndex+e).toString():String.fromCharCode(n.charCodeAt(0)+this.visibleIndex)},enumerable:!0,configurable:!0}),t.prototype.onSetData=function(){e.prototype.onSetData.call(this),this.onSurveyValueChanged(this.value)},Object.defineProperty(t.prototype,"value",{get:function(){return this.valueFromData(this.getValueCore())},set:function(e){this.setNewValue(e),this.isvalueChangedCallbackFiring||(this.isvalueChangedCallbackFiring=!0,this.fireCallback(this.valueChangedCallback),this.isvalueChangedCallbackFiring=!1)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"displayValue",{get:function(){return this.value},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"comment",{get:function(){return this.getComment()},set:function(e){this.comment!=e&&(this.setComment(e),this.fireCallback(this.commentChangedCallback))},enumerable:!0,configurable:!0}),t.prototype.getComment=function(){return null!=this.data?this.data.getComment(this.name):this.questionComment},t.prototype.setComment=function(e){this.setNewComment(e)},t.prototype.isEmpty=function(){return a.b.isValueEmpty(this.value)},t.prototype.hasErrors=function(e){return void 0===e&&(e=!0),this.checkForErrors(e),this.errors.length>0},Object.defineProperty(t.prototype,"currentErrorCount",{get:function(){return this.errors.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"requiredText",{get:function(){return null!=this.survey&&this.isRequired?this.survey.requiredText:""},enumerable:!0,configurable:!0}),t.prototype.addError=function(e){this.errors.push(e),this.fireCallback(this.errorsChangedCallback)},t.prototype.checkForErrors=function(e){var t=this.errors?this.errors.length:0;if(this.errors=[],this.onCheckForErrors(this.errors),0==this.errors.length&&!this.isEmpty()){var n=this.runValidators();n&&this.errors.push(n)}if(this.survey&&0==this.errors.length){var n=this.fireSurveyValidation();n&&this.errors.push(n)}e&&(t!=this.errors.length||t>0)&&this.fireCallback(this.errorsChangedCallback)},t.prototype.fireSurveyValidation=function(){return this.validateValueCallback?this.validateValueCallback():this.survey?this.survey.validateQuestion(this.name):null},t.prototype.onCheckForErrors=function(e){this.hasRequiredError()&&this.errors.push(new u.a(this.requiredErrorText))},t.prototype.hasRequiredError=function(){return this.isRequired&&this.isEmpty()},t.prototype.runValidators=function(){return(new l.a).run(this)},t.prototype.setNewValue=function(e){this.setNewValueInData(e),this.onValueChanged()},t.prototype.setNewValueInData=function(e){this.isValueChangedInSurvey||(e=this.valueToData(e),this.setValueCore(e))},t.prototype.getValueCore=function(){return null!=this.data?this.data.getValue(this.name):this.questionValue},t.prototype.setValueCore=function(e){null!=this.data?this.data.setValue(this.name,e):this.questionValue=e},t.prototype.valueFromData=function(e){return e},t.prototype.valueToData=function(e){return e},t.prototype.onValueChanged=function(){},t.prototype.setNewComment=function(e){null!=this.data?this.data.setComment(this.name,e):this.questionComment=e},t.prototype.onSurveyValueChanged=function(e){this.isValueChangedInSurvey=!0,this.value=this.valueFromData(e),this.fireCallback(this.commentChangedCallback),this.isValueChangedInSurvey=!1},t.prototype.getValidatorTitle=function(){return null},t}(o.a);i.a.metaData.addClass("question",[{name:"title:text",serializationProperty:"locTitle"},{name:"description:text",serializationProperty:"locDescription"},{name:"commentText",serializationProperty:"locCommentText"},"enableIf:expression","isRequired:boolean",{name:"requiredErrorText:text",serializationProperty:"locRequiredErrorText"},"readOnly:boolean",{name:"validators:validators",baseClassName:"surveyvalidator",classNamePart:"validator"}],null,"questionbase")},function(e,t,n){"use strict";var r=n(0),i=n(1),o=n(5);n.d(t,"a",function(){return a}),n.d(t,"b",function(){return s}),n.d(t,"d",function(){return u}),n.d(t,"c",function(){return l});var a=function(e){function t(t){void 0===t&&(t=null);var n=e.call(this)||this;return n.customErrorText=t,n}return r.b(t,e),t.prototype.getText=function(){return this.customErrorText?this.customErrorText:i.a.getString("requiredError")},t}(o.d),s=function(e){function t(){return e.call(this)||this}return r.b(t,e),t.prototype.getText=function(){return i.a.getString("numericError")},t}(o.d),u=function(e){function t(t){var n=e.call(this)||this;return n.maxSize=t,n}return r.b(t,e),t.prototype.getText=function(){return i.a.getString("exceedMaxSize").format(this.getTextSize())},t.prototype.getTextSize=function(){var e=["Bytes","KB","MB","GB","TB"],t=[0,0,2,3,3];if(0==this.maxSize)return"0 Byte";var n=Math.floor(Math.log(this.maxSize)/Math.log(1024));return(this.maxSize/Math.pow(1024,n)).toFixed(t[n])+" "+e[n]},t}(o.d),l=function(e){function t(t){var n=e.call(this)||this;return n.text=t,n}return r.b(t,e),t.prototype.getText=function(){return this.text},t}(o.d)},function(e,t,n){"use strict";n.d(t,"b",function(){return r}),n.d(t,"a",function(){return i});var r={currentType:"",getCss:function(){var e=this.currentType?this[this.currentType]:i;return e||(e=i),e}},i={root:"sv_main",header:"",body:"sv_body",footer:"sv_nav",navigationButton:"",navigation:{complete:"sv_complete_btn",prev:"sv_prev_btn",next:"sv_next_btn"},progress:"sv_progress",progressBar:"",pageTitle:"sv_p_title",row:"sv_row",question:{mainRoot:"sv_q",title:"sv_q_title",description:"sv_q_description",comment:"",required:"",titleRequired:"",indent:20},panel:{title:"sv_p_title",container:""},error:{root:"sv_q_erbox",icon:"",item:""},boolean:{root:"sv_qcbc",item:"sv_q_checkbox"},checkbox:{root:"sv_qcbc",item:"sv_q_checkbox",other:"sv_q_other"},comment:"",dropdown:{root:"",control:"",other:"sv_q_other"},matrix:{root:"sv_q_matrix"},matrixdropdown:{root:"sv_q_matrix"},matrixdynamic:{root:"table",button:""},paneldynamic:{root:"",button:""},multipletext:{root:"",itemTitle:"",row:"",itemValue:""},radiogroup:{root:"sv_qcbc",item:"sv_q_radiogroup",label:"",other:"sv_q_other"},rating:{root:"sv_q_rating",item:"sv_q_rating_item",selected:"active"},text:"",saveData:{root:"",saving:"",error:"",success:"",saveAgainButton:""},window:{root:"sv_window",body:"sv_window_content",header:{root:"sv_window_title",title:"",button:"",buttonExpanded:"",buttonCollapsed:""}}};r.standard=i},function(e,t,n){"use strict";var r=n(7),i=n(3);n.d(t,"a",function(){return o});var o=function(){function e(e,t){void 0===t&&(t=null),this.locTextValue=new r.a(null,!0);var n=this;this.locTextValue.onGetTextCallback=function(e){return e||(n.isValueEmpty?null:n.value.toString())},t&&(this.locText.text=t),this.value=e}return e.createArray=function(t){var n=[];return e.setupArray(n,t),n},e.setupArray=function(e,t){e.push=function(e){var n=Array.prototype.push.call(this,e);return e.locOwner=t,n},e.splice=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=(s=Array.prototype.splice).call.apply(s,[this,e,n].concat(r));r||(r=[]);for(var a=0;a<r.length;a++)r[a].locOwner=t;return o;var s}},e.setData=function(t,n){t.length=0;for(var r=0;r<n.length;r++){var i=n[r],o=new e(null);o.setData(i),t.push(o)}},e.getData=function(e){for(var t=new Array,n=0;n<e.length;n++)t.push(e[n].getData());return t},e.getItemByValue=function(e,t){for(var n=0;n<e.length;n++)if(e[n].value==t)return e[n];return null},e.getTextOrHtmlByValue=function(t,n){var r=e.getItemByValue(t,n);return null!==r?r.locText.textOrHtml:""},e.NotifyArrayOnLocaleChanged=function(e){for(var t=0;t<e.length;t++)e[t].locText.onChanged()},e.prototype.getType=function(){return"itemvalue"},Object.defineProperty(e.prototype,"locText",{get:function(){return this.locTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"locOwner",{get:function(){return this.locText.owner},set:function(e){this.locText.owner=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.itemValue},set:function(t){if(this.itemValue=t,this.itemValue){var n=this.itemValue.toString(),r=n.indexOf(e.Separator);r>-1&&(this.itemValue=n.slice(0,r),this.text=n.slice(r+1))}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasText",{get:function(){return!!this.locText.pureText},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this.locText.text},set:function(e){this.locText.text=e},enumerable:!0,configurable:!0}),e.prototype.getData=function(){var e=this.getCustomAttributes(),t=this.locText.getJson();if(!e&&!t)return this.value;var n={value:this.value};if(t&&(n.text=t),e)for(var r in e)n[r]=e[r];return n},e.prototype.setData=function(t){if(void 0!==t.value){var n=null;this.isObjItemValue(t)&&(t.itemValue=t.itemValue,this.locText.setJson(t.locText.getJson()),n=e.itemValueProp),this.copyAttributes(t,n)}else this.value=t},Object.defineProperty(e.prototype,"isValueEmpty",{get:function(){return!this.itemValue&&0!==this.itemValue&&!1!==this.itemValue},enumerable:!0,configurable:!0}),e.prototype.isObjItemValue=function(e){return void 0!==e.getType&&"itemvalue"==e.getType()},e.prototype.copyAttributes=function(e,t){for(var n in e)"function"!=typeof e[n]&&(t&&t.indexOf(n)>-1||("text"==n?this.locText.setJson(e[n]):this[n]=e[n]))},e.prototype.getCustomAttributes=function(){var t=null;for(var n in this)"function"==typeof this[n]||e.itemValueProp.indexOf(n)>-1||"itemValue"==n||(null==t&&(t={}),t[n]=this[n]);return t},e}();o.Separator="|",o.itemValueProp=["text","value","hasText","locOwner","locText","isValueEmpty","locTextValue","pos"],i.a.metaData.addClass("itemvalue",["!value",{name:"text",onGetValue:function(e){return e.locText.pureText}}])},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(8);n.d(t,"b",function(){return s}),n.d(t,"a",function(){return u});var s=function(e){function t(t){var n=e.call(this,t)||this;return n.state={value:n.question.value||""},n.handleOnChange=n.handleOnChange.bind(n),n.handleOnBlur=n.handleOnBlur.bind(n),n}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.state={value:this.question.value||""}},t.prototype.handleOnChange=function(e){this.setState({value:e.target.value})},t.prototype.handleOnBlur=function(e){this.question.value=e.target.value,this.setState({value:this.question.value||""})},t.prototype.render=function(){if(!this.question)return null;var e=this.question.cssClasses;return i.createElement("textarea",{id:this.question.inputId,className:e.root,type:"text",readOnly:this.isDisplayMode,value:this.state.value,placeholder:this.question.placeHolder,onBlur:this.handleOnBlur,onChange:this.handleOnChange,cols:this.question.cols,rows:this.question.rows})},t}(o.b),u=function(e){function t(t){var n=e.call(this,t)||this;return n.question=t.question,n.comment=n.question.comment,n.otherCss=t.otherCss,n.state={value:n.comment},n.handleOnChange=n.handleOnChange.bind(n),n.handleOnBlur=n.handleOnBlur.bind(n),n}return r.b(t,e),t.prototype.handleOnChange=function(e){this.comment=e.target.value,this.setState({value:this.comment})},t.prototype.handleOnBlur=function(e){this.question.comment=this.comment},t.prototype.componentWillReceiveProps=function(e){this.question=e.question},t.prototype.render=function(){if(!this.question)return null;if(this.isDisplayMode)return i.createElement("div",{className:this.cssClasses.comment},this.comment);var e=this.otherCss?this.otherCss:this.cssClasses.comment;return i.createElement("input",{type:"text",className:e,value:this.state.value,onChange:this.handleOnChange,onBlur:this.handleOnBlur})},t}(o.c);a.a.Instance.registerQuestion("comment",function(e){return i.createElement(s,e)})},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(){this.values=null}return e.prototype.getFirstName=function(e){if(!e)return e;for(var t="",n=0;n<e.length;n++){var r=e[n];if("."==r||"["==r)break;t+=r}return t},e.prototype.hasValue=function(e,t){return void 0===t&&(t=null),t||(t=this.values),this.getValueCore(e,t).hasValue},e.prototype.getValue=function(e,t){return void 0===t&&(t=null),t||(t=this.values),this.getValueCore(e,t).value},e.prototype.getValueCore=function(e,t){var n={hasValue:!1,value:null},r=t;if(!r)return n;for(var i=!0;e&&e.length>0;){if(!i&&"["==e[0]){if(!Array.isArray(r))return n;for(var o=1,a="";o<e.length&&"]"!=e[o];)a+=e[o],o++;if(e=o<e.length?e.substr(o+1):"",(o=this.getIntValue(a))<0||o>=r.length)return n;r=r[o]}else{i||(e=e.substr(1));var s=this.getFirstName(e);if(!s)return n;if(!r[s])return n;r=r[s],e=e.substr(s.length)}i=!1}return n.value=r,n.hasValue=!0,n},e.prototype.getIntValue=function(e){return"0"==e||(0|e)>0&&e%1==0?Number(e):-1},e}()},function(e,t,n){"use strict";var r=n(0),i=n(31),o=n(33),a=n(14);n.d(t,"c",function(){return s}),n.d(t,"d",function(){return u}),n.d(t,"b",function(){return l}),n.d(t,"e",function(){return c}),n.d(t,"a",function(){return h});var s=function(){function e(e){this.origionalValue=e}return e.prototype.getValue=function(e){var t=this.origionalValue;if(void 0===t||"undefined"===t)return null;if(!t||"string"!=typeof t)return t;if(t=this.removeQuotes(t),e){var n=this.getValueName(t);if(n)return e.hasValue(n)?e.getValue(n):null}return t},e.prototype.operandToString=function(){var e=this.origionalValue;return e&&!this.isNumeric(e)&&(e="'"+e+"'"),e},e.prototype.removeQuotes=function(e){e.length>0&&("'"==e[0]||'"'==e[0])&&(e=e.substr(1));var t=e.length;return t>0&&("'"==e[t-1]||'"'==e[t-1])&&(e=e.substr(0,t-1)),e},e.prototype.getValueName=function(e){return e.length<3||"{"!=e[0]||"}"!=e[e.length-1]?null:e.substr(1,e.length-2)},e.prototype.isNumeric=function(e){var t=parseFloat(e);return!isNaN(t)&&isFinite(t)},e}(),u=function(e){function t(t){var n=e.call(this,t)||this;return n.origionalValue=t,n.parameters=new Array,n}return r.b(t,e),t.prototype.getValue=function(e){for(var t=[],n=0;n<this.parameters.length;n++)t.push(this.parameters[n].getValue(e));return o.a.Instance.run(this.origionalValue,t)},t.prototype.operandToString=function(){for(var e=this.origionalValue+"(",t=0;t<this.parameters.length;t++)t>0&&(e+=", "),e+=this.parameters[t].operandToString();return e},t}(s),l=function(){function e(){this.opValue="equal",this.leftValue=null,this.rightValue=null}return Object.defineProperty(e,"operators",{get:function(){return null!=e.operatorsValue?e.operatorsValue:(e.operatorsValue={empty:function(e,t){return null==e||!e},notempty:function(e,t){return null!=e&&!!e},equal:function(e,t){return!(null==e&&null!=t||null!=e&&null==t)&&(null==e&&null==t||e==t)},notequal:function(e,t){return null==e&&null!=t||null!=e&&null==t||(null!=e||null!=t)&&e!=t},contains:function(e,t){return null!=e&&e.indexOf&&e.indexOf(t)>-1},notcontains:function(e,t){return null==e||!e.indexOf||-1==e.indexOf(t)},greater:function(e,t){return null!=e&&(null==t||e>t)},less:function(e,t){return null!=t&&(null==e||e<t)},greaterorequal:function(e,t){return(null!=e||null==t)&&(null==t||e>=t)},lessorequal:function(e,t){return(null==e||null!=t)&&(null==e||e<=t)}},e.operatorsValue)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"left",{get:function(){return this.leftValue},set:function(e){this.leftValue=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){return this.rightValue},set:function(e){this.rightValue=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"operator",{get:function(){return this.opValue},set:function(t){t&&(t=t.toLowerCase(),e.operators[t]&&(this.opValue=t))},enumerable:!0,configurable:!0}),e.prototype.perform=function(e,t,n){return void 0===e&&(e=null),void 0===t&&(t=null),void 0===n&&(n=null),e||(e=this.left),t||(t=this.right),this.performExplicit(e,t,n)},e.prototype.performExplicit=function(t,n,r){var i=t?t.getValue(r):null,o=n?n.getValue(r):null;return e.operators[this.operator](i,o)},e}();l.operatorsValue=null;var c=function(){function e(){this.connectiveValue="and",this.children=[]}return Object.defineProperty(e.prototype,"connective",{get:function(){return this.connectiveValue},set:function(e){e&&(e=e.toLowerCase(),"&"!=e&&"&&"!=e||(e="and"),"|"!=e&&"||"!=e||(e="or"),"and"!=e&&"or"!=e||(this.connectiveValue=e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0==this.children.length},enumerable:!0,configurable:!0}),e.prototype.clear=function(){this.children=[],this.connective="and"},e}(),h=function(){function e(e){this.root=new c,this.expression=e,this.processValue=new a.a}return Object.defineProperty(e.prototype,"expression",{get:function(){return this.expressionValue},set:function(e){this.expression!=e&&(this.expressionValue=e,(new i.a).parse(this.expressionValue,this.root))},enumerable:!0,configurable:!0}),e.prototype.run=function(e){return this.processValue.values=e,this.runNode(this.root)},e.prototype.runNode=function(e){for(var t="and"==e.connective,n=0;n<e.children.length;n++){var r=this.runNodeCondition(e.children[n]);if(!r&&t)return!1;if(r&&!t)return!0}return t},e.prototype.runNodeCondition=function(e){return e.children?this.runNode(e):!!e.left&&this.runCondition(e)},e.prototype.runCondition=function(e){return e.performExplicit(e.left,e.right,this.processValue)},e}()},function(e,t,n){"use strict";var r=n(0),i=n(3),o=n(9),a=n(12),s=n(1),u=n(10),l=n(20),c=n(7);n.d(t,"b",function(){return h}),n.d(t,"a",function(){return p});var h=function(e){function t(t){var n=e.call(this,t)||this;n.visibleChoicesCache=null,n.otherItemValue=new a.a("other",s.a.getString("otherItemText")),n.choicesFromUrl=null,n.cachedValueForUrlRequestion=null,n.storeOthersAsComment=!0,n.choicesOrderValue="none",n.isSettingComment=!1,n.choicesValues=a.a.createArray(n),n.choicesByUrl=n.createRestfull(),n.locOtherTextValue=new c.a(n,!0),n.locOtherErrorTextValue=new c.a(n,!0),n.otherItemValue.locOwner=n;var r=n;return n.choicesByUrl.getResultCallback=function(e){r.onLoadChoicesFromUrl(e)},n}return r.b(t,e),Object.defineProperty(t.prototype,"otherItem",{get:function(){return this.otherItemValue.text=this.otherText?this.otherText:s.a.getString("otherItemText"),this.otherItemValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isOtherSelected",{get:function(){return this.getStoreOthersAsComment()?this.getHasOther(this.value):this.getHasOther(this.cachedValue)},enumerable:!0,configurable:!0}),t.prototype.getHasOther=function(e){return e==this.otherItem.value},t.prototype.createRestfull=function(){return new l.a},t.prototype.getComment=function(){return this.getStoreOthersAsComment()?e.prototype.getComment.call(this):this.commentValue},t.prototype.setComment=function(t){this.getStoreOthersAsComment()?e.prototype.setComment.call(this,t):this.isSettingComment||t==this.commentValue||(this.isSettingComment=!0,this.commentValue=t,this.isOtherSelected&&this.setNewValueInData(this.cachedValue),this.isSettingComment=!1)},t.prototype.setNewValue=function(t){t&&(this.cachedValueForUrlRequestion=t),e.prototype.setNewValue.call(this,t)},t.prototype.valueFromData=function(t){return this.getStoreOthersAsComment()?e.prototype.valueFromData.call(this,t):(this.cachedValue=this.valueFromDataCore(t),this.cachedValue)},t.prototype.valueToData=function(t){return this.getStoreOthersAsComment()?e.prototype.valueToData.call(this,t):(this.cachedValue=t,this.valueToDataCore(t))},t.prototype.valueFromDataCore=function(e){return this.hasUnknownValue(e)?e==this.otherItem.value?e:(this.comment=e,this.otherItem.value):e},t.prototype.valueToDataCore=function(e){return e==this.otherItem.value&&this.getComment()&&(e=this.getComment()),e},t.prototype.hasUnknownValue=function(e){if(!e)return!1;for(var t=this.activeChoices,n=0;n<t.length;n++)if(t[n].value==e)return!1;return!0},Object.defineProperty(t.prototype,"choices",{get:function(){return this.choicesValues},set:function(e){a.a.setData(this.choicesValues,e),this.onVisibleChoicesChanged()},enumerable:!0,configurable:!0}),t.prototype.hasOtherChanged=function(){this.onVisibleChoicesChanged()},Object.defineProperty(t.prototype,"choicesOrder",{get:function(){return this.choicesOrderValue},set:function(e){(e=e.toLowerCase())!=this.choicesOrderValue&&(this.choicesOrderValue=e,this.onVisibleChoicesChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"otherText",{get:function(){return this.locOtherText.text},set:function(e){this.locOtherText.text=e,this.onVisibleChoicesChanged()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"otherErrorText",{get:function(){return this.locOtherErrorText.text},set:function(e){this.locOtherErrorText.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locOtherText",{get:function(){return this.locOtherTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locOtherErrorText",{get:function(){return this.locOtherErrorTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"visibleChoices",{get:function(){return this.hasOther||"none"!=this.choicesOrder?(this.visibleChoicesCache||(this.visibleChoicesCache=this.sortVisibleChoices(this.activeChoices.slice()),this.hasOther&&this.visibleChoicesCache.push(this.otherItem)),this.visibleChoicesCache):this.activeChoices},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"displayValue",{get:function(){return this.isEmpty()?"":this.getDisplayValue(this.visibleChoices,this.value)},enumerable:!0,configurable:!0}),t.prototype.getDisplayValue=function(e,t){if(t==this.otherItemValue.value)return this.comment?this.comment:"";var n=a.a.getTextOrHtmlByValue(e,t);return""==n&&t?t:n},Object.defineProperty(t.prototype,"activeChoices",{get:function(){return this.choicesFromUrl?this.choicesFromUrl:this.choices},enumerable:!0,configurable:!0}),t.prototype.supportComment=function(){return!0},t.prototype.supportOther=function(){return!0},t.prototype.onCheckForErrors=function(t){if(e.prototype.onCheckForErrors.call(this,t),this.isOtherSelected&&!this.comment){var n=this.otherErrorText;n||(n=s.a.getString("otherRequiredError")),t.push(new u.c(n))}},t.prototype.onLocaleChanged=function(){e.prototype.onLocaleChanged.call(this),this.onVisibleChoicesChanged(),a.a.NotifyArrayOnLocaleChanged(this.visibleChoices)},t.prototype.getStoreOthersAsComment=function(){return this.storeOthersAsComment&&(null==this.survey||this.survey.storeOthersAsComment)},t.prototype.onSurveyLoad=function(){e.prototype.onSurveyLoad.call(this),this.runChoicesByUrl(),this.onVisibleChoicesChanged()},t.prototype.onAnyValueChanged=function(t){e.prototype.onAnyValueChanged.call(this,t),this.runChoicesByUrl()},t.prototype.runChoicesByUrl=function(){if(this.choicesByUrl){var e=this.surveyImpl?this.surveyImpl.getTextProcessor():this.survey;this.choicesByUrl.run(e)}},t.prototype.onLoadChoicesFromUrl=function(e){var t=this.errors.length;this.errors=[],this.choicesByUrl&&this.choicesByUrl.error&&this.errors.push(this.choicesByUrl.error),(t>0||this.errors.length>0)&&this.fireCallback(this.errorsChangedCallback);var n=null;e&&e.length>0&&(n=new Array,a.a.setData(n,e)),this.choicesFromUrl=n,this.onVisibleChoicesChanged(),this.cachedValueForUrlRequestion&&(this.value=this.cachedValueForUrlRequestion)},t.prototype.onVisibleChoicesChanged=function(){this.isLoadingFromJson||(this.visibleChoicesCache=null,this.fireCallback(this.choicesChangedCallback))},t.prototype.sortVisibleChoices=function(e){var t=this.choicesOrder.toLowerCase();return"asc"==t?this.sortArray(e,1):"desc"==t?this.sortArray(e,-1):"random"==t?this.randomizeArray(e):e},t.prototype.sortArray=function(e,t){return e.sort(function(e,n){return e.text<n.text?-1*t:e.text>n.text?1*t:0})},t.prototype.randomizeArray=function(e){for(var t=e.length-1;t>0;t--){var n=Math.floor(Math.random()*(t+1)),r=e[t];e[t]=e[n],e[n]=r}return e},t.prototype.clearUnusedValues=function(){e.prototype.clearUnusedValues.call(this),this.isOtherSelected||this.hasComment||(this.comment=null)},t}(o.a),p=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n.colCountValue=1,n}return r.b(t,e),Object.defineProperty(t.prototype,"colCount",{get:function(){return this.colCountValue},set:function(e){e<0||e>4||(this.colCountValue=e,this.fireCallback(this.colCountChangedCallback))},enumerable:!0,configurable:!0}),t}(h);i.a.metaData.addClass("selectbase",["hasComment:boolean","hasOther:boolean",{name:"choices:itemvalues",onGetValue:function(e){return a.a.getData(e.choices)},onSetValue:function(e,t){e.choices=t}},{name:"choicesOrder",default:"none",choices:["none","asc","desc","random"]},{name:"choicesByUrl:restfull",className:"ChoicesRestfull",onGetValue:function(e){return e.choicesByUrl.isEmpty?null:e.choicesByUrl},onSetValue:function(e,t){e.choicesByUrl.setData(t)}},{name:"otherText",serializationProperty:"locOtherText"},{name:"otherErrorText",serializationProperty:"locOtherErrorText"},{name:"storeOthersAsComment:boolean",default:!0}],null,"question"),i.a.metaData.addClass("checkboxbase",[{name:"colCount:number",default:1,choices:[0,1,2,3,4]}],null,"selectbase")},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=function(){function e(){}return e}(),i=function(){function e(){this.hasAllValuesOnLastRunValue=!1}return e.prototype.process=function(e,t){if(void 0===t&&(t=!1),this.hasAllValuesOnLastRunValue=!0,!e)return e;if(!this.onProcess)return e;for(var n=this.getItems(e),r=n.length-1;r>=0;r--){var i=n[r],o=this.getName(e.substring(i.start+1,i.end));if(this.canProcessName(o))if(!this.onHasValue||this.onHasValue(o)){var a=this.onProcess(o,t);null==a&&(a="",this.hasAllValuesOnLastRunValue=!1),e=e.substr(0,i.start)+a+e.substr(i.end+1)}else this.hasAllValuesOnLastRunValue=!1}return e},Object.defineProperty(e.prototype,"hasAllValuesOnLastRun",{get:function(){return this.hasAllValuesOnLastRunValue},enumerable:!0,configurable:!0}),e.prototype.getItems=function(e){for(var t=[],n=e.length,i=-1,o="",a=0;a<n;a++)if(o=e[a],"{"==o&&(i=a),"}"==o){if(i>-1){var s=new r;s.start=i,s.end=a,t.push(s)}i=-1}return t},e.prototype.getName=function(e){if(e)return e.trim()},e.prototype.canProcessName=function(e){if(!e)return!1;for(var t=0;t<e.length;t++){var n=e[t];if(" "==n||"-"==n||"&"==n)return!1}return!0},e}()},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(9)),a=n(13),s=n(4),u=n(24);n.d(t,"a",function(){return l}),n.d(t,"b",function(){return c});var l=function(e){function t(t){var n=e.call(this,t)||this;return n.setQuestion(t.question),n.creator=t.creator,n}return r.b(t,e),t.prototype.componentWillReceiveProps=function(e){this.creator=e.creator,this.setQuestion(e.question)},t.prototype.setQuestion=function(e){this.questionBase=e,this.question=e instanceof o.a?e:null;var t=this.question?this.question.value:null;this.state={visible:this.questionBase.visible,value:t,error:0,renderWidth:0,visibleIndexValue:-1,isReadOnly:this.questionBase.isReadOnly}},t.prototype.componentDidMount=function(){if(this.questionBase){var e=this;this.questionBase.react=e,this.questionBase.renderWidthChangedCallback=function(){e.state.renderWidth=e.state.renderWidth+1,e.setState(e.state)},this.questionBase.visibleIndexChangedCallback=function(){e.state.visibleIndexValue=e.questionBase.visibleIndex,e.setState(e.state)},this.questionBase.readOnlyChangedCallback=function(){e.state.isReadOnly=e.questionBase.isReadOnly,e.setState(e.state)};var t=this.refs.root;t&&this.questionBase.survey&&this.questionBase.survey.afterRenderQuestion(this.questionBase,t)}},t.prototype.componentWillUnmount=function(){this.refs.root;this.questionBase&&(this.questionBase.react=null,this.questionBase.renderWidthChangedCallback=null,this.questionBase.visibleIndexChangedCallback=null,this.questionBase.readOnlyChangedCallback=null)},t.prototype.render=function(){if(!this.questionBase||!this.creator)return null;if(!this.questionBase.visible)return null;var e=this.questionBase.cssClasses,t=this.renderQuestion(),n=this.questionBase.hasTitle?this.renderTitle(e):null,r=this.renderDescription(e),o="top"==this.creator.questionTitleLocation()?n:null,a="bottom"==this.creator.questionTitleLocation()?n:null,s="top"==this.creator.questionTitleLocation()?r:null,u="bottom"==this.creator.questionTitleLocation()?r:null,l=this.question&&this.question.hasComment?this.renderComment(e):null,c=this.renderErrors(e),h="top"==this.creator.questionErrorLocation()?c:null,p="bottom"==this.creator.questionErrorLocation()?c:null,d=this.questionBase.indent>0?this.questionBase.indent*e.indent+"px":null,f=this.questionBase.rightIndent>0?this.questionBase.rightIndent*e.indent+"px":null,m={display:"inline-block",verticalAlign:"top"};return this.questionBase.renderWidth&&(m.width=this.questionBase.renderWidth),d&&(m.paddingLeft=d),f&&(m.paddingRight=f),i.createElement("div",{ref:"root",id:this.questionBase.id,className:e.mainRoot,style:m},o,s,h,t,l,p,a,u)},t.prototype.renderQuestion=function(){return this.questionBase.customWidget?i.createElement(u.a,{creator:this.creator,question:this.questionBase}):this.creator.createQuestionElement(this.questionBase)},t.prototype.renderTitle=function(e){var t=s.a.renderLocString(this.question.locTitle);return i.createElement("h5",{className:e.title},t)},t.prototype.renderDescription=function(e){if(!this.questionBase.hasDescription)return null;var t=s.a.renderLocString(this.question.locDescription);return i.createElement("div",{className:e.description},t)},t.prototype.renderComment=function(e){var t=s.a.renderLocString(this.question.locCommentText);return i.createElement("div",null,i.createElement("div",null,t),i.createElement(a.a,{question:this.question,cssClasses:e}))},t.prototype.renderErrors=function(e){return i.createElement(c,{question:this.question,cssClasses:e,creator:this.creator})},t}(i.Component),c=function(e){function t(t){var n=e.call(this,t)||this;return n.setQuestion(t.question),n.creator=t.creator,n}return r.b(t,e),t.prototype.componentWillReceiveProps=function(e){this.setQuestion(e.question),this.creator=e.creator},t.prototype.setQuestion=function(e){if(this.question=e instanceof o.a?e:null,this.question){var t=this;this.question.errorsChangedCallback=function(){t.state.error=t.state.error+1,t.setState(t.state)}}this.state={error:0}},t.prototype.render=function(){if(!this.question||0==this.question.errors.length)return null;for(var e=[],t=0;t<this.question.errors.length;t++){var n=this.question.errors[t].getText(),r="error"+t;e.push(this.creator.renderError(r,n,this.cssClasses))}return i.createElement("div",{className:this.cssClasses.error.root},e)},t}(s.c)},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(27)),a=n(26),s=n(36),u=n(8),l=n(11),c=n(37),h=n(5),p=n(4);n.d(t,"a",function(){return d});var d=function(e){function t(t){var n=e.call(this,t)||this;return n.isCurrentPageChanged=!1,n.handleTryAgainClick=n.handleTryAgainClick.bind(n),n.updateSurvey(t),n}return r.b(t,e),Object.defineProperty(t,"cssType",{get:function(){return l.b.currentType},set:function(e){l.b.currentType=e},enumerable:!0,configurable:!0}),t.prototype.componentWillReceiveProps=function(e){this.updateSurvey(e)},t.prototype.componentDidUpdate=function(){this.isCurrentPageChanged&&(this.isCurrentPageChanged=!1,this.survey.focusFirstQuestionAutomatic&&this.survey.focusFirstQuestion())},t.prototype.componentDidMount=function(){var e=this.refs.root;e&&this.survey&&this.survey.doAfterRenderSurvey(e)},t.prototype.render=function(){return"completed"==this.survey.state?this.renderCompleted():"completedbefore"==this.survey.state?this.renderCompletedBefore():"loading"==this.survey.state?this.renderLoading():this.renderSurvey()},Object.defineProperty(t.prototype,"css",{get:function(){return l.b.getCss()},set:function(e){this.survey.mergeCss(e,this.css)},enumerable:!0,configurable:!0}),t.prototype.handleTryAgainClick=function(e){this.survey.doComplete()},t.prototype.renderCompleted=function(){if(!this.survey.showCompletedPage)return null;var e=null;if(this.survey.completedState){var t=null;if("error"==this.survey.completedState){var n=this.survey.getLocString("saveAgainButton");t=i.createElement("input",{type:"button",value:n,className:this.css.saveData.saveAgainButton,onClick:this.handleTryAgainClick})}var r=this.css.saveData[this.survey.completedState];e=i.createElement("div",{className:this.css.saveData.root},i.createElement("div",{className:r},i.createElement("span",null,this.survey.completedStateText),t))}var o={__html:this.survey.processedCompletedHtml};return i.createElement("div",null,i.createElement("div",{dangerouslySetInnerHTML:o}),e)},t.prototype.renderCompletedBefore=function(){var e={__html:this.survey.processedCompletedBeforeHtml};return i.createElement("div",{dangerouslySetInnerHTML:e})},t.prototype.renderLoading=function(){var e={__html:this.survey.processedLoadingHtml};return i.createElement("div",{dangerouslySetInnerHTML:e})},t.prototype.renderSurvey=function(){var e=this.survey.title&&this.survey.showTitle?this.renderTitle():null,t=this.survey.currentPage?this.renderPage():null,n="top"==this.survey.showProgressBar?this.renderProgress(!0):null,r="bottom"==this.survey.showProgressBar?this.renderProgress(!1):null,o=t&&this.survey.showNavigationButtons?this.renderNavigation():null;return t||(t=this.renderEmptySurvey()),i.createElement("div",{ref:"root",className:this.css.root},e,i.createElement("div",{id:h.e,className:this.css.body},n,t,r),o)},t.prototype.renderTitle=function(){var e=p.a.renderLocString(this.survey.locTitle);return i.createElement("div",{className:this.css.header},i.createElement("h3",null,e))},t.prototype.renderPage=function(){return i.createElement(a.a,{survey:this.survey,page:this.survey.currentPage,css:this.css,creator:this})},t.prototype.renderProgress=function(e){return i.createElement(c.a,{survey:this.survey,css:this.css,isTop:e})},t.prototype.renderNavigation=function(){return i.createElement(s.a,{survey:this.survey,css:this.css})},t.prototype.renderEmptySurvey=function(){return i.createElement("span",null,this.survey.emptySurveyText)},t.prototype.updateSurvey=function(e){e?e.model?this.survey=e.model:e.json&&(this.survey=new o.a(e.json)):this.survey=new o.a,e&&(e.clientId&&(this.survey.clientId=e.clientId),e.data&&(this.survey.data=e.data),e.css&&this.survey.mergeCss(e.css,this.css));this.survey.currentPage;this.state={pageIndexChange:0,isCompleted:!1,modelChanged:0},this.setSurveyEvents(e)},t.prototype.setSurveyEvents=function(e){var t=this;this.survey.renderCallback=function(){t.state.modelChanged=t.state.modelChanged+1,t.setState(t.state)},this.survey.onComplete.add(function(e){t.state.isCompleted=!0,t.setState(t.state)}),this.survey.onPartialSend.add(function(e){t.setState(t.state)}),this.survey.onCurrentPageChanged.add(function(n,r){t.isCurrentPageChanged=!0,t.state.pageIndexChange=t.state.pageIndexChange+1,t.setState(t.state),e&&e.onCurrentPageChanged&&e.onCurrentPageChanged(n,r)}),this.survey.onVisibleChanged.add(function(e,t){if(t.question&&t.question.react){var n=t.question.react.state;n.visible=t.question.visible,t.question.react.setState(n)}}),this.survey.onValueChanged.add(function(e,t){if(t.question&&t.question.react){var n=t.question.react.state;n.value=t.value,t.question.react.setState(n)}}),e&&(this.survey.onValueChanged.add(function(t,n){e.data&&(e.data[n.name]=n.value),e.onValueChanged&&e.onValueChanged(t,n)}),e.onVisibleChanged&&this.survey.onVisibleChanged.add(function(t){e.onVisibleChanged(t)}),e.onComplete&&this.survey.onComplete.add(function(t,n){e.onComplete(t,n)}),e.onPartialSend&&this.survey.onPartialSend.add(function(t){e.onPartialSend(t)}),this.survey.onPageVisibleChanged.add(function(t,n){e.onPageVisibleChanged&&e.onPageVisibleChanged(t,n)}),e.onServerValidateQuestions&&(this.survey.onServerValidateQuestions=e.onServerValidateQuestions),e.onQuestionAdded&&this.survey.onQuestionAdded.add(function(t,n){e.onQuestionAdded(t,n)}),e.onQuestionRemoved&&this.survey.onQuestionRemoved.add(function(t,n){e.onQuestionRemoved(t,n)}),e.onValidateQuestion&&this.survey.onValidateQuestion.add(function(t,n){e.onValidateQuestion(t,n)}),e.onSendResult&&this.survey.onSendResult.add(function(t,n){e.onSendResult(t,n)}),e.onGetResult&&this.survey.onGetResult.add(function(t,n){e.onGetResult(t,n)}),e.onProcessHtml&&this.survey.onProcessHtml.add(function(t,n){e.onProcessHtml(t,n)}),e.onAfterRenderSurvey&&this.survey.onAfterRenderSurvey.add(function(t,n){e.onAfterRenderSurvey(t,n)}),e.onAfterRenderPage&&this.survey.onAfterRenderPage.add(function(t,n){e.onAfterRenderPage(t,n)}),e.onAfterRenderQuestion&&this.survey.onAfterRenderQuestion.add(function(t,n){e.onAfterRenderQuestion(t,n)}),e.onAfterRenderPanel&&this.survey.onAfterRenderPanel.add(function(t,n){e.onAfterRenderPanel(t,n)}),e.onTextMarkdown&&this.survey.onTextMarkdown.add(function(t,n){e.onTextMarkdown(t,n)}),e.onMatrixRowAdded&&this.survey.onMatrixRowAdded.add(function(t,n){e.onMatrixRowAdded(t,n)}),e.onMatrixCellCreated&&this.survey.onMatrixCellCreated.add(function(t,n){e.onMatrixCellCreated(t,n)}),e.onMatrixCellValueChanged&&this.survey.onMatrixCellValueChanged.add(function(t,n){e.onMatrixCellValueChanged(t,n)}))},t.prototype.createQuestionElement=function(e){return u.a.Instance.createQuestion(e.getType(),{question:e,isDisplayMode:e.isReadOnly,creator:this})},t.prototype.renderError=function(e,t,n){return i.createElement("div",{key:e,className:n.error.item},t)},t.prototype.questionTitleLocation=function(){return this.survey.questionTitleLocation},t.prototype.questionErrorLocation=function(){return this.survey.questionErrorLocation},t}(i.Component)},function(e,t,n){"use strict";var r=n(0),i=n(5),o=n(12),a=n(3),s=n(1),u=n(10);n.d(t,"a",function(){return l});var l=function(e){function t(){var t=e.call(this)||this;return t.lastObjHash="",t.processedUrl="",t.processedPath="",t.url="",t.path="",t.valueName="",t.titleName="",t.error=null,t}return r.b(t,e),t.getCachedItemsResult=function(e){var n=e.objHash,r=t.itemsResult[n];return!!r&&(e.getResultCallback&&e.getResultCallback(r),!0)},t.prototype.run=function(e){if(void 0===e&&(e=null),this.url&&this.getResultCallback){if(this.processedText(e),!this.processedUrl)return void this.getResultCallback([]);this.lastObjHash!=this.objHash&&(this.lastObjHash=this.objHash,t.getCachedItemsResult(this)||(this.error=null,this.sendRequest()))}},t.prototype.processedText=function(e){if(e){var t=e.processTextEx(this.url),n=e.processTextEx(this.path);t.hasAllValuesOnLastRun&&n.hasAllValuesOnLastRun?(this.processedUrl=t.text,this.processedPath=n.text):(this.processedUrl="",this.processedPath="")}else this.processedUrl=this.url,this.processedPath=this.path},t.prototype.sendRequest=function(){var e=new XMLHttpRequest;e.open("GET",this.processedUrl),e.setRequestHeader("Content-Type","application/x-www-form-urlencoded");var t=this;e.onload=function(){200==e.status?t.onLoad(JSON.parse(e.response)):t.onError(e.statusText,e.responseText)},e.send()},t.prototype.getType=function(){return"choicesByUrl"},Object.defineProperty(t.prototype,"isEmpty",{get:function(){return!(this.url||this.path||this.valueName||this.titleName)},enumerable:!0,configurable:!0}),t.prototype.setData=function(e){this.clear(),e.url&&(this.url=e.url),e.path&&(this.path=e.path),e.valueName&&(this.valueName=e.valueName),e.titleName&&(this.titleName=e.titleName)},t.prototype.clear=function(){this.url="",this.path="",this.valueName="",this.titleName=""},t.prototype.onLoad=function(e){var n=[];if((e=this.getResultAfterPath(e))&&e.length)for(var r=0;r<e.length;r++){var i=e[r];if(i){var a=this.getValue(i),l=this.getTitle(i);n.push(new o.a(a,l))}}else this.error=new u.c(s.a.getString("urlGetChoicesError"));t.itemsResult[this.objHash]=n,this.getResultCallback(n)},t.prototype.onError=function(e,t){this.error=new u.c(s.a.getString("urlRequestError").format(e,t)),this.getResultCallback([])},t.prototype.getResultAfterPath=function(e){if(!e)return e;if(!this.processedPath)return e;for(var t=this.getPathes(),n=0;n<t.length;n++)if(!(e=e[t[n]]))return null;return e},t.prototype.getPathes=function(){var e=[];return e=this.processedPath.indexOf(";")>-1?this.path.split(";"):this.processedPath.split(","),0==e.length&&e.push(this.processedPath),e},t.prototype.getValue=function(e){return e?this.valueName?this.getValueCore(e,this.valueName):e instanceof Object?Object.keys(e).length<1?null:e[Object.keys(e)[0]]:e:null},t.prototype.getTitle=function(e){return this.titleName?this.getValueCore(e,this.titleName):null},t.prototype.getValueCore=function(e,t){if(!e)return null;if(t.indexOf(".")<0)return e[t];for(var n=t.split("."),r=0;r<n.length;r++)if(!(e=e[n[r]]))return null;return e},Object.defineProperty(t.prototype,"objHash",{get:function(){return this.processedUrl+";"+this.processedPath+";"+this.valueName+";"+this.titleName},enumerable:!0,configurable:!0}),t}(i.b);l.itemsResult={},a.a.metaData.addClass("choicesByUrl",["url","path","valueName","titleName"],function(){return new l})},function(e,t,n){"use strict";var r=n(0),i=n(3),o=n(5),a=n(15),s=n(6),u=n(7),l=n(11);n.d(t,"c",function(){return c}),n.d(t,"a",function(){return h}),n.d(t,"b",function(){return p});var c=function(){function e(e){this.panel=e,this.elements=[],this.visibleValue=e.survey&&e.survey.isDesignMode}return Object.defineProperty(e.prototype,"questions",{get:function(){return this.elements},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this.visibleValue},set:function(e){e!=this.visible&&(this.visibleValue=e,this.onVisibleChanged())},enumerable:!0,configurable:!0}),e.prototype.updateVisible=function(){this.visible=this.calcVisible(),this.setWidth()},e.prototype.addElement=function(e){this.elements.push(e),this.updateVisible()},e.prototype.onVisibleChanged=function(){this.visibilityChangedCallback&&this.visibilityChangedCallback()},e.prototype.setWidth=function(){var e=this.getVisibleCount();if(0!=e)for(var t=0,n=0;n<this.elements.length;n++)if(this.elements[n].isVisible){var r=this.elements[n];r.renderWidth=r.width?r.width:Math.floor(100/e)+"%",r.rightIndent=t<e-1?1:0,t++}},e.prototype.getVisibleCount=function(){for(var e=0,t=0;t<this.elements.length;t++)this.elements[t].isVisible&&e++;return e},e.prototype.calcVisible=function(){return this.getVisibleCount()>0},e}(),h=function(e){function t(n){void 0===n&&(n="");var r=e.call(this)||this;r.name=n,r.rowValues=null,r.conditionRunner=null,r.elementsValue=new Array,r.isQuestionsReady=!1,r.questionsValue=new Array,r.parent=null,r.visibleIf="",r.visibleValue=!0,r.idValue=t.getPanelId(),r.locTitleValue=new u.a(r,!0);var i=r;return r.locTitleValue.onRenderedHtmlCallback=function(e){return i.getRendredTitle(e)},r.elementsValue.push=function(e){return i.doOnPushElement(this,e)},r.elementsValue.splice=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return i.doSpliceElements.apply(i,[this,e,t].concat(n))},r}return r.b(t,e),t.getPanelId=function(){return"sp_"+t.panelCounter++},t.prototype.setSurveyImpl=function(t){e.prototype.setSurveyImpl.call(this,t),this.survey&&this.survey.isDesignMode&&this.onVisibleChanged();for(var n=0;n<this.elements.length;n++)this.elements[n].setSurveyImpl(t)},Object.defineProperty(t.prototype,"title",{get:function(){return this.locTitle.text},set:function(e){this.locTitle.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locTitle",{get:function(){return this.locTitleValue},enumerable:!0,configurable:!0}),t.prototype.getLocale=function(){return this.survey?this.survey.getLocale():""},t.prototype.getMarkdownHtml=function(e){return this.survey?this.survey.getMarkdownHtml(e):null},Object.defineProperty(t.prototype,"cssClasses",{get:function(){return this.css},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"css",{get:function(){return l.b.getCss()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this.idValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isPanel",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"questions",{get:function(){if(!this.isQuestionsReady){this.questionsValue=[];for(var e=0;e<this.elements.length;e++){var t=this.elements[e];if(t.isPanel)for(var n=t.questions,r=0;r<n.length;r++)this.questionsValue.push(n[r]);else this.questionsValue.push(t)}this.isQuestionsReady=!0}return this.questionsValue},enumerable:!0,configurable:!0}),t.prototype.getQuestionByName=function(e){for(var t=this.questions,n=0;n<t.length;n++)if(t[n].name==e)return t[n];return null},t.prototype.markQuestionListDirty=function(){this.isQuestionsReady=!1,this.parent&&this.parent.markQuestionListDirty()},Object.defineProperty(t.prototype,"elements",{get:function(){return this.elementsValue},enumerable:!0,configurable:!0}),t.prototype.getElementsInDesign=function(e){return void 0===e&&(e=!1),this.elements},t.prototype.containsElement=function(e){for(var t=0;t<this.elements.length;t++){var n=this.elements[t];if(n==e)return!0;if(n.isPanel&&n.containsElement(e))return!0}return!1},t.prototype.hasErrors=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!1);var n=!1,r=null,i=[];this.addQuestionsToList(i,!0);for(var o=0;o<i.length;o++){var a=i[o];a.isReadOnly||a.hasErrors(e)&&(t&&null==r&&(r=a),n=!0)}return r&&r.focus(!0),n},t.prototype.addQuestionsToList=function(e,t){if(void 0===t&&(t=!1),!t||this.visible)for(var n=0;n<this.elements.length;n++){var r=this.elements[n];t&&!r.visible||(r.isPanel?r.addQuestionsToList(e,t):e.push(r))}},Object.defineProperty(t.prototype,"rows",{get:function(){return this.rowValues||(this.rowValues=this.buildRows()),this.rowValues},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isActive",{get:function(){return!this.survey||this.survey.currentPage==this.root},enumerable:!0,configurable:!0}),t.prototype.updateCustomWidgets=function(){for(var e=0;e<this.elements.length;e++)this.elements[e].updateCustomWidgets()},Object.defineProperty(t.prototype,"root",{get:function(){for(var e=this;e.parent;)e=e.parent;return e},enumerable:!0,configurable:!0}),t.prototype.createRow=function(){return new c(this)},t.prototype.onSurveyLoad=function(){for(var e=0;e<this.elements.length;e++)this.elements[e].onSurveyLoad();this.rowsChangedCallback&&this.rowsChangedCallback()},t.prototype.onRowsChanged=function(){this.rowValues=null,this.rowsChangedCallback&&!this.isLoadingFromJson&&this.rowsChangedCallback()},Object.defineProperty(t.prototype,"isDesignMode",{get:function(){return this.survey&&this.survey.isDesignMode},enumerable:!0,configurable:!0}),t.prototype.doOnPushElement=function(e,t){var n=Array.prototype.push.call(e,t);return this.markQuestionListDirty(),this.onAddElement(t,e.length),this.onRowsChanged(),n},t.prototype.doSpliceElements=function(e,t,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];t||(t=0),n||(n=0);for(var o=[],a=0;a<n;a++)a+t>=e.length||o.push(e[a+t]);var s=(u=Array.prototype.splice).call.apply(u,[e,t,n].concat(r));this.markQuestionListDirty(),r||(r=[]);for(var a=0;a<o.length;a++)this.onRemoveElement(o[a]);for(var a=0;a<r.length;a++)this.onAddElement(r[a],t+a);return this.onRowsChanged(),s;var u},t.prototype.onAddElement=function(e,t){if(e.setSurveyImpl(this.surveyImpl),e.isPanel){var n=e;n.parent=this,this.survey&&this.survey.panelAdded(n,t,this,this.root)}else if(this.survey){var r=e;this.survey.questionAdded(r,t,this,this.root)}var i=this;e.rowVisibilityChangedCallback=function(){i.onElementVisibilityChanged(e)},e.startWithNewLineChangedCallback=function(){i.onElementStartWithNewLineChanged(e)}},t.prototype.onRemoveElement=function(e){e.isPanel?this.survey&&this.survey.panelRemoved(e):this.survey&&this.survey.questionRemoved(e)},t.prototype.onElementVisibilityChanged=function(e){this.rowValues&&this.updateRowsVisibility(e),this.parent&&this.parent.onElementVisibilityChanged(this)},t.prototype.onElementStartWithNewLineChanged=function(e){this.onRowsChanged()},t.prototype.updateRowsVisibility=function(e){for(var t=0;t<this.rowValues.length;t++){var n=this.rowValues[t];if(n.elements.indexOf(e)>-1){n.updateVisible();break}}},t.prototype.buildRows=function(){for(var e=new Array,t=0;t<this.elements.length;t++){var n=this.elements[t],r=0==t||n.startWithNewLine,i=r?this.createRow():e[e.length-1];r&&e.push(i),i.addElement(n)}for(var t=0;t<e.length;t++)e[t].updateVisible();return e},Object.defineProperty(t.prototype,"processedTitle",{get:function(){return this.getRendredTitle(this.locTitle.textOrHtml)},enumerable:!0,configurable:!0}),t.prototype.getRendredTitle=function(e){return!e&&this.isPanel&&this.isDesignMode?"["+this.name+"]":null!=this.textProcessor?this.textProcessor.processText(e,!0):e},Object.defineProperty(t.prototype,"visible",{get:function(){return this.visibleValue},set:function(e){e!==this.visible&&(this.visibleValue=e,this.isLoadingFromJson||this.onVisibleChanged(),this.panelVisibilityChanged(this,this.visible))},enumerable:!0,configurable:!0}),t.prototype.panelVisibilityChanged=function(e,t){},t.prototype.onVisibleChanged=function(){},Object.defineProperty(t.prototype,"isVisible",{get:function(){return this.survey&&this.survey.isDesignMode||this.getIsPageVisible(null)},enumerable:!0,configurable:!0}),t.prototype.getIsPageVisible=function(e){if(!this.visible)return!1;for(var t=0;t<this.questions.length;t++)if(this.questions[t]!=e&&this.questions[t].visible)return!0;return!1},t.prototype.addElement=function(e,t){void 0===t&&(t=-1),null!=e&&(t<0||t>=this.elements.length?this.elements.push(e):this.elements.splice(t,0,e))},t.prototype.addQuestion=function(e,t){void 0===t&&(t=-1),this.addElement(e,t)},t.prototype.addPanel=function(e,t){void 0===t&&(t=-1),this.addElement(e,t)},t.prototype.addNewQuestion=function(e,t){var n=s.a.Instance.createQuestion(e,t);return this.addQuestion(n),n},t.prototype.addNewPanel=function(e){var t=this.createNewPanel(e);return this.addPanel(t),t},t.prototype.createNewPanel=function(e){return new p(e)},t.prototype.removeElement=function(e){var t=this.elements.indexOf(e);if(t<0){for(var n=0;n<this.elements.length;n++){var r=this.elements[n];if(r.isPanel&&r.removeElement(e))return!0}return!1}return this.elements.splice(t,1),!0},t.prototype.removeQuestion=function(e){this.removeElement(e)},t.prototype.runCondition=function(e){for(var t=0;t<this.elements.length;t++)this.elements[t].runCondition(e);this.visibleIf&&(this.conditionRunner||(this.conditionRunner=new a.a(this.visibleIf)),this.conditionRunner.expression=this.visibleIf,this.visible=this.conditionRunner.run(e))},t.prototype.onLocaleChanged=function(){for(var e=0;e<this.elements.length;e++)this.elements[e].onLocaleChanged();this.locTitle.onChanged()},t.prototype.onAnyValueChanged=function(e){for(var t=0;t<this.elements.length;t++)this.elements[t].onAnyValueChanged(e);var n=this.locTitle.text;n&&n.toLocaleLowerCase().indexOf("{"+e.toLowerCase())>-1&&this.locTitle.onChanged()},t}(o.a);h.panelCounter=100;var p=function(e){function t(t){void 0===t&&(t="");var n=e.call(this,t)||this;return n.name=t,n.innerIndentValue=0,n.startWithNewLineValue=!0,n}return r.b(t,e),t.prototype.getType=function(){return"panel"},Object.defineProperty(t.prototype,"isPanel",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"innerIndent",{get:function(){return this.innerIndentValue},set:function(e){e!=this.innerIndentValue&&(this.innerIndentValue=e,this.renderWidthChangedCallback&&this.renderWidthChangedCallback())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderWidth",{get:function(){return this.renderWidthValue},set:function(e){e!=this.renderWidth&&(this.renderWidthValue=e,this.renderWidthChangedCallback&&this.renderWidthChangedCallback())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"startWithNewLine",{get:function(){return this.startWithNewLineValue},set:function(e){this.startWithNewLine!=e&&(this.startWithNewLineValue=e,this.startWithNewLineChangedCallback&&this.startWithNewLineChangedCallback())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rightIndent",{get:function(){return this.rightIndentValue},set:function(e){e!=this.rightIndent&&(this.rightIndentValue=e,this.renderWidthChangedCallback&&this.renderWidthChangedCallback())},enumerable:!0,configurable:!0}),t.prototype.onVisibleChanged=function(){this.rowVisibilityChangedCallback&&this.rowVisibilityChangedCallback()},t}(h);i.a.metaData.addClass("panel",["name",{name:"elements",alternativeName:"questions",baseClassName:"question",visible:!1},{name:"startWithNewLine:boolean",default:!0},{name:"visible:boolean",default:!0},"visibleIf:expression",{name:"title:text",serializationProperty:"locTitle"},{name:"innerIndent:number",default:0,choices:[0,1,2,3]}],function(){return new p})},function(e,t,n){"use strict";var r=n(0),i=n(3),o=n(9),a=n(5),s=n(17),u=n(14),l=n(12),c=n(1),h=n(16),p=n(20),d=n(6),f=n(7);n.d(t,"b",function(){return m}),n.d(t,"a",function(){return g}),n.d(t,"c",function(){return y}),n.d(t,"d",function(){return v});var m=function(e){function t(t,n){void 0===n&&(n=null);var r=e.call(this)||this;r.isRequiredValue=!1,r.hasOtherValue=!1,r.colCountValue=-1,r.minWidth="",r.cellTypeValue="default",r.inputTypeValue="text",r.choicesOrderValue="none",r.colOwner=null,r.validators=new Array,r.visibleIf="",r.nameValue=t,r.choicesValue=l.a.createArray(r),r.locTitleValue=new f.a(r,!0);var i=r;return r.locTitleValue.onRenderedHtmlCallback=function(e){return i.getFullTitle(e)},r.locOptionsCaptionValue=new f.a(r),r.locPlaceHolderValue=new f.a(r),r.choicesByUrl=new p.a,n&&(r.title=n),r}return r.b(t,e),t.prototype.getType=function(){return"matrixdropdowncolumn"},Object.defineProperty(t.prototype,"name",{get:function(){return this.nameValue},set:function(e){e!=this.name&&(this.nameValue=e,this.onPropertiesChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"choicesOrder",{get:function(){return this.choicesOrderValue},set:function(e){e=e.toLocaleLowerCase(),this.choicesOrder!=e&&(this.choicesOrderValue=e,this.onPropertiesChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputType",{get:function(){return this.inputTypeValue},set:function(e){e=e.toLocaleLowerCase(),this.inputTypeValue!=e&&(this.inputTypeValue=e,this.onPropertiesChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cellType",{get:function(){return this.cellTypeValue},set:function(e){e=e.toLocaleLowerCase(),this.cellTypeValue!=e&&(this.cellTypeValue=e,this.onPropertiesChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return this.locTitle.text?this.locTitle.text:this.name},set:function(e){this.locTitle.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fullTitle",{get:function(){return this.getFullTitle(this.locTitle.textOrHtml)},enumerable:!0,configurable:!0}),t.prototype.getFullTitle=function(e){if(e||(e=this.name),this.isRequired){var t=this.colOwner?this.colOwner.getRequiredText():"";t&&(t+=" "),e=t+e}return e},Object.defineProperty(t.prototype,"locTitle",{get:function(){return this.locTitleValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"optionsCaption",{get:function(){return this.locOptionsCaption.text},set:function(e){this.locOptionsCaption.text=e,this.onPropertiesChanged()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locOptionsCaption",{get:function(){return this.locOptionsCaptionValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"placeHolder",{get:function(){return this.locPlaceHolder.text},set:function(e){this.locPlaceHolder.text=e,this.onPropertiesChanged()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locPlaceHolder",{get:function(){return this.locPlaceHolderValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"choices",{get:function(){return this.choicesValue},set:function(e){l.a.setData(this.choicesValue,e),this.onPropertiesChanged()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"colCount",{get:function(){return this.colCountValue},set:function(e){e<-1||e>4||(this.colCountValue=e,this.onPropertiesChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRequired",{get:function(){return this.isRequiredValue},set:function(e){this.isRequired!=e&&(this.isRequiredValue=e,this.onPropertiesChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasOther",{get:function(){return this.hasOtherValue},set:function(e){this.hasOther!=e&&(this.hasOtherValue=e,this.onPropertiesChanged())},enumerable:!0,configurable:!0}),t.prototype.getLocale=function(){return this.colOwner?this.colOwner.getLocale():""},t.prototype.getMarkdownHtml=function(e){return this.colOwner?this.colOwner.getMarkdownHtml(e):null},t.prototype.onLocaleChanged=function(){this.locTitle.onChanged(),this.locOptionsCaption.onChanged(),l.a.NotifyArrayOnLocaleChanged(this.choices)},t.prototype.onPropertiesChanged=function(){null!=this.colOwner&&this.colOwner.onColumnPropertiesChanged(this)},t}(a.b),g=function(){function e(e,t,n){var r=this;this.column=e,this.row=t,this.questionValue=n.createQuestion(this.row,this.column),this.questionValue.validateValueCallback=function(){return n.validateCell(t,e.name,t.value)},i.a.metaData.getProperties(e.getType()).forEach(function(t){var n=t.name;void 0!==e[n]&&void 0===r.questionValue[n]&&(r.questionValue[n]=e[n])}),Object.keys(e).forEach(function(e){}),this.questionValue.updateCustomWidget()}return Object.defineProperty(e.prototype,"question",{get:function(){return this.questionValue},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.question.value},set:function(e){this.question.value=e},enumerable:!0,configurable:!0}),e.prototype.runCondition=function(e){this.question.runCondition(e)},e}(),y=function(){function e(t,n){this.rowValues={},this.isSettingValue=!1,this.textPreProcessor=new s.a,this.cells=[],this.data=t,this.value=n,this.textPreProcessor=new s.a;var r=this;this.textPreProcessor.onHasValue=function(e){return r.hasProcessedTextValue(e)},this.textPreProcessor.onProcess=function(e,t){return r.getProcessedTextValue(e,t)};for(var i=0;i<this.data.columns.length;i++)void 0===this.rowValues[this.data.columns[i].name]&&(this.rowValues[this.data.columns[i].name]=null);this.idValue=e.getId(),this.buildCells()}return e.getId=function(){return"srow_"+e.idCounter++},Object.defineProperty(e.prototype,"id",{get:function(){return this.idValue},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowName",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.rowValues},set:function(e){if(this.isSettingValue=!0,this.rowValues={},null!=e)for(var t in e)this.rowValues[t]=e[t];for(var n=0;n<this.cells.length;n++)this.cells[n].question.onSurveyValueChanged(this.getValue(this.cells[n].column.name));this.isSettingValue=!1},enumerable:!0,configurable:!0}),e.prototype.getAllValues=function(){return this.value},e.prototype.onAnyValueChanged=function(e){for(var t=0;t<this.cells.length;t++)this.cells[t].question.onAnyValueChanged(e)},e.prototype.getValue=function(e){return this.rowValues[e]},e.prototype.setValue=function(e,t){this.isSettingValue||(""===t&&(t=null),null!=t?this.rowValues[e]=t:delete this.rowValues[e],this.data.onRowChanged(this,e,this.value),this.onAnyValueChanged("row"))},e.prototype.getComment=function(e){var t=this.getValue(e+a.b.commentPrefix);return t||""},e.prototype.setComment=function(e,t){this.setValue(e+a.b.commentPrefix,t)},Object.defineProperty(e.prototype,"isEmpty",{get:function(){var e=this.value;if(a.b.isValueEmpty(e))return!0;for(var t in e)if(void 0!==e[t]&&null!==e[t])return!1;return!0},enumerable:!0,configurable:!0}),e.prototype.getQuestionByColumn=function(e){for(var t=0;t<this.cells.length;t++)if(this.cells[t].column==e)return this.cells[t].question;return null},e.prototype.getLocale=function(){return this.data?this.data.getLocale():""},e.prototype.getMarkdownHtml=function(e){return this.data?this.data.getMarkdownHtml(e):null},e.prototype.onLocaleChanged=function(){for(var e=0;e<this.cells.length;e++)this.cells[e].question.onLocaleChanged()},e.prototype.runCondition=function(e){e.row=this.value;for(var t=0;t<this.cells.length;t++)this.cells[t].runCondition(e)},e.prototype.buildCells=function(){for(var e=this.data.columns,t=0;t<e.length;t++){var n=e[t];this.cells.push(this.createCell(n))}},e.prototype.createCell=function(e){return new g(e,this,this.data)},e.prototype.geSurveyData=function(){return this},e.prototype.getSurvey=function(){return this.data?this.data.getSurvey():null},e.prototype.hasProcessedTextValue=function(e){return"row"==(new u.a).getFirstName(e)},e.prototype.getProcessedTextValue=function(e,t){var n={row:this.value};return(new u.a).getValue(e,n)},e.prototype.getTextProcessor=function(){return this},e.prototype.processText=function(e,t){return e=this.textPreProcessor.process(e,t),this.getSurvey().processText(e,t)},e.prototype.processTextEx=function(e){e=this.processText(e,!0);var t=this.textPreProcessor.hasAllValuesOnLastRun,n=this.getSurvey().processTextEx(e);return n.hasAllValuesOnLastRun=n.hasAllValuesOnLastRun&&t,n},e}();y.idCounter=1;var v=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n.columnsValue=[],n.isRowChanging=!1,n.generatedVisibleRows=null,n.cellTypeValue="dropdown",n.columnColCountValue=0,n.columnMinWidth="",n.horizontalScroll=!1,n.choicesValue=l.a.createArray(n),n.locOptionsCaptionValue=new f.a(n),n.overrideColumnsMethods(),n}return r.b(t,e),t.addDefaultColumns=function(e){for(var t=d.a.DefaultColums,n=0;n<t.length;n++)e.addColumn(t[n])},t.prototype.getType=function(){return"matrixdropdownbase"},Object.defineProperty(t.prototype,"columns",{get:function(){return this.columnsValue},set:function(e){this.columnsValue=e,this.overrideColumnsMethods(),this.fireCallback(this.columnsChangedCallback)},enumerable:!0,configurable:!0}),t.prototype.onMatrixRowCreated=function(e){if(this.survey)for(var t={rowValue:e.value,row:e,column:null,columnName:null,cell:null,cellQuestion:null,value:null},n=0;n<this.columns.length;n++){t.column=this.columns[n],t.columnName=t.column.name;var r=e.cells[n];t.cell=r,t.cellQuestion=r.question,t.value=r.value,this.survey.matrixCellCreated(this,t)}},t.prototype.overrideColumnsMethods=function(){var e=this;this.columnsValue.push=function(t){var n=Array.prototype.push.call(this,t);return e.generatedVisibleRows=null,t.colOwner=e,null!=e.data&&e.fireCallback(e.columnsChangedCallback),n},this.columnsValue.splice=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=(s=Array.prototype.splice).call.apply(s,[this,t,n].concat(r));e.generatedVisibleRows=null,r||(r=[]);for(var a=0;a<r.length;a++)r[a].colOwner=e;return null!=e.data&&e.fireCallback(e.columnsChangedCallback),o;var s}},Object.defineProperty(t.prototype,"cellType",{get:function(){return this.cellTypeValue},set:function(e){e=e.toLowerCase(),this.cellType!=e&&(this.cellTypeValue=e,this.fireCallback(this.updateCellsCallback))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"columnColCount",{get:function(){return this.columnColCountValue},set:function(e){e<0||e>4||(this.columnColCountValue=e,this.fireCallback(this.updateCellsCallback))},enumerable:!0,configurable:!0}),t.prototype.getRequiredText=function(){return this.survey?this.survey.requiredText:""},t.prototype.onColumnPropertiesChanged=function(e){if(this.generatedVisibleRows)for(var t=0;t<this.generatedVisibleRows.length;t++)for(var n=this.generatedVisibleRows[t],r=0;r<n.cells.length;r++)if(n.cells[r].column===e){this.setQuestionProperties(n.cells[r].question,e,n);break}},t.prototype.runCondition=function(t){e.prototype.runCondition.call(this,t),this.runCellsCondition(t)},t.prototype.runCellsCondition=function(e){if(this.generatedVisibleRows&&this.hasVisibleIfColumn){var t={};e&&e instanceof Object&&(t=JSON.parse(JSON.stringify(e))),t.row={};for(var n=this.generatedVisibleRows,r=0;r<n.length;r++)n[r].runCondition(t)}},Object.defineProperty(t.prototype,"hasVisibleIfColumn",{get:function(){for(var e=0;e<this.columns.length;e++)if(this.columns[e].visibleIf)return!0;return!1},enumerable:!0,configurable:!0}),t.prototype.onLocaleChanged=function(){e.prototype.onLocaleChanged.call(this),this.locOptionsCaption.onChanged();for(var t=0;t<this.columns.length;t++)this.columns[t].onLocaleChanged();var n=this.visibleRows;if(n){for(var t=0;t<n.length;t++)n[t].onLocaleChanged();this.fireCallback(this.updateCellsCallback)}},t.prototype.getColumnName=function(e){for(var t=0;t<this.columns.length;t++)if(this.columns[t].name==e)return this.columns[t];return null},t.prototype.getColumnWidth=function(e){return e.minWidth?e.minWidth:this.columnMinWidth},Object.defineProperty(t.prototype,"choices",{get:function(){return this.choicesValue},set:function(e){l.a.setData(this.choicesValue,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"optionsCaption",{get:function(){return this.locOptionsCaption.text?this.locOptionsCaption.text:c.a.getString("optionsCaption")},set:function(e){this.locOptionsCaption.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locOptionsCaption",{get:function(){return this.locOptionsCaptionValue},enumerable:!0,configurable:!0}),t.prototype.addColumn=function(e,t){void 0===t&&(t=null);var n=new m(e,t);return this.columnsValue.push(n),n},Object.defineProperty(t.prototype,"visibleRows",{get:function(){if(!this.isLoadingFromJson)return this.generatedVisibleRows||(this.generatedVisibleRows=this.generateRows(),this.data&&this.runCellsCondition(this.data.getAllValues())),this.generatedVisibleRows},enumerable:!0,configurable:!0}),t.prototype.onSurveyLoad=function(){e.prototype.onSurveyLoad.call(this),this.generatedVisibleRows=null},t.prototype.getRowValue=function(e){if(e<0)return null;var t=this.visibleRows;if(e>=t.length)return null;var n=this.createNewValue(this.value);return this.getRowValueCore(t[e],n)},t.prototype.setRowValue=function(e,t){if(e<0)return null;var n=this.visibleRows;if(e>=n.length)return null;this.onRowChanged(n[e],"",t),this.onValueChanged()},t.prototype.generateRows=function(){return null},t.prototype.createNewValue=function(e){return e||{}},t.prototype.getRowValueCore=function(e,t,n){void 0===n&&(n=!1);var r=t[e.rowName]?t[e.rowName]:null;return!r&&n&&(r={},t[e.rowName]=r),r},t.prototype.getRowDisplayValue=function(e,t){for(var n=0;n<this.columns.length;n++){var r=this.columns[n];t[r.name]&&(t[r.name]=e.cells[n].question.displayValue)}return t},t.prototype.onBeforeValueChanged=function(e){},t.prototype.onValueChanged=function(){if(!this.isRowChanging&&(this.onBeforeValueChanged(this.value),this.generatedVisibleRows&&0!=this.generatedVisibleRows.length)){this.isRowChanging=!0;for(var e=this.createNewValue(this.value),t=0;t<this.generatedVisibleRows.length;t++){var n=this.generatedVisibleRows[t];this.generatedVisibleRows[t].value=this.getRowValueCore(n,e)}this.isRowChanging=!1}},t.prototype.supportGoNextPageAutomatic=function(){var e=this.generatedVisibleRows;if(e||(e=this.visibleRows),!e)return!0;for(var t=0;t<e.length;t++){var n=this.generatedVisibleRows[t].cells;if(n)for(var r=0;r<n.length;r++){var i=n[r].question;if(i&&(!i.supportGoNextPageAutomatic()||!i.value))return!1}}return!0},t.prototype.hasErrors=function(t){void 0===t&&(t=!0);var n=this.hasErrorInColumns(t);return e.prototype.hasErrors.call(this,t)||n},t.prototype.getAllErrors=function(){for(var t=e.prototype.getAllErrors.call(this),n=this.generatedVisibleRows,r=0;r<n.length;r++)for(var i=n[r],o=0;o<i.cells.length;o++){var a=i.cells[o].question.getAllErrors();a&&a.length>0&&(t=t.concat(a))}return t},t.prototype.hasErrorInColumns=function(e){if(!this.generatedVisibleRows)return!1;for(var t=!1,n=0;n<this.generatedVisibleRows.length;n++){var r=this.generatedVisibleRows[n].cells;if(r)for(var i=0;i<this.columns.length;i++)if(r[i]){var o=r[i].question;t=o&&o.visible&&o.hasErrors(e)||t}}return t},t.prototype.getFirstInputElementId=function(){var t=this.getFirstCellQuestion(!1);return t?t.inputId:e.prototype.getFirstInputElementId.call(this)},t.prototype.getFirstErrorInputElementId=function(){var t=this.getFirstCellQuestion(!0);return t?t.inputId:e.prototype.getFirstErrorInputElementId.call(this)},t.prototype.getFirstCellQuestion=function(e){if(!this.generatedVisibleRows)return null;for(var t=0;t<this.generatedVisibleRows.length;t++)for(var n=this.generatedVisibleRows[t].cells,r=0;r<this.columns.length;r++){if(!e)return n[r].question;if(n[r].question.currentErrorCount>0)return n[r].question}return null},t.prototype.createQuestion=function(e,t){return this.createQuestionCore(e,t)},t.prototype.createQuestionCore=function(e,t){var n="default"==t.cellType?this.cellType:t.cellType,r=this.createCellQuestion(n,t.name);return r.setSurveyImpl(e),this.setQuestionProperties(r,t,e),r},t.prototype.getColumnChoices=function(e){return e.choices&&e.choices.length>0?e.choices:this.choices},t.prototype.getColumnOptionsCaption=function(e){return e.optionsCaption?e.optionsCaption:this.optionsCaption},t.prototype.setQuestionProperties=function(e,t,n){if(e){e.name=t.name,e.isRequired=t.isRequired,e.hasOther=t.hasOther,e.readOnly=this.readOnly,e.validators=t.validators,e.visibleIf=t.visibleIf,t.hasOther&&e instanceof h.b&&(e.storeOthersAsComment=!1);var r=e.getType();"checkbox"!=r&&"radiogroup"!=r||(e.colCount=t.colCount>-1?t.colCount:this.columnColCount,this.setSelectBaseProperties(e,t,n)),"dropdown"==r&&(e.optionsCaption=this.getColumnOptionsCaption(t),this.setSelectBaseProperties(e,t,n)),"text"==r&&(e.inputType=t.inputType,e.placeHolder=t.placeHolder),"comment"==r&&(e.placeHolder=t.placeHolder)}},t.prototype.setSelectBaseProperties=function(e,t,n){e.choicesOrder=t.choicesOrder,e.choices=this.getColumnChoices(t),e.choicesByUrl.setData(t.choicesByUrl),e.choicesByUrl.isEmpty||e.choicesByUrl.run(n)},t.prototype.createCellQuestion=function(e,t){return d.a.Instance.createQuestion(e,t)},t.prototype.deleteRowValue=function(e,t){return delete e[t.rowName],0==Object.keys(e).length?null:e},t.prototype.onAnyValueChanged=function(e){if(!this.isLoadingFromJson)for(var t=this.visibleRows,n=0;n<t.length;n++)t[n].onAnyValueChanged(e)},t.prototype.onCellValueChanged=function(e,t,n){if(this.survey){var r=this,i=function(t){for(var n=0;r.columns.length;n++)if(r.columns[n].name==t)return e.cells[n].question;return null},o={row:e,columnName:t,rowValue:n,value:n[t],getCellQuestion:i};this.survey.matrixCellValueChanged(this,o)}},t.prototype.validateCell=function(e,t,n){if(this.survey){var r={row:e,columnName:t,rowValue:n,value:n[t]};return this.survey.matrixCellValidate(this,r)}},t.prototype.onRowChanged=function(e,t,n){var r=this.createNewValue(this.value),i=this.getRowValueCore(e,r,!0);for(var o in i)delete i[o];if(n){n=JSON.parse(JSON.stringify(n));for(var o in n)a.b.isValueEmpty(n[o])||(i[o]=n[o])}0==Object.keys(i).length&&(r=this.deleteRowValue(r,e)),this.isRowChanging=!0,this.setNewValue(r),this.isRowChanging=!1,t&&this.onCellValueChanged(e,t,i)},t.prototype.getSurvey=function(){return this.survey},t}(o.a);i.a.metaData.addClass("matrixdropdowncolumn",["name",{name:"title",serializationProperty:"locTitle"},{name:"choices:itemvalues",onGetValue:function(e){return l.a.getData(e.choices)},onSetValue:function(e,t){e.choices=t}},{name:"optionsCaption",serializationProperty:"locOptionsCaption"},{name:"cellType",default:"default",choices:["default","dropdown","checkbox","radiogroup","text","comment"]},{name:"colCount",default:-1,choices:[-1,0,1,2,3,4]},"isRequired:boolean","hasOther:boolean","minWidth",{name:"placeHolder",serializationProperty:"locPlaceHolder"},{name:"choicesOrder",default:"none",choices:["none","asc","desc","random"]},{name:"choicesByUrl:restfull",className:"ChoicesRestfull",onGetValue:function(e){return e.choicesByUrl.isEmpty?null:e.choicesByUrl},onSetValue:function(e,t){e.choicesByUrl.setData(t)}},{name:"inputType",default:"text",choices:["color","date","datetime","datetime-local","email","month","number","password","range","tel","text","time","url","week"]},"visibleIf:expression",{name:"validators:validators",baseClassName:"surveyvalidator",classNamePart:"validator"}],function(){return new m("")}),i.a.metaData.addClass("matrixdropdownbase",[{name:"columns:matrixdropdowncolumns",className:"matrixdropdowncolumn"},"horizontalScroll:boolean",{name:"choices:itemvalues",onGetValue:function(e){return l.a.getData(e.choices)},onSetValue:function(e,t){e.choices=t}},{name:"optionsCaption",serializationProperty:"locOptionsCaption"},{name:"cellType",default:"dropdown",choices:["dropdown","checkbox","radiogroup","text","comment"]},{name:"columnColCount",default:0,choices:[0,1,2,3,4]},"columnMinWidth"],function(){return new v("")},"question")},function(e,t,n){"use strict";var r=n(0),i=n(5),o=n(3),a=n(15),s=n(11),u=n(35);n.d(t,"a",function(){return l});var l=function(e){function t(n){var r=e.call(this)||this;return r.name=n,r.conditionRunner=null,r.isCustomWidgetRequested=!1,r.customWidgetData={isNeedRender:!0},r.visibleIf="",r.visibleValue=!0,r.startWithNewLineValue=!0,r.visibleIndexValue=-1,r.width="",r.renderWidthValue="",r.rightIndentValue=0,r.indentValue=0,r.localeChanged=new i.c,r.idValue=t.getQuestionId(),r.onCreating(),r}return r.b(t,e),t.getQuestionId=function(){return"sq_"+t.questionCounter++},Object.defineProperty(t.prototype,"isPanel",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"visible",{get:function(){return this.visibleValue},set:function(e){e!=this.visible&&(this.visibleValue=e,this.fireCallback(this.visibilityChangedCallback),this.fireCallback(this.rowVisibilityChangedCallback),this.survey&&this.survey.questionVisibilityChanged(this,this.visible))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this.visible||this.isDesignMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDesignMode",{get:function(){return this.survey&&this.survey.isDesignMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isReadOnly",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"visibleIndex",{get:function(){return this.visibleIndexValue},enumerable:!0,configurable:!0}),t.prototype.hasErrors=function(e){return void 0===e&&(e=!0),!1},Object.defineProperty(t.prototype,"currentErrorCount",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasTitle",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasDescription",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasInput",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasComment",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this.idValue},set:function(e){this.idValue=e},enumerable:!0,configurable:!0}),t.prototype.getAllErrors=function(){return[]},Object.defineProperty(t.prototype,"customWidget",{get:function(){return this.isCustomWidgetRequested||this.customWidgetValue||(this.isCustomWidgetRequested=!0,this.updateCustomWidget()),this.customWidgetValue},enumerable:!0,configurable:!0}),t.prototype.updateCustomWidget=function(){this.customWidgetValue=u.a.Instance.getCustomWidget(this)},Object.defineProperty(t.prototype,"startWithNewLine",{get:function(){return this.startWithNewLineValue},set:function(e){this.startWithNewLine!=e&&(this.startWithNewLineValue=e,this.startWithNewLineChangedCallback&&this.startWithNewLineChangedCallback())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cssClasses",{get:function(){var e=this.css,t={error:{}};return this.copyCssClasses(t,e.question),this.copyCssClasses(t.error,e.error),this.updateCssClasses(t,e),this.survey&&this.survey.updateQuestionCssClasses(this,t),t},enumerable:!0,configurable:!0}),t.prototype.getRootCss=function(e){return e.question.root},t.prototype.updateCssClasses=function(e,t){var n=t[this.getType()];if(void 0!==n&&null!==n)if("string"==typeof n||n instanceof String)e.root=n;else for(var r in n)e[r]=n[r]},t.prototype.copyCssClasses=function(e,t){if(t)if("string"==typeof t||t instanceof String)e.root=t;else for(var n in t)e[n]=t[n]},Object.defineProperty(t.prototype,"css",{get:function(){return s.b.getCss()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderWidth",{get:function(){return this.renderWidthValue},set:function(e){e!=this.renderWidth&&(this.renderWidthValue=e,this.fireCallback(this.renderWidthChangedCallback))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"indent",{get:function(){return this.indentValue},set:function(e){e!=this.indent&&(this.indentValue=e,this.fireCallback(this.renderWidthChangedCallback))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rightIndent",{get:function(){return this.rightIndentValue},set:function(e){e!=this.rightIndent&&(this.rightIndentValue=e,this.fireCallback(this.renderWidthChangedCallback))},enumerable:!0,configurable:!0}),t.prototype.focus=function(e){void 0===e&&(e=!1)},t.prototype.fireCallback=function(e){e&&e()},t.prototype.onCreating=function(){},t.prototype.runCondition=function(e){this.visibleIf&&(this.conditionRunner||(this.conditionRunner=new a.a(this.visibleIf)),this.conditionRunner.expression=this.visibleIf,this.visible=this.conditionRunner.run(e))},t.prototype.onSurveyValueChanged=function(e){},t.prototype.onSurveyLoad=function(){this.fireCallback(this.surveyLoadCallback)},t.prototype.setVisibleIndex=function(e){return this.visibleIndexValue==e?1:(this.visibleIndexValue=e,this.fireCallback(this.visibleIndexChangedCallback),1)},t.prototype.supportGoNextPageAutomatic=function(){return!1},t.prototype.clearUnusedValues=function(){},Object.defineProperty(t.prototype,"displayValue",{get:function(){return""},enumerable:!0,configurable:!0}),t.prototype.onLocaleChanged=function(){this.localeChanged.fire(this,this.getLocale())},t.prototype.onReadOnlyChanged=function(){},t.prototype.onAnyValueChanged=function(e){},t.prototype.getLocale=function(){return this.survey?this.survey.getLocale():""},t.prototype.getMarkdownHtml=function(e){return this.survey?this.survey.getMarkdownHtml(e):null},t}(i.a);l.questionCounter=100,o.a.metaData.addClass("questionbase",["!name",{name:"visible:boolean",default:!0},"visibleIf:expression",{name:"width"},{name:"startWithNewLine:boolean",default:!0},{name:"indent:number",default:0,choices:[0,1,2,3]}])},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4));n.d(t,"a",function(){return a});var a=function(e){function t(t){var n=e.call(this,t)||this;return n.localeChangedHandler=function(e){return e.customWidgetData.isNeedRender=!0},n}return r.b(t,e),t.prototype._afterRender=function(){var e=this.refs.root;this.questionBase.customWidget&&(e=this.refs.widget)&&(this.questionBase.customWidget.afterRender(this.questionBase,e),this.questionBase.customWidgetData.isNeedRender=!1)},t.prototype.componentDidMount=function(){this.questionBase&&(this._afterRender(),this.questionBase.localeChanged.add(this.localeChangedHandler))},t.prototype.componentDidUpdate=function(){this.questionBase&&this._afterRender()},t.prototype.componentWillUnmount=function(){var e=this.refs.root;this.questionBase.customWidget&&(e=this.refs.widget)&&this.questionBase.customWidget.willUnmount(this.questionBase,e),this.questionBase.localeChanged.remove(this.localeChangedHandler)},t.prototype.render=function(){if(!this.questionBase||!this.creator)return null;if(!this.questionBase.visible)return null;var e=this.questionBase.customWidget;if(e.widgetJson.isDefaultRender)return i.createElement("div",{ref:"widget"},this.creator.createQuestionElement(this.questionBase));var t=null;if(e.widgetJson.render)t=e.widgetJson.render(this.questionBase);else if(e.htmlTemplate){var n={__html:e.htmlTemplate};return i.createElement("div",{ref:"widget",dangerouslySetInnerHTML:n})}return i.createElement("div",{ref:"widget"},t)},t}(o.b)},function(e,t,n){"use strict";var r=n(0),i=n(2);n.n(i);n.d(t,"a",function(){return o});var o=function(e){function t(t){var n=e.call(this,t)||this;return n.updateStateFunction=null,n.survey=t.survey,n.css=t.css,n.state={update:0},n}return r.b(t,e),t.prototype.componentWillReceiveProps=function(e){this.survey=e.survey,this.css=e.css},t.prototype.componentDidMount=function(){if(this.survey){var e=this;this.updateStateFunction=function(){e.state.update=e.state.update+1,e.setState(e.state)},this.survey.onPageVisibleChanged.add(this.updateStateFunction)}},t.prototype.componentWillUnmount=function(){this.survey&&this.updateStateFunction&&(this.survey.onPageVisibleChanged.remove(this.updateStateFunction),this.updateStateFunction=null)},t}(i.Component)},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(18)),a=n(4);n.d(t,"a",function(){return s}),n.d(t,"c",function(){return u}),n.d(t,"b",function(){return l});var s=function(e){function t(t){var n=e.call(this,t)||this;return n.page=t.page,n.survey=t.survey,n.creator=t.creator,n.css=t.css,n}return r.b(t,e),t.prototype.componentWillReceiveProps=function(e){this.page=e.page,this.survey=e.survey,this.creator=e.creator,this.css=e.css},t.prototype.componentDidMount=function(){var e=this.refs.root;e&&this.survey&&this.survey.afterRenderPage(e)},t.prototype.render=function(){if(null==this.page||null==this.survey||null==this.creator)return null;for(var e=this.renderTitle(),t=[],n=this.page.rows,r=0;r<n.length;r++)t.push(this.createRow(n[r],r));return i.createElement("div",{ref:"root"},e,t)},t.prototype.createRow=function(e,t){var n="row"+(t+1);return i.createElement(l,{key:n,row:e,survey:this.survey,creator:this.creator,css:this.css})},t.prototype.renderTitle=function(){if(!this.page.title||!this.survey.showPageTitles)return null;var e=a.a.renderLocString(this.page.locTitle);return i.createElement("h4",{className:this.css.pageTitle},e)},t}(i.Component),u=function(e){function t(t){var n=e.call(this,t)||this;return n.panel=t.panel,n.survey=t.survey,n.creator=t.creator,n.css=t.css,n.state={modelChanged:0},n}return r.b(t,e),t.prototype.componentWillReceiveProps=function(e){this.panel=e.panel,this.survey=e.survey,this.creator=e.creator,this.css=e.css},t.prototype.componentDidMount=function(){var e=this,t=this.refs.root;t&&this.survey&&this.survey.afterRenderPanel(this.panel,t),this.panel.panelVisibilityChanged=function(t,n){e.state.modelChanged=e.state.modelChanged+1,e.setState(e.state)},this.panel.renderWidthChangedCallback=function(){e.state.modelChanged=e.state.modelChanged+1,e.setState(e.state)}},t.prototype.render=function(){if(null==this.panel||null==this.survey||null==this.creator)return null;for(var e=this.renderTitle(),t=[],n=this.panel.rows,r=0;r<n.length;r++)t.push(this.createRow(n[r],r));var o={paddingLeft:this.panel.innerIndent*this.css.question.indent+"px"},a={verticalAlign:"top",display:this.panel.isVisible?"inline-block":"none"};return this.panel.renderWidth&&(a.width=this.panel.renderWidth),i.createElement("div",{ref:"root",className:this.css.panel.container,style:a},e,i.createElement("div",{style:o},t))},t.prototype.createRow=function(e,t){var n="row"+(t+1);return i.createElement(l,{key:n,row:e,survey:this.survey,creator:this.creator,css:this.css})},t.prototype.renderTitle=function(){if(!this.panel.title)return null;var e=a.a.renderLocString(this.panel.locTitle);return i.createElement("h4",{className:this.css.panel.title},e)},t}(i.Component),l=function(e){function t(t){var n=e.call(this,t)||this;return n.setProperties(t),n}return r.b(t,e),t.prototype.componentWillReceiveProps=function(e){this.setProperties(e)},t.prototype.setProperties=function(e){if(this.row=e.row,this.row){var t=this;this.row.visibilityChangedCallback=function(){t.setState({visible:t.row.visible})}}this.survey=e.survey,this.creator=e.creator,this.css=e.css},t.prototype.render=function(){if(null==this.row||null==this.survey||null==this.creator)return null;var e=null;if(this.row.visible){e=[];for(var t=0;t<this.row.elements.length;t++){var n=this.row.elements[t];e.push(this.createQuestion(n))}}var r=this.row.visible?{}:{display:"none"};return i.createElement("div",{className:this.css.row,style:r},e)},t.prototype.createQuestion=function(e){return e.isPanel?i.createElement(u,{key:e.name,panel:e,creator:this.creator,survey:this.survey,css:this.css}):i.createElement(o.a,{key:e.name,question:e,creator:this.creator,css:this.css})},t}(i.Component)},function(e,t,n){"use strict";var r=n(0),i=n(28);n.d(t,"a",function(){return o});var o=function(e){function t(t){return void 0===t&&(t=null),e.call(this,t)||this}return r.b(t,e),t.prototype.render=function(){this.renderCallback&&this.renderCallback()},t.prototype.mergeCss=function(e,t){this.mergeValues(e,t)},t.prototype.doAfterRenderSurvey=function(e){this.afterRenderSurvey(e)},t.prototype.onLoadSurveyFromService=function(){this.render()},t.prototype.onLoadingSurveyFromService=function(){this.render()},t.prototype.setCompletedState=function(t,n){e.prototype.setCompletedState.call(this,t,n),this.render()},t}(i.a)},function(e,t,n){"use strict";var r=n(0),i=n(3),o=n(5),a=n(34),s=n(17),u=n(14),l=n(32),c=n(1),h=n(10);n.d(t,"a",function(){return p});var p=function(e){function t(t){void 0===t&&(t=null);var n=e.call(this)||this;n.currentPageValue=null,n.valuesHash={},n.variablesHash={},n.localeValue="",n.isCompleted=!1,n.isCompletedBefore=!1,n.isLoading=!1,n.processedTextValues={},n.completedStateValue="",n.completedStateTextValue="",n.onComplete=new o.c,n.onPartialSend=new o.c,n.onCurrentPageChanged=new o.c,n.onValueChanged=new o.c,n.onVisibleChanged=new o.c,n.onPageVisibleChanged=new o.c,n.onQuestionAdded=new o.c,n.onQuestionRemoved=new o.c,n.onPanelAdded=new o.c,n.onPanelRemoved=new o.c,n.onValidateQuestion=new o.c,n.onProcessHtml=new o.c,n.onTextMarkdown=new o.c,n.onSendResult=new o.c,n.onGetResult=new o.c,n.onUploadFile=new o.c,n.onUpdateQuestionCssClasses=new o.c,n.onAfterRenderSurvey=new o.c,n.onAfterRenderPage=new o.c,n.onAfterRenderQuestion=new o.c,n.onAfterRenderPanel=new o.c,n.onMatrixRowAdded=new o.c,n.onMatrixCellCreated=new o.c,n.onMatrixCellValueChanged=new o.c,n.onMatrixCellValidate=new o.c,n.jsonErrors=null;var r=n;return n.createLocalizableString("title",n,!0).onRenderedHtmlCallback=function(e){return r.processedTitle},n.createLocalizableString("completedHtml",n),n.createLocalizableString("completedBeforeHtml",n),n.createLocalizableString("loadingHtml",n),n.createLocalizableString("pagePrev",n),n.createLocalizableString("pageNext",n),n.createLocalizableString("complete",n),n.createLocalizableString("questionTitleTemplate",n,!0),n.textPreProcessor=new s.a,n.textPreProcessor.onHasValue=function(e){return r.hasProcessedTextValue(e)},n.textPreProcessor.onProcess=function(e,t){return r.getProcessedTextValue(e,t)},n.pagesValue=n.createNewArray("pages",function(e){e.setSurveyImpl(r)}),n.triggersValue=n.createNewArray("triggers",function(e){e.setOwner(r)}),n.updateProcessedTextValues(),n.onBeforeCreating(),t&&(("string"==typeof t||t instanceof String)&&(t=JSON.parse(t)),t&&t.clientId&&(n.clientId=t.clientId),n.setJsonObject(t),n.surveyId&&n.loadSurveyFromService(n.surveyId,n.clientId)),n.onCreating(),n}return r.b(t,e),Object.defineProperty(t.prototype,"commentPrefix",{get:function(){return o.b.commentPrefix},set:function(e){o.b.commentPrefix=e},enumerable:!0,configurable:!0}),t.prototype.getType=function(){return"survey"},Object.defineProperty(t.prototype,"pages",{get:function(){return this.pagesValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"triggers",{get:function(){return this.triggersValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"surveyId",{get:function(){return this.getPropertyValue("surveyId","")},set:function(e){this.setPropertyValue("surveyId",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"surveyPostId",{get:function(){return this.getPropertyValue("surveyPostId","")},set:function(e){this.setPropertyValue("surveyPostId",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"clientId",{get:function(){return this.getPropertyValue("clientId","")},set:function(e){this.setPropertyValue("clientId",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cookieName",{get:function(){return this.getPropertyValue("cookieName","")},set:function(e){this.setPropertyValue("cookieName",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sendResultOnPageNext",{get:function(){return this.getPropertyValue("sendResultOnPageNext",!1)},set:function(e){this.setPropertyValue("sendResultOnPageNext",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"surveyShowDataSaving",{get:function(){return this.getPropertyValue("surveyShowDataSaving",!1)},set:function(e){this.setPropertyValue("surveyShowDataSaving",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"focusFirstQuestionAutomatic",{get:function(){return this.getPropertyValue("focusFirstQuestionAutomatic",!0)},set:function(e){this.setPropertyValue("focusFirstQuestionAutomatic",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showNavigationButtons",{get:function(){return this.getPropertyValue("showNavigationButtons",!0)},set:function(e){this.setPropertyValue("showNavigationButtons",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showTitle",{get:function(){return this.getPropertyValue("showTitle",!0)},set:function(e){this.setPropertyValue("showTitle",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showPageTitles",{get:function(){return this.getPropertyValue("showPageTitles",!0)},set:function(e){this.setPropertyValue("showPageTitles",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showCompletedPage",{get:function(){return this.getPropertyValue("showCompletedPage",!0)},set:function(e){this.setPropertyValue("showCompletedPage",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"requiredText",{get:function(){return this.getPropertyValue("requiredText","*")},set:function(e){this.setPropertyValue("requiredText",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"questionStartIndex",{get:function(){return this.getPropertyValue("questionStartIndex","")},set:function(e){this.setPropertyValue("questionStartIndex",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"storeOthersAsComment",{get:function(){return this.getPropertyValue("storeOthersAsComment",!0)},set:function(e){this.setPropertyValue("storeOthersAsComment",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"goNextPageAutomatic",{get:function(){return this.getPropertyValue("goNextPageAutomatic",!1)},set:function(e){this.setPropertyValue("goNextPageAutomatic",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"clearInvisibleValues",{get:function(){return this.getPropertyValue("clearInvisibleValues",!1)},set:function(e){this.setPropertyValue("clearInvisibleValues",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locale",{get:function(){return this.localeValue},set:function(e){this.localeValue=e,this.setPropertyValue("locale",e),c.a.currentLocale=e;for(var t=0;t<this.pages.length;t++)this.pages[t].onLocaleChanged()},enumerable:!0,configurable:!0}),t.prototype.getLocale=function(){return this.locale},t.prototype.getMarkdownHtml=function(e){var t={text:e,html:null};return this.onTextMarkdown.fire(this,t),t.html},t.prototype.getLocString=function(e){return c.a.getString(e)},Object.defineProperty(t.prototype,"emptySurveyText",{get:function(){return this.getLocString("emptySurvey")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return this.getLocalizableStringText("title")},set:function(e){this.setLocalizableStringText("title",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locTitle",{get:function(){return this.getLocalizableString("title")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"completedHtml",{get:function(){return this.getLocalizableStringText("completedHtml")},set:function(e){this.setLocalizableStringText("completedHtml",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locCompletedHtml",{get:function(){return this.getLocalizableString("completedHtml")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"completedBeforeHtml",{get:function(){return this.getLocalizableStringText("completedBeforeHtml")},set:function(e){this.setLocalizableStringText("completedBeforeHtml",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locCompletedBeforeHtml",{get:function(){return this.getLocalizableString("completedHtml")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"loadingHtml",{get:function(){return this.getLocalizableStringText("loadingHtml")},set:function(e){this.setLocalizableStringText("loadingHtml",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locLoadingHtml",{get:function(){return this.getLocalizableString("loadingHtml")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pagePrevText",{get:function(){return this.getLocalizableStringText("pagePrev",this.getLocString("pagePrevText"))},set:function(e){this.setLocalizableStringText("pagePrev",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locPagePrevText",{get:function(){return this.getLocalizableString("pagePrev")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pageNextText",{get:function(){return this.getLocalizableStringText("pageNext",this.getLocString("pageNextText"))},set:function(e){this.setLocalizableStringText("pageNext",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locPageNextText",{get:function(){return this.getLocalizableString("pageNext")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"completeText",{get:function(){return this.getLocalizableStringText("complete",this.getLocString("completeText"))},set:function(e){this.setLocalizableStringText("complete",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locCompleteText",{get:function(){return this.getLocalizableString("complete")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"questionTitleTemplate",{get:function(){return this.getLocalizableStringText("questionTitleTemplate")},set:function(e){this.setLocalizableStringText("questionTitleTemplate",e)},enumerable:!0,configurable:!0}),t.prototype.getQuestionTitleTemplate=function(){return this.locQuestionTitleTemplate.textOrHtml},Object.defineProperty(t.prototype,"locQuestionTitleTemplate",{get:function(){return this.getLocalizableString("questionTitleTemplate")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showPageNumbers",{get:function(){return this.getPropertyValue("showPageNumbers",!1)},set:function(e){e!==this.showPageNumbers&&(this.setPropertyValue("showPageNumbers",e),this.updateVisibleIndexes())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showQuestionNumbers",{get:function(){return this.getPropertyValue("showQuestionNumbers","on")},set:function(e){e=e.toLowerCase(),(e="onpage"===e?"onPage":e)!==this.showQuestionNumbers&&(this.setPropertyValue("showQuestionNumbers",e),this.updateVisibleIndexes())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showProgressBar",{get:function(){return this.getPropertyValue("showProgressBar","off")},set:function(e){this.setPropertyValue("showProgressBar",e.toLowerCase())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"processedTitle",{get:function(){return this.processText(this.locTitle.textOrHtml,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"questionTitleLocation",{get:function(){return this.getPropertyValue("questionTitleLocation","top")},set:function(e){this.setPropertyValue("questionTitleLocation",e.toLowerCase())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"questionErrorLocation",{get:function(){return this.getPropertyValue("questionErrorLocation","top")},set:function(e){this.setPropertyValue("questionErrorLocation",e.toLowerCase())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mode",{get:function(){return this.getPropertyValue("mode","edit")},set:function(e){if((e=e.toLowerCase())!=this.mode&&("edit"==e||"display"==e)){this.setPropertyValue("mode",e);for(var t=this.getAllQuestions(),n=0;n<t.length;n++)t[n].onReadOnlyChanged()}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){var e={};for(var t in this.valuesHash)e[t]=this.valuesHash[t];return e},set:function(e){if(this.valuesHash={},e)for(var t in e)this.setDataValueCore(this.valuesHash,t,e[t]),this.checkTriggers(t,e[t],!1),this.processedTextValues[t.toLowerCase()]||(this.processedTextValues[t.toLowerCase()]="value");this.notifyAllQuestionsOnValueChanged(),this.runConditions()},enumerable:!0,configurable:!0}),t.prototype.getAllValues=function(){return this.data},t.prototype.setDataValueCore=function(e,t,n){e[t]=n},Object.defineProperty(t.prototype,"comments",{get:function(){var e={};for(var t in this.valuesHash)t.indexOf(this.commentPrefix)>0&&(e[t]=this.valuesHash[t]);return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"visiblePages",{get:function(){if(this.isDesignMode)return this.pages;for(var e=new Array,t=0;t<this.pages.length;t++)this.pages[t].isVisible&&e.push(this.pages[t]);return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isEmpty",{get:function(){return 0==this.pages.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"PageCount",{get:function(){return this.pageCount},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pageCount",{get:function(){return this.pages.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"visiblePageCount",{get:function(){return this.visiblePages.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentPage",{get:function(){var e=this.visiblePages;return null!=this.currentPageValue&&e.indexOf(this.currentPageValue)<0&&(this.currentPage=null),null==this.currentPageValue&&e.length>0&&(this.currentPage=e[0]),this.currentPageValue},set:function(e){var t=this.visiblePages;if(!(null!=e&&t.indexOf(e)<0)&&e!=this.currentPageValue){var n=this.currentPageValue;this.currentPageValue=e,e&&e.updateCustomWidgets(),this.currentPageChanged(e,n)}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentPageNo",{get:function(){return this.visiblePages.indexOf(this.currentPage)},set:function(e){this.visiblePages;e<0||e>=this.visiblePages.length||(this.currentPage=this.visiblePages[e])},enumerable:!0,configurable:!0}),t.prototype.focusFirstQuestion=function(){this.currentPageValue&&(this.currentPageValue.scrollToTop(),this.currentPageValue.focusFirstQuestion())},Object.defineProperty(t.prototype,"state",{get:function(){return this.isLoading?"loading":this.isCompleted?"completed":this.isCompletedBefore?"completedbefore":this.currentPage?"running":"empty"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"completedState",{get:function(){return this.completedStateValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"completedStateText",{get:function(){return this.completedStateTextValue},enumerable:!0,configurable:!0}),t.prototype.setCompletedState=function(e,t){this.completedStateValue=e,t||("saving"==e&&(t=this.getLocString("savingData")),"error"==e&&(t=this.getLocString("savingDataError")),"success"==e&&(t=this.getLocString("savingDataSuccess"))),this.completedStateTextValue=t},t.prototype.clear=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0),e&&(this.data=null,this.variablesHash={}),this.isCompleted=!1,this.isCompletedBefore=!1,this.isLoading=!1,t&&this.visiblePageCount>0&&(this.currentPage=this.visiblePages[0])},t.prototype.mergeValues=function(e,t){if(t&&e)for(var n in e){var r=e[n];r&&"object"==typeof r?(t[n]||(t[n]={}),this.mergeValues(r,t[n])):t[n]=r}},t.prototype.updateCustomWidgets=function(e){e&&e.updateCustomWidgets()},t.prototype.currentPageChanged=function(e,t){this.onCurrentPageChanged.fire(this,{oldCurrentPage:t,newCurrentPage:e})},t.prototype.getProgress=function(){if(null==this.currentPage)return 0;var e=this.visiblePages.indexOf(this.currentPage)+1;return Math.ceil(100*e/this.visiblePageCount)},Object.defineProperty(t.prototype,"isNavigationButtonsShowing",{get:function(){if(this.isDesignMode)return!1;var e=this.currentPage;return!!e&&("show"==e.navigationButtonsVisibility||"hide"!=e.navigationButtonsVisibility&&this.showNavigationButtons)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isEditMode",{get:function(){return"edit"==this.mode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisplayMode",{get:function(){return"display"==this.mode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDesignMode",{get:function(){return this.getPropertyValue("isDesignMode",!1)},enumerable:!0,configurable:!0}),t.prototype.setDesignMode=function(e){this.setPropertyValue("isDesignMode",e)},Object.defineProperty(t.prototype,"hasCookie",{get:function(){if(!this.cookieName)return!1;var e=document.cookie;return e&&e.indexOf(this.cookieName+"=true")>-1},enumerable:!0,configurable:!0}),t.prototype.setCookie=function(){this.cookieName&&(document.cookie=this.cookieName+"=true; expires=Fri, 31 Dec 9999 0:0:0 GMT")},t.prototype.deleteCookie=function(){this.cookieName&&(document.cookie=this.cookieName+"=;")},t.prototype.nextPage=function(){return!this.isLastPage&&((!this.isEditMode||!this.isCurrentPageHasErrors)&&(!this.doServerValidation()&&(this.doNextPage(),!0)))},Object.defineProperty(t.prototype,"isCurrentPageHasErrors",{get:function(){return null==this.currentPage||this.currentPage.hasErrors(!0,!0)},enumerable:!0,configurable:!0}),t.prototype.prevPage=function(){if(this.isFirstPage)return!1;var e=this.visiblePages,t=e.indexOf(this.currentPage);this.currentPage=e[t-1]},t.prototype.completeLastPage=function(){return(!this.isEditMode||!this.isCurrentPageHasErrors)&&(!this.doServerValidation()&&(this.doComplete(),!0))},Object.defineProperty(t.prototype,"isFirstPage",{get:function(){return null==this.currentPage||0==this.visiblePages.indexOf(this.currentPage)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isLastPage",{get:function(){if(null==this.currentPage)return!0;var e=this.visiblePages;return e.indexOf(this.currentPage)==e.length-1},enumerable:!0,configurable:!0}),t.prototype.doComplete=function(){var e=this.hasCookie;this.clearUnusedValues(),this.setCookie(),this.setCompleted();var t=this,n={showDataSaving:function(e){t.setCompletedState("saving",e)},showDataSavingError:function(e){t.setCompletedState("error",e)},showDataSavingSuccess:function(e){t.setCompletedState("success",e)},showDataSavingClear:function(e){t.setCompletedState("","")}};this.onComplete.fire(this,n),!e&&this.surveyPostId&&this.sendResult()},Object.defineProperty(t.prototype,"isValidatingOnServer",{get:function(){return this.getPropertyValue("isValidatingOnServer",!1)},enumerable:!0,configurable:!0}),t.prototype.setIsValidatingOnServer=function(e){e!=this.isValidatingOnServer&&(this.setPropertyValue("isValidatingOnServer",e),this.onIsValidatingOnServerChanged())},t.prototype.onIsValidatingOnServerChanged=function(){},t.prototype.doServerValidation=function(){if(!this.onServerValidateQuestions)return!1;for(var e=this,t={data:{},errors:{},survey:this,complete:function(){e.completeServerValidation(t)}},n=0;n<this.currentPage.questions.length;n++){var r=this.currentPage.questions[n];if(r.visible){var i=this.getValue(r.name);o.b.isValueEmpty(i)||(t.data[r.name]=i)}}return this.setIsValidatingOnServer(!0),this.onServerValidateQuestions(this,t),!0},t.prototype.completeServerValidation=function(e){if(this.setIsValidatingOnServer(!1),e||e.survey){var t=e.survey,n=!1;if(e.errors)for(var r in e.errors){var i=t.getQuestionByName(r);i&&i.errors&&(n=!0,i.addError(new h.c(e.errors[r])))}n||(t.isLastPage?t.doComplete():t.doNextPage())}},t.prototype.doNextPage=function(){this.checkOnPageTriggers(),this.sendResultOnPageNext&&this.sendResult(this.surveyPostId,this.clientId,!0);var e=this.visiblePages,t=e.indexOf(this.currentPage);this.currentPage=e[t+1]},t.prototype.setCompleted=function(){this.isCompleted=!0},Object.defineProperty(t.prototype,"processedCompletedHtml",{get:function(){return this.completedHtml?this.processHtml(this.completedHtml):"<h3>"+this.getLocString("completingSurvey")+"</h3>"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"processedCompletedBeforeHtml",{get:function(){return this.completedBeforeHtml?this.processHtml(this.completedBeforeHtml):"<h3>"+this.getLocString("completingSurveyBefore")+"</h3>"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"processedLoadingHtml",{get:function(){return this.loadingHtml?this.processHtml(this.loadingHtml):"<h3>"+this.getLocString("loadingSurvey")+"</h3>"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"progressText",{get:function(){if(null==this.currentPage)return"";var e=this.visiblePages,t=e.indexOf(this.currentPage)+1;return this.getLocString("progressText").format(t,e.length)},enumerable:!0,configurable:!0}),t.prototype.afterRenderSurvey=function(e){this.onAfterRenderSurvey.fire(this,{survey:this,htmlElement:e})},t.prototype.updateQuestionCssClasses=function(e,t){this.onUpdateQuestionCssClasses.fire(this,{question:e,cssClasses:t})},t.prototype.afterRenderPage=function(e){this.onAfterRenderPage.isEmpty||this.onAfterRenderPage.fire(this,{page:this.currentPage,htmlElement:e})},t.prototype.afterRenderQuestion=function(e,t){this.onAfterRenderQuestion.fire(this,{question:e,htmlElement:t})},t.prototype.afterRenderPanel=function(e,t){this.onAfterRenderPanel.fire(this,{panel:e,htmlElement:t})},t.prototype.matrixRowAdded=function(e){this.onMatrixRowAdded.fire(this,{question:e})},t.prototype.matrixCellCreated=function(e,t){t.question=e,this.onMatrixCellCreated.fire(this,t)},t.prototype.matrixCellValueChanged=function(e,t){t.question=e,this.onMatrixCellValueChanged.fire(this,t)},t.prototype.matrixCellValidate=function(e,t){return t.question=e,this.onMatrixCellValidate.fire(this,t),t.error?new h.c(t.error):null},t.prototype.uploadFile=function(e,t,n,r){var i=!0;return this.onUploadFile.fire(this,{name:e,file:t,accept:i}),!!i&&(!n&&this.surveyPostId&&this.uploadFileCore(e,t,r),!0)},t.prototype.createSurveyService=function(){return new l.a},t.prototype.uploadFileCore=function(e,t,n){var r=this;n&&n("uploading"),this.createSurveyService().sendFile(this.surveyPostId,t,function(t,i){n&&n(t?"success":"error"),t&&r.setValue(e,i)})},t.prototype.getPage=function(e){return this.pages[e]},t.prototype.addPage=function(e){null!=e&&(this.pages.push(e),this.updateVisibleIndexes())},t.prototype.addNewPage=function(e){var t=this.createNewPage(e);return this.addPage(t),t},t.prototype.removePage=function(e){var t=this.pages.indexOf(e);t<0||(this.pages.splice(t,1),this.currentPageValue==e&&(this.currentPage=this.pages.length>0?this.pages[0]:null),this.updateVisibleIndexes())},t.prototype.getQuestionByName=function(e,t){void 0===t&&(t=!1);var n=this.getAllQuestions();t&&(e=e.toLowerCase());for(var r=0;r<n.length;r++){var i=n[r].name;if(t&&(i=i.toLowerCase()),i==e)return n[r]}return null},t.prototype.getQuestionsByNames=function(e,t){void 0===t&&(t=!1);var n=[];if(!e)return n;for(var r=0;r<e.length;r++)if(e[r]){var i=this.getQuestionByName(e[r],t);i&&n.push(i)}return n},t.prototype.getPageByElement=function(e){for(var t=0;t<this.pages.length;t++){var n=this.pages[t];if(n.containsElement(e))return n}return null},t.prototype.getPageByQuestion=function(e){return this.getPageByElement(e)},t.prototype.getPageByName=function(e){for(var t=0;t<this.pages.length;t++)if(this.pages[t].name==e)return this.pages[t];return null},t.prototype.getPagesByNames=function(e){var t=[];if(!e)return t;for(var n=0;n<e.length;n++)if(e[n]){var r=this.getPageByName(e[n]);r&&t.push(r)}return t},t.prototype.getAllQuestions=function(e){void 0===e&&(e=!1);for(var t=new Array,n=0;n<this.pages.length;n++)this.pages[n].addQuestionsToList(t,e);return t},t.prototype.createNewPage=function(e){return new a.a(e)},t.prototype.notifyQuestionOnValueChanged=function(e,t){for(var n=this.getAllQuestions(),r=null,i=0;i<n.length;i++)n[i].name==e&&(r=n[i],this.doSurveyValueChanged(r,t),this.onValueChanged.fire(this,{name:e,question:r,value:t}));r||this.onValueChanged.fire(this,{name:e,question:null,value:t}),this.notifyElementsOnAnyValueOrVariableChanged(e)},t.prototype.notifyElementsOnAnyValueOrVariableChanged=function(e){for(var t=0;t<this.pages.length;t++)this.pages[t].onAnyValueChanged(e)},t.prototype.notifyAllQuestionsOnValueChanged=function(){for(var e=this.getAllQuestions(),t=0;t<e.length;t++)this.doSurveyValueChanged(e[t],this.getValue(e[t].name))},t.prototype.doSurveyValueChanged=function(e,t){e.onSurveyValueChanged(t)},t.prototype.checkOnPageTriggers=function(){for(var e=this.getCurrentPageQuestions(),t=0;t<e.length;t++){var n=e[t],r=this.getValue(n.name);this.checkTriggers(n.name,r,!0)}},t.prototype.getCurrentPageQuestions=function(){var e=[],t=this.currentPage;if(!t)return e;for(var n=0;n<t.questions.length;n++){var r=t.questions[n];r.visible&&r.name&&e.push(r)}return e},t.prototype.checkTriggers=function(e,t,n){for(var r=0;r<this.triggers.length;r++){var i=this.triggers[r];i.name==e&&i.isOnNextPage==n&&i.check(t)}},t.prototype.doElementsOnLoad=function(){for(var e=0;e<this.pages.length;e++)this.pages[e].onSurveyLoad()},t.prototype.runConditions=function(){for(var e=this.pages,t=0;t<e.length;t++)e[t].runCondition(this.valuesHash)},t.prototype.sendResult=function(e,t,n){if(void 0===e&&(e=null),void 0===t&&(t=null),void 0===n&&(n=!1),this.isEditMode&&(n&&this.onPartialSend&&this.onPartialSend.fire(this,null),!e&&this.surveyPostId&&(e=this.surveyPostId),e&&(t&&(this.clientId=t),!n||this.clientId))){var r=this;this.surveyShowDataSaving&&this.setCompletedState("saving",""),this.createSurveyService().sendResult(e,this.data,function(e,t){r.surveyShowDataSaving&&(e?r.setCompletedState("success",""):r.setCompletedState("error","")),r.onSendResult.fire(r,{success:e,response:t})},this.clientId,n)}},t.prototype.getResult=function(e,t){var n=this;this.createSurveyService().getResult(e,t,function(e,t,r,i){n.onGetResult.fire(n,{success:e,data:t,dataList:r,response:i})})},t.prototype.loadSurveyFromService=function(e,t){void 0===e&&(e=null),void 0===t&&(t=null),e&&(this.surveyId=e),t&&(this.clientId=t);var n=this;this.isLoading=!0,this.onLoadingSurveyFromService(),t?this.createSurveyService().getSurveyJsonAndIsCompleted(this.surveyId,this.clientId,function(e,t,r,i){n.isLoading=!1,e&&(n.isCompletedBefore="completed"==r,n.loadSurveyFromServiceJson(t))}):this.createSurveyService().loadSurvey(this.surveyId,function(e,t,r){n.isLoading=!1,e&&n.loadSurveyFromServiceJson(t)})},t.prototype.loadSurveyFromServiceJson=function(e){e&&(this.setJsonObject(e),this.notifyAllQuestionsOnValueChanged(),this.onLoadSurveyFromService())},t.prototype.onLoadingSurveyFromService=function(){},t.prototype.onLoadSurveyFromService=function(){},t.prototype.checkPageVisibility=function(e,t){var n=this.getPageByQuestion(e);if(n){var r=n.isVisible;(r!=n.getIsPageVisible(e)||t)&&this.pageVisibilityChanged(n,r)}},t.prototype.updateVisibleIndexes=function(){if(this.updatePageVisibleIndexes(this.showPageNumbers),"onPage"==this.showQuestionNumbers)for(var e=this.visiblePages,t=0;t<e.length;t++)this.updateQuestionVisibleIndexes(e[t].questions,!0);else this.updateQuestionVisibleIndexes(this.getAllQuestions(!1),"on"==this.showQuestionNumbers)},t.prototype.updatePageVisibleIndexes=function(e){for(var t=0,n=0;n<this.pages.length;n++)this.pages[n].visibleIndex=this.pages[n].visible?t++:-1,this.pages[n].num=e&&this.pages[n].visible?this.pages[n].visibleIndex+1:-1},t.prototype.updateQuestionVisibleIndexes=function(e,t){o.a.setVisibleIndex(e,0,t)},t.prototype.setJsonObject=function(e){if(e){this.jsonErrors=null;var t=new i.a;t.toObject(e,this),t.errors.length>0&&(this.jsonErrors=t.errors)}},t.prototype.endLoadingFromJson=function(){this.runConditions(),this.updateVisibleIndexes(),this.updateProcessedTextValues(),e.prototype.endLoadingFromJson.call(this),this.hasCookie&&this.doComplete(),this.doElementsOnLoad()},t.prototype.onBeforeCreating=function(){},t.prototype.onCreating=function(){},t.prototype.updateProcessedTextValues=function(){this.processedTextValues={};var e=this;this.processedTextValues.pageno=function(t){return null!=e.currentPage?e.visiblePages.indexOf(e.currentPage)+1:0},this.processedTextValues.pagecount=function(t){return e.visiblePageCount};for(var t=this.getAllQuestions(),n=0;n<t.length;n++)this.addQuestionToProcessedTextValues(t[n])},t.prototype.addQuestionToProcessedTextValues=function(e){this.processedTextValues[e.name.toLowerCase()]="question"},t.prototype.hasProcessedTextValue=function(e){var t=(new u.a).getFirstName(e);return this.processedTextValues[t.toLowerCase()]},t.prototype.getProcessedTextValue=function(e,t){var n=(new u.a).getFirstName(e),r=this.processedTextValues[n.toLowerCase()];if(!r)return null;if("variable"==r)return this.getVariable(e.toLowerCase());if("question"==r){var i=this.getQuestionByName(n,!0);if(!i)return null;e=i.name+e.substr(n.length);var o={};return o[n]=t?i.displayValue:this.getValue(n),(new u.a).getValue(e,o)}return"value"==r?(new u.a).getValue(e,this.valuesHash):r(e)},t.prototype.clearUnusedValues=function(){for(var e=this.getAllQuestions(),t=0;t<e.length;t++)e[t].clearUnusedValues();this.clearInvisibleValues&&this.clearInvisibleQuestionValues()},t.prototype.clearInvisibleQuestionValues=function(){for(var e=this.getAllQuestions(),t=0;t<e.length;t++)e[t].visible||this.clearValue(e[t].name)},t.prototype.getVariable=function(e){return e?this.variablesHash[e]:null},t.prototype.setVariable=function(e,t){e&&(this.variablesHash[e]=t,this.processedTextValues[e.toLowerCase()]="variable",this.notifyElementsOnAnyValueOrVariableChanged(e))},t.prototype.getUnbindValue=function(e){return e&&e instanceof Object?JSON.parse(JSON.stringify(e)):e},t.prototype.getValue=function(e){if(!e||0==e.length)return null;var t=this.valuesHash[e];return this.getUnbindValue(t)},t.prototype.setValue=function(e,t){if(!this.isValueEqual(e,t)){if(o.b.isValueEmpty(t))delete this.valuesHash[e];else{t=this.getUnbindValue(t),this.setDataValueCore(this.valuesHash,e,t);this.processedTextValues[e.toLowerCase()]||(this.processedTextValues[e.toLowerCase()]="value")}this.notifyQuestionOnValueChanged(e,t),this.checkTriggers(e,t,!1),this.runConditions(),this.tryGoNextPageAutomatic(e)}},t.prototype.isValueEqual=function(e,t){""==t&&(t=null);var n=this.getValue(e);return null===t||null===n?t===n:this.isTwoValueEquals(t,n)},t.prototype.tryGoNextPageAutomatic=function(e){if(this.goNextPageAutomatic&&this.currentPage){var t=this.getQuestionByName(e);if(!t||t.visible&&t.supportGoNextPageAutomatic()){for(var n=this.getCurrentPageQuestions(),r=0;r<n.length;r++){var i=this.getValue(n[r].name);if(n[r].hasInput&&o.b.isValueEmpty(i))return}this.currentPage.hasErrors(!0,!1)||(this.isLastPage?this.completeLastPage():this.nextPage())}}},t.prototype.getComment=function(e){var t=this.data[e+this.commentPrefix];return null==t&&(t=""),t},t.prototype.setComment=function(e,t){var n=e+this.commentPrefix;""===t||null===t?delete this.valuesHash[n]:(this.setDataValueCore(this.valuesHash,n,t),this.tryGoNextPageAutomatic(e));var r=this.getQuestionByName(e);r&&this.onValueChanged.fire(this,{name:n,question:r,value:t})},t.prototype.clearValue=function(e){this.setValue(e,null),this.setComment(e,null)},t.prototype.questionVisibilityChanged=function(e,t){this.updateVisibleIndexes(),this.onVisibleChanged.fire(this,{question:e,name:e.name,visible:t}),this.checkPageVisibility(e,!t)},t.prototype.pageVisibilityChanged=function(e,t){this.updateVisibleIndexes(),this.onPageVisibleChanged.fire(this,{page:e,visible:t})},t.prototype.questionAdded=function(e,t,n,r){this.updateVisibleIndexes(),this.addQuestionToProcessedTextValues(e),this.onQuestionAdded.fire(this,{question:e,name:e.name,index:t,parentPanel:n,rootPanel:r})},t.prototype.questionRemoved=function(e){this.updateVisibleIndexes(),this.onQuestionRemoved.fire(this,{question:e,name:e.name})},t.prototype.panelAdded=function(e,t,n,r){this.updateVisibleIndexes(),this.onPanelAdded.fire(this,{panel:e,name:e.name,index:t,parentPanel:n,rootPanel:r})},t.prototype.panelRemoved=function(e){this.updateVisibleIndexes(),this.onPanelRemoved.fire(this,{panel:e,name:e.name})},t.prototype.validateQuestion=function(e){if(this.onValidateQuestion.isEmpty)return null;var t={name:e,value:this.getValue(e),error:null};return this.onValidateQuestion.fire(this,t),t.error?new h.c(t.error):null},t.prototype.processHtml=function(e){var t={html:e};return this.onProcessHtml.fire(this,t),this.processText(t.html,!0)},t.prototype.processText=function(e,t){return this.textPreProcessor.process(e,t)},t.prototype.processTextEx=function(e){var t={text:this.textPreProcessor.process(e),hasAllValuesOnLastRun:!0};return t.hasAllValuesOnLastRun=this.textPreProcessor.hasAllValuesOnLastRun,t},t.prototype.geSurveyData=function(){return this},t.prototype.getSurvey=function(){return this},t.prototype.getTextProcessor=function(){return this},t.prototype.getObjects=function(e,t){var n=[];return Array.prototype.push.apply(n,this.getPagesByNames(e)),Array.prototype.push.apply(n,this.getQuestionsByNames(t)),n},t.prototype.setTriggerValue=function(e,t,n){e&&(n?this.setVariable(e,t):this.setValue(e,t))},t}(o.b);i.a.metaData.addClass("survey",[{name:"locale",choices:function(){return c.a.getLocales()}},{name:"title",serializationProperty:"locTitle"},{name:"focusFirstQuestionAutomatic:boolean",default:!0},{name:"completedHtml:html",serializationProperty:"locCompletedHtml"},{name:"completedBeforeHtml:html",serializationProperty:"locCompletedBeforeHtml"},{name:"loadingHtml:html",serializationProperty:"locLoadingHtml"},{name:"pages",className:"page",visible:!1},{name:"questions",alternativeName:"elements",baseClassName:"question",visible:!1,onGetValue:function(e){return null},onSetValue:function(e,t,n){var r=e.addNewPage("");n.toObject({questions:t},r)}},{name:"triggers:triggers",baseClassName:"surveytrigger",classNamePart:"trigger"},{name:"surveyId",visible:!1},{name:"surveyPostId",visible:!1},{name:"surveyShowDataSaving",visible:!1},"cookieName","sendResultOnPageNext:boolean",{name:"showNavigationButtons:boolean",default:!0},{name:"showTitle:boolean",default:!0},{name:"showPageTitles:boolean",default:!0},{name:"showCompletedPage:boolean",default:!0},"showPageNumbers:boolean",{name:"showQuestionNumbers",default:"on",choices:["on","onPage","off"]},{name:"questionTitleLocation",default:"top",choices:["top","bottom"]},{name:"questionErrorLocation",default:"top",choices:["top","bottom"]},{name:"showProgressBar",default:"off",choices:["off","top","bottom"]},{name:"mode",default:"edit",choices:["edit","display"]},{name:"storeOthersAsComment:boolean",default:!0},"goNextPageAutomatic:boolean","clearInvisibleValues:boolean",{name:"pagePrevText",serializationProperty:"locPagePrevText"},{name:"pageNextText",serializationProperty:"locPageNextText"},{name:"completeText",serializationProperty:"locCompleteText"},{name:"requiredText",default:"*"},"questionStartIndex",{name:"questionTitleTemplate",serializationProperty:"locQuestionTitleTemplate"}])},function(e,t,n){"use strict";var r=n(0),i=n(5),o=n(10),a=n(1),s=n(3);n.d(t,"h",function(){return u}),n.d(t,"f",function(){return l}),n.d(t,"a",function(){return c}),n.d(t,"d",function(){return h}),n.d(t,"g",function(){return p}),n.d(t,"b",function(){return d}),n.d(t,"e",function(){return f}),n.d(t,"c",function(){return m});var u=function(){function e(e,t){void 0===t&&(t=null),this.value=e,this.error=t}return e}(),l=function(e){function t(){var t=e.call(this)||this;return t.text="",t}return r.b(t,e),t.prototype.getErrorText=function(e){return this.text?this.text:this.getDefaultErrorText(e)},t.prototype.getDefaultErrorText=function(e){return""},t.prototype.validate=function(e,t){return void 0===t&&(t=null),null},t}(i.b),c=function(){function e(){}return e.prototype.run=function(e){for(var t=0;t<e.validators.length;t++){var n=e.validators[t].validate(e.value,e.getValidatorTitle());if(null!=n){if(n.error)return n.error;n.value&&(e.value=n.value)}}return null},e}(),h=function(e){function t(t,n){void 0===t&&(t=null),void 0===n&&(n=null);var r=e.call(this)||this;return r.minValue=t,r.maxValue=n,r}return r.b(t,e),t.prototype.getType=function(){return"numericvalidator"},t.prototype.validate=function(e,t){if(void 0===t&&(t=null),!this.isNumber(e))return new u(null,new o.b);var n=new u(parseFloat(e));return null!==this.minValue&&this.minValue>n.value?(n.error=new o.c(this.getErrorText(t)),n):null!==this.maxValue&&this.maxValue<n.value?(n.error=new o.c(this.getErrorText(t)),n):"number"==typeof e?null:n},t.prototype.getDefaultErrorText=function(e){var t=e||a.a.getString("value");return null!==this.minValue&&null!==this.maxValue?a.a.getString("numericMinMax").format(t,this.minValue,this.maxValue):null!==this.minValue?a.a.getString("numericMin").format(t,this.minValue):a.a.getString("numericMax").format(t,this.maxValue)},t.prototype.isNumber=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},t}(l),p=function(e){function t(t,n){void 0===t&&(t=0),void 0===n&&(n=0);var r=e.call(this)||this;return r.minLength=t,r.maxLength=n,r}return r.b(t,e),t.prototype.getType=function(){return"textvalidator"},t.prototype.validate=function(e,t){return void 0===t&&(t=null),this.minLength>0&&e.length<this.minLength?new u(null,new o.c(this.getErrorText(t))):this.maxLength>0&&e.length>this.maxLength?new u(null,new o.c(this.getErrorText(t))):null},t.prototype.getDefaultErrorText=function(e){return this.minLength>0&&this.maxLength>0?a.a.getString("textMinMaxLength").format(this.minLength,this.maxLength):this.minLength>0?a.a.getString("textMinLength").format(this.minLength):a.a.getString("textMaxLength").format(this.maxLength)},t}(l),d=function(e){function t(t,n){void 0===t&&(t=null),void 0===n&&(n=null);var r=e.call(this)||this;return r.minCount=t,r.maxCount=n,r}return r.b(t,e),t.prototype.getType=function(){return"answercountvalidator"},t.prototype.validate=function(e,t){if(void 0===t&&(t=null),null==e||e.constructor!=Array)return null;var n=e.length;return this.minCount&&n<this.minCount?new u(null,new o.c(this.getErrorText(a.a.getString("minSelectError").format(this.minCount)))):this.maxCount&&n>this.maxCount?new u(null,new o.c(this.getErrorText(a.a.getString("maxSelectError").format(this.maxCount)))):null},t.prototype.getDefaultErrorText=function(e){return e},t}(l),f=function(e){function t(t){void 0===t&&(t=null);var n=e.call(this)||this;return n.regex=t,n}return r.b(t,e),t.prototype.getType=function(){return"regexvalidator"},t.prototype.validate=function(e,t){return void 0===t&&(t=null),this.regex&&e?new RegExp(this.regex).test(e)?null:new u(e,new o.c(this.getErrorText(t))):null},t}(l),m=function(e){function t(){var t=e.call(this)||this;return t.re=/^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,t}return r.b(t,e),t.prototype.getType=function(){return"emailvalidator"},t.prototype.validate=function(e,t){return void 0===t&&(t=null),e?this.re.test(e)?null:new u(e,new o.c(this.getErrorText(t))):null},t.prototype.getDefaultErrorText=function(e){return a.a.getString("invalidEmail")},t}(l);s.a.metaData.addClass("surveyvalidator",["text"]),s.a.metaData.addClass("numericvalidator",["minValue:number","maxValue:number"],function(){return new h},"surveyvalidator"),s.a.metaData.addClass("textvalidator",["minLength:number","maxLength:number"],function(){return new p},"surveyvalidator"),s.a.metaData.addClass("answercountvalidator",["minCount:number","maxCount:number"],function(){return new d},"surveyvalidator"),s.a.metaData.addClass("regexvalidator",["regex"],function(){return new f},"surveyvalidator"),s.a.metaData.addClass("emailvalidator",[],function(){return new m},"surveyvalidator")},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(19)),a=n(4);n.d(t,"a",function(){return s});var s=function(e){function t(t){var n=e.call(this,t)||this;return n.handleOnExpanded=n.handleOnExpanded.bind(n),n}return r.b(t,e),t.prototype.handleOnExpanded=function(e){this.state.expanded=!this.state.expanded,this.setState(this.state)},t.prototype.render=function(){if(this.state.hidden)return null;var e=this.renderHeader(),t=this.state.expanded?this.renderBody():null,n={position:"fixed",bottom:"3px",right:"10px"};return i.createElement("div",{className:this.css.window.root,style:n},e,t)},t.prototype.renderHeader=function(){var e={width:"100%"},t={paddingRight:"10px"},n=this.state.expanded?this.css.window.header.buttonCollapsed:this.css.window.header.buttonExpanded;n="glyphicon pull-right "+n;var r=a.a.renderLocString(this.survey.locTitle);return i.createElement("div",{className:this.css.window.header.root},i.createElement("a",{href:"#",onClick:this.handleOnExpanded,style:e},i.createElement("span",{className:this.css.window.header.title,style:t},r),i.createElement("span",{className:n,"aria-hidden":"true"})))},t.prototype.renderBody=function(){return i.createElement("div",{className:this.css.window.body},this.renderSurvey())},t.prototype.updateSurvey=function(t){e.prototype.updateSurvey.call(this,t);var n=!!t.expanded&&t.expanded;this.state={expanded:n,hidden:!1};var r=this;this.survey.onComplete.add(function(e){r.state.hidden=!0,r.setState(r.state)})},t}(o.a)},function(e,t,n){"use strict";var r=n(15);n.d(t,"a",function(){return i});var i=function(){function e(){}return e.prototype.parse=function(e,t){return this.text=e,this.root=t,this.root.clear(),this.at=0,this.length=this.text.length,this.parseText()},e.prototype.toString=function(e){return this.root=e,this.nodeToString(e)},e.prototype.toStringCore=function(e){return e?e.children?this.nodeToString(e):e.left?this.conditionToString(e):"":""},e.prototype.nodeToString=function(e){if(e.isEmpty)return"";for(var t="",n=0;n<e.children.length;n++){var r=this.toStringCore(e.children[n]);r&&(t&&(t+=" "+e.connective+" "),t+=r)}return e!=this.root&&e.children.length>1&&(t="("+t+")"),t},e.prototype.conditionToString=function(e){if(!e.right||!e.operator)return"";var t=e.left.operandToString(),n=t+" "+this.operationToString(e.operator);return this.isNoRightOperation(e.operator)?n:n+" "+e.right.operandToString()},e.prototype.operationToString=function(e){return"equal"==e?"=":"notequal"==e?"!=":"greater"==e?">":"less"==e?"<":"greaterorequal"==e?">=":"lessorequal"==e?"<=":e},e.prototype.parseText=function(){return this.node=this.root,this.expressionNodes=[],this.expressionNodes.push(this.node),this.readConditions()&&this.at>=this.length},e.prototype.readConditions=function(){var e=this.readCondition();if(!e)return e;var t=this.readConnective();return!t||(this.addConnective(t),this.readConditions())},e.prototype.readCondition=function(){var e=this.readExpression();if(e<0)return!1;if(1==e)return!0;var t=this.readString();if(!t)return!1;var n=this.readParameters(),i=this.readOperator();if(!i)return!1;var o=new r.b;if(o.left=this.createOperand(t,n),o.operator=i,!this.isNoRightOperation(i)){var a=this.readString();if(!a)return!1;n=this.readParameters(),o.right=this.createOperand(a,n)}return this.addCondition(o),!0},e.prototype.readExpression=function(){if(this.skip(),this.at>=this.length||"("!=this.ch)return 0;this.at++,this.pushExpression();var e=this.readConditions();return e?(this.skip(),e=")"==this.ch,this.at++,this.popExpression(),1):-1},Object.defineProperty(e.prototype,"ch",{get:function(){return this.text.charAt(this.at)},enumerable:!0,configurable:!0}),e.prototype.skip=function(){for(;this.at<this.length&&this.isSpace(this.ch);)this.at++},e.prototype.isSpace=function(e){return" "==e||"\n"==e||"\t"==e||"\r"==e},e.prototype.isQuotes=function(e){return"'"==e||'"'==e},e.prototype.isComma=function(e){return","==e},e.prototype.isOperatorChar=function(e){return">"==e||"<"==e||"="==e||"!"==e},e.prototype.isOpenBracket=function(e){return"("==e},e.prototype.isCloseBracket=function(e){return")"==e},e.prototype.isBrackets=function(e){return this.isOpenBracket(e)||this.isCloseBracket(e)},e.prototype.readString=function(){if(this.skip(),this.at>=this.length)return null;var e=this.at,t=this.isQuotes(this.ch);t&&this.at++;for(var n=this.isOperatorChar(this.ch);this.at<this.length&&(t||!this.isSpace(this.ch));){if(this.isQuotes(this.ch)){t&&this.at++;break}if(!t){if(n!=this.isOperatorChar(this.ch))break;if(this.isBrackets(this.ch)||this.isComma(this.ch))break}this.at++}if(this.at<=e)return null;var r=this.text.substr(e,this.at-e);if(r&&r.length>1&&this.isQuotes(r[0])){var i=r.length-1;this.isQuotes(r[r.length-1])&&i--,r=r.substr(1,i)}return r},e.prototype.createOperand=function(e,t){if(!t)return new r.c(e);var n=new r.d(e);return n.parameters=t,n},e.prototype.readParameters=function(){if(!this.isOpenBracket(this.ch))return null;for(var e=[];this.at<this.length&&!this.isCloseBracket(this.ch);){this.at++;var t=this.readString();if(t){var n=this.readParameters();e.push(this.createOperand(t,n))}}return this.at++,e},e.prototype.isNoRightOperation=function(e){return"empty"==e||"notempty"==e},e.prototype.readOperator=function(){var e=this.readString();return e?(e=e.toLowerCase(),">"==e&&(e="greater"),"<"==e&&(e="less"),">="!=e&&"=>"!=e||(e="greaterorequal"),"<="!=e&&"=<"!=e||(e="lessorequal"),"="!=e&&"=="!=e||(e="equal"),"<>"!=e&&"!="!=e||(e="notequal"),"contain"==e&&(e="contains"),"notcontain"==e&&(e="notcontains"),e):null},e.prototype.readConnective=function(){var e=this.readString();return e?(e=e.toLowerCase(),"&"!=e&&"&&"!=e||(e="and"),"|"!=e&&"||"!=e||(e="or"),"and"!=e&&"or"!=e&&(e=null),e):null},e.prototype.pushExpression=function(){var e=new r.e;this.expressionNodes.push(e),this.node=e},e.prototype.popExpression=function(){var e=this.expressionNodes.pop();this.node=this.expressionNodes[this.expressionNodes.length-1],this.node.children.push(e)},e.prototype.addCondition=function(e){this.node.children.push(e)},e.prototype.addConnective=function(e){if(this.node.children.length<2)this.node.connective=e;else if(this.node.connective!=e){var t=this.node.connective,n=this.node.children;this.node.clear(),this.node.connective=e;var i=new r.e;i.connective=t,i.children=n,this.node.children.push(i);var o=new r.e;this.node.children.push(o),this.node=o}},e}()},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(){}return e.prototype.loadSurvey=function(t,n){var r=new XMLHttpRequest;r.open("GET",e.serviceUrl+"/getSurvey?surveyId="+t),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.onload=function(){var e=JSON.parse(r.response);n(200==r.status,e,r.response)},r.send()},e.prototype.getSurveyJsonAndIsCompleted=function(t,n,r){var i=new XMLHttpRequest;i.open("GET",e.serviceUrl+"/getSurveyAndIsCompleted?surveyId="+t+"&clientId="+n),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.onload=function(){var e=JSON.parse(i.response),t=e?e.survey:null,n=e?e.isCompleted:null;r(200==i.status,t,n,i.response)},i.send()},e.prototype.sendResult=function(t,n,r,i,o){void 0===i&&(i=null),void 0===o&&(o=!1);var a=new XMLHttpRequest;a.open("POST",e.serviceUrl+"/post/"),a.setRequestHeader("Content-Type","application/json; charset=utf-8");var s={postId:t,surveyResult:JSON.stringify(n)};i&&(s.clientId=i),o&&(s.isPartialCompleted=!0);var u=JSON.stringify(s);a.onload=a.onerror=function(){r&&r(200==a.status,a.response)},a.send(u)},e.prototype.sendFile=function(t,n,r){var i=new XMLHttpRequest;i.onload=i.onerror=function(){r&&r(200==i.status,JSON.parse(i.response))},i.open("POST",e.serviceUrl+"/upload/",!0);var o=new FormData;o.append("file",n),o.append("postId",t),i.send(o)},e.prototype.getResult=function(t,n,r){var i=new XMLHttpRequest,o="resultId="+t+"&name="+n;i.open("GET",e.serviceUrl+"/getResult?"+o),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded");i.onload=function(){var e=null,t=null;if(200==i.status){e=JSON.parse(i.response),t=[];for(var n in e.QuestionResult){var o={name:n,value:e.QuestionResult[n]};t.push(o)}}r(200==i.status,e,t,i.response)},i.send()},e.prototype.isCompleted=function(t,n,r){var i=new XMLHttpRequest,o="resultId="+t+"&clientId="+n;i.open("GET",e.serviceUrl+"/isCompleted?"+o),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded");i.onload=function(){var e=null;200==i.status&&(e=JSON.parse(i.response)),r(200==i.status,e,i.response)},i.send()},e}();r.serviceUrl="https://dxsurveyapi.azurewebsites.net/api/Survey"},function(e,t,n){"use strict";function r(e){for(var t=0,n=0;n<e.length;n++)t+=e[n];return t}function i(e){if(e.length<1)return-1;var t=new Date(e[0]),n=Date.now()-t.getTime(),r=new Date(n);return Math.abs(r.getUTCFullYear()-1970)}n.d(t,"a",function(){return o});var o=function(){function e(){this.functionHash={}}return e.prototype.register=function(e,t){this.functionHash[e]=t},e.prototype.clear=function(){this.functionHash={}},e.prototype.getAll=function(){var e=[];for(var t in this.functionHash)e.push(t);return e.sort()},e.prototype.run=function(e,t){var n=this.functionHash[e];return n?n(t):null},e}();o.Instance=new o,o.Instance.register("sum",r),o.Instance.register("age",i)},function(e,t,n){"use strict";var r=n(0),i=n(3),o=n(5),a=n(21);n.d(t,"a",function(){return s});var s=function(e){function t(t){void 0===t&&(t="");var n=e.call(this,t)||this;return n.name=t,n.numValue=-1,n.navigationButtonsVisibilityValue="inherit",n.visibleIndex=-1,n}return r.b(t,e),t.prototype.getType=function(){return"page"},Object.defineProperty(t.prototype,"num",{get:function(){return this.numValue},set:function(e){this.numValue!=e&&(this.numValue=e,this.onNumChanged(e))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"navigationButtonsVisibility",{get:function(){return this.navigationButtonsVisibilityValue},set:function(e){this.navigationButtonsVisibilityValue=e.toLowerCase()},enumerable:!0,configurable:!0}),t.prototype.getRendredTitle=function(t){return t=e.prototype.getRendredTitle.call(this,t),this.num>0&&(t=this.num+". "+t),t},t.prototype.focusFirstQuestion=function(){for(var e=0;e<this.questions.length;e++){var t=this.questions[e];if(t.visible&&t.hasInput){this.questions[e].focus();break}}},t.prototype.focusFirstErrorQuestion=function(){for(var e=0;e<this.questions.length;e++)if(this.questions[e].visible&&0!=this.questions[e].currentErrorCount){this.questions[e].focus(!0);break}},t.prototype.scrollToTop=function(){o.a.ScrollElementToTop(o.e)},t.prototype.onNumChanged=function(e){},t.prototype.onVisibleChanged=function(){e.prototype.onVisibleChanged.call(this),null!=this.survey&&this.survey.pageVisibilityChanged(this,this.visible)},t}(a.a);i.a.metaData.addClass("page",[{name:"navigationButtonsVisibility",default:"inherit",choices:["inherit","show","hide"]}],function(){return new s},"panel")},function(e,t,n){"use strict";var r=n(5);n.d(t,"b",function(){return i}),n.d(t,"a",function(){return o});var i=function(){function e(e,t){this.name=e,this.widgetJson=t,this.htmlTemplate=t.htmlTemplate?t.htmlTemplate:""}return e.prototype.afterRender=function(e,t){this.widgetJson.afterRender&&this.widgetJson.afterRender(e,t)},e.prototype.willUnmount=function(e,t){this.widgetJson.willUnmount&&this.widgetJson.willUnmount(e,t)},e.prototype.isFit=function(e){return!!this.widgetJson.isFit&&this.widgetJson.isFit(e)},e}(),o=function(){function e(){this.widgetsValues=[],this.onCustomWidgetAdded=new r.c}return Object.defineProperty(e.prototype,"widgets",{get:function(){return this.widgetsValues},enumerable:!0,configurable:!0}),e.prototype.addCustomWidget=function(e){var t=e.name;t||(t="widget_"+this.widgets.length+1);var n=new i(t,e);this.widgetsValues.push(n),this.onCustomWidgetAdded.fire(n,null)},e.prototype.clear=function(){this.widgetsValues=[]},e.prototype.getCustomWidget=function(e){for(var t=0;t<this.widgetsValues.length;t++)if(this.widgetsValues[t].isFit(e))return this.widgetsValues[t];return null},e}();o.Instance=new o},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(25));n.d(t,"a",function(){return a});var a=function(e){function t(t){var n=e.call(this,t)||this;return n.handlePrevClick=n.handlePrevClick.bind(n),n.handleNextClick=n.handleNextClick.bind(n),n.handleCompleteClick=n.handleCompleteClick.bind(n),n}return r.b(t,e),t.prototype.handlePrevClick=function(e){this.survey.prevPage()},t.prototype.handleNextClick=function(e){this.survey.nextPage()},t.prototype.handleCompleteClick=function(e){this.survey.completeLastPage()},t.prototype.render=function(){if(!this.survey||!this.survey.isNavigationButtonsShowing)return null;var e=this.survey.isFirstPage?null:this.renderButton(this.handlePrevClick,this.survey.pagePrevText,this.css.navigation.prev),t=this.survey.isLastPage?null:this.renderButton(this.handleNextClick,this.survey.pageNextText,this.css.navigation.next),n=this.survey.isLastPage&&this.survey.isEditMode?this.renderButton(this.handleCompleteClick,this.survey.completeText,this.css.navigation.complete):null;return i.createElement("div",{className:this.css.footer},e,t,n)},t.prototype.renderButton=function(e,t,n){var r={marginRight:"5px"},o=this.css.navigationButton+(n?" "+n:"");return i.createElement("input",{className:o,style:r,type:"button",onClick:e,value:t})},t}(o.a)},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(25));n.d(t,"a",function(){return a});var a=function(e){function t(t){var n=e.call(this,t)||this;return n.isTop=t.isTop,n}return r.b(t,e),t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.isTop=t.isTop},Object.defineProperty(t.prototype,"progress",{get:function(){return this.survey.getProgress()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"progressText",{get:function(){return this.survey.progressText},enumerable:!0,configurable:!0}),t.prototype.render=function(){var e=this.isTop?{width:"60%"}:{width:"60%",marginTop:"10px"},t={width:"auto",minWidth:this.progress+"%",paddingLeft:"2px",paddingRight:"2px"};return i.createElement("div",{className:this.css.progress,style:e},i.createElement("div",{style:t,className:this.css.progressBar,role:"progressbar","aria-valuemin":"0","aria-valuemax":"100"},i.createElement("span",null,this.progressText)))},t}(o.a)},function(e,t,n){"use strict";var r=n(47);n.d(t,"O",function(){return r.a}),n.d(t,"P",function(){return r.b}),n.d(t,"Q",function(){return r.c}),n.d(t,"R",function(){return r.d}),n.d(t,"S",function(){return r.e}),n.d(t,"T",function(){return r.f}),n.d(t,"U",function(){return r.g}),n.d(t,"V",function(){return r.h}),n.d(t,"W",function(){return r.i}),n.d(t,"X",function(){return r.j}),n.d(t,"Y",function(){return r.k}),n.d(t,"Z",function(){return r.l}),n.d(t,"_0",function(){return r.m}),n.d(t,"_1",function(){return r.n}),n.d(t,"_2",function(){return r.o}),n.d(t,"_3",function(){return r.p}),n.d(t,"_4",function(){return r.q}),n.d(t,"_5",function(){return r.r}),n.d(t,"_6",function(){return r.s}),n.d(t,"_7",function(){return r.t}),n.d(t,"_8",function(){return r.u}),n.d(t,"_9",function(){return r.v}),n.d(t,"_10",function(){return r.w}),n.d(t,"_11",function(){return r.x}),n.d(t,"_12",function(){return r.y}),n.d(t,"_13",function(){return r.z}),n.d(t,"_14",function(){return r.A}),n.d(t,"_15",function(){return r.B}),n.d(t,"_16",function(){return r.C}),n.d(t,"_17",function(){return r.D}),n.d(t,"_18",function(){return r.E}),n.d(t,"_19",function(){return r.F}),n.d(t,"_20",function(){return r.G}),n.d(t,"_21",function(){return r.H}),n.d(t,"_22",function(){return r.I}),n.d(t,"_23",function(){return r.J}),n.d(t,"_24",function(){return r.K}),n.d(t,"_25",function(){return r.L}),n.d(t,"_26",function(){return r.M}),n.d(t,"_27",function(){return r.N}),n.d(t,"_28",function(){return r.O}),n.d(t,"_29",function(){return r.P}),n.d(t,"_30",function(){return r.Q}),n.d(t,"_31",function(){return r.R}),n.d(t,"_32",function(){return r.S}),n.d(t,"_33",function(){return r.T}),n.d(t,"_34",function(){return r.U}),n.d(t,"_35",function(){return r.V}),n.d(t,"_36",function(){return r.W}),n.d(t,"_37",function(){return r.X}),n.d(t,"_38",function(){return r.Y}),n.d(t,"_39",function(){return r.Z}),n.d(t,"_40",function(){return r._0}),n.d(t,"_41",function(){return r._1}),n.d(t,"_42",function(){return r._2}),n.d(t,"_43",function(){return r._3}),n.d(t,"_44",function(){return r._4}),n.d(t,"_45",function(){return r._5}),n.d(t,"_46",function(){return r._6}),n.d(t,"_47",function(){return r._7}),n.d(t,"_48",function(){return r._8}),n.d(t,"_49",function(){return r._9}),n.d(t,"_50",function(){return r._10}),n.d(t,"_51",function(){return r._11}),n.d(t,"_52",function(){return r._12}),n.d(t,"_53",function(){return r._13}),n.d(t,"_54",function(){return r._14}),n.d(t,"_55",function(){return r._15}),n.d(t,"_56",function(){return r._16}),n.d(t,"_57",function(){return r._17}),n.d(t,"_58",function(){return r._18}),n.d(t,"_59",function(){return r._19}),n.d(t,"_60",function(){return r._20}),n.d(t,"_61",function(){return r._21}),n.d(t,"_62",function(){return r._22}),n.d(t,"_63",function(){return r._23}),n.d(t,"_64",function(){return r._24}),n.d(t,"_65",function(){return r._25}),n.d(t,"_66",function(){return r._26}),n.d(t,"_67",function(){return r._27});var i=(n(46),n(0));n.d(t,"a",function(){return i.a}),n.d(t,"b",function(){return i.b}),n.d(t,"c",function(){return i.c});var o=n(11);n.d(t,"d",function(){return o.a});var a=n(44);n.d(t,"e",function(){return a.a});var s=n(45);n.d(t,"f",function(){return s.a});var u=n(19);n.d(t,"g",function(){return u.a});var l=n(27);n.d(t,"h",function(){return l.a}),n.d(t,"i",function(){return l.a});var c=n(25);n.d(t,"j",function(){return c.a});var h=n(36);n.d(t,"k",function(){return h.a});var p=n(26);n.d(t,"l",function(){return p.a}),n.d(t,"m",function(){return p.b});var d=n(18);n.d(t,"n",function(){return d.a}),n.d(t,"o",function(){return d.b});var f=n(4);n.d(t,"p",function(){return f.a}),n.d(t,"q",function(){return f.b});var m=n(13);n.d(t,"r",function(){return m.a}),n.d(t,"s",function(){return m.b});var g=n(83);n.d(t,"t",function(){return g.a}),n.d(t,"u",function(){return g.b});var y=n(84);n.d(t,"v",function(){return y.a});var v=n(88);n.d(t,"w",function(){return v.a}),n.d(t,"x",function(){return v.b});var b=n(87);n.d(t,"y",function(){return b.a}),n.d(t,"z",function(){return b.b});var C=n(86);n.d(t,"A",function(){return C.a});var x=n(85);n.d(t,"B",function(){return x.a});var P=n(90);n.d(t,"C",function(){return P.a}),n.d(t,"D",function(){return P.b});var w=n(92);n.d(t,"E",function(){return w.a});var V=n(94);n.d(t,"F",function(){return V.a});var T=n(82);n.d(t,"G",function(){return T.a});var O=n(89);n.d(t,"H",function(){return O.a}),n.d(t,"I",function(){return O.b});var S=n(91);n.d(t,"J",function(){return S.a});var R=n(37);n.d(t,"K",function(){return R.a});var E=n(93);n.d(t,"L",function(){return E.a});var q=n(30);n.d(t,"M",function(){return q.a});var k=n(8);n.d(t,"N",function(){return k.a})},function(t,n){t.exports=e},function(e,t){},function(e,t,n){!function(e,n){n(t)}(0,function(e){function t(e,t,n){this.nodeName=e,this.attributes=t,this.children=n,this.key=t&&t.key}function n(e,n){var r,i,o,a,s;for(s=arguments.length;s-- >2;)_.push(arguments[s]);for(n&&n.children&&(_.length||_.push(n.children),delete n.children);_.length;)if((o=_.pop())instanceof Array)for(s=o.length;s--;)_.push(o[s]);else null!=o&&!0!==o&&!1!==o&&("number"==typeof o&&(o=String(o)),a="string"==typeof o,a&&i?r[r.length-1]+=o:((r||(r=[])).push(o),i=a));var u=new t(e,n||void 0,r||z);return A.vnode&&A.vnode(u),u}function r(e,t){if(t)for(var n in t)e[n]=t[n];return e}function i(e){return r({},e)}function o(e,t){for(var n=t.split("."),r=0;r<n.length&&e;r++)e=e[n[r]];return e}function a(e){return"function"==typeof e}function s(e){return"string"==typeof e}function u(e){var t="";for(var n in e)e[n]&&(t&&(t+=" "),t+=n);return t}function l(e,t){return n(e.nodeName,r(i(e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}function c(e,t,n){var r=t.split(".");return function(t){for(var i=t&&t.target||this,a={},u=a,l=s(n)?o(t,n):i.nodeName?i.type.match(/^che|rad/)?i.checked:i.value:t,c=0;c<r.length-1;c++)u=u[r[c]]||(u[r[c]]=!c&&e.state[r[c]]||{});u[r[c]]=l,e.setState(a)}}function h(e){!e._dirty&&(e._dirty=!0)&&1==K.push(e)&&(A.debounceRendering||F)(p)}function p(){var e,t=K;for(K=[];e=t.pop();)e._dirty&&j(e)}function d(e){var t=e&&e.nodeName;return t&&a(t)&&!(t.prototype&&t.prototype.render)}function f(e,t){return e.nodeName(y(e),t||W)}function m(e,t){return s(t)?e instanceof Text:s(t.nodeName)?!e._componentConstructor&&g(e,t.nodeName):a(t.nodeName)?!e._componentConstructor||e._componentConstructor===t.nodeName||d(t):void 0}function g(e,t){return e.normalizedNodeName===t||Q(e.nodeName)===Q(t)}function y(e){var t=i(e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(n)for(var r in n)void 0===t[r]&&(t[r]=n[r]);return t}function v(e){var t=e.parentNode;t&&t.removeChild(e)}function b(e,t,n,r,i){if("className"===t&&(t="class"),"class"===t&&r&&"object"==typeof r&&(r=u(r)),"key"===t);else if("class"!==t||i)if("style"===t){if((!r||s(r)||s(n))&&(e.style.cssText=r||""),r&&"object"==typeof r){if(!s(n))for(var o in n)o in r||(e.style[o]="");for(var o in r)e.style[o]="number"!=typeof r[o]||J[o]?r[o]:r[o]+"px"}}else if("dangerouslySetInnerHTML"===t)r&&(e.innerHTML=r.__html||"");else if("o"==t[0]&&"n"==t[1]){var l=e._listeners||(e._listeners={});t=Q(t.substring(2)),r?l[t]||e.addEventListener(t,x,!!G[t]):l[t]&&e.removeEventListener(t,x,!!G[t]),l[t]=r}else if("list"!==t&&"type"!==t&&!i&&t in e)C(e,t,null==r?"":r),null!=r&&!1!==r||e.removeAttribute(t);else{var c=i&&t.match(/^xlink\:?(.+)/);null==r||!1===r?c?e.removeAttributeNS("http://www.w3.org/1999/xlink",Q(c[1])):e.removeAttribute(t):"object"==typeof r||a(r)||(c?e.setAttributeNS("http://www.w3.org/1999/xlink",Q(c[1]),r):e.setAttribute(t,r))}else e.className=r||""}function C(e,t,n){try{e[t]=n}catch(e){}}function x(e){return this._listeners[e.type](A.event&&A.event(e)||e)}function P(e){if(v(e),e instanceof Element){e._component=e._componentConstructor=null;var t=e.normalizedNodeName||Q(e.nodeName);(Z[t]||(Z[t]=[])).push(e)}}function w(e,t){var n=Q(e),r=Z[n]&&Z[n].pop()||(t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e));return r.normalizedNodeName=n,r}function V(){for(var e;e=X.pop();)A.afterMount&&A.afterMount(e),e.componentDidMount&&e.componentDidMount()}function T(e,t,n,r,i,o){$++||(Y=i&&void 0!==i.ownerSVGElement,ee=e&&!(U in e));var a=O(e,t,n,r);return i&&a.parentNode!==i&&i.appendChild(a),--$||(ee=!1,o||V()),a}function O(e,t,n,r){for(var i=t&&t.attributes&&t.attributes.ref;d(t);)t=f(t,n);if(null==t&&(t=""),s(t))return e&&e instanceof Text&&e.parentNode?e.nodeValue!=t&&(e.nodeValue=t):(e&&R(e),e=document.createTextNode(t)),e;if(a(t.nodeName))return I(e,t,n,r);var o=e,u=String(t.nodeName),l=Y,c=t.children;if(Y="svg"===u||"foreignObject"!==u&&Y,e){if(!g(e,u)){for(o=w(u,Y);e.firstChild;)o.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(o,e),R(e)}}else o=w(u,Y);var h=o.firstChild,p=o[U];if(!p){o[U]=p={};for(var m=o.attributes,y=m.length;y--;)p[m[y].name]=m[y].value}return!ee&&c&&1===c.length&&"string"==typeof c[0]&&h&&h instanceof Text&&!h.nextSibling?h.nodeValue!=c[0]&&(h.nodeValue=c[0]):(c&&c.length||h)&&S(o,c,n,r,!!p.dangerouslySetInnerHTML),E(o,t.attributes,p),i&&(p.ref=i)(o),Y=l,o}function S(e,t,n,r,i){var o,a,s,u,l=e.childNodes,c=[],h={},p=0,d=0,f=l.length,g=0,y=t&&t.length;if(f)for(var b=0;b<f;b++){var C=l[b],x=C[U],P=y?(a=C._component)?a.__key:x?x.key:null:null;null!=P?(p++,h[P]=C):(ee||i||x||C instanceof Text)&&(c[g++]=C)}if(y)for(var b=0;b<y;b++){s=t[b],u=null;var P=s.key;if(null!=P)p&&P in h&&(u=h[P],h[P]=void 0,p--);else if(!u&&d<g)for(o=d;o<g;o++)if((a=c[o])&&m(a,s)){u=a,c[o]=void 0,o===g-1&&g--,o===d&&d++;break}u=O(u,s,n,r),u&&u!==e&&(b>=f?e.appendChild(u):u!==l[b]&&(u===l[b+1]&&v(l[b]),e.insertBefore(u,l[b]||null)))}if(p)for(var b in h)h[b]&&R(h[b]);for(;d<=g;)(u=c[g--])&&R(u)}function R(e,t){var n=e._component;if(n)L(n,!t);else{e[U]&&e[U].ref&&e[U].ref(null),t||P(e);for(var r;r=e.lastChild;)R(r,t)}}function E(e,t,n){var r;for(r in n)t&&r in t||null==n[r]||b(e,r,n[r],n[r]=void 0,Y);if(t)for(r in t)"children"===r||"innerHTML"===r||r in n&&t[r]===("value"===r||"checked"===r?e[r]:n[r])||b(e,r,n[r],n[r]=t[r],Y)}function q(e){var t=e.constructor.name,n=te[t];n?n.push(e):te[t]=[e]}function k(e,t,n){var r=new e(t,n),i=te[e.name];if(M.call(r,t,n),i)for(var o=i.length;o--;)if(i[o].constructor===e){r.nextBase=i[o].nextBase,i.splice(o,1);break}return r}function N(e,t,n,r,i){e._disable||(e._disable=!0,(e.__ref=t.ref)&&delete t.ref,(e.__key=t.key)&&delete t.key,!e.base||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,r),r&&r!==e.context&&(e.prevContext||(e.prevContext=e.context),e.context=r),e.prevProps||(e.prevProps=e.props),e.props=t,e._disable=!1,0!==n&&(1!==n&&!1===A.syncComponentUpdates&&e.base?h(e):j(e,1,i)),e.__ref&&e.__ref(e))}function j(e,t,n,o){if(!e._disable){var s,u,l,c,h=e.props,p=e.state,m=e.context,g=e.prevProps||h,v=e.prevState||p,b=e.prevContext||m,C=e.base,x=e.nextBase,P=C||x,w=e._component;if(C&&(e.props=g,e.state=v,e.context=b,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(h,p,m)?s=!0:e.componentWillUpdate&&e.componentWillUpdate(h,p,m),e.props=h,e.state=p,e.context=m),e.prevProps=e.prevState=e.prevContext=e.nextBase=null,e._dirty=!1,!s){for(e.render&&(u=e.render(h,p,m)),e.getChildContext&&(m=r(i(m),e.getChildContext()));d(u);)u=f(u,m);var O,S,E=u&&u.nodeName;if(a(E)){var q=y(u);l=w,l&&l.constructor===E&&q.key==l.__key?N(l,q,1,m):(O=l,l=k(E,q,m),l.nextBase=l.nextBase||x,l._parentComponent=e,e._component=l,N(l,q,0,m),j(l,1,n,!0)),S=l.base}else c=P,O=w,O&&(c=e._component=null),(P||1===t)&&(c&&(c._component=null),S=T(c,u,m,n||!C,P&&P.parentNode,!0));if(P&&S!==P&&l!==w){var I=P.parentNode;I&&S!==I&&(I.replaceChild(S,P),O||(P._component=null,R(P)))}if(O&&L(O,S!==P),e.base=S,S&&!o){for(var M=e,D=e;D=D._parentComponent;)(M=D).base=S;S._component=M,S._componentConstructor=M.constructor}}!C||n?X.unshift(e):s||(e.componentDidUpdate&&e.componentDidUpdate(g,v,b),A.afterUpdate&&A.afterUpdate(e));var _,z=e._renderCallbacks;if(z)for(;_=z.pop();)_.call(e);$||o||V()}}function I(e,t,n,r){for(var i=e&&e._component,o=i,a=e,s=i&&e._componentConstructor===t.nodeName,u=s,l=y(t);i&&!u&&(i=i._parentComponent);)u=i.constructor===t.nodeName;return i&&u&&(!r||i._component)?(N(i,l,3,n,r),e=i.base):(o&&!s&&(L(o,!0),e=a=null),i=k(t.nodeName,l,n),e&&!i.nextBase&&(i.nextBase=e,a=null),N(i,l,1,n,r),e=i.base,a&&e!==a&&(a._component=null,R(a))),e}function L(e,t){A.beforeUnmount&&A.beforeUnmount(e);var n=e.base;e._disable=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var r=e._component;if(r)L(r,t);else if(n){n[U]&&n[U].ref&&n[U].ref(null),e.nextBase=n,t&&(v(n),q(e));for(var i;i=n.lastChild;)R(i,!t)}e.__ref&&e.__ref(null),e.componentDidUnmount&&e.componentDidUnmount()}function M(e,t){this._dirty=!0,this.context=t,this.props=e,this.state||(this.state={})}function D(e,t,n){return T(n,e,{},!1,t)}var A={},_=[],z=[],B={},Q=function(e){return B[e]||(B[e]=e.toLowerCase())},H="undefined"!=typeof Promise&&Promise.resolve(),F=H?function(e){H.then(e)}:setTimeout,W={},U="undefined"!=typeof Symbol?Symbol.for("preactattr"):"__preactattr_",J={boxFlex:1,boxFlexGroup:1,columnCount:1,fillOpacity:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,strokeOpacity:1,widows:1,zIndex:1,zoom:1},G={blur:1,error:1,focus:1,load:1,resize:1,scroll:1},K=[],Z={},X=[],$=0,Y=!1,ee=!1,te={};r(M.prototype,{linkState:function(e,t){var n=this._linkedStates||(this._linkedStates={});return n[e+t]||(n[e+t]=c(this,e,t))},setState:function(e,t){var n=this.state;this.prevState||(this.prevState=i(n)),r(n,a(e)?e(n,this.props):e),t&&(this._renderCallbacks=this._renderCallbacks||[]).push(t),h(this)},forceUpdate:function(){j(this,2)},render:function(){}}),e.h=n,e.cloneElement=l,e.Component=M,e.render=D,e.rerender=p,e.options=A})},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function o(e){if(h===clearTimeout)return clearTimeout(e);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(e);try{return h(e)}catch(t){try{return h.call(null,e)}catch(t){return h.call(this,e)}}}function a(){m&&d&&(m=!1,d.length?f=d.concat(f):g=-1,f.length&&s())}function s(){if(!m){var e=i(a);m=!0;for(var t=f.length;t;){for(d=f,f=[];++g<t;)d&&d[g].run();g=-1,t=f.length}d=null,m=!1,o(e)}}function u(e,t){this.fun=e,this.array=t}function l(){}var c,h,p=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(e){c=n}try{h="function"==typeof clearTimeout?clearTimeout:r}catch(e){h=r}}();var d,f=[],m=!1,g=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new u(e,t)),1!==f.length||m||i(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=l,p.addListener=l,p.once=l,p.off=l,p.removeListener=l,p.removeAllListeners=l,p.emit=l,p.prependListener=l,p.prependOnceListener=l,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t,n){var r,i,o;!function(n,a){i=[t,e],r=a,void 0!==(o="function"==typeof r?r.apply(t,i):r)&&(e.exports=o)}(0,function(e,t){"use strict";function n(e){var t=e&&(w&&e[w]||e[V]);if("function"==typeof t)return t}function r(e){function t(t,n,r,i,o,a){if(i=i||T,a=a||r,null==n[r]){var s=x[o];return t?new Error("Required "+s+" `"+a+"` was not specified in `"+i+"`."):null}return e(n,r,i,o,a)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function i(e){function t(t,n,r,i,o){var a=t[n];if(g(a)!==e){var s=x[i],u=y(a);return new Error("Invalid "+s+" `"+o+"` of type `"+u+"` supplied to `"+r+"`, expected `"+e+"`.")}return null}return r(t)}function o(){return r(P.thatReturns(null))}function a(e){function t(t,n,r,i,o){var a=t[n];if(!Array.isArray(a)){var s=x[i],u=g(a);return new Error("Invalid "+s+" `"+o+"` of type `"+u+"` supplied to `"+r+"`, expected an array.")}for(var l=0;l<a.length;l++){var c=e(a,l,r,i,o+"["+l+"]");if(c instanceof Error)return c}return null}return r(t)}function s(){function e(e,t,n,r,i){if(!C.isValidElement(e[t])){var o=x[r];return new Error("Invalid "+o+" `"+i+"` supplied to `"+n+"`, expected a single ReactElement.")}return null}return r(e)}function u(e){function t(t,n,r,i,o){if(!(t[n]instanceof e)){var a=x[i],s=e.name||T,u=v(t[n]);return new Error("Invalid "+a+" `"+o+"` of type `"+u+"` supplied to `"+r+"`, expected instance of `"+s+"`.")}return null}return r(t)}function l(e){function t(t,n,r,i,o){for(var a=t[n],s=0;s<e.length;s++)if(a===e[s])return null;var u=x[i],l=JSON.stringify(e);return new Error("Invalid "+u+" `"+o+"` of value `"+a+"` supplied to `"+r+"`, expected one of "+l+".")}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOf, expected an instance of array.")})}function c(e){function t(t,n,r,i,o){var a=t[n],s=g(a);if("object"!==s){var u=x[i];return new Error("Invalid "+u+" `"+o+"` of type `"+s+"` supplied to `"+r+"`, expected an object.")}for(var l in a)if(a.hasOwnProperty(l)){var c=e(a,l,r,i,o+"."+l);if(c instanceof Error)return c}return null}return r(t)}function h(e){function t(t,n,r,i,o){for(var a=0;a<e.length;a++){if(null==(0,e[a])(t,n,r,i,o))return null}var s=x[i];return new Error("Invalid "+s+" `"+o+"` supplied to `"+r+"`.")}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOfType, expected an instance of array.")})}function p(){function e(e,t,n,r,i){if(!f(e[t])){var o=x[r];return new Error("Invalid "+o+" `"+i+"` supplied to `"+n+"`, expected a ReactNode.")}return null}return r(e)}function d(e){function t(t,n,r,i,o){var a=t[n],s=g(a);if("object"!==s){var u=x[i];return new Error("Invalid "+u+" `"+o+"` of type `"+s+"` supplied to `"+r+"`, expected `object`.")}for(var l in e){var c=e[l];if(c){var h=c(a,l,r,i,o+"."+l);if(h)return h}}return null}return r(t)}function f(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(f);if(null===e||C.isValidElement(e))return!0;var t=n(e);if(!t)return!1;var r,i=t.call(e);if(t!==e.entries){for(;!(r=i.next()).done;)if(!f(r.value))return!1}else for(;!(r=i.next()).done;){var o=r.value;if(o&&!f(o[1]))return!1}return!0;default:return!1}}function m(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function g(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":m(t,e)?"symbol":t}function y(e){var t=g(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function v(e){return e.constructor&&e.constructor.name?e.constructor.name:T}var b="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,C={};C.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===b};var x={prop:"prop",context:"context",childContext:"child context"},P={thatReturns:function(e){return function(){return e}}},w="function"==typeof Symbol&&Symbol.iterator,V="@@iterator",T="<<anonymous>>",O={array:i("array"),bool:i("boolean"),func:i("function"),number:i("number"),object:i("object"),string:i("string"),symbol:i("symbol"),any:o(),arrayOf:a,element:s(),instanceOf:u,node:p(),objectOf:c,oneOf:l,oneOfType:h,shape:d};t.exports=O})},function(e,t,n){"use strict";var r=n(11);n.d(t,"a",function(){return i});var i={root:"",header:"panel-heading",body:"panel-body",footer:"panel-footer",navigationButton:"",navigation:{complete:"sv_complete_btn",prev:"sv_prev_btn",next:"sv_next_btn"},progress:"progress center-block",progressBar:"progress-bar",pageTitle:"",row:"",question:{mainRoot:"",title:"",description:"small",comment:"form-control",required:"",titleRequired:"",indent:20},panel:{title:"",container:""},error:{root:"alert alert-danger",icon:"glyphicon glyphicon-exclamation-sign",item:""},boolean:{root:"form-inline",item:"checkbox"},checkbox:{root:"form-inline",item:"checkbox",other:""},comment:"form-control",dropdown:{root:"",control:"form-control",other:""},matrix:{root:"table"},matrixdropdown:{root:"table"},matrixdynamic:{root:"table",button:"button"},paneldynamic:{root:"",button:"button"},multipletext:{root:"table",itemTitle:"",itemValue:"form-control"},radiogroup:{root:"form-inline",item:"radio",label:"",other:""},rating:{root:"btn-group",item:"btn btn-default",selected:"active"},text:"form-control",saveData:{root:"",saving:"alert alert-info",error:"alert alert-danger",success:"alert alert-success",saveAgainButton:""},window:{root:"modal-content",body:"modal-body",header:{root:"modal-header panel-title",title:"pull-left",button:"glyphicon pull-right",buttonExpanded:"glyphicon pull-right glyphicon-chevron-up",buttonCollapsed:"glyphicon pull-right glyphicon-chevron-down"}}};r.b.bootstrap=i},function(e,t,n){"use strict";var r=n(11);n.d(t,"a",function(){return i});var i={root:"",header:"panel-heading",body:"panel-body",footer:"panel-footer",navigationButton:"",navigation:{complete:"sv_complete_btn",prev:"sv_prev_btn",next:"sv_next_btn"},progress:"progress center-block",progressBar:"progress-bar",pageTitle:"",row:"",question:{mainRoot:"form-group",title:"",description:"small",comment:"form-control",required:"",titleRequired:"",indent:20},panel:{title:"",container:""},error:{root:"alert alert-danger",icon:"glyphicon glyphicon-exclamation-sign",item:""},boolean:{root:"form-inline",item:"checkbox"},checkbox:{root:"form-inline",item:"checkbox",other:""},comment:"form-control",dropdown:{root:"",control:"form-control",other:""},matrix:{root:"table",row:"form-group",label:"radio-inline",itemValue:"form-control"},matrixdropdown:{root:"table",itemValue:"form-group"},matrixdynamic:{root:"table",button:"button"},paneldynamic:{root:"",button:"button"},multipletext:{root:"table",itemTitle:"",row:"form-group",itemValue:"form-control"},radiogroup:{root:"form-inline",item:"radio-inline",label:"radio-inline",other:""},rating:{root:"btn-group",item:"btn btn-default",selected:"active"},text:"form-control",saveData:{root:"",saving:"alert alert-info",error:"alert alert-danger",success:"alert alert-success",saveAgainButton:""},window:{root:"modal-content",body:"modal-body",header:{root:"modal-header panel-title",title:"pull-left",button:"glyphicon pull-right",buttonExpanded:"glyphicon pull-right glyphicon-chevron-up",buttonCollapsed:"glyphicon pull-right glyphicon-chevron-down"}}};r.b.bootstrapmaterial=i},function(e,t,n){"use strict";n(48),n(49),n(50),n(51),n(52),n(53),n(54),n(55),n(56),n(57),n(58),n(59),n(60),n(61),n(62),n(63),n(65),n(66),n(67),n(64)},function(e,t,n){"use strict";var r=n(40),i=(n.n(r),n(29));n.d(t,"b",function(){return i.b}),n.d(t,"c",function(){return i.c}),n.d(t,"d",function(){return i.d}),n.d(t,"e",function(){return i.e}),n.d(t,"f",function(){return i.f}),n.d(t,"g",function(){return i.g}),n.d(t,"h",function(){return i.h}),n.d(t,"i",function(){return i.a});var o=n(5);n.d(t,"j",function(){return o.b}),n.d(t,"k",function(){return o.c}),n.d(t,"l",function(){return o.d});var a=n(12);n.d(t,"m",function(){return a.a});var s=n(7);n.d(t,"n",function(){return s.a});var u=n(20);n.d(t,"o",function(){return u.a});var l=n(33);n.d(t,"p",function(){return l.a});var c=n(15);n.d(t,"q",function(){return c.b}),n.d(t,"r",function(){return c.e}),n.d(t,"s",function(){return c.a});var h=n(31);n.d(t,"t",function(){return h.a});var p=n(14);n.d(t,"u",function(){return p.a});var d=n(10);n.d(t,"v",function(){return d.c}),n.d(t,"w",function(){return d.d}),n.d(t,"x",function(){return d.b});var f=n(3);n.d(t,"y",function(){return f.b}),n.d(t,"z",function(){return f.c}),n.d(t,"A",function(){return f.d}),n.d(t,"B",function(){return f.e}),n.d(t,"C",function(){return f.f}),n.d(t,"D",function(){return f.g}),n.d(t,"E",function(){return f.a}),n.d(t,"F",function(){return f.h}),n.d(t,"G",function(){return f.i}),n.d(t,"H",function(){return f.j});var m=n(22);n.d(t,"I",function(){return m.a}),n.d(t,"J",function(){return m.b}),n.d(t,"K",function(){return m.c}),n.d(t,"L",function(){return m.d});var g=n(75);n.d(t,"M",function(){return g.a}),n.d(t,"N",function(){return g.b});var y=n(76);n.d(t,"O",function(){return y.a}),n.d(t,"P",function(){return y.b});var v=n(74);n.d(t,"Q",function(){return v.a}),n.d(t,"R",function(){return v.b});var b=n(77);n.d(t,"S",function(){return b.a}),n.d(t,"T",function(){return b.b});var C=n(21);n.d(t,"U",function(){return C.b}),n.d(t,"V",function(){return C.a}),n.d(t,"W",function(){return C.c});var x=n(34);n.d(t,"X",function(){return x.a});var P=n(9);n.d(t,"Y",function(){return P.a});var w=n(23);n.d(t,"Z",function(){return w.a});var V=n(16);n.d(t,"_0",function(){return V.a}),n.d(t,"_1",function(){return V.b});var T=n(69);n.d(t,"_2",function(){return T.a});var O=n(70);n.d(t,"_3",function(){return O.a});var S=n(71);n.d(t,"_4",function(){return S.a});var R=n(6);n.d(t,"_5",function(){return R.a}),n.d(t,"_6",function(){return R.b});var E=n(72);n.d(t,"_7",function(){return E.a});var q=n(73);n.d(t,"_8",function(){return q.a});var k=n(79);n.d(t,"_9",function(){return k.a});var N=n(80);n.d(t,"_10",function(){return N.a});var j=n(81);n.d(t,"_11",function(){return j.a});var I=n(68);n.d(t,"_12",function(){return I.a});var L=n(78);n.d(t,"_13",function(){return L.a}),n.d(t,"_14",function(){return L.b});var M=n(28);n.d(t,"_15",function(){return M.a});var D=n(96);n.d(t,"_16",function(){return D.a}),n.d(t,"_17",function(){return D.b}),n.d(t,"_18",function(){return D.c}),n.d(t,"_19",function(){return D.d}),n.d(t,"_20",function(){return D.e});var A=n(95);n.d(t,"_21",function(){return A.a});var _=n(17);n.d(t,"_22",function(){return _.a});var z=n(32);n.d(t,"_23",function(){return z.a});var B=n(1);n.d(t,"_24",function(){return B.a}),n.d(t,"_25",function(){return B.b});var Q=n(35);n.d(t,"_26",function(){return Q.b}),n.d(t,"_27",function(){return Q.a}),n.d(t,"a",function(){return H});var H;H="0.12.24"},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"السابق",pageNextText:"التالي",completeText:"انهاء- تم",progressText:"{1} صفحة {0} من",otherItemText:"نص آخر",emptySurvey:"لا توجد صفحة مرئية أو سؤال في المسح",completingSurvey:"شكرا لك لاستكمال الاستبيان!",loadingSurvey:"...يتم تحميل الاستبيان",optionsCaption:"...اختر",requiredError:".يرجى الإجابة على السؤال",requiredInAllRowsError:"يرجى الإجابة على الأسئلة في جميع الصفوف",numericError:"يجب أن تكون القيمة الرقمية.",textMinLength:"الرجاء إدخال ما لا يقل عن {0} حرف",textMaxLength:"الرجاء إدخال أقل من {0} حرف",textMinMaxLength:"يرجى إدخال أكثر من {0} وأقل من {1} حرف",minRowCountError:"يرجى ملء ما لا يقل عن {0} الصفوف",minSelectError:"يرجى تحديد ما لا يقل عن {0} المتغيرات",maxSelectError:"يرجى تحديد ما لا يزيد عن {0} المتغيرات",numericMinMax:"و'{0}' يجب أن تكون مساوية أو أكثر من {1} ويساوي أو أقل من {2}ا",numericMin:"و'{0}' يجب أن تكون مساوية أو أكثر من {1}ا",numericMax:"و'{0}' يجب أن تكون مساوية أو أقل من {1}ا",invalidEmail:"رجاء قم بإدخال بريد الكتروني صحيح",urlRequestError:"طلب إرجاع خطأ '{0}'. {1}ا",urlGetChoicesError:"عاد طلب بيانات فارغة أو 'المسار' ممتلكات غير صحيحة ",exceedMaxSize:"وينبغي ألا يتجاوز حجم الملف {0}ا",otherRequiredError:"الرجاء إدخال قيمة أخرى",uploadingFile:"الملف الخاص بك تحميل. يرجى الانتظار عدة ثوان وحاول مرة أخرى",addRow:"اضافة صف",removeRow:"إزالة صف"};r.a.locales.ar=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Předchozí",pageNextText:"Další",completeText:"Hotovo",otherItemText:"Jiná odpověď (napište)",progressText:"Strana {0} z {1}",emptySurvey:"Průzkumu neobsahuje žádné otázky.",completingSurvey:"Děkujeme za vyplnění průzkumu!",loadingSurvey:"Probíhá načítání průzkumu...",optionsCaption:"Vyber...",requiredError:"Odpovězte prosím na otázku.",requiredInAllRowsError:"Odpovězte prosím na všechny otázky.",numericError:"V tomto poli lze zadat pouze čísla.",textMinLength:"Zadejte prosím alespoň {0} znaků.",textMaxLength:"Zadejte prosím méně než {0} znaků.",textMinMaxLength:"Zadejte prosím více než {0} a méně než {1} znaků.",minRowCountError:"Vyplňte prosím alespoň {0} řádků.",minSelectError:"Vyberte prosím alespoň {0} varianty.",maxSelectError:"Nevybírejte prosím více než {0} variant.",numericMinMax:"Odpověď '{0}' by mělo být větší nebo rovno {1} a menší nebo rovno {2}",numericMin:"Odpověď '{0}' by mělo být větší nebo rovno {1}",numericMax:"Odpověď '{0}' by mělo být menší nebo rovno {1}",invalidEmail:"Zadejte prosím platnou e-mailovou adresu.",urlRequestError:"Požadavek vrátil chybu '{0}'. {1}",urlGetChoicesError:"Požadavek nevrátil data nebo cesta je neplatná",exceedMaxSize:"Velikost souboru by neměla být větší než {0}.",otherRequiredError:"Zadejte prosím jinou hodnotu.",uploadingFile:"Váš soubor se nahrává. Zkuste to prosím za několik sekund.",addRow:"Přidat řádek",removeRow:"Odstranit"};r.a.locales.cz=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Tilbage",pageNextText:"Videre",completeText:"Færdig",progressText:"Side {0} af {1}",emptySurvey:"Der er ingen synlige spørgsmål.",completingSurvey:"Mange tak for din besvarelse!",loadingSurvey:"Spørgeskemaet hentes fra serveren...",otherItemText:"Valgfrit svar...",optionsCaption:"Vælg...",requiredError:"Besvar venligst spørgsmålet.",numericError:"Angiv et tal.",textMinLength:"Angiv mindst {0} tegn.",minSelectError:"Vælg venligst mindst {0} svarmulighed(er).",maxSelectError:"Vælg venligst færre {0} svarmuligheder(er).",numericMinMax:"'{0}' skal være lig med eller større end {1} og lig med eller mindre end {2}",numericMin:"'{0}' skal være lig med eller større end {1}",numericMax:"'{0}' skal være lig med eller mindre end {1}",invalidEmail:"Angiv venligst en gyldig e-mail adresse.",exceedMaxSize:"Filstørrelsen må ikke overstige {0}.",otherRequiredError:"Angiv en værdi for dit valgfrie svar."};r.a.locales.da=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Vorige",pageNextText:"Volgende",completeText:"Afsluiten",otherItemText:"Andere",progressText:"Pagina {0} van {1}",emptySurvey:"Er is geen zichtbare pagina of vraag in deze vragenlijst",completingSurvey:"Bedankt om deze vragenlijst in te vullen",loadingSurvey:"De vragenlijst is aan het laden...",optionsCaption:"Kies...",requiredError:"Gelieve een antwoord in te vullen",numericError:"Het antwoord moet een getal zijn",textMinLength:"Gelieve minsten {0} karakters in te vullen.",minSelectError:"Gelieve minimum {0} antwoorden te selecteren.",maxSelectError:"Gelieve niet meer dan {0} antwoorden te selecteren.",numericMinMax:"Uw antwoord '{0}' moet groter of gelijk zijn aan {1} en kleiner of gelijk aan {2}",numericMin:"Uw antwoord '{0}' moet groter of gelijk zijn aan {1}",numericMax:"Uw antwoord '{0}' moet groter of gelijk zijn aan {1}",invalidEmail:"Gelieve een geldig e-mailadres in te vullen.",exceedMaxSize:"De grootte van het bestand mag niet groter zijn dan {0}.",otherRequiredError:"Gelieve het veld 'Andere' in te vullen"};r.a.locales.nl=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Edellinen",pageNextText:"Seuraava",completeText:"Valmis",otherItemText:"Muu (kuvaile)",progressText:"Sivu {0}/{1}",emptySurvey:"Tässä kyselyssä ei ole yhtäkään näkyvillä olevaa sivua tai kysymystä.",completingSurvey:"Kiitos kyselyyn vastaamisesta!",loadingSurvey:"Kyselyä ladataan palvelimelta...",optionsCaption:"Valitse...",requiredError:"Vastaa kysymykseen, kiitos.",numericError:"Arvon tulee olla numeerinen.",textMinLength:"Ole hyvä ja syötä vähintään {0} merkkiä.",minSelectError:"Ole hyvä ja valitse vähintään {0} vaihtoehtoa.",maxSelectError:"Ole hyvä ja valitse enintään {0} vaihtoehtoa.",numericMinMax:"'{0}' täytyy olla enemmän tai yhtä suuri kuin {1} ja vähemmän tai yhtä suuri kuin {2}",numericMin:"'{0}' täytyy olla enemmän tai yhtä suuri kuin {1}",numericMax:"'{0}' täytyy olla vähemmän tai yhtä suuri kuin {1}",invalidEmail:"Syötä validi sähköpostiosoite.",otherRequiredError:'Ole hyvä ja syötä "Muu (kuvaile)"'};r.a.locales.fi=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Précédent",pageNextText:"Suivant",completeText:"Terminer",otherItemText:"Autre (préciser)",progressText:"Page {0} sur {1}",emptySurvey:"Il n'y a ni page visible ni question visible dans ce questionnaire",completingSurvey:"Merci d'avoir répondu au questionnaire!",loadingSurvey:"Le questionnaire est en cours de chargement...",optionsCaption:"Choisissez...",requiredError:"La réponse à cette question est obligatoire.",requiredInAllRowsError:"Toutes les lignes sont obligatoires",numericError:"La réponse doit être un nombre.",textMinLength:"Merci d'entrer au moins {0} symboles.",minSelectError:"Merci de sélectionner au moins {0}réponses.",maxSelectError:"Merci de sélectionner au plus {0}réponses.",numericMinMax:"Votre réponse '{0}' doit êtresupérieure ou égale à {1} et inférieure ouégale à {2}",numericMin:"Votre réponse '{0}' doit êtresupérieure ou égale à {1}",numericMax:"Votre réponse '{0}' doit êtreinférieure ou égale à {1}",invalidEmail:"Merci d'entrer une adresse mail valide.",exceedMaxSize:"La taille du fichier ne doit pas excéder {0}.",otherRequiredError:"Merci de préciser le champ 'Autre'."};r.a.locales.fr=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Zurück",pageNextText:"Weiter",completeText:"Absenden",progressText:"Seite {0} von {1}",emptySurvey:"Es gibt keine sichtbare Frage.",completingSurvey:"Vielen Dank für die Beantwortung des Fragebogens!",loadingSurvey:"Der Fragebogen wird vom Server geladen...",otherItemText:"Benutzerdefinierte Antwort...",optionsCaption:"Wählen...",requiredError:"Bitte beantworten Sie diese Frage.",numericError:"Der Wert sollte eine Zahl sein.",textMinLength:"Bitte geben Sie mindestens {0} Zeichen ein.",minSelectError:"Bitte wählen Sie mindestens {0} Einträge.",maxSelectError:"Bitte wählen Sie nicht mehr als {0} Einträge.",numericMinMax:"'{0}' sollte gleich oder größer sein als {1} und gleich oder kleiner als {2}.",numericMin:"'{0}' sollte gleich oder größer sein als {1}.",numericMax:"'{0}' sollte gleich oder kleiner als {1} sein.",invalidEmail:"Bitte geben Sie eine gültige E-Mail Adresse ein.",exceedMaxSize:"Die Dateigröße darf {0} KB nicht überschreiten.",otherRequiredError:"Bitte geben Sie Ihre benutzerdefinierte Antwort ein."};r.a.locales.de=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Προηγούμενο",pageNextText:"Επόμενο",completeText:"Ολοκλήρωση",otherItemText:"Άλλο (παρακαλώ διευκρινίστε)",progressText:"Σελίδα {0} από {1}",emptySurvey:"Δεν υπάρχει καμία ορατή σελίδα ή ορατή ερώτηση σε αυτό το ερωτηματολόγιο.",completingSurvey:"Ευχαριστούμε για την συμπλήρωση αυτου του ερωτηματολογίου!",loadingSurvey:"Το ερωτηματολόγιο φορτώνεται απο το διακομιστή...",optionsCaption:"Επιλέξτε...",requiredError:"Παρακαλώ απαντήστε στην ερώτηση.",requiredInAllRowsError:"Παρακαλώ απαντήστε στις ερωτήσεις σε όλες τις γραμμές.",numericError:"Η τιμή πρέπει να είναι αριθμιτική.",textMinLength:"Παρακαλώ συμπληρώστε τουλάχιστον {0} σύμβολα.",minRowCountError:"Παρακαλώ συμπληρώστε τουλάχιστον {0} γραμμές.",minSelectError:"Παρακαλώ επιλέξτε τουλάχιστον {0} παραλλαγές.",maxSelectError:"Παρακαλώ επιλέξτε όχι παραπάνω απο {0} παραλλαγές.",numericMinMax:"Το '{0}' θα πρέπει να είναι ίσο ή μεγαλύτερο απο το {1} και ίσο ή μικρότερο απο το {2}",numericMin:"Το '{0}' πρέπει να είναι μεγαλύτερο ή ισο με το {1}",numericMax:"Το '{0}' πρέπει να είναι μικρότερο ή ίσο απο το {1}",invalidEmail:"Παρακαλώ δώστε μια αποδεκτή διεύθυνση e-mail.",urlRequestError:"Η αίτηση επέστρεψε σφάλμα '{0}'. {1}",urlGetChoicesError:"Η αίτηση επέστρεψε κενά δεδομένα ή η ιδότητα 'μονοπάτι/path' είναι εσφαλέμένη",exceedMaxSize:"Το μέγεθος δεν μπορεί να υπερβένει τα {0}.",otherRequiredError:"Παρακαλώ συμπληρώστε την τιμή για το πεδίο 'άλλο'.",uploadingFile:"Το αρχείο σας ανεβαίνει. Παρακαλώ περιμένετε καποια δευτερόλεπτα και δοκιμάστε ξανά.",addRow:"Προσθήκη γραμμής",removeRow:"Αφαίρεση"};r.a.locales.gr=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Vissza",pageNextText:"Tovább",completeText:"Kész",otherItemText:"Egyéb (adja meg)",progressText:"{0}./{1} oldal",emptySurvey:"There is no visible page or question in the survey.",completingSurvey:"Köszönjük, hogy kitöltötte felmérésünket!",completingSurveyBefore:"Már kitöltötte a felmérést.",loadingSurvey:"Felmérés betöltése...",optionsCaption:"Válasszon...",value:"érték",requiredError:"Kérjük, válaszolja meg ezt a kérdést!",requiredInAllRowsError:"Kérjük adjon választ minden sorban!",numericError:"Az érték szám kell, hogy legyen!",textMinLength:"Adjon meg legalább {0} karaktert!",textMaxLength:"Legfeljebb {0} karaktert adjon meg!",textMinMaxLength:"Adjon meg legalább {0}, de legfeljebb {1} karaktert!",minRowCountError:"Töltsön ki minimum {0} sort!",minSelectError:"Válasszon ki legalább {0} lehetőséget!",maxSelectError:"Ne válasszon többet, mint {0} lehetőség!",numericMinMax:"'{0}' legyen nagyobb, vagy egyenlő, mint {1} és kisebb, vagy egyenlő, mint {2}!",numericMin:"'{0}' legyen legalább {1}!",numericMax:"The '{0}' ne legyen nagyobb, mint {1}!",invalidEmail:"Adjon meg egy valós email címet!",urlRequestError:"A lekérdezés hibával tért vissza: '{0}'. {1}",urlGetChoicesError:"A lekérdezés üres adattal tért vissza, vagy a 'path' paraméter helytelen.",exceedMaxSize:"A méret nem lehet nagyobb, mint {0}.",otherRequiredError:"Adja meg az egyéb értéket!",uploadingFile:"Feltöltés folyamatban. Várjon pár másodpercet, majd próbálja újra.",confirmDelete:"Törli ezt a rekordot?",keyDuplicationError:"Az értéknek egyedinek kell lennie.",addRow:"Sor hozzáadása",removeRow:"Eltávolítás",addPanel:"Új hozzáadása",removePanel:"Eltávolítás",choices_Item:"elem",matrix_column:"Oszlop",matrix_row:"Sor",savingData:"Eredmény mentése a szerverre...",savingDataError:"Egy hiba folytán nem tudtuk elmenteni az eredményt.",savingDataSuccess:"Eredmény sikeresen mentve!",saveAgainButton:"Próbálja újra"};r.a.locales.hu=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Tilbaka",pageNextText:"Áfram",completeText:"Lokið",otherItemText:"Hinn (skýring)",progressText:"Síða {0} of {1}",emptySurvey:"Það er enginn síða eða spurningar í þessari könnun.",completingSurvey:"Takk fyrir að fyllja út þessa könnun!",loadingSurvey:"Könnunin er að hlaða...",optionsCaption:"Veldu...",requiredError:"Vinsamlegast svarið spurningunni.",requiredInAllRowsError:"Vinsamlegast svarið spurningum í öllum röðum.",numericError:"Þetta gildi verður að vera tala.",textMinLength:"Það ætti að vera minnst {0} tákn.",textMaxLength:"Það ætti að vera mest {0} tákn.",textMinMaxLength:"Það ætti að vera fleiri en {0} og færri en {1} tákn.",minRowCountError:"Vinsamlegast fyllið úr að minnsta kosti {0} raðir.",minSelectError:"Vinsamlegast veljið að minnsta kosti {0} möguleika.",maxSelectError:"Vinsamlegast veljið ekki fleiri en {0} möguleika.",numericMinMax:"'{0}' ætti að vera meira en eða jafnt og {1} minna en eða jafnt og {2}",numericMin:"{0}' ætti að vera meira en eða jafnt og {1}",numericMax:"'{0}' ætti að vera minna en eða jafnt og {1}",invalidEmail:"Vinsamlegast sláið inn gilt netfang.",urlRequestError:"Beiðninn skilaði eftirfaranadi villu '{0}'. {1}",urlGetChoicesError:"Beiðninng skilaði engum gögnum eða slóðinn var röng",exceedMaxSize:"Skráinn skal ekki vera stærri en {0}.",otherRequiredError:"Vinamlegast fyllið út hitt gildið.",uploadingFile:"Skráinn þín var send. Vinsamlegast bíðið í nokkrar sekúndur og reynið aftur.",addRow:"Bæta við röð",removeRow:"Fjarlægja",choices_firstItem:"fyrsti hlutur",choices_secondItem:"annar hlutur",choices_thirdItem:"þriðji hlutur",matrix_column:"Dálkur",matrix_row:"Röð"};r.a.locales.is=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Precedente",pageNextText:"Successivo",completeText:"Salva",otherItemText:"Altro (descrivi)",progressText:"Pagina {0} di {1}",emptySurvey:"Non ci sono pagine o domande visibili nel questionario.",completingSurvey:"Grazie per aver completato il questionario!",loadingSurvey:"Caricamento del questionario in corso...",optionsCaption:"Scegli...",requiredError:"Campo obbligatorio",requiredInAllRowsError:"Completare tutte le righe",numericError:"Il valore deve essere numerico",textMinLength:"Inserire almeno {0} caratteri",textMaxLength:"Lunghezza massima consentita {0} caratteri",textMinMaxLength:"Inserire una stringa con minimo {0} e massimo {1} caratteri",minRowCountError:"Completare almeno {0} righe.",minSelectError:"Selezionare almeno {0} varianti.",maxSelectError:"Selezionare massimo {0} varianti.",numericMinMax:"'{0}' deve essere uguale o superiore a {1} e uguale o inferiore a {2}",numericMin:"'{0}' deve essere uguale o superiore a {1}",numericMax:"'{0}' deve essere uguale o inferiore a {1}",invalidEmail:"Inserire indirizzo mail valido",urlRequestError:"La richiesta ha risposto con un errore '{0}'. {1}",urlGetChoicesError:"La richiesta ha risposto null oppure il percorso non è corretto",exceedMaxSize:"Il file non può eccedere {0}",otherRequiredError:"Inserire il valore 'altro'",uploadingFile:"File in caricamento. Attendi alcuni secondi e riprova",addRow:"Aggiungi riga",removeRow:"Rimuovi riga",choices_Item:"Elemento",matrix_column:"Colonna",matrix_row:"Riga"};r.a.locales.it=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Atpakaļ",pageNextText:"Tālāk",completeText:"Pabeigt",progressText:"Lappuse {0} no {1}",emptySurvey:"Nav neviena jautājuma.",completingSurvey:"Pateicamies Jums par anketas aizpildīšanu!",loadingSurvey:"Ielāde no servera...",otherItemText:"Cits (lūdzu, aprakstiet!)",optionsCaption:"Izvēlēties...",requiredError:"Lūdzu, atbildiet uz jautājumu!",numericError:"Atbildei ir jābūt skaitlim.",textMinLength:"Lūdzu, ievadiet vismaz {0} simbolus.",minSelectError:"Lūdzu, izvēlieties vismaz {0} variantu.",maxSelectError:"Lūdzu, izvēlieties ne vairak par {0} variantiem.",numericMinMax:"'{0}' jābūt vienādam vai lielākam nekā {1}, un vienādam vai mazākam, nekā {2}",numericMin:"'{0}' jābūt vienādam vai lielākam {1}",numericMax:"'{0}' jābūt vienādam vai lielākam {1}",invalidEmail:"Lūdzu, ievadiet patiesu e-pasta adresi!",otherRequiredError:'Lūdzu, ievadiet datus laukā "Cits"'};r.a.locales.lv=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Wstecz",pageNextText:"Dalej",completeText:"Gotowe",otherItemText:"Inna odpowiedź (wpisz)",progressText:"Strona {0} z {1}",emptySurvey:"Nie ma widocznych pytań.",completingSurvey:"Dziękujemy za wypełnienie ankiety!",loadingSurvey:"Trwa wczytywanie ankiety...",optionsCaption:"Wybierz...",requiredError:"Proszę odpowiedzieć na to pytanie.",requiredInAllRowsError:"Proszę odpowiedzieć na wszystkie pytania.",numericError:"W tym polu można wpisać tylko liczby.",textMinLength:"Proszę wpisać co najmniej {0} znaków.",textMaxLength:"Proszę wpisać mniej niż {0} znaków.",textMinMaxLength:"Proszę wpisać więcej niż {0} i mniej niż {1} znaków.",minRowCountError:"Proszę uzupełnić przynajmniej {0} wierszy.",minSelectError:"Proszę wybrać co najmniej {0} pozycji.",maxSelectError:"Proszę wybrać nie więcej niż {0} pozycji.",numericMinMax:"Odpowiedź '{0}' powinna być większa lub równa {1} oraz mniejsza lub równa {2}",numericMin:"Odpowiedź '{0}' powinna być większa lub równa {1}",numericMax:"Odpowiedź '{0}' powinna być mniejsza lub równa {1}",invalidEmail:"Proszę podać prawidłowy adres email.",urlRequestError:"Żądanie zwróciło błąd '{0}'. {1}",urlGetChoicesError:"Żądanie nie zwróciło danych albo ścieżka jest nieprawidłowa",exceedMaxSize:"Rozmiar przesłanego pliku nie może przekraczać {0}.",otherRequiredError:"Proszę podać inną odpowiedź.",uploadingFile:"Trwa przenoszenie Twojego pliku, proszę spróbować ponownie za kilka sekund.",addRow:"Dodaj wiersz",removeRow:"Usuń"};r.a.locales.pl=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Anterior",pageNextText:"Próximo",completeText:"Finalizar",otherItemText:"Outros (descrever)",progressText:"Pagina {0} de {1}",emptySurvey:"Não há página visível ou pergunta na pesquisa.",completingSurvey:"Obrigado por finalizar a pesquisa!",loadingSurvey:"A pesquisa está carregando...",optionsCaption:"Selecione...",requiredError:"Por favor, responda a pergunta.",requiredInAllRowsError:"Por favor, responda as perguntas em todas as linhas.",numericError:"O valor deve ser numérico.",textMinLength:"Por favor, insira pelo menos {0} caracteres.",textMaxLength:"Por favor, insira menos de {0} caracteres.",textMinMaxLength:"Por favor, insira mais de {0} e menos de {1} caracteres.",minRowCountError:"Preencha pelo menos {0} linhas.",minSelectError:"Selecione pelo menos {0} opções.",maxSelectError:"Por favor, selecione não mais do que {0} opções.",numericMinMax:"O '{0}' deve ser igual ou superior a {1} e igual ou menor que {2}",numericMin:"O '{0}' deve ser igual ou superior a {1}",numericMax:"O '{0}' deve ser igual ou inferior a {1}",invalidEmail:"Por favor, informe um e-mail válido.",urlRequestError:"A requisição retornou o erro '{0}'. {1}",urlGetChoicesError:"A requisição não retornou dados ou o 'caminho' da requisição não está correto",exceedMaxSize:"O tamanho do arquivo não deve exceder {0}.",otherRequiredError:"Por favor, informe o outro valor.",uploadingFile:"Seu arquivo está sendo carregado. Por favor, aguarde alguns segundos e tente novamente.",addRow:"Adicionar linha",removeRow:"Remover linha",choices_firstItem:"primeiro item",choices_secondItem:"segundo item",choices_thirdItem:"terceiro item",matrix_column:"Coluna",matrix_row:"Linha"};r.a.locales.pt=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Precedent",pageNextText:"Următor",completeText:"Finalizare",otherItemText:"Altul(precizaţi)",progressText:"Pagina {0} din {1}",emptySurvey:"Nu sunt întrebări pentru acest chestionar",completingSurvey:"Vă mulţumim pentru timpul acordat!",loadingSurvey:"Chestionarul se încarcă...",optionsCaption:"Alegeţi...",requiredError:"Răspunsul la această întrebare este obligatoriu.",requiredInAllRowsError:"Toate răspunsurile sunt obligatorii",numericError:"Răspunsul trebuie să fie numeric.",textMinLength:"Trebuie să introduci minim {0} caractere.",minSelectError:"Trebuie să selectezi minim {0} opţiuni.",maxSelectError:"Trebuie să selectezi maxim {0} opţiuni.",numericMinMax:"Răspunsul '{0}' trebuie să fie mai mare sau egal ca {1} şî mai mic sau egal cu {2}",numericMin:"Răspunsul '{0}' trebuie să fie mai mare sau egal ca {1}",numericMax:"Răspunsul '{0}' trebuie să fie mai mic sau egal ca {1}",invalidEmail:"Trebuie să introduceţi o adresa de email validă.",exceedMaxSize:"Dimensiunea fişierului nu trebuie să depăşească {0}.",otherRequiredError:"Trebuie să completezi câmpul 'Altul'."};r.a.locales.ro=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Назад",pageNextText:"Далее",completeText:"Готово",progressText:"Страница {0} из {1}",emptySurvey:"Нет ни одного вопроса.",completingSurvey:"Благодарим Вас за заполнение анкеты!",loadingSurvey:"Загрузка с сервера...",otherItemText:"Другое (пожалуйста, опишите)",optionsCaption:"Выбрать...",requiredError:"Пожалуйста, ответьте на вопрос.",numericError:"Ответ должен быть числом.",textMinLength:"Пожалуйста, введите хотя бы {0} символов.",minSelectError:"Пожалуйста, выберите хотя бы {0} вариантов.",maxSelectError:"Пожалуйста, выберите не более {0} вариантов.",numericMinMax:"'{0}' должно быть равным или больше, чем {1}, и равным или меньше, чем {2}",numericMin:"'{0}' должно быть равным или больше, чем {1}",numericMax:"'{0}' должно быть равным или меньше, чем {1}",invalidEmail:"Пожалуйста, введите действительный адрес электронной почты.",otherRequiredError:'Пожалуйста, введите данные в поле "Другое"'};r.a.locales.ru=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"上一页",pageNextText:"下一页",completeText:"提交问卷",otherItemText:"填写其他答案",progressText:"第 {0} 页, 共 {1} 页",emptySurvey:"问卷中没有问题或页面",completingSurvey:"感谢您的参与!",loadingSurvey:"问卷正在加载中...",optionsCaption:"请选择...",requiredError:"请填写此问题",requiredInAllRowsError:"请填写所有行中问题",numericError:"答案必须是个数字",textMinLength:"答案长度至少 {0} 个字符",textMaxLength:"答案长度不能超过 {0} 个字符",textMinMaxLength:"答案长度必须在 {0} - {1} 个字符之间",minRowCountError:"最少需要填写 {0} 行答案",minSelectError:"最少需要选择 {0} 项答案",maxSelectError:"最多只能选择 {0} 项答案",numericMinMax:"答案 '{0}' 必须大于等于 {1} 且小于等于 {2}",numericMin:"答案 '{0}' 必须大于等于 {1}",numericMax:"答案 '{0}' 必须小于等于 {1}",invalidEmail:"请输入有效的 Email 地址",urlRequestError:"载入选项时发生错误 '{0}': {1}",urlGetChoicesError:"未能载入有效的选项或请求参数路径有误",exceedMaxSize:"文件大小不能超过 {0}",otherRequiredError:"请完成其他问题",uploadingFile:"文件上传中... 请耐心等待几秒后重试",addRow:"添加答案",removeRow:"删除答案",choices_Item:"选项",matrix_column:"列",matrix_row:"行",savingData:"正在将结果保存到服务器...",savingDataError:"在保存结果过程中发生了错误,结果未能保存",savingDataSuccess:"结果保存成功!",saveAgainButton:"请重试"};r.a.locales["zh-cn"]=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Anterior",pageNextText:"Siguiente",completeText:"Completo",otherItemText:"Otro (describa)",progressText:"Página {0} de {1}",emptySurvey:"No hay página visible o pregunta en la encuesta.",completingSurvey:"Gracias por completar la encuesta!",loadingSurvey:"La encuesta está cargando...",optionsCaption:"Seleccione...",requiredError:"Por favor conteste la pregunta.",requiredInAllRowsError:"Por favor conteste las preguntas en cada hilera.",numericError:"La estimación debe ser numérica.",textMinLength:"Por favor entre por lo menos {0} símbolos.",textMaxLength:"Por favor entre menos de {0} símbolos.",textMinMaxLength:"Por favor entre más de {0} y menos de {1} símbolos.",minRowCountError:"Por favor llene por lo menos {0} hileras.",minSelectError:"Por favor seleccione por lo menos {0} variantes.",maxSelectError:"Por favor seleccione no más de {0} variantes.",numericMinMax:"El '{0}' debe de ser igual o más de {1} y igual o menos de {2}",numericMin:"El '{0}' debe ser igual o más de {1}",numericMax:"El '{0}' debe ser igual o menos de {1}",invalidEmail:"Por favor agregue un correo electrónico válido.",urlRequestError:"La solicitud regresó error '{0}'. {1}",urlGetChoicesError:"La solicitud regresó vacío de data o la propiedad 'trayectoria' no es correcta",exceedMaxSize:"El tamaño del archivo no debe de exceder {0}.",otherRequiredError:"Por favor agregue la otra estimación.",uploadingFile:"Su archivo se está subiendo. Por favor espere unos segundos e intente de nuevo.",addRow:"Agregue una hilera",removeRow:"Eliminar una hilera",choices_firstItem:"primer artículo",choices_secondItem:"segundo artículo",choices_thirdItem:"tercera artículo",matrix_column:"Columna",matrix_row:"Hilera"};r.a.locales.es=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Föregående",pageNextText:"Nästa",completeText:"Färdig",otherItemText:"Annat (beskriv)",progressText:"Sida {0} av {1}",emptySurvey:"Det finns ingen synlig sida eller fråga i enkäten.",completingSurvey:"Tack för att du genomfört enkäten!!",loadingSurvey:"Enkäten laddas...",optionsCaption:"Välj...",requiredError:"Var vänlig besvara frågan.",requiredInAllRowsError:"Var vänlig besvara frågorna på alla rader.",numericError:"Värdet ska vara numeriskt.",textMinLength:"Var vänlig ange minst {0} tecken.",minRowCountError:"Var vänlig fyll i minst {0} rader.",minSelectError:"Var vänlig välj åtminstone {0} varianter.",maxSelectError:"Var vänlig välj inte fler än {0} varianter.",numericMinMax:"'{0}' ska vara lika med eller mer än {1} samt lika med eller mindre än {2}",numericMin:"'{0}' ska vara lika med eller mer än {1}",numericMax:"'{0}' ska vara lika med eller mindre än {1}",invalidEmail:"Var vänlig ange en korrekt e-postadress.",urlRequestError:"Förfrågan returnerade felet '{0}'. {1}",urlGetChoicesError:"Antingen returnerade förfrågan ingen data eller så är egenskapen 'path' inte korrekt",exceedMaxSize:"Filstorleken får ej överstiga {0}.",otherRequiredError:"Var vänlig ange det andra värdet.",uploadingFile:"Din fil laddas upp. Var vänlig vänta några sekunder och försök sedan igen.",addRow:"Lägg till rad",removeRow:"Ta bort"};r.a.locales.sv=i},function(e,t,n){"use strict";var r=n(1),i={pagePrevText:"Geri",pageNextText:"İleri",completeText:"Anketi Tamamla",otherItemText:"Diğer (açıklayınız)",progressText:"Sayfa {0} / {1}",emptySurvey:"Ankette görüntülenecek sayfa ya da soru mevcut değil.",completingSurvey:"Anketimizi tamamladığınız için teşekkür ederiz.",loadingSurvey:"Anket sunucudan yükleniyor ...",optionsCaption:"Seçiniz ...",requiredError:"Lütfen soruya cevap veriniz",numericError:"Girilen değer numerik olmalıdır",textMinLength:"En az {0} sembol giriniz.",minRowCountError:"Lütfen en az {0} satırı doldurun.",minSelectError:"Lütfen en az {0} seçeneği seçiniz.",maxSelectError:"Lütfen {0} adetten fazla seçmeyiniz.",numericMinMax:"The '{0}' should be equal or more than {1} and equal or less than {2}",numericMin:"'{0}' değeri {1} değerine eşit veya büyük olmalıdır",numericMax:"'{0}' değeri {1} değerine eşit ya da küçük olmalıdır.",invalidEmail:"Lütfen geçerli bir eposta adresi giriniz.",urlRequestError:"Talebi şu hatayı döndü '{0}'. {1}",urlGetChoicesError:"Talep herhangi bir veri dönmedi ya da 'path' özelliği hatalı.",exceedMaxSize:"Dosya boyutu {0} değerini geçemez.",otherRequiredError:"Lütfen diğer değerleri giriniz.",uploadingFile:"Dosyanız yükleniyor. LÜtfen birkaç saniye bekleyin ve tekrar deneyin.",addRow:"Satır Ekle",removeRow:"Kaldır"};r.a.locales.tr=i},function(e,t,n){"use strict";var r=n(0),i=n(5),o=n(6),a=n(3),s=n(9),u=n(7);n.d(t,"a",function(){return l});var l=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n.locLabelValue=new u.a(n,!0),n}return r.b(t,e),t.prototype.getType=function(){return"boolean"},Object.defineProperty(t.prototype,"isIndeterminate",{get:function(){return this.isEmpty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasTitle",{get:function(){return this.showTitle},enumerable:!0,configurable:!0}),t.prototype.supportGoNextPageAutomatic=function(){return!0},t.prototype.onSetData=function(){e.prototype.onSetData.call(this),this.updateValueWithDefaults()},t.prototype.onSurveyLoad=function(){e.prototype.onSurveyLoad.call(this),this.updateValueWithDefaults()},Object.defineProperty(t.prototype,"checkedValue",{get:function(){return this.isEmpty()?null:this.value==this.getValueTrue()},set:function(e){i.b.isValueEmpty(e)?this.value=null:this.value=1==e?this.getValueTrue():this.getValueFalse()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"defaultValue",{get:function(){return this.getPropertyValue("defaultValue","indeterminate")},set:function(e){this.setPropertyValue("defaultValue",e),this.updateValueWithDefaults()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"label",{get:function(){return this.locLabel.text?this.locLabel.text:""},set:function(e){this.locLabel.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locLabel",{get:function(){return this.locLabelValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locDisplayLabel",{get:function(){return this.locLabel.text?this.locLabel:this.showTitle?this.locLabel:this.locTitle},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showTitle",{get:function(){return this.getPropertyValue("showTitle")},set:function(e){this.setPropertyValue("showTitle",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"valueTrue",{get:function(){return this.getPropertyValue("valueTrue")},set:function(e){this.setPropertyValue("valueTrue",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"valueFalse",{get:function(){return this.getPropertyValue("valueFalse")},set:function(e){this.setPropertyValue("valueFalse",e)},enumerable:!0,configurable:!0}),t.prototype.getValueTrue=function(){return!this.valueTrue||this.valueTrue},t.prototype.getValueFalse=function(){return!!this.valueFalse&&this.valueFalse},t.prototype.updateValueWithDefaults=function(){this.isLoadingFromJson||(this.isEmpty()||this.isDesignMode)&&("true"==this.defaultValue&&(this.checkedValue=!0),"false"==this.defaultValue&&(this.checkedValue=!1),"indeterminate"==this.defaultValue&&(this.value=null))},t}(s.a);a.a.metaData.addClass("boolean",[{name:"defaultValue",default:"indeterminate",choices:["indeterminate","false","true"]},{name:"label:text",serializationProperty:"locLabel"},"showTitle:boolean","valueTrue","valueFalse"],function(){return new l("")},"question"),o.a.Instance.registerQuestion("boolean",function(e){return new l(e)})},function(e,t,n){"use strict";var r=n(0),i=n(3),o=n(6),a=n(16);n.d(t,"a",function(){return s});var s=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n}return r.b(t,e),Object.defineProperty(t.prototype,"displayValue",{get:function(){if(this.isEmpty())return"";for(var e=this.visibleChoices,t=this.value,n="",r=0;r<t.length;r++){var i=this.getDisplayValue(e,t[r]);i&&(n&&(n+=", "),n+=i)}return n},enumerable:!0,configurable:!0}),t.prototype.getHasOther=function(e){return!(!e||!Array.isArray(e))&&e.indexOf(this.otherItem.value)>=0},t.prototype.valueFromData=function(t){return t?Array.isArray(t)?e.prototype.valueFromData.call(this,t):[t]:t},t.prototype.valueFromDataCore=function(e){for(var t=0;t<e.length;t++){if(e[t]==this.otherItem.value)return e;if(this.hasUnknownValue(e[t])){this.comment=e[t];var n=e.slice();return n[t]=this.otherItem.value,n}}return e},t.prototype.valueToDataCore=function(e){if(!e||!e.length)return e;for(var t=0;t<e.length;t++)if(e[t]==this.otherItem.value&&this.getComment()){var n=e.slice();return n[t]=this.getComment(),n}return e},t.prototype.getType=function(){return"checkbox"},t}(a.a);i.a.metaData.addClass("checkbox",[],function(){return new s("")},"checkboxbase"),o.a.Instance.registerQuestion("checkbox",function(e){var t=new s(e);return t.choices=o.a.DefaultChoices,t})},function(e,t,n){"use strict";var r=n(0),i=n(9),o=n(3),a=n(6),s=n(7);n.d(t,"a",function(){return u});var u=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n.rows=4,n.cols=50,n.locPlaceHolderValue=new s.a(n),n}return r.b(t,e),Object.defineProperty(t.prototype,"placeHolder",{get:function(){return this.locPlaceHolder.text},set:function(e){this.locPlaceHolder.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locPlaceHolder",{get:function(){return this.locPlaceHolderValue},enumerable:!0,configurable:!0}),t.prototype.getType=function(){return"comment"},t.prototype.isEmpty=function(){return e.prototype.isEmpty.call(this)||""===this.value},t}(i.a);o.a.metaData.addClass("comment",[{name:"cols:number",default:50},{name:"rows:number",default:4},{name:"placeHolder",serializationProperty:"locPlaceHolder"}],function(){return new u("")},"question"),a.a.Instance.registerQuestion("comment",function(e){return new u(e)})},function(e,t,n){"use strict";var r=n(0),i=n(3),o=n(6),a=n(16),s=n(1),u=n(7);n.d(t,"a",function(){return l});var l=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n.locOptionsCaptionValue=new u.a(n),n}return r.b(t,e),Object.defineProperty(t.prototype,"optionsCaption",{get:function(){return this.locOptionsCaption.text?this.locOptionsCaption.text:s.a.getString("optionsCaption")},set:function(e){this.locOptionsCaption.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locOptionsCaption",{get:function(){return this.locOptionsCaptionValue},enumerable:!0,configurable:!0}),t.prototype.getType=function(){return"dropdown"},t.prototype.onLocaleChanged=function(){e.prototype.onLocaleChanged.call(this),this.locOptionsCaption.onChanged()},t.prototype.supportGoNextPageAutomatic=function(){return!0},t}(a.b);i.a.metaData.addClass("dropdown",[{name:"optionsCaption",serializationProperty:"locOptionsCaption"}],function(){return new l("")},"selectbase"),o.a.Instance.registerQuestion("dropdown",function(e){var t=new l(e);return t.choices=o.a.DefaultChoices,t})},function(e,t,n){"use strict";var r=n(0),i=n(9),o=n(3),a=n(6),s=n(10),u=n(1);n.d(t,"a",function(){return l});var l=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n.showPreviewValue=!1,n.isUploading=!1,n}return r.b(t,e),t.prototype.getType=function(){return"file"},Object.defineProperty(t.prototype,"showPreview",{get:function(){return this.showPreviewValue},set:function(e){this.showPreviewValue=e},enumerable:!0,configurable:!0}),t.prototype.loadFile=function(e){var t=this;this.survey&&!this.survey.uploadFile(this.name,e,this.storeDataAsText,function(e){t.isUploading="uploading"==e})||this.setFileValue(e)},t.prototype.setFileValue=function(e){if(FileReader&&(this.showPreview||this.storeDataAsText)&&!this.checkFileForErrors(e)){var t=new FileReader,n=this;t.onload=function(r){n.showPreview&&(n.previewValue=n.isFileImage(e)?t.result:null,n.fireCallback(n.previewValueLoadedCallback)),n.storeDataAsText&&(n.value=t.result)},t.readAsDataURL(e)}},t.prototype.onCheckForErrors=function(t){e.prototype.onCheckForErrors.call(this,t),this.isUploading&&this.errors.push(new s.c(u.a.getString("uploadingFile")))},t.prototype.checkFileForErrors=function(e){var t=this.errors?this.errors.length:0;return this.errors=[],this.maxSize>0&&e.size>this.maxSize&&this.errors.push(new s.d(this.maxSize)),(t!=this.errors.length||this.errors.length>0)&&this.fireCallback(this.errorsChangedCallback),this.errors.length>0},t.prototype.isFileImage=function(e){if(e&&e.type){return 0==e.type.toLowerCase().indexOf("image")}},t}(i.a);o.a.metaData.addClass("file",["showPreview:boolean","imageHeight","imageWidth","storeDataAsText:boolean","maxSize:number"],function(){return new l("")},"question"),a.a.Instance.registerQuestion("file",function(e){return new l(e)})},function(e,t,n){"use strict";var r=n(0),i=n(23),o=n(3),a=n(6),s=n(7);n.d(t,"a",function(){return u});var u=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n.locHtmlValue=new s.a(n),n}return r.b(t,e),t.prototype.getType=function(){return"html"},Object.defineProperty(t.prototype,"html",{get:function(){return this.locHtml.text},set:function(e){this.locHtml.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locHtml",{get:function(){return this.locHtmlValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"processedHtml",{get:function(){return this.survey?this.survey.processHtml(this.html):this.html},enumerable:!0,configurable:!0}),t}(i.a);o.a.metaData.addClass("html",[{name:"html:html",serializationProperty:"locHtml"}],function(){return new u("")},"questionbase"),a.a.Instance.registerQuestion("html",function(e){return new u(e)})},function(e,t,n){"use strict";var r=n(0),i=n(5),o=n(12),a=n(9),s=n(3),u=n(1),l=n(10),c=n(6);n.d(t,"a",function(){return h}),n.d(t,"b",function(){return p});var h=function(e){function t(t,n,r,i){var o=e.call(this)||this;return o.fullName=n,o.item=t,o.data=r,o.rowValue=i,o}return r.b(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return this.item.value},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this.item.text},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locText",{get:function(){return this.item.locText},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.rowValue},set:function(e){this.rowValue=e,this.data&&this.data.onMatrixRowChanged(this),this.onValueChanged()},enumerable:!0,configurable:!0}),t.prototype.onValueChanged=function(){},t}(i.b),p=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n.isRowChanging=!1,n.isAllRowRequired=!1,n.columnsValue=o.a.createArray(n),n.rowsValue=o.a.createArray(n),n}return r.b(t,e),t.prototype.getType=function(){return"matrix"},Object.defineProperty(t.prototype,"hasRows",{get:function(){return this.rowsValue.length>0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"columns",{get:function(){return this.columnsValue},set:function(e){o.a.setData(this.columnsValue,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rows",{get:function(){return this.rowsValue},set:function(e){o.a.setData(this.rowsValue,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"visibleRows",{get:function(){var e=new Array,t=this.value;t||(t={});for(var n=0;n<this.rows.length;n++)this.rows[n].value&&e.push(this.createMatrixRow(this.rows[n],this.name+"_"+this.rows[n].value.toString(),t[this.rows[n].value]));return 0==e.length&&e.push(this.createMatrixRow(new o.a(null),this.name,t)),this.generatedVisibleRows=e,e},enumerable:!0,configurable:!0}),t.prototype.onLocaleChanged=function(){e.prototype.onLocaleChanged.call(this),o.a.NotifyArrayOnLocaleChanged(this.columns),o.a.NotifyArrayOnLocaleChanged(this.rows)},t.prototype.supportGoNextPageAutomatic=function(){return this.hasValuesInAllRows()},t.prototype.onCheckForErrors=function(t){e.prototype.onCheckForErrors.call(this,t),this.hasErrorInRows()&&this.errors.push(new l.c(u.a.getString("requiredInAllRowsError")))},t.prototype.hasErrorInRows=function(){return!!this.isAllRowRequired&&!this.hasValuesInAllRows()},t.prototype.hasValuesInAllRows=function(){var e=this.generatedVisibleRows;if(e||(e=this.visibleRows),!e)return!0;for(var t=0;t<e.length;t++){if(!e[t].value)return!1}return!0},t.prototype.createMatrixRow=function(e,t,n){return new h(e,t,this,n)},t.prototype.onValueChanged=function(){if(!this.isRowChanging&&this.generatedVisibleRows&&0!=this.generatedVisibleRows.length){this.isRowChanging=!0;var e=this.value;if(e||(e={}),0==this.rows.length)this.generatedVisibleRows[0].value=e;else for(var t=0;t<this.generatedVisibleRows.length;t++){var n=this.generatedVisibleRows[t],r=e[n.name]?e[n.name]:null;this.generatedVisibleRows[t].value=r}this.isRowChanging=!1}},Object.defineProperty(t.prototype,"displayValue",{get:function(){var e=this.value;if(!e)return e;for(var t in e)e[t]=o.a.getTextOrHtmlByValue(this.columns,e[t]);return e},enumerable:!0,configurable:!0}),t.prototype.onMatrixRowChanged=function(e){if(!this.isRowChanging){if(this.isRowChanging=!0,this.hasRows){var t=this.value;t||(t={}),t[e.name]=e.value,this.setNewValue(t)}else this.setNewValue(e.value);this.isRowChanging=!1}},t}(a.a);s.a.metaData.addClass("matrix",[{name:"columns:itemvalues",onGetValue:function(e){return o.a.getData(e.columns)},onSetValue:function(e,t){e.columns=t}},{name:"rows:itemvalues",onGetValue:function(e){return o.a.getData(e.rows)},onSetValue:function(e,t){e.rows=t}},"isAllRowRequired:boolean"],function(){return new p("")},"question"),c.a.Instance.registerQuestion("matrix",function(e){var t=new p(e);return t.rows=c.a.DefaultRows,t.columns=c.a.DefaultColums,t})},function(e,t,n){"use strict";var r=n(0),i=n(22),o=n(3),a=n(12),s=n(6);n.d(t,"a",function(){return u}),n.d(t,"b",function(){return l});var u=function(e){function t(t,n,r,i){var o=e.call(this,r,i)||this;return o.name=t,o.item=n,o}return r.b(t,e),Object.defineProperty(t.prototype,"rowName",{get:function(){return this.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this.item.text},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locText",{get:function(){return this.item.locText},enumerable:!0,configurable:!0}),t}(i.c),l=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n.rowsValue=a.a.createArray(n),n}return r.b(t,e),t.prototype.getType=function(){return"matrixdropdown"},Object.defineProperty(t.prototype,"displayValue",{get:function(){var e=this.value;if(!e)return e;for(var t=this.visibleRows,n=0;n<t.length;n++){var r=this.rows[n].value,i=e[r];i&&(e[r]=this.getRowDisplayValue(t[n],i))}return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rows",{get:function(){return this.rowsValue},set:function(e){a.a.setData(this.rowsValue,e),this.generatedVisibleRows=null},enumerable:!0,configurable:!0}),t.prototype.onLocaleChanged=function(){e.prototype.onLocaleChanged.call(this),a.a.NotifyArrayOnLocaleChanged(this.rowsValue)},t.prototype.generateRows=function(){var e=new Array;if(!this.rows||0===this.rows.length)return e;var t=this.value;t||(t={});for(var n=0;n<this.rows.length;n++)this.rows[n].value&&e.push(this.createMatrixRow(this.rows[n],t[this.rows[n].value]));return e},t.prototype.createMatrixRow=function(e,t){var n=new u(e.value,e,this,t);return this.onMatrixRowCreated(n),n},t}(i.d);o.a.metaData.addClass("matrixdropdown",[{name:"rows:itemvalues",onGetValue:function(e){return a.a.getData(e.rows)},onSetValue:function(e,t){e.rows=t}}],function(){return new l("")},"matrixdropdownbase"),s.a.Instance.registerQuestion("matrixdropdown",function(e){var t=new l(e);return t.choices=[1,2,3,4,5],t.rows=s.a.DefaultColums,i.d.addDefaultColumns(t),t})},function(e,t,n){"use strict";var r=n(0),i=n(22),o=n(3),a=n(6),s=n(1),u=n(10),l=n(7);n.d(t,"a",function(){return c}),n.d(t,"b",function(){return h});var c=function(e){function t(t,n,r){var i=e.call(this,n,r)||this;return i.index=t,i}return r.b(t,e),Object.defineProperty(t.prototype,"rowName",{get:function(){return this.id},enumerable:!0,configurable:!0}),t}(i.c),h=function(e){function t(n){var r=e.call(this,n)||this;return r.name=n,r.rowCounter=0,r.rowCountValue=2,r.minRowCountValue=0,r.maxRowCountValue=t.MaxRowCount,r.confirmDelete=!1,r.keyName="",r.locConfirmDeleteTextValue=new l.a(r),r.locKeyDuplicationErrorValue=new l.a(r),r.locAddRowTextValue=new l.a(r),r.locRemoveRowTextValue=new l.a(r),r}return r.b(t,e),t.prototype.getType=function(){return"matrixdynamic"},Object.defineProperty(t.prototype,"rowCount",{get:function(){return this.rowCountValue},set:function(e){if(!(e<0||e>t.MaxRowCount)){var n=this.rowCountValue;if(this.rowCountValue=e,this.value&&this.value.length>e){var r=this.value;r.splice(e),this.value=r}if(this.generatedVisibleRows){this.generatedVisibleRows.splice(e);for(var i=n;i<e;i++)this.generatedVisibleRows.push(this.createMatrixRow(null))}this.fireCallback(this.rowCountChangedCallback)}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"minRowCount",{get:function(){return this.minRowCountValue},set:function(e){e<0&&(e=0),e==this.minRowCount||e>this.maxRowCount||(this.minRowCountValue=e,this.rowCount<e&&(this.rowCount=e))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxRowCount",{get:function(){return this.maxRowCountValue},set:function(e){e<=0||(e>t.MaxRowCount&&(e=t.MaxRowCount),e==this.maxRowCount||e<this.minRowCount||(this.maxRowCountValue=e,this.rowCount>e&&(this.rowCount=e)))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canAddRow",{get:function(){return this.rowCount<this.maxRowCount},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canRemoveRow",{get:function(){return this.rowCount>this.minRowCount},enumerable:!0,configurable:!0}),t.prototype.addRow=function(){if(this.canAddRow){var e=this.rowCount;this.rowCount=this.rowCount+1,this.data&&this.runCellsCondition(this.data.getAllValues()),this.survey&&e+1==this.rowCount&&this.survey.matrixRowAdded(this)}},t.prototype.removeRowUI=function(e){this.confirmDelete&&!confirm(this.confirmDeleteText)||this.removeRow(e)},t.prototype.removeRow=function(e){if(this.canRemoveRow&&!(e<0||e>=this.rowCount)){if(this.generatedVisibleRows&&e<this.generatedVisibleRows.length&&this.generatedVisibleRows.splice(e,1),this.value){var t=this.createNewValue(this.value);t.splice(e,1),t=this.deleteRowValue(t,null),this.value=t}this.rowCountValue--,this.fireCallback(this.rowCountChangedCallback)}},Object.defineProperty(t.prototype,"confirmDeleteText",{get:function(){return this.locConfirmDeleteText.text?this.locConfirmDeleteText.text:s.a.getString("confirmDelete")},set:function(e){this.locConfirmDeleteText.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locConfirmDeleteText",{get:function(){return this.locConfirmDeleteTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"keyDuplicationError",{get:function(){return this.locKeyDuplicationError.text?this.locKeyDuplicationError.text:s.a.getString("keyDuplicationError")},set:function(e){this.locKeyDuplicationError.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locKeyDuplicationError",{get:function(){return this.locKeyDuplicationErrorValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"addRowText",{get:function(){return this.locAddRowText.text?this.locAddRowText.text:s.a.getString("addRow")},set:function(e){this.locAddRowText.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locAddRowText",{get:function(){return this.locAddRowTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"removeRowText",{get:function(){return this.locRemoveRowText.text?this.locRemoveRowText.text:s.a.getString("removeRow")},set:function(e){this.locRemoveRowText.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locRemoveRowText",{get:function(){return this.locRemoveRowTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"displayValue",{get:function(){var e=this.value;if(!e)return e;for(var t=this.visibleRows,n=0;n<t.length&&n<e.length;n++){var r=e[n];r&&(e[n]=this.getRowDisplayValue(t[n],r))}return e},enumerable:!0,configurable:!0}),t.prototype.supportGoNextPageAutomatic=function(){return!1},t.prototype.onCheckForErrors=function(t){e.prototype.onCheckForErrors.call(this,t),this.hasErrorInRows()&&t.push(new u.c(s.a.getString("minRowCountError").format(this.minRowCount)))},t.prototype.hasErrors=function(t){void 0===t&&(t=!0);var n=e.prototype.hasErrors.call(this,t);return this.isValueDuplicated()||n},t.prototype.hasErrorInRows=function(){if(this.minRowCount<=0||!this.generatedVisibleRows)return!1;for(var e=0,t=0;t<this.generatedVisibleRows.length;t++){this.generatedVisibleRows[t].isEmpty||e++}return e<this.minRowCount},t.prototype.isValueDuplicated=function(){if(!this.keyName||!this.generatedVisibleRows)return!1;var e=this.getColumnName(this.keyName);if(!e)return!1;for(var t=[],n=!1,r=0;r<this.generatedVisibleRows.length;r++)n=this.isValueDuplicatedInRow(this.generatedVisibleRows[r],e,t)||n;return n},t.prototype.isValueDuplicatedInRow=function(e,t,n){var r=e.getQuestionByColumn(t);if(!r||r.isEmpty())return!1;for(var i=r.value,o=0;o<n.length;o++)if(i==n[o])return r.addError(new u.c(this.keyDuplicationError)),!0;return n.push(i),!1},t.prototype.generateRows=function(){var e=new Array;if(0===this.rowCount)return e;for(var t=this.createNewValue(this.value),n=0;n<this.rowCount;n++)e.push(this.createMatrixRow(this.getRowValueByIndex(t,n)));return e},t.prototype.createMatrixRow=function(e){var t=new c(this.rowCounter++,this,e);return this.onMatrixRowCreated(t),t},t.prototype.onBeforeValueChanged=function(e){var t=e&&Array.isArray(e)?e.length:0;t<=this.rowCount||(this.rowCountValue=t,this.generatedVisibleRows&&(this.generatedVisibleRows=null,this.generatedVisibleRows=this.visibleRows))},t.prototype.createNewValue=function(e){var t=e;t||(t=[]);t.length>this.rowCount&&t.splice(this.rowCount-1);for(var n=t.length;n<this.rowCount;n++)t.push({});return t},t.prototype.deleteRowValue=function(e,t){for(var n=!0,r=0;r<e.length;r++)if(Object.keys(e[r]).length>0){n=!1;break}return n?null:e},t.prototype.getRowValueByIndex=function(e,t){return t>=0&&t<e.length?e[t]:null},t.prototype.getRowValueCore=function(e,t,n){return void 0===n&&(n=!1),this.getRowValueByIndex(t,this.generatedVisibleRows.indexOf(e))},t}(i.d);h.MaxRowCount=100,o.a.metaData.addClass("matrixdynamic",[{name:"rowCount:number",default:2},{name:"minRowCount:number",default:0},{name:"maxRowCount:number",default:h.MaxRowCount},{name:"keyName"},{name:"keyDuplicationError",serializationProperty:"locKeyDuplicationError"},{name:"confirmDelete:boolean"},{name:"confirmDeleteText",serializationProperty:"locConfirmDeleteText"},{name:"addRowText",serializationProperty:"locAddRowText"},{name:"removeRowText",serializationProperty:"locRemoveRowText"}],function(){return new h("")},"matrixdropdownbase"),a.a.Instance.registerQuestion("matrixdynamic",function(e){var t=new h(e);return t.choices=[1,2,3,4,5],i.d.addDefaultColumns(t),t})},function(e,t,n){"use strict";var r=n(0),i=n(5),o=n(29),a=n(9),s=n(3),u=n(6),l=n(10),c=n(7);n.d(t,"a",function(){return h}),n.d(t,"b",function(){return p});var h=function(e){function t(t,n){void 0===t&&(t=null),void 0===n&&(n=null);var r=e.call(this)||this;r.isRequired=!1,r.inputTypeValue="text",r.validators=new Array,r.nameValue=t,r.locTitleValue=new c.a(r,!0);var i=r;return r.locTitleValue.onRenderedHtmlCallback=function(e){return i.getFullTitle(e)},r.title=n,r.locPlaceHolderValue=new c.a(r),r}return r.b(t,e),t.prototype.getType=function(){return"multipletextitem"},Object.defineProperty(t.prototype,"name",{get:function(){return this.nameValue},set:function(e){this.name!==e&&(this.nameValue=e,this.locTitleValue.onChanged())},enumerable:!0,configurable:!0}),t.prototype.setData=function(e){this.data=e},Object.defineProperty(t.prototype,"inputType",{get:function(){return this.inputTypeValue},set:function(e){this.inputTypeValue=e.toLowerCase()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return this.locTitle.text?this.locTitle.text:this.name},set:function(e){this.locTitle.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locTitle",{get:function(){return this.locTitleValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fullTitle",{get:function(){return this.getFullTitle(this.locTitle.textOrHtml)},enumerable:!0,configurable:!0}),t.prototype.getFullTitle=function(e){return e||(e=this.name),this.isRequired&&this.data&&(e=this.data.getIsRequiredText()+" "+e),e},Object.defineProperty(t.prototype,"placeHolder",{get:function(){return this.locPlaceHolder.text},set:function(e){this.locPlaceHolder.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locPlaceHolder",{get:function(){return this.locPlaceHolderValue},enumerable:!0,configurable:!0}),t.prototype.onLocaleChanged=function(){this.locTitle.onChanged()},Object.defineProperty(t.prototype,"value",{get:function(){return this.data?this.data.getMultipleTextValue(this.name):null},set:function(e){null!=this.data&&this.data.setMultipleTextValue(this.name,e)},enumerable:!0,configurable:!0}),t.prototype.onValueChanged=function(e){this.onValueChangedCallback&&this.onValueChangedCallback(e)},t.prototype.getValidatorTitle=function(){return this.title},t.prototype.getLocale=function(){return this.data?this.data.getLocale():""},t.prototype.getMarkdownHtml=function(e){return this.data?this.data.getMarkdownHtml(e):null},t}(i.b),p=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n.colCountValue=1,n.itemSize=25,n.itemsValues=new Array,n.isMultipleItemValueChanging=!1,n.setItemsOverriddenMethods(),n}return r.b(t,e),t.prototype.getType=function(){return"multipletext"},Object.defineProperty(t.prototype,"items",{get:function(){return this.itemsValues},set:function(e){this.itemsValues=e,this.setItemsOverriddenMethods(),this.fireCallback(this.colCountChangedCallback)},enumerable:!0,configurable:!0}),t.prototype.addItem=function(e,t){void 0===t&&(t=null);var n=this.createTextItem(e,t);return this.items.push(n),n},t.prototype.onLocaleChanged=function(){e.prototype.onLocaleChanged.call(this);for(var t=0;t<this.items.length;t++)this.items[t].onLocaleChanged()},t.prototype.setItemsOverriddenMethods=function(){var e=this;this.itemsValues.push=function(t){t.setData(e);var n=Array.prototype.push.call(this,t);return e.fireCallback(e.colCountChangedCallback),n},this.itemsValues.splice=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];t||(t=0),n||(n=0);var o=(s=Array.prototype.splice).call.apply(s,[e.itemsValues,t,n].concat(r));r||(r=[]);for(var a=0;a<r.length;a++)r[a].setData(e);return e.fireCallback(e.colCountChangedCallback),o;var s}},t.prototype.supportGoNextPageAutomatic=function(){for(var e=0;e<this.items.length;e++)if(!this.items[e].value)return!1;return!0},Object.defineProperty(t.prototype,"colCount",{get:function(){return this.colCountValue},set:function(e){e<1||e>4||(this.colCountValue=e,this.fireCallback(this.colCountChangedCallback))},enumerable:!0,configurable:!0}),t.prototype.getRows=function(){for(var e=this.colCount,t=this.items,n=[],r=0,i=0;i<t.length;i++)0==r&&n.push([]),n[n.length-1].push(t[i]),++r>=e&&(r=0);return n},t.prototype.onValueChanged=function(){e.prototype.onValueChanged.call(this),this.onItemValueChanged()},t.prototype.createTextItem=function(e,t){return new h(e,t)},t.prototype.onItemValueChanged=function(){if(!this.isMultipleItemValueChanging)for(var e=0;e<this.items.length;e++){var t=null;this.value&&this.items[e].name in this.value&&(t=this.value[this.items[e].name]),this.items[e].onValueChanged(t)}},t.prototype.runValidators=function(){var t=e.prototype.runValidators.call(this);if(null!=t)return t;for(var n=0;n<this.items.length;n++)if(null!=(t=(new o.a).run(this.items[n])))return t;return null},t.prototype.hasErrors=function(t){void 0===t&&(t=!0);var n=e.prototype.hasErrors.call(this,t);return n||(n=this.hasErrorInItems(t)),n},t.prototype.hasErrorInItems=function(e){for(var t=0;t<this.items.length;t++){var n=this.items[t];if(n.isRequired&&!n.value)return this.errors.push(new l.a),e&&this.fireCallback(this.errorsChangedCallback),!0}return!1},t.prototype.getMultipleTextValue=function(e){return this.value?this.value[e]:null},t.prototype.setMultipleTextValue=function(e,t){this.isMultipleItemValueChanging=!0;var n=this.value;n||(n={}),n[e]=t,this.setNewValue(n),this.isMultipleItemValueChanging=!1},t.prototype.getIsRequiredText=function(){return this.survey?this.survey.requiredText:""},t}(a.a);s.a.metaData.addClass("multipletextitem",["name","isRequired:boolean",{name:"placeHolder",serializationProperty:"locPlaceHolder"},{name:"inputType",default:"text",choices:["color","date","datetime","datetime-local","email","month","number","password","range","tel","text","time","url","week"]},{name:"title",serializationProperty:"locTitle"},{name:"validators:validators",baseClassName:"surveyvalidator",classNamePart:"validator"}],function(){return new h("")}),s.a.metaData.addClass("multipletext",[{name:"!items:textitems",className:"multipletextitem"},{name:"itemSize:number",default:25},{name:"colCount:number",default:1,choices:[1,2,3,4]}],function(){return new p("")},"question"),u.a.Instance.registerQuestion("multipletext",function(e){var t=new p(e);return t.addItem("text1"),t.addItem("text2"),t})},function(e,t,n){"use strict";var r=n(0),i=n(5),o=n(1),a=n(7),s=n(17),u=n(14),l=n(9),c=n(21),h=n(3),p=n(6),d=n(10);n.d(t,"b",function(){return f}),n.d(t,"a",function(){return m});var f=function(){function e(e,t){this.textPreProcessor=new s.a,this.data=e,this.panelValue=t,this.panel.setSurveyImpl(this),this.panel.updateCustomWidgets();var n=this;this.textPreProcessor=new s.a,this.textPreProcessor.onHasValue=function(e){return n.hasProcessedTextValue(e)},this.textPreProcessor.onProcess=function(e,t){return n.getProcessedTextValue(e,t)}}return Object.defineProperty(e.prototype,"panel",{get:function(){return this.panelValue},enumerable:!0,configurable:!0}),e.prototype.runCondition=function(e){this.panel.runCondition(e)},e.prototype.getValue=function(e){return this.data.getPanelItemData(this)[e]},e.prototype.setValue=function(e,t){this.data.setPanelItemData(this,e,t)},e.prototype.getComment=function(e){var t=this.getValue(e+i.b.commentPrefix);return t||""},e.prototype.setComment=function(e,t){this.setValue(e+i.b.commentPrefix,t)},e.prototype.onSurveyValueChanged=function(){for(var e=this.panel.questions,t=this.data.getPanelItemData(this),n=0;n<e.length;n++){var r=e[n];r.onSurveyValueChanged(t[r.name])}},e.prototype.setVisibleIndex=function(e,t){return i.a.setVisibleIndex(this.panel.questions,e,t)},e.prototype.getAllValues=function(){return this.data.getPanelItemData(this)},e.prototype.geSurveyData=function(){return this},e.prototype.getSurvey=function(){return this.data?this.data.getSurvey():null},e.prototype.getTextProcessor=function(){return this},e.prototype.hasProcessedTextValue=function(t){return t==e.IndexVariableName||(new u.a).getFirstName(t)==e.ItemVariableName},e.prototype.getProcessedTextValue=function(t,n){if(t==e.IndexVariableName)return this.data.getItemIndex(this)+1;t=t.replace(e.ItemVariableName+".","");var r=(new u.a).getFirstName(t),i=this.panel.getQuestionByName(r);if(!i)return null;var o={};return o[r]=n?i.displayValue:i.value,(new u.a).getValue(t,o)},e.prototype.processText=function(e,t){e=this.textPreProcessor.process(e,t);var n=this.getSurvey();return n?n.processText(e,t):e},e.prototype.processTextEx=function(e){e=this.processText(e,!0);var t=this.textPreProcessor.hasAllValuesOnLastRun,n={hasAllValuesOnLastRun:!0,text:e};return this.getSurvey()&&(n=this.getSurvey().processTextEx(e)),n.hasAllValuesOnLastRun=n.hasAllValuesOnLastRun&&t,n},e.prototype.onAnyValueChanged=function(t){this.panel.onAnyValueChanged(t),this.panel.onAnyValueChanged(e.ItemVariableName)},e}();f.ItemVariableName="panel",f.IndexVariableName="panelIndex";var m=function(e){function t(n){var r=e.call(this,n)||this;r.name=n,r.itemsValue=new Array,r.loadingPanelCount=0,r.minPanelCountValue=0,r.maxPanelCountValue=t.MaxPanelCount,r.renderModeValue="list",r.showQuestionNumbersValue="off",r.showRangeInProgressValue=!0,r.currentIndexValue=-1,r.confirmDelete=!1,r.keyName="",r.templateValue=r.createNewPanelObject(),r.template.renderWidth="100%",r.template.selectedElementInDesign=r;var i=r;return r.oldTemplateRowsChangedCallback=r.template.rowsChangedCallback,r.template.rowsChangedCallback=function(){i.templateOnRowsChanged(),i.oldTemplateRowsChangedCallback&&i.oldTemplateRowsChangedCallback()},r.locKeyDuplicationErrorValue=new a.a(r),r.locConfirmDeleteTextValue=new a.a(r),r.locPanelAddTextValue=new a.a(r),r.locPanelRemoveTextValue=new a.a(r),r.locPanelPrevTextValue=new a.a(r),r.locPanelNextTextValue=new a.a(r),r}return r.b(t,e),t.prototype.templateOnRowsChanged=function(){this.isLoadingFromJson||this.rebuildPanels()},t.prototype.getType=function(){return"paneldynamic"},Object.defineProperty(t.prototype,"template",{get:function(){return this.templateValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"templateElements",{get:function(){return this.template.elements},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"templateTitle",{get:function(){return this.template.title},set:function(e){this.template.title=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locTemplateTitle",{get:function(){return this.template.locTitle},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"items",{get:function(){return this.itemsValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"panels",{get:function(){for(var e=[],t=0;t<this.items.length;t++)e.push(this.items[t].panel);return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentIndex",{get:function(){return this.isRenderModeList?-1:(this.currentIndexValue<0&&this.panelCount>0&&(this.currentIndexValue=0),this.currentIndexValue>=this.panelCount&&(this.currentIndexValue=this.panelCount-1),this.currentIndexValue)},set:function(e){e>=this.panelCount&&(e=this.panelCount-1),this.currentIndexValue=e,this.fireCallback(this.currentIndexChangedCallback)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentPanel",{get:function(){var e=this.currentIndex;return e<0||e>=this.panels.length?null:this.panels[e]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"confirmDeleteText",{get:function(){return this.locConfirmDeleteText.text?this.locConfirmDeleteText.text:o.a.getString("confirmDelete")},set:function(e){this.locConfirmDeleteText.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locConfirmDeleteText",{get:function(){return this.locConfirmDeleteTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"keyDuplicationError",{get:function(){return this.locKeyDuplicationError.text?this.locKeyDuplicationError.text:o.a.getString("keyDuplicationError")},set:function(e){this.locKeyDuplicationError.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locKeyDuplicationError",{get:function(){return this.locKeyDuplicationErrorValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"panelPrevText",{get:function(){return this.locPanelPrevText.text?this.locPanelPrevText.text:o.a.getString("pagePrevText")},set:function(e){this.locPanelPrevText.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locPanelPrevText",{get:function(){return this.locPanelPrevTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"panelNextText",{get:function(){return this.locPanelNextText.text?this.locPanelNextText.text:o.a.getString("pageNextText")},set:function(e){this.locPanelNextText.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locPanelNextText",{get:function(){return this.locPanelNextTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"panelAddText",{get:function(){return this.locPanelAddText.text?this.locPanelAddText.text:o.a.getString("addPanel")},set:function(e){this.locPanelAddText.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locPanelAddText",{get:function(){return this.locPanelAddTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"panelRemoveText",{get:function(){return this.locPanelRemoveText.text?this.locPanelRemoveText.text:o.a.getString("removePanel")},set:function(e){this.locPanelRemoveText.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locPanelRemoveText",{get:function(){return this.locPanelRemoveTextValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isProgressTopShowing",{get:function(){return"progressTop"==this.renderMode||"progressTopBottom"==this.renderMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isProgressBottomShowing",{get:function(){return"progressBottom"==this.renderMode||"progressTopBottom"==this.renderMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isPrevButtonShowing",{get:function(){return this.currentIndex>0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isNextButtonShowing",{get:function(){return this.currentIndex>=0&&this.currentIndex<this.panelCount-1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRangeShowing",{get:function(){return this.showRangeInProgress&&this.currentIndex>=0&&this.panelCount>1},enumerable:!0,configurable:!0}),t.prototype.getElementsInDesign=function(e){return void 0===e&&(e=!1),e?[this.template]:this.templateElements},Object.defineProperty(t.prototype,"panelCount",{get:function(){return this.isLoadingFromJson?this.loadingPanelCount:this.items.length},set:function(e){if(!(e<0)){if(this.isLoadingFromJson)return void(this.loadingPanelCount=e);if(e!=this.items.length&&!this.isDesignMode){for(var t=this.panelCount;t<e;t++)this.items.push(this.createNewItem());e<this.panelCount&&this.items.splice(e,this.panelCount-e),this.setValueBasedOnPanelCount(),this.reRunCondition(),this.fireCallback(this.panelCountChangedCallback)}}},enumerable:!0,configurable:!0}),t.prototype.setValueBasedOnPanelCount=function(){var e=this.value;if(e&&Array.isArray(e)||(e=[]),e.length!=this.panelCount){for(var t=e.length;t<this.panelCount;t++)e.push({});e.length>this.panelCount&&e.splice(this.panelCount,e.length-this.panelCount),this.value=e}},Object.defineProperty(t.prototype,"minPanelCount",{get:function(){return this.minPanelCountValue},set:function(e){e<0&&(e=0),e==this.minPanelCount||e>this.maxPanelCount||(this.minPanelCountValue=e,this.panelCount<e&&(this.panelCount=e))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxPanelCount",{get:function(){return this.maxPanelCountValue},set:function(e){e<=0||(e>t.MaxPanelCount&&(e=t.MaxPanelCount),e==this.maxPanelCount||e<this.minPanelCount||(this.maxPanelCountValue=e,this.panelCount>e&&(this.panelCount=e)))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showQuestionNumbers",{get:function(){return this.showQuestionNumbersValue},set:function(e){this.showQuestionNumbersValue=e,!this.isLoadingFromJson&&this.survey&&this.survey.questionVisibilityChanged(this,this.visible)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showRangeInProgress",{get:function(){return this.showRangeInProgressValue},set:function(e){this.showRangeInProgressValue=e,this.fireCallback(this.currentIndexChangedCallback)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderMode",{get:function(){return this.renderModeValue},set:function(e){this.renderModeValue=e,this.fireCallback(this.renderModeChangedCallback)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRenderModeList",{get:function(){return"list"==this.renderMode},enumerable:!0,configurable:!0}),t.prototype.setVisibleIndex=function(t){for(var n="onSurvey"==this.showQuestionNumbers?t:0,r=0;r<this.items.length;r++){var i=this.items[r].setVisibleIndex(n,"off"!=this.showQuestionNumbers);"onSurvey"==this.showQuestionNumbers&&(n+=i)}return e.prototype.setVisibleIndex.call(this,"onSurvey"!=this.showQuestionNumbers?t:-1),"onSurvey"!=this.showQuestionNumbers?1:n-t},Object.defineProperty(t.prototype,"canAddPanel",{get:function(){return!this.isReadOnly&&this.panelCount<this.maxPanelCount},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canRemovePanel",{get:function(){return!this.isReadOnly&&this.panelCount>this.minPanelCount},enumerable:!0,configurable:!0}),t.prototype.rebuildPanels=function(){var e=new Array;if(this.isDesignMode)e.push(new f(this,this.template)),this.oldTemplateRowsChangedCallback&&this.oldTemplateRowsChangedCallback();else for(var t=0;t<this.panelCount;t++)e.push(this.createNewItem());this.itemsValue=e,this.reRunCondition(),this.fireCallback(this.panelCountChangedCallback)},t.prototype.addPanel=function(){return this.canAddPanel?(this.panelCount++,this.isRenderModeList||(this.currentIndex=this.panelCount-1),this.items[this.panelCount-1].panel):null},t.prototype.removePanelUI=function(e){this.confirmDelete&&!confirm(this.confirmDeleteText)||this.removePanel(e)},t.prototype.removePanel=function(e){if(this.canRemovePanel){var t=this.getPanelIndex(e);if(!(t<0||t>=this.panelCount)){this.items.splice(t,1);var e=this.value;!e||!Array.isArray(e)||t>=e.length||(e.splice(t,1),this.value=e,this.fireCallback(this.panelCountChangedCallback))}}},t.prototype.getPanelIndex=function(e){if(!isNaN(parseFloat(e))&&isFinite(e))return e;for(var t=0;t<this.items.length;t++)if(this.items[t]===e||this.items[t].panel===e)return t;return-1},t.prototype.onSurveyLoad=function(){this.loadingPanelCount>0&&(this.panelCount=this.loadingPanelCount),this.isDesignMode&&this.rebuildPanels(),e.prototype.onSurveyLoad.call(this)},t.prototype.runCondition=function(t){e.prototype.runCondition.call(this,t),this.runPanelsCondition(t)},t.prototype.reRunCondition=function(){this.data&&this.runCondition(this.data.getAllValues())},t.prototype.runPanelsCondition=function(e){var t={};e&&e instanceof Object&&(t=JSON.parse(JSON.stringify(e)));for(var n=0;n<this.items.length;n++)t[f.ItemVariableName]=this.getPanelItemData(this.items[n]),this.items[n].runCondition(t)},t.prototype.onAnyValueChanged=function(t){e.prototype.onAnyValueChanged.call(this,t);for(var n=0;n<this.items.length;n++)this.items[n].onAnyValueChanged(t)},t.prototype.hasErrors=function(t){void 0===t&&(t=!0);var n=this.hasErrorInPanels(t);return e.prototype.hasErrors.call(this,t)||n},t.prototype.getAllErrors=function(){for(var t=e.prototype.getAllErrors.call(this),n=0;n<this.panels.length;n++)for(var r=this.panels[n].questions,i=0;i<r.length;i++){var o=r[i].getAllErrors();o&&o.length>0&&(t=t.concat(o))}return t},t.prototype.hasErrorInPanels=function(e){for(var t=!1,n=this.panels,r=[],i=0;i<n.length;i++){var o=n[i].hasErrors(e);o=this.isValueDuplicated(n[i],r)||o,this.isRenderModeList||!o||t||(this.currentIndex=i),t=o||t}return t},t.prototype.isValueDuplicated=function(e,t){if(!this.keyName)return!1;var n=e.getQuestionByName(this.keyName);if(!n||n.isEmpty())return!1;for(var r=n.value,i=0;i<t.length;i++)if(r==t[i])return n.addError(new d.c(this.keyDuplicationError)),!0;return t.push(r),!1},t.prototype.createNewItem=function(){return new f(this,this.createNewPanel())},t.prototype.createNewPanel=function(){var e=this.createNewPanelObject(),t=new h.a,n=t.toJsonObject(this.template);return t.toObject(n,e),e.renderWidth="100%",e},t.prototype.createNewPanelObject=function(){return new c.b},t.prototype.onValueChanged=function(){if(!this.isValueChangingInternally){var e=this.value,t=e&&Array.isArray(e)?e.length:0;t<=this.panelCount||(this.panelCount=t)}},t.prototype.onSurveyValueChanged=function(t){e.prototype.onSurveyValueChanged.call(this,t);for(var n=0;n<this.items.length;n++)this.items[n].onSurveyValueChanged()},t.prototype.onSetData=function(){e.prototype.onSetData.call(this),this.isDesignMode&&(this.template.setSurveyImpl(this.surveyImpl),this.isLoadingFromJson||this.rebuildPanels())},t.prototype.getItemIndex=function(e){return this.items.indexOf(e)},t.prototype.getPanelItemData=function(e){var t=this.items.indexOf(e);if(t<0)return{};var n=this.value;return!n||!Array.isArray(n)||n.length<=t?{}:n[t]},t.prototype.setPanelItemData=function(e,t,n){var r=this.items.indexOf(e);if(!(r<0)){var i=this.value;!i||!Array.isArray(i)||i.length<=r||(i[r]||(i[r]={}),i[r][t]=n,this.isValueChangingInternally=!0,this.value=i,this.isValueChangingInternally=!1)}},t.prototype.getSurvey=function(){return this.survey},t}(l.a);m.MaxPanelCount=100,h.a.metaData.addClass("paneldynamic",[{name:"templateElements",alternativeName:"questions",visible:!1},{name:"templateTitle:text",serializationProperty:"locTemplateTitle"},{name:"panelCount:number",default:0,choices:[0,1,2,3,4,5,6,7,8,9,10]},{name:"minPanelCount:number",default:0},{name:"maxPanelCount:number",default:m.MaxPanelCount},{name:"keyName"},{name:"keyDuplicationError",serializationProperty:"locKeyDuplicationError"},{name:"confirmDelete:boolean"},{name:"confirmDeleteText",serializationProperty:"locConfirmDeleteText"},{name:"panelAddText",serializationProperty:"locPanelAddText"},{name:"panelRemoveText",serializationProperty:"locPanelRemoveText"},{name:"panelPrevText",serializationProperty:"locPanelPrevText"},{name:"panelNextText",serializationProperty:"locPanelNextText"},{name:"showQuestionNumbers",default:"off",choices:["off","onPanel","onSurvey"]},{name:"showRangeInProgress",default:!0},{name:"renderMode",default:"list",choices:["list","progressTop","progressBottom","progressTopBottom"]}],function(){return new m("")},"question"),p.a.Instance.registerQuestion("paneldynamic",function(e){return new m(e)})},function(e,t,n){"use strict";var r=n(0),i=n(3),o=n(6),a=n(16);n.d(t,"a",function(){return s});var s=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n}return r.b(t,e),t.prototype.getType=function(){return"radiogroup"},t.prototype.supportGoNextPageAutomatic=function(){return!0},t}(a.a);i.a.metaData.addClass("radiogroup",[],function(){return new s("")},"checkboxbase"),o.a.Instance.registerQuestion("radiogroup",function(e){var t=new s(e);return t.choices=o.a.DefaultChoices,t})},function(e,t,n){"use strict";var r=n(0),i=n(12),o=n(9),a=n(3),s=n(6),u=n(7);n.d(t,"a",function(){return l});var l=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n.rates=i.a.createArray(n),n.locMinRateDescriptionValue=new u.a(n,!0),n.locMaxRateDescriptionValue=new u.a(n,!0),n.locMinRateDescriptionValue.onRenderedHtmlCallback=function(e){return e?e+" ":e},n.locMaxRateDescriptionValue.onRenderedHtmlCallback=function(e){return e?" "+e:e},n}return r.b(t,e),Object.defineProperty(t.prototype,"rateValues",{get:function(){return this.rates},set:function(e){i.a.setData(this.rates,e),this.fireCallback(this.rateValuesChangedCallback)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"visibleRateValues",{get:function(){return this.rateValues.length>0?this.rateValues:t.defaultRateValues},enumerable:!0,configurable:!0}),t.prototype.getType=function(){return"rating"},t.prototype.supportGoNextPageAutomatic=function(){return!0},t.prototype.supportComment=function(){return!0},t.prototype.supportOther=function(){return!0},Object.defineProperty(t.prototype,"minRateDescription",{get:function(){return this.locMinRateDescription.text},set:function(e){this.locMinRateDescription.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locMinRateDescription",{get:function(){return this.locMinRateDescriptionValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxRateDescription",{get:function(){return this.locMaxRateDescription.text},set:function(e){this.locMaxRateDescription.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locMaxRateDescription",{get:function(){return this.locMaxRateDescriptionValue},enumerable:!0,configurable:!0}),t}(o.a);l.defaultRateValues=[],i.a.setData(l.defaultRateValues,[1,2,3,4,5]),a.a.metaData.addClass("rating",["hasComment:boolean",{name:"rateValues:itemvalues",onGetValue:function(e){return i.a.getData(e.rateValues)},onSetValue:function(e,t){e.rateValues=t}},{name:"minRateDescription",alternativeName:"mininumRateDescription",serializationProperty:"locMinRateDescription"},{name:"maxRateDescription",alternativeName:"maximumRateDescription",serializationProperty:"locMaxRateDescription"}],function(){return new l("")},"question"),s.a.Instance.registerQuestion("rating",function(e){return new l(e)})},function(e,t,n){"use strict";var r=n(0),i=n(6),o=n(3),a=n(9),s=n(7);n.d(t,"a",function(){return u});var u=function(e){function t(t){var n=e.call(this,t)||this;return n.name=t,n.size=25,n.inputTypeValue="text",n.locPlaceHolderValue=new s.a(n),n}return r.b(t,e),t.prototype.getType=function(){return"text"},Object.defineProperty(t.prototype,"inputType",{get:function(){return this.inputTypeValue},set:function(e){var t=e.toLowerCase();this.inputTypeValue="datetime_local"===t?"datetime-local":t},enumerable:!0,configurable:!0}),t.prototype.isEmpty=function(){return e.prototype.isEmpty.call(this)||""===this.value},t.prototype.supportGoNextPageAutomatic=function(){return!0},Object.defineProperty(t.prototype,"placeHolder",{get:function(){return this.locPlaceHolder.text},set:function(e){this.locPlaceHolder.text=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locPlaceHolder",{get:function(){return this.locPlaceHolderValue},enumerable:!0,configurable:!0}),t.prototype.setNewValue=function(t){t=this.correctValueType(t),e.prototype.setNewValue.call(this,t)},t.prototype.correctValueType=function(e){return e&&("number"==this.inputType||"range"==this.inputType)?this.isNumber(e)?parseFloat(e):"":e},t.prototype.isNumber=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},t}(a.a);o.a.metaData.addClass("text",[{name:"inputType",default:"text",choices:["color","date","datetime","datetime-local","email","month","number","password","range","tel","text","time","url","week"]},{name:"size:number",default:25},{name:"placeHolder",serializationProperty:"locPlaceHolder"}],function(){return new u("")},"question"),i.a.Instance.registerQuestion("text",function(e){return new u(e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(8);n.d(t,"a",function(){return s});var s=function(e){function t(t){var n=e.call(this,t)||this;return n.handleOnChange=n.handleOnChange.bind(n),n}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.handleOnChange=function(e){this.question.checkedValue=e.target.checked,this.setState({value:this.question.checkedValue})},t.prototype.componentDidMount=function(){if(this.question&&this.question.isIndeterminate){var e=this.refs.check;e&&(e.indeterminate=!0)}},t.prototype.render=function(){if(!this.question)return null;var e=this.question.cssClasses,t=this.renderLocString(this.question.locDisplayLabel);return i.createElement("div",{className:e.item},i.createElement("label",{className:e.item},i.createElement("input",{ref:"check",type:"checkbox",value:this.question.checkedValue,id:this.question.inputId,disabled:this.isDisplayMode,checked:this.question.checkedValue,onChange:this.handleOnChange}),i.createElement("span",{className:"checkbox-material",style:{marginRight:"3px"}},i.createElement("span",{className:"check"})),i.createElement("span",null,t)))},t}(o.b);a.a.Instance.registerQuestion("boolean",function(e){return i.createElement(s,e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(13),s=n(8);n.d(t,"a",function(){return u}),n.d(t,"b",function(){return l});var u=function(e){function t(t){var n=e.call(this,t)||this;n.state={choicesChanged:0};var r=n;return n.question.choicesChangedCallback=function(){r.state.choicesChanged=r.state.choicesChanged+1,r.setState(r.state)},n}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.render=function(){if(!this.question)return null;var e=this.question.cssClasses;return i.createElement("div",{className:e.root},this.getItems(e))},t.prototype.getItems=function(e){for(var t=[],n=0;n<this.question.visibleChoices.length;n++){var r=this.question.visibleChoices[n],i="item"+n;t.push(this.renderItem(i,r,0==n,e))}return t},Object.defineProperty(t.prototype,"textStyle",{get:function(){return null},enumerable:!0,configurable:!0}),t.prototype.renderItem=function(e,t,n,r){return i.createElement(l,{key:e,question:this.question,cssClasses:r,isDisplayMode:this.isDisplayMode,item:t,textStyle:this.textStyle,isFirst:n})},t}(o.b),l=function(e){function t(t){var n=e.call(this,t)||this;return n.item=t.item,n.question=t.question,n.textStyle=t.textStyle,n.isFirst=t.isFirst,n.handleOnChange=n.handleOnChange.bind(n),n}return r.b(t,e),t.prototype.shouldComponentUpdate=function(){return!this.question.customWidget||!!this.question.customWidgetData.isNeedRender||!!this.question.customWidget.widgetJson.render},t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.item=t.item,this.textStyle=t.textStyle,this.question=t.question,this.isFirst=t.isFirst},t.prototype.handleOnChange=function(e){var t=this.question.value;t||(t=[]);var n=t.indexOf(this.item.value);e.target.checked?n<0&&t.push(this.item.value):n>-1&&t.splice(n,1),this.question.value=t,this.setState({value:this.question.value})},t.prototype.render=function(){if(!this.item||!this.question)return null;var e=this.question.colCount>0?100/this.question.colCount+"%":"",t=0==this.question.colCount?"5px":"0px",n={marginRight:t,display:"inline-block"};e&&(n.width=e);var r=this.question.value&&this.question.value.indexOf(this.item.value)>-1||!1,i=this.item.value===this.question.otherItem.value&&r?this.renderOther():null;return this.renderCheckbox(r,n,i)},Object.defineProperty(t.prototype,"inputStyle",{get:function(){return{marginRight:"3px"}},enumerable:!0,configurable:!0}),t.prototype.renderCheckbox=function(e,t,n){var r=this.isFirst?this.question.inputId:null,o=this.renderLocString(this.item.locText);return i.createElement("div",{className:this.cssClasses.item,style:t},i.createElement("label",{className:this.cssClasses.item},i.createElement("input",{type:"checkbox",value:this.item.value,id:r,style:this.inputStyle,disabled:this.isDisplayMode,checked:e,onChange:this.handleOnChange}),i.createElement("span",{className:"checkbox-material",style:{marginRight:"5px"}},i.createElement("span",{className:"check"})),i.createElement("span",null,o)),n)},t.prototype.renderOther=function(){return i.createElement("div",{className:this.cssClasses.other},i.createElement(a.a,{question:this.question,otherCss:this.cssClasses.other,cssClasses:this.cssClasses,isDisplayMode:this.isDisplayMode}))},t}(o.c);s.a.Instance.registerQuestion("checkbox",function(e){return i.createElement(u,e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(13),s=n(8),u=n(97);n.d(t,"a",function(){return l});var l=function(e){function t(t){var n=e.call(this,t)||this;n.state={value:n.question.value||"",choicesChanged:0};var r=n;return n.question.choicesChangedCallback=function(){r.state.choicesChanged=r.state.choicesChanged+1,r.setState(r.state)},n.handleOnChange=n.handleOnChange.bind(n),n}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.state.value=this.question.value||""},t.prototype.handleOnChange=function(e){this.question.value=e.target.value,this.setState({value:this.question.value||""})},t.prototype.render=function(){if(!this.question)return null;var e=this.question.cssClasses,t=this.question.value===this.question.otherItem.value?this.renderOther(e):null,n=this.renderSelect(e);return i.createElement("div",{className:e.root},n,t)},t.prototype.renderSelect=function(e){if(this.isDisplayMode)return i.createElement("div",{id:this.question.inputId,className:e.control},this.question.displayValue);for(var t=[],r=0;r<this.question.visibleChoices.length;r++){var o=this.question.visibleChoices[r],a="item"+r,s=i.createElement("option",{key:a,value:o.value},o.text);t.push(s)}var l=null;return(u.a.msie||u.a.firefox&&n.i(u.b)(u.a.version,"51")<0)&&(l=this.handleOnChange),i.createElement("select",{id:this.question.inputId,className:e.control,value:this.state.value,onChange:l,onInput:this.handleOnChange},i.createElement("option",{value:""},this.question.optionsCaption),t)},t.prototype.renderOther=function(e){var t={marginTop:"3px"};return i.createElement("div",{style:t},i.createElement(a.a,{question:this.question,otherCss:e.other,cssClasses:e,isDisplayMode:this.isDisplayMode}))},t}(o.b);s.a.Instance.registerQuestion("dropdown",function(e){return i.createElement(l,e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(8);n.d(t,"a",function(){return s});var s=function(e){function t(t){var n=e.call(this,t)||this;return n.state={fileLoaded:0},n.handleOnChange=n.handleOnChange.bind(n),n}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.handleOnChange=function(e){var t=e.target||e.srcElement;window.FileReader&&(!t||!t.files||t.files.length<1||(this.question.loadFile(t.files[0]),this.setState({fileLoaded:this.state.fileLoaded+1})))},t.prototype.render=function(){if(!this.question)return null;var e=this.renderImage(),t=null;return this.isDisplayMode||(t=i.createElement("input",{id:this.question.inputId,type:"file",onChange:this.handleOnChange})),i.createElement("div",null,t,e)},t.prototype.renderImage=function(){return this.question.previewValue?i.createElement("div",null," ",i.createElement("img",{src:this.question.previewValue,height:this.question.imageHeight,width:this.question.imageWidth})):null},t}(o.b);a.a.Instance.registerQuestion("file",function(e){return i.createElement(s,e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(8);n.d(t,"a",function(){return s});var s=function(e){function t(t){return e.call(this,t)||this}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.render=function(){if(!this.question||!this.question.html)return null;var e={__html:this.question.processedHtml};return i.createElement("div",{dangerouslySetInnerHTML:e})},t}(o.b);a.a.Instance.registerQuestion("html",function(e){return i.createElement(s,e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(8);n.d(t,"a",function(){return s}),n.d(t,"b",function(){return u});var s=function(e){function t(t){return e.call(this,t)||this}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.render=function(){if(!this.question)return null;for(var e=this.question.cssClasses,t=this.question.hasRows?i.createElement("th",null):null,n=[],r=0;r<this.question.columns.length;r++){var o=this.question.columns[r],a="column"+r,s=this.renderLocString(o.locText);n.push(i.createElement("th",{key:a},s))}for(var l=[],c=this.question.visibleRows,r=0;r<c.length;r++){var h=c[r],a="row"+r;l.push(i.createElement(u,{key:a,question:this.question,cssClasses:e,isDisplayMode:this.isDisplayMode,row:h,isFirst:0==r}))}return i.createElement("table",{className:e.root},i.createElement("thead",null,i.createElement("tr",null,t,n)),i.createElement("tbody",null,l))},t}(o.b),u=function(e){function t(t){var n=e.call(this,t)||this;return n.question=t.question,n.row=t.row,n.isFirst=t.isFirst,n.handleOnChange=n.handleOnChange.bind(n),n}return r.b(t,e),t.prototype.handleOnChange=function(e){this.row.value=e.target.value,this.setState({value:this.row.value})},t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.question=t.question,this.row=t.row,this.isFirst=t.isFirst},t.prototype.render=function(){if(!this.row)return null;var e=null;if(this.question.hasRows){var t=this.renderLocString(this.row.locText);e=i.createElement("td",null,t)}for(var n=[],r=0;r<this.question.columns.length;r++){var o=this.question.columns[r],a="value"+r,s=this.row.value==o.value,u=this.isFirst&&0==r?this.question.inputId:null,l={margin:"0",position:"absolute"},c=i.createElement("td",{key:a},i.createElement("label",{className:this.cssClasses.label,style:l},i.createElement("input",{id:u,type:"radio",className:this.cssClasses.itemValue,name:this.row.fullName,value:o.value,disabled:this.isDisplayMode,checked:s,onChange:this.handleOnChange}),i.createElement("span",{className:"circle"}),i.createElement("span",{className:"check"})));n.push(c)}return i.createElement("tr",null,e,n)},t}(o.c);a.a.Instance.registerQuestion("matrix",function(e){return i.createElement(s,e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(18),s=n(8),u=n(24);n.d(t,"a",function(){return l}),n.d(t,"b",function(){return c});var l=function(e){function t(t){return e.call(this,t)||this}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.render=function(){if(!this.question)return null;for(var e=this.question.cssClasses,t=[],n=0;n<this.question.columns.length;n++){var r=this.question.columns[n],o="column"+n,a=this.question.getColumnWidth(r),s=a?{minWidth:a}:{},u=this.renderLocString(r.locTitle);t.push(i.createElement("th",{key:o,style:s},u))}for(var l=[],h=this.question.visibleRows,n=0;n<h.length;n++){var p=h[n];l.push(i.createElement(c,{key:n,row:p,cssClasses:e,isDisplayMode:this.isDisplayMode,creator:this.creator}))}var d=this.question.horizontalScroll?{overflowX:"scroll"}:{};return i.createElement("div",{style:d},i.createElement("table",{className:e.root},i.createElement("thead",null,i.createElement("tr",null,i.createElement("th",null),t)),i.createElement("tbody",null,l)))},t}(o.b),c=function(e){function t(t){var n=e.call(this,t)||this;return n.setProperties(t),n}return r.b(t,e),t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.setProperties(t)},t.prototype.setProperties=function(e){this.row=e.row,this.creator=e.creator},t.prototype.render=function(){if(!this.row)return null;for(var e=[],t=0;t<this.row.cells.length;t++){var n=this.row.cells[t],r=i.createElement(a.b,{question:n.question,cssClasses:this.cssClasses,creator:this.creator}),o=this.renderSelect(n);e.push(i.createElement("td",{key:"row"+t,className:this.cssClasses.itemValue},r,o))}var s=this.renderLocString(this.row.locText);return i.createElement("tr",null,i.createElement("td",null,s),e)},t.prototype.renderSelect=function(e){return e.question.visible?e.question.customWidget?i.createElement(u.a,{creator:this.creator,question:e.question}):this.creator.createQuestionElement(e.question):null},t}(o.c);s.a.Instance.registerQuestion("matrixdropdown",function(e){return i.createElement(l,e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(18),s=n(8),u=n(24);n.d(t,"a",function(){return l}),n.d(t,"b",function(){return c});var l=function(e){function t(t){var n=e.call(this,t)||this;return n.setProperties(t),n}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.setProperties(t)},t.prototype.setProperties=function(e){var t=this;this.state={rowCounter:0},this.question.rowCountChangedCallback=function(){t.state.rowCounter=t.state.rowCounter+1,t.setState(t.state)},this.handleOnRowAddClick=this.handleOnRowAddClick.bind(this)},t.prototype.handleOnRowAddClick=function(e){this.question.addRow()},t.prototype.render=function(){if(!this.question)return null;for(var e=this.question.cssClasses,t=[],n=0;n<this.question.columns.length;n++){var r=this.question.columns[n],o="column"+n,a=this.question.getColumnWidth(r),s=a?{minWidth:a}:{},u=this.renderLocString(r.locTitle);t.push(i.createElement("th",{key:o,style:s},u))}for(var l=[],h=this.question.visibleRows,n=0;n<h.length;n++){var p=h[n];l.push(i.createElement(c,{key:n,row:p,question:this.question,index:n,cssClasses:e,isDisplayMode:this.isDisplayMode,creator:this.creator}))}var d=this.question.horizontalScroll?{overflowX:"scroll"}:{},f=this.isDisplayMode?null:i.createElement("th",null);return i.createElement("div",null,i.createElement("div",{style:d},i.createElement("table",{className:e.root},i.createElement("thead",null,i.createElement("tr",null,t,f)),i.createElement("tbody",null,l))),this.renderAddRowButton(e))},t.prototype.renderAddRowButton=function(e){return this.isDisplayMode||!this.question.canAddRow?null:i.createElement("input",{className:e.button,type:"button",onClick:this.handleOnRowAddClick,value:this.question.addRowText})},t}(o.b),c=function(e){function t(t){var n=e.call(this,t)||this;return n.setProperties(t),n}return r.b(t,e),t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.setProperties(t)},t.prototype.setProperties=function(e){this.row=e.row,this.question=e.question,this.index=e.index,this.creator=e.creator,this.handleOnRowRemoveClick=this.handleOnRowRemoveClick.bind(this)},t.prototype.handleOnRowRemoveClick=function(e){this.question.removeRowUI(this.index)},t.prototype.render=function(){if(!this.row)return null;for(var e=[],t=0;t<this.row.cells.length;t++){var n=this.row.cells[t],r=i.createElement(a.b,{question:n.question,cssClasses:this.cssClasses,creator:this.creator}),o=this.renderQuestion(n);e.push(i.createElement("td",{key:"row"+t},r,o))}if(!this.isDisplayMode&&this.question.canRemoveRow){var s=this.renderButton();e.push(i.createElement("td",{key:"row"+this.row.cells.length+1},s))}return i.createElement("tr",null,e)},t.prototype.renderQuestion=function(e){return e.question.visible?e.question.customWidget?i.createElement(u.a,{creator:this.creator,question:e.question}):this.creator.createQuestionElement(e.question):null},t.prototype.renderButton=function(){return i.createElement("input",{className:this.cssClasses.button,type:"button",onClick:this.handleOnRowRemoveClick,value:this.question.removeRowText})},t}(o.c);s.a.Instance.registerQuestion("matrixdynamic",function(e){return i.createElement(l,e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(8);n.d(t,"a",function(){return s}),n.d(t,"b",function(){return u});var s=function(e){function t(t){var n=e.call(this,t)||this;n.state={colCountChanged:0};var r=n;return n.question.colCountChangedCallback=function(){r.state.colCountChanged=r.state.colCountChanged+1,r.setState(r.state)},n}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.render=function(){if(!this.question)return null;for(var e=this.question.cssClasses,t=this.question.getRows(),n=[],r=0;r<t.length;r++)n.push(this.renderRow("item"+r,t[r],e));return i.createElement("table",{className:e.root},i.createElement("tbody",null,n))},t.prototype.renderRow=function(e,t,n){for(var r=[],o=0;o<t.length;o++){var a=t[o],s=this.renderLocString(a.locTitle);r.push(i.createElement("td",{key:"label"+o},i.createElement("span",{className:n.itemTitle},s))),r.push(i.createElement("td",{key:"value"+o},this.renderItem(a,0==o,n)))}return i.createElement("tr",{key:e,className:n.row},r)},t.prototype.renderItem=function(e,t,n){var r=t?this.question.inputId:null;return i.createElement(u,{item:e,cssClasses:n,isDisplayMode:this.isDisplayMode,inputId:r})},t}(o.b),u=function(e){function t(t){var n=e.call(this,t)||this;return n.item=t.item,n.inputId=t.inputId,n.state={value:n.item.value||""},n.handleOnChange=n.handleOnChange.bind(n),n.handleOnBlur=n.handleOnBlur.bind(n),n}return r.b(t,e),t.prototype.handleOnChange=function(e){this.setState({value:e.target.value})},t.prototype.handleOnBlur=function(e){this.item.value=e.target.value,this.setState({value:this.item.value})},t.prototype.componentWillReceiveProps=function(e){this.item=e.item},t.prototype.componentDidMount=function(){if(this.item){var e=this;this.item.onValueChangedCallback=function(t){e.setState({value:t||""})}}},t.prototype.componentWillUnmount=function(){this.item&&(this.item.onValueChangedCallback=null)},t.prototype.render=function(){if(!this.item)return null;var e={float:"left"};return this.isDisplayMode?i.createElement("div",{id:this.inputId,className:this.cssClasses.itemValue,style:e},this.item.value):i.createElement("input",{id:this.inputId,className:this.cssClasses.itemValue,type:this.item.inputType,style:e,value:this.state.value,placeholder:this.item.placeHolder,onBlur:this.handleOnBlur,onChange:this.handleOnChange})},Object.defineProperty(t.prototype,"mainClassName",{get:function(){return""},enumerable:!0,configurable:!0}),t}(o.c);a.a.Instance.registerQuestion("multipletext",function(e){return i.createElement(s,e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(26),s=n(11),u=n(8);n.d(t,"a",function(){return l});var l=function(e){function t(t){var n=e.call(this,t)||this;return n.setProperties(t),n}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.setProperties(t)},t.prototype.setProperties=function(e){var t=this;this.state={panelCounter:0},this.question.panelCountChangedCallback=function(){t.updateQuestionRendering()},this.question.currentIndexChangedCallback=function(){t.updateQuestionRendering()},this.question.renderModeChangedCallback=function(){t.updateQuestionRendering()},this.handleOnPanelAddClick=this.handleOnPanelAddClick.bind(this),this.handleOnPanelPrevClick=this.handleOnPanelPrevClick.bind(this),this.handleOnPanelNextClick=this.handleOnPanelNextClick.bind(this),this.handleOnRangeChange=this.handleOnRangeChange.bind(this)},t.prototype.updateQuestionRendering=function(){this.state.panelCounter=this.state.panelCounter+1,this.setState(this.state)},t.prototype.handleOnPanelAddClick=function(e){this.question.addPanel()},t.prototype.handleOnPanelPrevClick=function(e){this.question.currentIndex--},t.prototype.handleOnPanelNextClick=function(e){this.question.currentIndex++},t.prototype.handleOnRangeChange=function(e){this.question.currentIndex=e.target.value},t.prototype.render=function(){if(!this.question)return null;var e=this.question.cssClasses,t=[];if(this.question.isRenderModeList)for(var n=0;n<this.question.panels.length;n++){var r=this.question.panels[n];t.push(i.createElement(c,{key:n,panel:r,question:this.question,index:n,cssClasses:e,isDisplayMode:this.isDisplayMode,creator:this.creator}))}else if(null!=this.question.currentPanel){var r=this.question.currentPanel;t.push(i.createElement(c,{key:this.question.currentIndex,panel:r,question:this.question,index:this.question.currentIndex,cssClasses:e,isDisplayMode:this.isDisplayMode,creator:this.creator}))}var o=(this.isDisplayMode||i.createElement("th",null),this.question.isRenderModeList?this.renderAddRowButton(e,{marginTop:"5px"}):null),a=this.question.isProgressTopShowing?this.renderNavigator(e):null,s=this.question.isProgressBottomShowing?this.renderNavigator(e):null;return i.createElement("div",null,a,t,s,o)},t.prototype.renderNavigator=function(e){var t={float:"left",margin:"5px"},n=this.question.isRangeShowing?this.renderRange(t):null,r=this.question.isPrevButtonShowing?this.renderButton(this.question.panelPrevText,e,t,this.handleOnPanelPrevClick):null,o=this.question.isNextButtonShowing?this.renderButton(this.question.panelNextText,e,t,this.handleOnPanelNextClick):null,a=this.renderAddRowButton(e,t);return i.createElement("div",null,n,r,o,a)},t.prototype.renderRange=function(e){var t={width:"25%"};for(var n in e)t[n]=e[n];return i.createElement("input",{style:t,type:"range",onChange:this.handleOnRangeChange,min:0,max:this.question.panelCount-1,value:this.question.currentIndex})},t.prototype.renderAddRowButton=function(e,t){return this.question.canAddPanel?this.renderButton(this.question.panelAddText,e,t,this.handleOnPanelAddClick):null},t.prototype.renderButton=function(e,t,n,r){return i.createElement("input",{className:t.button,style:n,type:"button",onClick:r,value:e})},t}(o.b),c=function(e){function t(t){var n=e.call(this,t)||this;return n.setProperties(t),n}return r.b(t,e),t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.setProperties(t)},t.prototype.setProperties=function(e){this.panel=e.panel,this.question=e.question,this.index=e.index,this.creator=e.creator,this.handleOnPanelRemoveClick=this.handleOnPanelRemoveClick.bind(this)},t.prototype.handleOnPanelRemoveClick=function(e){this.question.removePanelUI(this.index)},t.prototype.render=function(){if(!this.panel)return null;this.question.survey;var e=i.createElement(a.c,{key:this.index,panel:this.panel,css:s.b.getCss(),survey:this.question.survey,creator:this.creator}),t=this.question.isRenderModeList&&this.index<this.question.panelCount-1?i.createElement("hr",null):null,n=this.renderButton();return i.createElement("div",null,e,n,t)},t.prototype.renderButton=function(){if(!this.question.canRemovePanel)return null;var e={marginTop:"5px"};return i.createElement("input",{className:this.cssClasses.button,style:e,type:"button",onClick:this.handleOnPanelRemoveClick,value:this.question.panelRemoveText})},t}(o.c);u.a.Instance.registerQuestion("paneldynamic",function(e){return i.createElement(l,e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(13),s=n(8);n.d(t,"a",function(){return u});var u=function(e){function t(t){var n=e.call(this,t)||this;n.state={choicesChanged:0};var r=n;return n.question.choicesChangedCallback=function(){r.state.choicesChanged=r.state.choicesChanged+1,r.setState(r.state)},n.handleOnChange=n.handleOnChange.bind(n),n}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.handleOnChange=this.handleOnChange.bind(this)},t.prototype.handleOnChange=function(e){this.question.value=e.target.value,this.setState({value:this.question.value})},t.prototype.render=function(){if(!this.question)return null;var e=this.question.cssClasses;return i.createElement("div",{className:e.root},this.getItems(e))},t.prototype.getItems=function(e){for(var t=[],n=0;n<this.question.visibleChoices.length;n++){var r=this.question.visibleChoices[n],i="item"+n;t.push(this.renderItem(i,r,0==n,e))}return t},Object.defineProperty(t.prototype,"textStyle",{get:function(){return{marginLeft:"3px",display:"inline",position:"static"}},enumerable:!0,configurable:!0}),t.prototype.renderItem=function(e,t,n,r){var i=this.question.colCount>0?100/this.question.colCount+"%":"",o=0==this.question.colCount?"5px":"0px",a={marginRight:o,marginLeft:"0px",display:"inline-block"};i&&(a.width=i);var s=this.question.value==t.value,u=s&&t.value===this.question.otherItem.value?this.renderOther(r):null;return this.renderRadio(e,t,s,a,u,n,r)},t.prototype.renderRadio=function(e,t,n,r,o,a,s){var u=a?this.question.inputId:null,l=this.renderLocString(t.locText,this.textStyle);return i.createElement("div",{key:e,className:s.item,style:r},i.createElement("label",{className:s.label},i.createElement("input",{id:u,type:"radio",name:this.question.name+"_"+this.questionBase.id,checked:n,value:t.value,disabled:this.isDisplayMode,onChange:this.handleOnChange}),i.createElement("span",{className:"circle"}),i.createElement("span",{className:"check"}),l),o)},t.prototype.renderOther=function(e){return i.createElement("div",{className:e.other},i.createElement(a.a,{question:this.question,otherCss:e.other,cssClasses:e,isDisplayMode:this.isDisplayMode}))},t}(o.b);s.a.Instance.registerQuestion("radiogroup",function(e){return i.createElement(u,e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(13),s=n(8);n.d(t,"a",function(){return u});var u=function(e){function t(t){var n=e.call(this,t)||this;return n.handleOnChange=n.handleOnChange.bind(n),n}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.handleOnChange=function(e){this.question.value=e.target.value,this.setState({value:this.question.value})},t.prototype.render=function(){if(!this.question)return null;for(var e=this.question.cssClasses,t=[],n=this.question.minRateDescription?this.renderLocString(this.question.locMinRateDescription):null,r=this.question.maxRateDescription?this.renderLocString(this.question.locMaxRateDescription):null,o=0;o<this.question.visibleRateValues.length;o++){var a=0==o?n:null,s=o==this.question.visibleRateValues.length-1?r:null;t.push(this.renderItem("value"+o,this.question.visibleRateValues[o],a,s,e))}var u=this.question.hasOther?this.renderOther(e):null;return i.createElement("div",{className:e.root},t,u)},t.prototype.renderItem=function(e,t,n,r,o){var a=this.question.value==t.value,s=o.item;a&&(s+=" "+o.selected);var u=this.renderLocString(t.locText);return i.createElement("label",{key:e,className:s},i.createElement("input",{type:"radio",style:{display:"none"},name:this.question.name,value:t.value,disabled:this.isDisplayMode,checked:this.question.value==t.value,onChange:this.handleOnChange}),n,u,r)},t.prototype.renderOther=function(e){return i.createElement("div",{className:e.other},i.createElement(a.a,{question:this.question,cssClasses:e,isDisplayMode:this.isDisplayMode}))},t}(o.b);s.a.Instance.registerQuestion("rating",function(e){return i.createElement(u,e)})},function(e,t,n){"use strict";var r=n(0),i=n(2),o=(n.n(i),n(4)),a=n(8);n.d(t,"a",function(){return s});var s=function(e){function t(t){var n=e.call(this,t)||this;return n.state={value:n.question.value||""},n.handleOnChange=n.handleOnChange.bind(n),n.handleOnBlur=n.handleOnBlur.bind(n),n}return r.b(t,e),Object.defineProperty(t.prototype,"question",{get:function(){return this.questionBase},enumerable:!0,configurable:!0}),t.prototype.componentWillReceiveProps=function(t){e.prototype.componentWillReceiveProps.call(this,t),this.state={value:this.question.value||""}},t.prototype.handleOnChange=function(e){this.setState({value:e.target.value})},t.prototype.handleOnBlur=function(e){this.question.value=e.target.value,this.setState({value:this.question.value||""})},t.prototype.render=function(){if(!this.question)return null;var e=this.question.cssClasses;return this.isDisplayMode?i.createElement("div",{id:this.question.inputId,className:e.root},this.question.value):i.createElement("input",{id:this.question.inputId,className:e.root,type:this.question.inputType,value:this.state.value,size:this.question.size,placeholder:this.question.placeHolder,onBlur:this.handleOnBlur,onChange:this.handleOnChange})},t}(o.b);a.a.Instance.registerQuestion("text",function(e){return i.createElement(s,e)})},function(e,t,n){"use strict";var r=n(0),i=n(5),o=n(28);n.d(t,"a",function(){return a});var a=function(e){function t(t){var n=e.call(this)||this;return n.surveyValue=n.createSurvey(t),n.surveyValue.showTitle=!1,"undefined"!=typeof document&&(n.windowElement=document.createElement("div")),n}return r.b(t,e),t.prototype.getType=function(){return"window"},Object.defineProperty(t.prototype,"survey",{get:function(){return this.surveyValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isShowing",{get:function(){return this.isShowingValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isExpanded",{get:function(){return this.isExpandedValue},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return this.survey.title},set:function(e){this.survey.title=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"locTitle",{get:function(){return this.survey.locTitle},enumerable:!0,configurable:!0}),t.prototype.expand=function(){this.expandcollapse(!0)},t.prototype.collapse=function(){this.expandcollapse(!1)},t.prototype.createSurvey=function(e){return new o.a(e)},t.prototype.expandcollapse=function(e){this.isExpandedValue=e},t}(i.b);a.surveyElementName="windowSurveyJS"},function(e,t,n){"use strict";var r=n(0),i=n(5),o=n(3);n.d(t,"e",function(){return a}),n.d(t,"a",function(){return s}),n.d(t,"d",function(){return u}),n.d(t,"b",function(){return l}),n.d(t,"c",function(){return c});var a=function(e){function t(){var t=e.call(this)||this;return t.opValue="equal",t}return r.b(t,e),Object.defineProperty(t,"operators",{get:function(){return null!=t.operatorsValue?t.operatorsValue:(t.operatorsValue={empty:function(e,t){return!e},notempty:function(e,t){return!!e},equal:function(e,t){return e==t},notequal:function(e,t){return e!=t},contains:function(e,t){return e&&e.indexOf&&e.indexOf(t)>-1},notcontains:function(e,t){return!e||!e.indexOf||-1==e.indexOf(t)},greater:function(e,t){return e>t},less:function(e,t){return e<t},greaterorequal:function(e,t){return e>=t},lessorequal:function(e,t){return e<=t}},t.operatorsValue)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"operator",{get:function(){return this.opValue},set:function(e){e&&(e=e.toLowerCase(),t.operators[e]&&(this.opValue=e))},enumerable:!0,configurable:!0}),t.prototype.check=function(e){t.operators[this.operator](e,this.value)?this.onSuccess():this.onFailure()},t.prototype.onSuccess=function(){},t.prototype.onFailure=function(){},t}(i.b);a.operatorsValue=null;var s=function(e){function t(){var t=e.call(this)||this;return t.owner=null,t}return r.b(t,e),t.prototype.setOwner=function(e){this.owner=e},Object.defineProperty(t.prototype,"isOnNextPage",{get:function(){return!1},enumerable:!0,configurable:!0}),t}(a),u=function(e){function t(){var t=e.call(this)||this;return t.pages=[],t.questions=[],t}return r.b(t,e),t.prototype.getType=function(){return"visibletrigger"},t.prototype.onSuccess=function(){this.onTrigger(this.onItemSuccess)},t.prototype.onFailure=function(){this.onTrigger(this.onItemFailure)},t.prototype.onTrigger=function(e){if(this.owner)for(var t=this.owner.getObjects(this.pages,this.questions),n=0;n<t.length;n++)e(t[n])},t.prototype.onItemSuccess=function(e){e.visible=!0},t.prototype.onItemFailure=function(e){e.visible=!1},t}(s),l=function(e){function t(){return e.call(this)||this}return r.b(t,e),t.prototype.getType=function(){return"completetrigger"},Object.defineProperty(t.prototype,"isOnNextPage",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.onSuccess=function(){this.owner&&this.owner.doComplete()},t}(s),c=function(e){function t(){return e.call(this)||this}return r.b(t,e),t.prototype.getType=function(){return"setvaluetrigger"},t.prototype.onSuccess=function(){this.setToName&&this.owner&&this.owner.setTriggerValue(this.setToName,this.setValue,this.isVariable)},t}(s);o.a.metaData.addClass("trigger",["operator","!value"]),o.a.metaData.addClass("surveytrigger",["!name"],null,"trigger"),o.a.metaData.addClass("visibletrigger",["pages","questions"],function(){return new u},"surveytrigger"),o.a.metaData.addClass("completetrigger",[],function(){return new l},"surveytrigger"),o.a.metaData.addClass("setvaluetrigger",["!setToName","setValue","isVariable:boolean"],function(){return new c},"surveytrigger")},function(e,t,n){"use strict";function r(e,t){var n,r,i=/(\.0+)+$/,o=e.replace(i,"").split("."),a=t.replace(i,"").split("."),s=Math.min(o.length,a.length);for(n=0;n<s;n++)if(r=parseInt(o[n],10)-parseInt(a[n],10))return r;return o.length-a.length}n.d(t,"a",function(){return c}),n.d(t,"b",function(){return r});var i=/(webkit)[ \/]([\w.]+)/,o=/(msie) (\d{1,2}\.\d)/,a=/(trident).*rv:(\d{1,2}\.\d)/,s=/(edge)\/((\d+)?[\w\.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))/,l=function(e){e=e.toLowerCase();var t={},n=o.exec(e)||a.exec(e)||s.exec(e)||e.indexOf("compatible")<0&&u.exec(e)||i.exec(e)||[],r=n[1],l=n[2];return"trident"===r||"edge"===r?r="msie":"mozilla"===r&&(r="firefox"),r&&(t[r]=!0,t.version=l),t},c=l(navigator.userAgent)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(2),o=(n.n(i),n(2)),a=(n.n(o),n(19)),s=n(30),u=n(39),l=n.n(u),c=n(38);n.d(t,"__assign",function(){return c.a}),n.d(t,"__extends",function(){return c.b}),n.d(t,"__decorate",function(){return c.c}),n.d(t,"defaultStandardCss",function(){return c.d}),n.d(t,"defaultBootstrapCss",function(){return c.e}),n.d(t,"defaultBootstrapMaterialCss",function(){return c.f}),n.d(t,"Survey",function(){return c.g}),n.d(t,"ReactSurveyModel",function(){return c.h}),n.d(t,"Model",function(){return c.i}),n.d(t,"SurveyNavigationBase",function(){return c.j}),n.d(t,"SurveyNavigation",function(){return c.k}),n.d(t,"SurveyPage",function(){return c.l}),n.d(t,"SurveyRow",function(){return c.m}),n.d(t,"SurveyQuestion",function(){return c.n}),n.d(t,"SurveyQuestionErrors",function(){return c.o}),n.d(t,"SurveyElementBase",function(){return c.p}),n.d(t,"SurveyQuestionElementBase",function(){return c.q}),n.d(t,"SurveyQuestionCommentItem",function(){return c.r}),n.d(t,"SurveyQuestionComment",function(){return c.s}),n.d(t,"SurveyQuestionCheckbox",function(){return c.t}),n.d(t,"SurveyQuestionCheckboxItem",function(){return c.u}),n.d(t,"SurveyQuestionDropdown",function(){return c.v}),n.d(t,"SurveyQuestionMatrixDropdown",function(){return c.w}),n.d(t,"SurveyQuestionMatrixDropdownRow",function(){return c.x}),n.d(t,"SurveyQuestionMatrix",function(){return c.y}),n.d(t,"SurveyQuestionMatrixRow",function(){return c.z}),n.d(t,"SurveyQuestionHtml",function(){return c.A}),n.d(t,"SurveyQuestionFile",function(){return c.B}),n.d(t,"SurveyQuestionMultipleText",function(){return c.C}),n.d(t,"SurveyQuestionMultipleTextItem",function(){return c.D}),n.d(t,"SurveyQuestionRadiogroup",function(){return c.E}),n.d(t,"SurveyQuestionText",function(){return c.F}),n.d(t,"SurveyQuestionBoolean",function(){return c.G}),n.d(t,"SurveyQuestionMatrixDynamic",function(){return c.H}),n.d(t,"SurveyQuestionMatrixDynamicRow",function(){return c.I}),n.d(t,"SurveyQuestionPanelDynamic",function(){return c.J}),n.d(t,"SurveyProgress",function(){return c.K}),n.d(t,"SurveyQuestionRating",function(){return c.L}),n.d(t,"SurveyWindow",function(){return c.M}),n.d(t,"ReactQuestionFactory",function(){return c.N}),n.d(t,"Version",function(){return c.O}),n.d(t,"AnswerCountValidator",function(){return c.P}),n.d(t,"EmailValidator",function(){return c.Q}),n.d(t,"NumericValidator",function(){return c.R}),n.d(t,"RegexValidator",function(){return c.S}),n.d(t,"SurveyValidator",function(){return c.T}),n.d(t,"TextValidator",function(){return c.U}),n.d(t,"ValidatorResult",function(){return c.V}),n.d(t,"ValidatorRunner",function(){return c.W}),n.d(t,"Base",function(){return c.X}),n.d(t,"Event",function(){return c.Y}),n.d(t,"SurveyError",function(){return c.Z}),n.d(t,"ItemValue",function(){return c._0}),n.d(t,"LocalizableString",function(){return c._1}),n.d(t,"ChoicesRestfull",function(){return c._2}),n.d(t,"FunctionFactory",function(){return c._3}),n.d(t,"Condition",function(){return c._4}),n.d(t,"ConditionNode",function(){return c._5}),n.d(t,"ConditionRunner",function(){return c._6}),n.d(t,"ConditionsParser",function(){return c._7}),n.d(t,"ProcessValue",function(){return c._8}),n.d(t,"CustomError",function(){return c._9}),n.d(t,"ExceedSizeError",function(){return c._10}),n.d(t,"RequreNumericError",function(){return c._11}),n.d(t,"JsonError",function(){return c._12}),n.d(t,"JsonIncorrectTypeError",function(){return c._13}),n.d(t,"JsonMetadata",function(){return c._14}),n.d(t,"JsonMetadataClass",function(){return c._15}),n.d(t,"JsonMissingTypeError",function(){return c._16}),n.d(t,"JsonMissingTypeErrorBase",function(){return c._17}),n.d(t,"JsonObject",function(){return c._18}),n.d(t,"JsonObjectProperty",function(){return c._19}),n.d(t,"JsonRequiredPropertyError",function(){return c._20}),n.d(t,"JsonUnknownPropertyError",function(){return c._21}),n.d(t,"MatrixDropdownCell",function(){return c._22}),n.d(t,"MatrixDropdownColumn",function(){return c._23}),n.d(t,"MatrixDropdownRowModelBase",function(){return c._24}),n.d(t,"QuestionMatrixDropdownModelBase",function(){return c._25}),n.d(t,"MatrixDropdownRowModel",function(){return c._26}),n.d(t,"QuestionMatrixDropdownModel",function(){return c._27}),n.d(t,"MatrixDynamicRowModel",function(){return c._28}),n.d(t,"QuestionMatrixDynamicModel",function(){return c._29}),n.d(t,"MatrixRowModel",function(){return c._30}),n.d(t,"QuestionMatrixModel",function(){return c._31}),n.d(t,"MultipleTextItemModel",function(){return c._32}),n.d(t,"QuestionMultipleTextModel",function(){return c._33}),n.d(t,"PanelModel",function(){return c._34}),n.d(t,"PanelModelBase",function(){return c._35}),n.d(t,"QuestionRowModel",function(){return c._36}),n.d(t,"PageModel",function(){return c._37}),n.d(t,"Question",function(){return c._38}),n.d(t,"QuestionBase",function(){return c._39}),n.d(t,"QuestionCheckboxBase",function(){return c._40}),n.d(t,"QuestionSelectBase",function(){return c._41}),n.d(t,"QuestionCheckboxModel",function(){return c._42}),n.d(t,"QuestionCommentModel",function(){return c._43}),n.d(t,"QuestionDropdownModel",function(){return c._44}),n.d(t,"QuestionFactory",function(){return c._45}),n.d(t,"ElementFactory",function(){return c._46}),n.d(t,"QuestionFileModel",function(){return c._47}),n.d(t,"QuestionHtmlModel",function(){return c._48}),n.d(t,"QuestionRadiogroupModel",function(){return c._49}),n.d(t,"QuestionRatingModel",function(){return c._50}),n.d(t,"QuestionTextModel",function(){return c._51}),n.d(t,"QuestionBooleanModel",function(){return c._52}),n.d(t,"QuestionPanelDynamicModel",function(){return c._53}),n.d(t,"QuestionPanelDynamicItem",function(){return c._54}),n.d(t,"SurveyModel",function(){return c._55}),n.d(t,"SurveyTrigger",function(){return c._56}),n.d(t,"SurveyTriggerComplete",function(){return c._57}),n.d(t,"SurveyTriggerSetValue",function(){return c._58}),n.d(t,"SurveyTriggerVisible",function(){return c._59}),n.d(t,"Trigger",function(){return c._60}),n.d(t,"SurveyWindowModel",function(){return c._61}),n.d(t,"TextPreProcessor",function(){return c._62}),n.d(t,"dxSurveyService",function(){return c._63}),n.d(t,"surveyLocalization",function(){return c._64}),n.d(t,"surveyStrings",function(){return c._65}),n.d(t,"QuestionCustomWidget",function(){return c._66}),n.d(t,"CustomWidgetCollection",function(){return c._67}),l.a.fn.extend({Survey:function(e){this.each(function(){o.render(i.createElement(a.a,r.a({},e)),this)})},SurveyWindow:function(e){this.each(function(){o.render(i.createElement(s.a,r.a({},e)),this)})}})}])}); |
ajax/libs/zeroclipboard/2.1.2/ZeroClipboard.Core.js | viskin/cdnjs | /*!
* ZeroClipboard
* The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
* Copyright (c) 2014 Jon Rohan, James M. Greene
* Licensed MIT
* http://zeroclipboard.org/
* v2.1.2
*/
(function(window, undefined) {
"use strict";
/**
* Store references to critically important global functions that may be
* overridden on certain web pages.
*/
var _window = window, _document = _window.document, _navigator = _window.navigator, _setTimeout = _window.setTimeout, _encodeURIComponent = _window.encodeURIComponent, _ActiveXObject = _window.ActiveXObject, _parseInt = _window.Number.parseInt || _window.parseInt, _parseFloat = _window.Number.parseFloat || _window.parseFloat, _isNaN = _window.Number.isNaN || _window.isNaN, _round = _window.Math.round, _now = _window.Date.now, _keys = _window.Object.keys, _defineProperty = _window.Object.defineProperty, _hasOwn = _window.Object.prototype.hasOwnProperty, _slice = _window.Array.prototype.slice;
/**
* Convert an `arguments` object into an Array.
*
* @returns The arguments as an Array
* @private
*/
var _args = function(argumentsObj) {
return _slice.call(argumentsObj, 0);
};
/**
* Shallow-copy the owned, enumerable properties of one object over to another, similar to jQuery's `$.extend`.
*
* @returns The target object, augmented
* @private
*/
var _extend = function() {
var i, len, arg, prop, src, copy, args = _args(arguments), target = args[0] || {};
for (i = 1, len = args.length; i < len; i++) {
if ((arg = args[i]) != null) {
for (prop in arg) {
if (_hasOwn.call(arg, prop)) {
src = target[prop];
copy = arg[prop];
if (target !== copy && copy !== undefined) {
target[prop] = copy;
}
}
}
}
}
return target;
};
/**
* Return a deep copy of the source object or array.
*
* @returns Object or Array
* @private
*/
var _deepCopy = function(source) {
var copy, i, len, prop;
if (typeof source !== "object" || source == null) {
copy = source;
} else if (typeof source.length === "number") {
copy = [];
for (i = 0, len = source.length; i < len; i++) {
if (_hasOwn.call(source, i)) {
copy[i] = _deepCopy(source[i]);
}
}
} else {
copy = {};
for (prop in source) {
if (_hasOwn.call(source, prop)) {
copy[prop] = _deepCopy(source[prop]);
}
}
}
return copy;
};
/**
* Makes a shallow copy of `obj` (like `_extend`) but filters its properties based on a list of `keys` to keep.
* The inverse of `_omit`, mostly. The big difference is that these properties do NOT need to be enumerable to
* be kept.
*
* @returns A new filtered object.
* @private
*/
var _pick = function(obj, keys) {
var newObj = {};
for (var i = 0, len = keys.length; i < len; i++) {
if (keys[i] in obj) {
newObj[keys[i]] = obj[keys[i]];
}
}
return newObj;
};
/**
* Makes a shallow copy of `obj` (like `_extend`) but filters its properties based on a list of `keys` to omit.
* The inverse of `_pick`.
*
* @returns A new filtered object.
* @private
*/
var _omit = function(obj, keys) {
var newObj = {};
for (var prop in obj) {
if (keys.indexOf(prop) === -1) {
newObj[prop] = obj[prop];
}
}
return newObj;
};
/**
* Remove all owned, enumerable properties from an object.
*
* @returns The original object without its owned, enumerable properties.
* @private
*/
var _deleteOwnProperties = function(obj) {
if (obj) {
for (var prop in obj) {
if (_hasOwn.call(obj, prop)) {
delete obj[prop];
}
}
}
return obj;
};
/**
* Determine if an element is contained within another element.
*
* @returns Boolean
* @private
*/
var _containedBy = function(el, ancestorEl) {
if (el && el.nodeType === 1 && el.ownerDocument && ancestorEl && (ancestorEl.nodeType === 1 && ancestorEl.ownerDocument && ancestorEl.ownerDocument === el.ownerDocument || ancestorEl.nodeType === 9 && !ancestorEl.ownerDocument && ancestorEl === el.ownerDocument)) {
do {
if (el === ancestorEl) {
return true;
}
el = el.parentNode;
} while (el);
}
return false;
};
/**
* Keep track of the state of the Flash object.
* @private
*/
var _flashState = {
bridge: null,
version: "0.0.0",
pluginType: "unknown",
disabled: null,
outdated: null,
unavailable: null,
deactivated: null,
overdue: null,
ready: null
};
/**
* The minimum Flash Player version required to use ZeroClipboard completely.
* @readonly
* @private
*/
var _minimumFlashVersion = "11.0.0";
/**
* Keep track of all event listener registrations.
* @private
*/
var _handlers = {};
/**
* Keep track of the currently activated element.
* @private
*/
var _currentElement;
/**
* Keep track of data for the pending clipboard transaction.
* @private
*/
var _clipData = {};
/**
* Keep track of data formats for the pending clipboard transaction.
* @private
*/
var _clipDataFormatMap = null;
/**
* The `message` store for events
* @private
*/
var _eventMessages = {
ready: "Flash communication is established",
error: {
"flash-disabled": "Flash is disabled or not installed",
"flash-outdated": "Flash is too outdated to support ZeroClipboard",
"flash-unavailable": "Flash is unable to communicate bidirectionally with JavaScript",
"flash-deactivated": "Flash is too outdated for your browser and/or is configured as click-to-activate",
"flash-overdue": "Flash communication was established but NOT within the acceptable time limit"
}
};
/**
* The presumed location of the "ZeroClipboard.swf" file, based on the location
* of the executing JavaScript file (e.g. "ZeroClipboard.js", etc.).
* @private
*/
var _swfPath = function() {
var i, jsDir, tmpJsPath, jsPath, swfPath = "ZeroClipboard.swf";
if (!(_document.currentScript && (jsPath = _document.currentScript.src))) {
var scripts = _document.getElementsByTagName("script");
if ("readyState" in scripts[0]) {
for (i = scripts.length; i--; ) {
if (scripts[i].readyState === "interactive" && (jsPath = scripts[i].src)) {
break;
}
}
} else if (_document.readyState === "loading") {
jsPath = scripts[scripts.length - 1].src;
} else {
for (i = scripts.length; i--; ) {
tmpJsPath = scripts[i].src;
if (!tmpJsPath) {
jsDir = null;
break;
}
tmpJsPath = tmpJsPath.split("#")[0].split("?")[0];
tmpJsPath = tmpJsPath.slice(0, tmpJsPath.lastIndexOf("/") + 1);
if (jsDir == null) {
jsDir = tmpJsPath;
} else if (jsDir !== tmpJsPath) {
jsDir = null;
break;
}
}
if (jsDir !== null) {
jsPath = jsDir;
}
}
}
if (jsPath) {
jsPath = jsPath.split("#")[0].split("?")[0];
swfPath = jsPath.slice(0, jsPath.lastIndexOf("/") + 1) + swfPath;
}
return swfPath;
}();
/**
* ZeroClipboard configuration defaults for the Core module.
* @private
*/
var _globalConfig = {
swfPath: _swfPath,
trustedDomains: window.location.host ? [ window.location.host ] : [],
cacheBust: true,
forceEnhancedClipboard: false,
flashLoadTimeout: 3e4,
autoActivate: true,
bubbleEvents: true,
containerId: "global-zeroclipboard-html-bridge",
containerClass: "global-zeroclipboard-container",
swfObjectId: "global-zeroclipboard-flash-bridge",
hoverClass: "zeroclipboard-is-hover",
activeClass: "zeroclipboard-is-active",
forceHandCursor: false,
title: null,
zIndex: 999999999
};
/**
* The underlying implementation of `ZeroClipboard.config`.
* @private
*/
var _config = function(options) {
if (typeof options === "object" && options !== null) {
for (var prop in options) {
if (_hasOwn.call(options, prop)) {
if (/^(?:forceHandCursor|title|zIndex|bubbleEvents)$/.test(prop)) {
_globalConfig[prop] = options[prop];
} else if (_flashState.bridge == null) {
if (prop === "containerId" || prop === "swfObjectId") {
if (_isValidHtml4Id(options[prop])) {
_globalConfig[prop] = options[prop];
} else {
throw new Error("The specified `" + prop + "` value is not valid as an HTML4 Element ID");
}
} else {
_globalConfig[prop] = options[prop];
}
}
}
}
}
if (typeof options === "string" && options) {
if (_hasOwn.call(_globalConfig, options)) {
return _globalConfig[options];
}
return;
}
return _deepCopy(_globalConfig);
};
/**
* The underlying implementation of `ZeroClipboard.state`.
* @private
*/
var _state = function() {
return {
browser: _pick(_navigator, [ "userAgent", "platform", "appName" ]),
flash: _omit(_flashState, [ "bridge" ]),
zeroclipboard: {
version: ZeroClipboard.version,
config: ZeroClipboard.config()
}
};
};
/**
* The underlying implementation of `ZeroClipboard.isFlashUnusable`.
* @private
*/
var _isFlashUnusable = function() {
return !!(_flashState.disabled || _flashState.outdated || _flashState.unavailable || _flashState.deactivated);
};
/**
* The underlying implementation of `ZeroClipboard.on`.
* @private
*/
var _on = function(eventType, listener) {
var i, len, events, added = {};
if (typeof eventType === "string" && eventType) {
events = eventType.toLowerCase().split(/\s+/);
} else if (typeof eventType === "object" && eventType && typeof listener === "undefined") {
for (i in eventType) {
if (_hasOwn.call(eventType, i) && typeof i === "string" && i && typeof eventType[i] === "function") {
ZeroClipboard.on(i, eventType[i]);
}
}
}
if (events && events.length) {
for (i = 0, len = events.length; i < len; i++) {
eventType = events[i].replace(/^on/, "");
added[eventType] = true;
if (!_handlers[eventType]) {
_handlers[eventType] = [];
}
_handlers[eventType].push(listener);
}
if (added.ready && _flashState.ready) {
ZeroClipboard.emit({
type: "ready"
});
}
if (added.error) {
var errorTypes = [ "disabled", "outdated", "unavailable", "deactivated", "overdue" ];
for (i = 0, len = errorTypes.length; i < len; i++) {
if (_flashState[errorTypes[i]] === true) {
ZeroClipboard.emit({
type: "error",
name: "flash-" + errorTypes[i]
});
break;
}
}
}
}
return ZeroClipboard;
};
/**
* The underlying implementation of `ZeroClipboard.off`.
* @private
*/
var _off = function(eventType, listener) {
var i, len, foundIndex, events, perEventHandlers;
if (arguments.length === 0) {
events = _keys(_handlers);
} else if (typeof eventType === "string" && eventType) {
events = eventType.split(/\s+/);
} else if (typeof eventType === "object" && eventType && typeof listener === "undefined") {
for (i in eventType) {
if (_hasOwn.call(eventType, i) && typeof i === "string" && i && typeof eventType[i] === "function") {
ZeroClipboard.off(i, eventType[i]);
}
}
}
if (events && events.length) {
for (i = 0, len = events.length; i < len; i++) {
eventType = events[i].toLowerCase().replace(/^on/, "");
perEventHandlers = _handlers[eventType];
if (perEventHandlers && perEventHandlers.length) {
if (listener) {
foundIndex = perEventHandlers.indexOf(listener);
while (foundIndex !== -1) {
perEventHandlers.splice(foundIndex, 1);
foundIndex = perEventHandlers.indexOf(listener, foundIndex);
}
} else {
perEventHandlers.length = 0;
}
}
}
}
return ZeroClipboard;
};
/**
* The underlying implementation of `ZeroClipboard.handlers`.
* @private
*/
var _listeners = function(eventType) {
var copy;
if (typeof eventType === "string" && eventType) {
copy = _deepCopy(_handlers[eventType]) || null;
} else {
copy = _deepCopy(_handlers);
}
return copy;
};
/**
* The underlying implementation of `ZeroClipboard.emit`.
* @private
*/
var _emit = function(event) {
var eventCopy, returnVal, tmp;
event = _createEvent(event);
if (!event) {
return;
}
if (_preprocessEvent(event)) {
return;
}
if (event.type === "ready" && _flashState.overdue === true) {
return ZeroClipboard.emit({
type: "error",
name: "flash-overdue"
});
}
eventCopy = _extend({}, event);
_dispatchCallbacks.call(this, eventCopy);
if (event.type === "copy") {
tmp = _mapClipDataToFlash(_clipData);
returnVal = tmp.data;
_clipDataFormatMap = tmp.formatMap;
}
return returnVal;
};
/**
* The underlying implementation of `ZeroClipboard.create`.
* @private
*/
var _create = function() {
if (typeof _flashState.ready !== "boolean") {
_flashState.ready = false;
}
if (!ZeroClipboard.isFlashUnusable() && _flashState.bridge === null) {
var maxWait = _globalConfig.flashLoadTimeout;
if (typeof maxWait === "number" && maxWait >= 0) {
_setTimeout(function() {
if (typeof _flashState.deactivated !== "boolean") {
_flashState.deactivated = true;
}
if (_flashState.deactivated === true) {
ZeroClipboard.emit({
type: "error",
name: "flash-deactivated"
});
}
}, maxWait);
}
_flashState.overdue = false;
_embedSwf();
}
};
/**
* The underlying implementation of `ZeroClipboard.destroy`.
* @private
*/
var _destroy = function() {
ZeroClipboard.clearData();
ZeroClipboard.blur();
ZeroClipboard.emit("destroy");
_unembedSwf();
ZeroClipboard.off();
};
/**
* The underlying implementation of `ZeroClipboard.setData`.
* @private
*/
var _setData = function(format, data) {
var dataObj;
if (typeof format === "object" && format && typeof data === "undefined") {
dataObj = format;
ZeroClipboard.clearData();
} else if (typeof format === "string" && format) {
dataObj = {};
dataObj[format] = data;
} else {
return;
}
for (var dataFormat in dataObj) {
if (typeof dataFormat === "string" && dataFormat && _hasOwn.call(dataObj, dataFormat) && typeof dataObj[dataFormat] === "string" && dataObj[dataFormat]) {
_clipData[dataFormat] = dataObj[dataFormat];
}
}
};
/**
* The underlying implementation of `ZeroClipboard.clearData`.
* @private
*/
var _clearData = function(format) {
if (typeof format === "undefined") {
_deleteOwnProperties(_clipData);
_clipDataFormatMap = null;
} else if (typeof format === "string" && _hasOwn.call(_clipData, format)) {
delete _clipData[format];
}
};
/**
* The underlying implementation of `ZeroClipboard.getData`.
* @private
*/
var _getData = function(format) {
if (typeof format === "undefined") {
return _deepCopy(_clipData);
} else if (typeof format === "string" && _hasOwn.call(_clipData, format)) {
return _clipData[format];
}
};
/**
* The underlying implementation of `ZeroClipboard.focus`/`ZeroClipboard.activate`.
* @private
*/
var _focus = function(element) {
if (!(element && element.nodeType === 1)) {
return;
}
if (_currentElement) {
_removeClass(_currentElement, _globalConfig.activeClass);
if (_currentElement !== element) {
_removeClass(_currentElement, _globalConfig.hoverClass);
}
}
_currentElement = element;
_addClass(element, _globalConfig.hoverClass);
var newTitle = element.getAttribute("title") || _globalConfig.title;
if (typeof newTitle === "string" && newTitle) {
var htmlBridge = _getHtmlBridge(_flashState.bridge);
if (htmlBridge) {
htmlBridge.setAttribute("title", newTitle);
}
}
var useHandCursor = _globalConfig.forceHandCursor === true || _getStyle(element, "cursor") === "pointer";
_setHandCursor(useHandCursor);
_reposition();
};
/**
* The underlying implementation of `ZeroClipboard.blur`/`ZeroClipboard.deactivate`.
* @private
*/
var _blur = function() {
var htmlBridge = _getHtmlBridge(_flashState.bridge);
if (htmlBridge) {
htmlBridge.removeAttribute("title");
htmlBridge.style.left = "0px";
htmlBridge.style.top = "-9999px";
htmlBridge.style.width = "1px";
htmlBridge.style.top = "1px";
}
if (_currentElement) {
_removeClass(_currentElement, _globalConfig.hoverClass);
_removeClass(_currentElement, _globalConfig.activeClass);
_currentElement = null;
}
};
/**
* The underlying implementation of `ZeroClipboard.activeElement`.
* @private
*/
var _activeElement = function() {
return _currentElement || null;
};
/**
* Check if a value is a valid HTML4 `ID` or `Name` token.
* @private
*/
var _isValidHtml4Id = function(id) {
return typeof id === "string" && id && /^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(id);
};
/**
* Create or update an `event` object, based on the `eventType`.
* @private
*/
var _createEvent = function(event) {
var eventType;
if (typeof event === "string" && event) {
eventType = event;
event = {};
} else if (typeof event === "object" && event && typeof event.type === "string" && event.type) {
eventType = event.type;
}
if (!eventType) {
return;
}
_extend(event, {
type: eventType.toLowerCase(),
target: event.target || _currentElement || null,
relatedTarget: event.relatedTarget || null,
currentTarget: _flashState && _flashState.bridge || null,
timeStamp: event.timeStamp || _now() || null
});
var msg = _eventMessages[event.type];
if (event.type === "error" && event.name && msg) {
msg = msg[event.name];
}
if (msg) {
event.message = msg;
}
if (event.type === "ready") {
_extend(event, {
target: null,
version: _flashState.version
});
}
if (event.type === "error") {
if (/^flash-(disabled|outdated|unavailable|deactivated|overdue)$/.test(event.name)) {
_extend(event, {
target: null,
minimumVersion: _minimumFlashVersion
});
}
if (/^flash-(outdated|unavailable|deactivated|overdue)$/.test(event.name)) {
_extend(event, {
version: _flashState.version
});
}
}
if (event.type === "copy") {
event.clipboardData = {
setData: ZeroClipboard.setData,
clearData: ZeroClipboard.clearData
};
}
if (event.type === "aftercopy") {
event = _mapClipResultsFromFlash(event, _clipDataFormatMap);
}
if (event.target && !event.relatedTarget) {
event.relatedTarget = _getRelatedTarget(event.target);
}
event = _addMouseData(event);
return event;
};
/**
* Get a relatedTarget from the target's `data-clipboard-target` attribute
* @private
*/
var _getRelatedTarget = function(targetEl) {
var relatedTargetId = targetEl && targetEl.getAttribute && targetEl.getAttribute("data-clipboard-target");
return relatedTargetId ? _document.getElementById(relatedTargetId) : null;
};
/**
* Add element and position data to `MouseEvent` instances
* @private
*/
var _addMouseData = function(event) {
if (event && /^_(?:click|mouse(?:over|out|down|up|move))$/.test(event.type)) {
var srcElement = event.target;
var fromElement = event.type === "_mouseover" && event.relatedTarget ? event.relatedTarget : undefined;
var toElement = event.type === "_mouseout" && event.relatedTarget ? event.relatedTarget : undefined;
var pos = _getDOMObjectPosition(srcElement);
var screenLeft = _window.screenLeft || _window.screenX || 0;
var screenTop = _window.screenTop || _window.screenY || 0;
var scrollLeft = _document.body.scrollLeft + _document.documentElement.scrollLeft;
var scrollTop = _document.body.scrollTop + _document.documentElement.scrollTop;
var pageX = pos.left + (typeof event._stageX === "number" ? event._stageX : 0);
var pageY = pos.top + (typeof event._stageY === "number" ? event._stageY : 0);
var clientX = pageX - scrollLeft;
var clientY = pageY - scrollTop;
var screenX = screenLeft + clientX;
var screenY = screenTop + clientY;
var moveX = typeof event.movementX === "number" ? event.movementX : 0;
var moveY = typeof event.movementY === "number" ? event.movementY : 0;
delete event._stageX;
delete event._stageY;
_extend(event, {
srcElement: srcElement,
fromElement: fromElement,
toElement: toElement,
screenX: screenX,
screenY: screenY,
pageX: pageX,
pageY: pageY,
clientX: clientX,
clientY: clientY,
x: clientX,
y: clientY,
movementX: moveX,
movementY: moveY,
offsetX: 0,
offsetY: 0,
layerX: 0,
layerY: 0
});
}
return event;
};
/**
* Determine if an event's registered handlers should be execute synchronously or asynchronously.
*
* @returns {boolean}
* @private
*/
var _shouldPerformAsync = function(event) {
var eventType = event && typeof event.type === "string" && event.type || "";
return !/^(?:(?:before)?copy|destroy)$/.test(eventType);
};
/**
* Control if a callback should be executed asynchronously or not.
*
* @returns `undefined`
* @private
*/
var _dispatchCallback = function(func, context, args, async) {
if (async) {
_setTimeout(function() {
func.apply(context, args);
}, 0);
} else {
func.apply(context, args);
}
};
/**
* Handle the actual dispatching of events to client instances.
*
* @returns `undefined`
* @private
*/
var _dispatchCallbacks = function(event) {
if (!(typeof event === "object" && event && event.type)) {
return;
}
var async = _shouldPerformAsync(event);
var wildcardTypeHandlers = _handlers["*"] || [];
var specificTypeHandlers = _handlers[event.type] || [];
var handlers = wildcardTypeHandlers.concat(specificTypeHandlers);
if (handlers && handlers.length) {
var i, len, func, context, eventCopy, originalContext = this;
for (i = 0, len = handlers.length; i < len; i++) {
func = handlers[i];
context = originalContext;
if (typeof func === "string" && typeof _window[func] === "function") {
func = _window[func];
}
if (typeof func === "object" && func && typeof func.handleEvent === "function") {
context = func;
func = func.handleEvent;
}
if (typeof func === "function") {
eventCopy = _extend({}, event);
_dispatchCallback(func, context, [ eventCopy ], async);
}
}
}
return this;
};
/**
* Preprocess any special behaviors, reactions, or state changes after receiving this event.
* Executes only once per event emitted, NOT once per client.
* @private
*/
var _preprocessEvent = function(event) {
var element = event.target || _currentElement || null;
var sourceIsSwf = event._source === "swf";
delete event._source;
var flashErrorNames = [ "flash-disabled", "flash-outdated", "flash-unavailable", "flash-deactivated", "flash-overdue" ];
switch (event.type) {
case "error":
if (flashErrorNames.indexOf(event.name) !== -1) {
_extend(_flashState, {
disabled: event.name === "flash-disabled",
outdated: event.name === "flash-outdated",
unavailable: event.name === "flash-unavailable",
deactivated: event.name === "flash-deactivated",
overdue: event.name === "flash-overdue",
ready: false
});
}
break;
case "ready":
var wasDeactivated = _flashState.deactivated === true;
_extend(_flashState, {
disabled: false,
outdated: false,
unavailable: false,
deactivated: false,
overdue: wasDeactivated,
ready: !wasDeactivated
});
break;
case "copy":
var textContent, htmlContent, targetEl = event.relatedTarget;
if (!(_clipData["text/html"] || _clipData["text/plain"]) && targetEl && (htmlContent = targetEl.value || targetEl.outerHTML || targetEl.innerHTML) && (textContent = targetEl.value || targetEl.textContent || targetEl.innerText)) {
event.clipboardData.clearData();
event.clipboardData.setData("text/plain", textContent);
if (htmlContent !== textContent) {
event.clipboardData.setData("text/html", htmlContent);
}
} else if (!_clipData["text/plain"] && event.target && (textContent = event.target.getAttribute("data-clipboard-text"))) {
event.clipboardData.clearData();
event.clipboardData.setData("text/plain", textContent);
}
break;
case "aftercopy":
ZeroClipboard.clearData();
if (element && element !== _safeActiveElement() && element.focus) {
element.focus();
}
break;
case "_mouseover":
ZeroClipboard.focus(element);
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
if (element && element !== event.relatedTarget && !_containedBy(event.relatedTarget, element)) {
_fireMouseEvent(_extend({}, event, {
type: "mouseenter",
bubbles: false,
cancelable: false
}));
}
_fireMouseEvent(_extend({}, event, {
type: "mouseover"
}));
}
break;
case "_mouseout":
ZeroClipboard.blur();
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
if (element && element !== event.relatedTarget && !_containedBy(event.relatedTarget, element)) {
_fireMouseEvent(_extend({}, event, {
type: "mouseleave",
bubbles: false,
cancelable: false
}));
}
_fireMouseEvent(_extend({}, event, {
type: "mouseout"
}));
}
break;
case "_mousedown":
_addClass(element, _globalConfig.activeClass);
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
_fireMouseEvent(_extend({}, event, {
type: event.type.slice(1)
}));
}
break;
case "_mouseup":
_removeClass(element, _globalConfig.activeClass);
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
_fireMouseEvent(_extend({}, event, {
type: event.type.slice(1)
}));
}
break;
case "_click":
case "_mousemove":
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
_fireMouseEvent(_extend({}, event, {
type: event.type.slice(1)
}));
}
break;
}
if (/^_(?:click|mouse(?:over|out|down|up|move))$/.test(event.type)) {
return true;
}
};
/**
* Dispatch a synthetic MouseEvent.
*
* @returns `undefined`
* @private
*/
var _fireMouseEvent = function(event) {
if (!(event && typeof event.type === "string" && event)) {
return;
}
var e, target = event.target || null, doc = target && target.ownerDocument || _document, defaults = {
view: doc.defaultView || _window,
canBubble: true,
cancelable: true,
detail: event.type === "click" ? 1 : 0,
button: typeof event.which === "number" ? event.which - 1 : typeof event.button === "number" ? event.button : doc.createEvent ? 0 : 1
}, args = _extend(defaults, event);
if (!target) {
return;
}
if (doc.createEvent && target.dispatchEvent) {
args = [ args.type, args.canBubble, args.cancelable, args.view, args.detail, args.screenX, args.screenY, args.clientX, args.clientY, args.ctrlKey, args.altKey, args.shiftKey, args.metaKey, args.button, args.relatedTarget ];
e = doc.createEvent("MouseEvents");
if (e.initMouseEvent) {
e.initMouseEvent.apply(e, args);
e._source = "js";
target.dispatchEvent(e);
}
}
};
/**
* Create the HTML bridge element to embed the Flash object into.
* @private
*/
var _createHtmlBridge = function() {
var container = _document.createElement("div");
container.id = _globalConfig.containerId;
container.className = _globalConfig.containerClass;
container.style.position = "absolute";
container.style.left = "0px";
container.style.top = "-9999px";
container.style.width = "1px";
container.style.height = "1px";
container.style.zIndex = "" + _getSafeZIndex(_globalConfig.zIndex);
return container;
};
/**
* Get the HTML element container that wraps the Flash bridge object/element.
* @private
*/
var _getHtmlBridge = function(flashBridge) {
var htmlBridge = flashBridge && flashBridge.parentNode;
while (htmlBridge && htmlBridge.nodeName === "OBJECT" && htmlBridge.parentNode) {
htmlBridge = htmlBridge.parentNode;
}
return htmlBridge || null;
};
/**
* Create the SWF object.
*
* @returns The SWF object reference.
* @private
*/
var _embedSwf = function() {
var len, flashBridge = _flashState.bridge, container = _getHtmlBridge(flashBridge);
if (!flashBridge) {
var allowScriptAccess = _determineScriptAccess(_window.location.host, _globalConfig);
var allowNetworking = allowScriptAccess === "never" ? "none" : "all";
var flashvars = _vars(_globalConfig);
var swfUrl = _globalConfig.swfPath + _cacheBust(_globalConfig.swfPath, _globalConfig);
container = _createHtmlBridge();
var divToBeReplaced = _document.createElement("div");
container.appendChild(divToBeReplaced);
_document.body.appendChild(container);
var tmpDiv = _document.createElement("div");
var oldIE = _flashState.pluginType === "activex";
tmpDiv.innerHTML = '<object id="' + _globalConfig.swfObjectId + '" name="' + _globalConfig.swfObjectId + '" ' + 'width="100%" height="100%" ' + (oldIE ? 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' : 'type="application/x-shockwave-flash" data="' + swfUrl + '"') + ">" + (oldIE ? '<param name="movie" value="' + swfUrl + '"/>' : "") + '<param name="allowScriptAccess" value="' + allowScriptAccess + '"/>' + '<param name="allowNetworking" value="' + allowNetworking + '"/>' + '<param name="menu" value="false"/>' + '<param name="wmode" value="transparent"/>' + '<param name="flashvars" value="' + flashvars + '"/>' + "</object>";
flashBridge = tmpDiv.firstChild;
tmpDiv = null;
flashBridge.ZeroClipboard = ZeroClipboard;
container.replaceChild(flashBridge, divToBeReplaced);
}
if (!flashBridge) {
flashBridge = _document[_globalConfig.swfObjectId];
if (flashBridge && (len = flashBridge.length)) {
flashBridge = flashBridge[len - 1];
}
if (!flashBridge && container) {
flashBridge = container.firstChild;
}
}
_flashState.bridge = flashBridge || null;
return flashBridge;
};
/**
* Destroy the SWF object.
* @private
*/
var _unembedSwf = function() {
var flashBridge = _flashState.bridge;
if (flashBridge) {
var htmlBridge = _getHtmlBridge(flashBridge);
if (htmlBridge) {
if (_flashState.pluginType === "activex" && "readyState" in flashBridge) {
flashBridge.style.display = "none";
(function removeSwfFromIE() {
if (flashBridge.readyState === 4) {
for (var prop in flashBridge) {
if (typeof flashBridge[prop] === "function") {
flashBridge[prop] = null;
}
}
if (flashBridge.parentNode) {
flashBridge.parentNode.removeChild(flashBridge);
}
if (htmlBridge.parentNode) {
htmlBridge.parentNode.removeChild(htmlBridge);
}
} else {
_setTimeout(removeSwfFromIE, 10);
}
})();
} else {
if (flashBridge.parentNode) {
flashBridge.parentNode.removeChild(flashBridge);
}
if (htmlBridge.parentNode) {
htmlBridge.parentNode.removeChild(htmlBridge);
}
}
}
_flashState.ready = null;
_flashState.bridge = null;
_flashState.deactivated = null;
}
};
/**
* Map the data format names of the "clipData" to Flash-friendly names.
*
* @returns A new transformed object.
* @private
*/
var _mapClipDataToFlash = function(clipData) {
var newClipData = {}, formatMap = {};
if (!(typeof clipData === "object" && clipData)) {
return;
}
for (var dataFormat in clipData) {
if (dataFormat && _hasOwn.call(clipData, dataFormat) && typeof clipData[dataFormat] === "string" && clipData[dataFormat]) {
switch (dataFormat.toLowerCase()) {
case "text/plain":
case "text":
case "air:text":
case "flash:text":
newClipData.text = clipData[dataFormat];
formatMap.text = dataFormat;
break;
case "text/html":
case "html":
case "air:html":
case "flash:html":
newClipData.html = clipData[dataFormat];
formatMap.html = dataFormat;
break;
case "application/rtf":
case "text/rtf":
case "rtf":
case "richtext":
case "air:rtf":
case "flash:rtf":
newClipData.rtf = clipData[dataFormat];
formatMap.rtf = dataFormat;
break;
default:
break;
}
}
}
return {
data: newClipData,
formatMap: formatMap
};
};
/**
* Map the data format names from Flash-friendly names back to their original "clipData" names (via a format mapping).
*
* @returns A new transformed object.
* @private
*/
var _mapClipResultsFromFlash = function(clipResults, formatMap) {
if (!(typeof clipResults === "object" && clipResults && typeof formatMap === "object" && formatMap)) {
return clipResults;
}
var newResults = {};
for (var prop in clipResults) {
if (_hasOwn.call(clipResults, prop)) {
if (prop !== "success" && prop !== "data") {
newResults[prop] = clipResults[prop];
continue;
}
newResults[prop] = {};
var tmpHash = clipResults[prop];
for (var dataFormat in tmpHash) {
if (dataFormat && _hasOwn.call(tmpHash, dataFormat) && _hasOwn.call(formatMap, dataFormat)) {
newResults[prop][formatMap[dataFormat]] = tmpHash[dataFormat];
}
}
}
}
return newResults;
};
/**
* Will look at a path, and will create a "?noCache={time}" or "&noCache={time}"
* query param string to return. Does NOT append that string to the original path.
* This is useful because ExternalInterface often breaks when a Flash SWF is cached.
*
* @returns The `noCache` query param with necessary "?"/"&" prefix.
* @private
*/
var _cacheBust = function(path, options) {
var cacheBust = options == null || options && options.cacheBust === true;
if (cacheBust) {
return (path.indexOf("?") === -1 ? "?" : "&") + "noCache=" + _now();
} else {
return "";
}
};
/**
* Creates a query string for the FlashVars param.
* Does NOT include the cache-busting query param.
*
* @returns FlashVars query string
* @private
*/
var _vars = function(options) {
var i, len, domain, domains, str = "", trustedOriginsExpanded = [];
if (options.trustedDomains) {
if (typeof options.trustedDomains === "string") {
domains = [ options.trustedDomains ];
} else if (typeof options.trustedDomains === "object" && "length" in options.trustedDomains) {
domains = options.trustedDomains;
}
}
if (domains && domains.length) {
for (i = 0, len = domains.length; i < len; i++) {
if (_hasOwn.call(domains, i) && domains[i] && typeof domains[i] === "string") {
domain = _extractDomain(domains[i]);
if (!domain) {
continue;
}
if (domain === "*") {
trustedOriginsExpanded.length = 0;
trustedOriginsExpanded.push(domain);
break;
}
trustedOriginsExpanded.push.apply(trustedOriginsExpanded, [ domain, "//" + domain, _window.location.protocol + "//" + domain ]);
}
}
}
if (trustedOriginsExpanded.length) {
str += "trustedOrigins=" + _encodeURIComponent(trustedOriginsExpanded.join(","));
}
if (options.forceEnhancedClipboard === true) {
str += (str ? "&" : "") + "forceEnhancedClipboard=true";
}
if (typeof options.swfObjectId === "string" && options.swfObjectId) {
str += (str ? "&" : "") + "swfObjectId=" + _encodeURIComponent(options.swfObjectId);
}
return str;
};
/**
* Extract the domain (e.g. "github.com") from an origin (e.g. "https://github.com") or
* URL (e.g. "https://github.com/zeroclipboard/zeroclipboard/").
*
* @returns the domain
* @private
*/
var _extractDomain = function(originOrUrl) {
if (originOrUrl == null || originOrUrl === "") {
return null;
}
originOrUrl = originOrUrl.replace(/^\s+|\s+$/g, "");
if (originOrUrl === "") {
return null;
}
var protocolIndex = originOrUrl.indexOf("//");
originOrUrl = protocolIndex === -1 ? originOrUrl : originOrUrl.slice(protocolIndex + 2);
var pathIndex = originOrUrl.indexOf("/");
originOrUrl = pathIndex === -1 ? originOrUrl : protocolIndex === -1 || pathIndex === 0 ? null : originOrUrl.slice(0, pathIndex);
if (originOrUrl && originOrUrl.slice(-4).toLowerCase() === ".swf") {
return null;
}
return originOrUrl || null;
};
/**
* Set `allowScriptAccess` based on `trustedDomains` and `window.location.host` vs. `swfPath`.
*
* @returns The appropriate script access level.
* @private
*/
var _determineScriptAccess = function() {
var _extractAllDomains = function(origins) {
var i, len, tmp, resultsArray = [];
if (typeof origins === "string") {
origins = [ origins ];
}
if (!(typeof origins === "object" && origins && typeof origins.length === "number")) {
return resultsArray;
}
for (i = 0, len = origins.length; i < len; i++) {
if (_hasOwn.call(origins, i) && (tmp = _extractDomain(origins[i]))) {
if (tmp === "*") {
resultsArray.length = 0;
resultsArray.push("*");
break;
}
if (resultsArray.indexOf(tmp) === -1) {
resultsArray.push(tmp);
}
}
}
return resultsArray;
};
return function(currentDomain, configOptions) {
var swfDomain = _extractDomain(configOptions.swfPath);
if (swfDomain === null) {
swfDomain = currentDomain;
}
var trustedDomains = _extractAllDomains(configOptions.trustedDomains);
var len = trustedDomains.length;
if (len > 0) {
if (len === 1 && trustedDomains[0] === "*") {
return "always";
}
if (trustedDomains.indexOf(currentDomain) !== -1) {
if (len === 1 && currentDomain === swfDomain) {
return "sameDomain";
}
return "always";
}
}
return "never";
};
}();
/**
* Get the currently active/focused DOM element.
*
* @returns the currently active/focused element, or `null`
* @private
*/
var _safeActiveElement = function() {
try {
return _document.activeElement;
} catch (err) {
return null;
}
};
/**
* Add a class to an element, if it doesn't already have it.
*
* @returns The element, with its new class added.
* @private
*/
var _addClass = function(element, value) {
if (!element || element.nodeType !== 1) {
return element;
}
if (element.classList) {
if (!element.classList.contains(value)) {
element.classList.add(value);
}
return element;
}
if (value && typeof value === "string") {
var classNames = (value || "").split(/\s+/);
if (element.nodeType === 1) {
if (!element.className) {
element.className = value;
} else {
var className = " " + element.className + " ", setClass = element.className;
for (var c = 0, cl = classNames.length; c < cl; c++) {
if (className.indexOf(" " + classNames[c] + " ") < 0) {
setClass += " " + classNames[c];
}
}
element.className = setClass.replace(/^\s+|\s+$/g, "");
}
}
}
return element;
};
/**
* Remove a class from an element, if it has it.
*
* @returns The element, with its class removed.
* @private
*/
var _removeClass = function(element, value) {
if (!element || element.nodeType !== 1) {
return element;
}
if (element.classList) {
if (element.classList.contains(value)) {
element.classList.remove(value);
}
return element;
}
if (typeof value === "string" && value) {
var classNames = value.split(/\s+/);
if (element.nodeType === 1 && element.className) {
var className = (" " + element.className + " ").replace(/[\n\t]/g, " ");
for (var c = 0, cl = classNames.length; c < cl; c++) {
className = className.replace(" " + classNames[c] + " ", " ");
}
element.className = className.replace(/^\s+|\s+$/g, "");
}
}
return element;
};
/**
* Attempt to interpret the element's CSS styling. If `prop` is `"cursor"`,
* then we assume that it should be a hand ("pointer") cursor if the element
* is an anchor element ("a" tag).
*
* @returns The computed style property.
* @private
*/
var _getStyle = function(el, prop) {
var value = _window.getComputedStyle(el, null).getPropertyValue(prop);
if (prop === "cursor") {
if (!value || value === "auto") {
if (el.nodeName === "A") {
return "pointer";
}
}
}
return value;
};
/**
* Get the zoom factor of the browser. Always returns `1.0`, except at
* non-default zoom levels in IE<8 and some older versions of WebKit.
*
* @returns Floating unit percentage of the zoom factor (e.g. 150% = `1.5`).
* @private
*/
var _getZoomFactor = function() {
var rect, physicalWidth, logicalWidth, zoomFactor = 1;
if (typeof _document.body.getBoundingClientRect === "function") {
rect = _document.body.getBoundingClientRect();
physicalWidth = rect.right - rect.left;
logicalWidth = _document.body.offsetWidth;
zoomFactor = _round(physicalWidth / logicalWidth * 100) / 100;
}
return zoomFactor;
};
/**
* Get the DOM positioning info of an element.
*
* @returns Object containing the element's position, width, and height.
* @private
*/
var _getDOMObjectPosition = function(obj) {
var info = {
left: 0,
top: 0,
width: 0,
height: 0
};
if (obj.getBoundingClientRect) {
var rect = obj.getBoundingClientRect();
var pageXOffset, pageYOffset, zoomFactor;
if ("pageXOffset" in _window && "pageYOffset" in _window) {
pageXOffset = _window.pageXOffset;
pageYOffset = _window.pageYOffset;
} else {
zoomFactor = _getZoomFactor();
pageXOffset = _round(_document.documentElement.scrollLeft / zoomFactor);
pageYOffset = _round(_document.documentElement.scrollTop / zoomFactor);
}
var leftBorderWidth = _document.documentElement.clientLeft || 0;
var topBorderWidth = _document.documentElement.clientTop || 0;
info.left = rect.left + pageXOffset - leftBorderWidth;
info.top = rect.top + pageYOffset - topBorderWidth;
info.width = "width" in rect ? rect.width : rect.right - rect.left;
info.height = "height" in rect ? rect.height : rect.bottom - rect.top;
}
return info;
};
/**
* Reposition the Flash object to cover the currently activated element.
*
* @returns `undefined`
* @private
*/
var _reposition = function() {
var htmlBridge;
if (_currentElement && (htmlBridge = _getHtmlBridge(_flashState.bridge))) {
var pos = _getDOMObjectPosition(_currentElement);
_extend(htmlBridge.style, {
width: pos.width + "px",
height: pos.height + "px",
top: pos.top + "px",
left: pos.left + "px",
zIndex: "" + _getSafeZIndex(_globalConfig.zIndex)
});
}
};
/**
* Sends a signal to the Flash object to display the hand cursor if `true`.
*
* @returns `undefined`
* @private
*/
var _setHandCursor = function(enabled) {
if (_flashState.ready === true) {
if (_flashState.bridge && typeof _flashState.bridge.setHandCursor === "function") {
_flashState.bridge.setHandCursor(enabled);
} else {
_flashState.ready = false;
}
}
};
/**
* Get a safe value for `zIndex`
*
* @returns an integer, or "auto"
* @private
*/
var _getSafeZIndex = function(val) {
if (/^(?:auto|inherit)$/.test(val)) {
return val;
}
var zIndex;
if (typeof val === "number" && !_isNaN(val)) {
zIndex = val;
} else if (typeof val === "string") {
zIndex = _getSafeZIndex(_parseInt(val, 10));
}
return typeof zIndex === "number" ? zIndex : "auto";
};
/**
* Detect the Flash Player status, version, and plugin type.
*
* @see {@link https://code.google.com/p/doctype-mirror/wiki/ArticleDetectFlash#The_code}
* @see {@link http://stackoverflow.com/questions/12866060/detecting-pepper-ppapi-flash-with-javascript}
*
* @returns `undefined`
* @private
*/
var _detectFlashSupport = function(ActiveXObject) {
var plugin, ax, mimeType, hasFlash = false, isActiveX = false, isPPAPI = false, flashVersion = "";
/**
* Derived from Apple's suggested sniffer.
* @param {String} desc e.g. "Shockwave Flash 7.0 r61"
* @returns {String} "7.0.61"
* @private
*/
function parseFlashVersion(desc) {
var matches = desc.match(/[\d]+/g);
matches.length = 3;
return matches.join(".");
}
function isPepperFlash(flashPlayerFileName) {
return !!flashPlayerFileName && (flashPlayerFileName = flashPlayerFileName.toLowerCase()) && (/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(flashPlayerFileName) || flashPlayerFileName.slice(-13) === "chrome.plugin");
}
function inspectPlugin(plugin) {
if (plugin) {
hasFlash = true;
if (plugin.version) {
flashVersion = parseFlashVersion(plugin.version);
}
if (!flashVersion && plugin.description) {
flashVersion = parseFlashVersion(plugin.description);
}
if (plugin.filename) {
isPPAPI = isPepperFlash(plugin.filename);
}
}
}
if (_navigator.plugins && _navigator.plugins.length) {
plugin = _navigator.plugins["Shockwave Flash"];
inspectPlugin(plugin);
if (_navigator.plugins["Shockwave Flash 2.0"]) {
hasFlash = true;
flashVersion = "2.0.0.11";
}
} else if (_navigator.mimeTypes && _navigator.mimeTypes.length) {
mimeType = _navigator.mimeTypes["application/x-shockwave-flash"];
plugin = mimeType && mimeType.enabledPlugin;
inspectPlugin(plugin);
} else if (typeof ActiveXObject !== "undefined") {
isActiveX = true;
try {
ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
hasFlash = true;
flashVersion = parseFlashVersion(ax.GetVariable("$version"));
} catch (e1) {
try {
ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
hasFlash = true;
flashVersion = "6.0.21";
} catch (e2) {
try {
ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
hasFlash = true;
flashVersion = parseFlashVersion(ax.GetVariable("$version"));
} catch (e3) {
isActiveX = false;
}
}
}
}
_flashState.disabled = hasFlash !== true;
_flashState.outdated = flashVersion && _parseFloat(flashVersion) < _parseFloat(_minimumFlashVersion);
_flashState.version = flashVersion || "0.0.0";
_flashState.pluginType = isPPAPI ? "pepper" : isActiveX ? "activex" : hasFlash ? "netscape" : "unknown";
};
/**
* Invoke the Flash detection algorithms immediately upon inclusion so we're not waiting later.
*/
_detectFlashSupport(_ActiveXObject);
/**
* A shell constructor for `ZeroClipboard` client instances.
*
* @constructor
*/
var ZeroClipboard = function() {
if (!(this instanceof ZeroClipboard)) {
return new ZeroClipboard();
}
if (typeof ZeroClipboard._createClient === "function") {
ZeroClipboard._createClient.apply(this, _args(arguments));
}
};
/**
* The ZeroClipboard library's version number.
*
* @static
* @readonly
* @property {string}
*/
_defineProperty(ZeroClipboard, "version", {
value: "2.1.2",
writable: false,
configurable: true,
enumerable: true
});
/**
* Update or get a copy of the ZeroClipboard global configuration.
* Returns a copy of the current/updated configuration.
*
* @returns Object
* @static
*/
ZeroClipboard.config = function() {
return _config.apply(this, _args(arguments));
};
/**
* Diagnostic method that describes the state of the browser, Flash Player, and ZeroClipboard.
*
* @returns Object
* @static
*/
ZeroClipboard.state = function() {
return _state.apply(this, _args(arguments));
};
/**
* Check if Flash is unusable for any reason: disabled, outdated, deactivated, etc.
*
* @returns Boolean
* @static
*/
ZeroClipboard.isFlashUnusable = function() {
return _isFlashUnusable.apply(this, _args(arguments));
};
/**
* Register an event listener.
*
* @returns `ZeroClipboard`
* @static
*/
ZeroClipboard.on = function() {
return _on.apply(this, _args(arguments));
};
/**
* Unregister an event listener.
* If no `listener` function/object is provided, it will unregister all listeners for the provided `eventType`.
* If no `eventType` is provided, it will unregister all listeners for every event type.
*
* @returns `ZeroClipboard`
* @static
*/
ZeroClipboard.off = function() {
return _off.apply(this, _args(arguments));
};
/**
* Retrieve event listeners for an `eventType`.
* If no `eventType` is provided, it will retrieve all listeners for every event type.
*
* @returns array of listeners for the `eventType`; if no `eventType`, then a map/hash object of listeners for all event types; or `null`
*/
ZeroClipboard.handlers = function() {
return _listeners.apply(this, _args(arguments));
};
/**
* Event emission receiver from the Flash object, forwarding to any registered JavaScript event listeners.
*
* @returns For the "copy" event, returns the Flash-friendly "clipData" object; otherwise `undefined`.
* @static
*/
ZeroClipboard.emit = function() {
return _emit.apply(this, _args(arguments));
};
/**
* Create and embed the Flash object.
*
* @returns The Flash object
* @static
*/
ZeroClipboard.create = function() {
return _create.apply(this, _args(arguments));
};
/**
* Self-destruct and clean up everything, including the embedded Flash object.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.destroy = function() {
return _destroy.apply(this, _args(arguments));
};
/**
* Set the pending data for clipboard injection.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.setData = function() {
return _setData.apply(this, _args(arguments));
};
/**
* Clear the pending data for clipboard injection.
* If no `format` is provided, all pending data formats will be cleared.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.clearData = function() {
return _clearData.apply(this, _args(arguments));
};
/**
* Get a copy of the pending data for clipboard injection.
* If no `format` is provided, a copy of ALL pending data formats will be returned.
*
* @returns `String` or `Object`
* @static
*/
ZeroClipboard.getData = function() {
return _getData.apply(this, _args(arguments));
};
/**
* Sets the current HTML object that the Flash object should overlay. This will put the global
* Flash object on top of the current element; depending on the setup, this may also set the
* pending clipboard text data as well as the Flash object's wrapping element's title attribute
* based on the underlying HTML element and ZeroClipboard configuration.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.focus = ZeroClipboard.activate = function() {
return _focus.apply(this, _args(arguments));
};
/**
* Un-overlays the Flash object. This will put the global Flash object off-screen; depending on
* the setup, this may also unset the Flash object's wrapping element's title attribute based on
* the underlying HTML element and ZeroClipboard configuration.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.blur = ZeroClipboard.deactivate = function() {
return _blur.apply(this, _args(arguments));
};
/**
* Returns the currently focused/"activated" HTML element that the Flash object is wrapping.
*
* @returns `HTMLElement` or `null`
* @static
*/
ZeroClipboard.activeElement = function() {
return _activeElement.apply(this, _args(arguments));
};
if (typeof define === "function" && define.amd) {
define(function() {
return ZeroClipboard;
});
} else if (typeof module === "object" && module && typeof module.exports === "object" && module.exports) {
module.exports = ZeroClipboard;
} else {
window.ZeroClipboard = ZeroClipboard;
}
})(function() {
return this || window;
}()); |
volunteer_planner/static/js/jquery1.11.3.min.js | juliabiro/volunteer_planner | /*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;
return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ca()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===ca()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?aa:ba):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=aa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=aa,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=aa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=ba;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=ba),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function da(a){var b=ea.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var ea="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fa=/ jQuery\d+="(?:null|\d+)"/g,ga=new RegExp("<(?:"+ea+")[\\s/>]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/<tbody/i,la=/<|&#?\w+;/,ma=/<(?:script|style|link)/i,na=/checked\s*(?:[^=]|=\s*.checked.)/i,oa=/^$|\/(?:java|ecma)script/i,pa=/^true\/(.*)/,qa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ra={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?"<table>"!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ca[0].contentWindow||Ca[0].contentDocument).document,b.write(),b.close(),c=Ea(a,b),Ca.detach()),Da[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Ga=/^margin/,Ha=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ia,Ja,Ka=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ia=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Ha.test(g)&&Ga.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ia=function(a){return a.currentStyle},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ha.test(g)&&!Ka.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function La(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Ma=/alpha\([^)]*\)/i,Na=/opacity\s*=\s*([^)]*)/,Oa=/^(none|table(?!-c[ea]).+)/,Pa=new RegExp("^("+S+")(.*)$","i"),Qa=new RegExp("^([+-])=("+S+")","i"),Ra={position:"absolute",visibility:"hidden",display:"block"},Sa={letterSpacing:"0",fontWeight:"400"},Ta=["Webkit","O","Moz","ms"];function Ua(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ta.length;while(e--)if(b=Ta[e]+c,b in a)return b;return d}function Va(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fa(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wa(a,b,c){var d=Pa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Ya(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ia(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Ja(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ha.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xa(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ja(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ua(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qa.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ua(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Ja(a,b,d)),"normal"===f&&b in Sa&&(f=Sa[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Oa.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Ra,function(){return Ya(a,b,d)}):Ya(a,b,d):void 0},set:function(a,c,d){var e=d&&Ia(a);return Wa(a,c,d?Xa(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Na.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Ma,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Ma.test(f)?f.replace(Ma,e):f+" "+e)}}),m.cssHooks.marginRight=La(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Ja,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Ga.test(a)||(m.cssHooks[a+b].set=Wa)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ia(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Va(this,!0)},hide:function(){return Va(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Za(a,b,c,d,e){
return new Za.prototype.init(a,b,c,d,e)}m.Tween=Za,Za.prototype={constructor:Za,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Za.propHooks[this.prop];return a&&a.get?a.get(this):Za.propHooks._default.get(this)},run:function(a){var b,c=Za.propHooks[this.prop];return this.options.duration?this.pos=b=m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Za.propHooks._default.set(this),this}},Za.prototype.init.prototype=Za.prototype,Za.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Za.propHooks.scrollTop=Za.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Za.prototype.init,m.fx.step={};var $a,_a,ab=/^(?:toggle|show|hide)$/,bb=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cb=/queueHooks$/,db=[ib],eb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bb.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bb.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fb(){return setTimeout(function(){$a=void 0}),$a=m.now()}function gb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hb(a,b,c){for(var d,e=(eb[b]||[]).concat(eb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fa(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fa(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ab.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fa(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hb(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=db.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$a||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$a||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);g>f;f++)if(d=db[f].call(j,a,k,j.opts))return d;return m.map(k,hb,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kb,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],eb[c]=eb[c]||[],eb[c].unshift(b)},prefilter:function(a,b){b?db.unshift(a):db.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kb(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),m.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($a=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$a=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_a||(_a=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_a),_a=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lb=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lb,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mb,nb,ob=m.expr.attrHandle,pb=/^(?:checked|selected)$/i,qb=k.getSetAttribute,rb=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nb:mb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rb&&qb||!pb.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qb?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nb={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rb&&qb||!pb.test(c)?a.setAttribute(!qb&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ob[b]||m.find.attr;ob[b]=rb&&qb||!pb.test(b)?function(a,b,d){var e,f;return d||(f=ob[b],ob[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,ob[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rb&&qb||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mb&&mb.set(a,b,c)}}),qb||(mb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},ob.id=ob.name=ob.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mb.set},m.attrHooks.contenteditable={set:function(a,b,c){mb.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sb=/^(?:input|select|textarea|button|object)$/i,tb=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sb.test(a.nodeName)||tb.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var ub=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ub," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vb=m.now(),wb=/\?/,xb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yb,zb,Ab=/#.*$/,Bb=/([?&])_=[^&]*/,Cb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Db=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Eb=/^(?:GET|HEAD)$/,Fb=/^\/\//,Gb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hb={},Ib={},Jb="*/".concat("*");try{zb=location.href}catch(Kb){zb=y.createElement("a"),zb.href="",zb=zb.href}yb=Gb.exec(zb.toLowerCase())||[];function Lb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mb(a,b,c,d){var e={},f=a===Ib;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nb(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Ob(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zb,type:"GET",isLocal:Db.test(yb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nb(Nb(a,m.ajaxSettings),b):Nb(m.ajaxSettings,a)},ajaxPrefilter:Lb(Hb),ajaxTransport:Lb(Ib),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cb.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zb)+"").replace(Ab,"").replace(Fb,yb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gb.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yb[1]&&c[2]===yb[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yb[3]||("http:"===yb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mb(Hb,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Eb.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wb.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bb.test(e)?e.replace(Bb,"$1_="+vb++):e+(wb.test(e)?"&":"?")+"_="+vb++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jb+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mb(Ib,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Ob(k,v,c)),u=Pb(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qb=/%20/g,Rb=/\[\]$/,Sb=/\r?\n/g,Tb=/^(?:submit|button|image|reset|file)$/i,Ub=/^(?:input|select|textarea|keygen)/i;function Vb(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rb.test(a)?d(a,e):Vb(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vb(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vb(c,a[c],b,e);return d.join("&").replace(Qb,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Ub.test(this.nodeName)&&!Tb.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sb,"\r\n")}}):{name:b.name,value:c.replace(Sb,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zb()||$b()}:Zb;var Wb=0,Xb={},Yb=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xb)Xb[a](void 0,!0)}),k.cors=!!Yb&&"withCredentials"in Yb,Yb=k.ajax=!!Yb,Yb&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xb[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xb[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zb(){try{return new a.XMLHttpRequest}catch(b){}}function $b(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _b=[],ac=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_b.pop()||m.expando+"_"+vb++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ac.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ac.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ac,"$1"+e):b.jsonp!==!1&&(b.url+=(wb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_b.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bc=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bc)return bc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cc=a.document.documentElement;function dc(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cc;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cc})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=La(k.pixelPosition,function(a,c){return c?(c=Ja(a,b),Ha.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ec=a.jQuery,fc=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fc),b&&a.jQuery===m&&(a.jQuery=ec),m},typeof b===K&&(a.jQuery=a.$=m),m});
|
src/front/js/routes.js | raccoon-app/ui-kit | import React from 'react';
import { Route } from 'react-router';
import { IndexRoute } from 'react-router';
import Auth from './containers/Auth';
import ProjectSelection from './containers/ProjectSelection';
import Project from './containers/Project';
export default () => (
<Route path="/" >
<IndexRoute component={Auth} />
<Route path="projects" component={ProjectSelection} />
<Route path="project/:id" component={Project} />
</Route>
);
|
node_modules/bs-recipes/recipes/webpack.react-transform-hmr/app/js/main.js | jessiegacula/jessiegacula.github.io | import React from 'react';
import { render } from 'react-dom';
// It's important to not define HelloWorld component right in this file
// because in that case it will do full page reload on change
import HelloWorld from './HelloWorld.jsx';
render(<HelloWorld />, document.getElementById('react-root'));
|
packages/material-ui-icons/src/FilterDramaRounded.js | kybarg/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.61 5.64 5.36 8.04 2.35 8.36 0 10.9 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6.17c-2.09 0-3.95-1.53-4.15-3.61C1.79 12.01 3.66 10 6 10c1.92 0 3.53 1.36 3.91 3.17.1.48.5.83.98.83.61 0 1.11-.55.99-1.15-.43-2.24-2.11-4.03-4.29-4.63 1.1-1.46 2.89-2.37 4.89-2.2 2.88.25 5.01 2.82 5.01 5.71V12h1.37c1.45 0 2.79.97 3.07 2.4.39 1.91-1.08 3.6-2.93 3.6z" />
, 'FilterDramaRounded');
|
server/sonar-web/src/main/js/apps/code/components/App.js | Builders-SonarSource/sonarqube-bis | /*
* SonarQube
* Copyright (C) 2009-2016 SonarSource SA
* mailto:contact AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import classNames from 'classnames';
import React from 'react';
import { connect } from 'react-redux';
import Components from './Components';
import Breadcrumbs from './Breadcrumbs';
import SourceViewer from './../../../components/source-viewer/SourceViewer';
import Search from './Search';
import ListFooter from '../../../components/controls/ListFooter';
import { retrieveComponentChildren, retrieveComponent, loadMoreChildren, parseError } from '../utils';
import { addComponent, addComponentBreadcrumbs, clearBucket } from '../bucket';
import { getComponent } from '../../../store/rootReducer';
import '../code.css';
class App extends React.Component {
state = {
loading: true,
baseComponent: null,
components: null,
breadcrumbs: [],
total: 0,
page: 0,
sourceViewer: null,
error: null
};
componentDidMount () {
this.mounted = true;
this.handleComponentChange();
}
componentDidUpdate (prevProps) {
if (prevProps.component !== this.props.component) {
this.handleComponentChange();
} else if (prevProps.location !== this.props.location) {
this.handleUpdate();
}
}
componentWillUnmount () {
clearBucket();
this.mounted = false;
}
handleComponentChange () {
const { component } = this.props;
// we already know component's breadcrumbs,
addComponentBreadcrumbs(component.key, component.breadcrumbs);
this.setState({ loading: true });
const isView = component.qualifier === 'VW' || component.qualifier === 'SVW';
retrieveComponentChildren(component.key, isView).then(r => {
addComponent(r.baseComponent);
this.handleUpdate();
}).catch(e => {
if (this.mounted) {
this.setState({ loading: false });
parseError(e).then(this.handleError.bind(this));
}
});
}
loadComponent (componentKey) {
this.setState({ loading: true });
const isView = this.props.component.qualifier === 'VW' || this.props.component.qualifier === 'SVW';
retrieveComponent(componentKey, isView).then(r => {
if (this.mounted) {
if (['FIL', 'UTS'].includes(r.component.qualifier)) {
this.setState({
loading: false,
sourceViewer: r.component,
breadcrumbs: r.breadcrumbs,
searchResults: null
});
} else {
this.setState({
loading: false,
baseComponent: r.component,
components: r.components,
breadcrumbs: r.breadcrumbs,
total: r.total,
page: r.page,
sourceViewer: null,
searchResults: null
});
}
}
}).catch(e => {
if (this.mounted) {
this.setState({ loading: false });
parseError(e).then(this.handleError.bind(this));
}
});
}
handleUpdate () {
const { component, location } = this.props;
const { selected } = location.query;
const finalKey = selected || component.key;
this.loadComponent(finalKey);
}
handleLoadMore () {
const { baseComponent, page } = this.state;
const isView = this.props.component.qualifier === 'VW' || this.props.component.qualifier === 'SVW';
loadMoreChildren(baseComponent.key, page + 1, isView).then(r => {
if (this.mounted) {
this.setState({
components: [...this.state.components, ...r.components],
page: r.page,
total: r.total
});
}
}).catch(e => {
if (this.mounted) {
this.setState({ loading: false });
parseError(e).then(this.handleError.bind(this));
}
});
}
handleError (error) {
if (this.mounted) {
this.setState({ error });
}
}
render () {
const { component, location } = this.props;
const {
loading,
error,
baseComponent,
components,
breadcrumbs,
total,
sourceViewer
} = this.state;
const shouldShowSourceViewer = !!sourceViewer;
const shouldShowComponents = !shouldShowSourceViewer && components;
const shouldShowBreadcrumbs = Array.isArray(breadcrumbs) && breadcrumbs.length > 1;
const componentsClassName = classNames('spacer-top', { 'new-loading': loading });
return (
<div className="page page-limited">
{error && (
<div className="alert alert-danger">
{error}
</div>
)}
<Search
location={location}
component={component}
onError={this.handleError.bind(this)}/>
<div className="code-components">
{shouldShowBreadcrumbs && (
<Breadcrumbs
rootComponent={component}
breadcrumbs={breadcrumbs}/>
)}
{shouldShowComponents && (
<div className={componentsClassName}>
<Components
rootComponent={component}
baseComponent={baseComponent}
components={components}/>
</div>
)}
{shouldShowComponents && (
<ListFooter
count={components.length}
total={total}
loadMore={this.handleLoadMore.bind(this)}/>
)}
{shouldShowSourceViewer && (
<div className="spacer-top">
<SourceViewer component={sourceViewer}/>
</div>
)}
</div>
</div>
);
}
}
const mapStateToProps = (state, ownProps) => ({
component: getComponent(state, ownProps.location.query.id)
});
export default connect(mapStateToProps)(App);
|
src/app.js | devgeniem/silverbullet-kitchensink | /*
Here is the main react application used in react-based views.
This is used in urls defined by routes.js and initialized in
config/http.js middleware.
*/
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, browserHistory, createMemoryHistory } from 'react-router';
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
import { syncHistoryWithStore, routerReducer } from 'react-router-redux';
import thunk from 'redux-thunk';
import { Provider } from 'react-redux';
import socketIOClient from 'socket.io-client';
import sailsIOClient from 'sails.io.js';
import Iso from 'iso';
import { I18nextProvider } from 'react-i18next';
import getI18n from './services/i18n';
import routes from './routes';
import reducers from './reducers';
export default class App extends React.Component {
static propTypes = {
state: React.PropTypes.object,
req: React.PropTypes.object,
};
static defaultProps = {
state: {},
req: {},
}
constructor(props) {
super(props);
if (process.browser) {
this.initStoreClientSide();
} else {
this.initStoreServerSide();
}
}
getSyncData() {
const storeData = this.store.getState();
const syncData = {};
Object.keys(storeData).forEach((key) => {
if (storeData[key].sync) {
syncData[key] = storeData[key];
}
});
return syncData;
}
initStoreClientSide() {
Iso.bootstrap((state) => {
const io = sailsIOClient(socketIOClient);
this.store = createStore(
combineReducers({ ...reducers, routing: routerReducer }),
state,
compose(
applyMiddleware(thunk),
window.devToolsExtension ? window.devToolsExtension() : f => f,
),
);
this.history = syncHistoryWithStore(browserHistory, this.store);
//keep server session in sync with store
this.store.subscribe(() => {
var syncData = this.getSyncData();
if (syncData) {
io.socket.post('/api/session', { state: syncData }, (body, JWR) => {
if (JWR.statusCode !== 200) {
// console.error('Failed to save session state: ', JWR.statusCode);
}
});
}
});
});
}
initStoreServerSide() {
const memoryHistory = createMemoryHistory(this.props.req.url);
this.store = createStore(
combineReducers({ ...reducers, routing: routerReducer }),
this.props.state,
applyMiddleware(thunk),
);
this.history = syncHistoryWithStore(memoryHistory, this.store);
}
render() {
const isLoggedIn = !!this.store.getState().user.isLoggedIn;
return (
<I18nextProvider i18n={getI18n(this.store.getState().lang.lang)}>
<Provider store={this.store}>
<Router history={this.history} routes={routes(isLoggedIn)} />
</Provider>
</I18nextProvider>
);
}
}
if (process.browser) {
ReactDOM.render(
<App />,
document.getElementById('app'),
);
} else {
module.exports = App;
}
|
Code_Examples/801Ugly/libraries/p5.sound.js | bensk/SE8_p5js | /*! p5.sound.js v0.3.0 2016-01-31 */
(function (root, factory) {
if (typeof define === 'function' && define.amd)
define('p5.sound', ['p5'], function (p5) { (factory(p5));});
else if (typeof exports === 'object')
factory(require('../p5'));
else
factory(root['p5']);
}(this, function (p5) {
/**
* p5.sound extends p5 with <a href="http://caniuse.com/audio-api"
* target="_blank">Web Audio</a> functionality including audio input,
* playback, analysis and synthesis.
* <br/><br/>
* <a href="#/p5.SoundFile"><b>p5.SoundFile</b></a>: Load and play sound files.<br/>
* <a href="#/p5.Amplitude"><b>p5.Amplitude</b></a>: Get the current volume of a sound.<br/>
* <a href="#/p5.AudioIn"><b>p5.AudioIn</b></a>: Get sound from an input source, typically
* a computer microphone.<br/>
* <a href="#/p5.FFT"><b>p5.FFT</b></a>: Analyze the frequency of sound. Returns
* results from the frequency spectrum or time domain (waveform).<br/>
* <a href="#/p5.Oscillator"><b>p5.Oscillator</b></a>: Generate Sine,
* Triangle, Square and Sawtooth waveforms. Base class of
* <a href="#/p5.Noise">p5.Noise</a> and <a href="#/p5.Pulse">p5.Pulse</a>.
* <br/>
* <a href="#/p5.Env"><b>p5.Env</b></a>: An Envelope is a series
* of fades over time. Often used to control an object's
* output gain level as an "ADSR Envelope" (Attack, Decay,
* Sustain, Release). Can also modulate other parameters.<br/>
* <a href="#/p5.Delay"><b>p5.Delay</b></a>: A delay effect with
* parameters for feedback, delayTime, and lowpass filter.<br/>
* <a href="#/p5.Filter"><b>p5.Filter</b></a>: Filter the frequency range of a
* sound.
* <br/>
* <a href="#/p5.Reverb"><b>p5.Reverb</b></a>: Add reverb to a sound by specifying
* duration and decay. <br/>
* <b><a href="#/p5.Convolver">p5.Convolver</a>:</b> Extends
* <a href="#/p5.Reverb">p5.Reverb</a> to simulate the sound of real
* physical spaces through convolution.<br/>
* <b><a href="#/p5.SoundRecorder">p5.SoundRecorder</a></b>: Record sound for playback
* / save the .wav file.
* <b><a href="#/p5.Phrase">p5.Phrase</a></b>, <b><a href="#/p5.Part">p5.Part</a></b> and
* <b><a href="#/p5.Score">p5.Score</a></b>: Compose musical sequences.
* <br/><br/>
* p5.sound is on <a href="https://github.com/therewasaguy/p5.sound/">GitHub</a>.
* Download the latest version
* <a href="https://github.com/therewasaguy/p5.sound/blob/master/lib/p5.sound.js">here</a>.
*
* @module p5.sound
* @submodule p5.sound
* @for p5.sound
* @main
*/
/**
* p5.sound developed by Jason Sigal for the Processing Foundation, Google Summer of Code 2014. The MIT License (MIT).
*
* http://github.com/therewasaguy/p5.sound
*
* Some of the many audio libraries & resources that inspire p5.sound:
* - TONE.js (c) Yotam Mann, 2014. Licensed under The MIT License (MIT). https://github.com/TONEnoTONE/Tone.js
* - buzz.js (c) Jay Salvat, 2013. Licensed under The MIT License (MIT). http://buzz.jaysalvat.com/
* - Boris Smus Web Audio API book, 2013. Licensed under the Apache License http://www.apache.org/licenses/LICENSE-2.0
* - wavesurfer.js https://github.com/katspaugh/wavesurfer.js
* - Web Audio Components by Jordan Santell https://github.com/web-audio-components
* - Wilm Thoben's Sound library for Processing https://github.com/processing/processing/tree/master/java/libraries/sound
*
* Web Audio API: http://w3.org/TR/webaudio/
*/
var sndcore;
sndcore = function () {
'use strict';
/* AudioContext Monkeypatch
Copyright 2013 Chris Wilson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function (global, exports, perf) {
exports = exports || {};
'use strict';
function fixSetTarget(param) {
if (!param)
// if NYI, just return
return;
if (!param.setTargetAtTime)
param.setTargetAtTime = param.setTargetValueAtTime;
}
if (window.hasOwnProperty('webkitAudioContext') && !window.hasOwnProperty('AudioContext')) {
window.AudioContext = webkitAudioContext;
if (!AudioContext.prototype.hasOwnProperty('createGain'))
AudioContext.prototype.createGain = AudioContext.prototype.createGainNode;
if (!AudioContext.prototype.hasOwnProperty('createDelay'))
AudioContext.prototype.createDelay = AudioContext.prototype.createDelayNode;
if (!AudioContext.prototype.hasOwnProperty('createScriptProcessor'))
AudioContext.prototype.createScriptProcessor = AudioContext.prototype.createJavaScriptNode;
if (!AudioContext.prototype.hasOwnProperty('createPeriodicWave'))
AudioContext.prototype.createPeriodicWave = AudioContext.prototype.createWaveTable;
AudioContext.prototype.internal_createGain = AudioContext.prototype.createGain;
AudioContext.prototype.createGain = function () {
var node = this.internal_createGain();
fixSetTarget(node.gain);
return node;
};
AudioContext.prototype.internal_createDelay = AudioContext.prototype.createDelay;
AudioContext.prototype.createDelay = function (maxDelayTime) {
var node = maxDelayTime ? this.internal_createDelay(maxDelayTime) : this.internal_createDelay();
fixSetTarget(node.delayTime);
return node;
};
AudioContext.prototype.internal_createBufferSource = AudioContext.prototype.createBufferSource;
AudioContext.prototype.createBufferSource = function () {
var node = this.internal_createBufferSource();
if (!node.start) {
node.start = function (when, offset, duration) {
if (offset || duration)
this.noteGrainOn(when || 0, offset, duration);
else
this.noteOn(when || 0);
};
} else {
node.internal_start = node.start;
node.start = function (when, offset, duration) {
if (typeof duration !== 'undefined')
node.internal_start(when || 0, offset, duration);
else
node.internal_start(when || 0, offset || 0);
};
}
if (!node.stop) {
node.stop = function (when) {
this.noteOff(when || 0);
};
} else {
node.internal_stop = node.stop;
node.stop = function (when) {
node.internal_stop(when || 0);
};
}
fixSetTarget(node.playbackRate);
return node;
};
AudioContext.prototype.internal_createDynamicsCompressor = AudioContext.prototype.createDynamicsCompressor;
AudioContext.prototype.createDynamicsCompressor = function () {
var node = this.internal_createDynamicsCompressor();
fixSetTarget(node.threshold);
fixSetTarget(node.knee);
fixSetTarget(node.ratio);
fixSetTarget(node.reduction);
fixSetTarget(node.attack);
fixSetTarget(node.release);
return node;
};
AudioContext.prototype.internal_createBiquadFilter = AudioContext.prototype.createBiquadFilter;
AudioContext.prototype.createBiquadFilter = function () {
var node = this.internal_createBiquadFilter();
fixSetTarget(node.frequency);
fixSetTarget(node.detune);
fixSetTarget(node.Q);
fixSetTarget(node.gain);
return node;
};
if (AudioContext.prototype.hasOwnProperty('createOscillator')) {
AudioContext.prototype.internal_createOscillator = AudioContext.prototype.createOscillator;
AudioContext.prototype.createOscillator = function () {
var node = this.internal_createOscillator();
if (!node.start) {
node.start = function (when) {
this.noteOn(when || 0);
};
} else {
node.internal_start = node.start;
node.start = function (when) {
node.internal_start(when || 0);
};
}
if (!node.stop) {
node.stop = function (when) {
this.noteOff(when || 0);
};
} else {
node.internal_stop = node.stop;
node.stop = function (when) {
node.internal_stop(when || 0);
};
}
if (!node.setPeriodicWave)
node.setPeriodicWave = node.setWaveTable;
fixSetTarget(node.frequency);
fixSetTarget(node.detune);
return node;
};
}
}
if (window.hasOwnProperty('webkitOfflineAudioContext') && !window.hasOwnProperty('OfflineAudioContext')) {
window.OfflineAudioContext = webkitOfflineAudioContext;
}
return exports;
}(window));
// <-- end MonkeyPatch.
// Create the Audio Context
var audiocontext = new window.AudioContext();
/**
* <p>Returns the Audio Context for this sketch. Useful for users
* who would like to dig deeper into the <a target='_blank' href=
* 'http://webaudio.github.io/web-audio-api/'>Web Audio API
* </a>.</p>
*
* @method getAudioContext
* @return {Object} AudioContext for this sketch
*/
p5.prototype.getAudioContext = function () {
return audiocontext;
};
// Polyfill for AudioIn, also handled by p5.dom createCapture
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
/**
* Determine which filetypes are supported (inspired by buzz.js)
* The audio element (el) will only be used to test browser support for various audio formats
*/
var el = document.createElement('audio');
p5.prototype.isSupported = function () {
return !!el.canPlayType;
};
var isOGGSupported = function () {
return !!el.canPlayType && el.canPlayType('audio/ogg; codecs="vorbis"');
};
var isMP3Supported = function () {
return !!el.canPlayType && el.canPlayType('audio/mpeg;');
};
var isWAVSupported = function () {
return !!el.canPlayType && el.canPlayType('audio/wav; codecs="1"');
};
var isAACSupported = function () {
return !!el.canPlayType && (el.canPlayType('audio/x-m4a;') || el.canPlayType('audio/aac;'));
};
var isAIFSupported = function () {
return !!el.canPlayType && el.canPlayType('audio/x-aiff;');
};
p5.prototype.isFileSupported = function (extension) {
switch (extension.toLowerCase()) {
case 'mp3':
return isMP3Supported();
case 'wav':
return isWAVSupported();
case 'ogg':
return isOGGSupported();
case 'aac', 'm4a', 'mp4':
return isAACSupported();
case 'aif', 'aiff':
return isAIFSupported();
default:
return false;
}
};
// if it is iOS, we have to have a user interaction to start Web Audio
// http://paulbakaus.com/tutorials/html5/web-audio-on-ios/
var iOS = navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false;
if (iOS) {
var iosStarted = false;
var startIOS = function () {
if (iosStarted)
return;
// create empty buffer
var buffer = audiocontext.createBuffer(1, 1, 22050);
var source = audiocontext.createBufferSource();
source.buffer = buffer;
// connect to output (your speakers)
source.connect(audiocontext.destination);
// play the file
source.start(0);
console.log('start ios!');
if (audiocontext.state === 'running') {
iosStarted = true;
}
};
document.addEventListener('touchend', startIOS, false);
document.addEventListener('touchstart', startIOS, false);
}
}();
var master;
master = function () {
'use strict';
/**
* Master contains AudioContext and the master sound output.
*/
var Master = function () {
var audiocontext = p5.prototype.getAudioContext();
this.input = audiocontext.createGain();
this.output = audiocontext.createGain();
//put a hard limiter on the output
this.limiter = audiocontext.createDynamicsCompressor();
this.limiter.threshold.value = 0;
this.limiter.ratio.value = 100;
this.audiocontext = audiocontext;
this.output.disconnect();
// an array of input sources
this.inputSources = [];
// connect input to limiter
this.input.connect(this.limiter);
// connect limiter to output
this.limiter.connect(this.output);
// meter is just for global Amplitude / FFT analysis
this.meter = audiocontext.createGain();
this.fftMeter = audiocontext.createGain();
this.output.connect(this.meter);
this.output.connect(this.fftMeter);
// connect output to destination
this.output.connect(this.audiocontext.destination);
// an array of all sounds in the sketch
this.soundArray = [];
// an array of all musical parts in the sketch
this.parts = [];
// file extensions to search for
this.extensions = [];
};
// create a single instance of the p5Sound / master output for use within this sketch
var p5sound = new Master();
/**
* Returns a number representing the master amplitude (volume) for sound
* in this sketch.
*
* @method getMasterVolume
* @return {Number} Master amplitude (volume) for sound in this sketch.
* Should be between 0.0 (silence) and 1.0.
*/
p5.prototype.getMasterVolume = function () {
return p5sound.output.gain.value;
};
/**
* <p>Scale the output of all sound in this sketch</p>
* Scaled between 0.0 (silence) and 1.0 (full volume).
* 1.0 is the maximum amplitude of a digital sound, so multiplying
* by greater than 1.0 may cause digital distortion. To
* fade, provide a <code>rampTime</code> parameter. For more
* complex fades, see the Env class.
*
* Alternately, you can pass in a signal source such as an
* oscillator to modulate the amplitude with an audio signal.
*
* <p><b>How This Works</b>: When you load the p5.sound module, it
* creates a single instance of p5sound. All sound objects in this
* module output to p5sound before reaching your computer's output.
* So if you change the amplitude of p5sound, it impacts all of the
* sound in this module.</p>
*
* <p>If no value is provided, returns a Web Audio API Gain Node</p>
*
* @method masterVolume
* @param {Number|Object} volume Volume (amplitude) between 0.0
* and 1.0 or modulating signal/oscillator
* @param {Number} [rampTime] Fade for t seconds
* @param {Number} [timeFromNow] Schedule this event to happen at
* t seconds in the future
*/
p5.prototype.masterVolume = function (vol, rampTime, tFromNow) {
if (typeof vol === 'number') {
var rampTime = rampTime || 0;
var tFromNow = tFromNow || 0;
var now = p5sound.audiocontext.currentTime;
var currentVol = p5sound.output.gain.value;
p5sound.output.gain.cancelScheduledValues(now + tFromNow);
p5sound.output.gain.linearRampToValueAtTime(currentVol, now + tFromNow);
p5sound.output.gain.linearRampToValueAtTime(vol, now + tFromNow + rampTime);
} else if (vol) {
vol.connect(p5sound.output.gain);
} else {
// return the Gain Node
return p5sound.output.gain;
}
};
/**
* p5.soundOut is the p5.sound master output. It sends output to
* the destination of this window's web audio context. It contains
* Web Audio API nodes including a dyanmicsCompressor (<code>.limiter</code>),
* and Gain Nodes for <code>.input</code> and <code>.output</code>.
*
* @property p5.soundOut
* @type {Object}
*/
p5.soundOut = p5sound;
/**
* a silent connection to the DesinationNode
* which will ensure that anything connected to it
* will not be garbage collected
*
* @private
*/
p5.soundOut._silentNode = p5sound.audiocontext.createGain();
p5.soundOut._silentNode.gain.value = 0;
p5.soundOut._silentNode.connect(p5sound.audiocontext.destination);
return p5sound;
}(sndcore);
var helpers;
helpers = function () {
'use strict';
var p5sound = master;
/**
* Returns a number representing the sample rate, in samples per second,
* of all sound objects in this audio context. It is determined by the
* sampling rate of your operating system's sound card, and it is not
* currently possile to change.
* It is often 44100, or twice the range of human hearing.
*
* @method sampleRate
* @return {Number} samplerate samples per second
*/
p5.prototype.sampleRate = function () {
return p5sound.audiocontext.sampleRate;
};
/**
* Returns the closest MIDI note value for
* a given frequency.
*
* @param {Number} frequency A freqeuncy, for example, the "A"
* above Middle C is 440Hz
* @return {Number} MIDI note value
*/
p5.prototype.freqToMidi = function (f) {
var mathlog2 = Math.log(f / 440) / Math.log(2);
var m = Math.round(12 * mathlog2) + 57;
return m;
};
/**
* Returns the frequency value of a MIDI note value.
* General MIDI treats notes as integers where middle C
* is 60, C# is 61, D is 62 etc. Useful for generating
* musical frequencies with oscillators.
*
* @method midiToFreq
* @param {Number} midiNote The number of a MIDI note
* @return {Number} Frequency value of the given MIDI note
* @example
* <div><code>
* var notes = [60, 64, 67, 72];
* var i = 0;
*
* function setup() {
* osc = new p5.Oscillator('Triangle');
* osc.start();
* frameRate(1);
* }
*
* function draw() {
* var freq = midiToFreq(notes[i]);
* osc.freq(freq);
* i++;
* if (i >= notes.length){
* i = 0;
* }
* }
* </code></div>
*/
p5.prototype.midiToFreq = function (m) {
return 440 * Math.pow(2, (m - 69) / 12);
};
/**
* List the SoundFile formats that you will include. LoadSound
* will search your directory for these extensions, and will pick
* a format that is compatable with the client's web browser.
* <a href="http://media.io/">Here</a> is a free online file
* converter.
*
* @method soundFormats
* @param {String|Strings} formats i.e. 'mp3', 'wav', 'ogg'
* @example
* <div><code>
* function preload() {
* // set the global sound formats
* soundFormats('mp3', 'ogg');
*
* // load either beatbox.mp3, or .ogg, depending on browser
* mySound = loadSound('../sounds/beatbox.mp3');
* }
*
* function setup() {
* mySound.play();
* }
* </code></div>
*/
p5.prototype.soundFormats = function () {
// reset extensions array
p5sound.extensions = [];
// add extensions
for (var i = 0; i < arguments.length; i++) {
arguments[i] = arguments[i].toLowerCase();
if ([
'mp3',
'wav',
'ogg',
'm4a',
'aac'
].indexOf(arguments[i]) > -1) {
p5sound.extensions.push(arguments[i]);
} else {
throw arguments[i] + ' is not a valid sound format!';
}
}
};
p5.prototype.disposeSound = function () {
for (var i = 0; i < p5sound.soundArray.length; i++) {
p5sound.soundArray[i].dispose();
}
};
// register removeSound to dispose of p5sound SoundFiles, Convolvers,
// Oscillators etc when sketch ends
p5.prototype.registerMethod('remove', p5.prototype.disposeSound);
p5.prototype._checkFileFormats = function (paths) {
var path;
// if path is a single string, check to see if extension is provided
if (typeof paths === 'string') {
path = paths;
// see if extension is provided
var extTest = path.split('.').pop();
// if an extension is provided...
if ([
'mp3',
'wav',
'ogg',
'm4a',
'aac'
].indexOf(extTest) > -1) {
var supported = p5.prototype.isFileSupported(extTest);
if (supported) {
path = path;
} else {
var pathSplit = path.split('.');
var pathCore = pathSplit[pathSplit.length - 1];
for (var i = 0; i < p5sound.extensions.length; i++) {
var extension = p5sound.extensions[i];
var supported = p5.prototype.isFileSupported(extension);
if (supported) {
pathCore = '';
if (pathSplit.length === 2) {
pathCore += pathSplit[0];
}
for (var i = 1; i <= pathSplit.length - 2; i++) {
var p = pathSplit[i];
pathCore += '.' + p;
}
path = pathCore += '.';
path = path += extension;
break;
}
}
}
} else {
for (var i = 0; i < p5sound.extensions.length; i++) {
var extension = p5sound.extensions[i];
var supported = p5.prototype.isFileSupported(extension);
if (supported) {
path = path + '.' + extension;
break;
}
}
}
} else if (typeof paths === 'object') {
for (var i = 0; i < paths.length; i++) {
var extension = paths[i].split('.').pop();
var supported = p5.prototype.isFileSupported(extension);
if (supported) {
// console.log('.'+extension + ' is ' + supported +
// ' supported by your browser.');
path = paths[i];
break;
}
}
}
return path;
};
/**
* Used by Osc and Env to chain signal math
*/
p5.prototype._mathChain = function (o, math, thisChain, nextChain, type) {
// if this type of math already exists in the chain, replace it
for (var i in o.mathOps) {
if (o.mathOps[i] instanceof type) {
o.mathOps[i].dispose();
thisChain = i;
if (thisChain < o.mathOps.length - 1) {
nextChain = o.mathOps[i + 1];
}
}
}
o.mathOps[thisChain - 1].disconnect();
o.mathOps[thisChain - 1].connect(math);
math.connect(nextChain);
o.mathOps[thisChain] = math;
return o;
};
}(master);
var errorHandler;
errorHandler = function () {
'use strict';
/**
* Helper function to generate an error
* with a custom stack trace that points to the sketch
* and removes other parts of the stack trace.
*
* @private
*
* @param {String} name custom error name
* @param {String} errorTrace custom error trace
* @param {String} failedPath path to the file that failed to load
* @property {String} name custom error name
* @property {String} message custom error message
* @property {String} stack trace the error back to a line in the user's sketch.
* Note: this edits out stack trace within p5.js and p5.sound.
* @property {String} originalStack unedited, original stack trace
* @property {String} failedPath path to the file that failed to load
* @return {Error} returns a custom Error object
*/
var CustomError = function (name, errorTrace, failedPath) {
var err = new Error();
var tempStack, splitStack;
err.name = name;
err.originalStack = err.stack + errorTrace;
tempStack = err.stack + errorTrace;
err.failedPath = failedPath;
// only print the part of the stack trace that refers to the user code:
var splitStack = tempStack.split('\n');
splitStack = splitStack.filter(function (ln) {
return !ln.match(/(p5.|native code|globalInit)/g);
});
err.stack = splitStack.join('\n');
return err;
};
return CustomError;
}();
var panner;
panner = function () {
'use strict';
var p5sound = master;
var ac = p5sound.audiocontext;
// Stereo panner
// if there is a stereo panner node use it
if (typeof ac.createStereoPanner !== 'undefined') {
p5.Panner = function (input, output, numInputChannels) {
this.stereoPanner = this.input = ac.createStereoPanner();
input.connect(this.stereoPanner);
this.stereoPanner.connect(output);
};
p5.Panner.prototype.pan = function (val, tFromNow) {
var time = tFromNow || 0;
var t = ac.currentTime + time;
this.stereoPanner.pan.linearRampToValueAtTime(val, t);
};
p5.Panner.prototype.inputChannels = function (numChannels) {
};
p5.Panner.prototype.connect = function (obj) {
this.stereoPanner.connect(obj);
};
p5.Panner.prototype.disconnect = function (obj) {
this.stereoPanner.disconnect();
};
} else {
// if there is no createStereoPanner object
// such as in safari 7.1.7 at the time of writing this
// use this method to create the effect
p5.Panner = function (input, output, numInputChannels) {
this.input = ac.createGain();
input.connect(this.input);
this.left = ac.createGain();
this.right = ac.createGain();
this.left.channelInterpretation = 'discrete';
this.right.channelInterpretation = 'discrete';
// if input is stereo
if (numInputChannels > 1) {
this.splitter = ac.createChannelSplitter(2);
this.input.connect(this.splitter);
this.splitter.connect(this.left, 1);
this.splitter.connect(this.right, 0);
} else {
this.input.connect(this.left);
this.input.connect(this.right);
}
this.output = ac.createChannelMerger(2);
this.left.connect(this.output, 0, 1);
this.right.connect(this.output, 0, 0);
this.output.connect(output);
};
// -1 is left, +1 is right
p5.Panner.prototype.pan = function (val, tFromNow) {
var time = tFromNow || 0;
var t = ac.currentTime + time;
var v = (val + 1) / 2;
var rightVal = Math.cos(v * Math.PI / 2);
var leftVal = Math.sin(v * Math.PI / 2);
this.left.gain.linearRampToValueAtTime(leftVal, t);
this.right.gain.linearRampToValueAtTime(rightVal, t);
};
p5.Panner.prototype.inputChannels = function (numChannels) {
if (numChannels === 1) {
this.input.disconnect();
this.input.connect(this.left);
this.input.connect(this.right);
} else if (numChannels === 2) {
if (typeof (this.splitter === 'undefined')) {
this.splitter = ac.createChannelSplitter(2);
}
this.input.disconnect();
this.input.connect(this.splitter);
this.splitter.connect(this.left, 1);
this.splitter.connect(this.right, 0);
}
};
p5.Panner.prototype.connect = function (obj) {
this.output.connect(obj);
};
p5.Panner.prototype.disconnect = function (obj) {
this.output.disconnect();
};
}
// 3D panner
p5.Panner3D = function (input, output) {
var panner3D = ac.createPanner();
panner3D.panningModel = 'HRTF';
panner3D.distanceModel = 'linear';
panner3D.setPosition(0, 0, 0);
input.connect(panner3D);
panner3D.connect(output);
panner3D.pan = function (xVal, yVal, zVal) {
panner3D.setPosition(xVal, yVal, zVal);
};
return panner3D;
};
}(master);
var soundfile;
soundfile = function () {
'use strict';
var CustomError = errorHandler;
var p5sound = master;
var ac = p5sound.audiocontext;
/**
* <p>SoundFile object with a path to a file.</p>
*
* <p>The p5.SoundFile may not be available immediately because
* it loads the file information asynchronously.</p>
*
* <p>To do something with the sound as soon as it loads
* pass the name of a function as the second parameter.</p>
*
* <p>Only one file path is required. However, audio file formats
* (i.e. mp3, ogg, wav and m4a/aac) are not supported by all
* web browsers. If you want to ensure compatability, instead of a single
* file path, you may include an Array of filepaths, and the browser will
* choose a format that works.</p>
*
* @class p5.SoundFile
* @constructor
* @param {String/Array} path path to a sound file (String). Optionally,
* you may include multiple file formats in
* an array. Alternately, accepts an object
* from the HTML5 File API, or a p5.File.
* @param {Function} [successCallback] Name of a function to call once file loads
* @param {Function} [errorCallback] Name of a function to call if file fails to
* load. This function will receive an error or
* XMLHttpRequest object with information
* about what went wrong.
* @param {Function} [whileLoadingCallback] Name of a function to call while file
* is loading. That function will
* receive percentage loaded
* (between 0 and 1) as a
* parameter.
*
* @return {Object} p5.SoundFile Object
* @example
* <div><code>
*
* function preload() {
* mySound = loadSound('assets/doorbell.mp3');
* }
*
* function setup() {
* mySound.setVolume(0.1);
* mySound.play();
* }
*
* </code></div>
*/
p5.SoundFile = function (paths, onload, onerror, whileLoading) {
if (typeof paths !== 'undefined') {
if (typeof paths == 'string' || typeof paths[0] == 'string') {
var path = p5.prototype._checkFileFormats(paths);
this.url = path;
} else if (typeof paths == 'object') {
if (!(window.File && window.FileReader && window.FileList && window.Blob)) {
// The File API isn't supported in this browser
throw 'Unable to load file because the File API is not supported';
}
}
// if type is a p5.File...get the actual file
if (paths.file) {
paths = paths.file;
}
this.file = paths;
}
// private _onended callback, set by the method: onended(callback)
this._onended = function () {
};
this._looping = false;
this._playing = false;
this._paused = false;
this._pauseTime = 0;
// cues for scheduling events with addCue() removeCue()
this._cues = [];
// position of the most recently played sample
this._lastPos = 0;
this._counterNode;
this._scopeNode;
// array of sources so that they can all be stopped!
this.bufferSourceNodes = [];
// current source
this.bufferSourceNode = null;
this.buffer = null;
this.playbackRate = 1;
this.gain = 1;
this.input = p5sound.audiocontext.createGain();
this.output = p5sound.audiocontext.createGain();
this.reversed = false;
// start and end of playback / loop
this.startTime = 0;
this.endTime = null;
this.pauseTime = 0;
// "restart" would stop playback before retriggering
this.mode = 'sustain';
// time that playback was started, in millis
this.startMillis = null;
// stereo panning
this.panPosition = 0;
this.panner = new p5.Panner(this.output, p5sound.input, 2);
// it is possible to instantiate a soundfile with no path
if (this.url || this.file) {
this.load(onload, onerror);
}
// add this p5.SoundFile to the soundArray
p5sound.soundArray.push(this);
if (typeof whileLoading === 'function') {
this._whileLoading = whileLoading;
} else {
this._whileLoading = function () {
};
}
};
// register preload handling of loadSound
p5.prototype.registerPreloadMethod('loadSound', p5.prototype);
/**
* loadSound() returns a new p5.SoundFile from a specified
* path. If called during preload(), the p5.SoundFile will be ready
* to play in time for setup() and draw(). If called outside of
* preload, the p5.SoundFile will not be ready immediately, so
* loadSound accepts a callback as the second parameter. Using a
* <a href="https://github.com/processing/p5.js/wiki/Local-server">
* local server</a> is recommended when loading external files.
*
* @method loadSound
* @param {String/Array} path Path to the sound file, or an array with
* paths to soundfiles in multiple formats
* i.e. ['sound.ogg', 'sound.mp3'].
* Alternately, accepts an object: either
* from the HTML5 File API, or a p5.File.
* @param {Function} [successCallback] Name of a function to call once file loads
* @param {Function} [errorCallback] Name of a function to call if there is
* an error loading the file.
* @param {Function} [whileLoading] Name of a function to call while file is loading.
* This function will receive the percentage loaded
* so far, from 0.0 to 1.0.
* @return {SoundFile} Returns a p5.SoundFile
* @example
* <div><code>
* function preload() {
* mySound = loadSound('assets/doorbell.mp3');
* }
*
* function setup() {
* mySound.setVolume(0.1);
* mySound.play();
* }
* </code></div>
*/
p5.prototype.loadSound = function (path, callback, onerror, whileLoading) {
// if loading locally without a server
if (window.location.origin.indexOf('file://') > -1 && window.cordova === 'undefined') {
alert('This sketch may require a server to load external files. Please see http://bit.ly/1qcInwS');
}
var s = new p5.SoundFile(path, callback, onerror, whileLoading);
return s;
};
/**
* This is a helper function that the p5.SoundFile calls to load
* itself. Accepts a callback (the name of another function)
* as an optional parameter.
*
* @private
* @param {Function} [successCallback] Name of a function to call once file loads
* @param {Function} [errorCallback] Name of a function to call if there is an error
*/
p5.SoundFile.prototype.load = function (callback, errorCallback) {
var loggedError = false;
var self = this;
var errorTrace = new Error().stack;
if (this.url != undefined && this.url != '') {
var request = new XMLHttpRequest();
request.addEventListener('progress', function (evt) {
self._updateProgress(evt);
}, false);
request.open('GET', this.url, true);
request.responseType = 'arraybuffer';
request.onload = function () {
if (request.status == 200) {
// on sucess loading file:
ac.decodeAudioData(request.response, // success decoding buffer:
function (buff) {
self.buffer = buff;
self.panner.inputChannels(buff.numberOfChannels);
if (callback) {
callback(self);
}
}, // error decoding buffer. "e" is undefined in Chrome 11/22/2015
function (e) {
var err = new CustomError('decodeAudioData', errorTrace, self.url);
var msg = 'AudioContext error at decodeAudioData for ' + self.url;
if (errorCallback) {
err.msg = msg;
errorCallback(err);
} else {
console.error(msg + '\n The error stack trace includes: \n' + err.stack);
}
});
} else {
var err = new CustomError('loadSound', errorTrace, self.url);
var msg = 'Unable to load ' + self.url + '. The request status was: ' + request.status + ' (' + request.statusText + ')';
if (errorCallback) {
err.message = msg;
errorCallback(err);
} else {
console.error(msg + '\n The error stack trace includes: \n' + err.stack);
}
}
};
// if there is another error, aside from 404...
request.onerror = function (e) {
var err = new CustomError('loadSound', errorTrace, self.url);
var msg = 'There was no response from the server at ' + self.url + '. Check the url and internet connectivity.';
if (errorCallback) {
err.message = msg;
errorCallback(err);
} else {
console.error(msg + '\n The error stack trace includes: \n' + err.stack);
}
};
request.send();
} else if (this.file != undefined) {
var reader = new FileReader();
var self = this;
reader.onload = function () {
ac.decodeAudioData(reader.result, function (buff) {
self.buffer = buff;
self.panner.inputChannels(buff.numberOfChannels);
if (callback) {
callback(self);
}
});
};
reader.onerror = function (e) {
if (onerror)
onerror(e);
};
reader.readAsArrayBuffer(this.file);
}
};
// TO DO: use this method to create a loading bar that shows progress during file upload/decode.
p5.SoundFile.prototype._updateProgress = function (evt) {
if (evt.lengthComputable) {
var percentComplete = Math.log(evt.loaded / evt.total * 9.9);
this._whileLoading(percentComplete);
} else {
// Unable to compute progress information since the total size is unknown
this._whileLoading('size unknown');
}
};
/**
* Returns true if the sound file finished loading successfully.
*
* @method isLoaded
* @return {Boolean}
*/
p5.SoundFile.prototype.isLoaded = function () {
if (this.buffer) {
return true;
} else {
return false;
}
};
/**
* Play the p5.SoundFile
*
* @method play
* @param {Number} [startTime] (optional) schedule playback to start (in seconds from now).
* @param {Number} [rate] (optional) playback rate
* @param {Number} [amp] (optional) amplitude (volume)
* of playback
* @param {Number} [cueStart] (optional) cue start time in seconds
* @param {Number} [duration] (optional) duration of playback in seconds
*/
p5.SoundFile.prototype.play = function (time, rate, amp, _cueStart, duration) {
var self = this;
var now = p5sound.audiocontext.currentTime;
var cueStart, cueEnd;
var time = time || 0;
if (time < 0) {
time = 0;
}
time = time + now;
// TO DO: if already playing, create array of buffers for easy stop()
if (this.buffer) {
// reset the pause time (if it was paused)
this._pauseTime = 0;
// handle restart playmode
if (this.mode === 'restart' && this.buffer && this.bufferSourceNode) {
var now = p5sound.audiocontext.currentTime;
this.bufferSourceNode.stop(time);
this._counterNode.stop(time);
}
// make a new source and counter. They are automatically assigned playbackRate and buffer
this.bufferSourceNode = this._initSourceNode();
// garbage collect counterNode and create a new one
if (this._counterNode)
this._counterNode = undefined;
this._counterNode = this._initCounterNode();
if (_cueStart) {
if (_cueStart >= 0 && _cueStart < this.buffer.duration) {
// this.startTime = cueStart;
cueStart = _cueStart;
} else {
throw 'start time out of range';
}
} else {
cueStart = 0;
}
if (duration) {
// if duration is greater than buffer.duration, just play entire file anyway rather than throw an error
duration = duration <= this.buffer.duration - cueStart ? duration : this.buffer.duration;
} else {
duration = this.buffer.duration - cueStart;
}
// TO DO: Fix this. It broke in Safari
//
// method of controlling gain for individual bufferSourceNodes, without resetting overall soundfile volume
// if (typeof(this.bufferSourceNode.gain === 'undefined' ) ) {
// this.bufferSourceNode.gain = p5sound.audiocontext.createGain();
// }
// this.bufferSourceNode.connect(this.bufferSourceNode.gain);
// set local amp if provided, otherwise 1
var a = amp || 1;
// this.bufferSourceNode.gain.gain.setValueAtTime(a, p5sound.audiocontext.currentTime);
// this.bufferSourceNode.gain.connect(this.output);
this.bufferSourceNode.connect(this.output);
this.output.gain.value = a;
// not necessary with _initBufferSource ?
// this.bufferSourceNode.playbackRate.cancelScheduledValues(now);
rate = rate || Math.abs(this.playbackRate);
this.bufferSourceNode.playbackRate.setValueAtTime(rate, now);
// if it was paused, play at the pause position
if (this._paused) {
this.bufferSourceNode.start(time, this.pauseTime, duration);
this._counterNode.start(time, this.pauseTime, duration);
} else {
this.bufferSourceNode.start(time, cueStart, duration);
this._counterNode.start(time, cueStart, duration);
}
this._playing = true;
this._paused = false;
// add source to sources array, which is used in stopAll()
this.bufferSourceNodes.push(this.bufferSourceNode);
this.bufferSourceNode._arrayIndex = this.bufferSourceNodes.length - 1;
// delete this.bufferSourceNode from the sources array when it is done playing:
var clearOnEnd = function (e) {
this._playing = false;
this.removeEventListener('ended', clearOnEnd, false);
// call the onended callback
self._onended(self);
self.bufferSourceNodes.forEach(function (n, i) {
if (n._playing === false) {
self.bufferSourceNodes.splice(i);
}
});
if (self.bufferSourceNodes.length === 0) {
self._playing = false;
}
};
this.bufferSourceNode.onended = clearOnEnd;
} else {
throw 'not ready to play file, buffer has yet to load. Try preload()';
}
// if looping, will restart at original time
this.bufferSourceNode.loop = this._looping;
this._counterNode.loop = this._looping;
if (this._looping === true) {
var cueEnd = cueStart + duration;
this.bufferSourceNode.loopStart = cueStart;
this.bufferSourceNode.loopEnd = cueEnd;
this._counterNode.loopStart = cueStart;
this._counterNode.loopEnd = cueEnd;
}
};
/**
* p5.SoundFile has two play modes: <code>restart</code> and
* <code>sustain</code>. Play Mode determines what happens to a
* p5.SoundFile if it is triggered while in the middle of playback.
* In sustain mode, playback will continue simultaneous to the
* new playback. In restart mode, play() will stop playback
* and start over. Sustain is the default mode.
*
* @method playMode
* @param {String} str 'restart' or 'sustain'
* @example
* <div><code>
* function setup(){
* mySound = loadSound('assets/Damscray_DancingTiger.mp3');
* }
* function mouseClicked() {
* mySound.playMode('sustain');
* mySound.play();
* }
* function keyPressed() {
* mySound.playMode('restart');
* mySound.play();
* }
*
* </code></div>
*/
p5.SoundFile.prototype.playMode = function (str) {
var s = str.toLowerCase();
// if restart, stop all other sounds from playing
if (s === 'restart' && this.buffer && this.bufferSourceNode) {
for (var i = 0; i < this.bufferSourceNodes.length - 1; i++) {
var now = p5sound.audiocontext.currentTime;
this.bufferSourceNodes[i].stop(now);
}
}
// set play mode to effect future playback
if (s === 'restart' || s === 'sustain') {
this.mode = s;
} else {
throw 'Invalid play mode. Must be either "restart" or "sustain"';
}
};
/**
* Pauses a file that is currently playing. If the file is not
* playing, then nothing will happen.
*
* After pausing, .play() will resume from the paused
* position.
* If p5.SoundFile had been set to loop before it was paused,
* it will continue to loop after it is unpaused with .play().
*
* @method pause
* @param {Number} [startTime] (optional) schedule event to occur
* seconds from now
* @example
* <div><code>
* var soundFile;
*
* function preload() {
* soundFormats('ogg', 'mp3');
* soundFile = loadSound('assets/Damscray_-_Dancing_Tiger_02.mp3');
* }
* function setup() {
* background(0, 255, 0);
* soundFile.setVolume(0.1);
* soundFile.loop();
* }
* function keyTyped() {
* if (key == 'p') {
* soundFile.pause();
* background(255, 0, 0);
* }
* }
*
* function keyReleased() {
* if (key == 'p') {
* soundFile.play();
* background(0, 255, 0);
* }
* </code>
* </div>
*/
p5.SoundFile.prototype.pause = function (time) {
var now = p5sound.audiocontext.currentTime;
var time = time || 0;
var pTime = time + now;
if (this.isPlaying() && this.buffer && this.bufferSourceNode) {
this.pauseTime = this.currentTime();
this.bufferSourceNode.stop(pTime);
this._counterNode.stop(pTime);
this._paused = true;
this._playing = false;
this._pauseTime = this.currentTime();
} else {
this._pauseTime = 0;
}
};
/**
* Loop the p5.SoundFile. Accepts optional parameters to set the
* playback rate, playback volume, loopStart, loopEnd.
*
* @method loop
* @param {Number} [startTime] (optional) schedule event to occur
* seconds from now
* @param {Number} [rate] (optional) playback rate
* @param {Number} [amp] (optional) playback volume
* @param {Number} [cueLoopStart](optional) startTime in seconds
* @param {Number} [duration] (optional) loop duration in seconds
*/
p5.SoundFile.prototype.loop = function (startTime, rate, amp, loopStart, duration) {
this._looping = true;
this.play(startTime, rate, amp, loopStart, duration);
};
/**
* Set a p5.SoundFile's looping flag to true or false. If the sound
* is currently playing, this change will take effect when it
* reaches the end of the current playback.
*
* @param {Boolean} Boolean set looping to true or false
*/
p5.SoundFile.prototype.setLoop = function (bool) {
if (bool === true) {
this._looping = true;
} else if (bool === false) {
this._looping = false;
} else {
throw 'Error: setLoop accepts either true or false';
}
if (this.bufferSourceNode) {
this.bufferSourceNode.loop = this._looping;
this._counterNode.loop = this._looping;
}
};
/**
* Returns 'true' if a p5.SoundFile is currently looping and playing, 'false' if not.
*
* @return {Boolean}
*/
p5.SoundFile.prototype.isLooping = function () {
if (!this.bufferSourceNode) {
return false;
}
if (this._looping === true && this.isPlaying() === true) {
return true;
}
return false;
};
/**
* Returns true if a p5.SoundFile is playing, false if not (i.e.
* paused or stopped).
*
* @method isPlaying
* @return {Boolean}
*/
p5.SoundFile.prototype.isPlaying = function () {
return this._playing;
};
/**
* Returns true if a p5.SoundFile is paused, false if not (i.e.
* playing or stopped).
*
* @method isPaused
* @return {Boolean}
*/
p5.SoundFile.prototype.isPaused = function () {
return this._paused;
};
/**
* Stop soundfile playback.
*
* @method stop
* @param {Number} [startTime] (optional) schedule event to occur
* in seconds from now
*/
p5.SoundFile.prototype.stop = function (timeFromNow) {
var time = timeFromNow || 0;
if (this.mode == 'sustain') {
this.stopAll(time);
this._playing = false;
this.pauseTime = 0;
this._paused = false;
} else if (this.buffer && this.bufferSourceNode) {
var now = p5sound.audiocontext.currentTime;
var t = time || 0;
this.pauseTime = 0;
this.bufferSourceNode.stop(now + t);
this._counterNode.stop(now + t);
this._playing = false;
this._paused = false;
}
};
/**
* Stop playback on all of this soundfile's sources.
* @private
*/
p5.SoundFile.prototype.stopAll = function (_time) {
var now = p5sound.audiocontext.currentTime;
var time = _time || 0;
if (this.buffer && this.bufferSourceNode) {
for (var i = 0; i < this.bufferSourceNodes.length; i++) {
if (typeof this.bufferSourceNodes[i] != undefined) {
try {
this.bufferSourceNodes[i].onended = function () {
};
this.bufferSourceNodes[i].stop(now + time);
} catch (e) {
}
}
}
this._counterNode.stop(now + time);
this._onended(this);
}
};
/**
* Multiply the output volume (amplitude) of a sound file
* between 0.0 (silence) and 1.0 (full volume).
* 1.0 is the maximum amplitude of a digital sound, so multiplying
* by greater than 1.0 may cause digital distortion. To
* fade, provide a <code>rampTime</code> parameter. For more
* complex fades, see the Env class.
*
* Alternately, you can pass in a signal source such as an
* oscillator to modulate the amplitude with an audio signal.
*
* @method setVolume
* @param {Number|Object} volume Volume (amplitude) between 0.0
* and 1.0 or modulating signal/oscillator
* @param {Number} [rampTime] Fade for t seconds
* @param {Number} [timeFromNow] Schedule this event to happen at
* t seconds in the future
*/
p5.SoundFile.prototype.setVolume = function (vol, rampTime, tFromNow) {
if (typeof vol === 'number') {
var rampTime = rampTime || 0;
var tFromNow = tFromNow || 0;
var now = p5sound.audiocontext.currentTime;
var currentVol = this.output.gain.value;
this.output.gain.cancelScheduledValues(now + tFromNow);
this.output.gain.linearRampToValueAtTime(currentVol, now + tFromNow);
this.output.gain.linearRampToValueAtTime(vol, now + tFromNow + rampTime);
} else if (vol) {
vol.connect(this.output.gain);
} else {
// return the Gain Node
return this.output.gain;
}
};
// same as setVolume, to match Processing Sound
p5.SoundFile.prototype.amp = p5.SoundFile.prototype.setVolume;
// these are the same thing
p5.SoundFile.prototype.fade = p5.SoundFile.prototype.setVolume;
p5.SoundFile.prototype.getVolume = function () {
return this.output.gain.value;
};
/**
* Set the stereo panning of a p5.sound object to
* a floating point number between -1.0 (left) and 1.0 (right).
* Default is 0.0 (center).
*
* @method pan
* @param {Number} [panValue] Set the stereo panner
* @param {Number} timeFromNow schedule this event to happen
* seconds from now
* @example
* <div><code>
*
* var ball = {};
* var soundFile;
*
* function setup() {
* soundFormats('ogg', 'mp3');
* soundFile = loadSound('assets/beatbox.mp3');
* }
*
* function draw() {
* background(0);
* ball.x = constrain(mouseX, 0, width);
* ellipse(ball.x, height/2, 20, 20)
* }
*
* function mousePressed(){
* // map the ball's x location to a panning degree
* // between -1.0 (left) and 1.0 (right)
* var panning = map(ball.x, 0., width,-1.0, 1.0);
* soundFile.pan(panning);
* soundFile.play();
* }
* </div></code>
*/
p5.SoundFile.prototype.pan = function (pval, tFromNow) {
this.panPosition = pval;
this.panner.pan(pval, tFromNow);
};
/**
* Returns the current stereo pan position (-1.0 to 1.0)
*
* @return {Number} Returns the stereo pan setting of the Oscillator
* as a number between -1.0 (left) and 1.0 (right).
* 0.0 is center and default.
*/
p5.SoundFile.prototype.getPan = function () {
return this.panPosition;
};
/**
* Set the playback rate of a sound file. Will change the speed and the pitch.
* Values less than zero will reverse the audio buffer.
*
* @method rate
* @param {Number} [playbackRate] Set the playback rate. 1.0 is normal,
* .5 is half-speed, 2.0 is twice as fast.
* Must be greater than zero.
* @example
* <div><code>
* var song;
*
* function preload() {
* song = loadSound('assets/Damscray_DancingTiger.mp3');
* }
*
* function setup() {
* song.loop();
* }
*
* function draw() {
* background(200);
*
* // Set the rate to a range between 0.1 and 4
* // Changing the rate also alters the pitch
* var speed = map(mouseY, 0.1, height, 0, 2);
* speed = constrain(speed, 0.01, 4);
* song.rate(speed);
*
* // Draw a circle to show what is going on
* stroke(0);
* fill(51, 100);
* ellipse(mouseX, 100, 48, 48);
* }
*
* </code>
* </div>
*
*/
p5.SoundFile.prototype.rate = function (playbackRate) {
if (this.playbackRate === playbackRate && this.bufferSourceNode) {
if (this.bufferSourceNode.playbackRate.value === playbackRate) {
return;
}
}
this.playbackRate = playbackRate;
var rate = playbackRate;
if (this.playbackRate === 0 && this._playing) {
this.pause();
}
if (this.playbackRate < 0 && !this.reversed) {
var cPos = this.currentTime();
var cRate = this.bufferSourceNode.playbackRate.value;
// this.pause();
this.reverseBuffer();
rate = Math.abs(playbackRate);
var newPos = (cPos - this.duration()) / rate;
this.pauseTime = newPos;
} else if (this.playbackRate > 0 && this.reversed) {
this.reverseBuffer();
}
if (this.bufferSourceNode) {
var now = p5sound.audiocontext.currentTime;
this.bufferSourceNode.playbackRate.cancelScheduledValues(now);
this.bufferSourceNode.playbackRate.linearRampToValueAtTime(Math.abs(rate), now);
this._counterNode.playbackRate.cancelScheduledValues(now);
this._counterNode.playbackRate.linearRampToValueAtTime(Math.abs(rate), now);
}
};
// TO DO: document this
p5.SoundFile.prototype.setPitch = function (num) {
var newPlaybackRate = midiToFreq(num) / midiToFreq(60);
this.rate(newPlaybackRate);
};
p5.SoundFile.prototype.getPlaybackRate = function () {
return this.playbackRate;
};
/**
* Returns the duration of a sound file in seconds.
*
* @method duration
* @return {Number} The duration of the soundFile in seconds.
*/
p5.SoundFile.prototype.duration = function () {
// Return Duration
if (this.buffer) {
return this.buffer.duration;
} else {
return 0;
}
};
/**
* Return the current position of the p5.SoundFile playhead, in seconds.
* Note that if you change the playbackRate while the p5.SoundFile is
* playing, the results may not be accurate.
*
* @method currentTime
* @return {Number} currentTime of the soundFile in seconds.
*/
p5.SoundFile.prototype.currentTime = function () {
// TO DO --> make reverse() flip these values appropriately
if (this._pauseTime > 0) {
return this._pauseTime;
} else {
return this._lastPos / ac.sampleRate;
}
};
/**
* Move the playhead of the song to a position, in seconds. Start
* and Stop time. If none are given, will reset the file to play
* entire duration from start to finish.
*
* @method jump
* @param {Number} cueTime cueTime of the soundFile in seconds.
* @param {Number} uuration duration in seconds.
*/
p5.SoundFile.prototype.jump = function (cueTime, duration) {
if (cueTime < 0 || cueTime > this.buffer.duration) {
throw 'jump time out of range';
}
if (duration > this.buffer.duration - cueTime) {
throw 'end time out of range';
}
var cTime = cueTime || 0;
var eTime = duration || this.buffer.duration - cueTime;
if (this.isPlaying()) {
this.stop();
}
this.play(0, this.playbackRate, this.output.gain.value, cTime, eTime);
};
/**
* Return the number of channels in a sound file.
* For example, Mono = 1, Stereo = 2.
*
* @method channels
* @return {Number} [channels]
*/
p5.SoundFile.prototype.channels = function () {
return this.buffer.numberOfChannels;
};
/**
* Return the sample rate of the sound file.
*
* @method sampleRate
* @return {Number} [sampleRate]
*/
p5.SoundFile.prototype.sampleRate = function () {
return this.buffer.sampleRate;
};
/**
* Return the number of samples in a sound file.
* Equal to sampleRate * duration.
*
* @method frames
* @return {Number} [sampleCount]
*/
p5.SoundFile.prototype.frames = function () {
return this.buffer.length;
};
/**
* Returns an array of amplitude peaks in a p5.SoundFile that can be
* used to draw a static waveform. Scans through the p5.SoundFile's
* audio buffer to find the greatest amplitudes. Accepts one
* parameter, 'length', which determines size of the array.
* Larger arrays result in more precise waveform visualizations.
*
* Inspired by Wavesurfer.js.
*
* @method getPeaks
* @params {Number} [length] length is the size of the returned array.
* Larger length results in more precision.
* Defaults to 5*width of the browser window.
* @returns {Float32Array} Array of peaks.
*/
p5.SoundFile.prototype.getPeaks = function (length) {
if (this.buffer) {
// set length to window's width if no length is provided
if (!length) {
length = window.width * 5;
}
if (this.buffer) {
var buffer = this.buffer;
var sampleSize = buffer.length / length;
var sampleStep = ~~(sampleSize / 10) || 1;
var channels = buffer.numberOfChannels;
var peaks = new Float32Array(Math.round(length));
for (var c = 0; c < channels; c++) {
var chan = buffer.getChannelData(c);
for (var i = 0; i < length; i++) {
var start = ~~(i * sampleSize);
var end = ~~(start + sampleSize);
var max = 0;
for (var j = start; j < end; j += sampleStep) {
var value = chan[j];
if (value > max) {
max = value;
} else if (-value > max) {
max = value;
}
}
if (c === 0 || Math.abs(max) > peaks[i]) {
peaks[i] = max;
}
}
}
return peaks;
}
} else {
throw 'Cannot load peaks yet, buffer is not loaded';
}
};
/**
* Reverses the p5.SoundFile's buffer source.
* Playback must be handled separately (see example).
*
* @method reverseBuffer
* @example
* <div><code>
* var drum;
*
* function preload() {
* drum = loadSound('assets/drum.mp3');
* }
*
* function setup() {
* drum.reverseBuffer();
* drum.play();
* }
*
* </code>
* </div>
*/
p5.SoundFile.prototype.reverseBuffer = function () {
var curVol = this.getVolume();
this.setVolume(0, 0.01, 0);
this.pause();
if (this.buffer) {
for (var i = 0; i < this.buffer.numberOfChannels; i++) {
Array.prototype.reverse.call(this.buffer.getChannelData(i));
}
// set reversed flag
this.reversed = !this.reversed;
} else {
throw 'SoundFile is not done loading';
}
this.setVolume(curVol, 0.01, 0.0101);
this.play();
};
/**
* Schedule an event to be called when the soundfile
* reaches the end of a buffer. If the soundfile is
* playing through once, this will be called when it
* ends. If it is looping, it will be called when
* stop is called.
*
* @method onended
* @param {Function} callback function to call when the
* soundfile has ended.
*/
p5.SoundFile.prototype.onended = function (callback) {
this._onended = callback;
return this;
};
p5.SoundFile.prototype.add = function () {
};
p5.SoundFile.prototype.dispose = function () {
var now = p5sound.audiocontext.currentTime;
// remove reference to soundfile
var index = p5sound.soundArray.indexOf(this);
p5sound.soundArray.splice(index, 1);
this.stop(now);
if (this.buffer && this.bufferSourceNode) {
for (var i = 0; i < this.bufferSourceNodes.length - 1; i++) {
if (this.bufferSourceNodes[i] !== null) {
this.bufferSourceNodes[i].disconnect();
try {
this.bufferSourceNodes[i].stop(now);
} catch (e) {
}
this.bufferSourceNodes[i] = null;
}
}
if (this.isPlaying()) {
try {
this._counterNode.stop(now);
} catch (e) {
console.log(e);
}
this._counterNode = null;
}
}
if (this.output) {
this.output.disconnect();
this.output = null;
}
if (this.panner) {
this.panner.disconnect();
this.panner = null;
}
};
/**
* Connects the output of a p5sound object to input of another
* p5.sound object. For example, you may connect a p5.SoundFile to an
* FFT or an Effect. If no parameter is given, it will connect to
* the master output. Most p5sound objects connect to the master
* output when they are created.
*
* @method connect
* @param {Object} [object] Audio object that accepts an input
*/
p5.SoundFile.prototype.connect = function (unit) {
if (!unit) {
this.panner.connect(p5sound.input);
} else {
if (unit.hasOwnProperty('input')) {
this.panner.connect(unit.input);
} else {
this.panner.connect(unit);
}
}
};
/**
* Disconnects the output of this p5sound object.
*
* @method disconnect
*/
p5.SoundFile.prototype.disconnect = function (unit) {
this.panner.disconnect(unit);
};
/**
*/
p5.SoundFile.prototype.getLevel = function (smoothing) {
console.warn('p5.SoundFile.getLevel has been removed from the library. Use p5.Amplitude instead');
};
/**
* Reset the source for this SoundFile to a
* new path (URL).
*
* @method setPath
* @param {String} path path to audio file
* @param {Function} callback Callback
*/
p5.SoundFile.prototype.setPath = function (p, callback) {
var path = p5.prototype._checkFileFormats(p);
this.url = path;
this.load(callback);
};
/**
* Replace the current Audio Buffer with a new Buffer.
*
* @param {Array} buf Array of Float32 Array(s). 2 Float32 Arrays
* will create a stereo source. 1 will create
* a mono source.
*/
p5.SoundFile.prototype.setBuffer = function (buf) {
var numChannels = buf.length;
var size = buf[0].length;
var newBuffer = ac.createBuffer(numChannels, size, ac.sampleRate);
if (!buf[0] instanceof Float32Array) {
buf[0] = new Float32Array(buf[0]);
}
for (var channelNum = 0; channelNum < numChannels; channelNum++) {
var channel = newBuffer.getChannelData(channelNum);
channel.set(buf[channelNum]);
}
this.buffer = newBuffer;
// set numbers of channels on input to the panner
this.panner.inputChannels(numChannels);
};
//////////////////////////////////////////////////
// script processor node with an empty buffer to help
// keep a sample-accurate position in playback buffer.
// Inspired by Chinmay Pendharkar's technique for Sonoport --> http://bit.ly/1HwdCsV
// Copyright [2015] [Sonoport (Asia) Pte. Ltd.],
// Licensed under the Apache License http://apache.org/licenses/LICENSE-2.0
////////////////////////////////////////////////////////////////////////////////////
// initialize counterNode, set its initial buffer and playbackRate
p5.SoundFile.prototype._initCounterNode = function () {
var self = this;
var now = ac.currentTime;
var cNode = ac.createBufferSource();
// dispose of scope node if it already exists
if (self._scopeNode) {
self._scopeNode.disconnect();
self._scopeNode.onaudioprocess = undefined;
self._scopeNode = null;
}
self._scopeNode = ac.createScriptProcessor(256, 1, 1);
// create counter buffer of the same length as self.buffer
cNode.buffer = _createCounterBuffer(self.buffer);
cNode.playbackRate.setValueAtTime(self.playbackRate, now);
cNode.connect(self._scopeNode);
self._scopeNode.connect(p5.soundOut._silentNode);
self._scopeNode.onaudioprocess = function (processEvent) {
var inputBuffer = processEvent.inputBuffer.getChannelData(0);
// update the lastPos
self._lastPos = inputBuffer[inputBuffer.length - 1] || 0;
// do any callbacks that have been scheduled
self._onTimeUpdate(self._lastPos);
};
return cNode;
};
// initialize sourceNode, set its initial buffer and playbackRate
p5.SoundFile.prototype._initSourceNode = function () {
var self = this;
var now = ac.currentTime;
var bufferSourceNode = ac.createBufferSource();
bufferSourceNode.buffer = self.buffer;
bufferSourceNode.playbackRate.setValueAtTime(self.playbackRate, now);
return bufferSourceNode;
};
var _createCounterBuffer = function (buffer) {
var array = new Float32Array(buffer.length);
var audioBuf = ac.createBuffer(1, buffer.length, 44100);
for (var index = 0; index < buffer.length; index++) {
array[index] = index;
}
audioBuf.getChannelData(0).set(array);
return audioBuf;
};
/**
* processPeaks returns an array of timestamps where it thinks there is a beat.
*
* This is an asynchronous function that processes the soundfile in an offline audio context,
* and sends the results to your callback function.
*
* The process involves running the soundfile through a lowpass filter, and finding all of the
* peaks above the initial threshold. If the total number of peaks are below the minimum number of peaks,
* it decreases the threshold and re-runs the analysis until either minPeaks or minThreshold are reached.
*
* @method processPeaks
* @param {Function} callback a function to call once this data is returned
* @param {Number} [initThreshold] initial threshold defaults to 0.9
* @param {Number} [minThreshold] minimum threshold defaults to 0.22
* @param {Number} [minPeaks] minimum number of peaks defaults to 200
* @return {Array} Array of timestamped peaks
*/
p5.SoundFile.prototype.processPeaks = function (callback, _initThreshold, _minThreshold, _minPeaks) {
var bufLen = this.buffer.length;
var sampleRate = this.buffer.sampleRate;
var buffer = this.buffer;
var initialThreshold = _initThreshold || 0.9, threshold = initialThreshold, minThreshold = _minThreshold || 0.22, minPeaks = _minPeaks || 200;
// Create offline context
var offlineContext = new OfflineAudioContext(1, bufLen, sampleRate);
// create buffer source
var source = offlineContext.createBufferSource();
source.buffer = buffer;
// Create filter. TO DO: allow custom setting of filter
var filter = offlineContext.createBiquadFilter();
filter.type = 'lowpass';
source.connect(filter);
filter.connect(offlineContext.destination);
// start playing at time:0
source.start(0);
offlineContext.startRendering();
// Render the song
// act on the result
offlineContext.oncomplete = function (e) {
var data = {};
var filteredBuffer = e.renderedBuffer;
var bufferData = filteredBuffer.getChannelData(0);
// step 1:
// create Peak instances, add them to array, with strength and sampleIndex
do {
allPeaks = getPeaksAtThreshold(bufferData, threshold);
threshold -= 0.005;
} while (Object.keys(allPeaks).length < minPeaks && threshold >= minThreshold);
// step 2:
// find intervals for each peak in the sampleIndex, add tempos array
var intervalCounts = countIntervalsBetweenNearbyPeaks(allPeaks);
// step 3: find top tempos
var groups = groupNeighborsByTempo(intervalCounts, filteredBuffer.sampleRate);
// sort top intervals
var topTempos = groups.sort(function (intA, intB) {
return intB.count - intA.count;
}).splice(0, 5);
// set this SoundFile's tempo to the top tempo ??
this.tempo = topTempos[0].tempo;
// step 4:
// new array of peaks at top tempo within a bpmVariance
var bpmVariance = 5;
var tempoPeaks = getPeaksAtTopTempo(allPeaks, topTempos[0].tempo, filteredBuffer.sampleRate, bpmVariance);
callback(tempoPeaks);
};
};
// process peaks
var Peak = function (amp, i) {
this.sampleIndex = i;
this.amplitude = amp;
this.tempos = [];
this.intervals = [];
};
var allPeaks = [];
// 1. for processPeaks() Function to identify peaks above a threshold
// returns an array of peak indexes as frames (samples) of the original soundfile
function getPeaksAtThreshold(data, threshold) {
var peaksObj = {};
var length = data.length;
for (var i = 0; i < length; i++) {
if (data[i] > threshold) {
var amp = data[i];
var peak = new Peak(amp, i);
peaksObj[i] = peak;
// Skip forward ~ 1/8s to get past this peak.
i += 6000;
}
i++;
}
return peaksObj;
}
// 2. for processPeaks()
function countIntervalsBetweenNearbyPeaks(peaksObj) {
var intervalCounts = [];
var peaksArray = Object.keys(peaksObj).sort();
for (var index = 0; index < peaksArray.length; index++) {
// find intervals in comparison to nearby peaks
for (var i = 0; i < 10; i++) {
var startPeak = peaksObj[peaksArray[index]];
var endPeak = peaksObj[peaksArray[index + i]];
if (startPeak && endPeak) {
var startPos = startPeak.sampleIndex;
var endPos = endPeak.sampleIndex;
var interval = endPos - startPos;
// add a sample interval to the startPeek in the allPeaks array
if (interval > 0) {
startPeak.intervals.push(interval);
}
// tally the intervals and return interval counts
var foundInterval = intervalCounts.some(function (intervalCount, p) {
if (intervalCount.interval === interval) {
intervalCount.count++;
return intervalCount;
}
});
// store with JSON like formatting
if (!foundInterval) {
intervalCounts.push({
interval: interval,
count: 1
});
}
}
}
}
return intervalCounts;
}
// 3. for processPeaks --> find tempo
function groupNeighborsByTempo(intervalCounts, sampleRate) {
var tempoCounts = [];
intervalCounts.forEach(function (intervalCount, i) {
try {
// Convert an interval to tempo
var theoreticalTempo = Math.abs(60 / (intervalCount.interval / sampleRate));
theoreticalTempo = mapTempo(theoreticalTempo);
var foundTempo = tempoCounts.some(function (tempoCount) {
if (tempoCount.tempo === theoreticalTempo)
return tempoCount.count += intervalCount.count;
});
if (!foundTempo) {
if (isNaN(theoreticalTempo)) {
return;
}
tempoCounts.push({
tempo: Math.round(theoreticalTempo),
count: intervalCount.count
});
}
} catch (e) {
throw e;
}
});
return tempoCounts;
}
// 4. for processPeaks - get peaks at top tempo
function getPeaksAtTopTempo(peaksObj, tempo, sampleRate, bpmVariance) {
var peaksAtTopTempo = [];
var peaksArray = Object.keys(peaksObj).sort();
// TO DO: filter out peaks that have the tempo and return
for (var i = 0; i < peaksArray.length; i++) {
var key = peaksArray[i];
var peak = peaksObj[key];
for (var j = 0; j < peak.intervals.length; j++) {
var intervalBPM = Math.round(Math.abs(60 / (peak.intervals[j] / sampleRate)));
intervalBPM = mapTempo(intervalBPM);
var dif = intervalBPM - tempo;
if (Math.abs(intervalBPM - tempo) < bpmVariance) {
// convert sampleIndex to seconds
peaksAtTopTempo.push(peak.sampleIndex / 44100);
}
}
}
// filter out peaks that are very close to each other
peaksAtTopTempo = peaksAtTopTempo.filter(function (peakTime, index, arr) {
var dif = arr[index + 1] - peakTime;
if (dif > 0.01) {
return true;
}
});
return peaksAtTopTempo;
}
// helper function for processPeaks
function mapTempo(theoreticalTempo) {
// these scenarios create infinite while loop
if (!isFinite(theoreticalTempo) || theoreticalTempo == 0) {
return;
}
// Adjust the tempo to fit within the 90-180 BPM range
while (theoreticalTempo < 90)
theoreticalTempo *= 2;
while (theoreticalTempo > 180 && theoreticalTempo > 90)
theoreticalTempo /= 2;
return theoreticalTempo;
}
/*** SCHEDULE EVENTS ***/
/**
* Schedule events to trigger every time a MediaElement
* (audio/video) reaches a playback cue point.
*
* Accepts a callback function, a time (in seconds) at which to trigger
* the callback, and an optional parameter for the callback.
*
* Time will be passed as the first parameter to the callback function,
* and param will be the second parameter.
*
*
* @method addCue
* @param {Number} time Time in seconds, relative to this media
* element's playback. For example, to trigger
* an event every time playback reaches two
* seconds, pass in the number 2. This will be
* passed as the first parameter to
* the callback function.
* @param {Function} callback Name of a function that will be
* called at the given time. The callback will
* receive time and (optionally) param as its
* two parameters.
* @param {Object} [value] An object to be passed as the
* second parameter to the
* callback function.
* @return {Number} id ID of this cue,
* useful for removeCue(id)
* @example
* <div><code>
* function setup() {
* background(0);
* noStroke();
* fill(255);
* textAlign(CENTER);
* text('click to play', width/2, height/2);
*
* mySound = loadSound('assets/beat.mp3');
*
* // schedule calls to changeText
* mySound.addCue(0.50, changeText, "hello" );
* mySound.addCue(1.00, changeText, "p5" );
* mySound.addCue(1.50, changeText, "what" );
* mySound.addCue(2.00, changeText, "do" );
* mySound.addCue(2.50, changeText, "you" );
* mySound.addCue(3.00, changeText, "want" );
* mySound.addCue(4.00, changeText, "to" );
* mySound.addCue(5.00, changeText, "make" );
* mySound.addCue(6.00, changeText, "?" );
* }
*
* function changeText(val) {
* background(0);
* text(val, width/2, height/2);
* }
*
* function mouseClicked() {
* if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
* if (mySound.isPlaying() ) {
* mySound.stop();
* } else {
* mySound.play();
* }
* }
* }
* </code></div>
*/
p5.SoundFile.prototype.addCue = function (time, callback, val) {
var id = this._cueIDCounter++;
var cue = new Cue(callback, time, id, val);
this._cues.push(cue);
// if (!this.elt.ontimeupdate) {
// this.elt.ontimeupdate = this._onTimeUpdate.bind(this);
// }
return id;
};
/**
* Remove a callback based on its ID. The ID is returned by the
* addCue method.
*
* @method removeCue
* @param {Number} id ID of the cue, as returned by addCue
*/
p5.SoundFile.prototype.removeCue = function (id) {
var cueLength = this._cues.length;
for (var i = 0; i < cueLength; i++) {
var cue = this._cues[i];
if (cue.id === id) {
this.cues.splice(i, 1);
}
}
if (this._cues.length === 0) {
}
};
/**
* Remove all of the callbacks that had originally been scheduled
* via the addCue method.
*
* @method clearCues
*/
p5.SoundFile.prototype.clearCues = function () {
this._cues = [];
};
// private method that checks for cues to be fired if events
// have been scheduled using addCue(callback, time).
p5.SoundFile.prototype._onTimeUpdate = function (position) {
var playbackTime = position / this.buffer.sampleRate;
var cueLength = this._cues.length;
for (var i = 0; i < cueLength; i++) {
var cue = this._cues[i];
var callbackTime = cue.time;
var val = cue.val;
if (this._prevTime < callbackTime && callbackTime <= playbackTime) {
// pass the scheduled callbackTime as parameter to the callback
cue.callback(val);
}
}
this._prevTime = playbackTime;
};
// Cue inspired by JavaScript setTimeout, and the
// Tone.js Transport Timeline Event, MIT License Yotam Mann 2015 tonejs.org
var Cue = function (callback, time, id, val) {
this.callback = callback;
this.time = time;
this.id = id;
this.val = val;
};
}(sndcore, errorHandler, master);
var amplitude;
amplitude = function () {
'use strict';
var p5sound = master;
/**
* Amplitude measures volume between 0.0 and 1.0.
* Listens to all p5sound by default, or use setInput()
* to listen to a specific sound source. Accepts an optional
* smoothing value, which defaults to 0.
*
* @class p5.Amplitude
* @constructor
* @param {Number} [smoothing] between 0.0 and .999 to smooth
* amplitude readings (defaults to 0)
* @return {Object} Amplitude Object
* @example
* <div><code>
* var sound, amplitude, cnv;
*
* function preload(){
* sound = loadSound('assets/beat.mp3');
* }
* function setup() {
* cnv = createCanvas(100,100);
* amplitude = new p5.Amplitude();
*
* // start / stop the sound when canvas is clicked
* cnv.mouseClicked(function() {
* if (sound.isPlaying() ){
* sound.stop();
* } else {
* sound.play();
* }
* });
* }
* function draw() {
* background(0);
* fill(255);
* var level = amplitude.getLevel();
* var size = map(level, 0, 1, 0, 200);
* ellipse(width/2, height/2, size, size);
* }
*
* </code></div>
*/
p5.Amplitude = function (smoothing) {
// Set to 2048 for now. In future iterations, this should be inherited or parsed from p5sound's default
this.bufferSize = 2048;
// set audio context
this.audiocontext = p5sound.audiocontext;
this.processor = this.audiocontext.createScriptProcessor(this.bufferSize, 2, 1);
// for connections
this.input = this.processor;
this.output = this.audiocontext.createGain();
// smoothing defaults to 0
this.smoothing = smoothing || 0;
// the variables to return
this.volume = 0;
this.average = 0;
this.stereoVol = [
0,
0
];
this.stereoAvg = [
0,
0
];
this.stereoVolNorm = [
0,
0
];
this.volMax = 0.001;
this.normalize = false;
this.processor.onaudioprocess = this._audioProcess.bind(this);
this.processor.connect(this.output);
this.output.gain.value = 0;
// this may only be necessary because of a Chrome bug
this.output.connect(this.audiocontext.destination);
// connect to p5sound master output by default, unless set by input()
p5sound.meter.connect(this.processor);
// add this p5.SoundFile to the soundArray
p5sound.soundArray.push(this);
};
/**
* Connects to the p5sound instance (master output) by default.
* Optionally, you can pass in a specific source (i.e. a soundfile).
*
* @method setInput
* @param {soundObject|undefined} [snd] set the sound source
* (optional, defaults to
* master output)
* @param {Number|undefined} [smoothing] a range between 0.0 and 1.0
* to smooth amplitude readings
* @example
* <div><code>
* function preload(){
* sound1 = loadSound('assets/beat.mp3');
* sound2 = loadSound('assets/drum.mp3');
* }
* function setup(){
* amplitude = new p5.Amplitude();
* sound1.play();
* sound2.play();
* amplitude.setInput(sound2);
* }
* function draw() {
* background(0);
* fill(255);
* var level = amplitude.getLevel();
* var size = map(level, 0, 1, 0, 200);
* ellipse(width/2, height/2, size, size);
* }
* function mouseClicked(){
* sound1.stop();
* sound2.stop();
* }
* </code></div>
*/
p5.Amplitude.prototype.setInput = function (source, smoothing) {
p5sound.meter.disconnect();
if (smoothing) {
this.smoothing = smoothing;
}
// connect to the master out of p5s instance if no snd is provided
if (source == null) {
console.log('Amplitude input source is not ready! Connecting to master output instead');
p5sound.meter.connect(this.processor);
} else if (source instanceof p5.Signal) {
source.output.connect(this.processor);
} else if (source) {
source.connect(this.processor);
this.processor.disconnect();
this.processor.connect(this.output);
} else {
p5sound.meter.connect(this.processor);
}
};
p5.Amplitude.prototype.connect = function (unit) {
if (unit) {
if (unit.hasOwnProperty('input')) {
this.output.connect(unit.input);
} else {
this.output.connect(unit);
}
} else {
this.output.connect(this.panner.connect(p5sound.input));
}
};
p5.Amplitude.prototype.disconnect = function (unit) {
this.output.disconnect();
};
// TO DO make this stereo / dependent on # of audio channels
p5.Amplitude.prototype._audioProcess = function (event) {
for (var channel = 0; channel < event.inputBuffer.numberOfChannels; channel++) {
var inputBuffer = event.inputBuffer.getChannelData(channel);
var bufLength = inputBuffer.length;
var total = 0;
var sum = 0;
var x;
for (var i = 0; i < bufLength; i++) {
x = inputBuffer[i];
if (this.normalize) {
total += Math.max(Math.min(x / this.volMax, 1), -1);
sum += Math.max(Math.min(x / this.volMax, 1), -1) * Math.max(Math.min(x / this.volMax, 1), -1);
} else {
total += x;
sum += x * x;
}
}
var average = total / bufLength;
// ... then take the square root of the sum.
var rms = Math.sqrt(sum / bufLength);
this.stereoVol[channel] = Math.max(rms, this.stereoVol[channel] * this.smoothing);
this.stereoAvg[channel] = Math.max(average, this.stereoVol[channel] * this.smoothing);
this.volMax = Math.max(this.stereoVol[channel], this.volMax);
}
// add volume from all channels together
var self = this;
var volSum = this.stereoVol.reduce(function (previousValue, currentValue, index) {
self.stereoVolNorm[index - 1] = Math.max(Math.min(self.stereoVol[index - 1] / self.volMax, 1), 0);
self.stereoVolNorm[index] = Math.max(Math.min(self.stereoVol[index] / self.volMax, 1), 0);
return previousValue + currentValue;
});
// volume is average of channels
this.volume = volSum / this.stereoVol.length;
// normalized value
this.volNorm = Math.max(Math.min(this.volume / this.volMax, 1), 0);
};
/**
* Returns a single Amplitude reading at the moment it is called.
* For continuous readings, run in the draw loop.
*
* @method getLevel
* @param {Number} [channel] Optionally return only channel 0 (left) or 1 (right)
* @return {Number} Amplitude as a number between 0.0 and 1.0
* @example
* <div><code>
* function preload(){
* sound = loadSound('assets/beat.mp3');
* }
* function setup() {
* amplitude = new p5.Amplitude();
* sound.play();
* }
* function draw() {
* background(0);
* fill(255);
* var level = amplitude.getLevel();
* var size = map(level, 0, 1, 0, 200);
* ellipse(width/2, height/2, size, size);
* }
* function mouseClicked(){
* sound.stop();
* }
* </code></div>
*/
p5.Amplitude.prototype.getLevel = function (channel) {
if (typeof channel !== 'undefined') {
if (this.normalize) {
return this.stereoVolNorm[channel];
} else {
return this.stereoVol[channel];
}
} else if (this.normalize) {
return this.volNorm;
} else {
return this.volume;
}
};
/**
* Determines whether the results of Amplitude.process() will be
* Normalized. To normalize, Amplitude finds the difference the
* loudest reading it has processed and the maximum amplitude of
* 1.0. Amplitude adds this difference to all values to produce
* results that will reliably map between 0.0 and 1.0. However,
* if a louder moment occurs, the amount that Normalize adds to
* all the values will change. Accepts an optional boolean parameter
* (true or false). Normalizing is off by default.
*
* @method toggleNormalize
* @param {boolean} [boolean] set normalize to true (1) or false (0)
*/
p5.Amplitude.prototype.toggleNormalize = function (bool) {
if (typeof bool === 'boolean') {
this.normalize = bool;
} else {
this.normalize = !this.normalize;
}
};
/**
* Smooth Amplitude analysis by averaging with the last analysis
* frame. Off by default.
*
* @method smooth
* @param {Number} set smoothing from 0.0 <= 1
*/
p5.Amplitude.prototype.smooth = function (s) {
if (s >= 0 && s < 1) {
this.smoothing = s;
} else {
console.log('Error: smoothing must be between 0 and 1');
}
};
p5.Amplitude.prototype.dispose = function () {
// remove reference from soundArray
var index = p5sound.soundArray.indexOf(this);
p5sound.soundArray.splice(index, 1);
this.input.disconnect();
this.output.disconnect();
this.input = this.processor = undefined;
this.output = undefined;
};
}(master);
var fft;
fft = function () {
'use strict';
var p5sound = master;
/**
* <p>FFT (Fast Fourier Transform) is an analysis algorithm that
* isolates individual
* <a href="https://en.wikipedia.org/wiki/Audio_frequency">
* audio frequencies</a> within a waveform.</p>
*
* <p>Once instantiated, a p5.FFT object can return an array based on
* two types of analyses: <br> • <code>FFT.waveform()</code> computes
* amplitude values along the time domain. The array indices correspond
* to samples across a brief moment in time. Each value represents
* amplitude of the waveform at that sample of time.<br>
* • <code>FFT.analyze() </code> computes amplitude values along the
* frequency domain. The array indices correspond to frequencies (i.e.
* pitches), from the lowest to the highest that humans can hear. Each
* value represents amplitude at that slice of the frequency spectrum.
* Use with <code>getEnergy()</code> to measure amplitude at specific
* frequencies, or within a range of frequencies. </p>
*
* <p>FFT analyzes a very short snapshot of sound called a sample
* buffer. It returns an array of amplitude measurements, referred
* to as <code>bins</code>. The array is 1024 bins long by default.
* You can change the bin array length, but it must be a power of 2
* between 16 and 1024 in order for the FFT algorithm to function
* correctly. The actual size of the FFT buffer is twice the
* number of bins, so given a standard sample rate, the buffer is
* 2048/44100 seconds long.</p>
*
*
* @class p5.FFT
* @constructor
* @param {Number} [smoothing] Smooth results of Freq Spectrum.
* 0.0 < smoothing < 1.0.
* Defaults to 0.8.
* @param {Number} [bins] Length of resulting array.
* Must be a power of two between
* 16 and 1024. Defaults to 1024.
* @return {Object} FFT Object
* @example
* <div><code>
* function preload(){
* sound = loadSound('assets/Damscray_DancingTiger.mp3');
* }
*
* function setup(){
* var cnv = createCanvas(100,100);
* cnv.mouseClicked(togglePlay);
* fft = new p5.FFT();
* sound.amp(0.2);
* }
*
* function draw(){
* background(0);
*
* var spectrum = fft.analyze();
* noStroke();
* fill(0,255,0); // spectrum is green
* for (var i = 0; i< spectrum.length; i++){
* var x = map(i, 0, spectrum.length, 0, width);
* var h = -height + map(spectrum[i], 0, 255, height, 0);
* rect(x, height, width / spectrum.length, h )
* }
*
* var waveform = fft.waveform();
* noFill();
* beginShape();
* stroke(255,0,0); // waveform is red
* strokeWeight(1);
* for (var i = 0; i< waveform.length; i++){
* var x = map(i, 0, waveform.length, 0, width);
* var y = map( waveform[i], -1, 1, 0, height);
* vertex(x,y);
* }
* endShape();
*
* text('click to play/pause', 4, 10);
* }
*
* // fade sound if mouse is over canvas
* function togglePlay() {
* if (sound.isPlaying()) {
* sound.pause();
* } else {
* sound.loop();
* }
* }
* </code></div>
*/
p5.FFT = function (smoothing, bins) {
this.smoothing = smoothing || 0.8;
this.bins = bins || 1024;
var FFT_SIZE = bins * 2 || 2048;
this.input = this.analyser = p5sound.audiocontext.createAnalyser();
// default connections to p5sound fftMeter
p5sound.fftMeter.connect(this.analyser);
this.analyser.smoothingTimeConstant = this.smoothing;
this.analyser.fftSize = FFT_SIZE;
this.freqDomain = new Uint8Array(this.analyser.frequencyBinCount);
this.timeDomain = new Uint8Array(this.analyser.frequencyBinCount);
// predefined frequency ranages, these will be tweakable
this.bass = [
20,
140
];
this.lowMid = [
140,
400
];
this.mid = [
400,
2600
];
this.highMid = [
2600,
5200
];
this.treble = [
5200,
14000
];
// add this p5.SoundFile to the soundArray
p5sound.soundArray.push(this);
};
/**
* Set the input source for the FFT analysis. If no source is
* provided, FFT will analyze all sound in the sketch.
*
* @method setInput
* @param {Object} [source] p5.sound object (or web audio API source node)
*/
p5.FFT.prototype.setInput = function (source) {
if (!source) {
p5sound.fftMeter.connect(this.analyser);
} else {
if (source.output) {
source.output.connect(this.analyser);
} else if (source.connect) {
source.connect(this.analyser);
}
p5sound.fftMeter.disconnect();
}
};
/**
* Returns an array of amplitude values (between -1.0 and +1.0) that represent
* a snapshot of amplitude readings in a single buffer. Length will be
* equal to bins (defaults to 1024). Can be used to draw the waveform
* of a sound.
*
* @method waveform
* @param {Number} [bins] Must be a power of two between
* 16 and 1024. Defaults to 1024.
* @param {String} [precision] If any value is provided, will return results
* in a Float32 Array which is more precise
* than a regular array.
* @return {Array} Array Array of amplitude values (-1 to 1)
* over time. Array length = bins.
*
*/
p5.FFT.prototype.waveform = function () {
var bins, mode, normalArray;
for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] === 'number') {
bins = arguments[i];
this.analyser.fftSize = bins * 2;
}
if (typeof arguments[i] === 'string') {
mode = arguments[i];
}
}
// getFloatFrequencyData doesnt work in Safari as of 5/2015
if (mode && !p5.prototype._isSafari()) {
timeToFloat(this, this.timeDomain);
this.analyser.getFloatTimeDomainData(this.timeDomain);
return this.timeDomain;
} else {
timeToInt(this, this.timeDomain);
this.analyser.getByteTimeDomainData(this.timeDomain);
var normalArray = new Array();
for (var i = 0; i < this.timeDomain.length; i++) {
var scaled = p5.prototype.map(this.timeDomain[i], 0, 255, -1, 1);
normalArray.push(scaled);
}
return normalArray;
}
};
/**
* Returns an array of amplitude values (between 0 and 255)
* across the frequency spectrum. Length is equal to FFT bins
* (1024 by default). The array indices correspond to frequencies
* (i.e. pitches), from the lowest to the highest that humans can
* hear. Each value represents amplitude at that slice of the
* frequency spectrum. Must be called prior to using
* <code>getEnergy()</code>.
*
* @method analyze
* @param {Number} [bins] Must be a power of two between
* 16 and 1024. Defaults to 1024.
* @param {Number} [scale] If "dB," returns decibel
* float measurements between
* -140 and 0 (max).
* Otherwise returns integers from 0-255.
* @return {Array} spectrum Array of energy (amplitude/volume)
* values across the frequency spectrum.
* Lowest energy (silence) = 0, highest
* possible is 255.
* @example
* <div><code>
* var osc;
* var fft;
*
* function setup(){
* createCanvas(100,100);
* osc = new p5.Oscillator();
* osc.amp(0);
* osc.start();
* fft = new p5.FFT();
* }
*
* function draw(){
* background(0);
*
* var freq = map(mouseX, 0, 800, 20, 15000);
* freq = constrain(freq, 1, 20000);
* osc.freq(freq);
*
* var spectrum = fft.analyze();
* noStroke();
* fill(0,255,0); // spectrum is green
* for (var i = 0; i< spectrum.length; i++){
* var x = map(i, 0, spectrum.length, 0, width);
* var h = -height + map(spectrum[i], 0, 255, height, 0);
* rect(x, height, width / spectrum.length, h );
* }
*
* stroke(255);
* text('Freq: ' + round(freq)+'Hz', 10, 10);
*
* isMouseOverCanvas();
* }
*
* // only play sound when mouse is over canvas
* function isMouseOverCanvas() {
* var mX = mouseX, mY = mouseY;
* if (mX > 0 && mX < width && mY < height && mY > 0) {
* osc.amp(0.5, 0.2);
* } else {
* osc.amp(0, 0.2);
* }
* }
* </code></div>
*
*
*/
p5.FFT.prototype.analyze = function () {
var bins, mode;
for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] === 'number') {
bins = this.bins = arguments[i];
this.analyser.fftSize = this.bins * 2;
}
if (typeof arguments[i] === 'string') {
mode = arguments[i];
}
}
if (mode && mode.toLowerCase() === 'db') {
freqToFloat(this);
this.analyser.getFloatFrequencyData(this.freqDomain);
return this.freqDomain;
} else {
freqToInt(this, this.freqDomain);
this.analyser.getByteFrequencyData(this.freqDomain);
var normalArray = Array.apply([], this.freqDomain);
normalArray.length === this.analyser.fftSize;
normalArray.constructor === Array;
return normalArray;
}
};
/**
* Returns the amount of energy (volume) at a specific
* <a href="en.wikipedia.org/wiki/Audio_frequency" target="_blank">
* frequency</a>, or the average amount of energy between two
* frequencies. Accepts Number(s) corresponding
* to frequency (in Hz), or a String corresponding to predefined
* frequency ranges ("bass", "lowMid", "mid", "highMid", "treble").
* Returns a range between 0 (no energy/volume at that frequency) and
* 255 (maximum energy).
* <em>NOTE: analyze() must be called prior to getEnergy(). Analyze()
* tells the FFT to analyze frequency data, and getEnergy() uses
* the results determine the value at a specific frequency or
* range of frequencies.</em></p>
*
* @method getEnergy
* @param {Number|String} frequency1 Will return a value representing
* energy at this frequency. Alternately,
* the strings "bass", "lowMid" "mid",
* "highMid", and "treble" will return
* predefined frequency ranges.
* @param {Number} [frequency2] If a second frequency is given,
* will return average amount of
* energy that exists between the
* two frequencies.
* @return {Number} Energy Energy (volume/amplitude) from
* 0 and 255.
*
*/
p5.FFT.prototype.getEnergy = function (frequency1, frequency2) {
var nyquist = p5sound.audiocontext.sampleRate / 2;
if (frequency1 === 'bass') {
frequency1 = this.bass[0];
frequency2 = this.bass[1];
} else if (frequency1 === 'lowMid') {
frequency1 = this.lowMid[0];
frequency2 = this.lowMid[1];
} else if (frequency1 === 'mid') {
frequency1 = this.mid[0];
frequency2 = this.mid[1];
} else if (frequency1 === 'highMid') {
frequency1 = this.highMid[0];
frequency2 = this.highMid[1];
} else if (frequency1 === 'treble') {
frequency1 = this.treble[0];
frequency2 = this.treble[1];
}
if (typeof frequency1 !== 'number') {
throw 'invalid input for getEnergy()';
} else if (!frequency2) {
var index = Math.round(frequency1 / nyquist * this.freqDomain.length);
return this.freqDomain[index];
} else if (frequency1 && frequency2) {
// if second is higher than first
if (frequency1 > frequency2) {
var swap = frequency2;
frequency2 = frequency1;
frequency1 = swap;
}
var lowIndex = Math.round(frequency1 / nyquist * this.freqDomain.length);
var highIndex = Math.round(frequency2 / nyquist * this.freqDomain.length);
var total = 0;
var numFrequencies = 0;
// add up all of the values for the frequencies
for (var i = lowIndex; i <= highIndex; i++) {
total += this.freqDomain[i];
numFrequencies += 1;
}
// divide by total number of frequencies
var toReturn = total / numFrequencies;
return toReturn;
} else {
throw 'invalid input for getEnergy()';
}
};
// compatability with v.012, changed to getEnergy in v.0121. Will be deprecated...
p5.FFT.prototype.getFreq = function (freq1, freq2) {
console.log('getFreq() is deprecated. Please use getEnergy() instead.');
var x = this.getEnergy(freq1, freq2);
return x;
};
/**
* Returns the
* <a href="http://en.wikipedia.org/wiki/Spectral_centroid" target="_blank">
* spectral centroid</a> of the input signal.
* <em>NOTE: analyze() must be called prior to getCentroid(). Analyze()
* tells the FFT to analyze frequency data, and getCentroid() uses
* the results determine the spectral centroid.</em></p>
*
* @method getCentroid
* @return {Number} Spectral Centroid Frequency Frequency of the spectral centroid in Hz.
*
*
* @example
* <div><code>
*
*
*function setup(){
* cnv = createCanvas(800,400);
* sound = new p5.AudioIn();
* sound.start();
* fft = new p5.FFT();
* sound.connect(fft);
*}
*
*
*function draw(){
*
* var centroidplot = 0.0;
* var spectralCentroid = 0;
*
*
* background(0);
* stroke(0,255,0);
* var spectrum = fft.analyze();
* fill(0,255,0); // spectrum is green
*
* //draw the spectrum
*
* for (var i = 0; i< spectrum.length; i++){
* var x = map(log(i), 0, log(spectrum.length), 0, width);
* var h = map(spectrum[i], 0, 255, 0, height);
* var rectangle_width = (log(i+1)-log(i))*(width/log(spectrum.length));
* rect(x, height, rectangle_width, -h )
* }
* var nyquist = 22050;
*
* // get the centroid
* spectralCentroid = fft.getCentroid();
*
* // the mean_freq_index calculation is for the display.
* var mean_freq_index = spectralCentroid/(nyquist/spectrum.length);
*
* centroidplot = map(log(mean_freq_index), 0, log(spectrum.length), 0, width);
*
*
* stroke(255,0,0); // the line showing where the centroid is will be red
*
* rect(centroidplot, 0, width / spectrum.length, height)
* noStroke();
* fill(255,255,255); // text is white
* textSize(40);
* text("centroid: "+round(spectralCentroid)+" Hz", 10, 40);
*}
* </code></div>
*/
p5.FFT.prototype.getCentroid = function () {
var nyquist = p5sound.audiocontext.sampleRate / 2;
var cumulative_sum = 0;
var centroid_normalization = 0;
for (var i = 0; i < this.freqDomain.length; i++) {
cumulative_sum += i * this.freqDomain[i];
centroid_normalization += this.freqDomain[i];
}
var mean_freq_index = 0;
if (centroid_normalization != 0) {
mean_freq_index = cumulative_sum / centroid_normalization;
}
var spec_centroid_freq = mean_freq_index * (nyquist / this.freqDomain.length);
return spec_centroid_freq;
};
/**
* Smooth FFT analysis by averaging with the last analysis frame.
*
* @method smooth
* @param {Number} smoothing 0.0 < smoothing < 1.0.
* Defaults to 0.8.
*/
p5.FFT.prototype.smooth = function (s) {
if (s) {
this.smoothing = s;
}
this.analyser.smoothingTimeConstant = s;
};
p5.FFT.prototype.dispose = function () {
// remove reference from soundArray
var index = p5sound.soundArray.indexOf(this);
p5sound.soundArray.splice(index, 1);
this.analyser.disconnect();
this.analyser = undefined;
};
// helper methods to convert type from float (dB) to int (0-255)
var freqToFloat = function (fft) {
if (fft.freqDomain instanceof Float32Array === false) {
fft.freqDomain = new Float32Array(fft.analyser.frequencyBinCount);
}
};
var freqToInt = function (fft) {
if (fft.freqDomain instanceof Uint8Array === false) {
fft.freqDomain = new Uint8Array(fft.analyser.frequencyBinCount);
}
};
var timeToFloat = function (fft) {
if (fft.timeDomain instanceof Float32Array === false) {
fft.timeDomain = new Float32Array(fft.analyser.frequencyBinCount);
}
};
var timeToInt = function (fft) {
if (fft.timeDomain instanceof Uint8Array === false) {
fft.timeDomain = new Uint8Array(fft.analyser.frequencyBinCount);
}
};
}(master);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_core_Tone;
Tone_core_Tone = function () {
'use strict';
function isUndef(val) {
return val === void 0;
}
function isFunction(val) {
return typeof val === 'function';
}
var audioContext;
if (isUndef(window.AudioContext)) {
window.AudioContext = window.webkitAudioContext;
}
if (isUndef(window.OfflineAudioContext)) {
window.OfflineAudioContext = window.webkitOfflineAudioContext;
}
if (!isUndef(AudioContext)) {
audioContext = new AudioContext();
} else {
throw new Error('Web Audio is not supported in this browser');
}
if (!isFunction(AudioContext.prototype.createGain)) {
AudioContext.prototype.createGain = AudioContext.prototype.createGainNode;
}
if (!isFunction(AudioContext.prototype.createDelay)) {
AudioContext.prototype.createDelay = AudioContext.prototype.createDelayNode;
}
if (!isFunction(AudioContext.prototype.createPeriodicWave)) {
AudioContext.prototype.createPeriodicWave = AudioContext.prototype.createWaveTable;
}
if (!isFunction(AudioBufferSourceNode.prototype.start)) {
AudioBufferSourceNode.prototype.start = AudioBufferSourceNode.prototype.noteGrainOn;
}
if (!isFunction(AudioBufferSourceNode.prototype.stop)) {
AudioBufferSourceNode.prototype.stop = AudioBufferSourceNode.prototype.noteOff;
}
if (!isFunction(OscillatorNode.prototype.start)) {
OscillatorNode.prototype.start = OscillatorNode.prototype.noteOn;
}
if (!isFunction(OscillatorNode.prototype.stop)) {
OscillatorNode.prototype.stop = OscillatorNode.prototype.noteOff;
}
if (!isFunction(OscillatorNode.prototype.setPeriodicWave)) {
OscillatorNode.prototype.setPeriodicWave = OscillatorNode.prototype.setWaveTable;
}
AudioNode.prototype._nativeConnect = AudioNode.prototype.connect;
AudioNode.prototype.connect = function (B, outNum, inNum) {
if (B.input) {
if (Array.isArray(B.input)) {
if (isUndef(inNum)) {
inNum = 0;
}
this.connect(B.input[inNum]);
} else {
this.connect(B.input, outNum, inNum);
}
} else {
try {
if (B instanceof AudioNode) {
this._nativeConnect(B, outNum, inNum);
} else {
this._nativeConnect(B, outNum);
}
} catch (e) {
throw new Error('error connecting to node: ' + B);
}
}
};
var Tone = function (inputs, outputs) {
if (isUndef(inputs) || inputs === 1) {
this.input = this.context.createGain();
} else if (inputs > 1) {
this.input = new Array(inputs);
}
if (isUndef(outputs) || outputs === 1) {
this.output = this.context.createGain();
} else if (outputs > 1) {
this.output = new Array(inputs);
}
};
Tone.prototype.set = function (params, value, rampTime) {
if (this.isObject(params)) {
rampTime = value;
} else if (this.isString(params)) {
var tmpObj = {};
tmpObj[params] = value;
params = tmpObj;
}
for (var attr in params) {
value = params[attr];
var parent = this;
if (attr.indexOf('.') !== -1) {
var attrSplit = attr.split('.');
for (var i = 0; i < attrSplit.length - 1; i++) {
parent = parent[attrSplit[i]];
}
attr = attrSplit[attrSplit.length - 1];
}
var param = parent[attr];
if (isUndef(param)) {
continue;
}
if (Tone.Signal && param instanceof Tone.Signal || Tone.Param && param instanceof Tone.Param) {
if (param.value !== value) {
if (isUndef(rampTime)) {
param.value = value;
} else {
param.rampTo(value, rampTime);
}
}
} else if (param instanceof AudioParam) {
if (param.value !== value) {
param.value = value;
}
} else if (param instanceof Tone) {
param.set(value);
} else if (param !== value) {
parent[attr] = value;
}
}
return this;
};
Tone.prototype.get = function (params) {
if (isUndef(params)) {
params = this._collectDefaults(this.constructor);
} else if (this.isString(params)) {
params = [params];
}
var ret = {};
for (var i = 0; i < params.length; i++) {
var attr = params[i];
var parent = this;
var subRet = ret;
if (attr.indexOf('.') !== -1) {
var attrSplit = attr.split('.');
for (var j = 0; j < attrSplit.length - 1; j++) {
var subAttr = attrSplit[j];
subRet[subAttr] = subRet[subAttr] || {};
subRet = subRet[subAttr];
parent = parent[subAttr];
}
attr = attrSplit[attrSplit.length - 1];
}
var param = parent[attr];
if (this.isObject(params[attr])) {
subRet[attr] = param.get();
} else if (Tone.Signal && param instanceof Tone.Signal) {
subRet[attr] = param.value;
} else if (Tone.Param && param instanceof Tone.Param) {
subRet[attr] = param.value;
} else if (param instanceof AudioParam) {
subRet[attr] = param.value;
} else if (param instanceof Tone) {
subRet[attr] = param.get();
} else if (!isFunction(param) && !isUndef(param)) {
subRet[attr] = param;
}
}
return ret;
};
Tone.prototype._collectDefaults = function (constr) {
var ret = [];
if (!isUndef(constr.defaults)) {
ret = Object.keys(constr.defaults);
}
if (!isUndef(constr._super)) {
var superDefs = this._collectDefaults(constr._super);
for (var i = 0; i < superDefs.length; i++) {
if (ret.indexOf(superDefs[i]) === -1) {
ret.push(superDefs[i]);
}
}
}
return ret;
};
Tone.prototype.toString = function () {
for (var className in Tone) {
var isLetter = className[0].match(/^[A-Z]$/);
var sameConstructor = Tone[className] === this.constructor;
if (isFunction(Tone[className]) && isLetter && sameConstructor) {
return className;
}
}
return 'Tone';
};
Tone.context = audioContext;
Tone.prototype.context = Tone.context;
Tone.prototype.bufferSize = 2048;
Tone.prototype.blockTime = 128 / Tone.context.sampleRate;
Tone.prototype.dispose = function () {
if (!this.isUndef(this.input)) {
if (this.input instanceof AudioNode) {
this.input.disconnect();
}
this.input = null;
}
if (!this.isUndef(this.output)) {
if (this.output instanceof AudioNode) {
this.output.disconnect();
}
this.output = null;
}
return this;
};
var _silentNode = null;
Tone.prototype.noGC = function () {
this.output.connect(_silentNode);
return this;
};
AudioNode.prototype.noGC = function () {
this.connect(_silentNode);
return this;
};
Tone.prototype.connect = function (unit, outputNum, inputNum) {
if (Array.isArray(this.output)) {
outputNum = this.defaultArg(outputNum, 0);
this.output[outputNum].connect(unit, 0, inputNum);
} else {
this.output.connect(unit, outputNum, inputNum);
}
return this;
};
Tone.prototype.disconnect = function (outputNum) {
if (Array.isArray(this.output)) {
outputNum = this.defaultArg(outputNum, 0);
this.output[outputNum].disconnect();
} else {
this.output.disconnect();
}
return this;
};
Tone.prototype.connectSeries = function () {
if (arguments.length > 1) {
var currentUnit = arguments[0];
for (var i = 1; i < arguments.length; i++) {
var toUnit = arguments[i];
currentUnit.connect(toUnit);
currentUnit = toUnit;
}
}
return this;
};
Tone.prototype.connectParallel = function () {
var connectFrom = arguments[0];
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
var connectTo = arguments[i];
connectFrom.connect(connectTo);
}
}
return this;
};
Tone.prototype.chain = function () {
if (arguments.length > 0) {
var currentUnit = this;
for (var i = 0; i < arguments.length; i++) {
var toUnit = arguments[i];
currentUnit.connect(toUnit);
currentUnit = toUnit;
}
}
return this;
};
Tone.prototype.fan = function () {
if (arguments.length > 0) {
for (var i = 0; i < arguments.length; i++) {
this.connect(arguments[i]);
}
}
return this;
};
AudioNode.prototype.chain = Tone.prototype.chain;
AudioNode.prototype.fan = Tone.prototype.fan;
Tone.prototype.defaultArg = function (given, fallback) {
if (this.isObject(given) && this.isObject(fallback)) {
var ret = {};
for (var givenProp in given) {
ret[givenProp] = this.defaultArg(fallback[givenProp], given[givenProp]);
}
for (var fallbackProp in fallback) {
ret[fallbackProp] = this.defaultArg(given[fallbackProp], fallback[fallbackProp]);
}
return ret;
} else {
return isUndef(given) ? fallback : given;
}
};
Tone.prototype.optionsObject = function (values, keys, defaults) {
var options = {};
if (values.length === 1 && this.isObject(values[0])) {
options = values[0];
} else {
for (var i = 0; i < keys.length; i++) {
options[keys[i]] = values[i];
}
}
if (!this.isUndef(defaults)) {
return this.defaultArg(options, defaults);
} else {
return options;
}
};
Tone.prototype.isUndef = isUndef;
Tone.prototype.isFunction = isFunction;
Tone.prototype.isNumber = function (arg) {
return typeof arg === 'number';
};
Tone.prototype.isObject = function (arg) {
return Object.prototype.toString.call(arg) === '[object Object]' && arg.constructor === Object;
};
Tone.prototype.isBoolean = function (arg) {
return typeof arg === 'boolean';
};
Tone.prototype.isArray = function (arg) {
return Array.isArray(arg);
};
Tone.prototype.isString = function (arg) {
return typeof arg === 'string';
};
Tone.noOp = function () {
};
Tone.prototype._readOnly = function (property) {
if (Array.isArray(property)) {
for (var i = 0; i < property.length; i++) {
this._readOnly(property[i]);
}
} else {
Object.defineProperty(this, property, {
writable: false,
enumerable: true
});
}
};
Tone.prototype._writable = function (property) {
if (Array.isArray(property)) {
for (var i = 0; i < property.length; i++) {
this._writable(property[i]);
}
} else {
Object.defineProperty(this, property, { writable: true });
}
};
Tone.State = {
Started: 'started',
Stopped: 'stopped',
Paused: 'paused'
};
Tone.prototype.equalPowerScale = function (percent) {
var piFactor = 0.5 * Math.PI;
return Math.sin(percent * piFactor);
};
Tone.prototype.dbToGain = function (db) {
return Math.pow(2, db / 6);
};
Tone.prototype.gainToDb = function (gain) {
return 20 * (Math.log(gain) / Math.LN10);
};
Tone.prototype.now = function () {
return this.context.currentTime;
};
Tone.extend = function (child, parent) {
if (isUndef(parent)) {
parent = Tone;
}
function TempConstructor() {
}
TempConstructor.prototype = parent.prototype;
child.prototype = new TempConstructor();
child.prototype.constructor = child;
child._super = parent;
};
var newContextCallbacks = [];
Tone._initAudioContext = function (callback) {
callback(Tone.context);
newContextCallbacks.push(callback);
};
Tone.setContext = function (ctx) {
Tone.prototype.context = ctx;
Tone.context = ctx;
for (var i = 0; i < newContextCallbacks.length; i++) {
newContextCallbacks[i](ctx);
}
};
Tone.startMobile = function () {
var osc = Tone.context.createOscillator();
var silent = Tone.context.createGain();
silent.gain.value = 0;
osc.connect(silent);
silent.connect(Tone.context.destination);
var now = Tone.context.currentTime;
osc.start(now);
osc.stop(now + 1);
};
Tone._initAudioContext(function (audioContext) {
Tone.prototype.blockTime = 128 / audioContext.sampleRate;
_silentNode = audioContext.createGain();
_silentNode.gain.value = 0;
_silentNode.connect(audioContext.destination);
});
Tone.version = 'r7-dev';
return Tone;
}();
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_signal_SignalBase;
Tone_signal_SignalBase = function (Tone) {
'use strict';
Tone.SignalBase = function () {
};
Tone.extend(Tone.SignalBase);
Tone.SignalBase.prototype.connect = function (node, outputNumber, inputNumber) {
if (Tone.Signal && Tone.Signal === node.constructor || Tone.Param && Tone.Param === node.constructor || Tone.TimelineSignal && Tone.TimelineSignal === node.constructor) {
node._param.cancelScheduledValues(0);
node._param.value = 0;
node.overridden = true;
} else if (node instanceof AudioParam) {
node.cancelScheduledValues(0);
node.value = 0;
}
Tone.prototype.connect.call(this, node, outputNumber, inputNumber);
return this;
};
return Tone.SignalBase;
}(Tone_core_Tone);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_signal_WaveShaper;
Tone_signal_WaveShaper = function (Tone) {
'use strict';
Tone.WaveShaper = function (mapping, bufferLen) {
this._shaper = this.input = this.output = this.context.createWaveShaper();
this._curve = null;
if (Array.isArray(mapping)) {
this.curve = mapping;
} else if (isFinite(mapping) || this.isUndef(mapping)) {
this._curve = new Float32Array(this.defaultArg(mapping, 1024));
} else if (this.isFunction(mapping)) {
this._curve = new Float32Array(this.defaultArg(bufferLen, 1024));
this.setMap(mapping);
}
};
Tone.extend(Tone.WaveShaper, Tone.SignalBase);
Tone.WaveShaper.prototype.setMap = function (mapping) {
for (var i = 0, len = this._curve.length; i < len; i++) {
var normalized = i / len * 2 - 1;
this._curve[i] = mapping(normalized, i);
}
this._shaper.curve = this._curve;
return this;
};
Object.defineProperty(Tone.WaveShaper.prototype, 'curve', {
get: function () {
return this._shaper.curve;
},
set: function (mapping) {
this._curve = new Float32Array(mapping);
this._shaper.curve = this._curve;
}
});
Object.defineProperty(Tone.WaveShaper.prototype, 'oversample', {
get: function () {
return this._shaper.oversample;
},
set: function (oversampling) {
if ([
'none',
'2x',
'4x'
].indexOf(oversampling) !== -1) {
this._shaper.oversample = oversampling;
} else {
throw new Error('invalid oversampling: ' + oversampling);
}
}
});
Tone.WaveShaper.prototype.dispose = function () {
Tone.prototype.dispose.call(this);
this._shaper.disconnect();
this._shaper = null;
this._curve = null;
return this;
};
return Tone.WaveShaper;
}(Tone_core_Tone);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_core_Type;
Tone_core_Type = function (Tone) {
'use strict';
Tone.Type = {
Default: 'number',
Time: 'time',
Frequency: 'frequency',
NormalRange: 'normalRange',
AudioRange: 'audioRange',
Decibels: 'db',
Interval: 'interval',
BPM: 'bpm',
Positive: 'positive',
Cents: 'cents',
Degrees: 'degrees',
MIDI: 'midi',
TransportTime: 'transportTime',
Ticks: 'tick',
Note: 'note',
Milliseconds: 'milliseconds',
Notation: 'notation'
};
Tone.prototype.isNowRelative = function () {
var nowRelative = new RegExp(/^\s*\+(.)+/i);
return function (note) {
return nowRelative.test(note);
};
}();
Tone.prototype.isTicks = function () {
var tickFormat = new RegExp(/^\d+i$/i);
return function (note) {
return tickFormat.test(note);
};
}();
Tone.prototype.isNotation = function () {
var notationFormat = new RegExp(/^[0-9]+[mnt]$/i);
return function (note) {
return notationFormat.test(note);
};
}();
Tone.prototype.isTransportTime = function () {
var transportTimeFormat = new RegExp(/^(\d+(\.\d+)?\:){1,2}(\d+(\.\d+)?)?$/i);
return function (transportTime) {
return transportTimeFormat.test(transportTime);
};
}();
Tone.prototype.isNote = function () {
var noteFormat = new RegExp(/^[a-g]{1}(b|#|x|bb)?-?[0-9]+$/i);
return function (note) {
return noteFormat.test(note);
};
}();
Tone.prototype.isFrequency = function () {
var freqFormat = new RegExp(/^\d*\.?\d+hz$/i);
return function (freq) {
return freqFormat.test(freq);
};
}();
function getTransportBpm() {
if (Tone.Transport && Tone.Transport.bpm) {
return Tone.Transport.bpm.value;
} else {
return 120;
}
}
function getTransportTimeSignature() {
if (Tone.Transport && Tone.Transport.timeSignature) {
return Tone.Transport.timeSignature;
} else {
return 4;
}
}
Tone.prototype.notationToSeconds = function (notation, bpm, timeSignature) {
bpm = this.defaultArg(bpm, getTransportBpm());
timeSignature = this.defaultArg(timeSignature, getTransportTimeSignature());
var beatTime = 60 / bpm;
if (notation === '1n') {
notation = '1m';
}
var subdivision = parseInt(notation, 10);
var beats = 0;
if (subdivision === 0) {
beats = 0;
}
var lastLetter = notation.slice(-1);
if (lastLetter === 't') {
beats = 4 / subdivision * 2 / 3;
} else if (lastLetter === 'n') {
beats = 4 / subdivision;
} else if (lastLetter === 'm') {
beats = subdivision * timeSignature;
} else {
beats = 0;
}
return beatTime * beats;
};
Tone.prototype.transportTimeToSeconds = function (transportTime, bpm, timeSignature) {
bpm = this.defaultArg(bpm, getTransportBpm());
timeSignature = this.defaultArg(timeSignature, getTransportTimeSignature());
var measures = 0;
var quarters = 0;
var sixteenths = 0;
var split = transportTime.split(':');
if (split.length === 2) {
measures = parseFloat(split[0]);
quarters = parseFloat(split[1]);
} else if (split.length === 1) {
quarters = parseFloat(split[0]);
} else if (split.length === 3) {
measures = parseFloat(split[0]);
quarters = parseFloat(split[1]);
sixteenths = parseFloat(split[2]);
}
var beats = measures * timeSignature + quarters + sixteenths / 4;
return beats * (60 / bpm);
};
Tone.prototype.ticksToSeconds = function (ticks, bpm) {
if (this.isUndef(Tone.Transport)) {
return 0;
}
ticks = parseFloat(ticks);
bpm = this.defaultArg(bpm, getTransportBpm());
var tickTime = 60 / bpm / Tone.Transport.PPQ;
return tickTime * ticks;
};
Tone.prototype.frequencyToSeconds = function (freq) {
return 1 / parseFloat(freq);
};
Tone.prototype.samplesToSeconds = function (samples) {
return samples / this.context.sampleRate;
};
Tone.prototype.secondsToSamples = function (seconds) {
return seconds * this.context.sampleRate;
};
Tone.prototype.secondsToTransportTime = function (seconds, bpm, timeSignature) {
bpm = this.defaultArg(bpm, getTransportBpm());
timeSignature = this.defaultArg(timeSignature, getTransportTimeSignature());
var quarterTime = 60 / bpm;
var quarters = seconds / quarterTime;
var measures = Math.floor(quarters / timeSignature);
var sixteenths = quarters % 1 * 4;
quarters = Math.floor(quarters) % timeSignature;
var progress = [
measures,
quarters,
sixteenths
];
return progress.join(':');
};
Tone.prototype.secondsToFrequency = function (seconds) {
return 1 / seconds;
};
Tone.prototype.toTransportTime = function (time, bpm, timeSignature) {
var seconds = this.toSeconds(time);
return this.secondsToTransportTime(seconds, bpm, timeSignature);
};
Tone.prototype.toFrequency = function (freq, now) {
if (this.isFrequency(freq)) {
return parseFloat(freq);
} else if (this.isNotation(freq) || this.isTransportTime(freq)) {
return this.secondsToFrequency(this.toSeconds(freq, now));
} else if (this.isNote(freq)) {
return this.noteToFrequency(freq);
} else {
return freq;
}
};
Tone.prototype.toTicks = function (time) {
if (this.isUndef(Tone.Transport)) {
return 0;
}
var bpm = Tone.Transport.bpm.value;
var plusNow = 0;
if (this.isNowRelative(time)) {
time = time.replace('+', '');
plusNow = Tone.Transport.ticks;
} else if (this.isUndef(time)) {
return Tone.Transport.ticks;
}
var seconds = this.toSeconds(time);
var quarter = 60 / bpm;
var quarters = seconds / quarter;
var tickNum = quarters * Tone.Transport.PPQ;
return Math.round(tickNum + plusNow);
};
Tone.prototype.toSamples = function (time) {
var seconds = this.toSeconds(time);
return Math.round(seconds * this.context.sampleRate);
};
Tone.prototype.toSeconds = function (time, now) {
now = this.defaultArg(now, this.now());
if (this.isNumber(time)) {
return time;
} else if (this.isString(time)) {
var plusTime = 0;
if (this.isNowRelative(time)) {
time = time.replace('+', '');
plusTime = now;
}
var betweenParens = time.match(/\(([^)(]+)\)/g);
if (betweenParens) {
for (var j = 0; j < betweenParens.length; j++) {
var symbol = betweenParens[j].replace(/[\(\)]/g, '');
var symbolVal = this.toSeconds(symbol);
time = time.replace(betweenParens[j], symbolVal);
}
}
if (time.indexOf('@') !== -1) {
var quantizationSplit = time.split('@');
if (!this.isUndef(Tone.Transport)) {
var toQuantize = quantizationSplit[0].trim();
if (toQuantize === '') {
toQuantize = undefined;
}
if (plusTime > 0) {
toQuantize = '+' + toQuantize;
plusTime = 0;
}
var subdivision = quantizationSplit[1].trim();
time = Tone.Transport.quantize(toQuantize, subdivision);
} else {
throw new Error('quantization requires Tone.Transport');
}
} else {
var components = time.split(/[\(\)\-\+\/\*]/);
if (components.length > 1) {
var originalTime = time;
for (var i = 0; i < components.length; i++) {
var symb = components[i].trim();
if (symb !== '') {
var val = this.toSeconds(symb);
time = time.replace(symb, val);
}
}
try {
time = eval(time);
} catch (e) {
throw new EvalError('cannot evaluate Time: ' + originalTime);
}
} else if (this.isNotation(time)) {
time = this.notationToSeconds(time);
} else if (this.isTransportTime(time)) {
time = this.transportTimeToSeconds(time);
} else if (this.isFrequency(time)) {
time = this.frequencyToSeconds(time);
} else if (this.isTicks(time)) {
time = this.ticksToSeconds(time);
} else {
time = parseFloat(time);
}
}
return time + plusTime;
} else {
return now;
}
};
Tone.prototype.toNotation = function (time, bpm, timeSignature) {
var testNotations = [
'1m',
'2n',
'4n',
'8n',
'16n',
'32n',
'64n',
'128n'
];
var retNotation = toNotationHelper.call(this, time, bpm, timeSignature, testNotations);
var testTripletNotations = [
'1m',
'2n',
'2t',
'4n',
'4t',
'8n',
'8t',
'16n',
'16t',
'32n',
'32t',
'64n',
'64t',
'128n'
];
var retTripletNotation = toNotationHelper.call(this, time, bpm, timeSignature, testTripletNotations);
if (retTripletNotation.split('+').length < retNotation.split('+').length) {
return retTripletNotation;
} else {
return retNotation;
}
};
function toNotationHelper(time, bpm, timeSignature, testNotations) {
var seconds = this.toSeconds(time);
var threshold = this.notationToSeconds(testNotations[testNotations.length - 1], bpm, timeSignature);
var retNotation = '';
for (var i = 0; i < testNotations.length; i++) {
var notationTime = this.notationToSeconds(testNotations[i], bpm, timeSignature);
var multiple = seconds / notationTime;
var floatingPointError = 0.000001;
if (1 - multiple % 1 < floatingPointError) {
multiple += floatingPointError;
}
multiple = Math.floor(multiple);
if (multiple > 0) {
if (multiple === 1) {
retNotation += testNotations[i];
} else {
retNotation += multiple.toString() + '*' + testNotations[i];
}
seconds -= multiple * notationTime;
if (seconds < threshold) {
break;
} else {
retNotation += ' + ';
}
}
}
if (retNotation === '') {
retNotation = '0';
}
return retNotation;
}
Tone.prototype.fromUnits = function (val, units) {
if (this.convert || this.isUndef(this.convert)) {
switch (units) {
case Tone.Type.Time:
return this.toSeconds(val);
case Tone.Type.Frequency:
return this.toFrequency(val);
case Tone.Type.Decibels:
return this.dbToGain(val);
case Tone.Type.NormalRange:
return Math.min(Math.max(val, 0), 1);
case Tone.Type.AudioRange:
return Math.min(Math.max(val, -1), 1);
case Tone.Type.Positive:
return Math.max(val, 0);
default:
return val;
}
} else {
return val;
}
};
Tone.prototype.toUnits = function (val, units) {
if (this.convert || this.isUndef(this.convert)) {
switch (units) {
case Tone.Type.Decibels:
return this.gainToDb(val);
default:
return val;
}
} else {
return val;
}
};
var noteToScaleIndex = {
'cbb': -2,
'cb': -1,
'c': 0,
'c#': 1,
'cx': 2,
'dbb': 0,
'db': 1,
'd': 2,
'd#': 3,
'dx': 4,
'ebb': 2,
'eb': 3,
'e': 4,
'e#': 5,
'ex': 6,
'fbb': 3,
'fb': 4,
'f': 5,
'f#': 6,
'fx': 7,
'gbb': 5,
'gb': 6,
'g': 7,
'g#': 8,
'gx': 9,
'abb': 7,
'ab': 8,
'a': 9,
'a#': 10,
'ax': 11,
'bbb': 9,
'bb': 10,
'b': 11,
'b#': 12,
'bx': 13
};
var scaleIndexToNote = [
'C',
'C#',
'D',
'D#',
'E',
'F',
'F#',
'G',
'G#',
'A',
'A#',
'B'
];
Tone.A4 = 440;
Tone.prototype.noteToFrequency = function (note) {
var parts = note.split(/(-?\d+)/);
if (parts.length === 3) {
var index = noteToScaleIndex[parts[0].toLowerCase()];
var octave = parts[1];
var noteNumber = index + (parseInt(octave, 10) + 1) * 12;
return this.midiToFrequency(noteNumber);
} else {
return 0;
}
};
Tone.prototype.frequencyToNote = function (freq) {
var log = Math.log(freq / Tone.A4) / Math.LN2;
var noteNumber = Math.round(12 * log) + 57;
var octave = Math.floor(noteNumber / 12);
if (octave < 0) {
noteNumber += -12 * octave;
}
var noteName = scaleIndexToNote[noteNumber % 12];
return noteName + octave.toString();
};
Tone.prototype.intervalToFrequencyRatio = function (interval) {
return Math.pow(2, interval / 12);
};
Tone.prototype.midiToNote = function (midiNumber) {
var octave = Math.floor(midiNumber / 12) - 1;
var note = midiNumber % 12;
return scaleIndexToNote[note] + octave;
};
Tone.prototype.noteToMidi = function (note) {
var parts = note.split(/(\d+)/);
if (parts.length === 3) {
var index = noteToScaleIndex[parts[0].toLowerCase()];
var octave = parts[1];
return index + (parseInt(octave, 10) + 1) * 12;
} else {
return 0;
}
};
Tone.prototype.midiToFrequency = function (midi) {
return Tone.A4 * Math.pow(2, (midi - 69) / 12);
};
return Tone;
}(Tone_core_Tone);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_core_Param;
Tone_core_Param = function (Tone) {
'use strict';
Tone.Param = function () {
var options = this.optionsObject(arguments, [
'param',
'units',
'convert'
], Tone.Param.defaults);
this._param = this.input = options.param;
this.units = options.units;
this.convert = options.convert;
this.overridden = false;
if (!this.isUndef(options.value)) {
this.value = options.value;
}
};
Tone.extend(Tone.Param);
Tone.Param.defaults = {
'units': Tone.Type.Default,
'convert': true,
'param': undefined
};
Object.defineProperty(Tone.Param.prototype, 'value', {
get: function () {
return this._toUnits(this._param.value);
},
set: function (value) {
var convertedVal = this._fromUnits(value);
this._param.value = convertedVal;
}
});
Tone.Param.prototype._fromUnits = function (val) {
if (this.convert || this.isUndef(this.convert)) {
switch (this.units) {
case Tone.Type.Time:
return this.toSeconds(val);
case Tone.Type.Frequency:
return this.toFrequency(val);
case Tone.Type.Decibels:
return this.dbToGain(val);
case Tone.Type.NormalRange:
return Math.min(Math.max(val, 0), 1);
case Tone.Type.AudioRange:
return Math.min(Math.max(val, -1), 1);
case Tone.Type.Positive:
return Math.max(val, 0);
default:
return val;
}
} else {
return val;
}
};
Tone.Param.prototype._toUnits = function (val) {
if (this.convert || this.isUndef(this.convert)) {
switch (this.units) {
case Tone.Type.Decibels:
return this.gainToDb(val);
default:
return val;
}
} else {
return val;
}
};
Tone.Param.prototype._minOutput = 0.00001;
Tone.Param.prototype.setValueAtTime = function (value, time) {
value = this._fromUnits(value);
this._param.setValueAtTime(value, this.toSeconds(time));
return this;
};
Tone.Param.prototype.setRampPoint = function (now) {
now = this.defaultArg(now, this.now());
var currentVal = this._param.value;
this._param.setValueAtTime(currentVal, now);
return this;
};
Tone.Param.prototype.linearRampToValueAtTime = function (value, endTime) {
value = this._fromUnits(value);
this._param.linearRampToValueAtTime(value, this.toSeconds(endTime));
return this;
};
Tone.Param.prototype.exponentialRampToValueAtTime = function (value, endTime) {
value = this._fromUnits(value);
value = Math.max(this._minOutput, value);
this._param.exponentialRampToValueAtTime(value, this.toSeconds(endTime));
return this;
};
Tone.Param.prototype.exponentialRampToValue = function (value, rampTime) {
var now = this.now();
var currentVal = this.value;
this.setValueAtTime(Math.max(currentVal, this._minOutput), now);
this.exponentialRampToValueAtTime(value, now + this.toSeconds(rampTime));
return this;
};
Tone.Param.prototype.linearRampToValue = function (value, rampTime) {
var now = this.now();
this.setRampPoint(now);
this.linearRampToValueAtTime(value, now + this.toSeconds(rampTime));
return this;
};
Tone.Param.prototype.setTargetAtTime = function (value, startTime, timeConstant) {
value = this._fromUnits(value);
value = Math.max(this._minOutput, value);
timeConstant = Math.max(this._minOutput, timeConstant);
this._param.setTargetAtTime(value, this.toSeconds(startTime), timeConstant);
return this;
};
Tone.Param.prototype.setValueCurveAtTime = function (values, startTime, duration) {
for (var i = 0; i < values.length; i++) {
values[i] = this._fromUnits(values[i]);
}
this._param.setValueCurveAtTime(values, this.toSeconds(startTime), this.toSeconds(duration));
return this;
};
Tone.Param.prototype.cancelScheduledValues = function (startTime) {
this._param.cancelScheduledValues(this.toSeconds(startTime));
return this;
};
Tone.Param.prototype.rampTo = function (value, rampTime) {
rampTime = this.defaultArg(rampTime, 0);
if (this.units === Tone.Type.Frequency || this.units === Tone.Type.BPM) {
this.exponentialRampToValue(value, rampTime);
} else {
this.linearRampToValue(value, rampTime);
}
return this;
};
Tone.Param.prototype.dispose = function () {
Tone.prototype.dispose.call(this);
this._param = null;
return this;
};
return Tone.Param;
}(Tone_core_Tone);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_core_Gain;
Tone_core_Gain = function (Tone) {
'use strict';
Tone.Gain = function () {
var options = this.optionsObject(arguments, [
'gain',
'units'
], Tone.Gain.defaults);
this.input = this.output = this._gainNode = this.context.createGain();
this.gain = new Tone.Param({
'param': this._gainNode.gain,
'units': options.units,
'value': options.gain,
'convert': options.convert
});
this._readOnly('gain');
};
Tone.extend(Tone.Gain);
Tone.Gain.defaults = {
'gain': 1,
'convert': true
};
Tone.Gain.prototype.dispose = function () {
Tone.Param.prototype.dispose.call(this);
this._gainNode.disconnect();
this._gainNode = null;
this._writable('gain');
this.gain.dispose();
this.gain = null;
};
return Tone.Gain;
}(Tone_core_Tone, Tone_core_Param);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_signal_Signal;
Tone_signal_Signal = function (Tone) {
'use strict';
Tone.Signal = function () {
var options = this.optionsObject(arguments, [
'value',
'units'
], Tone.Signal.defaults);
this.output = this._gain = this.context.createGain();
options.param = this._gain.gain;
Tone.Param.call(this, options);
this.input = this._param = this._gain.gain;
Tone.Signal._constant.chain(this._gain);
};
Tone.extend(Tone.Signal, Tone.Param);
Tone.Signal.defaults = {
'value': 0,
'units': Tone.Type.Default,
'convert': true
};
Tone.Signal.prototype.connect = Tone.SignalBase.prototype.connect;
Tone.Signal.prototype.dispose = function () {
Tone.Param.prototype.dispose.call(this);
this._param = null;
this._gain.disconnect();
this._gain = null;
return this;
};
Tone.Signal._constant = null;
Tone._initAudioContext(function (audioContext) {
var buffer = audioContext.createBuffer(1, 128, audioContext.sampleRate);
var arr = buffer.getChannelData(0);
for (var i = 0; i < arr.length; i++) {
arr[i] = 1;
}
Tone.Signal._constant = audioContext.createBufferSource();
Tone.Signal._constant.channelCount = 1;
Tone.Signal._constant.channelCountMode = 'explicit';
Tone.Signal._constant.buffer = buffer;
Tone.Signal._constant.loop = true;
Tone.Signal._constant.start(0);
Tone.Signal._constant.noGC();
});
return Tone.Signal;
}(Tone_core_Tone, Tone_signal_WaveShaper, Tone_core_Type, Tone_core_Param);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_signal_Add;
Tone_signal_Add = function (Tone) {
'use strict';
Tone.Add = function (value) {
Tone.call(this, 2, 0);
this._sum = this.input[0] = this.input[1] = this.output = this.context.createGain();
this._param = this.input[1] = new Tone.Signal(value);
this._param.connect(this._sum);
};
Tone.extend(Tone.Add, Tone.Signal);
Tone.Add.prototype.dispose = function () {
Tone.prototype.dispose.call(this);
this._sum.disconnect();
this._sum = null;
this._param.dispose();
this._param = null;
return this;
};
return Tone.Add;
}(Tone_core_Tone);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_signal_Multiply;
Tone_signal_Multiply = function (Tone) {
'use strict';
Tone.Multiply = function (value) {
Tone.call(this, 2, 0);
this._mult = this.input[0] = this.output = this.context.createGain();
this._param = this.input[1] = this.output.gain;
this._param.value = this.defaultArg(value, 0);
};
Tone.extend(Tone.Multiply, Tone.Signal);
Tone.Multiply.prototype.dispose = function () {
Tone.prototype.dispose.call(this);
this._mult.disconnect();
this._mult = null;
this._param = null;
return this;
};
return Tone.Multiply;
}(Tone_core_Tone);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_signal_Scale;
Tone_signal_Scale = function (Tone) {
'use strict';
Tone.Scale = function (outputMin, outputMax) {
this._outputMin = this.defaultArg(outputMin, 0);
this._outputMax = this.defaultArg(outputMax, 1);
this._scale = this.input = new Tone.Multiply(1);
this._add = this.output = new Tone.Add(0);
this._scale.connect(this._add);
this._setRange();
};
Tone.extend(Tone.Scale, Tone.SignalBase);
Object.defineProperty(Tone.Scale.prototype, 'min', {
get: function () {
return this._outputMin;
},
set: function (min) {
this._outputMin = min;
this._setRange();
}
});
Object.defineProperty(Tone.Scale.prototype, 'max', {
get: function () {
return this._outputMax;
},
set: function (max) {
this._outputMax = max;
this._setRange();
}
});
Tone.Scale.prototype._setRange = function () {
this._add.value = this._outputMin;
this._scale.value = this._outputMax - this._outputMin;
};
Tone.Scale.prototype.dispose = function () {
Tone.prototype.dispose.call(this);
this._add.dispose();
this._add = null;
this._scale.dispose();
this._scale = null;
return this;
};
return Tone.Scale;
}(Tone_core_Tone, Tone_signal_Add, Tone_signal_Multiply);
var signal;
signal = function () {
'use strict';
// Signal is built with the Tone.js signal by Yotam Mann
// https://github.com/TONEnoTONE/Tone.js/
var Signal = Tone_signal_Signal;
var Add = Tone_signal_Add;
var Mult = Tone_signal_Multiply;
var Scale = Tone_signal_Scale;
var Tone = Tone_core_Tone;
var p5sound = master;
Tone.setContext(p5sound.audiocontext);
/**
* <p>p5.Signal is a constant audio-rate signal used by p5.Oscillator
* and p5.Envelope for modulation math.</p>
*
* <p>This is necessary because Web Audio is processed on a seprate clock.
* For example, the p5 draw loop runs about 60 times per second. But
* the audio clock must process samples 44100 times per second. If we
* want to add a value to each of those samples, we can't do it in the
* draw loop, but we can do it by adding a constant-rate audio signal.</p.
*
* <p>This class mostly functions behind the scenes in p5.sound, and returns
* a Tone.Signal from the Tone.js library by Yotam Mann.
* If you want to work directly with audio signals for modular
* synthesis, check out
* <a href='http://bit.ly/1oIoEng' target=_'blank'>tone.js.</a></p>
*
* @class p5.Signal
* @constructor
* @return {Tone.Signal} A Signal object from the Tone.js library
* @example
* <div><code>
* function setup() {
* carrier = new p5.Oscillator('sine');
* carrier.amp(1); // set amplitude
* carrier.freq(220); // set frequency
* carrier.start(); // start oscillating
*
* modulator = new p5.Oscillator('sawtooth');
* modulator.disconnect();
* modulator.amp(1);
* modulator.freq(4);
* modulator.start();
*
* // Modulator's default amplitude range is -1 to 1.
* // Multiply it by -200, so the range is -200 to 200
* // then add 220 so the range is 20 to 420
* carrier.freq( modulator.mult(-200).add(220) );
* }
* </code></div>
*/
p5.Signal = function (value) {
var s = new Signal(value);
// p5sound.soundArray.push(s);
return s;
};
/**
* Fade to value, for smooth transitions
*
* @method fade
* @param {Number} value Value to set this signal
* @param {[Number]} secondsFromNow Length of fade, in seconds from now
*/
Signal.prototype.fade = Signal.prototype.linearRampToValueAtTime;
Mult.prototype.fade = Signal.prototype.fade;
Add.prototype.fade = Signal.prototype.fade;
Scale.prototype.fade = Signal.prototype.fade;
/**
* Connect a p5.sound object or Web Audio node to this
* p5.Signal so that its amplitude values can be scaled.
*
* @param {Object} input
*/
Signal.prototype.setInput = function (_input) {
_input.connect(this);
};
Mult.prototype.setInput = Signal.prototype.setInput;
Add.prototype.setInput = Signal.prototype.setInput;
Scale.prototype.setInput = Signal.prototype.setInput;
// signals can add / mult / scale themselves
/**
* Add a constant value to this audio signal,
* and return the resulting audio signal. Does
* not change the value of the original signal,
* instead it returns a new p5.SignalAdd.
*
* @method add
* @param {Number} number
* @return {p5.SignalAdd} object
*/
Signal.prototype.add = function (num) {
var add = new Add(num);
// add.setInput(this);
this.connect(add);
return add;
};
Mult.prototype.add = Signal.prototype.add;
Add.prototype.add = Signal.prototype.add;
Scale.prototype.add = Signal.prototype.add;
/**
* Multiply this signal by a constant value,
* and return the resulting audio signal. Does
* not change the value of the original signal,
* instead it returns a new p5.SignalMult.
*
* @method mult
* @param {Number} number to multiply
* @return {Tone.Multiply} object
*/
Signal.prototype.mult = function (num) {
var mult = new Mult(num);
// mult.setInput(this);
this.connect(mult);
return mult;
};
Mult.prototype.mult = Signal.prototype.mult;
Add.prototype.mult = Signal.prototype.mult;
Scale.prototype.mult = Signal.prototype.mult;
/**
* Scale this signal value to a given range,
* and return the result as an audio signal. Does
* not change the value of the original signal,
* instead it returns a new p5.SignalScale.
*
* @method scale
* @param {Number} number to multiply
* @param {Number} inMin input range minumum
* @param {Number} inMax input range maximum
* @param {Number} outMin input range minumum
* @param {Number} outMax input range maximum
* @return {p5.SignalScale} object
*/
Signal.prototype.scale = function (inMin, inMax, outMin, outMax) {
var mapOutMin, mapOutMax;
if (arguments.length === 4) {
mapOutMin = p5.prototype.map(outMin, inMin, inMax, 0, 1) - 0.5;
mapOutMax = p5.prototype.map(outMax, inMin, inMax, 0, 1) - 0.5;
} else {
mapOutMin = arguments[0];
mapOutMax = arguments[1];
}
var scale = new Scale(mapOutMin, mapOutMax);
this.connect(scale);
return scale;
};
Mult.prototype.scale = Signal.prototype.scale;
Add.prototype.scale = Signal.prototype.scale;
Scale.prototype.scale = Signal.prototype.scale;
}(Tone_signal_Signal, Tone_signal_Add, Tone_signal_Multiply, Tone_signal_Scale, Tone_core_Tone, master);
var oscillator;
oscillator = function () {
'use strict';
var p5sound = master;
var Signal = Tone_signal_Signal;
var Add = Tone_signal_Add;
var Mult = Tone_signal_Multiply;
var Scale = Tone_signal_Scale;
/**
* <p>Creates a signal that oscillates between -1.0 and 1.0.
* By default, the oscillation takes the form of a sinusoidal
* shape ('sine'). Additional types include 'triangle',
* 'sawtooth' and 'square'. The frequency defaults to
* 440 oscillations per second (440Hz, equal to the pitch of an
* 'A' note).</p>
*
* <p>Set the type of oscillation with setType(), or by creating a
* specific oscillator.</p> For example:
* <code>new p5.SinOsc(freq)</code>
* <code>new p5.TriOsc(freq)</code>
* <code>new p5.SqrOsc(freq)</code>
* <code>new p5.SawOsc(freq)</code>.
* </p>
*
* @class p5.Oscillator
* @constructor
* @param {Number} [freq] frequency defaults to 440Hz
* @param {String} [type] type of oscillator. Options:
* 'sine' (default), 'triangle',
* 'sawtooth', 'square'
* @return {Object} Oscillator object
* @example
* <div><code>
* var osc;
* var playing = false;
*
* function setup() {
* backgroundColor = color(255,0,255);
* textAlign(CENTER);
*
* osc = new p5.Oscillator();
* osc.setType('sine');
* osc.freq(240);
* osc.amp(0);
* osc.start();
* }
*
* function draw() {
* background(backgroundColor)
* text('click to play', width/2, height/2);
* }
*
* function mouseClicked() {
* if (mouseX > 0 && mouseX < width && mouseY < height && mouseY > 0) {
* if (!playing) {
* // ramp amplitude to 0.5 over 0.1 seconds
* osc.amp(0.5, 0.05);
* playing = true;
* backgroundColor = color(0,255,255);
* } else {
* // ramp amplitude to 0 over 0.5 seconds
* osc.amp(0, 0.5);
* playing = false;
* backgroundColor = color(255,0,255);
* }
* }
* }
* </code> </div>
*/
p5.Oscillator = function (freq, type) {
if (typeof freq === 'string') {
var f = type;
type = freq;
freq = f;
}
if (typeof type === 'number') {
var f = type;
type = freq;
freq = f;
}
this.started = false;
// components
this.phaseAmount = undefined;
this.oscillator = p5sound.audiocontext.createOscillator();
this.f = freq || 440;
// frequency
this.oscillator.frequency.setValueAtTime(this.f, p5sound.audiocontext.currentTime);
this.oscillator.type = type || 'sine';
var o = this.oscillator;
// connections
this.input = p5sound.audiocontext.createGain();
this.output = p5sound.audiocontext.createGain();
this._freqMods = [];
// modulators connected to this oscillator's frequency
// set default output gain to 0.5
this.output.gain.value = 0.5;
this.output.gain.setValueAtTime(0.5, p5sound.audiocontext.currentTime);
this.oscillator.connect(this.output);
// stereo panning
this.panPosition = 0;
this.connection = p5sound.input;
// connect to p5sound by default
this.panner = new p5.Panner(this.output, this.connection, 1);
//array of math operation signal chaining
this.mathOps = [this.output];
// add to the soundArray so we can dispose of the osc later
p5sound.soundArray.push(this);
};
/**
* Start an oscillator. Accepts an optional parameter to
* determine how long (in seconds from now) until the
* oscillator starts.
*
* @method start
* @param {Number} [time] startTime in seconds from now.
* @param {Number} [frequency] frequency in Hz.
*/
p5.Oscillator.prototype.start = function (time, f) {
if (this.started) {
var now = p5sound.audiocontext.currentTime;
this.stop(now);
}
if (!this.started) {
var freq = f || this.f;
var type = this.oscillator.type;
// var detune = this.oscillator.frequency.value;
this.oscillator = p5sound.audiocontext.createOscillator();
this.oscillator.frequency.exponentialRampToValueAtTime(Math.abs(freq), p5sound.audiocontext.currentTime);
this.oscillator.type = type;
// this.oscillator.detune.value = detune;
this.oscillator.connect(this.output);
time = time || 0;
this.oscillator.start(time + p5sound.audiocontext.currentTime);
this.freqNode = this.oscillator.frequency;
// if other oscillators are already connected to this osc's freq
for (var i in this._freqMods) {
if (typeof this._freqMods[i].connect !== 'undefined') {
this._freqMods[i].connect(this.oscillator.frequency);
}
}
this.started = true;
}
};
/**
* Stop an oscillator. Accepts an optional parameter
* to determine how long (in seconds from now) until the
* oscillator stops.
*
* @method stop
* @param {Number} secondsFromNow Time, in seconds from now.
*/
p5.Oscillator.prototype.stop = function (time) {
if (this.started) {
var t = time || 0;
var now = p5sound.audiocontext.currentTime;
this.oscillator.stop(t + now);
this.started = false;
}
};
/**
* Set the amplitude between 0 and 1.0. Or, pass in an object
* such as an oscillator to modulate amplitude with an audio signal.
*
* @method amp
* @param {Number|Object} vol between 0 and 1.0
* or a modulating signal/oscillator
* @param {Number} [rampTime] create a fade that lasts rampTime
* @param {Number} [timeFromNow] schedule this event to happen
* seconds from now
* @return {AudioParam} gain If no value is provided,
* returns the Web Audio API
* AudioParam that controls
* this oscillator's
* gain/amplitude/volume)
*/
p5.Oscillator.prototype.amp = function (vol, rampTime, tFromNow) {
var self = this;
if (typeof vol === 'number') {
var rampTime = rampTime || 0;
var tFromNow = tFromNow || 0;
var now = p5sound.audiocontext.currentTime;
var currentVol = this.output.gain.value;
this.output.gain.cancelScheduledValues(now);
this.output.gain.linearRampToValueAtTime(currentVol, now + tFromNow);
this.output.gain.linearRampToValueAtTime(vol, now + tFromNow + rampTime);
} else if (vol) {
vol.connect(self.output.gain);
} else {
// return the Gain Node
return this.output.gain;
}
};
// these are now the same thing
p5.Oscillator.prototype.fade = p5.Oscillator.prototype.amp;
p5.Oscillator.prototype.getAmp = function () {
return this.output.gain.value;
};
/**
* Set frequency of an oscillator to a value. Or, pass in an object
* such as an oscillator to modulate the frequency with an audio signal.
*
* @method freq
* @param {Number|Object} Frequency Frequency in Hz
* or modulating signal/oscillator
* @param {Number} [rampTime] Ramp time (in seconds)
* @param {Number} [timeFromNow] Schedule this event to happen
* at x seconds from now
* @return {AudioParam} Frequency If no value is provided,
* returns the Web Audio API
* AudioParam that controls
* this oscillator's frequency
* @example
* <div><code>
* var osc = new p5.Oscillator(300);
* osc.start();
* osc.freq(40, 10);
* </code></div>
*/
p5.Oscillator.prototype.freq = function (val, rampTime, tFromNow) {
if (typeof val === 'number' && !isNaN(val)) {
this.f = val;
var now = p5sound.audiocontext.currentTime;
var rampTime = rampTime || 0;
var tFromNow = tFromNow || 0;
// var currentFreq = this.oscillator.frequency.value;
// this.oscillator.frequency.cancelScheduledValues(now);
if (rampTime == 0) {
this.oscillator.frequency.cancelScheduledValues(now);
this.oscillator.frequency.setValueAtTime(val, tFromNow + now);
} else {
if (val > 0) {
this.oscillator.frequency.exponentialRampToValueAtTime(val, tFromNow + rampTime + now);
} else {
this.oscillator.frequency.linearRampToValueAtTime(val, tFromNow + rampTime + now);
}
}
// reset phase if oscillator has a phase
if (this.phaseAmount) {
this.phase(this.phaseAmount);
}
} else if (val) {
if (val.output) {
val = val.output;
}
val.connect(this.oscillator.frequency);
// keep track of what is modulating this param
// so it can be re-connected if
this._freqMods.push(val);
} else {
// return the Frequency Node
return this.oscillator.frequency;
}
};
p5.Oscillator.prototype.getFreq = function () {
return this.oscillator.frequency.value;
};
/**
* Set type to 'sine', 'triangle', 'sawtooth' or 'square'.
*
* @method setType
* @param {String} type 'sine', 'triangle', 'sawtooth' or 'square'.
*/
p5.Oscillator.prototype.setType = function (type) {
this.oscillator.type = type;
};
p5.Oscillator.prototype.getType = function () {
return this.oscillator.type;
};
/**
* Connect to a p5.sound / Web Audio object.
*
* @method connect
* @param {Object} unit A p5.sound or Web Audio object
*/
p5.Oscillator.prototype.connect = function (unit) {
if (!unit) {
this.panner.connect(p5sound.input);
} else if (unit.hasOwnProperty('input')) {
this.panner.connect(unit.input);
this.connection = unit.input;
} else {
this.panner.connect(unit);
this.connection = unit;
}
};
/**
* Disconnect all outputs
*
* @method disconnect
*/
p5.Oscillator.prototype.disconnect = function (unit) {
this.output.disconnect();
this.panner.disconnect();
this.output.connect(this.panner);
this.oscMods = [];
};
/**
* Pan between Left (-1) and Right (1)
*
* @method pan
* @param {Number} panning Number between -1 and 1
* @param {Number} timeFromNow schedule this event to happen
* seconds from now
*/
p5.Oscillator.prototype.pan = function (pval, tFromNow) {
this.panPosition = pval;
this.panner.pan(pval, tFromNow);
};
p5.Oscillator.prototype.getPan = function () {
return this.panPosition;
};
// get rid of the oscillator
p5.Oscillator.prototype.dispose = function () {
// remove reference from soundArray
var index = p5sound.soundArray.indexOf(this);
p5sound.soundArray.splice(index, 1);
if (this.oscillator) {
var now = p5sound.audiocontext.currentTime;
this.stop(now);
this.disconnect();
this.oscillator.disconnect();
this.panner = null;
this.oscillator = null;
}
// if it is a Pulse
if (this.osc2) {
this.osc2.dispose();
}
};
/**
* Set the phase of an oscillator between 0.0 and 1.0.
* In this implementation, phase is a delay time
* based on the oscillator's current frequency.
*
* @method phase
* @param {Number} phase float between 0.0 and 1.0
*/
p5.Oscillator.prototype.phase = function (p) {
var delayAmt = p5.prototype.map(p, 0, 1, 0, 1 / this.f);
var now = p5sound.audiocontext.currentTime;
this.phaseAmount = p;
if (!this.dNode) {
// create a delay node
this.dNode = p5sound.audiocontext.createDelay();
// put the delay node in between output and panner
this.oscillator.disconnect();
this.oscillator.connect(this.dNode);
this.dNode.connect(this.output);
}
// set delay time to match phase:
this.dNode.delayTime.setValueAtTime(delayAmt, now);
};
// ========================== //
// SIGNAL MATH FOR MODULATION //
// ========================== //
// return sigChain(this, scale, thisChain, nextChain, Scale);
var sigChain = function (o, mathObj, thisChain, nextChain, type) {
var chainSource = o.oscillator;
// if this type of math already exists in the chain, replace it
for (var i in o.mathOps) {
if (o.mathOps[i] instanceof type) {
chainSource.disconnect();
o.mathOps[i].dispose();
thisChain = i;
// assume nextChain is output gain node unless...
if (thisChain < o.mathOps.length - 2) {
nextChain = o.mathOps[i + 1];
}
}
}
if (thisChain == o.mathOps.length - 1) {
o.mathOps.push(nextChain);
}
// assume source is the oscillator unless i > 0
if (i > 0) {
chainSource = o.mathOps[i - 1];
}
chainSource.disconnect();
chainSource.connect(mathObj);
mathObj.connect(nextChain);
o.mathOps[thisChain] = mathObj;
return o;
};
/**
* Add a value to the p5.Oscillator's output amplitude,
* and return the oscillator. Calling this method again
* will override the initial add() with a new value.
*
* @method add
* @param {Number} number Constant number to add
* @return {p5.Oscillator} Oscillator Returns this oscillator
* with scaled output
*
*/
p5.Oscillator.prototype.add = function (num) {
var add = new Add(num);
var thisChain = this.mathOps.length - 1;
var nextChain = this.output;
return sigChain(this, add, thisChain, nextChain, Add);
};
/**
* Multiply the p5.Oscillator's output amplitude
* by a fixed value (i.e. turn it up!). Calling this method
* again will override the initial mult() with a new value.
*
* @method mult
* @param {Number} number Constant number to multiply
* @return {p5.Oscillator} Oscillator Returns this oscillator
* with multiplied output
*/
p5.Oscillator.prototype.mult = function (num) {
var mult = new Mult(num);
var thisChain = this.mathOps.length - 1;
var nextChain = this.output;
return sigChain(this, mult, thisChain, nextChain, Mult);
};
/**
* Scale this oscillator's amplitude values to a given
* range, and return the oscillator. Calling this method
* again will override the initial scale() with new values.
*
* @method scale
* @param {Number} inMin input range minumum
* @param {Number} inMax input range maximum
* @param {Number} outMin input range minumum
* @param {Number} outMax input range maximum
* @return {p5.Oscillator} Oscillator Returns this oscillator
* with scaled output
*/
p5.Oscillator.prototype.scale = function (inMin, inMax, outMin, outMax) {
var mapOutMin, mapOutMax;
if (arguments.length === 4) {
mapOutMin = p5.prototype.map(outMin, inMin, inMax, 0, 1) - 0.5;
mapOutMax = p5.prototype.map(outMax, inMin, inMax, 0, 1) - 0.5;
} else {
mapOutMin = arguments[0];
mapOutMax = arguments[1];
}
var scale = new Scale(mapOutMin, mapOutMax);
var thisChain = this.mathOps.length - 1;
var nextChain = this.output;
return sigChain(this, scale, thisChain, nextChain, Scale);
};
// ============================== //
// SinOsc, TriOsc, SqrOsc, SawOsc //
// ============================== //
/**
* Constructor: <code>new p5.SinOsc()</code>.
* This creates a Sine Wave Oscillator and is
* equivalent to <code> new p5.Oscillator('sine')
* </code> or creating a p5.Oscillator and then calling
* its method <code>setType('sine')</code>.
* See p5.Oscillator for methods.
*
* @method p5.SinOsc
* @param {[Number]} freq Set the frequency
*/
p5.SinOsc = function (freq) {
p5.Oscillator.call(this, freq, 'sine');
};
p5.SinOsc.prototype = Object.create(p5.Oscillator.prototype);
/**
* Constructor: <code>new p5.TriOsc()</code>.
* This creates a Triangle Wave Oscillator and is
* equivalent to <code>new p5.Oscillator('triangle')
* </code> or creating a p5.Oscillator and then calling
* its method <code>setType('triangle')</code>.
* See p5.Oscillator for methods.
*
* @method p5.TriOsc
* @param {[Number]} freq Set the frequency
*/
p5.TriOsc = function (freq) {
p5.Oscillator.call(this, freq, 'triangle');
};
p5.TriOsc.prototype = Object.create(p5.Oscillator.prototype);
/**
* Constructor: <code>new p5.SawOsc()</code>.
* This creates a SawTooth Wave Oscillator and is
* equivalent to <code> new p5.Oscillator('sawtooth')
* </code> or creating a p5.Oscillator and then calling
* its method <code>setType('sawtooth')</code>.
* See p5.Oscillator for methods.
*
* @method p5.SawOsc
* @param {[Number]} freq Set the frequency
*/
p5.SawOsc = function (freq) {
p5.Oscillator.call(this, freq, 'sawtooth');
};
p5.SawOsc.prototype = Object.create(p5.Oscillator.prototype);
/**
* Constructor: <code>new p5.SqrOsc()</code>.
* This creates a Square Wave Oscillator and is
* equivalent to <code> new p5.Oscillator('square')
* </code> or creating a p5.Oscillator and then calling
* its method <code>setType('square')</code>.
* See p5.Oscillator for methods.
*
* @method p5.SqrOsc
* @param {[Number]} freq Set the frequency
*/
p5.SqrOsc = function (freq) {
p5.Oscillator.call(this, freq, 'square');
};
p5.SqrOsc.prototype = Object.create(p5.Oscillator.prototype);
}(master, Tone_signal_Signal, Tone_signal_Add, Tone_signal_Multiply, Tone_signal_Scale);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_core_Timeline;
Tone_core_Timeline = function (Tone) {
'use strict';
Tone.Timeline = function () {
var options = this.optionsObject(arguments, ['memory'], Tone.Timeline.defaults);
this._timeline = [];
this._toRemove = [];
this._iterating = false;
this.memory = options.memory;
};
Tone.extend(Tone.Timeline);
Tone.Timeline.defaults = { 'memory': Infinity };
Object.defineProperty(Tone.Timeline.prototype, 'length', {
get: function () {
return this._timeline.length;
}
});
Tone.Timeline.prototype.addEvent = function (event) {
if (this.isUndef(event.time)) {
throw new Error('events must have a time attribute');
}
event.time = this.toSeconds(event.time);
if (this._timeline.length) {
var index = this._search(event.time);
this._timeline.splice(index + 1, 0, event);
} else {
this._timeline.push(event);
}
if (this.length > this.memory) {
var diff = this.length - this.memory;
this._timeline.splice(0, diff);
}
return this;
};
Tone.Timeline.prototype.removeEvent = function (event) {
if (this._iterating) {
this._toRemove.push(event);
} else {
var index = this._timeline.indexOf(event);
if (index !== -1) {
this._timeline.splice(index, 1);
}
}
return this;
};
Tone.Timeline.prototype.getEvent = function (time) {
time = this.toSeconds(time);
var index = this._search(time);
if (index !== -1) {
return this._timeline[index];
} else {
return null;
}
};
Tone.Timeline.prototype.getEventAfter = function (time) {
time = this.toSeconds(time);
var index = this._search(time);
if (index + 1 < this._timeline.length) {
return this._timeline[index + 1];
} else {
return null;
}
};
Tone.Timeline.prototype.getEventBefore = function (time) {
time = this.toSeconds(time);
var index = this._search(time);
if (index - 1 >= 0) {
return this._timeline[index - 1];
} else {
return null;
}
};
Tone.Timeline.prototype.cancel = function (after) {
if (this._timeline.length > 1) {
after = this.toSeconds(after);
var index = this._search(after);
if (index >= 0) {
this._timeline = this._timeline.slice(0, index);
} else {
this._timeline = [];
}
} else if (this._timeline.length === 1) {
if (this._timeline[0].time >= after) {
this._timeline = [];
}
}
return this;
};
Tone.Timeline.prototype.cancelBefore = function (time) {
if (this._timeline.length) {
time = this.toSeconds(time);
var index = this._search(time);
if (index >= 0) {
this._timeline = this._timeline.slice(index + 1);
}
}
return this;
};
Tone.Timeline.prototype._search = function (time) {
var beginning = 0;
var len = this._timeline.length;
var end = len;
while (beginning <= end && beginning < len) {
var midPoint = Math.floor(beginning + (end - beginning) / 2);
var event = this._timeline[midPoint];
if (event.time === time) {
for (var i = midPoint; i < this._timeline.length; i++) {
var testEvent = this._timeline[i];
if (testEvent.time === time) {
midPoint = i;
}
}
return midPoint;
} else if (event.time > time) {
end = midPoint - 1;
} else if (event.time < time) {
beginning = midPoint + 1;
}
}
return beginning - 1;
};
Tone.Timeline.prototype._iterate = function (callback, lowerBound, upperBound) {
this._iterating = true;
lowerBound = this.defaultArg(lowerBound, 0);
upperBound = this.defaultArg(upperBound, this._timeline.length - 1);
for (var i = lowerBound; i <= upperBound; i++) {
callback(this._timeline[i]);
}
this._iterating = false;
if (this._toRemove.length > 0) {
for (var j = 0; j < this._toRemove.length; j++) {
var index = this._timeline.indexOf(this._toRemove[j]);
if (index !== -1) {
this._timeline.splice(index, 1);
}
}
this._toRemove = [];
}
};
Tone.Timeline.prototype.forEach = function (callback) {
this._iterate(callback);
return this;
};
Tone.Timeline.prototype.forEachBefore = function (time, callback) {
time = this.toSeconds(time);
var upperBound = this._search(time);
if (upperBound !== -1) {
this._iterate(callback, 0, upperBound);
}
return this;
};
Tone.Timeline.prototype.forEachAfter = function (time, callback) {
time = this.toSeconds(time);
var lowerBound = this._search(time);
this._iterate(callback, lowerBound + 1);
return this;
};
Tone.Timeline.prototype.forEachFrom = function (time, callback) {
time = this.toSeconds(time);
var lowerBound = this._search(time);
while (lowerBound >= 0 && this._timeline[lowerBound].time >= time) {
lowerBound--;
}
this._iterate(callback, lowerBound + 1);
return this;
};
Tone.Timeline.prototype.forEachAtTime = function (time, callback) {
time = this.toSeconds(time);
var upperBound = this._search(time);
if (upperBound !== -1) {
this._iterate(function (event) {
if (event.time === time) {
callback(event);
}
}, 0, upperBound);
}
return this;
};
Tone.Timeline.prototype.dispose = function () {
Tone.prototype.dispose.call(this);
this._timeline = null;
this._toRemove = null;
};
return Tone.Timeline;
}(Tone_core_Tone);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_signal_TimelineSignal;
Tone_signal_TimelineSignal = function (Tone) {
'use strict';
Tone.TimelineSignal = function () {
var options = this.optionsObject(arguments, [
'value',
'units'
], Tone.Signal.defaults);
Tone.Signal.apply(this, options);
options.param = this._param;
Tone.Param.call(this, options);
this._events = new Tone.Timeline(10);
this._initial = this._fromUnits(this._param.value);
};
Tone.extend(Tone.TimelineSignal, Tone.Param);
Tone.TimelineSignal.Type = {
Linear: 'linear',
Exponential: 'exponential',
Target: 'target',
Set: 'set'
};
Object.defineProperty(Tone.TimelineSignal.prototype, 'value', {
get: function () {
return this._toUnits(this._param.value);
},
set: function (value) {
var convertedVal = this._fromUnits(value);
this._initial = convertedVal;
this._param.value = convertedVal;
}
});
Tone.TimelineSignal.prototype.setValueAtTime = function (value, startTime) {
value = this._fromUnits(value);
startTime = this.toSeconds(startTime);
this._events.addEvent({
'type': Tone.TimelineSignal.Type.Set,
'value': value,
'time': startTime
});
this._param.setValueAtTime(value, startTime);
return this;
};
Tone.TimelineSignal.prototype.linearRampToValueAtTime = function (value, endTime) {
value = this._fromUnits(value);
endTime = this.toSeconds(endTime);
this._events.addEvent({
'type': Tone.TimelineSignal.Type.Linear,
'value': value,
'time': endTime
});
this._param.linearRampToValueAtTime(value, endTime);
return this;
};
Tone.TimelineSignal.prototype.exponentialRampToValueAtTime = function (value, endTime) {
value = this._fromUnits(value);
value = Math.max(this._minOutput, value);
endTime = this.toSeconds(endTime);
this._events.addEvent({
'type': Tone.TimelineSignal.Type.Exponential,
'value': value,
'time': endTime
});
this._param.exponentialRampToValueAtTime(value, endTime);
return this;
};
Tone.TimelineSignal.prototype.setTargetAtTime = function (value, startTime, timeConstant) {
value = this._fromUnits(value);
value = Math.max(this._minOutput, value);
timeConstant = Math.max(this._minOutput, timeConstant);
startTime = this.toSeconds(startTime);
this._events.addEvent({
'type': Tone.TimelineSignal.Type.Target,
'value': value,
'time': startTime,
'constant': timeConstant
});
this._param.setTargetAtTime(value, startTime, timeConstant);
return this;
};
Tone.TimelineSignal.prototype.cancelScheduledValues = function (after) {
this._events.cancel(after);
this._param.cancelScheduledValues(this.toSeconds(after));
return this;
};
Tone.TimelineSignal.prototype.setRampPoint = function (time) {
time = this.toSeconds(time);
var val = this.getValueAtTime(time);
var after = this._searchAfter(time);
if (after) {
this.cancelScheduledValues(time);
if (after.type === Tone.TimelineSignal.Type.Linear) {
this.linearRampToValueAtTime(val, time);
} else if (after.type === Tone.TimelineSignal.Type.Exponential) {
this.exponentialRampToValueAtTime(val, time);
}
}
this.setValueAtTime(val, time);
return this;
};
Tone.TimelineSignal.prototype.linearRampToValueBetween = function (value, start, finish) {
this.setRampPoint(start);
this.linearRampToValueAtTime(value, finish);
return this;
};
Tone.TimelineSignal.prototype.exponentialRampToValueBetween = function (value, start, finish) {
this.setRampPoint(start);
this.exponentialRampToValueAtTime(value, finish);
return this;
};
Tone.TimelineSignal.prototype._searchBefore = function (time) {
return this._events.getEvent(time);
};
Tone.TimelineSignal.prototype._searchAfter = function (time) {
return this._events.getEventAfter(time);
};
Tone.TimelineSignal.prototype.getValueAtTime = function (time) {
var after = this._searchAfter(time);
var before = this._searchBefore(time);
var value = this._initial;
if (before === null) {
value = this._initial;
} else if (before.type === Tone.TimelineSignal.Type.Target) {
var previous = this._events.getEventBefore(before.time);
var previouVal;
if (previous === null) {
previouVal = this._initial;
} else {
previouVal = previous.value;
}
value = this._exponentialApproach(before.time, previouVal, before.value, before.constant, time);
} else if (after === null) {
value = before.value;
} else if (after.type === Tone.TimelineSignal.Type.Linear) {
value = this._linearInterpolate(before.time, before.value, after.time, after.value, time);
} else if (after.type === Tone.TimelineSignal.Type.Exponential) {
value = this._exponentialInterpolate(before.time, before.value, after.time, after.value, time);
} else {
value = before.value;
}
return value;
};
Tone.TimelineSignal.prototype.connect = Tone.SignalBase.prototype.connect;
Tone.TimelineSignal.prototype._exponentialApproach = function (t0, v0, v1, timeConstant, t) {
return v1 + (v0 - v1) * Math.exp(-(t - t0) / timeConstant);
};
Tone.TimelineSignal.prototype._linearInterpolate = function (t0, v0, t1, v1, t) {
return v0 + (v1 - v0) * ((t - t0) / (t1 - t0));
};
Tone.TimelineSignal.prototype._exponentialInterpolate = function (t0, v0, t1, v1, t) {
v0 = Math.max(this._minOutput, v0);
return v0 * Math.pow(v1 / v0, (t - t0) / (t1 - t0));
};
Tone.TimelineSignal.prototype.dispose = function () {
Tone.Signal.prototype.dispose.call(this);
Tone.Param.prototype.dispose.call(this);
this._events.dispose();
this._events = null;
};
return Tone.TimelineSignal;
}(Tone_core_Tone, Tone_signal_Signal);
var env;
env = function () {
'use strict';
var p5sound = master;
var Add = Tone_signal_Add;
var Mult = Tone_signal_Multiply;
var Scale = Tone_signal_Scale;
var TimelineSignal = Tone_signal_TimelineSignal;
var Tone = Tone_core_Tone;
Tone.setContext(p5sound.audiocontext);
/**
* <p>Envelopes are pre-defined amplitude distribution over time.
* Typically, envelopes are used to control the output volume
* of an object, a series of fades referred to as Attack, Decay,
* Sustain and Release (
* <a href="https://upload.wikimedia.org/wikipedia/commons/e/ea/ADSR_parameter.svg">ADSR</a>
* ). Envelopes can also control other Web Audio Parameters—for example, a p5.Env can
* control an Oscillator's frequency like this: <code>osc.freq(env)</code>.</p>
* <p>Use <code><a href="#/p5.Env/setRange">setRange</a></code> to change the attack/release level.
* Use <code><a href="#/p5.Env/setADSR">setADSR</a></code> to change attackTime, decayTime, sustainPercent and releaseTime.</p>
* <p>Use the <code><a href="#/p5.Env/play">play</a></code> method to play the entire envelope,
* the <code><a href="#/p5.Env/ramp">ramp</a></code> method for a pingable trigger,
* or <code><a href="#/p5.Env/triggerAttack">triggerAttack</a></code>/
* <code><a href="#/p5.Env/triggerRelease">triggerRelease</a></code> to trigger noteOn/noteOff.</p>
*
* @class p5.Env
* @constructor
* @example
* <div><code>
* var attackLevel = 1.0;
* var releaseLevel = 0;
*
* var attackTime = 0.001
* var decayTime = 0.2;
* var susPercent = 0.2;
* var releaseTime = 0.5;
*
* var env, triOsc;
*
* function setup() {
* var cnv = createCanvas(100, 100);
*
* textAlign(CENTER);
* text('click to play', width/2, height/2);
*
* env = new p5.Env();
* env.setADSR(attackTime, decayTime, susPercent, releaseTime);
* env.setRange(attackLevel, releaseLevel);
*
* triOsc = new p5.Oscillator('triangle');
* triOsc.amp(env);
* triOsc.start();
* triOsc.freq(220);
*
* cnv.mousePressed(playEnv);
* }
*
* function playEnv(){
* env.play();
* }
* </code></div>
*/
p5.Env = function (t1, l1, t2, l2, t3, l3) {
var now = p5sound.audiocontext.currentTime;
/**
* Time until envelope reaches attackLevel
* @property attackTime
*/
this.aTime = t1 || 0.1;
/**
* Level once attack is complete.
* @property attackLevel
*/
this.aLevel = l1 || 1;
/**
* Time until envelope reaches decayLevel.
* @property decayTime
*/
this.dTime = t2 || 0.5;
/**
* Level after decay. The envelope will sustain here until it is released.
* @property decayLevel
*/
this.dLevel = l2 || 0;
/**
* Duration of the release portion of the envelope.
* @property releaseTime
*/
this.rTime = t3 || 0;
/**
* Level at the end of the release.
* @property releaseLevel
*/
this.rLevel = l3 || 0;
this._rampHighPercentage = 0.98;
this._rampLowPercentage = 0.02;
this.output = p5sound.audiocontext.createGain();
this.control = new TimelineSignal();
this._init();
// this makes sure the envelope starts at zero
this.control.connect(this.output);
// connect to the output
this.connection = null;
// store connection
//array of math operation signal chaining
this.mathOps = [this.control];
//whether envelope should be linear or exponential curve
this.isExponential = false;
// oscillator or buffer source to clear on env complete
// to save resources if/when it is retriggered
this.sourceToClear = null;
// set to true if attack is set, then false on release
this.wasTriggered = false;
// add to the soundArray so we can dispose of the env later
p5sound.soundArray.push(this);
};
// this init function just smooths the starting value to zero and gives a start point for the timeline
// - it was necessary to remove glitches at the beginning.
p5.Env.prototype._init = function () {
var now = p5sound.audiocontext.currentTime;
var t = now;
this.control.setTargetAtTime(0.00001, t, 0.001);
//also, compute the correct time constants
this._setRampAD(this.aTime, this.dTime);
};
/**
* Reset the envelope with a series of time/value pairs.
*
* @method set
* @param {Number} attackTime Time (in seconds) before level
* reaches attackLevel
* @param {Number} attackLevel Typically an amplitude between
* 0.0 and 1.0
* @param {Number} decayTime Time
* @param {Number} decayLevel Amplitude (In a standard ADSR envelope,
* decayLevel = sustainLevel)
* @param {Number} releaseTime Release Time (in seconds)
* @param {Number} releaseLevel Amplitude
*/
p5.Env.prototype.set = function (t1, l1, t2, l2, t3, l3) {
this.aTime = t1;
this.aLevel = l1;
this.dTime = t2 || 0;
this.dLevel = l2 || 0;
this.rTime = t4 || 0;
this.rLevel = l4 || 0;
// set time constants for ramp
this._setRampAD(t1, t2);
};
/**
* Set values like a traditional
* <a href="https://en.wikipedia.org/wiki/Synthesizer#/media/File:ADSR_parameter.svg">
* ADSR envelope
* </a>.
*
* @method setADSR
* @param {Number} attackTime Time (in seconds before envelope
* reaches Attack Level
* @param {Number} [decayTime] Time (in seconds) before envelope
* reaches Decay/Sustain Level
* @param {Number} [susRatio] Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,
* where 1.0 = attackLevel, 0.0 = releaseLevel.
* The susRatio determines the decayLevel and the level at which the
* sustain portion of the envelope will sustain.
* For example, if attackLevel is 0.4, releaseLevel is 0,
* and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is
* increased to 1.0 (using <code>setRange</code>),
* then decayLevel would increase proportionally, to become 0.5.
* @param {Number} [releaseTime] Time in seconds from now (defaults to 0)
* @example
* <div><code>
* var attackLevel = 1.0;
* var releaseLevel = 0;
*
* var attackTime = 0.001
* var decayTime = 0.2;
* var susPercent = 0.2;
* var releaseTime = 0.5;
*
* var env, triOsc;
*
* function setup() {
* var cnv = createCanvas(100, 100);
*
* textAlign(CENTER);
* text('click to play', width/2, height/2);
*
* env = new p5.Env();
* env.setADSR(attackTime, decayTime, susPercent, releaseTime);
* env.setRange(attackLevel, releaseLevel);
*
* triOsc = new p5.Oscillator('triangle');
* triOsc.amp(env);
* triOsc.start();
* triOsc.freq(220);
*
* cnv.mousePressed(playEnv);
* }
*
* function playEnv(){
* env.play();
* }
* </code></div>
*/
p5.Env.prototype.setADSR = function (aTime, dTime, sPercent, rTime) {
this.aTime = aTime;
this.dTime = dTime || 0;
// lerp
this.sPercent = sPercent || 0;
this.dLevel = typeof sPercent !== 'undefined' ? sPercent * (this.aLevel - this.rLevel) + this.rLevel : 0;
this.rTime = rTime || 0;
// also set time constants for ramp
this._setRampAD(aTime, dTime);
};
/**
* Set max (attackLevel) and min (releaseLevel) of envelope.
*
* @method setRange
* @param {Number} aLevel attack level (defaults to 1)
* @param {Number} rLevel release level (defaults to 0)
* @example
* <div><code>
* var attackLevel = 1.0;
* var releaseLevel = 0;
*
* var attackTime = 0.001
* var decayTime = 0.2;
* var susPercent = 0.2;
* var releaseTime = 0.5;
*
* var env, triOsc;
*
* function setup() {
* var cnv = createCanvas(100, 100);
*
* textAlign(CENTER);
* text('click to play', width/2, height/2);
*
* env = new p5.Env();
* env.setADSR(attackTime, decayTime, susPercent, releaseTime);
* env.setRange(attackLevel, releaseLevel);
*
* triOsc = new p5.Oscillator('triangle');
* triOsc.amp(env);
* triOsc.start();
* triOsc.freq(220);
*
* cnv.mousePressed(playEnv);
* }
*
* function playEnv(){
* env.play();
* }
* </code></div>
*/
p5.Env.prototype.setRange = function (aLevel, rLevel) {
this.aLevel = aLevel || 1;
this.rLevel = rLevel || 0;
};
// private (undocumented) method called when ADSR is set to set time constants for ramp
//
// Set the <a href="https://en.wikipedia.org/wiki/RC_time_constant">
// time constants</a> for simple exponential ramps.
// The larger the time constant value, the slower the
// transition will be.
//
// method _setRampAD
// param {Number} attackTimeConstant attack time constant
// param {Number} decayTimeConstant decay time constant
//
p5.Env.prototype._setRampAD = function (t1, t2) {
this._rampAttackTime = this.checkExpInput(t1);
this._rampDecayTime = this.checkExpInput(t2);
var TCDenominator = 1;
/// Aatish Bhatia's calculation for time constant for rise(to adjust 1/1-e calculation to any percentage)
TCDenominator = Math.log(1 / this.checkExpInput(1 - this._rampHighPercentage));
this._rampAttackTC = t1 / this.checkExpInput(TCDenominator);
TCDenominator = Math.log(1 / this._rampLowPercentage);
this._rampDecayTC = t2 / this.checkExpInput(TCDenominator);
};
// private method
p5.Env.prototype.setRampPercentages = function (p1, p2) {
//set the percentages that the simple exponential ramps go to
this._rampHighPercentage = this.checkExpInput(p1);
this._rampLowPercentage = this.checkExpInput(p2);
var TCDenominator = 1;
//now re-compute the time constants based on those percentages
/// Aatish Bhatia's calculation for time constant for rise(to adjust 1/1-e calculation to any percentage)
TCDenominator = Math.log(1 / this.checkExpInput(1 - this._rampHighPercentage));
this._rampAttackTC = this._rampAttackTime / this.checkExpInput(TCDenominator);
TCDenominator = Math.log(1 / this._rampLowPercentage);
this._rampDecayTC = this._rampDecayTime / this.checkExpInput(TCDenominator);
};
/**
* Assign a parameter to be controlled by this envelope.
* If a p5.Sound object is given, then the p5.Env will control its
* output gain. If multiple inputs are provided, the env will
* control all of them.
*
* @method setInput
* @param {Object} unit A p5.sound object or
* Web Audio Param.
*/
p5.Env.prototype.setInput = function (unit) {
for (var i = 0; i < arguments.length; i++) {
this.connect(arguments[i]);
}
};
/**
* Set whether the envelope ramp is linear (default) or exponential.
* Exponential ramps can be useful because we perceive amplitude
* and frequency logarithmically.
*
* @method setExp
* @param {Boolean} isExp true is exponential, false is linear
*/
p5.Env.prototype.setExp = function (isExp) {
this.isExponential = isExp;
};
//helper method to protect against zero values being sent to exponential functions
p5.Env.prototype.checkExpInput = function (value) {
if (value <= 0) {
value = 0.0001;
}
return value;
};
/**
* Play tells the envelope to start acting on a given input.
* If the input is a p5.sound object (i.e. AudioIn, Oscillator,
* SoundFile), then Env will control its output volume.
* Envelopes can also be used to control any <a href="
* http://docs.webplatform.org/wiki/apis/webaudio/AudioParam">
* Web Audio Audio Param.</a>
*
* @method play
* @param {Object} unit A p5.sound object or
* Web Audio Param.
* @param {Number} [startTime] time from now (in seconds) at which to play
* @param {Number} [sustainTime] time to sustain before releasing the envelope
* @example
* <div><code>
* var attackLevel = 1.0;
* var releaseLevel = 0;
*
* var attackTime = 0.001
* var decayTime = 0.2;
* var susPercent = 0.2;
* var releaseTime = 0.5;
*
* var env, triOsc;
*
* function setup() {
* var cnv = createCanvas(100, 100);
*
* textAlign(CENTER);
* text('click to play', width/2, height/2);
*
* env = new p5.Env();
* env.setADSR(attackTime, decayTime, susPercent, releaseTime);
* env.setRange(attackLevel, releaseLevel);
*
* triOsc = new p5.Oscillator('triangle');
* triOsc.amp(env);
* triOsc.start();
* triOsc.freq(220);
*
* cnv.mousePressed(playEnv);
* }
*
* function playEnv(){
* // trigger env on triOsc, 0 seconds from now
* // After decay, sustain for 0.2 seconds before release
* env.play(triOsc, 0, 0.2);
* }
* </code></div>
*/
p5.Env.prototype.play = function (unit, secondsFromNow, susTime) {
var now = p5sound.audiocontext.currentTime;
var tFromNow = secondsFromNow || 0;
var susTime = susTime || 0;
if (unit) {
if (this.connection !== unit) {
this.connect(unit);
}
}
this.triggerAttack(unit, tFromNow);
this.triggerRelease(unit, tFromNow + this.aTime + this.dTime + susTime);
};
/**
* Trigger the Attack, and Decay portion of the Envelope.
* Similar to holding down a key on a piano, but it will
* hold the sustain level until you let go. Input can be
* any p5.sound object, or a <a href="
* http://docs.webplatform.org/wiki/apis/webaudio/AudioParam">
* Web Audio Param</a>.
*
* @method triggerAttack
* @param {Object} unit p5.sound Object or Web Audio Param
* @param {Number} secondsFromNow time from now (in seconds)
* @example
* <div><code>
*
* var attackLevel = 1.0;
* var releaseLevel = 0;
*
* var attackTime = 0.001
* var decayTime = 0.3;
* var susPercent = 0.4;
* var releaseTime = 0.5;
*
* var env, triOsc;
*
* function setup() {
* var cnv = createCanvas(100, 100);
* background(200);
* textAlign(CENTER);
* text('click to play', width/2, height/2);
*
* env = new p5.Env();
* env.setADSR(attackTime, decayTime, susPercent, releaseTime);
* env.setRange(attackLevel, releaseLevel);
*
* triOsc = new p5.Oscillator('triangle');
* triOsc.amp(env);
* triOsc.start();
* triOsc.freq(220);
*
* cnv.mousePressed(envAttack);
* }
*
* function envAttack(){
* console.log('trigger attack');
* env.triggerAttack();
*
* background(0,255,0);
* text('attack!', width/2, height/2);
* }
*
* function mouseReleased() {
* env.triggerRelease();
*
* background(200);
* text('click to play', width/2, height/2);
* }
* </code></div>
*/
p5.Env.prototype.triggerAttack = function (unit, secondsFromNow) {
var now = p5sound.audiocontext.currentTime;
var tFromNow = secondsFromNow || 0;
var t = now + tFromNow;
this.lastAttack = t;
this.wasTriggered = true;
if (unit) {
if (this.connection !== unit) {
this.connect(unit);
}
}
// get and set value (with linear ramp) to anchor automation
var valToSet = this.control.getValueAtTime(t);
this.control.cancelScheduledValues(t);
// not sure if this is necessary
if (this.isExponential == true) {
this.control.exponentialRampToValueAtTime(this.checkExpInput(valToSet), t);
} else {
this.control.linearRampToValueAtTime(valToSet, t);
}
// after each ramp completes, cancel scheduled values
// (so they can be overridden in case env has been re-triggered)
// then, set current value (with linearRamp to avoid click)
// then, schedule the next automation...
// attack
t += this.aTime;
if (this.isExponential == true) {
this.control.exponentialRampToValueAtTime(this.checkExpInput(this.aLevel), t);
valToSet = this.checkExpInput(this.control.getValueAtTime(t));
this.control.cancelScheduledValues(t);
this.control.exponentialRampToValueAtTime(valToSet, t);
} else {
this.control.linearRampToValueAtTime(this.aLevel, t);
valToSet = this.control.getValueAtTime(t);
this.control.cancelScheduledValues(t);
this.control.linearRampToValueAtTime(valToSet, t);
}
// decay to decay level (if using ADSR, then decay level == sustain level)
t += this.dTime;
if (this.isExponential == true) {
this.control.exponentialRampToValueAtTime(this.checkExpInput(this.dLevel), t);
valToSet = this.checkExpInput(this.control.getValueAtTime(t));
this.control.cancelScheduledValues(t);
this.control.exponentialRampToValueAtTime(valToSet, t);
} else {
this.control.linearRampToValueAtTime(this.dLevel, t);
valToSet = this.control.getValueAtTime(t);
this.control.cancelScheduledValues(t);
this.control.linearRampToValueAtTime(valToSet, t);
}
};
/**
* Trigger the Release of the Envelope. This is similar to releasing
* the key on a piano and letting the sound fade according to the
* release level and release time.
*
* @method triggerRelease
* @param {Object} unit p5.sound Object or Web Audio Param
* @param {Number} secondsFromNow time to trigger the release
* @example
* <div><code>
*
* var attackLevel = 1.0;
* var releaseLevel = 0;
*
* var attackTime = 0.001
* var decayTime = 0.3;
* var susPercent = 0.4;
* var releaseTime = 0.5;
*
* var env, triOsc;
*
* function setup() {
* var cnv = createCanvas(100, 100);
* background(200);
* textAlign(CENTER);
* text('click to play', width/2, height/2);
*
* env = new p5.Env();
* env.setADSR(attackTime, decayTime, susPercent, releaseTime);
* env.setRange(attackLevel, releaseLevel);
*
* triOsc = new p5.Oscillator('triangle');
* triOsc.amp(env);
* triOsc.start();
* triOsc.freq(220);
*
* cnv.mousePressed(envAttack);
* }
*
* function envAttack(){
* console.log('trigger attack');
* env.triggerAttack();
*
* background(0,255,0);
* text('attack!', width/2, height/2);
* }
*
* function mouseReleased() {
* env.triggerRelease();
*
* background(200);
* text('click to play', width/2, height/2);
* }
* </code></div>
*/
p5.Env.prototype.triggerRelease = function (unit, secondsFromNow) {
// only trigger a release if an attack was triggered
if (!this.wasTriggered) {
// this currently causes a bit of trouble:
// if a later release has been scheduled (via the play function)
// a new earlier release won't interrupt it, because
// this.wasTriggered has already been set to false.
// If we want new earlier releases to override, then we need to
// keep track of the last release time, and if the new release time is
// earlier, then use it.
return;
}
var now = p5sound.audiocontext.currentTime;
var tFromNow = secondsFromNow || 0;
var t = now + tFromNow;
if (unit) {
if (this.connection !== unit) {
this.connect(unit);
}
}
// get and set value (with linear or exponential ramp) to anchor automation
var valToSet = this.control.getValueAtTime(t);
this.control.cancelScheduledValues(t);
// not sure if this is necessary
if (this.isExponential == true) {
this.control.exponentialRampToValueAtTime(this.checkExpInput(valToSet), t);
} else {
this.control.linearRampToValueAtTime(valToSet, t);
}
// release
t += this.rTime;
if (this.isExponential == true) {
this.control.exponentialRampToValueAtTime(this.checkExpInput(this.rLevel), t);
valToSet = this.checkExpInput(this.control.getValueAtTime(t));
this.control.cancelScheduledValues(t);
this.control.exponentialRampToValueAtTime(valToSet, t);
} else {
this.control.linearRampToValueAtTime(this.rLevel, t);
valToSet = this.control.getValueAtTime(t);
this.control.cancelScheduledValues(t);
this.control.linearRampToValueAtTime(valToSet, t);
}
this.wasTriggered = false;
};
/**
* Exponentially ramp to a value using the first two
* values from <code><a href="#/p5.Env/setADSR">setADSR(attackTime, decayTime)</a></code>
* as <a href="https://en.wikipedia.org/wiki/RC_time_constant">
* time constants</a> for simple exponential ramps.
* If the value is higher than current value, it uses attackTime,
* while a decrease uses decayTime.
*
* @method ramp
* @param {Object} unit p5.sound Object or Web Audio Param
* @param {Number} secondsFromNow When to trigger the ramp
* @param {Number} v Target value
* @param {Number} [v2] Second target value (optional)
* @example
* <div><code>
* var env, osc, amp, cnv;
*
* var attackTime = 0.001;
* var decayTime = 0.2;
* var attackLevel = 1;
* var decayLevel = 0;
*
* function setup() {
* cnv = createCanvas(100, 100);
* fill(0,255,0);
* noStroke();
*
* env = new p5.Env();
* env.setADSR(attackTime, decayTime);
*
* osc = new p5.Oscillator();
* osc.amp(env);
* osc.start();
*
* amp = new p5.Amplitude();
*
* cnv.mousePressed(triggerRamp);
* }
*
* function triggerRamp() {
* env.ramp(osc, 0, attackLevel, decayLevel);
* }
*
* function draw() {
* background(20,20,20);
* text('click me', 10, 20);
* var h = map(amp.getLevel(), 0, 0.4, 0, height);;
*
* rect(0, height, width, -h);
* }
* </code></div>
*/
p5.Env.prototype.ramp = function (unit, secondsFromNow, v1, v2) {
var now = p5sound.audiocontext.currentTime;
var tFromNow = secondsFromNow || 0;
var t = now + tFromNow;
var destination1 = this.checkExpInput(v1);
var destination2 = typeof v2 !== 'undefined' ? this.checkExpInput(v2) : undefined;
// connect env to unit if not already connected
if (unit) {
if (this.connection !== unit) {
this.connect(unit);
}
}
//get current value
var currentVal = this.checkExpInput(this.control.getValueAtTime(t));
this.control.cancelScheduledValues(t);
//if it's going up
if (destination1 > currentVal) {
this.control.setTargetAtTime(destination1, t, this._rampAttackTC);
t += this._rampAttackTime;
} else if (destination1 < currentVal) {
this.control.setTargetAtTime(destination1, t, this._rampDecayTC);
t += this._rampDecayTime;
}
// Now the second part of envelope begins
if (destination2 === undefined)
return;
//if it's going up
if (destination2 > destination1) {
this.control.setTargetAtTime(destination2, t, this._rampAttackTC);
} else if (destination2 < destination1) {
this.control.setTargetAtTime(destination2, t, this._rampDecayTC);
}
};
p5.Env.prototype.connect = function (unit) {
this.connection = unit;
// assume we're talking about output gain
// unless given a different audio param
if (unit instanceof p5.Oscillator || unit instanceof p5.SoundFile || unit instanceof p5.AudioIn || unit instanceof p5.Reverb || unit instanceof p5.Noise || unit instanceof p5.Filter || unit instanceof p5.Delay) {
unit = unit.output.gain;
}
if (unit instanceof AudioParam) {
//set the initial value
unit.setValueAtTime(0, p5sound.audiocontext.currentTime);
}
if (unit instanceof p5.Signal) {
unit.setValue(0);
}
this.output.connect(unit);
};
p5.Env.prototype.disconnect = function (unit) {
this.output.disconnect();
};
// Signal Math
/**
* Add a value to the p5.Oscillator's output amplitude,
* and return the oscillator. Calling this method
* again will override the initial add() with new values.
*
* @method add
* @param {Number} number Constant number to add
* @return {p5.Env} Envelope Returns this envelope
* with scaled output
*/
p5.Env.prototype.add = function (num) {
var add = new Add(num);
var thisChain = this.mathOps.length;
var nextChain = this.output;
return p5.prototype._mathChain(this, add, thisChain, nextChain, Add);
};
/**
* Multiply the p5.Env's output amplitude
* by a fixed value. Calling this method
* again will override the initial mult() with new values.
*
* @method mult
* @param {Number} number Constant number to multiply
* @return {p5.Env} Envelope Returns this envelope
* with scaled output
*/
p5.Env.prototype.mult = function (num) {
var mult = new Mult(num);
var thisChain = this.mathOps.length;
var nextChain = this.output;
return p5.prototype._mathChain(this, mult, thisChain, nextChain, Mult);
};
/**
* Scale this envelope's amplitude values to a given
* range, and return the envelope. Calling this method
* again will override the initial scale() with new values.
*
* @method scale
* @param {Number} inMin input range minumum
* @param {Number} inMax input range maximum
* @param {Number} outMin input range minumum
* @param {Number} outMax input range maximum
* @return {p5.Env} Envelope Returns this envelope
* with scaled output
*/
p5.Env.prototype.scale = function (inMin, inMax, outMin, outMax) {
var scale = new Scale(inMin, inMax, outMin, outMax);
var thisChain = this.mathOps.length;
var nextChain = this.output;
return p5.prototype._mathChain(this, scale, thisChain, nextChain, Scale);
};
// get rid of the oscillator
p5.Env.prototype.dispose = function () {
// remove reference from soundArray
var index = p5sound.soundArray.indexOf(this);
p5sound.soundArray.splice(index, 1);
var now = p5sound.audiocontext.currentTime;
this.disconnect();
try {
this.control.dispose();
this.control = null;
} catch (e) {
}
for (var i = 1; i < this.mathOps.length; i++) {
mathOps[i].dispose();
}
};
}(master, Tone_signal_Add, Tone_signal_Multiply, Tone_signal_Scale, Tone_signal_TimelineSignal, Tone_core_Tone);
var pulse;
pulse = function () {
'use strict';
var p5sound = master;
/**
* Creates a Pulse object, an oscillator that implements
* Pulse Width Modulation.
* The pulse is created with two oscillators.
* Accepts a parameter for frequency, and to set the
* width between the pulses. See <a href="
* http://p5js.org/reference/#/p5.Oscillator">
* <code>p5.Oscillator</code> for a full list of methods.
*
* @class p5.Pulse
* @constructor
* @param {Number} [freq] Frequency in oscillations per second (Hz)
* @param {Number} [w] Width between the pulses (0 to 1.0,
* defaults to 0)
* @example
* <div><code>
* var pulse;
* function setup() {
* background(0);
*
* // Create and start the pulse wave oscillator
* pulse = new p5.Pulse();
* pulse.amp(0.5);
* pulse.freq(220);
* pulse.start();
* }
*
* function draw() {
* var w = map(mouseX, 0, width, 0, 1);
* w = constrain(w, 0, 1);
* pulse.width(w)
* }
* </code></div>
*/
p5.Pulse = function (freq, w) {
p5.Oscillator.call(this, freq, 'sawtooth');
// width of PWM, should be betw 0 to 1.0
this.w = w || 0;
// create a second oscillator with inverse frequency
this.osc2 = new p5.SawOsc(freq);
// create a delay node
this.dNode = p5sound.audiocontext.createDelay();
// dc offset
this.dcOffset = createDCOffset();
this.dcGain = p5sound.audiocontext.createGain();
this.dcOffset.connect(this.dcGain);
this.dcGain.connect(this.output);
// set delay time based on PWM width
this.f = freq || 440;
var mW = this.w / this.oscillator.frequency.value;
this.dNode.delayTime.value = mW;
this.dcGain.gain.value = 1.7 * (0.5 - this.w);
// disconnect osc2 and connect it to delay, which is connected to output
this.osc2.disconnect();
this.osc2.panner.disconnect();
this.osc2.amp(-1);
// inverted amplitude
this.osc2.output.connect(this.dNode);
this.dNode.connect(this.output);
this.output.gain.value = 1;
this.output.connect(this.panner);
};
p5.Pulse.prototype = Object.create(p5.Oscillator.prototype);
/**
* Set the width of a Pulse object (an oscillator that implements
* Pulse Width Modulation).
*
* @method width
* @param {Number} [width] Width between the pulses (0 to 1.0,
* defaults to 0)
*/
p5.Pulse.prototype.width = function (w) {
if (typeof w === 'number') {
if (w <= 1 && w >= 0) {
this.w = w;
// set delay time based on PWM width
// var mW = map(this.w, 0, 1.0, 0, 1/this.f);
var mW = this.w / this.oscillator.frequency.value;
this.dNode.delayTime.value = mW;
}
this.dcGain.gain.value = 1.7 * (0.5 - this.w);
} else {
w.connect(this.dNode.delayTime);
var sig = new p5.SignalAdd(-0.5);
sig.setInput(w);
sig = sig.mult(-1);
sig = sig.mult(1.7);
sig.connect(this.dcGain.gain);
}
};
p5.Pulse.prototype.start = function (f, time) {
var now = p5sound.audiocontext.currentTime;
var t = time || 0;
if (!this.started) {
var freq = f || this.f;
var type = this.oscillator.type;
this.oscillator = p5sound.audiocontext.createOscillator();
this.oscillator.frequency.setValueAtTime(freq, now);
this.oscillator.type = type;
this.oscillator.connect(this.output);
this.oscillator.start(t + now);
// set up osc2
this.osc2.oscillator = p5sound.audiocontext.createOscillator();
this.osc2.oscillator.frequency.setValueAtTime(freq, t + now);
this.osc2.oscillator.type = type;
this.osc2.oscillator.connect(this.osc2.output);
this.osc2.start(t + now);
this.freqNode = [
this.oscillator.frequency,
this.osc2.oscillator.frequency
];
// start dcOffset, too
this.dcOffset = createDCOffset();
this.dcOffset.connect(this.dcGain);
this.dcOffset.start(t + now);
// if LFO connections depend on these oscillators
if (this.mods !== undefined && this.mods.frequency !== undefined) {
this.mods.frequency.connect(this.freqNode[0]);
this.mods.frequency.connect(this.freqNode[1]);
}
this.started = true;
this.osc2.started = true;
}
};
p5.Pulse.prototype.stop = function (time) {
if (this.started) {
var t = time || 0;
var now = p5sound.audiocontext.currentTime;
this.oscillator.stop(t + now);
this.osc2.oscillator.stop(t + now);
this.dcOffset.stop(t + now);
this.started = false;
this.osc2.started = false;
}
};
p5.Pulse.prototype.freq = function (val, rampTime, tFromNow) {
if (typeof val === 'number') {
this.f = val;
var now = p5sound.audiocontext.currentTime;
var rampTime = rampTime || 0;
var tFromNow = tFromNow || 0;
var currentFreq = this.oscillator.frequency.value;
this.oscillator.frequency.cancelScheduledValues(now);
this.oscillator.frequency.setValueAtTime(currentFreq, now + tFromNow);
this.oscillator.frequency.exponentialRampToValueAtTime(val, tFromNow + rampTime + now);
this.osc2.oscillator.frequency.cancelScheduledValues(now);
this.osc2.oscillator.frequency.setValueAtTime(currentFreq, now + tFromNow);
this.osc2.oscillator.frequency.exponentialRampToValueAtTime(val, tFromNow + rampTime + now);
if (this.freqMod) {
this.freqMod.output.disconnect();
this.freqMod = null;
}
} else if (val.output) {
val.output.disconnect();
val.output.connect(this.oscillator.frequency);
val.output.connect(this.osc2.oscillator.frequency);
this.freqMod = val;
}
};
// inspiration: http://webaudiodemos.appspot.com/oscilloscope/
function createDCOffset() {
var ac = p5sound.audiocontext;
var buffer = ac.createBuffer(1, 2048, ac.sampleRate);
var data = buffer.getChannelData(0);
for (var i = 0; i < 2048; i++)
data[i] = 1;
var bufferSource = ac.createBufferSource();
bufferSource.buffer = buffer;
bufferSource.loop = true;
return bufferSource;
}
}(master, oscillator);
var noise;
noise = function () {
'use strict';
var p5sound = master;
/**
* Noise is a type of oscillator that generates a buffer with random values.
*
* @class p5.Noise
* @constructor
* @param {String} type Type of noise can be 'white' (default),
* 'brown' or 'pink'.
* @return {Object} Noise Object
*/
p5.Noise = function (type) {
p5.Oscillator.call(this);
delete this.f;
delete this.freq;
delete this.oscillator;
this.buffer = _whiteNoise;
};
p5.Noise.prototype = Object.create(p5.Oscillator.prototype);
// generate noise buffers
var _whiteNoise = function () {
var bufferSize = 2 * p5sound.audiocontext.sampleRate;
var whiteBuffer = p5sound.audiocontext.createBuffer(1, bufferSize, p5sound.audiocontext.sampleRate);
var noiseData = whiteBuffer.getChannelData(0);
for (var i = 0; i < bufferSize; i++) {
noiseData[i] = Math.random() * 2 - 1;
}
whiteBuffer.type = 'white';
return whiteBuffer;
}();
var _pinkNoise = function () {
var bufferSize = 2 * p5sound.audiocontext.sampleRate;
var pinkBuffer = p5sound.audiocontext.createBuffer(1, bufferSize, p5sound.audiocontext.sampleRate);
var noiseData = pinkBuffer.getChannelData(0);
var b0, b1, b2, b3, b4, b5, b6;
b0 = b1 = b2 = b3 = b4 = b5 = b6 = 0;
for (var i = 0; i < bufferSize; i++) {
var white = Math.random() * 2 - 1;
b0 = 0.99886 * b0 + white * 0.0555179;
b1 = 0.99332 * b1 + white * 0.0750759;
b2 = 0.969 * b2 + white * 0.153852;
b3 = 0.8665 * b3 + white * 0.3104856;
b4 = 0.55 * b4 + white * 0.5329522;
b5 = -0.7616 * b5 - white * 0.016898;
noiseData[i] = b0 + b1 + b2 + b3 + b4 + b5 + b6 + white * 0.5362;
noiseData[i] *= 0.11;
// (roughly) compensate for gain
b6 = white * 0.115926;
}
pinkBuffer.type = 'pink';
return pinkBuffer;
}();
var _brownNoise = function () {
var bufferSize = 2 * p5sound.audiocontext.sampleRate;
var brownBuffer = p5sound.audiocontext.createBuffer(1, bufferSize, p5sound.audiocontext.sampleRate);
var noiseData = brownBuffer.getChannelData(0);
var lastOut = 0;
for (var i = 0; i < bufferSize; i++) {
var white = Math.random() * 2 - 1;
noiseData[i] = (lastOut + 0.02 * white) / 1.02;
lastOut = noiseData[i];
noiseData[i] *= 3.5;
}
brownBuffer.type = 'brown';
return brownBuffer;
}();
/**
* Set type of noise to 'white', 'pink' or 'brown'.
* White is the default.
*
* @method setType
* @param {String} [type] 'white', 'pink' or 'brown'
*/
p5.Noise.prototype.setType = function (type) {
switch (type) {
case 'white':
this.buffer = _whiteNoise;
break;
case 'pink':
this.buffer = _pinkNoise;
break;
case 'brown':
this.buffer = _brownNoise;
break;
default:
this.buffer = _whiteNoise;
}
if (this.started) {
var now = p5sound.audiocontext.currentTime;
this.stop(now);
this.start(now + 0.01);
}
};
p5.Noise.prototype.getType = function () {
return this.buffer.type;
};
/**
* Start the noise
*
* @method start
*/
p5.Noise.prototype.start = function () {
if (this.started) {
this.stop();
}
this.noise = p5sound.audiocontext.createBufferSource();
this.noise.buffer = this.buffer;
this.noise.loop = true;
this.noise.connect(this.output);
var now = p5sound.audiocontext.currentTime;
this.noise.start(now);
this.started = true;
};
/**
* Stop the noise.
*
* @method stop
*/
p5.Noise.prototype.stop = function () {
var now = p5sound.audiocontext.currentTime;
if (this.noise) {
this.noise.stop(now);
this.started = false;
}
};
/**
* Pan the noise.
*
* @method pan
* @param {Number} panning Number between -1 (left)
* and 1 (right)
* @param {Number} timeFromNow schedule this event to happen
* seconds from now
*/
/**
* Set the amplitude of the noise between 0 and 1.0. Or,
* modulate amplitude with an audio signal such as an oscillator.
*
* @param {Number|Object} volume amplitude between 0 and 1.0
* or modulating signal/oscillator
* @param {Number} [rampTime] create a fade that lasts rampTime
* @param {Number} [timeFromNow] schedule this event to happen
* seconds from now
*/
/**
* Send output to a p5.sound or web audio object
*
* @method connect
* @param {Object} unit
*/
/**
* Disconnect all output.
*
* @method disconnect
*/
p5.Noise.prototype.dispose = function () {
var now = p5sound.audiocontext.currentTime;
// remove reference from soundArray
var index = p5sound.soundArray.indexOf(this);
p5sound.soundArray.splice(index, 1);
if (this.noise) {
this.noise.disconnect();
this.stop(now);
}
if (this.output) {
this.output.disconnect();
}
if (this.panner) {
this.panner.disconnect();
}
this.output = null;
this.panner = null;
this.buffer = null;
this.noise = null;
};
}(master);
var audioin;
audioin = function () {
'use strict';
var p5sound = master;
var CustomError = errorHandler;
/**
* <p>Get audio from an input, i.e. your computer's microphone.</p>
*
* <p>Turn the mic on/off with the start() and stop() methods. When the mic
* is on, its volume can be measured with getLevel or by connecting an
* FFT object.</p>
*
* <p>If you want to hear the AudioIn, use the .connect() method.
* AudioIn does not connect to p5.sound output by default to prevent
* feedback.</p>
*
* <p><em>Note: This uses the <a href="http://caniuse.com/stream">getUserMedia/
* Stream</a> API, which is not supported by certain browsers.</em></p>
*
* @class p5.AudioIn
* @constructor
* @return {Object} AudioIn
* @example
* <div><code>
* var mic;
* function setup(){
* mic = new p5.AudioIn()
* mic.start();
* }
* function draw(){
* background(0);
* micLevel = mic.getLevel();
* ellipse(width/2, constrain(height-micLevel*height*5, 0, height), 10, 10);
* }
* </code></div>
*/
p5.AudioIn = function () {
// set up audio input
this.input = p5sound.audiocontext.createGain();
this.output = p5sound.audiocontext.createGain();
this.stream = null;
this.mediaStream = null;
this.currentSource = 0;
/**
* Client must allow browser to access their microphone / audioin source.
* Default: false. Will become true when the client enables acces.
*
* @property {Boolean} enabled
*/
this.enabled = false;
// create an amplitude, connect to it by default but not to master out
this.amplitude = new p5.Amplitude();
this.output.connect(this.amplitude.input);
// Some browsers let developer determine their input sources
if (typeof window.MediaStreamTrack === 'undefined') {
window.alert('This browser does not support MediaStreamTrack');
} else if (typeof window.MediaStreamTrack.getSources === 'function') {
// Chrome supports getSources to list inputs. Dev picks default
window.MediaStreamTrack.getSources(this._gotSources);
} else {
}
// add to soundArray so we can dispose on close
p5sound.soundArray.push(this);
};
/**
* Start processing audio input. This enables the use of other
* AudioIn methods like getLevel(). Note that by default, AudioIn
* is not connected to p5.sound's output. So you won't hear
* anything unless you use the connect() method.<br/>
*
* @method start
* @param {Function} successCallback Name of a function to call on
* success.
* @param {Function} errorCallback Name of a function to call if
* there was an error. For example,
* some browsers do not support
* getUserMedia.
*/
p5.AudioIn.prototype.start = function (successCallback, errorCallback) {
var self = this;
// if _gotSources() i.e. developers determine which source to use
if (p5sound.inputSources[self.currentSource]) {
// set the audio source
var audioSource = p5sound.inputSources[self.currentSource].id;
var constraints = { audio: { optional: [{ sourceId: audioSource }] } };
window.navigator.getUserMedia(constraints, this._onStream = function (stream) {
self.stream = stream;
self.enabled = true;
// Wrap a MediaStreamSourceNode around the live input
self.mediaStream = p5sound.audiocontext.createMediaStreamSource(stream);
self.mediaStream.connect(self.output);
if (successCallback)
successCallback();
// only send to the Amplitude reader, so we can see it but not hear it.
self.amplitude.setInput(self.output);
}, this._onStreamError = function (e) {
if (errorCallback)
errorCallback(e);
else
console.error(e);
});
} else {
// if Firefox where users select their source via browser
// if (typeof MediaStreamTrack.getSources === 'undefined') {
// Only get the audio stream.
window.navigator.getUserMedia({ 'audio': true }, this._onStream = function (stream) {
self.stream = stream;
self.enabled = true;
// Wrap a MediaStreamSourceNode around the live input
self.mediaStream = p5sound.audiocontext.createMediaStreamSource(stream);
self.mediaStream.connect(self.output);
// only send to the Amplitude reader, so we can see it but not hear it.
self.amplitude.setInput(self.output);
if (successCallback)
successCallback();
}, this._onStreamError = function (e) {
if (errorCallback)
errorCallback(e);
else
console.error(e);
});
}
};
/**
* Turn the AudioIn off. If the AudioIn is stopped, it cannot getLevel().<br/>
*
* @method stop
*/
p5.AudioIn.prototype.stop = function () {
if (this.stream) {
this.stream.stop();
}
};
/**
* Connect to an audio unit. If no parameter is provided, will
* connect to the master output (i.e. your speakers).<br/>
*
* @method connect
* @param {Object} [unit] An object that accepts audio input,
* such as an FFT
*/
p5.AudioIn.prototype.connect = function (unit) {
if (unit) {
if (unit.hasOwnProperty('input')) {
this.output.connect(unit.input);
} else if (unit.hasOwnProperty('analyser')) {
this.output.connect(unit.analyser);
} else {
this.output.connect(unit);
}
} else {
this.output.connect(p5sound.input);
}
};
/**
* Disconnect the AudioIn from all audio units. For example, if
* connect() had been called, disconnect() will stop sending
* signal to your speakers.<br/>
*
* @method disconnect
*/
p5.AudioIn.prototype.disconnect = function (unit) {
this.output.disconnect(unit);
// stay connected to amplitude even if not outputting to p5
this.output.connect(this.amplitude.input);
};
/**
* Read the Amplitude (volume level) of an AudioIn. The AudioIn
* class contains its own instance of the Amplitude class to help
* make it easy to get a microphone's volume level. Accepts an
* optional smoothing value (0.0 < 1.0). <em>NOTE: AudioIn must
* .start() before using .getLevel().</em><br/>
*
* @method getLevel
* @param {Number} [smoothing] Smoothing is 0.0 by default.
* Smooths values based on previous values.
* @return {Number} Volume level (between 0.0 and 1.0)
*/
p5.AudioIn.prototype.getLevel = function (smoothing) {
if (smoothing) {
this.amplitude.smoothing = smoothing;
}
return this.amplitude.getLevel();
};
/**
* Add input sources to the list of available sources.
*
* @private
*/
p5.AudioIn.prototype._gotSources = function (sourceInfos) {
for (var i = 0; i < sourceInfos.length; i++) {
var sourceInfo = sourceInfos[i];
if (sourceInfo.kind === 'audio') {
// add the inputs to inputSources
//p5sound.inputSources.push(sourceInfo);
return sourceInfo;
}
}
};
/**
* Set amplitude (volume) of a mic input between 0 and 1.0. <br/>
*
* @method amp
* @param {Number} vol between 0 and 1.0
* @param {Number} [time] ramp time (optional)
*/
p5.AudioIn.prototype.amp = function (vol, t) {
if (t) {
var rampTime = t || 0;
var currentVol = this.output.gain.value;
this.output.gain.cancelScheduledValues(p5sound.audiocontext.currentTime);
this.output.gain.setValueAtTime(currentVol, p5sound.audiocontext.currentTime);
this.output.gain.linearRampToValueAtTime(vol, rampTime + p5sound.audiocontext.currentTime);
} else {
this.output.gain.cancelScheduledValues(p5sound.audiocontext.currentTime);
this.output.gain.setValueAtTime(vol, p5sound.audiocontext.currentTime);
}
};
p5.AudioIn.prototype.listSources = function () {
console.log('listSources is deprecated - please use AudioIn.getSources');
console.log('input sources: ');
if (p5sound.inputSources.length > 0) {
return p5sound.inputSources;
} else {
return 'This browser does not support MediaStreamTrack.getSources()';
}
};
/**
* Chrome only. Returns a list of available input sources
* and allows the user to set the media source. Firefox allows
* the user to choose from input sources in the permissions dialogue
* instead of enumerating available sources and selecting one.
* Note: in order to have descriptive media names your page must be
* served over a secure (HTTPS) connection and the page should
* request user media before enumerating devices. Otherwise device
* ID will be a long device ID number and does not specify device
* type. For example see
* https://simpl.info/getusermedia/sources/index.html vs.
* http://simpl.info/getusermedia/sources/index.html
*
* @method getSources
* @param {Function} callback a callback to handle the sources
* when they have been enumerated
* @example
* <div><code>
* var audiograb;
*
* function setup(){
* //new audioIn
* audioGrab = new p5.AudioIn();
*
* audioGrab.getSources(function(sourceList) {
* //print out the array of available sources
* console.log(sourceList);
* //set the source to the first item in the inputSources array
* audioGrab.setSource(0);
* });
* }
* </code></div>
*/
p5.AudioIn.prototype.getSources = function (callback) {
if (typeof window.MediaStreamTrack.getSources === 'function') {
window.MediaStreamTrack.getSources(function (data) {
for (var i = 0, max = data.length; i < max; i++) {
var sourceInfo = data[i];
if (sourceInfo.kind === 'audio') {
// add the inputs to inputSources
p5sound.inputSources.push(sourceInfo);
}
}
callback(p5sound.inputSources);
});
} else {
console.log('This browser does not support MediaStreamTrack.getSources()');
}
};
/**
* Set the input source. Accepts a number representing a
* position in the array returned by listSources().
* This is only available in browsers that support
* MediaStreamTrack.getSources(). Instead, some browsers
* give users the option to set their own media source.<br/>
*
* @method setSource
* @param {number} num position of input source in the array
*/
p5.AudioIn.prototype.setSource = function (num) {
// TO DO - set input by string or # (array position)
var self = this;
if (p5sound.inputSources.length > 0 && num < p5sound.inputSources.length) {
// set the current source
self.currentSource = num;
console.log('set source to ' + p5sound.inputSources[self.currentSource].id);
} else {
console.log('unable to set input source');
}
};
// private method
p5.AudioIn.prototype.dispose = function () {
// remove reference from soundArray
var index = p5sound.soundArray.indexOf(this);
p5sound.soundArray.splice(index, 1);
this.stop();
if (this.output) {
this.output.disconnect();
}
if (this.amplitude) {
this.amplitude.disconnect();
}
this.amplitude = null;
this.output = null;
};
}(master, errorHandler);
var filter;
filter = function () {
'use strict';
var p5sound = master;
/**
* A p5.Filter uses a Web Audio Biquad Filter to filter
* the frequency response of an input source. Inheriting
* classes include:<br/>
* * <code>p5.LowPass</code> - allows frequencies below
* the cutoff frequency to pass through, and attenuates
* frequencies above the cutoff.<br/>
* * <code>p5.HighPass</code> - the opposite of a lowpass
* filter. <br/>
* * <code>p5.BandPass</code> - allows a range of
* frequencies to pass through and attenuates the frequencies
* below and above this frequency range.<br/>
*
* The <code>.res()</code> method controls either width of the
* bandpass, or resonance of the low/highpass cutoff frequency.
*
* @class p5.Filter
* @constructor
* @param {[String]} type 'lowpass' (default), 'highpass', 'bandpass'
* @return {Object} p5.Filter
* @example
* <div><code>
* var fft, noise, filter;
*
* function setup() {
* fill(255, 40, 255);
*
* filter = new p5.BandPass();
*
* noise = new p5.Noise();
* // disconnect unfiltered noise,
* // and connect to filter
* noise.disconnect();
* noise.connect(filter);
* noise.start();
*
* fft = new p5.FFT();
* }
*
* function draw() {
* background(30);
*
* // set the BandPass frequency based on mouseX
* var freq = map(mouseX, 0, width, 20, 10000);
* filter.freq(freq);
* // give the filter a narrow band (lower res = wider bandpass)
* filter.res(50);
*
* // draw filtered spectrum
* var spectrum = fft.analyze();
* noStroke();
* for (var i = 0; i < spectrum.length; i++) {
* var x = map(i, 0, spectrum.length, 0, width);
* var h = -height + map(spectrum[i], 0, 255, height, 0);
* rect(x, height, width/spectrum.length, h);
* }
*
* isMouseOverCanvas();
* }
*
* function isMouseOverCanvas() {
* var mX = mouseX, mY = mouseY;
* if (mX > 0 && mX < width && mY < height && mY > 0) {
* noise.amp(0.5, 0.2);
* } else {
* noise.amp(0, 0.2);
* }
* }
* </code></div>
*/
p5.Filter = function (type) {
this.ac = p5sound.audiocontext;
this.input = this.ac.createGain();
this.output = this.ac.createGain();
/**
* The p5.Filter is built with a
* <a href="http://www.w3.org/TR/webaudio/#BiquadFilterNode">
* Web Audio BiquadFilter Node</a>.
*
* @property biquadFilter
* @type {Object} Web Audio Delay Node
*/
this.biquad = this.ac.createBiquadFilter();
this.input.connect(this.biquad);
this.biquad.connect(this.output);
this.connect();
if (type) {
this.setType(type);
}
// add to the soundArray
p5sound.soundArray.push(this);
};
/**
* Filter an audio signal according to a set
* of filter parameters.
*
* @method process
* @param {Object} Signal An object that outputs audio
* @param {[Number]} freq Frequency in Hz, from 10 to 22050
* @param {[Number]} res Resonance/Width of the filter frequency
* from 0.001 to 1000
*/
p5.Filter.prototype.process = function (src, freq, res) {
src.connect(this.input);
this.set(freq, res);
};
/**
* Set the frequency and the resonance of the filter.
*
* @method set
* @param {Number} freq Frequency in Hz, from 10 to 22050
* @param {Number} res Resonance (Q) from 0.001 to 1000
* @param {Number} [timeFromNow] schedule this event to happen
* seconds from now
*/
p5.Filter.prototype.set = function (freq, res, time) {
if (freq) {
this.freq(freq, time);
}
if (res) {
this.res(res, time);
}
};
/**
* Set the filter frequency, in Hz, from 10 to 22050 (the range of
* human hearing, although in reality most people hear in a narrower
* range).
*
* @method freq
* @param {Number} freq Filter Frequency
* @param {Number} [timeFromNow] schedule this event to happen
* seconds from now
* @return {Number} value Returns the current frequency value
*/
p5.Filter.prototype.freq = function (freq, time) {
var self = this;
var t = time || 0;
if (freq <= 0) {
freq = 1;
}
if (typeof freq === 'number') {
self.biquad.frequency.value = freq;
self.biquad.frequency.cancelScheduledValues(this.ac.currentTime + 0.01 + t);
self.biquad.frequency.exponentialRampToValueAtTime(freq, this.ac.currentTime + 0.02 + t);
} else if (freq) {
freq.connect(this.biquad.frequency);
}
return self.biquad.frequency.value;
};
/**
* Controls either width of a bandpass frequency,
* or the resonance of a low/highpass cutoff frequency.
*
* @method res
* @param {Number} res Resonance/Width of filter freq
* from 0.001 to 1000
* @param {Number} [timeFromNow] schedule this event to happen
* seconds from now
* @return {Number} value Returns the current res value
*/
p5.Filter.prototype.res = function (res, time) {
var self = this;
var t = time || 0;
if (typeof res == 'number') {
self.biquad.Q.value = res;
self.biquad.Q.cancelScheduledValues(self.ac.currentTime + 0.01 + t);
self.biquad.Q.linearRampToValueAtTime(res, self.ac.currentTime + 0.02 + t);
} else if (res) {
freq.connect(this.biquad.Q);
}
return self.biquad.Q.value;
};
/**
* Set the type of a p5.Filter. Possible types include:
* "lowpass" (default), "highpass", "bandpass",
* "lowshelf", "highshelf", "peaking", "notch",
* "allpass".
*
* @method setType
* @param {String}
*/
p5.Filter.prototype.setType = function (t) {
this.biquad.type = t;
};
/**
* Set the output level of the filter.
*
* @method amp
* @param {Number} volume amplitude between 0 and 1.0
* @param {Number} [rampTime] create a fade that lasts rampTime
* @param {Number} [timeFromNow] schedule this event to happen
* seconds from now
*/
p5.Filter.prototype.amp = function (vol, rampTime, tFromNow) {
var rampTime = rampTime || 0;
var tFromNow = tFromNow || 0;
var now = p5sound.audiocontext.currentTime;
var currentVol = this.output.gain.value;
this.output.gain.cancelScheduledValues(now);
this.output.gain.linearRampToValueAtTime(currentVol, now + tFromNow + 0.001);
this.output.gain.linearRampToValueAtTime(vol, now + tFromNow + rampTime + 0.001);
};
/**
* Send output to a p5.sound or web audio object
*
* @method connect
* @param {Object} unit
*/
p5.Filter.prototype.connect = function (unit) {
var u = unit || p5.soundOut.input;
this.output.connect(u);
};
/**
* Disconnect all output.
*
* @method disconnect
*/
p5.Filter.prototype.disconnect = function () {
this.output.disconnect();
};
p5.Filter.prototype.dispose = function () {
// remove reference from soundArray
var index = p5sound.soundArray.indexOf(this);
p5sound.soundArray.splice(index, 1);
this.input.disconnect();
this.input = undefined;
this.output.disconnect();
this.output = undefined;
this.biquad.disconnect();
this.biquad = undefined;
};
/**
* Constructor: <code>new p5.LowPass()</code> Filter.
* This is the same as creating a p5.Filter and then calling
* its method <code>setType('lowpass')</code>.
* See p5.Filter for methods.
*
* @method p5.LowPass
*/
p5.LowPass = function () {
p5.Filter.call(this, 'lowpass');
};
p5.LowPass.prototype = Object.create(p5.Filter.prototype);
/**
* Constructor: <code>new p5.HighPass()</code> Filter.
* This is the same as creating a p5.Filter and then calling
* its method <code>setType('highpass')</code>.
* See p5.Filter for methods.
*
* @method p5.HighPass
*/
p5.HighPass = function () {
p5.Filter.call(this, 'highpass');
};
p5.HighPass.prototype = Object.create(p5.Filter.prototype);
/**
* Constructor: <code>new p5.BandPass()</code> Filter.
* This is the same as creating a p5.Filter and then calling
* its method <code>setType('bandpass')</code>.
* See p5.Filter for methods.
*
* @method p5.BandPass
*/
p5.BandPass = function () {
p5.Filter.call(this, 'bandpass');
};
p5.BandPass.prototype = Object.create(p5.Filter.prototype);
}(master);
var delay;
delay = function () {
'use strict';
var p5sound = master;
var Filter = filter;
/**
* Delay is an echo effect. It processes an existing sound source,
* and outputs a delayed version of that sound. The p5.Delay can
* produce different effects depending on the delayTime, feedback,
* filter, and type. In the example below, a feedback of 0.5 will
* produce a looping delay that decreases in volume by
* 50% each repeat. A filter will cut out the high frequencies so
* that the delay does not sound as piercing as the original source.
*
* @class p5.Delay
* @constructor
* @return {Object} Returns a p5.Delay object
* @example
* <div><code>
* var noise, env, delay;
*
* function setup() {
* background(0);
* noStroke();
* fill(255);
* textAlign(CENTER);
* text('click to play', width/2, height/2);
*
* noise = new p5.Noise('brown');
* noise.amp(0);
* noise.start();
*
* delay = new p5.Delay();
*
* // delay.process() accepts 4 parameters:
* // source, delayTime, feedback, filter frequency
* // play with these numbers!!
* delay.process(noise, .12, .7, 2300);
*
* // play the noise with an envelope,
* // a series of fades ( time / value pairs )
* env = new p5.Env(.01, 0.2, .2, .1);
* }
*
* // mouseClick triggers envelope
* function mouseClicked() {
* // is mouse over canvas?
* if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
* env.play(noise);
* }
* }
* </code></div>
*/
p5.Delay = function () {
this.ac = p5sound.audiocontext;
this.input = this.ac.createGain();
this.output = this.ac.createGain();
this._split = this.ac.createChannelSplitter(2);
this._merge = this.ac.createChannelMerger(2);
this._leftGain = this.ac.createGain();
this._rightGain = this.ac.createGain();
/**
* The p5.Delay is built with two
* <a href="http://www.w3.org/TR/webaudio/#DelayNode">
* Web Audio Delay Nodes</a>, one for each stereo channel.
*
* @property leftDelay
* @type {Object} Web Audio Delay Node
*/
this.leftDelay = this.ac.createDelay();
/**
* The p5.Delay is built with two
* <a href="http://www.w3.org/TR/webaudio/#DelayNode">
* Web Audio Delay Nodes</a>, one for each stereo channel.
*
* @property rightDelay
* @type {Object} Web Audio Delay Node
*/
this.rightDelay = this.ac.createDelay();
this._leftFilter = new p5.Filter();
this._rightFilter = new p5.Filter();
this._leftFilter.disconnect();
this._rightFilter.disconnect();
this._leftFilter.biquad.frequency.setValueAtTime(1200, this.ac.currentTime);
this._rightFilter.biquad.frequency.setValueAtTime(1200, this.ac.currentTime);
this._leftFilter.biquad.Q.setValueAtTime(0.3, this.ac.currentTime);
this._rightFilter.biquad.Q.setValueAtTime(0.3, this.ac.currentTime);
// graph routing
this.input.connect(this._split);
this.leftDelay.connect(this._leftGain);
this.rightDelay.connect(this._rightGain);
this._leftGain.connect(this._leftFilter.input);
this._rightGain.connect(this._rightFilter.input);
this._merge.connect(this.output);
this.output.connect(p5.soundOut.input);
this._leftFilter.biquad.gain.setValueAtTime(1, this.ac.currentTime);
this._rightFilter.biquad.gain.setValueAtTime(1, this.ac.currentTime);
// default routing
this.setType(0);
this._maxDelay = this.leftDelay.delayTime.maxValue;
// add this p5.SoundFile to the soundArray
p5sound.soundArray.push(this);
};
/**
* Add delay to an audio signal according to a set
* of delay parameters.
*
* @method process
* @param {Object} Signal An object that outputs audio
* @param {Number} [delayTime] Time (in seconds) of the delay/echo.
* Some browsers limit delayTime to
* 1 second.
* @param {Number} [feedback] sends the delay back through itself
* in a loop that decreases in volume
* each time.
* @param {Number} [lowPass] Cutoff frequency. Only frequencies
* below the lowPass will be part of the
* delay.
*/
p5.Delay.prototype.process = function (src, _delayTime, _feedback, _filter) {
var feedback = _feedback || 0;
var delayTime = _delayTime || 0;
if (feedback >= 1) {
throw new Error('Feedback value will force a positive feedback loop.');
}
if (delayTime >= this._maxDelay) {
throw new Error('Delay Time exceeds maximum delay time of ' + this._maxDelay + ' second.');
}
src.connect(this.input);
this.leftDelay.delayTime.setValueAtTime(delayTime, this.ac.currentTime);
this.rightDelay.delayTime.setValueAtTime(delayTime, this.ac.currentTime);
this._leftGain.gain.setValueAtTime(feedback, this.ac.currentTime);
this._rightGain.gain.setValueAtTime(feedback, this.ac.currentTime);
if (_filter) {
this._leftFilter.freq(_filter);
this._rightFilter.freq(_filter);
}
};
/**
* Set the delay (echo) time, in seconds. Usually this value will be
* a floating point number between 0.0 and 1.0.
*
* @method delayTime
* @param {Number} delayTime Time (in seconds) of the delay
*/
p5.Delay.prototype.delayTime = function (t) {
// if t is an audio node...
if (typeof t !== 'number') {
t.connect(this.leftDelay.delayTime);
t.connect(this.rightDelay.delayTime);
} else {
this.leftDelay.delayTime.cancelScheduledValues(this.ac.currentTime);
this.rightDelay.delayTime.cancelScheduledValues(this.ac.currentTime);
this.leftDelay.delayTime.linearRampToValueAtTime(t, this.ac.currentTime);
this.rightDelay.delayTime.linearRampToValueAtTime(t, this.ac.currentTime);
}
};
/**
* Feedback occurs when Delay sends its signal back through its input
* in a loop. The feedback amount determines how much signal to send each
* time through the loop. A feedback greater than 1.0 is not desirable because
* it will increase the overall output each time through the loop,
* creating an infinite feedback loop.
*
* @method feedback
* @param {Number|Object} feedback 0.0 to 1.0, or an object such as an
* Oscillator that can be used to
* modulate this param
*/
p5.Delay.prototype.feedback = function (f) {
// if f is an audio node...
if (typeof f !== 'number') {
f.connect(this._leftGain.gain);
f.connect(this._rightGain.gain);
} else if (f >= 1) {
throw new Error('Feedback value will force a positive feedback loop.');
} else {
this._leftGain.gain.exponentialRampToValueAtTime(f, this.ac.currentTime);
this._rightGain.gain.exponentialRampToValueAtTime(f, this.ac.currentTime);
}
};
/**
* Set a lowpass filter frequency for the delay. A lowpass filter
* will cut off any frequencies higher than the filter frequency.
*
* @method filter
* @param {Number|Object} cutoffFreq A lowpass filter will cut off any
* frequencies higher than the filter frequency.
* @param {Number|Object} res Resonance of the filter frequency
* cutoff, or an object (i.e. a p5.Oscillator)
* that can be used to modulate this parameter.
* High numbers (i.e. 15) will produce a resonance,
* low numbers (i.e. .2) will produce a slope.
*/
p5.Delay.prototype.filter = function (freq, q) {
this._leftFilter.set(freq, q);
this._rightFilter.set(freq, q);
};
/**
* Choose a preset type of delay. 'pingPong' bounces the signal
* from the left to the right channel to produce a stereo effect.
* Any other parameter will revert to the default delay setting.
*
* @method setType
* @param {String|Number} type 'pingPong' (1) or 'default' (0)
*/
p5.Delay.prototype.setType = function (t) {
if (t === 1) {
t = 'pingPong';
}
this._split.disconnect();
this._leftFilter.disconnect();
this._rightFilter.disconnect();
this._split.connect(this.leftDelay, 0);
this._split.connect(this.rightDelay, 1);
switch (t) {
case 'pingPong':
this._rightFilter.setType(this._leftFilter.biquad.type);
this._leftFilter.output.connect(this._merge, 0, 0);
this._rightFilter.output.connect(this._merge, 0, 1);
this._leftFilter.output.connect(this.rightDelay);
this._rightFilter.output.connect(this.leftDelay);
break;
default:
this._leftFilter.output.connect(this._merge, 0, 0);
this._leftFilter.output.connect(this._merge, 0, 1);
this._leftFilter.output.connect(this.leftDelay);
this._leftFilter.output.connect(this.rightDelay);
}
};
/**
* Set the output level of the delay effect.
*
* @method amp
* @param {Number} volume amplitude between 0 and 1.0
* @param {Number} [rampTime] create a fade that lasts rampTime
* @param {Number} [timeFromNow] schedule this event to happen
* seconds from now
*/
p5.Delay.prototype.amp = function (vol, rampTime, tFromNow) {
var rampTime = rampTime || 0;
var tFromNow = tFromNow || 0;
var now = p5sound.audiocontext.currentTime;
var currentVol = this.output.gain.value;
this.output.gain.cancelScheduledValues(now);
this.output.gain.linearRampToValueAtTime(currentVol, now + tFromNow + 0.001);
this.output.gain.linearRampToValueAtTime(vol, now + tFromNow + rampTime + 0.001);
};
/**
* Send output to a p5.sound or web audio object
*
* @method connect
* @param {Object} unit
*/
p5.Delay.prototype.connect = function (unit) {
var u = unit || p5.soundOut.input;
this.output.connect(u);
};
/**
* Disconnect all output.
*
* @method disconnect
*/
p5.Delay.prototype.disconnect = function () {
this.output.disconnect();
};
p5.Delay.prototype.dispose = function () {
// remove reference from soundArray
var index = p5sound.soundArray.indexOf(this);
p5sound.soundArray.splice(index, 1);
this.input.disconnect();
this.output.disconnect();
this._split.disconnect();
this._leftFilter.disconnect();
this._rightFilter.disconnect();
this._merge.disconnect();
this._leftGain.disconnect();
this._rightGain.disconnect();
this.leftDelay.disconnect();
this.rightDelay.disconnect();
this.input = undefined;
this.output = undefined;
this._split = undefined;
this._leftFilter = undefined;
this._rightFilter = undefined;
this._merge = undefined;
this._leftGain = undefined;
this._rightGain = undefined;
this.leftDelay = undefined;
this.rightDelay = undefined;
};
}(master, filter);
var reverb;
reverb = function () {
'use strict';
var p5sound = master;
var CustomError = errorHandler;
/**
* Reverb adds depth to a sound through a large number of decaying
* echoes. It creates the perception that sound is occurring in a
* physical space. The p5.Reverb has paramters for Time (how long does the
* reverb last) and decayRate (how much the sound decays with each echo)
* that can be set with the .set() or .process() methods. The p5.Convolver
* extends p5.Reverb allowing you to recreate the sound of actual physical
* spaces through convolution.
*
* @class p5.Reverb
* @constructor
* @example
* <div><code>
* var soundFile, reverb;
* function preload() {
* soundFile = loadSound('assets/Damscray_DancingTiger.mp3');
* }
*
* function setup() {
* reverb = new p5.Reverb();
* soundFile.disconnect(); // so we'll only hear reverb...
*
* // connect soundFile to reverb, process w/
* // 3 second reverbTime, decayRate of 2%
* reverb.process(soundFile, 3, 2);
* soundFile.play();
* }
* </code></div>
*/
p5.Reverb = function () {
this.ac = p5sound.audiocontext;
this.convolverNode = this.ac.createConvolver();
this.input = this.ac.createGain();
this.output = this.ac.createGain();
// otherwise, Safari distorts
this.input.gain.value = 0.5;
this.input.connect(this.convolverNode);
this.convolverNode.connect(this.output);
// default params
this._seconds = 3;
this._decay = 2;
this._reverse = false;
this._buildImpulse();
this.connect();
p5sound.soundArray.push(this);
};
/**
* Connect a source to the reverb, and assign reverb parameters.
*
* @method process
* @param {Object} src p5.sound / Web Audio object with a sound
* output.
* @param {Number} [seconds] Duration of the reverb, in seconds.
* Min: 0, Max: 10. Defaults to 3.
* @param {Number} [decayRate] Percentage of decay with each echo.
* Min: 0, Max: 100. Defaults to 2.
* @param {Boolean} [reverse] Play the reverb backwards or forwards.
*/
p5.Reverb.prototype.process = function (src, seconds, decayRate, reverse) {
src.connect(this.input);
var rebuild = false;
if (seconds) {
this._seconds = seconds;
rebuild = true;
}
if (decayRate) {
this._decay = decayRate;
}
if (reverse) {
this._reverse = reverse;
}
if (rebuild) {
this._buildImpulse();
}
};
/**
* Set the reverb settings. Similar to .process(), but without
* assigning a new input.
*
* @method set
* @param {Number} [seconds] Duration of the reverb, in seconds.
* Min: 0, Max: 10. Defaults to 3.
* @param {Number} [decayRate] Percentage of decay with each echo.
* Min: 0, Max: 100. Defaults to 2.
* @param {Boolean} [reverse] Play the reverb backwards or forwards.
*/
p5.Reverb.prototype.set = function (seconds, decayRate, reverse) {
var rebuild = false;
if (seconds) {
this._seconds = seconds;
rebuild = true;
}
if (decayRate) {
this._decay = decayRate;
}
if (reverse) {
this._reverse = reverse;
}
if (rebuild) {
this._buildImpulse();
}
};
/**
* Set the output level of the delay effect.
*
* @method amp
* @param {Number} volume amplitude between 0 and 1.0
* @param {Number} [rampTime] create a fade that lasts rampTime
* @param {Number} [timeFromNow] schedule this event to happen
* seconds from now
*/
p5.Reverb.prototype.amp = function (vol, rampTime, tFromNow) {
var rampTime = rampTime || 0;
var tFromNow = tFromNow || 0;
var now = p5sound.audiocontext.currentTime;
var currentVol = this.output.gain.value;
this.output.gain.cancelScheduledValues(now);
this.output.gain.linearRampToValueAtTime(currentVol, now + tFromNow + 0.001);
this.output.gain.linearRampToValueAtTime(vol, now + tFromNow + rampTime + 0.001);
};
/**
* Send output to a p5.sound or web audio object
*
* @method connect
* @param {Object} unit
*/
p5.Reverb.prototype.connect = function (unit) {
var u = unit || p5.soundOut.input;
this.output.connect(u.input ? u.input : u);
};
/**
* Disconnect all output.
*
* @method disconnect
*/
p5.Reverb.prototype.disconnect = function () {
this.output.disconnect();
};
/**
* Inspired by Simple Reverb by Jordan Santell
* https://github.com/web-audio-components/simple-reverb/blob/master/index.js
*
* Utility function for building an impulse response
* based on the module parameters.
*
* @private
*/
p5.Reverb.prototype._buildImpulse = function () {
var rate = this.ac.sampleRate;
var length = rate * this._seconds;
var decay = this._decay;
var impulse = this.ac.createBuffer(2, length, rate);
var impulseL = impulse.getChannelData(0);
var impulseR = impulse.getChannelData(1);
var n, i;
for (i = 0; i < length; i++) {
n = this.reverse ? length - i : i;
impulseL[i] = (Math.random() * 2 - 1) * Math.pow(1 - n / length, decay);
impulseR[i] = (Math.random() * 2 - 1) * Math.pow(1 - n / length, decay);
}
this.convolverNode.buffer = impulse;
};
p5.Reverb.prototype.dispose = function () {
// remove reference from soundArray
var index = p5sound.soundArray.indexOf(this);
p5sound.soundArray.splice(index, 1);
if (this.convolverNode) {
this.convolverNode.buffer = null;
this.convolverNode = null;
}
if (typeof this.output !== 'undefined') {
this.output.disconnect();
this.output = null;
}
if (typeof this.panner !== 'undefined') {
this.panner.disconnect();
this.panner = null;
}
};
// =======================================================================
// *** p5.Convolver ***
// =======================================================================
/**
* <p>p5.Convolver extends p5.Reverb. It can emulate the sound of real
* physical spaces through a process called <a href="
* https://en.wikipedia.org/wiki/Convolution_reverb#Real_space_simulation">
* convolution</a>.</p>
*
* <p>Convolution multiplies any audio input by an "impulse response"
* to simulate the dispersion of sound over time. The impulse response is
* generated from an audio file that you provide. One way to
* generate an impulse response is to pop a balloon in a reverberant space
* and record the echo. Convolution can also be used to experiment with
* sound.</p>
*
* <p>Use the method <code>createConvolution(path)</code> to instantiate a
* p5.Convolver with a path to your impulse response audio file.</p>
*
* @class p5.Convolver
* @constructor
* @param {String} path path to a sound file
* @param {Function} [callback] function to call when loading succeeds
* @param {Function} [errorCallback] function to call if loading fails.
* This function will receive an error or
* XMLHttpRequest object with information
* about what went wrong.
* @example
* <div><code>
* var cVerb, sound;
* function preload() {
* // We have both MP3 and OGG versions of all sound assets
* soundFormats('ogg', 'mp3');
*
* // Try replacing 'bx-spring' with other soundfiles like
* // 'concrete-tunnel' 'small-plate' 'drum' 'beatbox'
* cVerb = createConvolver('assets/bx-spring.mp3');
*
* // Try replacing 'Damscray_DancingTiger' with
* // 'beat', 'doorbell', lucky_dragons_-_power_melody'
* sound = loadSound('assets/Damscray_DancingTiger.mp3');
* }
*
* function setup() {
* // disconnect from master output...
* sound.disconnect();
*
* // ...and process with cVerb
* // so that we only hear the convolution
* cVerb.process(sound);
*
* sound.play();
* }
* </code></div>
*/
p5.Convolver = function (path, callback, errorCallback) {
this.ac = p5sound.audiocontext;
/**
* Internally, the p5.Convolver uses the a
* <a href="http://www.w3.org/TR/webaudio/#ConvolverNode">
* Web Audio Convolver Node</a>.
*
* @property convolverNode
* @type {Object} Web Audio Convolver Node
*/
this.convolverNode = this.ac.createConvolver();
this.input = this.ac.createGain();
this.output = this.ac.createGain();
// otherwise, Safari distorts
this.input.gain.value = 0.5;
this.input.connect(this.convolverNode);
this.convolverNode.connect(this.output);
if (path) {
this.impulses = [];
this._loadBuffer(path, callback, errorCallback);
} else {
// parameters
this._seconds = 3;
this._decay = 2;
this._reverse = false;
this._buildImpulse();
}
this.connect();
p5sound.soundArray.push(this);
};
p5.Convolver.prototype = Object.create(p5.Reverb.prototype);
p5.prototype.registerPreloadMethod('createConvolver', p5.prototype);
/**
* Create a p5.Convolver. Accepts a path to a soundfile
* that will be used to generate an impulse response.
*
* @method createConvolver
* @param {String} path path to a sound file
* @param {Function} [callback] function to call if loading is successful.
* The object will be passed in as the argument
* to the callback function.
* @param {Function} [errorCallback] function to call if loading is not successful.
* A custom error will be passed in as the argument
* to the callback function.
* @return {p5.Convolver}
* @example
* <div><code>
* var cVerb, sound;
* function preload() {
* // We have both MP3 and OGG versions of all sound assets
* soundFormats('ogg', 'mp3');
*
* // Try replacing 'bx-spring' with other soundfiles like
* // 'concrete-tunnel' 'small-plate' 'drum' 'beatbox'
* cVerb = createConvolver('assets/bx-spring.mp3');
*
* // Try replacing 'Damscray_DancingTiger' with
* // 'beat', 'doorbell', lucky_dragons_-_power_melody'
* sound = loadSound('assets/Damscray_DancingTiger.mp3');
* }
*
* function setup() {
* // disconnect from master output...
* sound.disconnect();
*
* // ...and process with cVerb
* // so that we only hear the convolution
* cVerb.process(sound);
*
* sound.play();
* }
* </code></div>
*/
p5.prototype.createConvolver = function (path, callback, errorCallback) {
// if loading locally without a server
if (window.location.origin.indexOf('file://') > -1 && window.cordova === 'undefined') {
alert('This sketch may require a server to load external files. Please see http://bit.ly/1qcInwS');
}
var cReverb = new p5.Convolver(path, callback, errorCallback);
cReverb.impulses = [];
return cReverb;
};
/**
* Private method to load a buffer as an Impulse Response,
* assign it to the convolverNode, and add to the Array of .impulses.
*
* @param {String} path
* @param {Function} callback
* @param {Function} errorCallback
* @private
*/
p5.Convolver.prototype._loadBuffer = function (path, callback, errorCallback) {
var path = p5.prototype._checkFileFormats(path);
var self = this;
var errorTrace = new Error().stack;
var ac = p5.prototype.getAudioContext();
var request = new XMLHttpRequest();
request.open('GET', path, true);
request.responseType = 'arraybuffer';
request.onload = function () {
if (request.status == 200) {
// on success loading file:
ac.decodeAudioData(request.response, function (buff) {
var buffer = {};
var chunks = path.split('/');
buffer.name = chunks[chunks.length - 1];
buffer.audioBuffer = buff;
self.impulses.push(buffer);
self.convolverNode.buffer = buffer.audioBuffer;
if (callback) {
callback(buffer);
}
}, // error decoding buffer. "e" is undefined in Chrome 11/22/2015
function (e) {
var err = new CustomError('decodeAudioData', errorTrace, self.url);
var msg = 'AudioContext error at decodeAudioData for ' + self.url;
if (errorCallback) {
err.msg = msg;
errorCallback(err);
} else {
console.error(msg + '\n The error stack trace includes: \n' + err.stack);
}
});
} else {
var err = new CustomError('loadConvolver', errorTrace, self.url);
var msg = 'Unable to load ' + self.url + '. The request status was: ' + request.status + ' (' + request.statusText + ')';
if (errorCallback) {
err.message = msg;
errorCallback(err);
} else {
console.error(msg + '\n The error stack trace includes: \n' + err.stack);
}
}
};
// if there is another error, aside from 404...
request.onerror = function (e) {
var err = new CustomError('loadConvolver', errorTrace, self.url);
var msg = 'There was no response from the server at ' + self.url + '. Check the url and internet connectivity.';
if (errorCallback) {
err.message = msg;
errorCallback(err);
} else {
console.error(msg + '\n The error stack trace includes: \n' + err.stack);
}
};
request.send();
};
p5.Convolver.prototype.set = null;
/**
* Connect a source to the reverb, and assign reverb parameters.
*
* @method process
* @param {Object} src p5.sound / Web Audio object with a sound
* output.
* @example
* <div><code>
* var cVerb, sound;
* function preload() {
* soundFormats('ogg', 'mp3');
*
* cVerb = createConvolver('assets/concrete-tunnel.mp3');
*
* sound = loadSound('assets/beat.mp3');
* }
*
* function setup() {
* // disconnect from master output...
* sound.disconnect();
*
* // ...and process with (i.e. connect to) cVerb
* // so that we only hear the convolution
* cVerb.process(sound);
*
* sound.play();
* }
* </code></div>
*/
p5.Convolver.prototype.process = function (src) {
src.connect(this.input);
};
/**
* If you load multiple impulse files using the .addImpulse method,
* they will be stored as Objects in this Array. Toggle between them
* with the <code>toggleImpulse(id)</code> method.
*
* @property impulses
* @type {Array} Array of Web Audio Buffers
*/
p5.Convolver.prototype.impulses = [];
/**
* Load and assign a new Impulse Response to the p5.Convolver.
* The impulse is added to the <code>.impulses</code> array. Previous
* impulses can be accessed with the <code>.toggleImpulse(id)</code>
* method.
*
* @method addImpulse
* @param {String} path path to a sound file
* @param {Function} callback function (optional)
* @param {Function} errorCallback function (optional)
*/
p5.Convolver.prototype.addImpulse = function (path, callback, errorCallback) {
// if loading locally without a server
if (window.location.origin.indexOf('file://') > -1 && window.cordova === 'undefined') {
alert('This sketch may require a server to load external files. Please see http://bit.ly/1qcInwS');
}
this._loadBuffer(path, callback, errorCallback);
};
/**
* Similar to .addImpulse, except that the <code>.impulses</code>
* Array is reset to save memory. A new <code>.impulses</code>
* array is created with this impulse as the only item.
*
* @method resetImpulse
* @param {String} path path to a sound file
* @param {Function} callback function (optional)
* @param {Function} errorCallback function (optional)
*/
p5.Convolver.prototype.resetImpulse = function (path, callback, errorCallback) {
// if loading locally without a server
if (window.location.origin.indexOf('file://') > -1 && window.cordova === 'undefined') {
alert('This sketch may require a server to load external files. Please see http://bit.ly/1qcInwS');
}
this.impulses = [];
this._loadBuffer(path, callback, errorCallback);
};
/**
* If you have used <code>.addImpulse()</code> to add multiple impulses
* to a p5.Convolver, then you can use this method to toggle between
* the items in the <code>.impulses</code> Array. Accepts a parameter
* to identify which impulse you wish to use, identified either by its
* original filename (String) or by its position in the <code>.impulses
* </code> Array (Number).<br/>
* You can access the objects in the .impulses Array directly. Each
* Object has two attributes: an <code>.audioBuffer</code> (type:
* Web Audio <a href="
* http://webaudio.github.io/web-audio-api/#the-audiobuffer-interface">
* AudioBuffer)</a> and a <code>.name</code>, a String that corresponds
* with the original filename.
*
* @method toggleImpulse
* @param {String|Number} id Identify the impulse by its original filename
* (String), or by its position in the
* <code>.impulses</code> Array (Number).
*/
p5.Convolver.prototype.toggleImpulse = function (id) {
if (typeof id === 'number' && id < this.impulses.length) {
this.convolverNode.buffer = this.impulses[id].audioBuffer;
}
if (typeof id === 'string') {
for (var i = 0; i < this.impulses.length; i++) {
if (this.impulses[i].name === id) {
this.convolverNode.buffer = this.impulses[i].audioBuffer;
break;
}
}
}
};
p5.Convolver.prototype.dispose = function () {
// remove all the Impulse Response buffers
for (var i in this.impulses) {
this.impulses[i] = null;
}
this.convolverNode.disconnect();
this.concolverNode = null;
if (typeof this.output !== 'undefined') {
this.output.disconnect();
this.output = null;
}
if (typeof this.panner !== 'undefined') {
this.panner.disconnect();
this.panner = null;
}
};
}(master, errorHandler, sndcore);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_core_TimelineState;
Tone_core_TimelineState = function (Tone) {
'use strict';
Tone.TimelineState = function (initial) {
Tone.Timeline.call(this);
this._initial = initial;
};
Tone.extend(Tone.TimelineState, Tone.Timeline);
Tone.TimelineState.prototype.getStateAtTime = function (time) {
var event = this.getEvent(time);
if (event !== null) {
return event.state;
} else {
return this._initial;
}
};
Tone.TimelineState.prototype.setStateAtTime = function (state, time) {
this.addEvent({
'state': state,
'time': this.toSeconds(time)
});
};
return Tone.TimelineState;
}(Tone_core_Tone, Tone_core_Timeline);
/** Tone.js module by Yotam Mann, MIT License 2016 http://opensource.org/licenses/MIT **/
var Tone_core_Clock;
Tone_core_Clock = function (Tone) {
'use strict';
Tone.Clock = function () {
var options = this.optionsObject(arguments, [
'callback',
'frequency'
], Tone.Clock.defaults);
this.callback = options.callback;
this._lookAhead = 'auto';
this._computedLookAhead = 1 / 60;
this._threshold = 0.5;
this._nextTick = -1;
this._lastUpdate = 0;
this._loopID = -1;
this.frequency = new Tone.TimelineSignal(options.frequency, Tone.Type.Frequency);
this.ticks = 0;
this._state = new Tone.TimelineState(Tone.State.Stopped);
this._boundLoop = this._loop.bind(this);
this._readOnly('frequency');
this._loop();
};
Tone.extend(Tone.Clock);
Tone.Clock.defaults = {
'callback': Tone.noOp,
'frequency': 1,
'lookAhead': 'auto'
};
Object.defineProperty(Tone.Clock.prototype, 'state', {
get: function () {
return this._state.getStateAtTime(this.now());
}
});
Object.defineProperty(Tone.Clock.prototype, 'lookAhead', {
get: function () {
return this._lookAhead;
},
set: function (val) {
if (val === 'auto') {
this._lookAhead = 'auto';
} else {
this._lookAhead = this.toSeconds(val);
}
}
});
Tone.Clock.prototype.start = function (time, offset) {
time = this.toSeconds(time);
if (this._state.getStateAtTime(time) !== Tone.State.Started) {
this._state.addEvent({
'state': Tone.State.Started,
'time': time,
'offset': offset
});
}
return this;
};
Tone.Clock.prototype.stop = function (time) {
time = this.toSeconds(time);
if (this._state.getStateAtTime(time) !== Tone.State.Stopped) {
this._state.setStateAtTime(Tone.State.Stopped, time);
}
return this;
};
Tone.Clock.prototype.pause = function (time) {
time = this.toSeconds(time);
if (this._state.getStateAtTime(time) === Tone.State.Started) {
this._state.setStateAtTime(Tone.State.Paused, time);
}
return this;
};
Tone.Clock.prototype._loop = function (time) {
this._loopID = requestAnimationFrame(this._boundLoop);
if (this._lookAhead === 'auto') {
if (!this.isUndef(time)) {
var diff = (time - this._lastUpdate) / 1000;
this._lastUpdate = time;
if (diff < this._threshold) {
this._computedLookAhead = (9 * this._computedLookAhead + diff) / 10;
}
}
} else {
this._computedLookAhead = this._lookAhead;
}
var now = this.now();
var lookAhead = this._computedLookAhead * 2;
var event = this._state.getEvent(now + lookAhead);
var state = Tone.State.Stopped;
if (event) {
state = event.state;
if (this._nextTick === -1 && state === Tone.State.Started) {
this._nextTick = event.time;
if (!this.isUndef(event.offset)) {
this.ticks = event.offset;
}
}
}
if (state === Tone.State.Started) {
while (now + lookAhead > this._nextTick) {
if (now > this._nextTick + this._threshold) {
this._nextTick = now;
}
var tickTime = this._nextTick;
this._nextTick += 1 / this.frequency.getValueAtTime(this._nextTick);
this.callback(tickTime);
this.ticks++;
}
} else if (state === Tone.State.Stopped) {
this._nextTick = -1;
this.ticks = 0;
}
};
Tone.Clock.prototype.getStateAtTime = function (time) {
return this._state.getStateAtTime(time);
};
Tone.Clock.prototype.dispose = function () {
cancelAnimationFrame(this._loopID);
Tone.TimelineState.prototype.dispose.call(this);
this._writable('frequency');
this.frequency.dispose();
this.frequency = null;
this._boundLoop = Tone.noOp;
this._nextTick = Infinity;
this.callback = null;
this._state.dispose();
this._state = null;
};
return Tone.Clock;
}(Tone_core_Tone, Tone_signal_TimelineSignal);
var metro;
metro = function () {
'use strict';
var p5sound = master;
// requires the Tone.js library's Clock (MIT license, Yotam Mann)
// https://github.com/TONEnoTONE/Tone.js/
var Clock = Tone_core_Clock;
var ac = p5sound.audiocontext;
// var upTick = false;
p5.Metro = function () {
this.clock = new Clock({ 'callback': this.ontick.bind(this) });
this.syncedParts = [];
this.bpm = 120;
// gets overridden by p5.Part
this._init();
this.tickCallback = function () {
};
};
var prevTick = 0;
var tatumTime = 0;
p5.Metro.prototype.ontick = function (tickTime) {
var elapsedTime = tickTime - prevTick;
var secondsFromNow = tickTime - p5sound.audiocontext.currentTime;
if (elapsedTime - tatumTime <= -0.02) {
return;
} else {
prevTick = tickTime;
// for all of the active things on the metro:
for (var i in this.syncedParts) {
var thisPart = this.syncedParts[i];
thisPart.incrementStep(secondsFromNow);
// each synced source keeps track of its own beat number
for (var j in thisPart.phrases) {
var thisPhrase = thisPart.phrases[j];
var phraseArray = thisPhrase.sequence;
var bNum = this.metroTicks % phraseArray.length;
if (phraseArray[bNum] !== 0 && (this.metroTicks < phraseArray.length || !thisPhrase.looping)) {
thisPhrase.callback(secondsFromNow, phraseArray[bNum]);
}
}
}
this.metroTicks += 1;
this.tickCallback(secondsFromNow);
}
};
p5.Metro.prototype.setBPM = function (bpm, rampTime) {
var beatTime = 60 / (bpm * this.tatums);
var now = p5sound.audiocontext.currentTime;
tatumTime = beatTime;
var rampTime = rampTime || 0;
this.clock.frequency.setValueAtTime(this.clock.frequency.value, now);
this.clock.frequency.linearRampToValueAtTime(bpm, now + rampTime);
this.bpm = bpm;
};
p5.Metro.prototype.getBPM = function (tempo) {
return this.clock.getRate() / this.tatums * 60;
};
p5.Metro.prototype._init = function () {
this.metroTicks = 0;
};
// clear existing synced parts, add only this one
p5.Metro.prototype.resetSync = function (part) {
this.syncedParts = [part];
};
// push a new synced part to the array
p5.Metro.prototype.pushSync = function (part) {
this.syncedParts.push(part);
};
p5.Metro.prototype.start = function (timeFromNow) {
var t = timeFromNow || 0;
var now = p5sound.audiocontext.currentTime;
this.clock.start(now + t);
this.setBPM(this.bpm);
};
p5.Metro.prototype.stop = function (timeFromNow) {
var t = timeFromNow || 0;
var now = p5sound.audiocontext.currentTime;
if (this.clock._oscillator) {
this.clock.stop(now + t);
}
};
p5.Metro.prototype.beatLength = function (tatums) {
this.tatums = 1 / tatums / 4;
};
}(master, Tone_core_Clock);
var looper;
looper = function () {
'use strict';
var p5sound = master;
var bpm = 120;
/**
* Set the global tempo, in beats per minute, for all
* p5.Parts. This method will impact all active p5.Parts.
*
* @param {Number} BPM Beats Per Minute
* @param {Number} rampTime Seconds from now
*/
p5.prototype.setBPM = function (BPM, rampTime) {
bpm = BPM;
for (var i in p5sound.parts) {
p5sound.parts[i].setBPM(bpm, rampTime);
}
};
/**
* <p>A phrase is a pattern of musical events over time, i.e.
* a series of notes and rests.</p>
*
* <p>Phrases must be added to a p5.Part for playback, and
* each part can play multiple phrases at the same time.
* For example, one Phrase might be a kick drum, another
* could be a snare, and another could be the bassline.</p>
*
* <p>The first parameter is a name so that the phrase can be
* modified or deleted later. The callback is a a function that
* this phrase will call at every step—for example it might be
* called <code>playNote(value){}</code>. The array determines
* which value is passed into the callback at each step of the
* phrase. It can be numbers, an object with multiple numbers,
* or a zero (0) indicates a rest so the callback won't be called).</p>
*
* @class p5.Phrase
* @constructor
* @param {String} name Name so that you can access the Phrase.
* @param {Function} callback The name of a function that this phrase
* will call. Typically it will play a sound,
* and accept two parameters: a time at which
* to play the sound (in seconds from now),
* and a value from the sequence array. The
* time should be passed into the play() or
* start() method to ensure precision.
* @param {Array} sequence Array of values to pass into the callback
* at each step of the phrase.
* @example
* <div><code>
* var mySound, myPhrase, myPart;
* var pattern = [1,0,0,2,0,2,0,0];
* var msg = 'click to play';
*
* function preload() {
* mySound = loadSound('assets/beatbox.mp3');
* }
*
* function setup() {
* noStroke();
* fill(255);
* textAlign(CENTER);
* masterVolume(0.1);
*
* myPhrase = new p5.Phrase('bbox', makeSound, pattern);
* myPart = new p5.Part();
* myPart.addPhrase(myPhrase);
* myPart.setBPM(60);
* }
*
* function draw() {
* background(0);
* text(msg, width/2, height/2);
* }
*
* function makeSound(time, playbackRate) {
* mySound.rate(playbackRate);
* mySound.play(time);
* }
*
* function mouseClicked() {
* if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
* myPart.start();
* msg = 'playing pattern';
* }
* }
*
* </code></div>
*/
p5.Phrase = function (name, callback, sequence) {
this.phraseStep = 0;
this.name = name;
this.callback = callback;
/**
* Array of values to pass into the callback
* at each step of the phrase. Depending on the callback
* function's requirements, these values may be numbers,
* strings, or an object with multiple parameters.
* Zero (0) indicates a rest.
*
* @property sequence
* @type {Array}
*/
this.sequence = sequence;
};
/**
* <p>A p5.Part plays back one or more p5.Phrases. Instantiate a part
* with steps and tatums. By default, each step represents 1/16th note.</p>
*
* <p>See p5.Phrase for more about musical timing.</p>
*
* @class p5.Part
* @constructor
* @param {Number} [steps] Steps in the part
* @param {Number} [tatums] Divisions of a beat (default is 1/16, a quarter note)
* @example
* <div><code>
* var box, drum, myPart;
* var boxPat = [1,0,0,2,0,2,0,0];
* var drumPat = [0,1,1,0,2,0,1,0];
* var msg = 'click to play';
*
* function preload() {
* box = loadSound('assets/beatbox.mp3');
* drum = loadSound('assets/drum.mp3');
* }
*
* function setup() {
* noStroke();
* fill(255);
* textAlign(CENTER);
* masterVolume(0.1);
*
* var boxPhrase = new p5.Phrase('box', playBox, boxPat);
* var drumPhrase = new p5.Phrase('drum', playDrum, drumPat);
* myPart = new p5.Part();
* myPart.addPhrase(boxPhrase);
* myPart.addPhrase(drumPhrase);
* myPart.setBPM(60);
* masterVolume(0.1);
* }
*
* function draw() {
* background(0);
* text(msg, width/2, height/2);
* }
*
* function playBox(time, playbackRate) {
* box.rate(playbackRate);
* box.play(time);
* }
*
* function playDrum(time, playbackRate) {
* drum.rate(playbackRate);
* drum.play(time);
* }
*
* function mouseClicked() {
* if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
* myPart.start();
* msg = 'playing part';
* }
* }
* </code></div>
*/
p5.Part = function (steps, bLength) {
this.length = steps || 0;
// how many beats
this.partStep = 0;
this.phrases = [];
this.looping = false;
this.isPlaying = false;
// what does this looper do when it gets to the last step?
this.onended = function () {
this.stop();
};
this.tatums = bLength || 0.0625;
// defaults to quarter note
this.metro = new p5.Metro();
this.metro._init();
this.metro.beatLength(this.tatums);
this.metro.setBPM(bpm);
p5sound.parts.push(this);
this.callback = function () {
};
};
/**
* Set the tempo of this part, in Beats Per Minute.
*
* @method setBPM
* @param {Number} BPM Beats Per Minute
* @param {Number} [rampTime] Seconds from now
*/
p5.Part.prototype.setBPM = function (tempo, rampTime) {
this.metro.setBPM(tempo, rampTime);
};
/**
* Returns the Beats Per Minute of this currently part.
*
* @method getBPM
* @return {Number}
*/
p5.Part.prototype.getBPM = function () {
return this.metro.getBPM();
};
/**
* Start playback of this part. It will play
* through all of its phrases at a speed
* determined by setBPM.
*
* @method start
* @param {Number} [time] seconds from now
*/
p5.Part.prototype.start = function (time) {
if (!this.isPlaying) {
this.isPlaying = true;
this.metro.resetSync(this);
var t = time || 0;
this.metro.start(t);
}
};
/**
* Loop playback of this part. It will begin
* looping through all of its phrases at a speed
* determined by setBPM.
*
* @method loop
* @param {Number} [time] seconds from now
*/
p5.Part.prototype.loop = function (time) {
this.looping = true;
// rest onended function
this.onended = function () {
this.partStep = 0;
};
var t = time || 0;
this.start(t);
};
/**
* Tell the part to stop looping.
*
* @method noLoop
*/
p5.Part.prototype.noLoop = function () {
this.looping = false;
// rest onended function
this.onended = function () {
this.stop();
};
};
/**
* Stop the part and cue it to step 0.
*
* @method stop
* @param {Number} [time] seconds from now
*/
p5.Part.prototype.stop = function (time) {
this.partStep = 0;
this.pause(time);
};
/**
* Pause the part. Playback will resume
* from the current step.
*
* @method pause
* @param {Number} time seconds from now
*/
p5.Part.prototype.pause = function (time) {
this.isPlaying = false;
var t = time || 0;
this.metro.stop(t);
};
/**
* Add a p5.Phrase to this Part.
*
* @method addPhrase
* @param {p5.Phrase} phrase reference to a p5.Phrase
*/
p5.Part.prototype.addPhrase = function (name, callback, array) {
var p;
if (arguments.length === 3) {
p = new p5.Phrase(name, callback, array);
} else if (arguments[0] instanceof p5.Phrase) {
p = arguments[0];
} else {
throw 'invalid input. addPhrase accepts name, callback, array or a p5.Phrase';
}
this.phrases.push(p);
// reset the length if phrase is longer than part's existing length
if (p.sequence.length > this.length) {
this.length = p.sequence.length;
}
};
/**
* Remove a phrase from this part, based on the name it was
* given when it was created.
*
* @method removePhrase
* @param {String} phraseName
*/
p5.Part.prototype.removePhrase = function (name) {
for (var i in this.phrases) {
if (this.phrases[i].name === name) {
this.phrases.split(i, 1);
}
}
};
/**
* Get a phrase from this part, based on the name it was
* given when it was created. Now you can modify its array.
*
* @method getPhrase
* @param {String} phraseName
*/
p5.Part.prototype.getPhrase = function (name) {
for (var i in this.phrases) {
if (this.phrases[i].name === name) {
return this.phrases[i];
}
}
};
/**
* Get a phrase from this part, based on the name it was
* given when it was created. Now you can modify its array.
*
* @method replaceSequence
* @param {String} phraseName
* @param {Array} sequence Array of values to pass into the callback
* at each step of the phrase.
*/
p5.Part.prototype.replaceSequence = function (name, array) {
for (var i in this.phrases) {
if (this.phrases[i].name === name) {
this.phrases[i].sequence = array;
}
}
};
p5.Part.prototype.incrementStep = function (time) {
if (this.partStep < this.length - 1) {
this.callback(time);
this.partStep += 1;
} else {
if (this.looping) {
this.callback(time);
}
this.onended();
this.partStep = 0;
}
};
/**
* Fire a callback function at every step.
*
* @method onStep
* @param {Function} callback The name of the callback
* you want to fire
* on every beat/tatum.
*/
p5.Part.prototype.onStep = function (callback) {
this.callback = callback;
};
// ===============
// p5.Score
// ===============
/**
* A Score consists of a series of Parts. The parts will
* be played back in order. For example, you could have an
* A part, a B part, and a C part, and play them back in this order
* <code>new p5.Score(a, a, b, a, c)</code>
*
* @class p5.Score
* @constructor
* @param {p5.Part} part(s) One or multiple parts, to be played in sequence.
* @return {p5.Score}
*/
p5.Score = function () {
// for all of the arguments
this.parts = [];
this.currentPart = 0;
var thisScore = this;
for (var i in arguments) {
this.parts[i] = arguments[i];
this.parts[i].nextPart = this.parts[i + 1];
this.parts[i].onended = function () {
thisScore.resetPart(i);
playNextPart(thisScore);
};
}
this.looping = false;
};
p5.Score.prototype.onended = function () {
if (this.looping) {
// this.resetParts();
this.parts[0].start();
} else {
this.parts[this.parts.length - 1].onended = function () {
this.stop();
this.resetParts();
};
}
this.currentPart = 0;
};
/**
* Start playback of the score.
*
* @method start
*/
p5.Score.prototype.start = function () {
this.parts[this.currentPart].start();
this.scoreStep = 0;
};
/**
* Stop playback of the score.
*
* @method stop
*/
p5.Score.prototype.stop = function () {
this.parts[this.currentPart].stop();
this.currentPart = 0;
this.scoreStep = 0;
};
/**
* Pause playback of the score.
*
* @method pause
*/
p5.Score.prototype.pause = function () {
this.parts[this.currentPart].stop();
};
/**
* Loop playback of the score.
*
* @method loop
*/
p5.Score.prototype.loop = function () {
this.looping = true;
this.start();
};
/**
* Stop looping playback of the score. If it
* is currently playing, this will go into effect
* after the current round of playback completes.
*
* @method noLoop
*/
p5.Score.prototype.noLoop = function () {
this.looping = false;
};
p5.Score.prototype.resetParts = function () {
for (var i in this.parts) {
this.resetPart(i);
}
};
p5.Score.prototype.resetPart = function (i) {
this.parts[i].stop();
this.parts[i].partStep = 0;
for (var p in this.parts[i].phrases) {
this.parts[i].phrases[p].phraseStep = 0;
}
};
/**
* Set the tempo for all parts in the score
*
* @param {Number} BPM Beats Per Minute
* @param {Number} rampTime Seconds from now
*/
p5.Score.prototype.setBPM = function (bpm, rampTime) {
for (var i in this.parts) {
this.parts[i].setBPM(bpm, rampTime);
}
};
function playNextPart(aScore) {
aScore.currentPart++;
if (aScore.currentPart >= aScore.parts.length) {
aScore.scoreStep = 0;
aScore.onended();
} else {
aScore.scoreStep = 0;
aScore.parts[aScore.currentPart - 1].stop();
aScore.parts[aScore.currentPart].start();
}
}
}(master);
var soundRecorder;
soundRecorder = function () {
'use strict';
var p5sound = master;
var ac = p5sound.audiocontext;
/**
* <p>Record sounds for playback and/or to save as a .wav file.
* The p5.SoundRecorder records all sound output from your sketch,
* or can be assigned a specific source with setInput().</p>
* <p>The record() method accepts a p5.SoundFile as a parameter.
* When playback is stopped (either after the given amount of time,
* or with the stop() method), the p5.SoundRecorder will send its
* recording to that p5.SoundFile for playback.</p>
*
* @class p5.SoundRecorder
* @constructor
* @example
* <div><code>
* var mic, recorder, soundFile;
* var state = 0;
*
* function setup() {
* background(200);
* // create an audio in
* mic = new p5.AudioIn();
*
* // prompts user to enable their browser mic
* mic.start();
*
* // create a sound recorder
* recorder = new p5.SoundRecorder();
*
* // connect the mic to the recorder
* recorder.setInput(mic);
*
* // this sound file will be used to
* // playback & save the recording
* soundFile = new p5.SoundFile();
*
* text('keyPress to record', 20, 20);
* }
*
* function keyPressed() {
* // make sure user enabled the mic
* if (state === 0 && mic.enabled) {
*
* // record to our p5.SoundFile
* recorder.record(soundFile);
*
* background(255,0,0);
* text('Recording!', 20, 20);
* state++;
* }
* else if (state === 1) {
* background(0,255,0);
*
* // stop recorder and
* // send result to soundFile
* recorder.stop();
*
* text('Stopped', 20, 20);
* state++;
* }
*
* else if (state === 2) {
* soundFile.play(); // play the result!
* save(soundFile, 'mySound.wav');
* state++;
* }
* }
* </div></code>
*/
p5.SoundRecorder = function () {
this.input = ac.createGain();
this.output = ac.createGain();
this.recording = false;
this.bufferSize = 1024;
this._channels = 2;
// stereo (default)
this._clear();
// initialize variables
this._jsNode = ac.createScriptProcessor(this.bufferSize, this._channels, 2);
this._jsNode.onaudioprocess = this._audioprocess.bind(this);
/**
* callback invoked when the recording is over
* @private
* @type {function(Float32Array)}
*/
this._callback = function () {
};
// connections
this._jsNode.connect(p5.soundOut._silentNode);
this.setInput();
// add this p5.SoundFile to the soundArray
p5sound.soundArray.push(this);
};
/**
* Connect a specific device to the p5.SoundRecorder.
* If no parameter is given, p5.SoundRecorer will record
* all audible p5.sound from your sketch.
*
* @method setInput
* @param {Object} [unit] p5.sound object or a web audio unit
* that outputs sound
*/
p5.SoundRecorder.prototype.setInput = function (unit) {
this.input.disconnect();
this.input = null;
this.input = ac.createGain();
this.input.connect(this._jsNode);
this.input.connect(this.output);
if (unit) {
unit.connect(this.input);
} else {
p5.soundOut.output.connect(this.input);
}
};
/**
* Start recording. To access the recording, provide
* a p5.SoundFile as the first parameter. The p5.SoundRecorder
* will send its recording to that p5.SoundFile for playback once
* recording is complete. Optional parameters include duration
* (in seconds) of the recording, and a callback function that
* will be called once the complete recording has been
* transfered to the p5.SoundFile.
*
* @method record
* @param {p5.SoundFile} soundFile p5.SoundFile
* @param {Number} [duration] Time (in seconds)
* @param {Function} [callback] The name of a function that will be
* called once the recording completes
*/
p5.SoundRecorder.prototype.record = function (sFile, duration, callback) {
this.recording = true;
if (duration) {
this.sampleLimit = Math.round(duration * ac.sampleRate);
}
if (sFile && callback) {
this._callback = function () {
this.buffer = this._getBuffer();
sFile.setBuffer(this.buffer);
callback();
};
} else if (sFile) {
this._callback = function () {
this.buffer = this._getBuffer();
sFile.setBuffer(this.buffer);
};
}
};
/**
* Stop the recording. Once the recording is stopped,
* the results will be sent to the p5.SoundFile that
* was given on .record(), and if a callback function
* was provided on record, that function will be called.
*
* @method stop
*/
p5.SoundRecorder.prototype.stop = function () {
this.recording = false;
this._callback();
this._clear();
};
p5.SoundRecorder.prototype._clear = function () {
this._leftBuffers = [];
this._rightBuffers = [];
this.recordedSamples = 0;
this.sampleLimit = null;
};
/**
* internal method called on audio process
*
* @private
* @param {AudioProcessorEvent} event
*/
p5.SoundRecorder.prototype._audioprocess = function (event) {
if (this.recording === false) {
return;
} else if (this.recording === true) {
// if we are past the duration, then stop... else:
if (this.sampleLimit && this.recordedSamples >= this.sampleLimit) {
this.stop();
} else {
// get channel data
var left = event.inputBuffer.getChannelData(0);
var right = event.inputBuffer.getChannelData(1);
// clone the samples
this._leftBuffers.push(new Float32Array(left));
this._rightBuffers.push(new Float32Array(right));
this.recordedSamples += this.bufferSize;
}
}
};
p5.SoundRecorder.prototype._getBuffer = function () {
var buffers = [];
buffers.push(this._mergeBuffers(this._leftBuffers));
buffers.push(this._mergeBuffers(this._rightBuffers));
return buffers;
};
p5.SoundRecorder.prototype._mergeBuffers = function (channelBuffer) {
var result = new Float32Array(this.recordedSamples);
var offset = 0;
var lng = channelBuffer.length;
for (var i = 0; i < lng; i++) {
var buffer = channelBuffer[i];
result.set(buffer, offset);
offset += buffer.length;
}
return result;
};
p5.SoundRecorder.prototype.dispose = function () {
this._clear();
// remove reference from soundArray
var index = p5sound.soundArray.indexOf(this);
p5sound.soundArray.splice(index, 1);
this._callback = function () {
};
if (this.input) {
this.input.disconnect();
}
this.input = null;
this._jsNode = null;
};
/**
* Save a p5.SoundFile as a .wav audio file.
*
* @method saveSound
* @param {p5.SoundFile} soundFile p5.SoundFile that you wish to save
* @param {String} name name of the resulting .wav file.
*/
p5.prototype.saveSound = function (soundFile, name) {
var leftChannel = soundFile.buffer.getChannelData(0);
var rightChannel = soundFile.buffer.getChannelData(1);
var interleaved = interleave(leftChannel, rightChannel);
// create the buffer and view to create the .WAV file
var buffer = new ArrayBuffer(44 + interleaved.length * 2);
var view = new DataView(buffer);
// write the WAV container,
// check spec at: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
// RIFF chunk descriptor
writeUTFBytes(view, 0, 'RIFF');
view.setUint32(4, 44 + interleaved.length * 2, true);
writeUTFBytes(view, 8, 'WAVE');
// FMT sub-chunk
writeUTFBytes(view, 12, 'fmt ');
view.setUint32(16, 16, true);
view.setUint16(20, 1, true);
// stereo (2 channels)
view.setUint16(22, 2, true);
view.setUint32(24, 44100, true);
view.setUint32(28, 44100 * 4, true);
view.setUint16(32, 4, true);
view.setUint16(34, 16, true);
// data sub-chunk
writeUTFBytes(view, 36, 'data');
view.setUint32(40, interleaved.length * 2, true);
// write the PCM samples
var lng = interleaved.length;
var index = 44;
var volume = 1;
for (var i = 0; i < lng; i++) {
view.setInt16(index, interleaved[i] * (32767 * volume), true);
index += 2;
}
p5.prototype.writeFile([view], name, 'wav');
};
// helper methods to save waves
function interleave(leftChannel, rightChannel) {
var length = leftChannel.length + rightChannel.length;
var result = new Float32Array(length);
var inputIndex = 0;
for (var index = 0; index < length;) {
result[index++] = leftChannel[inputIndex];
result[index++] = rightChannel[inputIndex];
inputIndex++;
}
return result;
}
function writeUTFBytes(view, offset, string) {
var lng = string.length;
for (var i = 0; i < lng; i++) {
view.setUint8(offset + i, string.charCodeAt(i));
}
}
}(sndcore, master);
var peakdetect;
peakdetect = function () {
'use strict';
var p5sound = master;
/**
* <p>PeakDetect works in conjunction with p5.FFT to
* look for onsets in some or all of the frequency spectrum.
* </p>
* <p>
* To use p5.PeakDetect, call <code>update</code> in the draw loop
* and pass in a p5.FFT object.
* </p>
* <p>
* You can listen for a specific part of the frequency spectrum by
* setting the range between <code>freq1</code> and <code>freq2</code>.
* </p>
*
* <p><code>threshold</code> is the threshold for detecting a peak,
* scaled between 0 and 1. It is logarithmic, so 0.1 is half as loud
* as 1.0.</p>
*
* <p>
* The update method is meant to be run in the draw loop, and
* <b>frames</b> determines how many loops must pass before
* another peak can be detected.
* For example, if the frameRate() = 60, you could detect the beat of a
* 120 beat-per-minute song with this equation:
* <code> framesPerPeak = 60 / (estimatedBPM / 60 );</code>
* </p>
*
* <p>
* Based on example contribtued by @b2renger, and a simple beat detection
* explanation by <a
* href="http://www.airtightinteractive.com/2013/10/making-audio-reactive-visuals/"
* target="_blank">Felix Turner</a>.
* </p>
*
* @class p5.PeakDetect
* @constructor
* @param {Number} [freq1] lowFrequency - defaults to 20Hz
* @param {Number} [freq2] highFrequency - defaults to 20000 Hz
* @param {Number} [threshold] Threshold for detecting a beat between 0 and 1
* scaled logarithmically where 0.1 is 1/2 the loudness
* of 1.0. Defaults to 0.35.
* @param {Number} [framesPerPeak] Defaults to 20.
* @example
* <div><code>
*
* var cnv, soundFile, fft, peakDetect;
* var ellipseWidth = 10;
*
* function setup() {
* background(0);
* noStroke();
* fill(255);
* textAlign(CENTER);
*
* soundFile = loadSound('assets/beat.mp3');
*
* // p5.PeakDetect requires a p5.FFT
* fft = new p5.FFT();
* peakDetect = new p5.PeakDetect();
*
* }
*
* function draw() {
* background(0);
* text('click to play/pause', width/2, height/2);
*
* // peakDetect accepts an fft post-analysis
* fft.analyze();
* peakDetect.update(fft);
*
* if ( peakDetect.isDetected ) {
* ellipseWidth = 50;
* } else {
* ellipseWidth *= 0.95;
* }
*
* ellipse(width/2, height/2, ellipseWidth, ellipseWidth);
* }
*
* // toggle play/stop when canvas is clicked
* function mouseClicked() {
* if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
* if (soundFile.isPlaying() ) {
* soundFile.stop();
* } else {
* soundFile.play();
* }
* }
* }
* </code></div>
*/
p5.PeakDetect = function (freq1, freq2, threshold, _framesPerPeak) {
var framesPerPeak;
// framesPerPeak determines how often to look for a beat.
// If a beat is provided, try to look for a beat based on bpm
this.framesPerPeak = _framesPerPeak || 20;
this.framesSinceLastPeak = 0;
this.decayRate = 0.95;
this.threshold = threshold || 0.35;
this.cutoff = 0;
// how much to increase the cutoff
// TO DO: document this / figure out how to make it accessible
this.cutoffMult = 1.5;
this.energy = 0;
this.penergy = 0;
// TO DO: document this property / figure out how to make it accessible
this.currentValue = 0;
/**
* isDetected is set to true when a peak is detected.
*
* @attribute isDetected
* @type {Boolean}
* @default false
*/
this.isDetected = false;
this.f1 = freq1 || 40;
this.f2 = freq2 || 20000;
// function to call when a peak is detected
this._onPeak = function () {
};
};
/**
* The update method is run in the draw loop.
*
* Accepts an FFT object. You must call .analyze()
* on the FFT object prior to updating the peakDetect
* because it relies on a completed FFT analysis.
*
* @method update
* @param {p5.FFT} fftObject A p5.FFT object
*/
p5.PeakDetect.prototype.update = function (fftObject) {
var nrg = this.energy = fftObject.getEnergy(this.f1, this.f2) / 255;
if (nrg > this.cutoff && nrg > this.threshold && nrg - this.penergy > 0) {
// trigger callback
this._onPeak();
this.isDetected = true;
// debounce
this.cutoff = nrg * this.cutoffMult;
this.framesSinceLastPeak = 0;
} else {
this.isDetected = false;
if (this.framesSinceLastPeak <= this.framesPerPeak) {
this.framesSinceLastPeak++;
} else {
this.cutoff *= this.decayRate;
this.cutoff = Math.max(this.cutoff, this.threshold);
}
}
this.currentValue = nrg;
this.penergy = nrg;
};
/**
* onPeak accepts two arguments: a function to call when
* a peak is detected. The value of the peak,
* between 0.0 and 1.0, is passed to the callback.
*
* @method onPeak
* @param {Function} callback Name of a function that will
* be called when a peak is
* detected.
* @param {Object} [val] Optional value to pass
* into the function when
* a peak is detected.
* @example
* <div><code>
* var cnv, soundFile, fft, peakDetect;
* var ellipseWidth = 0;
*
* function setup() {
* cnv = createCanvas(100,100);
* textAlign(CENTER);
*
* soundFile = loadSound('assets/beat.mp3');
* fft = new p5.FFT();
* peakDetect = new p5.PeakDetect();
*
* setupSound();
*
* // when a beat is detected, call triggerBeat()
* peakDetect.onPeak(triggerBeat);
* }
*
* function draw() {
* background(0);
* fill(255);
* text('click to play', width/2, height/2);
*
* fft.analyze();
* peakDetect.update(fft);
*
* ellipseWidth *= 0.95;
* ellipse(width/2, height/2, ellipseWidth, ellipseWidth);
* }
*
* // this function is called by peakDetect.onPeak
* function triggerBeat() {
* ellipseWidth = 50;
* }
*
* // mouseclick starts/stops sound
* function setupSound() {
* cnv.mouseClicked( function() {
* if (soundFile.isPlaying() ) {
* soundFile.stop();
* } else {
* soundFile.play();
* }
* });
* }
* </code></div>
*/
p5.PeakDetect.prototype.onPeak = function (callback, val) {
var self = this;
self._onPeak = function () {
callback(self.energy, val);
};
};
}(master);
var gain;
gain = function () {
'use strict';
var p5sound = master;
/**
* A gain node is usefull to set the relative volume of sound.
* It's typically used to build mixers.
*
* @class p5.Gain
* @constructor
* @example
* <div><code>
*
* // load two soundfile and crossfade beetween them
* var sound1,sound2;
* var gain1, gain2, gain3;
*
* function preload(){
* soundFormats('ogg', 'mp3');
* sound1 = loadSound('../_files/Damscray_-_Dancing_Tiger_01');
* sound2 = loadSound('../_files/beat.mp3');
* }
*
* function setup() {
* createCanvas(400,200);
*
* // create a 'master' gain to which we will connect both soundfiles
* gain3 = new p5.Gain();
* gain3.connect();
*
* // setup first sound for playing
* sound1.rate(1);
* sound1.loop();
* sound1.disconnect(); // diconnect from p5 output
*
* gain1 = new p5.Gain(); // setup a gain node
* gain1.setInput(sound1); // connect the first sound to its input
* gain1.connect(gain3); // connect its output to the 'master'
*
* sound2.rate(1);
* sound2.disconnect();
* sound2.loop();
*
* gain2 = new p5.Gain();
* gain2.setInput(sound2);
* gain2.connect(gain3);
*
* }
*
* function draw(){
* background(180);
*
* // calculate the horizontal distance beetween the mouse and the right of the screen
* var d = dist(mouseX,0,width,0);
*
* // map the horizontal position of the mouse to values useable for volume control of sound1
* var vol1 = map(mouseX,0,width,0,1);
* var vol2 = 1-vol1; // when sound1 is loud, sound2 is quiet and vice versa
*
* gain1.amp(vol1,0.5,0);
* gain2.amp(vol2,0.5,0);
*
* // map the vertical position of the mouse to values useable for 'master volume control'
* var vol3 = map(mouseY,0,height,0,1);
* gain3.amp(vol3,0.5,0);
* }
*</code></div>
*
*/
p5.Gain = function () {
this.ac = p5sound.audiocontext;
this.input = this.ac.createGain();
this.output = this.ac.createGain();
// otherwise, Safari distorts
this.input.gain.value = 0.5;
this.input.connect(this.output);
// add to the soundArray
p5sound.soundArray.push(this);
};
/**
* Connect a source to the gain node.
*
* @method setInput
* @param {Object} src p5.sound / Web Audio object with a sound
* output.
*/
p5.Gain.prototype.setInput = function (src) {
src.connect(this.input);
};
/**
* Send output to a p5.sound or web audio object
*
* @method connect
* @param {Object} unit
*/
p5.Gain.prototype.connect = function (unit) {
var u = unit || p5.soundOut.input;
this.output.connect(u.input ? u.input : u);
};
/**
* Disconnect all output.
*
* @method disconnect
*/
p5.Gain.prototype.disconnect = function () {
this.output.disconnect();
};
/**
* Set the output level of the gain node.
*
* @method amp
* @param {Number} volume amplitude between 0 and 1.0
* @param {Number} [rampTime] create a fade that lasts rampTime
* @param {Number} [timeFromNow] schedule this event to happen
* seconds from now
*/
p5.Gain.prototype.amp = function (vol, rampTime, tFromNow) {
var rampTime = rampTime || 0;
var tFromNow = tFromNow || 0;
var now = p5sound.audiocontext.currentTime;
var currentVol = this.output.gain.value;
this.output.gain.cancelScheduledValues(now);
this.output.gain.linearRampToValueAtTime(currentVol, now + tFromNow);
this.output.gain.linearRampToValueAtTime(vol, now + tFromNow + rampTime);
};
p5.Gain.prototype.dispose = function () {
// remove reference from soundArray
var index = p5sound.soundArray.indexOf(this);
p5sound.soundArray.splice(index, 1);
this.output.disconnect();
this.input.disconnect();
this.output = undefined;
this.input = undefined;
};
}(master, sndcore);
var src_app;
src_app = function () {
'use strict';
var p5SOUND = sndcore;
return p5SOUND;
}(sndcore, master, helpers, errorHandler, panner, soundfile, amplitude, fft, signal, oscillator, env, pulse, noise, audioin, filter, delay, reverb, metro, looper, soundRecorder, peakdetect, gain);
})); |
react-flux-mui/js/material-ui/src/IconMenu/IconMenu.spec.js | pbogdan/react-flux-mui | /* eslint-env mocha */
import React from 'react';
import {shallow} from 'enzyme';
import {assert} from 'chai';
import getMuiTheme from '../styles/getMuiTheme';
import IconMenu from './IconMenu';
describe('<IconMenu />', function() {
const muiTheme = getMuiTheme();
const shallowWithContext = (node) => shallow(node, {context: {muiTheme}});
it('should not leak an iconStyle property', () => {
const wrapper = shallowWithContext(
<IconMenu iconButtonElement={<div data-test="my-icon-button" />} />
);
assert.strictEqual(wrapper.find('[data-test="my-icon-button"]').props().hasOwnProperty('iconStyle'), false,
'should leak property on the div');
});
});
|
src/containers/verification/joblist/BrowseView.js | shojil/bifapp | /**
* Receipe Tabs Screen
* - Shows tabs, which contain receipe listings
*
* React Native Starter App
* https://github.com/mcnamee/react-native-starter-app
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
View,
StyleSheet,
InteractionManager,
ScrollView,
Image,
Dimensions,
ListView,
AsyncStorage
} from 'react-native';
import { TabViewAnimated, TabBar } from 'react-native-tab-view';
// Consts and Libs
import { AppColors, AppStyles } from '@theme/';
// Consts and Libs
import { AppConfig } from '@constants/';
// Containers
import RecipeListing from '@containers/recipes/Listing/ListingContainer';
// Components
import { Text } from '@ui/';
import Loading from '@components/general/Loading';
import { Actions } from 'react-native-router-flux';
// Components
import {
Alerts,
DashBadge,
Button,
Card,
Spacer,
List,
ListItem,
FormInput,
FormLabel,
} from '@components/ui/';
import { Icon, Grid, Col, Row } from 'react-native-elements';
/* Styles ==================================================================== */
const styles = StyleSheet.create({
// Tab Styles
tabContainerWrapper: {
flex:1
},
tabContainer: {
flexDirection: 'row',
flex: 1,
marginBottom:12
},
tabbar: {
backgroundColor: AppColors.brand.primary,
},
tabbarIndicator: {
backgroundColor: '#FFF',
},
tabbarText: {
color: '#FFF',
},
dashbadbox1:{
width:'35%', marginLeft:'9%', marginRight:'4%'
},
dashbadbox2:{
width:'35%', marginLeft:'5%', marginRight:'9%'
}
});
const dummyData2 = [
{
title: 'BCIL-EB-885 - Imran Ahmad Memon',
role: '96 Memon MOHALLAH MALL ROAD KHAIRPUR MEMON MOHALLAH KHAIRPUR',
phone: '00923224434435',
isNew: 'No',
bcilno:'BCIL-EB-885',
name:'Imran Ahmad Memon',
residenceaddress:'96 Memon MOHALLAH MALL ROAD KHAIRPUR MEMON MOHALLAH KHAIRPUR',
regid:'0019NPM000058',
businessname:'Graint Heights'
},
{
title: 'BCIL-NB-2102 - Usman Malik',
role: 'Office no 23 Street 44 Gulistan-e-Johr Lahore',
phone: '00923224434435',
isNew: 'Yes',
bcilno:'BCIL-NB-2102',
name:'Usman Malik',
residenceaddress:'Office no 23 Street 44 Gulistan-e-Johr Lahore',
regid:'0019NPM000012',
businessname:'Wholesale Dailer'
},
{
title: 'BCIL-NB-2103 - Asad Malik',
role: 'Office no 234 Street 44 Gulistan-e-Johr Lahore',
phone: '00923224434435',
isNew: 'Yes',
bcilno:'BCIL-NB-2103',
name:'Asad Malik',
residenceaddress:'Office no 234 Street 44 Gulistan-e-Johr Lahore',
regid:'0019NPM000111',
businessname:'Super Store'
},
{
title: 'BCIL-NB-2104 - Asad Kamran',
role: 'Office no 234 Street 44 Gulistan-e-Johr Lahore',
phone: '00923224434435',
isNew: 'Yes',
bcilno:'BCIL-NB-2104',
name:'Asad Kamran',
residenceaddress:'Office no 234 Street 44 Gulistan-e-Johr Lahore',
regid:'0019NPM000013',
businessname:'Vegitable Shop'
},
{
title: 'BCIL-EB-2105 - Aslam Kamran',
role: 'Office no 234 Street 44 Gulistan-e-Johr Lahore',
phone: '00923224434435',
isNew: 'No',
bcilno:'BCIL-EB-2105',
name:'Aslam Kamran',
residenceaddress:'Office no 234 Street 44 Gulistan-e-Johr Lahore',
regid:'0019NPM003453',
businessname:'Super Store'
},
{
title: 'BCIL-EB-2106 - Aslam Kamran',
role: 'Office no 234 Street 44 Muslim Town Lahore',
phone: '00923224434435',
isNew: 'No',
bcilno:'BCIL-EB-2106',
name:'Aslam Kamran',
residenceaddress:'Office no 234 Street 44 Muslim Town Lahore',
regid:'0019NPM000253',
businessname:'Factory'
},
{
title: 'BCIL-NB-2104 - Usman Saleem',
role: 'Office no 234 Street 44 Muslim Town Lahore',
phone: '00923224434435',
isNew: 'Yes',
bcilno:'BCIL-NB-2104',
name:'Usman Saleem',
residenceaddress:'Office no 234 Street 44 Muslim Town Lahore',
regid:'0019NPM000313',
businessname:'Juice Shop'
},
{
title: 'BCIL-NB-2109 - Jim Collins',
role: 'Office no 234 Street 44 Muslim Town Lahore',
phone: '00923224434435',
isNew: 'Yes',
bcilno:'BCIL-NB-2109',
name:'Jim Collins',
residenceaddress:'Office no 234 Street 44 Muslim Town Lahore',
regid:'0019NPM000313',
businessname:'Boutique'
},
{
title: 'BCIL-EB-2109 - Jim Collins',
role: 'Office no 2 Muslim Town Lahore',
phone: '00923224434435',
isNew: 'No',
bcilno:'BCIL-EB-2109',
name:'Jim Collins',
residenceaddress:'Office no 2 Muslim Town Lahore',
regid:'0019NPM000313',
businessname:'Boutique'
},
{
title: 'BCIL-EB-2110 - Anwar Ali',
role: 'Office no 234 Street 44 Muslim Town Lahore',
phone: '00923224434435',
isNew: 'No',
bcilno:'BCIL-EB-2110',
name:'Anwar Ali',
residenceaddress:'Office no 234 Street 44 Muslim Town Lahore',
regid:'0019NPM000113',
businessname:'Grammer School'
}
];
/* Component ==================================================================== */
let loadingTimeout;
class RecipeTabs extends Component {
static componentName = 'RecipeTabs';
static propTypes = {
meals: PropTypes.arrayOf(PropTypes.object).isRequired,
}
static defaultProps = {
meals: [],
}
constructor(props) {
super(props);
const ds2 = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
this.state = {
loading: true,
visitedRoutes: [],
dataSource2: ds2.cloneWithRows(dummyData2)
};
this.openForm = this.openForm.bind(this)
}
/**
* Wait until any interactions are finished, before setting up tabs
*/
componentDidMount = () => {
InteractionManager.runAfterInteractions(() => {
this.setTabs();
});
}
componentWillUnmount = () => clearTimeout(loadingTimeout);
/**
* When meals are ready, populate tabs
*/
setTabs = () => {
const routes = [];
let idx = 0;
this.props.meals.forEach((meal) => {
routes.push({
key: idx.toString(),
id: meal.id.toString(),
title: meal.title,
});
idx += 1;
});
this.setState({
navigation: {
index: 0,
routes,
},
}, () => {
// Hack to prevent error showing
loadingTimeout = setTimeout(() => {
this.setState({ loading: false });
}, 100);
});
}
openForm = () => {
console.log("Testing ..... OpenForm clicked....")
}
/**
* On Change Tab
*/
handleChangeTab = (index) => {
this.setState({
navigation: { ...this.state.navigation, index },
});
}
/**
* Each List Item
*/
renderRow = (data, sectionID) => (
<View>
<Text h5 style={{marginLeft:30}}>{data.title}</Text>
<ListItem
key={`list-row-${sectionID}`}
onPress={()=>Actions.verificationform({data: data})}
title={data.phone}
subtitle={data.role || null}
leftIcon={data.icon ? { name: data.icon } : null}
avatar={data.avatar ? { uri: data.avatar } : null}
roundAvatar={!!data.avatar}
/>
</View>
)
/**
* Header Component
*/
renderHeader = props => (
<View />
)
/**
* Which component to show
*/
renderScene = ({ route }) => {
// For performance, only render if it's this route, or I've visited before
if (
parseInt(route.key, 0) !== parseInt(this.state.navigation.index, 0) &&
this.state.visitedRoutes.indexOf(route.key) < 0
) {
return null;
}
// And Add this index to visited routes
if (this.state.visitedRoutes.indexOf(this.state.navigation.index) < 0) {
this.state.visitedRoutes.push(route.key);
}
// Which component should be loaded?
return (
<View style={styles.tabContainer}>
<ScrollView
automaticallyAdjustContentInsets={false}
style={[AppStyles.container]}
>
<View style={[AppStyles.paddingHorizontal]}>
<Spacer size={15} />
<Text h2>List Rows</Text>
<Spacer size={-10} />
</View>
<List>
<ListView
renderRow={this.renderRow}
dataSource={this.state.dataSource2}
/>
</List>
</ScrollView>
</View>
);
}
/**
* Save Form Step to AsyncStorage
*/
setFormStep = async(setp) => {
if(typeof AppConfig.localstoragekeys != 'undefined' && typeof AppConfig.localstoragekeys.fromstep != 'undefined')
{
await AsyncStorage.setItem(AppConfig.localstoragekeys.fromstep, step);
}
}
render = () => {
if (this.state.loading || !this.state.navigation) return <Loading />;
this.setFormStep(0)
return (
<TabViewAnimated
style={[styles.tabContainer]}
renderScene={this.renderScene}
renderHeader={this.renderHeader}
navigationState={this.state.navigation}
onRequestChangeTab={this.handleChangeTab}
/>
);
}
}
/* Export Component ==================================================================== */
export default RecipeTabs;
|
actor-apps/app-web/src/app/components/sidebar/ContactsSectionItem.react.js | Just-D/actor-platform | import React from 'react';
import ReactMixin from 'react-mixin';
import addons from 'react/addons';
import DialogActionCreators from 'actions/DialogActionCreators';
import AvatarItem from 'components/common/AvatarItem.react';
const {addons: { PureRenderMixin }} = addons;
@ReactMixin.decorate(PureRenderMixin)
class ContactsSectionItem extends React.Component {
static propTypes = {
contact: React.PropTypes.object
};
constructor(props) {
super(props);
}
openNewPrivateCoversation = () => {
DialogActionCreators.selectDialogPeerUser(this.props.contact.uid);
}
render() {
const contact = this.props.contact;
return (
<li className="sidebar__list__item row" onClick={this.openNewPrivateCoversation}>
<AvatarItem image={contact.avatar}
placeholder={contact.placeholder}
size="small"
title={contact.name}/>
<div className="col-xs">
<span className="title">
{contact.name}
</span>
</div>
</li>
);
}
}
export default ContactsSectionItem;
|
packages/react-scripts/template/src/index.js | CodingZeal/create-react-app | import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
|
examples/huge-apps/routes/Course/routes/Assignments/routes/Assignment/components/Assignment.js | natorojr/react-router | import React from 'react';
class Assignment extends React.Component {
render () {
var { courseId, assignmentId } = this.props.params;
var { title, body } = COURSES[courseId].assignments[assignmentId]
return (
<div>
<h4>{title}</h4>
<p>{body}</p>
</div>
);
}
}
export default Assignment;
|
app/javascript/mastodon/components/modal_root.js | kirakiratter/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import 'wicg-inert';
export default class ModalRoot extends React.PureComponent {
static propTypes = {
children: PropTypes.node,
onClose: PropTypes.func.isRequired,
};
state = {
revealed: !!this.props.children,
};
activeElement = this.state.revealed ? document.activeElement : null;
handleKeyUp = (e) => {
if ((e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27)
&& !!this.props.children) {
this.props.onClose();
}
}
handleKeyDown = (e) => {
if (e.key === 'Tab') {
const focusable = Array.from(this.node.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter((x) => window.getComputedStyle(x).display !== 'none');
const index = focusable.indexOf(e.target);
let element;
if (e.shiftKey) {
element = focusable[index - 1] || focusable[focusable.length - 1];
} else {
element = focusable[index + 1] || focusable[0];
}
if (element) {
element.focus();
e.stopPropagation();
e.preventDefault();
}
}
}
componentDidMount () {
window.addEventListener('keyup', this.handleKeyUp, false);
window.addEventListener('keydown', this.handleKeyDown, false);
}
componentWillReceiveProps (nextProps) {
if (!!nextProps.children && !this.props.children) {
this.activeElement = document.activeElement;
this.getSiblings().forEach(sibling => sibling.setAttribute('inert', true));
} else if (!nextProps.children) {
this.setState({ revealed: false });
}
}
componentDidUpdate (prevProps) {
if (!this.props.children && !!prevProps.children) {
this.getSiblings().forEach(sibling => sibling.removeAttribute('inert'));
// Because of the wicg-inert polyfill, the activeElement may not be
// immediately selectable, we have to wait for observers to run, as
// described in https://github.com/WICG/inert#performance-and-gotchas
Promise.resolve().then(() => {
this.activeElement.focus();
this.activeElement = null;
}).catch((error) => {
console.error(error);
});
}
if (this.props.children) {
requestAnimationFrame(() => {
this.setState({ revealed: true });
});
}
}
componentWillUnmount () {
window.removeEventListener('keyup', this.handleKeyUp);
window.removeEventListener('keydown', this.handleKeyDown);
}
getSiblings = () => {
return Array(...this.node.parentElement.childNodes).filter(node => node !== this.node);
}
setRef = ref => {
this.node = ref;
}
render () {
const { children, onClose } = this.props;
const { revealed } = this.state;
const visible = !!children;
if (!visible) {
return (
<div className='modal-root' ref={this.setRef} style={{ opacity: 0 }} />
);
}
return (
<div className='modal-root' ref={this.setRef} style={{ opacity: revealed ? 1 : 0 }}>
<div style={{ pointerEvents: visible ? 'auto' : 'none' }}>
<div role='presentation' className='modal-root__overlay' onClick={onClose} />
<div role='dialog' className='modal-root__container'>{children}</div>
</div>
</div>
);
}
}
|
source/src/containers/footer.js | vgudzhev/DiagramTool | import React from 'react';
class Footer extends React.Component {
render() {
return (
<div className="footer">
<p>React-redux Diagram tool 2016 ©</p>
</div>
);
}
}
export default Footer;
|
docs/src/examples/collections/Message/Variations/MessageExampleCompact.js | Semantic-Org/Semantic-UI-React | import React from 'react'
import { Message } from 'semantic-ui-react'
const MessageExampleCompact = () => (
<Message compact>
Get all the best inventions in your e-mail every day. Sign up now!
</Message>
)
export default MessageExampleCompact
|
ajax/libs/rxjs/2.3.16/rx.lite.js | calvinf/cdnjs | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (undefined) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
var Rx = {
internals: {},
config: {
Promise: root.Promise // Detect if promise exists
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
isScheduler = Rx.helpers.isScheduler = function (x) { return x instanceof Rx.Scheduler; },
identity = Rx.helpers.identity = function (x) { return x; },
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
just = Rx.helpers.just = function (value) { return function () { return value; }; },
defaultNow = Rx.helpers.defaultNow = Date.now,
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
not = Rx.helpers.not = function (a) { return !a; },
isFunction = Rx.helpers.isFunction = (function () {
var isFn = function (value) {
return typeof value == 'function' || false;
}
// fallback for older versions of Chrome and Safari
if (isFn(/x/)) {
isFn = function(value) {
return typeof value == 'function' && toString.call(value) == '[object Function]';
};
}
return isFn;
}());
// Errors
var sequenceContainsNoElements = 'Sequence contains no elements.';
var argumentOutOfRange = 'Argument out of range';
var objectDisposed = 'Object has been disposed';
function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
// Shim in iterator support
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
'_es6shim_iterator_';
// Bug for mozilla version
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
$iterator$ = '@@iterator';
}
var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined };
var isIterable = Rx.helpers.isIterable = function (o) {
return o[$iterator$] !== undefined;
}
var isArrayLike = Rx.helpers.isArrayLike = function (o) {
return o && o.length !== undefined;
}
Rx.helpers.iterator = $iterator$;
var deprecate = Rx.helpers.deprecate = function (name, alternative) {
if (typeof console !== "undefined" && typeof console.warn === "function") {
console.warn(name + ' is deprecated, use ' + alternative + ' instead.', new Error('').stack);
}
}
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
errorClass = '[object Error]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
var toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
suportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
suportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch (e) {
suportNodeClass = true;
}
var shadowedProps = [
'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'
];
var nonEnumProps = {};
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
nonEnumProps[objectClass] = { 'constructor': true };
var support = {};
(function () {
var ctor = function() { this.x = 1; },
props = [];
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var key in new ctor) { props.push(key); }
for (key in arguments) { }
// Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
// Detect if `prototype` properties are enumerable by default.
support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
// Detect if `arguments` object indexes are non-enumerable
support.nonEnumArgs = key != 0;
// Detect if properties shadowing those on `Object.prototype` are non-enumerable.
support.nonEnumShadows = !/valueOf/.test(props);
}(1));
function isObject(value) {
// check if the value is the ECMAScript language type of Object
// http://es5.github.io/#x8
// and avoid a V8 bug
// https://code.google.com/p/v8/issues/detail?id=2291
var type = typeof value;
return value && (type == 'function' || type == 'object') || false;
}
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
}
if (support.nonEnumArgs && object.length && isArguments(object)) {
object = slice.call(object);
}
var skipProto = support.enumPrototypes && typeof object == 'function',
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name'))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var ctor = object.constructor,
index = -1,
length = shadowedProps.length;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
nonEnum = nonEnumProps[className];
}
while (++index < length) {
key = shadowedProps[index];
if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
result.push(key);
}
}
}
return result;
}
function internalFor(object, callback, keysFunc) {
var index = -1,
props = keysFunc(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
}
function internalForIn(object, callback) {
return internalFor(object, callback, keysIn);
}
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
function isArguments(value) {
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
}
// fallback for browsers that can't detect `arguments` objects by [[Class]]
if (!supportsArgsClass) {
isArguments = function(value) {
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
};
}
var isEqual = Rx.internals.isEqual = function (x, y) {
return deepEquals(x, y, [], []);
};
/** @private
* Used for deep comparison
**/
function deepEquals(a, b, stackA, stackB) {
// exit early for identical values
if (a === b) {
// treat `+0` vs. `-0` as not equal
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
// exit early for unlike primitive values
if (a === a && (a == null || b == null ||
(type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) {
return false;
}
// compare [[Class]] names
var className = toString.call(a),
otherClass = toString.call(b);
if (className == argsClass) {
className = objectClass;
}
if (otherClass == argsClass) {
otherClass = objectClass;
}
if (className != otherClass) {
return false;
}
switch (className) {
case boolClass:
case dateClass:
// coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
return +a == +b;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (a != +a) ?
b != +b :
// but treat `-0` vs. `+0` as not equal
(a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass:
case stringClass:
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and their corresponding object instances as equal
return a == String(b);
}
var isArr = className == arrayClass;
if (!isArr) {
// exit for functions and DOM nodes
if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
return false;
}
// in older versions of Opera, `arguments` objects have `Array` constructors
var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
// non `Object` object instances with different constructors are not equal
if (ctorA != ctorB &&
!(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) &&
!(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
('constructor' in a && 'constructor' in b)
) {
return false;
}
}
// assume cyclic structures are equal
// the algorithm for detecting cyclic structures is adapted from ES 5.1
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
var initedStack = !stackA;
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == a) {
return stackB[length] == b;
}
}
var size = 0;
var result = true;
// add `a` and `b` to the stack of traversed objects
stackA.push(a);
stackB.push(b);
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
// compare lengths to determine if a deep comparison is necessary
length = a.length;
size = b.length;
result = size == length;
if (result) {
// deep compare the contents, ignoring non-numeric properties
while (size--) {
var index = length,
value = b[size];
if (!(result = deepEquals(a[size], value, stackA, stackB))) {
break;
}
}
}
}
else {
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
// which, in this case, is more costly
internalForIn(b, function(value, key, b) {
if (hasOwnProperty.call(b, key)) {
// count the number of properties.
size++;
// deep compare each property value.
return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB));
}
});
if (result) {
// ensure both objects have the same number of properties
internalForIn(a, function(value, key, a) {
if (hasOwnProperty.call(a, key)) {
// `size` will be `-1` if `a` has more properties than `b`
return (result = --size > -1);
}
});
}
}
stackA.pop();
stackB.pop();
return result;
}
var slice = Array.prototype.slice;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
var hasProp = {}.hasOwnProperty;
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
var addProperties = Rx.internals.addProperties = function (obj) {
var sources = slice.call(arguments, 1);
for (var i = 0, len = sources.length; i < len; i++) {
var source = sources[i];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
// Collections
function IndexedItem(id, value) {
this.id = id;
this.value = value;
}
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
c === 0 && (c = this.id - other.id);
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) { return; }
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) { return; }
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
+index || (index = 0);
if (index >= this.length || index < 0) { return; }
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () { return this.items[0].value; };
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
delete this.items[this.length];
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
this.disposables = argsOrArray(arguments, 0);
this.isDisposed = false;
this.length = this.disposables.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Converts the existing CompositeDisposable to an array of disposables
* @returns {Array} An array of disposable objects.
*/
CompositeDisposablePrototype.toArray = function () {
return this.disposables.slice(0);
};
/**
* Provides a set of static methods for creating Disposables.
*
* @constructor
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
/** Performs the task of cleaning up resources. */
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function () {
function BooleanDisposable () {
this.isDisposed = false;
this.current = null;
}
var booleanDisposablePrototype = BooleanDisposable.prototype;
/**
* Gets the underlying disposable.
* @return The underlying disposable.
*/
booleanDisposablePrototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
* @param {Disposable} value The new underlying disposable.
*/
booleanDisposablePrototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed, old;
if (!shouldDispose) {
old = this.current;
this.current = value;
}
old && old.dispose();
shouldDispose && value && value.dispose();
};
/**
* Disposes the underlying disposable as well as all future replacements.
*/
booleanDisposablePrototype.dispose = function () {
var old;
if (!this.isDisposed) {
this.isDisposed = true;
old = this.current;
this.current = null;
}
old && old.dispose();
};
return BooleanDisposable;
}());
var SerialDisposable = Rx.SerialDisposable = SingleAssignmentDisposable;
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed) {
if (!this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
if (!this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
ScheduledItem.prototype.invoke = function () {
this.disposable.setDisposable(this.invokeCore());
};
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
timeSpan < 0 && (timeSpan = 0);
return timeSpan;
};
return Scheduler;
}());
var normalizeTime = Scheduler.normalize;
(function (schedulerProto) {
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function scheduleInnerRecursive(action, self) {
action(function(dt) { self(action, dt); });
}
/**
* Schedules an action to be executed recursively.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, function (_action, self) {
_action(function () { self(_action); }); });
};
/**
* Schedules an action to be executed recursively.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState({ first: state, second: action }, invokeRecImmediate);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, action);
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) {
if (typeof root.setInterval === 'undefined') { throw new Error('Periodic scheduling not supported.'); }
var s = state;
var id = root.setInterval(function () {
s = action(s);
}, period);
return disposableCreate(function () {
root.clearInterval(id);
});
};
}(Scheduler.prototype));
/**
* Gets a scheduler that schedules work immediately on the current thread.
*/
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) { return action(this, state); }
function scheduleRelative(state, dueTime, action) {
var dt = normalizeTime(dt);
while (dt - this.now() > 0) { }
return action(this, state);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function runTrampoline (q) {
var item;
while (q.length > 0) {
item = q.dequeue();
if (!item.isCancelled()) {
// Note, do not schedule blocking work!
while (item.dueTime - Scheduler.now() > 0) {
}
if (!item.isCancelled()) {
item.invoke();
}
}
}
}
function scheduleNow(state, action) {
return this.scheduleWithRelativeAndState(state, 0, action);
}
function scheduleRelative(state, dueTime, action) {
var dt = this.now() + Scheduler.normalize(dueTime),
si = new ScheduledItem(this, state, action, dt);
if (!queue) {
queue = new PriorityQueue(4);
queue.enqueue(si);
try {
runTrampoline(queue);
} catch (e) {
throw e;
} finally {
queue = null;
}
} else {
queue.enqueue(si);
}
return si.disposable;
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
currentScheduler.scheduleRequired = function () { return !queue; };
currentScheduler.ensureTrampoline = function (action) {
if (!queue) { this.schedule(action); } else { action(); }
};
return currentScheduler;
}());
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
function SchedulePeriodicRecursive(scheduler, state, period, action) {
this._scheduler = scheduler;
this._state = state;
this._period = period;
this._action = action;
}
SchedulePeriodicRecursive.prototype.start = function () {
var d = new SingleAssignmentDisposable();
this._cancel = d;
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
return d;
};
return SchedulePeriodicRecursive;
}());
var scheduleMethod, clearMethod = noop;
var localTimer = (function () {
var localSetTimeout, localClearTimeout = noop;
if ('WScript' in this) {
localSetTimeout = function (fn, time) {
WScript.Sleep(time);
fn();
};
} else if (!!root.setTimeout) {
localSetTimeout = root.setTimeout;
localClearTimeout = root.clearTimeout;
} else {
throw new Error('No concurrency detected!');
}
return {
setTimeout: localSetTimeout,
clearTimeout: localClearTimeout
};
}());
var localSetTimeout = localTimer.setTimeout,
localClearTimeout = localTimer.clearTimeout;
(function () {
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate,
clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' &&
!reNative.test(clearImmediate) && clearImmediate;
function postMessageSupported () {
// Ensure not in a worker
if (!root.postMessage || root.importScripts) { return false; }
var isAsync = false,
oldHandler = root.onmessage;
// Test for async
root.onmessage = function () { isAsync = true; };
root.postMessage('', '*');
root.onmessage = oldHandler;
return isAsync;
}
// Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout
if (typeof setImmediate === 'function') {
scheduleMethod = setImmediate;
clearMethod = clearImmediate;
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = process.nextTick;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
var handleId = event.data.substring(MSG_PREFIX.length),
action = tasks[handleId];
action();
delete tasks[handleId];
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else {
root.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var currentId = taskId++;
tasks[currentId] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel(),
channelTasks = {},
channelTaskId = 0;
channel.port1.onmessage = function (event) {
var id = event.data,
action = channelTasks[id];
action();
delete channelTasks[id];
};
scheduleMethod = function (action) {
var id = channelTaskId++;
channelTasks[id] = action;
channel.port2.postMessage(id);
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
scriptElement.onreadystatechange = function () {
action();
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
};
} else {
scheduleMethod = function (action) { return localSetTimeout(action, 0); };
clearMethod = localClearTimeout;
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = (function () {
function scheduleNow(state, action) {
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this,
dt = Scheduler.normalize(dueTime);
if (dt === 0) {
return scheduler.scheduleWithState(state, action);
}
var disposable = new SingleAssignmentDisposable();
var id = localSetTimeout(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
localClearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, hasValue) {
this.hasValue = hasValue == null ? false : hasValue;
this.kind = kind;
}
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
return observerOrOnNext && typeof observerOrOnNext === 'object' ?
this._acceptObservable(observerOrOnNext) :
this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notifications
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
Notification.prototype.toObservable = function (scheduler) {
var notification = this;
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
notification._acceptObservable(observer);
notification.kind === 'N' && observer.onCompleted();
});
});
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept (onNext) { return onNext(this.value); }
function _acceptObservable(observer) { return observer.onNext(this.value); }
function toString () { return 'OnNext(' + this.value + ')'; }
return function (value) {
var notification = new Notification('N', true);
notification.value = value;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) { return onError(this.exception); }
function _acceptObservable(observer) { return observer.onError(this.exception); }
function toString () { return 'OnError(' + this.exception + ')'; }
return function (e) {
var notification = new Notification('E');
notification.exception = e;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) { return onCompleted(); }
function _acceptObservable(observer) { return observer.onCompleted(); }
function toString () { return 'OnCompleted()'; }
return function () {
var notification = new Notification('C');
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
var Enumerator = Rx.internals.Enumerator = function (next) {
this._next = next;
};
Enumerator.prototype.next = function () {
return this._next();
};
Enumerator.prototype[$iterator$] = function () { return this; }
var Enumerable = Rx.internals.Enumerable = function (iterator) {
this._iterator = iterator;
};
Enumerable.prototype[$iterator$] = function () {
return this._iterator();
};
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch (err) {
observer.onError();
return;
}
var isDisposed,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var currentItem;
if (isDisposed) { return; }
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
observer.onCompleted();
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () { self(); })
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchError = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch (err) {
observer.onError();
return;
}
var isDisposed,
lastException,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
var currentItem;
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
if (lastException) {
observer.onError(lastException);
} else {
observer.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
function (exn) {
lastException = exn;
self();
},
observer.onCompleted.bind(observer)));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
if (repeatCount == null) { repeatCount = -1; }
return new Enumerable(function () {
var left = repeatCount;
return new Enumerator(function () {
if (left === 0) { return doneEnumerator; }
if (left > 0) { left--; }
return { done: false, value: value };
});
});
};
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
selector || (selector = identity);
return new Enumerable(function () {
var index = -1;
return new Enumerator(
function () {
return ++index < source.length ?
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
doneEnumerator;
});
});
};
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) { return n.accept(observer); };
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler, thisArg) {
return new AnonymousObserver(function (x) {
return handler.call(thisArg, notificationCreateOnNext(x));
}, function (e) {
return handler.call(thisArg, notificationCreateOnError(e));
}, function () {
return handler.call(thisArg, notificationCreateOnCompleted());
});
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {
inherits(AbstractObserver, __super__);
/**
* Creates a new observer in a non-stopped state.
*/
function AbstractObserver() {
this.isStopped = false;
__super__.call(this);
}
/**
* Notifies the observer of a new element in the sequence.
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) { this.next(value); }
};
/**
* Notifies the observer that an exception has occurred.
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.error(e);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) {
inherits(AnonymousObserver, __super__);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
__super__.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
* @param {Any} error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (error) {
this._onError(error);
};
/**
* Calls the onCompleted action.
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
function Observable(subscribe) {
this._subscribe = subscribe;
}
observableProto = Observable.prototype;
/**
* Subscribes an observer to the observable sequence.
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
return this._subscribe(typeof observerOrOnNext === 'object' ?
observerOrOnNext :
observerCreate(observerOrOnNext, onError, onCompleted));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnNext = function (onNext, thisArg) {
return this._subscribe(observerCreate(arguments.length === 2 ? function(x) { onNext.call(thisArg, x); } : onNext));
};
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnError = function (onError, thisArg) {
return this._subscribe(observerCreate(null, arguments.length === 2 ? function(e) { onError.call(thisArg, e); } : onError));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {
return this._subscribe(observerCreate(null, null, arguments.length === 2 ? function() { onCompleted.call(thisArg); } : onCompleted));
};
return Observable;
})();
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) {
inherits(ScheduledObserver, __super__);
function ScheduledObserver(scheduler, observer) {
__super__.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () {
self.observer.onNext(value);
});
};
ScheduledObserver.prototype.error = function (err) {
var self = this;
this.queue.push(function () {
self.observer.onError(err);
});
};
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () {
self.observer.onCompleted();
});
};
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false, parent = this;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
try {
work();
} catch (ex) {
parent.queue = [];
parent.hasFaulted = true;
throw ex;
}
self();
}));
}
};
ScheduledObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
/**
* Creates an array from an observable sequence.
* @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
var self = this;
return new AnonymousObservable(function(observer) {
var arr = [];
return self.subscribe(
arr.push.bind(arr),
observer.onError.bind(observer),
function () {
observer.onNext(arr);
observer.onCompleted();
});
});
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* var res = Rx.Observable.create(function (observer) { return function () { } );
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* var res = Rx.Observable.create(function (observer) { } );
*
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = Observable.createWithDisposable = function (subscribe) {
return new AnonymousObservable(subscribe);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
isPromise(result) && (result = observableFromPromise(result));
return result.subscribe(observer);
});
};
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* var res = Rx.Observable.empty();
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onCompleted();
});
});
};
var maxSafeInteger = Math.pow(2, 53) - 1;
function StringIterable(str) {
this._s = s;
}
StringIterable.prototype[$iterator$] = function () {
return new StringIterator(this._s);
};
function StringIterator(str) {
this._s = s;
this._l = s.length;
this._i = 0;
}
StringIterator.prototype[$iterator$] = function () {
return this;
};
StringIterator.prototype.next = function () {
if (this._i < this._l) {
var val = this._s.charAt(this._i++);
return { done: false, value: val };
} else {
return doneEnumerator;
}
};
function ArrayIterable(a) {
this._a = a;
}
ArrayIterable.prototype[$iterator$] = function () {
return new ArrayIterator(this._a);
};
function ArrayIterator(a) {
this._a = a;
this._l = toLength(a);
this._i = 0;
}
ArrayIterator.prototype[$iterator$] = function () {
return this;
};
ArrayIterator.prototype.next = function () {
if (this._i < this._l) {
var val = this._a[this._i++];
return { done: false, value: val };
} else {
return doneEnumerator;
}
};
function numberIsFinite(value) {
return typeof value === 'number' && root.isFinite(value);
}
function isNan(n) {
return n !== n;
}
function getIterable(o) {
var i = o[$iterator$], it;
if (!i && typeof o === 'string') {
it = new StringIterable(o);
return it[$iterator$]();
}
if (!i && o.length !== undefined) {
it = new ArrayIterable(o);
return it[$iterator$]();
}
if (!i) { throw new TypeError('Object is not iterable'); }
return o[$iterator$]();
}
function sign(value) {
var number = +value;
if (number === 0) { return number; }
if (isNaN(number)) { return number; }
return number < 0 ? -1 : 1;
}
function toLength(o) {
var len = +o.length;
if (isNaN(len)) { return 0; }
if (len === 0 || !numberIsFinite(len)) { return len; }
len = sign(len) * Math.floor(Math.abs(len));
if (len <= 0) { return 0; }
if (len > maxSafeInteger) { return maxSafeInteger; }
return len;
}
/**
* This method creates a new Observable sequence from an array-like or iterable object.
* @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.
* @param {Function} [mapFn] Map function to call on every element of the array.
* @param {Any} [thisArg] The context to use calling the mapFn if provided.
* @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
*/
var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isFunction(mapFn)) {
throw new Error('mapFn when provided must be a function');
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
var list = Object(iterable), it = getIterable(list);
return new AnonymousObservable(function (observer) {
var i = 0;
return scheduler.scheduleRecursive(function (self) {
var next;
try {
next = it.next();
} catch (e) {
observer.onError(e);
return;
}
if (next.done) {
observer.onCompleted();
return;
}
var result = next.value;
if (mapFn && isFunction(mapFn)) {
try {
result = mapFn.call(thisArg, result, i);
} catch (e) {
observer.onError(e);
return;
}
}
observer.onNext(result);
i++;
self();
});
});
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
* @deprecated use Observable.from or Observable.of
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
deprecate('fromArray', 'from');
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0, len = array.length;
return scheduler.scheduleRecursive(function (self) {
if (count < len) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new AnonymousObservable(function () {
return disposableEmpty;
});
};
function observableOf (scheduler, array) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0, len = array.length;
return scheduler.scheduleRecursive(function (self) {
if (count < len) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
}
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.of = function () {
return observableOf(null, arguments);
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.ofWithScheduler = function (scheduler) {
return observableOf(scheduler, slice.call(arguments, 1));
};
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.range(0, 10);
* var res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout);
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleRecursiveWithState(0, function (i, self) {
if (i < count) {
observer.onNext(start + i);
self(i + 1);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.repeat(42);
* var res = Rx.Observable.repeat(42, 4);
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return observableReturn(value, scheduler).repeat(repeatCount == null ? -1 : repeatCount);
};
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'just', and 'returnValue' for browsers <IE9.
*
* @example
* var res = Rx.Observable.return(42);
* var res = Rx.Observable.return(42, Rx.Scheduler.timeout);
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onNext(value);
observer.onCompleted();
});
});
};
/** @deprecated use return or just */
Observable.returnValue = function () {
deprecate('returnValue', 'return or just');
return observableReturn.apply(null, arguments);
};
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwError' for browsers <IE9.
* @param {Mixed} exception An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable['throw'] = Observable.throwException = Observable.throwError = function (exception, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onError(exception);
});
});
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (observer) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) {
var d, result;
try {
result = handler(exception);
} catch (ex) {
observer.onError(ex);
return;
}
isPromise(result) && (result = observableFromPromise(result));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(observer));
}, observer.onCompleted.bind(observer)));
return subscription;
});
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto['catch'] = observableProto.catchError = function (handlerOrSecond) {
return typeof handlerOrSecond === 'function' ?
observableCatchHandler(this, handlerOrSecond) :
observableCatch([this, handlerOrSecond]);
};
/**
* @deprecated use #catch or #catchError instead.
*/
observableProto.catchException = function (handlerOrSecond) {
deprecate('catchException', 'catch or catchError');
return this.catchError(handlerOrSecond);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchError = Observable['catch'] = function () {
return enumerableOf(argsOrArray(arguments, 0)).catchError();
};
/**
* @deprecated use #catch or #catchError instead.
*/
Observable.catchException = function () {
deprecate('catchException', 'catch or catchError');
return observableCatch.apply(null, arguments);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var args = slice.call(arguments);
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var args = slice.call(arguments), resultSelector = args.pop();
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
}
function done (i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
values[i] = x;
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
*
* @example
* 1 - concatenated = xs.concat(ys, zs);
* 2 - concatenated = xs.concat([ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
var items = slice.call(arguments, 0);
items.unshift(this);
return observableConcat.apply(this, items);
};
/**
* Concatenates all the observable sequences.
* @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
return enumerableOf(argsOrArray(arguments, 0)).concat();
};
/**
* Concatenates an observable sequence of observable sequences.
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatAll = function () {
return this.merge(1);
};
/** @deprecated Use `concatAll` instead. */
observableProto.concatObservable = function () {
deprecate('concatObservable', 'concatAll');
return this.merge(1);
};
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
if (typeof maxConcurrentOrOther !== 'number') { return observableMerge(this, maxConcurrentOrOther); }
var sources = this;
return new AnonymousObservable(function (observer) {
var activeCount = 0, group = new CompositeDisposable(), isStopped = false, q = [];
function subscribe(xs) {
var subscription = new SingleAssignmentDisposable();
group.add(subscription);
// Check for promises support
isPromise(xs) && (xs = observableFromPromise(xs));
subscription.setDisposable(xs.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
group.remove(subscription);
if (q.length > 0) {
subscribe(q.shift());
} else {
activeCount--;
isStopped && activeCount === 0 && observer.onCompleted();
}
}));
}
group.add(sources.subscribe(function (innerSource) {
if (activeCount < maxConcurrentOrOther) {
activeCount++;
subscribe(innerSource);
} else {
q.push(innerSource);
}
}, observer.onError.bind(observer), function () {
isStopped = true;
activeCount === 0 && observer.onCompleted();
}));
return group;
});
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
*
* @example
* 1 - merged = Rx.Observable.merge(xs, ys, zs);
* 2 - merged = Rx.Observable.merge([xs, ys, zs]);
* 3 - merged = Rx.Observable.merge(scheduler, xs, ys, zs);
* 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]);
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources;
if (!arguments[0]) {
scheduler = immediateScheduler;
sources = slice.call(arguments, 1);
} else if (arguments[0].now) {
scheduler = arguments[0];
sources = slice.call(arguments, 1);
} else {
scheduler = immediateScheduler;
sources = slice.call(arguments, 0);
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableOf(scheduler, sources).mergeAll();
};
/**
* Merges an observable sequence of observable sequences into an observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeAll = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable(),
isStopped = false,
m = new SingleAssignmentDisposable();
group.add(m);
m.setDisposable(sources.subscribe(function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
// Check for promises support
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
group.remove(innerSubscription);
isStopped && group.length === 1 && observer.onCompleted();
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
group.length === 1 && observer.onCompleted();
}));
return group;
});
};
/**
* @deprecated use #mergeAll instead.
*/
observableProto.mergeObservable = function () {
deprecate('mergeObservable', 'mergeAll');
return this.mergeAll.apply(this, arguments);
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
isOpen && observer.onNext(left);
}, observer.onError.bind(observer), function () {
isOpen && observer.onCompleted();
}));
isPromise(other) && (other = observableFromPromise(other));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, observer.onError.bind(observer), function () {
rightSubscription.dispose();
}));
return disposables;
});
};
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto['switch'] = observableProto.switchLatest = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasLatest = false,
innerSubscription = new SerialDisposable(),
isStopped = false,
latest = 0,
subscription = sources.subscribe(
function (innerSource) {
var d = new SingleAssignmentDisposable(), id = ++latest;
hasLatest = true;
innerSubscription.setDisposable(d);
// Check if Promise or Observable
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
d.setDisposable(innerSource.subscribe(
function (x) { latest === id && observer.onNext(x); },
function (e) { latest === id && observer.onError(e); },
function () {
if (latest === id) {
hasLatest = false;
isStopped && observer.onCompleted();
}
}));
},
observer.onError.bind(observer),
function () {
isStopped = true;
!hasLatest && observer.onCompleted();
});
return new CompositeDisposable(subscription, innerSubscription);
});
};
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
isPromise(other) && (other = observableFromPromise(other));
return new CompositeDisposable(
source.subscribe(observer),
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
);
});
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) {
return zipArray.apply(this, arguments);
}
var parent = this, sources = slice.call(arguments), resultSelector = sources.pop();
sources.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
var res, queuedValues;
if (queues.every(function (x) { return x.length > 0; })) {
try {
queuedValues = queues.map(function (x) { return x.shift(); });
res = resultSelector.apply(parent, queuedValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = sources[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
* @param arguments Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function () {
var args = slice.call(arguments, 0), first = args.shift();
return first.zip.apply(first, args);
};
/**
* Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
* @param arguments Observable sources.
* @returns {Observable} An observable sequence containing lists of elements at corresponding indexes.
*/
Observable.zipArray = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
return;
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
return;
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
var compositeDisposable = new CompositeDisposable(subscriptions);
compositeDisposable.add(disposableCreate(function () {
for (var qIdx = 0, qLen = queues.length; qIdx < qLen; qIdx++) { queues[qIdx] = []; }
}));
return compositeDisposable;
});
};
/**
* Hides the identity of an observable sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
return new AnonymousObservable(this.subscribe.bind(this));
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
return x.accept(observer);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* var obs = observable.distinctUntilChanged();
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
keySelector || (keySelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var comparerEquals = false, key;
try {
key = keySelector(value);
} catch (exception) {
observer.onError(exception);
return;
}
if (hasCurrentKey) {
try {
comparerEquals = comparer(currentKey, key);
} catch (exception) {
observer.onError(exception);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto['do'] = observableProto.tap = function (observerOrOnNext, onError, onCompleted) {
var source = this, onNextFunc;
if (typeof observerOrOnNext === 'function') {
onNextFunc = observerOrOnNext;
} else {
onNextFunc = observerOrOnNext.onNext.bind(observerOrOnNext);
onError = observerOrOnNext.onError.bind(observerOrOnNext);
onCompleted = observerOrOnNext.onCompleted.bind(observerOrOnNext);
}
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
try {
onNextFunc(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (err) {
if (onError) {
try {
onError(err);
} catch (e) {
observer.onError(e);
}
}
observer.onError(err);
}, function () {
if (onCompleted) {
try {
onCompleted();
} catch (e) {
observer.onError(e);
}
}
observer.onCompleted();
});
});
};
/** @deprecated use #do or #tap instead. */
observableProto.doAction = function () {
deprecate('doAction', 'do or tap');
return this.tap.apply(this, arguments);
};
/**
* Invokes an action for each element in the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onNext Action to invoke for each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {
return this.tap(arguments.length === 2 ? function (x) { onNext.call(thisArg, x); } : onNext);
};
/**
* Invokes an action upon exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {
return this.tap(noop, arguments.length === 2 ? function (e) { onError.call(thisArg, e); } : onError);
};
/**
* Invokes an action upon graceful termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {
return this.tap(noop, null, arguments.length === 2 ? function () { onCompleted.call(thisArg); } : onCompleted);
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto['finally'] = observableProto.ensure = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription;
try {
subscription = source.subscribe(observer);
} catch (e) {
action();
throw e;
}
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
});
};
/**
* @deprecated use #finally or #ensure instead.
*/
observableProto.finallyAction = function (action) {
deprecate('finallyAction', 'finally or ensure');
return this.ensure(action);
};
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (e) {
observer.onNext(notificationCreateOnError(e));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
});
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
* Note if you encounter an error and want it to retry once, then you must use .retry(2);
*
* @example
* var res = retried = retry.repeat();
* var res = retried = retry.repeat(2);
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchError();
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @example
* var res = source.scan(function (acc, x) { return acc + x; });
* var res = source.scan(0, function (acc, x) { return acc + x; });
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var hasSeed = false, seed, accumulator, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (observer) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
!hasValue && (hasValue = true);
try {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(accumulation);
},
observer.onError.bind(observer),
function () {
!hasValue && hasSeed && observer.onNext(seed);
observer.onCompleted();
}
);
});
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
* @description
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && observer.onNext(q.shift());
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
* @example
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
* @param {Arguments} args The specified values to prepend to the observable sequence
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && isScheduler(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
values = slice.call(arguments, start);
return enumerableOf([observableFromArray(values, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence.
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, observer.onError.bind(observer), function () {
while (q.length > 0) { observer.onNext(q.shift()); }
observer.onCompleted();
});
});
};
function concatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).concatAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
if (isFunction(selector) && isFunction(resultSelector)) {
return this.concatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
});
}
return isFunction(selector) ?
concatMap(this, selector, thisArg) :
concatMap(this, function () { return selector; });
};
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.select = observableProto.map = function (selector, thisArg) {
var selectorFn = isFunction(selector) ? selector : function () { return selector; },
source = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return source.subscribe(function (value) {
var result;
try {
result = selectorFn.call(thisArg, value, count++, source);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Retrieves the value of a specified property from all elements in the Observable sequence.
* @param {String} prop The property to pluck.
* @returns {Observable} Returns a new Observable sequence of property values.
*/
observableProto.pluck = function (prop) {
return this.map(function (x) { return x[prop]; });
};
function flatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).mergeAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
if (isFunction(selector) && isFunction(resultSelector)) {
return this.flatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
}, thisArg);
}
return isFunction(selector) ?
flatMap(this, selector, thisArg) :
flatMap(this, function () { return selector; });
};
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function (selector, thisArg) {
return this.select(selector, thisArg).switchLatest();
};
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) { throw new Error(argumentOutOfRange); }
var source = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return source.subscribe(function (x) {
if (remaining <= 0) {
observer.onNext(x);
} else {
remaining--;
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* var res = source.skipWhile(function (value) { return value < 10; });
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !predicate.call(thisArg, x, i++, source);
} catch (e) {
observer.onError(e);
return;
}
}
running && observer.onNext(x);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* var res = source.take(5);
* var res = source.take(0, Rx.Scheduler.timeout);
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) { throw new RangeError(argumentOutOfRange); }
if (count === 0) { return observableEmpty(scheduler); }
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining-- > 0) {
observer.onNext(x);
remaining === 0 && observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var observable = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = true;
return observable.subscribe(function (x) {
if (running) {
try {
running = predicate.call(thisArg, x, i++, observable);
} catch (e) {
observer.onError(e);
return;
}
if (running) {
observer.onNext(x);
} else {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
*
* @example
* var res = source.where(function (value) { return value < 10; });
* var res = source.where(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.where = observableProto.filter = function (predicate, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, value, count++, parent);
} catch (e) {
observer.onError(e);
return;
}
shouldRun && observer.onNext(value);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
Observable.fromCallback = function (func, context, selector) {
return function () {
var args = slice.call(arguments, 0);
return new AnonymousObservable(function (observer) {
function handler(e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
observer.onError(err);
return;
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
Observable.fromNodeCallback = function (func, context, selector) {
return function () {
var args = slice.call(arguments, 0);
return new AnonymousObservable(function (observer) {
function handler(err) {
if (err) {
observer.onError(err);
return;
}
var results = slice.call(arguments, 1);
if (selector) {
try {
results = selector(results);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
function createListener (element, name, handler) {
if (element.addEventListener) {
element.addEventListener(name, handler, false);
return disposableCreate(function () {
element.removeEventListener(name, handler, false);
});
}
throw new Error('No listener found');
}
function createEventListener (el, eventName, handler) {
var disposables = new CompositeDisposable();
// Asume NodeList
if (Object.prototype.toString.call(el) === '[object NodeList]') {
for (var i = 0, len = el.length; i < len; i++) {
disposables.add(createEventListener(el.item(i), eventName, handler));
}
} else if (el) {
disposables.add(createListener(el, eventName, handler));
}
return disposables;
}
/**
* Configuration option to determine whether to use native events only
*/
Rx.config.useNativeEvents = false;
// Check for Angular/jQuery/Zepto support
var jq =
!!root.angular && !!angular.element ? angular.element :
(!!root.jQuery ? root.jQuery : (
!!root.Zepto ? root.Zepto : null));
// Check for ember
var ember = !!root.Ember && typeof root.Ember.addListener === 'function';
// Check for Backbone.Marionette. Note if using AMD add Marionette as a dependency of rxjs
// for proper loading order!
var marionette = !!root.Backbone && !!root.Backbone.Marionette;
/**
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
*
* @example
* var source = Rx.Observable.fromEvent(element, 'mouseup');
*
* @param {Object} element The DOMElement or NodeList to attach a listener.
* @param {String} eventName The event name to attach the observable sequence.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
*/
Observable.fromEvent = function (element, eventName, selector) {
// Node.js specific
if (element.addListener) {
return fromEventPattern(
function (h) { element.addListener(eventName, h); },
function (h) { element.removeListener(eventName, h); },
selector);
}
// Use only if non-native events are allowed
if (!Rx.config.useNativeEvents) {
if (marionette) {
return fromEventPattern(
function (h) { element.on(eventName, h); },
function (h) { element.off(eventName, h); },
selector);
}
if (ember) {
return fromEventPattern(
function (h) { Ember.addListener(element, eventName, h); },
function (h) { Ember.removeListener(element, eventName, h); },
selector);
}
if (jq) {
var $elem = jq(element);
return fromEventPattern(
function (h) { $elem.on(eventName, h); },
function (h) { $elem.off(eventName, h); },
selector);
}
}
return new AnonymousObservable(function (observer) {
return createEventListener(
element,
eventName,
function handler (e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
observer.onError(err);
return
}
}
observer.onNext(results);
});
}).publish().refCount();
};
/**
* Creates an observable sequence from an event emitter via an addHandler/removeHandler pair.
* @param {Function} addHandler The function to add a handler to the emitter.
* @param {Function} [removeHandler] The optional function to remove a handler from an emitter.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
return new AnonymousObservable(function (observer) {
function innerHandler (e) {
var result = e;
if (selector) {
try {
result = selector(arguments);
} catch (err) {
observer.onError(err);
return;
}
}
observer.onNext(result);
}
var returnValue = addHandler(innerHandler);
return disposableCreate(function () {
if (removeHandler) {
removeHandler(innerHandler, returnValue);
}
});
}).publish().refCount();
};
/**
* Converts a Promise to an Observable sequence
* @param {Promise} An ES6 Compliant promise.
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
*/
var observableFromPromise = Observable.fromPromise = function (promise) {
return observableDefer(function () {
var subject = new Rx.AsyncSubject();
promise.then(
function (value) {
if (!subject.isDisposed) {
subject.onNext(value);
subject.onCompleted();
}
},
subject.onError.bind(subject));
return subject;
});
};
/*
* Converts an existing observable sequence to an ES6 Compatible Promise
* @example
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
*
* // With config
* Rx.config.Promise = RSVP.Promise;
* var promise = Rx.Observable.return(42).toPromise();
* @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.
* @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.
*/
observableProto.toPromise = function (promiseCtor) {
promiseCtor || (promiseCtor = Rx.config.Promise);
if (!promiseCtor) { throw new TypeError('Promise type not provided nor in Rx.config.Promise'); }
var source = this;
return new promiseCtor(function (resolve, reject) {
// No cancellation can be done
var value, hasValue = false;
source.subscribe(function (v) {
value = v;
hasValue = true;
}, reject, function () {
hasValue && resolve(value);
});
});
};
/**
* Invokes the asynchronous function, surfacing the result through an observable sequence.
* @param {Function} functionAsync Asynchronous function which returns a Promise to run.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*/
Observable.startAsync = function (functionAsync) {
var promise;
try {
promise = functionAsync();
} catch (e) {
return observableThrow(e);
}
return observableFromPromise(promise);
}
/**
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
* subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
* invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param {Function|Subject} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
* Or:
* Subject to push source elements into.
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.multicast = function (subjectOrSubjectSelector, selector) {
var source = this;
return typeof subjectOrSubjectSelector === 'function' ?
new AnonymousObservable(function (observer) {
var connectable = source.multicast(subjectOrSubjectSelector());
return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect());
}) :
new ConnectableObservable(source, subjectOrSubjectSelector);
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of Multicast using a regular Subject.
*
* @example
* var resres = source.publish();
* var res = source.publish(function (x) { return x; });
*
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publish = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new Subject(); }, selector) :
this.multicast(new Subject());
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.share();
*
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.share = function () {
return this.publish().refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
* This operator is a specialization of Multicast using a AsyncSubject.
*
* @example
* var res = source.publishLast();
* var res = source.publishLast(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishLast = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new AsyncSubject(); }, selector) :
this.multicast(new AsyncSubject());
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
* This operator is a specialization of Multicast using a BehaviorSubject.
*
* @example
* var res = source.publishValue(42);
* var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishValue = function (initialValueOrSelector, initialValue) {
return arguments.length === 2 ?
this.multicast(function () {
return new BehaviorSubject(initialValue);
}, initialValueOrSelector) :
this.multicast(new BehaviorSubject(initialValueOrSelector));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareValue(42);
*
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareValue = function (initialValue) {
return this.publishValue(initialValue).refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of Multicast using a ReplaySubject.
*
* @example
* var res = source.replay(null, 3);
* var res = source.replay(null, 3, 500);
* var res = source.replay(null, 3, 500, scheduler);
* var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.replay = function (selector, bufferSize, window, scheduler) {
return selector && isFunction(selector) ?
this.multicast(function () { return new ReplaySubject(bufferSize, window, scheduler); }, selector) :
this.multicast(new ReplaySubject(bufferSize, window, scheduler));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareReplay(3);
* var res = source.shareReplay(3, 500);
* var res = source.shareReplay(3, 500, scheduler);
*
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareReplay = function (bufferSize, window, scheduler) {
return this.replay(null, bufferSize, window, scheduler).refCount();
};
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
inherits(ConnectableObservable, __super__);
function ConnectableObservable(source, subject) {
var hasSubscription = false,
subscription,
sourceObservable = source.asObservable();
this.connect = function () {
if (!hasSubscription) {
hasSubscription = true;
subscription = new CompositeDisposable(sourceObservable.subscribe(subject), disposableCreate(function () {
hasSubscription = false;
}));
}
return subscription;
};
__super__.call(this, subject.subscribe.bind(subject));
}
ConnectableObservable.prototype.refCount = function () {
var connectableSubscription, count = 0, source = this;
return new AnonymousObservable(function (observer) {
var shouldConnect = ++count === 1,
subscription = source.subscribe(observer);
shouldConnect && (connectableSubscription = source.connect());
return function () {
subscription.dispose();
--count === 0 && connectableSubscription.dispose();
};
});
};
return ConnectableObservable;
}(Observable));
function observableTimerDate(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithAbsolute(dueTime, function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerDateAndPeriod(dueTime, period, scheduler) {
return new AnonymousObservable(function (observer) {
var count = 0, d = dueTime, p = normalizeTime(period);
return scheduler.scheduleRecursiveWithAbsolute(d, function (self) {
if (p > 0) {
var now = scheduler.now();
d = d + p;
d <= now && (d = now + p);
}
observer.onNext(count++);
self(d);
});
});
}
function observableTimerTimeSpan(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithRelative(normalizeTime(dueTime), function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) {
return dueTime === period ?
new AnonymousObservable(function (observer) {
return scheduler.schedulePeriodicWithState(0, period, function (count) {
observer.onNext(count);
return count + 1;
});
}) :
observableDefer(function () {
return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler);
});
}
/**
* Returns an observable sequence that produces a value after each period.
*
* @example
* 1 - res = Rx.Observable.interval(1000);
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
*
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @returns {Observable} An observable sequence that produces a value after each period.
*/
var observableinterval = Observable.interval = function (period, scheduler) {
return observableTimerTimeSpanAndPeriod(period, period, isScheduler(scheduler) ? scheduler : timeoutScheduler);
};
/**
* Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/
var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {
var period;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (periodOrScheduler !== undefined && typeof periodOrScheduler === 'number') {
period = periodOrScheduler;
} else if (isScheduler(periodOrScheduler)) {
scheduler = periodOrScheduler;
}
if (dueTime instanceof Date && period === undefined) {
return observableTimerDate(dueTime.getTime(), scheduler);
}
if (dueTime instanceof Date && period !== undefined) {
period = periodOrScheduler;
return observableTimerDateAndPeriod(dueTime.getTime(), period, scheduler);
}
return period === undefined ?
observableTimerTimeSpan(dueTime, scheduler) :
observableTimerTimeSpanAndPeriod(dueTime, period, scheduler);
};
function observableDelayTimeSpan(source, dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
var active = false,
cancelable = new SerialDisposable(),
exception = null,
q = [],
running = false,
subscription;
subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) {
var d, shouldRun;
if (notification.value.kind === 'E') {
q = [];
q.push(notification);
exception = notification.value.exception;
shouldRun = !running;
} else {
q.push({ value: notification.value, timestamp: notification.timestamp + dueTime });
shouldRun = !active;
active = true;
}
if (shouldRun) {
if (exception !== null) {
observer.onError(exception);
} else {
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleRecursiveWithRelative(dueTime, function (self) {
var e, recurseDueTime, result, shouldRecurse;
if (exception !== null) {
return;
}
running = true;
do {
result = null;
if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) {
result = q.shift().value;
}
if (result !== null) {
result.accept(observer);
}
} while (result !== null);
shouldRecurse = false;
recurseDueTime = 0;
if (q.length > 0) {
shouldRecurse = true;
recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now());
} else {
active = false;
}
e = exception;
running = false;
if (e !== null) {
observer.onError(e);
} else if (shouldRecurse) {
self(recurseDueTime);
}
}));
}
}
});
return new CompositeDisposable(subscription, cancelable);
});
}
function observableDelayDate(source, dueTime, scheduler) {
return observableDefer(function () {
return observableDelayTimeSpan(source, dueTime - scheduler.now(), scheduler);
});
}
/**
* Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved.
*
* @example
* 1 - res = Rx.Observable.delay(new Date());
* 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout);
*
* 3 - res = Rx.Observable.delay(5000);
* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delay = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return dueTime instanceof Date ?
observableDelayDate(this, dueTime.getTime(), scheduler) :
observableDelayTimeSpan(this, dueTime, scheduler);
};
/**
* Ignores values from an observable sequence which are followed by another value before dueTime.
* @param {Number} dueTime Duration of the debounce period for each value (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the debounce timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The debounced sequence.
*/
observableProto.debounce = observableProto.throttleWithTimeout = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var cancelable = new SerialDisposable(), hasvalue = false, value, id = 0;
var subscription = source.subscribe(
function (x) {
hasvalue = true;
value = x;
id++;
var currentId = id,
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleWithRelative(dueTime, function () {
hasvalue && id === currentId && observer.onNext(value);
hasvalue = false;
}));
},
function (e) {
cancelable.dispose();
observer.onError(e);
hasvalue = false;
id++;
},
function () {
cancelable.dispose();
hasvalue && observer.onNext(value);
observer.onCompleted();
hasvalue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* @deprecated use #debounce or #throttleWithTimeout instead.
*/
observableProto.throttle = function(dueTime, scheduler) {
deprecate('throttle', 'debounce or throttleWithTimeout');
return this.debounce(dueTime, scheduler);
};
/**
* Records the timestamp for each value in an observable sequence.
*
* @example
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
* 2 - res = source.timestamp(Rx.Scheduler.timeout);
*
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with timestamp information on values.
*/
observableProto.timestamp = function (scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return this.map(function (x) {
return { value: x, timestamp: scheduler.now() };
});
};
function sampleObservable(source, sampler) {
return new AnonymousObservable(function (observer) {
var atEnd, value, hasValue;
function sampleSubscribe() {
if (hasValue) {
hasValue = false;
observer.onNext(value);
}
atEnd && observer.onCompleted();
}
return new CompositeDisposable(
source.subscribe(function (newValue) {
hasValue = true;
value = newValue;
}, observer.onError.bind(observer), function () {
atEnd = true;
}),
sampler.subscribe(sampleSubscribe, observer.onError.bind(observer), sampleSubscribe)
);
});
}
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
observableProto.sample = observableProto.throttleLatest = function (intervalOrSampler, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return typeof intervalOrSampler === 'number' ?
sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :
sampleObservable(this, intervalOrSampler);
};
/**
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeout = function (dueTime, other, scheduler) {
(other == null || typeof other === 'string') && (other = observableThrow(new Error(other || 'Timeout')));
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = dueTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (observer) {
var id = 0,
original = new SingleAssignmentDisposable(),
subscription = new SerialDisposable(),
switched = false,
timer = new SerialDisposable();
subscription.setDisposable(original);
function createTimer() {
var myId = id;
timer.setDisposable(scheduler[schedulerMethod](dueTime, function () {
if (id === myId) {
isPromise(other) && (other = observableFromPromise(other));
subscription.setDisposable(other.subscribe(observer));
}
}));
}
createTimer();
original.setDisposable(source.subscribe(function (x) {
if (!switched) {
id++;
observer.onNext(x);
createTimer();
}
}, function (e) {
if (!switched) {
id++;
observer.onError(e);
}
}, function () {
if (!switched) {
id++;
observer.onCompleted();
}
}));
return new CompositeDisposable(subscription, timer);
});
};
/**
* Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.
* @param {Number} windowDuration time to wait before emitting another item after emitting the last item
* @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.
* @returns {Observable} An Observable that performs the throttle operation.
*/
observableProto.throttleFirst = function (windowDuration, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var duration = +windowDuration || 0;
if (duration <= 0) { throw new RangeError('windowDuration cannot be less or equal zero.'); }
var source = this;
return new AnonymousObservable(function (observer) {
var lastOnNext = 0;
return source.subscribe(
function (x) {
var now = scheduler.now();
if (lastOnNext === 0 || now - lastOnNext >= duration) {
lastOnNext = now;
observer.onNext(x);
}
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer)
);
});
};
var PausableObservable = (function (_super) {
inherits(PausableObservable, _super);
function subscribe(observer) {
var conn = this.source.publish(),
subscription = conn.subscribe(observer),
connection = disposableEmpty;
var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {
if (b) {
connection = conn.connect();
} else {
connection.dispose();
connection = disposableEmpty;
}
});
return new CompositeDisposable(subscription, connection, pausable);
}
function PausableObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
_super.call(this, subscribe);
}
PausableObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausable(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausable = function (pauser) {
return new PausableObservable(this, pauser);
};
function combineLatestSource(source, subject, resultSelector) {
return new AnonymousObservable(function (observer) {
var hasValue = [false, false],
hasValueAll = false,
isDone = false,
values = new Array(2),
err;
function next(x, i) {
values[i] = x
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
if (err) {
observer.onError(err);
return;
}
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
}
if (isDone && values[1]) {
observer.onCompleted();
}
}
return new CompositeDisposable(
source.subscribe(
function (x) {
next(x, 0);
},
function (e) {
if (values[1]) {
observer.onError(e);
} else {
err = e;
}
},
function () {
isDone = true;
values[1] && observer.onCompleted();
}),
subject.subscribe(
function (x) {
next(x, 1);
},
observer.onError.bind(observer),
function () {
isDone = true;
next(true, 1);
})
);
});
}
var PausableBufferedObservable = (function (__super__) {
inherits(PausableBufferedObservable, __super__);
function subscribe(observer) {
var q = [], previousShouldFire;
var subscription =
combineLatestSource(
this.source,
this.pauser.distinctUntilChanged().startWith(false),
function (data, shouldFire) {
return { data: data, shouldFire: shouldFire };
})
.subscribe(
function (results) {
if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) {
previousShouldFire = results.shouldFire;
// change in shouldFire
if (results.shouldFire) {
while (q.length > 0) {
observer.onNext(q.shift());
}
}
} else {
previousShouldFire = results.shouldFire;
// new data
if (results.shouldFire) {
observer.onNext(results.data);
} else {
q.push(results.data);
}
}
},
function (err) {
// Empty buffer before sending error
while (q.length > 0) {
observer.onNext(q.shift());
}
observer.onError(err);
},
function () {
// Empty buffer before sending completion
while (q.length > 0) {
observer.onNext(q.shift());
}
observer.onCompleted();
}
);
return subscription;
}
function PausableBufferedObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
__super__.call(this, subscribe);
}
PausableBufferedObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableBufferedObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableBufferedObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false,
* and yields the values that were buffered while paused.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausableBuffered(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausableBuffered = function (subject) {
return new PausableBufferedObservable(this, subject);
};
/**
* Attaches a controller to the observable sequence with the ability to queue.
* @example
* var source = Rx.Observable.interval(100).controlled();
* source.request(3); // Reads 3 values
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.controlled = function (enableQueue) {
if (enableQueue == null) { enableQueue = true; }
return new ControlledObservable(this, enableQueue);
};
var ControlledObservable = (function (_super) {
inherits(ControlledObservable, _super);
function subscribe (observer) {
return this.source.subscribe(observer);
}
function ControlledObservable (source, enableQueue) {
_super.call(this, subscribe);
this.subject = new ControlledSubject(enableQueue);
this.source = source.multicast(this.subject).refCount();
}
ControlledObservable.prototype.request = function (numberOfItems) {
if (numberOfItems == null) { numberOfItems = -1; }
return this.subject.request(numberOfItems);
};
return ControlledObservable;
}(Observable));
var ControlledSubject = Rx.ControlledSubject = (function (_super) {
function subscribe (observer) {
return this.subject.subscribe(observer);
}
inherits(ControlledSubject, _super);
function ControlledSubject(enableQueue) {
if (enableQueue == null) {
enableQueue = true;
}
_super.call(this, subscribe);
this.subject = new Subject();
this.enableQueue = enableQueue;
this.queue = enableQueue ? [] : null;
this.requestedCount = 0;
this.requestedDisposable = disposableEmpty;
this.error = null;
this.hasFailed = false;
this.hasCompleted = false;
this.controlledDisposable = disposableEmpty;
}
addProperties(ControlledSubject.prototype, Observer, {
onCompleted: function () {
checkDisposed.call(this);
this.hasCompleted = true;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onCompleted();
}
},
onError: function (error) {
checkDisposed.call(this);
this.hasFailed = true;
this.error = error;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onError(error);
}
},
onNext: function (value) {
checkDisposed.call(this);
var hasRequested = false;
if (this.requestedCount === 0) {
if (this.enableQueue) {
this.queue.push(value);
}
} else {
if (this.requestedCount !== -1) {
if (this.requestedCount-- === 0) {
this.disposeCurrentRequest();
}
}
hasRequested = true;
}
if (hasRequested) {
this.subject.onNext(value);
}
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
//console.log('queue length', this.queue.length);
while (this.queue.length >= numberOfItems && numberOfItems > 0) {
//console.log('number of items', numberOfItems);
this.subject.onNext(this.queue.shift());
numberOfItems--;
}
if (this.queue.length !== 0) {
return { numberOfItems: numberOfItems, returnValue: true };
} else {
return { numberOfItems: numberOfItems, returnValue: false };
}
}
if (this.hasFailed) {
this.subject.onError(this.error);
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
} else if (this.hasCompleted) {
this.subject.onCompleted();
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
}
return { numberOfItems: numberOfItems, returnValue: false };
},
request: function (number) {
checkDisposed.call(this);
this.disposeCurrentRequest();
var self = this,
r = this._processRequest(number);
number = r.numberOfItems;
if (!r.returnValue) {
this.requestedCount = number;
this.requestedDisposable = disposableCreate(function () {
self.requestedCount = 0;
});
return this.requestedDisposable
} else {
return disposableEmpty;
}
},
disposeCurrentRequest: function () {
this.requestedDisposable.dispose();
this.requestedDisposable = disposableEmpty;
},
dispose: function () {
this.isDisposed = true;
this.error = null;
this.subject.dispose();
this.requestedDisposable.dispose();
}
});
return ControlledSubject;
}(Observable));
/**
* Executes a transducer to transform the observable sequence
* @param {Transducer} transducer A transducer to execute
* @returns {Observable} An Observable sequence containing the results from the transducer.
*/
observableProto.transduce = function(transducer) {
var source = this;
function transformForObserver(observer) {
return {
init: function() {
return observer;
},
step: function(obs, input) {
return obs.onNext(input);
},
result: function(obs) {
return obs.onCompleted();
}
};
}
return new AnonymousObservable(function(observer) {
var xform = transducer(transformForObserver(observer));
return source.subscribe(
function(v) {
try {
xform.step(observer, v);
} catch (e) {
observer.onError(e);
}
},
observer.onError.bind(observer),
function() { xform.result(observer); }
);
});
};
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
inherits(AnonymousObservable, __super__);
// Fix subscriber to check for undefined or function returned to decorate as Disposable
function fixSubscriber(subscriber) {
if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
return typeof subscriber === 'function' ?
disposableCreate(subscriber) :
disposableEmpty;
}
function AnonymousObservable(subscribe) {
if (!(this instanceof AnonymousObservable)) {
return new AnonymousObservable(subscribe);
}
function s(observer) {
var setDisposable = function () {
try {
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
};
var autoDetachObserver = new AutoDetachObserver(observer);
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.schedule(setDisposable);
} else {
setDisposable();
}
return autoDetachObserver;
}
__super__.call(this, s);
}
return AnonymousObservable;
}(Observable));
/** @private */
var AutoDetachObserver = (function (_super) {
inherits(AutoDetachObserver, _super);
function AutoDetachObserver(observer) {
_super.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
AutoDetachObserverPrototype.next = function (value) {
var noError = false;
try {
this.observer.onNext(value);
noError = true;
} catch (e) {
throw e;
} finally {
if (!noError) {
this.dispose();
}
}
};
AutoDetachObserverPrototype.error = function (exn) {
try {
this.observer.onError(exn);
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.completed = function () {
try {
this.observer.onCompleted();
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function (value) { return this.m.getDisposable(); };
/* @private */
AutoDetachObserverPrototype.disposable = function (value) {
return arguments.length ? this.getDisposable() : setDisposable(value);
};
AutoDetachObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
/** @private */
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
/**
* @private
* @memberOf InnerSubscription
*/
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.exception) {
observer.onError(this.exception);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, _super);
/**
* Creates a subject.
* @constructor
*/
function Subject() {
_super.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
}
addProperties(Subject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
var ex = this.exception,
hv = this.hasValue,
v = this.value;
if (ex) {
observer.onError(ex);
} else if (hv) {
observer.onNext(v);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, __super__);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
* @constructor
*/
function AsyncSubject() {
__super__.call(this, subscribe);
this.isDisposed = false;
this.isStopped = false;
this.value = null;
this.hasValue = false;
this.observers = [];
this.exception = null;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
checkDisposed.call(this);
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*/
onCompleted: function () {
var o, i, len;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
var os = this.observers.slice(0),
v = this.value,
hv = this.hasValue;
if (hv) {
for (i = 0, len = os.length; i < len; i++) {
o = os[i];
o.onNext(v);
o.onCompleted();
}
} else {
for (i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the error.
* @param {Mixed} error The Error to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = error;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers = [];
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.value = value;
this.hasValue = true;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
inherits(AnonymousSubject, __super__);
function AnonymousSubject(observer, observable) {
this.observer = observer;
this.observable = observable;
__super__.call(this, this.observable.subscribe.bind(this.observable));
}
addProperties(AnonymousSubject.prototype, Observer, {
onCompleted: function () {
this.observer.onCompleted();
},
onError: function (exception) {
this.observer.onError(exception);
},
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
/**
* Represents a value that changes over time.
* Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
*/
var BehaviorSubject = Rx.BehaviorSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
observer.onNext(this.value);
return new InnerSubscription(this, observer);
}
var ex = this.exception;
if (ex) {
observer.onError(ex);
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(BehaviorSubject, __super__);
/**
* @constructor
* Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value.
* @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet.
*/
function BehaviorSubject(value) {
__super__.call(this, subscribe);
this.value = value,
this.observers = [],
this.isDisposed = false,
this.isStopped = false,
this.exception = null;
}
addProperties(BehaviorSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.isStopped = true;
for (var i = 0, os = this.observers.slice(0), len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.exception = error;
for (var i = 0, os = this.observers.slice(0), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers = [];
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.value = value;
for (var i = 0, os = this.observers.slice(0), len = os.length; i < len; i++) {
os[i].onNext(value);
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.value = null;
this.exception = null;
}
});
return BehaviorSubject;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
*/
var ReplaySubject = Rx.ReplaySubject = (function (__super__) {
function createRemovableDisposable(subject, observer) {
return disposableCreate(function () {
observer.dispose();
!subject.isDisposed && subject.observers.splice(subject.observers.indexOf(observer), 1);
});
}
function subscribe(observer) {
var so = new ScheduledObserver(this.scheduler, observer),
subscription = createRemovableDisposable(this, so);
checkDisposed.call(this);
this._trim(this.scheduler.now());
this.observers.push(so);
var n = this.q.length;
for (var i = 0, len = this.q.length; i < len; i++) {
so.onNext(this.q[i].value);
}
if (this.hasError) {
n++;
so.onError(this.error);
} else if (this.isStopped) {
n++;
so.onCompleted();
}
so.ensureActive(n);
return subscription;
}
inherits(ReplaySubject, __super__);
/**
* Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.
* @param {Number} [bufferSize] Maximum element count of the replay buffer.
* @param {Number} [windowSize] Maximum time length of the replay buffer.
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
*/
function ReplaySubject(bufferSize, windowSize, scheduler) {
this.bufferSize = bufferSize == null ? Number.MAX_VALUE : bufferSize;
this.windowSize = windowSize == null ? Number.MAX_VALUE : windowSize;
this.scheduler = scheduler || currentThreadScheduler;
this.q = [];
this.observers = [];
this.isStopped = false;
this.isDisposed = false;
this.hasError = false;
this.error = null;
__super__.call(this, subscribe);
}
addProperties(ReplaySubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
_trim: function (now) {
while (this.q.length > this.bufferSize) {
this.q.shift();
}
while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) {
this.q.shift();
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (this.isStopped) { return; }
var now = this.scheduler.now();
this.q.push({ interval: now, value: value });
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
var observer = o[i];
observer.onNext(value);
observer.ensureActive();
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.error = error;
this.hasError = true;
var now = this.scheduler.now();
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
var observer = o[i];
observer.onError(error);
observer.ensureActive();
}
this.observers = [];
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.isStopped = true;
var now = this.scheduler.now();
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
var observer = o[i];
observer.onCompleted();
observer.ensureActive();
}
this.observers = [];
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
return ReplaySubject;
}(Observable));
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
});
} else if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Rx).Rx = Rx;
} else {
freeExports.Rx = Rx;
}
} else {
// in a browser or Rhino
root.Rx = Rx;
}
}.call(this));
|
react-starter/examples/UnigridExamples.js | yoonka/unigrid | /*
Copyright (c) 2018, Grzegorz Junka
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.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import React from 'react';
import { UnigridExample1 } from './UnigridExample1';
import { UnigridExample2 } from './UnigridExample2';
import { UnigridExample3 } from './UnigridExample3';
import { UnigridExample4 } from './UnigridExample4';
import { UnigridExample5 } from './UnigridExample5';
import { UnigridExample6 } from './UnigridExample6';
import { UnigridExample7 } from './UnigridExample7';
import { UnigridExample8 } from './UnigridExample8';
import { UnigridExample9 } from './UnigridExample9';
import { UnigridExample10 } from './UnigridExample10';
import { UnigridExample11 } from './UnigridExample11';
import { UnigridExample12 } from './UnigridExample12';
import { UnigridExample13 } from './UnigridExample13';
export class UnigridExamples extends React.Component {
render() {
return (
<div>
<hr />
<UnigridExample1 />
<hr />
<UnigridExample2 />
<hr />
<UnigridExample3 />
<hr />
<UnigridExample4 />
<hr />
<UnigridExample5 />
<hr />
<UnigridExample6 />
<hr />
<UnigridExample7 />
<hr />
<UnigridExample8 />
<hr />
<UnigridExample9 />
<hr />
<UnigridExample10 />
<hr />
<UnigridExample11 />
<hr />
<UnigridExample12 />
<hr />
<UnigridExample13 />
<hr />
</div>
);
}
}
|
src/react-gauge.js | michigan-com/react-gauge | 'use strict';
import React from 'react';
// http://stackoverflow.com/a/11832950/1337683
function roundTwoDecimals(number) {
return Math.round(number * 100) / 100;
}
const _colorArc = (gradient, color, id) => gradient.length == 0 ? color : `url(#linear-gradient)`;
export default class ReactGauge extends React.Component {
static defaultProps = {
colors: {
blue: '#255C69',
green: '#2A7F40',
orange: '#AA7139',
red: '#AA4639'
},
primaryColor:'#255C69',
gradient:[],
width: 500,
height: 250,
min: 0,
max: 100,
value: 0
};
constructor(props) {
super(props);
this.state = {
width: this.props.width,
height: this.props.height
}
this.resizeGauge = this.resizeGauge.bind(this);
window.addEventListener('resize', this.resizeGauge, false);
}
componentWillMount() {
this.resizeGauge();
}
componentWillUnMount() {
window.removeEventListener('resize', this.resizeGauge);
}
resizeGauge() {
const width = this.props.width;
const height = this.props.height;
if (window.innerWidth > width) {
if (this.state.width < width) {
this.setState({ width, height });
}
} else {
this.setState({
width: window.innerWidth,
height: window.innerWidth * .5
});
}
}
getStyles() {
let xLeft = 0;
let xMiddle = Math.round(this.state.width / 2);
let xRight = this.state.width;
let yTop = 0;
let yMiddle = Math.round(this.state.height / 2);
let yBottom = this.state.height;
let percent = this.props.value / this.props.max;
let degrees = percent * 180;
// Outer circle
let outerCircle = {
r: xMiddle,
cx: xMiddle,
cy: yBottom
}
// Inner circle
let innerCircle = {
r: xMiddle * .8,
cx: xMiddle,
cy: yBottom
}
// Needle
let needleCircle = {
r: Math.round(this.state.width / 10),
cx: Math.round(this.state.width / 2),
cy: this.state.height
}
let needleWidth = 10;
let needlePath = {
d: `M ${xMiddle} ${yBottom - needleWidth} L 0 ${yBottom - needleWidth}`,
strokeWidth: needleWidth
}
let needleStyle = {
transformOrigin: '100% 50% 0',
transform: `rotate(${degrees}deg)`,
OTransition: 'transform 250ms ease-in',
MozTransition: 'transform 250ms ease-in',
WebkitTransition: 'transform 250ms ease-in'
}
// Text
let textStyle = {
text: `${ roundTwoDecimals(percent * 100) }%`,
x: xMiddle,
y: yBottom * .6,
fontSize: this.state.width * .1
}
return { outerCircle, innerCircle, needleCircle, needlePath, needleStyle, textStyle }
}
renderGradientIfPresent() {
const { gradient } = this.props;
if (!gradient.length) return null;
const uniqueId= this._reactInternalInstance._rootNodeID;
return (
<defs>
<linearGradient id='linear-gradient' x1="0%" y1="0%" x2="100%" y2="0%">
{gradient.map((item, index) => (
<stop offset={item.p + "%"} stopColor={item.color} key={`stop-${index}`}/>
))}
</linearGradient>
</defs>
)
}
render() {
console.log(this.state.width)
const styles = this.getStyles();
const viewBox = "0 0 " + this.state.width + ' ' + this.state.height;
const uniqueId= this._reactInternalInstance._rootNodeID;
const { gradient, primaryColor } = this.props;
const fillName = _colorArc(gradient, primaryColor, uniqueId);
return(
<svg width={ this.state.width } viewBox={viewBox} height={ this.state.height }>
{ this.renderGradientIfPresent()}
<circle r={ styles.outerCircle.r }
cx={ styles.outerCircle.cx }
cy={ styles.outerCircle.cy }
fill={fillName}>
</circle>
<circle r={ styles.innerCircle.r }
cx={ styles.innerCircle.cx }
cy={ styles.innerCircle.cy }
fill="white">
</circle>
<text x={ styles.textStyle.x } y={ styles.textStyle.y }
fontSize={ styles.textStyle.fontSize }
fontFamily='Arimo'
textAnchor='middle'
fill={ this.props.colors.blue }>
{ styles.textStyle.text }
</text>
<g className="needle">
<circle r={ styles.needleCircle.r }
cx={ styles.needleCircle.cx }
cy={ styles.needleCircle.cy }
fill={ this.props.colors.red }>
</circle>
<path style={ styles.needleStyle }
d={ styles.needlePath.d }
stroke={ this.props.colors.red }
strokeWidth={ styles.needlePath.strokeWidth }>
</path>
</g>
</svg>
)
}
}
|
packages/editor/src/components/Controls/Inline/InlineLayout.js | strues/boldr | /* eslint-disable react/no-unused-prop-types */
/* @flow */
import React from 'react';
import cn from 'classnames';
import { Bold, Italic, Underline, Strikethrough, Code } from '../../Icons';
import Option from '../../Option';
type CurrentState = {
bold?: boolean,
italic?: boolean,
underline?: boolean,
strikethrough?: boolean,
superscript?: boolean,
subscript?: boolean,
CODE?: boolean,
};
export type Props = {
onChange?: Function,
currentState: CurrentState,
};
const InlineLayout = (props: Props) => {
const { currentState, onChange } = props;
return (
<div className={cn('be-ctrl__group')} aria-label="be-inline-control">
<Option value="bold" onClick={onChange} active={currentState.bold === true} title="bold">
<Bold size={20} fill="#222" />
</Option>
<Option
value="italic"
onClick={onChange}
active={currentState.italic === true}
title="Italic">
<Italic size={20} fill="#222" />
</Option>
<Option
value="underline"
onClick={onChange}
active={currentState.underline === true}
title="Underline">
<Underline size={20} fill="#222" />
</Option>
<Option
value="strikethrough"
onClick={onChange}
active={currentState.strikethrough === true}
title="Strikethrough">
<Strikethrough size={20} fill="#222" />
</Option>
</div>
);
};
export default InlineLayout;
/*
<Option value="code" onClick={onChange} active={currentState.CODE} title="Code">
<Code size={20} fill="#222" />
</Option>*/
|
ajax/libs/ember-data.js/1.13.12/ember-data.prod.js | CyrusSUEN/cdnjs | (function() {
"use strict";
var ember$lib$main$$default = Ember;
var ember$data$lib$ext$ember$array$$default = Array.prototype || ember$lib$main$$default.ArrayPolyfills;
var ember$data$lib$system$object$polyfills$$keysFunc = Object.keys || Ember.keys;
var ember$data$lib$system$object$polyfills$$create = Object.create || Ember.create;
/**
@class AdapterError
@namespace DS
*/
var ember$data$lib$adapters$errors$$forEach = ember$data$lib$ext$ember$array$$default.forEach;
var ember$data$lib$adapters$errors$$EmberError = Ember.Error;
var ember$data$lib$adapters$errors$$SOURCE_POINTER_REGEXP = /^\/?data\/(attributes|relationships)\/(.*)/;
function ember$data$lib$adapters$errors$$AdapterError(errors, message) {
message = message || "Adapter operation failed";
ember$data$lib$adapters$errors$$EmberError.call(this, message);
this.errors = errors || [{
title: "Adapter Error",
detail: message
}];
}
ember$data$lib$adapters$errors$$AdapterError.prototype = ember$data$lib$system$object$polyfills$$create(ember$data$lib$adapters$errors$$EmberError.prototype);
/**
A `DS.InvalidError` is used by an adapter to signal the external API
was unable to process a request because the content was not
semantically correct or meaningful per the API. Usually this means a
record failed some form of server side validation. When a promise
from an adapter is rejected with a `DS.InvalidError` the record will
transition to the `invalid` state and the errors will be set to the
`errors` property on the record.
For Ember Data to correctly map errors to their corresponding
properties on the model, Ember Data expects each error to be
a valid json-api error object with a `source/pointer` that matches
the property name. For example if you had a Post model that
looked like this.
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr('string'),
content: DS.attr('string')
});
```
To show an error from the server related to the `title` and
`content` properties your adapter could return a promise that
rejects with a `DS.InvalidError` object that looks like this:
```app/adapters/post.js
import Ember from 'ember';
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
updateRecord: function() {
// Fictional adapter that always rejects
return Ember.RSVP.reject(new DS.InvalidError([
{
detail: 'Must be unique',
source: { pointer: 'data/attributes/title' }
},
{
detail: 'Must not be blank',
source: { pointer: 'data/attributes/content'}
}
]));
}
});
```
Your backend may use different property names for your records the
store will attempt extract and normalize the errors using the
serializer's `extractErrors` method before the errors get added to
the the model. As a result, it is safe for the `InvalidError` to
wrap the error payload unaltered.
@class InvalidError
@namespace DS
*/
function ember$data$lib$adapters$errors$$InvalidError(errors) {
if (!Ember.isArray(errors)) {
errors = ember$data$lib$adapters$errors$$errorsHashToArray(errors);
}
ember$data$lib$adapters$errors$$AdapterError.call(this, errors, "The adapter rejected the commit because it was invalid");
}
ember$data$lib$adapters$errors$$InvalidError.prototype = ember$data$lib$system$object$polyfills$$create(ember$data$lib$adapters$errors$$AdapterError.prototype);
/**
@class TimeoutError
@namespace DS
*/
function ember$data$lib$adapters$errors$$TimeoutError() {
ember$data$lib$adapters$errors$$AdapterError.call(this, null, "The adapter operation timed out");
}
ember$data$lib$adapters$errors$$TimeoutError.prototype = ember$data$lib$system$object$polyfills$$create(ember$data$lib$adapters$errors$$AdapterError.prototype);
/**
@class AbortError
@namespace DS
*/
function ember$data$lib$adapters$errors$$AbortError() {
ember$data$lib$adapters$errors$$AdapterError.call(this, null, "The adapter operation was aborted");
}
ember$data$lib$adapters$errors$$AbortError.prototype = ember$data$lib$system$object$polyfills$$create(ember$data$lib$adapters$errors$$AdapterError.prototype);
/**
@private
*/
function ember$data$lib$adapters$errors$$errorsHashToArray(errors) {
var out = [];
if (Ember.isPresent(errors)) {
ember$data$lib$adapters$errors$$forEach.call(ember$data$lib$system$object$polyfills$$keysFunc(errors), function (key) {
var messages = Ember.makeArray(errors[key]);
for (var i = 0; i < messages.length; i++) {
out.push({
title: 'Invalid Attribute',
detail: messages[i],
source: {
pointer: '/data/attributes/' + key
}
});
}
});
}
return out;
}
function ember$data$lib$adapters$errors$$errorsArrayToHash(errors) {
var out = {};
if (Ember.isPresent(errors)) {
ember$data$lib$adapters$errors$$forEach.call(errors, function (error) {
if (error.source && error.source.pointer) {
var key = error.source.pointer.match(ember$data$lib$adapters$errors$$SOURCE_POINTER_REGEXP);
if (key) {
key = key[2];
out[key] = out[key] || [];
out[key].push(error.detail || error.title);
}
}
});
}
return out;
}
var ember$data$lib$system$adapter$$get = Ember.get;
/**
An adapter is an object that receives requests from a store and
translates them into the appropriate action to take against your
persistence layer. The persistence layer is usually an HTTP API, but
may be anything, such as the browser's local storage. Typically the
adapter is not invoked directly instead its functionality is accessed
through the `store`.
### Creating an Adapter
Create a new subclass of `DS.Adapter` in the `app/adapters` folder:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
// ...your code here
});
```
Model-specific adapters can be created by putting your adapter
class in an `app/adapters/` + `model-name` + `.js` file of the application.
```app/adapters/post.js
import DS from 'ember-data';
export default DS.Adapter.extend({
// ...Post-specific adapter code goes here
});
```
`DS.Adapter` is an abstract base class that you should override in your
application to customize it for your backend. The minimum set of methods
that you should implement is:
* `findRecord()`
* `createRecord()`
* `updateRecord()`
* `deleteRecord()`
* `findAll()`
* `query()`
To improve the network performance of your application, you can optimize
your adapter by overriding these lower-level methods:
* `findMany()`
For an example implementation, see `DS.RESTAdapter`, the
included REST adapter.
@class Adapter
@namespace DS
@extends Ember.Object
*/
var ember$data$lib$system$adapter$$Adapter = Ember.Object.extend({
/**
If you would like your adapter to use a custom serializer you can
set the `defaultSerializer` property to be the name of the custom
serializer.
Note the `defaultSerializer` serializer has a lower priority than
a model specific serializer (i.e. `PostSerializer`) or the
`application` serializer.
```app/adapters/django.js
import DS from 'ember-data';
export default DS.Adapter.extend({
defaultSerializer: 'django'
});
```
@property defaultSerializer
@type {String}
*/
defaultSerializer: '-default',
/**
The `findRecord()` method is invoked when the store is asked for a record that
has not previously been loaded. In response to `findRecord()` being called, you
should query your persistence layer for a record with the given ID. Once
found, you can asynchronously call the store's `push()` method to push
the record into the store.
Here is an example `findRecord` implementation:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
findRecord: function(store, type, id, snapshot) {
var url = [type.modelName, id].join('/');
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.getJSON(url).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method findRecord
@param {DS.Store} store
@param {DS.Model} type
@param {String} id
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
findRecord: null,
/**
The `findAll()` method is used to retrieve all records for a given type.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
findAll: function(store, type, sinceToken) {
var url = type;
var query = { since: sinceToken };
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.getJSON(url, query).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method findAll
@param {DS.Store} store
@param {DS.Model} type
@param {String} sinceToken
@param {DS.SnapshotRecordArray} snapshotRecordArray
@return {Promise} promise
*/
findAll: null,
/**
This method is called when you call `query` on the store.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
query: function(store, type, query) {
var url = type;
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.getJSON(url, query).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@private
@method query
@param {DS.Store} store
@param {DS.Model} type
@param {Object} query
@param {DS.AdapterPopulatedRecordArray} recordArray
@return {Promise} promise
*/
query: null,
/**
The `queryRecord()` method is invoked when the store is asked for a single
record through a query object.
In response to `queryRecord()` being called, you should always fetch fresh
data. Once found, you can asynchronously call the store's `push()` method
to push the record into the store.
Here is an example `queryRecord` implementation:
Example
```app/adapters/application.js
import DS from 'ember-data';
import Ember from 'ember';
export default DS.Adapter.extend(DS.BuildURLMixin, {
queryRecord: function(store, type, query) {
var urlForQueryRecord = this.buildURL(type.modelName, null, null, 'queryRecord', query);
return new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.getJSON(urlForQueryRecord, query).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method queryRecord
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {Object} query
@return {Promise} promise
*/
queryRecord: null,
/**
If the globally unique IDs for your records should be generated on the client,
implement the `generateIdForRecord()` method. This method will be invoked
each time you create a new record, and the value returned from it will be
assigned to the record's `primaryKey`.
Most traditional REST-like HTTP APIs will not use this method. Instead, the ID
of the record will be set by the server, and your adapter will update the store
with the new ID when it calls `didCreateRecord()`. Only implement this method if
you intend to generate record IDs on the client-side.
The `generateIdForRecord()` method will be invoked with the requesting store as
the first parameter and the newly created record as the second parameter:
```javascript
generateIdForRecord: function(store, inputProperties) {
var uuid = App.generateUUIDWithStatisticallyLowOddsOfCollision();
return uuid;
}
```
@method generateIdForRecord
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the record
@param {Object} inputProperties a hash of properties to set on the
newly created record.
@return {(String|Number)} id
*/
generateIdForRecord: null,
/**
Proxies to the serializer's `serialize` method.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
createRecord: function(store, type, snapshot) {
var data = this.serialize(snapshot, { includeId: true });
var url = type;
// ...
}
});
```
@method serialize
@param {DS.Snapshot} snapshot
@param {Object} options
@return {Object} serialized snapshot
*/
serialize: function (snapshot, options) {
return ember$data$lib$system$adapter$$get(snapshot.record, 'store').serializerFor(snapshot.modelName).serialize(snapshot, options);
},
/**
Implement this method in a subclass to handle the creation of
new records.
Serializes the record and sends it to the server.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
createRecord: function(store, type, snapshot) {
var data = this.serialize(snapshot, { includeId: true });
var url = type;
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.ajax({
type: 'POST',
url: url,
dataType: 'json',
data: data
}).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method createRecord
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the record
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
createRecord: null,
/**
Implement this method in a subclass to handle the updating of
a record.
Serializes the record update and sends it to the server.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
updateRecord: function(store, type, snapshot) {
var data = this.serialize(snapshot, { includeId: true });
var id = snapshot.id;
var url = [type, id].join('/');
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.ajax({
type: 'PUT',
url: url,
dataType: 'json',
data: data
}).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method updateRecord
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the record
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: null,
/**
Implement this method in a subclass to handle the deletion of
a record.
Sends a delete request for the record to the server.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
deleteRecord: function(store, type, snapshot) {
var data = this.serialize(snapshot, { includeId: true });
var id = snapshot.id;
var url = [type, id].join('/');
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.ajax({
type: 'DELETE',
url: url,
dataType: 'json',
data: data
}).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method deleteRecord
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the record
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
deleteRecord: null,
/**
By default the store will try to coalesce all `fetchRecord` calls within the same runloop
into as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.
You can opt out of this behaviour by either not implementing the findMany hook or by setting
coalesceFindRequests to false.
@property coalesceFindRequests
@type {boolean}
*/
coalesceFindRequests: true,
/**
Find multiple records at once if coalesceFindRequests is true.
@method findMany
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the records
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
/**
Organize records into groups, each of which is to be passed to separate
calls to `findMany`.
For example, if your api has nested URLs that depend on the parent, you will
want to group records by their parent.
The default implementation returns the records as a single group.
@method groupRecordsForFindMany
@param {DS.Store} store
@param {Array} snapshots
@return {Array} an array of arrays of records, each of which is to be
loaded separately by `findMany`.
*/
groupRecordsForFindMany: function (store, snapshots) {
return [snapshots];
},
/**
This method is used by the store to determine if the store should
reload a record from the adapter when a record is requested by
`store.findRecord`.
If this method returns true, the store will re-fetch a record from
the adapter. If this method returns false, the store will resolve
immediately using the cached record.
@method shouldReloadRecord
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@return {Boolean}
*/
shouldReloadRecord: function (store, snapshot) {
return false;
},
/**
This method is used by the store to determine if the store should
reload all records from the adapter when records are requested by
`store.findAll`.
If this method returns true, the store will re-fetch all records from
the adapter. If this method returns false, the store will resolve
immediately using the cached record.
@method shouldReloadAll
@param {DS.Store} store
@param {DS.SnapshotRecordArray} snapshotRecordArray
@return {Boolean}
*/
shouldReloadAll: function (store, snapshotRecordArray) {
var modelName = snapshotRecordArray.type.modelName;
return true;
},
/**
This method is used by the store to determine if the store should
reload a record after the `store.findRecord` method resolves a
cached record.
This method is *only* checked by the store when the store is
returning a cached record.
If this method returns true the store will re-fetch a record from
the adapter.
@method shouldBackgroundReloadRecord
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@return {Boolean}
*/
shouldBackgroundReloadRecord: function (store, snapshot) {
return false;
},
/**
This method is used by the store to determine if the store should
reload a record array after the `store.findAll` method resolves
with a cached record array.
This method is *only* checked by the store when the store is
returning a cached record array.
If this method returns true the store will re-fetch all records
from the adapter.
@method shouldBackgroundReloadAll
@param {DS.Store} store
@param {DS.SnapshotRecordArray} snapshotRecordArray
@return {Boolean}
*/
shouldBackgroundReloadAll: function (store, snapshotRecordArray) {
return true;
}
});
var ember$data$lib$system$adapter$$default = ember$data$lib$system$adapter$$Adapter;
var ember$data$lib$system$map$$Map = Ember.Map;
var ember$data$lib$system$map$$MapWithDefault = Ember.MapWithDefault;
var ember$data$lib$system$map$$default = ember$data$lib$system$map$$Map;
var ember$data$lib$system$empty$object$$default = ember$data$lib$system$empty$object$$EmptyObject;
// This exists because `Object.create(null)` is absurdly slow compared
// to `new EmptyObject()`. In either case, you want a null prototype
// when you're treating the object instances as arbitrary dictionaries
// and don't want your keys colliding with build-in methods on the
// default object prototype.
var ember$data$lib$system$empty$object$$proto = Object.create(null, {
// without this, we will always still end up with (new
// EmptyObject()).constructor === Object
constructor: {
value: undefined,
enumerable: false,
writable: true
}
});
function ember$data$lib$system$empty$object$$EmptyObject() {}
ember$data$lib$system$empty$object$$EmptyObject.prototype = ember$data$lib$system$empty$object$$proto;var ember$data$lib$adapters$build$url$mixin$$get = Ember.get;
/**
WARNING: This interface is likely to change in order to accomodate https://github.com/emberjs/rfcs/pull/4
## Using BuildURLMixin
To use url building, include the mixin when extending an adapter, and call `buildURL` where needed.
The default behaviour is designed for RESTAdapter.
### Example
```javascript
export default DS.Adapter.extend(BuildURLMixin, {
findRecord: function(store, type, id, snapshot) {
var url = this.buildURL(type.modelName, id, snapshot, 'findRecord');
return this.ajax(url, 'GET');
}
});
```
### Attributes
The `host` and `namespace` attributes will be used if defined, and are optional.
@class BuildURLMixin
@namespace DS
*/
var ember$data$lib$adapters$build$url$mixin$$BuildURLMixin = Ember.Mixin.create({
/**
Builds a URL for a given type and optional ID.
By default, it pluralizes the type's name (for example, 'post'
becomes 'posts' and 'person' becomes 'people'). To override the
pluralization see [pathForType](#method_pathForType).
If an ID is specified, it adds the ID to the path generated
for the type, separated by a `/`.
When called by RESTAdapter.findMany() the `id` and `snapshot` parameters
will be arrays of ids and snapshots.
@method buildURL
@param {String} modelName
@param {(String|Array|Object)} id single id or array of ids or query
@param {(DS.Snapshot|Array)} snapshot single snapshot or array of snapshots
@param {String} requestType
@param {Object} query object of query parameters to send for query requests.
@return {String} url
*/
buildURL: function (modelName, id, snapshot, requestType, query) {
switch (requestType) {
case 'find':
// The `find` case is deprecated
return this.urlForFind(id, modelName, snapshot);
case 'findRecord':
return this.urlForFindRecord(id, modelName, snapshot);
case 'findAll':
return this.urlForFindAll(modelName);
case 'findQuery':
// The `findQuery` case is deprecated
return this.urlForFindQuery(query, modelName);
case 'query':
return this.urlForQuery(query, modelName);
case 'queryRecord':
return this.urlForQueryRecord(query, modelName);
case 'findMany':
return this.urlForFindMany(id, modelName, snapshot);
case 'findHasMany':
return this.urlForFindHasMany(id, modelName);
case 'findBelongsTo':
return this.urlForFindBelongsTo(id, modelName);
case 'createRecord':
return this.urlForCreateRecord(modelName, snapshot);
case 'updateRecord':
return this.urlForUpdateRecord(id, modelName, snapshot);
case 'deleteRecord':
return this.urlForDeleteRecord(id, modelName, snapshot);
default:
return this._buildURL(modelName, id);
}
},
/**
@method _buildURL
@private
@param {String} modelName
@param {String} id
@return {String} url
*/
_buildURL: function (modelName, id) {
var url = [];
var host = ember$data$lib$adapters$build$url$mixin$$get(this, 'host');
var prefix = this.urlPrefix();
var path;
if (modelName) {
path = this.pathForType(modelName);
if (path) {
url.push(path);
}
}
if (id) {
url.push(encodeURIComponent(id));
}
if (prefix) {
url.unshift(prefix);
}
url = url.join('/');
if (!host && url && url.charAt(0) !== '/') {
url = '/' + url;
}
return url;
},
/**
* @method urlForFindRecord
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
* @deprecated Use [urlForFindRecord](#method_urlForFindRecord) instead
*/
urlForFind: ember$data$lib$adapters$build$url$mixin$$urlForFind,
/**
* @method urlForFind
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForFindRecord: function (id, modelName, snapshot) {
if (this.urlForFind !== ember$data$lib$adapters$build$url$mixin$$urlForFind) {
return this.urlForFind(id, modelName, snapshot);
}
return this._buildURL(modelName, id);
},
/**
* @method urlForFindAll
* @param {String} modelName
* @return {String} url
*/
urlForFindAll: function (modelName) {
return this._buildURL(modelName);
},
/**
* @method urlForFindQuery
* @param {Object} query
* @param {String} modelName
* @return {String} url
* @deprecated Use [urlForQuery](#method_urlForQuery) instead
*/
urlForFindQuery: ember$data$lib$adapters$build$url$mixin$$urlForFindQuery,
/**
* @method urlForQuery
* @param {Object} query
* @param {String} modelName
* @return {String} url
*/
urlForQuery: function (query, modelName) {
if (this.urlForFindQuery !== ember$data$lib$adapters$build$url$mixin$$urlForFindQuery) {
return this.urlForFindQuery(query, modelName);
}
return this._buildURL(modelName);
},
/**
* @method urlForQueryRecord
* @param {Object} query
* @param {String} modelName
* @return {String} url
*/
urlForQueryRecord: function (query, modelName) {
return this._buildURL(modelName);
},
/**
* @method urlForFindMany
* @param {Array} ids
* @param {String} modelName
* @param {Array} snapshots
* @return {String} url
*/
urlForFindMany: function (ids, modelName, snapshots) {
return this._buildURL(modelName);
},
/**
* @method urlForFindHasMany
* @param {String} id
* @param {String} modelName
* @return {String} url
*/
urlForFindHasMany: function (id, modelName) {
return this._buildURL(modelName, id);
},
/**
* @method urlForFindBelongTo
* @param {String} id
* @param {String} modelName
* @return {String} url
*/
urlForFindBelongsTo: function (id, modelName) {
return this._buildURL(modelName, id);
},
/**
* @method urlForCreateRecord
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForCreateRecord: function (modelName, snapshot) {
return this._buildURL(modelName);
},
/**
* @method urlForUpdateRecord
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForUpdateRecord: function (id, modelName, snapshot) {
return this._buildURL(modelName, id);
},
/**
* @method urlForDeleteRecord
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForDeleteRecord: function (id, modelName, snapshot) {
return this._buildURL(modelName, id);
},
/**
@method urlPrefix
@private
@param {String} path
@param {String} parentURL
@return {String} urlPrefix
*/
urlPrefix: function (path, parentURL) {
var host = ember$data$lib$adapters$build$url$mixin$$get(this, 'host');
var namespace = ember$data$lib$adapters$build$url$mixin$$get(this, 'namespace');
var url = [];
if (path) {
// Protocol relative url
//jscs:disable disallowEmptyBlocks
if (/^\/\//.test(path)) {
// Do nothing, the full host is already included. This branch
// avoids the absolute path logic and the relative path logic.
// Absolute path
} else if (path.charAt(0) === '/') {
//jscs:enable disallowEmptyBlocks
if (host) {
path = path.slice(1);
url.push(host);
}
// Relative path
} else if (!/^http(s)?:\/\//.test(path)) {
url.push(parentURL);
}
} else {
if (host) {
url.push(host);
}
if (namespace) {
url.push(namespace);
}
}
if (path) {
url.push(path);
}
return url.join('/');
},
/**
Determines the pathname for a given type.
By default, it pluralizes the type's name (for example,
'post' becomes 'posts' and 'person' becomes 'people').
### Pathname customization
For example if you have an object LineItem with an
endpoint of "/line_items/".
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
pathForType: function(modelName) {
var decamelized = Ember.String.decamelize(modelName);
return Ember.String.pluralize(decamelized);
}
});
```
@method pathForType
@param {String} modelName
@return {String} path
**/
pathForType: function (modelName) {
var camelized = Ember.String.camelize(modelName);
return Ember.String.pluralize(camelized);
}
});
function ember$data$lib$adapters$build$url$mixin$$urlForFind(id, modelName, snapshot) {
return this._buildURL(modelName, id);
}
function ember$data$lib$adapters$build$url$mixin$$urlForFindQuery(query, modelName) {
return this._buildURL(modelName);
}
var ember$data$lib$adapters$build$url$mixin$$default = ember$data$lib$adapters$build$url$mixin$$BuildURLMixin;
/**
The REST adapter allows your store to communicate with an HTTP server by
transmitting JSON via XHR. Most Ember.js apps that consume a JSON API
should use the REST adapter.
This adapter is designed around the idea that the JSON exchanged with
the server should be conventional.
## JSON Structure
The REST adapter expects the JSON returned from your server to follow
these conventions.
### Object Root
The JSON payload should be an object that contains the record inside a
root property. For example, in response to a `GET` request for
`/posts/1`, the JSON should look like this:
```js
{
"post": {
"id": 1,
"title": "I'm Running to Reform the W3C's Tag",
"author": "Yehuda Katz"
}
}
```
Similarly, in response to a `GET` request for `/posts`, the JSON should
look like this:
```js
{
"posts": [
{
"id": 1,
"title": "I'm Running to Reform the W3C's Tag",
"author": "Yehuda Katz"
},
{
"id": 2,
"title": "Rails is omakase",
"author": "D2H"
}
]
}
```
### Conventional Names
Attribute names in your JSON payload should be the camelCased versions of
the attributes in your Ember.js models.
For example, if you have a `Person` model:
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.attr('string')
});
```
The JSON returned should look like this:
```js
{
"person": {
"id": 5,
"firstName": "Barack",
"lastName": "Obama",
"occupation": "President"
}
}
```
## Customization
### Endpoint path customization
Endpoint paths can be prefixed with a `namespace` by setting the namespace
property on the adapter:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
namespace: 'api/1'
});
```
Requests for `App.Person` would now target `/api/1/people/1`.
### Host customization
An adapter can target other hosts by setting the `host` property.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
host: 'https://api.example.com'
});
```
### Headers customization
Some APIs require HTTP headers, e.g. to provide an API key. Arbitrary
headers can be set as key/value pairs on the `RESTAdapter`'s `headers`
object and Ember Data will send them along with each ajax request.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
headers: {
"API_KEY": "secret key",
"ANOTHER_HEADER": "Some header value"
}
});
```
`headers` can also be used as a computed property to support dynamic
headers. In the example below, the `session` object has been
injected into an adapter by Ember's container.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
headers: function() {
return {
"API_KEY": this.get("session.authToken"),
"ANOTHER_HEADER": "Some header value"
};
}.property("session.authToken")
});
```
In some cases, your dynamic headers may require data from some
object outside of Ember's observer system (for example
`document.cookie`). You can use the
[volatile](/api/classes/Ember.ComputedProperty.html#method_volatile)
function to set the property into a non-cached mode causing the headers to
be recomputed with every request.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
headers: function() {
return {
"API_KEY": Ember.get(document.cookie.match(/apiKey\=([^;]*)/), "1"),
"ANOTHER_HEADER": "Some header value"
};
}.property().volatile()
});
```
@class RESTAdapter
@constructor
@namespace DS
@extends DS.Adapter
@uses DS.BuildURLMixin
*/
var ember$data$lib$adapters$rest$adapter$$get = Ember.get;
var ember$data$lib$adapters$rest$adapter$$set = Ember.set;
var ember$data$lib$adapters$rest$adapter$$forEach = ember$data$lib$ext$ember$array$$default.forEach;var ember$data$lib$adapters$rest$adapter$$RestAdapter = ember$data$lib$system$adapter$$default.extend(ember$data$lib$adapters$build$url$mixin$$default, {
defaultSerializer: '-rest',
/**
By default, the RESTAdapter will send the query params sorted alphabetically to the
server.
For example:
```js
store.query('posts', { sort: 'price', category: 'pets' });
```
will generate a requests like this `/posts?category=pets&sort=price`, even if the
parameters were specified in a different order.
That way the generated URL will be deterministic and that simplifies caching mechanisms
in the backend.
Setting `sortQueryParams` to a falsey value will respect the original order.
In case you want to sort the query parameters with a different criteria, set
`sortQueryParams` to your custom sort function.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
sortQueryParams: function(params) {
var sortedKeys = Object.keys(params).sort().reverse();
var len = sortedKeys.length, newParams = {};
for (var i = 0; i < len; i++) {
newParams[sortedKeys[i]] = params[sortedKeys[i]];
}
return newParams;
}
});
```
@method sortQueryParams
@param {Object} obj
@return {Object}
*/
sortQueryParams: function (obj) {
var keys = ember$data$lib$system$object$polyfills$$keysFunc(obj);
var len = keys.length;
if (len < 2) {
return obj;
}
var newQueryParams = {};
var sortedKeys = keys.sort();
for (var i = 0; i < len; i++) {
newQueryParams[sortedKeys[i]] = obj[sortedKeys[i]];
}
return newQueryParams;
},
/**
By default the RESTAdapter will send each find request coming from a `store.find`
or from accessing a relationship separately to the server. If your server supports passing
ids as a query string, you can set coalesceFindRequests to true to coalesce all find requests
within a single runloop.
For example, if you have an initial payload of:
```javascript
{
post: {
id: 1,
comments: [1, 2]
}
}
```
By default calling `post.get('comments')` will trigger the following requests(assuming the
comments haven't been loaded before):
```
GET /comments/1
GET /comments/2
```
If you set coalesceFindRequests to `true` it will instead trigger the following request:
```
GET /comments?ids[]=1&ids[]=2
```
Setting coalesceFindRequests to `true` also works for `store.find` requests and `belongsTo`
relationships accessed within the same runloop. If you set `coalesceFindRequests: true`
```javascript
store.findRecord('comment', 1);
store.findRecord('comment', 2);
```
will also send a request to: `GET /comments?ids[]=1&ids[]=2`
Note: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app
`groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.
@property coalesceFindRequests
@type {boolean}
*/
coalesceFindRequests: false,
/**
Endpoint paths can be prefixed with a `namespace` by setting the namespace
property on the adapter:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
namespace: 'api/1'
});
```
Requests for `App.Post` would now target `/api/1/post/`.
@property namespace
@type {String}
*/
/**
An adapter can target other hosts by setting the `host` property.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
host: 'https://api.example.com'
});
```
Requests for `App.Post` would now target `https://api.example.com/post/`.
@property host
@type {String}
*/
/**
Some APIs require HTTP headers, e.g. to provide an API
key. Arbitrary headers can be set as key/value pairs on the
`RESTAdapter`'s `headers` object and Ember Data will send them
along with each ajax request. For dynamic headers see [headers
customization](/api/data/classes/DS.RESTAdapter.html#toc_headers-customization).
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
headers: {
"API_KEY": "secret key",
"ANOTHER_HEADER": "Some header value"
}
});
```
@property headers
@type {Object}
*/
/**
@method find
@param {DS.Store} store
@param {DS.Model} type
@param {String} id
@param {DS.Snapshot} snapshot
@return {Promise} promise
@deprecated Use [findRecord](#method_findRecord) instead
*/
find: function (store, type, id, snapshot) {
return this.ajax(this.buildURL(type.modelName, id, snapshot, 'find'), 'GET');
},
/**
Called by the store in order to fetch the JSON for a given
type and ID.
The `findRecord` method makes an Ajax request to a URL computed by
`buildURL`, and returns a promise for the resulting payload.
This method performs an HTTP `GET` request with the id provided as part of the query string.
@method findRecord
@param {DS.Store} store
@param {DS.Model} type
@param {String} id
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
findRecord: function (store, type, id, snapshot) {
var find = ember$data$lib$adapters$rest$adapter$$RestAdapter.prototype.find;
if (find !== this.find) {
return this.find(store, type, id, snapshot);
}
return this.ajax(this.buildURL(type.modelName, id, snapshot, 'findRecord'), 'GET');
},
/**
Called by the store in order to fetch a JSON array for all
of the records for a given type.
The `findAll` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a
promise for the resulting payload.
@private
@method findAll
@param {DS.Store} store
@param {DS.Model} type
@param {String} sinceToken
@return {Promise} promise
*/
findAll: function (store, type, sinceToken) {
var query, url;
if (sinceToken) {
query = { since: sinceToken };
}
url = this.buildURL(type.modelName, null, null, 'findAll');
return this.ajax(url, 'GET', { data: query });
},
/**
Called by the store in order to fetch a JSON array for
the records that match a particular query.
The `findQuery` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a
promise for the resulting payload.
The `query` argument is a simple JavaScript object that will be passed directly
to the server as parameters.
@private
@method findQuery
@param {DS.Store} store
@param {DS.Model} type
@param {Object} query
@return {Promise} promise
@deprecated Use [query](#method_query) instead
*/
findQuery: function (store, type, query) {
var url = this.buildURL(type.modelName, null, null, 'findQuery', query);
if (this.sortQueryParams) {
query = this.sortQueryParams(query);
}
return this.ajax(url, 'GET', { data: query });
},
/**
Called by the store in order to fetch a JSON array for
the records that match a particular query.
The `findQuery` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a
promise for the resulting payload.
The `query` argument is a simple JavaScript object that will be passed directly
to the server as parameters.
@private
@method query
@param {DS.Store} store
@param {DS.Model} type
@param {Object} query
@return {Promise} promise
*/
query: function (store, type, query) {
var findQuery = ember$data$lib$adapters$rest$adapter$$RestAdapter.prototype.findQuery;
if (findQuery !== this.findQuery) {
return this.findQuery(store, type, query);
}
var url = this.buildURL(type.modelName, null, null, 'query', query);
if (this.sortQueryParams) {
query = this.sortQueryParams(query);
}
return this.ajax(url, 'GET', { data: query });
},
/**
Called by the store in order to fetch a JSON object for
the record that matches a particular query.
The `queryRecord` method makes an Ajax (HTTP GET) request to a URL
computed by `buildURL`, and returns a promise for the resulting
payload.
The `query` argument is a simple JavaScript object that will be passed directly
to the server as parameters.
@private
@method queryRecord
@param {DS.Store} store
@param {DS.Model} type
@param {Object} query
@return {Promise} promise
*/
queryRecord: function (store, type, query) {
var url = this.buildURL(type.modelName, null, null, 'queryRecord', query);
if (this.sortQueryParams) {
query = this.sortQueryParams(query);
}
return this.ajax(url, 'GET', { data: query });
},
/**
Called by the store in order to fetch several records together if `coalesceFindRequests` is true
For example, if the original payload looks like:
```js
{
"id": 1,
"title": "Rails is omakase",
"comments": [ 1, 2, 3 ]
}
```
The IDs will be passed as a URL-encoded Array of IDs, in this form:
```
ids[]=1&ids[]=2&ids[]=3
```
Many servers, such as Rails and PHP, will automatically convert this URL-encoded array
into an Array for you on the server-side. If you want to encode the
IDs, differently, just override this (one-line) method.
The `findMany` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a
promise for the resulting payload.
@method findMany
@param {DS.Store} store
@param {DS.Model} type
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
findMany: function (store, type, ids, snapshots) {
var url = this.buildURL(type.modelName, ids, snapshots, 'findMany');
return this.ajax(url, 'GET', { data: { ids: ids } });
},
/**
Called by the store in order to fetch a JSON array for
the unloaded records in a has-many relationship that were originally
specified as a URL (inside of `links`).
For example, if your original payload looks like this:
```js
{
"post": {
"id": 1,
"title": "Rails is omakase",
"links": { "comments": "/posts/1/comments" }
}
}
```
This method will be called with the parent record and `/posts/1/comments`.
The `findHasMany` method will make an Ajax (HTTP GET) request to the originally specified URL.
@method findHasMany
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@param {String} url
@return {Promise} promise
*/
findHasMany: function (store, snapshot, url, relationship) {
var id = snapshot.id;
var type = snapshot.modelName;
url = this.urlPrefix(url, this.buildURL(type, id, null, 'findHasMany'));
return this.ajax(url, 'GET');
},
/**
Called by the store in order to fetch a JSON array for
the unloaded records in a belongs-to relationship that were originally
specified as a URL (inside of `links`).
For example, if your original payload looks like this:
```js
{
"person": {
"id": 1,
"name": "Tom Dale",
"links": { "group": "/people/1/group" }
}
}
```
This method will be called with the parent record and `/people/1/group`.
The `findBelongsTo` method will make an Ajax (HTTP GET) request to the originally specified URL.
@method findBelongsTo
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@param {String} url
@return {Promise} promise
*/
findBelongsTo: function (store, snapshot, url, relationship) {
var id = snapshot.id;
var type = snapshot.modelName;
url = this.urlPrefix(url, this.buildURL(type, id, null, 'findBelongsTo'));
return this.ajax(url, 'GET');
},
/**
Called by the store when a newly created record is
saved via the `save` method on a model record instance.
The `createRecord` method serializes the record and makes an Ajax (HTTP POST) request
to a URL computed by `buildURL`.
See `serialize` for information on how to customize the serialized form
of a record.
@method createRecord
@param {DS.Store} store
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
createRecord: function (store, type, snapshot) {
var data = {};
var serializer = store.serializerFor(type.modelName);
var url = this.buildURL(type.modelName, null, snapshot, 'createRecord');
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
return this.ajax(url, "POST", { data: data });
},
/**
Called by the store when an existing record is saved
via the `save` method on a model record instance.
The `updateRecord` method serializes the record and makes an Ajax (HTTP PUT) request
to a URL computed by `buildURL`.
See `serialize` for information on how to customize the serialized form
of a record.
@method updateRecord
@param {DS.Store} store
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: function (store, type, snapshot) {
var data = {};
var serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, snapshot);
var id = snapshot.id;
var url = this.buildURL(type.modelName, id, snapshot, 'updateRecord');
return this.ajax(url, "PUT", { data: data });
},
/**
Called by the store when a record is deleted.
The `deleteRecord` method makes an Ajax (HTTP DELETE) request to a URL computed by `buildURL`.
@method deleteRecord
@param {DS.Store} store
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
deleteRecord: function (store, type, snapshot) {
var id = snapshot.id;
return this.ajax(this.buildURL(type.modelName, id, snapshot, 'deleteRecord'), "DELETE");
},
_stripIDFromURL: function (store, snapshot) {
var url = this.buildURL(snapshot.modelName, snapshot.id, snapshot);
var expandedURL = url.split('/');
//Case when the url is of the format ...something/:id
var lastSegment = expandedURL[expandedURL.length - 1];
var id = snapshot.id;
if (lastSegment === id) {
expandedURL[expandedURL.length - 1] = "";
} else if (ember$data$lib$adapters$rest$adapter$$endsWith(lastSegment, '?id=' + id)) {
//Case when the url is of the format ...something?id=:id
expandedURL[expandedURL.length - 1] = lastSegment.substring(0, lastSegment.length - id.length - 1);
}
return expandedURL.join('/');
},
// http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
maxURLLength: 2048,
/**
Organize records into groups, each of which is to be passed to separate
calls to `findMany`.
This implementation groups together records that have the same base URL but
differing ids. For example `/comments/1` and `/comments/2` will be grouped together
because we know findMany can coalesce them together as `/comments?ids[]=1&ids[]=2`
It also supports urls where ids are passed as a query param, such as `/comments?id=1`
but not those where there is more than 1 query param such as `/comments?id=2&name=David`
Currently only the query param of `id` is supported. If you need to support others, please
override this or the `_stripIDFromURL` method.
It does not group records that have differing base urls, such as for example: `/posts/1/comments/2`
and `/posts/2/comments/3`
@method groupRecordsForFindMany
@param {DS.Store} store
@param {Array} snapshots
@return {Array} an array of arrays of records, each of which is to be
loaded separately by `findMany`.
*/
groupRecordsForFindMany: function (store, snapshots) {
var groups = ember$data$lib$system$map$$MapWithDefault.create({ defaultValue: function () {
return [];
} });
var adapter = this;
var maxURLLength = this.maxURLLength;
ember$data$lib$adapters$rest$adapter$$forEach.call(snapshots, function (snapshot) {
var baseUrl = adapter._stripIDFromURL(store, snapshot);
groups.get(baseUrl).push(snapshot);
});
function splitGroupToFitInUrl(group, maxURLLength, paramNameLength) {
var baseUrl = adapter._stripIDFromURL(store, group[0]);
var idsSize = 0;
var splitGroups = [[]];
ember$data$lib$adapters$rest$adapter$$forEach.call(group, function (snapshot) {
var additionalLength = encodeURIComponent(snapshot.id).length + paramNameLength;
if (baseUrl.length + idsSize + additionalLength >= maxURLLength) {
idsSize = 0;
splitGroups.push([]);
}
idsSize += additionalLength;
var lastGroupIndex = splitGroups.length - 1;
splitGroups[lastGroupIndex].push(snapshot);
});
return splitGroups;
}
var groupsArray = [];
groups.forEach(function (group, key) {
var paramNameLength = '&ids%5B%5D='.length;
var splitGroups = splitGroupToFitInUrl(group, maxURLLength, paramNameLength);
ember$data$lib$adapters$rest$adapter$$forEach.call(splitGroups, function (splitGroup) {
groupsArray.push(splitGroup);
});
});
return groupsArray;
},
/**
Takes an ajax response, and returns an error payload.
@method ajaxError
@deprecated Use [handleResponse](#method_handleResponse) instead
@param {Object} jqXHR
@param {Object} responseText
@param {Object} errorThrown
@return {Object} jqXHR
*/
/**
Takes an ajax response, and returns the json payload.
@method ajaxSuccess
@deprecated Use [handleResponse](#method_handleResponse) instead
@param {Object} jqXHR
@param {Object} jsonPayload
@return {Object} jsonPayload
*/
/**
Takes an ajax response, and returns the json payload or an error.
By default this hook just returns the json payload passed to it.
You might want to override it in two cases:
1. Your API might return useful results in the response headers.
Response headers are passed in as the second argument.
2. Your API might return errors as successful responses with status code
200 and an Errors text or object. You can return a `DS.InvalidError` or a
`DS.AdapterError` (or a sub class) from this hook and it will automatically
reject the promise and put your record into the invalid or error state.
Returning a `DS.InvalidError` from this method will cause the
record to transition into the `invalid` state and make the
`errors` object available on the record. When returning an
`DS.InvalidError` the store will attempt to normalize the error data
returned from the server using the serializer's `extractErrors`
method.
@method handleResponse
@param {Number} status
@param {Object} headers
@param {Object} payload
@return {Object | DS.AdapterError} response
*/
handleResponse: function (status, headers, payload) {
if (this.isSuccess(status, headers, payload)) {
return payload;
} else if (this.isInvalid(status, headers, payload)) {
return new ember$data$lib$adapters$errors$$InvalidError(payload.errors);
}
var errors = this.normalizeErrorResponse(status, headers, payload);
return new ember$data$lib$adapters$errors$$AdapterError(errors);
},
/**
Default `handleResponse` implementation uses this hook to decide if the
response is a success.
@method isSuccess
@param {Number} status
@param {Object} headers
@param {Object} payload
@return {Boolean}
*/
isSuccess: function (status, headers, payload) {
return status >= 200 && status < 300 || status === 304;
},
/**
Default `handleResponse` implementation uses this hook to decide if the
response is a an invalid error.
@method isInvalid
@param {Number} status
@param {Object} headers
@param {Object} payload
@return {Boolean}
*/
isInvalid: function (status, headers, payload) {
return status === 422;
},
/**
Takes a URL, an HTTP method and a hash of data, and makes an
HTTP request.
When the server responds with a payload, Ember Data will call into `extractSingle`
or `extractArray` (depending on whether the original query was for one record or
many records).
By default, `ajax` method has the following behavior:
* It sets the response `dataType` to `"json"`
* If the HTTP method is not `"GET"`, it sets the `Content-Type` to be
`application/json; charset=utf-8`
* If the HTTP method is not `"GET"`, it stringifies the data passed in. The
data is the serialized record in the case of a save.
* Registers success and failure handlers.
@method ajax
@private
@param {String} url
@param {String} type The request type GET, POST, PUT, DELETE etc.
@param {Object} options
@return {Promise} promise
*/
ajax: function (url, type, options) {
var adapter = this;
return new Ember.RSVP.Promise(function (resolve, reject) {
var hash = adapter.ajaxOptions(url, type, options);
hash.success = function (payload, textStatus, jqXHR) {
var response = undefined;
if (adapter.ajaxSuccess) {
response = adapter.ajaxSuccess(jqXHR, payload);
}
if (!(response instanceof ember$data$lib$adapters$errors$$AdapterError)) {
response = adapter.handleResponse(jqXHR.status, ember$data$lib$adapters$rest$adapter$$parseResponseHeaders(jqXHR.getAllResponseHeaders()), response || payload);
}
if (response instanceof ember$data$lib$adapters$errors$$AdapterError) {
Ember.run(null, reject, response);
} else {
Ember.run(null, resolve, response);
}
};
hash.error = function (jqXHR, textStatus, errorThrown) {
var error = undefined;
if (adapter.ajaxError) {
error = adapter.ajaxError(jqXHR, textStatus, errorThrown);
}
if (!(error instanceof Error)) {
if (errorThrown instanceof Error) {
error = errorThrown;
} else if (textStatus === 'timeout') {
error = new ember$data$lib$adapters$errors$$TimeoutError();
} else if (textStatus === 'abort') {
error = new ember$data$lib$adapters$errors$$AbortError();
} else {
error = adapter.handleResponse(jqXHR.status, ember$data$lib$adapters$rest$adapter$$parseResponseHeaders(jqXHR.getAllResponseHeaders()), adapter.parseErrorResponse(jqXHR.responseText) || errorThrown);
}
}
Ember.run(null, reject, error);
};
Ember.$.ajax(hash);
}, 'DS: RESTAdapter#ajax ' + type + ' to ' + url);
},
/**
@method ajaxOptions
@private
@param {String} url
@param {String} type The request type GET, POST, PUT, DELETE etc.
@param {Object} options
@return {Object}
*/
ajaxOptions: function (url, type, options) {
var hash = options || {};
hash.url = url;
hash.type = type;
hash.dataType = 'json';
hash.context = this;
if (hash.data && type !== 'GET') {
hash.contentType = 'application/json; charset=utf-8';
hash.data = JSON.stringify(hash.data);
}
var headers = ember$data$lib$adapters$rest$adapter$$get(this, 'headers');
if (headers !== undefined) {
hash.beforeSend = function (xhr) {
ember$data$lib$adapters$rest$adapter$$forEach.call(ember$data$lib$system$object$polyfills$$keysFunc(headers), function (key) {
xhr.setRequestHeader(key, headers[key]);
});
};
}
return hash;
},
/**
@method parseErrorResponse
@private
@param {String} responseText
@return {Object}
*/
parseErrorResponse: function (responseText) {
var json = responseText;
try {
json = Ember.$.parseJSON(responseText);
} catch (e) {}
return json;
},
/**
@method normalizeErrorResponse
@private
@param {Number} status
@param {Object} headers
@param {Object} payload
@return {Object} errors payload
*/
normalizeErrorResponse: function (status, headers, payload) {
if (payload && typeof payload === 'object' && payload.errors) {
return payload.errors;
} else {
return [{
status: "" + status,
title: "The backend responded with an error",
detail: "" + payload
}];
}
}
});
function ember$data$lib$adapters$rest$adapter$$parseResponseHeaders(headerStr) {
var headers = new ember$data$lib$system$empty$object$$default();
if (!headerStr) {
return headers;
}
var headerPairs = headerStr.split('\u000d\u000a');
for (var i = 0; i < headerPairs.length; i++) {
var headerPair = headerPairs[i];
// Can't use split() here because it does the wrong thing
// if the header value has the string ": " in it.
var index = headerPair.indexOf('\u003a\u0020');
if (index > 0) {
var key = headerPair.substring(0, index);
var val = headerPair.substring(index + 2);
headers[key] = val;
}
}
return headers;
}
//From http://stackoverflow.com/questions/280634/endswith-in-javascript
function ember$data$lib$adapters$rest$adapter$$endsWith(string, suffix) {
if (typeof String.prototype.endsWith !== 'function') {
return string.indexOf(suffix, string.length - suffix.length) !== -1;
} else {
return string.endsWith(suffix);
}
}
if (Ember.platform.hasPropertyAccessors) {
Ember.defineProperty(ember$data$lib$adapters$rest$adapter$$RestAdapter.prototype, 'maxUrlLength', {
enumerable: false,
get: function () {
return this.maxURLLength;
},
set: function (value) {
ember$data$lib$adapters$rest$adapter$$set(this, 'maxURLLength', value);
}
});
}
var ember$data$lib$adapters$rest$adapter$$default = ember$data$lib$adapters$rest$adapter$$RestAdapter;
var ember$inflector$lib$lib$system$inflector$$capitalize = ember$lib$main$$default.String.capitalize;
var ember$inflector$lib$lib$system$inflector$$BLANK_REGEX = /^\s*$/;
var ember$inflector$lib$lib$system$inflector$$LAST_WORD_DASHED_REGEX = /([\w/-]+[_/\s-])([a-z\d]+$)/;
var ember$inflector$lib$lib$system$inflector$$LAST_WORD_CAMELIZED_REGEX = /([\w/\s-]+)([A-Z][a-z\d]*$)/;
var ember$inflector$lib$lib$system$inflector$$CAMELIZED_REGEX = /[A-Z][a-z\d]*$/;
function ember$inflector$lib$lib$system$inflector$$loadUncountable(rules, uncountable) {
for (var i = 0, length = uncountable.length; i < length; i++) {
rules.uncountable[uncountable[i].toLowerCase()] = true;
}
}
function ember$inflector$lib$lib$system$inflector$$loadIrregular(rules, irregularPairs) {
var pair;
for (var i = 0, length = irregularPairs.length; i < length; i++) {
pair = irregularPairs[i];
//pluralizing
rules.irregular[pair[0].toLowerCase()] = pair[1];
rules.irregular[pair[1].toLowerCase()] = pair[1];
//singularizing
rules.irregularInverse[pair[1].toLowerCase()] = pair[0];
rules.irregularInverse[pair[0].toLowerCase()] = pair[0];
}
}
/**
Inflector.Ember provides a mechanism for supplying inflection rules for your
application. Ember includes a default set of inflection rules, and provides an
API for providing additional rules.
Examples:
Creating an inflector with no rules.
```js
var inflector = new Ember.Inflector();
```
Creating an inflector with the default ember ruleset.
```js
var inflector = new Ember.Inflector(Ember.Inflector.defaultRules);
inflector.pluralize('cow'); //=> 'kine'
inflector.singularize('kine'); //=> 'cow'
```
Creating an inflector and adding rules later.
```javascript
var inflector = Ember.Inflector.inflector;
inflector.pluralize('advice'); // => 'advices'
inflector.uncountable('advice');
inflector.pluralize('advice'); // => 'advice'
inflector.pluralize('formula'); // => 'formulas'
inflector.irregular('formula', 'formulae');
inflector.pluralize('formula'); // => 'formulae'
// you would not need to add these as they are the default rules
inflector.plural(/$/, 's');
inflector.singular(/s$/i, '');
```
Creating an inflector with a nondefault ruleset.
```javascript
var rules = {
plurals: [ /$/, 's' ],
singular: [ /\s$/, '' ],
irregularPairs: [
[ 'cow', 'kine' ]
],
uncountable: [ 'fish' ]
};
var inflector = new Ember.Inflector(rules);
```
@class Inflector
@namespace Ember
*/
function ember$inflector$lib$lib$system$inflector$$Inflector(ruleSet) {
ruleSet = ruleSet || {};
ruleSet.uncountable = ruleSet.uncountable || ember$inflector$lib$lib$system$inflector$$makeDictionary();
ruleSet.irregularPairs = ruleSet.irregularPairs || ember$inflector$lib$lib$system$inflector$$makeDictionary();
var rules = this.rules = {
plurals: ruleSet.plurals || [],
singular: ruleSet.singular || [],
irregular: ember$inflector$lib$lib$system$inflector$$makeDictionary(),
irregularInverse: ember$inflector$lib$lib$system$inflector$$makeDictionary(),
uncountable: ember$inflector$lib$lib$system$inflector$$makeDictionary()
};
ember$inflector$lib$lib$system$inflector$$loadUncountable(rules, ruleSet.uncountable);
ember$inflector$lib$lib$system$inflector$$loadIrregular(rules, ruleSet.irregularPairs);
this.enableCache();
}
if (!Object.create && !Object.create(null).hasOwnProperty) {
throw new Error("This browser does not support Object.create(null), please polyfil with es5-sham: http://git.io/yBU2rg");
}
function ember$inflector$lib$lib$system$inflector$$makeDictionary() {
var cache = Object.create(null);
cache['_dict'] = null;
delete cache['_dict'];
return cache;
}
ember$inflector$lib$lib$system$inflector$$Inflector.prototype = {
/**
@public
As inflections can be costly, and commonly the same subset of words are repeatedly
inflected an optional cache is provided.
@method enableCache
*/
enableCache: function () {
this.purgeCache();
this.singularize = function (word) {
this._cacheUsed = true;
return this._sCache[word] || (this._sCache[word] = this._singularize(word));
};
this.pluralize = function (word) {
this._cacheUsed = true;
return this._pCache[word] || (this._pCache[word] = this._pluralize(word));
};
},
/**
@public
@method purgedCache
*/
purgeCache: function () {
this._cacheUsed = false;
this._sCache = ember$inflector$lib$lib$system$inflector$$makeDictionary();
this._pCache = ember$inflector$lib$lib$system$inflector$$makeDictionary();
},
/**
@public
disable caching
@method disableCache;
*/
disableCache: function () {
this._sCache = null;
this._pCache = null;
this.singularize = function (word) {
return this._singularize(word);
};
this.pluralize = function (word) {
return this._pluralize(word);
};
},
/**
@method plural
@param {RegExp} regex
@param {String} string
*/
plural: function (regex, string) {
if (this._cacheUsed) {
this.purgeCache();
}
this.rules.plurals.push([regex, string.toLowerCase()]);
},
/**
@method singular
@param {RegExp} regex
@param {String} string
*/
singular: function (regex, string) {
if (this._cacheUsed) {
this.purgeCache();
}
this.rules.singular.push([regex, string.toLowerCase()]);
},
/**
@method uncountable
@param {String} regex
*/
uncountable: function (string) {
if (this._cacheUsed) {
this.purgeCache();
}
ember$inflector$lib$lib$system$inflector$$loadUncountable(this.rules, [string.toLowerCase()]);
},
/**
@method irregular
@param {String} singular
@param {String} plural
*/
irregular: function (singular, plural) {
if (this._cacheUsed) {
this.purgeCache();
}
ember$inflector$lib$lib$system$inflector$$loadIrregular(this.rules, [[singular, plural]]);
},
/**
@method pluralize
@param {String} word
*/
pluralize: function (word) {
return this._pluralize(word);
},
_pluralize: function (word) {
return this.inflect(word, this.rules.plurals, this.rules.irregular);
},
/**
@method singularize
@param {String} word
*/
singularize: function (word) {
return this._singularize(word);
},
_singularize: function (word) {
return this.inflect(word, this.rules.singular, this.rules.irregularInverse);
},
/**
@protected
@method inflect
@param {String} word
@param {Object} typeRules
@param {Object} irregular
*/
inflect: function (word, typeRules, irregular) {
var inflection, substitution, result, lowercase, wordSplit, firstPhrase, lastWord, isBlank, isCamelized, rule, isUncountable;
isBlank = !word || ember$inflector$lib$lib$system$inflector$$BLANK_REGEX.test(word);
isCamelized = ember$inflector$lib$lib$system$inflector$$CAMELIZED_REGEX.test(word);
firstPhrase = "";
if (isBlank) {
return word;
}
lowercase = word.toLowerCase();
wordSplit = ember$inflector$lib$lib$system$inflector$$LAST_WORD_DASHED_REGEX.exec(word) || ember$inflector$lib$lib$system$inflector$$LAST_WORD_CAMELIZED_REGEX.exec(word);
if (wordSplit) {
firstPhrase = wordSplit[1];
lastWord = wordSplit[2].toLowerCase();
}
isUncountable = this.rules.uncountable[lowercase] || this.rules.uncountable[lastWord];
if (isUncountable) {
return word;
}
for (rule in this.rules.irregular) {
if (lowercase.match(rule + "$")) {
substitution = irregular[rule];
if (isCamelized && irregular[lastWord]) {
substitution = ember$inflector$lib$lib$system$inflector$$capitalize(substitution);
rule = ember$inflector$lib$lib$system$inflector$$capitalize(rule);
}
return word.replace(rule, substitution);
}
}
for (var i = typeRules.length, min = 0; i > min; i--) {
inflection = typeRules[i - 1];
rule = inflection[0];
if (rule.test(word)) {
break;
}
}
inflection = inflection || [];
rule = inflection[0];
substitution = inflection[1];
result = word.replace(rule, substitution);
return result;
}
};
var ember$inflector$lib$lib$system$inflector$$default = ember$inflector$lib$lib$system$inflector$$Inflector;
function ember$inflector$lib$lib$system$string$$pluralize(word) {
return ember$inflector$lib$lib$system$inflector$$default.inflector.pluralize(word);
}
function ember$inflector$lib$lib$system$string$$singularize(word) {
return ember$inflector$lib$lib$system$inflector$$default.inflector.singularize(word);
}
var ember$inflector$lib$lib$system$inflections$$default = {
plurals: [[/$/, 's'], [/s$/i, 's'], [/^(ax|test)is$/i, '$1es'], [/(octop|vir)us$/i, '$1i'], [/(octop|vir)i$/i, '$1i'], [/(alias|status)$/i, '$1es'], [/(bu)s$/i, '$1ses'], [/(buffal|tomat)o$/i, '$1oes'], [/([ti])um$/i, '$1a'], [/([ti])a$/i, '$1a'], [/sis$/i, 'ses'], [/(?:([^f])fe|([lr])f)$/i, '$1$2ves'], [/(hive)$/i, '$1s'], [/([^aeiouy]|qu)y$/i, '$1ies'], [/(x|ch|ss|sh)$/i, '$1es'], [/(matr|vert|ind)(?:ix|ex)$/i, '$1ices'], [/^(m|l)ouse$/i, '$1ice'], [/^(m|l)ice$/i, '$1ice'], [/^(ox)$/i, '$1en'], [/^(oxen)$/i, '$1'], [/(quiz)$/i, '$1zes']],
singular: [[/s$/i, ''], [/(ss)$/i, '$1'], [/(n)ews$/i, '$1ews'], [/([ti])a$/i, '$1um'], [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '$1sis'], [/(^analy)(sis|ses)$/i, '$1sis'], [/([^f])ves$/i, '$1fe'], [/(hive)s$/i, '$1'], [/(tive)s$/i, '$1'], [/([lr])ves$/i, '$1f'], [/([^aeiouy]|qu)ies$/i, '$1y'], [/(s)eries$/i, '$1eries'], [/(m)ovies$/i, '$1ovie'], [/(x|ch|ss|sh)es$/i, '$1'], [/^(m|l)ice$/i, '$1ouse'], [/(bus)(es)?$/i, '$1'], [/(o)es$/i, '$1'], [/(shoe)s$/i, '$1'], [/(cris|test)(is|es)$/i, '$1is'], [/^(a)x[ie]s$/i, '$1xis'], [/(octop|vir)(us|i)$/i, '$1us'], [/(alias|status)(es)?$/i, '$1'], [/^(ox)en/i, '$1'], [/(vert|ind)ices$/i, '$1ex'], [/(matr)ices$/i, '$1ix'], [/(quiz)zes$/i, '$1'], [/(database)s$/i, '$1']],
irregularPairs: [['person', 'people'], ['man', 'men'], ['child', 'children'], ['sex', 'sexes'], ['move', 'moves'], ['cow', 'kine'], ['zombie', 'zombies']],
uncountable: ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'jeans', 'police']
};
ember$inflector$lib$lib$system$inflector$$default.inflector = new ember$inflector$lib$lib$system$inflector$$default(ember$inflector$lib$lib$system$inflections$$default);
if (ember$lib$main$$default.EXTEND_PROTOTYPES === true || ember$lib$main$$default.EXTEND_PROTOTYPES.String) {
/**
See {{#crossLink "Ember.String/pluralize"}}{{/crossLink}}
@method pluralize
@for String
*/
String.prototype.pluralize = function () {
return ember$inflector$lib$lib$system$string$$pluralize(this);
};
/**
See {{#crossLink "Ember.String/singularize"}}{{/crossLink}}
@method singularize
@for String
*/
String.prototype.singularize = function () {
return ember$inflector$lib$lib$system$string$$singularize(this);
};
}
ember$inflector$lib$lib$system$inflector$$default.defaultRules = ember$inflector$lib$lib$system$inflections$$default;
ember$lib$main$$default.Inflector = ember$inflector$lib$lib$system$inflector$$default;
ember$lib$main$$default.String.pluralize = ember$inflector$lib$lib$system$string$$pluralize;
ember$lib$main$$default.String.singularize = ember$inflector$lib$lib$system$string$$singularize;
var ember$inflector$lib$main$$default = ember$inflector$lib$lib$system$inflector$$default;
if (typeof define !== 'undefined' && define.amd) {
define('ember-inflector', ['exports'], function (__exports__) {
__exports__['default'] = ember$inflector$lib$lib$system$inflector$$default;
return ember$inflector$lib$lib$system$inflector$$default;
});
} else if (typeof module !== 'undefined' && module['exports']) {
module['exports'] = ember$inflector$lib$lib$system$inflector$$default;
}
var activemodel$adapter$lib$system$active$model$adapter$$_Ember$String = ember$lib$main$$default.String;
var activemodel$adapter$lib$system$active$model$adapter$$decamelize = activemodel$adapter$lib$system$active$model$adapter$$_Ember$String.decamelize;
var activemodel$adapter$lib$system$active$model$adapter$$underscore = activemodel$adapter$lib$system$active$model$adapter$$_Ember$String.underscore;
/**
@module ember-data
*/
/**
The ActiveModelAdapter is a subclass of the RESTAdapter designed to integrate
with a JSON API that uses an underscored naming convention instead of camelCasing.
It has been designed to work out of the box with the
[active\_model\_serializers](http://github.com/rails-api/active_model_serializers)
Ruby gem. This Adapter expects specific settings using ActiveModel::Serializers,
`embed :ids, embed_in_root: true` which sideloads the records.
This adapter extends the DS.RESTAdapter by making consistent use of the camelization,
decamelization and pluralization methods to normalize the serialized JSON into a
format that is compatible with a conventional Rails backend and Ember Data.
## JSON Structure
The ActiveModelAdapter expects the JSON returned from your server to follow
the REST adapter conventions substituting underscored keys for camelcased ones.
Unlike the DS.RESTAdapter, async relationship keys must be the singular form
of the relationship name, followed by "_id" for DS.belongsTo relationships,
or "_ids" for DS.hasMany relationships.
### Conventional Names
Attribute names in your JSON payload should be the underscored versions of
the attributes in your Ember.js models.
For example, if you have a `Person` model:
```js
App.FamousPerson = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.attr('string')
});
```
The JSON returned should look like this:
```js
{
"famous_person": {
"id": 1,
"first_name": "Barack",
"last_name": "Obama",
"occupation": "President"
}
}
```
Let's imagine that `Occupation` is just another model:
```js
App.Person = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.belongsTo('occupation')
});
App.Occupation = DS.Model.extend({
name: DS.attr('string'),
salary: DS.attr('number'),
people: DS.hasMany('person')
});
```
The JSON needed to avoid extra server calls, should look like this:
```js
{
"people": [{
"id": 1,
"first_name": "Barack",
"last_name": "Obama",
"occupation_id": 1
}],
"occupations": [{
"id": 1,
"name": "President",
"salary": 100000,
"person_ids": [1]
}]
}
```
@class ActiveModelAdapter
@constructor
@namespace DS
@extends DS.RESTAdapter
**/
var activemodel$adapter$lib$system$active$model$adapter$$ActiveModelAdapter = ember$data$lib$adapters$rest$adapter$$default.extend({
defaultSerializer: '-active-model',
/**
The ActiveModelAdapter overrides the `pathForType` method to build
underscored URLs by decamelizing and pluralizing the object type name.
```js
this.pathForType("famousPerson");
//=> "famous_people"
```
@method pathForType
@param {String} modelName
@return String
*/
pathForType: function (modelName) {
var decamelized = activemodel$adapter$lib$system$active$model$adapter$$decamelize(modelName);
var underscored = activemodel$adapter$lib$system$active$model$adapter$$underscore(decamelized);
return ember$inflector$lib$lib$system$string$$pluralize(underscored);
},
/**
The ActiveModelAdapter overrides the `handleResponse` method
to format errors passed to a DS.InvalidError for all
422 Unprocessable Entity responses.
A 422 HTTP response from the server generally implies that the request
was well formed but the API was unable to process it because the
content was not semantically correct or meaningful per the API.
For more information on 422 HTTP Error code see 11.2 WebDAV RFC 4918
https://tools.ietf.org/html/rfc4918#section-11.2
@method ajaxError
@param {Object} jqXHR
@return error
*/
handleResponse: function (status, headers, payload) {
if (this.isInvalid(status, headers, payload)) {
var errors = ember$data$lib$adapters$errors$$errorsHashToArray(payload.errors);
return new ember$data$lib$adapters$errors$$InvalidError(errors);
} else {
return this._super.apply(this, arguments);
}
}
});
var activemodel$adapter$lib$system$active$model$adapter$$default = activemodel$adapter$lib$system$active$model$adapter$$ActiveModelAdapter;
var ember$data$lib$system$serializer$$Serializer = Ember.Object.extend({
/*
This is only to be used temporarily during the transition from the old
serializer API to the new one.
This makes the store and the built-in serializers use the new Serializer API.
## Custom Serializers
If you have custom serializers you need to do the following:
1. Opt-in to the new Serializer API by setting `isNewSerializerAPI` to `true`
when extending one of the built-in serializers. This indicates that the
store should call `normalizeResponse` instead of `extract` and to expect
a JSON-API Document back.
2. If you have a custom `extract` hooks you need to refactor it to the new
`normalizeResponse` hooks and make sure it returns a JSON-API Document.
3. If you have a custom `normalize` method you need to make sure it also
returns a JSON-API Document with the record in question as the primary
data.
@property isNewSerializerAPI
*/
isNewSerializerAPI: false,
/**
The `store` property is the application's `store` that contains all records.
It's injected as a service.
It can be used to push records from a non flat data structure server
response.
@property store
@type {DS.Store}
@public
*/
/**
The `extract` method is used to deserialize the payload received from your
data source into the form that Ember Data expects.
@method extract
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object}
*/
extract: null,
/**
The `serialize` method is used when a record is saved in order to convert
the record into the form that your external data source expects.
`serialize` takes an optional `options` hash with a single option:
- `includeId`: If this is `true`, `serialize` should include the ID
in the serialized object it builds.
@method serialize
@param {DS.Model} record
@param {Object} [options]
@return {Object}
*/
serialize: null,
/**
The `normalize` method is used to convert a payload received from your
external data source into the normalized form `store.push()` expects. You
should override this method, munge the hash and return the normalized
payload.
@method normalize
@param {DS.Model} typeClass
@param {Object} hash
@return {Object}
*/
normalize: function (typeClass, hash) {
return hash;
}
});
var ember$data$lib$system$serializer$$default = ember$data$lib$system$serializer$$Serializer;
var ember$data$lib$system$coerce$id$$default = ember$data$lib$system$coerce$id$$coerceId;
// Used by the store to normalize IDs entering the store. Despite the fact
// that developers may provide IDs as numbers (e.g., `store.find(Person, 1)`),
// it is important that internally we use strings, since IDs may be serialized
// and lose type information. For example, Ember's router may put a record's
// ID into the URL, and if we later try to deserialize that URL and find the
// corresponding record, we will not know if it is a string or a number.
function ember$data$lib$system$coerce$id$$coerceId(id) {
return id == null || id === '' ? null : id + '';
}
var ember$data$lib$system$normalize$model$name$$default = ember$data$lib$system$normalize$model$name$$normalizeModelName;
/**
All modelNames are dasherized internally. Changing this function may
require changes to other normalization hooks (such as typeForRoot).
@method normalizeModelName
@public
@param {String} modelName
@return {String} if the adapter can generate one, an ID
@for DS
*/
function ember$data$lib$system$normalize$model$name$$normalizeModelName(modelName) {
return Ember.String.dasherize(modelName);
}
var ember$data$lib$serializers$json$serializer$$get = Ember.get;
var ember$data$lib$serializers$json$serializer$$isNone = Ember.isNone;
var ember$data$lib$serializers$json$serializer$$map = ember$data$lib$ext$ember$array$$default.map;
var ember$data$lib$serializers$json$serializer$$merge = Ember.merge;
/**
Ember Data 2.0 Serializer:
In Ember Data a Serializer is used to serialize and deserialize
records when they are transferred in and out of an external source.
This process involves normalizing property names, transforming
attribute values and serializing relationships.
By default Ember Data recommends using the JSONApiSerializer.
`JSONSerializer` is useful for simpler or legacy backends that may
not support the http://jsonapi.org/ spec.
`JSONSerializer` normalizes a JSON payload that looks like:
```js
App.User = DS.Model.extend({
name: DS.attr(),
friends: DS.hasMany('user'),
house: DS.belongsTo('location'),
});
```
```js
{
id: 1,
name: 'Sebastian',
friends: [3, 4],
links: {
house: '/houses/lefkada'
}
}
```
to JSONApi format that the Ember Data store expects.
You can customize how JSONSerializer processes it's payload by passing options in
the attrs hash or by subclassing the JSONSerializer and overriding hooks:
-To customize how a single record is normalized, use the `normalize` hook
-To customize how JSONSerializer normalizes the whole server response, use the
normalizeResponse hook
-To customize how JSONSerializer normalizes a specific response from the server,
use one of the many specific normalizeResponse hooks
-To customize how JSONSerializer normalizes your id, attributes or relationships,
use the extractId, extractAttributes and extractRelationships hooks.
JSONSerializer normalization process follows these steps:
- `normalizeResponse` - entry method to the Serializer
- `normalizeCreateRecordResponse` - a normalizeResponse for a specific operation is called
- `normalizeSingleResponse`|`normalizeArrayResponse` - for methods like `createRecord` we expect
a single record back, while for methods like `findAll` we expect multiple methods back
- `normalize` - normalizeArray iterates and calls normalize for each of it's records while normalizeSingle
calls it once. This is the method you most likely want to subclass
- `extractId` | `extractAttributes` | `extractRelationships` - normalize delegates to these methods to
turn the record payload into the JSONApi format
@class JSONSerializer
@namespace DS
@extends DS.Serializer
*/
var ember$data$lib$serializers$json$serializer$$JSONSerializer = ember$data$lib$system$serializer$$default.extend({
/**
The primaryKey is used when serializing and deserializing
data. Ember Data always uses the `id` property to store the id of
the record. The external source may not always follow this
convention. In these cases it is useful to override the
primaryKey property to match the primaryKey of your external
store.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
primaryKey: '_id'
});
```
@property primaryKey
@type {String}
@default 'id'
*/
primaryKey: 'id',
/**
The `attrs` object can be used to declare a simple mapping between
property names on `DS.Model` records and payload keys in the
serialized JSON object representing the record. An object with the
property `key` can also be used to designate the attribute's key on
the response payload.
Example
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.attr('string'),
admin: DS.attr('boolean')
});
```
```app/serializers/person.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
attrs: {
admin: 'is_admin',
occupation: { key: 'career' }
}
});
```
You can also remove attributes by setting the `serialize` key to
false in your mapping object.
Example
```app/serializers/person.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
attrs: {
admin: {serialize: false},
occupation: { key: 'career' }
}
});
```
When serialized:
```javascript
{
"firstName": "Harry",
"lastName": "Houdini",
"career": "magician"
}
```
Note that the `admin` is now not included in the payload.
@property attrs
@type {Object}
*/
mergedProperties: ['attrs'],
/**
Given a subclass of `DS.Model` and a JSON object this method will
iterate through each attribute of the `DS.Model` and invoke the
`DS.Transform#deserialize` method on the matching property of the
JSON object. This method is typically called after the
serializer's `normalize` method.
@method applyTransforms
@private
@param {DS.Model} typeClass
@param {Object} data The data to transform
@return {Object} data The transformed data object
*/
applyTransforms: function (typeClass, data) {
typeClass.eachTransformedAttribute(function applyTransform(key, typeClass) {
if (!data.hasOwnProperty(key)) {
return;
}
var transform = this.transformFor(typeClass);
data[key] = transform.deserialize(data[key]);
}, this);
return data;
},
/**
The `normalizeResponse` method is used to normalize a payload from the
server to a JSON-API Document.
http://jsonapi.org/format/#document-structure
This method delegates to a more specific normalize method based on
the `requestType`.
To override this method with a custom one, make sure to call
`return this._super(store, primaryModelClass, payload, id, requestType)` with your
pre-processed data.
Here's an example of using `normalizeResponse` manually:
```javascript
socket.on('message', function(message) {
var data = message.data;
var modelClass = store.modelFor(data.modelName);
var serializer = store.serializerFor(data.modelName);
var json = serializer.normalizeSingleResponse(store, modelClass, data, data.id);
store.push(normalized);
});
```
@method normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeResponse: function (store, primaryModelClass, payload, id, requestType) {
switch (requestType) {
case 'findRecord':
return this.normalizeFindRecordResponse.apply(this, arguments);
case 'queryRecord':
return this.normalizeQueryRecordResponse.apply(this, arguments);
case 'findAll':
return this.normalizeFindAllResponse.apply(this, arguments);
case 'findBelongsTo':
return this.normalizeFindBelongsToResponse.apply(this, arguments);
case 'findHasMany':
return this.normalizeFindHasManyResponse.apply(this, arguments);
case 'findMany':
return this.normalizeFindManyResponse.apply(this, arguments);
case 'query':
return this.normalizeQueryResponse.apply(this, arguments);
case 'createRecord':
return this.normalizeCreateRecordResponse.apply(this, arguments);
case 'deleteRecord':
return this.normalizeDeleteRecordResponse.apply(this, arguments);
case 'updateRecord':
return this.normalizeUpdateRecordResponse.apply(this, arguments);
}
},
/**
@method normalizeFindRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSingleResponse.apply(this, arguments);
},
/**
@method normalizeQueryRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeQueryRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSingleResponse.apply(this, arguments);
},
/**
@method normalizeFindAllResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindAllResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeArrayResponse.apply(this, arguments);
},
/**
@method normalizeFindBelongsToResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindBelongsToResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSingleResponse.apply(this, arguments);
},
/**
@method normalizeFindHasManyResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindHasManyResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeArrayResponse.apply(this, arguments);
},
/**
@method normalizeFindManyResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindManyResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeArrayResponse.apply(this, arguments);
},
/**
@method normalizeQueryResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeQueryResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeArrayResponse.apply(this, arguments);
},
/**
@method normalizeCreateRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeCreateRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSaveResponse.apply(this, arguments);
},
/**
@method normalizeDeleteRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeDeleteRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSaveResponse.apply(this, arguments);
},
/**
@method normalizeUpdateRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeUpdateRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSaveResponse.apply(this, arguments);
},
/**
@method normalizeSaveResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeSaveResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSingleResponse.apply(this, arguments);
},
/**
@method normalizeSingleResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeSingleResponse: function (store, primaryModelClass, payload, id, requestType) {
return this._normalizeResponse(store, primaryModelClass, payload, id, requestType, true);
},
/**
@method normalizeArrayResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeArrayResponse: function (store, primaryModelClass, payload, id, requestType) {
return this._normalizeResponse(store, primaryModelClass, payload, id, requestType, false);
},
/**
@method _normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@param {Boolean} isSingle
@return {Object} JSON-API Document
@private
*/
_normalizeResponse: function (store, primaryModelClass, payload, id, requestType, isSingle) {
var _this = this;
var documentHash = {
data: null,
included: []
};
var meta = this.extractMeta(store, primaryModelClass, payload);
if (meta) {
documentHash.meta = meta;
}
if (isSingle) {
var _normalize = this.normalize(primaryModelClass, payload);
var data = _normalize.data;
var included = _normalize.included;
documentHash.data = data;
if (included) {
documentHash.included = included;
}
} else {
documentHash.data = payload.map(function (item) {
var _normalize2 = _this.normalize(primaryModelClass, item);
var data = _normalize2.data;
var included = _normalize2.included;
if (included) {
var _documentHash$included;
(_documentHash$included = documentHash.included).push.apply(_documentHash$included, included);
}
return data;
});
}
return documentHash;
},
/**
Normalizes a part of the JSON payload returned by
the server. You should override this method, munge the hash
and call super if you have generic normalization to do.
It takes the type of the record that is being normalized
(as a DS.Model class), the property where the hash was
originally found, and the hash to normalize.
You can use this method, for example, to normalize underscored keys to camelized
or other general-purpose normalizations.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
normalize: function(typeClass, hash) {
var fields = Ember.get(typeClass, 'fields');
fields.forEach(function(field) {
var payloadField = Ember.String.underscore(field);
if (field === payloadField) { return; }
hash[field] = hash[payloadField];
delete hash[payloadField];
});
return this._super.apply(this, arguments);
}
});
```
@method normalize
@param {DS.Model} typeClass
@param {Object} hash
@return {Object}
*/
normalize: function (typeClass, hash) {
if (this.get('isNewSerializerAPI')) {
return ember$data$lib$serializers$json$serializer$$_newNormalize.apply(this, arguments);
}
if (!hash) {
return hash;
}
this.normalizeId(hash);
this.normalizeAttributes(typeClass, hash);
this.normalizeRelationships(typeClass, hash);
this.normalizeUsingDeclaredMapping(typeClass, hash);
this.applyTransforms(typeClass, hash);
return hash;
},
/**
Returns the resource's ID.
@method extractId
@param {Object} modelClass
@param {Object} resourceHash
@return {String}
*/
extractId: function (modelClass, resourceHash) {
var primaryKey = ember$data$lib$serializers$json$serializer$$get(this, 'primaryKey');
var id = resourceHash[primaryKey];
return ember$data$lib$system$coerce$id$$default(id);
},
/**
Returns the resource's attributes formatted as a JSON-API "attributes object".
http://jsonapi.org/format/#document-resource-object-attributes
@method extractAttributes
@param {Object} modelClass
@param {Object} resourceHash
@return {Object}
*/
extractAttributes: function (modelClass, resourceHash) {
var attributeKey;
var attributes = {};
modelClass.eachAttribute(function (key) {
attributeKey = this.keyForAttribute(key, 'deserialize');
if (resourceHash.hasOwnProperty(attributeKey)) {
attributes[key] = resourceHash[attributeKey];
}
}, this);
return attributes;
},
/**
Returns a relationship formatted as a JSON-API "relationship object".
http://jsonapi.org/format/#document-resource-object-relationships
@method extractRelationship
@param {Object} relationshipModelName
@param {Object} relationshipHash
@return {Object}
*/
extractRelationship: function (relationshipModelName, relationshipHash) {
if (Ember.isNone(relationshipHash)) {
return null;
}
/*
When `relationshipHash` is an object it usually means that the relationship
is polymorphic. It could however also be embedded resources that the
EmbeddedRecordsMixin has be able to process.
*/
if (Ember.typeOf(relationshipHash) === 'object') {
if (relationshipHash.id) {
relationshipHash.id = ember$data$lib$system$coerce$id$$default(relationshipHash.id);
}
if (relationshipHash.type) {
relationshipHash.type = this.modelNameFromPayloadKey(relationshipHash.type);
}
return relationshipHash;
}
return { id: ember$data$lib$system$coerce$id$$default(relationshipHash), type: relationshipModelName };
},
/**
Returns the resource's relationships formatted as a JSON-API "relationships object".
http://jsonapi.org/format/#document-resource-object-relationships
@method extractRelationships
@param {Object} modelClass
@param {Object} resourceHash
@return {Object}
*/
extractRelationships: function (modelClass, resourceHash) {
var relationships = {};
modelClass.eachRelationship(function (key, relationshipMeta) {
var relationship = null;
var relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, 'deserialize');
if (resourceHash.hasOwnProperty(relationshipKey)) {
var data = null;
var relationshipHash = resourceHash[relationshipKey];
if (relationshipMeta.kind === 'belongsTo') {
data = this.extractRelationship(relationshipMeta.type, relationshipHash);
} else if (relationshipMeta.kind === 'hasMany') {
data = Ember.A(relationshipHash).map(function (item) {
return this.extractRelationship(relationshipMeta.type, item);
}, this);
}
relationship = { data: data };
}
var linkKey = this.keyForLink(key, relationshipMeta.kind);
if (resourceHash.links && resourceHash.links.hasOwnProperty(linkKey)) {
var related = resourceHash.links[linkKey];
relationship = relationship || {};
relationship.links = { related: related };
}
if (relationship) {
relationships[key] = relationship;
}
}, this);
return relationships;
},
/**
@method modelNameFromPayloadKey
@param {String} key
@return {String} the model's modelName
*/
modelNameFromPayloadKey: function (key) {
return ember$data$lib$system$normalize$model$name$$default(key);
},
/**
You can use this method to normalize all payloads, regardless of whether they
represent single records or an array.
For example, you might want to remove some extraneous data from the payload:
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
normalizePayload: function(payload) {
delete payload.version;
delete payload.status;
return payload;
}
});
```
@method normalizePayload
@param {Object} payload
@return {Object} the normalized payload
@deprecated
*/
normalizePayload: function (payload) {
return payload;
},
/**
@method normalizeAttributes
@private
*/
normalizeAttributes: function (typeClass, hash) {
var payloadKey;
if (this.keyForAttribute) {
typeClass.eachAttribute(function (key) {
payloadKey = this.keyForAttribute(key, 'deserialize');
if (key === payloadKey) {
return;
}
if (!hash.hasOwnProperty(payloadKey)) {
return;
}
hash[key] = hash[payloadKey];
delete hash[payloadKey];
}, this);
}
},
/**
@method normalizeRelationships
@private
*/
normalizeRelationships: function (typeClass, hash) {
var payloadKey;
if (this.keyForRelationship) {
typeClass.eachRelationship(function (key, relationship) {
payloadKey = this.keyForRelationship(key, relationship.kind, 'deserialize');
if (key === payloadKey) {
return;
}
if (!hash.hasOwnProperty(payloadKey)) {
return;
}
hash[key] = hash[payloadKey];
delete hash[payloadKey];
}, this);
}
},
/**
@method normalizeUsingDeclaredMapping
@private
*/
normalizeUsingDeclaredMapping: function (typeClass, hash) {
var attrs = ember$data$lib$serializers$json$serializer$$get(this, 'attrs');
var payloadKey, key;
if (attrs) {
for (key in attrs) {
payloadKey = this._getMappedKey(key);
if (!hash.hasOwnProperty(payloadKey)) {
continue;
}
if (payloadKey !== key) {
hash[key] = hash[payloadKey];
delete hash[payloadKey];
}
}
}
},
/**
@method normalizeId
@private
*/
normalizeId: function (hash) {
var primaryKey = ember$data$lib$serializers$json$serializer$$get(this, 'primaryKey');
if (primaryKey === 'id') {
return;
}
hash.id = hash[primaryKey];
delete hash[primaryKey];
},
/**
@method normalizeErrors
@private
*/
normalizeErrors: function (typeClass, hash) {
this.normalizeId(hash);
this.normalizeAttributes(typeClass, hash);
this.normalizeRelationships(typeClass, hash);
this.normalizeUsingDeclaredMapping(typeClass, hash);
},
/**
Looks up the property key that was set by the custom `attr` mapping
passed to the serializer.
@method _getMappedKey
@private
@param {String} key
@return {String} key
*/
_getMappedKey: function (key) {
var attrs = ember$data$lib$serializers$json$serializer$$get(this, 'attrs');
var mappedKey;
if (attrs && attrs[key]) {
mappedKey = attrs[key];
//We need to account for both the { title: 'post_title' } and
//{ title: { key: 'post_title' }} forms
if (mappedKey.key) {
mappedKey = mappedKey.key;
}
if (typeof mappedKey === 'string') {
key = mappedKey;
}
}
return key;
},
/**
Check attrs.key.serialize property to inform if the `key`
can be serialized
@method _canSerialize
@private
@param {String} key
@return {boolean} true if the key can be serialized
*/
_canSerialize: function (key) {
var attrs = ember$data$lib$serializers$json$serializer$$get(this, 'attrs');
return !attrs || !attrs[key] || attrs[key].serialize !== false;
},
/**
When attrs.key.serialize is set to true then
it takes priority over the other checks and the related
attribute/relationship will be serialized
@method _mustSerialize
@private
@param {String} key
@return {boolean} true if the key must be serialized
*/
_mustSerialize: function (key) {
var attrs = ember$data$lib$serializers$json$serializer$$get(this, 'attrs');
return attrs && attrs[key] && attrs[key].serialize === true;
},
/**
Check if the given hasMany relationship should be serialized
@method _shouldSerializeHasMany
@private
@param {DS.Snapshot} snapshot
@param {String} key
@param {String} relationshipType
@return {boolean} true if the hasMany relationship should be serialized
*/
_shouldSerializeHasMany: function (snapshot, key, relationship) {
var relationshipType = snapshot.type.determineRelationshipType(relationship, this.store);
if (this._mustSerialize(key)) {
return true;
}
return this._canSerialize(key) && (relationshipType === 'manyToNone' || relationshipType === 'manyToMany');
},
// SERIALIZE
/**
Called when a record is saved in order to convert the
record into JSON.
By default, it creates a JSON object with a key for
each attribute and belongsTo relationship.
For example, consider this model:
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr(),
body: DS.attr(),
author: DS.belongsTo('user')
});
```
The default serialization would create a JSON object like:
```javascript
{
"title": "Rails is unagi",
"body": "Rails? Omakase? O_O",
"author": 12
}
```
By default, attributes are passed through as-is, unless
you specified an attribute type (`DS.attr('date')`). If
you specify a transform, the JavaScript value will be
serialized when inserted into the JSON hash.
By default, belongs-to relationships are converted into
IDs when inserted into the JSON hash.
## IDs
`serialize` takes an options hash with a single option:
`includeId`. If this option is `true`, `serialize` will,
by default include the ID in the JSON object it builds.
The adapter passes in `includeId: true` when serializing
a record for `createRecord`, but not for `updateRecord`.
## Customization
Your server may expect a different JSON format than the
built-in serialization format.
In that case, you can implement `serialize` yourself and
return a JSON hash of your choosing.
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(snapshot, options) {
var json = {
POST_TTL: snapshot.attr('title'),
POST_BDY: snapshot.attr('body'),
POST_CMS: snapshot.hasMany('comments', { ids: true })
}
if (options.includeId) {
json.POST_ID_ = snapshot.id;
}
return json;
}
});
```
## Customizing an App-Wide Serializer
If you want to define a serializer for your entire
application, you'll probably want to use `eachAttribute`
and `eachRelationship` on the record.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(snapshot, options) {
var json = {};
snapshot.eachAttribute(function(name) {
json[serverAttributeName(name)] = snapshot.attr(name);
})
snapshot.eachRelationship(function(name, relationship) {
if (relationship.kind === 'hasMany') {
json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });
}
});
if (options.includeId) {
json.ID_ = snapshot.id;
}
return json;
}
});
function serverAttributeName(attribute) {
return attribute.underscore().toUpperCase();
}
function serverHasManyName(name) {
return serverAttributeName(name.singularize()) + "_IDS";
}
```
This serializer will generate JSON that looks like this:
```javascript
{
"TITLE": "Rails is omakase",
"BODY": "Yep. Omakase.",
"COMMENT_IDS": [ 1, 2, 3 ]
}
```
## Tweaking the Default JSON
If you just want to do some small tweaks on the default JSON,
you can call super first and make the tweaks on the returned
JSON.
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(snapshot, options) {
var json = this._super.apply(this, arguments);
json.subject = json.title;
delete json.title;
return json;
}
});
```
@method serialize
@param {DS.Snapshot} snapshot
@param {Object} options
@return {Object} json
*/
serialize: function (snapshot, options) {
var json = {};
if (options && options.includeId) {
var id = snapshot.id;
if (id) {
json[ember$data$lib$serializers$json$serializer$$get(this, 'primaryKey')] = id;
}
}
snapshot.eachAttribute(function (key, attribute) {
this.serializeAttribute(snapshot, json, key, attribute);
}, this);
snapshot.eachRelationship(function (key, relationship) {
if (relationship.kind === 'belongsTo') {
this.serializeBelongsTo(snapshot, json, relationship);
} else if (relationship.kind === 'hasMany') {
this.serializeHasMany(snapshot, json, relationship);
}
}, this);
return json;
},
/**
You can use this method to customize how a serialized record is added to the complete
JSON hash to be sent to the server. By default the JSON Serializer does not namespace
the payload and just sends the raw serialized JSON object.
If your server expects namespaced keys, you should consider using the RESTSerializer.
Otherwise you can override this method to customize how the record is added to the hash.
For example, your server may expect underscored root objects.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serializeIntoHash: function(data, type, snapshot, options) {
var root = Ember.String.decamelize(type.modelName);
data[root] = this.serialize(snapshot, options);
}
});
```
@method serializeIntoHash
@param {Object} hash
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
@param {Object} options
*/
serializeIntoHash: function (hash, typeClass, snapshot, options) {
ember$data$lib$serializers$json$serializer$$merge(hash, this.serialize(snapshot, options));
},
/**
`serializeAttribute` can be used to customize how `DS.attr`
properties are serialized
For example if you wanted to ensure all your attributes were always
serialized as properties on an `attributes` object you could
write:
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serializeAttribute: function(snapshot, json, key, attributes) {
json.attributes = json.attributes || {};
this._super(snapshot, json.attributes, key, attributes);
}
});
```
@method serializeAttribute
@param {DS.Snapshot} snapshot
@param {Object} json
@param {String} key
@param {Object} attribute
*/
serializeAttribute: function (snapshot, json, key, attribute) {
var type = attribute.type;
if (this._canSerialize(key)) {
var value = snapshot.attr(key);
if (type) {
var transform = this.transformFor(type);
value = transform.serialize(value);
}
// if provided, use the mapping provided by `attrs` in
// the serializer
var payloadKey = this._getMappedKey(key);
if (payloadKey === key && this.keyForAttribute) {
payloadKey = this.keyForAttribute(key, 'serialize');
}
json[payloadKey] = value;
}
},
/**
`serializeBelongsTo` can be used to customize how `DS.belongsTo`
properties are serialized.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serializeBelongsTo: function(snapshot, json, relationship) {
var key = relationship.key;
var belongsTo = snapshot.belongsTo(key);
key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo", "serialize") : key;
json[key] = Ember.isNone(belongsTo) ? belongsTo : belongsTo.record.toJSON();
}
});
```
@method serializeBelongsTo
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeBelongsTo: function (snapshot, json, relationship) {
var key = relationship.key;
if (this._canSerialize(key)) {
var belongsToId = snapshot.belongsTo(key, { id: true });
// if provided, use the mapping provided by `attrs` in
// the serializer
var payloadKey = this._getMappedKey(key);
if (payloadKey === key && this.keyForRelationship) {
payloadKey = this.keyForRelationship(key, "belongsTo", "serialize");
}
//Need to check whether the id is there for new&async records
if (ember$data$lib$serializers$json$serializer$$isNone(belongsToId)) {
json[payloadKey] = null;
} else {
json[payloadKey] = belongsToId;
}
if (relationship.options.polymorphic) {
this.serializePolymorphicType(snapshot, json, relationship);
}
}
},
/**
`serializeHasMany` can be used to customize how `DS.hasMany`
properties are serialized.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serializeHasMany: function(snapshot, json, relationship) {
var key = relationship.key;
if (key === 'comments') {
return;
} else {
this._super.apply(this, arguments);
}
}
});
```
@method serializeHasMany
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeHasMany: function (snapshot, json, relationship) {
var key = relationship.key;
if (this._shouldSerializeHasMany(snapshot, key, relationship)) {
var payloadKey;
// if provided, use the mapping provided by `attrs` in
// the serializer
payloadKey = this._getMappedKey(key);
if (payloadKey === key && this.keyForRelationship) {
payloadKey = this.keyForRelationship(key, "hasMany", "serialize");
}
json[payloadKey] = snapshot.hasMany(key, { ids: true });
// TODO support for polymorphic manyToNone and manyToMany relationships
}
},
/**
You can use this method to customize how polymorphic objects are
serialized. Objects are considered to be polymorphic if
`{ polymorphic: true }` is pass as the second argument to the
`DS.belongsTo` function.
Example
```app/serializers/comment.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serializePolymorphicType: function(snapshot, json, relationship) {
var key = relationship.key,
belongsTo = snapshot.belongsTo(key);
key = this.keyForAttribute ? this.keyForAttribute(key, "serialize") : key;
if (Ember.isNone(belongsTo)) {
json[key + "_type"] = null;
} else {
json[key + "_type"] = belongsTo.modelName;
}
}
});
```
@method serializePolymorphicType
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializePolymorphicType: Ember.K,
// EXTRACT
/**
The `extract` method is used to deserialize payload data from the
server. By default the `JSONSerializer` does not push the records
into the store. However records that subclass `JSONSerializer`
such as the `RESTSerializer` may push records into the store as
part of the extract call.
This method delegates to a more specific extract method based on
the `requestType`.
To override this method with a custom one, make sure to call
`return this._super(store, type, payload, id, requestType)` with your
pre-processed data.
Here's an example of using `extract` manually:
```javascript
socket.on('message', function(message) {
var data = message.data;
var typeClass = store.modelFor(message.modelName);
var serializer = store.serializerFor(typeClass.modelName);
var record = serializer.extract(store, typeClass, data, data.id, 'single');
store.push(message.modelName, record);
});
```
@method extract
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extract: function (store, typeClass, payload, id, requestType) {
this.extractMeta(store, typeClass.modelName, payload);
var specificExtract = "extract" + requestType.charAt(0).toUpperCase() + requestType.substr(1);
return this[specificExtract](store, typeClass, payload, id, requestType);
},
/**
`extractFindAll` is a hook into the extract method used when a
call is made to `DS.Store#findAll`. By default this method is an
alias for [extractArray](#method_extractArray).
@method extractFindAll
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Array} array An array of deserialized objects
*/
extractFindAll: function (store, typeClass, payload, id, requestType) {
return this.extractArray(store, typeClass, payload, id, requestType);
},
/**
`extractFindQuery` is a hook into the extract method used when a
call is made to `DS.Store#findQuery`. By default this method is an
alias for [extractArray](#method_extractArray).
@method extractFindQuery
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Array} array An array of deserialized objects
*/
extractFindQuery: function (store, typeClass, payload, id, requestType) {
return this.extractArray(store, typeClass, payload, id, requestType);
},
/**
`extractQueryRecord` is a hook into the extract method used when a
call is made to `DS.Store#queryRecord`. By default this method is an
alias for [extractSingle](#method_extractSingle).
@method extractQueryRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} object A hash of deserialized object
*/
extractQueryRecord: function (store, typeClass, payload, id, requestType) {
return this.extractSingle(store, typeClass, payload, id, requestType);
},
/**
`extractFindMany` is a hook into the extract method used when a
call is made to `DS.Store#findMany`. By default this method is
alias for [extractArray](#method_extractArray).
@method extractFindMany
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Array} array An array of deserialized objects
*/
extractFindMany: function (store, typeClass, payload, id, requestType) {
return this.extractArray(store, typeClass, payload, id, requestType);
},
/**
`extractFindHasMany` is a hook into the extract method used when a
call is made to `DS.Store#findHasMany`. By default this method is
alias for [extractArray](#method_extractArray).
@method extractFindHasMany
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Array} array An array of deserialized objects
*/
extractFindHasMany: function (store, typeClass, payload, id, requestType) {
return this.extractArray(store, typeClass, payload, id, requestType);
},
/**
`extractCreateRecord` is a hook into the extract method used when a
call is made to `DS.Model#save` and the record is new. By default
this method is alias for [extractSave](#method_extractSave).
@method extractCreateRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractCreateRecord: function (store, typeClass, payload, id, requestType) {
return this.extractSave(store, typeClass, payload, id, requestType);
},
/**
`extractUpdateRecord` is a hook into the extract method used when
a call is made to `DS.Model#save` and the record has been updated.
By default this method is alias for [extractSave](#method_extractSave).
@method extractUpdateRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractUpdateRecord: function (store, typeClass, payload, id, requestType) {
return this.extractSave(store, typeClass, payload, id, requestType);
},
/**
`extractDeleteRecord` is a hook into the extract method used when
a call is made to `DS.Model#save` and the record has been deleted.
By default this method is alias for [extractSave](#method_extractSave).
@method extractDeleteRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractDeleteRecord: function (store, typeClass, payload, id, requestType) {
return this.extractSave(store, typeClass, payload, id, requestType);
},
/**
`extractFind` is a hook into the extract method used when
a call is made to `DS.Store#find`. By default this method is
alias for [extractSingle](#method_extractSingle).
@method extractFind
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractFind: function (store, typeClass, payload, id, requestType) {
return this.extractSingle(store, typeClass, payload, id, requestType);
},
/**
`extractFindBelongsTo` is a hook into the extract method used when
a call is made to `DS.Store#findBelongsTo`. By default this method is
alias for [extractSingle](#method_extractSingle).
@method extractFindBelongsTo
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractFindBelongsTo: function (store, typeClass, payload, id, requestType) {
return this.extractSingle(store, typeClass, payload, id, requestType);
},
/**
`extractSave` is a hook into the extract method used when a call
is made to `DS.Model#save`. By default this method is alias
for [extractSingle](#method_extractSingle).
@method extractSave
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractSave: function (store, typeClass, payload, id, requestType) {
return this.extractSingle(store, typeClass, payload, id, requestType);
},
/**
`extractSingle` is used to deserialize a single record returned
from the adapter.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
extractSingle: function(store, typeClass, payload) {
payload.comments = payload._embedded.comment;
delete payload._embedded;
return this._super(store, typeClass, payload);
},
});
```
@method extractSingle
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractSingle: function (store, typeClass, payload, id, requestType) {
if (!this.get('didDeprecateNormalizePayload')) {
this.set('didDeprecateNormalizePayload', true);
}
var normalizedPayload = this.normalizePayload(payload);
return this.normalize(typeClass, normalizedPayload);
},
/**
`extractArray` is used to deserialize an array of records
returned from the adapter.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
extractArray: function(store, typeClass, payload) {
return payload.map(function(json) {
return this.extractSingle(store, typeClass, json);
}, this);
}
});
```
@method extractArray
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} arrayPayload
@param {(String|Number)} id
@param {String} requestType
@return {Array} array An array of deserialized objects
*/
extractArray: function (store, typeClass, arrayPayload, id, requestType) {
if (!this.get('didDeprecateNormalizePayload')) {
this.set('didDeprecateNormalizePayload', true);
}
var normalizedPayload = this.normalizePayload(arrayPayload);
var serializer = this;
return ember$data$lib$serializers$json$serializer$$map.call(normalizedPayload, function (singlePayload) {
return serializer.normalize(typeClass, singlePayload);
});
},
/**
`extractMeta` is used to deserialize any meta information in the
adapter payload. By default Ember Data expects meta information to
be located on the `meta` property of the payload object.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
extractMeta: function(store, typeClass, payload) {
if (payload && payload._pagination) {
store.setMetadataFor(typeClass, payload._pagination);
delete payload._pagination;
}
}
});
```
@method extractMeta
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
*/
extractMeta: function (store, typeClass, payload) {
if (this.get('isNewSerializerAPI')) {
return ember$data$lib$serializers$json$serializer$$_newExtractMeta.apply(this, arguments);
}
if (payload && payload.meta) {
store._setMetadataFor(typeClass, payload.meta);
delete payload.meta;
}
},
/**
`extractErrors` is used to extract model errors when a call is made
to `DS.Model#save` which fails with an `InvalidError`. By default
Ember Data expects error information to be located on the `errors`
property of the payload object.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
extractErrors: function(store, typeClass, payload, id) {
if (payload && typeof payload === 'object' && payload._problems) {
payload = payload._problems;
this.normalizeErrors(typeClass, payload);
}
return payload;
}
});
```
@method extractErrors
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@return {Object} json The deserialized errors
*/
extractErrors: function (store, typeClass, payload, id) {
if (payload && typeof payload === 'object' && payload.errors) {
payload = ember$data$lib$adapters$errors$$errorsArrayToHash(payload.errors);
this.normalizeErrors(typeClass, payload);
}
return payload;
},
/**
`keyForAttribute` can be used to define rules for how to convert an
attribute name in your model to a key in your JSON.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
keyForAttribute: function(attr, method) {
return Ember.String.underscore(attr).toUpperCase();
}
});
```
@method keyForAttribute
@param {String} key
@param {String} method
@return {String} normalized key
*/
keyForAttribute: function (key, method) {
return key;
},
/**
`keyForRelationship` can be used to define a custom key when
serializing and deserializing relationship properties. By default
`JSONSerializer` does not provide an implementation of this method.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
keyForRelationship: function(key, relationship, method) {
return 'rel_' + Ember.String.underscore(key);
}
});
```
@method keyForRelationship
@param {String} key
@param {String} typeClass
@param {String} method
@return {String} normalized key
*/
keyForRelationship: function (key, typeClass, method) {
return key;
},
/**
`keyForLink` can be used to define a custom key when deserializing link
properties.
@method keyForLink
@param {String} key
@param {String} kind `belongsTo` or `hasMany`
@return {String} normalized key
*/
keyForLink: function (key, kind) {
return key;
},
// HELPERS
/**
@method transformFor
@private
@param {String} attributeType
@param {Boolean} skipAssertion
@return {DS.Transform} transform
*/
transformFor: function (attributeType, skipAssertion) {
var transform = this.container.lookup('transform:' + attributeType);
return transform;
}
});
/*
@method _newNormalize
@param {DS.Model} modelClass
@param {Object} resourceHash
@return {Object}
@private
*/
function ember$data$lib$serializers$json$serializer$$_newNormalize(modelClass, resourceHash) {
var data = null;
if (resourceHash) {
this.normalizeUsingDeclaredMapping(modelClass, resourceHash);
data = {
id: this.extractId(modelClass, resourceHash),
type: modelClass.modelName,
attributes: this.extractAttributes(modelClass, resourceHash),
relationships: this.extractRelationships(modelClass, resourceHash)
};
this.applyTransforms(modelClass, data.attributes);
}
return { data: data };
}
/*
@method _newExtractMeta
@param {DS.Store} store
@param {DS.Model} modelClass
@param {Object} payload
@return {Object}
@private
*/
function ember$data$lib$serializers$json$serializer$$_newExtractMeta(store, modelClass, payload) {
if (payload && payload.hasOwnProperty('meta')) {
var meta = payload.meta;
delete payload.meta;
return meta;
}
}
var ember$data$lib$serializers$json$serializer$$default = ember$data$lib$serializers$json$serializer$$JSONSerializer;
var ember$data$lib$system$promise$proxies$$Promise = Ember.RSVP.Promise;
var ember$data$lib$system$promise$proxies$$get = Ember.get;
/**
A `PromiseArray` is an object that acts like both an `Ember.Array`
and a promise. When the promise is resolved the resulting value
will be set to the `PromiseArray`'s `content` property. This makes
it easy to create data bindings with the `PromiseArray` that will be
updated when the promise resolves.
For more information see the [Ember.PromiseProxyMixin
documentation](/api/classes/Ember.PromiseProxyMixin.html).
Example
```javascript
var promiseArray = DS.PromiseArray.create({
promise: $.getJSON('/some/remote/data.json')
});
promiseArray.get('length'); // 0
promiseArray.then(function() {
promiseArray.get('length'); // 100
});
```
@class PromiseArray
@namespace DS
@extends Ember.ArrayProxy
@uses Ember.PromiseProxyMixin
*/
var ember$data$lib$system$promise$proxies$$PromiseArray = Ember.ArrayProxy.extend(Ember.PromiseProxyMixin);
/**
A `PromiseObject` is an object that acts like both an `Ember.Object`
and a promise. When the promise is resolved, then the resulting value
will be set to the `PromiseObject`'s `content` property. This makes
it easy to create data bindings with the `PromiseObject` that will
be updated when the promise resolves.
For more information see the [Ember.PromiseProxyMixin
documentation](/api/classes/Ember.PromiseProxyMixin.html).
Example
```javascript
var promiseObject = DS.PromiseObject.create({
promise: $.getJSON('/some/remote/data.json')
});
promiseObject.get('name'); // null
promiseObject.then(function() {
promiseObject.get('name'); // 'Tomster'
});
```
@class PromiseObject
@namespace DS
@extends Ember.ObjectProxy
@uses Ember.PromiseProxyMixin
*/
var ember$data$lib$system$promise$proxies$$PromiseObject = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);
var ember$data$lib$system$promise$proxies$$promiseObject = function (promise, label) {
return ember$data$lib$system$promise$proxies$$PromiseObject.create({
promise: ember$data$lib$system$promise$proxies$$Promise.resolve(promise, label)
});
};
var ember$data$lib$system$promise$proxies$$promiseArray = function (promise, label) {
return ember$data$lib$system$promise$proxies$$PromiseArray.create({
promise: ember$data$lib$system$promise$proxies$$Promise.resolve(promise, label)
});
};
/**
A PromiseManyArray is a PromiseArray that also proxies certain method calls
to the underlying manyArray.
Right now we proxy:
* `reload()`
* `createRecord()`
* `on()`
* `one()`
* `trigger()`
* `off()`
* `has()`
@class PromiseManyArray
@namespace DS
@extends Ember.ArrayProxy
*/
function ember$data$lib$system$promise$proxies$$proxyToContent(method) {
return function () {
var content = ember$data$lib$system$promise$proxies$$get(this, 'content');
return content[method].apply(content, arguments);
};
}
var ember$data$lib$system$promise$proxies$$PromiseManyArray = ember$data$lib$system$promise$proxies$$PromiseArray.extend({
reload: function () {
//I don't think this should ever happen right now, but worth guarding if we refactor the async relationships
return ember$data$lib$system$promise$proxies$$PromiseManyArray.create({
promise: ember$data$lib$system$promise$proxies$$get(this, 'content').reload()
});
},
createRecord: ember$data$lib$system$promise$proxies$$proxyToContent('createRecord'),
on: ember$data$lib$system$promise$proxies$$proxyToContent('on'),
one: ember$data$lib$system$promise$proxies$$proxyToContent('one'),
trigger: ember$data$lib$system$promise$proxies$$proxyToContent('trigger'),
off: ember$data$lib$system$promise$proxies$$proxyToContent('off'),
has: ember$data$lib$system$promise$proxies$$proxyToContent('has')
});
var ember$data$lib$system$promise$proxies$$promiseManyArray = function (promise, label) {
return ember$data$lib$system$promise$proxies$$PromiseManyArray.create({
promise: ember$data$lib$system$promise$proxies$$Promise.resolve(promise, label)
});
};
/**
@module ember-data
*/
/**
Holds validation errors for a given record organized by attribute names.
Every DS.Model has an `errors` property that is an instance of
`DS.Errors`. This can be used to display validation error
messages returned from the server when a `record.save()` rejects.
This works automatically with `DS.ActiveModelAdapter`, but you
can implement [ajaxError](/api/data/classes/DS.RESTAdapter.html#method_ajaxError)
in other adapters as well.
For Example, if you had an `User` model that looked like this:
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
username: attr('string'),
email: attr('string')
});
```
And you attempted to save a record that did not validate on the backend.
```javascript
var user = store.createRecord('user', {
username: 'tomster',
email: 'invalidEmail'
});
user.save();
```
Your backend data store might return a response that looks like
this. This response will be used to populate the error object.
```javascript
{
"errors": {
"username": ["This username is already taken!"],
"email": ["Doesn't look like a valid email."]
}
}
```
Errors can be displayed to the user by accessing their property name
to get an array of all the error objects for that property. Each
error object is a JavaScript object with two keys:
- `message` A string containing the error message from the backend
- `attribute` The name of the property associated with this error message
```handlebars
<label>Username: {{input value=username}} </label>
{{#each model.errors.username as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
<label>Email: {{input value=email}} </label>
{{#each model.errors.email as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
```
You can also access the special `messages` property on the error
object to get an array of all the error strings.
```handlebars
{{#each model.errors.messages as |message|}}
<div class="error">
{{message}}
</div>
{{/each}}
```
@class Errors
@namespace DS
@extends Ember.Object
@uses Ember.Enumerable
@uses Ember.Evented
*/
var ember$data$lib$system$model$errors$$get = Ember.get;
var ember$data$lib$system$model$errors$$set = Ember.set;
var ember$data$lib$system$model$errors$$isEmpty = Ember.isEmpty;
var ember$data$lib$system$model$errors$$makeArray = Ember.makeArray;var ember$data$lib$system$model$errors$$map = ember$data$lib$ext$ember$array$$default.map;
var ember$data$lib$system$model$errors$$default = Ember.ArrayProxy.extend(Ember.Evented, {
/**
Register with target handler
@method registerHandlers
@param {Object} target
@param {Function} becameInvalid
@param {Function} becameValid
*/
registerHandlers: function (target, becameInvalid, becameValid) {
this.on('becameInvalid', target, becameInvalid);
this.on('becameValid', target, becameValid);
},
/**
@property errorsByAttributeName
@type {Ember.MapWithDefault}
@private
*/
errorsByAttributeName: Ember.computed(function () {
return ember$data$lib$system$map$$MapWithDefault.create({
defaultValue: function () {
return Ember.A();
}
});
}),
/**
Returns errors for a given attribute
```javascript
var user = store.createRecord('user', {
username: 'tomster',
email: 'invalidEmail'
});
user.save().catch(function(){
user.get('errors').errorsFor('email'); // returns:
// [{attribute: "email", message: "Doesn't look like a valid email."}]
});
```
@method errorsFor
@param {String} attribute
@return {Array}
*/
errorsFor: function (attribute) {
return ember$data$lib$system$model$errors$$get(this, 'errorsByAttributeName').get(attribute);
},
/**
An array containing all of the error messages for this
record. This is useful for displaying all errors to the user.
```handlebars
{{#each model.errors.messages as |message|}}
<div class="error">
{{message}}
</div>
{{/each}}
```
@property messages
@type {Array}
*/
messages: Ember.computed.mapBy('content', 'message'),
/**
@property content
@type {Array}
@private
*/
content: Ember.computed(function () {
return Ember.A();
}),
/**
@method unknownProperty
@private
*/
unknownProperty: function (attribute) {
var errors = this.errorsFor(attribute);
if (ember$data$lib$system$model$errors$$isEmpty(errors)) {
return null;
}
return errors;
},
/**
Total number of errors.
@property length
@type {Number}
@readOnly
*/
/**
@property isEmpty
@type {Boolean}
@readOnly
*/
isEmpty: Ember.computed.not('length').readOnly(),
/**
Adds error messages to a given attribute and sends
`becameInvalid` event to the record.
Example:
```javascript
if (!user.get('username') {
user.get('errors').add('username', 'This field is required');
}
```
@method add
@param {String} attribute
@param {(Array|String)} messages
*/
add: function (attribute, messages) {
var wasEmpty = ember$data$lib$system$model$errors$$get(this, 'isEmpty');
messages = this._findOrCreateMessages(attribute, messages);
this.addObjects(messages);
ember$data$lib$system$model$errors$$get(this, 'errorsByAttributeName').get(attribute).addObjects(messages);
this.notifyPropertyChange(attribute);
if (wasEmpty && !ember$data$lib$system$model$errors$$get(this, 'isEmpty')) {
this.trigger('becameInvalid');
}
},
/**
@method _findOrCreateMessages
@private
*/
_findOrCreateMessages: function (attribute, messages) {
var errors = this.errorsFor(attribute);
return ember$data$lib$system$model$errors$$map.call(ember$data$lib$system$model$errors$$makeArray(messages), function (message) {
return errors.findBy('message', message) || {
attribute: attribute,
message: message
};
});
},
/**
Removes all error messages from the given attribute and sends
`becameValid` event to the record if there no more errors left.
Example:
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
email: DS.attr('string'),
twoFactorAuth: DS.attr('boolean'),
phone: DS.attr('string')
});
```
```app/routes/user/edit.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
save: function(user) {
if (!user.get('twoFactorAuth')) {
user.get('errors').remove('phone');
}
user.save();
}
}
});
```
@method remove
@param {String} attribute
*/
remove: function (attribute) {
if (ember$data$lib$system$model$errors$$get(this, 'isEmpty')) {
return;
}
var content = this.rejectBy('attribute', attribute);
ember$data$lib$system$model$errors$$set(this, 'content', content);
ember$data$lib$system$model$errors$$get(this, 'errorsByAttributeName')["delete"](attribute);
this.notifyPropertyChange(attribute);
if (ember$data$lib$system$model$errors$$get(this, 'isEmpty')) {
this.trigger('becameValid');
}
},
/**
Removes all error messages and sends `becameValid` event
to the record.
Example:
```app/routes/user/edit.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
retrySave: function(user) {
user.get('errors').clear();
user.save();
}
}
});
```
@method clear
*/
clear: function () {
if (ember$data$lib$system$model$errors$$get(this, 'isEmpty')) {
return;
}
var errorsByAttributeName = ember$data$lib$system$model$errors$$get(this, 'errorsByAttributeName');
var attributes = Ember.A();
errorsByAttributeName.forEach(function (_, attribute) {
attributes.push(attribute);
});
errorsByAttributeName.clear();
attributes.forEach(function (attribute) {
this.notifyPropertyChange(attribute);
}, this);
this._super();
this.trigger('becameValid');
},
/**
Checks if there is error messages for the given attribute.
```app/routes/user/edit.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
save: function(user) {
if (user.get('errors').has('email')) {
return alert('Please update your email before attempting to save.');
}
user.save();
}
}
});
```
@method has
@param {String} attribute
@return {Boolean} true if there some errors on given attribute
*/
has: function (attribute) {
return !ember$data$lib$system$model$errors$$isEmpty(this.errorsFor(attribute));
}
});
var ember$new$computed$lib$utils$can$use$new$syntax$$supportsSetterGetter;
try {
ember$lib$main$$default.computed({
set: function () {},
get: function () {}
});
ember$new$computed$lib$utils$can$use$new$syntax$$supportsSetterGetter = true;
} catch (e) {
ember$new$computed$lib$utils$can$use$new$syntax$$supportsSetterGetter = false;
}
var ember$new$computed$lib$utils$can$use$new$syntax$$default = ember$new$computed$lib$utils$can$use$new$syntax$$supportsSetterGetter;
var ember$new$computed$lib$main$$default = ember$new$computed$lib$main$$newComputed;
var ember$new$computed$lib$main$$computed = ember$lib$main$$default.computed;
function ember$new$computed$lib$main$$newComputed() {
var polyfillArguments = [];
var config = arguments[arguments.length - 1];
if (typeof config === 'function' || ember$new$computed$lib$utils$can$use$new$syntax$$default) {
return ember$new$computed$lib$main$$computed.apply(undefined, arguments);
}
for (var i = 0, l = arguments.length - 1; i < l; i++) {
polyfillArguments.push(arguments[i]);
}
var func;
if (config.set) {
func = function (key, value) {
if (arguments.length > 1) {
return config.set.call(this, key, value);
} else {
return config.get.call(this, key);
}
};
} else {
func = function (key) {
return config.get.call(this, key);
};
}
polyfillArguments.push(func);
return ember$new$computed$lib$main$$computed.apply(undefined, polyfillArguments);
}
var ember$new$computed$lib$main$$getKeys = Object.keys || ember$lib$main$$default.keys;
var ember$new$computed$lib$main$$computedKeys = ember$new$computed$lib$main$$getKeys(ember$new$computed$lib$main$$computed);
for (var ember$new$computed$lib$main$$i = 0, ember$new$computed$lib$main$$l = ember$new$computed$lib$main$$computedKeys.length; ember$new$computed$lib$main$$i < ember$new$computed$lib$main$$l; ember$new$computed$lib$main$$i++) {
ember$new$computed$lib$main$$newComputed[ember$new$computed$lib$main$$computedKeys[ember$new$computed$lib$main$$i]] = ember$new$computed$lib$main$$computed[ember$new$computed$lib$main$$computedKeys[ember$new$computed$lib$main$$i]];
}
var ember$data$lib$system$model$model$$errorDeprecationShown = false;
/**
@module ember-data
*/
var ember$data$lib$system$model$model$$get = Ember.get;
var ember$data$lib$system$model$model$$merge = Ember.merge;
var ember$data$lib$system$model$model$$copy = Ember.copy;
var ember$data$lib$system$model$model$$forEach = ember$data$lib$ext$ember$array$$default.forEach;
var ember$data$lib$system$model$model$$indexOf = ember$data$lib$ext$ember$array$$default.indexOf;
function ember$data$lib$system$model$model$$intersection(array1, array2) {
var result = [];
ember$data$lib$system$model$model$$forEach.call(array1, function (element) {
if (ember$data$lib$system$model$model$$indexOf.call(array2, element) >= 0) {
result.push(element);
}
});
return result;
}
var ember$data$lib$system$model$model$$RESERVED_MODEL_PROPS = ['currentState', 'data', 'store'];
var ember$data$lib$system$model$model$$retrieveFromCurrentState = Ember.computed('currentState', function (key) {
return ember$data$lib$system$model$model$$get(this._internalModel.currentState, key);
}).readOnly();
/**
The model class that all Ember Data records descend from.
This is the public API of Ember Data models. If you are using Ember Data
in your application, this is the class you should use.
If you are working on Ember Data internals, you most likely want to be dealing
with `InternalModel`
@class Model
@namespace DS
@extends Ember.Object
@uses Ember.Evented
*/
var ember$data$lib$system$model$model$$Model = Ember.Object.extend(Ember.Evented, {
_recordArrays: undefined,
_relationships: undefined,
_internalModel: null,
store: null,
/**
If this property is `true` the record is in the `empty`
state. Empty is the first state all records enter after they have
been created. Most records created by the store will quickly
transition to the `loading` state if data needs to be fetched from
the server or the `created` state if the record is created on the
client. A record can also enter the empty state if the adapter is
unable to locate the record.
@property isEmpty
@type {Boolean}
@readOnly
*/
isEmpty: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If this property is `true` the record is in the `loading` state. A
record enters this state when the store asks the adapter for its
data. It remains in this state until the adapter provides the
requested data.
@property isLoading
@type {Boolean}
@readOnly
*/
isLoading: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If this property is `true` the record is in the `loaded` state. A
record enters this state when its data is populated. Most of a
record's lifecycle is spent inside substates of the `loaded`
state.
Example
```javascript
var record = store.createRecord('model');
record.get('isLoaded'); // true
store.find('model', 1).then(function(model) {
model.get('isLoaded'); // true
});
```
@property isLoaded
@type {Boolean}
@readOnly
*/
isLoaded: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If this property is `true` the record is in the `dirty` state. The
record has local changes that have not yet been saved by the
adapter. This includes records that have been created (but not yet
saved) or deleted.
Example
```javascript
var record = store.createRecord('model');
record.get('isDirty'); // true
store.find('model', 1).then(function(model) {
model.get('isDirty'); // false
model.set('foo', 'some value');
model.get('isDirty'); // true
});
```
@property isDirty
@type {Boolean}
@readOnly
@deprecated
*/
isDirty: Ember.computed('currentState.isDirty', function () {
return this.get('currentState.isDirty');
}),
/**
@property error
@type {Boolean}
@deprecated
*/
error: ember$new$computed$lib$main$$default('adapterError', {
get: function () {
if (!ember$data$lib$system$model$model$$errorDeprecationShown) {
ember$data$lib$system$model$model$$errorDeprecationShown = true;
}
return Ember.get(this, 'adapterError');
}
}),
/**
If this property is `true` the record is in the `dirty` state. The
record has local changes that have not yet been saved by the
adapter. This includes records that have been created (but not yet
saved) or deleted.
Example
```javascript
var record = store.createRecord('model');
record.get('hasDirtyAttributes'); // true
store.find('model', 1).then(function(model) {
model.get('hasDirtyAttributes'); // false
model.set('foo', 'some value');
model.get('hasDirtyAttributes'); // true
});
```
@property hasDirtyAttributes
@type {Boolean}
@readOnly
*/
hasDirtyAttributes: Ember.computed('currentState.isDirty', function () {
return this.get('currentState.isDirty');
}),
/**
If this property is `true` the record is in the `saving` state. A
record enters the saving state when `save` is called, but the
adapter has not yet acknowledged that the changes have been
persisted to the backend.
Example
```javascript
var record = store.createRecord('model');
record.get('isSaving'); // false
var promise = record.save();
record.get('isSaving'); // true
promise.then(function() {
record.get('isSaving'); // false
});
```
@property isSaving
@type {Boolean}
@readOnly
*/
isSaving: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If this property is `true` the record is in the `deleted` state
and has been marked for deletion. When `isDeleted` is true and
`isDirty` is true, the record is deleted locally but the deletion
was not yet persisted. When `isSaving` is true, the change is
in-flight. When both `isDirty` and `isSaving` are false, the
change has persisted.
Example
```javascript
var record = store.createRecord('model');
record.get('isDeleted'); // false
record.deleteRecord();
// Locally deleted
record.get('isDeleted'); // true
record.get('isDirty'); // true
record.get('isSaving'); // false
// Persisting the deletion
var promise = record.save();
record.get('isDeleted'); // true
record.get('isSaving'); // true
// Deletion Persisted
promise.then(function() {
record.get('isDeleted'); // true
record.get('isSaving'); // false
record.get('isDirty'); // false
});
```
@property isDeleted
@type {Boolean}
@readOnly
*/
isDeleted: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If this property is `true` the record is in the `new` state. A
record will be in the `new` state when it has been created on the
client and the adapter has not yet report that it was successfully
saved.
Example
```javascript
var record = store.createRecord('model');
record.get('isNew'); // true
record.save().then(function(model) {
model.get('isNew'); // false
});
```
@property isNew
@type {Boolean}
@readOnly
*/
isNew: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If this property is `true` the record is in the `valid` state.
A record will be in the `valid` state when the adapter did not report any
server-side validation failures.
@property isValid
@type {Boolean}
@readOnly
*/
isValid: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If the record is in the dirty state this property will report what
kind of change has caused it to move into the dirty
state. Possible values are:
- `created` The record has been created by the client and not yet saved to the adapter.
- `updated` The record has been updated by the client and not yet saved to the adapter.
- `deleted` The record has been deleted by the client and not yet saved to the adapter.
Example
```javascript
var record = store.createRecord('model');
record.get('dirtyType'); // 'created'
```
@property dirtyType
@type {String}
@readOnly
*/
dirtyType: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If `true` the adapter reported that it was unable to save local
changes to the backend for any reason other than a server-side
validation error.
Example
```javascript
record.get('isError'); // false
record.set('foo', 'valid value');
record.save().then(null, function() {
record.get('isError'); // true
});
```
@property isError
@type {Boolean}
@readOnly
*/
isError: false,
/**
If `true` the store is attempting to reload the record form the adapter.
Example
```javascript
record.get('isReloading'); // false
record.reload();
record.get('isReloading'); // true
```
@property isReloading
@type {Boolean}
@readOnly
*/
isReloading: false,
/**
All ember models have an id property. This is an identifier
managed by an external source. These are always coerced to be
strings before being used internally. Note when declaring the
attributes for a model it is an error to declare an id
attribute.
```javascript
var record = store.createRecord('model');
record.get('id'); // null
store.find('model', 1).then(function(model) {
model.get('id'); // '1'
});
```
@property id
@type {String}
*/
id: null,
/**
@property currentState
@private
@type {Object}
*/
/**
When the record is in the `invalid` state this object will contain
any errors returned by the adapter. When present the errors hash
contains keys corresponding to the invalid property names
and values which are arrays of Javascript objects with two keys:
- `message` A string containing the error message from the backend
- `attribute` The name of the property associated with this error message
```javascript
record.get('errors.length'); // 0
record.set('foo', 'invalid value');
record.save().catch(function() {
record.get('errors').get('foo');
// [{message: 'foo should be a number.', attribute: 'foo'}]
});
```
The `errors` property us useful for displaying error messages to
the user.
```handlebars
<label>Username: {{input value=username}} </label>
{{#each model.errors.username as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
<label>Email: {{input value=email}} </label>
{{#each model.errors.email as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
```
You can also access the special `messages` property on the error
object to get an array of all the error strings.
```handlebars
{{#each model.errors.messages as |message|}}
<div class="error">
{{message}}
</div>
{{/each}}
```
@property errors
@type {DS.Errors}
*/
errors: Ember.computed(function () {
var errors = ember$data$lib$system$model$errors$$default.create();
errors.registerHandlers(this._internalModel, function () {
this.send('becameInvalid');
}, function () {
this.send('becameValid');
});
return errors;
}).readOnly(),
/**
This property holds the `DS.AdapterError` object with which
last adapter operation was rejected.
@property adapterError
@type {DS.AdapterError}
*/
adapterError: null,
/**
Create a JSON representation of the record, using the serialization
strategy of the store's adapter.
`serialize` takes an optional hash as a parameter, currently
supported options are:
- `includeId`: `true` if the record's ID should be included in the
JSON representation.
@method serialize
@param {Object} options
@return {Object} an object whose values are primitive JSON values only
*/
serialize: function (options) {
return this.store.serialize(this, options);
},
/**
Use [DS.JSONSerializer](DS.JSONSerializer.html) to
get the JSON representation of a record.
`toJSON` takes an optional hash as a parameter, currently
supported options are:
- `includeId`: `true` if the record's ID should be included in the
JSON representation.
@method toJSON
@param {Object} options
@return {Object} A JSON representation of the object.
*/
toJSON: function (options) {
// container is for lazy transform lookups
var serializer = this.store.serializerFor('-default');
var snapshot = this._internalModel.createSnapshot();
return serializer.serialize(snapshot, options);
},
/**
Fired when the record is ready to be interacted with,
that is either loaded from the server or created locally.
@event ready
*/
ready: Ember.K,
/**
Fired when the record is loaded from the server.
@event didLoad
*/
didLoad: Ember.K,
/**
Fired when the record is updated.
@event didUpdate
*/
didUpdate: Ember.K,
/**
Fired when a new record is commited to the server.
@event didCreate
*/
didCreate: Ember.K,
/**
Fired when the record is deleted.
@event didDelete
*/
didDelete: Ember.K,
/**
Fired when the record becomes invalid.
@event becameInvalid
*/
becameInvalid: Ember.K,
/**
Fired when the record enters the error state.
@event becameError
*/
becameError: Ember.K,
/**
Fired when the record is rolled back.
@event rolledBack
*/
rolledBack: Ember.K,
/**
@property data
@private
@type {Object}
*/
data: Ember.computed.readOnly('_internalModel._data'),
//TODO Do we want to deprecate these?
/**
@method send
@private
@param {String} name
@param {Object} context
*/
send: function (name, context) {
return this._internalModel.send(name, context);
},
/**
@method transitionTo
@private
@param {String} name
*/
transitionTo: function (name) {
return this._internalModel.transitionTo(name);
},
/**
Marks the record as deleted but does not save it. You must call
`save` afterwards if you want to persist it. You might use this
method if you want to allow the user to still `rollbackAttributes()`
after a delete it was made.
Example
```app/routes/model/delete.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
softDelete: function() {
this.controller.get('model').deleteRecord();
},
confirm: function() {
this.controller.get('model').save();
},
undo: function() {
this.controller.get('model').rollbackAttributes();
}
}
});
```
@method deleteRecord
*/
deleteRecord: function () {
this._internalModel.deleteRecord();
},
/**
Same as `deleteRecord`, but saves the record immediately.
Example
```app/routes/model/delete.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
delete: function() {
var controller = this.controller;
controller.get('model').destroyRecord().then(function() {
controller.transitionToRoute('model.index');
});
}
}
});
```
@method destroyRecord
@param {Object} options
@return {Promise} a promise that will be resolved when the adapter returns
successfully or rejected if the adapter returns with an error.
*/
destroyRecord: function (options) {
this.deleteRecord();
return this.save(options);
},
/**
@method unloadRecord
@private
*/
unloadRecord: function () {
if (this.isDestroyed) {
return;
}
this._internalModel.unloadRecord();
},
/**
@method _notifyProperties
@private
*/
_notifyProperties: function (keys) {
Ember.beginPropertyChanges();
var key;
for (var i = 0, length = keys.length; i < length; i++) {
key = keys[i];
this.notifyPropertyChange(key);
}
Ember.endPropertyChanges();
},
/**
Returns an object, whose keys are changed properties, and value is
an [oldProp, newProp] array.
Example
```app/models/mascot.js
import DS from 'ember-data';
export default DS.Model.extend({
name: attr('string')
});
```
```javascript
var mascot = store.createRecord('mascot');
mascot.changedAttributes(); // {}
mascot.set('name', 'Tomster');
mascot.changedAttributes(); // {name: [undefined, 'Tomster']}
```
@method changedAttributes
@return {Object} an object, whose keys are changed properties,
and value is an [oldProp, newProp] array.
*/
changedAttributes: function () {
var oldData = ember$data$lib$system$model$model$$get(this._internalModel, '_data');
var currentData = ember$data$lib$system$model$model$$get(this._internalModel, '_attributes');
var inFlightData = ember$data$lib$system$model$model$$get(this._internalModel, '_inFlightAttributes');
var newData = ember$data$lib$system$model$model$$merge(ember$data$lib$system$model$model$$copy(inFlightData), currentData);
var diffData = new ember$data$lib$system$empty$object$$default();
var newDataKeys = ember$data$lib$system$object$polyfills$$keysFunc(newData);
for (var i = 0, _length = newDataKeys.length; i < _length; i++) {
var key = newDataKeys[i];
diffData[key] = [oldData[key], newData[key]];
}
return diffData;
},
//TODO discuss with tomhuda about events/hooks
//Bring back as hooks?
/**
@method adapterWillCommit
@private
adapterWillCommit: function() {
this.send('willCommit');
},
/**
@method adapterDidDirty
@private
adapterDidDirty: function() {
this.send('becomeDirty');
this.updateRecordArraysLater();
},
*/
/**
If the model `isDirty` this function will discard any unsaved
changes. If the model `isNew` it will be removed from the store.
Example
```javascript
record.get('name'); // 'Untitled Document'
record.set('name', 'Doc 1');
record.get('name'); // 'Doc 1'
record.rollback();
record.get('name'); // 'Untitled Document'
```
@method rollback
@deprecated Use `rollbackAttributes()` instead
*/
rollback: function () {
this.rollbackAttributes();
},
/**
If the model `isDirty` this function will discard any unsaved
changes. If the model `isNew` it will be removed from the store.
Example
```javascript
record.get('name'); // 'Untitled Document'
record.set('name', 'Doc 1');
record.get('name'); // 'Doc 1'
record.rollbackAttributes();
record.get('name'); // 'Untitled Document'
```
@method rollbackAttributes
*/
rollbackAttributes: function () {
this._internalModel.rollbackAttributes();
},
/*
@method _createSnapshot
@private
*/
_createSnapshot: function () {
return this._internalModel.createSnapshot();
},
toStringExtension: function () {
return ember$data$lib$system$model$model$$get(this, 'id');
},
/**
Save the record and persist any changes to the record to an
external source via the adapter.
Example
```javascript
record.set('name', 'Tomster');
record.save().then(function() {
// Success callback
}, function() {
// Error callback
});
```
@method save
@param {Object} options
@return {Promise} a promise that will be resolved when the adapter returns
successfully or rejected if the adapter returns with an error.
*/
save: function (options) {
var model = this;
return ember$data$lib$system$promise$proxies$$PromiseObject.create({
promise: this._internalModel.save(options).then(function () {
return model;
})
});
},
/**
Reload the record from the adapter.
This will only work if the record has already finished loading
and has not yet been modified (`isLoaded` but not `isDirty`,
or `isSaving`).
Example
```app/routes/model/view.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
reload: function() {
this.controller.get('model').reload().then(function(model) {
// do something with the reloaded model
});
}
}
});
```
@method reload
@return {Promise} a promise that will be resolved with the record when the
adapter returns successfully or rejected if the adapter returns
with an error.
*/
reload: function () {
var model = this;
return ember$data$lib$system$promise$proxies$$PromiseObject.create({
promise: this._internalModel.reload().then(function () {
return model;
})
});
},
/**
Override the default event firing from Ember.Evented to
also call methods with the given name.
@method trigger
@private
@param {String} name
*/
trigger: function (name) {
var length = arguments.length;
var args = new Array(length - 1);
for (var i = 1; i < length; i++) {
args[i - 1] = arguments[i];
}
Ember.tryInvoke(this, name, args);
this._super.apply(this, arguments);
},
willDestroy: function () {
//TODO Move!
this._internalModel.clearRelationships();
this._internalModel.recordObjectWillDestroy();
this._super.apply(this, arguments);
//TODO should we set internalModel to null here?
},
// This is a temporary solution until we refactor DS.Model to not
// rely on the data property.
willMergeMixin: function (props) {
var constructor = this.constructor;
},
attr: function () {
},
belongsTo: function () {
},
hasMany: function () {
}
});
ember$data$lib$system$model$model$$Model.reopenClass({
/**
Alias DS.Model's `create` method to `_create`. This allows us to create DS.Model
instances from within the store, but if end users accidentally call `create()`
(instead of `createRecord()`), we can raise an error.
@method _create
@private
@static
*/
_create: ember$data$lib$system$model$model$$Model.create,
/**
Override the class' `create()` method to raise an error. This
prevents end users from inadvertently calling `create()` instead
of `createRecord()`. The store is still able to create instances
by calling the `_create()` method. To create an instance of a
`DS.Model` use [store.createRecord](DS.Store.html#method_createRecord).
@method create
@private
@static
*/
create: function () {
throw new Ember.Error("You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.");
},
/**
Represents the model's class name as a string. This can be used to look up the model through
DS.Store's modelFor method.
`modelName` is generated for you by Ember Data. It will be a lowercased, dasherized string.
For example:
```javascript
store.modelFor('post').modelName; // 'post'
store.modelFor('blog-post').modelName; // 'blog-post'
```
The most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload
keys to underscore (instead of dasherized), you might use the following code:
```javascript
export default var PostSerializer = DS.RESTSerializer.extend({
payloadKeyFromModelName: function(modelName) {
return Ember.String.underscore(modelName);
}
});
```
@property modelName
@type String
@readonly
*/
modelName: null
});
var ember$data$lib$system$model$model$$default = ember$data$lib$system$model$model$$Model;
var ember$data$lib$system$store$serializer$response$$forEach = ember$data$lib$ext$ember$array$$default.forEach;
var ember$data$lib$system$store$serializer$response$$map = ember$data$lib$ext$ember$array$$default.map;
var ember$data$lib$system$store$serializer$response$$get = Ember.get;
/**
This is a helper method that validates a JSON API top-level document
The format of a document is described here:
http://jsonapi.org/format/#document-top-level
@method validateDocumentStructure
@param {Object} doc JSON API document
@return {array} An array of errors found in the document structure
*/
function ember$data$lib$system$store$serializer$response$$validateDocumentStructure(doc) {
var errors = [];
if (!doc || typeof doc !== 'object') {
errors.push('Top level of a JSON API document must be an object');
} else {
if (!('data' in doc) && !('errors' in doc) && !('meta' in doc)) {
errors.push('One or more of the following keys must be present: "data", "errors", "meta".');
} else {
if ('data' in doc && 'errors' in doc) {
errors.push('Top level keys "errors" and "data" cannot both be present in a JSON API document');
}
}
if ('data' in doc) {
if (!(doc.data === null || Ember.isArray(doc.data) || typeof doc.data === 'object')) {
errors.push('data must be null, an object, or an array');
}
}
if ('meta' in doc) {
if (typeof doc.meta !== 'object') {
errors.push('meta must be an object');
}
}
if ('errors' in doc) {
if (!Ember.isArray(doc.errors)) {
errors.push('errors must be an array');
}
}
if ('links' in doc) {
if (typeof doc.links !== 'object') {
errors.push('links must be an object');
}
}
if ('jsonapi' in doc) {
if (typeof doc.jsonapi !== 'object') {
errors.push('jsonapi must be an object');
}
}
if ('included' in doc) {
if (typeof doc.included !== 'object') {
errors.push('included must be an array');
}
}
}
return errors;
}
/**
This is a helper method that always returns a JSON-API Document.
If the current serializer has `isNewSerializerAPI` set to `true`
this helper calls `normalizeResponse` instead of `extract`.
All the built-in serializers get `isNewSerializerAPI` set to `true` automatically
if the feature flag is enabled.
@method normalizeResponseHelper
@param {DS.Serializer} serializer
@param {DS.Store} store
@param {subclass of DS.Model} modelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
function ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, modelClass, payload, id, requestType) {
if (ember$data$lib$system$store$serializer$response$$get(serializer, 'isNewSerializerAPI')) {
var _ret = (function () {
var normalizedResponse = serializer.normalizeResponse(store, modelClass, payload, id, requestType);
var validationErrors = [];
// TODO: Remove after metadata refactor
if (normalizedResponse.meta) {
store._setMetadataFor(modelClass.modelName, normalizedResponse.meta);
}
return {
v: normalizedResponse
};
})();
if (typeof _ret === 'object') return _ret.v;
} else {
var serializerPayload = serializer.extract(store, modelClass, payload, id, requestType);
return ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayload(modelClass, serializerPayload);
}
}
/**
Convert the payload from `serializer.extract` to a JSON-API Document.
@method _normalizeSerializerPayload
@private
@param {subclass of DS.Model} modelClass
@param {Object} payload
@return {Object} JSON-API Document
*/
function ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayload(modelClass, payload) {
var data = null;
if (payload) {
if (Ember.typeOf(payload) === 'array') {
data = ember$data$lib$system$store$serializer$response$$map.call(payload, function (payload) {
return ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayloadItem(modelClass, payload);
});
} else {
data = ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayloadItem(modelClass, payload);
}
}
return { data: data };
}
/**
Convert the payload representing a single record from `serializer.extract` to
a JSON-API Resource Object.
@method _normalizeSerializerPayloadItem
@private
@param {subclass of DS.Model} modelClass
@param {Object} payload
@return {Object} JSON-API Resource Object
*/
function ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayloadItem(modelClass, itemPayload) {
var item = {};
item.id = '' + itemPayload.id;
item.type = modelClass.modelName;
item.attributes = {};
item.relationships = {};
modelClass.eachAttribute(function (name) {
if (itemPayload.hasOwnProperty(name)) {
item.attributes[name] = itemPayload[name];
}
});
modelClass.eachRelationship(function (key, relationshipMeta) {
var relationship, value;
if (itemPayload.hasOwnProperty(key)) {
var relationshipData;
(function () {
relationship = {};
value = itemPayload[key];
var normalizeRelationshipData = function (value, relationshipMeta) {
if (Ember.isNone(value)) {
return null;
}
//Temporary support for https://github.com/emberjs/data/issues/3271
if (value instanceof ember$data$lib$system$model$model$$default) {
value = { id: value.id, type: value.constructor.modelName };
}
if (Ember.typeOf(value) === 'object') {
if (value.id) {
value.id = '' + value.id;
}
return value;
}
return { id: '' + value, type: relationshipMeta.type };
};
if (relationshipMeta.kind === 'belongsTo') {
relationship.data = normalizeRelationshipData(value, relationshipMeta);
//handle the belongsTo polymorphic case, where { post:1, postType: 'video' }
if (relationshipMeta.options && relationshipMeta.options.polymorphic && itemPayload[key + 'Type']) {
relationship.data.type = itemPayload[key + 'Type'];
}
} else if (relationshipMeta.kind === 'hasMany') {
//|| [] because the hasMany could be === null
relationshipData = Ember.A(value || []);
relationship.data = ember$data$lib$system$store$serializer$response$$map.call(relationshipData, function (item) {
return normalizeRelationshipData(item, relationshipMeta);
});
}
})();
}
if (itemPayload.links && itemPayload.links.hasOwnProperty(key)) {
relationship = relationship || {};
value = itemPayload.links[key];
relationship.links = {
related: value
};
}
if (relationship) {
relationship.meta = ember$data$lib$system$store$serializer$response$$get(itemPayload, 'meta.' + key);
item.relationships[key] = relationship;
}
});
return item;
}
/**
Push a JSON-API Document to the store.
This will push both primary data located in `data` and secondary data located
in `included` (if present).
@method pushPayload
@param {DS.Store} store
@param {Object} payload
@return {DS.Model|Array} one or multiple records from `data`
*/
function ember$data$lib$system$store$serializer$response$$pushPayload(store, payload) {
var result = ember$data$lib$system$store$serializer$response$$pushPayloadData(store, payload);
ember$data$lib$system$store$serializer$response$$pushPayloadIncluded(store, payload);
return result;
}
/**
Push the primary data of a JSON-API Document to the store.
This method only pushes the primary data located in `data`.
@method pushPayloadData
@param {DS.Store} store
@param {Object} payload
@return {DS.Model|Array} one or multiple records from `data`
*/
function ember$data$lib$system$store$serializer$response$$pushPayloadData(store, payload) {
var result;
if (payload && payload.data) {
if (Ember.isArray(payload.data)) {
result = ember$data$lib$system$store$serializer$response$$map.call(payload.data, function (item) {
return ember$data$lib$system$store$serializer$response$$_pushResourceObject(store, item);
});
} else {
result = ember$data$lib$system$store$serializer$response$$_pushResourceObject(store, payload.data);
}
}
return result;
}
/**
Push the secondary data of a JSON-API Document to the store.
This method only pushes the secondary data located in `included`.
@method pushPayloadIncluded
@param {DS.Store} store
@param {Object} payload
@return {Array} an array containing zero or more records from `included`
*/
function ember$data$lib$system$store$serializer$response$$pushPayloadIncluded(store, payload) {
var result;
if (payload && payload.included && Ember.isArray(payload.included)) {
result = ember$data$lib$system$store$serializer$response$$map.call(payload.included, function (item) {
return ember$data$lib$system$store$serializer$response$$_pushResourceObject(store, item);
});
}
return result;
}
/**
Push a single JSON-API Resource Object to the store.
@method _pushResourceObject
@private
@param {Object} resourceObject
@return {DS.Model} a record
*/
function ember$data$lib$system$store$serializer$response$$_pushResourceObject(store, resourceObject) {
return store.push({ data: resourceObject });
}
/**
This method converts a JSON-API Resource Object to a format that DS.Store
understands.
TODO: This method works as an interim until DS.Store understands JSON-API.
@method convertResourceObject
@param {Object} payload
@return {Object} an object formatted the way DS.Store understands
*/
function ember$data$lib$system$store$serializer$response$$convertResourceObject(payload) {
if (!payload) {
return payload;
}
var data = {
id: payload.id,
type: payload.type,
links: {}
};
if (payload.attributes) {
var attributeKeys = ember$data$lib$system$object$polyfills$$keysFunc(payload.attributes);
ember$data$lib$system$store$serializer$response$$forEach.call(attributeKeys, function (key) {
var attribute = payload.attributes[key];
data[key] = attribute;
});
}
if (payload.relationships) {
var relationshipKeys = ember$data$lib$system$object$polyfills$$keysFunc(payload.relationships);
ember$data$lib$system$store$serializer$response$$forEach.call(relationshipKeys, function (key) {
var relationship = payload.relationships[key];
if (relationship.hasOwnProperty('data')) {
data[key] = relationship.data;
} else if (relationship.links && relationship.links.related) {
data.links[key] = relationship.links.related;
}
});
}
return data;
}
var ember$data$lib$serializers$rest$serializer$$forEach = ember$data$lib$ext$ember$array$$default.forEach;
var ember$data$lib$serializers$rest$serializer$$map = ember$data$lib$ext$ember$array$$default.map;
var ember$data$lib$serializers$rest$serializer$$camelize = Ember.String.camelize;
var ember$data$lib$serializers$rest$serializer$$get = Ember.get;
/**
Normally, applications will use the `RESTSerializer` by implementing
the `normalize` method and individual normalizations under
`normalizeHash`.
This allows you to do whatever kind of munging you need, and is
especially useful if your server is inconsistent and you need to
do munging differently for many different kinds of responses.
See the `normalize` documentation for more information.
## Across the Board Normalization
There are also a number of hooks that you might find useful to define
across-the-board rules for your payload. These rules will be useful
if your server is consistent, or if you're building an adapter for
an infrastructure service, like Parse, and want to encode service
conventions.
For example, if all of your keys are underscored and all-caps, but
otherwise consistent with the names you use in your models, you
can implement across-the-board rules for how to convert an attribute
name in your model to a key in your JSON.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
keyForAttribute: function(attr, method) {
return Ember.String.underscore(attr).toUpperCase();
}
});
```
You can also implement `keyForRelationship`, which takes the name
of the relationship as the first parameter, the kind of
relationship (`hasMany` or `belongsTo`) as the second parameter, and
the method (`serialize` or `deserialize`) as the third parameter.
@class RESTSerializer
@namespace DS
@extends DS.JSONSerializer
*/
var ember$data$lib$serializers$rest$serializer$$RESTSerializer = ember$data$lib$serializers$json$serializer$$default.extend({
/**
If you want to do normalizations specific to some part of the payload, you
can specify those under `normalizeHash`.
For example, given the following json where the the `IDs` under
`"comments"` are provided as `_id` instead of `id`.
```javascript
{
"post": {
"id": 1,
"title": "Rails is omakase",
"comments": [ 1, 2 ]
},
"comments": [{
"_id": 1,
"body": "FIRST"
}, {
"_id": 2,
"body": "Rails is unagi"
}]
}
```
You use `normalizeHash` to normalize just the comments:
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
normalizeHash: {
comments: function(hash) {
hash.id = hash._id;
delete hash._id;
return hash;
}
}
});
```
The key under `normalizeHash` is usually just the original key
that was in the original payload. However, key names will be
impacted by any modifications done in the `normalizePayload`
method. The `DS.RESTSerializer`'s default implementation makes no
changes to the payload keys.
@property normalizeHash
@type {Object}
@default undefined
@deprecated
*/
/**
Normalizes a part of the JSON payload returned by
the server. You should override this method, munge the hash
and call super if you have generic normalization to do.
It takes the type of the record that is being normalized
(as a DS.Model class), the property where the hash was
originally found, and the hash to normalize.
For example, if you have a payload that looks like this:
```js
{
"post": {
"id": 1,
"title": "Rails is omakase",
"comments": [ 1, 2 ]
},
"comments": [{
"id": 1,
"body": "FIRST"
}, {
"id": 2,
"body": "Rails is unagi"
}]
}
```
The `normalize` method will be called three times:
* With `App.Post`, `"posts"` and `{ id: 1, title: "Rails is omakase", ... }`
* With `App.Comment`, `"comments"` and `{ id: 1, body: "FIRST" }`
* With `App.Comment`, `"comments"` and `{ id: 2, body: "Rails is unagi" }`
You can use this method, for example, to normalize underscored keys to camelized
or other general-purpose normalizations.
If you want to do normalizations specific to some part of the payload, you
can specify those under `normalizeHash`.
For example, if the `IDs` under `"comments"` are provided as `_id` instead of
`id`, you can specify how to normalize just the comments:
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
normalizeHash: {
comments: function(hash) {
hash.id = hash._id;
delete hash._id;
return hash;
}
}
});
```
The key under `normalizeHash` is just the original key that was in the original
payload.
@method normalize
@param {DS.Model} typeClass
@param {Object} hash
@param {String} prop
@return {Object}
*/
normalize: function (typeClass, hash, prop) {
if (this.get('isNewSerializerAPI')) {
ember$data$lib$serializers$rest$serializer$$_newNormalize.apply(this, arguments);
return this._super.apply(this, arguments);
}
this.normalizeId(hash);
this.normalizeAttributes(typeClass, hash);
this.normalizeRelationships(typeClass, hash);
this.normalizeUsingDeclaredMapping(typeClass, hash);
if (this.normalizeHash && this.normalizeHash[prop]) {
this.normalizeHash[prop](hash);
}
this.applyTransforms(typeClass, hash);
return hash;
},
/**
Normalizes an array of resource payloads and returns a JSON-API Document
with primary data and, if any, included data as `{ data, included }`.
@method normalizeArray
@param {DS.Store} store
@param {String} modelName
@param {Object} arrayHash
@param {String} prop
@return {Object}
*/
normalizeArray: function (store, modelName, arrayHash, prop) {
var _this = this;
var documentHash = {
data: [],
included: []
};
var modelClass = store.modelFor(modelName);
var serializer = store.serializerFor(modelName);
var primaryHasTypeAttribute = ember$data$lib$serializers$rest$serializer$$get(modelClass, 'attributes').get('type');
/*jshint loopfunc:true*/
ember$data$lib$serializers$rest$serializer$$forEach.call(arrayHash, function (hash) {
var _normalizePolymorphicRecord = _this._normalizePolymorphicRecord(store, hash, prop, modelClass, serializer, primaryHasTypeAttribute);
var data = _normalizePolymorphicRecord.data;
var included = _normalizePolymorphicRecord.included;
documentHash.data.push(data);
if (included) {
var _documentHash$included;
(_documentHash$included = documentHash.included).push.apply(_documentHash$included, included);
}
}, this);
return documentHash;
},
_normalizePolymorphicRecord: function (store, hash, prop, primaryModelClass, primarySerializer, primaryHasTypeAttribute) {
var serializer = undefined,
modelClass = undefined;
// Support polymorphic records in async relationships
if (!primaryHasTypeAttribute && hash.type && store._hasModelFor(this.modelNameFromPayloadKey(hash.type))) {
serializer = store.serializerFor(hash.type);
modelClass = store.modelFor(hash.type);
} else {
serializer = primarySerializer;
modelClass = primaryModelClass;
}
return serializer.normalize(modelClass, hash, prop);
},
/*
@method _normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@param {Boolean} isSingle
@return {Object} JSON-API Document
@private
*/
_normalizeResponse: function (store, primaryModelClass, payload, id, requestType, isSingle) {
var documentHash = {
data: null,
included: []
};
var meta = this.extractMeta(store, primaryModelClass, payload);
if (meta) {
documentHash.meta = meta;
}
var keys = ember$data$lib$system$object$polyfills$$keysFunc(payload);
for (var i = 0, _length = keys.length; i < _length; i++) {
var prop = keys[i];
var modelName = prop;
var forcedSecondary = false;
/*
If you want to provide sideloaded records of the same type that the
primary data you can do that by prefixing the key with `_`.
Example
```
{
users: [
{ id: 1, title: 'Tom', manager: 3 },
{ id: 2, title: 'Yehuda', manager: 3 }
],
_users: [
{ id: 3, title: 'Tomster' }
]
}
```
This forces `_users` to be added to `included` instead of `data`.
*/
if (prop.charAt(0) === '_') {
forcedSecondary = true;
modelName = prop.substr(1);
}
var typeName = this.modelNameFromPayloadKey(modelName);
if (!store.modelFactoryFor(typeName)) {
continue;
}
var isPrimary = !forcedSecondary && this.isPrimaryType(store, typeName, primaryModelClass);
var value = payload[prop];
if (value === null) {
continue;
}
/*
Support primary data as an object instead of an array.
Example
```
{
user: { id: 1, title: 'Tom', manager: 3 }
}
```
*/
if (isPrimary && Ember.typeOf(value) !== 'array') {
var _normalizePolymorphicRecord2 = this._normalizePolymorphicRecord(store, value, prop, primaryModelClass, this);
var _data = _normalizePolymorphicRecord2.data;
var _included = _normalizePolymorphicRecord2.included;
documentHash.data = _data;
if (_included) {
var _documentHash$included2;
(_documentHash$included2 = documentHash.included).push.apply(_documentHash$included2, _included);
}
continue;
}
var _normalizeArray = this.normalizeArray(store, typeName, value, prop);
var data = _normalizeArray.data;
var included = _normalizeArray.included;
if (included) {
var _documentHash$included3;
(_documentHash$included3 = documentHash.included).push.apply(_documentHash$included3, included);
}
if (isSingle) {
/*jshint loopfunc:true*/
ember$data$lib$serializers$rest$serializer$$forEach.call(data, function (resource) {
/*
Figures out if this is the primary record or not.
It's either:
1. The record with the same ID as the original request
2. If it's a newly created record without an ID, the first record
in the array
*/
var isUpdatedRecord = isPrimary && ember$data$lib$system$coerce$id$$default(resource.id) === id;
var isFirstCreatedRecord = isPrimary && !id && !documentHash.data;
if (isFirstCreatedRecord || isUpdatedRecord) {
documentHash.data = resource;
} else {
documentHash.included.push(resource);
}
});
} else {
if (isPrimary) {
documentHash.data = data;
} else {
if (data) {
var _documentHash$included4;
(_documentHash$included4 = documentHash.included).push.apply(_documentHash$included4, data);
}
}
}
}
return documentHash;
},
/**
Called when the server has returned a payload representing
a single record, such as in response to a `find` or `save`.
It is your opportunity to clean up the server's response into the normalized
form expected by Ember Data.
If you want, you can just restructure the top-level of your payload, and
do more fine-grained normalization in the `normalize` method.
For example, if you have a payload like this in response to a request for
post 1:
```js
{
"id": 1,
"title": "Rails is omakase",
"_embedded": {
"comment": [{
"_id": 1,
"comment_title": "FIRST"
}, {
"_id": 2,
"comment_title": "Rails is unagi"
}]
}
}
```
You could implement a serializer that looks like this to get your payload
into shape:
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
// First, restructure the top-level so it's organized by type
extractSingle: function(store, typeClass, payload, id) {
var comments = payload._embedded.comment;
delete payload._embedded;
payload = { comments: comments, post: payload };
return this._super(store, typeClass, payload, id);
},
normalizeHash: {
// Next, normalize individual comments, which (after `extract`)
// are now located under `comments`
comments: function(hash) {
hash.id = hash._id;
hash.title = hash.comment_title;
delete hash._id;
delete hash.comment_title;
return hash;
}
}
})
```
When you call super from your own implementation of `extractSingle`, the
built-in implementation will find the primary record in your normalized
payload and push the remaining records into the store.
The primary record is the single hash found under `post` or the first
element of the `posts` array.
The primary record has special meaning when the record is being created
for the first time or updated (`createRecord` or `updateRecord`). In
particular, it will update the properties of the record that was saved.
@method extractSingle
@param {DS.Store} store
@param {DS.Model} primaryTypeClass
@param {Object} rawPayload
@param {String} recordId
@return {Object} the primary response to the original request
*/
extractSingle: function (store, primaryTypeClass, rawPayload, recordId) {
var payload = this.normalizePayload(rawPayload);
var primaryRecord;
for (var prop in payload) {
var modelName = this.modelNameFromPayloadKey(prop);
if (!store.modelFactoryFor(modelName)) {
continue;
}
var isPrimary = this.isPrimaryType(store, modelName, primaryTypeClass);
var value = payload[prop];
if (value === null) {
continue;
}
// legacy support for singular resources
if (isPrimary && Ember.typeOf(value) !== "array") {
primaryRecord = this.normalize(primaryTypeClass, value, prop);
continue;
}
/*jshint loopfunc:true*/
ember$data$lib$serializers$rest$serializer$$forEach.call(value, function (hash) {
var typeName = this.modelNameFromPayloadKey(prop);
var type = store.modelFor(typeName);
var typeSerializer = store.serializerFor(type.modelName);
hash = typeSerializer.normalize(type, hash, prop);
var isFirstCreatedRecord = isPrimary && !recordId && !primaryRecord;
var isUpdatedRecord = isPrimary && ember$data$lib$system$coerce$id$$default(hash.id) === recordId;
// find the primary record.
//
// It's either:
// * the record with the same ID as the original request
// * in the case of a newly created record that didn't have an ID, the first
// record in the Array
if (isFirstCreatedRecord || isUpdatedRecord) {
primaryRecord = hash;
} else {
store.push(modelName, hash);
}
}, this);
}
return primaryRecord;
},
/**
Called when the server has returned a payload representing
multiple records, such as in response to a `findAll` or `findQuery`.
It is your opportunity to clean up the server's response into the normalized
form expected by Ember Data.
If you want, you can just restructure the top-level of your payload, and
do more fine-grained normalization in the `normalize` method.
For example, if you have a payload like this in response to a request for
all posts:
```js
{
"_embedded": {
"post": [{
"id": 1,
"title": "Rails is omakase"
}, {
"id": 2,
"title": "The Parley Letter"
}],
"comment": [{
"_id": 1,
"comment_title": "Rails is unagi",
"post_id": 1
}, {
"_id": 2,
"comment_title": "Don't tread on me",
"post_id": 2
}]
}
}
```
You could implement a serializer that looks like this to get your payload
into shape:
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
// First, restructure the top-level so it's organized by type
// and the comments are listed under a post's `comments` key.
extractArray: function(store, type, payload) {
var posts = payload._embedded.post;
var comments = [];
var postCache = {};
posts.forEach(function(post) {
post.comments = [];
postCache[post.id] = post;
});
payload._embedded.comment.forEach(function(comment) {
comments.push(comment);
postCache[comment.post_id].comments.push(comment);
delete comment.post_id;
});
payload = { comments: comments, posts: posts };
return this._super(store, type, payload);
},
normalizeHash: {
// Next, normalize individual comments, which (after `extract`)
// are now located under `comments`
comments: function(hash) {
hash.id = hash._id;
hash.title = hash.comment_title;
delete hash._id;
delete hash.comment_title;
return hash;
}
}
})
```
When you call super from your own implementation of `extractArray`, the
built-in implementation will find the primary array in your normalized
payload and push the remaining records into the store.
The primary array is the array found under `posts`.
The primary record has special meaning when responding to `findQuery`
or `findHasMany`. In particular, the primary array will become the
list of records in the record array that kicked off the request.
If your primary array contains secondary (embedded) records of the same type,
you cannot place these into the primary array `posts`. Instead, place the
secondary items into an underscore prefixed property `_posts`, which will
push these items into the store and will not affect the resulting query.
@method extractArray
@param {DS.Store} store
@param {DS.Model} primaryTypeClass
@param {Object} rawPayload
@return {Array} The primary array that was returned in response
to the original query.
*/
extractArray: function (store, primaryTypeClass, rawPayload) {
var payload = this.normalizePayload(rawPayload);
var primaryArray;
for (var prop in payload) {
var modelName = prop;
var forcedSecondary = false;
if (prop.charAt(0) === '_') {
forcedSecondary = true;
modelName = prop.substr(1);
}
var typeName = this.modelNameFromPayloadKey(modelName);
if (!store.modelFactoryFor(typeName)) {
continue;
}
var type = store.modelFor(typeName);
var typeSerializer = store.serializerFor(type.modelName);
var isPrimary = !forcedSecondary && this.isPrimaryType(store, typeName, primaryTypeClass);
/*jshint loopfunc:true*/
var normalizedArray = ember$data$lib$serializers$rest$serializer$$map.call(payload[prop], function (hash) {
return typeSerializer.normalize(type, hash, prop);
}, this);
if (isPrimary) {
primaryArray = normalizedArray;
} else {
store.pushMany(typeName, normalizedArray);
}
}
return primaryArray;
},
isPrimaryType: function (store, typeName, primaryTypeClass) {
var typeClass = store.modelFor(typeName);
return typeClass.modelName === primaryTypeClass.modelName;
},
/**
This method allows you to push a payload containing top-level
collections of records organized per type.
```js
{
"posts": [{
"id": "1",
"title": "Rails is omakase",
"author", "1",
"comments": [ "1" ]
}],
"comments": [{
"id": "1",
"body": "FIRST"
}],
"users": [{
"id": "1",
"name": "@d2h"
}]
}
```
It will first normalize the payload, so you can use this to push
in data streaming in from your server structured the same way
that fetches and saves are structured.
@method pushPayload
@param {DS.Store} store
@param {Object} rawPayload
*/
pushPayload: function (store, rawPayload) {
if (this.get('isNewSerializerAPI')) {
ember$data$lib$serializers$rest$serializer$$_newPushPayload.apply(this, arguments);
return;
}
var payload = this.normalizePayload(rawPayload);
for (var prop in payload) {
var modelName = this.modelNameFromPayloadKey(prop);
if (!store.modelFactoryFor(modelName)) {
continue;
}
var typeClass = store.modelFor(modelName);
var typeSerializer = store.serializerFor(modelName);
/*jshint loopfunc:true*/
var normalizedArray = ember$data$lib$serializers$rest$serializer$$map.call(Ember.makeArray(payload[prop]), function (hash) {
return typeSerializer.normalize(typeClass, hash, prop);
}, this);
store.pushMany(modelName, normalizedArray);
}
},
/**
This method is used to convert each JSON root key in the payload
into a modelName that it can use to look up the appropriate model for
that part of the payload.
For example, your server may send a model name that does not correspond with
the name of the model in your app. Let's take a look at an example model,
and an example payload:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
});
```
```javascript
{
"blog/post": {
"id": "1
}
}
```
Ember Data is going to normalize the payload's root key for the modelName. As a result,
it will try to look up the "blog/post" model. Since we don't have a model called "blog/post"
(or a file called app/models/blog/post.js in ember-cli), Ember Data will throw an error
because it cannot find the "blog/post" model.
Since we want to remove this namespace, we can define a serializer for the application that will
remove "blog/" from the payload key whenver it's encountered by Ember Data:
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
modelNameFromPayloadKey: function(payloadKey) {
if (payloadKey === 'blog/post') {
return this._super(payloadKey.replace('blog/', ''));
} else {
return this._super(payloadKey);
}
}
});
```
After refreshing, Ember Data will appropriately look up the "post" model.
By default the modelName for a model is its
name in dasherized form. This means that a payload key like "blogPost" would be
normalized to "blog-post" when Ember Data looks up the model. Usually, Ember Data
can use the correct inflection to do this for you. Most of the time, you won't
need to override `modelNameFromPayloadKey` for this purpose.
@method modelNameFromPayloadKey
@param {String} key
@return {String} the model's modelName
*/
modelNameFromPayloadKey: function (key) {
return ember$inflector$lib$lib$system$string$$singularize(ember$data$lib$system$normalize$model$name$$default(key));
},
// SERIALIZE
/**
Called when a record is saved in order to convert the
record into JSON.
By default, it creates a JSON object with a key for
each attribute and belongsTo relationship.
For example, consider this model:
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr(),
body: DS.attr(),
author: DS.belongsTo('user')
});
```
The default serialization would create a JSON object like:
```js
{
"title": "Rails is unagi",
"body": "Rails? Omakase? O_O",
"author": 12
}
```
By default, attributes are passed through as-is, unless
you specified an attribute type (`DS.attr('date')`). If
you specify a transform, the JavaScript value will be
serialized when inserted into the JSON hash.
By default, belongs-to relationships are converted into
IDs when inserted into the JSON hash.
## IDs
`serialize` takes an options hash with a single option:
`includeId`. If this option is `true`, `serialize` will,
by default include the ID in the JSON object it builds.
The adapter passes in `includeId: true` when serializing
a record for `createRecord`, but not for `updateRecord`.
## Customization
Your server may expect a different JSON format than the
built-in serialization format.
In that case, you can implement `serialize` yourself and
return a JSON hash of your choosing.
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serialize: function(snapshot, options) {
var json = {
POST_TTL: snapshot.attr('title'),
POST_BDY: snapshot.attr('body'),
POST_CMS: snapshot.hasMany('comments', { ids: true })
}
if (options.includeId) {
json.POST_ID_ = snapshot.id;
}
return json;
}
});
```
## Customizing an App-Wide Serializer
If you want to define a serializer for your entire
application, you'll probably want to use `eachAttribute`
and `eachRelationship` on the record.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serialize: function(snapshot, options) {
var json = {};
snapshot.eachAttribute(function(name) {
json[serverAttributeName(name)] = snapshot.attr(name);
})
snapshot.eachRelationship(function(name, relationship) {
if (relationship.kind === 'hasMany') {
json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });
}
});
if (options.includeId) {
json.ID_ = snapshot.id;
}
return json;
}
});
function serverAttributeName(attribute) {
return attribute.underscore().toUpperCase();
}
function serverHasManyName(name) {
return serverAttributeName(name.singularize()) + "_IDS";
}
```
This serializer will generate JSON that looks like this:
```js
{
"TITLE": "Rails is omakase",
"BODY": "Yep. Omakase.",
"COMMENT_IDS": [ 1, 2, 3 ]
}
```
## Tweaking the Default JSON
If you just want to do some small tweaks on the default JSON,
you can call super first and make the tweaks on the returned
JSON.
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serialize: function(snapshot, options) {
var json = this._super(snapshot, options);
json.subject = json.title;
delete json.title;
return json;
}
});
```
@method serialize
@param {DS.Snapshot} snapshot
@param {Object} options
@return {Object} json
*/
serialize: function (snapshot, options) {
return this._super.apply(this, arguments);
},
/**
You can use this method to customize the root keys serialized into the JSON.
By default the REST Serializer sends the modelName of a model, which is a camelized
version of the name.
For example, your server may expect underscored root objects.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serializeIntoHash: function(data, type, record, options) {
var root = Ember.String.decamelize(type.modelName);
data[root] = this.serialize(record, options);
}
});
```
@method serializeIntoHash
@param {Object} hash
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
@param {Object} options
*/
serializeIntoHash: function (hash, typeClass, snapshot, options) {
var normalizedRootKey = this.payloadKeyFromModelName(typeClass.modelName);
hash[normalizedRootKey] = this.serialize(snapshot, options);
},
/**
You can use `payloadKeyFromModelName` to override the root key for an outgoing
request. By default, the RESTSerializer returns a camelized version of the
model's name.
For a model called TacoParty, its `modelName` would be the string `taco-party`. The RESTSerializer
will send it to the server with `tacoParty` as the root key in the JSON payload:
```js
{
"tacoParty": {
"id": "1",
"location": "Matthew Beale's House"
}
}
```
For example, your server may expect dasherized root objects:
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
payloadKeyFromModelName: function(modelName) {
return Ember.String.dasherize(modelName);
}
});
```
Given a `TacoParty' model, calling `save` on a tacoModel would produce an outgoing
request like:
```js
{
"taco-party": {
"id": "1",
"location": "Matthew Beale's House"
}
}
```
@method payloadKeyFromModelName
@param {String} modelName
@return {String}
*/
payloadKeyFromModelName: function (modelName) {
return ember$data$lib$serializers$rest$serializer$$camelize(modelName);
},
/**
Deprecated. Use modelNameFromPayloadKey instead
@method typeForRoot
@param {String} modelName
@return {String}
@deprecated
*/
typeForRoot: function (modelName) {
return this.modelNameFromPayloadKey(modelName);
},
/**
You can use this method to customize how polymorphic objects are serialized.
By default the JSON Serializer creates the key by appending `Type` to
the attribute and value from the model's camelcased model name.
@method serializePolymorphicType
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializePolymorphicType: function (snapshot, json, relationship) {
var key = relationship.key;
var belongsTo = snapshot.belongsTo(key);
key = this.keyForAttribute ? this.keyForAttribute(key, "serialize") : key;
if (Ember.isNone(belongsTo)) {
json[key + "Type"] = null;
} else {
json[key + "Type"] = Ember.String.camelize(belongsTo.modelName);
}
}
});
var ember$data$lib$serializers$rest$serializer$$default = ember$data$lib$serializers$rest$serializer$$RESTSerializer;
/*
@method _newNormalize
@param {DS.Model} modelClass
@param {Object} resourceHash
@param {String} prop
@return {Object}
@private
*/
function ember$data$lib$serializers$rest$serializer$$_newNormalize(modelClass, resourceHash, prop) {
if (this.normalizeHash && this.normalizeHash[prop]) {
this.normalizeHash[prop](resourceHash);
}
}
/*
@method _newPushPayload
@param {DS.Store} store
@param {Object} rawPayload
*/
function ember$data$lib$serializers$rest$serializer$$_newPushPayload(store, rawPayload) {
var documentHash = {
data: [],
included: []
};
var payload = this.normalizePayload(rawPayload);
for (var prop in payload) {
var modelName = this.modelNameFromPayloadKey(prop);
if (!store.modelFactoryFor(modelName)) {
continue;
}
var type = store.modelFor(modelName);
var typeSerializer = store.serializerFor(type.modelName);
/*jshint loopfunc:true*/
ember$data$lib$serializers$rest$serializer$$forEach.call(Ember.makeArray(payload[prop]), function (hash) {
var _typeSerializer$normalize = typeSerializer.normalize(type, hash, prop);
var data = _typeSerializer$normalize.data;
var included = _typeSerializer$normalize.included;
documentHash.data.push(data);
if (included) {
var _documentHash$included5;
(_documentHash$included5 = documentHash.included).push.apply(_documentHash$included5, included);
}
}, this);
}
ember$data$lib$system$store$serializer$response$$pushPayload(store, documentHash);
}
/**
@module ember-data
*/
var activemodel$adapter$lib$system$active$model$serializer$$_Ember$String = ember$lib$main$$default.String;
var activemodel$adapter$lib$system$active$model$serializer$$singularize = activemodel$adapter$lib$system$active$model$serializer$$_Ember$String.singularize;
var activemodel$adapter$lib$system$active$model$serializer$$classify = activemodel$adapter$lib$system$active$model$serializer$$_Ember$String.classify;
var activemodel$adapter$lib$system$active$model$serializer$$decamelize = activemodel$adapter$lib$system$active$model$serializer$$_Ember$String.decamelize;
var activemodel$adapter$lib$system$active$model$serializer$$camelize = activemodel$adapter$lib$system$active$model$serializer$$_Ember$String.camelize;
var activemodel$adapter$lib$system$active$model$serializer$$underscore = activemodel$adapter$lib$system$active$model$serializer$$_Ember$String.underscore;
/**
The ActiveModelSerializer is a subclass of the RESTSerializer designed to integrate
with a JSON API that uses an underscored naming convention instead of camelCasing.
It has been designed to work out of the box with the
[active\_model\_serializers](http://github.com/rails-api/active_model_serializers)
Ruby gem. This Serializer expects specific settings using ActiveModel::Serializers,
`embed :ids, embed_in_root: true` which sideloads the records.
This serializer extends the DS.RESTSerializer by making consistent
use of the camelization, decamelization and pluralization methods to
normalize the serialized JSON into a format that is compatible with
a conventional Rails backend and Ember Data.
## JSON Structure
The ActiveModelSerializer expects the JSON returned from your server
to follow the REST adapter conventions substituting underscored keys
for camelcased ones.
### Conventional Names
Attribute names in your JSON payload should be the underscored versions of
the attributes in your Ember.js models.
For example, if you have a `Person` model:
```js
App.FamousPerson = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.attr('string')
});
```
The JSON returned should look like this:
```js
{
"famous_person": {
"id": 1,
"first_name": "Barack",
"last_name": "Obama",
"occupation": "President"
}
}
```
Let's imagine that `Occupation` is just another model:
```js
App.Person = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.belongsTo('occupation')
});
App.Occupation = DS.Model.extend({
name: DS.attr('string'),
salary: DS.attr('number'),
people: DS.hasMany('person')
});
```
The JSON needed to avoid extra server calls, should look like this:
```js
{
"people": [{
"id": 1,
"first_name": "Barack",
"last_name": "Obama",
"occupation_id": 1
}],
"occupations": [{
"id": 1,
"name": "President",
"salary": 100000,
"person_ids": [1]
}]
}
```
@class ActiveModelSerializer
@namespace DS
@extends DS.RESTSerializer
*/
var activemodel$adapter$lib$system$active$model$serializer$$ActiveModelSerializer = ember$data$lib$serializers$rest$serializer$$default.extend({
// SERIALIZE
/**
Converts camelCased attributes to underscored when serializing.
@method keyForAttribute
@param {String} attribute
@return String
*/
keyForAttribute: function (attr) {
return activemodel$adapter$lib$system$active$model$serializer$$decamelize(attr);
},
/**
Underscores relationship names and appends "_id" or "_ids" when serializing
relationship keys.
@method keyForRelationship
@param {String} relationshipModelName
@param {String} kind
@return String
*/
keyForRelationship: function (relationshipModelName, kind) {
var key = activemodel$adapter$lib$system$active$model$serializer$$decamelize(relationshipModelName);
if (kind === "belongsTo") {
return key + "_id";
} else if (kind === "hasMany") {
return activemodel$adapter$lib$system$active$model$serializer$$singularize(key) + "_ids";
} else {
return key;
}
},
/**
`keyForLink` can be used to define a custom key when deserializing link
properties. The `ActiveModelSerializer` camelizes link keys by default.
@method keyForLink
@param {String} key
@param {String} kind `belongsTo` or `hasMany`
@return {String} normalized key
*/
keyForLink: function (key, relationshipKind) {
return activemodel$adapter$lib$system$active$model$serializer$$camelize(key);
},
/*
Does not serialize hasMany relationships by default.
*/
serializeHasMany: ember$lib$main$$default.K,
/**
Underscores the JSON root keys when serializing.
@method payloadKeyFromModelName
@param {String} modelName
@return {String}
*/
payloadKeyFromModelName: function (modelName) {
return activemodel$adapter$lib$system$active$model$serializer$$underscore(activemodel$adapter$lib$system$active$model$serializer$$decamelize(modelName));
},
/**
Serializes a polymorphic type as a fully capitalized model name.
@method serializePolymorphicType
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializePolymorphicType: function (snapshot, json, relationship) {
var key = relationship.key;
var belongsTo = snapshot.belongsTo(key);
var jsonKey = activemodel$adapter$lib$system$active$model$serializer$$underscore(key + "_type");
if (ember$lib$main$$default.isNone(belongsTo)) {
json[jsonKey] = null;
} else {
json[jsonKey] = activemodel$adapter$lib$system$active$model$serializer$$classify(belongsTo.modelName).replace('/', '::');
}
},
// EXTRACT
/**
Add extra step to `DS.RESTSerializer.normalize` so links are normalized.
If your payload looks like:
```js
{
"post": {
"id": 1,
"title": "Rails is omakase",
"links": { "flagged_comments": "api/comments/flagged" }
}
}
```
The normalized version would look like this
```js
{
"post": {
"id": 1,
"title": "Rails is omakase",
"links": { "flaggedComments": "api/comments/flagged" }
}
}
```
@method normalize
@param {subclass of DS.Model} typeClass
@param {Object} hash
@param {String} prop
@return Object
*/
normalize: function (typeClass, hash, prop) {
this.normalizeLinks(hash);
return this._super(typeClass, hash, prop);
},
/**
Convert `snake_cased` links to `camelCase`
@method normalizeLinks
@param {Object} data
*/
normalizeLinks: function (data) {
if (data.links) {
var links = data.links;
for (var link in links) {
var camelizedLink = activemodel$adapter$lib$system$active$model$serializer$$camelize(link);
if (camelizedLink !== link) {
links[camelizedLink] = links[link];
delete links[link];
}
}
}
},
/**
Normalize the polymorphic type from the JSON.
Normalize:
```js
{
id: "1"
minion: { type: "evil_minion", id: "12"}
}
```
To:
```js
{
id: "1"
minion: { type: "evilMinion", id: "12"}
}
```
@param {Subclass of DS.Model} typeClass
@method normalizeRelationships
@private
*/
normalizeRelationships: function (typeClass, hash) {
if (this.keyForRelationship) {
typeClass.eachRelationship(function (key, relationship) {
var payloadKey, payload;
if (relationship.options.polymorphic) {
payloadKey = this.keyForAttribute(key, "deserialize");
payload = hash[payloadKey];
if (payload && payload.type) {
payload.type = this.modelNameFromPayloadKey(payload.type);
} else if (payload && relationship.kind === "hasMany") {
for (var i = 0, len = payload.length; i < len; i++) {
var single = payload[i];
single.type = this.modelNameFromPayloadKey(single.type);
}
}
} else {
payloadKey = this.keyForRelationship(key, relationship.kind, "deserialize");
if (!hash.hasOwnProperty(payloadKey)) {
return;
}
payload = hash[payloadKey];
}
hash[key] = payload;
if (key !== payloadKey) {
delete hash[payloadKey];
}
}, this);
}
},
extractRelationships: function (modelClass, resourceHash) {
modelClass.eachRelationship(function (key, relationshipMeta) {
var relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, "deserialize");
// prefer the format the AMS gem expects, e.g.:
// relationship: {id: id, type: type}
if (relationshipMeta.options.polymorphic) {
activemodel$adapter$lib$system$active$model$serializer$$extractPolymorphicRelationships(key, relationshipMeta, resourceHash, relationshipKey);
}
// If the preferred format is not found, use {relationship_name_id, relationship_name_type}
if (resourceHash.hasOwnProperty(relationshipKey) && typeof resourceHash[relationshipKey] !== 'object') {
var polymorphicTypeKey = this.keyForRelationship(key) + '_type';
if (resourceHash[polymorphicTypeKey] && relationshipMeta.options.polymorphic) {
var id = resourceHash[relationshipKey];
var type = resourceHash[polymorphicTypeKey];
delete resourceHash[polymorphicTypeKey];
delete resourceHash[relationshipKey];
resourceHash[relationshipKey] = { id: id, type: type };
}
}
}, this);
return this._super.apply(this, arguments);
},
modelNameFromPayloadKey: function (key) {
var convertedFromRubyModule = activemodel$adapter$lib$system$active$model$serializer$$singularize(key.replace('::', '/'));
return ember$data$lib$system$normalize$model$name$$default(convertedFromRubyModule);
}
});
function activemodel$adapter$lib$system$active$model$serializer$$extractPolymorphicRelationships(key, relationshipMeta, resourceHash, relationshipKey) {
var polymorphicKey = activemodel$adapter$lib$system$active$model$serializer$$decamelize(key);
if (polymorphicKey in resourceHash && typeof resourceHash[polymorphicKey] === 'object') {
if (relationshipMeta.kind === 'belongsTo') {
var hash = resourceHash[polymorphicKey];
var id = hash.id;
var type = hash.type;
resourceHash[relationshipKey] = { id: id, type: type };
// otherwise hasMany
} else {
var hashes = resourceHash[polymorphicKey];
if (!hashes) {
return;
}
// TODO: replace this with map when ActiveModelAdapter branches for Ember Data 2.0
var array = [];
for (var i = 0, _length = hashes.length; i < _length; i++) {
var hash = hashes[i];
var id = hash.id;
var type = hash.type;
array.push({ id: id, type: type });
}
resourceHash[relationshipKey] = array;
}
}
}
var activemodel$adapter$lib$system$active$model$serializer$$default = activemodel$adapter$lib$system$active$model$serializer$$ActiveModelSerializer;
function ember$data$lib$system$container$proxy$$ContainerProxy(container) {
this.container = container;
}
ember$data$lib$system$container$proxy$$ContainerProxy.prototype.aliasedFactory = function (path, preLookup) {
var _this = this;
return {
create: function () {
if (preLookup) {
preLookup();
}
return _this.container.lookup(path);
}
};
};
ember$data$lib$system$container$proxy$$ContainerProxy.prototype.registerAlias = function (source, dest, preLookup) {
var factory = this.aliasedFactory(dest, preLookup);
return this.container.register(source, factory);
};
ember$data$lib$system$container$proxy$$ContainerProxy.prototype.registerDeprecation = function (deprecated, valid) {
var preLookupCallback = function () {
};
return this.registerAlias(deprecated, valid, preLookupCallback);
};
ember$data$lib$system$container$proxy$$ContainerProxy.prototype.registerDeprecations = function (proxyPairs) {
var i, proxyPair, deprecated, valid;
for (i = proxyPairs.length; i > 0; i--) {
proxyPair = proxyPairs[i - 1];
deprecated = proxyPair['deprecated'];
valid = proxyPair['valid'];
this.registerDeprecation(deprecated, valid);
}
};
var ember$data$lib$system$container$proxy$$default = ember$data$lib$system$container$proxy$$ContainerProxy;
var activemodel$adapter$lib$setup$container$$default = activemodel$adapter$lib$setup$container$$setupActiveModelAdapter;
function activemodel$adapter$lib$setup$container$$setupActiveModelAdapter(registry, application) {
var proxy = new ember$data$lib$system$container$proxy$$default(registry);
proxy.registerDeprecations([{ deprecated: 'serializer:_ams', valid: 'serializer:-active-model' }, { deprecated: 'adapter:_ams', valid: 'adapter:-active-model' }]);
registry.register('serializer:-active-model', activemodel$adapter$lib$system$active$model$serializer$$default.extend({ isNewSerializerAPI: true }));
registry.register('adapter:-active-model', activemodel$adapter$lib$system$active$model$adapter$$default);
}
/**
`DS.FixtureAdapter` is an adapter that loads records from memory.
It's primarily used for development and testing. You can also use
`DS.FixtureAdapter` while working on the API but is not ready to
integrate yet. It is a fully functioning adapter. All CRUD methods
are implemented. You can also implement query logic that a remote
system would do. It's possible to develop your entire application
with `DS.FixtureAdapter`.
For information on how to use the `FixtureAdapter` in your
application please see the [FixtureAdapter
guide](/guides/models/the-fixture-adapter/).
@class FixtureAdapter
@namespace DS
@extends DS.Adapter
*/
var ember$data$lib$adapters$fixture$adapter$$get = Ember.get;
var ember$data$lib$adapters$fixture$adapter$$fmt = Ember.String.fmt;
var ember$data$lib$adapters$fixture$adapter$$indexOf = ember$data$lib$ext$ember$array$$default.indexOf;
var ember$data$lib$adapters$fixture$adapter$$counter = 0;
var ember$data$lib$adapters$fixture$adapter$$default = ember$data$lib$system$adapter$$default.extend({
// by default, fixtures are already in normalized form
serializer: null,
// The fixture adapter does not support coalesceFindRequests
coalesceFindRequests: false,
/**
If `simulateRemoteResponse` is `true` the `FixtureAdapter` will
wait a number of milliseconds before resolving promises with the
fixture values. The wait time can be configured via the `latency`
property.
@property simulateRemoteResponse
@type {Boolean}
@default true
*/
simulateRemoteResponse: true,
/**
By default the `FixtureAdapter` will simulate a wait of the
`latency` milliseconds before resolving promises with the fixture
values. This behavior can be turned off via the
`simulateRemoteResponse` property.
@property latency
@type {Number}
@default 50
*/
latency: 50,
/**
Implement this method in order to provide data associated with a type
@method fixturesForType
@param {DS.Model} typeClass
@return {Array}
*/
fixturesForType: function (typeClass) {
if (typeClass.FIXTURES) {
var fixtures = Ember.A(typeClass.FIXTURES);
return fixtures.map(function (fixture) {
var fixtureIdType = typeof fixture.id;
if (fixtureIdType !== "number" && fixtureIdType !== "string") {
throw new Error(ember$data$lib$adapters$fixture$adapter$$fmt('the id property must be defined as a number or string for fixture %@', [fixture]));
}
fixture.id = fixture.id + '';
return fixture;
});
}
return null;
},
/**
Implement this method in order to query fixtures data
@method queryFixtures
@param {Array} fixtures
@param {Object} query
@param {DS.Model} typeClass
@return {(Promise|Array)}
*/
queryFixtures: function (fixtures, query, typeClass) {
},
/**
@method updateFixtures
@param {DS.Model} typeClass
@param {Array} fixture
*/
updateFixtures: function (typeClass, fixture) {
if (!typeClass.FIXTURES) {
typeClass.FIXTURES = [];
}
var fixtures = typeClass.FIXTURES;
this.deleteLoadedFixture(typeClass, fixture);
fixtures.push(fixture);
},
/**
Implement this method in order to provide json for CRUD methods
@method mockJSON
@param {DS.Store} store
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
*/
mockJSON: function (store, typeClass, snapshot) {
return store.serializerFor(snapshot.modelName).serialize(snapshot, { includeId: true });
},
/**
@method generateIdForRecord
@param {DS.Store} store
@return {String} id
*/
generateIdForRecord: function (store) {
return "fixture-" + ember$data$lib$adapters$fixture$adapter$$counter++;
},
/**
@method find
@param {DS.Store} store
@param {DS.Model} typeClass
@param {String} id
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
find: function (store, typeClass, id, snapshot) {
var fixtures = this.fixturesForType(typeClass);
var fixture;
if (fixtures) {
fixture = Ember.A(fixtures).findBy('id', id);
}
if (fixture) {
return this.simulateRemoteCall(function () {
return fixture;
}, this);
}
},
/**
@method findMany
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
findMany: function (store, typeClass, ids, snapshots) {
var fixtures = this.fixturesForType(typeClass);
if (fixtures) {
fixtures = fixtures.filter(function (item) {
return ember$data$lib$adapters$fixture$adapter$$indexOf.call(ids, item.id) !== -1;
});
}
if (fixtures) {
return this.simulateRemoteCall(function () {
return fixtures;
}, this);
}
},
/**
@private
@method findAll
@param {DS.Store} store
@param {DS.Model} typeClass
@return {Promise} promise
*/
findAll: function (store, typeClass) {
var fixtures = this.fixturesForType(typeClass);
return this.simulateRemoteCall(function () {
return fixtures;
}, this);
},
/**
@private
@method findQuery
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} query
@param {DS.AdapterPopulatedRecordArray} array
@return {Promise} promise
*/
findQuery: function (store, typeClass, query, array) {
var fixtures = this.fixturesForType(typeClass);
fixtures = this.queryFixtures(fixtures, query, typeClass);
if (fixtures) {
return this.simulateRemoteCall(function () {
return fixtures;
}, this);
}
},
/**
@method createRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
createRecord: function (store, typeClass, snapshot) {
var fixture = this.mockJSON(store, typeClass, snapshot);
this.updateFixtures(typeClass, fixture);
return this.simulateRemoteCall(function () {
return fixture;
}, this);
},
/**
@method updateRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: function (store, typeClass, snapshot) {
var fixture = this.mockJSON(store, typeClass, snapshot);
this.updateFixtures(typeClass, fixture);
return this.simulateRemoteCall(function () {
return fixture;
}, this);
},
/**
@method deleteRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
deleteRecord: function (store, typeClass, snapshot) {
this.deleteLoadedFixture(typeClass, snapshot);
return this.simulateRemoteCall(function () {
// no payload in a deletion
return null;
});
},
/*
@method deleteLoadedFixture
@private
@param typeClass
@param snapshot
*/
deleteLoadedFixture: function (typeClass, snapshot) {
var existingFixture = this.findExistingFixture(typeClass, snapshot);
if (existingFixture) {
var index = ember$data$lib$adapters$fixture$adapter$$indexOf.call(typeClass.FIXTURES, existingFixture);
typeClass.FIXTURES.splice(index, 1);
return true;
}
},
/*
@method findExistingFixture
@private
@param typeClass
@param snapshot
*/
findExistingFixture: function (typeClass, snapshot) {
var fixtures = this.fixturesForType(typeClass);
var id = snapshot.id;
return this.findFixtureById(fixtures, id);
},
/*
@method findFixtureById
@private
@param fixtures
@param id
*/
findFixtureById: function (fixtures, id) {
return Ember.A(fixtures).find(function (r) {
if ('' + ember$data$lib$adapters$fixture$adapter$$get(r, 'id') === '' + id) {
return true;
} else {
return false;
}
});
},
/*
@method simulateRemoteCall
@private
@param callback
@param context
*/
simulateRemoteCall: function (callback, context) {
var adapter = this;
return new Ember.RSVP.Promise(function (resolve) {
var value = Ember.copy(callback.call(context), true);
if (ember$data$lib$adapters$fixture$adapter$$get(adapter, 'simulateRemoteResponse')) {
// Schedule with setTimeout
Ember.run.later(function () {
resolve(value);
}, ember$data$lib$adapters$fixture$adapter$$get(adapter, 'latency'));
} else {
// Asynchronous, but at the of the runloop with zero latency
Ember.run.schedule('actions', null, function () {
resolve(value);
});
}
}, "DS: FixtureAdapter#simulateRemoteCall");
}
});
var ember$data$lib$adapters$json$api$adapter$$default = ember$data$lib$adapters$rest$adapter$$default.extend({
defaultSerializer: '-json-api',
/**
@method ajaxOptions
@private
@param {String} url
@param {String} type The request type GET, POST, PUT, DELETE etc.
@param {Object} options
@return {Object}
*/
ajaxOptions: function (url, type, options) {
var hash = this._super.apply(this, arguments);
if (hash.contentType) {
hash.contentType = 'application/vnd.api+json';
}
var beforeSend = hash.beforeSend;
hash.beforeSend = function (xhr) {
xhr.setRequestHeader('Accept', 'application/vnd.api+json');
if (beforeSend) {
beforeSend(xhr);
}
};
return hash;
},
/**
@method findMany
@param {DS.Store} store
@param {DS.Model} type
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
findMany: function (store, type, ids, snapshots) {
var url = this.buildURL(type.modelName, ids, snapshots, 'findMany');
return this.ajax(url, 'GET', { data: { filter: { id: ids.join(',') } } });
},
/**
@method pathForType
@param {String} modelName
@return {String} path
**/
pathForType: function (modelName) {
var dasherized = Ember.String.dasherize(modelName);
return Ember.String.pluralize(dasherized);
},
// TODO: Remove this once we have a better way to override HTTP verbs.
/**
@method updateRecord
@param {DS.Store} store
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: function (store, type, snapshot) {
var data = {};
var serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
var id = snapshot.id;
var url = this.buildURL(type.modelName, id, snapshot, 'updateRecord');
return this.ajax(url, 'PATCH', { data: data });
}
});
var ember$data$lib$core$$DS = Ember.Namespace.create({
VERSION: '1.13.12'
});
if (Ember.libraries) {
Ember.libraries.registerCoreLibrary('Ember Data', ember$data$lib$core$$DS.VERSION);
}
//jshint ignore: line
var ember$data$lib$core$$EMBER_DATA_FEATURES = {};
Ember.merge(Ember.FEATURES, ember$data$lib$core$$EMBER_DATA_FEATURES);
var ember$data$lib$core$$default = ember$data$lib$core$$DS;
var ember$data$lib$system$store$common$$get = Ember.get;
function ember$data$lib$system$store$common$$_bind(fn) {
var args = Array.prototype.slice.call(arguments, 1);
return function () {
return fn.apply(undefined, args);
};
}
function ember$data$lib$system$store$common$$_guard(promise, test) {
var guarded = promise['finally'](function () {
if (!test()) {
guarded._subscribers.length = 0;
}
});
return guarded;
}
function ember$data$lib$system$store$common$$_objectIsAlive(object) {
return !(ember$data$lib$system$store$common$$get(object, "isDestroyed") || ember$data$lib$system$store$common$$get(object, "isDestroying"));
}
function ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, type) {
var serializer = adapter.serializer;
if (serializer === undefined) {
serializer = store.serializerFor(type);
}
if (serializer === null || serializer === undefined) {
serializer = {
extract: function (store, type, payload) {
return payload;
}
};
}
return serializer;
}
var ember$data$lib$system$store$finders$$Promise = Ember.RSVP.Promise;
var ember$data$lib$system$store$finders$$map = ember$data$lib$ext$ember$array$$default.map;
var ember$data$lib$system$store$finders$$get = Ember.get;
function ember$data$lib$system$store$finders$$_find(adapter, store, typeClass, id, internalModel, options) {
var snapshot = internalModel.createSnapshot(options);
var promise;
if (!adapter.findRecord) {
promise = adapter.find(store, typeClass, id, snapshot);
} else {
promise = adapter.findRecord(store, typeClass, id, snapshot);
}
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, internalModel.type.modelName);
var label = "DS: Handle Adapter#find of " + typeClass + " with id: " + id;
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
return promise.then(function (adapterPayload) {
return store._adapterRun(function () {
var requestType = ember$data$lib$system$store$finders$$get(serializer, 'isNewSerializerAPI') ? 'findRecord' : 'find';
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, id, requestType);
//TODO Optimize
var record = ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
return record._internalModel;
});
}, function (error) {
internalModel.notFound();
if (internalModel.isEmpty()) {
internalModel.unloadRecord();
}
throw error;
}, "DS: Extract payload of '" + typeClass + "'");
}
function ember$data$lib$system$store$finders$$_findMany(adapter, store, typeClass, ids, internalModels) {
var snapshots = Ember.A(internalModels).invoke('createSnapshot');
var promise = adapter.findMany(store, typeClass, ids, snapshots);
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, typeClass.modelName);
var label = "DS: Handle Adapter#findMany of " + typeClass;
if (promise === undefined) {
throw new Error('adapter.findMany returned undefined, this was very likely a mistake');
}
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
return promise.then(function (adapterPayload) {
return store._adapterRun(function () {
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, 'findMany');
//TODO Optimize, no need to materialize here
var records = ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
return ember$data$lib$system$store$finders$$map.call(records, function (record) {
return record._internalModel;
});
});
}, null, "DS: Extract payload of " + typeClass);
}
function ember$data$lib$system$store$finders$$_findHasMany(adapter, store, internalModel, link, relationship) {
var snapshot = internalModel.createSnapshot();
var typeClass = store.modelFor(relationship.type);
var promise = adapter.findHasMany(store, snapshot, link, relationship);
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, relationship.type);
var label = "DS: Handle Adapter#findHasMany of " + internalModel + " : " + relationship.type;
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, internalModel));
return promise.then(function (adapterPayload) {
return store._adapterRun(function () {
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, 'findHasMany');
//TODO Use a non record creating push
var records = ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
var recordArray = ember$data$lib$system$store$finders$$map.call(records, function (record) {
return record._internalModel;
});
if (ember$data$lib$system$store$finders$$get(serializer, 'isNewSerializerAPI')) {
recordArray.meta = payload.meta;
}
return recordArray;
});
}, null, "DS: Extract payload of " + internalModel + " : hasMany " + relationship.type);
}
function ember$data$lib$system$store$finders$$_findBelongsTo(adapter, store, internalModel, link, relationship) {
var snapshot = internalModel.createSnapshot();
var typeClass = store.modelFor(relationship.type);
var promise = adapter.findBelongsTo(store, snapshot, link, relationship);
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, relationship.type);
var label = "DS: Handle Adapter#findBelongsTo of " + internalModel + " : " + relationship.type;
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, internalModel));
return promise.then(function (adapterPayload) {
return store._adapterRun(function () {
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, 'findBelongsTo');
if (!payload.data) {
return null;
}
//TODO Optimize
var record = ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
return record._internalModel;
});
}, null, "DS: Extract payload of " + internalModel + " : " + relationship.type);
}
function ember$data$lib$system$store$finders$$_findAll(adapter, store, typeClass, sinceToken, options) {
var modelName = typeClass.modelName;
var recordArray = store.peekAll(modelName);
var snapshotArray = recordArray.createSnapshot(options);
var promise = adapter.findAll(store, typeClass, sinceToken, snapshotArray);
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, modelName);
var label = "DS: Handle Adapter#findAll of " + typeClass;
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
return promise.then(function (adapterPayload) {
store._adapterRun(function () {
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, 'findAll');
//TODO Optimize
ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
});
store.didUpdateAll(typeClass);
return store.peekAll(modelName);
}, null, "DS: Extract payload of findAll " + typeClass);
}
function ember$data$lib$system$store$finders$$_query(adapter, store, typeClass, query, recordArray) {
var modelName = typeClass.modelName;
var promise;
if (!adapter.query) {
promise = adapter.findQuery(store, typeClass, query, recordArray);
} else {
promise = adapter.query(store, typeClass, query, recordArray);
}
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, modelName);
var label = "DS: Handle Adapter#findQuery of " + typeClass;
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
return promise.then(function (adapterPayload) {
var records;
store._adapterRun(function () {
var requestType = ember$data$lib$system$store$finders$$get(serializer, 'isNewSerializerAPI') ? 'query' : 'findQuery';
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, requestType);
//TODO Optimize
records = ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
});
recordArray.loadRecords(records);
return recordArray;
}, null, "DS: Extract payload of findQuery " + typeClass);
}
function ember$data$lib$system$store$finders$$_queryRecord(adapter, store, typeClass, query) {
var modelName = typeClass.modelName;
var promise = adapter.queryRecord(store, typeClass, query);
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, modelName);
var label = "DS: Handle Adapter#queryRecord of " + typeClass;
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
return promise.then(function (adapterPayload) {
var record;
store._adapterRun(function () {
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, 'queryRecord');
//TODO Optimize
record = ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
});
return record;
}, null, "DS: Extract payload of queryRecord " + typeClass);
}
function ember$data$lib$system$snapshot$record$array$$SnapshotRecordArray(recordArray, meta, adapterOptions) {
/**
An array of snapshots
@private
@property _snapshots
@type {Array}
*/
this._snapshots = null;
/**
An array of records
@private
@property _recordArray
@type {Array}
*/
this._recordArray = recordArray;
/**
Number of records in the array
@property length
@type {Number}
*/
this.length = recordArray.get('length');
/**
The type of the underlying records for the snapshots in the array, as a DS.Model
@property type
@type {DS.Model}
*/
this.type = recordArray.get('type');
/**
Meta object
@property meta
@type {Object}
*/
this.meta = meta;
/**
A hash of adapter options
@property adapterOptions
@type {Object}
*/
this.adapterOptions = adapterOptions;
}
/**
Get snapshots of the underlying record array
@method snapshots
@return {Array} Array of snapshots
*/
ember$data$lib$system$snapshot$record$array$$SnapshotRecordArray.prototype.snapshots = function () {
if (this._snapshots) {
return this._snapshots;
}
var recordArray = this._recordArray;
this._snapshots = recordArray.invoke('createSnapshot');
return this._snapshots;
};
var ember$data$lib$system$snapshot$record$array$$default = ember$data$lib$system$snapshot$record$array$$SnapshotRecordArray;
var ember$data$lib$system$record$arrays$record$array$$get = Ember.get;
var ember$data$lib$system$record$arrays$record$array$$set = Ember.set;
var ember$data$lib$system$record$arrays$record$array$$default = Ember.ArrayProxy.extend(Ember.Evented, {
/**
The model type contained by this record array.
@property type
@type DS.Model
*/
type: null,
/**
The array of client ids backing the record array. When a
record is requested from the record array, the record
for the client id at the same index is materialized, if
necessary, by the store.
@property content
@private
@type Ember.Array
*/
content: null,
/**
The flag to signal a `RecordArray` is finished loading data.
Example
```javascript
var people = store.peekAll('person');
people.get('isLoaded'); // true
```
@property isLoaded
@type Boolean
*/
isLoaded: false,
/**
The flag to signal a `RecordArray` is currently loading data.
Example
```javascript
var people = store.peekAll('person');
people.get('isUpdating'); // false
people.update();
people.get('isUpdating'); // true
```
@property isUpdating
@type Boolean
*/
isUpdating: false,
/**
The store that created this record array.
@property store
@private
@type DS.Store
*/
store: null,
/**
Retrieves an object from the content by index.
@method objectAtContent
@private
@param {Number} index
@return {DS.Model} record
*/
objectAtContent: function (index) {
var content = ember$data$lib$system$record$arrays$record$array$$get(this, 'content');
var internalModel = content.objectAt(index);
return internalModel && internalModel.getRecord();
},
/**
Used to get the latest version of all of the records in this array
from the adapter.
Example
```javascript
var people = store.peekAll('person');
people.get('isUpdating'); // false
people.update();
people.get('isUpdating'); // true
```
@method update
*/
update: function () {
if (ember$data$lib$system$record$arrays$record$array$$get(this, 'isUpdating')) {
return;
}
var store = ember$data$lib$system$record$arrays$record$array$$get(this, 'store');
var modelName = ember$data$lib$system$record$arrays$record$array$$get(this, 'type.modelName');
return store.findAll(modelName, { reload: true });
},
/**
Adds an internal model to the `RecordArray` without duplicates
@method addInternalModel
@private
@param {InternalModel} internalModel
@param {number} an optional index to insert at
*/
addInternalModel: function (internalModel, idx) {
var content = ember$data$lib$system$record$arrays$record$array$$get(this, 'content');
if (idx === undefined) {
content.addObject(internalModel);
} else if (!content.contains(internalModel)) {
content.insertAt(idx, internalModel);
}
},
/**
Removes an internalModel to the `RecordArray`.
@method removeInternalModel
@private
@param {InternalModel} internalModel
*/
removeInternalModel: function (internalModel) {
ember$data$lib$system$record$arrays$record$array$$get(this, 'content').removeObject(internalModel);
},
/**
Saves all of the records in the `RecordArray`.
Example
```javascript
var messages = store.peekAll('message');
messages.forEach(function(message) {
message.set('hasBeenSeen', true);
});
messages.save();
```
@method save
@return {DS.PromiseArray} promise
*/
save: function () {
var recordArray = this;
var promiseLabel = "DS: RecordArray#save " + ember$data$lib$system$record$arrays$record$array$$get(this, 'type');
var promise = Ember.RSVP.all(this.invoke("save"), promiseLabel).then(function (array) {
return recordArray;
}, null, "DS: RecordArray#save return RecordArray");
return ember$data$lib$system$promise$proxies$$PromiseArray.create({ promise: promise });
},
_dissociateFromOwnRecords: function () {
var array = this;
this.get('content').forEach(function (record) {
var recordArrays = record._recordArrays;
if (recordArrays) {
recordArrays["delete"](array);
}
});
},
/**
@method _unregisterFromManager
@private
*/
_unregisterFromManager: function () {
var manager = ember$data$lib$system$record$arrays$record$array$$get(this, 'manager');
manager.unregisterRecordArray(this);
},
willDestroy: function () {
this._unregisterFromManager();
this._dissociateFromOwnRecords();
ember$data$lib$system$record$arrays$record$array$$set(this, 'content', undefined);
this._super.apply(this, arguments);
},
createSnapshot: function (options) {
var adapterOptions = options && options.adapterOptions;
var meta = this.get('meta');
return new ember$data$lib$system$snapshot$record$array$$default(this, meta, adapterOptions);
}
});
/**
@module ember-data
*/
var ember$data$lib$system$record$arrays$filtered$record$array$$get = Ember.get;
var ember$data$lib$system$record$arrays$filtered$record$array$$default = ember$data$lib$system$record$arrays$record$array$$default.extend({
/**
The filterFunction is a function used to test records from the store to
determine if they should be part of the record array.
Example
```javascript
var allPeople = store.peekAll('person');
allPeople.mapBy('name'); // ["Tom Dale", "Yehuda Katz", "Trek Glowacki"]
var people = store.filter('person', function(person) {
if (person.get('name').match(/Katz$/)) { return true; }
});
people.mapBy('name'); // ["Yehuda Katz"]
var notKatzFilter = function(person) {
return !person.get('name').match(/Katz$/);
};
people.set('filterFunction', notKatzFilter);
people.mapBy('name'); // ["Tom Dale", "Trek Glowacki"]
```
@method filterFunction
@param {DS.Model} record
@return {Boolean} `true` if the record should be in the array
*/
filterFunction: null,
isLoaded: true,
replace: function () {
var type = ember$data$lib$system$record$arrays$filtered$record$array$$get(this, 'type').toString();
throw new Error("The result of a client-side filter (on " + type + ") is immutable.");
},
/**
@method updateFilter
@private
*/
_updateFilter: function () {
var manager = ember$data$lib$system$record$arrays$filtered$record$array$$get(this, 'manager');
manager.updateFilter(this, ember$data$lib$system$record$arrays$filtered$record$array$$get(this, 'type'), ember$data$lib$system$record$arrays$filtered$record$array$$get(this, 'filterFunction'));
},
updateFilter: Ember.observer('filterFunction', function () {
Ember.run.once(this, this._updateFilter);
})
});
var ember$data$lib$system$clone$null$$default = ember$data$lib$system$clone$null$$cloneNull;
function ember$data$lib$system$clone$null$$cloneNull(source) {
var clone = new ember$data$lib$system$empty$object$$default();
for (var key in source) {
clone[key] = source[key];
}
return clone;
}
/**
@module ember-data
*/
var ember$data$lib$system$record$arrays$adapter$populated$record$array$$get = Ember.get;
var ember$data$lib$system$record$arrays$adapter$populated$record$array$$default = ember$data$lib$system$record$arrays$record$array$$default.extend({
query: null,
replace: function () {
var type = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, 'type').toString();
throw new Error("The result of a server query (on " + type + ") is immutable.");
},
/**
@method load
@private
@param {Array} data
*/
load: function (data) {
var store = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, 'store');
var type = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, 'type');
var modelName = type.modelName;
var records = store.pushMany(modelName, data);
this.loadRecords(records);
},
/**
@method loadRecords
@param {Array} records
@private
*/
loadRecords: function (records) {
var store = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, 'store');
var type = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, 'type');
var modelName = type.modelName;
var meta = store._metadataFor(modelName);
//TODO Optimize
var internalModels = Ember.A(records).mapBy('_internalModel');
this.setProperties({
content: Ember.A(internalModels),
isLoaded: true,
meta: ember$data$lib$system$clone$null$$default(meta)
});
internalModels.forEach(function (record) {
this.manager.recordArraysForRecord(record).add(this);
}, this);
// TODO: should triggering didLoad event be the last action of the runLoop?
Ember.run.once(this, 'trigger', 'didLoad');
}
});
var ember$data$lib$system$ordered$set$$EmberOrderedSet = Ember.OrderedSet;
var ember$data$lib$system$ordered$set$$guidFor = Ember.guidFor;
var ember$data$lib$system$ordered$set$$OrderedSet = function () {
this._super$constructor();
};
ember$data$lib$system$ordered$set$$OrderedSet.create = function () {
var Constructor = this;
return new Constructor();
};
ember$data$lib$system$ordered$set$$OrderedSet.prototype = ember$data$lib$system$object$polyfills$$create(ember$data$lib$system$ordered$set$$EmberOrderedSet.prototype);
ember$data$lib$system$ordered$set$$OrderedSet.prototype.constructor = ember$data$lib$system$ordered$set$$OrderedSet;
ember$data$lib$system$ordered$set$$OrderedSet.prototype._super$constructor = ember$data$lib$system$ordered$set$$EmberOrderedSet;
ember$data$lib$system$ordered$set$$OrderedSet.prototype.addWithIndex = function (obj, idx) {
var guid = ember$data$lib$system$ordered$set$$guidFor(obj);
var presenceSet = this.presenceSet;
var list = this.list;
if (presenceSet[guid] === true) {
return;
}
presenceSet[guid] = true;
if (idx === undefined || idx == null) {
list.push(obj);
} else {
list.splice(idx, 0, obj);
}
this.size += 1;
return this;
};
var ember$data$lib$system$ordered$set$$default = ember$data$lib$system$ordered$set$$OrderedSet;
var ember$data$lib$system$record$array$manager$$get = Ember.get;
var ember$data$lib$system$record$array$manager$$forEach = ember$data$lib$ext$ember$array$$default.forEach;
var ember$data$lib$system$record$array$manager$$indexOf = ember$data$lib$ext$ember$array$$default.indexOf;
var ember$data$lib$system$record$array$manager$$default = Ember.Object.extend({
init: function () {
var _this = this;
this.filteredRecordArrays = ember$data$lib$system$map$$MapWithDefault.create({
defaultValue: function () {
return [];
}
});
this.liveRecordArrays = ember$data$lib$system$map$$MapWithDefault.create({
defaultValue: function (typeClass) {
return _this.createRecordArray(typeClass);
}
});
this.changedRecords = [];
this._adapterPopulatedRecordArrays = [];
},
recordDidChange: function (record) {
if (this.changedRecords.push(record) !== 1) {
return;
}
Ember.run.schedule('actions', this, this.updateRecordArrays);
},
recordArraysForRecord: function (record) {
record._recordArrays = record._recordArrays || ember$data$lib$system$ordered$set$$default.create();
return record._recordArrays;
},
/**
This method is invoked whenever data is loaded into the store by the
adapter or updated by the adapter, or when a record has changed.
It updates all record arrays that a record belongs to.
To avoid thrashing, it only runs at most once per run loop.
@method updateRecordArrays
*/
updateRecordArrays: function () {
ember$data$lib$system$record$array$manager$$forEach.call(this.changedRecords, function (record) {
if (record.isDeleted()) {
this._recordWasDeleted(record);
} else {
this._recordWasChanged(record);
}
}, this);
this.changedRecords.length = 0;
},
_recordWasDeleted: function (record) {
var recordArrays = record._recordArrays;
if (!recordArrays) {
return;
}
recordArrays.forEach(function (array) {
array.removeInternalModel(record);
});
record._recordArrays = null;
},
_recordWasChanged: function (record) {
var typeClass = record.type;
var recordArrays = this.filteredRecordArrays.get(typeClass);
var filter;
ember$data$lib$system$record$array$manager$$forEach.call(recordArrays, function (array) {
filter = ember$data$lib$system$record$array$manager$$get(array, 'filterFunction');
this.updateFilterRecordArray(array, filter, typeClass, record);
}, this);
},
//Need to update live arrays on loading
recordWasLoaded: function (record) {
var typeClass = record.type;
var recordArrays = this.filteredRecordArrays.get(typeClass);
var filter;
ember$data$lib$system$record$array$manager$$forEach.call(recordArrays, function (array) {
filter = ember$data$lib$system$record$array$manager$$get(array, 'filterFunction');
this.updateFilterRecordArray(array, filter, typeClass, record);
}, this);
if (this.liveRecordArrays.has(typeClass)) {
var liveRecordArray = this.liveRecordArrays.get(typeClass);
this._addRecordToRecordArray(liveRecordArray, record);
}
},
/**
Update an individual filter.
@method updateFilterRecordArray
@param {DS.FilteredRecordArray} array
@param {Function} filter
@param {DS.Model} typeClass
@param {InternalModel} record
*/
updateFilterRecordArray: function (array, filter, typeClass, record) {
var shouldBeInArray = filter(record.getRecord());
var recordArrays = this.recordArraysForRecord(record);
if (shouldBeInArray) {
this._addRecordToRecordArray(array, record);
} else {
recordArrays["delete"](array);
array.removeInternalModel(record);
}
},
_addRecordToRecordArray: function (array, record) {
var recordArrays = this.recordArraysForRecord(record);
if (!recordArrays.has(array)) {
array.addInternalModel(record);
recordArrays.add(array);
}
},
populateLiveRecordArray: function (array, modelName) {
var typeMap = this.store.typeMapFor(modelName);
var records = typeMap.records;
var record;
for (var i = 0, l = records.length; i < l; i++) {
record = records[i];
if (!record.isDeleted() && !record.isEmpty()) {
this._addRecordToRecordArray(array, record);
}
}
},
/**
This method is invoked if the `filterFunction` property is
changed on a `DS.FilteredRecordArray`.
It essentially re-runs the filter from scratch. This same
method is invoked when the filter is created in th first place.
@method updateFilter
@param {Array} array
@param {String} modelName
@param {Function} filter
*/
updateFilter: function (array, modelName, filter) {
var typeMap = this.store.typeMapFor(modelName);
var records = typeMap.records;
var record;
for (var i = 0, l = records.length; i < l; i++) {
record = records[i];
if (!record.isDeleted() && !record.isEmpty()) {
this.updateFilterRecordArray(array, filter, modelName, record);
}
}
},
/**
Get the `DS.RecordArray` for a type, which contains all loaded records of
given type.
@method liveRecordArrayFor
@param {Class} typeClass
@return {DS.RecordArray}
*/
liveRecordArrayFor: function (typeClass) {
return this.liveRecordArrays.get(typeClass);
},
/**
Create a `DS.RecordArray` for a type.
@method createRecordArray
@param {Class} typeClass
@return {DS.RecordArray}
*/
createRecordArray: function (typeClass) {
var array = ember$data$lib$system$record$arrays$record$array$$default.create({
type: typeClass,
content: Ember.A(),
store: this.store,
isLoaded: true,
manager: this
});
return array;
},
/**
Create a `DS.FilteredRecordArray` for a type and register it for updates.
@method createFilteredRecordArray
@param {DS.Model} typeClass
@param {Function} filter
@param {Object} query (optional
@return {DS.FilteredRecordArray}
*/
createFilteredRecordArray: function (typeClass, filter, query) {
var array = ember$data$lib$system$record$arrays$filtered$record$array$$default.create({
query: query,
type: typeClass,
content: Ember.A(),
store: this.store,
manager: this,
filterFunction: filter
});
this.registerFilteredRecordArray(array, typeClass, filter);
return array;
},
/**
Create a `DS.AdapterPopulatedRecordArray` for a type with given query.
@method createAdapterPopulatedRecordArray
@param {DS.Model} typeClass
@param {Object} query
@return {DS.AdapterPopulatedRecordArray}
*/
createAdapterPopulatedRecordArray: function (typeClass, query) {
var array = ember$data$lib$system$record$arrays$adapter$populated$record$array$$default.create({
type: typeClass,
query: query,
content: Ember.A(),
store: this.store,
manager: this
});
this._adapterPopulatedRecordArrays.push(array);
return array;
},
/**
Register a RecordArray for a given type to be backed by
a filter function. This will cause the array to update
automatically when records of that type change attribute
values or states.
@method registerFilteredRecordArray
@param {DS.RecordArray} array
@param {DS.Model} typeClass
@param {Function} filter
*/
registerFilteredRecordArray: function (array, typeClass, filter) {
var recordArrays = this.filteredRecordArrays.get(typeClass);
recordArrays.push(array);
this.updateFilter(array, typeClass, filter);
},
/**
Unregister a RecordArray.
So manager will not update this array.
@method unregisterRecordArray
@param {DS.RecordArray} array
*/
unregisterRecordArray: function (array) {
var typeClass = array.type;
// unregister filtered record array
var recordArrays = this.filteredRecordArrays.get(typeClass);
var index = ember$data$lib$system$record$array$manager$$indexOf.call(recordArrays, array);
if (index !== -1) {
recordArrays.splice(index, 1);
// unregister live record array
} else if (this.liveRecordArrays.has(typeClass)) {
var liveRecordArrayForType = this.liveRecordArrayFor(typeClass);
if (array === liveRecordArrayForType) {
this.liveRecordArrays["delete"](typeClass);
}
}
},
willDestroy: function () {
this._super.apply(this, arguments);
this.filteredRecordArrays.forEach(function (value) {
ember$data$lib$system$record$array$manager$$forEach.call(ember$data$lib$system$record$array$manager$$flatten(value), ember$data$lib$system$record$array$manager$$destroy);
});
this.liveRecordArrays.forEach(ember$data$lib$system$record$array$manager$$destroy);
ember$data$lib$system$record$array$manager$$forEach.call(this._adapterPopulatedRecordArrays, ember$data$lib$system$record$array$manager$$destroy);
}
});
function ember$data$lib$system$record$array$manager$$destroy(entry) {
entry.destroy();
}
function ember$data$lib$system$record$array$manager$$flatten(list) {
var length = list.length;
var result = Ember.A();
for (var i = 0; i < length; i++) {
result = result.concat(list[i]);
}
return result;
}
/**
* The `ContainerInstanceCache` serves as a lazy cache for looking up
* instances of serializers and adapters. It has some additional logic for
* finding the 'fallback' adapter or serializer.
*
* The 'fallback' adapter or serializer is an adapter or serializer that is looked up
* when the preferred lookup fails. For example, say you try to look up `adapter:post`,
* but there is no entry (app/adapters/post.js in EmberCLI) for `adapter:post` in the registry.
*
* The `fallbacks` array passed will then be used; the first entry in the fallbacks array
* that exists in the container will then be cached for `adapter:post`. So, the next time you
* look up `adapter:post`, you'll get the `adapter:application` instance (or whatever the fallback
* was if `adapter:application` doesn't exist).
*
* @private
* @class ContainerInstanceCache
*
*/
function ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache(container) {
this._container = container;
this._cache = new ember$data$lib$system$empty$object$$default();
}
ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache.prototype = new ember$data$lib$system$empty$object$$default();
ember$lib$main$$default.merge(ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache.prototype, {
get: function (type, preferredKey, fallbacks) {
var cache = this._cache;
var preferredLookupKey = type + ':' + preferredKey;
if (!(preferredLookupKey in cache)) {
var instance = this.instanceFor(preferredLookupKey) || this._findInstance(type, fallbacks);
if (instance) {
cache[preferredLookupKey] = instance;
}
}
return cache[preferredLookupKey];
},
_findInstance: function (type, fallbacks) {
for (var i = 0, _length = fallbacks.length; i < _length; i++) {
var fallback = fallbacks[i];
var lookupKey = type + ':' + fallback;
var instance = this.instanceFor(lookupKey);
if (instance) {
return instance;
}
}
},
instanceFor: function (key) {
if (key === 'adapter:-rest') {
ember$lib$main$$default.deprecate('You are currently using the default DS.RESTAdapter adapter. For Ember 2.0 the default adapter will be DS.JSONAPIAdapter. If you would like to continue using DS.RESTAdapter please create an application adapter that extends DS.RESTAdapter.', false, {
id: 'ds.adapter.default-adapter-changing-to-json-api',
until: '2.0.0'
});
}
var cache = this._cache;
if (!cache[key]) {
var instance = this._container.lookup(key);
if (instance) {
cache[key] = instance;
}
}
return cache[key];
},
destroy: function () {
var cache = this._cache;
var cacheEntries = ember$data$lib$system$object$polyfills$$keysFunc(cache);
for (var i = 0, _length2 = cacheEntries.length; i < _length2; i++) {
var cacheKey = cacheEntries[i];
var cacheEntry = cache[cacheKey];
if (cacheEntry) {
cacheEntry.destroy();
}
}
this._container = null;
},
constructor: ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache,
toString: function () {
return 'ContainerInstanceCache';
}
});
var ember$data$lib$system$store$container$instance$cache$$default = ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache;
function ember$data$lib$system$merge$$merge(original, updates) {
if (!updates || typeof updates !== 'object') {
return original;
}
var props = ember$data$lib$system$object$polyfills$$keysFunc(updates);
var prop;
var length = props.length;
for (var i = 0; i < length; i++) {
prop = props[i];
original[prop] = updates[prop];
}
return original;
}
var ember$data$lib$system$merge$$default = ember$data$lib$system$merge$$merge;
/**
@module ember-data
*/
var ember$data$lib$system$model$states$$get = Ember.get;
/*
This file encapsulates the various states that a record can transition
through during its lifecycle.
*/
/**
### State
Each record has a `currentState` property that explicitly tracks what
state a record is in at any given time. For instance, if a record is
newly created and has not yet been sent to the adapter to be saved,
it would be in the `root.loaded.created.uncommitted` state. If a
record has had local modifications made to it that are in the
process of being saved, the record would be in the
`root.loaded.updated.inFlight` state. (This state paths will be
explained in more detail below.)
Events are sent by the record or its store to the record's
`currentState` property. How the state reacts to these events is
dependent on which state it is in. In some states, certain events
will be invalid and will cause an exception to be raised.
States are hierarchical and every state is a substate of the
`RootState`. For example, a record can be in the
`root.deleted.uncommitted` state, then transition into the
`root.deleted.inFlight` state. If a child state does not implement
an event handler, the state manager will attempt to invoke the event
on all parent states until the root state is reached. The state
hierarchy of a record is described in terms of a path string. You
can determine a record's current state by getting the state's
`stateName` property:
```javascript
record.get('currentState.stateName');
//=> "root.created.uncommitted"
```
The hierarchy of valid states that ship with ember data looks like
this:
```text
* root
* deleted
* saved
* uncommitted
* inFlight
* empty
* loaded
* created
* uncommitted
* inFlight
* saved
* updated
* uncommitted
* inFlight
* loading
```
The `DS.Model` states are themselves stateless. What that means is
that, the hierarchical states that each of *those* points to is a
shared data structure. For performance reasons, instead of each
record getting its own copy of the hierarchy of states, each record
points to this global, immutable shared instance. How does a state
know which record it should be acting on? We pass the record
instance into the state's event handlers as the first argument.
The record passed as the first parameter is where you should stash
state about the record if needed; you should never store data on the state
object itself.
### Events and Flags
A state may implement zero or more events and flags.
#### Events
Events are named functions that are invoked when sent to a record. The
record will first look for a method with the given name on the
current state. If no method is found, it will search the current
state's parent, and then its grandparent, and so on until reaching
the top of the hierarchy. If the root is reached without an event
handler being found, an exception will be raised. This can be very
helpful when debugging new features.
Here's an example implementation of a state with a `myEvent` event handler:
```javascript
aState: DS.State.create({
myEvent: function(manager, param) {
console.log("Received myEvent with", param);
}
})
```
To trigger this event:
```javascript
record.send('myEvent', 'foo');
//=> "Received myEvent with foo"
```
Note that an optional parameter can be sent to a record's `send()` method,
which will be passed as the second parameter to the event handler.
Events should transition to a different state if appropriate. This can be
done by calling the record's `transitionTo()` method with a path to the
desired state. The state manager will attempt to resolve the state path
relative to the current state. If no state is found at that path, it will
attempt to resolve it relative to the current state's parent, and then its
parent, and so on until the root is reached. For example, imagine a hierarchy
like this:
* created
* uncommitted <-- currentState
* inFlight
* updated
* inFlight
If we are currently in the `uncommitted` state, calling
`transitionTo('inFlight')` would transition to the `created.inFlight` state,
while calling `transitionTo('updated.inFlight')` would transition to
the `updated.inFlight` state.
Remember that *only events* should ever cause a state transition. You should
never call `transitionTo()` from outside a state's event handler. If you are
tempted to do so, create a new event and send that to the state manager.
#### Flags
Flags are Boolean values that can be used to introspect a record's current
state in a more user-friendly way than examining its state path. For example,
instead of doing this:
```javascript
var statePath = record.get('stateManager.currentPath');
if (statePath === 'created.inFlight') {
doSomething();
}
```
You can say:
```javascript
if (record.get('isNew') && record.get('isSaving')) {
doSomething();
}
```
If your state does not set a value for a given flag, the value will
be inherited from its parent (or the first place in the state hierarchy
where it is defined).
The current set of flags are defined below. If you want to add a new flag,
in addition to the area below, you will also need to declare it in the
`DS.Model` class.
* [isEmpty](DS.Model.html#property_isEmpty)
* [isLoading](DS.Model.html#property_isLoading)
* [isLoaded](DS.Model.html#property_isLoaded)
* [isDirty](DS.Model.html#property_isDirty)
* [isSaving](DS.Model.html#property_isSaving)
* [isDeleted](DS.Model.html#property_isDeleted)
* [isNew](DS.Model.html#property_isNew)
* [isValid](DS.Model.html#property_isValid)
@namespace DS
@class RootState
*/
function ember$data$lib$system$model$states$$didSetProperty(internalModel, context) {
if (context.value === context.originalValue) {
delete internalModel._attributes[context.name];
internalModel.send('propertyWasReset', context.name);
} else if (context.value !== context.oldValue) {
internalModel.send('becomeDirty');
}
internalModel.updateRecordArraysLater();
}
// Implementation notes:
//
// Each state has a boolean value for all of the following flags:
//
// * isLoaded: The record has a populated `data` property. When a
// record is loaded via `store.find`, `isLoaded` is false
// until the adapter sets it. When a record is created locally,
// its `isLoaded` property is always true.
// * isDirty: The record has local changes that have not yet been
// saved by the adapter. This includes records that have been
// created (but not yet saved) or deleted.
// * isSaving: The record has been committed, but
// the adapter has not yet acknowledged that the changes have
// been persisted to the backend.
// * isDeleted: The record was marked for deletion. When `isDeleted`
// is true and `isDirty` is true, the record is deleted locally
// but the deletion was not yet persisted. When `isSaving` is
// true, the change is in-flight. When both `isDirty` and
// `isSaving` are false, the change has persisted.
// * isError: The adapter reported that it was unable to save
// local changes to the backend. This may also result in the
// record having its `isValid` property become false if the
// adapter reported that server-side validations failed.
// * isNew: The record was created on the client and the adapter
// did not yet report that it was successfully saved.
// * isValid: The adapter did not report any server-side validation
// failures.
// The dirty state is a abstract state whose functionality is
// shared between the `created` and `updated` states.
//
// The deleted state shares the `isDirty` flag with the
// subclasses of `DirtyState`, but with a very different
// implementation.
//
// Dirty states have three child states:
//
// `uncommitted`: the store has not yet handed off the record
// to be saved.
// `inFlight`: the store has handed off the record to be saved,
// but the adapter has not yet acknowledged success.
// `invalid`: the record has invalid information and cannot be
// send to the adapter yet.
var ember$data$lib$system$model$states$$DirtyState = {
initialState: 'uncommitted',
// FLAGS
isDirty: true,
// SUBSTATES
// When a record first becomes dirty, it is `uncommitted`.
// This means that there are local pending changes, but they
// have not yet begun to be saved, and are not invalid.
uncommitted: {
// EVENTS
didSetProperty: ember$data$lib$system$model$states$$didSetProperty,
//TODO(Igor) reloading now triggers a
//loadingData event, though it seems fine?
loadingData: Ember.K,
propertyWasReset: function (internalModel, name) {
var length = ember$data$lib$system$object$polyfills$$keysFunc(internalModel._attributes).length;
var stillDirty = length > 0;
if (!stillDirty) {
internalModel.send('rolledBack');
}
},
pushedData: Ember.K,
becomeDirty: Ember.K,
willCommit: function (internalModel) {
internalModel.transitionTo('inFlight');
},
reloadRecord: function (internalModel, resolve) {
resolve(internalModel.store.reloadRecord(internalModel));
},
rolledBack: function (internalModel) {
internalModel.transitionTo('loaded.saved');
},
becameInvalid: function (internalModel) {
internalModel.transitionTo('invalid');
},
rollback: function (internalModel) {
internalModel.rollbackAttributes();
internalModel.triggerLater('ready');
}
},
// Once a record has been handed off to the adapter to be
// saved, it is in the 'in flight' state. Changes to the
// record cannot be made during this window.
inFlight: {
// FLAGS
isSaving: true,
// EVENTS
didSetProperty: ember$data$lib$system$model$states$$didSetProperty,
becomeDirty: Ember.K,
pushedData: Ember.K,
unloadRecord: ember$data$lib$system$model$states$$assertAgainstUnloadRecord,
// TODO: More robust semantics around save-while-in-flight
willCommit: Ember.K,
didCommit: function (internalModel) {
var dirtyType = ember$data$lib$system$model$states$$get(this, 'dirtyType');
internalModel.transitionTo('saved');
internalModel.send('invokeLifecycleCallbacks', dirtyType);
},
becameInvalid: function (internalModel) {
internalModel.transitionTo('invalid');
internalModel.send('invokeLifecycleCallbacks');
},
becameError: function (internalModel) {
internalModel.transitionTo('uncommitted');
internalModel.triggerLater('becameError', internalModel);
}
},
// A record is in the `invalid` if the adapter has indicated
// the the record failed server-side invalidations.
invalid: {
// FLAGS
isValid: false,
// EVENTS
deleteRecord: function (internalModel) {
internalModel.transitionTo('deleted.uncommitted');
internalModel.disconnectRelationships();
},
didSetProperty: function (internalModel, context) {
internalModel.removeErrorMessageFromAttribute(context.name);
ember$data$lib$system$model$states$$didSetProperty(internalModel, context);
},
becomeDirty: Ember.K,
pushedData: Ember.K,
willCommit: function (internalModel) {
internalModel.clearErrorMessages();
internalModel.transitionTo('inFlight');
},
rolledBack: function (internalModel) {
internalModel.clearErrorMessages();
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('ready');
},
becameValid: function (internalModel) {
internalModel.transitionTo('uncommitted');
},
invokeLifecycleCallbacks: function (internalModel) {
internalModel.triggerLater('becameInvalid', internalModel);
},
exit: function (internalModel) {
internalModel._inFlightAttributes = new ember$data$lib$system$empty$object$$default();
}
}
};
// The created and updated states are created outside the state
// chart so we can reopen their substates and add mixins as
// necessary.
function ember$data$lib$system$model$states$$deepClone(object) {
var clone = {};
var value;
for (var prop in object) {
value = object[prop];
if (value && typeof value === 'object') {
clone[prop] = ember$data$lib$system$model$states$$deepClone(value);
} else {
clone[prop] = value;
}
}
return clone;
}
function ember$data$lib$system$model$states$$mixin(original, hash) {
for (var prop in hash) {
original[prop] = hash[prop];
}
return original;
}
function ember$data$lib$system$model$states$$dirtyState(options) {
var newState = ember$data$lib$system$model$states$$deepClone(ember$data$lib$system$model$states$$DirtyState);
return ember$data$lib$system$model$states$$mixin(newState, options);
}
var ember$data$lib$system$model$states$$createdState = ember$data$lib$system$model$states$$dirtyState({
dirtyType: 'created',
// FLAGS
isNew: true
});
ember$data$lib$system$model$states$$createdState.invalid.rolledBack = function (internalModel) {
internalModel.transitionTo('deleted.saved');
};
ember$data$lib$system$model$states$$createdState.uncommitted.rolledBack = function (internalModel) {
internalModel.transitionTo('deleted.saved');
};
var ember$data$lib$system$model$states$$updatedState = ember$data$lib$system$model$states$$dirtyState({
dirtyType: 'updated'
});
ember$data$lib$system$model$states$$createdState.uncommitted.deleteRecord = function (internalModel) {
internalModel.disconnectRelationships();
internalModel.transitionTo('deleted.saved');
internalModel.send('invokeLifecycleCallbacks');
};
ember$data$lib$system$model$states$$createdState.uncommitted.rollback = function (internalModel) {
ember$data$lib$system$model$states$$DirtyState.uncommitted.rollback.apply(this, arguments);
internalModel.transitionTo('deleted.saved');
};
ember$data$lib$system$model$states$$createdState.uncommitted.pushedData = function (internalModel) {
internalModel.transitionTo('loaded.updated.uncommitted');
internalModel.triggerLater('didLoad');
};
ember$data$lib$system$model$states$$createdState.uncommitted.propertyWasReset = Ember.K;
function ember$data$lib$system$model$states$$assertAgainstUnloadRecord(internalModel) {
}
ember$data$lib$system$model$states$$updatedState.inFlight.unloadRecord = ember$data$lib$system$model$states$$assertAgainstUnloadRecord;
ember$data$lib$system$model$states$$updatedState.uncommitted.deleteRecord = function (internalModel) {
internalModel.transitionTo('deleted.uncommitted');
internalModel.disconnectRelationships();
};
var ember$data$lib$system$model$states$$RootState = {
// FLAGS
isEmpty: false,
isLoading: false,
isLoaded: false,
isDirty: false,
isSaving: false,
isDeleted: false,
isNew: false,
isValid: true,
// DEFAULT EVENTS
// Trying to roll back if you're not in the dirty state
// doesn't change your state. For example, if you're in the
// in-flight state, rolling back the record doesn't move
// you out of the in-flight state.
rolledBack: Ember.K,
unloadRecord: function (internalModel) {
// clear relationships before moving to deleted state
// otherwise it fails
internalModel.clearRelationships();
internalModel.transitionTo('deleted.saved');
},
propertyWasReset: Ember.K,
// SUBSTATES
// A record begins its lifecycle in the `empty` state.
// If its data will come from the adapter, it will
// transition into the `loading` state. Otherwise, if
// the record is being created on the client, it will
// transition into the `created` state.
empty: {
isEmpty: true,
// EVENTS
loadingData: function (internalModel, promise) {
internalModel._loadingPromise = promise;
internalModel.transitionTo('loading');
},
loadedData: function (internalModel) {
internalModel.transitionTo('loaded.created.uncommitted');
internalModel.triggerLater('ready');
},
pushedData: function (internalModel) {
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('didLoad');
internalModel.triggerLater('ready');
}
},
// A record enters this state when the store asks
// the adapter for its data. It remains in this state
// until the adapter provides the requested data.
//
// Usually, this process is asynchronous, using an
// XHR to retrieve the data.
loading: {
// FLAGS
isLoading: true,
exit: function (internalModel) {
internalModel._loadingPromise = null;
},
// EVENTS
pushedData: function (internalModel) {
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('didLoad');
internalModel.triggerLater('ready');
//TODO this seems out of place here
internalModel.didCleanError();
},
becameError: function (internalModel) {
internalModel.triggerLater('becameError', internalModel);
},
notFound: function (internalModel) {
internalModel.transitionTo('empty');
}
},
// A record enters this state when its data is populated.
// Most of a record's lifecycle is spent inside substates
// of the `loaded` state.
loaded: {
initialState: 'saved',
// FLAGS
isLoaded: true,
//TODO(Igor) Reloading now triggers a loadingData event,
//but it should be ok?
loadingData: Ember.K,
// SUBSTATES
// If there are no local changes to a record, it remains
// in the `saved` state.
saved: {
setup: function (internalModel) {
var attrs = internalModel._attributes;
var isDirty = ember$data$lib$system$object$polyfills$$keysFunc(attrs).length > 0;
if (isDirty) {
internalModel.adapterDidDirty();
}
},
// EVENTS
didSetProperty: ember$data$lib$system$model$states$$didSetProperty,
pushedData: Ember.K,
becomeDirty: function (internalModel) {
internalModel.transitionTo('updated.uncommitted');
},
willCommit: function (internalModel) {
internalModel.transitionTo('updated.inFlight');
},
reloadRecord: function (internalModel, resolve) {
resolve(internalModel.store.reloadRecord(internalModel));
},
deleteRecord: function (internalModel) {
internalModel.transitionTo('deleted.uncommitted');
internalModel.disconnectRelationships();
},
unloadRecord: function (internalModel) {
// clear relationships before moving to deleted state
// otherwise it fails
internalModel.clearRelationships();
internalModel.transitionTo('deleted.saved');
},
didCommit: function (internalModel) {
internalModel.send('invokeLifecycleCallbacks', ember$data$lib$system$model$states$$get(internalModel, 'lastDirtyType'));
},
// loaded.saved.notFound would be triggered by a failed
// `reload()` on an unchanged record
notFound: Ember.K
},
// A record is in this state after it has been locally
// created but before the adapter has indicated that
// it has been saved.
created: ember$data$lib$system$model$states$$createdState,
// A record is in this state if it has already been
// saved to the server, but there are new local changes
// that have not yet been saved.
updated: ember$data$lib$system$model$states$$updatedState
},
// A record is in this state if it was deleted from the store.
deleted: {
initialState: 'uncommitted',
dirtyType: 'deleted',
// FLAGS
isDeleted: true,
isLoaded: true,
isDirty: true,
// TRANSITIONS
setup: function (internalModel) {
internalModel.updateRecordArrays();
},
// SUBSTATES
// When a record is deleted, it enters the `start`
// state. It will exit this state when the record
// starts to commit.
uncommitted: {
// EVENTS
willCommit: function (internalModel) {
internalModel.transitionTo('inFlight');
},
rollback: function (internalModel) {
internalModel.rollbackAttributes();
internalModel.triggerLater('ready');
},
pushedData: Ember.K,
becomeDirty: Ember.K,
deleteRecord: Ember.K,
rolledBack: function (internalModel) {
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('ready');
}
},
// After a record starts committing, but
// before the adapter indicates that the deletion
// has saved to the server, a record is in the
// `inFlight` substate of `deleted`.
inFlight: {
// FLAGS
isSaving: true,
// EVENTS
unloadRecord: ember$data$lib$system$model$states$$assertAgainstUnloadRecord,
// TODO: More robust semantics around save-while-in-flight
willCommit: Ember.K,
didCommit: function (internalModel) {
internalModel.transitionTo('saved');
internalModel.send('invokeLifecycleCallbacks');
},
becameError: function (internalModel) {
internalModel.transitionTo('uncommitted');
internalModel.triggerLater('becameError', internalModel);
},
becameInvalid: function (internalModel) {
internalModel.transitionTo('invalid');
internalModel.triggerLater('becameInvalid', internalModel);
}
},
// Once the adapter indicates that the deletion has
// been saved, the record enters the `saved` substate
// of `deleted`.
saved: {
// FLAGS
isDirty: false,
setup: function (internalModel) {
var store = internalModel.store;
store._dematerializeRecord(internalModel);
},
invokeLifecycleCallbacks: function (internalModel) {
internalModel.triggerLater('didDelete', internalModel);
internalModel.triggerLater('didCommit', internalModel);
},
willCommit: Ember.K,
didCommit: Ember.K
},
invalid: {
isValid: false,
didSetProperty: function (internalModel, context) {
internalModel.removeErrorMessageFromAttribute(context.name);
ember$data$lib$system$model$states$$didSetProperty(internalModel, context);
},
deleteRecord: Ember.K,
becomeDirty: Ember.K,
willCommit: Ember.K,
rolledBack: function (internalModel) {
internalModel.clearErrorMessages();
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('ready');
},
becameValid: function (internalModel) {
internalModel.transitionTo('uncommitted');
}
}
},
invokeLifecycleCallbacks: function (internalModel, dirtyType) {
if (dirtyType === 'created') {
internalModel.triggerLater('didCreate', internalModel);
} else {
internalModel.triggerLater('didUpdate', internalModel);
}
internalModel.triggerLater('didCommit', internalModel);
}
};
function ember$data$lib$system$model$states$$wireState(object, parent, name) {
/*jshint proto:true*/
// TODO: Use Object.create and copy instead
object = ember$data$lib$system$model$states$$mixin(parent ? ember$data$lib$system$object$polyfills$$create(parent) : {}, object);
object.parentState = parent;
object.stateName = name;
for (var prop in object) {
if (!object.hasOwnProperty(prop) || prop === 'parentState' || prop === 'stateName') {
continue;
}
if (typeof object[prop] === 'object') {
object[prop] = ember$data$lib$system$model$states$$wireState(object[prop], object, name + "." + prop);
}
}
return object;
}
ember$data$lib$system$model$states$$RootState = ember$data$lib$system$model$states$$wireState(ember$data$lib$system$model$states$$RootState, null, "root");
var ember$data$lib$system$model$states$$default = ember$data$lib$system$model$states$$RootState;
var ember$data$lib$system$relationships$state$relationship$$forEach = ember$data$lib$ext$ember$array$$default.forEach;
function ember$data$lib$system$relationships$state$relationship$$Relationship(store, record, inverseKey, relationshipMeta) {
this.members = new ember$data$lib$system$ordered$set$$default();
this.canonicalMembers = new ember$data$lib$system$ordered$set$$default();
this.store = store;
this.key = relationshipMeta.key;
this.inverseKey = inverseKey;
this.record = record;
this.isAsync = relationshipMeta.options.async;
this.relationshipMeta = relationshipMeta;
//This probably breaks for polymorphic relationship in complex scenarios, due to
//multiple possible modelNames
this.inverseKeyForImplicit = this.record.constructor.modelName + this.key;
this.linkPromise = null;
this.meta = null;
this.hasData = false;
}
ember$data$lib$system$relationships$state$relationship$$Relationship.prototype = {
constructor: ember$data$lib$system$relationships$state$relationship$$Relationship,
destroy: Ember.K,
updateMeta: function (meta) {
this.meta = meta;
},
clear: function () {
var members = this.members.list;
var member;
while (members.length > 0) {
member = members[0];
this.removeRecord(member);
}
},
disconnect: function () {
this.members.forEach(function (member) {
this.removeRecordFromInverse(member);
}, this);
},
reconnect: function () {
this.members.forEach(function (member) {
this.addRecordToInverse(member);
}, this);
},
removeRecords: function (records) {
var self = this;
ember$data$lib$system$relationships$state$relationship$$forEach.call(records, function (record) {
self.removeRecord(record);
});
},
addRecords: function (records, idx) {
var self = this;
ember$data$lib$system$relationships$state$relationship$$forEach.call(records, function (record) {
self.addRecord(record, idx);
if (idx !== undefined) {
idx++;
}
});
},
addCanonicalRecords: function (records, idx) {
for (var i = 0; i < records.length; i++) {
if (idx !== undefined) {
this.addCanonicalRecord(records[i], i + idx);
} else {
this.addCanonicalRecord(records[i]);
}
}
},
addCanonicalRecord: function (record, idx) {
if (!this.canonicalMembers.has(record)) {
this.canonicalMembers.add(record);
if (this.inverseKey) {
record._relationships.get(this.inverseKey).addCanonicalRecord(this.record);
} else {
if (!record._implicitRelationships[this.inverseKeyForImplicit]) {
record._implicitRelationships[this.inverseKeyForImplicit] = new ember$data$lib$system$relationships$state$relationship$$Relationship(this.store, record, this.key, { options: {} });
}
record._implicitRelationships[this.inverseKeyForImplicit].addCanonicalRecord(this.record);
}
}
this.flushCanonicalLater();
this.setHasData(true);
},
removeCanonicalRecords: function (records, idx) {
for (var i = 0; i < records.length; i++) {
if (idx !== undefined) {
this.removeCanonicalRecord(records[i], i + idx);
} else {
this.removeCanonicalRecord(records[i]);
}
}
},
removeCanonicalRecord: function (record, idx) {
if (this.canonicalMembers.has(record)) {
this.removeCanonicalRecordFromOwn(record);
if (this.inverseKey) {
this.removeCanonicalRecordFromInverse(record);
} else {
if (record._implicitRelationships[this.inverseKeyForImplicit]) {
record._implicitRelationships[this.inverseKeyForImplicit].removeCanonicalRecord(this.record);
}
}
}
this.flushCanonicalLater();
},
addRecord: function (record, idx) {
if (!this.members.has(record)) {
this.members.addWithIndex(record, idx);
this.notifyRecordRelationshipAdded(record, idx);
if (this.inverseKey) {
record._relationships.get(this.inverseKey).addRecord(this.record);
} else {
if (!record._implicitRelationships[this.inverseKeyForImplicit]) {
record._implicitRelationships[this.inverseKeyForImplicit] = new ember$data$lib$system$relationships$state$relationship$$Relationship(this.store, record, this.key, { options: {} });
}
record._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record);
}
this.record.updateRecordArraysLater();
}
this.setHasData(true);
},
removeRecord: function (record) {
if (this.members.has(record)) {
this.removeRecordFromOwn(record);
if (this.inverseKey) {
this.removeRecordFromInverse(record);
} else {
if (record._implicitRelationships[this.inverseKeyForImplicit]) {
record._implicitRelationships[this.inverseKeyForImplicit].removeRecord(this.record);
}
}
}
},
addRecordToInverse: function (record) {
if (this.inverseKey) {
record._relationships.get(this.inverseKey).addRecord(this.record);
}
},
removeRecordFromInverse: function (record) {
var inverseRelationship = record._relationships.get(this.inverseKey);
//Need to check for existence, as the record might unloading at the moment
if (inverseRelationship) {
inverseRelationship.removeRecordFromOwn(this.record);
}
},
removeRecordFromOwn: function (record) {
this.members["delete"](record);
this.notifyRecordRelationshipRemoved(record);
this.record.updateRecordArrays();
},
removeCanonicalRecordFromInverse: function (record) {
var inverseRelationship = record._relationships.get(this.inverseKey);
//Need to check for existence, as the record might unloading at the moment
if (inverseRelationship) {
inverseRelationship.removeCanonicalRecordFromOwn(this.record);
}
},
removeCanonicalRecordFromOwn: function (record) {
this.canonicalMembers["delete"](record);
this.flushCanonicalLater();
},
flushCanonical: function () {
this.willSync = false;
//a hack for not removing new records
//TODO remove once we have proper diffing
var newRecords = [];
for (var i = 0; i < this.members.list.length; i++) {
if (this.members.list[i].isNew()) {
newRecords.push(this.members.list[i]);
}
}
//TODO(Igor) make this less abysmally slow
this.members = this.canonicalMembers.copy();
for (i = 0; i < newRecords.length; i++) {
this.members.add(newRecords[i]);
}
},
flushCanonicalLater: function () {
if (this.willSync) {
return;
}
this.willSync = true;
var self = this;
this.store._backburner.join(function () {
self.store._backburner.schedule('syncRelationships', self, self.flushCanonical);
});
},
updateLink: function (link) {
if (link !== this.link) {
this.link = link;
this.linkPromise = null;
this.record.notifyPropertyChange(this.key);
}
},
findLink: function () {
if (this.linkPromise) {
return this.linkPromise;
} else {
var promise = this.fetchLink();
this.linkPromise = promise;
return promise.then(function (result) {
return result;
});
}
},
updateRecordsFromAdapter: function (records) {
//TODO(Igor) move this to a proper place
var self = this;
//TODO Once we have adapter support, we need to handle updated and canonical changes
self.computeChanges(records);
self.setHasData(true);
},
notifyRecordRelationshipAdded: Ember.K,
notifyRecordRelationshipRemoved: Ember.K,
setHasData: function (value) {
this.hasData = value;
}
};
var ember$data$lib$system$relationships$state$relationship$$default = ember$data$lib$system$relationships$state$relationship$$Relationship;
var ember$data$lib$system$many$array$$get = Ember.get;
var ember$data$lib$system$many$array$$set = Ember.set;
var ember$data$lib$system$many$array$$filter = ember$data$lib$ext$ember$array$$default.filter;
var ember$data$lib$system$many$array$$default = Ember.Object.extend(Ember.MutableArray, Ember.Evented, {
init: function () {
this.currentState = Ember.A([]);
},
record: null,
canonicalState: null,
currentState: null,
length: 0,
objectAt: function (index) {
//Ember observers such as 'firstObject', 'lastObject' might do out of bounds accesses
if (!this.currentState[index]) {
return undefined;
}
return this.currentState[index].getRecord();
},
flushCanonical: function () {
//TODO make this smarter, currently its plenty stupid
var toSet = ember$data$lib$system$many$array$$filter.call(this.canonicalState, function (internalModel) {
return !internalModel.isDeleted();
});
//a hack for not removing new records
//TODO remove once we have proper diffing
var newRecords = this.currentState.filter(function (internalModel) {
return internalModel.isNew();
});
toSet = toSet.concat(newRecords);
var oldLength = this.length;
this.arrayContentWillChange(0, this.length, toSet.length);
this.set('length', toSet.length);
this.currentState = toSet;
this.arrayContentDidChange(0, oldLength, this.length);
//TODO Figure out to notify only on additions and maybe only if unloaded
this.relationship.notifyHasManyChanged();
this.record.updateRecordArrays();
},
/**
`true` if the relationship is polymorphic, `false` otherwise.
@property {Boolean} isPolymorphic
@private
*/
isPolymorphic: false,
/**
The loading state of this array
@property {Boolean} isLoaded
*/
isLoaded: false,
/**
The relationship which manages this array.
@property {ManyRelationship} relationship
@private
*/
relationship: null,
/**
Metadata associated with the request for async hasMany relationships.
Example
Given that the server returns the following JSON payload when fetching a
hasMany relationship:
```js
{
"comments": [{
"id": 1,
"comment": "This is the first comment",
}, {
// ...
}],
"meta": {
"page": 1,
"total": 5
}
}
```
You can then access the metadata via the `meta` property:
```js
post.get('comments').then(function(comments) {
var meta = comments.get('meta');
// meta.page => 1
// meta.total => 5
});
```
@property {Object} meta
@public
*/
meta: null,
internalReplace: function (idx, amt, objects) {
if (!objects) {
objects = [];
}
this.arrayContentWillChange(idx, amt, objects.length);
this.currentState.splice.apply(this.currentState, [idx, amt].concat(objects));
this.set('length', this.currentState.length);
this.arrayContentDidChange(idx, amt, objects.length);
if (objects) {
//TODO(Igor) probably needed only for unloaded records
this.relationship.notifyHasManyChanged();
}
this.record.updateRecordArrays();
},
//TODO(Igor) optimize
internalRemoveRecords: function (records) {
var index;
for (var i = 0; i < records.length; i++) {
index = this.currentState.indexOf(records[i]);
this.internalReplace(index, 1);
}
},
//TODO(Igor) optimize
internalAddRecords: function (records, idx) {
if (idx === undefined) {
idx = this.currentState.length;
}
this.internalReplace(idx, 0, records);
},
replace: function (idx, amt, objects) {
var records;
if (amt > 0) {
records = this.currentState.slice(idx, idx + amt);
this.get('relationship').removeRecords(records);
}
var map = objects.map || ember$data$lib$ext$ember$array$$default.map;
if (objects) {
this.get('relationship').addRecords(map.call(objects, function (obj) {
return obj._internalModel;
}), idx);
}
},
/**
Used for async `hasMany` arrays
to keep track of when they will resolve.
@property {Ember.RSVP.Promise} promise
@private
*/
promise: null,
/**
@method loadingRecordsCount
@param {Number} count
@private
*/
loadingRecordsCount: function (count) {
this.loadingRecordsCount = count;
},
/**
@method loadedRecord
@private
*/
loadedRecord: function () {
this.loadingRecordsCount--;
if (this.loadingRecordsCount === 0) {
ember$data$lib$system$many$array$$set(this, 'isLoaded', true);
this.trigger('didLoad');
}
},
/**
@method reload
@public
*/
reload: function () {
return this.relationship.reload();
},
/**
Saves all of the records in the `ManyArray`.
Example
```javascript
store.find('inbox', 1).then(function(inbox) {
inbox.get('messages').then(function(messages) {
messages.forEach(function(message) {
message.set('isRead', true);
});
messages.save()
});
});
```
@method save
@return {DS.PromiseArray} promise
*/
save: function () {
var manyArray = this;
var promiseLabel = "DS: ManyArray#save " + ember$data$lib$system$many$array$$get(this, 'type');
var promise = Ember.RSVP.all(this.invoke("save"), promiseLabel).then(function (array) {
return manyArray;
}, null, "DS: ManyArray#save return ManyArray");
return ember$data$lib$system$promise$proxies$$PromiseArray.create({ promise: promise });
},
/**
Create a child record within the owner
@method createRecord
@private
@param {Object} hash
@return {DS.Model} record
*/
createRecord: function (hash) {
var store = ember$data$lib$system$many$array$$get(this, 'store');
var type = ember$data$lib$system$many$array$$get(this, 'type');
var record;
record = store.createRecord(type.modelName, hash);
this.pushObject(record);
return record;
},
/**
@method addRecord
@param {DS.Model} record
@deprecated Use `addObject()` instead
*/
addRecord: function (record) {
this.addObject(record);
},
/**
@method removeRecord
@param {DS.Model} record
@deprecated Use `removeObject()` instead
*/
removeRecord: function (record) {
this.removeObject(record);
}
});
/**
Assert that `addedRecord` has a valid type so it can be added to the
relationship of the `record`.
The assert basically checks if the `addedRecord` can be added to the
relationship (specified via `relationshipMeta`) of the `record`.
This utility should only be used internally, as both record parameters must
be an InternalModel and the `relationshipMeta` needs to be the meta
information about the relationship, retrieved via
`record.relationshipFor(key)`.
@method assertPolymorphicType
@param {InternalModel} record
@param {RelationshipMeta} relationshipMeta retrieved via
`record.relationshipFor(key)`
@param {InternalModel} addedRecord record which
should be added/set for the relationship
*/
var ember$data$lib$utils$$assertPolymorphicType = function (record, relationshipMeta, addedRecord) {
var addedType = addedRecord.type.modelName;
var recordType = record.type.modelName;
var key = relationshipMeta.key;
var typeClass = record.store.modelFor(relationshipMeta.type);
var assertionMessage = 'You cannot add a record of type \'' + addedType + '\' to the \'' + recordType + '.' + key + '\' relationship (only \'' + typeClass.modelName + '\' allowed)';
ember$lib$main$$default.assert(assertionMessage, ember$data$lib$utils$$checkPolymorphic(typeClass, addedRecord));
};
function ember$data$lib$utils$$checkPolymorphic(typeClass, addedRecord) {
if (typeClass.__isMixin) {
//TODO Need to do this in order to support mixins, should convert to public api
//once it exists in Ember
return typeClass.__mixin.detect(addedRecord.type.PrototypeMixin);
}
if (ember$lib$main$$default.MODEL_FACTORY_INJECTIONS) {
typeClass = typeClass.superclass;
}
return typeClass.detect(addedRecord.type);
}
var ember$data$lib$system$relationships$state$has$many$$map = ember$data$lib$ext$ember$array$$default.map;
var ember$data$lib$system$relationships$state$has$many$$ManyRelationship = function (store, record, inverseKey, relationshipMeta) {
this._super$constructor(store, record, inverseKey, relationshipMeta);
this.belongsToType = relationshipMeta.type;
this.canonicalState = [];
this.manyArray = ember$data$lib$system$many$array$$default.create({
canonicalState: this.canonicalState,
store: this.store,
relationship: this,
type: this.store.modelFor(this.belongsToType),
record: record
});
this.isPolymorphic = relationshipMeta.options.polymorphic;
this.manyArray.isPolymorphic = this.isPolymorphic;
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype = ember$data$lib$system$object$polyfills$$create(ember$data$lib$system$relationships$state$relationship$$default.prototype);
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.constructor = ember$data$lib$system$relationships$state$has$many$$ManyRelationship;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$constructor = ember$data$lib$system$relationships$state$relationship$$default;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.destroy = function () {
this.manyArray.destroy();
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$updateMeta = ember$data$lib$system$relationships$state$relationship$$default.prototype.updateMeta;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.updateMeta = function (meta) {
this._super$updateMeta(meta);
this.manyArray.set('meta', meta);
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$addCanonicalRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addCanonicalRecord;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.addCanonicalRecord = function (record, idx) {
if (this.canonicalMembers.has(record)) {
return;
}
if (idx !== undefined) {
this.canonicalState.splice(idx, 0, record);
} else {
this.canonicalState.push(record);
}
this._super$addCanonicalRecord(record, idx);
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$addRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addRecord;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.addRecord = function (record, idx) {
if (this.members.has(record)) {
return;
}
this._super$addRecord(record, idx);
this.manyArray.internalAddRecords([record], idx);
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$removeCanonicalRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeCanonicalRecordFromOwn;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.removeCanonicalRecordFromOwn = function (record, idx) {
var i = idx;
if (!this.canonicalMembers.has(record)) {
return;
}
if (i === undefined) {
i = this.canonicalState.indexOf(record);
}
if (i > -1) {
this.canonicalState.splice(i, 1);
}
this._super$removeCanonicalRecordFromOwn(record, idx);
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$flushCanonical = ember$data$lib$system$relationships$state$relationship$$default.prototype.flushCanonical;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.flushCanonical = function () {
this.manyArray.flushCanonical();
this._super$flushCanonical();
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$removeRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeRecordFromOwn;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.removeRecordFromOwn = function (record, idx) {
if (!this.members.has(record)) {
return;
}
this._super$removeRecordFromOwn(record, idx);
if (idx !== undefined) {
//TODO(Igor) not used currently, fix
this.manyArray.currentState.removeAt(idx);
} else {
this.manyArray.internalRemoveRecords([record]);
}
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.notifyRecordRelationshipAdded = function (record, idx) {
ember$data$lib$utils$$assertPolymorphicType(this.record, this.relationshipMeta, record);
this.record.notifyHasManyAdded(this.key, record, idx);
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.reload = function () {
var self = this;
if (this.link) {
return this.fetchLink();
} else {
return this.store.scheduleFetchMany(this.manyArray.toArray()).then(function () {
//Goes away after the manyArray refactor
self.manyArray.set('isLoaded', true);
return self.manyArray;
});
}
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.computeChanges = function (records) {
var members = this.canonicalMembers;
var recordsToRemove = [];
var length;
var record;
var i;
records = ember$data$lib$system$relationships$state$has$many$$setForArray(records);
members.forEach(function (member) {
if (records.has(member)) {
return;
}
recordsToRemove.push(member);
});
this.removeCanonicalRecords(recordsToRemove);
// Using records.toArray() since currently using
// removeRecord can modify length, messing stuff up
// forEach since it directly looks at "length" each
// iteration
records = records.toArray();
length = records.length;
for (i = 0; i < length; i++) {
record = records[i];
this.removeCanonicalRecord(record);
this.addCanonicalRecord(record, i);
}
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.fetchLink = function () {
var _this = this;
return this.store.findHasMany(this.record, this.link, this.relationshipMeta).then(function (records) {
if (records.hasOwnProperty('meta')) {
_this.updateMeta(records.meta);
}
_this.store._backburner.join(function () {
_this.updateRecordsFromAdapter(records);
});
return _this.manyArray;
});
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.findRecords = function () {
var manyArray = this.manyArray;
//TODO CLEANUP
return this.store.findMany(ember$data$lib$system$relationships$state$has$many$$map.call(manyArray.toArray(), function (rec) {
return rec._internalModel;
})).then(function () {
//Goes away after the manyArray refactor
manyArray.set('isLoaded', true);
return manyArray;
});
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.notifyHasManyChanged = function () {
this.record.notifyHasManyAdded(this.key);
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.getRecords = function () {
//TODO(Igor) sync server here, once our syncing is not stupid
if (this.isAsync) {
var self = this;
var promise;
if (this.link) {
promise = this.findLink().then(function () {
return self.findRecords();
});
} else {
promise = this.findRecords();
}
return ember$data$lib$system$promise$proxies$$PromiseManyArray.create({
content: this.manyArray,
promise: promise
});
} else {
//TODO(Igor) WTF DO I DO HERE?
if (!this.manyArray.get('isDestroyed')) {
this.manyArray.set('isLoaded', true);
}
return this.manyArray;
}
};
function ember$data$lib$system$relationships$state$has$many$$setForArray(array) {
var set = new ember$data$lib$system$ordered$set$$default();
if (array) {
for (var i = 0, l = array.length; i < l; i++) {
set.add(array[i]);
}
}
return set;
}
var ember$data$lib$system$relationships$state$has$many$$default = ember$data$lib$system$relationships$state$has$many$$ManyRelationship;
var ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship = function (store, record, inverseKey, relationshipMeta) {
this._super$constructor(store, record, inverseKey, relationshipMeta);
this.record = record;
this.key = relationshipMeta.key;
this.inverseRecord = null;
this.canonicalState = null;
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype = ember$data$lib$system$object$polyfills$$create(ember$data$lib$system$relationships$state$relationship$$default.prototype);
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.constructor = ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$constructor = ember$data$lib$system$relationships$state$relationship$$default;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.setRecord = function (newRecord) {
if (newRecord) {
this.addRecord(newRecord);
} else if (this.inverseRecord) {
this.removeRecord(this.inverseRecord);
}
this.setHasData(true);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.setCanonicalRecord = function (newRecord) {
if (newRecord) {
this.addCanonicalRecord(newRecord);
} else if (this.inverseRecord) {
this.removeCanonicalRecord(this.inverseRecord);
}
this.setHasData(true);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$addCanonicalRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addCanonicalRecord;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.addCanonicalRecord = function (newRecord) {
if (this.canonicalMembers.has(newRecord)) {
return;
}
if (this.canonicalState) {
this.removeCanonicalRecord(this.canonicalState);
}
this.canonicalState = newRecord;
this._super$addCanonicalRecord(newRecord);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$flushCanonical = ember$data$lib$system$relationships$state$relationship$$default.prototype.flushCanonical;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.flushCanonical = function () {
//temporary fix to not remove newly created records if server returned null.
//TODO remove once we have proper diffing
if (this.inverseRecord && this.inverseRecord.isNew() && !this.canonicalState) {
return;
}
this.inverseRecord = this.canonicalState;
this.record.notifyBelongsToChanged(this.key);
this._super$flushCanonical();
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$addRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addRecord;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.addRecord = function (newRecord) {
if (this.members.has(newRecord)) {
return;
}
ember$data$lib$utils$$assertPolymorphicType(this.record, this.relationshipMeta, newRecord);
if (this.inverseRecord) {
this.removeRecord(this.inverseRecord);
}
this.inverseRecord = newRecord;
this._super$addRecord(newRecord);
this.record.notifyBelongsToChanged(this.key);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.setRecordPromise = function (newPromise) {
var content = newPromise.get && newPromise.get('content');
this.setRecord(content ? content._internalModel : content);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$removeRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeRecordFromOwn;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.removeRecordFromOwn = function (record) {
if (!this.members.has(record)) {
return;
}
this.inverseRecord = null;
this._super$removeRecordFromOwn(record);
this.record.notifyBelongsToChanged(this.key);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$removeCanonicalRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeCanonicalRecordFromOwn;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.removeCanonicalRecordFromOwn = function (record) {
if (!this.canonicalMembers.has(record)) {
return;
}
this.canonicalState = null;
this._super$removeCanonicalRecordFromOwn(record);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.findRecord = function () {
if (this.inverseRecord) {
return this.store._findByInternalModel(this.inverseRecord);
} else {
return Ember.RSVP.Promise.resolve(null);
}
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.fetchLink = function () {
var self = this;
return this.store.findBelongsTo(this.record, this.link, this.relationshipMeta).then(function (record) {
if (record) {
self.addRecord(record);
}
return record;
});
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.getRecord = function () {
//TODO(Igor) flushCanonical here once our syncing is not stupid
if (this.isAsync) {
var promise;
if (this.link) {
var self = this;
promise = this.findLink().then(function () {
return self.findRecord();
});
} else {
promise = this.findRecord();
}
return ember$data$lib$system$promise$proxies$$PromiseObject.create({
promise: promise,
content: this.inverseRecord ? this.inverseRecord.getRecord() : null
});
} else {
if (this.inverseRecord === null) {
return null;
}
var toReturn = this.inverseRecord.getRecord();
return toReturn;
}
};
var ember$data$lib$system$relationships$state$belongs$to$$default = ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship;
var ember$data$lib$system$relationships$state$create$$get = Ember.get;
var ember$data$lib$system$relationships$state$create$$createRelationshipFor = function (record, relationshipMeta, store) {
var inverseKey;
var inverse = record.type.inverseFor(relationshipMeta.key, store);
if (inverse) {
inverseKey = inverse.name;
}
if (relationshipMeta.kind === 'hasMany') {
return new ember$data$lib$system$relationships$state$has$many$$default(store, record, inverseKey, relationshipMeta);
} else {
return new ember$data$lib$system$relationships$state$belongs$to$$default(store, record, inverseKey, relationshipMeta);
}
};
var ember$data$lib$system$relationships$state$create$$Relationships = function (record) {
this.record = record;
this.initializedRelationships = new ember$data$lib$system$empty$object$$default();
};
ember$data$lib$system$relationships$state$create$$Relationships.prototype.has = function (key) {
return !!this.initializedRelationships[key];
};
ember$data$lib$system$relationships$state$create$$Relationships.prototype.get = function (key) {
var relationships = this.initializedRelationships;
var relationshipsByName = ember$data$lib$system$relationships$state$create$$get(this.record.type, 'relationshipsByName');
if (!relationships[key] && relationshipsByName.get(key)) {
relationships[key] = ember$data$lib$system$relationships$state$create$$createRelationshipFor(this.record, relationshipsByName.get(key), this.record.store);
}
return relationships[key];
};
var ember$data$lib$system$relationships$state$create$$default = ember$data$lib$system$relationships$state$create$$Relationships;
/**
@class Snapshot
@namespace DS
@private
@constructor
@param {DS.Model} internalModel The model to create a snapshot from
*/
/**
@module ember-data
*/
var ember$data$lib$system$snapshot$$get = Ember.get;function ember$data$lib$system$snapshot$$Snapshot(internalModel) {
this._attributes = new ember$data$lib$system$empty$object$$default();
this._belongsToRelationships = new ember$data$lib$system$empty$object$$default();
this._belongsToIds = new ember$data$lib$system$empty$object$$default();
this._hasManyRelationships = new ember$data$lib$system$empty$object$$default();
this._hasManyIds = new ember$data$lib$system$empty$object$$default();
var record = internalModel.getRecord();
this.record = record;
record.eachAttribute(function (keyName) {
this._attributes[keyName] = ember$data$lib$system$snapshot$$get(record, keyName);
}, this);
this.id = internalModel.id;
this._internalModel = internalModel;
this.type = internalModel.type;
this.modelName = internalModel.type.modelName;
this._changedAttributes = record.changedAttributes();
// The following code is here to keep backwards compatibility when accessing
// `constructor` directly.
//
// With snapshots you should use `type` instead of `constructor`.
//
// Remove for Ember Data 1.0.
if (Ember.platform.hasPropertyAccessors) {
var callDeprecate = true;
Ember.defineProperty(this, 'constructor', {
get: function () {
// Ugly hack since accessing error.stack (done in `Ember.deprecate()`)
// causes the internals of Chrome to access the constructor, which then
// causes an infinite loop if accessed and calls `Ember.deprecate()`
// again.
if (callDeprecate) {
callDeprecate = false;
callDeprecate = true;
}
return this.type;
}
});
} else {
this.constructor = this.type;
}
}
ember$data$lib$system$snapshot$$Snapshot.prototype = {
constructor: ember$data$lib$system$snapshot$$Snapshot,
/**
The id of the snapshot's underlying record
Example
```javascript
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
postSnapshot.id; // => '1'
```
@property id
@type {String}
*/
id: null,
/**
The underlying record for this snapshot. Can be used to access methods and
properties defined on the record.
Example
```javascript
var json = snapshot.record.toJSON();
```
@property record
@type {DS.Model}
*/
record: null,
/**
The type of the underlying record for this snapshot, as a DS.Model.
@property type
@type {DS.Model}
*/
type: null,
/**
The name of the type of the underlying record for this snapshot, as a string.
@property modelName
@type {String}
*/
modelName: null,
/**
Returns the value of an attribute.
Example
```javascript
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
postSnapshot.attr('author'); // => 'Tomster'
postSnapshot.attr('title'); // => 'Ember.js rocks'
```
Note: Values are loaded eagerly and cached when the snapshot is created.
@method attr
@param {String} keyName
@return {Object} The attribute value or undefined
*/
attr: function (keyName) {
if (keyName in this._attributes) {
return this._attributes[keyName];
}
throw new Ember.Error("Model '" + Ember.inspect(this.record) + "' has no attribute named '" + keyName + "' defined.");
},
/**
Returns all attributes and their corresponding values.
Example
```javascript
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }
```
@method attributes
@return {Object} All attributes of the current snapshot
*/
attributes: function () {
return Ember.copy(this._attributes);
},
/**
Returns all changed attributes and their old and new values.
Example
```javascript
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
postModel.set('title', 'Ember.js rocks!');
postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }
```
@method changedAttributes
@return {Object} All changed attributes of the current snapshot
*/
changedAttributes: function () {
var changedAttributes = new ember$data$lib$system$empty$object$$default();
var changedAttributeKeys = ember$data$lib$system$object$polyfills$$keysFunc(this._changedAttributes);
for (var i = 0, _length = changedAttributeKeys.length; i < _length; i++) {
var key = changedAttributeKeys[i];
changedAttributes[key] = Ember.copy(this._changedAttributes[key]);
}
return changedAttributes;
},
/**
Returns the current value of a belongsTo relationship.
`belongsTo` takes an optional hash of options as a second parameter,
currently supported options are:
- `id`: set to `true` if you only want the ID of the related record to be
returned.
Example
```javascript
// store.push('post', { id: 1, title: 'Hello World' });
// store.createRecord('comment', { body: 'Lorem ipsum', post: post });
commentSnapshot.belongsTo('post'); // => DS.Snapshot
commentSnapshot.belongsTo('post', { id: true }); // => '1'
// store.push('comment', { id: 1, body: 'Lorem ipsum' });
commentSnapshot.belongsTo('post'); // => undefined
```
Calling `belongsTo` will return a new Snapshot as long as there's any known
data for the relationship available, such as an ID. If the relationship is
known but unset, `belongsTo` will return `null`. If the contents of the
relationship is unknown `belongsTo` will return `undefined`.
Note: Relationships are loaded lazily and cached upon first access.
@method belongsTo
@param {String} keyName
@param {Object} [options]
@return {(DS.Snapshot|String|null|undefined)} A snapshot or ID of a known
relationship or null if the relationship is known but unset. undefined
will be returned if the contents of the relationship is unknown.
*/
belongsTo: function (keyName, options) {
var id = options && options.id;
var relationship, inverseRecord, hasData;
var result;
if (id && keyName in this._belongsToIds) {
return this._belongsToIds[keyName];
}
if (!id && keyName in this._belongsToRelationships) {
return this._belongsToRelationships[keyName];
}
relationship = this._internalModel._relationships.get(keyName);
if (!(relationship && relationship.relationshipMeta.kind === 'belongsTo')) {
throw new Ember.Error("Model '" + Ember.inspect(this.record) + "' has no belongsTo relationship named '" + keyName + "' defined.");
}
hasData = ember$data$lib$system$snapshot$$get(relationship, 'hasData');
inverseRecord = ember$data$lib$system$snapshot$$get(relationship, 'inverseRecord');
if (hasData) {
if (inverseRecord && !inverseRecord.isDeleted()) {
if (id) {
result = ember$data$lib$system$snapshot$$get(inverseRecord, 'id');
} else {
result = inverseRecord.createSnapshot();
}
} else {
result = null;
}
}
if (id) {
this._belongsToIds[keyName] = result;
} else {
this._belongsToRelationships[keyName] = result;
}
return result;
},
/**
Returns the current value of a hasMany relationship.
`hasMany` takes an optional hash of options as a second parameter,
currently supported options are:
- `ids`: set to `true` if you only want the IDs of the related records to be
returned.
Example
```javascript
// store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });
postSnapshot.hasMany('comments'); // => [DS.Snapshot, DS.Snapshot]
postSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']
// store.push('post', { id: 1, title: 'Hello World' });
postSnapshot.hasMany('comments'); // => undefined
```
Note: Relationships are loaded lazily and cached upon first access.
@method hasMany
@param {String} keyName
@param {Object} [options]
@return {(Array|undefined)} An array of snapshots or IDs of a known
relationship or an empty array if the relationship is known but unset.
undefined will be returned if the contents of the relationship is unknown.
*/
hasMany: function (keyName, options) {
var ids = options && options.ids;
var relationship, members, hasData;
var results;
if (ids && keyName in this._hasManyIds) {
return this._hasManyIds[keyName];
}
if (!ids && keyName in this._hasManyRelationships) {
return this._hasManyRelationships[keyName];
}
relationship = this._internalModel._relationships.get(keyName);
if (!(relationship && relationship.relationshipMeta.kind === 'hasMany')) {
throw new Ember.Error("Model '" + Ember.inspect(this.record) + "' has no hasMany relationship named '" + keyName + "' defined.");
}
hasData = ember$data$lib$system$snapshot$$get(relationship, 'hasData');
members = ember$data$lib$system$snapshot$$get(relationship, 'members');
if (hasData) {
results = [];
members.forEach(function (member) {
if (!member.isDeleted()) {
if (ids) {
results.push(member.id);
} else {
results.push(member.createSnapshot());
}
}
});
}
if (ids) {
this._hasManyIds[keyName] = results;
} else {
this._hasManyRelationships[keyName] = results;
}
return results;
},
/**
Iterates through all the attributes of the model, calling the passed
function on each attribute.
Example
```javascript
snapshot.eachAttribute(function(name, meta) {
// ...
});
```
@method eachAttribute
@param {Function} callback the callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
*/
eachAttribute: function (callback, binding) {
this.record.eachAttribute(callback, binding);
},
/**
Iterates through all the relationships of the model, calling the passed
function on each relationship.
Example
```javascript
snapshot.eachRelationship(function(name, relationship) {
// ...
});
```
@method eachRelationship
@param {Function} callback the callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
*/
eachRelationship: function (callback, binding) {
this.record.eachRelationship(callback, binding);
},
/**
@method get
@param {String} keyName
@return {Object} The property value
@deprecated Use [attr](#method_attr), [belongsTo](#method_belongsTo) or [hasMany](#method_hasMany) instead
*/
get: function (keyName) {
if (keyName === 'id') {
return this.id;
}
if (keyName in this._attributes) {
return this.attr(keyName);
}
var relationship = this._internalModel._relationships.get(keyName);
if (relationship && relationship.relationshipMeta.kind === 'belongsTo') {
return this.belongsTo(keyName);
}
if (relationship && relationship.relationshipMeta.kind === 'hasMany') {
return this.hasMany(keyName);
}
return ember$data$lib$system$snapshot$$get(this.record, keyName);
},
/**
@method serialize
@param {Object} options
@return {Object} an object whose values are primitive JSON values only
*/
serialize: function (options) {
return this.record.store.serializerFor(this.modelName).serialize(this, options);
},
/**
@method unknownProperty
@param {String} keyName
@return {Object} The property value
@deprecated Use [attr](#method_attr), [belongsTo](#method_belongsTo) or [hasMany](#method_hasMany) instead
*/
unknownProperty: function (keyName) {
return this.get(keyName);
},
/**
@method _createSnapshot
@private
*/
_createSnapshot: function () {
return this;
}
};
Ember.defineProperty(ember$data$lib$system$snapshot$$Snapshot.prototype, 'typeKey', {
enumerable: false,
get: function () {
return this.modelName;
},
set: function () {
}
});
var ember$data$lib$system$snapshot$$default = ember$data$lib$system$snapshot$$Snapshot;
var ember$data$lib$system$model$internal$model$$Promise = Ember.RSVP.Promise;
var ember$data$lib$system$model$internal$model$$get = Ember.get;
var ember$data$lib$system$model$internal$model$$set = Ember.set;
var ember$data$lib$system$model$internal$model$$forEach = ember$data$lib$ext$ember$array$$default.forEach;
var ember$data$lib$system$model$internal$model$$map = ember$data$lib$ext$ember$array$$default.map;
var ember$data$lib$system$model$internal$model$$_extractPivotNameCache = new ember$data$lib$system$empty$object$$default();
var ember$data$lib$system$model$internal$model$$_splitOnDotCache = new ember$data$lib$system$empty$object$$default();
function ember$data$lib$system$model$internal$model$$splitOnDot(name) {
return ember$data$lib$system$model$internal$model$$_splitOnDotCache[name] || (ember$data$lib$system$model$internal$model$$_splitOnDotCache[name] = name.split('.'));
}
function ember$data$lib$system$model$internal$model$$extractPivotName(name) {
return ember$data$lib$system$model$internal$model$$_extractPivotNameCache[name] || (ember$data$lib$system$model$internal$model$$_extractPivotNameCache[name] = ember$data$lib$system$model$internal$model$$splitOnDot(name)[0]);
}
function ember$data$lib$system$model$internal$model$$retrieveFromCurrentState(key) {
return function () {
return ember$data$lib$system$model$internal$model$$get(this.currentState, key);
};
}
/**
`InternalModel` is the Model class that we use internally inside Ember Data to represent models.
Internal ED methods should only deal with `InternalModel` objects. It is a fast, plain Javascript class.
We expose `DS.Model` to application code, by materializing a `DS.Model` from `InternalModel` lazily, as
a performance optimization.
`InternalModel` should never be exposed to application code. At the boundaries of the system, in places
like `find`, `push`, etc. we convert between Models and InternalModels.
We need to make sure that the properties from `InternalModel` are correctly exposed/proxied on `Model`
if they are needed.
@class InternalModel
*/
var ember$data$lib$system$model$internal$model$$InternalModel = function InternalModel(type, id, store, container, data) {
this.type = type;
this.id = id;
this.store = store;
this.container = container;
this._data = data || ember$data$lib$system$object$polyfills$$create(null);
this.modelName = type.modelName;
this.dataHasInitialized = false;
//Look into making this lazy
this._deferredTriggers = [];
this._attributes = ember$data$lib$system$object$polyfills$$create(null);
this._inFlightAttributes = ember$data$lib$system$object$polyfills$$create(null);
this._relationships = new ember$data$lib$system$relationships$state$create$$default(this);
this.currentState = ember$data$lib$system$model$states$$default.empty;
this.isReloading = false;
this.isError = false;
this.error = null;
/*
implicit relationships are relationship which have not been declared but the inverse side exists on
another record somewhere
For example if there was
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr()
})
```
but there is also
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr(),
comments: DS.hasMany('comment')
})
```
would have a implicit post relationship in order to be do things like remove ourselves from the post
when we are deleted
*/
this._implicitRelationships = ember$data$lib$system$object$polyfills$$create(null);
};
ember$data$lib$system$model$internal$model$$InternalModel.prototype = {
isEmpty: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState('isEmpty'),
isLoading: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState('isLoading'),
isLoaded: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState('isLoaded'),
hasDirtyAttributes: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState('hasDirtyAttributes'),
isSaving: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState('isSaving'),
isDeleted: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState('isDeleted'),
isNew: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState('isNew'),
isValid: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState('isValid'),
dirtyType: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState('dirtyType'),
constructor: ember$data$lib$system$model$internal$model$$InternalModel,
materializeRecord: function () {
// lookupFactory should really return an object that creates
// instances with the injections applied
this.record = this.type._create({
id: this.id,
store: this.store,
container: this.container,
_internalModel: this,
currentState: ember$data$lib$system$model$internal$model$$get(this, 'currentState'),
isError: this.isError,
adapterError: this.error
});
this._triggerDeferredTriggers();
},
recordObjectWillDestroy: function () {
this.record = null;
},
deleteRecord: function () {
this.send('deleteRecord');
},
save: function (options) {
var promiseLabel = "DS: Model#save " + this;
var resolver = Ember.RSVP.defer(promiseLabel);
this.store.scheduleSave(this, resolver, options);
return resolver.promise;
},
startedReloading: function () {
this.isReloading = true;
if (this.record) {
ember$data$lib$system$model$internal$model$$set(this.record, 'isReloading', true);
}
},
finishedReloading: function () {
this.isReloading = false;
if (this.record) {
ember$data$lib$system$model$internal$model$$set(this.record, 'isReloading', false);
}
},
reload: function () {
this.startedReloading();
var record = this;
var promiseLabel = "DS: Model#reload of " + this;
return new ember$data$lib$system$model$internal$model$$Promise(function (resolve) {
record.send('reloadRecord', resolve);
}, promiseLabel).then(function () {
record.didCleanError();
return record;
}, function (error) {
record.didError(error);
throw error;
}, "DS: Model#reload complete, update flags")["finally"](function () {
record.finishedReloading();
record.updateRecordArrays();
});
},
getRecord: function () {
if (!this.record) {
this.materializeRecord();
}
return this.record;
},
unloadRecord: function () {
this.send('unloadRecord');
},
eachRelationship: function (callback, binding) {
return this.type.eachRelationship(callback, binding);
},
eachAttribute: function (callback, binding) {
return this.type.eachAttribute(callback, binding);
},
inverseFor: function (key) {
return this.type.inverseFor(key);
},
setupData: function (data) {
var changedKeys = this._changedKeys(data.attributes);
ember$data$lib$system$merge$$default(this._data, data.attributes);
this.pushedData();
if (this.record) {
this.record._notifyProperties(changedKeys);
}
this.didInitalizeData();
},
becameReady: function () {
Ember.run.schedule('actions', this.store.recordArrayManager, this.store.recordArrayManager.recordWasLoaded, this);
},
didInitalizeData: function () {
if (!this.dataHasInitialized) {
this.becameReady();
this.dataHasInitialized = true;
}
},
destroy: function () {
if (this.record) {
return this.record.destroy();
}
},
/**
@method createSnapshot
@private
*/
createSnapshot: function (options) {
var adapterOptions = options && options.adapterOptions;
var snapshot = new ember$data$lib$system$snapshot$$default(this);
snapshot.adapterOptions = adapterOptions;
return snapshot;
},
/**
@method loadingData
@private
@param {Promise} promise
*/
loadingData: function (promise) {
this.send('loadingData', promise);
},
/**
@method loadedData
@private
*/
loadedData: function () {
this.send('loadedData');
this.didInitalizeData();
},
/**
@method notFound
@private
*/
notFound: function () {
this.send('notFound');
},
/**
@method pushedData
@private
*/
pushedData: function () {
this.send('pushedData');
},
flushChangedAttributes: function () {
this._inFlightAttributes = this._attributes;
this._attributes = ember$data$lib$system$object$polyfills$$create(null);
},
/**
@method adapterWillCommit
@private
*/
adapterWillCommit: function () {
this.send('willCommit');
},
/**
@method adapterDidDirty
@private
*/
adapterDidDirty: function () {
this.send('becomeDirty');
this.updateRecordArraysLater();
},
/**
@method send
@private
@param {String} name
@param {Object} context
*/
send: function (name, context) {
var currentState = ember$data$lib$system$model$internal$model$$get(this, 'currentState');
if (!currentState[name]) {
this._unhandledEvent(currentState, name, context);
}
return currentState[name](this, context);
},
notifyHasManyAdded: function (key, record, idx) {
if (this.record) {
this.record.notifyHasManyAdded(key, record, idx);
}
},
notifyHasManyRemoved: function (key, record, idx) {
if (this.record) {
this.record.notifyHasManyRemoved(key, record, idx);
}
},
notifyBelongsToChanged: function (key, record) {
if (this.record) {
this.record.notifyBelongsToChanged(key, record);
}
},
notifyPropertyChange: function (key) {
if (this.record) {
this.record.notifyPropertyChange(key);
}
},
rollbackAttributes: function () {
var dirtyKeys = ember$data$lib$system$object$polyfills$$keysFunc(this._attributes);
this._attributes = ember$data$lib$system$object$polyfills$$create(null);
if (ember$data$lib$system$model$internal$model$$get(this, 'isError')) {
this._inFlightAttributes = ember$data$lib$system$object$polyfills$$create(null);
this.didCleanError();
}
//Eventually rollback will always work for relationships
//For now we support it only out of deleted state, because we
//have an explicit way of knowing when the server acked the relationship change
if (this.isDeleted()) {
//TODO: Should probably move this to the state machine somehow
this.becameReady();
this.reconnectRelationships();
}
if (this.isNew()) {
this.clearRelationships();
}
if (this.isValid()) {
this._inFlightAttributes = ember$data$lib$system$object$polyfills$$create(null);
}
this.send('rolledBack');
this.record._notifyProperties(dirtyKeys);
},
/**
@method transitionTo
@private
@param {String} name
*/
transitionTo: function (name) {
// POSSIBLE TODO: Remove this code and replace with
// always having direct reference to state objects
var pivotName = ember$data$lib$system$model$internal$model$$extractPivotName(name);
var currentState = ember$data$lib$system$model$internal$model$$get(this, 'currentState');
var state = currentState;
do {
if (state.exit) {
state.exit(this);
}
state = state.parentState;
} while (!state.hasOwnProperty(pivotName));
var path = ember$data$lib$system$model$internal$model$$splitOnDot(name);
var setups = [];
var enters = [];
var i, l;
for (i = 0, l = path.length; i < l; i++) {
state = state[path[i]];
if (state.enter) {
enters.push(state);
}
if (state.setup) {
setups.push(state);
}
}
for (i = 0, l = enters.length; i < l; i++) {
enters[i].enter(this);
}
ember$data$lib$system$model$internal$model$$set(this, 'currentState', state);
//TODO Consider whether this is the best approach for keeping these two in sync
if (this.record) {
ember$data$lib$system$model$internal$model$$set(this.record, 'currentState', state);
}
for (i = 0, l = setups.length; i < l; i++) {
setups[i].setup(this);
}
this.updateRecordArraysLater();
},
_unhandledEvent: function (state, name, context) {
var errorMessage = "Attempted to handle event `" + name + "` ";
errorMessage += "on " + String(this) + " while in state ";
errorMessage += state.stateName + ". ";
if (context !== undefined) {
errorMessage += "Called with " + Ember.inspect(context) + ".";
}
throw new Ember.Error(errorMessage);
},
triggerLater: function () {
var length = arguments.length;
var args = new Array(length);
for (var i = 0; i < length; i++) {
args[i] = arguments[i];
}
if (this._deferredTriggers.push(args) !== 1) {
return;
}
Ember.run.scheduleOnce('actions', this, '_triggerDeferredTriggers');
},
_triggerDeferredTriggers: function () {
//TODO: Before 1.0 we want to remove all the events that happen on the pre materialized record,
//but for now, we queue up all the events triggered before the record was materialized, and flush
//them once we have the record
if (!this.record) {
return;
}
for (var i = 0, l = this._deferredTriggers.length; i < l; i++) {
this.record.trigger.apply(this.record, this._deferredTriggers[i]);
}
this._deferredTriggers.length = 0;
},
/**
@method clearRelationships
@private
*/
clearRelationships: function () {
this.eachRelationship(function (name, relationship) {
if (this._relationships.has(name)) {
var rel = this._relationships.get(name);
//TODO(Igor) figure out whether we want to clear or disconnect
rel.clear();
rel.destroy();
}
}, this);
var model = this;
ember$data$lib$system$model$internal$model$$forEach.call(ember$data$lib$system$object$polyfills$$keysFunc(this._implicitRelationships), function (key) {
model._implicitRelationships[key].clear();
model._implicitRelationships[key].destroy();
});
},
disconnectRelationships: function () {
this.eachRelationship(function (name, relationship) {
this._relationships.get(name).disconnect();
}, this);
var model = this;
ember$data$lib$system$model$internal$model$$forEach.call(ember$data$lib$system$object$polyfills$$keysFunc(this._implicitRelationships), function (key) {
model._implicitRelationships[key].disconnect();
});
},
reconnectRelationships: function () {
this.eachRelationship(function (name, relationship) {
this._relationships.get(name).reconnect();
}, this);
var model = this;
ember$data$lib$system$model$internal$model$$forEach.call(ember$data$lib$system$object$polyfills$$keysFunc(this._implicitRelationships), function (key) {
model._implicitRelationships[key].reconnect();
});
},
/**
When a find request is triggered on the store, the user can optionally pass in
attributes and relationships to be preloaded. These are meant to behave as if they
came back from the server, except the user obtained them out of band and is informing
the store of their existence. The most common use case is for supporting client side
nested URLs, such as `/posts/1/comments/2` so the user can do
`store.find('comment', 2, {post:1})` without having to fetch the post.
Preloaded data can be attributes and relationships passed in either as IDs or as actual
models.
@method _preloadData
@private
@param {Object} preload
*/
_preloadData: function (preload) {
var record = this;
//TODO(Igor) consider the polymorphic case
ember$data$lib$system$model$internal$model$$forEach.call(ember$data$lib$system$object$polyfills$$keysFunc(preload), function (key) {
var preloadValue = ember$data$lib$system$model$internal$model$$get(preload, key);
var relationshipMeta = record.type.metaForProperty(key);
if (relationshipMeta.isRelationship) {
record._preloadRelationship(key, preloadValue);
} else {
record._data[key] = preloadValue;
}
});
},
_preloadRelationship: function (key, preloadValue) {
var relationshipMeta = this.type.metaForProperty(key);
var type = relationshipMeta.type;
if (relationshipMeta.kind === 'hasMany') {
this._preloadHasMany(key, preloadValue, type);
} else {
this._preloadBelongsTo(key, preloadValue, type);
}
},
_preloadHasMany: function (key, preloadValue, type) {
var internalModel = this;
var recordsToSet = ember$data$lib$system$model$internal$model$$map.call(preloadValue, function (recordToPush) {
return internalModel._convertStringOrNumberIntoInternalModel(recordToPush, type);
});
//We use the pathway of setting the hasMany as if it came from the adapter
//because the user told us that they know this relationships exists already
this._relationships.get(key).updateRecordsFromAdapter(recordsToSet);
},
_preloadBelongsTo: function (key, preloadValue, type) {
var recordToSet = this._convertStringOrNumberIntoInternalModel(preloadValue, type);
//We use the pathway of setting the hasMany as if it came from the adapter
//because the user told us that they know this relationships exists already
this._relationships.get(key).setRecord(recordToSet);
},
_convertStringOrNumberIntoInternalModel: function (value, type) {
if (typeof value === 'string' || typeof value === 'number') {
return this.store._internalModelForId(type, value);
}
if (value._internalModel) {
return value._internalModel;
}
return value;
},
/**
@method updateRecordArrays
@private
*/
updateRecordArrays: function () {
this._updatingRecordArraysLater = false;
this.store.dataWasUpdated(this.type, this);
},
setId: function (id) {
this.id = id;
//TODO figure out whether maybe we should proxy
ember$data$lib$system$model$internal$model$$set(this.record, 'id', id);
},
didError: function (error) {
this.error = error;
this.isError = true;
if (this.record) {
this.record.setProperties({
isError: true,
adapterError: error
});
}
},
didCleanError: function () {
this.error = null;
this.isError = false;
if (this.record) {
this.record.setProperties({
isError: false,
adapterError: null
});
}
},
/**
If the adapter did not return a hash in response to a commit,
merge the changed attributes and relationships into the existing
saved data.
@method adapterDidCommit
*/
adapterDidCommit: function (data) {
if (data) {
data = data.attributes;
}
this.didCleanError();
var changedKeys = this._changedKeys(data);
ember$data$lib$system$merge$$default(this._data, this._inFlightAttributes);
if (data) {
ember$data$lib$system$merge$$default(this._data, data);
}
this._inFlightAttributes = ember$data$lib$system$object$polyfills$$create(null);
this.send('didCommit');
this.updateRecordArraysLater();
if (!data) {
return;
}
this.record._notifyProperties(changedKeys);
},
/**
@method updateRecordArraysLater
@private
*/
updateRecordArraysLater: function () {
// quick hack (something like this could be pushed into run.once
if (this._updatingRecordArraysLater) {
return;
}
this._updatingRecordArraysLater = true;
Ember.run.schedule('actions', this, this.updateRecordArrays);
},
addErrorMessageToAttribute: function (attribute, message) {
var record = this.getRecord();
ember$data$lib$system$model$internal$model$$get(record, 'errors').add(attribute, message);
},
removeErrorMessageFromAttribute: function (attribute) {
var record = this.getRecord();
ember$data$lib$system$model$internal$model$$get(record, 'errors').remove(attribute);
},
clearErrorMessages: function () {
var record = this.getRecord();
ember$data$lib$system$model$internal$model$$get(record, 'errors').clear();
},
// FOR USE DURING COMMIT PROCESS
/**
@method adapterDidInvalidate
@private
*/
adapterDidInvalidate: function (errors) {
var attribute;
for (attribute in errors) {
if (errors.hasOwnProperty(attribute)) {
this.addErrorMessageToAttribute(attribute, errors[attribute]);
}
}
this._saveWasRejected();
},
/**
@method adapterDidError
@private
*/
adapterDidError: function (error) {
this.send('becameError');
this.didError(error);
this._saveWasRejected();
},
_saveWasRejected: function () {
var keys = ember$data$lib$system$object$polyfills$$keysFunc(this._inFlightAttributes);
for (var i = 0; i < keys.length; i++) {
if (this._attributes[keys[i]] === undefined) {
this._attributes[keys[i]] = this._inFlightAttributes[keys[i]];
}
}
this._inFlightAttributes = ember$data$lib$system$object$polyfills$$create(null);
},
/**
Ember Data has 3 buckets for storing the value of an attribute on an internalModel.
`_data` holds all of the attributes that have been acknowledged by
a backend via the adapter. When rollbackAttributes is called on a model all
attributes will revert to the record's state in `_data`.
`_attributes` holds any change the user has made to an attribute
that has not been acknowledged by the adapter. Any values in
`_attributes` are have priority over values in `_data`.
`_inFlightAttributes`. When a record is being synced with the
backend the values in `_attributes` are copied to
`_inFlightAttributes`. This way if the backend acknowledges the
save but does not return the new state Ember Data can copy the
values from `_inFlightAttributes` to `_data`. Without having to
worry about changes made to `_attributes` while the save was
happenign.
Changed keys builds a list of all of the values that may have been
changed by the backend after a successful save.
It does this by iterating over each key, value pair in the payload
returned from the server after a save. If the `key` is found in
`_attributes` then the user has a local changed to the attribute
that has not been synced with the server and the key is not
included in the list of changed keys.
If the value, for a key differs from the value in what Ember Data
believes to be the truth about the backend state (A merger of the
`_data` and `_inFlightAttributes` objects where
`_inFlightAttributes` has priority) then that means the backend
has updated the value and the key is added to the list of changed
keys.
@method _changedKeys
@private
*/
_changedKeys: function (updates) {
var changedKeys = [];
if (updates) {
var original, i, value, key;
var keys = ember$data$lib$system$object$polyfills$$keysFunc(updates);
var length = keys.length;
original = ember$data$lib$system$merge$$default(ember$data$lib$system$object$polyfills$$create(null), this._data);
original = ember$data$lib$system$merge$$default(original, this._inFlightAttributes);
for (i = 0; i < length; i++) {
key = keys[i];
value = updates[key];
// A value in _attributes means the user has a local change to
// this attributes. We never override this value when merging
// updates from the backend so we should not sent a change
// notification if the server value differs from the original.
if (this._attributes[key] !== undefined) {
continue;
}
if (!Ember.isEqual(original[key], value)) {
changedKeys.push(key);
}
}
}
return changedKeys;
},
toString: function () {
if (this.record) {
return this.record.toString();
} else {
return "<" + this.modelName + ":" + this.id + ">";
}
}
};
var ember$data$lib$system$model$internal$model$$default = ember$data$lib$system$model$internal$model$$InternalModel;
var ember$data$lib$system$store$$Backburner = Ember._Backburner || Ember.Backburner || Ember.__loader.require('backburner')['default'] || Ember.__loader.require('backburner')['Backburner'];
//Shim Backburner.join
if (!ember$data$lib$system$store$$Backburner.prototype.join) {
var ember$data$lib$system$store$$isString = function (suspect) {
return typeof suspect === 'string';
};
ember$data$lib$system$store$$Backburner.prototype.join = function () /*target, method, args */{
var method, target;
if (this.currentInstance) {
var length = arguments.length;
if (length === 1) {
method = arguments[0];
target = null;
} else {
target = arguments[0];
method = arguments[1];
}
if (ember$data$lib$system$store$$isString(method)) {
method = target[method];
}
if (length === 1) {
return method();
} else if (length === 2) {
return method.call(target);
} else {
var args = new Array(length - 2);
for (var i = 0, l = length - 2; i < l; i++) {
args[i] = arguments[i + 2];
}
return method.apply(target, args);
}
} else {
return this.run.apply(this, arguments);
}
};
}
//Get the materialized model from the internalModel/promise that returns
//an internal model and return it in a promiseObject. Useful for returning
//from find methods
function ember$data$lib$system$store$$promiseRecord(internalModel, label) {
var toReturn = internalModel.then(function (model) {
return model.getRecord();
});
return ember$data$lib$system$promise$proxies$$promiseObject(toReturn, label);
}
var ember$data$lib$system$store$$get = Ember.get;
var ember$data$lib$system$store$$set = Ember.set;
var ember$data$lib$system$store$$once = Ember.run.once;
var ember$data$lib$system$store$$isNone = Ember.isNone;
var ember$data$lib$system$store$$forEach = ember$data$lib$ext$ember$array$$default.forEach;
var ember$data$lib$system$store$$indexOf = ember$data$lib$ext$ember$array$$default.indexOf;
var ember$data$lib$system$store$$map = ember$data$lib$ext$ember$array$$default.map;
var ember$data$lib$system$store$$filter = ember$data$lib$ext$ember$array$$default.filter;
var ember$data$lib$system$store$$Promise = Ember.RSVP.Promise;
var ember$data$lib$system$store$$copy = Ember.copy;
var ember$data$lib$system$store$$Store;
var ember$data$lib$system$store$$Service = Ember.Service;
if (!ember$data$lib$system$store$$Service) {
ember$data$lib$system$store$$Service = Ember.Object;
}
// Implementors Note:
//
// The variables in this file are consistently named according to the following
// scheme:
//
// * +id+ means an identifier managed by an external source, provided inside
// the data provided by that source. These are always coerced to be strings
// before being used internally.
// * +clientId+ means a transient numerical identifier generated at runtime by
// the data store. It is important primarily because newly created objects may
// not yet have an externally generated id.
// * +internalModel+ means a record internalModel object, which holds metadata about a
// record, even if it has not yet been fully materialized.
// * +type+ means a DS.Model.
/**
The store contains all of the data for records loaded from the server.
It is also responsible for creating instances of `DS.Model` that wrap
the individual data for a record, so that they can be bound to in your
Handlebars templates.
Define your application's store like this:
```app/stores/application.js
import DS from 'ember-data';
export default DS.Store.extend({
});
```
Most Ember.js applications will only have a single `DS.Store` that is
automatically created by their `Ember.Application`.
You can retrieve models from the store in several ways. To retrieve a record
for a specific id, use `DS.Store`'s `find()` method:
```javascript
store.find('person', 123).then(function (person) {
});
```
By default, the store will talk to your backend using a standard
REST mechanism. You can customize how the store talks to your
backend by specifying a custom adapter:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
});
```
You can learn more about writing a custom adapter by reading the `DS.Adapter`
documentation.
### Store createRecord() vs. push() vs. pushPayload()
The store provides multiple ways to create new record objects. They have
some subtle differences in their use which are detailed below:
[createRecord](#method_createRecord) is used for creating new
records on the client side. This will return a new record in the
`created.uncommitted` state. In order to persist this record to the
backend you will need to call `record.save()`.
[push](#method_push) is used to notify Ember Data's store of new or
updated records that exist in the backend. This will return a record
in the `loaded.saved` state. The primary use-case for `store#push` is
to notify Ember Data about record updates (full or partial) that happen
outside of the normal adapter methods (for example
[SSE](http://dev.w3.org/html5/eventsource/) or [Web
Sockets](http://www.w3.org/TR/2009/WD-websockets-20091222/)).
[pushPayload](#method_pushPayload) is a convenience wrapper for
`store#push` that will deserialize payloads if the
Serializer implements a `pushPayload` method.
Note: When creating a new record using any of the above methods
Ember Data will update `DS.RecordArray`s such as those returned by
`store#peekAll()`, `store#findAll()` or `store#filter()`. This means any
data bindings or computed properties that depend on the RecordArray
will automatically be synced to include the new or updated record
values.
@class Store
@namespace DS
@extends Ember.Service
*/
ember$data$lib$system$store$$Store = ember$data$lib$system$store$$Service.extend({
/**
@method init
@private
*/
init: function () {
this._backburner = new ember$data$lib$system$store$$Backburner(['normalizeRelationships', 'syncRelationships', 'finished']);
// internal bookkeeping; not observable
this.typeMaps = {};
this.recordArrayManager = ember$data$lib$system$record$array$manager$$default.create({
store: this
});
this._pendingSave = [];
this._instanceCache = new ember$data$lib$system$store$container$instance$cache$$default(this.container);
//Used to keep track of all the find requests that need to be coalesced
this._pendingFetch = ember$data$lib$system$map$$Map.create();
},
/**
The adapter to use to communicate to a backend server or other persistence layer.
This can be specified as an instance, class, or string.
If you want to specify `app/adapters/custom.js` as a string, do:
```js
adapter: 'custom'
```
@property adapter
@default DS.RESTAdapter
@type {(DS.Adapter|String)}
*/
adapter: '-rest',
/**
Returns a JSON representation of the record using a custom
type-specific serializer, if one exists.
The available options are:
* `includeId`: `true` if the record's ID should be included in
the JSON representation
@method serialize
@private
@param {DS.Model} record the record to serialize
@param {Object} options an options hash
*/
serialize: function (record, options) {
var snapshot = record._internalModel.createSnapshot();
return snapshot.serialize(options);
},
/**
This property returns the adapter, after resolving a possible
string key.
If the supplied `adapter` was a class, or a String property
path resolved to a class, this property will instantiate the
class.
This property is cacheable, so the same instance of a specified
adapter class should be used for the lifetime of the store.
@property defaultAdapter
@private
@return DS.Adapter
*/
defaultAdapter: Ember.computed('adapter', function () {
var adapter = ember$data$lib$system$store$$get(this, 'adapter');
adapter = this.retrieveManagedInstance('adapter', adapter);
return adapter;
}),
// .....................
// . CREATE NEW RECORD .
// .....................
/**
Create a new record in the current store. The properties passed
to this method are set on the newly created record.
To create a new instance of a `Post`:
```js
store.createRecord('post', {
title: "Rails is omakase"
});
```
To create a new instance of a `Post` that has a relationship with a `User` record:
```js
var user = this.store.peekRecord('user', 1);
store.createRecord('post', {
title: "Rails is omakase",
user: user
});
```
@method createRecord
@param {String} modelName
@param {Object} inputProperties a hash of properties to set on the
newly created record.
@return {DS.Model} record
*/
createRecord: function (modelName, inputProperties) {
var typeClass = this.modelFor(modelName);
var properties = ember$data$lib$system$store$$copy(inputProperties) || new ember$data$lib$system$empty$object$$default();
// If the passed properties do not include a primary key,
// give the adapter an opportunity to generate one. Typically,
// client-side ID generators will use something like uuid.js
// to avoid conflicts.
if (ember$data$lib$system$store$$isNone(properties.id)) {
properties.id = this._generateId(modelName, properties);
}
// Coerce ID to a string
properties.id = ember$data$lib$system$coerce$id$$default(properties.id);
var internalModel = this.buildInternalModel(typeClass, properties.id);
var record = internalModel.getRecord();
// Move the record out of its initial `empty` state into
// the `loaded` state.
internalModel.loadedData();
// Set the properties specified on the record.
record.setProperties(properties);
internalModel.eachRelationship(function (key, descriptor) {
internalModel._relationships.get(key).setHasData(true);
});
return record;
},
/**
If possible, this method asks the adapter to generate an ID for
a newly created record.
@method _generateId
@private
@param {String} modelName
@param {Object} properties from the new record
@return {String} if the adapter can generate one, an ID
*/
_generateId: function (modelName, properties) {
var adapter = this.adapterFor(modelName);
if (adapter && adapter.generateIdForRecord) {
return adapter.generateIdForRecord(this, modelName, properties);
}
return null;
},
// .................
// . DELETE RECORD .
// .................
/**
For symmetry, a record can be deleted via the store.
Example
```javascript
var post = store.createRecord('post', {
title: "Rails is omakase"
});
store.deleteRecord(post);
```
@method deleteRecord
@param {DS.Model} record
*/
deleteRecord: function (record) {
record.deleteRecord();
},
/**
For symmetry, a record can be unloaded via the store. Only
non-dirty records can be unloaded.
Example
```javascript
store.find('post', 1).then(function(post) {
store.unloadRecord(post);
});
```
@method unloadRecord
@param {DS.Model} record
*/
unloadRecord: function (record) {
record.unloadRecord();
},
// ................
// . FIND RECORDS .
// ................
/**
This is the main entry point into finding records. The first parameter to
this method is the model's name as a string.
---
To find a record by ID, pass the `id` as the second parameter:
```javascript
store.find('person', 1);
```
The `find` method will always return a **promise** that will be resolved
with the record. If the record was already in the store, the promise will
be resolved immediately. Otherwise, the store will ask the adapter's `find`
method to find the necessary data.
The `find` method will always resolve its promise with the same object for
a given type and `id`.
---
You can optionally `preload` specific attributes and relationships that you know of
by passing them as the third argument to find.
For example, if your Ember route looks like `/posts/1/comments/2` and your API route
for the comment also looks like `/posts/1/comments/2` if you want to fetch the comment
without fetching the post you can pass in the post to the `find` call:
```javascript
store.find('comment', 2, { preload: { post: 1 } });
```
If you have access to the post model you can also pass the model itself:
```javascript
store.find('post', 1).then(function (myPostModel) {
store.find('comment', 2, {post: myPostModel});
});
```
This way, your adapter's `find` or `buildURL` method will be able to look up the
relationship on the record and construct the nested URL without having to first
fetch the post.
---
To find all records for a type, call `findAll`:
```javascript
store.findAll('person');
```
This will ask the adapter's `findAll` method to find the records for the
given type, and return a promise that will be resolved once the server
returns the values. The promise will resolve into all records of this type
present in the store, even if the server only returns a subset of them.
@method find
@param {String} modelName
@param {(Object|String|Integer|null)} id
@param {Object} options
@return {Promise} promise
*/
find: function (modelName, id, preload) {
if (arguments.length === 1) {
return this.findAll(modelName);
}
// We are passed a query instead of an id.
if (Ember.typeOf(id) === 'object') {
return this.query(modelName, id);
}
var options = ember$data$lib$system$store$$deprecatePreload(preload, this.modelFor(modelName), 'find');
return this.findRecord(modelName, ember$data$lib$system$coerce$id$$default(id), options);
},
/**
This method returns a fresh record for a given type and id combination.
@method fetchById
@deprecated Use [findRecord](#method_findRecord) instead
@param {String} modelName
@param {(String|Integer)} id
@param {Object} options
@return {Promise} promise
*/
fetchById: function (modelName, id, preload) {
var options = ember$data$lib$system$store$$deprecatePreload(preload, this.modelFor(modelName), 'fetchById');
if (this.hasRecordForId(modelName, id)) {
return this.peekRecord(modelName, id).reload();
} else {
return this.findRecord(modelName, id, options);
}
},
/**
This method returns a fresh collection from the server, regardless of if there is already records
in the store or not.
@method fetchAll
@deprecated Use [findAll](#method_findAll) instead
@param {String} modelName
@return {Promise} promise
*/
fetchAll: function (modelName) {
return this.findAll(modelName, { reload: true });
},
/**
@method fetch
@param {String} modelName
@param {(String|Integer)} id
@param {Object} preload - optional set of attributes and relationships passed in either as IDs or as actual models
@return {Promise} promise
@deprecated Use [findRecord](#method_findRecord) instead
*/
fetch: function (modelName, id, preload) {
return this.findRecord(modelName, id, { reload: true, preload: preload });
},
/**
This method returns a record for a given type and id combination.
@method findById
@private
@param {String} modelName
@param {(String|Integer)} id
@param {Object} options
@return {Promise} promise
*/
findById: function (modelName, id, preload) {
var options = ember$data$lib$system$store$$deprecatePreload(preload, this.modelFor(modelName), 'findById');
return this.findRecord(modelName, id, options);
},
/**
This method returns a record for a given type and id combination.
The `findRecord` method will always return a **promise** that will be
resolved with the record. If the record was already in the store,
the promise will be resolved immediately. Otherwise, the store
will ask the adapter's `find` method to find the necessary data.
The `findRecord` method will always resolve its promise with the same
object for a given type and `id`.
Example
```app/routes/post.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.findRecord('post', params.post_id);
}
});
```
If you would like to force the record to reload, instead of
loading it from the cache when present you can set `reload: true`
in the options object for `findRecord`.
```app/routes/post/edit.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.findRecord('post', params.post_id, { reload: true });
}
});
```
@method findRecord
@param {String} modelName
@param {(String|Integer)} id
@param {Object} options
@return {Promise} promise
*/
findRecord: function (modelName, id, options) {
var internalModel = this._internalModelForId(modelName, id);
options = options || {};
if (!this.hasRecordForId(modelName, id)) {
return this._findByInternalModel(internalModel, options);
}
var fetchedInternalModel = this._findRecord(internalModel, options);
return ember$data$lib$system$store$$promiseRecord(fetchedInternalModel, "DS: Store#findRecord " + internalModel.typeKey + " with id: " + ember$data$lib$system$store$$get(internalModel, 'id'));
},
_findRecord: function (internalModel, options) {
// Refetch if the reload option is passed
if (options.reload) {
return this.scheduleFetch(internalModel, options);
}
// Refetch the record if the adapter thinks the record is stale
var snapshot = internalModel.createSnapshot();
snapshot.adapterOptions = options && options.adapterOptions;
var typeClass = internalModel.type;
var adapter = this.adapterFor(typeClass.modelName);
if (adapter.shouldReloadRecord(this, snapshot)) {
return this.scheduleFetch(internalModel, options);
}
// Trigger the background refetch if all the previous checks fail
if (adapter.shouldBackgroundReloadRecord(this, snapshot)) {
this.scheduleFetch(internalModel, options);
}
// Return the cached record
return ember$data$lib$system$store$$Promise.resolve(internalModel);
},
_findByInternalModel: function (internalModel, options) {
options = options || {};
if (options.preload) {
internalModel._preloadData(options.preload);
}
var fetchedInternalModel = this._findEmptyInternalModel(internalModel, options);
return ember$data$lib$system$store$$promiseRecord(fetchedInternalModel, "DS: Store#findRecord " + internalModel.typeKey + " with id: " + ember$data$lib$system$store$$get(internalModel, 'id'));
},
_findEmptyInternalModel: function (internalModel, options) {
if (internalModel.isEmpty()) {
return this.scheduleFetch(internalModel, options);
}
//TODO double check about reloading
if (internalModel.isLoading()) {
return internalModel._loadingPromise;
}
return ember$data$lib$system$store$$Promise.resolve(internalModel);
},
/**
This method makes a series of requests to the adapter's `find` method
and returns a promise that resolves once they are all loaded.
@private
@method findByIds
@param {String} modelName
@param {Array} ids
@return {Promise} promise
*/
findByIds: function (modelName, ids) {
var store = this;
return ember$data$lib$system$promise$proxies$$promiseArray(Ember.RSVP.all(ember$data$lib$system$store$$map.call(ids, function (id) {
return store.findRecord(modelName, id);
})).then(Ember.A, null, "DS: Store#findByIds of " + modelName + " complete"));
},
/**
This method is called by `findRecord` if it discovers that a particular
type/id pair hasn't been loaded yet to kick off a request to the
adapter.
@method fetchRecord
@private
@param {InternalModel} internalModel model
@return {Promise} promise
*/
// TODO rename this to have an underscore
fetchRecord: function (internalModel, options) {
var typeClass = internalModel.type;
var id = internalModel.id;
var adapter = this.adapterFor(typeClass.modelName);
var promise = ember$data$lib$system$store$finders$$_find(adapter, this, typeClass, id, internalModel, options);
return promise;
},
scheduleFetchMany: function (records) {
var internalModels = ember$data$lib$system$store$$map.call(records, function (record) {
return record._internalModel;
});
return ember$data$lib$system$store$$Promise.all(ember$data$lib$system$store$$map.call(internalModels, this.scheduleFetch, this));
},
scheduleFetch: function (internalModel, options) {
var typeClass = internalModel.type;
if (internalModel._loadingPromise) {
return internalModel._loadingPromise;
}
var resolver = Ember.RSVP.defer('Fetching ' + typeClass + 'with id: ' + internalModel.id);
var pendingFetchItem = {
record: internalModel,
resolver: resolver,
options: options
};
var promise = resolver.promise;
internalModel.loadingData(promise);
if (!this._pendingFetch.get(typeClass)) {
this._pendingFetch.set(typeClass, [pendingFetchItem]);
} else {
this._pendingFetch.get(typeClass).push(pendingFetchItem);
}
Ember.run.scheduleOnce('afterRender', this, this.flushAllPendingFetches);
return promise;
},
flushAllPendingFetches: function () {
if (this.isDestroyed || this.isDestroying) {
return;
}
this._pendingFetch.forEach(this._flushPendingFetchForType, this);
this._pendingFetch = ember$data$lib$system$map$$Map.create();
},
_flushPendingFetchForType: function (pendingFetchItems, typeClass) {
var store = this;
var adapter = store.adapterFor(typeClass.modelName);
var shouldCoalesce = !!adapter.findMany && adapter.coalesceFindRequests;
var records = Ember.A(pendingFetchItems).mapBy('record');
function _fetchRecord(recordResolverPair) {
recordResolverPair.resolver.resolve(store.fetchRecord(recordResolverPair.record, recordResolverPair.options)); // TODO adapter options
}
function resolveFoundRecords(records) {
ember$data$lib$system$store$$forEach.call(records, function (record) {
var pair = Ember.A(pendingFetchItems).findBy('record', record);
if (pair) {
var resolver = pair.resolver;
resolver.resolve(record);
}
});
return records;
}
function makeMissingRecordsRejector(requestedRecords) {
return function rejectMissingRecords(resolvedRecords) {
resolvedRecords = Ember.A(resolvedRecords);
var missingRecords = requestedRecords.reject(function (record) {
return resolvedRecords.contains(record);
});
if (missingRecords.length) {
}
rejectRecords(missingRecords);
};
}
function makeRecordsRejector(records) {
return function (error) {
rejectRecords(records, error);
};
}
function rejectRecords(records, error) {
ember$data$lib$system$store$$forEach.call(records, function (record) {
var pair = Ember.A(pendingFetchItems).findBy('record', record);
if (pair) {
var resolver = pair.resolver;
resolver.reject(error);
}
});
}
if (pendingFetchItems.length === 1) {
_fetchRecord(pendingFetchItems[0]);
} else if (shouldCoalesce) {
// TODO: Improve records => snapshots => records => snapshots
//
// We want to provide records to all store methods and snapshots to all
// adapter methods. To make sure we're doing that we're providing an array
// of snapshots to adapter.groupRecordsForFindMany(), which in turn will
// return grouped snapshots instead of grouped records.
//
// But since the _findMany() finder is a store method we need to get the
// records from the grouped snapshots even though the _findMany() finder
// will once again convert the records to snapshots for adapter.findMany()
var snapshots = Ember.A(records).invoke('createSnapshot');
var groups = adapter.groupRecordsForFindMany(this, snapshots);
ember$data$lib$system$store$$forEach.call(groups, function (groupOfSnapshots) {
var groupOfRecords = Ember.A(groupOfSnapshots).mapBy('_internalModel');
var requestedRecords = Ember.A(groupOfRecords);
var ids = requestedRecords.mapBy('id');
if (ids.length > 1) {
ember$data$lib$system$store$finders$$_findMany(adapter, store, typeClass, ids, requestedRecords).then(resolveFoundRecords).then(makeMissingRecordsRejector(requestedRecords)).then(null, makeRecordsRejector(requestedRecords));
} else if (ids.length === 1) {
var pair = Ember.A(pendingFetchItems).findBy('record', groupOfRecords[0]);
_fetchRecord(pair);
} else {
}
});
} else {
ember$data$lib$system$store$$forEach.call(pendingFetchItems, _fetchRecord);
}
},
/**
Get a record by a given type and ID without triggering a fetch.
This method will synchronously return the record if it is available in the store,
otherwise it will return `null`. A record is available if it has been fetched earlier, or
pushed manually into the store.
_Note: This is an synchronous method and does not return a promise._
```js
var post = store.getById('post', 1);
post.get('id'); // 1
```
@method getById
@param {String} modelName
@param {String|Integer} id
@return {DS.Model|null} record
*/
getById: function (modelName, id) {
return this.peekRecord(modelName, id);
},
/**
Get a record by a given type and ID without triggering a fetch.
This method will synchronously return the record if it is available in the store,
otherwise it will return `null`. A record is available if it has been fetched earlier, or
pushed manually into the store.
_Note: This is an synchronous method and does not return a promise._
```js
var post = store.peekRecord('post', 1);
post.get('id'); // 1
```
@method peekRecord
@param {String} modelName
@param {String|Integer} id
@return {DS.Model|null} record
*/
peekRecord: function (modelName, id) {
if (this.hasRecordForId(modelName, id)) {
return this._internalModelForId(modelName, id).getRecord();
} else {
return null;
}
},
/**
This method is called by the record's `reload` method.
This method calls the adapter's `find` method, which returns a promise. When
**that** promise resolves, `reloadRecord` will resolve the promise returned
by the record's `reload`.
@method reloadRecord
@private
@param {DS.Model} internalModel
@return {Promise} promise
*/
reloadRecord: function (internalModel) {
var modelName = internalModel.type.modelName;
var adapter = this.adapterFor(modelName);
var id = internalModel.id;
return this.scheduleFetch(internalModel);
},
/**
Returns true if a record for a given type and ID is already loaded.
@method hasRecordForId
@param {(String|DS.Model)} modelName
@param {(String|Integer)} inputId
@return {Boolean}
*/
hasRecordForId: function (modelName, inputId) {
var typeClass = this.modelFor(modelName);
var id = ember$data$lib$system$coerce$id$$default(inputId);
var internalModel = this.typeMapFor(typeClass).idToRecord[id];
return !!internalModel && internalModel.isLoaded();
},
/**
Returns id record for a given type and ID. If one isn't already loaded,
it builds a new record and leaves it in the `empty` state.
@method recordForId
@private
@param {String} modelName
@param {(String|Integer)} id
@return {DS.Model} record
*/
recordForId: function (modelName, id) {
return this._internalModelForId(modelName, id).getRecord();
},
_internalModelForId: function (typeName, inputId) {
var typeClass = this.modelFor(typeName);
var id = ember$data$lib$system$coerce$id$$default(inputId);
var idToRecord = this.typeMapFor(typeClass).idToRecord;
var record = idToRecord[id];
if (!record || !idToRecord[id]) {
record = this.buildInternalModel(typeClass, id);
}
return record;
},
/**
@method findMany
@private
@param {Array} internalModels
@return {Promise} promise
*/
findMany: function (internalModels) {
var store = this;
return ember$data$lib$system$store$$Promise.all(ember$data$lib$system$store$$map.call(internalModels, function (internalModel) {
return store._findByInternalModel(internalModel);
}));
},
/**
If a relationship was originally populated by the adapter as a link
(as opposed to a list of IDs), this method is called when the
relationship is fetched.
The link (which is usually a URL) is passed through unchanged, so the
adapter can make whatever request it wants.
The usual use-case is for the server to register a URL as a link, and
then use that URL in the future to make a request for the relationship.
@method findHasMany
@private
@param {DS.Model} owner
@param {any} link
@param {(Relationship)} relationship
@return {Promise} promise
*/
findHasMany: function (owner, link, relationship) {
var adapter = this.adapterFor(owner.type.modelName);
return ember$data$lib$system$store$finders$$_findHasMany(adapter, this, owner, link, relationship);
},
/**
@method findBelongsTo
@private
@param {DS.Model} owner
@param {any} link
@param {Relationship} relationship
@return {Promise} promise
*/
findBelongsTo: function (owner, link, relationship) {
var adapter = this.adapterFor(owner.type.modelName);
return ember$data$lib$system$store$finders$$_findBelongsTo(adapter, this, owner, link, relationship);
},
/**
This method delegates a query to the adapter. This is the one place where
adapter-level semantics are exposed to the application.
Exposing queries this way seems preferable to creating an abstract query
language for all server-side queries, and then require all adapters to
implement them.
---
If you do something like this:
```javascript
store.query('person', { page: 1 });
```
The call made to the server, using a Rails backend, will look something like this:
```
Started GET "/api/v1/person?page=1"
Processing by Api::V1::PersonsController#index as HTML
Parameters: { "page"=>"1" }
```
---
If you do something like this:
```javascript
store.query('person', { ids: [1, 2, 3] });
```
The call to the server, using a Rails backend, will look something like this:
```
Started GET "/api/v1/person?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3"
Processing by Api::V1::PersonsController#index as HTML
Parameters: { "ids" => ["1", "2", "3"] }
```
This method returns a promise, which is resolved with a `RecordArray`
once the server returns.
@method query
@param {String} modelName
@param {any} query an opaque query to be used by the adapter
@return {Promise} promise
*/
query: function (modelName, query) {
var typeClass = this.modelFor(modelName);
var array = this.recordArrayManager.createAdapterPopulatedRecordArray(typeClass, query);
var adapter = this.adapterFor(modelName);
return ember$data$lib$system$promise$proxies$$promiseArray(ember$data$lib$system$store$finders$$_query(adapter, this, typeClass, query, array));
},
/**
This method delegates a query to the adapter. This is the one place where
adapter-level semantics are exposed to the application.
Exposing queries this way seems preferable to creating an abstract query
language for all server-side queries, and then require all adapters to
implement them.
This method returns a promise, which is resolved with a `RecordObject`
once the server returns.
@method queryRecord
@param {String or subclass of DS.Model} type
@param {any} query an opaque query to be used by the adapter
@return {Promise} promise
*/
queryRecord: function (modelName, query) {
var typeClass = this.modelFor(modelName);
var adapter = this.adapterFor(modelName);
return ember$data$lib$system$promise$proxies$$promiseObject(ember$data$lib$system$store$finders$$_queryRecord(adapter, this, typeClass, query));
},
/**
This method delegates a query to the adapter. This is the one place where
adapter-level semantics are exposed to the application.
Exposing queries this way seems preferable to creating an abstract query
language for all server-side queries, and then require all adapters to
implement them.
This method returns a promise, which is resolved with a `RecordArray`
once the server returns.
@method findQuery
@param {String} modelName
@param {any} query an opaque query to be used by the adapter
@return {Promise} promise
@deprecated Use `store.query instead`
*/
findQuery: function (modelName, query) {
return this.query(modelName, query);
},
/**
`findAll` ask the adapter's `findAll` method to find the records
for the given type, and return a promise that will be resolved
once the server returns the values. The promise will resolve into
all records of this type present in the store, even if the server
only returns a subset of them.
```app/routes/authors.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.findAll('author');
}
});
```
@method findAll
@param {String} modelName
@param {Object} options
@return {DS.AdapterPopulatedRecordArray}
*/
findAll: function (modelName, options) {
var typeClass = this.modelFor(modelName);
return this._fetchAll(typeClass, this.peekAll(modelName), options);
},
/**
@method _fetchAll
@private
@param {DS.Model} typeClass
@param {DS.RecordArray} array
@return {Promise} promise
*/
_fetchAll: function (typeClass, array, options) {
options = options || {};
var adapter = this.adapterFor(typeClass.modelName);
var sinceToken = this.typeMapFor(typeClass).metadata.since;
ember$data$lib$system$store$$set(array, 'isUpdating', true);
if (options.reload) {
return ember$data$lib$system$promise$proxies$$promiseArray(ember$data$lib$system$store$finders$$_findAll(adapter, this, typeClass, sinceToken, options));
}
var snapshotArray = array.createSnapshot(options);
if (adapter.shouldReloadAll(this, snapshotArray)) {
return ember$data$lib$system$promise$proxies$$promiseArray(ember$data$lib$system$store$finders$$_findAll(adapter, this, typeClass, sinceToken, options));
}
if (adapter.shouldBackgroundReloadAll(this, snapshotArray)) {
ember$data$lib$system$promise$proxies$$promiseArray(ember$data$lib$system$store$finders$$_findAll(adapter, this, typeClass, sinceToken, options));
}
return ember$data$lib$system$promise$proxies$$promiseArray(ember$data$lib$system$store$$Promise.resolve(array));
},
/**
@method didUpdateAll
@param {DS.Model} typeClass
@private
*/
didUpdateAll: function (typeClass) {
var liveRecordArray = this.recordArrayManager.liveRecordArrayFor(typeClass);
ember$data$lib$system$store$$set(liveRecordArray, 'isUpdating', false);
},
/**
This method returns a filtered array that contains all of the
known records for a given type in the store.
Note that because it's just a filter, the result will contain any
locally created records of the type, however, it will not make a
request to the backend to retrieve additional records. If you
would like to request all the records from the backend please use
[store.find](#method_find).
Also note that multiple calls to `all` for a given type will always
return the same `RecordArray`.
Example
```javascript
var localPosts = store.all('post');
```
@method all
@param {String} modelName
@return {DS.RecordArray}
*/
all: function (modelName) {
return this.peekAll(modelName);
},
/**
This method returns a filtered array that contains all of the
known records for a given type in the store.
Note that because it's just a filter, the result will contain any
locally created records of the type, however, it will not make a
request to the backend to retrieve additional records. If you
would like to request all the records from the backend please use
[store.find](#method_find).
Also note that multiple calls to `peekAll` for a given type will always
return the same `RecordArray`.
Example
```javascript
var localPosts = store.peekAll('post');
```
@method peekAll
@param {String} modelName
@return {DS.RecordArray}
*/
peekAll: function (modelName) {
var typeClass = this.modelFor(modelName);
var liveRecordArray = this.recordArrayManager.liveRecordArrayFor(typeClass);
this.recordArrayManager.populateLiveRecordArray(liveRecordArray, typeClass);
return liveRecordArray;
},
/**
This method unloads all records in the store.
Optionally you can pass a type which unload all records for a given type.
```javascript
store.unloadAll();
store.unloadAll('post');
```
@method unloadAll
@param {String=} modelName
*/
unloadAll: function (modelName) {
if (arguments.length === 0) {
var typeMaps = this.typeMaps;
var keys = ember$data$lib$system$object$polyfills$$keysFunc(typeMaps);
var types = ember$data$lib$system$store$$map.call(keys, byType);
ember$data$lib$system$store$$forEach.call(types, this.unloadAll, this);
} else {
var typeClass = this.modelFor(modelName);
var typeMap = this.typeMapFor(typeClass);
var records = typeMap.records.slice();
var record;
for (var i = 0; i < records.length; i++) {
record = records[i];
record.unloadRecord();
record.destroy(); // maybe within unloadRecord
}
typeMap.metadata = new ember$data$lib$system$empty$object$$default();
}
function byType(entry) {
return typeMaps[entry]['type'].modelName;
}
},
/**
Takes a type and filter function, and returns a live RecordArray that
remains up to date as new records are loaded into the store or created
locally.
The filter function takes a materialized record, and returns true
if the record should be included in the filter and false if it should
not.
Example
```javascript
store.filter('post', function(post) {
return post.get('unread');
});
```
The filter function is called once on all records for the type when
it is created, and then once on each newly loaded or created record.
If any of a record's properties change, or if it changes state, the
filter function will be invoked again to determine whether it should
still be in the array.
Optionally you can pass a query, which is the equivalent of calling
[find](#method_find) with that same query, to fetch additional records
from the server. The results returned by the server could then appear
in the filter if they match the filter function.
The query itself is not used to filter records, it's only sent to your
server for you to be able to do server-side filtering. The filter
function will be applied on the returned results regardless.
Example
```javascript
store.filter('post', { unread: true }, function(post) {
return post.get('unread');
}).then(function(unreadPosts) {
unreadPosts.get('length'); // 5
var unreadPost = unreadPosts.objectAt(0);
unreadPost.set('unread', false);
unreadPosts.get('length'); // 4
});
```
@method filter
@param {String} modelName
@param {Object} query optional query
@param {Function} filter
@return {DS.PromiseArray}
*/
filter: function (modelName, query, filter) {
if (!Ember.ENV.ENABLE_DS_FILTER) {
}
var promise;
var length = arguments.length;
var array;
var hasQuery = length === 3;
// allow an optional server query
if (hasQuery) {
promise = this.query(modelName, query);
} else if (arguments.length === 2) {
filter = query;
}
modelName = this.modelFor(modelName);
if (hasQuery) {
array = this.recordArrayManager.createFilteredRecordArray(modelName, filter, query);
} else {
array = this.recordArrayManager.createFilteredRecordArray(modelName, filter);
}
promise = promise || ember$data$lib$system$store$$Promise.cast(array);
return ember$data$lib$system$promise$proxies$$promiseArray(promise.then(function () {
return array;
}, null, "DS: Store#filter of " + modelName));
},
/**
This method returns if a certain record is already loaded
in the store. Use this function to know beforehand if a find()
will result in a request or that it will be a cache hit.
Example
```javascript
store.recordIsLoaded('post', 1); // false
store.find('post', 1).then(function() {
store.recordIsLoaded('post', 1); // true
});
```
@method recordIsLoaded
@param {String} modelName
@param {string} id
@return {boolean}
*/
recordIsLoaded: function (modelName, id) {
return this.hasRecordForId(modelName, id);
},
/**
This method returns the metadata for a specific type.
@method metadataFor
@param {String} modelName
@return {object}
@deprecated
*/
metadataFor: function (modelName) {
return this._metadataFor(modelName);
},
/**
@method _metadataFor
@param {String} modelName
@return {object}
@private
*/
_metadataFor: function (modelName) {
var typeClass = this.modelFor(modelName);
return this.typeMapFor(typeClass).metadata;
},
/**
This method sets the metadata for a specific type.
@method setMetadataFor
@param {String} modelName
@param {Object} metadata metadata to set
@return {object}
@deprecated
*/
setMetadataFor: function (modelName, metadata) {
this._setMetadataFor(modelName, metadata);
},
/**
@method _setMetadataFor
@param {String} modelName
@param {Object} metadata metadata to set
@private
*/
_setMetadataFor: function (modelName, metadata) {
var typeClass = this.modelFor(modelName);
Ember.merge(this.typeMapFor(typeClass).metadata, metadata);
},
// ............
// . UPDATING .
// ............
/**
If the adapter updates attributes the record will notify
the store to update its membership in any filters.
To avoid thrashing, this method is invoked only once per
run loop per record.
@method dataWasUpdated
@private
@param {Class} type
@param {InternalModel} internalModel
*/
dataWasUpdated: function (type, internalModel) {
this.recordArrayManager.recordDidChange(internalModel);
},
// ..............
// . PERSISTING .
// ..............
/**
This method is called by `record.save`, and gets passed a
resolver for the promise that `record.save` returns.
It schedules saving to happen at the end of the run loop.
@method scheduleSave
@private
@param {InternalModel} internalModel
@param {Resolver} resolver
@param {Object} options
*/
scheduleSave: function (internalModel, resolver, options) {
var snapshot = internalModel.createSnapshot(options);
internalModel.flushChangedAttributes();
internalModel.adapterWillCommit();
this._pendingSave.push({
snapshot: snapshot,
resolver: resolver
});
ember$data$lib$system$store$$once(this, 'flushPendingSave');
},
/**
This method is called at the end of the run loop, and
flushes any records passed into `scheduleSave`
@method flushPendingSave
@private
*/
flushPendingSave: function () {
var pending = this._pendingSave.slice();
this._pendingSave = [];
ember$data$lib$system$store$$forEach.call(pending, function (pendingItem) {
var snapshot = pendingItem.snapshot;
var resolver = pendingItem.resolver;
var record = snapshot._internalModel;
var adapter = this.adapterFor(record.type.modelName);
var operation;
if (ember$data$lib$system$store$$get(record, 'currentState.stateName') === 'root.deleted.saved') {
return resolver.resolve();
} else if (record.isNew()) {
operation = 'createRecord';
} else if (record.isDeleted()) {
operation = 'deleteRecord';
} else {
operation = 'updateRecord';
}
resolver.resolve(ember$data$lib$system$store$$_commit(adapter, this, operation, snapshot));
}, this);
},
/**
This method is called once the promise returned by an
adapter's `createRecord`, `updateRecord` or `deleteRecord`
is resolved.
If the data provides a server-generated ID, it will
update the record and the store's indexes.
@method didSaveRecord
@private
@param {InternalModel} internalModel the in-flight internal model
@param {Object} data optional data (see above)
*/
didSaveRecord: function (internalModel, dataArg) {
var data;
if (dataArg) {
data = dataArg.data;
}
if (data) {
// normalize relationship IDs into records
this._backburner.schedule('normalizeRelationships', this, '_setupRelationships', internalModel, internalModel.type, data);
this.updateId(internalModel, data);
}
//We first make sure the primary data has been updated
//TODO try to move notification to the user to the end of the runloop
internalModel.adapterDidCommit(data);
},
/**
This method is called once the promise returned by an
adapter's `createRecord`, `updateRecord` or `deleteRecord`
is rejected with a `DS.InvalidError`.
@method recordWasInvalid
@private
@param {InternalModel} internalModel
@param {Object} errors
*/
recordWasInvalid: function (internalModel, errors) {
internalModel.adapterDidInvalidate(errors);
},
/**
This method is called once the promise returned by an
adapter's `createRecord`, `updateRecord` or `deleteRecord`
is rejected (with anything other than a `DS.InvalidError`).
@method recordWasError
@private
@param {InternalModel} internalModel
@param {Error} error
*/
recordWasError: function (internalModel, error) {
internalModel.adapterDidError(error);
},
/**
When an adapter's `createRecord`, `updateRecord` or `deleteRecord`
resolves with data, this method extracts the ID from the supplied
data.
@method updateId
@private
@param {InternalModel} internalModel
@param {Object} data
*/
updateId: function (internalModel, data) {
var oldId = internalModel.id;
var id = ember$data$lib$system$coerce$id$$default(data.id);
this.typeMapFor(internalModel.type).idToRecord[id] = internalModel;
internalModel.setId(id);
},
/**
Returns a map of IDs to client IDs for a given type.
@method typeMapFor
@private
@param {DS.Model} typeClass
@return {Object} typeMap
*/
typeMapFor: function (typeClass) {
var typeMaps = ember$data$lib$system$store$$get(this, 'typeMaps');
var guid = Ember.guidFor(typeClass);
var typeMap = typeMaps[guid];
if (typeMap) {
return typeMap;
}
typeMap = {
idToRecord: new ember$data$lib$system$empty$object$$default(),
records: [],
metadata: new ember$data$lib$system$empty$object$$default(),
type: typeClass
};
typeMaps[guid] = typeMap;
return typeMap;
},
// ................
// . LOADING DATA .
// ................
/**
This internal method is used by `push`.
@method _load
@private
@param {(String|DS.Model)} type
@param {Object} data
*/
_load: function (data) {
var id = ember$data$lib$system$coerce$id$$default(data.id);
var internalModel = this._internalModelForId(data.type, id);
internalModel.setupData(data);
this.recordArrayManager.recordDidChange(internalModel);
return internalModel;
},
/*
In case someone defined a relationship to a mixin, for example:
```
var Comment = DS.Model.extend({
owner: belongsTo('commentable'. { polymorphic: true})
});
var Commentable = Ember.Mixin.create({
comments: hasMany('comment')
});
```
we want to look up a Commentable class which has all the necessary
relationship metadata. Thus, we look up the mixin and create a mock
DS.Model, so we can access the relationship CPs of the mixin (`comments`)
in this case
*/
_modelForMixin: function (modelName) {
var normalizedModelName = ember$data$lib$system$normalize$model$name$$default(modelName);
var registry = this.container._registry ? this.container._registry : this.container;
var mixin = registry.resolve('mixin:' + normalizedModelName);
if (mixin) {
//Cache the class as a model
registry.register('model:' + normalizedModelName, DS.Model.extend(mixin));
}
var factory = this.modelFactoryFor(normalizedModelName);
if (factory) {
factory.__isMixin = true;
factory.__mixin = mixin;
}
return factory;
},
/**
Returns a model class for a particular key. Used by
methods that take a type key (like `find`, `createRecord`,
etc.)
@method modelFor
@param {String} modelName
@return {DS.Model}
*/
modelFor: function (modelName) {
var factory = this.modelFactoryFor(modelName);
if (!factory) {
//Support looking up mixins as base types for polymorphic relationships
factory = this._modelForMixin(modelName);
}
if (!factory) {
throw new Ember.Error("No model was found for '" + modelName + "'");
}
factory.modelName = factory.modelName || ember$data$lib$system$normalize$model$name$$default(modelName);
// deprecate typeKey
if (!('typeKey' in factory)) {
Ember.defineProperty(factory, 'typeKey', {
enumerable: true,
configurable: false,
get: function () {
var typeKey = this.modelName;
if (typeKey) {
typeKey = Ember.String.camelize(this.modelName);
}
return typeKey;
},
set: function () {
}
});
}
return factory;
},
modelFactoryFor: function (modelName) {
var normalizedKey = ember$data$lib$system$normalize$model$name$$default(modelName);
return this.container.lookupFactory('model:' + normalizedKey);
},
/**
Push some data for a given type into the store.
This method expects normalized data:
* The ID is a key named `id` (an ID is mandatory)
* The names of attributes are the ones you used in
your model's `DS.attr`s.
* Your relationships must be:
* represented as IDs or Arrays of IDs
* represented as model instances
* represented as URLs, under the `links` key
For this model:
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: DS.attr(),
lastName: DS.attr(),
children: DS.hasMany('person')
});
```
To represent the children as IDs:
```js
{
id: 1,
firstName: "Tom",
lastName: "Dale",
children: [1, 2, 3]
}
```
To represent the children relationship as a URL:
```js
{
id: 1,
firstName: "Tom",
lastName: "Dale",
links: {
children: "/people/1/children"
}
}
```
If you're streaming data or implementing an adapter, make sure
that you have converted the incoming data into this form. The
store's [normalize](#method_normalize) method is a convenience
helper for converting a json payload into the form Ember Data
expects.
```js
store.push('person', store.normalize('person', data));
```
This method can be used both to push in brand new
records, as well as to update existing records.
@method push
@param {String} modelName
@param {Object} data
@return {DS.Model|Array} the record(s) that was created or
updated.
*/
push: function (modelNameArg, dataArg) {
var _this = this;
var data, modelName;
if (Ember.typeOf(modelNameArg) === 'object' && Ember.typeOf(dataArg) === 'undefined') {
data = modelNameArg;
} else {
data = ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayload(this.modelFor(modelNameArg), dataArg);
modelName = modelNameArg;
}
if (data.included) {
ember$data$lib$system$store$$forEach.call(data.included, function (recordData) {
return _this._pushInternalModel(recordData);
});
}
if (Ember.typeOf(data.data) === 'array') {
var internalModels = ember$data$lib$system$store$$map.call(data.data, function (recordData) {
return _this._pushInternalModel(recordData);
});
return ember$data$lib$system$store$$map.call(internalModels, function (internalModel) {
return internalModel.getRecord();
});
}
var internalModel = this._pushInternalModel(data.data || data);
return internalModel.getRecord();
},
_hasModelFor: function (type) {
return this.container.lookupFactory("model:" + type);
},
_pushInternalModel: function (data) {
var modelName = data.type;
var type = this.modelFor(modelName);
// If Ember.ENV.DS_WARN_ON_UNKNOWN_KEYS is set to true and the payload
// contains unknown keys, log a warning.
if (Ember.ENV.DS_WARN_ON_UNKNOWN_KEYS) {
}
// Actually load the record into the store.
var internalModel = this._load(data);
var store = this;
this._backburner.join(function () {
store._backburner.schedule('normalizeRelationships', store, '_setupRelationships', internalModel, type, data);
});
return internalModel;
},
_setupRelationships: function (record, type, data) {
// If the payload contains relationships that are specified as
// IDs, normalizeRelationships will convert them into DS.Model instances
// (possibly unloaded) before we push the payload into the
// store.
data = ember$data$lib$system$store$$normalizeRelationships(this, type, data);
// Now that the pushed record as well as any related records
// are in the store, create the data structures used to track
// relationships.
ember$data$lib$system$store$$setupRelationships(this, record, data);
},
/**
Push some raw data into the store.
This method can be used both to push in brand new
records, as well as to update existing records. You
can push in more than one type of object at once.
All objects should be in the format expected by the
serializer.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.ActiveModelSerializer;
```
```js
var pushData = {
posts: [
{ id: 1, post_title: "Great post", comment_ids: [2] }
],
comments: [
{ id: 2, comment_body: "Insightful comment" }
]
}
store.pushPayload(pushData);
```
By default, the data will be deserialized using a default
serializer (the application serializer if it exists).
Alternatively, `pushPayload` will accept a model type which
will determine which serializer will process the payload.
However, the serializer itself (processing this data via
`normalizePayload`) will not know which model it is
deserializing.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.ActiveModelSerializer;
```
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer;
```
```js
store.pushPayload('comment', pushData); // Will use the application serializer
store.pushPayload('post', pushData); // Will use the post serializer
```
@method pushPayload
@param {String} modelName Optionally, a model type used to determine which serializer will be used
@param {Object} inputPayload
*/
pushPayload: function (modelName, inputPayload) {
var serializer;
var payload;
if (!inputPayload) {
payload = modelName;
serializer = ember$data$lib$system$store$$defaultSerializer(this);
} else {
payload = inputPayload;
serializer = this.serializerFor(modelName);
}
var store = this;
this._adapterRun(function () {
serializer.pushPayload(store, payload);
});
},
/**
`normalize` converts a json payload into the normalized form that
[push](#method_push) expects.
Example
```js
socket.on('message', function(message) {
var modelName = message.model;
var data = message.data;
store.push(modelName, store.normalize(modelName, data));
});
```
@method normalize
@param {String} modelName The name of the model type for this payload
@param {Object} payload
@return {Object} The normalized payload
*/
normalize: function (modelName, payload) {
var serializer = this.serializerFor(modelName);
var model = this.modelFor(modelName);
return serializer.normalize(model, payload);
},
/**
@method update
@param {String} modelName
@param {Object} data
@return {DS.Model} the record that was updated.
@deprecated Use [push](#method_push) instead
*/
update: function (modelName, data) {
return this.push(modelName, data);
},
/**
If you have an Array of normalized data to push,
you can call `pushMany` with the Array, and it will
call `push` repeatedly for you.
@method pushMany
@param {String} modelName
@param {Array} datas
@return {Array}
*/
pushMany: function (modelName, datas) {
var length = datas.length;
var result = new Array(length);
for (var i = 0; i < length; i++) {
result[i] = this.push(modelName, datas[i]);
}
return result;
},
/**
@method metaForType
@param {String} modelName
@param {Object} metadata
@deprecated Use [setMetadataFor](#method_setMetadataFor) instead
*/
metaForType: function (modelName, metadata) {
this.setMetadataFor(modelName, metadata);
},
/**
Build a brand new record for a given type, ID, and
initial data.
@method buildRecord
@private
@param {DS.Model} type
@param {String} id
@param {Object} data
@return {InternalModel} internal model
*/
buildInternalModel: function (type, id, data) {
var typeMap = this.typeMapFor(type);
var idToRecord = typeMap.idToRecord;
// lookupFactory should really return an object that creates
// instances with the injections applied
var internalModel = new ember$data$lib$system$model$internal$model$$default(type, id, this, this.container, data);
// if we're creating an item, this process will be done
// later, once the object has been persisted.
if (id) {
idToRecord[id] = internalModel;
}
typeMap.records.push(internalModel);
return internalModel;
},
//Called by the state machine to notify the store that the record is ready to be interacted with
recordWasLoaded: function (record) {
this.recordArrayManager.recordWasLoaded(record);
},
// ...............
// . DESTRUCTION .
// ...............
/**
@method dematerializeRecord
@private
@param {DS.Model} record
@deprecated Use [unloadRecord](#method_unloadRecord) instead
*/
dematerializeRecord: function (record) {
this._dematerializeRecord(record);
},
/**
When a record is destroyed, this un-indexes it and
removes it from any record arrays so it can be GCed.
@method _dematerializeRecord
@private
@param {InternalModel} internalModel
*/
_dematerializeRecord: function (internalModel) {
var type = internalModel.type;
var typeMap = this.typeMapFor(type);
var id = internalModel.id;
internalModel.updateRecordArrays();
if (id) {
delete typeMap.idToRecord[id];
}
var loc = ember$data$lib$system$store$$indexOf.call(typeMap.records, internalModel);
typeMap.records.splice(loc, 1);
},
// ......................
// . PER-TYPE ADAPTERS
// ......................
/**
Returns an instance of the adapter for a given type. For
example, `adapterFor('person')` will return an instance of
`App.PersonAdapter`.
If no `App.PersonAdapter` is found, this method will look
for an `App.ApplicationAdapter` (the default adapter for
your entire application).
If no `App.ApplicationAdapter` is found, it will return
the value of the `defaultAdapter`.
@method adapterFor
@private
@param {String} modelName
@return DS.Adapter
*/
adapterFor: function (modelOrClass) {
var modelName;
if (typeof modelOrClass === 'string') {
modelName = modelOrClass;
} else {
modelName = modelOrClass.modelName;
}
return this.lookupAdapter(modelName);
},
_adapterRun: function (fn) {
return this._backburner.run(fn);
},
// ..............................
// . RECORD CHANGE NOTIFICATION .
// ..............................
/**
Returns an instance of the serializer for a given type. For
example, `serializerFor('person')` will return an instance of
`App.PersonSerializer`.
If no `App.PersonSerializer` is found, this method will look
for an `App.ApplicationSerializer` (the default serializer for
your entire application).
if no `App.ApplicationSerializer` is found, it will attempt
to get the `defaultSerializer` from the `PersonAdapter`
(`adapterFor('person')`).
If a serializer cannot be found on the adapter, it will fall back
to an instance of `DS.JSONSerializer`.
@method serializerFor
@private
@param {String} modelName the record to serialize
@return {DS.Serializer}
*/
serializerFor: function (modelOrClass) {
var modelName;
if (typeof modelOrClass === 'string') {
modelName = modelOrClass;
} else {
modelName = modelOrClass.modelName;
}
var fallbacks = ['application', this.adapterFor(modelName).get('defaultSerializer'), '-default'];
var serializer = this.lookupSerializer(modelName, fallbacks);
return serializer;
},
/**
Retrieve a particular instance from the
container cache. If not found, creates it and
placing it in the cache.
Enabled a store to manage local instances of
adapters and serializers.
@method retrieveManagedInstance
@private
@param {String} modelName the object modelName
@param {String} name the object name
@param {Array} fallbacks the fallback objects to lookup if the lookup for modelName or 'application' fails
@return {Ember.Object}
*/
retrieveManagedInstance: function (type, modelName, fallbacks) {
var normalizedModelName = ember$data$lib$system$normalize$model$name$$default(modelName);
var instance = this._instanceCache.get(type, normalizedModelName, fallbacks);
ember$data$lib$system$store$$set(instance, 'store', this);
return instance;
},
lookupAdapter: function (name) {
return this.retrieveManagedInstance('adapter', name, this.get('_adapterFallbacks'));
},
_adapterFallbacks: Ember.computed('adapter', function () {
var adapter = this.get('adapter');
return ['application', adapter, '-rest'];
}),
lookupSerializer: function (name, fallbacks) {
return this.retrieveManagedInstance('serializer', name, fallbacks);
},
willDestroy: function () {
this.recordArrayManager.destroy();
this.unloadAll();
for (var cacheKey in this._containerCache) {
this._containerCache[cacheKey].destroy();
delete this._containerCache[cacheKey];
}
delete this._containerCache;
}
});
function ember$data$lib$system$store$$normalizeRelationships(store, type, data, record) {
data.relationships = data.relationships || {};
type.eachRelationship(function (key, relationship) {
var kind = relationship.kind;
var value;
if (data.relationships[key] && data.relationships[key].data) {
value = data.relationships[key].data;
if (kind === 'belongsTo') {
data.relationships[key].data = ember$data$lib$system$store$$deserializeRecordId(store, key, relationship, value);
} else if (kind === 'hasMany') {
data.relationships[key].data = ember$data$lib$system$store$$deserializeRecordIds(store, key, relationship, value);
}
}
});
return data;
}
function ember$data$lib$system$store$$deserializeRecordId(store, key, relationship, id) {
if (ember$data$lib$system$store$$isNone(id)) {
return;
}
//TODO:Better asserts
return store._internalModelForId(id.type, id.id);
}
function ember$data$lib$system$store$$deserializeRecordIds(store, key, relationship, ids) {
if (ember$data$lib$system$store$$isNone(ids)) {
return;
}
return ember$data$lib$system$store$$map.call(ids, function (id) {
return ember$data$lib$system$store$$deserializeRecordId(store, key, relationship, id);
});
}
// Delegation to the adapter and promise management
function ember$data$lib$system$store$$defaultSerializer(store) {
return store.serializerFor('application');
}
function ember$data$lib$system$store$$_commit(adapter, store, operation, snapshot) {
var internalModel = snapshot._internalModel;
var modelName = snapshot.modelName;
var typeClass = store.modelFor(modelName);
var promise = adapter[operation](store, typeClass, snapshot);
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, modelName);
var label = "DS: Extract and notify about " + operation + " completion of " + internalModel;
promise = ember$data$lib$system$store$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, internalModel));
return promise.then(function (adapterPayload) {
store._adapterRun(function () {
var payload, data;
if (adapterPayload) {
payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, snapshot.id, operation);
if (payload.included) {
store.push({ data: payload.included });
}
data = ember$data$lib$system$store$serializer$response$$convertResourceObject(payload.data);
}
store.didSaveRecord(internalModel, ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayload(internalModel.type, data));
});
return internalModel;
}, function (error) {
if (error instanceof ember$data$lib$adapters$errors$$InvalidError) {
var errors = serializer.extractErrors(store, typeClass, error, snapshot.id);
store.recordWasInvalid(internalModel, errors);
} else {
store.recordWasError(internalModel, error);
}
throw error;
}, label);
}
function ember$data$lib$system$store$$setupRelationships(store, record, data) {
var typeClass = record.type;
if (!data.relationships) {
return;
}
typeClass.eachRelationship(function (key, descriptor) {
var kind = descriptor.kind;
if (!data.relationships[key]) {
return;
}
var relationship;
if (data.relationships[key].links && data.relationships[key].links.related) {
relationship = record._relationships.get(key);
relationship.updateLink(data.relationships[key].links.related);
}
if (data.relationships[key].meta) {
relationship = record._relationships.get(key);
relationship.updateMeta(data.relationships[key].meta);
}
var value = data.relationships[key].data;
if (value !== undefined) {
if (kind === 'belongsTo') {
relationship = record._relationships.get(key);
relationship.setCanonicalRecord(value);
} else if (kind === 'hasMany') {
relationship = record._relationships.get(key);
relationship.updateRecordsFromAdapter(value);
}
}
});
}
function ember$data$lib$system$store$$deprecatePreload(preloadOrOptions, type, methodName) {
if (preloadOrOptions) {
var modelProperties = [];
var fields = Ember.get(type, 'fields');
fields.forEach(function (fieldType, key) {
modelProperties.push(key);
});
var preloadDetected = false;
for (var i = 0, _length = modelProperties.length; i < _length; i++) {
var key = modelProperties[i];
if (typeof preloadOrOptions[key] !== 'undefined') {
preloadDetected = true;
break;
}
}
if (preloadDetected) {
var preload = preloadOrOptions;
return {
preload: preload
};
}
}
return preloadOrOptions;
}
var ember$data$lib$system$store$$default = ember$data$lib$system$store$$Store;
var ember$data$lib$serializers$json$api$serializer$$map = ember$data$lib$ext$ember$array$$default.map;
var ember$data$lib$serializers$json$api$serializer$$dasherize = ember$lib$main$$default.String.dasherize;
var ember$data$lib$serializers$json$api$serializer$$get = ember$lib$main$$default.get;
var ember$data$lib$serializers$json$api$serializer$$default = ember$data$lib$serializers$json$serializer$$default.extend({
/**
This is only to be used temporarily during the transition from the old
serializer API to the new one.
`JSONAPISerializer` only supports the new Serializer API.
@property isNewSerializerAPI
*/
isNewSerializerAPI: true,
/**
@method _normalizeDocumentHelper
@param {Object} documentHash
@return {Object}
@private
*/
_normalizeDocumentHelper: function (documentHash) {
if (ember$lib$main$$default.typeOf(documentHash.data) === 'object') {
documentHash.data = this._normalizeResourceHelper(documentHash.data);
} else if (ember$lib$main$$default.typeOf(documentHash.data) === 'array') {
documentHash.data = ember$data$lib$serializers$json$api$serializer$$map.call(documentHash.data, this._normalizeResourceHelper, this);
}
if (ember$lib$main$$default.typeOf(documentHash.included) === 'array') {
documentHash.included = ember$data$lib$serializers$json$api$serializer$$map.call(documentHash.included, this._normalizeResourceHelper, this);
}
return documentHash;
},
/**
@method _normalizeRelationshipDataHelper
@param {Object} relationshipDataHash
@return {Object}
@private
*/
_normalizeRelationshipDataHelper: function (relationshipDataHash) {
var type = this.modelNameFromPayloadKey(relationshipDataHash.type);
relationshipDataHash.type = type;
return relationshipDataHash;
},
/**
@method _normalizeResourceHelper
@param {Object} resourceHash
@return {Object}
@private
*/
_normalizeResourceHelper: function (resourceHash) {
var modelName = this.modelNameFromPayloadKey(resourceHash.type);
var modelClass = this.store.modelFor(modelName);
var serializer = this.store.serializerFor(modelName);
ember$lib$main$$default.assert(this.toString() + ' is using the ' + (ember$data$lib$serializers$json$api$serializer$$get(this, 'isNewSerializerAPI') ? 'new' : 'old') + ' serializer API and expects ' + serializer.toString() + ' it collaborates with to do the same. Make sure to set `isNewSerializerAPI: true` in your custom serializers if you want to use the new Serializer API.', ember$data$lib$serializers$json$api$serializer$$get(this, 'isNewSerializerAPI') === ember$data$lib$serializers$json$api$serializer$$get(serializer, 'isNewSerializerAPI'));
var _serializer$normalize = serializer.normalize(modelClass, resourceHash);
var data = _serializer$normalize.data;
return data;
},
/**
@method pushPayload
@param {DS.Store} store
@param {Object} payload
*/
pushPayload: function (store, payload) {
var normalizedPayload = this._normalizeDocumentHelper(payload);
store.push(normalizedPayload);
},
/**
@method _normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@param {Boolean} isSingle
@return {Object} JSON-API Document
@private
*/
_normalizeResponse: function (store, primaryModelClass, payload, id, requestType, isSingle) {
var normalizedPayload = this._normalizeDocumentHelper(payload);
return normalizedPayload;
},
/**
@method extractAttributes
@param {DS.Model} modelClass
@param {Object} resourceHash
@return {Object}
*/
extractAttributes: function (modelClass, resourceHash) {
var _this = this;
var attributes = {};
if (resourceHash.attributes) {
modelClass.eachAttribute(function (key) {
var attributeKey = _this.keyForAttribute(key, 'deserialize');
if (resourceHash.attributes.hasOwnProperty(attributeKey)) {
attributes[key] = resourceHash.attributes[attributeKey];
}
});
}
return attributes;
},
/**
@method extractRelationship
@param {Object} relationshipHash
@return {Object}
*/
extractRelationship: function (relationshipHash) {
if (ember$lib$main$$default.typeOf(relationshipHash.data) === 'object') {
relationshipHash.data = this._normalizeRelationshipDataHelper(relationshipHash.data);
}
if (ember$lib$main$$default.typeOf(relationshipHash.data) === 'array') {
relationshipHash.data = ember$data$lib$serializers$json$api$serializer$$map.call(relationshipHash.data, this._normalizeRelationshipDataHelper, this);
}
return relationshipHash;
},
/**
@method extractRelationships
@param {Object} modelClass
@param {Object} resourceHash
@return {Object}
*/
extractRelationships: function (modelClass, resourceHash) {
var _this2 = this;
var relationships = {};
if (resourceHash.relationships) {
modelClass.eachRelationship(function (key, relationshipMeta) {
var relationshipKey = _this2.keyForRelationship(key, relationshipMeta.kind, 'deserialize');
if (resourceHash.relationships.hasOwnProperty(relationshipKey)) {
var relationshipHash = resourceHash.relationships[relationshipKey];
relationships[key] = _this2.extractRelationship(relationshipHash);
}
});
}
return relationships;
},
/**
@method _extractType
@param {DS.Model} modelClass
@param {Object} resourceHash
@return {String}
@private
*/
_extractType: function (modelClass, resourceHash) {
return this.modelNameFromPayloadKey(resourceHash.type);
},
/**
@method modelNameFromPayloadKey
@param {String} key
@return {String} the model's modelName
*/
modelNameFromPayloadKey: function (key) {
return ember$inflector$lib$lib$system$string$$singularize(ember$data$lib$system$normalize$model$name$$default(key));
},
/**
@method payloadKeyFromModelName
@param {String} modelName
@return {String}
*/
payloadKeyFromModelName: function (modelName) {
return ember$inflector$lib$lib$system$string$$pluralize(modelName);
},
/**
@method normalize
@param {DS.Model} modelClass
@param {Object} resourceHash
@return {String}
*/
normalize: function (modelClass, resourceHash) {
this.normalizeUsingDeclaredMapping(modelClass, resourceHash);
var data = {
id: this.extractId(modelClass, resourceHash),
type: this._extractType(modelClass, resourceHash),
attributes: this.extractAttributes(modelClass, resourceHash),
relationships: this.extractRelationships(modelClass, resourceHash)
};
this.applyTransforms(modelClass, data.attributes);
return { data: data };
},
/**
`keyForAttribute` can be used to define rules for how to convert an
attribute name in your model to a key in your JSON.
By default `JSONAPISerializer` follows the format used on the examples of
http://jsonapi.org/format and uses dashes as the word separator in the JSON
attribute keys.
This behaviour can be easily customized by extending this method.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONAPISerializer.extend({
keyForAttribute: function(attr, method) {
return Ember.String.dasherize(attr).toUpperCase();
}
});
```
@method keyForAttribute
@param {String} key
@param {String} method
@return {String} normalized key
*/
keyForAttribute: function (key, method) {
return ember$data$lib$serializers$json$api$serializer$$dasherize(key);
},
/**
`keyForRelationship` can be used to define a custom key when
serializing and deserializing relationship properties.
By default `JSONAPISerializer` follows the format used on the examples of
http://jsonapi.org/format and uses dashes as word separators in
relationship properties.
This behaviour can be easily customized by extending this method.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONAPISerializer.extend({
keyForRelationship: function(key, relationship, method) {
return Ember.String.underscore(key);
}
});
```
@method keyForRelationship
@param {String} key
@param {String} typeClass
@param {String} method
@return {String} normalized key
*/
keyForRelationship: function (key, typeClass, method) {
return ember$data$lib$serializers$json$api$serializer$$dasherize(key);
},
/**
@method serialize
@param {DS.Snapshot} snapshot
@param {Object} options
@return {Object} json
*/
serialize: function (snapshot, options) {
var data = this._super.apply(this, arguments);
data.type = this.payloadKeyFromModelName(snapshot.modelName);
return { data: data };
},
/**
@method serializeAttribute
@param {DS.Snapshot} snapshot
@param {Object} json
@param {String} key
@param {Object} attribute
*/
serializeAttribute: function (snapshot, json, key, attribute) {
var type = attribute.type;
if (this._canSerialize(key)) {
json.attributes = json.attributes || {};
var value = snapshot.attr(key);
if (type) {
var transform = this.transformFor(type);
value = transform.serialize(value);
}
var payloadKey = this._getMappedKey(key);
if (payloadKey === key) {
payloadKey = this.keyForAttribute(key, 'serialize');
}
json.attributes[payloadKey] = value;
}
},
/**
@method serializeBelongsTo
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeBelongsTo: function (snapshot, json, relationship) {
var key = relationship.key;
if (this._canSerialize(key)) {
var belongsTo = snapshot.belongsTo(key);
if (belongsTo !== undefined) {
json.relationships = json.relationships || {};
var payloadKey = this._getMappedKey(key);
if (payloadKey === key) {
payloadKey = this.keyForRelationship(key, 'belongsTo', 'serialize');
}
var data = null;
if (belongsTo) {
data = {
type: this.payloadKeyFromModelName(belongsTo.modelName),
id: belongsTo.id
};
}
json.relationships[payloadKey] = { data: data };
}
}
},
/**
@method serializeHasMany
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeHasMany: function (snapshot, json, relationship) {
var _this3 = this;
var key = relationship.key;
if (this._shouldSerializeHasMany(snapshot, key, relationship)) {
var hasMany = snapshot.hasMany(key);
if (hasMany !== undefined) {
json.relationships = json.relationships || {};
var payloadKey = this._getMappedKey(key);
if (payloadKey === key && this.keyForRelationship) {
payloadKey = this.keyForRelationship(key, 'hasMany', 'serialize');
}
var data = ember$data$lib$serializers$json$api$serializer$$map.call(hasMany, function (item) {
return {
type: _this3.payloadKeyFromModelName(item.modelName),
id: item.id
};
});
json.relationships[payloadKey] = { data: data };
}
}
}
});
var ember$data$lib$initializers$store$$default = ember$data$lib$initializers$store$$initializeStore;
/**
Configures a registry for use with an Ember-Data
store. Accepts an optional namespace argument.
@method initializeStore
@param {Ember.Registry} registry
@param {Object} [application] an application namespace
*/
function ember$data$lib$initializers$store$$initializeStore(registry, application) {
registry.optionsForType('serializer', { singleton: false });
registry.optionsForType('adapter', { singleton: false });
// allow older names to be looked up
var proxy = new ember$data$lib$system$container$proxy$$default(registry);
proxy.registerDeprecations([{ deprecated: 'serializer:_default', valid: 'serializer:-default' }, { deprecated: 'serializer:_rest', valid: 'serializer:-rest' }, { deprecated: 'adapter:_rest', valid: 'adapter:-rest' }]);
// new go forward paths
registry.register('serializer:-default', ember$data$lib$serializers$json$serializer$$default.extend({ isNewSerializerAPI: true }));
registry.register('serializer:-rest', ember$data$lib$serializers$rest$serializer$$default.extend({ isNewSerializerAPI: true }));
registry.register('adapter:-rest', ember$data$lib$adapters$rest$adapter$$default);
registry.register('adapter:-json-api', ember$data$lib$adapters$json$api$adapter$$default);
registry.register('serializer:-json-api', ember$data$lib$serializers$json$api$serializer$$default);
var store;
if (registry.has('store:main')) {
store = registry.lookup('store:main');
} else {
var storeMainProxy = new ember$data$lib$system$container$proxy$$default(registry);
storeMainProxy.registerDeprecations([{ deprecated: 'store:main', valid: 'service:store' }]);
}
if (registry.has('store:application')) {
store = registry.lookup('store:application');
} else {
var storeApplicationProxy = new ember$data$lib$system$container$proxy$$default(registry);
storeApplicationProxy.registerDeprecations([{ deprecated: 'store:application', valid: 'service:store' }]);
}
if (store) {
registry.unregister('service:store');
registry.register('service:store', store, { instantiate: false });
} else if (!registry.has('service:store')) {
registry.unregister('service:store');
registry.register('service:store', application && application.Store || ember$data$lib$system$store$$default);
}
}
var ember$data$lib$transforms$base$$default = Ember.Object.extend({
/**
When given a deserialized value from a record attribute this
method must return the serialized value.
Example
```javascript
serialize: function(deserialized) {
return Ember.isEmpty(deserialized) ? null : Number(deserialized);
}
```
@method serialize
@param deserialized The deserialized value
@return The serialized value
*/
serialize: null,
/**
When given a serialize value from a JSON object this method must
return the deserialized value for the record attribute.
Example
```javascript
deserialize: function(serialized) {
return empty(serialized) ? null : Number(serialized);
}
```
@method deserialize
@param serialized The serialized value
@return The deserialized value
*/
deserialize: null
});
var ember$data$lib$transforms$number$$empty = Ember.isEmpty;
function ember$data$lib$transforms$number$$isNumber(value) {
return value === value && value !== Infinity && value !== -Infinity;
}
var ember$data$lib$transforms$number$$default = ember$data$lib$transforms$base$$default.extend({
deserialize: function (serialized) {
var transformed;
if (ember$data$lib$transforms$number$$empty(serialized)) {
return null;
} else {
transformed = Number(serialized);
return ember$data$lib$transforms$number$$isNumber(transformed) ? transformed : null;
}
},
serialize: function (deserialized) {
var transformed;
if (ember$data$lib$transforms$number$$empty(deserialized)) {
return null;
} else {
transformed = Number(deserialized);
return ember$data$lib$transforms$number$$isNumber(transformed) ? transformed : null;
}
}
});
// Date.prototype.toISOString shim
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
var ember$data$lib$transforms$date$$toISOString = Date.prototype.toISOString || function () {
function pad(number) {
if (number < 10) {
return '0' + number;
}
return number;
}
return this.getUTCFullYear() + '-' + pad(this.getUTCMonth() + 1) + '-' + pad(this.getUTCDate()) + 'T' + pad(this.getUTCHours()) + ':' + pad(this.getUTCMinutes()) + ':' + pad(this.getUTCSeconds()) + '.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z';
};
if (Ember.SHIM_ES5) {
if (!Date.prototype.toISOString) {
Date.prototype.toISOString = ember$data$lib$transforms$date$$toISOString;
}
}
var ember$data$lib$transforms$date$$default = ember$data$lib$transforms$base$$default.extend({
deserialize: function (serialized) {
var type = typeof serialized;
if (type === "string") {
return new Date(Ember.Date.parse(serialized));
} else if (type === "number") {
return new Date(serialized);
} else if (serialized === null || serialized === undefined) {
// if the value is null return null
// if the value is not present in the data return undefined
return serialized;
} else {
return null;
}
},
serialize: function (date) {
if (date instanceof Date) {
return ember$data$lib$transforms$date$$toISOString.call(date);
} else {
return null;
}
}
});
var ember$data$lib$transforms$string$$none = Ember.isNone;
var ember$data$lib$transforms$string$$default = ember$data$lib$transforms$base$$default.extend({
deserialize: function (serialized) {
return ember$data$lib$transforms$string$$none(serialized) ? null : String(serialized);
},
serialize: function (deserialized) {
return ember$data$lib$transforms$string$$none(deserialized) ? null : String(deserialized);
}
});
var ember$data$lib$transforms$boolean$$default = ember$data$lib$transforms$base$$default.extend({
deserialize: function (serialized) {
var type = typeof serialized;
if (type === "boolean") {
return serialized;
} else if (type === "string") {
return serialized.match(/^true$|^t$|^1$/i) !== null;
} else if (type === "number") {
return serialized === 1;
} else {
return false;
}
},
serialize: function (deserialized) {
return Boolean(deserialized);
}
});
var ember$data$lib$initializers$transforms$$default = ember$data$lib$initializers$transforms$$initializeTransforms;
/**
Configures a registry for use with Ember-Data
transforms.
@method initializeTransforms
@param {Ember.Registry} registry
*/
function ember$data$lib$initializers$transforms$$initializeTransforms(registry) {
registry.register('transform:boolean', ember$data$lib$transforms$boolean$$default);
registry.register('transform:date', ember$data$lib$transforms$date$$default);
registry.register('transform:number', ember$data$lib$transforms$number$$default);
registry.register('transform:string', ember$data$lib$transforms$string$$default);
}
var ember$data$lib$initializers$store$injections$$default = ember$data$lib$initializers$store$injections$$initializeStoreInjections;
/**
Configures a registry with injections on Ember applications
for the Ember-Data store. Accepts an optional namespace argument.
@method initializeStoreInjections
@param {Ember.Registry} registry
*/
function ember$data$lib$initializers$store$injections$$initializeStoreInjections(registry) {
registry.injection('controller', 'store', 'service:store');
registry.injection('route', 'store', 'service:store');
registry.injection('data-adapter', 'store', 'service:store');
}
var ember$data$lib$system$model$attributes$$default = ember$data$lib$system$model$attributes$$attr;
/**
@module ember-data
*/
var ember$data$lib$system$model$attributes$$get = Ember.get;
/**
@class Model
@namespace DS
*/
ember$data$lib$system$model$model$$default.reopenClass({
/**
A map whose keys are the attributes of the model (properties
described by DS.attr) and whose values are the meta object for the
property.
Example
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: attr('string'),
lastName: attr('string'),
birthday: attr('date')
});
```
```javascript
import Ember from 'ember';
import Person from 'app/models/person';
var attributes = Ember.get(Person, 'attributes')
attributes.forEach(function(name, meta) {
console.log(name, meta);
});
// prints:
// firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
// lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
// birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
```
@property attributes
@static
@type {Ember.Map}
@readOnly
*/
attributes: Ember.computed(function () {
var map = ember$data$lib$system$map$$Map.create();
this.eachComputedProperty(function (name, meta) {
if (meta.isAttribute) {
meta.name = name;
map.set(name, meta);
}
});
return map;
}).readOnly(),
/**
A map whose keys are the attributes of the model (properties
described by DS.attr) and whose values are type of transformation
applied to each attribute. This map does not include any
attributes that do not have an transformation type.
Example
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: attr(),
lastName: attr('string'),
birthday: attr('date')
});
```
```javascript
import Ember from 'ember';
import Person from 'app/models/person';
var transformedAttributes = Ember.get(Person, 'transformedAttributes')
transformedAttributes.forEach(function(field, type) {
console.log(field, type);
});
// prints:
// lastName string
// birthday date
```
@property transformedAttributes
@static
@type {Ember.Map}
@readOnly
*/
transformedAttributes: Ember.computed(function () {
var map = ember$data$lib$system$map$$Map.create();
this.eachAttribute(function (key, meta) {
if (meta.type) {
map.set(key, meta.type);
}
});
return map;
}).readOnly(),
/**
Iterates through the attributes of the model, calling the passed function on each
attribute.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(name, meta);
```
- `name` the name of the current property in the iteration
- `meta` the meta object for the attribute property in the iteration
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context.
Example
```javascript
import DS from 'ember-data';
var Person = DS.Model.extend({
firstName: attr('string'),
lastName: attr('string'),
birthday: attr('date')
});
Person.eachAttribute(function(name, meta) {
console.log(name, meta);
});
// prints:
// firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
// lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
// birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
```
@method eachAttribute
@param {Function} callback The callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
@static
*/
eachAttribute: function (callback, binding) {
ember$data$lib$system$model$attributes$$get(this, 'attributes').forEach(function (meta, name) {
callback.call(binding, name, meta);
}, binding);
},
/**
Iterates through the transformedAttributes of the model, calling
the passed function on each attribute. Note the callback will not be
called for any attributes that do not have an transformation type.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(name, type);
```
- `name` the name of the current property in the iteration
- `type` a string containing the name of the type of transformed
applied to the attribute
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context.
Example
```javascript
import DS from 'ember-data';
var Person = DS.Model.extend({
firstName: attr(),
lastName: attr('string'),
birthday: attr('date')
});
Person.eachTransformedAttribute(function(name, type) {
console.log(name, type);
});
// prints:
// lastName string
// birthday date
```
@method eachTransformedAttribute
@param {Function} callback The callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
@static
*/
eachTransformedAttribute: function (callback, binding) {
ember$data$lib$system$model$attributes$$get(this, 'transformedAttributes').forEach(function (type, name) {
callback.call(binding, name, type);
});
}
});
ember$data$lib$system$model$model$$default.reopen({
eachAttribute: function (callback, binding) {
this.constructor.eachAttribute(callback, binding);
}
});
function ember$data$lib$system$model$attributes$$getDefaultValue(record, options, key) {
if (typeof options.defaultValue === "function") {
return options.defaultValue.apply(null, arguments);
} else {
return options.defaultValue;
}
}
function ember$data$lib$system$model$attributes$$hasValue(record, key) {
return key in record._attributes || key in record._inFlightAttributes || key in record._data;
}
function ember$data$lib$system$model$attributes$$getValue(record, key) {
if (key in record._attributes) {
return record._attributes[key];
} else if (key in record._inFlightAttributes) {
return record._inFlightAttributes[key];
} else {
return record._data[key];
}
}
/**
`DS.attr` defines an attribute on a [DS.Model](/api/data/classes/DS.Model.html).
By default, attributes are passed through as-is, however you can specify an
optional type to have the value automatically transformed.
Ember Data ships with four basic transform types: `string`, `number`,
`boolean` and `date`. You can define your own transforms by subclassing
[DS.Transform](/api/data/classes/DS.Transform.html).
Note that you cannot use `attr` to define an attribute of `id`.
`DS.attr` takes an optional hash as a second parameter, currently
supported options are:
- `defaultValue`: Pass a string or a function to be called to set the attribute
to a default value if none is supplied.
Example
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
username: DS.attr('string'),
email: DS.attr('string'),
verified: DS.attr('boolean', { defaultValue: false })
});
```
Default value can also be a function. This is useful it you want to return
a new object for each attribute.
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
username: attr('string'),
email: attr('string'),
settings: attr({defaultValue: function() {
return {};
}})
});
```
@namespace
@method attr
@for DS
@param {String} type the attribute type
@param {Object} options a hash of options
@return {Attribute}
*/
function ember$data$lib$system$model$attributes$$attr(type, options) {
if (typeof type === 'object') {
options = type;
type = undefined;
} else {
options = options || {};
}
var meta = {
type: type,
isAttribute: true,
options: options
};
return ember$new$computed$lib$main$$default({
get: function (key) {
var internalModel = this._internalModel;
if (ember$data$lib$system$model$attributes$$hasValue(internalModel, key)) {
return ember$data$lib$system$model$attributes$$getValue(internalModel, key);
} else {
return ember$data$lib$system$model$attributes$$getDefaultValue(this, options, key);
}
},
set: function (key, value) {
var internalModel = this._internalModel;
var oldValue = ember$data$lib$system$model$attributes$$getValue(internalModel, key);
if (value !== oldValue) {
// Add the new value to the changed attributes hash; it will get deleted by
// the 'didSetProperty' handler if it is no different from the original value
internalModel._attributes[key] = value;
this._internalModel.send('didSetProperty', {
name: key,
oldValue: oldValue,
originalValue: internalModel._data[key],
value: value
});
}
return value;
}
}).meta(meta);
}
var ember$data$lib$system$model$$default = ember$data$lib$system$model$model$$default;
var ember$data$lib$system$debug$debug$adapter$$get = Ember.get;
var ember$data$lib$system$debug$debug$adapter$$capitalize = Ember.String.capitalize;
var ember$data$lib$system$debug$debug$adapter$$underscore = Ember.String.underscore;
var ember$data$lib$system$debug$debug$adapter$$_Ember = Ember;
var ember$data$lib$system$debug$debug$adapter$$assert = ember$data$lib$system$debug$debug$adapter$$_Ember.assert;
var ember$data$lib$system$debug$debug$adapter$$default = Ember.DataAdapter.extend({
getFilters: function () {
return [{ name: 'isNew', desc: 'New' }, { name: 'isModified', desc: 'Modified' }, { name: 'isClean', desc: 'Clean' }];
},
detect: function (typeClass) {
return typeClass !== ember$data$lib$system$model$$default && ember$data$lib$system$model$$default.detect(typeClass);
},
columnsForType: function (typeClass) {
var columns = [{
name: 'id',
desc: 'Id'
}];
var count = 0;
var self = this;
ember$data$lib$system$debug$debug$adapter$$get(typeClass, 'attributes').forEach(function (meta, name) {
if (count++ > self.attributeLimit) {
return false;
}
var desc = ember$data$lib$system$debug$debug$adapter$$capitalize(ember$data$lib$system$debug$debug$adapter$$underscore(name).replace('_', ' '));
columns.push({ name: name, desc: desc });
});
return columns;
},
getRecords: function (modelClass, modelName) {
if (arguments.length < 2) {
// Legacy Ember.js < 1.13 support
var containerKey = modelClass._debugContainerKey;
if (containerKey) {
var match = containerKey.match(/model:(.*)/);
if (match) {
modelName = match[1];
}
}
}
ember$data$lib$system$debug$debug$adapter$$assert("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support", !!modelName);
return this.get('store').peekAll(modelName);
},
getRecordColumnValues: function (record) {
var self = this;
var count = 0;
var columnValues = { id: ember$data$lib$system$debug$debug$adapter$$get(record, 'id') };
record.eachAttribute(function (key) {
if (count++ > self.attributeLimit) {
return false;
}
var value = ember$data$lib$system$debug$debug$adapter$$get(record, key);
columnValues[key] = value;
});
return columnValues;
},
getRecordKeywords: function (record) {
var keywords = [];
var keys = Ember.A(['id']);
record.eachAttribute(function (key) {
keys.push(key);
});
keys.forEach(function (key) {
keywords.push(ember$data$lib$system$debug$debug$adapter$$get(record, key));
});
return keywords;
},
getRecordFilterValues: function (record) {
return {
isNew: record.get('isNew'),
isModified: record.get('hasDirtyAttributes') && !record.get('isNew'),
isClean: !record.get('hasDirtyAttributes')
};
},
getRecordColor: function (record) {
var color = 'black';
if (record.get('isNew')) {
color = 'green';
} else if (record.get('hasDirtyAttributes')) {
color = 'blue';
}
return color;
},
observeRecord: function (record, recordUpdated) {
var releaseMethods = Ember.A();
var self = this;
var keysToObserve = Ember.A(['id', 'isNew', 'hasDirtyAttributes']);
record.eachAttribute(function (key) {
keysToObserve.push(key);
});
keysToObserve.forEach(function (key) {
var handler = function () {
recordUpdated(self.wrapRecord(record));
};
Ember.addObserver(record, key, handler);
releaseMethods.push(function () {
Ember.removeObserver(record, key, handler);
});
});
var release = function () {
releaseMethods.forEach(function (fn) {
fn();
});
};
return release;
}
});
var ember$data$lib$initializers$data$adapter$$default = ember$data$lib$initializers$data$adapter$$initializeDebugAdapter;
/**
Configures a registry with injections on Ember applications
for the Ember-Data store. Accepts an optional namespace argument.
@method initializeStoreInjections
@param {Ember.Registry} registry
*/
function ember$data$lib$initializers$data$adapter$$initializeDebugAdapter(registry) {
registry.register('data-adapter:main', ember$data$lib$system$debug$debug$adapter$$default);
}
var ember$data$lib$instance$initializers$initialize$store$service$$default = ember$data$lib$instance$initializers$initialize$store$service$$initializeStoreService;
/**
Configures a registry for use with an Ember-Data
store.
@method initializeStore
@param {Ember.ApplicationInstance} applicationOrRegistry
*/
function ember$data$lib$instance$initializers$initialize$store$service$$initializeStoreService(applicationOrRegistry) {
var registry, container;
if (applicationOrRegistry.registry && applicationOrRegistry.container) {
// initializeStoreService was registered with an
// instanceInitializer. The first argument is the application
// instance.
registry = applicationOrRegistry.registry;
container = applicationOrRegistry.container;
} else {
// initializeStoreService was called by an initializer instead of
// an instanceInitializer. The first argument is a registy. This
// case allows ED to support Ember pre 1.12
registry = applicationOrRegistry;
if (registry.container) {
// Support Ember 1.10 - 1.11
container = registry.container();
} else {
// Support Ember 1.9
container = registry;
}
}
// Eagerly generate the store so defaultStore is populated.
container.lookup('service:store');
}
var ember$data$lib$setup$container$$default = ember$data$lib$setup$container$$setupContainer;
function ember$data$lib$setup$container$$setupContainer(registry, application) {
// application is not a required argument. This ensures
// testing setups can setup a container without booting an
// entire ember application.
ember$data$lib$setup$container$$initializeInjects(registry, application);
ember$data$lib$instance$initializers$initialize$store$service$$default(registry);
}
function ember$data$lib$setup$container$$initializeInjects(registry, application) {
ember$data$lib$initializers$data$adapter$$default(registry, application);
ember$data$lib$initializers$transforms$$default(registry, application);
ember$data$lib$initializers$store$injections$$default(registry, application);
activemodel$adapter$lib$setup$container$$default(registry, application);
ember$data$lib$initializers$store$$default(registry, application);
}
var ember$data$lib$ember$initializer$$K = Ember.K;
/**
@module ember-data
*/
/*
This code initializes Ember-Data onto an Ember application.
If an Ember.js developer defines a subclass of DS.Store on their application,
as `App.StoreService` (or via a module system that resolves to `service:store`)
this code will automatically instantiate it and make it available on the
router.
Additionally, after an application's controllers have been injected, they will
each have the store made available to them.
For example, imagine an Ember.js application with the following classes:
App.StoreService = DS.Store.extend({
adapter: 'custom'
});
App.PostsController = Ember.ArrayController.extend({
// ...
});
When the application is initialized, `App.ApplicationStore` will automatically be
instantiated, and the instance of `App.PostsController` will have its `store`
property set to that instance.
Note that this code will only be run if the `ember-application` package is
loaded. If Ember Data is being used in an environment other than a
typical application (e.g., node.js where only `ember-runtime` is available),
this code will be ignored.
*/
Ember.onLoad('Ember.Application', function (Application) {
Application.initializer({
name: "ember-data",
initialize: ember$data$lib$setup$container$$initializeInjects
});
if (Application.instanceInitializer) {
Application.instanceInitializer({
name: "ember-data",
initialize: ember$data$lib$instance$initializers$initialize$store$service$$default
});
} else {
Application.initializer({
name: "ember-data-store-service",
after: "ember-data",
initialize: ember$data$lib$instance$initializers$initialize$store$service$$default
});
}
// Deprecated initializers to satisfy old code that depended on them
Application.initializer({
name: "store",
after: "ember-data",
initialize: ember$data$lib$ember$initializer$$K
});
Application.initializer({
name: "activeModelAdapter",
before: "store",
initialize: ember$data$lib$ember$initializer$$K
});
Application.initializer({
name: "transforms",
before: "store",
initialize: ember$data$lib$ember$initializer$$K
});
Application.initializer({
name: "data-adapter",
before: "store",
initialize: ember$data$lib$ember$initializer$$K
});
Application.initializer({
name: "injectStore",
before: "store",
initialize: ember$data$lib$ember$initializer$$K
});
});
Ember.Date = Ember.Date || {};
var origParse = Date.parse;
var numericKeys = [1, 4, 5, 6, 7, 10, 11];
/**
@method parse
@param {Date} date
@return {Number} timestamp
*/
Ember.Date.parse = function (date) {
var timestamp, struct;
var minutesOffset = 0;
// ES5 §15.9.4.2 states that the string should attempt to be parsed as a Date Time String Format string
// before falling back to any implementation-specific date parsing, so that’s what we do, even if native
// implementations could be faster
// 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm
if (struct = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(date)) {
// avoid NaN timestamps caused by “undefined” values being passed to Date.UTC
for (var i = 0, k; k = numericKeys[i]; ++i) {
struct[k] = +struct[k] || 0;
}
// allow undefined days and months
struct[2] = (+struct[2] || 1) - 1;
struct[3] = +struct[3] || 1;
if (struct[8] !== 'Z' && struct[9] !== undefined) {
minutesOffset = struct[10] * 60 + struct[11];
if (struct[9] === '+') {
minutesOffset = 0 - minutesOffset;
}
}
timestamp = Date.UTC(struct[1], struct[2], struct[3], struct[4], struct[5] + minutesOffset, struct[6], struct[7]);
} else {
timestamp = origParse ? origParse(date) : NaN;
}
return timestamp;
};
if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Date) {
Date.parse = Ember.Date.parse;
}
ember$data$lib$system$model$$default.reopen({
/**
Provides info about the model for debugging purposes
by grouping the properties into more semantic groups.
Meant to be used by debugging tools such as the Chrome Ember Extension.
- Groups all attributes in "Attributes" group.
- Groups all belongsTo relationships in "Belongs To" group.
- Groups all hasMany relationships in "Has Many" group.
- Groups all flags in "Flags" group.
- Flags relationship CPs as expensive properties.
@method _debugInfo
@for DS.Model
@private
*/
_debugInfo: function () {
var attributes = ['id'];
var relationships = { belongsTo: [], hasMany: [] };
var expensiveProperties = [];
this.eachAttribute(function (name, meta) {
attributes.push(name);
}, this);
this.eachRelationship(function (name, relationship) {
relationships[relationship.kind].push(name);
expensiveProperties.push(name);
});
var groups = [{
name: 'Attributes',
properties: attributes,
expand: true
}, {
name: 'Belongs To',
properties: relationships.belongsTo,
expand: true
}, {
name: 'Has Many',
properties: relationships.hasMany,
expand: true
}, {
name: 'Flags',
properties: ['isLoaded', 'hasDirtyAttributes', 'isSaving', 'isDeleted', 'isError', 'isNew', 'isValid']
}];
return {
propertyInfo: {
// include all other mixins / properties (not just the grouped ones)
includeOtherProperties: true,
groups: groups,
// don't pre-calculate unless cached
expensiveProperties: expensiveProperties
}
};
}
});
var ember$data$lib$system$debug$debug$info$$default = ember$data$lib$system$model$$default;
var ember$data$lib$system$debug$$default = ember$data$lib$system$debug$debug$adapter$$default;
var ember$data$lib$serializers$embedded$records$mixin$$get = Ember.get;
var ember$data$lib$serializers$embedded$records$mixin$$set = Ember.set;
var ember$data$lib$serializers$embedded$records$mixin$$forEach = ember$data$lib$ext$ember$array$$default.forEach;
var ember$data$lib$serializers$embedded$records$mixin$$camelize = Ember.String.camelize;
/**
## Using Embedded Records
`DS.EmbeddedRecordsMixin` supports serializing embedded records.
To set up embedded records, include the mixin when extending a serializer
then define and configure embedded (model) relationships.
Below is an example of a per-type serializer ('post' type).
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
author: { embedded: 'always' },
comments: { serialize: 'ids' }
}
});
```
Note that this use of `{ embedded: 'always' }` is unrelated to
the `{ embedded: 'always' }` that is defined as an option on `DS.attr` as part of
defining a model while working with the ActiveModelSerializer. Nevertheless,
using `{ embedded: 'always' }` as an option to DS.attr is not a valid way to setup
embedded records.
The `attrs` option for a resource `{ embedded: 'always' }` is shorthand for:
```js
{
serialize: 'records',
deserialize: 'records'
}
```
### Configuring Attrs
A resource's `attrs` option may be set to use `ids`, `records` or false for the
`serialize` and `deserialize` settings.
The `attrs` property can be set on the ApplicationSerializer or a per-type
serializer.
In the case where embedded JSON is expected while extracting a payload (reading)
the setting is `deserialize: 'records'`, there is no need to use `ids` when
extracting as that is the default behavior without this mixin if you are using
the vanilla EmbeddedRecordsMixin. Likewise, to embed JSON in the payload while
serializing `serialize: 'records'` is the setting to use. There is an option of
not embedding JSON in the serialized payload by using `serialize: 'ids'`. If you
do not want the relationship sent at all, you can use `serialize: false`.
### EmbeddedRecordsMixin defaults
If you do not overwrite `attrs` for a specific relationship, the `EmbeddedRecordsMixin`
will behave in the following way:
BelongsTo: `{ serialize: 'id', deserialize: 'id' }`
HasMany: `{ serialize: false, deserialize: 'ids' }`
### Model Relationships
Embedded records must have a model defined to be extracted and serialized. Note that
when defining any relationships on your model such as `belongsTo` and `hasMany`, you
should not both specify `async:true` and also indicate through the serializer's
`attrs` attribute that the related model should be embedded for deserialization.
If a model is declared embedded for deserialization (`embedded: 'always'`,
`deserialize: 'record'` or `deserialize: 'records'`), then do not use `async:true`.
To successfully extract and serialize embedded records the model relationships
must be setup correcty See the
[defining relationships](/guides/models/defining-models/#toc_defining-relationships)
section of the **Defining Models** guide page.
Records without an `id` property are not considered embedded records, model
instances must have an `id` property to be used with Ember Data.
### Example JSON payloads, Models and Serializers
**When customizing a serializer it is important to grok what the customizations
are. Please read the docs for the methods this mixin provides, in case you need
to modify it to fit your specific needs.**
For example review the docs for each method of this mixin:
* [normalize](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_normalize)
* [serializeBelongsTo](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeBelongsTo)
* [serializeHasMany](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeHasMany)
@class EmbeddedRecordsMixin
@namespace DS
*/
var ember$data$lib$serializers$embedded$records$mixin$$EmbeddedRecordsMixin = Ember.Mixin.create({
/**
Normalize the record and recursively normalize/extract all the embedded records
while pushing them into the store as they are encountered
A payload with an attr configured for embedded records needs to be extracted:
```js
{
"post": {
"id": "1"
"title": "Rails is omakase",
"comments": [{
"id": "1",
"body": "Rails is unagi"
}, {
"id": "2",
"body": "Omakase O_o"
}]
}
}
```
@method normalize
@param {DS.Model} typeClass
@param {Object} hash to be normalized
@param {String} prop the hash has been referenced by
@return {Object} the normalized hash
**/
normalize: function (typeClass, hash, prop) {
var normalizedHash = this._super(typeClass, hash, prop);
return this._extractEmbeddedRecords(this, this.store, typeClass, normalizedHash);
},
keyForRelationship: function (key, typeClass, method) {
if (method === 'serialize' && this.hasSerializeRecordsOption(key) || method === 'deserialize' && this.hasDeserializeRecordsOption(key)) {
return this.keyForAttribute(key, method);
} else {
return this._super(key, typeClass, method) || key;
}
},
/**
Serialize `belongsTo` relationship when it is configured as an embedded object.
This example of an author model belongs to a post model:
```js
Post = DS.Model.extend({
title: DS.attr('string'),
body: DS.attr('string'),
author: DS.belongsTo('author')
});
Author = DS.Model.extend({
name: DS.attr('string'),
post: DS.belongsTo('post')
});
```
Use a custom (type) serializer for the post model to configure embedded author
```app/serializers/post.js
import DS from 'ember-data;
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
author: { embedded: 'always' }
}
})
```
A payload with an attribute configured for embedded records can serialize
the records together under the root attribute's payload:
```js
{
"post": {
"id": "1"
"title": "Rails is omakase",
"author": {
"id": "2"
"name": "dhh"
}
}
}
```
@method serializeBelongsTo
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeBelongsTo: function (snapshot, json, relationship) {
var attr = relationship.key;
if (this.noSerializeOptionSpecified(attr)) {
this._super(snapshot, json, relationship);
return;
}
var includeIds = this.hasSerializeIdsOption(attr);
var includeRecords = this.hasSerializeRecordsOption(attr);
var embeddedSnapshot = snapshot.belongsTo(attr);
var key;
if (includeIds) {
key = this.keyForRelationship(attr, relationship.kind, 'serialize');
if (!embeddedSnapshot) {
json[key] = null;
} else {
json[key] = embeddedSnapshot.id;
}
} else if (includeRecords) {
key = this.keyForAttribute(attr, 'serialize');
if (!embeddedSnapshot) {
json[key] = null;
} else {
json[key] = embeddedSnapshot.record.serialize({ includeId: true });
this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json[key]);
}
}
},
/**
Serialize `hasMany` relationship when it is configured as embedded objects.
This example of a post model has many comments:
```js
Post = DS.Model.extend({
title: DS.attr('string'),
body: DS.attr('string'),
comments: DS.hasMany('comment')
});
Comment = DS.Model.extend({
body: DS.attr('string'),
post: DS.belongsTo('post')
});
```
Use a custom (type) serializer for the post model to configure embedded comments
```app/serializers/post.js
import DS from 'ember-data;
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
comments: {embedded: 'always'}
}
})
```
A payload with an attribute configured for embedded records can serialize
the records together under the root attribute's payload:
```js
{
"post": {
"id": "1"
"title": "Rails is omakase",
"body": "I want this for my ORM, I want that for my template language..."
"comments": [{
"id": "1",
"body": "Rails is unagi"
}, {
"id": "2",
"body": "Omakase O_o"
}]
}
}
```
The attrs options object can use more specific instruction for extracting and
serializing. When serializing, an option to embed `ids` or `records` can be set.
When extracting the only option is `records`.
So `{ embedded: 'always' }` is shorthand for:
`{ serialize: 'records', deserialize: 'records' }`
To embed the `ids` for a related object (using a hasMany relationship):
```app/serializers/post.js
import DS from 'ember-data;
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
comments: { serialize: 'ids', deserialize: 'records' }
}
})
```
```js
{
"post": {
"id": "1"
"title": "Rails is omakase",
"body": "I want this for my ORM, I want that for my template language..."
"comments": ["1", "2"]
}
}
```
@method serializeHasMany
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeHasMany: function (snapshot, json, relationship) {
var attr = relationship.key;
if (this.noSerializeOptionSpecified(attr)) {
this._super(snapshot, json, relationship);
return;
}
var includeIds = this.hasSerializeIdsOption(attr);
var includeRecords = this.hasSerializeRecordsOption(attr);
var key, hasMany;
if (includeIds) {
key = this.keyForRelationship(attr, relationship.kind, 'serialize');
json[key] = snapshot.hasMany(attr, { ids: true });
} else if (includeRecords) {
key = this.keyForAttribute(attr, 'serialize');
hasMany = snapshot.hasMany(attr);
json[key] = Ember.A(hasMany).map(function (embeddedSnapshot) {
var embeddedJson = embeddedSnapshot.record.serialize({ includeId: true });
this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, embeddedJson);
return embeddedJson;
}, this);
}
},
/**
When serializing an embedded record, modify the property (in the json payload)
that refers to the parent record (foreign key for relationship).
Serializing a `belongsTo` relationship removes the property that refers to the
parent record
Serializing a `hasMany` relationship does not remove the property that refers to
the parent record.
@method removeEmbeddedForeignKey
@param {DS.Snapshot} snapshot
@param {DS.Snapshot} embeddedSnapshot
@param {Object} relationship
@param {Object} json
*/
removeEmbeddedForeignKey: function (snapshot, embeddedSnapshot, relationship, json) {
if (relationship.kind === 'hasMany') {
return;
} else if (relationship.kind === 'belongsTo') {
var parentRecord = snapshot.type.inverseFor(relationship.key, this.store);
if (parentRecord) {
var name = parentRecord.name;
var embeddedSerializer = this.store.serializerFor(embeddedSnapshot.modelName);
var parentKey = embeddedSerializer.keyForRelationship(name, parentRecord.kind, 'deserialize');
if (parentKey) {
delete json[parentKey];
}
}
}
},
// checks config for attrs option to embedded (always) - serialize and deserialize
hasEmbeddedAlwaysOption: function (attr) {
var option = this.attrsOption(attr);
return option && option.embedded === 'always';
},
// checks config for attrs option to serialize ids
hasSerializeRecordsOption: function (attr) {
var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
var option = this.attrsOption(attr);
return alwaysEmbed || option && option.serialize === 'records';
},
// checks config for attrs option to serialize records
hasSerializeIdsOption: function (attr) {
var option = this.attrsOption(attr);
return option && (option.serialize === 'ids' || option.serialize === 'id');
},
// checks config for attrs option to serialize records
noSerializeOptionSpecified: function (attr) {
var option = this.attrsOption(attr);
return !(option && (option.serialize || option.embedded));
},
// checks config for attrs option to deserialize records
// a defined option object for a resource is treated the same as
// `deserialize: 'records'`
hasDeserializeRecordsOption: function (attr) {
var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
var option = this.attrsOption(attr);
return alwaysEmbed || option && option.deserialize === 'records';
},
attrsOption: function (attr) {
var attrs = this.get('attrs');
return attrs && (attrs[ember$data$lib$serializers$embedded$records$mixin$$camelize(attr)] || attrs[attr]);
},
/**
@method _extractEmbeddedRecords
@private
*/
_extractEmbeddedRecords: function (serializer, store, typeClass, partial) {
if (this.get('isNewSerializerAPI')) {
return ember$data$lib$serializers$embedded$records$mixin$$_newExtractEmbeddedRecords.apply(this, arguments);
}
typeClass.eachRelationship(function (key, relationship) {
if (serializer.hasDeserializeRecordsOption(key)) {
var embeddedTypeClass = store.modelFor(relationship.type);
if (relationship.kind === "hasMany") {
if (relationship.options.polymorphic) {
this._extractEmbeddedHasManyPolymorphic(store, key, partial);
} else {
this._extractEmbeddedHasMany(store, key, embeddedTypeClass, partial);
}
}
if (relationship.kind === "belongsTo") {
if (relationship.options.polymorphic) {
this._extractEmbeddedBelongsToPolymorphic(store, key, partial);
} else {
this._extractEmbeddedBelongsTo(store, key, embeddedTypeClass, partial);
}
}
}
}, this);
return partial;
},
/**
@method _extractEmbeddedHasMany
@private
*/
_extractEmbeddedHasMany: function (store, key, embeddedTypeClass, hash) {
if (this.get('isNewSerializerAPI')) {
return ember$data$lib$serializers$embedded$records$mixin$$_newExtractEmbeddedHasMany.apply(this, arguments);
}
if (!hash[key]) {
return hash;
}
var ids = [];
var embeddedSerializer = store.serializerFor(embeddedTypeClass.modelName);
ember$data$lib$serializers$embedded$records$mixin$$forEach.call(hash[key], function (data) {
var embeddedRecord = embeddedSerializer.normalize(embeddedTypeClass, data, null);
store.push(embeddedTypeClass.modelName, embeddedRecord);
ids.push(embeddedRecord.id);
});
hash[key] = ids;
return hash;
},
/**
@method _extractEmbeddedHasManyPolymorphic
@private
*/
_extractEmbeddedHasManyPolymorphic: function (store, key, hash) {
var _this = this;
if (!hash[key]) {
return hash;
}
var ids = [];
ember$data$lib$serializers$embedded$records$mixin$$forEach.call(hash[key], function (data) {
var modelName = data.type;
var embeddedSerializer = store.serializerFor(modelName);
var embeddedTypeClass = store.modelFor(modelName);
// var primaryKey = embeddedSerializer.get('primaryKey');
var embeddedRecord = embeddedSerializer.normalize(embeddedTypeClass, data, null);
store.push(embeddedTypeClass.modelName, embeddedRecord);
ids.push({ id: embeddedRecord.id, type: modelName });
});
hash[key] = ids;
return hash;
},
/**
@method _extractEmbeddedBelongsTo
@private
*/
_extractEmbeddedBelongsTo: function (store, key, embeddedTypeClass, hash) {
if (this.get('isNewSerializerAPI')) {
return ember$data$lib$serializers$embedded$records$mixin$$_newExtractEmbeddedBelongsTo.apply(this, arguments);
}
if (!hash[key]) {
return hash;
}
var embeddedSerializer = store.serializerFor(embeddedTypeClass.modelName);
var embeddedRecord = embeddedSerializer.normalize(embeddedTypeClass, hash[key], null);
store.push(embeddedTypeClass.modelName, embeddedRecord);
hash[key] = embeddedRecord.id;
return hash;
},
/**
@method _extractEmbeddedBelongsToPolymorphic
@private
*/
_extractEmbeddedBelongsToPolymorphic: function (store, key, hash) {
if (!hash[key]) {
return hash;
}
var data = hash[key];
var modelName = data.type;
var embeddedSerializer = store.serializerFor(modelName);
var embeddedTypeClass = store.modelFor(modelName);
// var primaryKey = embeddedSerializer.get('primaryKey');
var embeddedRecord = embeddedSerializer.normalize(embeddedTypeClass, data, null);
store.push(embeddedTypeClass.modelName, embeddedRecord);
hash[key] = embeddedRecord.id;
hash[key + 'Type'] = modelName;
return hash;
},
/**
@method _normalizeEmbeddedRelationship
@private
*/
_normalizeEmbeddedRelationship: function (store, relationshipMeta, relationshipHash) {
var modelName = relationshipMeta.type;
if (relationshipMeta.options.polymorphic) {
modelName = relationshipHash.type;
}
var modelClass = store.modelFor(modelName);
var serializer = store.serializerFor(modelName);
return serializer.normalize(modelClass, relationshipHash, null);
}
});
var ember$data$lib$serializers$embedded$records$mixin$$default = ember$data$lib$serializers$embedded$records$mixin$$EmbeddedRecordsMixin;
/*
@method _newExtractEmbeddedRecords
@private
*/
function ember$data$lib$serializers$embedded$records$mixin$$_newExtractEmbeddedRecords(serializer, store, typeClass, partial) {
var _this2 = this;
typeClass.eachRelationship(function (key, relationship) {
if (serializer.hasDeserializeRecordsOption(key)) {
if (relationship.kind === "hasMany") {
_this2._extractEmbeddedHasMany(store, key, partial, relationship);
}
if (relationship.kind === "belongsTo") {
_this2._extractEmbeddedBelongsTo(store, key, partial, relationship);
}
}
}, this);
return partial;
}
/*
@method _newExtractEmbeddedHasMany
@private
*/
function ember$data$lib$serializers$embedded$records$mixin$$_newExtractEmbeddedHasMany(store, key, hash, relationshipMeta) {
var _this3 = this;
var relationshipHash = ember$data$lib$serializers$embedded$records$mixin$$get(hash, 'data.relationships.' + key + '.data');
if (!relationshipHash) {
return;
}
var hasMany = relationshipHash.map(function (item) {
var _normalizeEmbeddedRelationship = _this3._normalizeEmbeddedRelationship(store, relationshipMeta, item);
var data = _normalizeEmbeddedRelationship.data;
var included = _normalizeEmbeddedRelationship.included;
hash.included = hash.included || [];
hash.included.push(data);
if (included) {
var _hash$included;
(_hash$included = hash.included).push.apply(_hash$included, included);
}
return { id: data.id, type: data.type };
});
var relationship = { data: hasMany };
ember$data$lib$serializers$embedded$records$mixin$$set(hash, 'data.relationships.' + key, relationship);
}
/*
@method _newExtractEmbeddedBelongsTo
@private
*/
function ember$data$lib$serializers$embedded$records$mixin$$_newExtractEmbeddedBelongsTo(store, key, hash, relationshipMeta) {
var relationshipHash = ember$data$lib$serializers$embedded$records$mixin$$get(hash, 'data.relationships.' + key + '.data');
if (!relationshipHash) {
return;
}
var _normalizeEmbeddedRelationship2 = this._normalizeEmbeddedRelationship(store, relationshipMeta, relationshipHash);
var data = _normalizeEmbeddedRelationship2.data;
var included = _normalizeEmbeddedRelationship2.included;
hash.included = hash.included || [];
hash.included.push(data);
if (included) {
var _hash$included2;
(_hash$included2 = hash.included).push.apply(_hash$included2, included);
}
var belongsTo = { id: data.id, type: data.type };
var relationship = { data: belongsTo };
ember$data$lib$serializers$embedded$records$mixin$$set(hash, 'data.relationships.' + key, relationship);
}
/**
`DS.belongsTo` is used to define One-To-One and One-To-Many
relationships on a [DS.Model](/api/data/classes/DS.Model.html).
`DS.belongsTo` takes an optional hash as a second parameter, currently
supported options are:
- `async`: A boolean value used to explicitly declare this to be an async relationship.
- `inverse`: A string used to identify the inverse property on a
related model in a One-To-Many relationship. See [Explicit Inverses](#toc_explicit-inverses)
#### One-To-One
To declare a one-to-one relationship between two models, use
`DS.belongsTo`:
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
profile: DS.belongsTo('profile')
});
```
```app/models/profile.js
import DS from 'ember-data';
export default DS.Model.extend({
user: DS.belongsTo('user')
});
```
#### One-To-Many
To declare a one-to-many relationship between two models, use
`DS.belongsTo` in combination with `DS.hasMany`, like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment')
});
```
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
post: DS.belongsTo('post')
});
```
You can avoid passing a string as the first parameter. In that case Ember Data
will infer the type from the key name.
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
post: DS.belongsTo()
});
```
will lookup for a Post type.
@namespace
@method belongsTo
@for DS
@param {String} modelName (optional) type of the relationship
@param {Object} options (optional) a hash of options
@return {Ember.computed} relationship
*/
function ember$data$lib$system$relationships$belongs$to$$belongsTo(modelName, options) {
var opts, userEnteredModelName;
if (typeof modelName === 'object') {
opts = modelName;
userEnteredModelName = undefined;
} else {
opts = options;
userEnteredModelName = modelName;
}
if (typeof userEnteredModelName === 'string') {
userEnteredModelName = ember$data$lib$system$normalize$model$name$$default(userEnteredModelName);
}
opts = opts || {};
var shouldWarnAsync = false;
if (typeof opts.async === 'undefined') {
shouldWarnAsync = true;
}
var meta = {
type: userEnteredModelName,
isRelationship: true,
options: opts,
kind: 'belongsTo',
key: null,
shouldWarnAsync: shouldWarnAsync
};
return ember$new$computed$lib$main$$default({
get: function (key) {
if (opts.hasOwnProperty('serialize')) {
}
if (opts.hasOwnProperty('embedded')) {
}
if (meta.shouldWarnAsync) {
meta.shouldWarnAsync = false;
}
return this._internalModel._relationships.get(key).getRecord();
},
set: function (key, value) {
if (value === undefined) {
value = null;
}
if (value && value.then) {
this._internalModel._relationships.get(key).setRecordPromise(value);
} else if (value) {
this._internalModel._relationships.get(key).setRecord(value._internalModel);
} else {
this._internalModel._relationships.get(key).setRecord(value);
}
return this._internalModel._relationships.get(key).getRecord();
}
}).meta(meta);
}
/*
These observers observe all `belongsTo` relationships on the record. See
`relationships/ext` to see how these observers get their dependencies.
*/
ember$data$lib$system$model$$default.reopen({
notifyBelongsToChanged: function (key) {
this.notifyPropertyChange(key);
}
});
var ember$data$lib$system$relationships$belongs$to$$default = ember$data$lib$system$relationships$belongs$to$$belongsTo;
/**
`DS.hasMany` is used to define One-To-Many and Many-To-Many
relationships on a [DS.Model](/api/data/classes/DS.Model.html).
`DS.hasMany` takes an optional hash as a second parameter, currently
supported options are:
- `async`: A boolean value used to explicitly declare this to be an async relationship.
- `inverse`: A string used to identify the inverse property on a related model.
#### One-To-Many
To declare a one-to-many relationship between two models, use
`DS.belongsTo` in combination with `DS.hasMany`, like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment')
});
```
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
post: DS.belongsTo('post')
});
```
#### Many-To-Many
To declare a many-to-many relationship between two models, use
`DS.hasMany`:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
tags: DS.hasMany('tag')
});
```
```app/models/tag.js
import DS from 'ember-data';
export default DS.Model.extend({
posts: DS.hasMany('post')
});
```
You can avoid passing a string as the first parameter. In that case Ember Data
will infer the type from the singularized key name.
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
tags: DS.hasMany()
});
```
will lookup for a Tag type.
#### Explicit Inverses
Ember Data will do its best to discover which relationships map to
one another. In the one-to-many code above, for example, Ember Data
can figure out that changing the `comments` relationship should update
the `post` relationship on the inverse because post is the only
relationship to that model.
However, sometimes you may have multiple `belongsTo`/`hasManys` for the
same type. You can specify which property on the related model is
the inverse using `DS.hasMany`'s `inverse` option:
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
onePost: DS.belongsTo('post'),
twoPost: DS.belongsTo('post'),
redPost: DS.belongsTo('post'),
bluePost: DS.belongsTo('post')
});
```
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment', {
inverse: 'redPost'
})
});
```
You can also specify an inverse on a `belongsTo`, which works how
you'd expect.
@namespace
@method hasMany
@for DS
@param {String} type (optional) type of the relationship
@param {Object} options (optional) a hash of options
@return {Ember.computed} relationship
*/
function ember$data$lib$system$relationships$has$many$$hasMany(type, options) {
if (typeof type === 'object') {
options = type;
type = undefined;
}
options = options || {};
var shouldWarnAsync = false;
if (typeof options.async === 'undefined') {
shouldWarnAsync = true;
}
if (typeof type === 'string') {
type = ember$data$lib$system$normalize$model$name$$default(type);
}
// Metadata about relationships is stored on the meta of
// the relationship. This is used for introspection and
// serialization. Note that `key` is populated lazily
// the first time the CP is called.
var meta = {
type: type,
isRelationship: true,
options: options,
kind: 'hasMany',
key: null,
shouldWarnAsync: shouldWarnAsync
};
return ember$new$computed$lib$main$$default({
get: function (key) {
if (meta.shouldWarnAsync) {
meta.shouldWarnAsync = false;
}
var relationship = this._internalModel._relationships.get(key);
return relationship.getRecords();
},
set: function (key, records) {
var relationship = this._internalModel._relationships.get(key);
relationship.clear();
relationship.addRecords(Ember.A(records).mapBy('_internalModel'));
return relationship.getRecords();
}
}).meta(meta);
}
ember$data$lib$system$model$$default.reopen({
notifyHasManyAdded: function (key) {
//We need to notifyPropertyChange in the adding case because we need to make sure
//we fetch the newly added record in case it is unloaded
//TODO(Igor): Consider whether we could do this only if the record state is unloaded
//Goes away once hasMany is double promisified
this.notifyPropertyChange(key);
}
});
var ember$data$lib$system$relationships$has$many$$default = ember$data$lib$system$relationships$has$many$$hasMany;
function ember$data$lib$system$relationship$meta$$typeForRelationshipMeta(meta) {
var modelName;
modelName = meta.type || meta.key;
if (meta.kind === 'hasMany') {
modelName = ember$inflector$lib$lib$system$string$$singularize(ember$data$lib$system$normalize$model$name$$default(modelName));
}
return modelName;
}
function ember$data$lib$system$relationship$meta$$relationshipFromMeta(meta) {
return {
key: meta.key,
kind: meta.kind,
type: ember$data$lib$system$relationship$meta$$typeForRelationshipMeta(meta),
options: meta.options,
parentType: meta.parentType,
isRelationship: true
};
}
var ember$data$lib$system$relationships$ext$$get = Ember.get;
var ember$data$lib$system$relationships$ext$$filter = ember$data$lib$ext$ember$array$$default.filter;
var ember$data$lib$system$relationships$ext$$relationshipsDescriptor = Ember.computed(function () {
if (Ember.testing === true && ember$data$lib$system$relationships$ext$$relationshipsDescriptor._cacheable === true) {
ember$data$lib$system$relationships$ext$$relationshipsDescriptor._cacheable = false;
}
var map = new ember$data$lib$system$map$$MapWithDefault({
defaultValue: function () {
return [];
}
});
// Loop through each computed property on the class
this.eachComputedProperty(function (name, meta) {
// If the computed property is a relationship, add
// it to the map.
if (meta.isRelationship) {
meta.key = name;
var relationshipsForType = map.get(ember$data$lib$system$relationship$meta$$typeForRelationshipMeta(meta));
relationshipsForType.push({
name: name,
kind: meta.kind
});
}
});
return map;
}).readOnly();
var ember$data$lib$system$relationships$ext$$relatedTypesDescriptor = Ember.computed(function () {
if (Ember.testing === true && ember$data$lib$system$relationships$ext$$relatedTypesDescriptor._cacheable === true) {
ember$data$lib$system$relationships$ext$$relatedTypesDescriptor._cacheable = false;
}
var modelName;
var types = Ember.A();
// Loop through each computed property on the class,
// and create an array of the unique types involved
// in relationships
this.eachComputedProperty(function (name, meta) {
if (meta.isRelationship) {
meta.key = name;
modelName = ember$data$lib$system$relationship$meta$$typeForRelationshipMeta(meta);
if (!types.contains(modelName)) {
types.push(modelName);
}
}
});
return types;
}).readOnly();
var ember$data$lib$system$relationships$ext$$relationshipsByNameDescriptor = Ember.computed(function () {
if (Ember.testing === true && ember$data$lib$system$relationships$ext$$relationshipsByNameDescriptor._cacheable === true) {
ember$data$lib$system$relationships$ext$$relationshipsByNameDescriptor._cacheable = false;
}
var map = ember$data$lib$system$map$$Map.create();
this.eachComputedProperty(function (name, meta) {
if (meta.isRelationship) {
meta.key = name;
var relationship = ember$data$lib$system$relationship$meta$$relationshipFromMeta(meta);
relationship.type = ember$data$lib$system$relationship$meta$$typeForRelationshipMeta(meta);
map.set(name, relationship);
}
});
return map;
}).readOnly();
/**
@module ember-data
*/
/*
This file defines several extensions to the base `DS.Model` class that
add support for one-to-many relationships.
*/
/**
@class Model
@namespace DS
*/
ember$data$lib$system$model$$default.reopen({
/**
This Ember.js hook allows an object to be notified when a property
is defined.
In this case, we use it to be notified when an Ember Data user defines a
belongs-to relationship. In that case, we need to set up observers for
each one, allowing us to track relationship changes and automatically
reflect changes in the inverse has-many array.
This hook passes the class being set up, as well as the key and value
being defined. So, for example, when the user does this:
```javascript
DS.Model.extend({
parent: DS.belongsTo('user')
});
```
This hook would be called with "parent" as the key and the computed
property returned by `DS.belongsTo` as the value.
@method didDefineProperty
@param {Object} proto
@param {String} key
@param {Ember.ComputedProperty} value
*/
didDefineProperty: function (proto, key, value) {
// Check if the value being set is a computed property.
if (value instanceof Ember.ComputedProperty) {
// If it is, get the metadata for the relationship. This is
// populated by the `DS.belongsTo` helper when it is creating
// the computed property.
var meta = value.meta();
meta.parentType = proto.constructor;
}
}
});
/*
These DS.Model extensions add class methods that provide relationship
introspection abilities about relationships.
A note about the computed properties contained here:
**These properties are effectively sealed once called for the first time.**
To avoid repeatedly doing expensive iteration over a model's fields, these
values are computed once and then cached for the remainder of the runtime of
your application.
If your application needs to modify a class after its initial definition
(for example, using `reopen()` to add additional attributes), make sure you
do it before using your model with the store, which uses these properties
extensively.
*/
ember$data$lib$system$model$$default.reopenClass({
/**
For a given relationship name, returns the model type of the relationship.
For example, if you define a model like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment')
});
```
Calling `App.Post.typeForRelationship('comments')` will return `App.Comment`.
@method typeForRelationship
@static
@param {String} name the name of the relationship
@param {store} store an instance of DS.Store
@return {DS.Model} the type of the relationship, or undefined
*/
typeForRelationship: function (name, store) {
var relationship = ember$data$lib$system$relationships$ext$$get(this, 'relationshipsByName').get(name);
return relationship && store.modelFor(relationship.type);
},
inverseMap: Ember.computed(function () {
return new ember$data$lib$system$empty$object$$default();
}),
/**
Find the relationship which is the inverse of the one asked for.
For example, if you define models like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('message')
});
```
```app/models/message.js
import DS from 'ember-data';
export default DS.Model.extend({
owner: DS.belongsTo('post')
});
```
App.Post.inverseFor('comments') -> { type: App.Message, name: 'owner', kind: 'belongsTo' }
App.Message.inverseFor('owner') -> { type: App.Post, name: 'comments', kind: 'hasMany' }
@method inverseFor
@static
@param {String} name the name of the relationship
@return {Object} the inverse relationship, or null
*/
inverseFor: function (name, store) {
var inverseMap = ember$data$lib$system$relationships$ext$$get(this, 'inverseMap');
if (inverseMap[name]) {
return inverseMap[name];
} else {
var inverse = this._findInverseFor(name, store);
inverseMap[name] = inverse;
return inverse;
}
},
//Calculate the inverse, ignoring the cache
_findInverseFor: function (name, store) {
var inverseType = this.typeForRelationship(name, store);
if (!inverseType) {
return null;
}
var propertyMeta = this.metaForProperty(name);
//If inverse is manually specified to be null, like `comments: DS.hasMany('message', { inverse: null })`
var options = propertyMeta.options;
if (options.inverse === null) {
return null;
}
var inverseName, inverseKind, inverse;
//If inverse is specified manually, return the inverse
if (options.inverse) {
inverseName = options.inverse;
inverse = Ember.get(inverseType, 'relationshipsByName').get(inverseName);
inverseKind = inverse.kind;
} else {
//No inverse was specified manually, we need to use a heuristic to guess one
if (propertyMeta.type === propertyMeta.parentType.modelName) {
}
var possibleRelationships = findPossibleInverses(this, inverseType);
if (possibleRelationships.length === 0) {
return null;
}
var filteredRelationships = ember$data$lib$system$relationships$ext$$filter.call(possibleRelationships, function (possibleRelationship) {
var optionsForRelationship = inverseType.metaForProperty(possibleRelationship.name).options;
return name === optionsForRelationship.inverse;
});
if (filteredRelationships.length === 1) {
possibleRelationships = filteredRelationships;
}
inverseName = possibleRelationships[0].name;
inverseKind = possibleRelationships[0].kind;
}
function findPossibleInverses(type, inverseType, relationshipsSoFar) {
var possibleRelationships = relationshipsSoFar || [];
var relationshipMap = ember$data$lib$system$relationships$ext$$get(inverseType, 'relationships');
if (!relationshipMap) {
return possibleRelationships;
}
var relationships = relationshipMap.get(type.modelName);
relationships = ember$data$lib$system$relationships$ext$$filter.call(relationships, function (relationship) {
var optionsForRelationship = inverseType.metaForProperty(relationship.name).options;
if (!optionsForRelationship.inverse) {
return true;
}
return name === optionsForRelationship.inverse;
});
if (relationships) {
possibleRelationships.push.apply(possibleRelationships, relationships);
}
//Recurse to support polymorphism
if (type.superclass) {
findPossibleInverses(type.superclass, inverseType, possibleRelationships);
}
return possibleRelationships;
}
return {
type: inverseType,
name: inverseName,
kind: inverseKind
};
},
/**
The model's relationships as a map, keyed on the type of the
relationship. The value of each entry is an array containing a descriptor
for each relationship with that type, describing the name of the relationship
as well as the type.
For example, given the following model definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This computed property would return a map describing these
relationships, like this:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
var relationships = Ember.get(Blog, 'relationships');
relationships.get(App.User);
//=> [ { name: 'users', kind: 'hasMany' },
// { name: 'owner', kind: 'belongsTo' } ]
relationships.get(App.Post);
//=> [ { name: 'posts', kind: 'hasMany' } ]
```
@property relationships
@static
@type Ember.Map
@readOnly
*/
relationships: ember$data$lib$system$relationships$ext$$relationshipsDescriptor,
/**
A hash containing lists of the model's relationships, grouped
by the relationship kind. For example, given a model with this
definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This property would contain the following:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
var relationshipNames = Ember.get(Blog, 'relationshipNames');
relationshipNames.hasMany;
//=> ['users', 'posts']
relationshipNames.belongsTo;
//=> ['owner']
```
@property relationshipNames
@static
@type Object
@readOnly
*/
relationshipNames: Ember.computed(function () {
var names = {
hasMany: [],
belongsTo: []
};
this.eachComputedProperty(function (name, meta) {
if (meta.isRelationship) {
names[meta.kind].push(name);
}
});
return names;
}),
/**
An array of types directly related to a model. Each type will be
included once, regardless of the number of relationships it has with
the model.
For example, given a model with this definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This property would contain the following:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
var relatedTypes = Ember.get(Blog, 'relatedTypes');
//=> [ App.User, App.Post ]
```
@property relatedTypes
@static
@type Ember.Array
@readOnly
*/
relatedTypes: ember$data$lib$system$relationships$ext$$relatedTypesDescriptor,
/**
A map whose keys are the relationships of a model and whose values are
relationship descriptors.
For example, given a model with this
definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This property would contain the following:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
var relationshipsByName = Ember.get(Blog, 'relationshipsByName');
relationshipsByName.get('users');
//=> { key: 'users', kind: 'hasMany', type: App.User }
relationshipsByName.get('owner');
//=> { key: 'owner', kind: 'belongsTo', type: App.User }
```
@property relationshipsByName
@static
@type Ember.Map
@readOnly
*/
relationshipsByName: ember$data$lib$system$relationships$ext$$relationshipsByNameDescriptor,
/**
A map whose keys are the fields of the model and whose values are strings
describing the kind of the field. A model's fields are the union of all of its
attributes and relationships.
For example:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post'),
title: DS.attr('string')
});
```
```js
import Ember from 'ember';
import Blog from 'app/models/blog';
var fields = Ember.get(Blog, 'fields');
fields.forEach(function(kind, field) {
console.log(field, kind);
});
// prints:
// users, hasMany
// owner, belongsTo
// posts, hasMany
// title, attribute
```
@property fields
@static
@type Ember.Map
@readOnly
*/
fields: Ember.computed(function () {
var map = ember$data$lib$system$map$$Map.create();
this.eachComputedProperty(function (name, meta) {
if (meta.isRelationship) {
map.set(name, meta.kind);
} else if (meta.isAttribute) {
map.set(name, 'attribute');
}
});
return map;
}).readOnly(),
/**
Given a callback, iterates over each of the relationships in the model,
invoking the callback with the name of each relationship and its relationship
descriptor.
@method eachRelationship
@static
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelationship: function (callback, binding) {
ember$data$lib$system$relationships$ext$$get(this, 'relationshipsByName').forEach(function (relationship, name) {
callback.call(binding, name, relationship);
});
},
/**
Given a callback, iterates over each of the types related to a model,
invoking the callback with the related type's class. Each type will be
returned just once, regardless of how many different relationships it has
with a model.
@method eachRelatedType
@static
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelatedType: function (callback, binding) {
ember$data$lib$system$relationships$ext$$get(this, 'relatedTypes').forEach(function (type) {
callback.call(binding, type);
});
},
determineRelationshipType: function (knownSide, store) {
var knownKey = knownSide.key;
var knownKind = knownSide.kind;
var inverse = this.inverseFor(knownKey, store);
var key, otherKind;
if (!inverse) {
return knownKind === 'belongsTo' ? 'oneToNone' : 'manyToNone';
}
key = inverse.name;
otherKind = inverse.kind;
if (otherKind === 'belongsTo') {
return knownKind === 'belongsTo' ? 'oneToOne' : 'manyToOne';
} else {
return knownKind === 'belongsTo' ? 'oneToMany' : 'manyToMany';
}
}
});
ember$data$lib$system$model$$default.reopen({
/**
Given a callback, iterates over each of the relationships in the model,
invoking the callback with the name of each relationship and its relationship
descriptor.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(name, descriptor);
```
- `name` the name of the current property in the iteration
- `descriptor` the meta object that describes this relationship
The relationship descriptor argument is an object with the following properties.
- **key** <span class="type">String</span> the name of this relationship on the Model
- **kind** <span class="type">String</span> "hasMany" or "belongsTo"
- **options** <span class="type">Object</span> the original options hash passed when the relationship was declared
- **parentType** <span class="type">DS.Model</span> the type of the Model that owns this relationship
- **type** <span class="type">DS.Model</span> the type of the related Model
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(record, options) {
var json = {};
record.eachRelationship(function(name, descriptor) {
if (descriptor.kind === 'hasMany') {
var serializedHasManyName = name.toUpperCase() + '_IDS';
json[name.toUpperCase()] = record.get(name).mapBy('id');
}
});
return json;
}
});
```
@method eachRelationship
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelationship: function (callback, binding) {
this.constructor.eachRelationship(callback, binding);
},
relationshipFor: function (name) {
return ember$data$lib$system$relationships$ext$$get(this.constructor, 'relationshipsByName').get(name);
},
inverseFor: function (key) {
return this.constructor.inverseFor(key, this.store);
}
});
/**
Ember Data
@module ember-data
@main ember-data
*/
if (Ember.VERSION.match(/^1\.[0-7]\./)) {
throw new Ember.Error("Ember Data requires at least Ember 1.8.0, but you have " + Ember.VERSION + ". Please upgrade your version of Ember, then upgrade Ember Data");
}
if (Ember.VERSION.match(/^1\.12\.0/)) {
throw new Ember.Error("Ember Data does not work with Ember 1.12.0. Please upgrade to Ember 1.12.1 or higher.");
}
// support RSVP 2.x via resolve, but prefer RSVP 3.x's Promise.cast
Ember.RSVP.Promise.cast = Ember.RSVP.Promise.cast || Ember.RSVP.resolve;ember$data$lib$core$$default.Store = ember$data$lib$system$store$$Store;
ember$data$lib$core$$default.PromiseArray = ember$data$lib$system$promise$proxies$$PromiseArray;
ember$data$lib$core$$default.PromiseObject = ember$data$lib$system$promise$proxies$$PromiseObject;
ember$data$lib$core$$default.PromiseManyArray = ember$data$lib$system$promise$proxies$$PromiseManyArray;
ember$data$lib$core$$default.Model = ember$data$lib$system$model$$default;
ember$data$lib$core$$default.RootState = ember$data$lib$system$model$states$$default;
ember$data$lib$core$$default.attr = ember$data$lib$system$model$attributes$$default;
ember$data$lib$core$$default.Errors = ember$data$lib$system$model$errors$$default;
ember$data$lib$core$$default.InternalModel = ember$data$lib$system$model$internal$model$$default;
ember$data$lib$core$$default.Snapshot = ember$data$lib$system$snapshot$$default;
ember$data$lib$core$$default.Adapter = ember$data$lib$system$adapter$$default;
ember$data$lib$core$$default.AdapterError = ember$data$lib$adapters$errors$$AdapterError;
ember$data$lib$core$$default.InvalidError = ember$data$lib$adapters$errors$$InvalidError;
ember$data$lib$core$$default.TimeoutError = ember$data$lib$adapters$errors$$TimeoutError;
ember$data$lib$core$$default.AbortError = ember$data$lib$adapters$errors$$AbortError;
ember$data$lib$core$$default.errorsHashToArray = ember$data$lib$adapters$errors$$errorsHashToArray;
ember$data$lib$core$$default.errorsArrayToHash = ember$data$lib$adapters$errors$$errorsArrayToHash;
ember$data$lib$core$$default.Serializer = ember$data$lib$system$serializer$$default;
ember$data$lib$core$$default.DebugAdapter = ember$data$lib$system$debug$$default;
ember$data$lib$core$$default.RecordArray = ember$data$lib$system$record$arrays$record$array$$default;
ember$data$lib$core$$default.FilteredRecordArray = ember$data$lib$system$record$arrays$filtered$record$array$$default;
ember$data$lib$core$$default.AdapterPopulatedRecordArray = ember$data$lib$system$record$arrays$adapter$populated$record$array$$default;
ember$data$lib$core$$default.ManyArray = ember$data$lib$system$many$array$$default;
ember$data$lib$core$$default.RecordArrayManager = ember$data$lib$system$record$array$manager$$default;
ember$data$lib$core$$default.RESTAdapter = ember$data$lib$adapters$rest$adapter$$default;
ember$data$lib$core$$default.BuildURLMixin = ember$data$lib$adapters$build$url$mixin$$default;
ember$data$lib$core$$default.RESTSerializer = ember$data$lib$serializers$rest$serializer$$default;
ember$data$lib$core$$default.JSONSerializer = ember$data$lib$serializers$json$serializer$$default;
ember$data$lib$core$$default.JSONAPIAdapter = ember$data$lib$adapters$json$api$adapter$$default;
ember$data$lib$core$$default.JSONAPISerializer = ember$data$lib$serializers$json$api$serializer$$default;
ember$data$lib$core$$default.Transform = ember$data$lib$transforms$base$$default;
ember$data$lib$core$$default.DateTransform = ember$data$lib$transforms$date$$default;
ember$data$lib$core$$default.StringTransform = ember$data$lib$transforms$string$$default;
ember$data$lib$core$$default.NumberTransform = ember$data$lib$transforms$number$$default;
ember$data$lib$core$$default.BooleanTransform = ember$data$lib$transforms$boolean$$default;
var ember$data$lib$main$$_ActiveModelAdapter = activemodel$adapter$lib$system$active$model$adapter$$default;
var ember$data$lib$main$$_ActiveModelSerializer = activemodel$adapter$lib$system$active$model$serializer$$default;
if (Ember.platform.hasPropertyAccessors) {
Ember.defineProperty(ember$data$lib$core$$default, 'ActiveModelAdapter', {
get: function () {
if (ember$data$lib$main$$_ActiveModelSerializer === activemodel$adapter$lib$system$active$model$adapter$$default) {
}
return ember$data$lib$main$$_ActiveModelAdapter;
},
set: function (ActiveModelAdapter) {
ember$data$lib$main$$_ActiveModelAdapter = ActiveModelAdapter;
}
});
Ember.defineProperty(ember$data$lib$core$$default, 'ActiveModelSerializer', {
get: function () {
if (ember$data$lib$main$$_ActiveModelSerializer === activemodel$adapter$lib$system$active$model$serializer$$default) {
}
return ember$data$lib$main$$_ActiveModelSerializer;
},
set: function (ActiveModelSerializer) {
ember$data$lib$main$$_ActiveModelSerializer = ActiveModelSerializer;
}
});
} else {
ember$data$lib$core$$default.ActiveModelAdapter = activemodel$adapter$lib$system$active$model$adapter$$default;
ember$data$lib$core$$default.ActiveModelSerializer = activemodel$adapter$lib$system$active$model$serializer$$default;
}
ember$data$lib$core$$default.EmbeddedRecordsMixin = ember$data$lib$serializers$embedded$records$mixin$$default;
ember$data$lib$core$$default.belongsTo = ember$data$lib$system$relationships$belongs$to$$default;
ember$data$lib$core$$default.hasMany = ember$data$lib$system$relationships$has$many$$default;
ember$data$lib$core$$default.Relationship = ember$data$lib$system$relationships$state$relationship$$default;
ember$data$lib$core$$default.ContainerProxy = ember$data$lib$system$container$proxy$$default;
ember$data$lib$core$$default._setupContainer = ember$data$lib$setup$container$$default;
Ember.defineProperty(ember$data$lib$core$$default, 'normalizeModelName', {
enumerable: true,
writable: false,
configurable: false,
value: ember$data$lib$system$normalize$model$name$$default
});
var ember$data$lib$main$$_FixtureAdapter = ember$data$lib$adapters$fixture$adapter$$default;
if (Ember.platform.hasPropertyAccessors) {
Ember.defineProperty(ember$data$lib$core$$default, 'FixtureAdapter', {
get: function () {
if (ember$data$lib$main$$_FixtureAdapter === ember$data$lib$adapters$fixture$adapter$$default) {
}
return ember$data$lib$main$$_FixtureAdapter;
},
set: function (FixtureAdapter) {
ember$data$lib$main$$_FixtureAdapter = FixtureAdapter;
}
});
} else {
ember$data$lib$core$$default.FixtureAdapter = ember$data$lib$adapters$fixture$adapter$$default;
}
Ember.lookup.DS = ember$data$lib$core$$default;
var ember$data$lib$main$$default = ember$data$lib$core$$default;
var ember$inflector$lib$lib$utils$make$helper$$default = ember$inflector$lib$lib$utils$make$helper$$makeHelper;
function ember$inflector$lib$lib$utils$make$helper$$makeHelper(helperFunction) {
if (ember$lib$main$$default.Helper) {
return ember$lib$main$$default.Helper.helper(helperFunction);
}
if (ember$lib$main$$default.HTMLBars) {
return ember$lib$main$$default.HTMLBars.makeBoundHelper(helperFunction);
}
return ember$lib$main$$default.Handlebars.makeBoundHelper(helperFunction);
}
var ember$inflector$lib$lib$helpers$pluralize$$default = ember$inflector$lib$lib$utils$make$helper$$default(function (params) {
var count, word;
if (params.length === 1) {
word = params[0];
return ember$inflector$lib$lib$system$string$$pluralize(word);
} else {
count = params[0];
word = params[1];
if ((count | 0) !== 1) {
word = ember$inflector$lib$lib$system$string$$pluralize(word);
}
return count + " " + word;
}
});
var ember$inflector$lib$lib$helpers$singularize$$default = ember$inflector$lib$lib$utils$make$helper$$default(function (params) {
return ember$inflector$lib$lib$system$string$$singularize(params[0]);
});
}).call(this);
|
ajax/libs/angular-google-maps/1.0.17/angular-google-maps.js | cloudrifles/cdnjs | /*! angular-google-maps 1.0.17 2014-03-30
* AngularJS directives for Google Maps
* git: https://github.com/nlaplante/angular-google-maps.git
*/
(function() {
angular.element(document).ready(function() {
if (!(google || (typeof google !== "undefined" && google !== null ? google.maps : void 0) || (google.maps.InfoWindow != null))) {
return;
}
google.maps.InfoWindow.prototype._open = google.maps.InfoWindow.prototype.open;
google.maps.InfoWindow.prototype._close = google.maps.InfoWindow.prototype.close;
google.maps.InfoWindow.prototype._isOpen = false;
google.maps.InfoWindow.prototype.open = function(map, anchor) {
this._isOpen = true;
this._open(map, anchor);
};
google.maps.InfoWindow.prototype.close = function() {
this._isOpen = false;
this._close();
};
google.maps.InfoWindow.prototype.isOpen = function(val) {
if (val == null) {
val = void 0;
}
if (val == null) {
return this._isOpen;
} else {
return this._isOpen = val;
}
};
/*
Do the same for InfoBox
TODO: Clean this up so the logic is defined once, wait until develop becomes master as this will be easier
*/
if (!window.InfoBox) {
return;
}
window.InfoBox.prototype._open = window.InfoBox.prototype.open;
window.InfoBox.prototype._close = window.InfoBox.prototype.close;
window.InfoBox.prototype._isOpen = false;
window.InfoBox.prototype.open = function(map, anchor) {
this._isOpen = true;
this._open(map, anchor);
};
window.InfoBox.prototype.close = function() {
this._isOpen = false;
this._close();
};
return window.InfoBox.prototype.isOpen = function(val) {
if (val == null) {
val = void 0;
}
if (val == null) {
return this._isOpen;
} else {
return this._isOpen = val;
}
};
});
}).call(this);
/*
Author Nick McCready
Intersection of Objects if the arrays have something in common each intersecting object will be returned
in an new array.
*/
(function() {
_.intersectionObjects = function(array1, array2, comparison) {
var res,
_this = this;
if (comparison == null) {
comparison = void 0;
}
res = _.map(array1, function(obj1) {
return _.find(array2, function(obj2) {
if (comparison != null) {
return comparison(obj1, obj2);
} else {
return _.isEqual(obj1, obj2);
}
});
});
return _.filter(res, function(o) {
return o != null;
});
};
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
(function() {
(function() {
var app;
app = angular.module("google-maps", []);
return app.factory("debounce", [
"$timeout", function($timeout) {
return function(fn) {
var nthCall;
nthCall = 0;
return function() {
var argz, later, that;
that = this;
argz = arguments;
nthCall++;
later = (function(version) {
return function() {
if (version === nthCall) {
return fn.apply(that, argz);
}
};
})(nthCall);
return $timeout(later, 0, true);
};
};
}
]);
})();
}).call(this);
(function() {
this.ngGmapModule = function(names, fn) {
var space, _name;
if (fn == null) {
fn = function() {};
}
if (typeof names === 'string') {
names = names.split('.');
}
space = this[_name = names.shift()] || (this[_name] = {});
space.ngGmapModule || (space.ngGmapModule = this.ngGmapModule);
if (names.length) {
return space.ngGmapModule(names, fn);
} else {
return fn.call(space);
}
};
}).call(this);
(function() {
angular.module("google-maps").factory("array-sync", [
"add-events", function(mapEvents) {
var LatLngArraySync;
return LatLngArraySync = function(mapArray, scope, pathEval) {
var isSetFromScope, mapArrayListener, scopeArray, watchListener;
isSetFromScope = false;
scopeArray = scope.$eval(pathEval);
mapArrayListener = mapEvents(mapArray, {
set_at: function(index) {
var value;
if (isSetFromScope) {
return;
}
value = mapArray.getAt(index);
if (!value) {
return;
}
if (!value.lng || !value.lat) {
return;
}
scopeArray[index].latitude = value.lat();
return scopeArray[index].longitude = value.lng();
},
insert_at: function(index) {
var value;
if (isSetFromScope) {
return;
}
value = mapArray.getAt(index);
if (!value) {
return;
}
if (!value.lng || !value.lat) {
return;
}
return scopeArray.splice(index, 0, {
latitude: value.lat(),
longitude: value.lng()
});
},
remove_at: function(index) {
if (isSetFromScope) {
return;
}
return scopeArray.splice(index, 1);
}
});
watchListener = scope.$watchCollection(pathEval, function(newArray) {
var i, l, newLength, newValue, oldArray, oldLength, oldValue;
isSetFromScope = true;
oldArray = mapArray;
if (newArray) {
i = 0;
oldLength = oldArray.getLength();
newLength = newArray.length;
l = Math.min(oldLength, newLength);
newValue = void 0;
while (i < l) {
oldValue = oldArray.getAt(i);
newValue = newArray[i];
if ((oldValue.lat() !== newValue.latitude) || (oldValue.lng() !== newValue.longitude)) {
oldArray.setAt(i, new google.maps.LatLng(newValue.latitude, newValue.longitude));
}
i++;
}
while (i < newLength) {
newValue = newArray[i];
oldArray.push(new google.maps.LatLng(newValue.latitude, newValue.longitude));
i++;
}
while (i < oldLength) {
oldArray.pop();
i++;
}
}
return isSetFromScope = false;
});
return function() {
if (mapArrayListener) {
mapArrayListener();
mapArrayListener = null;
}
if (watchListener) {
watchListener();
return watchListener = null;
}
};
};
}
]);
}).call(this);
(function() {
angular.module("google-maps").factory("add-events", [
"$timeout", function($timeout) {
var addEvent, addEvents;
addEvent = function(target, eventName, handler) {
return google.maps.event.addListener(target, eventName, function() {
handler.apply(this, arguments);
return $timeout((function() {}), true);
});
};
addEvents = function(target, eventName, handler) {
var remove;
if (handler) {
return addEvent(target, eventName, handler);
}
remove = [];
angular.forEach(eventName, function(_handler, key) {
return remove.push(addEvent(target, key, _handler));
});
return function() {
angular.forEach(remove, function(fn) {
if (_.isFunction(fn)) {
fn();
}
if (fn.e !== null && _.isFunction(fn.e)) {
return fn.e();
}
});
return remove = null;
};
};
return addEvents;
}
]);
}).call(this);
(function() {
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
this.ngGmapModule("oo", function() {
var baseObjectKeywords;
baseObjectKeywords = ['extended', 'included'];
return this.BaseObject = (function() {
function BaseObject() {}
BaseObject.extend = function(obj) {
var key, value, _ref;
for (key in obj) {
value = obj[key];
if (__indexOf.call(baseObjectKeywords, key) < 0) {
this[key] = value;
}
}
if ((_ref = obj.extended) != null) {
_ref.apply(0);
}
return this;
};
BaseObject.include = function(obj) {
var key, value, _ref;
for (key in obj) {
value = obj[key];
if (__indexOf.call(baseObjectKeywords, key) < 0) {
this.prototype[key] = value;
}
}
if ((_ref = obj.included) != null) {
_ref.apply(0);
}
return this;
};
return BaseObject;
})();
});
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api.managers", function() {
return this.ClustererMarkerManager = (function(_super) {
__extends(ClustererMarkerManager, _super);
function ClustererMarkerManager(gMap, opt_markers, opt_options) {
this.clear = __bind(this.clear, this);
this.draw = __bind(this.draw, this);
this.removeMany = __bind(this.removeMany, this);
this.remove = __bind(this.remove, this);
this.addMany = __bind(this.addMany, this);
this.add = __bind(this.add, this);
var self;
ClustererMarkerManager.__super__.constructor.call(this);
self = this;
this.opt_options = opt_options;
if ((opt_options != null) && opt_markers === void 0) {
this.clusterer = new MarkerClusterer(gMap, void 0, opt_options);
} else if ((opt_options != null) && (opt_markers != null)) {
this.clusterer = new MarkerClusterer(gMap, opt_markers, opt_options);
} else {
this.clusterer = new MarkerClusterer(gMap);
}
this.clusterer.setIgnoreHidden(true);
this.$log = directives.api.utils.Logger;
this.noDrawOnSingleAddRemoves = true;
this.$log.info(this);
}
ClustererMarkerManager.prototype.add = function(gMarker) {
return this.clusterer.addMarker(gMarker, this.noDrawOnSingleAddRemoves);
};
ClustererMarkerManager.prototype.addMany = function(gMarkers) {
return this.clusterer.addMarkers(gMarkers);
};
ClustererMarkerManager.prototype.remove = function(gMarker) {
return this.clusterer.removeMarker(gMarker, this.noDrawOnSingleAddRemoves);
};
ClustererMarkerManager.prototype.removeMany = function(gMarkers) {
return this.clusterer.addMarkers(gMarkers);
};
ClustererMarkerManager.prototype.draw = function() {
return this.clusterer.repaint();
};
ClustererMarkerManager.prototype.clear = function() {
this.clusterer.clearMarkers();
return this.clusterer.repaint();
};
return ClustererMarkerManager;
})(oo.BaseObject);
});
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api.managers", function() {
return this.MarkerManager = (function(_super) {
__extends(MarkerManager, _super);
function MarkerManager(gMap, opt_markers, opt_options) {
this.handleOptDraw = __bind(this.handleOptDraw, this);
this.clear = __bind(this.clear, this);
this.draw = __bind(this.draw, this);
this.removeMany = __bind(this.removeMany, this);
this.remove = __bind(this.remove, this);
this.addMany = __bind(this.addMany, this);
this.add = __bind(this.add, this);
var self;
MarkerManager.__super__.constructor.call(this);
self = this;
this.gMap = gMap;
this.gMarkers = [];
this.$log = directives.api.utils.Logger;
this.$log.info(this);
}
MarkerManager.prototype.add = function(gMarker, optDraw) {
this.handleOptDraw(gMarker, optDraw, true);
return this.gMarkers.push(gMarker);
};
MarkerManager.prototype.addMany = function(gMarkers) {
var gMarker, _i, _len, _results;
_results = [];
for (_i = 0, _len = gMarkers.length; _i < _len; _i++) {
gMarker = gMarkers[_i];
_results.push(this.add(gMarker));
}
return _results;
};
MarkerManager.prototype.remove = function(gMarker, optDraw) {
var index, tempIndex;
this.handleOptDraw(gMarker, optDraw, false);
if (!optDraw) {
return;
}
index = void 0;
if (this.gMarkers.indexOf != null) {
index = this.gMarkers.indexOf(gMarker);
} else {
tempIndex = 0;
_.find(this.gMarkers, function(marker) {
tempIndex += 1;
if (marker === gMarker) {
index = tempIndex;
}
});
}
if (index != null) {
return this.gMarkers.splice(index, 1);
}
};
MarkerManager.prototype.removeMany = function(gMarkers) {
var marker, _i, _len, _ref, _results;
_ref = this.gMarkers;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
marker = _ref[_i];
_results.push(this.remove(marker));
}
return _results;
};
MarkerManager.prototype.draw = function() {
var deletes, gMarker, _fn, _i, _j, _len, _len1, _ref, _results,
_this = this;
deletes = [];
_ref = this.gMarkers;
_fn = function(gMarker) {
if (!gMarker.isDrawn) {
if (gMarker.doAdd) {
return gMarker.setMap(_this.gMap);
} else {
return deletes.push(gMarker);
}
}
};
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
gMarker = _ref[_i];
_fn(gMarker);
}
_results = [];
for (_j = 0, _len1 = deletes.length; _j < _len1; _j++) {
gMarker = deletes[_j];
_results.push(this.remove(gMarker, true));
}
return _results;
};
MarkerManager.prototype.clear = function() {
var gMarker, _i, _len, _ref;
_ref = this.gMarkers;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
gMarker = _ref[_i];
gMarker.setMap(null);
}
delete this.gMarkers;
return this.gMarkers = [];
};
MarkerManager.prototype.handleOptDraw = function(gMarker, optDraw, doAdd) {
if (optDraw === true) {
if (doAdd) {
gMarker.setMap(this.gMap);
} else {
gMarker.setMap(null);
}
return gMarker.isDrawn = true;
} else {
gMarker.isDrawn = false;
return gMarker.doAdd = doAdd;
}
};
return MarkerManager;
})(oo.BaseObject);
});
}).call(this);
/*
Author: Nicholas McCready & jfriend00
AsyncProcessor handles things asynchronous-like :), to allow the UI to be free'd to do other things
Code taken from http://stackoverflow.com/questions/10344498/best-way-to-iterate-over-an-array-without-blocking-the-ui
*/
(function() {
this.ngGmapModule("directives.api.utils", function() {
return this.AsyncProcessor = {
handleLargeArray: function(array, callback, pausedCallBack, doneCallBack, chunk, index) {
var doChunk;
if (chunk == null) {
chunk = 100;
}
if (index == null) {
index = 0;
}
if (array === void 0 || array.length <= 0) {
doneCallBack();
return;
}
doChunk = function() {
var cnt, i;
cnt = chunk;
i = index;
while (cnt-- && i < array.length) {
callback(array[i]);
++i;
}
if (i < array.length) {
index = i;
if (pausedCallBack != null) {
pausedCallBack();
}
return setTimeout(doChunk, 1);
} else {
return doneCallBack();
}
};
return doChunk();
}
};
});
}).call(this);
/*
Useful function callbacks that should be defined at later time.
Mainly to be used for specs to verify creation / linking.
This is to lead a common design in notifying child stuff.
*/
(function() {
this.ngGmapModule("directives.api.utils", function() {
return this.ChildEvents = {
onChildCreation: function(child) {}
};
});
}).call(this);
(function() {
this.ngGmapModule("directives.api.utils", function() {
return this.GmapUtil = {
getLabelPositionPoint: function(anchor) {
var xPos, yPos;
if (anchor === void 0) {
return void 0;
}
anchor = /^([\d\.]+)\s([\d\.]+)$/.exec(anchor);
xPos = anchor[1];
yPos = anchor[2];
if (xPos && yPos) {
return new google.maps.Point(xPos, yPos);
}
},
createMarkerOptions: function(coords, icon, defaults, map) {
var opts;
if (map == null) {
map = void 0;
}
if (defaults == null) {
defaults = {};
}
opts = angular.extend({}, defaults, {
position: defaults.position != null ? defaults.position : new google.maps.LatLng(coords.latitude, coords.longitude),
icon: defaults.icon != null ? defaults.icon : icon,
visible: defaults.visible != null ? defaults.visible : (coords.latitude != null) && (coords.longitude != null)
});
if (map != null) {
opts.map = map;
}
return opts;
},
createWindowOptions: function(gMarker, scope, content, defaults) {
if ((content != null) && (defaults != null)) {
return angular.extend({}, defaults, {
content: defaults.content != null ? defaults.content : content,
position: defaults.position != null ? defaults.position : angular.isObject(gMarker) ? gMarker.getPosition() : new google.maps.LatLng(scope.coords.latitude, scope.coords.longitude)
});
} else {
if (!defaults) {
} else {
return defaults;
}
}
},
defaultDelay: 50
};
});
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api.utils", function() {
return this.Linked = (function(_super) {
__extends(Linked, _super);
function Linked(scope, element, attrs, ctrls) {
this.scope = scope;
this.element = element;
this.attrs = attrs;
this.ctrls = ctrls;
}
return Linked;
})(oo.BaseObject);
});
}).call(this);
(function() {
this.ngGmapModule("directives.api.utils", function() {
var logger;
this.Logger = {
logger: void 0,
doLog: false,
info: function(msg) {
if (logger.doLog) {
if (logger.logger != null) {
return logger.logger.info(msg);
} else {
return console.info(msg);
}
}
},
error: function(msg) {
if (logger.doLog) {
if (logger.logger != null) {
return logger.logger.error(msg);
} else {
return console.error(msg);
}
}
}
};
return logger = this.Logger;
});
}).call(this);
(function() {
this.ngGmapModule("directives.api.utils", function() {
return this.ModelsWatcher = {
didModelsChange: function(newValue, oldValue) {
var didModelsChange, hasIntersectionDiff;
if (!_.isArray(newValue)) {
directives.api.utils.Logger.error("models property must be an array newValue of: " + (newValue.toString()) + " is not!!");
return false;
}
if (newValue === oldValue) {
return false;
}
hasIntersectionDiff = _.intersectionObjects(newValue, oldValue).length !== oldValue.length;
didModelsChange = true;
if (!hasIntersectionDiff) {
didModelsChange = newValue.length !== oldValue.length;
}
return didModelsChange;
}
};
});
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api.models.child", function() {
return this.MarkerLabelChildModel = (function(_super) {
__extends(MarkerLabelChildModel, _super);
MarkerLabelChildModel.include(directives.api.utils.GmapUtil);
function MarkerLabelChildModel(gMarker, opt_options) {
this.destroy = __bind(this.destroy, this);
this.draw = __bind(this.draw, this);
this.setPosition = __bind(this.setPosition, this);
this.setZIndex = __bind(this.setZIndex, this);
this.setVisible = __bind(this.setVisible, this);
this.setAnchor = __bind(this.setAnchor, this);
this.setMandatoryStyles = __bind(this.setMandatoryStyles, this);
this.setStyles = __bind(this.setStyles, this);
this.setContent = __bind(this.setContent, this);
this.setTitle = __bind(this.setTitle, this);
this.getSharedCross = __bind(this.getSharedCross, this);
var self, _ref, _ref1;
MarkerLabelChildModel.__super__.constructor.call(this);
self = this;
this.marker = gMarker;
this.marker.set("labelContent", opt_options.labelContent);
this.marker.set("labelAnchor", this.getLabelPositionPoint(opt_options.labelAnchor));
this.marker.set("labelClass", opt_options.labelClass || 'labels');
this.marker.set("labelStyle", opt_options.labelStyle || {
opacity: 100
});
this.marker.set("labelInBackground", opt_options.labelInBackground || false);
if (!opt_options.labelVisible) {
this.marker.set("labelVisible", true);
}
if (!opt_options.raiseOnDrag) {
this.marker.set("raiseOnDrag", true);
}
if (!opt_options.clickable) {
this.marker.set("clickable", true);
}
if (!opt_options.draggable) {
this.marker.set("draggable", false);
}
if (!opt_options.optimized) {
this.marker.set("optimized", false);
}
opt_options.crossImage = (_ref = opt_options.crossImage) != null ? _ref : document.location.protocol + "//maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png";
opt_options.handCursor = (_ref1 = opt_options.handCursor) != null ? _ref1 : document.location.protocol + "//maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur";
this.markerLabel = new MarkerLabel_(this.marker, opt_options.crossImage, opt_options.handCursor);
this.marker.set("setMap", function(theMap) {
google.maps.Marker.prototype.setMap.apply(this, arguments);
return self.markerLabel.setMap(theMap);
});
this.marker.setMap(this.marker.getMap());
}
MarkerLabelChildModel.prototype.getSharedCross = function(crossUrl) {
return this.markerLabel.getSharedCross(crossUrl);
};
MarkerLabelChildModel.prototype.setTitle = function() {
return this.markerLabel.setTitle();
};
MarkerLabelChildModel.prototype.setContent = function() {
return this.markerLabel.setContent();
};
MarkerLabelChildModel.prototype.setStyles = function() {
return this.markerLabel.setStyles();
};
MarkerLabelChildModel.prototype.setMandatoryStyles = function() {
return this.markerLabel.setMandatoryStyles();
};
MarkerLabelChildModel.prototype.setAnchor = function() {
return this.markerLabel.setAnchor();
};
MarkerLabelChildModel.prototype.setVisible = function() {
return this.markerLabel.setVisible();
};
MarkerLabelChildModel.prototype.setZIndex = function() {
return this.markerLabel.setZIndex();
};
MarkerLabelChildModel.prototype.setPosition = function() {
return this.markerLabel.setPosition();
};
MarkerLabelChildModel.prototype.draw = function() {
return this.markerLabel.draw();
};
MarkerLabelChildModel.prototype.destroy = function() {
if ((this.markerLabel.labelDiv_.parentNode != null) && (this.markerLabel.eventDiv_.parentNode != null)) {
return this.markerLabel.onRemove();
}
};
return MarkerLabelChildModel;
})(oo.BaseObject);
});
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api.models.child", function() {
return this.MarkerChildModel = (function(_super) {
__extends(MarkerChildModel, _super);
MarkerChildModel.include(directives.api.utils.GmapUtil);
function MarkerChildModel(index, model, parentScope, gMap, $timeout, defaults, doClick, gMarkerManager) {
var self,
_this = this;
this.index = index;
this.model = model;
this.parentScope = parentScope;
this.gMap = gMap;
this.defaults = defaults;
this.doClick = doClick;
this.gMarkerManager = gMarkerManager;
this.watchDestroy = __bind(this.watchDestroy, this);
this.setLabelOptions = __bind(this.setLabelOptions, this);
this.isLabelDefined = __bind(this.isLabelDefined, this);
this.setOptions = __bind(this.setOptions, this);
this.setIcon = __bind(this.setIcon, this);
this.setCoords = __bind(this.setCoords, this);
this.destroy = __bind(this.destroy, this);
this.maybeSetScopeValue = __bind(this.maybeSetScopeValue, this);
this.createMarker = __bind(this.createMarker, this);
this.setMyScope = __bind(this.setMyScope, this);
self = this;
this.iconKey = this.parentScope.icon;
this.coordsKey = this.parentScope.coords;
this.clickKey = this.parentScope.click();
this.labelContentKey = this.parentScope.labelContent;
this.optionsKey = this.parentScope.options;
this.labelOptionsKey = this.parentScope.labelOptions;
this.myScope = this.parentScope.$new(false);
this.myScope.model = this.model;
this.setMyScope(this.model, void 0, true);
this.createMarker(this.model);
this.myScope.$watch('model', function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.setMyScope(newValue, oldValue);
}
}, true);
this.$log = directives.api.utils.Logger;
this.$log.info(self);
this.watchDestroy(this.myScope);
}
MarkerChildModel.prototype.setMyScope = function(model, oldModel, isInit) {
if (oldModel == null) {
oldModel = void 0;
}
if (isInit == null) {
isInit = false;
}
this.maybeSetScopeValue('icon', model, oldModel, this.iconKey, this.evalModelHandle, isInit, this.setIcon);
this.maybeSetScopeValue('coords', model, oldModel, this.coordsKey, this.evalModelHandle, isInit, this.setCoords);
this.maybeSetScopeValue('labelContent', model, oldModel, this.labelContentKey, this.evalModelHandle, isInit);
this.maybeSetScopeValue('click', model, oldModel, this.clickKey, this.evalModelHandle, isInit);
return this.createMarker(model, oldModel, isInit);
};
MarkerChildModel.prototype.createMarker = function(model, oldModel, isInit) {
var _this = this;
if (oldModel == null) {
oldModel = void 0;
}
if (isInit == null) {
isInit = false;
}
return this.maybeSetScopeValue('options', model, oldModel, this.optionsKey, function(lModel, lModelKey) {
var value;
if (lModel === void 0) {
return void 0;
}
value = lModelKey === 'self' ? lModel : lModel[lModelKey];
if (value === void 0) {
return value = lModelKey === void 0 ? _this.defaults : _this.myScope.options;
} else {
return value;
}
}, isInit, this.setOptions);
};
MarkerChildModel.prototype.evalModelHandle = function(model, modelKey) {
if (model === void 0) {
return void 0;
}
if (modelKey === 'self') {
return model;
} else {
return model[modelKey];
}
};
MarkerChildModel.prototype.maybeSetScopeValue = function(scopePropName, model, oldModel, modelKey, evaluate, isInit, gSetter) {
var newValue, oldVal;
if (gSetter == null) {
gSetter = void 0;
}
if (oldModel === void 0) {
this.myScope[scopePropName] = evaluate(model, modelKey);
if (!isInit) {
if (gSetter != null) {
gSetter(this.myScope);
}
}
return;
}
oldVal = evaluate(oldModel, modelKey);
newValue = evaluate(model, modelKey);
if (newValue !== oldVal && this.myScope[scopePropName] !== newValue) {
this.myScope[scopePropName] = newValue;
if (!isInit) {
if (gSetter != null) {
gSetter(this.myScope);
}
return this.gMarkerManager.draw();
}
}
};
MarkerChildModel.prototype.destroy = function() {
return this.myScope.$destroy();
};
MarkerChildModel.prototype.setCoords = function(scope) {
if (scope.$id !== this.myScope.$id || this.gMarker === void 0) {
return;
}
if ((scope.coords != null)) {
if ((this.scope.coords.latitude == null) || (this.scope.coords.longitude == null)) {
this.$log.error("MarkerChildMarker cannot render marker as scope.coords as no position on marker: " + (JSON.stringify(this.model)));
return;
}
this.gMarker.setPosition(new google.maps.LatLng(scope.coords.latitude, scope.coords.longitude));
this.gMarker.setVisible((scope.coords.latitude != null) && (scope.coords.longitude != null));
this.gMarkerManager.remove(this.gMarker);
return this.gMarkerManager.add(this.gMarker);
} else {
return this.gMarkerManager.remove(this.gMarker);
}
};
MarkerChildModel.prototype.setIcon = function(scope) {
if (scope.$id !== this.myScope.$id || this.gMarker === void 0) {
return;
}
this.gMarkerManager.remove(this.gMarker);
this.gMarker.setIcon(scope.icon);
this.gMarkerManager.add(this.gMarker);
this.gMarker.setPosition(new google.maps.LatLng(scope.coords.latitude, scope.coords.longitude));
return this.gMarker.setVisible(scope.coords.latitude && (scope.coords.longitude != null));
};
MarkerChildModel.prototype.setOptions = function(scope) {
var _ref,
_this = this;
if (scope.$id !== this.myScope.$id) {
return;
}
if (this.gMarker != null) {
this.gMarkerManager.remove(this.gMarker);
delete this.gMarker;
}
if (!((_ref = scope.coords) != null ? _ref : typeof scope.icon === "function" ? scope.icon(scope.options != null) : void 0)) {
return;
}
this.opts = this.createMarkerOptions(scope.coords, scope.icon, scope.options);
delete this.gMarker;
if (this.isLabelDefined(scope)) {
this.gMarker = new MarkerWithLabel(this.setLabelOptions(this.opts, scope));
} else {
this.gMarker = new google.maps.Marker(this.opts);
}
this.gMarkerManager.add(this.gMarker);
return google.maps.event.addListener(this.gMarker, 'click', function() {
if (_this.doClick && (_this.myScope.click != null)) {
return _this.myScope.click();
}
});
};
MarkerChildModel.prototype.isLabelDefined = function(scope) {
return scope.labelContent != null;
};
MarkerChildModel.prototype.setLabelOptions = function(opts, scope) {
opts.labelAnchor = this.getLabelPositionPoint(scope.labelAnchor);
opts.labelClass = scope.labelClass;
opts.labelContent = scope.labelContent;
return opts;
};
MarkerChildModel.prototype.watchDestroy = function(scope) {
var _this = this;
return scope.$on("$destroy", function() {
var self;
if (_this.gMarker != null) {
_this.gMarkerManager.remove(_this.gMarker);
delete _this.gMarker;
}
return self = void 0;
});
};
return MarkerChildModel;
})(oo.BaseObject);
});
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api.models.child", function() {
return this.WindowChildModel = (function(_super) {
__extends(WindowChildModel, _super);
WindowChildModel.include(directives.api.utils.GmapUtil);
function WindowChildModel(scope, opts, isIconVisibleOnClick, mapCtrl, markerCtrl, $http, $templateCache, $compile, element, needToManualDestroy) {
this.element = element;
if (needToManualDestroy == null) {
needToManualDestroy = false;
}
this.destroy = __bind(this.destroy, this);
this.hideWindow = __bind(this.hideWindow, this);
this.getLatestPosition = __bind(this.getLatestPosition, this);
this.showWindow = __bind(this.showWindow, this);
this.handleClick = __bind(this.handleClick, this);
this.watchCoords = __bind(this.watchCoords, this);
this.watchShow = __bind(this.watchShow, this);
this.createGWin = __bind(this.createGWin, this);
this.scope = scope;
this.googleMapsHandles = [];
this.opts = opts;
this.mapCtrl = mapCtrl;
this.markerCtrl = markerCtrl;
this.isIconVisibleOnClick = isIconVisibleOnClick;
this.initialMarkerVisibility = this.markerCtrl != null ? this.markerCtrl.getVisible() : false;
this.$log = directives.api.utils.Logger;
this.$http = $http;
this.$templateCache = $templateCache;
this.$compile = $compile;
this.createGWin();
if (this.markerCtrl != null) {
this.markerCtrl.setClickable(true);
}
this.handleClick();
this.watchShow();
this.watchCoords();
this.needToManualDestroy = needToManualDestroy;
this.$log.info(this);
}
WindowChildModel.prototype.createGWin = function() {
var defaults, html,
_this = this;
if ((this.gWin == null) && (this.markerCtrl != null)) {
defaults = this.opts != null ? this.opts : {};
html = (this.element != null) && _.isFunction(this.element.html) ? this.element.html() : this.element;
this.opts = this.markerCtrl != null ? this.createWindowOptions(this.markerCtrl, this.scope, html, defaults) : {};
}
if ((this.opts != null) && this.gWin === void 0) {
if (this.opts.boxClass && (window.InfoBox && typeof window.InfoBox === 'function')) {
this.gWin = new window.InfoBox(this.opts);
} else {
this.gWin = new google.maps.InfoWindow(this.opts);
}
return this.googleMapsHandles.push(google.maps.event.addListener(this.gWin, 'closeclick', function() {
if (_this.markerCtrl != null) {
_this.markerCtrl.setVisible(_this.initialMarkerVisibility);
}
_this.gWin.isOpen(false);
if (_this.scope.closeClick != null) {
return _this.scope.closeClick();
}
}));
}
};
WindowChildModel.prototype.watchShow = function() {
var _this = this;
return this.scope.$watch('show', function(newValue, oldValue) {
if (newValue) {
return _this.showWindow();
} else {
return _this.hideWindow();
}
});
};
WindowChildModel.prototype.watchCoords = function() {
var scope,
_this = this;
scope = this.markerCtrl != null ? this.scope.$parent : this.scope;
return scope.$watch('coords', function(newValue, oldValue) {
if (newValue !== oldValue) {
if (newValue == null) {
return _this.hideWindow();
} else {
if ((newValue.latitude == null) || (newValue.longitude == null)) {
_this.$log.error("WindowChildMarker cannot render marker as scope.coords as no position on marker: " + (JSON.stringify(_this.model)));
return;
}
return _this.gWin.setPosition(new google.maps.LatLng(newValue.latitude, newValue.longitude));
}
}
}, true);
};
WindowChildModel.prototype.handleClick = function() {
var _this = this;
if (this.markerCtrl != null) {
return this.googleMapsHandles.push(google.maps.event.addListener(this.markerCtrl, 'click', function() {
var pos;
if (_this.gWin == null) {
_this.createGWin();
}
pos = _this.markerCtrl.getPosition();
if (_this.gWin != null) {
_this.gWin.setPosition(pos);
_this.showWindow();
}
_this.initialMarkerVisibility = _this.markerCtrl.getVisible();
return _this.markerCtrl.setVisible(_this.isIconVisibleOnClick);
}));
}
};
WindowChildModel.prototype.showWindow = function() {
var show,
_this = this;
show = function() {
if (_this.gWin) {
if ((_this.scope.show || (_this.scope.show == null)) && !_this.gWin.isOpen()) {
return _this.gWin.open(_this.mapCtrl);
}
}
};
if (this.scope.templateUrl) {
if (this.gWin) {
return this.$http.get(this.scope.templateUrl, {
cache: this.$templateCache
}).then(function(content) {
var compiled, templateScope;
templateScope = _this.scope.$new();
if (angular.isDefined(_this.scope.templateParameter)) {
templateScope.parameter = _this.scope.templateParameter;
}
compiled = _this.$compile(content.data)(templateScope);
_this.gWin.setContent(compiled[0]);
return show();
});
}
} else {
return show();
}
};
WindowChildModel.prototype.getLatestPosition = function() {
if ((this.gWin != null) && (this.markerCtrl != null)) {
return this.gWin.setPosition(this.markerCtrl.getPosition());
}
};
WindowChildModel.prototype.hideWindow = function() {
if ((this.gWin != null) && this.gWin.isOpen()) {
return this.gWin.close();
}
};
WindowChildModel.prototype.destroy = function() {
var self;
this.hideWindow();
_.each(this.googleMapsHandles, function(h) {
return google.maps.event.removeListener(h);
});
this.googleMapsHandles.length = 0;
if ((this.scope != null) && this.needToManualDestroy) {
this.scope.$destroy();
}
delete this.gWin;
return self = void 0;
};
return WindowChildModel;
})(oo.BaseObject);
});
}).call(this);
/*
- interface for all markers to derrive from
- to enforce a minimum set of requirements
- attributes
- coords
- icon
- implementation needed on watches
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api.models.parent", function() {
return this.IMarkerParentModel = (function(_super) {
__extends(IMarkerParentModel, _super);
IMarkerParentModel.prototype.DEFAULTS = {};
IMarkerParentModel.prototype.isFalse = function(value) {
return ['false', 'FALSE', 0, 'n', 'N', 'no', 'NO'].indexOf(value) !== -1;
};
function IMarkerParentModel(scope, element, attrs, mapCtrl, $timeout) {
var self,
_this = this;
this.scope = scope;
this.element = element;
this.attrs = attrs;
this.mapCtrl = mapCtrl;
this.$timeout = $timeout;
this.linkInit = __bind(this.linkInit, this);
this.onDestroy = __bind(this.onDestroy, this);
this.onWatch = __bind(this.onWatch, this);
this.watch = __bind(this.watch, this);
this.validateScope = __bind(this.validateScope, this);
this.onTimeOut = __bind(this.onTimeOut, this);
self = this;
this.$log = directives.api.utils.Logger;
if (!this.validateScope(scope)) {
return;
}
this.doClick = angular.isDefined(attrs.click);
if (scope.options != null) {
this.DEFAULTS = scope.options;
}
this.$timeout(function() {
_this.watch('coords', scope);
_this.watch('icon', scope);
_this.watch('options', scope);
_this.onTimeOut(scope);
return scope.$on("$destroy", function() {
return _this.onDestroy(scope);
});
});
}
IMarkerParentModel.prototype.onTimeOut = function(scope) {};
IMarkerParentModel.prototype.validateScope = function(scope) {
var ret;
if (scope == null) {
return false;
}
ret = scope.coords != null;
if (!ret) {
this.$log.error(this.constructor.name + ": no valid coords attribute found");
}
return ret;
};
IMarkerParentModel.prototype.watch = function(propNameToWatch, scope) {
var _this = this;
return scope.$watch(propNameToWatch, function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.onWatch(propNameToWatch, scope, newValue, oldValue);
}
}, true);
};
IMarkerParentModel.prototype.onWatch = function(propNameToWatch, scope, newValue, oldValue) {
throw new Exception("Not Implemented!!");
};
IMarkerParentModel.prototype.onDestroy = function(scope) {
throw new Exception("Not Implemented!!");
};
IMarkerParentModel.prototype.linkInit = function(element, mapCtrl, scope, animate) {
throw new Exception("Not Implemented!!");
};
return IMarkerParentModel;
})(oo.BaseObject);
});
}).call(this);
/*
- interface directive for all window(s) to derrive from
*/
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api.models.parent", function() {
return this.IWindowParentModel = (function(_super) {
__extends(IWindowParentModel, _super);
IWindowParentModel.include(directives.api.utils.GmapUtil);
IWindowParentModel.prototype.DEFAULTS = {};
function IWindowParentModel(scope, element, attrs, ctrls, $timeout, $compile, $http, $templateCache) {
var self;
self = this;
this.$log = directives.api.utils.Logger;
this.$timeout = $timeout;
this.$compile = $compile;
this.$http = $http;
this.$templateCache = $templateCache;
if (scope.options != null) {
this.DEFAULTS = scope.options;
}
}
return IWindowParentModel;
})(oo.BaseObject);
});
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api.models.parent", function() {
return this.LayerParentModel = (function(_super) {
__extends(LayerParentModel, _super);
function LayerParentModel(scope, element, attrs, mapCtrl, $timeout, onLayerCreated, $log) {
var _this = this;
this.scope = scope;
this.element = element;
this.attrs = attrs;
this.mapCtrl = mapCtrl;
this.$timeout = $timeout;
this.onLayerCreated = onLayerCreated != null ? onLayerCreated : void 0;
this.$log = $log != null ? $log : directives.api.utils.Logger;
this.createGoogleLayer = __bind(this.createGoogleLayer, this);
if (this.attrs.type == null) {
this.$log.info("type attribute for the layer directive is mandatory. Layer creation aborted!!");
return;
}
this.createGoogleLayer();
this.gMap = void 0;
this.doShow = true;
this.$timeout(function() {
_this.gMap = mapCtrl.getMap();
if (angular.isDefined(_this.attrs.show)) {
_this.doShow = _this.scope.show;
}
if (_this.doShow !== null && _this.doShow && _this.gMap !== null) {
_this.layer.setMap(_this.gMap);
}
_this.scope.$watch("show", function(newValue, oldValue) {
if (newValue !== oldValue) {
_this.doShow = newValue;
if (newValue) {
return _this.layer.setMap(_this.gMap);
} else {
return _this.layer.setMap(null);
}
}
}, true);
_this.scope.$watch("options", function(newValue, oldValue) {
if (newValue !== oldValue) {
_this.layer.setMap(null);
_this.layer = null;
return _this.createGoogleLayer();
}
}, true);
return _this.scope.$on("$destroy", function() {
return _this.layer.setMap(null);
});
});
}
LayerParentModel.prototype.createGoogleLayer = function() {
var _this = this;
if (this.attrs.options == null) {
this.layer = this.attrs.namespace === void 0 ? new google.maps[this.attrs.type]() : new google.maps[this.attrs.namespace][this.attrs.type]();
} else {
this.layer = this.attrs.namespace === void 0 ? new google.maps[this.attrs.type](this.scope.options) : new google.maps[this.attrs.namespace][this.attrs.type](this.scope.options);
}
return this.$timeout(function() {
var fn;
if ((_this.layer != null) && (_this.onLayerCreated != null)) {
fn = _this.onLayerCreated(_this.scope, _this.layer);
if (fn) {
return fn(_this.layer);
}
}
});
};
return LayerParentModel;
})(oo.BaseObject);
});
}).call(this);
/*
Basic Directive api for a marker. Basic in the sense that this directive contains 1:1 on scope and model.
Thus there will be one html element per marker within the directive.
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api.models.parent", function() {
return this.MarkerParentModel = (function(_super) {
__extends(MarkerParentModel, _super);
MarkerParentModel.include(directives.api.utils.GmapUtil);
function MarkerParentModel(scope, element, attrs, mapCtrl, $timeout) {
this.onDestroy = __bind(this.onDestroy, this);
this.onWatch = __bind(this.onWatch, this);
this.onTimeOut = __bind(this.onTimeOut, this);
var self;
MarkerParentModel.__super__.constructor.call(this, scope, element, attrs, mapCtrl, $timeout);
self = this;
}
MarkerParentModel.prototype.onTimeOut = function(scope) {
var opts,
_this = this;
opts = this.createMarkerOptions(scope.coords, scope.icon, scope.options, this.mapCtrl.getMap());
this.scope.gMarker = new google.maps.Marker(opts);
google.maps.event.addListener(this.scope.gMarker, 'click', function() {
if (_this.doClick && (scope.click != null)) {
return _this.$timeout(function() {
return _this.scope.click();
});
}
});
this.setEvents(this.scope.gMarker, scope);
return this.$log.info(this);
};
MarkerParentModel.prototype.onWatch = function(propNameToWatch, scope) {
switch (propNameToWatch) {
case 'coords':
if ((scope.coords != null) && (this.scope.gMarker != null)) {
this.scope.gMarker.setMap(this.mapCtrl.getMap());
this.scope.gMarker.setPosition(new google.maps.LatLng(scope.coords.latitude, scope.coords.longitude));
this.scope.gMarker.setVisible((scope.coords.latitude != null) && (scope.coords.longitude != null));
return this.scope.gMarker.setOptions(scope.options);
} else {
return this.scope.gMarker.setMap(null);
}
break;
case 'icon':
if ((scope.icon != null) && (scope.coords != null) && (this.scope.gMarker != null)) {
this.scope.gMarker.setOptions(scope.options);
this.scope.gMarker.setIcon(scope.icon);
this.scope.gMarker.setMap(null);
this.scope.gMarker.setMap(this.mapCtrl.getMap());
this.scope.gMarker.setPosition(new google.maps.LatLng(scope.coords.latitude, scope.coords.longitude));
return this.scope.gMarker.setVisible(scope.coords.latitude && (scope.coords.longitude != null));
}
break;
case 'options':
if ((scope.coords != null) && (scope.icon != null) && scope.options) {
if (this.scope.gMarker != null) {
this.scope.gMarker.setMap(null);
}
delete this.scope.gMarker;
return this.scope.gMarker = new google.maps.Marker(this.createMarkerOptions(scope.coords, scope.icon, scope.options, this.mapCtrl.getMap()));
}
}
};
MarkerParentModel.prototype.onDestroy = function(scope) {
var self;
if (this.scope.gMarker === void 0) {
self = void 0;
return;
}
this.scope.gMarker.setMap(null);
delete this.scope.gMarker;
return self = void 0;
};
MarkerParentModel.prototype.setEvents = function(marker, scope) {
if (angular.isDefined(scope.events) && (scope.events != null) && angular.isObject(scope.events)) {
return _.compact(_.each(scope.events, function(eventHandler, eventName) {
if (scope.events.hasOwnProperty(eventName) && angular.isFunction(scope.events[eventName])) {
return google.maps.event.addListener(marker, eventName, function() {
return eventHandler.apply(scope, [marker, eventName, arguments]);
});
}
}));
}
};
return MarkerParentModel;
})(directives.api.models.parent.IMarkerParentModel);
});
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api.models.parent", function() {
return this.MarkersParentModel = (function(_super) {
__extends(MarkersParentModel, _super);
MarkersParentModel.include(directives.api.utils.ModelsWatcher);
function MarkersParentModel(scope, element, attrs, mapCtrl, $timeout) {
this.fit = __bind(this.fit, this);
this.onDestroy = __bind(this.onDestroy, this);
this.onWatch = __bind(this.onWatch, this);
this.reBuildMarkers = __bind(this.reBuildMarkers, this);
this.createMarkers = __bind(this.createMarkers, this);
this.validateScope = __bind(this.validateScope, this);
this.onTimeOut = __bind(this.onTimeOut, this);
var self;
MarkersParentModel.__super__.constructor.call(this, scope, element, attrs, mapCtrl, $timeout);
self = this;
this.markersIndex = 0;
this.gMarkerManager = void 0;
this.scope = scope;
this.scope.markerModels = [];
this.bigGulp = directives.api.utils.AsyncProcessor;
this.$timeout = $timeout;
this.$log.info(this);
}
MarkersParentModel.prototype.onTimeOut = function(scope) {
this.watch('models', scope);
this.watch('doCluster', scope);
this.watch('clusterOptions', scope);
this.watch('fit', scope);
return this.createMarkers(scope);
};
MarkersParentModel.prototype.validateScope = function(scope) {
var modelsNotDefined;
modelsNotDefined = angular.isUndefined(scope.models) || scope.models === void 0;
if (modelsNotDefined) {
this.$log.error(this.constructor.name + ": no valid models attribute found");
}
return MarkersParentModel.__super__.validateScope.call(this, scope) || modelsNotDefined;
};
MarkersParentModel.prototype.createMarkers = function(scope) {
var markers,
_this = this;
if ((scope.doCluster != null) && scope.doCluster === true) {
if (scope.clusterOptions != null) {
if (this.gMarkerManager === void 0) {
this.gMarkerManager = new directives.api.managers.ClustererMarkerManager(this.mapCtrl.getMap(), void 0, scope.clusterOptions);
} else {
if (this.gMarkerManager.opt_options !== scope.clusterOptions) {
this.gMarkerManager = new directives.api.managers.ClustererMarkerManager(this.mapCtrl.getMap(), void 0, scope.clusterOptions);
}
}
} else {
this.gMarkerManager = new directives.api.managers.ClustererMarkerManager(this.mapCtrl.getMap());
}
} else {
this.gMarkerManager = new directives.api.managers.MarkerManager(this.mapCtrl.getMap());
}
markers = [];
scope.isMarkerModelsReady = false;
return this.bigGulp.handleLargeArray(scope.models, function(model) {
var child;
scope.doRebuild = true;
child = new directives.api.models.child.MarkerChildModel(_this.markersIndex, model, scope, _this.mapCtrl, _this.$timeout, _this.DEFAULTS, _this.doClick, _this.gMarkerManager);
_this.$log.info('child', child, 'markers', markers);
markers.push(child);
return _this.markersIndex++;
}, (function() {}), function() {
_this.gMarkerManager.draw();
scope.markerModels = markers;
if (angular.isDefined(_this.attrs.fit) && (scope.fit != null) && scope.fit) {
_this.fit();
}
scope.isMarkerModelsReady = true;
if (scope.onMarkerModelsReady != null) {
return scope.onMarkerModelsReady(scope);
}
});
};
MarkersParentModel.prototype.reBuildMarkers = function(scope) {
var _this = this;
if (!scope.doRebuild && scope.doRebuild !== void 0) {
return;
}
_.each(scope.markerModels, function(oldM) {
return oldM.destroy();
});
this.markersIndex = 0;
if (this.gMarkerManager != null) {
this.gMarkerManager.clear();
}
return this.createMarkers(scope);
};
MarkersParentModel.prototype.onWatch = function(propNameToWatch, scope, newValue, oldValue) {
if (propNameToWatch === 'models') {
if (!this.didModelsChange(newValue, oldValue)) {
return;
}
}
if (propNameToWatch === 'options' && (newValue != null)) {
this.DEFAULTS = newValue;
return;
}
return this.reBuildMarkers(scope);
};
MarkersParentModel.prototype.onDestroy = function(scope) {
var model, _i, _len, _ref;
_ref = scope.markerModels;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
model = _ref[_i];
model.destroy();
}
if (this.gMarkerManager != null) {
return this.gMarkerManager.clear();
}
};
MarkersParentModel.prototype.fit = function() {
var bounds, everSet,
_this = this;
if (this.mapCtrl && (this.scope.markerModels != null) && this.scope.markerModels.length > 0) {
bounds = new google.maps.LatLngBounds();
everSet = false;
_.each(this.scope.markerModels, function(childModelMarker) {
if (childModelMarker.gMarker != null) {
if (!everSet) {
everSet = true;
}
return bounds.extend(childModelMarker.gMarker.getPosition());
}
});
if (everSet) {
return this.mapCtrl.getMap().fitBounds(bounds);
}
}
};
return MarkersParentModel;
})(directives.api.models.parent.IMarkerParentModel);
});
}).call(this);
/*
Windows directive where many windows map to the models property
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api.models.parent", function() {
return this.WindowsParentModel = (function(_super) {
__extends(WindowsParentModel, _super);
WindowsParentModel.include(directives.api.utils.ModelsWatcher);
function WindowsParentModel(scope, element, attrs, ctrls, $timeout, $compile, $http, $templateCache, $interpolate) {
this.interpolateContent = __bind(this.interpolateContent, this);
this.setChildScope = __bind(this.setChildScope, this);
this.createWindow = __bind(this.createWindow, this);
this.setContentKeys = __bind(this.setContentKeys, this);
this.createChildScopesWindows = __bind(this.createChildScopesWindows, this);
this.onMarkerModelsReady = __bind(this.onMarkerModelsReady, this);
this.watchOurScope = __bind(this.watchOurScope, this);
this.destroy = __bind(this.destroy, this);
this.watchDestroy = __bind(this.watchDestroy, this);
this.watchModels = __bind(this.watchModels, this);
this.watch = __bind(this.watch, this);
var name, self, _i, _len, _ref,
_this = this;
WindowsParentModel.__super__.constructor.call(this, scope, element, attrs, ctrls, $timeout, $compile, $http, $templateCache, $interpolate);
self = this;
this.$interpolate = $interpolate;
this.windows = [];
this.windwsIndex = 0;
this.scopePropNames = ['show', 'coords', 'templateUrl', 'templateParameter', 'isIconVisibleOnClick', 'closeClick'];
_ref = this.scopePropNames;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
name = _ref[_i];
this[name + 'Key'] = void 0;
}
this.linked = new directives.api.utils.Linked(scope, element, attrs, ctrls);
this.models = void 0;
this.contentKeys = void 0;
this.isIconVisibleOnClick = void 0;
this.firstTime = true;
this.bigGulp = directives.api.utils.AsyncProcessor;
this.$log.info(self);
this.$timeout(function() {
_this.watchOurScope(scope);
return _this.createChildScopesWindows();
}, 50);
}
WindowsParentModel.prototype.watch = function(scope, name, nameKey) {
var _this = this;
return scope.$watch(name, function(newValue, oldValue) {
if (newValue !== oldValue) {
_this[nameKey] = typeof newValue === 'function' ? newValue() : newValue;
return _.each(_this.windows, function(model) {
return model.scope[name] = _this[nameKey] === 'self' ? model : model[_this[nameKey]];
});
}
}, true);
};
WindowsParentModel.prototype.watchModels = function(scope) {
var _this = this;
return scope.$watch('models', function(newValue, oldValue) {
if (_this.didModelsChange(newValue, oldValue)) {
_this.destroy();
return _this.createChildScopesWindows();
}
});
};
WindowsParentModel.prototype.watchDestroy = function(scope) {
var _this = this;
return scope.$on("$destroy", function() {
return _this.destroy();
});
};
WindowsParentModel.prototype.destroy = function() {
var _this = this;
_.each(this.windows, function(model) {
return model.destroy();
});
delete this.windows;
this.windows = [];
return this.windowsIndex = 0;
};
WindowsParentModel.prototype.watchOurScope = function(scope) {
var _this = this;
return _.each(this.scopePropNames, function(name) {
var nameKey;
nameKey = name + 'Key';
_this[nameKey] = typeof scope[name] === 'function' ? scope[name]() : scope[name];
return _this.watch(scope, name, nameKey);
});
};
WindowsParentModel.prototype.onMarkerModelsReady = function(scope) {
var _this = this;
this.destroy();
this.models = scope.models;
if (this.firstTime) {
this.watchDestroy(scope);
}
this.setContentKeys(scope.models);
return this.bigGulp.handleLargeArray(scope.markerModels, function(mm) {
return _this.createWindow(mm.model, mm.gMarker, _this.gMap);
}, (function() {}), function() {
return _this.firstTime = false;
});
};
WindowsParentModel.prototype.createChildScopesWindows = function() {
/*
being that we cannot tell the difference in Key String vs. a normal value string (TemplateUrl)
we will assume that all scope values are string expressions either pointing to a key (propName) or using
'self' to point the model as container/object of interest.
This may force redundant information into the model, but this appears to be the most flexible approach.
*/
var markersScope, modelsNotDefined,
_this = this;
this.isIconVisibleOnClick = true;
if (angular.isDefined(this.linked.attrs.isiconvisibleonclick)) {
this.isIconVisibleOnClick = this.linked.scope.isIconVisibleOnClick;
}
this.gMap = this.linked.ctrls[0].getMap();
markersScope = this.linked.ctrls.length > 1 && (this.linked.ctrls[1] != null) ? this.linked.ctrls[1].getMarkersScope() : void 0;
modelsNotDefined = angular.isUndefined(this.linked.scope.models);
if (modelsNotDefined && (markersScope === void 0 || (markersScope.markerModels === void 0 && markersScope.models === void 0))) {
this.$log.info("No models to create windows from! Need direct models or models derrived from markers!");
return;
}
if (this.gMap != null) {
if (this.linked.scope.models != null) {
this.models = this.linked.scope.models;
if (this.firstTime) {
this.watchModels(this.linked.scope);
this.watchDestroy(this.linked.scope);
}
this.setContentKeys(this.linked.scope.models);
return this.bigGulp.handleLargeArray(this.linked.scope.models, function(model) {
return _this.createWindow(model, void 0, _this.gMap);
}, (function() {}), function() {
return _this.firstTime = false;
});
} else {
markersScope.onMarkerModelsReady = this.onMarkerModelsReady;
if (markersScope.isMarkerModelsReady) {
return this.onMarkerModelsReady(markersScope);
}
}
}
};
WindowsParentModel.prototype.setContentKeys = function(models) {
if (models.length > 0) {
return this.contentKeys = Object.keys(models[0]);
}
};
WindowsParentModel.prototype.createWindow = function(model, gMarker, gMap) {
/*
Create ChildScope to Mimmick an ng-repeat created scope, must define the below scope
scope= {
coords: '=coords',
show: '&show',
templateUrl: '=templateurl',
templateParameter: '=templateparameter',
isIconVisibleOnClick: '=isiconvisibleonclick',
closeClick: '&closeclick'
}
*/
var childScope, opts, parsedContent,
_this = this;
childScope = this.linked.scope.$new(false);
this.setChildScope(childScope, model);
childScope.$watch('model', function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.setChildScope(childScope, newValue);
}
}, true);
parsedContent = this.interpolateContent(this.linked.element.html(), model);
opts = this.createWindowOptions(gMarker, childScope, parsedContent, this.DEFAULTS);
return this.windows.push(new directives.api.models.child.WindowChildModel(childScope, opts, this.isIconVisibleOnClick, gMap, gMarker, this.$http, this.$templateCache, this.$compile, void 0, true));
};
WindowsParentModel.prototype.setChildScope = function(childScope, model) {
var name, _fn, _i, _len, _ref,
_this = this;
_ref = this.scopePropNames;
_fn = function(name) {
var nameKey, newValue;
nameKey = name + 'Key';
newValue = _this[nameKey] === 'self' ? model : model[_this[nameKey]];
if (newValue !== childScope[name]) {
return childScope[name] = newValue;
}
};
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
name = _ref[_i];
_fn(name);
}
return childScope.model = model;
};
WindowsParentModel.prototype.interpolateContent = function(content, model) {
var exp, interpModel, key, _i, _len, _ref;
if (this.contentKeys === void 0 || this.contentKeys.length === 0) {
return;
}
exp = this.$interpolate(content);
interpModel = {};
_ref = this.contentKeys;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
interpModel[key] = model[key];
}
return exp(interpModel);
};
return WindowsParentModel;
})(directives.api.models.parent.IWindowParentModel);
});
}).call(this);
/*
- interface for all labels to derrive from
- to enforce a minimum set of requirements
- attributes
- content
- anchor
- implementation needed on watches
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api", function() {
return this.ILabel = (function(_super) {
__extends(ILabel, _super);
function ILabel($timeout) {
this.link = __bind(this.link, this);
var self;
self = this;
this.restrict = 'ECMA';
this.replace = true;
this.template = void 0;
this.require = void 0;
this.transclude = true;
this.priority = -100;
this.scope = {
labelContent: '=content',
labelAnchor: '@anchor',
labelClass: '@class',
labelStyle: '=style'
};
this.$log = directives.api.utils.Logger;
this.$timeout = $timeout;
}
ILabel.prototype.link = function(scope, element, attrs, ctrl) {
throw new Exception("Not Implemented!!");
};
return ILabel;
})(oo.BaseObject);
});
}).call(this);
/*
- interface for all markers to derrive from
- to enforce a minimum set of requirements
- attributes
- coords
- icon
- implementation needed on watches
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api", function() {
return this.IMarker = (function(_super) {
__extends(IMarker, _super);
function IMarker($timeout) {
this.link = __bind(this.link, this);
var self;
self = this;
this.$log = directives.api.utils.Logger;
this.$timeout = $timeout;
this.restrict = 'ECMA';
this.require = '^googleMap';
this.priority = -1;
this.transclude = true;
this.replace = true;
this.scope = {
coords: '=coords',
icon: '=icon',
click: '&click',
options: '=options',
events: '=events'
};
}
IMarker.prototype.controller = [
'$scope', '$element', function($scope, $element) {
throw new Exception("Not Implemented!!");
}
];
IMarker.prototype.link = function(scope, element, attrs, ctrl) {
throw new Exception("Not implemented!!");
};
return IMarker;
})(oo.BaseObject);
});
}).call(this);
/*
- interface directive for all window(s) to derrive from
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api", function() {
return this.IWindow = (function(_super) {
__extends(IWindow, _super);
IWindow.include(directives.api.utils.ChildEvents);
function IWindow($timeout, $compile, $http, $templateCache) {
var self;
this.$timeout = $timeout;
this.$compile = $compile;
this.$http = $http;
this.$templateCache = $templateCache;
this.link = __bind(this.link, this);
self = this;
this.restrict = 'ECMA';
this.template = void 0;
this.transclude = true;
this.priority = -100;
this.require = void 0;
this.replace = true;
this.scope = {
coords: '=coords',
show: '=show',
templateUrl: '=templateurl',
templateParameter: '=templateparameter',
isIconVisibleOnClick: '=isiconvisibleonclick',
closeClick: '&closeclick',
options: '=options'
};
this.$log = directives.api.utils.Logger;
}
IWindow.prototype.link = function(scope, element, attrs, ctrls) {
throw new Exception("Not Implemented!!");
};
return IWindow;
})(oo.BaseObject);
});
}).call(this);
/*
Basic Directive api for a label. Basic in the sense that this directive contains 1:1 on scope and model.
Thus there will be one html element per marker within the directive.
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api", function() {
return this.Label = (function(_super) {
__extends(Label, _super);
function Label($timeout) {
this.link = __bind(this.link, this);
var self;
Label.__super__.constructor.call(this, $timeout);
self = this;
this.require = '^marker';
this.template = '<span class="angular-google-maps-marker-label" ng-transclude></span>';
this.$log.info(this);
}
Label.prototype.link = function(scope, element, attrs, ctrl) {
var _this = this;
return this.$timeout(function() {
var label, markerCtrl;
markerCtrl = ctrl.getMarkerScope().gMarker;
if (markerCtrl != null) {
label = new directives.api.models.child.MarkerLabelChildModel(markerCtrl, scope);
}
return scope.$on("$destroy", function() {
return label.destroy();
});
}, directives.api.utils.GmapUtil.defaultDelay + 25);
};
return Label;
})(directives.api.ILabel);
});
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api", function() {
return this.Layer = (function(_super) {
__extends(Layer, _super);
function Layer($timeout) {
this.$timeout = $timeout;
this.link = __bind(this.link, this);
this.$log = directives.api.utils.Logger;
this.restrict = "ECMA";
this.require = "^googleMap";
this.priority = -1;
this.transclude = true;
this.template = '<span class=\"angular-google-map-layer\" ng-transclude></span>';
this.replace = true;
this.scope = {
show: "=show",
type: "=type",
namespace: "=namespace",
options: '=options',
onCreated: '&oncreated'
};
}
Layer.prototype.link = function(scope, element, attrs, mapCtrl) {
if (attrs.oncreated != null) {
return new directives.api.models.parent.LayerParentModel(scope, element, attrs, mapCtrl, this.$timeout, scope.onCreated);
} else {
return new directives.api.models.parent.LayerParentModel(scope, element, attrs, mapCtrl, this.$timeout);
}
};
return Layer;
})(oo.BaseObject);
});
}).call(this);
/*
Basic Directive api for a marker. Basic in the sense that this directive contains 1:1 on scope and model.
Thus there will be one html element per marker within the directive.
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api", function() {
return this.Marker = (function(_super) {
__extends(Marker, _super);
function Marker($timeout) {
this.link = __bind(this.link, this);
var self;
Marker.__super__.constructor.call(this, $timeout);
self = this;
this.template = '<span class="angular-google-map-marker" ng-transclude></span>';
this.$log.info(this);
}
Marker.prototype.controller = [
'$scope', '$element', function($scope, $element) {
return {
getMarkerScope: function() {
return $scope;
}
};
}
];
Marker.prototype.link = function(scope, element, attrs, ctrl) {
return new directives.api.models.parent.MarkerParentModel(scope, element, attrs, ctrl, this.$timeout);
};
return Marker;
})(directives.api.IMarker);
});
}).call(this);
/*
Markers will map icon and coords differently than directibes.api.Marker. This is because Scope and the model marker are
not 1:1 in this setting.
- icon - will be the iconKey to the marker value ie: to get the icon marker[iconKey]
- coords - will be the coordsKey to the marker value ie: to get the icon marker[coordsKey]
- watches from IMarker reflect that the look up key for a value has changed and not the actual icon or coords itself
- actual changes to a model are tracked inside directives.api.model.MarkerModel
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api", function() {
return this.Markers = (function(_super) {
__extends(Markers, _super);
function Markers($timeout) {
this.link = __bind(this.link, this);
var self;
Markers.__super__.constructor.call(this, $timeout);
self = this;
this.template = '<span class="angular-google-map-markers" ng-transclude></span>';
this.scope.models = '=models';
this.scope.doCluster = '=docluster';
this.scope.clusterOptions = '=clusteroptions';
this.scope.fit = '=fit';
this.scope.labelContent = '=labelcontent';
this.scope.labelAnchor = '@labelanchor';
this.scope.labelClass = '@labelclass';
this.$timeout = $timeout;
this.$log.info(this);
}
Markers.prototype.controller = [
'$scope', '$element', function($scope, $element) {
return {
getMarkersScope: function() {
return $scope;
}
};
}
];
Markers.prototype.link = function(scope, element, attrs, ctrl) {
return new directives.api.models.parent.MarkersParentModel(scope, element, attrs, ctrl, this.$timeout);
};
return Markers;
})(directives.api.IMarker);
});
}).call(this);
/*
Window directive for GoogleMap Info Windows, where ng-repeat is being used....
Where Html DOM element is 1:1 on Scope and a Model
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api", function() {
return this.Window = (function(_super) {
__extends(Window, _super);
Window.include(directives.api.utils.GmapUtil);
function Window($timeout, $compile, $http, $templateCache) {
this.link = __bind(this.link, this);
var self;
Window.__super__.constructor.call(this, $timeout, $compile, $http, $templateCache);
self = this;
this.require = ['^googleMap', '^?marker'];
this.template = '<span class="angular-google-maps-window" ng-transclude></span>';
this.$log.info(self);
}
Window.prototype.link = function(scope, element, attrs, ctrls) {
var _this = this;
return this.$timeout(function() {
var defaults, hasScopeCoords, isIconVisibleOnClick, mapCtrl, markerCtrl, markerScope, opts, window;
isIconVisibleOnClick = true;
if (angular.isDefined(attrs.isiconvisibleonclick)) {
isIconVisibleOnClick = scope.isIconVisibleOnClick;
}
mapCtrl = ctrls[0].getMap();
markerCtrl = ctrls.length > 1 && (ctrls[1] != null) ? ctrls[1].getMarkerScope().gMarker : void 0;
defaults = scope.options != null ? scope.options : {};
hasScopeCoords = (scope != null) && (scope.coords != null) && (scope.coords.latitude != null) && (scope.coords.longitude != null);
opts = hasScopeCoords ? _this.createWindowOptions(markerCtrl, scope, element.html(), defaults) : defaults;
if (mapCtrl != null) {
window = new directives.api.models.child.WindowChildModel(scope, opts, isIconVisibleOnClick, mapCtrl, markerCtrl, _this.$http, _this.$templateCache, _this.$compile, element);
}
scope.$on("$destroy", function() {
return window.destroy();
});
if (ctrls[1] != null) {
markerScope = ctrls[1].getMarkerScope();
markerScope.$watch('coords', function(newValue, oldValue) {
if (newValue == null) {
return window.hideWindow();
}
});
markerScope.$watch('coords.latitude', function(newValue, oldValue) {
if (newValue !== oldValue) {
return window.getLatestPosition();
}
});
}
if ((_this.onChildCreation != null) && (window != null)) {
return _this.onChildCreation(window);
}
}, directives.api.utils.GmapUtil.defaultDelay + 25);
};
return Window;
})(directives.api.IWindow);
});
}).call(this);
/*
Windows directive where many windows map to the models property
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
this.ngGmapModule("directives.api", function() {
return this.Windows = (function(_super) {
__extends(Windows, _super);
function Windows($timeout, $compile, $http, $templateCache, $interpolate) {
this.link = __bind(this.link, this);
var self;
Windows.__super__.constructor.call(this, $timeout, $compile, $http, $templateCache);
self = this;
this.$interpolate = $interpolate;
this.require = ['^googleMap', '^?markers'];
this.template = '<span class="angular-google-maps-windows" ng-transclude></span>';
this.scope.models = '=models';
this.$log.info(self);
}
Windows.prototype.link = function(scope, element, attrs, ctrls) {
return new directives.api.models.parent.WindowsParentModel(scope, element, attrs, ctrls, this.$timeout, this.$compile, this.$http, this.$templateCache, this.$interpolate);
};
return Windows;
})(directives.api.IWindow);
});
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
Nick Baugh - https://github.com/niftylettuce
*/
(function() {
angular.module("google-maps").directive("googleMap", [
"$log", "$timeout", function($log, $timeout) {
"use strict";
var DEFAULTS, getCoords, isTrue;
isTrue = function(val) {
return angular.isDefined(val) && val !== null && val === true || val === "1" || val === "y" || val === "true";
};
directives.api.utils.Logger.logger = $log;
DEFAULTS = {
mapTypeId: google.maps.MapTypeId.ROADMAP
};
getCoords = function(value) {
return new google.maps.LatLng(value.latitude, value.longitude);
};
return {
self: this,
restrict: "ECMA",
transclude: true,
replace: false,
template: "<div class=\"angular-google-map\"><div class=\"angular-google-map-container\"></div><div ng-transclude style=\"display: none\"></div></div>",
scope: {
center: "=center",
zoom: "=zoom",
dragging: "=dragging",
control: "=",
windows: "=windows",
options: "=options",
events: "=events",
styles: "=styles",
bounds: "=bounds"
},
controller: [
"$scope", function($scope) {
return {
getMap: function() {
return $scope.map;
}
};
}
],
/*
@param scope
@param element
@param attrs
*/
link: function(scope, element, attrs) {
var dragging, el, eventName, getEventHandler, opts, settingCenterFromScope, type, _m,
_this = this;
if (!angular.isDefined(scope.center) || (!angular.isDefined(scope.center.latitude) || !angular.isDefined(scope.center.longitude))) {
$log.error("angular-google-maps: could not find a valid center property");
return;
}
if (!angular.isDefined(scope.zoom)) {
$log.error("angular-google-maps: map zoom property not set");
return;
}
el = angular.element(element);
el.addClass("angular-google-map");
opts = {
options: {}
};
if (attrs.options) {
opts.options = scope.options;
}
if (attrs.styles) {
opts.styles = scope.styles;
}
if (attrs.type) {
type = attrs.type.toUpperCase();
if (google.maps.MapTypeId.hasOwnProperty(type)) {
opts.mapTypeId = google.maps.MapTypeId[attrs.type.toUpperCase()];
} else {
$log.error("angular-google-maps: invalid map type \"" + attrs.type + "\"");
}
}
_m = new google.maps.Map(el.find("div")[1], angular.extend({}, DEFAULTS, opts, {
center: new google.maps.LatLng(scope.center.latitude, scope.center.longitude),
draggable: isTrue(attrs.draggable),
zoom: scope.zoom,
bounds: scope.bounds
}));
dragging = false;
google.maps.event.addListener(_m, "dragstart", function() {
dragging = true;
return _.defer(function() {
return scope.$apply(function(s) {
if (s.dragging != null) {
return s.dragging = dragging;
}
});
});
});
google.maps.event.addListener(_m, "dragend", function() {
dragging = false;
return _.defer(function() {
return scope.$apply(function(s) {
if (s.dragging != null) {
return s.dragging = dragging;
}
});
});
});
google.maps.event.addListener(_m, "drag", function() {
var c;
c = _m.center;
return _.defer(function() {
return scope.$apply(function(s) {
s.center.latitude = c.lat();
return s.center.longitude = c.lng();
});
});
});
google.maps.event.addListener(_m, "zoom_changed", function() {
if (scope.zoom !== _m.zoom) {
return _.defer(function() {
return scope.$apply(function(s) {
return s.zoom = _m.zoom;
});
});
}
});
settingCenterFromScope = false;
google.maps.event.addListener(_m, "center_changed", function() {
var c;
c = _m.center;
if (settingCenterFromScope) {
return;
}
return _.defer(function() {
return scope.$apply(function(s) {
if (!_m.dragging) {
if (s.center.latitude !== c.lat()) {
s.center.latitude = c.lat();
}
if (s.center.longitude !== c.lng()) {
return s.center.longitude = c.lng();
}
}
});
});
});
google.maps.event.addListener(_m, "idle", function() {
var b, ne, sw;
b = _m.getBounds();
ne = b.getNorthEast();
sw = b.getSouthWest();
return _.defer(function() {
return scope.$apply(function(s) {
if (s.bounds !== null && s.bounds !== undefined && s.bounds !== void 0) {
s.bounds.northeast = {
latitude: ne.lat(),
longitude: ne.lng()
};
return s.bounds.southwest = {
latitude: sw.lat(),
longitude: sw.lng()
};
}
});
});
});
if (angular.isDefined(scope.events) && scope.events !== null && angular.isObject(scope.events)) {
getEventHandler = function(eventName) {
return function() {
return scope.events[eventName].apply(scope, [_m, eventName, arguments]);
};
};
for (eventName in scope.events) {
if (scope.events.hasOwnProperty(eventName) && angular.isFunction(scope.events[eventName])) {
google.maps.event.addListener(_m, eventName, getEventHandler(eventName));
}
}
}
scope.map = _m;
if ((attrs.control != null) && (scope.control != null)) {
scope.control.refresh = function(maybeCoords) {
var coords;
if (_m == null) {
return;
}
google.maps.event.trigger(_m, "resize");
if (((maybeCoords != null ? maybeCoords.latitude : void 0) != null) && ((maybeCoords != null ? maybeCoords.latitude : void 0) != null)) {
coords = getCoords(maybeCoords);
if (isTrue(attrs.pan)) {
return _m.panTo(coords);
} else {
return _m.setCenter(coords);
}
}
};
/*
I am sure you all will love this. You want the instance here you go.. BOOM!
*/
scope.control.getGMap = function() {
return _m;
};
}
scope.$watch("center", (function(newValue, oldValue) {
var coords;
coords = getCoords(newValue);
if (newValue === oldValue || (coords.lat() === _m.center.lat() && coords.lng() === _m.center.lng())) {
return;
}
settingCenterFromScope = true;
if (!dragging) {
if ((newValue.latitude == null) || (newValue.longitude == null)) {
$log.error("Invalid center for newValue: " + (JSON.stringify(newValue)));
}
if (isTrue(attrs.pan) && scope.zoom === _m.zoom) {
_m.panTo(coords);
} else {
_m.setCenter(coords);
}
}
return settingCenterFromScope = false;
}), true);
scope.$watch("zoom", function(newValue, oldValue) {
if (newValue === oldValue || newValue === _m.zoom) {
return;
}
return _.defer(function() {
return _m.setZoom(newValue);
});
});
scope.$watch("bounds", function(newValue, oldValue) {
var bounds, ne, sw;
if (newValue === oldValue) {
return;
}
if ((newValue.northeast.latitude == null) || (newValue.northeast.longitude == null) || (newValue.southwest.latitude == null) || (newValue.southwest.longitude == null)) {
$log.error("Invalid map bounds for new value: " + (JSON.stringify(newValue)));
return;
}
ne = new google.maps.LatLng(newValue.northeast.latitude, newValue.northeast.longitude);
sw = new google.maps.LatLng(newValue.southwest.latitude, newValue.southwest.longitude);
bounds = new google.maps.LatLngBounds(sw, ne);
return _m.fitBounds(bounds);
});
scope.$watch("options", function(newValue, oldValue) {
if (!_.isEqual(newValue, oldValue)) {
opts.options = newValue;
if (_m != null) {
return _m.setOptions(opts);
}
}
}, true);
return scope.$watch("styles", function(newValue, oldValue) {
if (!_.isEqual(newValue, oldValue)) {
opts.styles = newValue;
if (_m != null) {
return _m.setOptions(opts);
}
}
}, true);
}
};
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
/*
Map marker directive
This directive is used to create a marker on an existing map.
This directive creates a new scope.
{attribute coords required} object containing latitude and longitude properties
{attribute icon optional} string url to image used for marker icon
{attribute animate optional} if set to false, the marker won't be animated (on by default)
*/
(function() {
angular.module("google-maps").directive("marker", [
"$timeout", function($timeout) {
return new directives.api.Marker($timeout);
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
/*
Map marker directive
This directive is used to create a marker on an existing map.
This directive creates a new scope.
{attribute coords required} object containing latitude and longitude properties
{attribute icon optional} string url to image used for marker icon
{attribute animate optional} if set to false, the marker won't be animated (on by default)
*/
(function() {
angular.module("google-maps").directive("markers", [
"$timeout", function($timeout) {
return new directives.api.Markers($timeout);
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors Bruno Queiroz, [email protected]
*/
/*
Marker label directive
This directive is used to create a marker label on an existing map.
{attribute content required} content of the label
{attribute anchor required} string that contains the x and y point position of the label
{attribute class optional} class to DOM object
{attribute style optional} style for the label
*/
(function() {
angular.module("google-maps").directive("markerLabel", [
"$log", "$timeout", function($log, $timeout) {
return new directives.api.Label($timeout);
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
(function() {
angular.module("google-maps").directive("polygon", [
"$log", "$timeout", function($log, $timeout) {
var DEFAULTS, convertPathPoints, extendMapBounds, isTrue, validatePathPoints;
validatePathPoints = function(path) {
var i;
i = 0;
while (i < path.length) {
if (angular.isUndefined(path[i].latitude) || angular.isUndefined(path[i].longitude)) {
return false;
}
i++;
}
return true;
};
convertPathPoints = function(path) {
var i, result;
result = new google.maps.MVCArray();
i = 0;
while (i < path.length) {
result.push(new google.maps.LatLng(path[i].latitude, path[i].longitude));
i++;
}
return result;
};
extendMapBounds = function(map, points) {
var bounds, i;
bounds = new google.maps.LatLngBounds();
i = 0;
while (i < points.length) {
bounds.extend(points.getAt(i));
i++;
}
return map.fitBounds(bounds);
};
/*
Check if a value is true
*/
isTrue = function(val) {
return angular.isDefined(val) && val !== null && val === true || val === "1" || val === "y" || val === "true";
};
"use strict";
DEFAULTS = {};
return {
restrict: "ECA",
require: "^googleMap",
replace: true,
scope: {
path: "=path",
stroke: "=stroke",
clickable: "=",
draggable: "=",
editable: "=",
geodesic: "=",
icons: "=icons",
visible: "="
},
link: function(scope, element, attrs, mapCtrl) {
if (angular.isUndefined(scope.path) || scope.path === null || scope.path.length < 2 || !validatePathPoints(scope.path)) {
$log.error("polyline: no valid path attribute found");
return;
}
return $timeout(function() {
var map, opts, pathInsertAtListener, pathPoints, pathRemoveAtListener, pathSetAtListener, polyPath, polyline;
map = mapCtrl.getMap();
pathPoints = convertPathPoints(scope.path);
opts = angular.extend({}, DEFAULTS, {
map: map,
path: pathPoints,
strokeColor: scope.stroke && scope.stroke.color,
strokeOpacity: scope.stroke && scope.stroke.opacity,
strokeWeight: scope.stroke && scope.stroke.weight
});
angular.forEach({
clickable: true,
draggable: false,
editable: false,
geodesic: false,
visible: true
}, function(defaultValue, key) {
if (angular.isUndefined(scope[key]) || scope[key] === null) {
return opts[key] = defaultValue;
} else {
return opts[key] = scope[key];
}
});
polyline = new google.maps.Polyline(opts);
if (isTrue(attrs.fit)) {
extendMapBounds(map, pathPoints);
}
if (angular.isDefined(scope.editable)) {
scope.$watch("editable", function(newValue, oldValue) {
return polyline.setEditable(newValue);
});
}
if (angular.isDefined(scope.draggable)) {
scope.$watch("draggable", function(newValue, oldValue) {
return polyline.setDraggable(newValue);
});
}
if (angular.isDefined(scope.visible)) {
scope.$watch("visible", function(newValue, oldValue) {
return polyline.setVisible(newValue);
});
}
pathSetAtListener = void 0;
pathInsertAtListener = void 0;
pathRemoveAtListener = void 0;
polyPath = polyline.getPath();
pathSetAtListener = google.maps.event.addListener(polyPath, "set_at", function(index) {
var value;
value = polyPath.getAt(index);
if (!value) {
return;
}
if (!value.lng || !value.lat) {
return;
}
scope.path[index].latitude = value.lat();
scope.path[index].longitude = value.lng();
return scope.$apply();
});
pathInsertAtListener = google.maps.event.addListener(polyPath, "insert_at", function(index) {
var value;
value = polyPath.getAt(index);
if (!value) {
return;
}
if (!value.lng || !value.lat) {
return;
}
scope.path.splice(index, 0, {
latitude: value.lat(),
longitude: value.lng()
});
return scope.$apply();
});
pathRemoveAtListener = google.maps.event.addListener(polyPath, "remove_at", function(index) {
scope.path.splice(index, 1);
return scope.$apply();
});
scope.$watch("path", (function(newArray) {
var i, l, newLength, newValue, oldArray, oldLength, oldValue;
oldArray = polyline.getPath();
if (newArray !== oldArray) {
if (newArray) {
polyline.setMap(map);
i = 0;
oldLength = oldArray.getLength();
newLength = newArray.length;
l = Math.min(oldLength, newLength);
while (i < l) {
oldValue = oldArray.getAt(i);
newValue = newArray[i];
if ((oldValue.lat() !== newValue.latitude) || (oldValue.lng() !== newValue.longitude)) {
oldArray.setAt(i, new google.maps.LatLng(newValue.latitude, newValue.longitude));
}
i++;
}
while (i < newLength) {
newValue = newArray[i];
oldArray.push(new google.maps.LatLng(newValue.latitude, newValue.longitude));
i++;
}
while (i < oldLength) {
oldArray.pop();
i++;
}
if (isTrue(attrs.fit)) {
return extendMapBounds(map, oldArray);
}
} else {
return polyline.setMap(null);
}
}
}), true);
return scope.$on("$destroy", function() {
polyline.setMap(null);
pathSetAtListener();
pathSetAtListener = null;
pathInsertAtListener();
pathInsertAtListener = null;
pathRemoveAtListener();
return pathRemoveAtListener = null;
});
});
}
};
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
(function() {
angular.module("google-maps").directive("polyline", [
"$log", "$timeout", "array-sync", function($log, $timeout, arraySync) {
var DEFAULTS, convertPathPoints, extendMapBounds, isTrue, validatePathPoints;
validatePathPoints = function(path) {
var i;
i = 0;
while (i < path.length) {
if (angular.isUndefined(path[i].latitude) || angular.isUndefined(path[i].longitude)) {
return false;
}
i++;
}
return true;
};
convertPathPoints = function(path) {
var i, result;
result = new google.maps.MVCArray();
i = 0;
while (i < path.length) {
result.push(new google.maps.LatLng(path[i].latitude, path[i].longitude));
i++;
}
return result;
};
extendMapBounds = function(map, points) {
var bounds, i;
bounds = new google.maps.LatLngBounds();
i = 0;
while (i < points.length) {
bounds.extend(points.getAt(i));
i++;
}
return map.fitBounds(bounds);
};
/*
Check if a value is true
*/
isTrue = function(val) {
return angular.isDefined(val) && val !== null && val === true || val === "1" || val === "y" || val === "true";
};
"use strict";
DEFAULTS = {};
return {
restrict: "ECA",
replace: true,
require: "^googleMap",
scope: {
path: "=path",
stroke: "=stroke",
clickable: "=",
draggable: "=",
editable: "=",
geodesic: "=",
icons: "=icons",
visible: "="
},
link: function(scope, element, attrs, mapCtrl) {
if (angular.isUndefined(scope.path) || scope.path === null || scope.path.length < 2 || !validatePathPoints(scope.path)) {
$log.error("polyline: no valid path attribute found");
return;
}
return $timeout(function() {
var arraySyncer, buildOpts, map, polyline;
buildOpts = function(pathPoints) {
var opts;
opts = angular.extend({}, DEFAULTS, {
map: map,
path: pathPoints,
strokeColor: scope.stroke && scope.stroke.color,
strokeOpacity: scope.stroke && scope.stroke.opacity,
strokeWeight: scope.stroke && scope.stroke.weight
});
angular.forEach({
clickable: true,
draggable: false,
editable: false,
geodesic: false,
visible: true
}, function(defaultValue, key) {
if (angular.isUndefined(scope[key]) || scope[key] === null) {
return opts[key] = defaultValue;
} else {
return opts[key] = scope[key];
}
});
return opts;
};
map = mapCtrl.getMap();
polyline = new google.maps.Polyline(buildOpts(convertPathPoints(scope.path)));
if (isTrue(attrs.fit)) {
extendMapBounds(map, pathPoints);
}
if (angular.isDefined(scope.editable)) {
scope.$watch("editable", function(newValue, oldValue) {
return polyline.setEditable(newValue);
});
}
if (angular.isDefined(scope.draggable)) {
scope.$watch("draggable", function(newValue, oldValue) {
return polyline.setDraggable(newValue);
});
}
if (angular.isDefined(scope.visible)) {
scope.$watch("visible", function(newValue, oldValue) {
return polyline.setVisible(newValue);
});
}
if (angular.isDefined(scope.geodesic)) {
scope.$watch("geodesic", function(newValue, oldValue) {
return polyline.setOptions(buildOpts(polyline.getPath()));
});
}
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.weight)) {
scope.$watch("stroke.weight", function(newValue, oldValue) {
return polyline.setOptions(buildOpts(polyline.getPath()));
});
}
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.color)) {
scope.$watch("stroke.color", function(newValue, oldValue) {
return polyline.setOptions(buildOpts(polyline.getPath()));
});
}
arraySyncer = arraySync(polyline.getPath(), scope, "path");
return scope.$on("$destroy", function() {
polyline.setMap(null);
if (arraySyncer) {
arraySyncer();
return arraySyncer = null;
}
});
});
}
};
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
/*
Map info window directive
This directive is used to create an info window on an existing map.
This directive creates a new scope.
{attribute coords required} object containing latitude and longitude properties
{attribute show optional} map will show when this expression returns true
*/
(function() {
angular.module("google-maps").directive("window", [
"$timeout", "$compile", "$http", "$templateCache", function($timeout, $compile, $http, $templateCache) {
return new directives.api.Window($timeout, $compile, $http, $templateCache);
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
/*
Map info window directive
This directive is used to create an info window on an existing map.
This directive creates a new scope.
{attribute coords required} object containing latitude and longitude properties
{attribute show optional} map will show when this expression returns true
*/
(function() {
angular.module("google-maps").directive("windows", [
"$timeout", "$compile", "$http", "$templateCache", "$interpolate", function($timeout, $compile, $http, $templateCache, $interpolate) {
return new directives.api.Windows($timeout, $compile, $http, $templateCache, $interpolate);
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors:
- Nicolas Laplante https://plus.google.com/108189012221374960701
- Nicholas McCready - https://twitter.com/nmccready
*/
/*
Map Layer directive
This directive is used to create any type of Layer from the google maps sdk.
This directive creates a new scope.
{attribute show optional} true (default) shows the trafficlayer otherwise it is hidden
*/
(function() {
angular.module("google-maps").directive("layer", [
"$timeout", function($timeout) {
return new directives.api.Layer($timeout);
}
]);
}).call(this);
;/**
* @name InfoBox
* @version 1.1.12 [December 11, 2012]
* @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google)
* @copyright Copyright 2010 Gary Little [gary at luxcentral.com]
* @fileoverview InfoBox extends the Google Maps JavaScript API V3 <tt>OverlayView</tt> class.
* <p>
* An InfoBox behaves like a <tt>google.maps.InfoWindow</tt>, but it supports several
* additional properties for advanced styling. An InfoBox can also be used as a map label.
* <p>
* An InfoBox also fires the same events as a <tt>google.maps.InfoWindow</tt>.
*/
/*!
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint browser:true */
/*global google */
/**
* @name InfoBoxOptions
* @class This class represents the optional parameter passed to the {@link InfoBox} constructor.
* @property {string|Node} content The content of the InfoBox (plain text or an HTML DOM node).
* @property {boolean} [disableAutoPan=false] Disable auto-pan on <tt>open</tt>.
* @property {number} maxWidth The maximum width (in pixels) of the InfoBox. Set to 0 if no maximum.
* @property {Size} pixelOffset The offset (in pixels) from the top left corner of the InfoBox
* (or the bottom left corner if the <code>alignBottom</code> property is <code>true</code>)
* to the map pixel corresponding to <tt>position</tt>.
* @property {LatLng} position The geographic location at which to display the InfoBox.
* @property {number} zIndex The CSS z-index style value for the InfoBox.
* Note: This value overrides a zIndex setting specified in the <tt>boxStyle</tt> property.
* @property {string} [boxClass="infoBox"] The name of the CSS class defining the styles for the InfoBox container.
* @property {Object} [boxStyle] An object literal whose properties define specific CSS
* style values to be applied to the InfoBox. Style values defined here override those that may
* be defined in the <code>boxClass</code> style sheet. If this property is changed after the
* InfoBox has been created, all previously set styles (except those defined in the style sheet)
* are removed from the InfoBox before the new style values are applied.
* @property {string} closeBoxMargin The CSS margin style value for the close box.
* The default is "2px" (a 2-pixel margin on all sides).
* @property {string} closeBoxURL The URL of the image representing the close box.
* Note: The default is the URL for Google's standard close box.
* Set this property to "" if no close box is required.
* @property {Size} infoBoxClearance Minimum offset (in pixels) from the InfoBox to the
* map edge after an auto-pan.
* @property {boolean} [isHidden=false] Hide the InfoBox on <tt>open</tt>.
* [Deprecated in favor of the <tt>visible</tt> property.]
* @property {boolean} [visible=true] Show the InfoBox on <tt>open</tt>.
* @property {boolean} alignBottom Align the bottom left corner of the InfoBox to the <code>position</code>
* location (default is <tt>false</tt> which means that the top left corner of the InfoBox is aligned).
* @property {string} pane The pane where the InfoBox is to appear (default is "floatPane").
* Set the pane to "mapPane" if the InfoBox is being used as a map label.
* Valid pane names are the property names for the <tt>google.maps.MapPanes</tt> object.
* @property {boolean} enableEventPropagation Propagate mousedown, mousemove, mouseover, mouseout,
* mouseup, click, dblclick, touchstart, touchend, touchmove, and contextmenu events in the InfoBox
* (default is <tt>false</tt> to mimic the behavior of a <tt>google.maps.InfoWindow</tt>). Set
* this property to <tt>true</tt> if the InfoBox is being used as a map label.
*/
/**
* Creates an InfoBox with the options specified in {@link InfoBoxOptions}.
* Call <tt>InfoBox.open</tt> to add the box to the map.
* @constructor
* @param {InfoBoxOptions} [opt_opts]
*/
function InfoBox(opt_opts) {
opt_opts = opt_opts || {};
google.maps.OverlayView.apply(this, arguments);
// Standard options (in common with google.maps.InfoWindow):
//
this.content_ = opt_opts.content || "";
this.disableAutoPan_ = opt_opts.disableAutoPan || false;
this.maxWidth_ = opt_opts.maxWidth || 0;
this.pixelOffset_ = opt_opts.pixelOffset || new google.maps.Size(0, 0);
this.position_ = opt_opts.position || new google.maps.LatLng(0, 0);
this.zIndex_ = opt_opts.zIndex || null;
// Additional options (unique to InfoBox):
//
this.boxClass_ = opt_opts.boxClass || "infoBox";
this.boxStyle_ = opt_opts.boxStyle || {};
this.closeBoxMargin_ = opt_opts.closeBoxMargin || "2px";
this.closeBoxURL_ = opt_opts.closeBoxURL || "http://www.google.com/intl/en_us/mapfiles/close.gif";
if (opt_opts.closeBoxURL === "") {
this.closeBoxURL_ = "";
}
this.infoBoxClearance_ = opt_opts.infoBoxClearance || new google.maps.Size(1, 1);
if (typeof opt_opts.visible === "undefined") {
if (typeof opt_opts.isHidden === "undefined") {
opt_opts.visible = true;
} else {
opt_opts.visible = !opt_opts.isHidden;
}
}
this.isHidden_ = !opt_opts.visible;
this.alignBottom_ = opt_opts.alignBottom || false;
this.pane_ = opt_opts.pane || "floatPane";
this.enableEventPropagation_ = opt_opts.enableEventPropagation || false;
this.div_ = null;
this.closeListener_ = null;
this.moveListener_ = null;
this.contextListener_ = null;
this.eventListeners_ = null;
this.fixedWidthSet_ = null;
}
/* InfoBox extends OverlayView in the Google Maps API v3.
*/
InfoBox.prototype = new google.maps.OverlayView();
/**
* Creates the DIV representing the InfoBox.
* @private
*/
InfoBox.prototype.createInfoBoxDiv_ = function () {
var i;
var events;
var bw;
var me = this;
// This handler prevents an event in the InfoBox from being passed on to the map.
//
var cancelHandler = function (e) {
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
};
// This handler ignores the current event in the InfoBox and conditionally prevents
// the event from being passed on to the map. It is used for the contextmenu event.
//
var ignoreHandler = function (e) {
e.returnValue = false;
if (e.preventDefault) {
e.preventDefault();
}
if (!me.enableEventPropagation_) {
cancelHandler(e);
}
};
if (!this.div_) {
this.div_ = document.createElement("div");
this.setBoxStyle_();
if (typeof this.content_.nodeType === "undefined") {
this.div_.innerHTML = this.getCloseBoxImg_() + this.content_;
} else {
this.div_.innerHTML = this.getCloseBoxImg_();
this.div_.appendChild(this.content_);
}
// Add the InfoBox DIV to the DOM
this.getPanes()[this.pane_].appendChild(this.div_);
this.addClickHandler_();
if (this.div_.style.width) {
this.fixedWidthSet_ = true;
} else {
if (this.maxWidth_ !== 0 && this.div_.offsetWidth > this.maxWidth_) {
this.div_.style.width = this.maxWidth_;
this.div_.style.overflow = "auto";
this.fixedWidthSet_ = true;
} else { // The following code is needed to overcome problems with MSIE
bw = this.getBoxWidths_();
this.div_.style.width = (this.div_.offsetWidth - bw.left - bw.right) + "px";
this.fixedWidthSet_ = false;
}
}
this.panBox_(this.disableAutoPan_);
if (!this.enableEventPropagation_) {
this.eventListeners_ = [];
// Cancel event propagation.
//
// Note: mousemove not included (to resolve Issue 152)
events = ["mousedown", "mouseover", "mouseout", "mouseup",
"click", "dblclick", "touchstart", "touchend", "touchmove"];
for (i = 0; i < events.length; i++) {
this.eventListeners_.push(google.maps.event.addDomListener(this.div_, events[i], cancelHandler));
}
// Workaround for Google bug that causes the cursor to change to a pointer
// when the mouse moves over a marker underneath InfoBox.
this.eventListeners_.push(google.maps.event.addDomListener(this.div_, "mouseover", function (e) {
this.style.cursor = "default";
}));
}
this.contextListener_ = google.maps.event.addDomListener(this.div_, "contextmenu", ignoreHandler);
/**
* This event is fired when the DIV containing the InfoBox's content is attached to the DOM.
* @name InfoBox#domready
* @event
*/
google.maps.event.trigger(this, "domready");
}
};
/**
* Returns the HTML <IMG> tag for the close box.
* @private
*/
InfoBox.prototype.getCloseBoxImg_ = function () {
var img = "";
if (this.closeBoxURL_ !== "") {
img = "<img";
img += " src='" + this.closeBoxURL_ + "'";
img += " align=right"; // Do this because Opera chokes on style='float: right;'
img += " style='";
img += " position: relative;"; // Required by MSIE
img += " cursor: pointer;";
img += " margin: " + this.closeBoxMargin_ + ";";
img += "'>";
}
return img;
};
/**
* Adds the click handler to the InfoBox close box.
* @private
*/
InfoBox.prototype.addClickHandler_ = function () {
var closeBox;
if (this.closeBoxURL_ !== "") {
closeBox = this.div_.firstChild;
this.closeListener_ = google.maps.event.addDomListener(closeBox, "click", this.getCloseClickHandler_());
} else {
this.closeListener_ = null;
}
};
/**
* Returns the function to call when the user clicks the close box of an InfoBox.
* @private
*/
InfoBox.prototype.getCloseClickHandler_ = function () {
var me = this;
return function (e) {
// 1.0.3 fix: Always prevent propagation of a close box click to the map:
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
/**
* This event is fired when the InfoBox's close box is clicked.
* @name InfoBox#closeclick
* @event
*/
google.maps.event.trigger(me, "closeclick");
me.close();
};
};
/**
* Pans the map so that the InfoBox appears entirely within the map's visible area.
* @private
*/
InfoBox.prototype.panBox_ = function (disablePan) {
var map;
var bounds;
var xOffset = 0, yOffset = 0;
if (!disablePan) {
map = this.getMap();
if (map instanceof google.maps.Map) { // Only pan if attached to map, not panorama
if (!map.getBounds().contains(this.position_)) {
// Marker not in visible area of map, so set center
// of map to the marker position first.
map.setCenter(this.position_);
}
bounds = map.getBounds();
var mapDiv = map.getDiv();
var mapWidth = mapDiv.offsetWidth;
var mapHeight = mapDiv.offsetHeight;
var iwOffsetX = this.pixelOffset_.width;
var iwOffsetY = this.pixelOffset_.height;
var iwWidth = this.div_.offsetWidth;
var iwHeight = this.div_.offsetHeight;
var padX = this.infoBoxClearance_.width;
var padY = this.infoBoxClearance_.height;
var pixPosition = this.getProjection().fromLatLngToContainerPixel(this.position_);
if (pixPosition.x < (-iwOffsetX + padX)) {
xOffset = pixPosition.x + iwOffsetX - padX;
} else if ((pixPosition.x + iwWidth + iwOffsetX + padX) > mapWidth) {
xOffset = pixPosition.x + iwWidth + iwOffsetX + padX - mapWidth;
}
if (this.alignBottom_) {
if (pixPosition.y < (-iwOffsetY + padY + iwHeight)) {
yOffset = pixPosition.y + iwOffsetY - padY - iwHeight;
} else if ((pixPosition.y + iwOffsetY + padY) > mapHeight) {
yOffset = pixPosition.y + iwOffsetY + padY - mapHeight;
}
} else {
if (pixPosition.y < (-iwOffsetY + padY)) {
yOffset = pixPosition.y + iwOffsetY - padY;
} else if ((pixPosition.y + iwHeight + iwOffsetY + padY) > mapHeight) {
yOffset = pixPosition.y + iwHeight + iwOffsetY + padY - mapHeight;
}
}
if (!(xOffset === 0 && yOffset === 0)) {
// Move the map to the shifted center.
//
var c = map.getCenter();
map.panBy(xOffset, yOffset);
}
}
}
};
/**
* Sets the style of the InfoBox by setting the style sheet and applying
* other specific styles requested.
* @private
*/
InfoBox.prototype.setBoxStyle_ = function () {
var i, boxStyle;
if (this.div_) {
// Apply style values from the style sheet defined in the boxClass parameter:
this.div_.className = this.boxClass_;
// Clear existing inline style values:
this.div_.style.cssText = "";
// Apply style values defined in the boxStyle parameter:
boxStyle = this.boxStyle_;
for (i in boxStyle) {
if (boxStyle.hasOwnProperty(i)) {
this.div_.style[i] = boxStyle[i];
}
}
// Fix up opacity style for benefit of MSIE:
//
if (typeof this.div_.style.opacity !== "undefined" && this.div_.style.opacity !== "") {
this.div_.style.filter = "alpha(opacity=" + (this.div_.style.opacity * 100) + ")";
}
// Apply required styles:
//
this.div_.style.position = "absolute";
this.div_.style.visibility = 'hidden';
if (this.zIndex_ !== null) {
this.div_.style.zIndex = this.zIndex_;
}
}
};
/**
* Get the widths of the borders of the InfoBox.
* @private
* @return {Object} widths object (top, bottom left, right)
*/
InfoBox.prototype.getBoxWidths_ = function () {
var computedStyle;
var bw = {top: 0, bottom: 0, left: 0, right: 0};
var box = this.div_;
if (document.defaultView && document.defaultView.getComputedStyle) {
computedStyle = box.ownerDocument.defaultView.getComputedStyle(box, "");
if (computedStyle) {
// The computed styles are always in pixel units (good!)
bw.top = parseInt(computedStyle.borderTopWidth, 10) || 0;
bw.bottom = parseInt(computedStyle.borderBottomWidth, 10) || 0;
bw.left = parseInt(computedStyle.borderLeftWidth, 10) || 0;
bw.right = parseInt(computedStyle.borderRightWidth, 10) || 0;
}
} else if (document.documentElement.currentStyle) { // MSIE
if (box.currentStyle) {
// The current styles may not be in pixel units, but assume they are (bad!)
bw.top = parseInt(box.currentStyle.borderTopWidth, 10) || 0;
bw.bottom = parseInt(box.currentStyle.borderBottomWidth, 10) || 0;
bw.left = parseInt(box.currentStyle.borderLeftWidth, 10) || 0;
bw.right = parseInt(box.currentStyle.borderRightWidth, 10) || 0;
}
}
return bw;
};
/**
* Invoked when <tt>close</tt> is called. Do not call it directly.
*/
InfoBox.prototype.onRemove = function () {
if (this.div_) {
this.div_.parentNode.removeChild(this.div_);
this.div_ = null;
}
};
/**
* Draws the InfoBox based on the current map projection and zoom level.
*/
InfoBox.prototype.draw = function () {
this.createInfoBoxDiv_();
var pixPosition = this.getProjection().fromLatLngToDivPixel(this.position_);
this.div_.style.left = (pixPosition.x + this.pixelOffset_.width) + "px";
if (this.alignBottom_) {
this.div_.style.bottom = -(pixPosition.y + this.pixelOffset_.height) + "px";
} else {
this.div_.style.top = (pixPosition.y + this.pixelOffset_.height) + "px";
}
if (this.isHidden_) {
this.div_.style.visibility = 'hidden';
} else {
this.div_.style.visibility = "visible";
}
};
/**
* Sets the options for the InfoBox. Note that changes to the <tt>maxWidth</tt>,
* <tt>closeBoxMargin</tt>, <tt>closeBoxURL</tt>, and <tt>enableEventPropagation</tt>
* properties have no affect until the current InfoBox is <tt>close</tt>d and a new one
* is <tt>open</tt>ed.
* @param {InfoBoxOptions} opt_opts
*/
InfoBox.prototype.setOptions = function (opt_opts) {
if (typeof opt_opts.boxClass !== "undefined") { // Must be first
this.boxClass_ = opt_opts.boxClass;
this.setBoxStyle_();
}
if (typeof opt_opts.boxStyle !== "undefined") { // Must be second
this.boxStyle_ = opt_opts.boxStyle;
this.setBoxStyle_();
}
if (typeof opt_opts.content !== "undefined") {
this.setContent(opt_opts.content);
}
if (typeof opt_opts.disableAutoPan !== "undefined") {
this.disableAutoPan_ = opt_opts.disableAutoPan;
}
if (typeof opt_opts.maxWidth !== "undefined") {
this.maxWidth_ = opt_opts.maxWidth;
}
if (typeof opt_opts.pixelOffset !== "undefined") {
this.pixelOffset_ = opt_opts.pixelOffset;
}
if (typeof opt_opts.alignBottom !== "undefined") {
this.alignBottom_ = opt_opts.alignBottom;
}
if (typeof opt_opts.position !== "undefined") {
this.setPosition(opt_opts.position);
}
if (typeof opt_opts.zIndex !== "undefined") {
this.setZIndex(opt_opts.zIndex);
}
if (typeof opt_opts.closeBoxMargin !== "undefined") {
this.closeBoxMargin_ = opt_opts.closeBoxMargin;
}
if (typeof opt_opts.closeBoxURL !== "undefined") {
this.closeBoxURL_ = opt_opts.closeBoxURL;
}
if (typeof opt_opts.infoBoxClearance !== "undefined") {
this.infoBoxClearance_ = opt_opts.infoBoxClearance;
}
if (typeof opt_opts.isHidden !== "undefined") {
this.isHidden_ = opt_opts.isHidden;
}
if (typeof opt_opts.visible !== "undefined") {
this.isHidden_ = !opt_opts.visible;
}
if (typeof opt_opts.enableEventPropagation !== "undefined") {
this.enableEventPropagation_ = opt_opts.enableEventPropagation;
}
if (this.div_) {
this.draw();
}
};
/**
* Sets the content of the InfoBox.
* The content can be plain text or an HTML DOM node.
* @param {string|Node} content
*/
InfoBox.prototype.setContent = function (content) {
this.content_ = content;
if (this.div_) {
if (this.closeListener_) {
google.maps.event.removeListener(this.closeListener_);
this.closeListener_ = null;
}
// Odd code required to make things work with MSIE.
//
if (!this.fixedWidthSet_) {
this.div_.style.width = "";
}
if (typeof content.nodeType === "undefined") {
this.div_.innerHTML = this.getCloseBoxImg_() + content;
} else {
this.div_.innerHTML = this.getCloseBoxImg_();
this.div_.appendChild(content);
}
// Perverse code required to make things work with MSIE.
// (Ensures the close box does, in fact, float to the right.)
//
if (!this.fixedWidthSet_) {
this.div_.style.width = this.div_.offsetWidth + "px";
if (typeof content.nodeType === "undefined") {
this.div_.innerHTML = this.getCloseBoxImg_() + content;
} else {
this.div_.innerHTML = this.getCloseBoxImg_();
this.div_.appendChild(content);
}
}
this.addClickHandler_();
}
/**
* This event is fired when the content of the InfoBox changes.
* @name InfoBox#content_changed
* @event
*/
google.maps.event.trigger(this, "content_changed");
};
/**
* Sets the geographic location of the InfoBox.
* @param {LatLng} latlng
*/
InfoBox.prototype.setPosition = function (latlng) {
this.position_ = latlng;
if (this.div_) {
this.draw();
}
/**
* This event is fired when the position of the InfoBox changes.
* @name InfoBox#position_changed
* @event
*/
google.maps.event.trigger(this, "position_changed");
};
/**
* Sets the zIndex style for the InfoBox.
* @param {number} index
*/
InfoBox.prototype.setZIndex = function (index) {
this.zIndex_ = index;
if (this.div_) {
this.div_.style.zIndex = index;
}
/**
* This event is fired when the zIndex of the InfoBox changes.
* @name InfoBox#zindex_changed
* @event
*/
google.maps.event.trigger(this, "zindex_changed");
};
/**
* Sets the visibility of the InfoBox.
* @param {boolean} isVisible
*/
InfoBox.prototype.setVisible = function (isVisible) {
this.isHidden_ = !isVisible;
if (this.div_) {
this.div_.style.visibility = (this.isHidden_ ? "hidden" : "visible");
}
};
/**
* Returns the content of the InfoBox.
* @returns {string}
*/
InfoBox.prototype.getContent = function () {
return this.content_;
};
/**
* Returns the geographic location of the InfoBox.
* @returns {LatLng}
*/
InfoBox.prototype.getPosition = function () {
return this.position_;
};
/**
* Returns the zIndex for the InfoBox.
* @returns {number}
*/
InfoBox.prototype.getZIndex = function () {
return this.zIndex_;
};
/**
* Returns a flag indicating whether the InfoBox is visible.
* @returns {boolean}
*/
InfoBox.prototype.getVisible = function () {
var isVisible;
if ((typeof this.getMap() === "undefined") || (this.getMap() === null)) {
isVisible = false;
} else {
isVisible = !this.isHidden_;
}
return isVisible;
};
/**
* Shows the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.]
*/
InfoBox.prototype.show = function () {
this.isHidden_ = false;
if (this.div_) {
this.div_.style.visibility = "visible";
}
};
/**
* Hides the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.]
*/
InfoBox.prototype.hide = function () {
this.isHidden_ = true;
if (this.div_) {
this.div_.style.visibility = "hidden";
}
};
/**
* Adds the InfoBox to the specified map or Street View panorama. If <tt>anchor</tt>
* (usually a <tt>google.maps.Marker</tt>) is specified, the position
* of the InfoBox is set to the position of the <tt>anchor</tt>. If the
* anchor is dragged to a new location, the InfoBox moves as well.
* @param {Map|StreetViewPanorama} map
* @param {MVCObject} [anchor]
*/
InfoBox.prototype.open = function (map, anchor) {
var me = this;
if (anchor) {
this.position_ = anchor.getPosition();
this.moveListener_ = google.maps.event.addListener(anchor, "position_changed", function () {
me.setPosition(this.getPosition());
});
}
this.setMap(map);
if (this.div_) {
this.panBox_();
}
};
/**
* Removes the InfoBox from the map.
*/
InfoBox.prototype.close = function () {
var i;
if (this.closeListener_) {
google.maps.event.removeListener(this.closeListener_);
this.closeListener_ = null;
}
if (this.eventListeners_) {
for (i = 0; i < this.eventListeners_.length; i++) {
google.maps.event.removeListener(this.eventListeners_[i]);
}
this.eventListeners_ = null;
}
if (this.moveListener_) {
google.maps.event.removeListener(this.moveListener_);
this.moveListener_ = null;
}
if (this.contextListener_) {
google.maps.event.removeListener(this.contextListener_);
this.contextListener_ = null;
}
this.setMap(null);
};;/**
* @name MarkerClustererPlus for Google Maps V3
* @version 2.1.1 [November 4, 2013]
* @author Gary Little
* @fileoverview
* The library creates and manages per-zoom-level clusters for large amounts of markers.
* <p>
* This is an enhanced V3 implementation of the
* <a href="http://gmaps-utility-library-dev.googlecode.com/svn/tags/markerclusterer/"
* >V2 MarkerClusterer</a> by Xiaoxi Wu. It is based on the
* <a href="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/"
* >V3 MarkerClusterer</a> port by Luke Mahe. MarkerClustererPlus was created by Gary Little.
* <p>
* v2.0 release: MarkerClustererPlus v2.0 is backward compatible with MarkerClusterer v1.0. It
* adds support for the <code>ignoreHidden</code>, <code>title</code>, <code>batchSizeIE</code>,
* and <code>calculator</code> properties as well as support for four more events. It also allows
* greater control over the styling of the text that appears on the cluster marker. The
* documentation has been significantly improved and the overall code has been simplified and
* polished. Very large numbers of markers can now be managed without causing Javascript timeout
* errors on Internet Explorer. Note that the name of the <code>clusterclick</code> event has been
* deprecated. The new name is <code>click</code>, so please change your application code now.
*/
/**
* 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.
*/
/**
* @name ClusterIconStyle
* @class This class represents the object for values in the <code>styles</code> array passed
* to the {@link MarkerClusterer} constructor. The element in this array that is used to
* style the cluster icon is determined by calling the <code>calculator</code> function.
*
* @property {string} url The URL of the cluster icon image file. Required.
* @property {number} height The display height (in pixels) of the cluster icon. Required.
* @property {number} width The display width (in pixels) of the cluster icon. Required.
* @property {Array} [anchorText] The position (in pixels) from the center of the cluster icon to
* where the text label is to be centered and drawn. The format is <code>[yoffset, xoffset]</code>
* where <code>yoffset</code> increases as you go down from center and <code>xoffset</code>
* increases to the right of center. The default is <code>[0, 0]</code>.
* @property {Array} [anchorIcon] The anchor position (in pixels) of the cluster icon. This is the
* spot on the cluster icon that is to be aligned with the cluster position. The format is
* <code>[yoffset, xoffset]</code> where <code>yoffset</code> increases as you go down and
* <code>xoffset</code> increases to the right of the top-left corner of the icon. The default
* anchor position is the center of the cluster icon.
* @property {string} [textColor="black"] The color of the label text shown on the
* cluster icon.
* @property {number} [textSize=11] The size (in pixels) of the label text shown on the
* cluster icon.
* @property {string} [textDecoration="none"] The value of the CSS <code>text-decoration</code>
* property for the label text shown on the cluster icon.
* @property {string} [fontWeight="bold"] The value of the CSS <code>font-weight</code>
* property for the label text shown on the cluster icon.
* @property {string} [fontStyle="normal"] The value of the CSS <code>font-style</code>
* property for the label text shown on the cluster icon.
* @property {string} [fontFamily="Arial,sans-serif"] The value of the CSS <code>font-family</code>
* property for the label text shown on the cluster icon.
* @property {string} [backgroundPosition="0 0"] The position of the cluster icon image
* within the image defined by <code>url</code>. The format is <code>"xpos ypos"</code>
* (the same format as for the CSS <code>background-position</code> property). You must set
* this property appropriately when the image defined by <code>url</code> represents a sprite
* containing multiple images. Note that the position <i>must</i> be specified in px units.
*/
/**
* @name ClusterIconInfo
* @class This class is an object containing general information about a cluster icon. This is
* the object that a <code>calculator</code> function returns.
*
* @property {string} text The text of the label to be shown on the cluster icon.
* @property {number} index The index plus 1 of the element in the <code>styles</code>
* array to be used to style the cluster icon.
* @property {string} title The tooltip to display when the mouse moves over the cluster icon.
* If this value is <code>undefined</code> or <code>""</code>, <code>title</code> is set to the
* value of the <code>title</code> property passed to the MarkerClusterer.
*/
/**
* A cluster icon.
*
* @constructor
* @extends google.maps.OverlayView
* @param {Cluster} cluster The cluster with which the icon is to be associated.
* @param {Array} [styles] An array of {@link ClusterIconStyle} defining the cluster icons
* to use for various cluster sizes.
* @private
*/
function ClusterIcon(cluster, styles) {
cluster.getMarkerClusterer().extend(ClusterIcon, google.maps.OverlayView);
this.cluster_ = cluster;
this.className_ = cluster.getMarkerClusterer().getClusterClass();
this.styles_ = styles;
this.center_ = null;
this.div_ = null;
this.sums_ = null;
this.visible_ = false;
this.setMap(cluster.getMap()); // Note: this causes onAdd to be called
}
/**
* Adds the icon to the DOM.
*/
ClusterIcon.prototype.onAdd = function () {
var cClusterIcon = this;
var cMouseDownInCluster;
var cDraggingMapByCluster;
this.div_ = document.createElement("div");
this.div_.className = this.className_;
if (this.visible_) {
this.show();
}
this.getPanes().overlayMouseTarget.appendChild(this.div_);
// Fix for Issue 157
this.boundsChangedListener_ = google.maps.event.addListener(this.getMap(), "bounds_changed", function () {
cDraggingMapByCluster = cMouseDownInCluster;
});
google.maps.event.addDomListener(this.div_, "mousedown", function () {
cMouseDownInCluster = true;
cDraggingMapByCluster = false;
});
google.maps.event.addDomListener(this.div_, "click", function (e) {
cMouseDownInCluster = false;
if (!cDraggingMapByCluster) {
var theBounds;
var mz;
var mc = cClusterIcon.cluster_.getMarkerClusterer();
/**
* This event is fired when a cluster marker is clicked.
* @name MarkerClusterer#click
* @param {Cluster} c The cluster that was clicked.
* @event
*/
google.maps.event.trigger(mc, "click", cClusterIcon.cluster_);
google.maps.event.trigger(mc, "clusterclick", cClusterIcon.cluster_); // deprecated name
// The default click handler follows. Disable it by setting
// the zoomOnClick property to false.
if (mc.getZoomOnClick()) {
// Zoom into the cluster.
mz = mc.getMaxZoom();
theBounds = cClusterIcon.cluster_.getBounds();
mc.getMap().fitBounds(theBounds);
// There is a fix for Issue 170 here:
setTimeout(function () {
mc.getMap().fitBounds(theBounds);
// Don't zoom beyond the max zoom level
if (mz !== null && (mc.getMap().getZoom() > mz)) {
mc.getMap().setZoom(mz + 1);
}
}, 100);
}
// Prevent event propagation to the map:
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
}
});
google.maps.event.addDomListener(this.div_, "mouseover", function () {
var mc = cClusterIcon.cluster_.getMarkerClusterer();
/**
* This event is fired when the mouse moves over a cluster marker.
* @name MarkerClusterer#mouseover
* @param {Cluster} c The cluster that the mouse moved over.
* @event
*/
google.maps.event.trigger(mc, "mouseover", cClusterIcon.cluster_);
});
google.maps.event.addDomListener(this.div_, "mouseout", function () {
var mc = cClusterIcon.cluster_.getMarkerClusterer();
/**
* This event is fired when the mouse moves out of a cluster marker.
* @name MarkerClusterer#mouseout
* @param {Cluster} c The cluster that the mouse moved out of.
* @event
*/
google.maps.event.trigger(mc, "mouseout", cClusterIcon.cluster_);
});
};
/**
* Removes the icon from the DOM.
*/
ClusterIcon.prototype.onRemove = function () {
if (this.div_ && this.div_.parentNode) {
this.hide();
google.maps.event.removeListener(this.boundsChangedListener_);
google.maps.event.clearInstanceListeners(this.div_);
this.div_.parentNode.removeChild(this.div_);
this.div_ = null;
}
};
/**
* Draws the icon.
*/
ClusterIcon.prototype.draw = function () {
if (this.visible_) {
var pos = this.getPosFromLatLng_(this.center_);
this.div_.style.top = pos.y + "px";
this.div_.style.left = pos.x + "px";
}
};
/**
* Hides the icon.
*/
ClusterIcon.prototype.hide = function () {
if (this.div_) {
this.div_.style.display = "none";
}
this.visible_ = false;
};
/**
* Positions and shows the icon.
*/
ClusterIcon.prototype.show = function () {
if (this.div_) {
var img = "";
// NOTE: values must be specified in px units
var bp = this.backgroundPosition_.split(" ");
var spriteH = parseInt(bp[0].trim(), 10);
var spriteV = parseInt(bp[1].trim(), 10);
var pos = this.getPosFromLatLng_(this.center_);
this.div_.style.cssText = this.createCss(pos);
img = "<img src='" + this.url_ + "' style='position: absolute; top: " + spriteV + "px; left: " + spriteH + "px; ";
if (!this.cluster_.getMarkerClusterer().enableRetinaIcons_) {
img += "clip: rect(" + (-1 * spriteV) + "px, " + ((-1 * spriteH) + this.width_) + "px, " +
((-1 * spriteV) + this.height_) + "px, " + (-1 * spriteH) + "px);";
}
img += "'>";
this.div_.innerHTML = img + "<div style='" +
"position: absolute;" +
"top: " + this.anchorText_[0] + "px;" +
"left: " + this.anchorText_[1] + "px;" +
"color: " + this.textColor_ + ";" +
"font-size: " + this.textSize_ + "px;" +
"font-family: " + this.fontFamily_ + ";" +
"font-weight: " + this.fontWeight_ + ";" +
"font-style: " + this.fontStyle_ + ";" +
"text-decoration: " + this.textDecoration_ + ";" +
"text-align: center;" +
"width: " + this.width_ + "px;" +
"line-height:" + this.height_ + "px;" +
"'>" + this.sums_.text + "</div>";
if (typeof this.sums_.title === "undefined" || this.sums_.title === "") {
this.div_.title = this.cluster_.getMarkerClusterer().getTitle();
} else {
this.div_.title = this.sums_.title;
}
this.div_.style.display = "";
}
this.visible_ = true;
};
/**
* Sets the icon styles to the appropriate element in the styles array.
*
* @param {ClusterIconInfo} sums The icon label text and styles index.
*/
ClusterIcon.prototype.useStyle = function (sums) {
this.sums_ = sums;
var index = Math.max(0, sums.index - 1);
index = Math.min(this.styles_.length - 1, index);
var style = this.styles_[index];
this.url_ = style.url;
this.height_ = style.height;
this.width_ = style.width;
this.anchorText_ = style.anchorText || [0, 0];
this.anchorIcon_ = style.anchorIcon || [parseInt(this.height_ / 2, 10), parseInt(this.width_ / 2, 10)];
this.textColor_ = style.textColor || "black";
this.textSize_ = style.textSize || 11;
this.textDecoration_ = style.textDecoration || "none";
this.fontWeight_ = style.fontWeight || "bold";
this.fontStyle_ = style.fontStyle || "normal";
this.fontFamily_ = style.fontFamily || "Arial,sans-serif";
this.backgroundPosition_ = style.backgroundPosition || "0 0";
};
/**
* Sets the position at which to center the icon.
*
* @param {google.maps.LatLng} center The latlng to set as the center.
*/
ClusterIcon.prototype.setCenter = function (center) {
this.center_ = center;
};
/**
* Creates the cssText style parameter based on the position of the icon.
*
* @param {google.maps.Point} pos The position of the icon.
* @return {string} The CSS style text.
*/
ClusterIcon.prototype.createCss = function (pos) {
var style = [];
style.push("cursor: pointer;");
style.push("position: absolute; top: " + pos.y + "px; left: " + pos.x + "px;");
style.push("width: " + this.width_ + "px; height: " + this.height_ + "px;");
return style.join("");
};
/**
* Returns the position at which to place the DIV depending on the latlng.
*
* @param {google.maps.LatLng} latlng The position in latlng.
* @return {google.maps.Point} The position in pixels.
*/
ClusterIcon.prototype.getPosFromLatLng_ = function (latlng) {
var pos = this.getProjection().fromLatLngToDivPixel(latlng);
pos.x -= this.anchorIcon_[1];
pos.y -= this.anchorIcon_[0];
pos.x = parseInt(pos.x, 10);
pos.y = parseInt(pos.y, 10);
return pos;
};
/**
* Creates a single cluster that manages a group of proximate markers.
* Used internally, do not call this constructor directly.
* @constructor
* @param {MarkerClusterer} mc The <code>MarkerClusterer</code> object with which this
* cluster is associated.
*/
function Cluster(mc) {
this.markerClusterer_ = mc;
this.map_ = mc.getMap();
this.gridSize_ = mc.getGridSize();
this.minClusterSize_ = mc.getMinimumClusterSize();
this.averageCenter_ = mc.getAverageCenter();
this.markers_ = [];
this.center_ = null;
this.bounds_ = null;
this.clusterIcon_ = new ClusterIcon(this, mc.getStyles());
}
/**
* Returns the number of markers managed by the cluster. You can call this from
* a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler
* for the <code>MarkerClusterer</code> object.
*
* @return {number} The number of markers in the cluster.
*/
Cluster.prototype.getSize = function () {
return this.markers_.length;
};
/**
* Returns the array of markers managed by the cluster. You can call this from
* a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler
* for the <code>MarkerClusterer</code> object.
*
* @return {Array} The array of markers in the cluster.
*/
Cluster.prototype.getMarkers = function () {
return this.markers_;
};
/**
* Returns the center of the cluster. You can call this from
* a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler
* for the <code>MarkerClusterer</code> object.
*
* @return {google.maps.LatLng} The center of the cluster.
*/
Cluster.prototype.getCenter = function () {
return this.center_;
};
/**
* Returns the map with which the cluster is associated.
*
* @return {google.maps.Map} The map.
* @ignore
*/
Cluster.prototype.getMap = function () {
return this.map_;
};
/**
* Returns the <code>MarkerClusterer</code> object with which the cluster is associated.
*
* @return {MarkerClusterer} The associated marker clusterer.
* @ignore
*/
Cluster.prototype.getMarkerClusterer = function () {
return this.markerClusterer_;
};
/**
* Returns the bounds of the cluster.
*
* @return {google.maps.LatLngBounds} the cluster bounds.
* @ignore
*/
Cluster.prototype.getBounds = function () {
var i;
var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
var markers = this.getMarkers();
for (i = 0; i < markers.length; i++) {
bounds.extend(markers[i].getPosition());
}
return bounds;
};
/**
* Removes the cluster from the map.
*
* @ignore
*/
Cluster.prototype.remove = function () {
this.clusterIcon_.setMap(null);
this.markers_ = [];
delete this.markers_;
};
/**
* Adds a marker to the cluster.
*
* @param {google.maps.Marker} marker The marker to be added.
* @return {boolean} True if the marker was added.
* @ignore
*/
Cluster.prototype.addMarker = function (marker) {
var i;
var mCount;
var mz;
if (this.isMarkerAlreadyAdded_(marker)) {
return false;
}
if (!this.center_) {
this.center_ = marker.getPosition();
this.calculateBounds_();
} else {
if (this.averageCenter_) {
var l = this.markers_.length + 1;
var lat = (this.center_.lat() * (l - 1) + marker.getPosition().lat()) / l;
var lng = (this.center_.lng() * (l - 1) + marker.getPosition().lng()) / l;
this.center_ = new google.maps.LatLng(lat, lng);
this.calculateBounds_();
}
}
marker.isAdded = true;
this.markers_.push(marker);
mCount = this.markers_.length;
mz = this.markerClusterer_.getMaxZoom();
if (mz !== null && this.map_.getZoom() > mz) {
// Zoomed in past max zoom, so show the marker.
if (marker.getMap() !== this.map_) {
marker.setMap(this.map_);
}
} else if (mCount < this.minClusterSize_) {
// Min cluster size not reached so show the marker.
if (marker.getMap() !== this.map_) {
marker.setMap(this.map_);
}
} else if (mCount === this.minClusterSize_) {
// Hide the markers that were showing.
for (i = 0; i < mCount; i++) {
this.markers_[i].setMap(null);
}
} else {
marker.setMap(null);
}
this.updateIcon_();
return true;
};
/**
* Determines if a marker lies within the cluster's bounds.
*
* @param {google.maps.Marker} marker The marker to check.
* @return {boolean} True if the marker lies in the bounds.
* @ignore
*/
Cluster.prototype.isMarkerInClusterBounds = function (marker) {
return this.bounds_.contains(marker.getPosition());
};
/**
* Calculates the extended bounds of the cluster with the grid.
*/
Cluster.prototype.calculateBounds_ = function () {
var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
this.bounds_ = this.markerClusterer_.getExtendedBounds(bounds);
};
/**
* Updates the cluster icon.
*/
Cluster.prototype.updateIcon_ = function () {
var mCount = this.markers_.length;
var mz = this.markerClusterer_.getMaxZoom();
if (mz !== null && this.map_.getZoom() > mz) {
this.clusterIcon_.hide();
return;
}
if (mCount < this.minClusterSize_) {
// Min cluster size not yet reached.
this.clusterIcon_.hide();
return;
}
var numStyles = this.markerClusterer_.getStyles().length;
var sums = this.markerClusterer_.getCalculator()(this.markers_, numStyles);
this.clusterIcon_.setCenter(this.center_);
this.clusterIcon_.useStyle(sums);
this.clusterIcon_.show();
};
/**
* Determines if a marker has already been added to the cluster.
*
* @param {google.maps.Marker} marker The marker to check.
* @return {boolean} True if the marker has already been added.
*/
Cluster.prototype.isMarkerAlreadyAdded_ = function (marker) {
var i;
if (this.markers_.indexOf) {
return this.markers_.indexOf(marker) !== -1;
} else {
for (i = 0; i < this.markers_.length; i++) {
if (marker === this.markers_[i]) {
return true;
}
}
}
return false;
};
/**
* @name MarkerClustererOptions
* @class This class represents the optional parameter passed to
* the {@link MarkerClusterer} constructor.
* @property {number} [gridSize=60] The grid size of a cluster in pixels. The grid is a square.
* @property {number} [maxZoom=null] The maximum zoom level at which clustering is enabled or
* <code>null</code> if clustering is to be enabled at all zoom levels.
* @property {boolean} [zoomOnClick=true] Whether to zoom the map when a cluster marker is
* clicked. You may want to set this to <code>false</code> if you have installed a handler
* for the <code>click</code> event and it deals with zooming on its own.
* @property {boolean} [averageCenter=false] Whether the position of a cluster marker should be
* the average position of all markers in the cluster. If set to <code>false</code>, the
* cluster marker is positioned at the location of the first marker added to the cluster.
* @property {number} [minimumClusterSize=2] The minimum number of markers needed in a cluster
* before the markers are hidden and a cluster marker appears.
* @property {boolean} [ignoreHidden=false] Whether to ignore hidden markers in clusters. You
* may want to set this to <code>true</code> to ensure that hidden markers are not included
* in the marker count that appears on a cluster marker (this count is the value of the
* <code>text</code> property of the result returned by the default <code>calculator</code>).
* If set to <code>true</code> and you change the visibility of a marker being clustered, be
* sure to also call <code>MarkerClusterer.repaint()</code>.
* @property {string} [title=""] The tooltip to display when the mouse moves over a cluster
* marker. (Alternatively, you can use a custom <code>calculator</code> function to specify a
* different tooltip for each cluster marker.)
* @property {function} [calculator=MarkerClusterer.CALCULATOR] The function used to determine
* the text to be displayed on a cluster marker and the index indicating which style to use
* for the cluster marker. The input parameters for the function are (1) the array of markers
* represented by a cluster marker and (2) the number of cluster icon styles. It returns a
* {@link ClusterIconInfo} object. The default <code>calculator</code> returns a
* <code>text</code> property which is the number of markers in the cluster and an
* <code>index</code> property which is one higher than the lowest integer such that
* <code>10^i</code> exceeds the number of markers in the cluster, or the size of the styles
* array, whichever is less. The <code>styles</code> array element used has an index of
* <code>index</code> minus 1. For example, the default <code>calculator</code> returns a
* <code>text</code> value of <code>"125"</code> and an <code>index</code> of <code>3</code>
* for a cluster icon representing 125 markers so the element used in the <code>styles</code>
* array is <code>2</code>. A <code>calculator</code> may also return a <code>title</code>
* property that contains the text of the tooltip to be used for the cluster marker. If
* <code>title</code> is not defined, the tooltip is set to the value of the <code>title</code>
* property for the MarkerClusterer.
* @property {string} [clusterClass="cluster"] The name of the CSS class defining general styles
* for the cluster markers. Use this class to define CSS styles that are not set up by the code
* that processes the <code>styles</code> array.
* @property {Array} [styles] An array of {@link ClusterIconStyle} elements defining the styles
* of the cluster markers to be used. The element to be used to style a given cluster marker
* is determined by the function defined by the <code>calculator</code> property.
* The default is an array of {@link ClusterIconStyle} elements whose properties are derived
* from the values for <code>imagePath</code>, <code>imageExtension</code>, and
* <code>imageSizes</code>.
* @property {boolean} [enableRetinaIcons=false] Whether to allow the use of cluster icons that
* have sizes that are some multiple (typically double) of their actual display size. Icons such
* as these look better when viewed on high-resolution monitors such as Apple's Retina displays.
* Note: if this property is <code>true</code>, sprites cannot be used as cluster icons.
* @property {number} [batchSize=MarkerClusterer.BATCH_SIZE] Set this property to the
* number of markers to be processed in a single batch when using a browser other than
* Internet Explorer (for Internet Explorer, use the batchSizeIE property instead).
* @property {number} [batchSizeIE=MarkerClusterer.BATCH_SIZE_IE] When Internet Explorer is
* being used, markers are processed in several batches with a small delay inserted between
* each batch in an attempt to avoid Javascript timeout errors. Set this property to the
* number of markers to be processed in a single batch; select as high a number as you can
* without causing a timeout error in the browser. This number might need to be as low as 100
* if 15,000 markers are being managed, for example.
* @property {string} [imagePath=MarkerClusterer.IMAGE_PATH]
* The full URL of the root name of the group of image files to use for cluster icons.
* The complete file name is of the form <code>imagePath</code>n.<code>imageExtension</code>
* where n is the image file number (1, 2, etc.).
* @property {string} [imageExtension=MarkerClusterer.IMAGE_EXTENSION]
* The extension name for the cluster icon image files (e.g., <code>"png"</code> or
* <code>"jpg"</code>).
* @property {Array} [imageSizes=MarkerClusterer.IMAGE_SIZES]
* An array of numbers containing the widths of the group of
* <code>imagePath</code>n.<code>imageExtension</code> image files.
* (The images are assumed to be square.)
*/
/**
* Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}.
* @constructor
* @extends google.maps.OverlayView
* @param {google.maps.Map} map The Google map to attach to.
* @param {Array.<google.maps.Marker>} [opt_markers] The markers to be added to the cluster.
* @param {MarkerClustererOptions} [opt_options] The optional parameters.
*/
function MarkerClusterer(map, opt_markers, opt_options) {
// MarkerClusterer implements google.maps.OverlayView interface. We use the
// extend function to extend MarkerClusterer with google.maps.OverlayView
// because it might not always be available when the code is defined so we
// look for it at the last possible moment. If it doesn't exist now then
// there is no point going ahead :)
this.extend(MarkerClusterer, google.maps.OverlayView);
opt_markers = opt_markers || [];
opt_options = opt_options || {};
this.markers_ = [];
this.clusters_ = [];
this.listeners_ = [];
this.activeMap_ = null;
this.ready_ = false;
this.gridSize_ = opt_options.gridSize || 60;
this.minClusterSize_ = opt_options.minimumClusterSize || 2;
this.maxZoom_ = opt_options.maxZoom || null;
this.styles_ = opt_options.styles || [];
this.title_ = opt_options.title || "";
this.zoomOnClick_ = true;
if (opt_options.zoomOnClick !== undefined) {
this.zoomOnClick_ = opt_options.zoomOnClick;
}
this.averageCenter_ = false;
if (opt_options.averageCenter !== undefined) {
this.averageCenter_ = opt_options.averageCenter;
}
this.ignoreHidden_ = false;
if (opt_options.ignoreHidden !== undefined) {
this.ignoreHidden_ = opt_options.ignoreHidden;
}
this.enableRetinaIcons_ = false;
if (opt_options.enableRetinaIcons !== undefined) {
this.enableRetinaIcons_ = opt_options.enableRetinaIcons;
}
this.imagePath_ = opt_options.imagePath || MarkerClusterer.IMAGE_PATH;
this.imageExtension_ = opt_options.imageExtension || MarkerClusterer.IMAGE_EXTENSION;
this.imageSizes_ = opt_options.imageSizes || MarkerClusterer.IMAGE_SIZES;
this.calculator_ = opt_options.calculator || MarkerClusterer.CALCULATOR;
this.batchSize_ = opt_options.batchSize || MarkerClusterer.BATCH_SIZE;
this.batchSizeIE_ = opt_options.batchSizeIE || MarkerClusterer.BATCH_SIZE_IE;
this.clusterClass_ = opt_options.clusterClass || "cluster";
if (navigator.userAgent.toLowerCase().indexOf("msie") !== -1) {
// Try to avoid IE timeout when processing a huge number of markers:
this.batchSize_ = this.batchSizeIE_;
}
this.setupStyles_();
this.addMarkers(opt_markers, true);
this.setMap(map); // Note: this causes onAdd to be called
}
/**
* Implementation of the onAdd interface method.
* @ignore
*/
MarkerClusterer.prototype.onAdd = function () {
var cMarkerClusterer = this;
this.activeMap_ = this.getMap();
this.ready_ = true;
this.repaint();
// Add the map event listeners
this.listeners_ = [
google.maps.event.addListener(this.getMap(), "zoom_changed", function () {
cMarkerClusterer.resetViewport_(false);
// Workaround for this Google bug: when map is at level 0 and "-" of
// zoom slider is clicked, a "zoom_changed" event is fired even though
// the map doesn't zoom out any further. In this situation, no "idle"
// event is triggered so the cluster markers that have been removed
// do not get redrawn. Same goes for a zoom in at maxZoom.
if (this.getZoom() === (this.get("minZoom") || 0) || this.getZoom() === this.get("maxZoom")) {
google.maps.event.trigger(this, "idle");
}
}),
google.maps.event.addListener(this.getMap(), "idle", function () {
cMarkerClusterer.redraw_();
})
];
};
/**
* Implementation of the onRemove interface method.
* Removes map event listeners and all cluster icons from the DOM.
* All managed markers are also put back on the map.
* @ignore
*/
MarkerClusterer.prototype.onRemove = function () {
var i;
// Put all the managed markers back on the map:
for (i = 0; i < this.markers_.length; i++) {
if (this.markers_[i].getMap() !== this.activeMap_) {
this.markers_[i].setMap(this.activeMap_);
}
}
// Remove all clusters:
for (i = 0; i < this.clusters_.length; i++) {
this.clusters_[i].remove();
}
this.clusters_ = [];
// Remove map event listeners:
for (i = 0; i < this.listeners_.length; i++) {
google.maps.event.removeListener(this.listeners_[i]);
}
this.listeners_ = [];
this.activeMap_ = null;
this.ready_ = false;
};
/**
* Implementation of the draw interface method.
* @ignore
*/
MarkerClusterer.prototype.draw = function () {};
/**
* Sets up the styles object.
*/
MarkerClusterer.prototype.setupStyles_ = function () {
var i, size;
if (this.styles_.length > 0) {
return;
}
for (i = 0; i < this.imageSizes_.length; i++) {
size = this.imageSizes_[i];
this.styles_.push({
url: this.imagePath_ + (i + 1) + "." + this.imageExtension_,
height: size,
width: size
});
}
};
/**
* Fits the map to the bounds of the markers managed by the clusterer.
*/
MarkerClusterer.prototype.fitMapToMarkers = function () {
var i;
var markers = this.getMarkers();
var bounds = new google.maps.LatLngBounds();
for (i = 0; i < markers.length; i++) {
bounds.extend(markers[i].getPosition());
}
this.getMap().fitBounds(bounds);
};
/**
* Returns the value of the <code>gridSize</code> property.
*
* @return {number} The grid size.
*/
MarkerClusterer.prototype.getGridSize = function () {
return this.gridSize_;
};
/**
* Sets the value of the <code>gridSize</code> property.
*
* @param {number} gridSize The grid size.
*/
MarkerClusterer.prototype.setGridSize = function (gridSize) {
this.gridSize_ = gridSize;
};
/**
* Returns the value of the <code>minimumClusterSize</code> property.
*
* @return {number} The minimum cluster size.
*/
MarkerClusterer.prototype.getMinimumClusterSize = function () {
return this.minClusterSize_;
};
/**
* Sets the value of the <code>minimumClusterSize</code> property.
*
* @param {number} minimumClusterSize The minimum cluster size.
*/
MarkerClusterer.prototype.setMinimumClusterSize = function (minimumClusterSize) {
this.minClusterSize_ = minimumClusterSize;
};
/**
* Returns the value of the <code>maxZoom</code> property.
*
* @return {number} The maximum zoom level.
*/
MarkerClusterer.prototype.getMaxZoom = function () {
return this.maxZoom_;
};
/**
* Sets the value of the <code>maxZoom</code> property.
*
* @param {number} maxZoom The maximum zoom level.
*/
MarkerClusterer.prototype.setMaxZoom = function (maxZoom) {
this.maxZoom_ = maxZoom;
};
/**
* Returns the value of the <code>styles</code> property.
*
* @return {Array} The array of styles defining the cluster markers to be used.
*/
MarkerClusterer.prototype.getStyles = function () {
return this.styles_;
};
/**
* Sets the value of the <code>styles</code> property.
*
* @param {Array.<ClusterIconStyle>} styles The array of styles to use.
*/
MarkerClusterer.prototype.setStyles = function (styles) {
this.styles_ = styles;
};
/**
* Returns the value of the <code>title</code> property.
*
* @return {string} The content of the title text.
*/
MarkerClusterer.prototype.getTitle = function () {
return this.title_;
};
/**
* Sets the value of the <code>title</code> property.
*
* @param {string} title The value of the title property.
*/
MarkerClusterer.prototype.setTitle = function (title) {
this.title_ = title;
};
/**
* Returns the value of the <code>zoomOnClick</code> property.
*
* @return {boolean} True if zoomOnClick property is set.
*/
MarkerClusterer.prototype.getZoomOnClick = function () {
return this.zoomOnClick_;
};
/**
* Sets the value of the <code>zoomOnClick</code> property.
*
* @param {boolean} zoomOnClick The value of the zoomOnClick property.
*/
MarkerClusterer.prototype.setZoomOnClick = function (zoomOnClick) {
this.zoomOnClick_ = zoomOnClick;
};
/**
* Returns the value of the <code>averageCenter</code> property.
*
* @return {boolean} True if averageCenter property is set.
*/
MarkerClusterer.prototype.getAverageCenter = function () {
return this.averageCenter_;
};
/**
* Sets the value of the <code>averageCenter</code> property.
*
* @param {boolean} averageCenter The value of the averageCenter property.
*/
MarkerClusterer.prototype.setAverageCenter = function (averageCenter) {
this.averageCenter_ = averageCenter;
};
/**
* Returns the value of the <code>ignoreHidden</code> property.
*
* @return {boolean} True if ignoreHidden property is set.
*/
MarkerClusterer.prototype.getIgnoreHidden = function () {
return this.ignoreHidden_;
};
/**
* Sets the value of the <code>ignoreHidden</code> property.
*
* @param {boolean} ignoreHidden The value of the ignoreHidden property.
*/
MarkerClusterer.prototype.setIgnoreHidden = function (ignoreHidden) {
this.ignoreHidden_ = ignoreHidden;
};
/**
* Returns the value of the <code>enableRetinaIcons</code> property.
*
* @return {boolean} True if enableRetinaIcons property is set.
*/
MarkerClusterer.prototype.getEnableRetinaIcons = function () {
return this.enableRetinaIcons_;
};
/**
* Sets the value of the <code>enableRetinaIcons</code> property.
*
* @param {boolean} enableRetinaIcons The value of the enableRetinaIcons property.
*/
MarkerClusterer.prototype.setEnableRetinaIcons = function (enableRetinaIcons) {
this.enableRetinaIcons_ = enableRetinaIcons;
};
/**
* Returns the value of the <code>imageExtension</code> property.
*
* @return {string} The value of the imageExtension property.
*/
MarkerClusterer.prototype.getImageExtension = function () {
return this.imageExtension_;
};
/**
* Sets the value of the <code>imageExtension</code> property.
*
* @param {string} imageExtension The value of the imageExtension property.
*/
MarkerClusterer.prototype.setImageExtension = function (imageExtension) {
this.imageExtension_ = imageExtension;
};
/**
* Returns the value of the <code>imagePath</code> property.
*
* @return {string} The value of the imagePath property.
*/
MarkerClusterer.prototype.getImagePath = function () {
return this.imagePath_;
};
/**
* Sets the value of the <code>imagePath</code> property.
*
* @param {string} imagePath The value of the imagePath property.
*/
MarkerClusterer.prototype.setImagePath = function (imagePath) {
this.imagePath_ = imagePath;
};
/**
* Returns the value of the <code>imageSizes</code> property.
*
* @return {Array} The value of the imageSizes property.
*/
MarkerClusterer.prototype.getImageSizes = function () {
return this.imageSizes_;
};
/**
* Sets the value of the <code>imageSizes</code> property.
*
* @param {Array} imageSizes The value of the imageSizes property.
*/
MarkerClusterer.prototype.setImageSizes = function (imageSizes) {
this.imageSizes_ = imageSizes;
};
/**
* Returns the value of the <code>calculator</code> property.
*
* @return {function} the value of the calculator property.
*/
MarkerClusterer.prototype.getCalculator = function () {
return this.calculator_;
};
/**
* Sets the value of the <code>calculator</code> property.
*
* @param {function(Array.<google.maps.Marker>, number)} calculator The value
* of the calculator property.
*/
MarkerClusterer.prototype.setCalculator = function (calculator) {
this.calculator_ = calculator;
};
/**
* Returns the value of the <code>batchSizeIE</code> property.
*
* @return {number} the value of the batchSizeIE property.
*/
MarkerClusterer.prototype.getBatchSizeIE = function () {
return this.batchSizeIE_;
};
/**
* Sets the value of the <code>batchSizeIE</code> property.
*
* @param {number} batchSizeIE The value of the batchSizeIE property.
*/
MarkerClusterer.prototype.setBatchSizeIE = function (batchSizeIE) {
this.batchSizeIE_ = batchSizeIE;
};
/**
* Returns the value of the <code>clusterClass</code> property.
*
* @return {string} the value of the clusterClass property.
*/
MarkerClusterer.prototype.getClusterClass = function () {
return this.clusterClass_;
};
/**
* Sets the value of the <code>clusterClass</code> property.
*
* @param {string} clusterClass The value of the clusterClass property.
*/
MarkerClusterer.prototype.setClusterClass = function (clusterClass) {
this.clusterClass_ = clusterClass;
};
/**
* Returns the array of markers managed by the clusterer.
*
* @return {Array} The array of markers managed by the clusterer.
*/
MarkerClusterer.prototype.getMarkers = function () {
return this.markers_;
};
/**
* Returns the number of markers managed by the clusterer.
*
* @return {number} The number of markers.
*/
MarkerClusterer.prototype.getTotalMarkers = function () {
return this.markers_.length;
};
/**
* Returns the current array of clusters formed by the clusterer.
*
* @return {Array} The array of clusters formed by the clusterer.
*/
MarkerClusterer.prototype.getClusters = function () {
return this.clusters_;
};
/**
* Returns the number of clusters formed by the clusterer.
*
* @return {number} The number of clusters formed by the clusterer.
*/
MarkerClusterer.prototype.getTotalClusters = function () {
return this.clusters_.length;
};
/**
* Adds a marker to the clusterer. The clusters are redrawn unless
* <code>opt_nodraw</code> is set to <code>true</code>.
*
* @param {google.maps.Marker} marker The marker to add.
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
*/
MarkerClusterer.prototype.addMarker = function (marker, opt_nodraw) {
this.pushMarkerTo_(marker);
if (!opt_nodraw) {
this.redraw_();
}
};
/**
* Adds an array of markers to the clusterer. The clusters are redrawn unless
* <code>opt_nodraw</code> is set to <code>true</code>.
*
* @param {Array.<google.maps.Marker>} markers The markers to add.
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
*/
MarkerClusterer.prototype.addMarkers = function (markers, opt_nodraw) {
var key;
for (key in markers) {
if (markers.hasOwnProperty(key)) {
this.pushMarkerTo_(markers[key]);
}
}
if (!opt_nodraw) {
this.redraw_();
}
};
/**
* Pushes a marker to the clusterer.
*
* @param {google.maps.Marker} marker The marker to add.
*/
MarkerClusterer.prototype.pushMarkerTo_ = function (marker) {
// If the marker is draggable add a listener so we can update the clusters on the dragend:
if (marker.getDraggable()) {
var cMarkerClusterer = this;
google.maps.event.addListener(marker, "dragend", function () {
if (cMarkerClusterer.ready_) {
this.isAdded = false;
cMarkerClusterer.repaint();
}
});
}
marker.isAdded = false;
this.markers_.push(marker);
};
/**
* Removes a marker from the cluster. The clusters are redrawn unless
* <code>opt_nodraw</code> is set to <code>true</code>. Returns <code>true</code> if the
* marker was removed from the clusterer.
*
* @param {google.maps.Marker} marker The marker to remove.
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
* @return {boolean} True if the marker was removed from the clusterer.
*/
MarkerClusterer.prototype.removeMarker = function (marker, opt_nodraw) {
var removed = this.removeMarker_(marker);
if (!opt_nodraw && removed) {
this.repaint();
}
return removed;
};
/**
* Removes an array of markers from the cluster. The clusters are redrawn unless
* <code>opt_nodraw</code> is set to <code>true</code>. Returns <code>true</code> if markers
* were removed from the clusterer.
*
* @param {Array.<google.maps.Marker>} markers The markers to remove.
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
* @return {boolean} True if markers were removed from the clusterer.
*/
MarkerClusterer.prototype.removeMarkers = function (markers, opt_nodraw) {
var i, r;
var removed = false;
for (i = 0; i < markers.length; i++) {
r = this.removeMarker_(markers[i]);
removed = removed || r;
}
if (!opt_nodraw && removed) {
this.repaint();
}
return removed;
};
/**
* Removes a marker and returns true if removed, false if not.
*
* @param {google.maps.Marker} marker The marker to remove
* @return {boolean} Whether the marker was removed or not
*/
MarkerClusterer.prototype.removeMarker_ = function (marker) {
var i;
var index = -1;
if (this.markers_.indexOf) {
index = this.markers_.indexOf(marker);
} else {
for (i = 0; i < this.markers_.length; i++) {
if (marker === this.markers_[i]) {
index = i;
break;
}
}
}
if (index === -1) {
// Marker is not in our list of markers, so do nothing:
return false;
}
marker.setMap(null);
this.markers_.splice(index, 1); // Remove the marker from the list of managed markers
return true;
};
/**
* Removes all clusters and markers from the map and also removes all markers
* managed by the clusterer.
*/
MarkerClusterer.prototype.clearMarkers = function () {
this.resetViewport_(true);
this.markers_ = [];
};
/**
* Recalculates and redraws all the marker clusters from scratch.
* Call this after changing any properties.
*/
MarkerClusterer.prototype.repaint = function () {
var oldClusters = this.clusters_.slice();
this.clusters_ = [];
this.resetViewport_(false);
this.redraw_();
// Remove the old clusters.
// Do it in a timeout to prevent blinking effect.
setTimeout(function () {
var i;
for (i = 0; i < oldClusters.length; i++) {
oldClusters[i].remove();
}
}, 0);
};
/**
* Returns the current bounds extended by the grid size.
*
* @param {google.maps.LatLngBounds} bounds The bounds to extend.
* @return {google.maps.LatLngBounds} The extended bounds.
* @ignore
*/
MarkerClusterer.prototype.getExtendedBounds = function (bounds) {
var projection = this.getProjection();
// Turn the bounds into latlng.
var tr = new google.maps.LatLng(bounds.getNorthEast().lat(),
bounds.getNorthEast().lng());
var bl = new google.maps.LatLng(bounds.getSouthWest().lat(),
bounds.getSouthWest().lng());
// Convert the points to pixels and the extend out by the grid size.
var trPix = projection.fromLatLngToDivPixel(tr);
trPix.x += this.gridSize_;
trPix.y -= this.gridSize_;
var blPix = projection.fromLatLngToDivPixel(bl);
blPix.x -= this.gridSize_;
blPix.y += this.gridSize_;
// Convert the pixel points back to LatLng
var ne = projection.fromDivPixelToLatLng(trPix);
var sw = projection.fromDivPixelToLatLng(blPix);
// Extend the bounds to contain the new bounds.
bounds.extend(ne);
bounds.extend(sw);
return bounds;
};
/**
* Redraws all the clusters.
*/
MarkerClusterer.prototype.redraw_ = function () {
this.createClusters_(0);
};
/**
* Removes all clusters from the map. The markers are also removed from the map
* if <code>opt_hide</code> is set to <code>true</code>.
*
* @param {boolean} [opt_hide] Set to <code>true</code> to also remove the markers
* from the map.
*/
MarkerClusterer.prototype.resetViewport_ = function (opt_hide) {
var i, marker;
// Remove all the clusters
for (i = 0; i < this.clusters_.length; i++) {
this.clusters_[i].remove();
}
this.clusters_ = [];
// Reset the markers to not be added and to be removed from the map.
for (i = 0; i < this.markers_.length; i++) {
marker = this.markers_[i];
marker.isAdded = false;
if (opt_hide) {
marker.setMap(null);
}
}
};
/**
* Calculates the distance between two latlng locations in km.
*
* @param {google.maps.LatLng} p1 The first lat lng point.
* @param {google.maps.LatLng} p2 The second lat lng point.
* @return {number} The distance between the two points in km.
* @see http://www.movable-type.co.uk/scripts/latlong.html
*/
MarkerClusterer.prototype.distanceBetweenPoints_ = function (p1, p2) {
var R = 6371; // Radius of the Earth in km
var dLat = (p2.lat() - p1.lat()) * Math.PI / 180;
var dLon = (p2.lng() - p1.lng()) * Math.PI / 180;
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
var d = R * c;
return d;
};
/**
* Determines if a marker is contained in a bounds.
*
* @param {google.maps.Marker} marker The marker to check.
* @param {google.maps.LatLngBounds} bounds The bounds to check against.
* @return {boolean} True if the marker is in the bounds.
*/
MarkerClusterer.prototype.isMarkerInBounds_ = function (marker, bounds) {
return bounds.contains(marker.getPosition());
};
/**
* Adds a marker to a cluster, or creates a new cluster.
*
* @param {google.maps.Marker} marker The marker to add.
*/
MarkerClusterer.prototype.addToClosestCluster_ = function (marker) {
var i, d, cluster, center;
var distance = 40000; // Some large number
var clusterToAddTo = null;
for (i = 0; i < this.clusters_.length; i++) {
cluster = this.clusters_[i];
center = cluster.getCenter();
if (center) {
d = this.distanceBetweenPoints_(center, marker.getPosition());
if (d < distance) {
distance = d;
clusterToAddTo = cluster;
}
}
}
if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)) {
clusterToAddTo.addMarker(marker);
} else {
cluster = new Cluster(this);
cluster.addMarker(marker);
this.clusters_.push(cluster);
}
};
/**
* Creates the clusters. This is done in batches to avoid timeout errors
* in some browsers when there is a huge number of markers.
*
* @param {number} iFirst The index of the first marker in the batch of
* markers to be added to clusters.
*/
MarkerClusterer.prototype.createClusters_ = function (iFirst) {
var i, marker;
var mapBounds;
var cMarkerClusterer = this;
if (!this.ready_) {
return;
}
// Cancel previous batch processing if we're working on the first batch:
if (iFirst === 0) {
/**
* This event is fired when the <code>MarkerClusterer</code> begins
* clustering markers.
* @name MarkerClusterer#clusteringbegin
* @param {MarkerClusterer} mc The MarkerClusterer whose markers are being clustered.
* @event
*/
google.maps.event.trigger(this, "clusteringbegin", this);
if (typeof this.timerRefStatic !== "undefined") {
clearTimeout(this.timerRefStatic);
delete this.timerRefStatic;
}
}
// Get our current map view bounds.
// Create a new bounds object so we don't affect the map.
//
// See Comments 9 & 11 on Issue 3651 relating to this workaround for a Google Maps bug:
if (this.getMap().getZoom() > 3) {
mapBounds = new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest(),
this.getMap().getBounds().getNorthEast());
} else {
mapBounds = new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472, -178.48388434375), new google.maps.LatLng(-85.08136444384544, 178.00048865625));
}
var bounds = this.getExtendedBounds(mapBounds);
var iLast = Math.min(iFirst + this.batchSize_, this.markers_.length);
for (i = iFirst; i < iLast; i++) {
marker = this.markers_[i];
if (!marker.isAdded && this.isMarkerInBounds_(marker, bounds)) {
if (!this.ignoreHidden_ || (this.ignoreHidden_ && marker.getVisible())) {
this.addToClosestCluster_(marker);
}
}
}
if (iLast < this.markers_.length) {
this.timerRefStatic = setTimeout(function () {
cMarkerClusterer.createClusters_(iLast);
}, 0);
} else {
delete this.timerRefStatic;
/**
* This event is fired when the <code>MarkerClusterer</code> stops
* clustering markers.
* @name MarkerClusterer#clusteringend
* @param {MarkerClusterer} mc The MarkerClusterer whose markers are being clustered.
* @event
*/
google.maps.event.trigger(this, "clusteringend", this);
}
};
/**
* Extends an object's prototype by another's.
*
* @param {Object} obj1 The object to be extended.
* @param {Object} obj2 The object to extend with.
* @return {Object} The new extended object.
* @ignore
*/
MarkerClusterer.prototype.extend = function (obj1, obj2) {
return (function (object) {
var property;
for (property in object.prototype) {
this.prototype[property] = object.prototype[property];
}
return this;
}).apply(obj1, [obj2]);
};
/**
* The default function for determining the label text and style
* for a cluster icon.
*
* @param {Array.<google.maps.Marker>} markers The array of markers represented by the cluster.
* @param {number} numStyles The number of marker styles available.
* @return {ClusterIconInfo} The information resource for the cluster.
* @constant
* @ignore
*/
MarkerClusterer.CALCULATOR = function (markers, numStyles) {
var index = 0;
var title = "";
var count = markers.length.toString();
var dv = count;
while (dv !== 0) {
dv = parseInt(dv / 10, 10);
index++;
}
index = Math.min(index, numStyles);
return {
text: count,
index: index,
title: title
};
};
/**
* The number of markers to process in one batch.
*
* @type {number}
* @constant
*/
MarkerClusterer.BATCH_SIZE = 2000;
/**
* The number of markers to process in one batch (IE only).
*
* @type {number}
* @constant
*/
MarkerClusterer.BATCH_SIZE_IE = 500;
/**
* The default root name for the marker cluster images.
*
* @type {string}
* @constant
*/
MarkerClusterer.IMAGE_PATH = "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/images/m";
/**
* The default extension name for the marker cluster images.
*
* @type {string}
* @constant
*/
MarkerClusterer.IMAGE_EXTENSION = "png";
/**
* The default array of sizes for the marker cluster images.
*
* @type {Array.<number>}
* @constant
*/
MarkerClusterer.IMAGE_SIZES = [53, 56, 66, 78, 90];
if (typeof String.prototype.trim !== 'function') {
/**
* IE hack since trim() doesn't exist in all browsers
* @return {string} The string with removed whitespace
*/
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
;/**
* 1.1.9-patched
* @name MarkerWithLabel for V3
* @version 1.1.8 [February 26, 2013]
* @author Gary Little (inspired by code from Marc Ridey of Google).
* @copyright Copyright 2012 Gary Little [gary at luxcentral.com]
* @fileoverview MarkerWithLabel extends the Google Maps JavaScript API V3
* <code>google.maps.Marker</code> class.
* <p>
* MarkerWithLabel allows you to define markers with associated labels. As you would expect,
* if the marker is draggable, so too will be the label. In addition, a marker with a label
* responds to all mouse events in the same manner as a regular marker. It also fires mouse
* events and "property changed" events just as a regular marker would. Version 1.1 adds
* support for the raiseOnDrag feature introduced in API V3.3.
* <p>
* If you drag a marker by its label, you can cancel the drag and return the marker to its
* original position by pressing the <code>Esc</code> key. This doesn't work if you drag the marker
* itself because this feature is not (yet) supported in the <code>google.maps.Marker</code> class.
*/
/*!
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint browser:true */
/*global document,google */
/**
* @param {Function} childCtor Child class.
* @param {Function} parentCtor Parent class.
*/
function inherits(childCtor, parentCtor) {
/** @constructor */
function tempCtor() {}
tempCtor.prototype = parentCtor.prototype;
childCtor.superClass_ = parentCtor.prototype;
childCtor.prototype = new tempCtor();
/** @override */
childCtor.prototype.constructor = childCtor;
}
/**
* This constructor creates a label and associates it with a marker.
* It is for the private use of the MarkerWithLabel class.
* @constructor
* @param {Marker} marker The marker with which the label is to be associated.
* @param {string} crossURL The URL of the cross image =.
* @param {string} handCursor The URL of the hand cursor.
* @private
*/
function MarkerLabel_(marker, crossURL, handCursorURL) {
this.marker_ = marker;
this.handCursorURL_ = marker.handCursorURL;
this.labelDiv_ = document.createElement("div");
this.labelDiv_.style.cssText = "position: absolute; overflow: hidden;";
// Set up the DIV for handling mouse events in the label. This DIV forms a transparent veil
// in the "overlayMouseTarget" pane, a veil that covers just the label. This is done so that
// events can be captured even if the label is in the shadow of a google.maps.InfoWindow.
// Code is included here to ensure the veil is always exactly the same size as the label.
this.eventDiv_ = document.createElement("div");
this.eventDiv_.style.cssText = this.labelDiv_.style.cssText;
// This is needed for proper behavior on MSIE:
this.eventDiv_.setAttribute("onselectstart", "return false;");
this.eventDiv_.setAttribute("ondragstart", "return false;");
// Get the DIV for the "X" to be displayed when the marker is raised.
this.crossDiv_ = MarkerLabel_.getSharedCross(crossURL);
}
inherits(MarkerLabel_, google.maps.OverlayView);
/**
* Returns the DIV for the cross used when dragging a marker when the
* raiseOnDrag parameter set to true. One cross is shared with all markers.
* @param {string} crossURL The URL of the cross image =.
* @private
*/
MarkerLabel_.getSharedCross = function (crossURL) {
var div;
if (typeof MarkerLabel_.getSharedCross.crossDiv === "undefined") {
div = document.createElement("img");
div.style.cssText = "position: absolute; z-index: 1000002; display: none;";
// Hopefully Google never changes the standard "X" attributes:
div.style.marginLeft = "-8px";
div.style.marginTop = "-9px";
div.src = crossURL;
MarkerLabel_.getSharedCross.crossDiv = div;
}
return MarkerLabel_.getSharedCross.crossDiv;
};
/**
* Adds the DIV representing the label to the DOM. This method is called
* automatically when the marker's <code>setMap</code> method is called.
* @private
*/
MarkerLabel_.prototype.onAdd = function () {
var me = this;
var cMouseIsDown = false;
var cDraggingLabel = false;
var cSavedZIndex;
var cLatOffset, cLngOffset;
var cIgnoreClick;
var cRaiseEnabled;
var cStartPosition;
var cStartCenter;
// Constants:
var cRaiseOffset = 20;
var cDraggingCursor = "url(" + this.handCursorURL_ + ")";
// Stops all processing of an event.
//
var cAbortEvent = function (e) {
if (e.preventDefault) {
e.preventDefault();
}
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
};
var cStopBounce = function () {
me.marker_.setAnimation(null);
};
this.getPanes().overlayImage.appendChild(this.labelDiv_);
this.getPanes().overlayMouseTarget.appendChild(this.eventDiv_);
// One cross is shared with all markers, so only add it once:
if (typeof MarkerLabel_.getSharedCross.processed === "undefined") {
this.getPanes().overlayImage.appendChild(this.crossDiv_);
MarkerLabel_.getSharedCross.processed = true;
}
this.listeners_ = [
google.maps.event.addDomListener(this.eventDiv_, "mouseover", function (e) {
if (me.marker_.getDraggable() || me.marker_.getClickable()) {
this.style.cursor = "pointer";
google.maps.event.trigger(me.marker_, "mouseover", e);
}
}),
google.maps.event.addDomListener(this.eventDiv_, "mouseout", function (e) {
if ((me.marker_.getDraggable() || me.marker_.getClickable()) && !cDraggingLabel) {
this.style.cursor = me.marker_.getCursor();
google.maps.event.trigger(me.marker_, "mouseout", e);
}
}),
google.maps.event.addDomListener(this.eventDiv_, "mousedown", function (e) {
cDraggingLabel = false;
if (me.marker_.getDraggable()) {
cMouseIsDown = true;
this.style.cursor = cDraggingCursor;
}
if (me.marker_.getDraggable() || me.marker_.getClickable()) {
google.maps.event.trigger(me.marker_, "mousedown", e);
cAbortEvent(e); // Prevent map pan when starting a drag on a label
}
}),
google.maps.event.addDomListener(document, "mouseup", function (mEvent) {
var position;
if (cMouseIsDown) {
cMouseIsDown = false;
me.eventDiv_.style.cursor = "pointer";
google.maps.event.trigger(me.marker_, "mouseup", mEvent);
}
if (cDraggingLabel) {
if (cRaiseEnabled) { // Lower the marker & label
position = me.getProjection().fromLatLngToDivPixel(me.marker_.getPosition());
position.y += cRaiseOffset;
me.marker_.setPosition(me.getProjection().fromDivPixelToLatLng(position));
// This is not the same bouncing style as when the marker portion is dragged,
// but it will have to do:
try { // Will fail if running Google Maps API earlier than V3.3
me.marker_.setAnimation(google.maps.Animation.BOUNCE);
setTimeout(cStopBounce, 1406);
} catch (e) {}
}
me.crossDiv_.style.display = "none";
me.marker_.setZIndex(cSavedZIndex);
cIgnoreClick = true; // Set flag to ignore the click event reported after a label drag
cDraggingLabel = false;
mEvent.latLng = me.marker_.getPosition();
google.maps.event.trigger(me.marker_, "dragend", mEvent);
}
}),
google.maps.event.addListener(me.marker_.getMap(), "mousemove", function (mEvent) {
var position;
if (cMouseIsDown) {
if (cDraggingLabel) {
// Change the reported location from the mouse position to the marker position:
mEvent.latLng = new google.maps.LatLng(mEvent.latLng.lat() - cLatOffset, mEvent.latLng.lng() - cLngOffset);
position = me.getProjection().fromLatLngToDivPixel(mEvent.latLng);
if (cRaiseEnabled) {
me.crossDiv_.style.left = position.x + "px";
me.crossDiv_.style.top = position.y + "px";
me.crossDiv_.style.display = "";
position.y -= cRaiseOffset;
}
me.marker_.setPosition(me.getProjection().fromDivPixelToLatLng(position));
if (cRaiseEnabled) { // Don't raise the veil; this hack needed to make MSIE act properly
me.eventDiv_.style.top = (position.y + cRaiseOffset) + "px";
}
google.maps.event.trigger(me.marker_, "drag", mEvent);
} else {
// Calculate offsets from the click point to the marker position:
cLatOffset = mEvent.latLng.lat() - me.marker_.getPosition().lat();
cLngOffset = mEvent.latLng.lng() - me.marker_.getPosition().lng();
cSavedZIndex = me.marker_.getZIndex();
cStartPosition = me.marker_.getPosition();
cStartCenter = me.marker_.getMap().getCenter();
cRaiseEnabled = me.marker_.get("raiseOnDrag");
cDraggingLabel = true;
me.marker_.setZIndex(1000000); // Moves the marker & label to the foreground during a drag
mEvent.latLng = me.marker_.getPosition();
google.maps.event.trigger(me.marker_, "dragstart", mEvent);
}
}
}),
google.maps.event.addDomListener(document, "keydown", function (e) {
if (cDraggingLabel) {
if (e.keyCode === 27) { // Esc key
cRaiseEnabled = false;
me.marker_.setPosition(cStartPosition);
me.marker_.getMap().setCenter(cStartCenter);
google.maps.event.trigger(document, "mouseup", e);
}
}
}),
google.maps.event.addDomListener(this.eventDiv_, "click", function (e) {
if (me.marker_.getDraggable() || me.marker_.getClickable()) {
if (cIgnoreClick) { // Ignore the click reported when a label drag ends
cIgnoreClick = false;
} else {
google.maps.event.trigger(me.marker_, "click", e);
cAbortEvent(e); // Prevent click from being passed on to map
}
}
}),
google.maps.event.addDomListener(this.eventDiv_, "dblclick", function (e) {
if (me.marker_.getDraggable() || me.marker_.getClickable()) {
google.maps.event.trigger(me.marker_, "dblclick", e);
cAbortEvent(e); // Prevent map zoom when double-clicking on a label
}
}),
google.maps.event.addListener(this.marker_, "dragstart", function (mEvent) {
if (!cDraggingLabel) {
cRaiseEnabled = this.get("raiseOnDrag");
}
}),
google.maps.event.addListener(this.marker_, "drag", function (mEvent) {
if (!cDraggingLabel) {
if (cRaiseEnabled) {
me.setPosition(cRaiseOffset);
// During a drag, the marker's z-index is temporarily set to 1000000 to
// ensure it appears above all other markers. Also set the label's z-index
// to 1000000 (plus or minus 1 depending on whether the label is supposed
// to be above or below the marker).
me.labelDiv_.style.zIndex = 1000000 + (this.get("labelInBackground") ? -1 : +1);
}
}
}),
google.maps.event.addListener(this.marker_, "dragend", function (mEvent) {
if (!cDraggingLabel) {
if (cRaiseEnabled) {
me.setPosition(0); // Also restores z-index of label
}
}
}),
google.maps.event.addListener(this.marker_, "position_changed", function () {
me.setPosition();
}),
google.maps.event.addListener(this.marker_, "zindex_changed", function () {
me.setZIndex();
}),
google.maps.event.addListener(this.marker_, "visible_changed", function () {
me.setVisible();
}),
google.maps.event.addListener(this.marker_, "labelvisible_changed", function () {
me.setVisible();
}),
google.maps.event.addListener(this.marker_, "title_changed", function () {
me.setTitle();
}),
google.maps.event.addListener(this.marker_, "labelcontent_changed", function () {
me.setContent();
}),
google.maps.event.addListener(this.marker_, "labelanchor_changed", function () {
me.setAnchor();
}),
google.maps.event.addListener(this.marker_, "labelclass_changed", function () {
me.setStyles();
}),
google.maps.event.addListener(this.marker_, "labelstyle_changed", function () {
me.setStyles();
})
];
};
/**
* Removes the DIV for the label from the DOM. It also removes all event handlers.
* This method is called automatically when the marker's <code>setMap(null)</code>
* method is called.
* @private
*/
MarkerLabel_.prototype.onRemove = function () {
var i;
if (this.labelDiv_.parentNode !== null)
this.labelDiv_.parentNode.removeChild(this.labelDiv_);
if (this.eventDiv_.parentNode !== null)
this.eventDiv_.parentNode.removeChild(this.eventDiv_);
// Remove event listeners:
for (i = 0; i < this.listeners_.length; i++) {
google.maps.event.removeListener(this.listeners_[i]);
}
};
/**
* Draws the label on the map.
* @private
*/
MarkerLabel_.prototype.draw = function () {
this.setContent();
this.setTitle();
this.setStyles();
};
/**
* Sets the content of the label.
* The content can be plain text or an HTML DOM node.
* @private
*/
MarkerLabel_.prototype.setContent = function () {
var content = this.marker_.get("labelContent");
if (typeof content.nodeType === "undefined") {
this.labelDiv_.innerHTML = content;
this.eventDiv_.innerHTML = this.labelDiv_.innerHTML;
} else {
this.labelDiv_.innerHTML = ""; // Remove current content
this.labelDiv_.appendChild(content);
content = content.cloneNode(true);
this.eventDiv_.appendChild(content);
}
};
/**
* Sets the content of the tool tip for the label. It is
* always set to be the same as for the marker itself.
* @private
*/
MarkerLabel_.prototype.setTitle = function () {
this.eventDiv_.title = this.marker_.getTitle() || "";
};
/**
* Sets the style of the label by setting the style sheet and applying
* other specific styles requested.
* @private
*/
MarkerLabel_.prototype.setStyles = function () {
var i, labelStyle;
// Apply style values from the style sheet defined in the labelClass parameter:
this.labelDiv_.className = this.marker_.get("labelClass");
this.eventDiv_.className = this.labelDiv_.className;
// Clear existing inline style values:
this.labelDiv_.style.cssText = "";
this.eventDiv_.style.cssText = "";
// Apply style values defined in the labelStyle parameter:
labelStyle = this.marker_.get("labelStyle");
for (i in labelStyle) {
if (labelStyle.hasOwnProperty(i)) {
this.labelDiv_.style[i] = labelStyle[i];
this.eventDiv_.style[i] = labelStyle[i];
}
}
this.setMandatoryStyles();
};
/**
* Sets the mandatory styles to the DIV representing the label as well as to the
* associated event DIV. This includes setting the DIV position, z-index, and visibility.
* @private
*/
MarkerLabel_.prototype.setMandatoryStyles = function () {
this.labelDiv_.style.position = "absolute";
this.labelDiv_.style.overflow = "hidden";
// Make sure the opacity setting causes the desired effect on MSIE:
if (typeof this.labelDiv_.style.opacity !== "undefined" && this.labelDiv_.style.opacity !== "") {
this.labelDiv_.style.MsFilter = "\"progid:DXImageTransform.Microsoft.Alpha(opacity=" + (this.labelDiv_.style.opacity * 100) + ")\"";
this.labelDiv_.style.filter = "alpha(opacity=" + (this.labelDiv_.style.opacity * 100) + ")";
}
this.eventDiv_.style.position = this.labelDiv_.style.position;
this.eventDiv_.style.overflow = this.labelDiv_.style.overflow;
this.eventDiv_.style.opacity = 0.01; // Don't use 0; DIV won't be clickable on MSIE
this.eventDiv_.style.MsFilter = "\"progid:DXImageTransform.Microsoft.Alpha(opacity=1)\"";
this.eventDiv_.style.filter = "alpha(opacity=1)"; // For MSIE
this.setAnchor();
this.setPosition(); // This also updates z-index, if necessary.
this.setVisible();
};
/**
* Sets the anchor point of the label.
* @private
*/
MarkerLabel_.prototype.setAnchor = function () {
var anchor = this.marker_.get("labelAnchor");
this.labelDiv_.style.marginLeft = -anchor.x + "px";
this.labelDiv_.style.marginTop = -anchor.y + "px";
this.eventDiv_.style.marginLeft = -anchor.x + "px";
this.eventDiv_.style.marginTop = -anchor.y + "px";
};
/**
* Sets the position of the label. The z-index is also updated, if necessary.
* @private
*/
MarkerLabel_.prototype.setPosition = function (yOffset) {
var position = this.getProjection().fromLatLngToDivPixel(this.marker_.getPosition());
if (typeof yOffset === "undefined") {
yOffset = 0;
}
this.labelDiv_.style.left = Math.round(position.x) + "px";
this.labelDiv_.style.top = Math.round(position.y - yOffset) + "px";
this.eventDiv_.style.left = this.labelDiv_.style.left;
this.eventDiv_.style.top = this.labelDiv_.style.top;
this.setZIndex();
};
/**
* Sets the z-index of the label. If the marker's z-index property has not been defined, the z-index
* of the label is set to the vertical coordinate of the label. This is in keeping with the default
* stacking order for Google Maps: markers to the south are in front of markers to the north.
* @private
*/
MarkerLabel_.prototype.setZIndex = function () {
var zAdjust = (this.marker_.get("labelInBackground") ? -1 : +1);
if (typeof this.marker_.getZIndex() === "undefined") {
this.labelDiv_.style.zIndex = parseInt(this.labelDiv_.style.top, 10) + zAdjust;
this.eventDiv_.style.zIndex = this.labelDiv_.style.zIndex;
} else {
this.labelDiv_.style.zIndex = this.marker_.getZIndex() + zAdjust;
this.eventDiv_.style.zIndex = this.labelDiv_.style.zIndex;
}
};
/**
* Sets the visibility of the label. The label is visible only if the marker itself is
* visible (i.e., its visible property is true) and the labelVisible property is true.
* @private
*/
MarkerLabel_.prototype.setVisible = function () {
if (this.marker_.get("labelVisible")) {
this.labelDiv_.style.display = this.marker_.getVisible() ? "block" : "none";
} else {
this.labelDiv_.style.display = "none";
}
this.eventDiv_.style.display = this.labelDiv_.style.display;
};
/**
* @name MarkerWithLabelOptions
* @class This class represents the optional parameter passed to the {@link MarkerWithLabel} constructor.
* The properties available are the same as for <code>google.maps.Marker</code> with the addition
* of the properties listed below. To change any of these additional properties after the labeled
* marker has been created, call <code>google.maps.Marker.set(propertyName, propertyValue)</code>.
* <p>
* When any of these properties changes, a property changed event is fired. The names of these
* events are derived from the name of the property and are of the form <code>propertyname_changed</code>.
* For example, if the content of the label changes, a <code>labelcontent_changed</code> event
* is fired.
* <p>
* @property {string|Node} [labelContent] The content of the label (plain text or an HTML DOM node).
* @property {Point} [labelAnchor] By default, a label is drawn with its anchor point at (0,0) so
* that its top left corner is positioned at the anchor point of the associated marker. Use this
* property to change the anchor point of the label. For example, to center a 50px-wide label
* beneath a marker, specify a <code>labelAnchor</code> of <code>google.maps.Point(25, 0)</code>.
* (Note: x-values increase to the right and y-values increase to the top.)
* @property {string} [labelClass] The name of the CSS class defining the styles for the label.
* Note that style values for <code>position</code>, <code>overflow</code>, <code>top</code>,
* <code>left</code>, <code>zIndex</code>, <code>display</code>, <code>marginLeft</code>, and
* <code>marginTop</code> are ignored; these styles are for internal use only.
* @property {Object} [labelStyle] An object literal whose properties define specific CSS
* style values to be applied to the label. Style values defined here override those that may
* be defined in the <code>labelClass</code> style sheet. If this property is changed after the
* label has been created, all previously set styles (except those defined in the style sheet)
* are removed from the label before the new style values are applied.
* Note that style values for <code>position</code>, <code>overflow</code>, <code>top</code>,
* <code>left</code>, <code>zIndex</code>, <code>display</code>, <code>marginLeft</code>, and
* <code>marginTop</code> are ignored; these styles are for internal use only.
* @property {boolean} [labelInBackground] A flag indicating whether a label that overlaps its
* associated marker should appear in the background (i.e., in a plane below the marker).
* The default is <code>false</code>, which causes the label to appear in the foreground.
* @property {boolean} [labelVisible] A flag indicating whether the label is to be visible.
* The default is <code>true</code>. Note that even if <code>labelVisible</code> is
* <code>true</code>, the label will <i>not</i> be visible unless the associated marker is also
* visible (i.e., unless the marker's <code>visible</code> property is <code>true</code>).
* @property {boolean} [raiseOnDrag] A flag indicating whether the label and marker are to be
* raised when the marker is dragged. The default is <code>true</code>. If a draggable marker is
* being created and a version of Google Maps API earlier than V3.3 is being used, this property
* must be set to <code>false</code>.
* @property {boolean} [optimized] A flag indicating whether rendering is to be optimized for the
* marker. <b>Important: The optimized rendering technique is not supported by MarkerWithLabel,
* so the value of this parameter is always forced to <code>false</code>.
* @property {string} [crossImage="http://maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png"]
* The URL of the cross image to be displayed while dragging a marker.
* @property {string} [handCursor="http://maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur"]
* The URL of the cursor to be displayed while dragging a marker.
*/
/**
* Creates a MarkerWithLabel with the options specified in {@link MarkerWithLabelOptions}.
* @constructor
* @param {MarkerWithLabelOptions} [opt_options] The optional parameters.
*/
function MarkerWithLabel(opt_options) {
opt_options = opt_options || {};
opt_options.labelContent = opt_options.labelContent || "";
opt_options.labelAnchor = opt_options.labelAnchor || new google.maps.Point(0, 0);
opt_options.labelClass = opt_options.labelClass || "markerLabels";
opt_options.labelStyle = opt_options.labelStyle || {};
opt_options.labelInBackground = opt_options.labelInBackground || false;
if (typeof opt_options.labelVisible === "undefined") {
opt_options.labelVisible = true;
}
if (typeof opt_options.raiseOnDrag === "undefined") {
opt_options.raiseOnDrag = true;
}
if (typeof opt_options.clickable === "undefined") {
opt_options.clickable = true;
}
if (typeof opt_options.draggable === "undefined") {
opt_options.draggable = false;
}
if (typeof opt_options.optimized === "undefined") {
opt_options.optimized = false;
}
opt_options.crossImage = opt_options.crossImage || "http" + (document.location.protocol === "https:" ? "s" : "") + "://maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png";
opt_options.handCursor = opt_options.handCursor || "http" + (document.location.protocol === "https:" ? "s" : "") + "://maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur";
opt_options.optimized = false; // Optimized rendering is not supported
this.label = new MarkerLabel_(this, opt_options.crossImage, opt_options.handCursor); // Bind the label to the marker
// Call the parent constructor. It calls Marker.setValues to initialize, so all
// the new parameters are conveniently saved and can be accessed with get/set.
// Marker.set triggers a property changed event (called "propertyname_changed")
// that the marker label listens for in order to react to state changes.
google.maps.Marker.apply(this, arguments);
}
inherits(MarkerWithLabel, google.maps.Marker);
/**
* Overrides the standard Marker setMap function.
* @param {Map} theMap The map to which the marker is to be added.
* @private
*/
MarkerWithLabel.prototype.setMap = function (theMap) {
// Call the inherited function...
google.maps.Marker.prototype.setMap.apply(this, arguments);
// ... then deal with the label:
this.label.setMap(theMap);
}; |
blueprints/route/files/src/routes/__name__/components/__name__.js | LidaDimitriadi/Poker-React | import React from 'react'
import classes from './<%= pascalEntityName %>.scss'
export const <%= pascalEntityName %> = () => (
<div className={classes['<%= pascalEntityName %>']}>
<h4><%= pascalEntityName %></h4>
</div>
)
export default <%= pascalEntityName %>
|
node_modules/react-icons/md/exposure-plus-1.js | bengimbel/Solstice-React-Contacts-Project |
import React from 'react'
import Icon from 'react-icon-base'
const MdExposurePlus1 = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m33.4 30h-3.4v-17.7l-5 1.7v-2.8l7.8-2.8h0.6v21.6z m-16.8-18.4v6.8h6.8v3.2h-6.8v6.8h-3.2v-6.8h-6.8v-3.2h6.8v-6.8h3.2z"/></g>
</Icon>
)
export default MdExposurePlus1
|
src/components/shell/items/card.js | fredmarques/petshop | import { Image, Media } from 'react-bootstrap';
import React, { Component } from 'react';
class Card extends Component {
constructor(props) {
super(props);
this.image = this.props.image;
this.alt = this.props.alt;
this.heading = this.props.heading;
this.body = this.props.body;
this.width = this.props.width;
this.buttons = this.props.buttons;
}
render() {
return (
<div className="serviceRow">
<Media>
<Media.Left align="top">
<Image width={this.width} height={this.height} src={this.image} alt={this.alt} rounded />
</Media.Left>
<Media.Body>
<Media.Heading>{this.heading}</Media.Heading>
<p>{this.body}</p>
</Media.Body>
</Media>
</div>
);
}
}
export default Card;
|
src/index.js | vkarpov15/shidoshi | import { Provider } from 'react-redux';
import ReactDOM from 'react-dom';
import React from 'react';
import { Router, Route, IndexRoute, hashHistory } from 'react-router';
import App from './components/App';
import Article from './components/Article';
import Editor from './components/Editor';
import Home from './components/Home';
import Login from './components/Login';
import Profile from './components/Profile';
import ProfileFavorites from './components/ProfileFavorites';
import Register from './components/Register';
import Settings from './components/Settings';
import store from './store';
ReactDOM.render((
<Provider store={store}>
<Router history={hashHistory}>
<Route path="/" component={App}>
<IndexRoute component={Home} />
<Route path="login" component={Login} />
<Route path="register" component={Register} />
<Route path="settings" component={Settings} />
<Route path="article/:id" component={Article} />
<Route path="@:username" component={Profile} />
<Route path="@:username/favorites" component={ProfileFavorites} />
<Route path="editor" component={Editor} />
<Route path="editor/:slug" component={Editor} />
</Route>
</Router>
</Provider>
), document.getElementById('main'));
|
src/svg-icons/editor/linear-scale.js | igorbt/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let EditorLinearScale = (props) => (
<SvgIcon {...props}>
<path d="M19.5 9.5c-1.03 0-1.9.62-2.29 1.5h-2.92c-.39-.88-1.26-1.5-2.29-1.5s-1.9.62-2.29 1.5H6.79c-.39-.88-1.26-1.5-2.29-1.5C3.12 9.5 2 10.62 2 12s1.12 2.5 2.5 2.5c1.03 0 1.9-.62 2.29-1.5h2.92c.39.88 1.26 1.5 2.29 1.5s1.9-.62 2.29-1.5h2.92c.39.88 1.26 1.5 2.29 1.5 1.38 0 2.5-1.12 2.5-2.5s-1.12-2.5-2.5-2.5z"/>
</SvgIcon>
);
EditorLinearScale = pure(EditorLinearScale);
EditorLinearScale.displayName = 'EditorLinearScale';
EditorLinearScale.muiName = 'SvgIcon';
export default EditorLinearScale;
|
Examples/UIExplorer/TextInputExample.js | shlomiatar/react-native | /**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* 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 NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK 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.
*
* @flow
*/
'use strict';
var React = require('react-native');
var {
Text,
TextInput,
View,
StyleSheet,
} = React;
var WithLabel = React.createClass({
render: function() {
return (
<View style={styles.labelContainer}>
<View style={styles.label}>
<Text>{this.props.label}</Text>
</View>
{this.props.children}
</View>
);
},
});
var TextEventsExample = React.createClass({
getInitialState: function() {
return {
curText: '<No Event>',
prevText: '<No Event>',
prev2Text: '<No Event>',
};
},
updateText: function(text) {
this.setState((state) => {
return {
curText: text,
prevText: state.curText,
prev2Text: state.prevText,
};
});
},
render: function() {
return (
<View>
<TextInput
autoCapitalize="none"
placeholder="Enter text to see events"
autoCorrect={false}
onFocus={() => this.updateText('onFocus')}
onBlur={() => this.updateText('onBlur')}
onChange={(event) => this.updateText(
'onChange text: ' + event.nativeEvent.text
)}
onEndEditing={(event) => this.updateText(
'onEndEditing text: ' + event.nativeEvent.text
)}
onSubmitEditing={(event) => this.updateText(
'onSubmitEditing text: ' + event.nativeEvent.text
)}
style={styles.default}
/>
<Text style={styles.eventLabel}>
{this.state.curText}{'\n'}
(prev: {this.state.prevText}){'\n'}
(prev2: {this.state.prev2Text})
</Text>
</View>
);
}
});
class RewriteExample extends React.Component {
constructor(props) {
super(props);
this.state = {text: ''};
}
render() {
var limit = 20;
var remainder = limit - this.state.text.length;
var remainderColor = remainder > 5 ? 'blue' : 'red';
return (
<View style={styles.rewriteContainer}>
<TextInput
multiline={false}
maxLength={limit}
onChangeText={(text) => {
text = text.replace(/ /g, '_');
this.setState({text});
}}
style={styles.default}
value={this.state.text}
/>
<Text style={[styles.remainder, {color: remainderColor}]}>
{remainder}
</Text>
</View>
);
}
}
var styles = StyleSheet.create({
page: {
paddingBottom: 300,
},
default: {
height: 26,
borderWidth: 0.5,
borderColor: '#0f0f0f',
flex: 1,
fontSize: 13,
padding: 4,
},
multiline: {
borderWidth: 0.5,
borderColor: '#0f0f0f',
flex: 1,
fontSize: 13,
height: 50,
padding: 4,
marginBottom: 4,
},
multilineWithFontStyles: {
color: 'blue',
fontWeight: 'bold',
fontSize: 18,
fontFamily: 'Cochin',
height: 60,
},
multilineChild: {
width: 50,
height: 40,
position: 'absolute',
right: 5,
backgroundColor: 'red',
},
eventLabel: {
margin: 3,
fontSize: 12,
},
labelContainer: {
flexDirection: 'row',
marginVertical: 2,
flex: 1,
},
label: {
width: 115,
alignItems: 'flex-end',
marginRight: 10,
paddingTop: 2,
},
rewriteContainer: {
flexDirection: 'row',
alignItems: 'center',
},
remainder: {
textAlign: 'right',
width: 24,
},
});
exports.displayName = (undefined: ?string);
exports.title = '<TextInput>';
exports.description = 'Single and multi-line text inputs.';
exports.examples = [
{
title: 'Auto-focus',
render: function() {
return <TextInput autoFocus={true} style={styles.default} />;
}
},
{
title: "Live Re-Write (<sp> -> '_') + maxLength",
render: function() {
return <RewriteExample />;
}
},
{
title: 'Auto-capitalize',
render: function() {
return (
<View>
<WithLabel label="none">
<TextInput
autoCapitalize="none"
style={styles.default}
/>
</WithLabel>
<WithLabel label="sentences">
<TextInput
autoCapitalize="sentences"
style={styles.default}
/>
</WithLabel>
<WithLabel label="words">
<TextInput
autoCapitalize="words"
style={styles.default}
/>
</WithLabel>
<WithLabel label="characters">
<TextInput
autoCapitalize="characters"
style={styles.default}
/>
</WithLabel>
</View>
);
}
},
{
title: 'Auto-correct',
render: function() {
return (
<View>
<WithLabel label="true">
<TextInput autoCorrect={true} style={styles.default} />
</WithLabel>
<WithLabel label="false">
<TextInput autoCorrect={false} style={styles.default} />
</WithLabel>
</View>
);
}
},
{
title: 'Keyboard types',
render: function() {
var keyboardTypes = [
'default',
'ascii-capable',
'numbers-and-punctuation',
'url',
'number-pad',
'phone-pad',
'name-phone-pad',
'email-address',
'decimal-pad',
'twitter',
'web-search',
'numeric',
];
var examples = keyboardTypes.map((type) => {
return (
<WithLabel key={type} label={type}>
<TextInput
keyboardType={type}
style={styles.default}
/>
</WithLabel>
);
});
return <View>{examples}</View>;
}
},
{
title: 'Return key types',
render: function() {
var returnKeyTypes = [
'default',
'go',
'google',
'join',
'next',
'route',
'search',
'send',
'yahoo',
'done',
'emergency-call',
];
var examples = returnKeyTypes.map((type) => {
return (
<WithLabel key={type} label={type}>
<TextInput
returnKeyType={type}
style={styles.default}
/>
</WithLabel>
);
});
return <View>{examples}</View>;
}
},
{
title: 'Enable return key automatically',
render: function() {
return (
<View>
<WithLabel label="true">
<TextInput enablesReturnKeyAutomatically={true} style={styles.default} />
</WithLabel>
</View>
);
}
},
{
title: 'Secure text entry',
render: function() {
return (
<View>
<WithLabel label="true">
<TextInput password={true} style={styles.default} defaultValue="abc" />
</WithLabel>
</View>
);
}
},
{
title: 'Event handling',
render: function(): ReactElement { return <TextEventsExample />; },
},
{
title: 'Colored input text',
render: function() {
return (
<View>
<TextInput
style={[styles.default, {color: 'blue'}]}
defaultValue="Blue"
/>
<TextInput
style={[styles.default, {color: 'green'}]}
defaultValue="Green"
/>
</View>
);
}
},
{
title: 'Clear button mode',
render: function () {
return (
<View>
<WithLabel label="never">
<TextInput
style={styles.default}
clearButtonMode="never"
/>
</WithLabel>
<WithLabel label="while editing">
<TextInput
style={styles.default}
clearButtonMode="while-editing"
/>
</WithLabel>
<WithLabel label="unless editing">
<TextInput
style={styles.default}
clearButtonMode="unless-editing"
/>
</WithLabel>
<WithLabel label="always">
<TextInput
style={styles.default}
clearButtonMode="always"
/>
</WithLabel>
</View>
);
}
},
{
title: 'Clear and select',
render: function() {
return (
<View>
<WithLabel label="clearTextOnFocus">
<TextInput
placeholder="text is cleared on focus"
defaultValue="text is cleared on focus"
style={styles.default}
clearTextOnFocus={true}
/>
</WithLabel>
<WithLabel label="selectTextOnFocus">
<TextInput
placeholder="text is selected on focus"
defaultValue="text is selected on focus"
style={styles.default}
selectTextOnFocus={true}
/>
</WithLabel>
</View>
);
}
},
{
title: 'Multiline',
render: function() {
return (
<View>
<TextInput
placeholder="multiline text input"
multiline={true}
style={styles.multiline}
/>
<TextInput
placeholder="multiline text input with font styles and placeholder"
multiline={true}
clearTextOnFocus={true}
autoCorrect={true}
autoCapitalize="words"
placeholderTextColor="red"
keyboardType="url"
style={[styles.multiline, styles.multilineWithFontStyles]}
/>
<TextInput
placeholder="uneditable multiline text input"
editable={false}
multiline={true}
style={styles.multiline}
/>
<TextInput
placeholder="multiline with children"
multiline={true}
enablesReturnKeyAutomatically={true}
returnKeyType="go"
style={styles.multiline}>
<View style={styles.multilineChild}/>
</TextInput>
</View>
);
}
}
];
|
src/containers/calculationnotebooks.js | OpenChemistry/mongochemclient | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import _ from 'lodash';
import { push } from 'connected-react-router';
import NotebooksTable from '../components/notebooks/table'
import { calculations, jupyterlab } from '@openchemistry/redux'
import { selectors } from '@openchemistry/redux'
import { auth } from '@openchemistry/girder-redux';
class CalculationNotebooksContainer extends Component {
componentDidMount() {
this.props.dispatch(calculations.loadCalculationNotebooks(this.props.calculationId));
}
onOpen = (notebook) => {
const { me, dispatch } = this.props;
const meId = me ? me['_id'] : '';
if (meId === notebook['creatorId']) {
// If owner redirect to the notebook
const name = notebook['name'];
dispatch(jupyterlab.redirectToJupyterHub(name));
} else {
// Else, redirect to a read-only view of the notebook
const notebookId = notebook['_id'];
this.props.dispatch(push(`/notebooks/${notebookId}`));
}
}
render() {
return <NotebooksTable notebooks={this.props.notebooks} onOpen={this.onOpen} />;
}
}
CalculationNotebooksContainer.propTypes = {
calculationId: PropTypes.string,
notebooks: PropTypes.array,
}
CalculationNotebooksContainer.defaultProps = {
calculationId: null,
notebooks: [],
}
function mapStateToProps(state, ownProps) {
const props = {...ownProps};
if (!_.isNil(ownProps.calculationId)) {
const notebooks = selectors.calculations.getNotebooks(state, ownProps.calculationId);
if (!_.isNil(notebooks)) {
props.notebooks = notebooks;
}
}
props.me = auth.selectors.getMe(state);
return props;
}
export default connect(mapStateToProps)(CalculationNotebooksContainer)
|
files/core-js/0.9.1/library.js | evilangelmd/jsdelivr | /**
* Core.js 0.9.1
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © 2015 Denis Pushkarev
*/
!function(undefined){
'use strict';
var __e = null, __g = null;
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(1);
__webpack_require__(2);
__webpack_require__(3);
__webpack_require__(4);
__webpack_require__(5);
__webpack_require__(6);
__webpack_require__(7);
__webpack_require__(8);
__webpack_require__(9);
__webpack_require__(10);
__webpack_require__(11);
__webpack_require__(12);
__webpack_require__(13);
__webpack_require__(14);
__webpack_require__(15);
__webpack_require__(16);
__webpack_require__(17);
__webpack_require__(18);
__webpack_require__(19);
__webpack_require__(20);
__webpack_require__(21);
__webpack_require__(22);
__webpack_require__(23);
__webpack_require__(24);
__webpack_require__(25);
__webpack_require__(26);
__webpack_require__(27);
__webpack_require__(28);
__webpack_require__(29);
__webpack_require__(30);
__webpack_require__(31);
__webpack_require__(32);
__webpack_require__(33);
__webpack_require__(34);
__webpack_require__(35);
__webpack_require__(36);
__webpack_require__(37);
__webpack_require__(38);
__webpack_require__(39);
__webpack_require__(40);
__webpack_require__(41);
__webpack_require__(42);
__webpack_require__(43);
__webpack_require__(44);
__webpack_require__(45);
__webpack_require__(46);
__webpack_require__(47);
__webpack_require__(48);
__webpack_require__(49);
__webpack_require__(50);
__webpack_require__(51);
__webpack_require__(52);
__webpack_require__(53);
__webpack_require__(54);
__webpack_require__(55);
__webpack_require__(56);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, $def = __webpack_require__(59)
, invoke = __webpack_require__(60)
, arrayMethod = __webpack_require__(61)
, IE_PROTO = __webpack_require__(62).safe('__proto__')
, assert = __webpack_require__(63)
, assertObject = assert.obj
, ObjectProto = Object.prototype
, A = []
, slice = A.slice
, indexOf = A.indexOf
, classof = cof.classof
, has = $.has
, defineProperty = $.setDesc
, getOwnDescriptor = $.getDesc
, defineProperties = $.setDescs
, isFunction = $.isFunction
, toObject = $.toObject
, toLength = $.toLength
, IE8_DOM_DEFINE = false;
if(!$.DESC){
try {
IE8_DOM_DEFINE = defineProperty(document.createElement('div'), 'x',
{get: function(){ return 8; }}
).x == 8;
} catch(e){ /* empty */ }
$.setDesc = function(O, P, Attributes){
if(IE8_DOM_DEFINE)try {
return defineProperty(O, P, Attributes);
} catch(e){ /* empty */ }
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
if('value' in Attributes)assertObject(O)[P] = Attributes.value;
return O;
};
$.getDesc = function(O, P){
if(IE8_DOM_DEFINE)try {
return getOwnDescriptor(O, P);
} catch(e){ /* empty */ }
if(has(O, P))return $.desc(!ObjectProto.propertyIsEnumerable.call(O, P), O[P]);
};
$.setDescs = defineProperties = function(O, Properties){
assertObject(O);
var keys = $.getKeys(Properties)
, length = keys.length
, i = 0
, P;
while(length > i)$.setDesc(O, P = keys[i++], Properties[P]);
return O;
};
}
$def($def.S + $def.F * !$.DESC, 'Object', {
// 19.1.2.6 / 15.2.3.3 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: $.getDesc,
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
defineProperty: $.setDesc,
// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
defineProperties: defineProperties
});
// IE 8- don't enum bug keys
var keys1 = ('constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,' +
'toLocaleString,toString,valueOf').split(',')
// Additional keys for getOwnPropertyNames
, keys2 = keys1.concat('length', 'prototype')
, keysLen1 = keys1.length;
// Create object with `null` prototype: use iframe Object with cleared prototype
var createDict = function(){
// Thrash, waste and sodomy: IE GC bug
var iframe = document.createElement('iframe')
, i = keysLen1
, gt = '>'
, iframeDocument;
iframe.style.display = 'none';
$.html.appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write('<script>document.F=Object</script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while(i--)delete createDict.prototype[keys1[i]];
return createDict();
};
function createGetKeys(names, length){
return function(object){
var O = toObject(object)
, i = 0
, result = []
, key;
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while(length > i)if(has(O, key = names[i++])){
~indexOf.call(result, key) || result.push(key);
}
return result;
};
}
function isPrimitive(it){ return !$.isObject(it); }
function Empty(){}
$def($def.S, 'Object', {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
getPrototypeOf: $.getProto = $.getProto || function(O){
O = Object(assert.def(O));
if(has(O, IE_PROTO))return O[IE_PROTO];
if(isFunction(O.constructor) && O instanceof O.constructor){
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
},
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
getOwnPropertyNames: $.getNames = $.getNames || createGetKeys(keys2, keys2.length, true),
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
create: $.create = $.create || function(O, /*?*/Properties){
var result;
if(O !== null){
Empty.prototype = assertObject(O);
result = new Empty();
Empty.prototype = null;
// add "__proto__" for Object.getPrototypeOf shim
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : defineProperties(result, Properties);
},
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
keys: $.getKeys = $.getKeys || createGetKeys(keys1, keysLen1, false),
// 19.1.2.17 / 15.2.3.8 Object.seal(O)
seal: $.it, // <- cap
// 19.1.2.5 / 15.2.3.9 Object.freeze(O)
freeze: $.it, // <- cap
// 19.1.2.15 / 15.2.3.10 Object.preventExtensions(O)
preventExtensions: $.it, // <- cap
// 19.1.2.13 / 15.2.3.11 Object.isSealed(O)
isSealed: isPrimitive, // <- cap
// 19.1.2.12 / 15.2.3.12 Object.isFrozen(O)
isFrozen: isPrimitive, // <- cap
// 19.1.2.11 / 15.2.3.13 Object.isExtensible(O)
isExtensible: $.isObject // <- cap
});
// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
$def($def.P, 'Function', {
bind: function(that /*, args... */){
var fn = assert.fn(this)
, partArgs = slice.call(arguments, 1);
function bound(/* args... */){
var args = partArgs.concat(slice.call(arguments));
return invoke(fn, args, this instanceof bound ? $.create(fn.prototype) : that);
}
if(fn.prototype)bound.prototype = fn.prototype;
return bound;
}
});
// Fix for not array-like ES3 string
function arrayMethodFix(fn){
return function(){
return fn.apply($.ES5Object(this), arguments);
};
}
if(!(0 in Object('z') && 'z'[0] == 'z')){
$.ES5Object = function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
}
$def($def.P + $def.F * ($.ES5Object != Object), 'Array', {
slice: arrayMethodFix(slice),
join: arrayMethodFix(A.join)
});
// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
$def($def.S, 'Array', {
isArray: function(arg){
return cof(arg) == 'Array';
}
});
function createArrayReduce(isRight){
return function(callbackfn, memo){
assert.fn(callbackfn);
var O = toObject(this)
, length = toLength(O.length)
, index = isRight ? length - 1 : 0
, i = isRight ? -1 : 1;
if(arguments.length < 2)for(;;){
if(index in O){
memo = O[index];
index += i;
break;
}
index += i;
assert(isRight ? index >= 0 : length > index, 'Reduce of empty array with no initial value');
}
for(;isRight ? index >= 0 : length > index; index += i)if(index in O){
memo = callbackfn(memo, O[index], index, this);
}
return memo;
};
}
$def($def.P, 'Array', {
// 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
forEach: $.each = $.each || arrayMethod(0),
// 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
map: arrayMethod(1),
// 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
filter: arrayMethod(2),
// 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
some: arrayMethod(3),
// 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
every: arrayMethod(4),
// 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
reduce: createArrayReduce(false),
// 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
reduceRight: createArrayReduce(true),
// 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
indexOf: indexOf = indexOf || __webpack_require__(64)(false),
// 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
lastIndexOf: function(el, fromIndex /* = @[*-1] */){
var O = toObject(this)
, length = toLength(O.length)
, index = length - 1;
if(arguments.length > 1)index = Math.min(index, $.toInteger(fromIndex));
if(index < 0)index = toLength(length + index);
for(;index >= 0; index--)if(index in O)if(O[index] === el)return index;
return -1;
}
});
// 21.1.3.25 / 15.5.4.20 String.prototype.trim()
$def($def.P, 'String', {trim: __webpack_require__(65)(/^\s*([\s\S]*\S)?\s*$/, '$1')});
// 20.3.3.1 / 15.9.4.4 Date.now()
$def($def.S, 'Date', {now: function(){
return +new Date;
}});
function lz(num){
return num > 9 ? num : '0' + num;
}
// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
// PhantomJS and old webkit had a broken Date implementation.
var date = new Date(-5e13 - 1)
, brokenDate = !(date.toISOString && date.toISOString() == '0385-07-25T07:06:39.999Z');
$def($def.P + $def.F * brokenDate, 'Date', {toISOString: function(){
if(!isFinite(this))throw RangeError('Invalid time value');
var d = this
, y = d.getUTCFullYear()
, m = d.getUTCMilliseconds()
, s = y < 0 ? '-' : y > 9999 ? '+' : '';
return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) +
'-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) +
'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) +
':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
}});
if(classof(function(){ return arguments; }()) == 'Object')cof.classof = function(it){
var tag = classof(it);
return tag == 'Object' && isFunction(it.callee) ? 'Arguments' : tag;
};
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// ECMAScript 6 symbols shim
var $ = __webpack_require__(57)
, setTag = __webpack_require__(58).set
, uid = __webpack_require__(62)
, $def = __webpack_require__(59)
, keyOf = __webpack_require__(66)
, enumKeys = __webpack_require__(67)
, assertObject = __webpack_require__(63).obj
, has = $.has
, $create = $.create
, getDesc = $.getDesc
, setDesc = $.setDesc
, desc = $.desc
, getNames = $.getNames
, toObject = $.toObject
, Symbol = $.g.Symbol
, setter = false
, TAG = uid('tag')
, HIDDEN = uid('hidden')
, SymbolRegistry = {}
, AllSymbols = {}
, useNative = $.isFunction(Symbol);
function wrap(tag){
var sym = AllSymbols[tag] = $.set($create(Symbol.prototype), TAG, tag);
$.DESC && setter && setDesc(Object.prototype, tag, {
configurable: true,
set: function(value){
if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
setDesc(this, tag, desc(1, value));
}
});
return sym;
}
function defineProperty(it, key, D){
if(D && has(AllSymbols, key)){
if(!D.enumerable){
if(!has(it, HIDDEN))setDesc(it, HIDDEN, desc(1, {}));
it[HIDDEN][key] = true;
} else {
if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
D.enumerable = false;
}
} return setDesc(it, key, D);
}
function defineProperties(it, P){
assertObject(it);
var keys = enumKeys(P = toObject(P))
, i = 0
, l = keys.length
, key;
while(l > i)defineProperty(it, key = keys[i++], P[key]);
return it;
}
function create(it, P){
return P === undefined ? $create(it) : defineProperties($create(it), P);
}
function getOwnPropertyDescriptor(it, key){
var D = getDesc(it = toObject(it), key);
if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
return D;
}
function getOwnPropertyNames(it){
var names = getNames(toObject(it))
, result = []
, i = 0
, key;
while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key);
return result;
}
function getOwnPropertySymbols(it){
var names = getNames(toObject(it))
, result = []
, i = 0
, key;
while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]);
return result;
}
// 19.4.1.1 Symbol([description])
if(!useNative){
Symbol = function Symbol(description){
if(this instanceof Symbol)throw TypeError('Symbol is not a constructor');
return wrap(uid(description));
};
$.hide(Symbol.prototype, 'toString', function(){
return this[TAG];
});
$.create = create;
$.setDesc = defineProperty;
$.getDesc = getOwnPropertyDescriptor;
$.setDescs = defineProperties;
$.getNames = getOwnPropertyNames;
$.getSymbols = getOwnPropertySymbols;
}
var symbolStatics = {
// 19.4.2.1 Symbol.for(key)
'for': function(key){
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = Symbol(key);
},
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: function keyFor(key){
return keyOf(SymbolRegistry, key);
},
useSetter: function(){ setter = true; },
useSimple: function(){ setter = false; }
};
// 19.4.2.2 Symbol.hasInstance
// 19.4.2.3 Symbol.isConcatSpreadable
// 19.4.2.4 Symbol.iterator
// 19.4.2.6 Symbol.match
// 19.4.2.8 Symbol.replace
// 19.4.2.9 Symbol.search
// 19.4.2.10 Symbol.species
// 19.4.2.11 Symbol.split
// 19.4.2.12 Symbol.toPrimitive
// 19.4.2.13 Symbol.toStringTag
// 19.4.2.14 Symbol.unscopables
$.each.call((
'hasInstance,isConcatSpreadable,iterator,match,replace,search,' +
'species,split,toPrimitive,toStringTag,unscopables'
).split(','), function(it){
var sym = __webpack_require__(68)(it);
symbolStatics[it] = useNative ? sym : wrap(sym);
}
);
setter = true;
$def($def.G + $def.W, {Symbol: Symbol});
$def($def.S, 'Symbol', symbolStatics);
$def($def.S + $def.F * !useNative, 'Object', {
// 19.1.2.2 Object.create(O [, Properties])
create: create,
// 19.1.2.4 Object.defineProperty(O, P, Attributes)
defineProperty: defineProperty,
// 19.1.2.3 Object.defineProperties(O, Properties)
defineProperties: defineProperties,
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: getOwnPropertyDescriptor,
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: getOwnPropertyNames,
// 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols: getOwnPropertySymbols
});
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setTag(Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setTag($.g.JSON, 'JSON', true);
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.1 Object.assign(target, source)
var $def = __webpack_require__(59);
$def($def.S, 'Object', {assign: __webpack_require__(69)});
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.10 Object.is(value1, value2)
var $def = __webpack_require__(59);
$def($def.S, 'Object', {
is: function is(x, y){
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
}
});
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $def = __webpack_require__(59);
$def($def.S, 'Object', {setPrototypeOf: __webpack_require__(70).set});
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 19.1.3.6 Object.prototype.toString()
var $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, tmp = {};
tmp[__webpack_require__(68)('toStringTag')] = 'z';
if($.FW && cof(tmp) != 'z')$.hide(Object.prototype, 'toString', function toString(){
return '[object ' + cof.classof(this) + ']';
});
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, isObject = $.isObject
, toObject = $.toObject;
function wrapObjectMethod(METHOD, MODE){
var fn = ($.core.Object || {})[METHOD] || Object[METHOD]
, f = 0
, o = {};
o[METHOD] = MODE == 1 ? function(it){
return isObject(it) ? fn(it) : it;
} : MODE == 2 ? function(it){
return isObject(it) ? fn(it) : true;
} : MODE == 3 ? function(it){
return isObject(it) ? fn(it) : false;
} : MODE == 4 ? function getOwnPropertyDescriptor(it, key){
return fn(toObject(it), key);
} : MODE == 5 ? function getPrototypeOf(it){
return fn(Object($.assertDefined(it)));
} : function(it){
return fn(toObject(it));
};
try {
fn('z');
} catch(e){
f = 1;
}
$def($def.S + $def.F * f, 'Object', o);
}
wrapObjectMethod('freeze', 1);
wrapObjectMethod('seal', 1);
wrapObjectMethod('preventExtensions', 1);
wrapObjectMethod('isFrozen', 2);
wrapObjectMethod('isSealed', 2);
wrapObjectMethod('isExtensible', 3);
wrapObjectMethod('getOwnPropertyDescriptor', 4);
wrapObjectMethod('getPrototypeOf', 5);
wrapObjectMethod('keys');
wrapObjectMethod('getOwnPropertyNames');
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, NAME = 'name'
, setDesc = $.setDesc
, FunctionProto = Function.prototype;
// 19.2.4.2 name
NAME in FunctionProto || $.FW && $.DESC && setDesc(FunctionProto, NAME, {
configurable: true,
get: function(){
var match = String(this).match(/^\s*function ([^ (]*)/)
, name = match ? match[1] : '';
$.has(this, NAME) || setDesc(this, NAME, $.desc(5, name));
return name;
},
set: function(value){
$.has(this, NAME) || setDesc(this, NAME, $.desc(0, value));
}
});
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, abs = Math.abs
, floor = Math.floor
, _isFinite = $.g.isFinite
, MAX_SAFE_INTEGER = 0x1fffffffffffff; // pow(2, 53) - 1 == 9007199254740991;
function isInteger(it){
return !$.isObject(it) && _isFinite(it) && floor(it) === it;
}
$def($def.S, 'Number', {
// 20.1.2.1 Number.EPSILON
EPSILON: Math.pow(2, -52),
// 20.1.2.2 Number.isFinite(number)
isFinite: function isFinite(it){
return typeof it == 'number' && _isFinite(it);
},
// 20.1.2.3 Number.isInteger(number)
isInteger: isInteger,
// 20.1.2.4 Number.isNaN(number)
isNaN: function isNaN(number){
return number != number;
},
// 20.1.2.5 Number.isSafeInteger(number)
isSafeInteger: function isSafeInteger(number){
return isInteger(number) && abs(number) <= MAX_SAFE_INTEGER;
},
// 20.1.2.6 Number.MAX_SAFE_INTEGER
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER,
// 20.1.2.10 Number.MIN_SAFE_INTEGER
MIN_SAFE_INTEGER: -MAX_SAFE_INTEGER,
// 20.1.2.12 Number.parseFloat(string)
parseFloat: parseFloat,
// 20.1.2.13 Number.parseInt(string, radix)
parseInt: parseInt
});
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
var Infinity = 1 / 0
, $def = __webpack_require__(59)
, E = Math.E
, pow = Math.pow
, abs = Math.abs
, exp = Math.exp
, log = Math.log
, sqrt = Math.sqrt
, ceil = Math.ceil
, floor = Math.floor
, EPSILON = pow(2, -52)
, EPSILON32 = pow(2, -23)
, MAX32 = pow(2, 127) * (2 - EPSILON32)
, MIN32 = pow(2, -126);
function roundTiesToEven(n){
return n + 1 / EPSILON - 1 / EPSILON;
}
// 20.2.2.28 Math.sign(x)
function sign(x){
return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
}
// 20.2.2.5 Math.asinh(x)
function asinh(x){
return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log(x + sqrt(x * x + 1));
}
// 20.2.2.14 Math.expm1(x)
function expm1(x){
return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1;
}
$def($def.S, 'Math', {
// 20.2.2.3 Math.acosh(x)
acosh: function acosh(x){
return (x = +x) < 1 ? NaN : isFinite(x) ? log(x / E + sqrt(x + 1) * sqrt(x - 1) / E) + 1 : x;
},
// 20.2.2.5 Math.asinh(x)
asinh: asinh,
// 20.2.2.7 Math.atanh(x)
atanh: function atanh(x){
return (x = +x) == 0 ? x : log((1 + x) / (1 - x)) / 2;
},
// 20.2.2.9 Math.cbrt(x)
cbrt: function cbrt(x){
return sign(x = +x) * pow(abs(x), 1 / 3);
},
// 20.2.2.11 Math.clz32(x)
clz32: function clz32(x){
return (x >>>= 0) ? 31 - floor(log(x + 0.5) * Math.LOG2E) : 32;
},
// 20.2.2.12 Math.cosh(x)
cosh: function cosh(x){
return (exp(x = +x) + exp(-x)) / 2;
},
// 20.2.2.14 Math.expm1(x)
expm1: expm1,
// 20.2.2.16 Math.fround(x)
fround: function fround(x){
var $abs = abs(x)
, $sign = sign(x)
, a, result;
if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
a = (1 + EPSILON32 / EPSILON) * $abs;
result = a - (a - $abs);
if(result > MAX32 || result != result)return $sign * Infinity;
return $sign * result;
},
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
hypot: function hypot(value1, value2){ // eslint-disable-line no-unused-vars
var sum = 0
, len1 = arguments.length
, len2 = len1
, args = Array(len1)
, larg = -Infinity
, arg;
while(len1--){
arg = args[len1] = +arguments[len1];
if(arg == Infinity || arg == -Infinity)return Infinity;
if(arg > larg)larg = arg;
}
larg = arg || 1;
while(len2--)sum += pow(args[len2] / larg, 2);
return larg * sqrt(sum);
},
// 20.2.2.18 Math.imul(x, y)
imul: function imul(x, y){
var UInt16 = 0xffff
, xn = +x
, yn = +y
, xl = UInt16 & xn
, yl = UInt16 & yn;
return 0 | xl * yl + ((UInt16 & xn >>> 16) * yl + xl * (UInt16 & yn >>> 16) << 16 >>> 0);
},
// 20.2.2.20 Math.log1p(x)
log1p: function log1p(x){
return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x);
},
// 20.2.2.21 Math.log10(x)
log10: function log10(x){
return log(x) / Math.LN10;
},
// 20.2.2.22 Math.log2(x)
log2: function log2(x){
return log(x) / Math.LN2;
},
// 20.2.2.28 Math.sign(x)
sign: sign,
// 20.2.2.30 Math.sinh(x)
sinh: function sinh(x){
return abs(x = +x) < 1 ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (E / 2);
},
// 20.2.2.33 Math.tanh(x)
tanh: function tanh(x){
var a = expm1(x = +x)
, b = expm1(-x);
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
},
// 20.2.2.34 Math.trunc(x)
trunc: function trunc(it){
return (it > 0 ? floor : ceil)(it);
}
});
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59)
, toIndex = __webpack_require__(57).toIndex
, fromCharCode = String.fromCharCode;
$def($def.S, 'String', {
// 21.1.2.2 String.fromCodePoint(...codePoints)
fromCodePoint: function fromCodePoint(x){ // eslint-disable-line no-unused-vars
var res = []
, len = arguments.length
, i = 0
, code;
while(len > i){
code = +arguments[i++];
if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
res.push(code < 0x10000
? fromCharCode(code)
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
);
} return res.join('');
}
});
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59);
$def($def.S, 'String', {
// 21.1.2.4 String.raw(callSite, ...substitutions)
raw: function raw(callSite){
var tpl = $.toObject(callSite.raw)
, len = $.toLength(tpl.length)
, sln = arguments.length
, res = []
, i = 0;
while(len > i){
res.push(String(tpl[i++]));
if(i < sln)res.push(String(arguments[i]));
} return res.join('');
}
});
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
var set = __webpack_require__(57).set
, at = __webpack_require__(71)(true)
, ITER = __webpack_require__(62).safe('iter')
, $iter = __webpack_require__(72)
, step = $iter.step;
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(73)(String, 'String', function(iterated){
set(this, ITER, {o: String(iterated), i: 0});
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function(){
var iter = this[ITER]
, O = iter.o
, index = iter.i
, point;
if(index >= O.length)return step(1);
point = at.call(O, index);
iter.i += point.length;
return step(0, point);
});
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59);
$def($def.P, 'String', {
// 21.1.3.3 String.prototype.codePointAt(pos)
codePointAt: __webpack_require__(71)(false)
});
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, $def = __webpack_require__(59)
, toLength = $.toLength;
$def($def.P, 'String', {
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
endsWith: function endsWith(searchString /*, endPosition = @length */){
if(cof(searchString) == 'RegExp')throw TypeError();
var that = String($.assertDefined(this))
, endPosition = arguments[1]
, len = toLength(that.length)
, end = endPosition === undefined ? len : Math.min(toLength(endPosition), len);
searchString += '';
return that.slice(end - searchString.length, end) === searchString;
}
});
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, $def = __webpack_require__(59);
$def($def.P, 'String', {
// 21.1.3.7 String.prototype.includes(searchString, position = 0)
includes: function includes(searchString /*, position = 0 */){
if(cof(searchString) == 'RegExp')throw TypeError();
return !!~String($.assertDefined(this)).indexOf(searchString, arguments[1]);
}
});
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59);
$def($def.P, 'String', {
// 21.1.3.13 String.prototype.repeat(count)
repeat: function repeat(count){
var str = String($.assertDefined(this))
, res = ''
, n = $.toInteger(count);
if(n < 0 || n == Infinity)throw RangeError("Count can't be negative");
for(;n > 0; (n >>>= 1) && (str += str))if(n & 1)res += str;
return res;
}
});
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, $def = __webpack_require__(59);
$def($def.P, 'String', {
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
startsWith: function startsWith(searchString /*, position = 0 */){
if(cof(searchString) == 'RegExp')throw TypeError();
var that = String($.assertDefined(this))
, index = $.toLength(Math.min(arguments[1], that.length));
searchString += '';
return that.slice(index, index + searchString.length) === searchString;
}
});
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74)
, $def = __webpack_require__(59)
, $iter = __webpack_require__(72)
, call = __webpack_require__(75);
$def($def.S + $def.F * !__webpack_require__(76)(function(iter){ Array.from(iter); }), 'Array', {
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
var O = Object($.assertDefined(arrayLike))
, mapfn = arguments[1]
, mapping = mapfn !== undefined
, f = mapping ? ctx(mapfn, arguments[2], 2) : undefined
, index = 0
, length, result, step, iterator;
if($iter.is(O)){
iterator = $iter.get(O);
// strange IE quirks mode bug -> use typeof instead of isFunction
result = new (typeof this == 'function' ? this : Array);
for(; !(step = iterator.next()).done; index++){
result[index] = mapping ? call(iterator, f, [step.value, index], true) : step.value;
}
} else {
// strange IE quirks mode bug -> use typeof instead of isFunction
result = new (typeof this == 'function' ? this : Array)(length = $.toLength(O.length));
for(; length > index; index++){
result[index] = mapping ? f(O[index], index) : O[index];
}
}
result.length = index;
return result;
}
});
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59);
$def($def.S, 'Array', {
// 22.1.2.3 Array.of( ...items)
of: function of(/* ...args */){
var index = 0
, length = arguments.length
// strange IE quirks mode bug -> use typeof instead of isFunction
, result = new (typeof this == 'function' ? this : Array)(length);
while(length > index)result[index] = arguments[index++];
result.length = length;
return result;
}
});
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, setUnscope = __webpack_require__(77)
, ITER = __webpack_require__(62).safe('iter')
, $iter = __webpack_require__(72)
, step = $iter.step
, Iterators = $iter.Iterators;
// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
__webpack_require__(73)(Array, 'Array', function(iterated, kind){
$.set(this, ITER, {o: $.toObject(iterated), i: 0, k: kind});
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function(){
var iter = this[ITER]
, O = iter.o
, kind = iter.k
, index = iter.i++;
if(!O || index >= O.length){
iter.o = undefined;
return step(1);
}
if(kind == 'keys' )return step(0, index);
if(kind == 'values')return step(0, O[index]);
return step(0, [index, O[index]]);
}, 'values');
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;
setUnscope('keys');
setUnscope('values');
setUnscope('entries');
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(78)(Array);
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, toIndex = $.toIndex;
$def($def.P, 'Array', {
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
copyWithin: function copyWithin(target/* = 0 */, start /* = 0, end = @length */){
var O = Object($.assertDefined(this))
, len = $.toLength(O.length)
, to = toIndex(target, len)
, from = toIndex(start, len)
, end = arguments[2]
, fin = end === undefined ? len : toIndex(end, len)
, count = Math.min(fin - from, len - to)
, inc = 1;
if(from < to && to < from + count){
inc = -1;
from = from + count - 1;
to = to + count - 1;
}
while(count-- > 0){
if(from in O)O[to] = O[from];
else delete O[to];
to += inc;
from += inc;
} return O;
}
});
__webpack_require__(77)('copyWithin');
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, toIndex = $.toIndex;
$def($def.P, 'Array', {
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
fill: function fill(value /*, start = 0, end = @length */){
var O = Object($.assertDefined(this))
, length = $.toLength(O.length)
, index = toIndex(arguments[1], length)
, end = arguments[2]
, endPos = end === undefined ? length : toIndex(end, length);
while(endPos > index)O[index++] = value;
return O;
}
});
__webpack_require__(77)('fill');
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59);
$def($def.P, 'Array', {
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
find: __webpack_require__(61)(5)
});
__webpack_require__(77)('find');
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59);
$def($def.P, 'Array', {
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
findIndex: __webpack_require__(61)(6)
});
__webpack_require__(77)('findIndex');
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74)
, cof = __webpack_require__(58)
, $def = __webpack_require__(59)
, assert = __webpack_require__(63)
, forOf = __webpack_require__(79)
, setProto = __webpack_require__(70).set
, species = __webpack_require__(78)
, SPECIES = __webpack_require__(68)('species')
, RECORD = __webpack_require__(62).safe('record')
, PROMISE = 'Promise'
, global = $.g
, process = global.process
, asap = process && process.nextTick || __webpack_require__(80).set
, P = global[PROMISE]
, isFunction = $.isFunction
, isObject = $.isObject
, assertFunction = assert.fn
, assertObject = assert.obj
, test;
var useNative = isFunction(P) && isFunction(P.resolve) &&
P.resolve(test = new P(function(){})) == test;
// actual Firefox has broken subclass support, test that
function P2(x){
var self = new P(x);
setProto(self, P2.prototype);
return self;
}
if(useNative){
try { // protect against bad/buggy Object.setPrototype
setProto(P2, P);
P2.prototype = $.create(P.prototype, {constructor: {value: P2}});
if(!(P2.resolve(5).then(function(){}) instanceof P2)){
useNative = false;
}
} catch(e){ useNative = false; }
}
// helpers
function getConstructor(C){
var S = assertObject(C)[SPECIES];
return S != undefined ? S : C;
}
function isThenable(it){
var then;
if(isObject(it))then = it.then;
return isFunction(then) ? then : false;
}
function isUnhandled(promise){
var record = promise[RECORD]
, chain = record.c
, i = 0
, react;
if(record.h)return false;
while(chain.length > i){
react = chain[i++];
if(react.fail || !isUnhandled(react.P))return false;
} return true;
}
function notify(record, isReject){
var chain = record.c;
if(isReject || chain.length)asap(function(){
var promise = record.p
, value = record.v
, ok = record.s == 1
, i = 0;
if(isReject && isUnhandled(promise)){
setTimeout(function(){
if(isUnhandled(promise)){
if(cof(process) == 'process'){
process.emit('unhandledRejection', value, promise);
} else if(global.console && isFunction(console.error)){
console.error('Unhandled promise rejection', value);
}
}
}, 1e3);
} else while(chain.length > i)!function(react){
var cb = ok ? react.ok : react.fail
, ret, then;
try {
if(cb){
if(!ok)record.h = true;
ret = cb === true ? value : cb(value);
if(ret === react.P){
react.rej(TypeError(PROMISE + '-chain cycle'));
} else if(then = isThenable(ret)){
then.call(ret, react.res, react.rej);
} else react.res(ret);
} else react.rej(value);
} catch(err){
react.rej(err);
}
}(chain[i++]);
chain.length = 0;
});
}
function $reject(value){
var record = this;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
record.v = value;
record.s = 2;
notify(record, true);
}
function $resolve(value){
var record = this
, then, wrapper;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
try {
if(then = isThenable(value)){
wrapper = {r: record, d: false}; // wrap
then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
} else {
record.v = value;
record.s = 1;
notify(record);
}
} catch(err){
$reject.call(wrapper || {r: record, d: false}, err); // wrap
}
}
// constructor polyfill
if(!useNative){
// 25.4.3.1 Promise(executor)
P = function Promise(executor){
assertFunction(executor);
var record = {
p: assert.inst(this, P, PROMISE), // <- promise
c: [], // <- chain
s: 0, // <- state
d: false, // <- done
v: undefined, // <- value
h: false // <- handled rejection
};
$.hide(this, RECORD, record);
try {
executor(ctx($resolve, record, 1), ctx($reject, record, 1));
} catch(err){
$reject.call(record, err);
}
};
$.mix(P.prototype, {
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
then: function then(onFulfilled, onRejected){
var S = assertObject(assertObject(this).constructor)[SPECIES];
var react = {
ok: isFunction(onFulfilled) ? onFulfilled : true,
fail: isFunction(onRejected) ? onRejected : false
};
var promise = react.P = new (S != undefined ? S : P)(function(res, rej){
react.res = assertFunction(res);
react.rej = assertFunction(rej);
});
var record = this[RECORD];
record.c.push(react);
record.s && notify(record);
return promise;
},
// 25.4.5.1 Promise.prototype.catch(onRejected)
'catch': function(onRejected){
return this.then(undefined, onRejected);
}
});
}
// export
$def($def.G + $def.W + $def.F * !useNative, {Promise: P});
cof.set(P, PROMISE);
species(P);
species($.core[PROMISE]); // for wrapper
// statics
$def($def.S + $def.F * !useNative, PROMISE, {
// 25.4.4.5 Promise.reject(r)
reject: function reject(r){
return new (getConstructor(this))(function(res, rej){
rej(r);
});
},
// 25.4.4.6 Promise.resolve(x)
resolve: function resolve(x){
return isObject(x) && RECORD in x && $.getProto(x) === this.prototype
? x : new (getConstructor(this))(function(res){
res(x);
});
}
});
$def($def.S + $def.F * !(useNative && __webpack_require__(76)(function(iter){
P.all(iter)['catch'](function(){});
})), PROMISE, {
// 25.4.4.1 Promise.all(iterable)
all: function all(iterable){
var C = getConstructor(this)
, values = [];
return new C(function(res, rej){
forOf(iterable, false, values.push, values);
var remaining = values.length
, results = Array(remaining);
if(remaining)$.each.call(values, function(promise, index){
C.resolve(promise).then(function(value){
results[index] = value;
--remaining || res(results);
}, rej);
});
else res(results);
});
},
// 25.4.4.4 Promise.race(iterable)
race: function race(iterable){
var C = getConstructor(this);
return new C(function(res, rej){
forOf(iterable, false, function(promise){
C.resolve(promise).then(res, rej);
});
});
}
});
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var strong = __webpack_require__(81);
// 23.1 Map Objects
__webpack_require__(82)('Map', {
// 23.1.3.6 Map.prototype.get(key)
get: function get(key){
var entry = strong.getEntry(this, key);
return entry && entry.v;
},
// 23.1.3.9 Map.prototype.set(key, value)
set: function set(key, value){
return strong.def(this, key === 0 ? 0 : key, value);
}
}, strong, true);
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var strong = __webpack_require__(81);
// 23.2 Set Objects
__webpack_require__(82)('Set', {
// 23.2.3.1 Set.prototype.add(value)
add: function add(value){
return strong.def(this, value = value === 0 ? 0 : value, value);
}
}, strong);
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, weak = __webpack_require__(83)
, leakStore = weak.leakStore
, ID = weak.ID
, WEAK = weak.WEAK
, has = $.has
, isObject = $.isObject
, isFrozen = Object.isFrozen || $.core.Object.isFrozen
, tmp = {};
// 23.3 WeakMap Objects
var WeakMap = __webpack_require__(82)('WeakMap', {
// 23.3.3.3 WeakMap.prototype.get(key)
get: function get(key){
if(isObject(key)){
if(isFrozen(key))return leakStore(this).get(key);
if(has(key, WEAK))return key[WEAK][this[ID]];
}
},
// 23.3.3.5 WeakMap.prototype.set(key, value)
set: function set(key, value){
return weak.def(this, key, value);
}
}, weak, true, true);
// IE11 WeakMap frozen keys fix
if($.FW && new WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
$.each.call(['delete', 'has', 'get', 'set'], function(key){
var method = WeakMap.prototype[key];
WeakMap.prototype[key] = function(a, b){
// store frozen objects on leaky map
if(isObject(a) && isFrozen(a)){
var result = leakStore(this)[key](a, b);
return key == 'set' ? this : result;
// store all the rest on native weakmap
} return method.call(this, a, b);
};
});
}
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var weak = __webpack_require__(83);
// 23.4 WeakSet Objects
__webpack_require__(82)('WeakSet', {
// 23.4.3.1 WeakSet.prototype.add(value)
add: function add(value){
return weak.def(this, value, true);
}
}, weak, false, true);
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, setProto = __webpack_require__(70)
, $iter = __webpack_require__(72)
, ITER = __webpack_require__(62).safe('iter')
, step = $iter.step
, assert = __webpack_require__(63)
, isObject = $.isObject
, getDesc = $.getDesc
, setDesc = $.setDesc
, getProto = $.getProto
, apply = Function.apply
, assertObject = assert.obj
, _isExtensible = Object.isExtensible || $.it;
function Enumerate(iterated){
$.set(this, ITER, {o: iterated, k: undefined, i: 0});
}
$iter.create(Enumerate, 'Object', function(){
var iter = this[ITER]
, keys = iter.k
, key;
if(keys == undefined){
iter.k = keys = [];
for(key in iter.o)keys.push(key);
}
do {
if(iter.i >= keys.length)return step(1);
} while(!((key = keys[iter.i++]) in iter.o));
return step(0, key);
});
function wrap(fn){
return function(it){
assertObject(it);
try {
fn.apply(undefined, arguments);
return true;
} catch(e){
return false;
}
};
}
function get(target, propertyKey/*, receiver*/){
var receiver = arguments.length < 3 ? target : arguments[2]
, desc = getDesc(assertObject(target), propertyKey), proto;
if(desc)return $.has(desc, 'value')
? desc.value
: desc.get === undefined
? undefined
: desc.get.call(receiver);
return isObject(proto = getProto(target))
? get(proto, propertyKey, receiver)
: undefined;
}
function set(target, propertyKey, V/*, receiver*/){
var receiver = arguments.length < 4 ? target : arguments[3]
, ownDesc = getDesc(assertObject(target), propertyKey)
, existingDescriptor, proto;
if(!ownDesc){
if(isObject(proto = getProto(target))){
return set(proto, propertyKey, V, receiver);
}
ownDesc = $.desc(0);
}
if($.has(ownDesc, 'value')){
if(ownDesc.writable === false || !isObject(receiver))return false;
existingDescriptor = getDesc(receiver, propertyKey) || $.desc(0);
existingDescriptor.value = V;
setDesc(receiver, propertyKey, existingDescriptor);
return true;
}
return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
}
var reflect = {
// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
apply: __webpack_require__(74)(Function.call, apply, 3),
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
construct: function construct(target, argumentsList /*, newTarget*/){
var proto = assert.fn(arguments.length < 3 ? target : arguments[2]).prototype
, instance = $.create(isObject(proto) ? proto : Object.prototype)
, result = apply.call(target, instance, argumentsList);
return isObject(result) ? result : instance;
},
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
defineProperty: wrap(setDesc),
// 26.1.4 Reflect.deleteProperty(target, propertyKey)
deleteProperty: function deleteProperty(target, propertyKey){
var desc = getDesc(assertObject(target), propertyKey);
return desc && !desc.configurable ? false : delete target[propertyKey];
},
// 26.1.5 Reflect.enumerate(target)
enumerate: function enumerate(target){
return new Enumerate(assertObject(target));
},
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
get: get,
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey){
return getDesc(assertObject(target), propertyKey);
},
// 26.1.8 Reflect.getPrototypeOf(target)
getPrototypeOf: function getPrototypeOf(target){
return getProto(assertObject(target));
},
// 26.1.9 Reflect.has(target, propertyKey)
has: function has(target, propertyKey){
return propertyKey in target;
},
// 26.1.10 Reflect.isExtensible(target)
isExtensible: function isExtensible(target){
return !!_isExtensible(assertObject(target));
},
// 26.1.11 Reflect.ownKeys(target)
ownKeys: __webpack_require__(84),
// 26.1.12 Reflect.preventExtensions(target)
preventExtensions: wrap(Object.preventExtensions || $.it),
// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
set: set
};
// 26.1.14 Reflect.setPrototypeOf(target, proto)
if(setProto)reflect.setPrototypeOf = function setPrototypeOf(target, proto){
setProto.check(target, proto);
try {
setProto.set(target, proto);
return true;
} catch(e){
return false;
}
};
$def($def.G, {Reflect: {}});
$def($def.S, 'Reflect', reflect);
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/domenic/Array.prototype.includes
var $def = __webpack_require__(59);
$def($def.P, 'Array', {
includes: __webpack_require__(64)(true)
});
__webpack_require__(77)('includes');
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/mathiasbynens/String.prototype.at
var $def = __webpack_require__(59);
$def($def.P, 'String', {
at: __webpack_require__(71)(true)
});
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
// https://gist.github.com/kangax/9698100
var $def = __webpack_require__(59);
$def($def.S, 'RegExp', {
escape: __webpack_require__(65)(/([\\\-[\]{}()*+?.,^$|])/g, '\\$1', true)
});
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
// https://gist.github.com/WebReflection/9353781
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, ownKeys = __webpack_require__(84);
$def($def.S, 'Object', {
getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object){
var O = $.toObject(object)
, result = {};
$.each.call(ownKeys(O), function(key){
$.setDesc(result, key, $.desc(0, $.getDesc(O, key)));
});
return result;
}
});
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
// http://goo.gl/XkBrjD
var $ = __webpack_require__(57)
, $def = __webpack_require__(59);
function createObjectToArray(isEntries){
return function(object){
var O = $.toObject(object)
, keys = $.getKeys(O)
, length = keys.length
, i = 0
, result = Array(length)
, key;
if(isEntries)while(length > i)result[i] = [key = keys[i++], O[key]];
else while(length > i)result[i] = O[keys[i++]];
return result;
};
}
$def($def.S, 'Object', {
values: createObjectToArray(false),
entries: createObjectToArray(true)
});
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
__webpack_require__(85)('Map');
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
__webpack_require__(85)('Set');
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59)
, $task = __webpack_require__(80);
$def($def.G + $def.B, {
setImmediate: $task.set,
clearImmediate: $task.clear
});
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(21);
var $ = __webpack_require__(57)
, Iterators = __webpack_require__(72).Iterators
, ITERATOR = __webpack_require__(68)('iterator')
, ArrayValues = Iterators.Array
, NodeList = $.g.NodeList;
if($.FW && NodeList && !(ITERATOR in NodeList.prototype)){
$.hide(NodeList.prototype, ITERATOR, ArrayValues);
}
Iterators.NodeList = ArrayValues;
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
// ie9- setTimeout & setInterval additional parameters fix
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, invoke = __webpack_require__(60)
, partial = __webpack_require__(86)
, navigator = $.g.navigator
, MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
function wrap(set){
return MSIE ? function(fn, time /*, ...args */){
return set(invoke(
partial,
[].slice.call(arguments, 2),
$.isFunction(fn) ? fn : Function(fn)
), time);
} : set;
}
$def($def.G + $def.B + $def.F * MSIE, {
setTimeout: wrap($.g.setTimeout),
setInterval: wrap($.g.setInterval)
});
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74)
, $def = __webpack_require__(59)
, assign = __webpack_require__(69)
, keyOf = __webpack_require__(66)
, ITER = __webpack_require__(62).safe('iter')
, assert = __webpack_require__(63)
, $iter = __webpack_require__(72)
, forOf = __webpack_require__(79)
, step = $iter.step
, getKeys = $.getKeys
, toObject = $.toObject
, has = $.has;
function Dict(iterable){
var dict = $.create(null);
if(iterable != undefined){
if($iter.is(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});
}
$iter.create(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 step(1);
}
} while(!has(O, key = keys[iter.i++]));
if(kind == 'keys' )return step(0, key);
if(kind == 'values')return step(0, O[key]);
return step(0, [key, O[key]]);
});
function createDictIter(kind){
return function(it){
return new DictIterator(it, kind);
};
}
function generic(A, B){
// strange IE quirks mode bug -> use typeof instead of isFunction
return typeof A == 'function' ? A : B;
}
// 0 -> Dict.forEach
// 1 -> Dict.map
// 2 -> Dict.filter
// 3 -> Dict.some
// 4 -> Dict.every
// 5 -> Dict.find
// 6 -> Dict.findKey
// 7 -> Dict.mapPairs
function createDictMethod(TYPE){
var IS_MAP = TYPE == 1
, IS_EVERY = TYPE == 4;
return function(object, callbackfn, that /* = undefined */){
var f = ctx(callbackfn, that, 3)
, O = toObject(object)
, result = IS_MAP || 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(IS_MAP)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(IS_EVERY)return false; // every
}
}
return TYPE == 3 || IS_EVERY ? IS_EVERY : result;
};
}
// true -> Dict.turn
// false -> Dict.reduce
function createDictReduce(IS_TURN){
return function(object, mapfn, init){
assert.fn(mapfn);
var O = toObject(object)
, keys = getKeys(O)
, length = keys.length
, i = 0
, memo, key, result;
if(IS_TURN){
memo = init == undefined ? new (generic(this, Dict)) : Object(init);
} else if(arguments.length < 3){
assert(length, 'Reduce of empty object with no initial value');
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(IS_TURN){
if(result === false)break;
} else memo = result;
}
return memo;
};
}
var findKey = createDictMethod(6);
$def($def.G + $def.F, {Dict: $.mix(Dict, {
keys: createDictIter('keys'),
values: createDictIter('values'),
entries: createDictIter('entries'),
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: function(object, el){
return (el == el ? keyOf(object, el) : findKey(object, function(it){
return it != it;
})) !== undefined;
},
// Has / get / set own property
has: has,
get: function(object, key){
if(has(object, key))return object[key];
},
set: $.def,
isDict: function(it){
return $.isObject(it) && $.getProto(it) === Dict.prototype;
}
})});
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
var core = __webpack_require__(57).core
, $iter = __webpack_require__(72);
core.isIterable = $iter.is;
core.getIterator = $iter.get;
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74)
, safe = __webpack_require__(62).safe
, $def = __webpack_require__(59)
, $iter = __webpack_require__(72)
, forOf = __webpack_require__(79)
, ENTRIES = safe('entries')
, FN = safe('fn')
, ITER = safe('iter')
, call = __webpack_require__(75)
, getIterator = $iter.get
, setIterator = $iter.set
, createIterator = $iter.create;
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 Iterator(iter, fn, that){
this[ITER] = getIterator(iter);
this[ENTRIES] = iter[ENTRIES];
this[FN] = ctx(fn, that, iter[ENTRIES] ? 2 : 1);
}
createIterator(Iterator, 'Chain', next, $forProto);
setIterator(Iterator.prototype, $.that); // override $forProto iterator
return Iterator;
}
var MapIter = createChainIterator(function(){
var step = this[ITER].next();
return step.done
? step
: $iter.step(0, call(this[ITER], this[FN], step.value, this[ENTRIES]));
});
var FilterIter = createChainIterator(function(){
for(;;){
var step = this[ITER].next();
if(step.done || call(this[ITER], this[FN], step.value, this[ENTRIES]))return step;
}
});
$.mix($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, result.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 = $iter.is;
$for.getIterator = getIterator;
$def($def.G + $def.F, {$for: $for});
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, partial = __webpack_require__(86);
// https://esdiscuss.org/topic/promise-returning-delay-function
$def($def.G + $def.F, {
delay: function(time){
return new ($.core.Promise || $.g.Promise)(function(resolve){
setTimeout(partial.call(resolve, true), time);
});
}
});
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59);
// Placeholder
$.core._ = $.path._ = $.path._ || {};
$def($def.P + $def.F, 'Function', {
part: __webpack_require__(86)
});
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, ownKeys = __webpack_require__(84);
function define(target, mixin){
var keys = ownKeys($.toObject(mixin))
, length = keys.length
, i = 0, key;
while(length > i)$.setDesc(target, key = keys[i++], $.getDesc(mixin, key));
return target;
}
$def($def.S + $def.F, 'Object', {
isObject: $.isObject,
classof: __webpack_require__(58).classof,
define: define,
make: function(proto, mixin){
return define($.create(proto), mixin);
}
});
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, assertFunction = __webpack_require__(63).fn;
$def($def.P + $def.F, '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;
}
});
__webpack_require__(77)('turn');
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, ITER = __webpack_require__(62).safe('iter');
__webpack_require__(73)(Number, 'Number', function(iterated){
$.set(this, ITER, {l: $.toLength(iterated), i: 0});
}, function(){
var iter = this[ITER]
, i = iter.i++
, done = i >= iter.l;
return {done: done, value: done ? undefined : i};
});
/***/ },
/* 51 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, invoke = __webpack_require__(60)
, methods = {};
methods.random = function(lim /* = 0 */){
var a = +this
, b = lim == undefined ? 0 : +lim
, m = Math.min(a, b);
return Math.random() * (Math.max(a, b) - m) + m;
};
if($.FW)$.each.call((
// 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'
).split(','), function(key){
var fn = Math[key];
if(fn)methods[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);
};
}
);
$def($def.P + $def.F, 'Number', methods);
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59)
, replacer = __webpack_require__(65);
var escapeHTMLDict = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
}, unescapeHTMLDict = {}, key;
for(key in escapeHTMLDict)unescapeHTMLDict[escapeHTMLDict[key]] = key;
$def($def.P + $def.F, 'String', {
escapeHTML: replacer(/[&<>"']/g, escapeHTMLDict),
unescapeHTML: replacer(/&(?:amp|lt|gt|quot|apos);/g, unescapeHTMLDict)
});
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, core = $.core
, formatRegExp = /\b\w\w?\b/g
, flexioRegExp = /:(.*)\|(.*)$/
, locales = {}
, current = 'en'
, SECONDS = 'Seconds'
, MINUTES = 'Minutes'
, HOURS = 'Hours'
, DATE = 'Date'
, MONTH = 'Month'
, YEAR = 'FullYear';
function lz(num){
return num > 9 ? num : '0' + num;
}
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 = [];
$.each.call(locale.months.split(','), function(it){
result.push(it.replace(flexioRegExp, '$' + index));
});
return result;
}
locales[lang] = [locale.weekdays.split(','), split(1), split(2)];
return core;
}
$def($def.P + $def.F, 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;
/***/ },
/* 54 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59);
$def($def.G + $def.F, {global: __webpack_require__(57).g});
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, log = {}
, enabled = true;
// Methods from https://github.com/DeveloperToolsWG/console-object/blob/master/api.md
$.each.call(('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').split(','), function(key){
log[key] = function(){
if(enabled && $.g.console && $.isFunction(console[key])){
return Function.apply.call(console[key], console, arguments);
}
};
});
$def($def.G + $def.F, {log: __webpack_require__(69)(log.log, log, {
enable: function(){
enabled = true;
},
disable: function(){
enabled = false;
}
})});
/***/ },
/* 56 */
/***/ function(module, exports, __webpack_require__) {
// JavaScript 1.6 / Strawman array statics shim
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, $Array = $.core.Array || Array
, statics = {};
function setStatics(keys, length){
$.each.call(keys.split(','), function(key){
if(length == undefined && key in $Array)statics[key] = $Array[key];
else if(key in [])statics[key] = __webpack_require__(74)(Function.call, [][key], length);
});
}
setStatics('pop,reverse,shift,keys,values,entries', 1);
setStatics('indexOf,every,some,forEach,map,filter,find,findIndex,includes', 3);
setStatics('join,slice,concat,push,splice,unshift,sort,lastIndexOf,' +
'reduce,reduceRight,copyWithin,fill,turn');
$def($def.S, 'Array', statics);
/***/ },
/* 57 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var global = typeof self != 'undefined' ? self : Function('return this')()
, core = {}
, defineProperty = Object.defineProperty
, hasOwnProperty = {}.hasOwnProperty
, ceil = Math.ceil
, floor = Math.floor
, max = Math.max
, min = Math.min;
// The engine works fine with descriptors? Thank's IE8 for his funny defineProperty.
var DESC = !!function(){
try {
return defineProperty({}, 'a', {get: function(){ return 2; }}).a == 2;
} catch(e){ /* empty */ }
}();
var hide = createDefiner(1);
// 7.1.4 ToInteger
function toInteger(it){
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
}
function desc(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writable : !(bitmap & 4),
value : value
};
}
function simpleSet(object, key, value){
object[key] = value;
return object;
}
function createDefiner(bitmap){
return DESC ? function(object, key, value){
return $.setDesc(object, key, desc(bitmap, value));
} : simpleSet;
}
function isObject(it){
return it !== null && (typeof it == 'object' || typeof it == 'function');
}
function isFunction(it){
return typeof it == 'function';
}
function assertDefined(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
}
var $ = module.exports = __webpack_require__(87)({
g: global,
core: core,
html: global.document && document.documentElement,
// http://jsperf.com/core-js-isobject
isObject: isObject,
isFunction: isFunction,
it: function(it){
return it;
},
that: function(){
return this;
},
// 7.1.4 ToInteger
toInteger: toInteger,
// 7.1.15 ToLength
toLength: function(it){
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
},
toIndex: function(index, length){
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
},
has: function(it, key){
return hasOwnProperty.call(it, key);
},
create: Object.create,
getProto: Object.getPrototypeOf,
DESC: DESC,
desc: desc,
getDesc: Object.getOwnPropertyDescriptor,
setDesc: defineProperty,
setDescs: Object.defineProperties,
getKeys: Object.keys,
getNames: Object.getOwnPropertyNames,
getSymbols: Object.getOwnPropertySymbols,
assertDefined: assertDefined,
// Dummy, fix for not array-like ES3 string in es5 module
ES5Object: Object,
toObject: function(it){
return $.ES5Object(assertDefined(it));
},
hide: hide,
def: createDefiner(0),
set: global.Symbol ? simpleSet : hide,
mix: function(target, src){
for(var key in src)hide(target, key, src[key]);
return target;
},
each: [].forEach
});
/* eslint-disable no-undef */
if(typeof __e != 'undefined')__e = core;
if(typeof __g != 'undefined')__g = global;
/***/ },
/* 58 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, TAG = __webpack_require__(68)('toStringTag')
, toString = {}.toString;
function cof(it){
return toString.call(it).slice(8, -1);
}
cof.classof = function(it){
var O, T;
return it == undefined ? it === undefined ? 'Undefined' : 'Null'
: typeof (T = (O = Object(it))[TAG]) == 'string' ? T : cof(O);
};
cof.set = function(it, tag, stat){
if(it && !$.has(it = stat ? it : it.prototype, TAG))$.hide(it, TAG, tag);
};
module.exports = cof;
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, global = $.g
, core = $.core
, isFunction = $.isFunction;
function ctx(fn, that){
return function(){
return fn.apply(that, arguments);
};
}
// type bitmap
$def.F = 1; // forced
$def.G = 2; // global
$def.S = 4; // static
$def.P = 8; // proto
$def.B = 16; // bind
$def.W = 32; // wrap
function $def(type, name, source){
var key, own, out, exp
, isGlobal = type & $def.G
, target = isGlobal ? global : type & $def.S
? global[name] : (global[name] || {}).prototype
, exports = isGlobal ? core : core[name] || (core[name] = {});
if(isGlobal)source = name;
for(key in source){
// contains in native
own = !(type & $def.F) && target && key in target;
if(own && key in exports)continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
if(isGlobal && !isFunction(target[key]))exp = source[key];
// bind timers to global for call from export context
else if(type & $def.B && own)exp = ctx(out, global);
// wrap global constructors for prevent change them in library
else if(type & $def.W && target[key] == out)!function(C){
exp = function(param){
return this instanceof C ? new C(param) : C(param);
};
exp.prototype = C.prototype;
}(out);
else exp = type & $def.P && isFunction(out) ? ctx(Function.call, out) : out;
// export
$.hide(exports, key, exp);
}
}
module.exports = $def;
/***/ },
/* 60 */
/***/ function(module, exports, __webpack_require__) {
// Fast apply
// http://jsperf.lnkit.com/fast-apply/5
module.exports = function(fn, args, that){
var un = that === undefined;
switch(args.length){
case 0: return un ? fn()
: fn.call(that);
case 1: return un ? fn(args[0])
: fn.call(that, args[0]);
case 2: return un ? fn(args[0], args[1])
: fn.call(that, args[0], args[1]);
case 3: return un ? fn(args[0], args[1], args[2])
: fn.call(that, args[0], args[1], args[2]);
case 4: return un ? fn(args[0], args[1], args[2], args[3])
: fn.call(that, args[0], args[1], args[2], args[3]);
case 5: return un ? fn(args[0], args[1], args[2], args[3], args[4])
: fn.call(that, args[0], args[1], args[2], args[3], args[4]);
} return fn.apply(that, args);
};
/***/ },
/* 61 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
// 4 -> Array#every
// 5 -> Array#find
// 6 -> Array#findIndex
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74);
module.exports = function(TYPE){
var IS_MAP = TYPE == 1
, IS_FILTER = TYPE == 2
, IS_SOME = TYPE == 3
, IS_EVERY = TYPE == 4
, IS_FIND_INDEX = TYPE == 6
, NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
return function(callbackfn/*, that = undefined */){
var O = Object($.assertDefined(this))
, self = $.ES5Object(O)
, f = ctx(callbackfn, arguments[1], 3)
, length = $.toLength(self.length)
, index = 0
, result = IS_MAP ? Array(length) : IS_FILTER ? [] : undefined
, val, res;
for(;length > index; index++)if(NO_HOLES || index in self){
val = self[index];
res = f(val, index, O);
if(TYPE){
if(IS_MAP)result[index] = res; // map
else if(res)switch(TYPE){
case 3: return true; // some
case 5: return val; // find
case 6: return index; // findIndex
case 2: result.push(val); // filter
} else if(IS_EVERY)return false; // every
}
}
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
};
};
/***/ },
/* 62 */
/***/ function(module, exports, __webpack_require__) {
var sid = 0;
function uid(key){
return 'Symbol(' + key + ')_' + (++sid + Math.random()).toString(36);
}
uid.safe = __webpack_require__(57).g.Symbol || uid;
module.exports = uid;
/***/ },
/* 63 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57);
function assert(condition, msg1, msg2){
if(!condition)throw TypeError(msg2 ? msg1 + msg2 : msg1);
}
assert.def = $.assertDefined;
assert.fn = function(it){
if(!$.isFunction(it))throw TypeError(it + ' is not a function!');
return it;
};
assert.obj = function(it){
if(!$.isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
assert.inst = function(it, Constructor, name){
if(!(it instanceof Constructor))throw TypeError(name + ": use the 'new' operator!");
return it;
};
module.exports = assert;
/***/ },
/* 64 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// false -> Array#indexOf
// true -> Array#includes
var $ = __webpack_require__(57);
module.exports = function(IS_INCLUDES){
return function(el /*, fromIndex = 0 */){
var O = $.toObject(this)
, length = $.toLength(O.length)
, index = $.toIndex(arguments[1], length)
, value;
if(IS_INCLUDES && el != el)while(length > index){
value = O[index++];
if(value != value)return true;
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
if(O[index] === el)return IS_INCLUDES || index;
} return !IS_INCLUDES && -1;
};
};
/***/ },
/* 65 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = function(regExp, replace, isStatic){
var replacer = replace === Object(replace) ? function(part){
return replace[part];
} : replace;
return function(it){
return String(isStatic ? it : this).replace(regExp, replacer);
};
};
/***/ },
/* 66 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57);
module.exports = function(object, el){
var O = $.toObject(object)
, keys = $.getKeys(O)
, length = keys.length
, index = 0
, key;
while(length > index)if(O[key = keys[index++]] === el)return key;
};
/***/ },
/* 67 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57);
module.exports = function(it){
var keys = $.getKeys(it)
, getDesc = $.getDesc
, getSymbols = $.getSymbols;
if(getSymbols)$.each.call(getSymbols(it), function(key){
if(getDesc(it, key).enumerable)keys.push(key);
});
return keys;
};
/***/ },
/* 68 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(57).g
, store = {};
module.exports = function(name){
return store[name] || (store[name] =
global.Symbol && global.Symbol[name] || __webpack_require__(62).safe('Symbol.' + name));
};
/***/ },
/* 69 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, enumKeys = __webpack_require__(67);
// 19.1.2.1 Object.assign(target, source, ...)
/* eslint-disable no-unused-vars */
module.exports = Object.assign || function assign(target, source){
/* eslint-enable no-unused-vars */
var T = Object($.assertDefined(target))
, l = arguments.length
, i = 1;
while(l > i){
var S = $.ES5Object(arguments[i++])
, keys = enumKeys(S)
, length = keys.length
, j = 0
, key;
while(length > j)T[key = keys[j++]] = S[key];
}
return T;
};
/***/ },
/* 70 */
/***/ function(module, exports, __webpack_require__) {
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var $ = __webpack_require__(57)
, assert = __webpack_require__(63);
function check(O, proto){
assert.obj(O);
assert(proto === null || $.isObject(proto), proto, ": can't set as prototype!");
}
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} // eslint-disable-line
? function(buggy, set){
try {
set = __webpack_require__(74)(Function.call, $.getDesc(Object.prototype, '__proto__').set, 2);
set({}, []);
} catch(e){ buggy = true; }
return function setPrototypeOf(O, proto){
check(O, proto);
if(buggy)O.__proto__ = proto;
else set(O, proto);
return O;
};
}()
: undefined),
check: check
};
/***/ },
/* 71 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// true -> String#at
// false -> String#codePointAt
var $ = __webpack_require__(57);
module.exports = function(TO_STRING){
return function(pos){
var s = String($.assertDefined(this))
, i = $.toInteger(pos)
, l = s.length
, a, b;
if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l
|| (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? TO_STRING ? s.charAt(i) : a
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
/***/ },
/* 72 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, assertObject = __webpack_require__(63).obj
, SYMBOL_ITERATOR = __webpack_require__(68)('iterator')
, FF_ITERATOR = '@@iterator'
, Iterators = {}
, IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
setIterator(IteratorPrototype, $.that);
function setIterator(O, value){
$.hide(O, SYMBOL_ITERATOR, value);
// Add iterator for FF iterator protocol
if(FF_ITERATOR in [])$.hide(O, FF_ITERATOR, value);
}
module.exports = {
// Safari has buggy iterators w/o `next`
BUGGY: 'keys' in [] && !('next' in [].keys()),
Iterators: Iterators,
step: function(done, value){
return {value: value, done: !!done};
},
is: function(it){
var O = Object(it)
, Symbol = $.g.Symbol
, SYM = Symbol && Symbol.iterator || FF_ITERATOR;
return SYM in O || SYMBOL_ITERATOR in O || $.has(Iterators, cof.classof(O));
},
get: function(it){
var Symbol = $.g.Symbol
, ext = it[Symbol && Symbol.iterator || FF_ITERATOR]
, getIter = ext || it[SYMBOL_ITERATOR] || Iterators[cof.classof(it)];
return assertObject(getIter.call(it));
},
set: setIterator,
create: function(Constructor, NAME, next, proto){
Constructor.prototype = $.create(proto || IteratorPrototype, {next: $.desc(1, next)});
cof.set(Constructor, NAME + ' Iterator');
}
};
/***/ },
/* 73 */
/***/ function(module, exports, __webpack_require__) {
var $def = __webpack_require__(59)
, $ = __webpack_require__(57)
, cof = __webpack_require__(58)
, $iter = __webpack_require__(72)
, SYMBOL_ITERATOR = __webpack_require__(68)('iterator')
, FF_ITERATOR = '@@iterator'
, VALUES = 'values'
, Iterators = $iter.Iterators;
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE){
$iter.create(Constructor, NAME, next);
function createMethod(kind){
return function(){
return new Constructor(this, kind);
};
}
var TAG = NAME + ' Iterator'
, proto = Base.prototype
, _native = proto[SYMBOL_ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
, _default = _native || createMethod(DEFAULT)
, methods, key;
// Fix native
if(_native){
var IteratorPrototype = $.getProto(_default.call(new Base));
// Set @@toStringTag to native iterators
cof.set(IteratorPrototype, TAG, true);
// FF fix
if($.FW && $.has(proto, FF_ITERATOR))$iter.set(IteratorPrototype, $.that);
}
// Define iterator
if($.FW)$iter.set(proto, _default);
// Plug for library
Iterators[NAME] = _default;
Iterators[TAG] = $.that;
if(DEFAULT){
methods = {
keys: IS_SET ? _default : createMethod('keys'),
values: DEFAULT == VALUES ? _default : createMethod(VALUES),
entries: DEFAULT != VALUES ? _default : createMethod('entries')
};
if(FORCE)for(key in methods){
if(!(key in proto))$.hide(proto, key, methods[key]);
} else $def($def.P + $def.F * $iter.BUGGY, NAME, methods);
}
};
/***/ },
/* 74 */
/***/ function(module, exports, __webpack_require__) {
// Optional / simple context binding
var assertFunction = __webpack_require__(63).fn;
module.exports = function(fn, that, length){
assertFunction(fn);
if(~length && that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
} return function(/* ...args */){
return fn.apply(that, arguments);
};
};
/***/ },
/* 75 */
/***/ function(module, exports, __webpack_require__) {
var assertObject = __webpack_require__(63).obj;
function close(iterator){
var ret = iterator['return'];
if(ret !== undefined)assertObject(ret.call(iterator));
}
function call(iterator, fn, value, entries){
try {
return entries ? fn(assertObject(value)[0], value[1]) : fn(value);
} catch(e){
close(iterator);
throw e;
}
}
call.close = close;
module.exports = call;
/***/ },
/* 76 */
/***/ function(module, exports, __webpack_require__) {
var SYMBOL_ITERATOR = __webpack_require__(68)('iterator')
, SAFE_CLOSING = false;
try {
var riter = [7][SYMBOL_ITERATOR]();
riter['return'] = function(){ SAFE_CLOSING = true; };
Array.from(riter, function(){ throw 2; });
} catch(e){ /* empty */ }
module.exports = function(exec){
if(!SAFE_CLOSING)return false;
var safe = false;
try {
var arr = [7]
, iter = arr[SYMBOL_ITERATOR]();
iter.next = function(){ safe = true; };
arr[SYMBOL_ITERATOR] = function(){ return iter; };
exec(arr);
} catch(e){ /* empty */ }
return safe;
};
/***/ },
/* 77 */
/***/ function(module, exports, __webpack_require__) {
// 22.1.3.31 Array.prototype[@@unscopables]
var $ = __webpack_require__(57)
, UNSCOPABLES = __webpack_require__(68)('unscopables');
if($.FW && !(UNSCOPABLES in []))$.hide(Array.prototype, UNSCOPABLES, {});
module.exports = function(key){
if($.FW)[][UNSCOPABLES][key] = true;
};
/***/ },
/* 78 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, SPECIES = __webpack_require__(68)('species');
module.exports = function(C){
if($.DESC && !(SPECIES in C))$.setDesc(C, SPECIES, {
configurable: true,
get: $.that
});
};
/***/ },
/* 79 */
/***/ function(module, exports, __webpack_require__) {
var ctx = __webpack_require__(74)
, get = __webpack_require__(72).get
, call = __webpack_require__(75);
module.exports = function(iterable, entries, fn, that){
var iterator = get(iterable)
, f = ctx(fn, that, entries ? 2 : 1)
, step;
while(!(step = iterator.next()).done){
if(call(iterator, f, step.value, entries) === false){
return call.close(iterator);
}
}
};
/***/ },
/* 80 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74)
, cof = __webpack_require__(58)
, invoke = __webpack_require__(60)
, global = $.g
, isFunction = $.isFunction
, html = $.html
, document = global.document
, process = global.process
, setTask = global.setImmediate
, clearTask = global.clearImmediate
, postMessage = global.postMessage
, addEventListener = global.addEventListener
, MessageChannel = global.MessageChannel
, counter = 0
, queue = {}
, ONREADYSTATECHANGE = 'onreadystatechange'
, defer, channel, port;
function run(){
var id = +this;
if($.has(queue, id)){
var fn = queue[id];
delete queue[id];
fn();
}
}
function listner(event){
run.call(event.data);
}
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if(!isFunction(setTask) || !isFunction(clearTask)){
setTask = function(fn){
var args = [], i = 1;
while(arguments.length > i)args.push(arguments[i++]);
queue[++counter] = function(){
invoke(isFunction(fn) ? fn : Function(fn), args);
};
defer(counter);
return counter;
};
clearTask = function(id){
delete queue[id];
};
// Node.js 0.8-
if(cof(process) == 'process'){
defer = function(id){
process.nextTick(ctx(run, id, 1));
};
// Modern browsers, skip implementation for WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is object
} else if(addEventListener && isFunction(postMessage) && !global.importScripts){
defer = function(id){
postMessage(id, '*');
};
addEventListener('message', listner, false);
// WebWorkers
} else if(isFunction(MessageChannel)){
channel = new MessageChannel;
port = channel.port2;
channel.port1.onmessage = listner;
defer = ctx(port.postMessage, port, 1);
// IE8-
} else if(document && ONREADYSTATECHANGE in document.createElement('script')){
defer = function(id){
html.appendChild(document.createElement('script'))[ONREADYSTATECHANGE] = function(){
html.removeChild(this);
run.call(id);
};
};
// Rest old browsers
} else {
defer = function(id){
setTimeout(ctx(run, id, 1), 0);
};
}
}
module.exports = {
set: setTask,
clear: clearTask
};
/***/ },
/* 81 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, ctx = __webpack_require__(74)
, safe = __webpack_require__(62).safe
, assert = __webpack_require__(63)
, forOf = __webpack_require__(79)
, step = __webpack_require__(72).step
, has = $.has
, set = $.set
, isObject = $.isObject
, hide = $.hide
, isFrozen = Object.isFrozen || $.core.Object.isFrozen
, ID = safe('id')
, O1 = safe('O1')
, LAST = safe('last')
, FIRST = safe('first')
, ITER = safe('iter')
, SIZE = $.DESC ? safe('size') : 'size'
, id = 0;
function fastKey(it, create){
// return primitive with prefix
if(!isObject(it))return (typeof it == 'string' ? 'S' : 'P') + it;
// can't set id to frozen object
if(isFrozen(it))return 'F';
if(!has(it, ID)){
// not necessary to add id
if(!create)return 'E';
// add missing object id
hide(it, ID, ++id);
// return object id with prefix
} return 'O' + it[ID];
}
function getEntry(that, key){
// fast case
var index = fastKey(key), entry;
if(index != 'F')return that[O1][index];
// frozen object case
for(entry = that[FIRST]; entry; entry = entry.n){
if(entry.k == key)return entry;
}
}
module.exports = {
getConstructor: function(NAME, IS_MAP, ADDER){
function C(){
var that = assert.inst(this, C, NAME)
, iterable = arguments[0];
set(that, O1, $.create(null));
set(that, SIZE, 0);
set(that, LAST, undefined);
set(that, FIRST, undefined);
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
}
$.mix(C.prototype, {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function clear(){
for(var that = this, data = that[O1], entry = that[FIRST]; entry; entry = entry.n){
entry.r = true;
if(entry.p)entry.p = entry.p.n = undefined;
delete data[entry.i];
}
that[FIRST] = that[LAST] = undefined;
that[SIZE] = 0;
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function(key){
var that = this
, entry = getEntry(that, key);
if(entry){
var next = entry.n
, prev = entry.p;
delete that[O1][entry.i];
entry.r = true;
if(prev)prev.n = next;
if(next)next.p = prev;
if(that[FIRST] == entry)that[FIRST] = next;
if(that[LAST] == entry)that[LAST] = prev;
that[SIZE]--;
} return !!entry;
},
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
forEach: function forEach(callbackfn /*, that = undefined */){
var f = ctx(callbackfn, arguments[1], 3)
, entry;
while(entry = entry ? entry.n : this[FIRST]){
f(entry.v, entry.k, this);
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
}
},
// 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has: function has(key){
return !!getEntry(this, key);
}
});
if($.DESC)$.setDesc(C.prototype, 'size', {
get: function(){
return assert.def(this[SIZE]);
}
});
return C;
},
def: function(that, key, value){
var entry = getEntry(that, key)
, prev, index;
// change existing entry
if(entry){
entry.v = value;
// create new entry
} else {
that[LAST] = entry = {
i: index = fastKey(key, true), // <- index
k: key, // <- key
v: value, // <- value
p: prev = that[LAST], // <- previous entry
n: undefined, // <- next entry
r: false // <- removed
};
if(!that[FIRST])that[FIRST] = entry;
if(prev)prev.n = entry;
that[SIZE]++;
// add to index
if(index != 'F')that[O1][index] = entry;
} return that;
},
getEntry: getEntry,
// add .keys, .values, .entries, [@@iterator]
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
setIter: function(C, NAME, IS_MAP){
__webpack_require__(73)(C, NAME, function(iterated, kind){
set(this, ITER, {o: iterated, k: kind});
}, function(){
var iter = this[ITER]
, kind = iter.k
, entry = iter.l;
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
// get next entry
if(!iter.o || !(iter.l = entry = entry ? entry.n : iter.o[FIRST])){
// or finish the iteration
iter.o = undefined;
return step(1);
}
// return step by kind
if(kind == 'keys' )return step(0, entry.k);
if(kind == 'values')return step(0, entry.v);
return step(0, [entry.k, entry.v]);
}, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);
}
};
/***/ },
/* 82 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, $def = __webpack_require__(59)
, BUGGY = __webpack_require__(72).BUGGY
, forOf = __webpack_require__(79)
, species = __webpack_require__(78)
, assertInstance = __webpack_require__(63).inst;
module.exports = function(NAME, methods, common, IS_MAP, IS_WEAK){
var Base = $.g[NAME]
, C = Base
, ADDER = IS_MAP ? 'set' : 'add'
, proto = C && C.prototype
, O = {};
function fixMethod(KEY, CHAIN){
var method = proto[KEY];
if($.FW)proto[KEY] = function(a, b){
var result = method.call(this, a === 0 ? 0 : a, b);
return CHAIN ? this : result;
};
}
if(!$.isFunction(C) || !(IS_WEAK || !BUGGY && proto.forEach && proto.entries)){
// create collection constructor
C = common.getConstructor(NAME, IS_MAP, ADDER);
$.mix(C.prototype, methods);
} else {
var inst = new C
, chain = inst[ADDER](IS_WEAK ? {} : -0, 1)
, buggyZero;
// wrap for init collections from iterable
if(!__webpack_require__(76)(function(iter){ new C(iter); })){ // eslint-disable-line no-new
C = function(){
assertInstance(this, C, NAME);
var that = new Base
, iterable = arguments[0];
if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
return that;
};
C.prototype = proto;
if($.FW)proto.constructor = C;
}
IS_WEAK || inst.forEach(function(val, key){
buggyZero = 1 / key === -Infinity;
});
// fix converting -0 key to +0
if(buggyZero){
fixMethod('delete');
fixMethod('has');
IS_MAP && fixMethod('get');
}
// + fix .add & .set for chaining
if(buggyZero || chain !== inst)fixMethod(ADDER, true);
}
__webpack_require__(58).set(C, NAME);
O[NAME] = C;
$def($def.G + $def.W + $def.F * (C != Base), O);
species(C);
species($.core[NAME]); // for wrapper
if(!IS_WEAK)common.setIter(C, NAME, IS_MAP);
return C;
};
/***/ },
/* 83 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, safe = __webpack_require__(62).safe
, assert = __webpack_require__(63)
, forOf = __webpack_require__(79)
, _has = $.has
, isObject = $.isObject
, hide = $.hide
, isFrozen = Object.isFrozen || $.core.Object.isFrozen
, id = 0
, ID = safe('id')
, WEAK = safe('weak')
, LEAK = safe('leak')
, method = __webpack_require__(61)
, find = method(5)
, findIndex = method(6);
function findFrozen(store, key){
return find.call(store.array, function(it){
return it[0] === key;
});
}
// fallback for frozen keys
function leakStore(that){
return that[LEAK] || hide(that, LEAK, {
array: [],
get: function(key){
var entry = findFrozen(this, key);
if(entry)return entry[1];
},
has: function(key){
return !!findFrozen(this, key);
},
set: function(key, value){
var entry = findFrozen(this, key);
if(entry)entry[1] = value;
else this.array.push([key, value]);
},
'delete': function(key){
var index = findIndex.call(this.array, function(it){
return it[0] === key;
});
if(~index)this.array.splice(index, 1);
return !!~index;
}
})[LEAK];
}
module.exports = {
getConstructor: function(NAME, IS_MAP, ADDER){
function C(){
$.set(assert.inst(this, C, NAME), ID, id++);
var iterable = arguments[0];
if(iterable != undefined)forOf(iterable, IS_MAP, this[ADDER], this);
}
$.mix(C.prototype, {
// 23.3.3.2 WeakMap.prototype.delete(key)
// 23.4.3.3 WeakSet.prototype.delete(value)
'delete': function(key){
if(!isObject(key))return false;
if(isFrozen(key))return leakStore(this)['delete'](key);
return _has(key, WEAK) && _has(key[WEAK], this[ID]) && delete key[WEAK][this[ID]];
},
// 23.3.3.4 WeakMap.prototype.has(key)
// 23.4.3.4 WeakSet.prototype.has(value)
has: function has(key){
if(!isObject(key))return false;
if(isFrozen(key))return leakStore(this).has(key);
return _has(key, WEAK) && _has(key[WEAK], this[ID]);
}
});
return C;
},
def: function(that, key, value){
if(isFrozen(assert.obj(key))){
leakStore(that).set(key, value);
} else {
_has(key, WEAK) || hide(key, WEAK, {});
key[WEAK][that[ID]] = value;
} return that;
},
leakStore: leakStore,
WEAK: WEAK,
ID: ID
};
/***/ },
/* 84 */
/***/ function(module, exports, __webpack_require__) {
var $ = __webpack_require__(57)
, assertObject = __webpack_require__(63).obj;
module.exports = function ownKeys(it){
assertObject(it);
var keys = $.getNames(it)
, getSymbols = $.getSymbols;
return getSymbols ? keys.concat(getSymbols(it)) : keys;
};
/***/ },
/* 85 */
/***/ function(module, exports, __webpack_require__) {
// https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $def = __webpack_require__(59)
, forOf = __webpack_require__(79);
module.exports = function(NAME){
$def($def.P, NAME, {
toJSON: function toJSON(){
var arr = [];
forOf(this, false, arr.push, arr);
return arr;
}
});
};
/***/ },
/* 86 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(57)
, invoke = __webpack_require__(60)
, assertFunction = __webpack_require__(63).fn;
module.exports = function(/* ...pargs */){
var fn = assertFunction(this)
, length = arguments.length
, pargs = Array(length)
, i = 0
, _ = $.path._
, holder = false;
while(length > i)if((pargs[i] = arguments[i++]) === _)holder = true;
return function(/* ...args */){
var that = this
, _length = arguments.length
, j = 0, k = 0, args;
if(!holder && !_length)return invoke(fn, pargs, that);
args = pargs.slice();
if(holder)for(;length > j; j++)if(args[j] === _)args[j] = arguments[k++];
while(_length > k)args.push(arguments[k++]);
return invoke(fn, args, that);
};
};
/***/ },
/* 87 */
/***/ function(module, exports, __webpack_require__) {
module.exports = function($){
$.FW = false;
$.path = $.core;
return $;
};
/***/ }
/******/ ]);
// CommonJS export
if(typeof module != 'undefined' && module.exports)module.exports = __e;
// RequireJS export
else if(typeof define == 'function' && define.amd)define(function(){return __e});
// Export to global object
else __g.core = __e;
}(); |
addons/knobs/src/components/Panel.js | enjoylife/storybook | import React from 'react';
import PropTypes from 'prop-types';
import debounce from 'lodash.debounce';
import PropForm from './PropForm';
import Types from './types';
const getTimestamp = () => +new Date();
const styles = {
panelWrapper: {
width: '100%',
},
panel: {
padding: '5px',
width: 'auto',
position: 'relative',
},
noKnobs: {
fontFamily: `
-apple-system, ".SFNSText-Regular", "San Francisco", "Roboto",
"Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif
`,
display: 'inline',
width: '100%',
textAlign: 'center',
color: 'rgb(190, 190, 190)',
padding: '10px',
},
resetButton: {
position: 'absolute',
bottom: 11,
right: 10,
border: 'none',
borderTop: 'solid 1px rgba(0, 0, 0, 0.2)',
borderLeft: 'solid 1px rgba(0, 0, 0, 0.2)',
background: 'rgba(255, 255, 255, 0.5)',
padding: '5px 10px',
borderRadius: '4px 0 0 0',
color: 'rgba(0, 0, 0, 0.5)',
outline: 'none',
},
};
export default class Panel extends React.Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
this.setKnobs = this.setKnobs.bind(this);
this.reset = this.reset.bind(this);
this.setOptions = this.setOptions.bind(this);
this.state = { knobs: {} };
this.options = {};
this.lastEdit = getTimestamp();
this.loadedFromUrl = false;
this.props.channel.on('addon:knobs:setKnobs', this.setKnobs);
this.props.channel.on('addon:knobs:setOptions', this.setOptions);
}
componentWillUnmount() {
this.props.channel.removeListener('addon:knobs:setKnobs', this.setKnobs);
}
setOptions(options = { debounce: false, timestamps: false }) {
this.options = options;
if (options.debounce) {
this.emitChange = debounce(this.emitChange, options.debounce.wait, {
leading: options.debounce.leading,
});
}
}
setKnobs({ knobs, timestamp }) {
const queryParams = {};
const { api, channel } = this.props;
if (!this.options.timestamps || !timestamp || this.lastEdit <= timestamp) {
Object.keys(knobs).forEach(name => {
const knob = knobs[name];
// For the first time, get values from the URL and set them.
if (!this.loadedFromUrl) {
const urlValue = api.getQueryParam(`knob-${name}`);
if (urlValue !== undefined) {
// If the knob value present in url
knob.value = Types[knob.type].deserialize(urlValue);
channel.emit('addon:knobs:knobChange', knob);
}
}
queryParams[`knob-${name}`] = Types[knob.type].serialize(knob.value);
});
}
this.loadedFromUrl = true;
api.setQueryParams(queryParams);
this.setState({ knobs });
}
reset() {
this.props.channel.emit('addon:knobs:reset');
}
emitChange(changedKnob) {
this.props.channel.emit('addon:knobs:knobChange', changedKnob);
}
handleChange(changedKnob) {
this.lastEdit = getTimestamp();
const { api } = this.props;
const { knobs } = this.state;
const { name, type, value } = changedKnob;
const newKnobs = { ...knobs };
newKnobs[name] = {
...newKnobs[name],
...changedKnob,
};
this.setState({ knobs: newKnobs });
const queryParams = {};
queryParams[`knob-${name}`] = Types[type].serialize(value);
api.setQueryParams(queryParams);
this.setState({ knobs: newKnobs }, this.emitChange(changedKnob));
}
render() {
const { knobs } = this.state;
const knobsArray = Object.keys(knobs).filter(key => knobs[key].used).map(key => knobs[key]);
if (knobsArray.length === 0) {
return <div style={styles.noKnobs}>NO KNOBS</div>;
}
return (
<div style={styles.panelWrapper}>
<div style={styles.panel}>
<PropForm knobs={knobsArray} onFieldChange={this.handleChange} />
</div>
<button style={styles.resetButton} onClick={this.reset}>RESET</button>
</div>
);
}
}
Panel.propTypes = {
channel: PropTypes.shape({
emit: PropTypes.func,
on: PropTypes.func,
removeListener: PropTypes.func,
}).isRequired,
onReset: PropTypes.object, // eslint-disable-line
api: PropTypes.shape({
getQueryParam: PropTypes.func,
setQueryParams: PropTypes.func,
}).isRequired,
};
|
j2s/J/adapter/smarter/Resolver.js | tedgoddard/AtomicStereo | Clazz.declarePackage ("J.adapter.smarter");
Clazz.load (null, "J.adapter.smarter.Resolver", ["java.lang.Float", "java.util.StringTokenizer", "javajs.api.GenericBinaryDocument", "JU.LimitedLineReader", "$.PT", "J.adapter.smarter.AtomSetCollectionReader", "$.SmarterJmolAdapter", "J.api.Interface", "JU.Logger", "JV.FileManager", "$.JC"], function () {
c$ = Clazz.declareType (J.adapter.smarter, "Resolver");
c$.getReaderClassBase = Clazz.defineMethod (c$, "getReaderClassBase",
function (type) {
var name = type + "Reader";
if (type.startsWith ("Xml")) return "J.adapter.readers." + "xml." + name;
var key = ";" + type + ";";
for (var i = 1; i < J.adapter.smarter.Resolver.readerSets.length; i += 2) if (J.adapter.smarter.Resolver.readerSets[i].indexOf (key) >= 0) return "J.adapter.readers." + J.adapter.smarter.Resolver.readerSets[i - 1] + name;
return "J.adapter.readers." + "???." + name;
}, "~S");
c$.getFileType = Clazz.defineMethod (c$, "getFileType",
function (br) {
try {
return J.adapter.smarter.Resolver.determineAtomSetCollectionReader (br, false);
} catch (e) {
if (Clazz.exceptionOf (e, Exception)) {
return null;
} else {
throw e;
}
}
}, "java.io.BufferedReader");
c$.getAtomCollectionReader = Clazz.defineMethod (c$, "getAtomCollectionReader",
function (fullName, type, bufferedReader, htParams, ptFile) {
var readerName;
fullName = JV.FileManager.fixDOSName (fullName);
var errMsg = null;
if (type != null) {
readerName = J.adapter.smarter.Resolver.getReaderFromType (type);
if (readerName == null) readerName = J.adapter.smarter.Resolver.getReaderFromType ("Xml" + type);
if (readerName == null) errMsg = "unrecognized file format type " + type;
else JU.Logger.info ("The Resolver assumes " + readerName);
} else {
readerName = J.adapter.smarter.Resolver.determineAtomSetCollectionReader (bufferedReader, true);
if (readerName.charAt (0) == '\n') {
type = htParams.get ("defaultType");
if (type != null) {
type = J.adapter.smarter.Resolver.getReaderFromType (type);
if (type != null) readerName = type;
}}if (readerName.charAt (0) == '\n') errMsg = "unrecognized file format for file\n" + fullName + "\n" + J.adapter.smarter.Resolver.split (readerName, 50);
else if (readerName.equals ("spt")) errMsg = "NOTE: file recognized as a script file: " + fullName + "\n";
else if (!fullName.equals ("ligand")) JU.Logger.info ("The Resolver thinks " + readerName);
}if (errMsg != null) {
J.adapter.smarter.SmarterJmolAdapter.close (bufferedReader);
return errMsg;
}htParams.put ("ptFile", Integer.$valueOf (ptFile));
if (ptFile <= 0) htParams.put ("readerName", readerName);
if (readerName.indexOf ("Xml") == 0) readerName = "Xml";
return J.adapter.smarter.Resolver.getReader (readerName, htParams);
}, "~S,~S,~O,java.util.Map,~N");
c$.getReader = Clazz.defineMethod (c$, "getReader",
function (readerName, htParams) {
var rdr = null;
var className = null;
var err = null;
className = J.adapter.smarter.Resolver.getReaderClassBase (readerName);
if ((rdr = J.api.Interface.getInterface (className, htParams.get ("vwr"), "reader")) == null) {
err = JV.JC.READER_NOT_FOUND + className;
JU.Logger.error (err);
return err;
}return rdr;
}, "~S,java.util.Map");
c$.getReaderFromType = Clazz.defineMethod (c$, "getReaderFromType",
function (type) {
type = ";" + type.toLowerCase () + ";";
if (";zmatrix;cfi;c;vfi;v;mnd;jag;adf;gms;g;gau;mp;nw;orc;pqs;qc;".indexOf (type) >= 0) return "Input";
var set;
var pt;
for (var i = J.adapter.smarter.Resolver.readerSets.length; --i >= 0; ) if ((pt = (set = J.adapter.smarter.Resolver.readerSets[i--]).toLowerCase ().indexOf (type)) >= 0) return set.substring (pt + 1, set.indexOf (";", pt + 2));
return null;
}, "~S");
c$.split = Clazz.defineMethod (c$, "split",
function (a, n) {
var s = "";
var l = a.length;
for (var i = 0, j = 0; i < l; i = j) s += a.substring (i, (j = Math.min (i + n, l))) + "\n";
return s;
}, "~S,~N");
c$.DOMResolve = Clazz.defineMethod (c$, "DOMResolve",
function (htParams) {
var rdrName = J.adapter.smarter.Resolver.getXmlType (htParams.get ("nameSpaceInfo"));
if (JU.Logger.debugging) {
JU.Logger.debug ("The Resolver thinks " + rdrName);
}htParams.put ("readerName", rdrName);
return J.adapter.smarter.Resolver.getReader ("XmlReader", htParams);
}, "java.util.Map");
c$.determineAtomSetCollectionReader = Clazz.defineMethod (c$, "determineAtomSetCollectionReader",
function (readerOrDocument, returnLines) {
if (Clazz.instanceOf (readerOrDocument, javajs.api.GenericBinaryDocument)) {
return "PyMOL";
}var readerName;
var llr = new JU.LimitedLineReader (readerOrDocument, 16384);
var leader = llr.getHeader (64).trim ();
if (leader.indexOf ("PNG") == 1 && leader.indexOf ("PNGJ") >= 0) return "pngj";
if (leader.indexOf ("PNG") == 1 || leader.indexOf ("JPG") == 1 || leader.indexOf ("JFIF") == 6) return "spt";
if ((readerName = J.adapter.smarter.Resolver.checkFileStart (leader)) != null) return readerName;
var lines = new Array (16);
var nLines = 0;
for (var i = 0; i < lines.length; ++i) {
lines[i] = llr.readLineWithNewline ();
if (lines[i].length > 0) nLines++;
}
if ((readerName = J.adapter.smarter.Resolver.checkSpecial1 (nLines, lines, leader)) != null) return readerName;
if ((readerName = J.adapter.smarter.Resolver.checkLineStarts (lines)) != null) return readerName;
if ((readerName = J.adapter.smarter.Resolver.checkHeaderContains (llr.getHeader (0))) != null) return readerName;
if ((readerName = J.adapter.smarter.Resolver.checkSpecial2 (lines)) != null) return readerName;
return (returnLines ? "\n" + lines[0] + "\n" + lines[1] + "\n" + lines[2] + "\n" : null);
}, "~O,~B");
c$.checkFileStart = Clazz.defineMethod (c$, "checkFileStart",
function (leader) {
for (var i = 0; i < J.adapter.smarter.Resolver.fileStartsWithRecords.length; ++i) {
var recordTags = J.adapter.smarter.Resolver.fileStartsWithRecords[i];
for (var j = 1; j < recordTags.length; ++j) {
var recordTag = recordTags[j];
if (leader.startsWith (recordTag)) return recordTags[0];
}
}
return null;
}, "~S");
c$.checkSpecial1 = Clazz.defineMethod (c$, "checkSpecial1",
function (nLines, lines, leader) {
if (nLines == 1 && lines[0].length > 0 && JU.PT.isDigit (lines[0].charAt (0))) return "Jme";
if (J.adapter.smarter.Resolver.checkMopacGraphf (lines)) return "MopacGraphf";
if (J.adapter.smarter.Resolver.checkOdyssey (lines)) return "Odyssey";
switch (J.adapter.smarter.Resolver.checkMol (lines)) {
case 1:
case 3:
case 2000:
case 3000:
return "Mol";
}
switch (J.adapter.smarter.Resolver.checkXyz (lines)) {
case 1:
return "Xyz";
case 2:
return "Bilbao";
}
if (J.adapter.smarter.Resolver.checkAlchemy (lines[0])) return "Alchemy";
if (J.adapter.smarter.Resolver.checkFoldingXyz (lines)) return "FoldingXyz";
if (J.adapter.smarter.Resolver.checkCube (lines)) return "Cube";
if (J.adapter.smarter.Resolver.checkWien2k (lines)) return "Wien2k";
if (J.adapter.smarter.Resolver.checkAims (lines)) return "Aims";
if (J.adapter.smarter.Resolver.checkGenNBO (lines, leader)) return "GenNBO";
return null;
}, "~N,~A,~S");
c$.checkAims = Clazz.defineMethod (c$, "checkAims",
function (lines) {
for (var i = 0; i < lines.length; i++) {
if (lines[i].startsWith ("mol 1")) return false;
var tokens = JU.PT.getTokens (lines[i]);
if (tokens.length == 0) continue;
if (tokens[0].startsWith ("atom") && tokens.length > 4 && Float.isNaN (JU.PT.parseFloat (tokens[4])) || tokens[0].startsWith ("multipole") && tokens.length >= 6 || tokens[0].startsWith ("lattice_vector") && tokens.length >= 4) return true;
}
return false;
}, "~A");
c$.checkAlchemy = Clazz.defineMethod (c$, "checkAlchemy",
function (line) {
var pt;
if ((pt = line.indexOf ("ATOMS")) >= 0 && line.indexOf ("BONDS") > pt) try {
var n = Integer.parseInt (line.substring (0, pt).trim ());
return (n > 0);
} catch (nfe) {
if (Clazz.exceptionOf (nfe, NumberFormatException)) {
} else {
throw nfe;
}
}
return false;
}, "~S");
c$.checkCube = Clazz.defineMethod (c$, "checkCube",
function (lines) {
try {
for (var j = 2; j <= 5; j++) {
var tokens2 = new java.util.StringTokenizer (lines[j]);
var n = tokens2.countTokens ();
if (!(n == 4 || j == 2 && n == 5)) return false;
Integer.parseInt (tokens2.nextToken ());
for (var i = 3; --i >= 0; ) JU.PT.fVal (tokens2.nextToken ());
if (n == 5) Integer.parseInt (tokens2.nextToken ());
}
return true;
} catch (nfe) {
if (Clazz.exceptionOf (nfe, NumberFormatException)) {
} else {
throw nfe;
}
}
return false;
}, "~A");
c$.checkFoldingXyz = Clazz.defineMethod (c$, "checkFoldingXyz",
function (lines) {
var tokens = new java.util.StringTokenizer (lines[0].trim (), " \t");
if (tokens.countTokens () < 2) return false;
try {
Integer.parseInt (tokens.nextToken ().trim ());
} catch (nfe) {
if (Clazz.exceptionOf (nfe, NumberFormatException)) {
return false;
} else {
throw nfe;
}
}
var secondLine = lines[1].trim ();
if (secondLine.length == 0) secondLine = lines[2].trim ();
tokens = new java.util.StringTokenizer (secondLine, " \t");
if (tokens.countTokens () == 0) return false;
try {
Integer.parseInt (tokens.nextToken ().trim ());
} catch (nfe) {
if (Clazz.exceptionOf (nfe, NumberFormatException)) {
return false;
} else {
throw nfe;
}
}
return true;
}, "~A");
c$.checkGenNBO = Clazz.defineMethod (c$, "checkGenNBO",
function (lines, leader) {
return (leader.indexOf ("$GENNBO") >= 0 || lines[1].startsWith (" Basis set information needed for plotting orbitals") || lines[1].indexOf ("s in the AO basis:") >= 0 || lines[2].indexOf (" N A T U R A L A T O M I C O R B I T A L") >= 0);
}, "~A,~S");
c$.checkMol = Clazz.defineMethod (c$, "checkMol",
function (lines) {
var line4trimmed = ("X" + lines[3]).trim ().toUpperCase ();
if (line4trimmed.length < 7 || line4trimmed.indexOf (".") >= 0) return 0;
if (line4trimmed.endsWith ("V2000")) return 2000;
if (line4trimmed.endsWith ("V3000")) return 3000;
try {
var n1 = Integer.parseInt (lines[3].substring (0, 3).trim ());
var n2 = Integer.parseInt (lines[3].substring (3, 6).trim ());
return (n1 > 0 && n2 >= 0 && lines[0].indexOf ("@<TRIPOS>") != 0 && lines[1].indexOf ("@<TRIPOS>") != 0 && lines[2].indexOf ("@<TRIPOS>") != 0 ? 3 : 0);
} catch (nfe) {
if (Clazz.exceptionOf (nfe, NumberFormatException)) {
} else {
throw nfe;
}
}
return 0;
}, "~A");
c$.checkMopacGraphf = Clazz.defineMethod (c$, "checkMopacGraphf",
function (lines) {
return (lines[0].indexOf ("MOPAC-Graphical data") > 2);
}, "~A");
c$.checkOdyssey = Clazz.defineMethod (c$, "checkOdyssey",
function (lines) {
var i;
for (i = 0; i < lines.length; i++) if (!lines[i].startsWith ("C ") && lines[i].length != 0) break;
if (i >= lines.length || lines[i].charAt (0) != ' ' || (i = i + 2) + 1 >= lines.length) return false;
try {
var spin = Integer.parseInt (lines[i].substring (2).trim ());
var charge = Integer.parseInt (lines[i].substring (0, 2).trim ());
var atom1 = Integer.parseInt (lines[++i].substring (0, 2).trim ());
if (spin < 0 || spin > 5 || atom1 <= 0 || charge > 5) return false;
var atomline = J.adapter.smarter.AtomSetCollectionReader.getTokensFloat (lines[i], null, 5);
return !Float.isNaN (atomline[1]) && !Float.isNaN (atomline[2]) && !Float.isNaN (atomline[3]) && Float.isNaN (atomline[4]);
} catch (e) {
if (Clazz.exceptionOf (e, Exception)) {
} else {
throw e;
}
}
return false;
}, "~A");
c$.checkWien2k = Clazz.defineMethod (c$, "checkWien2k",
function (lines) {
return (lines[2].startsWith ("MODE OF CALC=") || lines[2].startsWith (" RELA") || lines[2].startsWith (" NREL"));
}, "~A");
c$.checkXyz = Clazz.defineMethod (c$, "checkXyz",
function (lines) {
try {
Integer.parseInt (lines[0].trim ());
try {
Integer.parseInt (lines[2].trim ());
} catch (nfe) {
if (Clazz.exceptionOf (nfe, NumberFormatException)) {
return 1;
} else {
throw nfe;
}
}
return 2;
} catch (nfe) {
if (Clazz.exceptionOf (nfe, NumberFormatException)) {
if (lines[0].indexOf ("Bilbao Crys") >= 0) return 2;
} else {
throw nfe;
}
}
return 0;
}, "~A");
c$.checkLineStarts = Clazz.defineMethod (c$, "checkLineStarts",
function (lines) {
for (var i = 0; i < J.adapter.smarter.Resolver.lineStartsWithRecords.length; ++i) {
var recordTags = J.adapter.smarter.Resolver.lineStartsWithRecords[i];
for (var j = 1; j < recordTags.length; ++j) {
var recordTag = recordTags[j];
for (var k = 0; k < lines.length; k++) {
if (lines[k].startsWith (recordTag)) return recordTags[0];
}
}
}
return null;
}, "~A");
c$.checkHeaderContains = Clazz.defineMethod (c$, "checkHeaderContains",
function (header) {
for (var i = 0; i < J.adapter.smarter.Resolver.headerContainsRecords.length; ++i) {
var recordTags = J.adapter.smarter.Resolver.headerContainsRecords[i];
for (var j = 1; j < recordTags.length; ++j) {
var recordTag = recordTags[j];
if (header.indexOf (recordTag) < 0) continue;
var type = recordTags[0];
if (!type.equals ("Xml")) return type;
if (header.indexOf ("/AFLOWDATA/") >= 0 || header.indexOf ("-- Structure PRE --") >= 0) return "AFLOW";
return (header.indexOf ("<!DOCTYPE HTML PUBLIC") < 0 && header.indexOf ("XHTML") < 0 && (header.indexOf ("xhtml") < 0 || header.indexOf ("<cml") >= 0) ? J.adapter.smarter.Resolver.getXmlType (header) : null);
}
}
return null;
}, "~S");
c$.getXmlType = Clazz.defineMethod (c$, "getXmlType",
function (header) {
if (header.indexOf ("http://www.molpro.net/") >= 0) {
return "XmlMolpro";
}if (header.indexOf ("odyssey") >= 0) {
return "XmlOdyssey";
}if (header.indexOf ("C3XML") >= 0) {
return "XmlChem3d";
}if (header.indexOf ("arguslab") >= 0) {
return "XmlArgus";
}if (header.indexOf ("jvxl") >= 0 || header.indexOf ("http://www.xml-cml.org/schema") >= 0 || header.indexOf ("cml:") >= 0) {
return "XmlCml";
}if (header.indexOf ("XSD") >= 0) {
return "XmlXsd";
}if (header.indexOf (">vasp") >= 0) {
return "XmlVasp";
}if (header.indexOf ("<GEOMETRY_INFO>") >= 0) {
return "XmlQE";
}return "XmlCml(unidentified)";
}, "~S");
c$.checkSpecial2 = Clazz.defineMethod (c$, "checkSpecial2",
function (lines) {
if (J.adapter.smarter.Resolver.checkGromacs (lines)) return "Gromacs";
if (J.adapter.smarter.Resolver.checkCrystal (lines)) return "Crystal";
var s = J.adapter.smarter.Resolver.checkCastepVasp (lines);
if (s != null) return s;
return null;
}, "~A");
c$.checkCrystal = Clazz.defineMethod (c$, "checkCrystal",
function (lines) {
var s = lines[1].trim ();
if (s.equals ("SLAB") || s.equals ("MOLECULE") || s.equals ("CRYSTAL") || s.equals ("POLYMER") || (s = lines[3]).equals ("SLAB") || s.equals ("MOLECULE") || s.equals ("POLYMER")) return true;
for (var i = 0; i < lines.length; i++) {
if (lines[i].trim ().equals ("OPTGEOM") || lines[i].trim ().equals ("FREQCALC") || lines[i].contains ("DOVESI") || lines[i].contains ("TORINO") || lines[i].contains ("http://www.crystal.unito.it") || lines[i].contains ("Pcrystal") || lines[i].contains ("MPPcrystal") || lines[i].contains ("crystal executable")) return true;
}
return false;
}, "~A");
c$.checkGromacs = Clazz.defineMethod (c$, "checkGromacs",
function (lines) {
if (JU.PT.parseInt (lines[1]) == -2147483648) return false;
var len = -1;
for (var i = 2; i < 16 && len != 0; i++) if ((len = lines[i].length) != 69 && len != 45 && len != 0) return false;
return true;
}, "~A");
c$.checkCastepVasp = Clazz.defineMethod (c$, "checkCastepVasp",
function (lines) {
for (var i = 0; i < lines.length; i++) {
var line = lines[i].toUpperCase ();
if (line.indexOf ("FREQUENCIES IN CM-1") == 1 || line.contains ("CASTEP") || line.startsWith ("%BLOCK LATTICE_ABC") || line.startsWith ("%BLOCK LATTICE_CART") || line.startsWith ("%BLOCK POSITIONS_FRAC") || line.startsWith ("%BLOCK POSITIONS_ABS") || line.contains ("<-- E")) return "Castep";
if (i >= 6 && i < 10 && (line.startsWith ("DIRECT") || line.startsWith ("CARTESIAN"))) return "VaspPoscar";
}
return null;
}, "~A");
Clazz.defineStatics (c$,
"classBase", "J.adapter.readers.");
c$.readerSets = c$.prototype.readerSets = Clazz.newArray (-1, ["aflow.", ";AFLOW;", "cif.", ";Cif;MMCif;", "molxyz.", ";Mol3D;Mol;Xyz;", "more.", ";BinaryDcd;Gromacs;Jcampdx;MdCrd;MdTop;Mol2;TlsDataOnly;", "quantum.", ";Adf;Csf;Dgrid;GamessUK;GamessUS;Gaussian;GaussianFchk;GaussianWfn;Jaguar;Molden;MopacGraphf;GenNBO;NWChem;Odyssey;Psi;Qchem;Spartan;SpartanSmol;WebMO;MO;", "pdb.", ";Pdb;Pqr;P2n;JmolData;", "pymol.", ";PyMOL;", "simple.", ";Alchemy;Ampac;Cube;FoldingXyz;GhemicalMM;HyperChem;Jme;JSON;Mopac;MopacArchive;Tinker;Input;", "xtal.", ";Abinit;Aims;Bilbao;Castep;Cgd;Crystal;Dmol;Espresso;Gulp;Jana;Magres;Shelx;Siesta;VaspOutcar;VaspPoscar;Wien2k;Xcrysden;", "xml.", ";XmlArgus;XmlCml;XmlChem3d;XmlMolpro;XmlOdyssey;XmlXsd;XmlVasp;XmlQE;"]);
Clazz.defineStatics (c$,
"CML_NAMESPACE_URI", "http://www.xml-cml.org/schema",
"LEADER_CHAR_MAX", 64,
"sptRecords", Clazz.newArray (-1, ["spt", "# Jmol state", "# Jmol script", "JmolManifest"]),
"m3dStartRecords", Clazz.newArray (-1, ["Alchemy", "STRUCTURE 1.00 1"]),
"cubeFileStartRecords", Clazz.newArray (-1, ["Cube", "JVXL", "#JVXL"]),
"mol2Records", Clazz.newArray (-1, ["Mol2", "mol2", "@<TRIPOS>"]),
"webmoFileStartRecords", Clazz.newArray (-1, ["WebMO", "[HEADER]"]),
"moldenFileStartRecords", Clazz.newArray (-1, ["Molden", "[Molden"]),
"dcdFileStartRecords", Clazz.newArray (-1, ["BinaryDcd", "T\0\0\0CORD", "\0\0\0TCORD"]),
"tlsDataOnlyFileStartRecords", Clazz.newArray (-1, ["TlsDataOnly", "REFMAC\n\nTL", "REFMAC\r\n\r\n", "REFMAC\r\rTL"]),
"inputFileStartRecords", Clazz.newArray (-1, ["Input", "#ZMATRIX", "%mem=", "AM1"]),
"magresFileStartRecords", Clazz.newArray (-1, ["Magres", "#$magres", "# magres"]),
"pymolStartRecords", Clazz.newArray (-1, ["PyMOL", "}q"]),
"janaStartRecords", Clazz.newArray (-1, ["Jana", "Version Jana"]),
"jsonStartRecords", Clazz.newArray (-1, ["JSON", "{\"mol\":"]),
"jcampdxStartRecords", Clazz.newArray (-1, ["Jcampdx", "##TITLE"]),
"jmoldataStartRecords", Clazz.newArray (-1, ["JmolData", "REMARK 6 Jmol"]),
"pqrStartRecords", Clazz.newArray (-1, ["Pqr", "REMARK 1 PQR", "REMARK The B-factors"]),
"p2nStartRecords", Clazz.newArray (-1, ["P2n", "REMARK 1 P2N"]));
c$.fileStartsWithRecords = c$.prototype.fileStartsWithRecords = Clazz.newArray (-1, [J.adapter.smarter.Resolver.sptRecords, J.adapter.smarter.Resolver.m3dStartRecords, J.adapter.smarter.Resolver.cubeFileStartRecords, J.adapter.smarter.Resolver.mol2Records, J.adapter.smarter.Resolver.webmoFileStartRecords, J.adapter.smarter.Resolver.moldenFileStartRecords, J.adapter.smarter.Resolver.dcdFileStartRecords, J.adapter.smarter.Resolver.tlsDataOnlyFileStartRecords, J.adapter.smarter.Resolver.inputFileStartRecords, J.adapter.smarter.Resolver.magresFileStartRecords, J.adapter.smarter.Resolver.pymolStartRecords, J.adapter.smarter.Resolver.janaStartRecords, J.adapter.smarter.Resolver.jsonStartRecords, J.adapter.smarter.Resolver.jcampdxStartRecords, J.adapter.smarter.Resolver.jmoldataStartRecords, J.adapter.smarter.Resolver.pqrStartRecords, J.adapter.smarter.Resolver.p2nStartRecords]);
Clazz.defineStatics (c$,
"mmcifLineStartRecords", Clazz.newArray (-1, ["MMCif", "_entry.id", "_database_PDB_", "_pdbx_", "_chem_comp.pdbx_type", "_audit_author.name", "_atom_site."]),
"cifLineStartRecords", Clazz.newArray (-1, ["Cif", "data_", "_publ"]),
"pdbLineStartRecords", Clazz.newArray (-1, ["Pdb", "HEADER", "OBSLTE", "TITLE ", "CAVEAT", "COMPND", "SOURCE", "KEYWDS", "EXPDTA", "AUTHOR", "REVDAT", "SPRSDE", "JRNL ", "REMARK ", "DBREF ", "SEQADV", "SEQRES", "MODRES", "HELIX ", "SHEET ", "TURN ", "CRYST1", "ORIGX1", "ORIGX2", "ORIGX3", "SCALE1", "SCALE2", "SCALE3", "ATOM ", "HETATM", "MODEL ", "LINK ", "USER MOD "]),
"cgdLineStartRecords", Clazz.newArray (-1, ["Cgd", "EDGE ", "edge "]),
"shelxLineStartRecords", Clazz.newArray (-1, ["Shelx", "TITL ", "ZERR ", "LATT ", "SYMM ", "CELL "]),
"ghemicalMMLineStartRecords", Clazz.newArray (-1, ["GhemicalMM", "!Header mm1gp", "!Header gpr"]),
"jaguarLineStartRecords", Clazz.newArray (-1, ["Jaguar", " | Jaguar version"]),
"mdlLineStartRecords", Clazz.newArray (-1, ["Mol", "$MDL "]),
"spartanSmolLineStartRecords", Clazz.newArray (-1, ["SpartanSmol", "INPUT="]),
"csfLineStartRecords", Clazz.newArray (-1, ["Csf", "local_transform"]),
"mdTopLineStartRecords", Clazz.newArray (-1, ["MdTop", "%FLAG TITLE"]),
"hyperChemLineStartRecords", Clazz.newArray (-1, ["HyperChem", "mol 1"]),
"vaspOutcarLineStartRecords", Clazz.newArray (-1, ["VaspOutcar", " vasp.", " INCAR:"]));
c$.lineStartsWithRecords = c$.prototype.lineStartsWithRecords = Clazz.newArray (-1, [J.adapter.smarter.Resolver.mmcifLineStartRecords, J.adapter.smarter.Resolver.cifLineStartRecords, J.adapter.smarter.Resolver.pdbLineStartRecords, J.adapter.smarter.Resolver.cgdLineStartRecords, J.adapter.smarter.Resolver.shelxLineStartRecords, J.adapter.smarter.Resolver.ghemicalMMLineStartRecords, J.adapter.smarter.Resolver.jaguarLineStartRecords, J.adapter.smarter.Resolver.mdlLineStartRecords, J.adapter.smarter.Resolver.spartanSmolLineStartRecords, J.adapter.smarter.Resolver.csfLineStartRecords, J.adapter.smarter.Resolver.mol2Records, J.adapter.smarter.Resolver.mdTopLineStartRecords, J.adapter.smarter.Resolver.hyperChemLineStartRecords, J.adapter.smarter.Resolver.vaspOutcarLineStartRecords]);
Clazz.defineStatics (c$,
"bilbaoContainsRecords", Clazz.newArray (-1, ["Bilbao", ">Bilbao Crystallographic Server<"]),
"xmlContainsRecords", Clazz.newArray (-1, ["Xml", "<?xml", "<atom", "<molecule", "<reaction", "<cml", "<bond", ".dtd\"", "<list>", "<entry", "<identifier", "http://www.xml-cml.org/schema/cml2/core"]),
"gaussianContainsRecords", Clazz.newArray (-1, ["Gaussian", "Entering Gaussian System", "Entering Link 1", "1998 Gaussian, Inc."]),
"ampacContainsRecords", Clazz.newArray (-1, ["Ampac", "AMPAC Version"]),
"mopacContainsRecords", Clazz.newArray (-1, ["Mopac", "MOPAC 93 (c) Fujitsu", "MOPAC FOR LINUX (PUBLIC DOMAIN VERSION)", "MOPAC: VERSION 6", "MOPAC 7", "MOPAC2", "MOPAC (PUBLIC"]),
"qchemContainsRecords", Clazz.newArray (-1, ["Qchem", "Welcome to Q-Chem", "A Quantum Leap Into The Future Of Chemistry"]),
"gamessUKContainsRecords", Clazz.newArray (-1, ["GamessUK", "GAMESS-UK", "G A M E S S - U K"]),
"gamessUSContainsRecords", Clazz.newArray (-1, ["GamessUS", "GAMESS", "$CONTRL"]),
"spartanBinaryContainsRecords", Clazz.newArray (-1, ["SpartanSmol", "|PropertyArchive", "_spartan", "spardir", "BEGIN Directory Entry Molecule"]),
"spartanContainsRecords", Clazz.newArray (-1, ["Spartan", "Spartan"]),
"adfContainsRecords", Clazz.newArray (-1, ["Adf", "Amsterdam Density Functional"]),
"psiContainsRecords", Clazz.newArray (-1, ["Psi", " PSI 3", "PSI3:"]),
"nwchemContainsRecords", Clazz.newArray (-1, ["NWChem", " argument 1 = "]),
"uicrcifContainsRecords", Clazz.newArray (-1, ["Cif", "Crystallographic Information File"]),
"dgridContainsRecords", Clazz.newArray (-1, ["Dgrid", "BASISFILE created by DGrid"]),
"crystalContainsRecords", Clazz.newArray (-1, ["Crystal", "* CRYSTAL", "TORINO", "DOVESI"]),
"dmolContainsRecords", Clazz.newArray (-1, ["Dmol", "DMol^3"]),
"gulpContainsRecords", Clazz.newArray (-1, ["Gulp", "GENERAL UTILITY LATTICE PROGRAM"]),
"espressoContainsRecords", Clazz.newArray (-1, ["Espresso", "Program PWSCF", "Program PHONON"]),
"siestaContainsRecords", Clazz.newArray (-1, ["Siesta", "MD.TypeOfRun", "SolutionMethod", "MeshCutoff", "WELCOME TO SIESTA"]),
"xcrysDenContainsRecords", Clazz.newArray (-1, ["Xcrysden", "PRIMVEC", "CONVVEC", "PRIMCOORD", "ANIMSTEP"]),
"mopacArchiveContainsRecords", Clazz.newArray (-1, ["MopacArchive", "SUMMARY OF PM"]),
"abinitContainsRecords", Clazz.newArray (-1, ["Abinit", "http://www.abinit.org", "Catholique", "Louvain"]),
"gaussianFchkContainsRecords", Clazz.newArray (-1, ["GaussianFchk", "Number of point charges in /Mol/"]),
"inputContainsRecords", Clazz.newArray (-1, ["Input", " ATOMS cartesian", "$molecule", "&zmat", "geometry={", "$DATA", "%coords", "GEOM=PQS", "geometry units angstroms"]),
"aflowContainsRecords", Clazz.newArray (-1, ["AFLOW", "/AFLOWDATA/"]));
c$.headerContainsRecords = c$.prototype.headerContainsRecords = Clazz.newArray (-1, [J.adapter.smarter.Resolver.sptRecords, J.adapter.smarter.Resolver.bilbaoContainsRecords, J.adapter.smarter.Resolver.xmlContainsRecords, J.adapter.smarter.Resolver.gaussianContainsRecords, J.adapter.smarter.Resolver.ampacContainsRecords, J.adapter.smarter.Resolver.mopacContainsRecords, J.adapter.smarter.Resolver.qchemContainsRecords, J.adapter.smarter.Resolver.gamessUKContainsRecords, J.adapter.smarter.Resolver.gamessUSContainsRecords, J.adapter.smarter.Resolver.spartanBinaryContainsRecords, J.adapter.smarter.Resolver.spartanContainsRecords, J.adapter.smarter.Resolver.mol2Records, J.adapter.smarter.Resolver.adfContainsRecords, J.adapter.smarter.Resolver.psiContainsRecords, J.adapter.smarter.Resolver.nwchemContainsRecords, J.adapter.smarter.Resolver.uicrcifContainsRecords, J.adapter.smarter.Resolver.dgridContainsRecords, J.adapter.smarter.Resolver.crystalContainsRecords, J.adapter.smarter.Resolver.dmolContainsRecords, J.adapter.smarter.Resolver.gulpContainsRecords, J.adapter.smarter.Resolver.espressoContainsRecords, J.adapter.smarter.Resolver.siestaContainsRecords, J.adapter.smarter.Resolver.xcrysDenContainsRecords, J.adapter.smarter.Resolver.mopacArchiveContainsRecords, J.adapter.smarter.Resolver.abinitContainsRecords, J.adapter.smarter.Resolver.gaussianFchkContainsRecords, J.adapter.smarter.Resolver.inputContainsRecords, J.adapter.smarter.Resolver.aflowContainsRecords]);
});
|
src/ui/components/views/Home.js | scrollback/pure | /* @flow */
import React, { Component } from 'react';
import ReactNative from 'react-native';
import NavigationRootContainer from '../containers/NavigationRootContainer';
import NavigationScene from './Navigation/NavigationScene';
import NavigationView from './Navigation/NavigationView';
import UserSwitcherContainer from '../containers/UserSwitcherContainer';
import ModalHost from './Core/ModalHost';
import routeMapper from '../../routeMapper';
const {
StyleSheet,
View,
} = ReactNative;
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
flex: 1,
},
inner: {
flex: 1,
},
});
export default class Home extends Component<void, any, void> {
_handleBackPress = () => {
if (ModalHost.isOpen()) {
ModalHost.requestClose();
return true;
}
return false;
};
_renderScene = (props: any) => {
return (
<NavigationScene
{...props}
key={props.scene.key}
routeMapper={routeMapper}
/>
);
};
_renderNavigator = (props: any) => {
return (
<NavigationView
{...props}
renderScene={this._renderScene}
onBackPress={this._handleBackPress}
/>
);
};
render() {
return (
<View style={styles.container}>
<UserSwitcherContainer />
<View style={styles.inner}>
<NavigationRootContainer
renderNavigator={this._renderNavigator}
/>
</View>
<ModalHost />
</View>
);
}
}
|
app/app.js | andreasasprou/react-boilerplate-auth | /**
* app.js
*
* This is the entry file for the application, only setup and boilerplate
* code.
*/
// Needed for redux-saga es6 generator support
import 'babel-polyfill';
// Import all the third party stuff
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { applyRouterMiddleware, Router, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import { useScroll } from 'react-router-scroll';
import 'sanitize.css/sanitize.css';
// Import root app
import App from 'containers/App';
// Import Language Provider
import LanguageProvider from 'containers/LanguageProvider';
// Needed for onTouchTap
import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();
// Load the favicon, the manifest.json file and the .htaccess file
/* eslint-disable import/no-unresolved, import/extensions */
import '!file-loader?name=[name].[ext]!./favicon.ico';
import '!file-loader?name=[name].[ext]!./manifest.json';
import 'file-loader?name=[name].[ext]!./.htaccess';
/* eslint-enable import/no-unresolved, import/extensions */
import configureStore from './store';
// Import i18n messages
import { translationMessages } from './i18n';
// Import CSS reset and Global Styles
import './global-styles';
// Import root routes
import createRoutes from './routes';
// Create redux store with history
// this uses the singleton browserHistory provided by react-router
// Optionally, this could be changed to leverage a created history
// e.g. `const browserHistory = useRouterHistory(createBrowserHistory)();`
const initialState = {};
const store = configureStore(initialState, browserHistory);
const makeSelectLocationState = () => {
let prevRoutingState;
let prevRoutingStateJS;
return (state) => {
const routingState = state.get('route'); // or state.route
if (!routingState.equals(prevRoutingState)) {
prevRoutingState = routingState;
prevRoutingStateJS = routingState.toJS();
}
return prevRoutingStateJS;
};
};
// Sync history and store, as the react-router-redux reducer
// is under the non-default key ("routing"), selectLocationState
// must be provided for resolving how to retrieve the "route" in the state
const history = syncHistoryWithStore(browserHistory, store, {
selectLocationState: makeSelectLocationState(),
});
// Set up the router, wrapping all Routes in the App component
const rootRoute = {
component: App,
childRoutes: createRoutes(store),
};
const render = (messages) => {
ReactDOM.render(
<Provider store={store}>
<LanguageProvider messages={messages}>
<Router
history={history}
routes={rootRoute}
render={
// Scroll to top when going to a new page, imitating default browser
// behaviour
applyRouterMiddleware(useScroll())
}
/>
</LanguageProvider>
</Provider>,
document.getElementById('app')
);
};
// Hot reloadable translation json files
if (module.hot) {
// modules.hot.accept does not accept dynamic dependencies,
// have to be constants at compile-time
module.hot.accept('./i18n', () => {
render(translationMessages);
});
}
// Chunked polyfill for browsers without Intl support
if (!window.Intl) {
(new Promise((resolve) => {
resolve(import('intl'));
}))
.then(() => Promise.all([
import('intl/locale-data/jsonp/en.js'),
]))
.then(() => render(translationMessages))
.catch((err) => {
throw err;
});
} else {
render(translationMessages);
}
// Install ServiceWorker and AppCache in the end since
// it's not most important operation and if main code fails,
// we do not want it installed
if (process.env.NODE_ENV === 'production') {
require('offline-plugin/runtime').install(); // eslint-disable-line global-require
}
|
src/svg-icons/action/feedback.js | spiermar/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionFeedback = (props) => (
<SvgIcon {...props}>
<path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 12h-2v-2h2v2zm0-4h-2V6h2v4z"/>
</SvgIcon>
);
ActionFeedback = pure(ActionFeedback);
ActionFeedback.displayName = 'ActionFeedback';
ActionFeedback.muiName = 'SvgIcon';
export default ActionFeedback;
|
packages/material-ui-icons/src/SubwaySharp.js | kybarg/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><circle cx="8.5" cy="16" r="1" /><circle cx="15.5" cy="16" r="1" /><path d="M7.01 9h10v5h-10zM17.8 2.8C16 2.09 13.86 2 12 2s-4 .09-5.8.8C3.53 3.84 2 6.05 2 8.86V22h20V8.86c0-2.81-1.53-5.02-4.2-6.06zm.2 12.7c0 1.54-1.16 2.79-2.65 2.96l1.15 1.16V20h-1.67l-1.5-1.5h-2.66L9.17 20H7.5v-.38l1.15-1.16C7.16 18.29 6 17.04 6 15.5V9c0-2.63 3-3 6-3s6 .37 6 3v6.5z" /></React.Fragment>
, 'SubwaySharp');
|
src/server.js | 24v/player-sankey | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present 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 path from 'path';
import express from 'express';
import cookieParser from 'cookie-parser';
import bodyParser from 'body-parser';
import expressJwt, { UnauthorizedError as Jwt401Error } from 'express-jwt';
import expressGraphQL from 'express-graphql';
import jwt from 'jsonwebtoken';
import fetch from 'node-fetch';
import React from 'react';
import ReactDOM from 'react-dom/server';
import PrettyError from 'pretty-error';
import App from './components/App';
import Html from './components/Html';
import { ErrorPageWithoutStyle } from './routes/error/ErrorPage';
import errorPageStyle from './routes/error/ErrorPage.css';
import createFetch from './createFetch';
import passport from './passport';
import router from './router';
import models from './data/models';
import schema from './data/schema';
import assets from './assets.json'; // eslint-disable-line import/no-unresolved
import config from './config';
const app = express();
//
// Tell any CSS tooling (such as Material UI) to use all vendor prefixes if the
// user agent is not known.
// -----------------------------------------------------------------------------
global.navigator = global.navigator || {};
global.navigator.userAgent = global.navigator.userAgent || 'all';
//
// Register Node.js middleware
// -----------------------------------------------------------------------------
app.use(express.static(path.resolve(__dirname, 'public')));
app.use(cookieParser());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
//
// Authentication
// -----------------------------------------------------------------------------
app.use(
expressJwt({
secret: config.auth.jwt.secret,
credentialsRequired: false,
getToken: req => req.cookies.id_token,
}),
);
// Error handler for express-jwt
app.use((err, req, res, next) => {
// eslint-disable-line no-unused-vars
if (err instanceof Jwt401Error) {
console.error('[express-jwt-error]', req.cookies.id_token);
// `clearCookie`, otherwise user can't use web-app until cookie expires
res.clearCookie('id_token');
}
next(err);
});
app.use(passport.initialize());
if (__DEV__) {
app.enable('trust proxy');
}
app.get(
'/login/facebook',
passport.authenticate('facebook', {
scope: ['email', 'user_location'],
session: false,
}),
);
app.get(
'/login/facebook/return',
passport.authenticate('facebook', {
failureRedirect: '/login',
session: false,
}),
(req, res) => {
const expiresIn = 60 * 60 * 24 * 180; // 180 days
const token = jwt.sign(req.user, config.auth.jwt.secret, { expiresIn });
res.cookie('id_token', token, { maxAge: 1000 * expiresIn, httpOnly: true });
res.redirect('/');
},
);
//
// Register API middleware
// -----------------------------------------------------------------------------
app.use(
'/graphql',
expressGraphQL(req => ({
schema,
graphiql: __DEV__,
rootValue: { request: req },
pretty: __DEV__,
})),
);
//
// Register server-side rendering middleware
// -----------------------------------------------------------------------------
app.get('*', async (req, res, next) => {
try {
const css = new Set();
// Global (context) variables that can be easily accessed from any React component
// https://facebook.github.io/react/docs/context.html
const context = {
// Enables critical path CSS rendering
// https://github.com/kriasoft/isomorphic-style-loader
insertCss: (...styles) => {
// eslint-disable-next-line no-underscore-dangle
styles.forEach(style => css.add(style._getCss()));
},
// Universal HTTP client
fetch: createFetch(fetch, {
baseUrl: config.api.serverUrl,
cookie: req.headers.cookie,
}),
};
const route = await router.resolve({
...context,
pathname: req.path,
query: req.query,
});
if (route.redirect) {
res.redirect(route.status || 302, route.redirect);
return;
}
const data = { ...route };
data.children = ReactDOM.renderToString(
<App context={context}>
{route.component}
</App>,
);
data.styles = [{ id: 'css', cssText: [...css].join('') }];
data.scripts = [assets.vendor.js];
if (route.chunks) {
data.scripts.push(...route.chunks.map(chunk => assets[chunk].js));
}
data.scripts.push(assets.client.js);
data.app = {
apiUrl: config.api.clientUrl,
};
const html = ReactDOM.renderToStaticMarkup(<Html {...data} />);
res.status(route.status || 200);
res.send(`<!doctype html>${html}`);
} catch (err) {
next(err);
}
});
//
// Error handling
// -----------------------------------------------------------------------------
const pe = new PrettyError();
pe.skipNodeFiles();
pe.skipPackage('express');
// eslint-disable-next-line no-unused-vars
app.use((err, req, res, next) => {
console.error(pe.render(err));
const html = ReactDOM.renderToStaticMarkup(
<Html
title="Internal Server Error"
description={err.message}
styles={[{ id: 'css', cssText: errorPageStyle._getCss() }]} // eslint-disable-line no-underscore-dangle
>
{ReactDOM.renderToString(<ErrorPageWithoutStyle error={err} />)}
</Html>,
);
res.status(err.status || 500);
res.send(`<!doctype html>${html}`);
});
//
// Launch the server
// -----------------------------------------------------------------------------
const promise = models.sync().catch(err => console.error(err.stack));
if (!module.hot) {
promise.then(() => {
app.listen(config.port, () => {
console.info(`The server is running at http://localhost:${config.port}/`);
});
});
}
//
// Hot Module Replacement
// -----------------------------------------------------------------------------
if (module.hot) {
app.hot = module.hot;
module.hot.accept('./router');
}
export default app;
|
src/components/_/_RoadObjectListItem.js | nickooms/racing-webgl2 | import React from 'react';
import PropTypes from 'prop-types';
import { TableRow, TableRowColumn } from 'material-ui/Table';
import muiThemeable from 'material-ui/styles/muiThemeable';
import './index.css';
const RoadObjectListItem = ({ id, selected }) => (
<TableRow selected={selected}>
<TableRowColumn>{id}</TableRowColumn>
</TableRow>
);
RoadObjectListItem.propTypes = {
id: PropTypes.number.isRequired,
selected: PropTypes.bool.isRequired,
};
export default muiThemeable()(RoadObjectListItem);
|
src/routes/Home/components/HomeView.js | loaclhostjason/react-redux-admin | import React from 'react'
import DuckImage from '../assets/Duck.jpg'
import './HomeView.scss'
export const HomeView = () => (
<div>
<h4>Welcome!</h4>
<img
alt='This is a duck, because Redux!'
className='duck'
src={DuckImage} />
</div>
)
export default HomeView
|
docs-src/js/components/options/FormatLocale.js | gomo/react-calcpicker | import React from 'react'
import {CalcPicker, Rect, Action} from '../../../../dist/react-calcpicker'
import SyntaxHighlighter from 'react-syntax-highlighter'
import { tomorrowNightEighties } from 'react-syntax-highlighter/dist/styles'
export default class FormatLocale extends React.Component
{
constructor(props) {
super(props);
}
render(){
return (
<div>
<section className="docs--para-options-cont">
<p>You can use the <a href="http://numeraljs.com/">Numeral.js</a> <a href="http://numeraljs.com/#format">fomat</a> and <a href="http://numeraljs.com/#locales">locale</a> to change the format inside the picker button.</p>
</section>
<section className="docs--para-options-cont">
<h3>Demo</h3>
<CalcPicker
onChange={val => console.log(val)}
format="$ 0,0"
locale="ja"
/>
</section>
<section className="docs--para-options-cont">
<h3>Source</h3>
<SyntaxHighlighter language='javascript' style={tomorrowNightEighties}>
{`<CalcPicker
onChange={val => console.log(val)}
format="$ 0,0"
locale="ja"
/>`}
</SyntaxHighlighter>
</section>
</div>
);
}
}
|
es2015plus/react-redux/src/components/SelectsContent/index.js | lshig/forms-challenge | import React from 'react';
import PropTypes from 'prop-types';
import Button from '../Button';
import Select from '../Select';
export default function SelectsContent({
className,
selectOptions,
id,
onSelectChange,
onPreviousClick,
onNextClick
}) {
return (
<div id={id} className={className}>
<div className="form--content">
{selectOptions.map((item, index) => (
<div className="row" key={index}>
<div className="center">
<Select {...item} onChange={onSelectChange} />
</div>
</div>
))}
</div>
<div className="row">
<Button
className="previous"
onClick={onPreviousClick}
text="Previous"
/>
<Button className="next" onClick={onNextClick} text="Next" />
</div>
</div>
);
}
SelectsContent.propTypes = {
className: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
selectOptions: PropTypes.array.isRequired,
onNextClick: PropTypes.func.isRequired,
onPreviousClick: PropTypes.func.isRequired,
onSelectChange: PropTypes.func.isRequired
};
|
app/components/specificComponents/CookItemWithData/index.js | romainquellec/cuistot | import React from 'react';
import Container from './container';
import Card from './card';
import Card_description from './card_description';
import Card_text from './card_text';
import Card_pro from './card_pro';
import A from 'components/genericComponents/A/cook';
import Description from './description';
import BirthDay from './birthDay';
import Space from './space';
import CookCarousel from 'components/specificComponents/CookCarousel';
import WorkshopsList from 'components/specificComponents/WorkshopsList';
import CookMaps from '../CookMaps';
import Commentary from 'components/specificComponents/Commentary';
// Import React Icons
import Certif from 'react-icons/lib/fa/certificate';
import Cutlery from 'react-icons/lib/fa/cutlery';
import Envelope from 'react-icons/lib/fa/envelope';
import Briefcase from 'react-icons/lib/fa/briefcase';
import Location from 'react-icons/lib/fa/location-arrow';
import Cake from 'react-icons/lib/fa/birthday-cake';
export default class CookItemWithData extends React.Component {
pro(cook) {
if (cook.is_pro) {
return (
<span>
<Certif /> Cuisinier Professionnel
<br />
<Briefcase /> Siren : {cook.siren}
</span>
);
} else {
return (
<span>
<Cutlery /> Cuisinier Particulier
</span>
);
}
}
render() {
const cook = this.props.cook;
const pro = cook.is_pro ? 'Cuisinier Pro' : 'Cuisinier Particulier';
const first_name = cook.first_name_legal
? cook.first_name_legal
: 'Nom indisponible';
const last_name = cook.last_name_legal
? cook.last_name_legal
: 'Prenom indisponible';
const pro_name = cook.business_name
? cook.business_name
: 'Nom pro indisponible';
const email = cook.email_pro ? cook.email_pro : 'Email pro indisponible';
const birthday = cook.birthday_legal
? cook.birthday_legal
: 'Anniversaire indisponible';
return (
<div>
<CookCarousel />
<Container direction="row" wrap="wrap">
<Card>
<Card_description>
<Card_text>
{first_name} {last_name} {pro_name}
</Card_text>
<Card_pro>
{this.pro(cook)}
<br />
<span>
<Envelope /> {email}
</span>
<br />
<span>
<Location /> <A href="#maps">Location</A>
</span>
</Card_pro>
</Card_description>
<Description>
<hr />
{cook.description}
</Description>
<BirthDay>
<Cake /> {birthday}
</BirthDay>
</Card>
</Container>
<Container direction="row" wrap="wrap">
<WorkshopsList workshops={cook.workshop} />
</Container>
<div id="maps" />
<CookMaps
lat={cook.gourmet.location.x}
lon={cook.gourmet.location.y}
radius={3000}
/>
<Space />
<Container direction="row" wrap="wrap">
<Commentary id={cook.cook_id} />
</Container>
<Space />
</div>
);
}
}
|
src/components/About/Education/Education.js | jumpalottahigh/jumpalottahigh.github.io | import React from 'react'
import styled from 'styled-components'
import Img from 'gatsby-image'
import { graphql, StaticQuery } from 'gatsby'
import H2 from '../../elements/H2/H2.js'
import CenteredDiv from '../../elements/CenteredDiv/CenteredDiv.js'
const UL = styled.ul`
display: grid;
grid-gap: 10px;
padding-left: 20px;
`
const Diploma = styled.div`
display: flex;
.diploma-image {
width: 74px;
height: 100px;
margin-right: 20px;
}
p {
font-weight: bold;
margin: 0;
align-self: center;
}
`
export default () => (
<StaticQuery
query={graphql`
query {
allFile(filter: { relativePath: { regex: "/education/" } }) {
edges {
node {
id
name
childImageSharp {
# Specify the image processing specifications right in the query.
# Makes it trivial to update as your page's design changes.
fluid(maxWidth: 74) {
...GatsbyImageSharpFluid_withWebp
}
}
}
}
}
}
`}
render={data => (
<section>
<H2>{ Education }</H2>
<CenteredDiv>
<p className="highlight">
I believe strongly in life-long education and therefor regularly
partake in different courses
</p>
<UL>
<li>
Udacity's Google Developer Challenge Scholarship holder for Mobile
Web Specialist nanodegree (2017-2018)
</li>
<li>Google Analytics certified (2017-2018)</li>
<li>
React for Beginners on Egghead.io, CSS grid by Wesbos, The Vue
book
</li>
<li>
Plethora of tutorials and blog posts closely related to: React,
Vue, JavaScript, WebComponents, Stencil, Polymer, etc.
</li>
</UL>
<Diploma>
<div className="diploma-image">
<Img
fluid={data.allFile.edges[0].node.childImageSharp.fluid}
alt="Georgi Yanev Bachelor Diploma from Helsinki Metropolia University of Applied Sciences"
/>
</div>
<p>
Bachelor of Engineering (B.E.), Computer Software Engineering
<br />
Helsinki Metropolia University of Applied Sciences
</p>
</Diploma>
</CenteredDiv>
</section>
)}
/>
)
|
docs/src/app/components/pages/components/IconButton/ExampleSize.js | spiermar/material-ui | import React from 'react';
import IconButton from 'material-ui/IconButton';
import ActionHome from 'material-ui/svg-icons/action/home';
const styles = {
smallIcon: {
width: 36,
height: 36,
},
mediumIcon: {
width: 48,
height: 48,
},
largeIcon: {
width: 60,
height: 60,
},
small: {
width: 72,
height: 72,
padding: 16,
},
medium: {
width: 96,
height: 96,
padding: 24,
},
large: {
width: 120,
height: 120,
padding: 30,
},
};
const IconButtonExampleSize = () => (
<div>
<IconButton>
<ActionHome />
</IconButton>
<IconButton
iconStyle={styles.smallIcon}
style={styles.small}
>
<ActionHome />
</IconButton>
<IconButton
iconStyle={styles.mediumIcon}
style={styles.medium}
>
<ActionHome />
</IconButton>
<IconButton
iconStyle={styles.largeIcon}
style={styles.large}
>
<ActionHome />
</IconButton>
</div>
);
export default IconButtonExampleSize;
|
client/index.js | ctrlplusb/react-universally | /* eslint-disable global-require */
import React from 'react';
import { render } from 'react-dom';
import BrowserRouter from 'react-router-dom/BrowserRouter';
import asyncBootstrapper from 'react-async-bootstrapper';
import { AsyncComponentProvider } from 'react-async-component';
import './polyfills';
import ReactHotLoader from './components/ReactHotLoader';
import DemoApp from '../shared/components/DemoApp';
// Get the DOM Element that will host our React application.
const container = document.querySelector('#app');
// Does the user's browser support the HTML5 history API?
// If the user's browser doesn't support the HTML5 history API then we
// will force full page refreshes on each page change.
const supportsHistory = 'pushState' in window.history;
// Get any rehydrateState for the async components.
// eslint-disable-next-line no-underscore-dangle
const asyncComponentsRehydrateState = window.__ASYNC_COMPONENTS_REHYDRATE_STATE__;
/**
* Renders the given React Application component.
*/
function renderApp(TheApp) {
// Firstly, define our full application component, wrapping the given
// component app with a browser based version of react router.
const app = (
<ReactHotLoader>
<AsyncComponentProvider rehydrateState={asyncComponentsRehydrateState}>
<BrowserRouter forceRefresh={!supportsHistory}>
<TheApp />
</BrowserRouter>
</AsyncComponentProvider>
</ReactHotLoader>
);
// We use the react-async-component in order to support code splitting of
// our bundle output. It's important to use this helper.
// @see https://github.com/ctrlplusb/react-async-component
asyncBootstrapper(app).then(() => render(app, container));
}
// Execute the first render of our app.
renderApp(DemoApp);
// This registers our service worker for asset caching and offline support.
// Keep this as the last item, just in case the code execution failed (thanks
// to react-boilerplate for that tip.)
require('./registerServiceWorker');
// The following is needed so that we can support hot reloading our application.
if (process.env.BUILD_FLAG_IS_DEV === 'true' && module.hot) {
// Accept changes to this file for hot reloading.
module.hot.accept('./index.js');
// Any changes to our App will cause a hotload re-render.
module.hot.accept('../shared/components/DemoApp', () => {
renderApp(require('../shared/components/DemoApp').default);
});
}
|
src/svg-icons/action/question-answer.js | andrejunges/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionQuestionAnswer = (props) => (
<SvgIcon {...props}>
<path d="M21 6h-2v9H6v2c0 .55.45 1 1 1h11l4 4V7c0-.55-.45-1-1-1zm-4 6V3c0-.55-.45-1-1-1H3c-.55 0-1 .45-1 1v14l4-4h10c.55 0 1-.45 1-1z"/>
</SvgIcon>
);
ActionQuestionAnswer = pure(ActionQuestionAnswer);
ActionQuestionAnswer.displayName = 'ActionQuestionAnswer';
ActionQuestionAnswer.muiName = 'SvgIcon';
export default ActionQuestionAnswer;
|
examples/node_modules/react-native/node_modules/react-tools/src/classic/element/__tests__/ReactElementValidator-test.js | toddw/react-native-swiper | /**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @emails react-core
*/
'use strict';
// NOTE: We're explicitly not using JSX in this file. This is intended to test
// classic JS without JSX.
var React;
var ReactFragment;
var ReactTestUtils;
describe('ReactElementValidator', function() {
var ComponentClass;
beforeEach(function() {
require('mock-modules').dumpCache();
React = require('React');
ReactFragment = require('ReactFragment');
ReactTestUtils = require('ReactTestUtils');
ComponentClass = React.createClass({
render: function() { return React.createElement('div'); }
});
});
function frag(obj) {
return ReactFragment.create(obj);
}
it('warns for keys for arrays of elements in rest args', function() {
spyOn(console, 'warn');
var Component = React.createFactory(ComponentClass);
Component(null, [Component(), Component()]);
expect(console.warn.argsForCall.length).toBe(1);
expect(console.warn.argsForCall[0][0]).toContain(
'Each child in an array or iterator should have a unique "key" prop.'
);
});
it('warns for keys for arrays of elements with owner info', function() {
spyOn(console, 'warn');
var Component = React.createFactory(ComponentClass);
var InnerClass = React.createClass({
displayName: 'InnerClass',
render: function() {
return Component(null, this.props.childSet);
}
});
var InnerComponent = React.createFactory(InnerClass);
var ComponentWrapper = React.createClass({
displayName: 'ComponentWrapper',
render: function() {
return InnerComponent({childSet: [Component(), Component()] });
}
});
ReactTestUtils.renderIntoDocument(
React.createElement(ComponentWrapper)
);
expect(console.warn.argsForCall.length).toBe(1);
expect(console.warn.argsForCall[0][0]).toContain(
'Each child in an array or iterator should have a unique "key" prop. ' +
'Check the render method of InnerClass. ' +
'It was passed a child from ComponentWrapper. '
);
});
it('warns for keys for arrays with no owner or parent info', function() {
spyOn(console, 'warn');
var Anonymous = React.createClass({
displayName: undefined,
render: function() {
return <div />;
}
});
var divs = [
<div />,
<div />
];
ReactTestUtils.renderIntoDocument(<Anonymous>{divs}</Anonymous>);
expect(console.warn.argsForCall.length).toBe(1);
expect(console.warn.argsForCall[0][0]).toBe(
'Warning: Each child in an array or iterator should have a unique ' +
'"key" prop. See http://fb.me/react-warning-keys for more information.'
);
});
it('warns for keys for arrays of elements with no owner info', function() {
spyOn(console, 'warn');
var divs = [
<div />,
<div />
];
ReactTestUtils.renderIntoDocument(<div>{divs}</div>);
expect(console.warn.argsForCall.length).toBe(1);
expect(console.warn.argsForCall[0][0]).toBe(
'Warning: Each child in an array or iterator should have a unique ' +
'"key" prop. Check the React.render call using <div>. See ' +
'http://fb.me/react-warning-keys for more information.'
);
});
it('warns for keys for iterables of elements in rest args', function() {
spyOn(console, 'warn');
var Component = React.createFactory(ComponentClass);
var iterable = {
'@@iterator': function() {
var i = 0;
return {
next: function() {
var done = ++i > 2;
return {value: done ? undefined : Component(), done: done};
}
};
}
};
Component(null, iterable);
expect(console.warn.argsForCall.length).toBe(1);
expect(console.warn.argsForCall[0][0]).toContain(
'Each child in an array or iterator should have a unique "key" prop.'
);
});
it('does not warns for arrays of elements with keys', function() {
spyOn(console, 'warn');
var Component = React.createFactory(ComponentClass);
Component(null, [Component({key: '#1'}), Component({key: '#2'})]);
expect(console.warn.argsForCall.length).toBe(0);
});
it('does not warns for iterable elements with keys', function() {
spyOn(console, 'warn');
var Component = React.createFactory(ComponentClass);
var iterable = {
'@@iterator': function() {
var i = 0;
return {
next: function() {
var done = ++i > 2;
return {
value: done ? undefined : Component({key: '#' + i}),
done: done
};
}
};
}
};
Component(null, iterable);
expect(console.warn.argsForCall.length).toBe(0);
});
it('warns for numeric keys on objects in rest args', function() {
spyOn(console, 'warn');
var Component = React.createFactory(ComponentClass);
Component(null, frag({1: Component(), 2: Component()}));
expect(console.warn.argsForCall.length).toBe(1);
expect(console.warn.argsForCall[0][0]).toContain(
'Child objects should have non-numeric keys so ordering is preserved.'
);
});
it('does not warn for numeric keys in entry iterables in rest args', function() {
spyOn(console, 'warn');
var Component = React.createFactory(ComponentClass);
var iterable = {
'@@iterator': function() {
var i = 0;
return {
next: function() {
var done = ++i > 2;
return {value: done ? undefined : [i, Component()], done: done};
}
};
}
};
iterable.entries = iterable['@@iterator'];
Component(null, iterable);
expect(console.warn.argsForCall.length).toBe(0);
});
it('does not warn when the element is directly in rest args', function() {
spyOn(console, 'warn');
var Component = React.createFactory(ComponentClass);
Component(null, Component(), Component());
expect(console.warn.argsForCall.length).toBe(0);
});
it('does not warn when the array contains a non-element', function() {
spyOn(console, 'warn');
var Component = React.createFactory(ComponentClass);
Component(null, [ {}, {} ]);
expect(console.warn.argsForCall.length).toBe(0);
});
// TODO: These warnings currently come from the composite component, but
// they should be moved into the ReactElementValidator.
it('should give context for PropType errors in nested components.', () => {
// In this test, we're making sure that if a proptype error is found in a
// component, we give a small hint as to which parent instantiated that
// component as per warnings about key usage in ReactElementValidator.
spyOn(console, 'warn');
var MyComp = React.createClass({
propTypes: {
color: React.PropTypes.string
},
render: function() {
return React.createElement('div', null, 'My color is ' + this.color);
}
});
var ParentComp = React.createClass({
render: function() {
return React.createElement(MyComp, {color: 123});
}
});
ReactTestUtils.renderIntoDocument(React.createElement(ParentComp));
expect(console.warn.calls[0].args[0]).toBe(
'Warning: Failed propType: ' +
'Invalid prop `color` of type `number` supplied to `MyComp`, ' +
'expected `string`. Check the render method of `ParentComp`.'
);
});
it('gives a helpful error when passing null or undefined', function() {
spyOn(console, 'warn');
React.createElement(undefined);
React.createElement(null);
expect(console.warn.calls.length).toBe(2);
expect(console.warn.calls[0].args[0]).toBe(
'Warning: React.createElement: type should not be null or undefined. ' +
'It should be a string (for DOM elements) or a ReactClass (for ' +
'composite components).'
);
expect(console.warn.calls[1].args[0]).toBe(
'Warning: React.createElement: type should not be null or undefined. ' +
'It should be a string (for DOM elements) or a ReactClass (for ' +
'composite components).'
);
React.createElement('div');
expect(console.warn.calls.length).toBe(2);
});
it('should check default prop values', function() {
spyOn(console, 'warn');
var Component = React.createClass({
propTypes: {prop: React.PropTypes.string.isRequired},
getDefaultProps: function() {
return {prop: null};
},
render: function() {
return React.createElement('span', null, this.props.prop);
}
});
ReactTestUtils.renderIntoDocument(React.createElement(Component));
expect(console.warn.calls.length).toBe(1);
expect(console.warn.calls[0].args[0]).toBe(
'Warning: Failed propType: ' +
'Required prop `prop` was not specified in `Component`.'
);
});
it('should not check the default for explicit null', function() {
spyOn(console, 'warn');
var Component = React.createClass({
propTypes: {prop: React.PropTypes.string.isRequired},
getDefaultProps: function() {
return {prop: 'text'};
},
render: function() {
return React.createElement('span', null, this.props.prop);
}
});
ReactTestUtils.renderIntoDocument(
React.createElement(Component, {prop:null})
);
expect(console.warn.calls.length).toBe(1);
expect(console.warn.calls[0].args[0]).toBe(
'Warning: Failed propType: ' +
'Required prop `prop` was not specified in `Component`.'
);
});
it('should check declared prop types', function() {
spyOn(console, 'warn');
var Component = React.createClass({
propTypes: {
prop: React.PropTypes.string.isRequired
},
render: function() {
return React.createElement('span', null, this.props.prop);
}
});
ReactTestUtils.renderIntoDocument(
React.createElement(Component)
);
ReactTestUtils.renderIntoDocument(
React.createElement(Component, {prop: 42})
);
expect(console.warn.calls.length).toBe(2);
expect(console.warn.calls[0].args[0]).toBe(
'Warning: Failed propType: ' +
'Required prop `prop` was not specified in `Component`.'
);
expect(console.warn.calls[1].args[0]).toBe(
'Warning: Failed propType: ' +
'Invalid prop `prop` of type `number` supplied to ' +
'`Component`, expected `string`.'
);
ReactTestUtils.renderIntoDocument(
React.createElement(Component, {prop: 'string'})
);
// Should not error for strings
expect(console.warn.calls.length).toBe(2);
});
it('should warn if a fragment is used without the wrapper', function() {
spyOn(console, 'warn');
var child = React.createElement('span');
React.createElement('div', null, {a: child, b: child});
expect(console.warn.calls.length).toBe(1);
expect(console.warn.calls[0].args[0]).toContain('use of a keyed object');
});
it('should warn when accessing .type on an element factory', function() {
spyOn(console, 'warn');
var TestComponent = React.createClass({
render: function() {
return <div />;
}
});
var TestFactory = React.createFactory(TestComponent);
expect(TestFactory.type).toBe(TestComponent);
expect(console.warn.argsForCall.length).toBe(1);
expect(console.warn.argsForCall[0][0]).toBe(
'Warning: Factory.type is deprecated. Access the class directly before ' +
'passing it to createFactory.'
);
// Warn once, not again
expect(TestFactory.type).toBe(TestComponent);
expect(console.warn.argsForCall.length).toBe(1);
});
});
|
src/svg-icons/communication/contact-phone.js | igorbt/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let CommunicationContactPhone = (props) => (
<SvgIcon {...props}>
<path d="M22 3H2C.9 3 0 3.9 0 5v14c0 1.1.9 2 2 2h20c1.1 0 1.99-.9 1.99-2L24 5c0-1.1-.9-2-2-2zM8 6c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm6 12H2v-1c0-2 4-3.1 6-3.1s6 1.1 6 3.1v1zm3.85-4h1.64L21 16l-1.99 1.99c-1.31-.98-2.28-2.38-2.73-3.99-.18-.64-.28-1.31-.28-2s.1-1.36.28-2c.45-1.62 1.42-3.01 2.73-3.99L21 8l-1.51 2h-1.64c-.22.63-.35 1.3-.35 2s.13 1.37.35 2z"/>
</SvgIcon>
);
CommunicationContactPhone = pure(CommunicationContactPhone);
CommunicationContactPhone.displayName = 'CommunicationContactPhone';
CommunicationContactPhone.muiName = 'SvgIcon';
export default CommunicationContactPhone;
|
ajax/libs/analytics.js/2.3.17/analytics.js | lmccart/cdnjs | (function outer(modules, cache, entries){
/**
* Global
*/
var global = (function(){ return this; })();
/**
* Require `name`.
*
* @param {String} name
* @param {Boolean} jumped
* @api public
*/
function require(name, jumped){
if (cache[name]) return cache[name].exports;
if (modules[name]) return call(name, require);
throw new Error('cannot find module "' + name + '"');
}
/**
* Call module `id` and cache it.
*
* @param {Number} id
* @param {Function} require
* @return {Function}
* @api private
*/
function call(id, require){
var m = cache[id] = { exports: {} };
var mod = modules[id];
var name = mod[2];
var fn = mod[0];
fn.call(m.exports, function(req){
var dep = modules[id][1][req];
return require(dep ? dep : req);
}, m, m.exports, outer, modules, cache, entries);
// expose as `name`.
if (name) cache[name] = cache[id];
return cache[id].exports;
}
/**
* Require all entries exposing them on global if needed.
*/
for (var id in entries) {
if (entries[id]) {
global[entries[id]] = require(id);
} else {
require(id);
}
}
/**
* Duo flag.
*/
require.duo = true;
/**
* Expose cache.
*/
require.cache = cache;
/**
* Expose modules
*/
require.modules = modules;
/**
* Return newest require.
*/
return require;
})({
1: [function(require, module, exports) {
/**
* Analytics.js
*
* (C) 2013 Segment.io Inc.
*/
var Integrations = require('analytics.js-integrations');
var Analytics = require('./analytics');
var each = require('each');
/**
* Expose the `analytics` singleton.
*/
var analytics = module.exports = exports = new Analytics();
/**
* Expose require
*/
analytics.require = require;
/**
* Expose `VERSION`.
*/
exports.VERSION = require('./version');
/**
* Add integrations.
*/
each(Integrations, function (name, Integration) {
analytics.use(Integration);
});
}, {"analytics.js-integrations":2,"./analytics":3,"each":4,"./version":5}],
2: [function(require, module, exports) {
/**
* Module dependencies.
*/
var each = require('each');
var plugins = require('./integrations.js');
/**
* Expose the integrations, using their own `name` from their `prototype`.
*/
each(plugins, function(plugin){
var name = (plugin.Integration || plugin).prototype.name;
exports[name] = plugin;
});
}, {"each":4,"./integrations.js":6}],
4: [function(require, module, exports) {
/**
* Module dependencies.
*/
var type = require('type');
/**
* HOP reference.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Iterate the given `obj` and invoke `fn(val, i)`.
*
* @param {String|Array|Object} obj
* @param {Function} fn
* @api public
*/
module.exports = function(obj, fn){
switch (type(obj)) {
case 'array':
return array(obj, fn);
case 'object':
if ('number' == typeof obj.length) return array(obj, fn);
return object(obj, fn);
case 'string':
return string(obj, fn);
}
};
/**
* Iterate string chars.
*
* @param {String} obj
* @param {Function} fn
* @api private
*/
function string(obj, fn) {
for (var i = 0; i < obj.length; ++i) {
fn(obj.charAt(i), i);
}
}
/**
* Iterate object keys.
*
* @param {Object} obj
* @param {Function} fn
* @api private
*/
function object(obj, fn) {
for (var key in obj) {
if (has.call(obj, key)) {
fn(key, obj[key]);
}
}
}
/**
* Iterate array-ish.
*
* @param {Array|Object} obj
* @param {Function} fn
* @api private
*/
function array(obj, fn) {
for (var i = 0; i < obj.length; ++i) {
fn(obj[i], i);
}
}
}, {"type":7}],
7: [function(require, module, exports) {
/**
* toString ref.
*/
var toString = Object.prototype.toString;
/**
* Return the type of `val`.
*
* @param {Mixed} val
* @return {String}
* @api public
*/
module.exports = function(val){
switch (toString.call(val)) {
case '[object Function]': return 'function';
case '[object Date]': return 'date';
case '[object RegExp]': return 'regexp';
case '[object Arguments]': return 'arguments';
case '[object Array]': return 'array';
case '[object String]': return 'string';
}
if (val === null) return 'null';
if (val === undefined) return 'undefined';
if (val && val.nodeType === 1) return 'element';
if (val === Object(val)) return 'object';
return typeof val;
};
}, {}],
6: [function(require, module, exports) {
/**
* DON'T EDIT THIS FILE. It's automatically generated!
*/
module.exports = [
require('./lib/adroll'),
require('./lib/adwords'),
require('./lib/alexa'),
require('./lib/amplitude'),
require('./lib/appcues'),
require('./lib/awesm'),
require('./lib/awesomatic'),
require('./lib/bing-ads'),
require('./lib/bronto'),
require('./lib/bugherd'),
require('./lib/bugsnag'),
require('./lib/chartbeat'),
require('./lib/churnbee'),
require('./lib/clicktale'),
require('./lib/clicky'),
require('./lib/comscore'),
require('./lib/crazy-egg'),
require('./lib/curebit'),
require('./lib/customerio'),
require('./lib/drip'),
require('./lib/errorception'),
require('./lib/evergage'),
require('./lib/facebook-conversion-tracking'),
require('./lib/foxmetrics'),
require('./lib/frontleaf'),
require('./lib/gauges'),
require('./lib/get-satisfaction'),
require('./lib/google-analytics'),
require('./lib/google-tag-manager'),
require('./lib/gosquared'),
require('./lib/heap'),
require('./lib/hellobar'),
require('./lib/hittail'),
require('./lib/hublo'),
require('./lib/hubspot'),
require('./lib/improvely'),
require('./lib/insidevault'),
require('./lib/inspectlet'),
require('./lib/intercom'),
require('./lib/keen-io'),
require('./lib/kenshoo'),
require('./lib/kissmetrics'),
require('./lib/klaviyo'),
require('./lib/leadlander'),
require('./lib/livechat'),
require('./lib/lucky-orange'),
require('./lib/lytics'),
require('./lib/mixpanel'),
require('./lib/mojn'),
require('./lib/mouseflow'),
require('./lib/mousestats'),
require('./lib/navilytics'),
require('./lib/olark'),
require('./lib/optimizely'),
require('./lib/perfect-audience'),
require('./lib/pingdom'),
require('./lib/piwik'),
require('./lib/preact'),
require('./lib/qualaroo'),
require('./lib/quantcast'),
require('./lib/rollbar'),
require('./lib/saasquatch'),
require('./lib/sentry'),
require('./lib/snapengage'),
require('./lib/spinnakr'),
require('./lib/tapstream'),
require('./lib/trakio'),
require('./lib/twitter-ads'),
require('./lib/usercycle'),
require('./lib/uservoice'),
require('./lib/vero'),
require('./lib/visual-website-optimizer'),
require('./lib/webengage'),
require('./lib/woopra'),
require('./lib/yandex-metrica')
];
}, {"./lib/adroll":8,"./lib/adwords":9,"./lib/alexa":10,"./lib/amplitude":11,"./lib/appcues":12,"./lib/awesm":13,"./lib/awesomatic":14,"./lib/bing-ads":15,"./lib/bronto":16,"./lib/bugherd":17,"./lib/bugsnag":18,"./lib/chartbeat":19,"./lib/churnbee":20,"./lib/clicktale":21,"./lib/clicky":22,"./lib/comscore":23,"./lib/crazy-egg":24,"./lib/curebit":25,"./lib/customerio":26,"./lib/drip":27,"./lib/errorception":28,"./lib/evergage":29,"./lib/facebook-conversion-tracking":30,"./lib/foxmetrics":31,"./lib/frontleaf":32,"./lib/gauges":33,"./lib/get-satisfaction":34,"./lib/google-analytics":35,"./lib/google-tag-manager":36,"./lib/gosquared":37,"./lib/heap":38,"./lib/hellobar":39,"./lib/hittail":40,"./lib/hublo":41,"./lib/hubspot":42,"./lib/improvely":43,"./lib/insidevault":44,"./lib/inspectlet":45,"./lib/intercom":46,"./lib/keen-io":47,"./lib/kenshoo":48,"./lib/kissmetrics":49,"./lib/klaviyo":50,"./lib/leadlander":51,"./lib/livechat":52,"./lib/lucky-orange":53,"./lib/lytics":54,"./lib/mixpanel":55,"./lib/mojn":56,"./lib/mouseflow":57,"./lib/mousestats":58,"./lib/navilytics":59,"./lib/olark":60,"./lib/optimizely":61,"./lib/perfect-audience":62,"./lib/pingdom":63,"./lib/piwik":64,"./lib/preact":65,"./lib/qualaroo":66,"./lib/quantcast":67,"./lib/rollbar":68,"./lib/saasquatch":69,"./lib/sentry":70,"./lib/snapengage":71,"./lib/spinnakr":72,"./lib/tapstream":73,"./lib/trakio":74,"./lib/twitter-ads":75,"./lib/usercycle":76,"./lib/uservoice":77,"./lib/vero":78,"./lib/visual-website-optimizer":79,"./lib/webengage":80,"./lib/woopra":81,"./lib/yandex-metrica":82}],
8: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var snake = require('to-snake-case');
var useHttps = require('use-https');
var each = require('each');
var is = require('is');
/**
* HOP
*/
var has = Object.prototype.hasOwnProperty;
/**
* Expose `AdRoll` integration.
*/
var AdRoll = module.exports = integration('AdRoll')
.assumesPageview()
.global('__adroll_loaded')
.global('adroll_adv_id')
.global('adroll_pix_id')
.global('adroll_custom_data')
.option('advId', '')
.option('pixId', '')
.tag('http', '<script src="http://a.adroll.com/j/roundtrip.js">')
.tag('https', '<script src="https://s.adroll.com/j/roundtrip.js">')
.mapping('events');
/**
* Initialize.
*
* http://support.adroll.com/getting-started-in-4-easy-steps/#step-one
* http://support.adroll.com/enhanced-conversion-tracking/
*
* @param {Object} page
*/
AdRoll.prototype.initialize = function(page){
window.adroll_adv_id = this.options.advId;
window.adroll_pix_id = this.options.pixId;
window.__adroll_loaded = true;
var name = useHttps() ? 'https' : 'http';
this.load(name, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
AdRoll.prototype.loaded = function(){
return window.__adroll;
};
/**
* Page.
*
* http://support.adroll.com/segmenting-clicks/
*
* @param {Page} page
*/
AdRoll.prototype.page = function(page){
var name = page.fullName();
this.track(page.track(name));
};
/**
* Track.
*
* @param {Track} track
*/
AdRoll.prototype.track = function(track){
var event = track.event();
var user = this.analytics.user();
var events = this.events(event);
var total = track.revenue() || track.total() || 0;
var orderId = track.orderId() || 0;
each(events, function(event){
var data = {};
if (user.id()) data.user_id = user.id();
data.adroll_conversion_value_in_dollars = total;
data.order_id = orderId;
// the adroll interface only allows for
// segment names which are snake cased.
data.adroll_segments = snake(event);
window.__adroll.record_user(data);
});
// no events found
if (!events.length) {
var data = {};
if (user.id()) data.user_id = user.id();
data.adroll_segments = snake(event);
window.__adroll.record_user(data);
}
};
}, {"analytics.js-integration":83,"to-snake-case":84,"use-https":85,"each":4,"is":86}],
83: [function(require, module, exports) {
/**
* Module dependencies.
*/
var bind = require('bind');
var callback = require('callback');
var clone = require('clone');
var debug = require('debug');
var defaults = require('defaults');
var protos = require('./protos');
var slug = require('slug');
var statics = require('./statics');
/**
* Expose `createIntegration`.
*/
module.exports = createIntegration;
/**
* Create a new `Integration` constructor.
*
* @param {String} name
* @return {Function} Integration
*/
function createIntegration(name){
/**
* Initialize a new `Integration`.
*
* @param {Object} options
*/
function Integration(options){
if (options && options.addIntegration) {
// plugin
return options.addIntegration(Integration);
}
this.debug = debug('analytics:integration:' + slug(name));
this.options = defaults(clone(options) || {}, this.defaults);
this._queue = [];
this.once('ready', bind(this, this.flush));
Integration.emit('construct', this);
this.ready = bind(this, this.ready);
this._wrapInitialize();
this._wrapPage();
this._wrapTrack();
}
Integration.prototype.defaults = {};
Integration.prototype.globals = [];
Integration.prototype.templates = {};
Integration.prototype.name = name;
for (var key in statics) Integration[key] = statics[key];
for (var key in protos) Integration.prototype[key] = protos[key];
return Integration;
}
}, {"bind":87,"callback":88,"clone":89,"debug":90,"defaults":91,"./protos":92,"slug":93,"./statics":94}],
87: [function(require, module, exports) {
var bind = require('bind')
, bindAll = require('bind-all');
/**
* Expose `bind`.
*/
module.exports = exports = bind;
/**
* Expose `bindAll`.
*/
exports.all = bindAll;
/**
* Expose `bindMethods`.
*/
exports.methods = bindMethods;
/**
* Bind `methods` on `obj` to always be called with the `obj` as context.
*
* @param {Object} obj
* @param {String} methods...
*/
function bindMethods (obj, methods) {
methods = [].slice.call(arguments, 1);
for (var i = 0, method; method = methods[i]; i++) {
obj[method] = bind(obj, obj[method]);
}
return obj;
}
}, {"bind":95,"bind-all":96}],
95: [function(require, module, exports) {
/**
* Slice reference.
*/
var slice = [].slice;
/**
* Bind `obj` to `fn`.
*
* @param {Object} obj
* @param {Function|String} fn or string
* @return {Function}
* @api public
*/
module.exports = function(obj, fn){
if ('string' == typeof fn) fn = obj[fn];
if ('function' != typeof fn) throw new Error('bind() requires a function');
var args = slice.call(arguments, 2);
return function(){
return fn.apply(obj, args.concat(slice.call(arguments)));
}
};
}, {}],
96: [function(require, module, exports) {
try {
var bind = require('bind');
var type = require('type');
} catch (e) {
var bind = require('bind-component');
var type = require('type-component');
}
module.exports = function (obj) {
for (var key in obj) {
var val = obj[key];
if (type(val) === 'function') obj[key] = bind(obj, obj[key]);
}
return obj;
};
}, {"bind":95,"type":7}],
88: [function(require, module, exports) {
var next = require('next-tick');
/**
* Expose `callback`.
*/
module.exports = callback;
/**
* Call an `fn` back synchronously if it exists.
*
* @param {Function} fn
*/
function callback (fn) {
if ('function' === typeof fn) fn();
}
/**
* Call an `fn` back asynchronously if it exists. If `wait` is ommitted, the
* `fn` will be called on next tick.
*
* @param {Function} fn
* @param {Number} wait (optional)
*/
callback.async = function (fn, wait) {
if ('function' !== typeof fn) return;
if (!wait) return next(fn);
setTimeout(fn, wait);
};
/**
* Symmetry.
*/
callback.sync = callback;
}, {"next-tick":97}],
97: [function(require, module, exports) {
"use strict"
if (typeof setImmediate == 'function') {
module.exports = function(f){ setImmediate(f) }
}
// legacy node.js
else if (typeof process != 'undefined' && typeof process.nextTick == 'function') {
module.exports = process.nextTick
}
// fallback for other environments / postMessage behaves badly on IE8
else if (typeof window == 'undefined' || window.ActiveXObject || !window.postMessage) {
module.exports = function(f){ setTimeout(f) };
} else {
var q = [];
window.addEventListener('message', function(){
var i = 0;
while (i < q.length) {
try { q[i++](); }
catch (e) {
q = q.slice(i);
window.postMessage('tic!', '*');
throw e;
}
}
q.length = 0;
}, true);
module.exports = function(fn){
if (!q.length) window.postMessage('tic!', '*');
q.push(fn);
}
}
}, {}],
89: [function(require, module, exports) {
/**
* Module dependencies.
*/
var type;
try {
type = require('type');
} catch(e){
type = require('type-component');
}
/**
* Module exports.
*/
module.exports = clone;
/**
* Clones objects.
*
* @param {Mixed} any object
* @api public
*/
function clone(obj){
switch (type(obj)) {
case 'object':
var copy = {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
copy[key] = clone(obj[key]);
}
}
return copy;
case 'array':
var copy = new Array(obj.length);
for (var i = 0, l = obj.length; i < l; i++) {
copy[i] = clone(obj[i]);
}
return copy;
case 'regexp':
// from millermedeiros/amd-utils - MIT
var flags = '';
flags += obj.multiline ? 'm' : '';
flags += obj.global ? 'g' : '';
flags += obj.ignoreCase ? 'i' : '';
return new RegExp(obj.source, flags);
case 'date':
return new Date(obj.getTime());
default: // string, number, boolean, …
return obj;
}
}
}, {"type":7}],
90: [function(require, module, exports) {
if ('undefined' == typeof window) {
module.exports = require('./lib/debug');
} else {
module.exports = require('./debug');
}
}, {"./lib/debug":98,"./debug":99}],
98: [function(require, module, exports) {
/**
* Module dependencies.
*/
var tty = require('tty');
/**
* Expose `debug()` as the module.
*/
module.exports = debug;
/**
* Enabled debuggers.
*/
var names = []
, skips = [];
(process.env.DEBUG || '')
.split(/[\s,]+/)
.forEach(function(name){
name = name.replace('*', '.*?');
if (name[0] === '-') {
skips.push(new RegExp('^' + name.substr(1) + '$'));
} else {
names.push(new RegExp('^' + name + '$'));
}
});
/**
* Colors.
*/
var colors = [6, 2, 3, 4, 5, 1];
/**
* Previous debug() call.
*/
var prev = {};
/**
* Previously assigned color.
*/
var prevColor = 0;
/**
* Is stdout a TTY? Colored output is disabled when `true`.
*/
var isatty = tty.isatty(2);
/**
* Select a color.
*
* @return {Number}
* @api private
*/
function color() {
return colors[prevColor++ % colors.length];
}
/**
* Humanize the given `ms`.
*
* @param {Number} m
* @return {String}
* @api private
*/
function humanize(ms) {
var sec = 1000
, min = 60 * 1000
, hour = 60 * min;
if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
if (ms >= min) return (ms / min).toFixed(1) + 'm';
if (ms >= sec) return (ms / sec | 0) + 's';
return ms + 'ms';
}
/**
* Create a debugger with the given `name`.
*
* @param {String} name
* @return {Type}
* @api public
*/
function debug(name) {
function disabled(){}
disabled.enabled = false;
var match = skips.some(function(re){
return re.test(name);
});
if (match) return disabled;
match = names.some(function(re){
return re.test(name);
});
if (!match) return disabled;
var c = color();
function colored(fmt) {
fmt = coerce(fmt);
var curr = new Date;
var ms = curr - (prev[name] || curr);
prev[name] = curr;
fmt = ' \u001b[9' + c + 'm' + name + ' '
+ '\u001b[3' + c + 'm\u001b[90m'
+ fmt + '\u001b[3' + c + 'm'
+ ' +' + humanize(ms) + '\u001b[0m';
console.error.apply(this, arguments);
}
function plain(fmt) {
fmt = coerce(fmt);
fmt = new Date().toUTCString()
+ ' ' + name + ' ' + fmt;
console.error.apply(this, arguments);
}
colored.enabled = plain.enabled = true;
return isatty || process.env.DEBUG_COLORS
? colored
: plain;
}
/**
* Coerce `val`.
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}
}, {}],
99: [function(require, module, exports) {
/**
* Expose `debug()` as the module.
*/
module.exports = debug;
/**
* Create a debugger with the given `name`.
*
* @param {String} name
* @return {Type}
* @api public
*/
function debug(name) {
if (!debug.enabled(name)) return function(){};
return function(fmt){
fmt = coerce(fmt);
var curr = new Date;
var ms = curr - (debug[name] || curr);
debug[name] = curr;
fmt = name
+ ' '
+ fmt
+ ' +' + debug.humanize(ms);
// This hackery is required for IE8
// where `console.log` doesn't have 'apply'
window.console
&& console.log
&& Function.prototype.apply.call(console.log, console, arguments);
}
}
/**
* The currently active debug mode names.
*/
debug.names = [];
debug.skips = [];
/**
* Enables a debug mode by name. This can include modes
* separated by a colon and wildcards.
*
* @param {String} name
* @api public
*/
debug.enable = function(name) {
try {
localStorage.debug = name;
} catch(e){}
var split = (name || '').split(/[\s,]+/)
, len = split.length;
for (var i = 0; i < len; i++) {
name = split[i].replace('*', '.*?');
if (name[0] === '-') {
debug.skips.push(new RegExp('^' + name.substr(1) + '$'));
}
else {
debug.names.push(new RegExp('^' + name + '$'));
}
}
};
/**
* Disable debug output.
*
* @api public
*/
debug.disable = function(){
debug.enable('');
};
/**
* Humanize the given `ms`.
*
* @param {Number} m
* @return {String}
* @api private
*/
debug.humanize = function(ms) {
var sec = 1000
, min = 60 * 1000
, hour = 60 * min;
if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
if (ms >= min) return (ms / min).toFixed(1) + 'm';
if (ms >= sec) return (ms / sec | 0) + 's';
return ms + 'ms';
};
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
debug.enabled = function(name) {
for (var i = 0, len = debug.skips.length; i < len; i++) {
if (debug.skips[i].test(name)) {
return false;
}
}
for (var i = 0, len = debug.names.length; i < len; i++) {
if (debug.names[i].test(name)) {
return true;
}
}
return false;
};
/**
* Coerce `val`.
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}
// persist
try {
if (window.localStorage) debug.enable(localStorage.debug);
} catch(e){}
}, {}],
91: [function(require, module, exports) {
'use strict';
/**
* Merge default values.
*
* @param {Object} dest
* @param {Object} defaults
* @return {Object}
* @api public
*/
var defaults = function (dest, src, recursive) {
for (var prop in src) {
if (recursive && dest[prop] instanceof Object && src[prop] instanceof Object) {
dest[prop] = defaults(dest[prop], src[prop], true);
} else if (! (prop in dest)) {
dest[prop] = src[prop];
}
}
return dest;
};
/**
* Expose `defaults`.
*/
module.exports = defaults;
}, {}],
92: [function(require, module, exports) {
/**
* Module dependencies.
*/
var loadScript = require('segmentio/load-script');
var normalize = require('to-no-case');
var callback = require('callback');
var Emitter = require('emitter');
var events = require('./events');
var tick = require('next-tick');
var assert = require('assert');
var after = require('after');
var each = require('component/each');
var type = require('type');
var fmt = require('yields/fmt');
/**
* Window defaults.
*/
var setTimeout = window.setTimeout;
var setInterval = window.setInterval;
var onerror = null;
var onload = null;
/**
* Mixin emitter.
*/
Emitter(exports);
/**
* Initialize.
*/
exports.initialize = function(){
var ready = this.ready;
tick(ready);
};
/**
* Loaded?
*
* @return {Boolean}
* @api private
*/
exports.loaded = function(){
return false;
};
/**
* Load.
*
* @param {Function} cb
*/
exports.load = function(cb){
callback.async(cb);
};
/**
* Page.
*
* @param {Page} page
*/
exports.page = function(page){};
/**
* Track.
*
* @param {Track} track
*/
exports.track = function(track){};
/**
* Get events that match `str`.
*
* Examples:
*
* events = { my_event: 'a4991b88' }
* .map(events, 'My Event');
* // => ["a4991b88"]
* .map(events, 'whatever');
* // => []
*
* events = [{ key: 'my event', value: '9b5eb1fa' }]
* .map(events, 'my_event');
* // => ["9b5eb1fa"]
* .map(events, 'whatever');
* // => []
*
* @param {String} str
* @return {Array}
* @api public
*/
exports.map = function(obj, str){
var a = normalize(str);
var ret = [];
// noop
if (!obj) return ret;
// object
if ('object' == type(obj)) {
for (var k in obj) {
var item = obj[k];
var b = normalize(k);
if (b == a) ret.push(item);
}
}
// array
if ('array' == type(obj)) {
if (!obj.length) return ret;
if (!obj[0].key) return ret;
for (var i = 0; i < obj.length; ++i) {
var item = obj[i];
var b = normalize(item.key);
if (b == a) ret.push(item.value);
}
}
return ret;
};
/**
* Invoke a `method` that may or may not exist on the prototype with `args`,
* queueing or not depending on whether the integration is "ready". Don't
* trust the method call, since it contains integration party code.
*
* @param {String} method
* @param {Mixed} args...
* @api private
*/
exports.invoke = function(method){
if (!this[method]) return;
var args = [].slice.call(arguments, 1);
if (!this._ready) return this.queue(method, args);
var ret;
try {
this.debug('%s with %o', method, args);
ret = this[method].apply(this, args);
} catch (e) {
this.debug('error %o calling %s with %o', e, method, args);
}
return ret;
};
/**
* Queue a `method` with `args`. If the integration assumes an initial
* pageview, then let the first call to `page` pass through.
*
* @param {String} method
* @param {Array} args
* @api private
*/
exports.queue = function(method, args){
if ('page' == method && this._assumesPageview && !this._initialized) {
return this.page.apply(this, args);
}
this._queue.push({ method: method, args: args });
};
/**
* Flush the internal queue.
*
* @api private
*/
exports.flush = function(){
this._ready = true;
var call;
while (call = this._queue.shift()) this[call.method].apply(this, call.args);
};
/**
* Reset the integration, removing its global variables.
*
* @api private
*/
exports.reset = function(){
for (var i = 0, key; key = this.globals[i]; i++) window[key] = undefined;
window.setTimeout = setTimeout;
window.setInterval = setInterval;
window.onerror = onerror;
window.onload = onload;
};
/**
* Load a tag by `name`.
*
* @param {String} name
* @param {Function} [fn]
*/
exports.load = function(name, locals, fn){
if ('function' == typeof name) fn = name, locals = null, name = null;
if (name && 'object' == typeof name) fn = locals, locals = name, name = null;
if ('function' == typeof locals) fn = locals, locals = null;
name = name || 'library';
locals = locals || {};
locals = this.locals(locals);
var template = this.templates[name];
assert(template, fmt('Template "%s" not defined.', name));
var attrs = render(template, locals);
var el;
switch (template.type) {
case 'img':
attrs.width = 1;
attrs.height = 1;
el = loadImage(attrs, fn);
break;
case 'script':
el = loadScript(attrs, fn);
// TODO: hack until refactoring load-script
delete attrs.src;
each(attrs, function(key, val){
el.setAttribute(key, val);
});
break;
case 'iframe':
el = loadIframe(attrs, fn);
break;
}
return el;
};
/**
* Locals for tag templates.
*
* By default it includes a cache buster,
* and all of the options.
*
* @param {Object} [locals]
* @return {Object}
*/
exports.locals = function(locals){
locals = locals || {};
var cache = Math.floor(new Date().getTime() / 3600000);
if (!locals.hasOwnProperty('cache')) locals.cache = cache;
each(this.options, function(key, val){
if (!locals.hasOwnProperty(key)) locals[key] = val;
});
return locals;
};
/**
* Simple way to emit ready.
*/
exports.ready = function(){
this.emit('ready');
};
/**
* Wrap the initialize method in an exists check, so we don't have to do it for
* every single integration.
*
* @api private
*/
exports._wrapInitialize = function(){
var initialize = this.initialize;
this.initialize = function(){
this.debug('initialize');
this._initialized = true;
var ret = initialize.apply(this, arguments);
this.emit('initialize');
return ret;
};
if (this._assumesPageview) this.initialize = after(2, this.initialize);
};
/**
* Wrap the page method to call `initialize` instead if the integration assumes
* a pageview.
*
* @api private
*/
exports._wrapPage = function(){
var page = this.page;
this.page = function(){
if (this._assumesPageview && !this._initialized) {
return this.initialize.apply(this, arguments);
}
return page.apply(this, arguments);
};
};
/**
* Wrap the track method to call other ecommerce methods if
* available depending on the `track.event()`.
*
* @api private
*/
exports._wrapTrack = function(){
var t = this.track;
this.track = function(track){
var event = track.event();
var called;
var ret;
for (var method in events) {
var regexp = events[method];
if (!this[method]) continue;
if (!regexp.test(event)) continue;
ret = this[method].apply(this, arguments);
called = true;
break;
}
if (!called) ret = t.apply(this, arguments);
return ret;
};
};
function loadImage(attrs, fn) {
fn = fn || function(){};
var img = new Image;
img.onerror = error(fn, 'failed to load pixel', img);
img.onload = function(){ fn(); };
img.src = attrs.src;
img.width = 1;
img.height = 1;
return img;
}
function error(fn, message, img){
return function(e){
e = e || window.event;
var err = new Error(message);
err.event = e;
err.source = img;
fn(err);
};
}
/**
* Render template + locals into an `attrs` object.
*
* @param {Object} template
* @param {Object} locals
* @return {Object}
*/
function render(template, locals) {
var attrs = {};
each(template.attrs, function(key, val){
attrs[key] = val.replace(/\{\{\ *(\w+)\ *\}\}/g, function(_, $1){
return locals[$1];
});
});
return attrs;
}
}, {"segmentio/load-script":100,"to-no-case":101,"callback":88,"emitter":102,"./events":103,"next-tick":97,"assert":104,"after":105,"component/each":106,"type":7,"yields/fmt":107}],
100: [function(require, module, exports) {
/**
* Module dependencies.
*/
var onload = require('script-onload');
var tick = require('next-tick');
var type = require('type');
/**
* Expose `loadScript`.
*
* @param {Object} options
* @param {Function} fn
* @api public
*/
module.exports = function loadScript(options, fn){
if (!options) throw new Error('Cant load nothing...');
// Allow for the simplest case, just passing a `src` string.
if ('string' == type(options)) options = { src : options };
var https = document.location.protocol === 'https:' ||
document.location.protocol === 'chrome-extension:';
// If you use protocol relative URLs, third-party scripts like Google
// Analytics break when testing with `file:` so this fixes that.
if (options.src && options.src.indexOf('//') === 0) {
options.src = https ? 'https:' + options.src : 'http:' + options.src;
}
// Allow them to pass in different URLs depending on the protocol.
if (https && options.https) options.src = options.https;
else if (!https && options.http) options.src = options.http;
// Make the `<script>` element and insert it before the first script on the
// page, which is guaranteed to exist since this Javascript is running.
var script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = options.src;
// If we have a fn, attach event handlers, even in IE. Based off of
// the Third-Party Javascript script loading example:
// https://github.com/thirdpartyjs/thirdpartyjs-code/blob/master/examples/templates/02/loading-files/index.html
if ('function' == type(fn)) {
onload(script, fn);
}
tick(function(){
// Append after event listeners are attached for IE.
var firstScript = document.getElementsByTagName('script')[0];
firstScript.parentNode.insertBefore(script, firstScript);
});
// Return the script element in case they want to do anything special, like
// give it an ID or attributes.
return script;
};
}, {"script-onload":108,"next-tick":97,"type":7}],
108: [function(require, module, exports) {
// https://github.com/thirdpartyjs/thirdpartyjs-code/blob/master/examples/templates/02/loading-files/index.html
/**
* Invoke `fn(err)` when the given `el` script loads.
*
* @param {Element} el
* @param {Function} fn
* @api public
*/
module.exports = function(el, fn){
return el.addEventListener
? add(el, fn)
: attach(el, fn);
};
/**
* Add event listener to `el`, `fn()`.
*
* @param {Element} el
* @param {Function} fn
* @api private
*/
function add(el, fn){
el.addEventListener('load', function(_, e){ fn(null, e); }, false);
el.addEventListener('error', function(e){
var err = new Error('failed to load the script "' + el.src + '"');
err.event = e;
fn(err);
}, false);
}
/**
* Attach evnet.
*
* @param {Element} el
* @param {Function} fn
* @api private
*/
function attach(el, fn){
el.attachEvent('onreadystatechange', function(e){
if (!/complete|loaded/.test(el.readyState)) return;
fn(null, e);
});
}
}, {}],
101: [function(require, module, exports) {
/**
* Expose `toNoCase`.
*/
module.exports = toNoCase;
/**
* Test whether a string is camel-case.
*/
var hasSpace = /\s/;
var hasSeparator = /[\W_]/;
/**
* Remove any starting case from a `string`, like camel or snake, but keep
* spaces and punctuation that may be important otherwise.
*
* @param {String} string
* @return {String}
*/
function toNoCase (string) {
if (hasSpace.test(string)) return string.toLowerCase();
if (hasSeparator.test(string)) return unseparate(string).toLowerCase();
return uncamelize(string).toLowerCase();
}
/**
* Separator splitter.
*/
var separatorSplitter = /[\W_]+(.|$)/g;
/**
* Un-separate a `string`.
*
* @param {String} string
* @return {String}
*/
function unseparate (string) {
return string.replace(separatorSplitter, function (m, next) {
return next ? ' ' + next : '';
});
}
/**
* Camelcase splitter.
*/
var camelSplitter = /(.)([A-Z]+)/g;
/**
* Un-camelcase a `string`.
*
* @param {String} string
* @return {String}
*/
function uncamelize (string) {
return string.replace(camelSplitter, function (m, previous, uppers) {
return previous + ' ' + uppers.toLowerCase().split('').join(' ');
});
}
}, {}],
102: [function(require, module, exports) {
/**
* Module dependencies.
*/
var index = require('indexof');
/**
* Expose `Emitter`.
*/
module.exports = Emitter;
/**
* Initialize a new `Emitter`.
*
* @api public
*/
function Emitter(obj) {
if (obj) return mixin(obj);
};
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
return obj;
}
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
(this._callbacks[event] = this._callbacks[event] || [])
.push(fn);
return this;
};
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.once = function(event, fn){
var self = this;
this._callbacks = this._callbacks || {};
function on() {
self.off(event, on);
fn.apply(this, arguments);
}
fn._off = on;
this.on(event, on);
return this;
};
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
// all
if (0 == arguments.length) {
this._callbacks = {};
return this;
}
// specific event
var callbacks = this._callbacks[event];
if (!callbacks) return this;
// remove all handlers
if (1 == arguments.length) {
delete this._callbacks[event];
return this;
}
// remove specific handler
var i = index(callbacks, fn._off || fn);
if (~i) callbacks.splice(i, 1);
return this;
};
/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/
Emitter.prototype.emit = function(event){
this._callbacks = this._callbacks || {};
var args = [].slice.call(arguments, 1)
, callbacks = this._callbacks[event];
if (callbacks) {
callbacks = callbacks.slice(0);
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
return this;
};
/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/
Emitter.prototype.listeners = function(event){
this._callbacks = this._callbacks || {};
return this._callbacks[event] || [];
};
/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/
Emitter.prototype.hasListeners = function(event){
return !! this.listeners(event).length;
};
}, {"indexof":109}],
109: [function(require, module, exports) {
module.exports = function(arr, obj){
if (arr.indexOf) return arr.indexOf(obj);
for (var i = 0; i < arr.length; ++i) {
if (arr[i] === obj) return i;
}
return -1;
};
}, {}],
103: [function(require, module, exports) {
/**
* Expose `events`.
*/
module.exports = {
removedProduct: /removed[ _]?product/i,
viewedProduct: /viewed[ _]?product/i,
addedProduct: /added[ _]?product/i,
completedOrder: /completed[ _]?order/i
};
}, {}],
104: [function(require, module, exports) {
/**
* Module dependencies.
*/
var equals = require('equals');
var fmt = require('fmt');
var stack = require('stack');
/**
* Assert `expr` with optional failure `msg`.
*
* @param {Mixed} expr
* @param {String} [msg]
* @api public
*/
module.exports = exports = function (expr, msg) {
if (expr) return;
throw new Error(msg || message());
};
/**
* Assert `actual` is weak equal to `expected`.
*
* @param {Mixed} actual
* @param {Mixed} expected
* @param {String} [msg]
* @api public
*/
exports.equal = function (actual, expected, msg) {
if (actual == expected) return;
throw new Error(msg || fmt('Expected %o to equal %o.', actual, expected));
};
/**
* Assert `actual` is not weak equal to `expected`.
*
* @param {Mixed} actual
* @param {Mixed} expected
* @param {String} [msg]
* @api public
*/
exports.notEqual = function (actual, expected, msg) {
if (actual != expected) return;
throw new Error(msg || fmt('Expected %o not to equal %o.', actual, expected));
};
/**
* Assert `actual` is deep equal to `expected`.
*
* @param {Mixed} actual
* @param {Mixed} expected
* @param {String} [msg]
* @api public
*/
exports.deepEqual = function (actual, expected, msg) {
if (equals(actual, expected)) return;
throw new Error(msg || fmt('Expected %o to deeply equal %o.', actual, expected));
};
/**
* Assert `actual` is not deep equal to `expected`.
*
* @param {Mixed} actual
* @param {Mixed} expected
* @param {String} [msg]
* @api public
*/
exports.notDeepEqual = function (actual, expected, msg) {
if (!equals(actual, expected)) return;
throw new Error(msg || fmt('Expected %o not to deeply equal %o.', actual, expected));
};
/**
* Assert `actual` is strict equal to `expected`.
*
* @param {Mixed} actual
* @param {Mixed} expected
* @param {String} [msg]
* @api public
*/
exports.strictEqual = function (actual, expected, msg) {
if (actual === expected) return;
throw new Error(msg || fmt('Expected %o to strictly equal %o.', actual, expected));
};
/**
* Assert `actual` is not strict equal to `expected`.
*
* @param {Mixed} actual
* @param {Mixed} expected
* @param {String} [msg]
* @api public
*/
exports.notStrictEqual = function (actual, expected, msg) {
if (actual !== expected) return;
throw new Error(msg || fmt('Expected %o not to strictly equal %o.', actual, expected));
};
/**
* Assert `block` throws an `error`.
*
* @param {Function} block
* @param {Function} [error]
* @param {String} [msg]
* @api public
*/
exports.throws = function (block, error, msg) {
var err;
try {
block();
} catch (e) {
err = e;
}
if (!err) throw new Error(msg || fmt('Expected %s to throw an error.', block.toString()));
if (error && !(err instanceof error)) {
throw new Error(msg || fmt('Expected %s to throw an %o.', block.toString(), error));
}
};
/**
* Assert `block` doesn't throw an `error`.
*
* @param {Function} block
* @param {Function} [error]
* @param {String} [msg]
* @api public
*/
exports.doesNotThrow = function (block, error, msg) {
var err;
try {
block();
} catch (e) {
err = e;
}
if (err) throw new Error(msg || fmt('Expected %s not to throw an error.', block.toString()));
if (error && (err instanceof error)) {
throw new Error(msg || fmt('Expected %s not to throw an %o.', block.toString(), error));
}
};
/**
* Create a message from the call stack.
*
* @return {String}
* @api private
*/
function message() {
if (!Error.captureStackTrace) return 'assertion failed';
var callsite = stack()[2];
var fn = callsite.getFunctionName();
var file = callsite.getFileName();
var line = callsite.getLineNumber() - 1;
var col = callsite.getColumnNumber() - 1;
var src = get(file);
line = src.split('\n')[line].slice(col);
var m = line.match(/assert\((.*)\)/);
return m && m[1].trim();
}
/**
* Load contents of `script`.
*
* @param {String} script
* @return {String}
* @api private
*/
function get(script) {
var xhr = new XMLHttpRequest;
xhr.open('GET', script, false);
xhr.send(null);
return xhr.responseText;
}
}, {"equals":110,"fmt":107,"stack":111}],
110: [function(require, module, exports) {
var type = require('type')
/**
* expose equals
*/
module.exports = equals
equals.compare = compare
/**
* assert all values are equal
*
* @param {Any} [...]
* @return {Boolean}
*/
function equals(){
var i = arguments.length - 1
while (i > 0) {
if (!compare(arguments[i], arguments[--i])) return false
}
return true
}
// (any, any, [array]) -> boolean
function compare(a, b, memos){
// All identical values are equivalent
if (a === b) return true
var fnA = types[type(a)]
var fnB = types[type(b)]
return fnA && fnA === fnB
? fnA(a, b, memos)
: false
}
var types = {}
// (Number) -> boolean
types.number = function(a){
// NaN check
return a !== a
}
// (function, function, array) -> boolean
types['function'] = function(a, b, memos){
return a.toString() === b.toString()
// Functions can act as objects
&& types.object(a, b, memos)
&& compare(a.prototype, b.prototype)
}
// (date, date) -> boolean
types.date = function(a, b){
return +a === +b
}
// (regexp, regexp) -> boolean
types.regexp = function(a, b){
return a.toString() === b.toString()
}
// (DOMElement, DOMElement) -> boolean
types.element = function(a, b){
return a.outerHTML === b.outerHTML
}
// (textnode, textnode) -> boolean
types.textnode = function(a, b){
return a.textContent === b.textContent
}
// decorate `fn` to prevent it re-checking objects
// (function) -> function
function memoGaurd(fn){
return function(a, b, memos){
if (!memos) return fn(a, b, [])
var i = memos.length, memo
while (memo = memos[--i]) {
if (memo[0] === a && memo[1] === b) return true
}
return fn(a, b, memos)
}
}
types['arguments'] =
types.array = memoGaurd(compareArrays)
// (array, array, array) -> boolean
function compareArrays(a, b, memos){
var i = a.length
if (i !== b.length) return false
memos.push([a, b])
while (i--) {
if (!compare(a[i], b[i], memos)) return false
}
return true
}
types.object = memoGaurd(compareObjects)
// (object, object, array) -> boolean
function compareObjects(a, b, memos) {
var ka = getEnumerableProperties(a)
var kb = getEnumerableProperties(b)
var i = ka.length
// same number of properties
if (i !== kb.length) return false
// although not necessarily the same order
ka.sort()
kb.sort()
// cheap key test
while (i--) if (ka[i] !== kb[i]) return false
// remember
memos.push([a, b])
// iterate again this time doing a thorough check
i = ka.length
while (i--) {
var key = ka[i]
if (!compare(a[key], b[key], memos)) return false
}
return true
}
// (object) -> array
function getEnumerableProperties (object) {
var result = []
for (var k in object) if (k !== 'constructor') {
result.push(k)
}
return result
}
}, {"type":112}],
112: [function(require, module, exports) {
var toString = {}.toString
var DomNode = typeof window != 'undefined'
? window.Node
: Function
/**
* Return the type of `val`.
*
* @param {Mixed} val
* @return {String}
* @api public
*/
module.exports = exports = function(x){
var type = typeof x
if (type != 'object') return type
type = types[toString.call(x)]
if (type) return type
if (x instanceof DomNode) switch (x.nodeType) {
case 1: return 'element'
case 3: return 'text-node'
case 9: return 'document'
case 11: return 'document-fragment'
default: return 'dom-node'
}
}
var types = exports.types = {
'[object Function]': 'function',
'[object Date]': 'date',
'[object RegExp]': 'regexp',
'[object Arguments]': 'arguments',
'[object Array]': 'array',
'[object String]': 'string',
'[object Null]': 'null',
'[object Undefined]': 'undefined',
'[object Number]': 'number',
'[object Boolean]': 'boolean',
'[object Object]': 'object',
'[object Text]': 'text-node',
'[object Uint8Array]': 'bit-array',
'[object Uint16Array]': 'bit-array',
'[object Uint32Array]': 'bit-array',
'[object Uint8ClampedArray]': 'bit-array',
'[object Error]': 'error',
'[object FormData]': 'form-data',
'[object File]': 'file',
'[object Blob]': 'blob'
}
}, {}],
107: [function(require, module, exports) {
/**
* Export `fmt`
*/
module.exports = fmt;
/**
* Formatters
*/
fmt.o = JSON.stringify;
fmt.s = String;
fmt.d = parseInt;
/**
* Format the given `str`.
*
* @param {String} str
* @param {...} args
* @return {String}
* @api public
*/
function fmt(str){
var args = [].slice.call(arguments, 1);
var j = 0;
return str.replace(/%([a-z])/gi, function(_, f){
return fmt[f]
? fmt[f](args[j++])
: _ + f;
});
}
}, {}],
111: [function(require, module, exports) {
/**
* Expose `stack()`.
*/
module.exports = stack;
/**
* Return the stack.
*
* @return {Array}
* @api public
*/
function stack() {
var orig = Error.prepareStackTrace;
Error.prepareStackTrace = function(_, stack){ return stack; };
var err = new Error;
Error.captureStackTrace(err, arguments.callee);
var stack = err.stack;
Error.prepareStackTrace = orig;
return stack;
}
}, {}],
105: [function(require, module, exports) {
module.exports = function after (times, func) {
// After 0, really?
if (times <= 0) return func();
// That's more like it.
return function() {
if (--times < 1) {
return func.apply(this, arguments);
}
};
};
}, {}],
106: [function(require, module, exports) {
/**
* Module dependencies.
*/
try {
var type = require('type');
} catch (err) {
var type = require('component-type');
}
var toFunction = require('to-function');
/**
* HOP reference.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Iterate the given `obj` and invoke `fn(val, i)`
* in optional context `ctx`.
*
* @param {String|Array|Object} obj
* @param {Function} fn
* @param {Object} [ctx]
* @api public
*/
module.exports = function(obj, fn, ctx){
fn = toFunction(fn);
ctx = ctx || this;
switch (type(obj)) {
case 'array':
return array(obj, fn, ctx);
case 'object':
if ('number' == typeof obj.length) return array(obj, fn, ctx);
return object(obj, fn, ctx);
case 'string':
return string(obj, fn, ctx);
}
};
/**
* Iterate string chars.
*
* @param {String} obj
* @param {Function} fn
* @param {Object} ctx
* @api private
*/
function string(obj, fn, ctx) {
for (var i = 0; i < obj.length; ++i) {
fn.call(ctx, obj.charAt(i), i);
}
}
/**
* Iterate object keys.
*
* @param {Object} obj
* @param {Function} fn
* @param {Object} ctx
* @api private
*/
function object(obj, fn, ctx) {
for (var key in obj) {
if (has.call(obj, key)) {
fn.call(ctx, key, obj[key]);
}
}
}
/**
* Iterate array-ish.
*
* @param {Array|Object} obj
* @param {Function} fn
* @param {Object} ctx
* @api private
*/
function array(obj, fn, ctx) {
for (var i = 0; i < obj.length; ++i) {
fn.call(ctx, obj[i], i);
}
}
}, {"type":7,"component-type":7,"to-function":113}],
113: [function(require, module, exports) {
/**
* Module Dependencies
*/
var expr;
try {
expr = require('props');
} catch(e) {
expr = require('component-props');
}
/**
* Expose `toFunction()`.
*/
module.exports = toFunction;
/**
* Convert `obj` to a `Function`.
*
* @param {Mixed} obj
* @return {Function}
* @api private
*/
function toFunction(obj) {
switch ({}.toString.call(obj)) {
case '[object Object]':
return objectToFunction(obj);
case '[object Function]':
return obj;
case '[object String]':
return stringToFunction(obj);
case '[object RegExp]':
return regexpToFunction(obj);
default:
return defaultToFunction(obj);
}
}
/**
* Default to strict equality.
*
* @param {Mixed} val
* @return {Function}
* @api private
*/
function defaultToFunction(val) {
return function(obj){
return val === obj;
};
}
/**
* Convert `re` to a function.
*
* @param {RegExp} re
* @return {Function}
* @api private
*/
function regexpToFunction(re) {
return function(obj){
return re.test(obj);
};
}
/**
* Convert property `str` to a function.
*
* @param {String} str
* @return {Function}
* @api private
*/
function stringToFunction(str) {
// immediate such as "> 20"
if (/^ *\W+/.test(str)) return new Function('_', 'return _ ' + str);
// properties such as "name.first" or "age > 18" or "age > 18 && age < 36"
return new Function('_', 'return ' + get(str));
}
/**
* Convert `object` to a function.
*
* @param {Object} object
* @return {Function}
* @api private
*/
function objectToFunction(obj) {
var match = {};
for (var key in obj) {
match[key] = typeof obj[key] === 'string'
? defaultToFunction(obj[key])
: toFunction(obj[key]);
}
return function(val){
if (typeof val !== 'object') return false;
for (var key in match) {
if (!(key in val)) return false;
if (!match[key](val[key])) return false;
}
return true;
};
}
/**
* Built the getter function. Supports getter style functions
*
* @param {String} str
* @return {String}
* @api private
*/
function get(str) {
var props = expr(str);
if (!props.length) return '_.' + str;
var val, i, prop;
for (i = 0; i < props.length; i++) {
prop = props[i];
val = '_.' + prop;
val = "('function' == typeof " + val + " ? " + val + "() : " + val + ")";
// mimic negative lookbehind to avoid problems with nested properties
str = stripNested(prop, str, val);
}
return str;
}
/**
* Mimic negative lookbehind to avoid problems with nested properties.
*
* See: http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript
*
* @param {String} prop
* @param {String} str
* @param {String} val
* @return {String}
* @api private
*/
function stripNested (prop, str, val) {
return str.replace(new RegExp('(\\.)?' + prop, 'g'), function($0, $1) {
return $1 ? $0 : val;
});
}
}, {"props":114,"component-props":114}],
114: [function(require, module, exports) {
/**
* Global Names
*/
var globals = /\b(this|Array|Date|Object|Math|JSON)\b/g;
/**
* Return immediate identifiers parsed from `str`.
*
* @param {String} str
* @param {String|Function} map function or prefix
* @return {Array}
* @api public
*/
module.exports = function(str, fn){
var p = unique(props(str));
if (fn && 'string' == typeof fn) fn = prefixed(fn);
if (fn) return map(str, p, fn);
return p;
};
/**
* Return immediate identifiers in `str`.
*
* @param {String} str
* @return {Array}
* @api private
*/
function props(str) {
return str
.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g, '')
.replace(globals, '')
.match(/[$a-zA-Z_]\w*/g)
|| [];
}
/**
* Return `str` with `props` mapped with `fn`.
*
* @param {String} str
* @param {Array} props
* @param {Function} fn
* @return {String}
* @api private
*/
function map(str, props, fn) {
var re = /\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;
return str.replace(re, function(_){
if ('(' == _[_.length - 1]) return fn(_);
if (!~props.indexOf(_)) return _;
return fn(_);
});
}
/**
* Return unique array.
*
* @param {Array} arr
* @return {Array}
* @api private
*/
function unique(arr) {
var ret = [];
for (var i = 0; i < arr.length; i++) {
if (~ret.indexOf(arr[i])) continue;
ret.push(arr[i]);
}
return ret;
}
/**
* Map with prefix `str`.
*/
function prefixed(str) {
return function(_){
return str + _;
};
}
}, {}],
93: [function(require, module, exports) {
/**
* Generate a slug from the given `str`.
*
* example:
*
* generate('foo bar');
* // > foo-bar
*
* @param {String} str
* @param {Object} options
* @config {String|RegExp} [replace] characters to replace, defaulted to `/[^a-z0-9]/g`
* @config {String} [separator] separator to insert, defaulted to `-`
* @return {String}
*/
module.exports = function (str, options) {
options || (options = {});
return str.toLowerCase()
.replace(options.replace || /[^a-z0-9]/g, ' ')
.replace(/^ +| +$/g, '')
.replace(/ +/g, options.separator || '-')
};
}, {}],
94: [function(require, module, exports) {
/**
* Module dependencies.
*/
var after = require('after');
var domify = require('component/domify');
var each = require('component/each');
var Emitter = require('emitter');
/**
* Mixin emitter.
*/
Emitter(exports);
/**
* Add a new option to the integration by `key` with default `value`.
*
* @param {String} key
* @param {Mixed} value
* @return {Integration}
*/
exports.option = function(key, value){
this.prototype.defaults[key] = value;
return this;
};
/**
* Add a new mapping option.
*
* This will create a method `name` that will return a mapping
* for you to use.
*
* Example:
*
* Integration('My Integration')
* .mapping('events');
*
* new MyIntegration().track('My Event');
*
* .track = function(track){
* var events = this.events(track.event());
* each(events, send);
* };
*
* @param {String} name
* @return {Integration}
*/
exports.mapping = function(name){
this.option(name, []);
this.prototype[name] = function(str){
return this.map(this.options[name], str);
};
return this;
};
/**
* Register a new global variable `key` owned by the integration, which will be
* used to test whether the integration is already on the page.
*
* @param {String} global
* @return {Integration}
*/
exports.global = function(key){
this.prototype.globals.push(key);
return this;
};
/**
* Mark the integration as assuming an initial pageview, so to defer loading
* the script until the first `page` call, noop the first `initialize`.
*
* @return {Integration}
*/
exports.assumesPageview = function(){
this.prototype._assumesPageview = true;
return this;
};
/**
* Mark the integration as being "ready" once `load` is called.
*
* @return {Integration}
*/
exports.readyOnLoad = function(){
this.prototype._readyOnLoad = true;
return this;
};
/**
* Mark the integration as being "ready" once `initialize` is called.
*
* @return {Integration}
*/
exports.readyOnInitialize = function(){
this.prototype._readyOnInitialize = true;
return this;
};
/**
* Define a tag to be loaded.
*
* @param {String} str DOM tag as string or URL
* @return {Integration}
*/
exports.tag = function(name, str){
if (null == str) {
str = name;
name = 'library';
}
this.prototype.templates[name] = objectify(str);
return this;
};
/**
* Given a string, give back DOM attributes.
*
* Do it in a way where the browser doesn't load images or iframes.
* It turns out, domify will load images/iframes, because
* whenever you construct those DOM elements,
* the browser immediately loads them.
*
* @param {String} str
* @return {Object}
*/
function objectify(str) {
// replace `src` with `data-src` to prevent image loading
str = str.replace(' src="', ' data-src="');
var el = domify(str);
var attrs = {};
each(el.attributes, function(attr){
// then replace it back
var name = 'data-src' == attr.name ? 'src' : attr.name;
attrs[name] = attr.value;
});
return {
type: el.tagName.toLowerCase(),
attrs: attrs
};
}
}, {"after":105,"component/domify":115,"component/each":106,"emitter":102}],
115: [function(require, module, exports) {
/**
* Expose `parse`.
*/
module.exports = parse;
/**
* Tests for browser support.
*/
var div = document.createElement('div');
// Setup
div.innerHTML = ' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
var innerHTMLBug = !div.getElementsByTagName('link').length;
div = undefined;
/**
* Wrap map from jquery.
*/
var map = {
legend: [1, '<fieldset>', '</fieldset>'],
tr: [2, '<table><tbody>', '</tbody></table>'],
col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
// for script/link/style tags to work in IE6-8, you have to wrap
// in a div with a non-whitespace character in front, ha!
_default: innerHTMLBug ? [1, 'X<div>', '</div>'] : [0, '', '']
};
map.td =
map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
map.option =
map.optgroup = [1, '<select multiple="multiple">', '</select>'];
map.thead =
map.tbody =
map.colgroup =
map.caption =
map.tfoot = [1, '<table>', '</table>'];
map.text =
map.circle =
map.ellipse =
map.line =
map.path =
map.polygon =
map.polyline =
map.rect = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
/**
* Parse `html` and return a DOM Node instance, which could be a TextNode,
* HTML DOM Node of some kind (<div> for example), or a DocumentFragment
* instance, depending on the contents of the `html` string.
*
* @param {String} html - HTML string to "domify"
* @param {Document} doc - The `document` instance to create the Node for
* @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance
* @api private
*/
function parse(html, doc) {
if ('string' != typeof html) throw new TypeError('String expected');
// default to the global `document` object
if (!doc) doc = document;
// tag name
var m = /<([\w:]+)/.exec(html);
if (!m) return doc.createTextNode(html);
html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace
var tag = m[1];
// body support
if (tag == 'body') {
var el = doc.createElement('html');
el.innerHTML = html;
return el.removeChild(el.lastChild);
}
// wrap map
var wrap = map[tag] || map._default;
var depth = wrap[0];
var prefix = wrap[1];
var suffix = wrap[2];
var el = doc.createElement('div');
el.innerHTML = prefix + html + suffix;
while (depth--) el = el.lastChild;
// one element
if (el.firstChild == el.lastChild) {
return el.removeChild(el.firstChild);
}
// several elements
var fragment = doc.createDocumentFragment();
while (el.firstChild) {
fragment.appendChild(el.removeChild(el.firstChild));
}
return fragment;
}
}, {}],
84: [function(require, module, exports) {
var toSpace = require('to-space-case');
/**
* Expose `toSnakeCase`.
*/
module.exports = toSnakeCase;
/**
* Convert a `string` to snake case.
*
* @param {String} string
* @return {String}
*/
function toSnakeCase (string) {
return toSpace(string).replace(/\s/g, '_');
}
}, {"to-space-case":116}],
116: [function(require, module, exports) {
var clean = require('to-no-case');
/**
* Expose `toSpaceCase`.
*/
module.exports = toSpaceCase;
/**
* Convert a `string` to space case.
*
* @param {String} string
* @return {String}
*/
function toSpaceCase (string) {
return clean(string).replace(/[\W_]+(.|$)/g, function (matches, match) {
return match ? ' ' + match : '';
});
}
}, {"to-no-case":117}],
117: [function(require, module, exports) {
/**
* Expose `toNoCase`.
*/
module.exports = toNoCase;
/**
* Test whether a string is camel-case.
*/
var hasSpace = /\s/;
var hasCamel = /[a-z][A-Z]/;
var hasSeparator = /[\W_]/;
/**
* Remove any starting case from a `string`, like camel or snake, but keep
* spaces and punctuation that may be important otherwise.
*
* @param {String} string
* @return {String}
*/
function toNoCase (string) {
if (hasSpace.test(string)) return string.toLowerCase();
if (hasSeparator.test(string)) string = unseparate(string);
if (hasCamel.test(string)) string = uncamelize(string);
return string.toLowerCase();
}
/**
* Separator splitter.
*/
var separatorSplitter = /[\W_]+(.|$)/g;
/**
* Un-separate a `string`.
*
* @param {String} string
* @return {String}
*/
function unseparate (string) {
return string.replace(separatorSplitter, function (m, next) {
return next ? ' ' + next : '';
});
}
/**
* Camelcase splitter.
*/
var camelSplitter = /(.)([A-Z]+)/g;
/**
* Un-camelcase a `string`.
*
* @param {String} string
* @return {String}
*/
function uncamelize (string) {
return string.replace(camelSplitter, function (m, previous, uppers) {
return previous + ' ' + uppers.toLowerCase().split('').join(' ');
});
}
}, {}],
85: [function(require, module, exports) {
/**
* Protocol.
*/
module.exports = function (url) {
switch (arguments.length) {
case 0: return check();
case 1: return transform(url);
}
};
/**
* Transform a protocol-relative `url` to the use the proper protocol.
*
* @param {String} url
* @return {String}
*/
function transform (url) {
return check() ? 'https:' + url : 'http:' + url;
}
/**
* Check whether `https:` be used for loading scripts.
*
* @return {Boolean}
*/
function check () {
return (
location.protocol == 'https:' ||
location.protocol == 'chrome-extension:'
);
}
}, {}],
86: [function(require, module, exports) {
var isEmpty = require('is-empty');
try {
var typeOf = require('type');
} catch (e) {
var typeOf = require('component-type');
}
/**
* Types.
*/
var types = [
'arguments',
'array',
'boolean',
'date',
'element',
'function',
'null',
'number',
'object',
'regexp',
'string',
'undefined'
];
/**
* Expose type checkers.
*
* @param {Mixed} value
* @return {Boolean}
*/
for (var i = 0, type; type = types[i]; i++) exports[type] = generate(type);
/**
* Add alias for `function` for old browsers.
*/
exports.fn = exports['function'];
/**
* Expose `empty` check.
*/
exports.empty = isEmpty;
/**
* Expose `nan` check.
*/
exports.nan = function (val) {
return exports.number(val) && val != val;
};
/**
* Generate a type checker.
*
* @param {String} type
* @return {Function}
*/
function generate (type) {
return function (value) {
return type === typeOf(value);
};
}
}, {"is-empty":118,"type":7,"component-type":7}],
118: [function(require, module, exports) {
/**
* Expose `isEmpty`.
*/
module.exports = isEmpty;
/**
* Has.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Test whether a value is "empty".
*
* @param {Mixed} val
* @return {Boolean}
*/
function isEmpty (val) {
if (null == val) return true;
if ('number' == typeof val) return 0 === val;
if (undefined !== val.length) return 0 === val.length;
for (var key in val) if (has.call(val, key)) return false;
return true;
}
}, {}],
9: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var domify = require('domify');
var each = require('each');
/**
* HOP
*/
var has = Object.prototype.hasOwnProperty;
/**
* Expose `AdWords`.
*/
var AdWords = module.exports = integration('AdWords')
.option('conversionId', '')
.option('remarketing', false)
.tag('<script src="//www.googleadservices.com/pagead/conversion_async.js">')
.mapping('events');
/**
* Load.
*
* @param {Function} fn
* @api public
*/
AdWords.prototype.initialize = function(){
this.load(this.ready);
};
/**
* Loaded.
*
* @return {Boolean}
* @api public
*/
AdWords.prototype.loaded = function(){
return !! document.body;
};
/**
* Page.
*
* https://support.google.com/adwords/answer/3111920#standard_parameters
* https://support.google.com/adwords/answer/3103357
* https://developers.google.com/adwords-remarketing-tag/asynchronous/
* https://developers.google.com/adwords-remarketing-tag/parameters
*
* @param {Page} page
*/
AdWords.prototype.page = function(page){
var remarketing = !!this.options.remarketing;
var id = this.options.conversionId;
var props = {};
window.google_trackConversion({
google_conversion_id: id,
google_custom_params: props,
google_remarketing_only: remarketing
});
};
/**
* Track.
*
* @param {Track}
* @api public
*/
AdWords.prototype.track = function(track){
var id = this.options.conversionId;
var events = this.events(track.event());
var revenue = track.revenue() || 0;
each(events, function(label){
var props = track.properties();
window.google_trackConversion({
google_conversion_id: id,
// TODO
// google_custom_params: props,
google_conversion_language: 'en',
google_conversion_format: '3',
google_conversion_color: 'ffffff',
google_conversion_label: label,
google_conversion_value: revenue,
google_remarketing_only: false
});
});
};
}, {"analytics.js-integration":83,"domify":119,"each":4}],
119: [function(require, module, exports) {
/**
* Expose `parse`.
*/
module.exports = parse;
/**
* Wrap map from jquery.
*/
var map = {
legend: [1, '<fieldset>', '</fieldset>'],
tr: [2, '<table><tbody>', '</tbody></table>'],
col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
_default: [0, '', '']
};
map.td =
map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
map.option =
map.optgroup = [1, '<select multiple="multiple">', '</select>'];
map.thead =
map.tbody =
map.colgroup =
map.caption =
map.tfoot = [1, '<table>', '</table>'];
map.text =
map.circle =
map.ellipse =
map.line =
map.path =
map.polygon =
map.polyline =
map.rect = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'];
/**
* Parse `html` and return the children.
*
* @param {String} html
* @return {Array}
* @api private
*/
function parse(html) {
if ('string' != typeof html) throw new TypeError('String expected');
html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace
// tag name
var m = /<([\w:]+)/.exec(html);
if (!m) return document.createTextNode(html);
var tag = m[1];
// body support
if (tag == 'body') {
var el = document.createElement('html');
el.innerHTML = html;
return el.removeChild(el.lastChild);
}
// wrap map
var wrap = map[tag] || map._default;
var depth = wrap[0];
var prefix = wrap[1];
var suffix = wrap[2];
var el = document.createElement('div');
el.innerHTML = prefix + html + suffix;
while (depth--) el = el.lastChild;
// one element
if (el.firstChild == el.lastChild) {
return el.removeChild(el.firstChild);
}
// several elements
var fragment = document.createDocumentFragment();
while (el.firstChild) {
fragment.appendChild(el.removeChild(el.firstChild));
}
return fragment;
}
}, {}],
10: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose Alexa integration.
*/
var Alexa = module.exports = integration('Alexa')
.assumesPageview()
.global('_atrk_opts')
.option('account', null)
.option('domain', '')
.option('dynamic', true)
.tag('<script src="//d31qbv1cthcecs.cloudfront.net/atrk.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Alexa.prototype.initialize = function(page){
var self = this;
window._atrk_opts = {
atrk_acct: this.options.account,
domain: this.options.domain,
dynamic: this.options.dynamic
};
this.load(function(){
window.atrk();
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Alexa.prototype.loaded = function(){
return !! window.atrk;
};
}, {"analytics.js-integration":83}],
11: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `Amplitude` integration.
*/
var Amplitude = module.exports = integration('Amplitude')
.global('amplitude')
.option('apiKey', '')
.option('trackAllPages', false)
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.tag('<script src="https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-1.1-min.js">');
/**
* Initialize.
*
* https://github.com/amplitude/Amplitude-Javascript
*
* @param {Object} page
*/
Amplitude.prototype.initialize = function(page){
(function(e,t){var r=e.amplitude||{}; r._q=[];function i(e){r[e]=function(){r._q.push([e].concat(Array.prototype.slice.call(arguments,0)));};} var s=["init","logEvent","setUserId","setGlobalUserProperties","setVersionName","setDomain"]; for (var c=0;c<s.length;c++){i(s[c]);}e.amplitude=r;})(window,document);
window.amplitude.init(this.options.apiKey);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Amplitude.prototype.loaded = function(){
return !! (window.amplitude && window.amplitude.options);
};
/**
* Page.
*
* @param {Page} page
*/
Amplitude.prototype.page = function(page){
var properties = page.properties();
var category = page.category();
var name = page.fullName();
var opts = this.options;
// all pages
if (opts.trackAllPages) {
this.track(page.track());
}
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
};
/**
* Identify.
*
* @param {Facade} identify
*/
Amplitude.prototype.identify = function(identify){
var id = identify.userId();
var traits = identify.traits();
if (id) window.amplitude.setUserId(id);
if (traits) window.amplitude.setGlobalUserProperties(traits);
};
/**
* Track.
*
* @param {Track} event
*/
Amplitude.prototype.track = function(track){
var props = track.properties();
var event = track.event();
window.amplitude.logEvent(event, props);
};
}, {"analytics.js-integration":83}],
12: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var load = require('load-script');
var is = require('is');
/**
* Expose plugin.
*/
module.exports = exports = function (analytics) {
analytics.addIntegration(Appcues);
};
/**
* Expose `Appcues` integration.
*/
var Appcues = exports.Integration = integration('Appcues')
.assumesPageview()
.global('Appcues')
.global('AppcuesIdentity')
.option('appcuesId', '')
.option('userId', '')
.option('userEmail', '');
/**
* Initialize.
*
* http://appcues.com/docs/
*
* @param {Object}
*/
Appcues.prototype.initialize = function(){
this.load(function() {
window.Appcues.init();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Appcues.prototype.loaded = function(){
return is.object(window.Appcues);
};
/**
* Load the Appcues library.
*
* @param {Function} callback
*/
Appcues.prototype.load = function(callback){
var script = load('//d2dubfq97s02eu.cloudfront.net/appcues-bundle.min.js', callback);
script.setAttribute('data-appcues-id', this.options.appcuesId);
script.setAttribute('data-user-id', this.options.userId);
script.setAttribute('data-user-email', this.options.userEmail);
};
/**
* Identify.
*
* http://appcues.com/docs#identify
*
* @param {Identify} identify
*/
Appcues.prototype.identify = function(identify){
window.Appcues.identify(identify.traits());
};
}, {"analytics.js-integration":83,"load-script":120,"is":86}],
120: [function(require, module, exports) {
/**
* Module dependencies.
*/
var onload = require('script-onload');
var tick = require('next-tick');
var type = require('type');
/**
* Expose `loadScript`.
*
* @param {Object} options
* @param {Function} fn
* @api public
*/
module.exports = function loadScript(options, fn){
if (!options) throw new Error('Cant load nothing...');
// Allow for the simplest case, just passing a `src` string.
if ('string' == type(options)) options = { src : options };
var https = document.location.protocol === 'https:' ||
document.location.protocol === 'chrome-extension:';
// If you use protocol relative URLs, third-party scripts like Google
// Analytics break when testing with `file:` so this fixes that.
if (options.src && options.src.indexOf('//') === 0) {
options.src = https ? 'https:' + options.src : 'http:' + options.src;
}
// Allow them to pass in different URLs depending on the protocol.
if (https && options.https) options.src = options.https;
else if (!https && options.http) options.src = options.http;
// Make the `<script>` element and insert it before the first script on the
// page, which is guaranteed to exist since this Javascript is running.
var script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = options.src;
// If we have a fn, attach event handlers, even in IE. Based off of
// the Third-Party Javascript script loading example:
// https://github.com/thirdpartyjs/thirdpartyjs-code/blob/master/examples/templates/02/loading-files/index.html
if ('function' == type(fn)) {
onload(script, fn);
}
tick(function(){
// Append after event listeners are attached for IE.
var firstScript = document.getElementsByTagName('script')[0];
firstScript.parentNode.insertBefore(script, firstScript);
});
// Return the script element in case they want to do anything special, like
// give it an ID or attributes.
return script;
};
}, {"script-onload":108,"next-tick":97,"type":7}],
13: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var each = require('each');
/**
* Expose `Awesm` integration.
*/
var Awesm = module.exports = integration('awe.sm')
.assumesPageview()
.global('AWESM')
.option('apiKey', '')
.tag('<script src="//widgets.awe.sm/v3/widgets.js?key={{ apiKey }}&async=true">')
.mapping('events');
/**
* Initialize.
*
* http://developers.awe.sm/guides/javascript/
*
* @param {Object} page
*/
Awesm.prototype.initialize = function(page){
window.AWESM = { api_key: this.options.apiKey };
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Awesm.prototype.loaded = function(){
return !! (window.AWESM && window.AWESM._exists);
};
/**
* Track.
*
* @param {Track} track
*/
Awesm.prototype.track = function(track){
var user = this.analytics.user();
var goals = this.events(track.event());
each(goals, function(goal){
window.AWESM.convert(goal, track.cents(), null, user.id());
});
};
}, {"analytics.js-integration":83,"each":4}],
14: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var is = require('is');
var noop = function(){};
var onBody = require('on-body');
/**
* Expose `Awesomatic` integration.
*/
var Awesomatic = module.exports = integration('Awesomatic')
.assumesPageview()
.global('Awesomatic')
.global('AwesomaticSettings')
.global('AwsmSetup')
.global('AwsmTmp')
.option('appId', '')
.tag('<script src="https://1c817b7a15b6941337c0-dff9b5f4adb7ba28259631e99c3f3691.ssl.cf2.rackcdn.com/gen/embed.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Awesomatic.prototype.initialize = function(page){
var self = this;
var user = this.analytics.user();
var id = user.id();
var options = user.traits();
options.appId = this.options.appId;
if (id) options.user_id = id;
this.load(function(){
window.Awesomatic.initialize(options, function(){
self.ready(); // need to wait for initialize to callback
});
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Awesomatic.prototype.loaded = function(){
return is.object(window.Awesomatic);
};
}, {"analytics.js-integration":83,"is":86,"on-body":121}],
121: [function(require, module, exports) {
var each = require('each');
/**
* Cache whether `<body>` exists.
*/
var body = false;
/**
* Callbacks to call when the body exists.
*/
var callbacks = [];
/**
* Export a way to add handlers to be invoked once the body exists.
*
* @param {Function} callback A function to call when the body exists.
*/
module.exports = function onBody (callback) {
if (body) {
call(callback);
} else {
callbacks.push(callback);
}
};
/**
* Set an interval to check for `document.body`.
*/
var interval = setInterval(function () {
if (!document.body) return;
body = true;
each(callbacks, call);
clearInterval(interval);
}, 5);
/**
* Call a callback, passing it the body.
*
* @param {Function} callback The callback to call.
*/
function call (callback) {
callback(document.body);
}
}, {"each":106}],
15: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var onbody = require('on-body');
var domify = require('domify');
var extend = require('extend');
var bind = require('bind');
var when = require('when');
var each = require('each');
/**
* HOP.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Noop.
*/
var noop = function(){};
/**
* Expose `Bing`.
*
* https://bingads.microsoft.com/campaign/signup
*/
var Bing = module.exports = integration('Bing Ads')
.option('siteId', '')
.option('domainId', '')
.tag('<script id="mstag_tops" src="//flex.msn.com/mstag/site/{{ siteId }}/mstag.js">')
.mapping('events');
/**
* Initialize.
*
* http://msdn.microsoft.com/en-us/library/bing-ads-campaign-management-campaign-analytics-scripts.aspx
*
* @param {Object} page
*/
Bing.prototype.initialize = function(page){
if (!window.mstag) {
window.mstag = {
loadTag: noop,
time: (new Date()).getTime(),
// they use document.write, which doesn't work when loaded async.
// they provide a way to override it.
// the first time it is called, load the script,
// and only when that script is done, is "loading" done.
_write: writeToAppend
};
};
var self = this;
onbody(function(){
self.load(function(){
var loaded = bind(self, self.loaded);
// poll until this.loaded() is true.
// have to do a weird hack like this because
// the first script loads a second script,
// and only after the second script is it actually loaded.
when(loaded, self.ready);
});
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Bing.prototype.loaded = function(){
return !! (window.mstag && window.mstag.loadTag !== noop);
};
/**
* Track.
*
* @param {Track} track
*/
Bing.prototype.track = function(track){
var events = this.events(track.event());
var revenue = track.revenue() || 0;
var self = this;
each(events, function(goal){
window.mstag.loadTag('analytics', {
domainId: self.options.domainId,
revenue: revenue,
dedup: '1',
type: '1',
actionid: goal
});
});
};
/**
* Convert `document.write` to `document.appendChild`.
*
* TODO: make into a component.
*
* @param {String} str
*/
function writeToAppend(str) {
var first = document.getElementsByTagName('script')[0];
var el = domify(str);
// https://github.com/component/domify/issues/14
if ('script' == el.tagName.toLowerCase() && el.getAttribute('src')) {
var tmp = document.createElement('script');
tmp.src = el.getAttribute('src');
tmp.async = true;
el = tmp;
}
document.body.appendChild(el);
}
}, {"analytics.js-integration":83,"on-body":121,"domify":119,"extend":122,"bind":95,"when":123,"each":4}],
122: [function(require, module, exports) {
module.exports = function extend (object) {
// Takes an unlimited number of extenders.
var args = Array.prototype.slice.call(arguments, 1);
// For each extender, copy their properties on our object.
for (var i = 0, source; source = args[i]; i++) {
if (!source) continue;
for (var property in source) {
object[property] = source[property];
}
}
return object;
};
}, {}],
123: [function(require, module, exports) {
var callback = require('callback');
/**
* Expose `when`.
*/
module.exports = when;
/**
* Loop on a short interval until `condition()` is true, then call `fn`.
*
* @param {Function} condition
* @param {Function} fn
* @param {Number} interval (optional)
*/
function when (condition, fn, interval) {
if (condition()) return callback.async(fn);
var ref = setInterval(function () {
if (!condition()) return;
callback(fn);
clearInterval(ref);
}, interval || 10);
}
}, {"callback":88}],
16: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var Identify = require('facade').Identify;
var Track = require('facade').Track;
var pixel = require('load-pixel')('http://app.bronto.com/public/');
var qs = require('querystring');
var each = require('each');
/**
* Expose `Bronto` integration.
*/
var Bronto = module.exports = integration('Bronto')
.global('__bta')
.option('siteId', '')
.option('host', '')
.tag('<script src="//p.bm23.com/bta.js">');
/**
* Initialize.
*
* http://app.bronto.com/mail/help/help_view/?k=mail:home:api_tracking:tracking_data_store_js#addingjavascriptconversiontrackingtoyoursite
* http://bronto.com/product-blog/features/using-conversion-tracking-private-domain#.Ut_Vk2T8KqB
* http://bronto.com/product-blog/features/javascript-conversion-tracking-setup-and-reporting#.Ut_VhmT8KqB
*
* @param {Object} page
*/
Bronto.prototype.initialize = function(page){
var self = this;
var params = qs.parse(window.location.search);
if (!params._bta_tid && !params._bta_c) {
this.debug('missing tracking URL parameters `_bta_tid` and `_bta_c`.');
}
this.load(function(){
var opts = self.options;
self.bta = new window.__bta(opts.siteId);
if (opts.host) self.bta.setHost(opts.host);
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Bronto.prototype.loaded = function(){
return this.bta;
};
/**
* Completed order.
*
* The cookie is used to link the order being processed back to the delivery,
* message, and contact which makes it a conversion.
* Passing in just the email ensures that the order itself
* gets linked to the contact record in Bronto even if the user
* does not have a tracking cookie.
*
* @param {Track} track
* @api private
*/
Bronto.prototype.completedOrder = function(track){
var user = this.analytics.user();
var products = track.products();
var props = track.properties();
var items = [];
var identify = new Identify({
userId: user.id(),
traits: user.traits()
});
var email = identify.email();
// items
each(products, function(product){
var track = new Track({ properties: product });
items.push({
item_id: track.id() || track.sku(),
desc: product.description || track.name(),
quantity: track.quantity(),
amount: track.price(),
});
});
// add conversion
this.bta.addOrder({
order_id: track.orderId(),
email: email,
// they recommend not putting in a date
// because it needs to be formatted correctly
// YYYY-MM-DDTHH:MM:SS
items: items
});
};
}, {"analytics.js-integration":83,"facade":124,"load-pixel":125,"querystring":126,"each":4}],
124: [function(require, module, exports) {
var Facade = require('./facade');
/**
* Expose `Facade` facade.
*/
module.exports = Facade;
/**
* Expose specific-method facades.
*/
Facade.Alias = require('./alias');
Facade.Group = require('./group');
Facade.Identify = require('./identify');
Facade.Track = require('./track');
Facade.Page = require('./page');
Facade.Screen = require('./screen');
}, {"./facade":127,"./alias":128,"./group":129,"./identify":130,"./track":131,"./page":132,"./screen":133}],
127: [function(require, module, exports) {
var traverse = require('isodate-traverse');
var isEnabled = require('./is-enabled');
var clone = require('./utils').clone;
var type = require('./utils').type;
var address = require('./address');
var objCase = require('obj-case');
var newDate = require('new-date');
/**
* Expose `Facade`.
*/
module.exports = Facade;
/**
* Initialize a new `Facade` with an `obj` of arguments.
*
* @param {Object} obj
*/
function Facade (obj) {
if (!obj.hasOwnProperty('timestamp')) obj.timestamp = new Date();
else obj.timestamp = newDate(obj.timestamp);
traverse(obj);
this.obj = obj;
}
/**
* Mixin address traits.
*/
address(Facade.prototype);
/**
* Return a proxy function for a `field` that will attempt to first use methods,
* and fallback to accessing the underlying object directly. You can specify
* deeply nested fields too like:
*
* this.proxy('options.Librato');
*
* @param {String} field
*/
Facade.prototype.proxy = function (field) {
var fields = field.split('.');
field = fields.shift();
// Call a function at the beginning to take advantage of facaded fields
var obj = this[field] || this.field(field);
if (!obj) return obj;
if (typeof obj === 'function') obj = obj.call(this) || {};
if (fields.length === 0) return transform(obj);
obj = objCase(obj, fields.join('.'));
return transform(obj);
};
/**
* Directly access a specific `field` from the underlying object, returning a
* clone so outsiders don't mess with stuff.
*
* @param {String} field
* @return {Mixed}
*/
Facade.prototype.field = function (field) {
var obj = this.obj[field];
return transform(obj);
};
/**
* Utility method to always proxy a particular `field`. You can specify deeply
* nested fields too like:
*
* Facade.proxy('options.Librato');
*
* @param {String} field
* @return {Function}
*/
Facade.proxy = function (field) {
return function () {
return this.proxy(field);
};
};
/**
* Utility method to directly access a `field`.
*
* @param {String} field
* @return {Function}
*/
Facade.field = function (field) {
return function () {
return this.field(field);
};
};
/**
* Proxy multiple `path`.
*
* @param {String} path
* @return {Array}
*/
Facade.multi = function(path){
return function(){
var multi = this.proxy(path + 's');
if ('array' == type(multi)) return multi;
var one = this.proxy(path);
if (one) one = [clone(one)];
return one || [];
};
};
/**
* Proxy one `path`.
*
* @param {String} path
* @return {Mixed}
*/
Facade.one = function(path){
return function(){
var one = this.proxy(path);
if (one) return one;
var multi = this.proxy(path + 's');
if ('array' == type(multi)) return multi[0];
};
};
/**
* Get the basic json object of this facade.
*
* @return {Object}
*/
Facade.prototype.json = function () {
var ret = clone(this.obj);
if (this.type) ret.type = this.type();
return ret;
};
/**
* Get the options of a call (formerly called "context"). If you pass an
* integration name, it will get the options for that specific integration, or
* undefined if the integration is not enabled.
*
* @param {String} integration (optional)
* @return {Object or Null}
*/
Facade.prototype.context =
Facade.prototype.options = function (integration) {
var options = clone(this.obj.options || this.obj.context) || {};
if (!integration) return clone(options);
if (!this.enabled(integration)) return;
var integrations = this.integrations();
var value = integrations[integration] || objCase(integrations, integration);
if ('boolean' == typeof value) value = {};
return value || {};
};
/**
* Check whether an integration is enabled.
*
* @param {String} integration
* @return {Boolean}
*/
Facade.prototype.enabled = function (integration) {
var allEnabled = this.proxy('options.providers.all');
if (typeof allEnabled !== 'boolean') allEnabled = this.proxy('options.all');
if (typeof allEnabled !== 'boolean') allEnabled = this.proxy('integrations.all');
if (typeof allEnabled !== 'boolean') allEnabled = true;
var enabled = allEnabled && isEnabled(integration);
var options = this.integrations();
// If the integration is explicitly enabled or disabled, use that
// First, check options.providers for backwards compatibility
if (options.providers && options.providers.hasOwnProperty(integration)) {
enabled = options.providers[integration];
}
// Next, check for the integration's existence in 'options' to enable it.
// If the settings are a boolean, use that, otherwise it should be enabled.
if (options.hasOwnProperty(integration)) {
var settings = options[integration];
if (typeof settings === 'boolean') {
enabled = settings;
} else {
enabled = true;
}
}
return enabled ? true : false;
};
/**
* Get all `integration` options.
*
* @param {String} integration
* @return {Object}
* @api private
*/
Facade.prototype.integrations = function(){
return this.obj.integrations
|| this.proxy('options.providers')
|| this.options();
};
/**
* Check whether the user is active.
*
* @return {Boolean}
*/
Facade.prototype.active = function () {
var active = this.proxy('options.active');
if (active === null || active === undefined) active = true;
return active;
};
/**
* Get `sessionId / anonymousId`.
*
* @return {Mixed}
* @api public
*/
Facade.prototype.sessionId =
Facade.prototype.anonymousId = function(){
return this.field('anonymousId')
|| this.field('sessionId');
};
/**
* Get `groupId` from `context.groupId`.
*
* @return {String}
* @api public
*/
Facade.prototype.groupId = Facade.proxy('options.groupId');
/**
* Get the call's "super properties" which are just traits that have been
* passed in as if from an identify call.
*
* @param {Object} aliases
* @return {Object}
*/
Facade.prototype.traits = function (aliases) {
var ret = this.proxy('options.traits') || {};
var id = this.userId();
aliases = aliases || {};
if (id) ret.id = id;
for (var alias in aliases) {
var value = null == this[alias]
? this.proxy('options.traits.' + alias)
: this[alias]();
if (null == value) continue;
ret[aliases[alias]] = value;
delete ret[alias];
}
return ret;
};
/**
* Add a convenient way to get the library name and version
*/
Facade.prototype.library = function(){
var library = this.proxy('options.library');
if (!library) return { name: 'unknown', version: null };
if (typeof library === 'string') return { name: library, version: null };
return library;
};
/**
* Setup some basic proxies.
*/
Facade.prototype.userId = Facade.field('userId');
Facade.prototype.channel = Facade.field('channel');
Facade.prototype.timestamp = Facade.field('timestamp');
Facade.prototype.userAgent = Facade.proxy('options.userAgent');
Facade.prototype.ip = Facade.proxy('options.ip');
/**
* Return the cloned and traversed object
*
* @param {Mixed} obj
* @return {Mixed}
*/
function transform(obj){
var cloned = clone(obj);
return cloned;
}
}, {"isodate-traverse":134,"./is-enabled":135,"./utils":136,"./address":137,"obj-case":138,"new-date":139}],
134: [function(require, module, exports) {
var is = require('is');
var isodate = require('isodate');
var each;
try {
each = require('each');
} catch (err) {
each = require('each-component');
}
/**
* Expose `traverse`.
*/
module.exports = traverse;
/**
* Traverse an object or array, and return a clone with all ISO strings parsed
* into Date objects.
*
* @param {Object} obj
* @return {Object}
*/
function traverse (input, strict) {
if (strict === undefined) strict = true;
if (is.object(input)) return object(input, strict);
if (is.array(input)) return array(input, strict);
return input;
}
/**
* Object traverser.
*
* @param {Object} obj
* @param {Boolean} strict
* @return {Object}
*/
function object (obj, strict) {
each(obj, function (key, val) {
if (isodate.is(val, strict)) {
obj[key] = isodate.parse(val);
} else if (is.object(val) || is.array(val)) {
traverse(val, strict);
}
});
return obj;
}
/**
* Array traverser.
*
* @param {Array} arr
* @param {Boolean} strict
* @return {Array}
*/
function array (arr, strict) {
each(arr, function (val, x) {
if (is.object(val)) {
traverse(val, strict);
} else if (isodate.is(val, strict)) {
arr[x] = isodate.parse(val);
}
});
return arr;
}
}, {"is":140,"isodate":141,"each":4}],
140: [function(require, module, exports) {
var isEmpty = require('is-empty');
try {
var typeOf = require('type');
} catch (e) {
var typeOf = require('component-type');
}
/**
* Types.
*/
var types = [
'arguments',
'array',
'boolean',
'date',
'element',
'function',
'null',
'number',
'object',
'regexp',
'string',
'undefined'
];
/**
* Expose type checkers.
*
* @param {Mixed} value
* @return {Boolean}
*/
for (var i = 0, type; type = types[i]; i++) exports[type] = generate(type);
/**
* Add alias for `function` for old browsers.
*/
exports.fn = exports['function'];
/**
* Expose `empty` check.
*/
exports.empty = isEmpty;
/**
* Expose `nan` check.
*/
exports.nan = function (val) {
return exports.number(val) && val != val;
};
/**
* Generate a type checker.
*
* @param {String} type
* @return {Function}
*/
function generate (type) {
return function (value) {
return type === typeOf(value);
};
}
}, {"is-empty":118,"type":7,"component-type":7}],
141: [function(require, module, exports) {
/**
* Matcher, slightly modified from:
*
* https://github.com/csnover/js-iso8601/blob/lax/iso8601.js
*/
var matcher = /^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;
/**
* Convert an ISO date string to a date. Fallback to native `Date.parse`.
*
* https://github.com/csnover/js-iso8601/blob/lax/iso8601.js
*
* @param {String} iso
* @return {Date}
*/
exports.parse = function (iso) {
var numericKeys = [1, 5, 6, 7, 11, 12];
var arr = matcher.exec(iso);
var offset = 0;
// fallback to native parsing
if (!arr) return new Date(iso);
// remove undefined values
for (var i = 0, val; val = numericKeys[i]; i++) {
arr[val] = parseInt(arr[val], 10) || 0;
}
// allow undefined days and months
arr[2] = parseInt(arr[2], 10) || 1;
arr[3] = parseInt(arr[3], 10) || 1;
// month is 0-11
arr[2]--;
// allow abitrary sub-second precision
arr[8] = arr[8]
? (arr[8] + '00').substring(0, 3)
: 0;
// apply timezone if one exists
if (arr[4] == ' ') {
offset = new Date().getTimezoneOffset();
} else if (arr[9] !== 'Z' && arr[10]) {
offset = arr[11] * 60 + arr[12];
if ('+' == arr[10]) offset = 0 - offset;
}
var millis = Date.UTC(arr[1], arr[2], arr[3], arr[5], arr[6] + offset, arr[7], arr[8]);
return new Date(millis);
};
/**
* Checks whether a `string` is an ISO date string. `strict` mode requires that
* the date string at least have a year, month and date.
*
* @param {String} string
* @param {Boolean} strict
* @return {Boolean}
*/
exports.is = function (string, strict) {
if (strict && false === /^\d{4}-\d{2}-\d{2}/.test(string)) return false;
return matcher.test(string);
};
}, {}],
135: [function(require, module, exports) {
/**
* A few integrations are disabled by default. They must be explicitly
* enabled by setting options[Provider] = true.
*/
var disabled = {
Salesforce: true
};
/**
* Check whether an integration should be enabled by default.
*
* @param {String} integration
* @return {Boolean}
*/
module.exports = function (integration) {
return ! disabled[integration];
};
}, {}],
136: [function(require, module, exports) {
/**
* TODO: use component symlink, everywhere ?
*/
try {
exports.inherit = require('inherit');
exports.clone = require('clone');
exports.type = require('type');
} catch (e) {
exports.inherit = require('inherit-component');
exports.clone = require('clone-component');
exports.type = require('type-component');
}
}, {"inherit":142,"clone":143,"type":7}],
142: [function(require, module, exports) {
module.exports = function(a, b){
var fn = function(){};
fn.prototype = b.prototype;
a.prototype = new fn;
a.prototype.constructor = a;
};
}, {}],
143: [function(require, module, exports) {
/**
* Module dependencies.
*/
var type;
try {
type = require('component-type');
} catch (_) {
type = require('type');
}
/**
* Module exports.
*/
module.exports = clone;
/**
* Clones objects.
*
* @param {Mixed} any object
* @api public
*/
function clone(obj){
switch (type(obj)) {
case 'object':
var copy = {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
copy[key] = clone(obj[key]);
}
}
return copy;
case 'array':
var copy = new Array(obj.length);
for (var i = 0, l = obj.length; i < l; i++) {
copy[i] = clone(obj[i]);
}
return copy;
case 'regexp':
// from millermedeiros/amd-utils - MIT
var flags = '';
flags += obj.multiline ? 'm' : '';
flags += obj.global ? 'g' : '';
flags += obj.ignoreCase ? 'i' : '';
return new RegExp(obj.source, flags);
case 'date':
return new Date(obj.getTime());
default: // string, number, boolean, …
return obj;
}
}
}, {"component-type":7,"type":7}],
137: [function(require, module, exports) {
/**
* Module dependencies.
*/
var get = require('obj-case');
/**
* Add address getters to `proto`.
*
* @param {Function} proto
*/
module.exports = function(proto){
proto.zip = trait('postalCode', 'zip');
proto.country = trait('country');
proto.street = trait('street');
proto.state = trait('state');
proto.city = trait('city');
function trait(a, b){
return function(){
var traits = this.traits();
return get(traits, 'address.' + a)
|| get(traits, a)
|| (b ? get(traits, 'address.' + b) : null)
|| (b ? get(traits, b) : null);
};
}
};
}, {"obj-case":138}],
138: [function(require, module, exports) {
var Case = require('case');
var identity = function(_){ return _; };
/**
* Cases
*/
var cases = [
identity,
Case.upper,
Case.lower,
Case.snake,
Case.pascal,
Case.camel,
Case.constant,
Case.title,
Case.capital,
Case.sentence
];
/**
* Module exports, export
*/
module.exports = module.exports.find = multiple(find);
/**
* Export the replacement function, return the modified object
*/
module.exports.replace = function (obj, key, val) {
multiple(replace).apply(this, arguments);
return obj;
};
/**
* Export the delete function, return the modified object
*/
module.exports.del = function (obj, key) {
multiple(del).apply(this, arguments);
return obj;
};
/**
* Compose applying the function to a nested key
*/
function multiple (fn) {
return function (obj, key, val) {
var keys = key.split('.');
if (keys.length === 0) return;
while (keys.length > 1) {
key = keys.shift();
obj = find(obj, key);
if (obj === null || obj === undefined) return;
}
key = keys.shift();
return fn(obj, key, val);
};
}
/**
* Find an object by its key
*
* find({ first_name : 'Calvin' }, 'firstName')
*/
function find (obj, key) {
for (var i = 0; i < cases.length; i++) {
var cased = cases[i](key);
if (obj.hasOwnProperty(cased)) return obj[cased];
}
}
/**
* Delete a value for a given key
*
* del({ a : 'b', x : 'y' }, 'X' }) -> { a : 'b' }
*/
function del (obj, key) {
for (var i = 0; i < cases.length; i++) {
var cased = cases[i](key);
if (obj.hasOwnProperty(cased)) delete obj[cased];
}
return obj;
}
/**
* Replace an objects existing value with a new one
*
* replace({ a : 'b' }, 'a', 'c') -> { a : 'c' }
*/
function replace (obj, key, val) {
for (var i = 0; i < cases.length; i++) {
var cased = cases[i](key);
if (obj.hasOwnProperty(cased)) obj[cased] = val;
}
return obj;
}
}, {"case":144}],
144: [function(require, module, exports) {
var cases = require('./cases');
/**
* Expose `determineCase`.
*/
module.exports = exports = determineCase;
/**
* Determine the case of a `string`.
*
* @param {String} string
* @return {String|Null}
*/
function determineCase (string) {
for (var key in cases) {
if (key == 'none') continue;
var convert = cases[key];
if (convert(string) == string) return key;
}
return null;
}
/**
* Define a case by `name` with a `convert` function.
*
* @param {String} name
* @param {Object} convert
*/
exports.add = function (name, convert) {
exports[name] = cases[name] = convert;
};
/**
* Add all the `cases`.
*/
for (var key in cases) {
exports.add(key, cases[key]);
}
}, {"./cases":145}],
145: [function(require, module, exports) {
var camel = require('to-camel-case')
, capital = require('to-capital-case')
, constant = require('to-constant-case')
, dot = require('to-dot-case')
, none = require('to-no-case')
, pascal = require('to-pascal-case')
, sentence = require('to-sentence-case')
, slug = require('to-slug-case')
, snake = require('to-snake-case')
, space = require('to-space-case')
, title = require('to-title-case');
/**
* Camel.
*/
exports.camel = camel;
/**
* Pascal.
*/
exports.pascal = pascal;
/**
* Dot. Should precede lowercase.
*/
exports.dot = dot;
/**
* Slug. Should precede lowercase.
*/
exports.slug = slug;
/**
* Snake. Should precede lowercase.
*/
exports.snake = snake;
/**
* Space. Should precede lowercase.
*/
exports.space = space;
/**
* Constant. Should precede uppercase.
*/
exports.constant = constant;
/**
* Capital. Should precede sentence and title.
*/
exports.capital = capital;
/**
* Title.
*/
exports.title = title;
/**
* Sentence.
*/
exports.sentence = sentence;
/**
* Convert a `string` to lower case from camel, slug, etc. Different that the
* usual `toLowerCase` in that it will try to break apart the input first.
*
* @param {String} string
* @return {String}
*/
exports.lower = function (string) {
return none(string).toLowerCase();
};
/**
* Convert a `string` to upper case from camel, slug, etc. Different that the
* usual `toUpperCase` in that it will try to break apart the input first.
*
* @param {String} string
* @return {String}
*/
exports.upper = function (string) {
return none(string).toUpperCase();
};
/**
* Invert each character in a `string` from upper to lower and vice versa.
*
* @param {String} string
* @return {String}
*/
exports.inverse = function (string) {
for (var i = 0, char; char = string[i]; i++) {
if (!/[a-z]/i.test(char)) continue;
var upper = char.toUpperCase();
var lower = char.toLowerCase();
string[i] = char == upper ? lower : upper;
}
return string;
};
/**
* None.
*/
exports.none = none;
}, {"to-camel-case":146,"to-capital-case":147,"to-constant-case":148,"to-dot-case":149,"to-no-case":117,"to-pascal-case":150,"to-sentence-case":151,"to-slug-case":152,"to-snake-case":153,"to-space-case":154,"to-title-case":155}],
146: [function(require, module, exports) {
var toSpace = require('to-space-case');
/**
* Expose `toCamelCase`.
*/
module.exports = toCamelCase;
/**
* Convert a `string` to camel case.
*
* @param {String} string
* @return {String}
*/
function toCamelCase (string) {
return toSpace(string).replace(/\s(\w)/g, function (matches, letter) {
return letter.toUpperCase();
});
}
}, {"to-space-case":154}],
154: [function(require, module, exports) {
var clean = require('to-no-case');
/**
* Expose `toSpaceCase`.
*/
module.exports = toSpaceCase;
/**
* Convert a `string` to space case.
*
* @param {String} string
* @return {String}
*/
function toSpaceCase (string) {
return clean(string).replace(/[\W_]+(.|$)/g, function (matches, match) {
return match ? ' ' + match : '';
});
}
}, {"to-no-case":117}],
147: [function(require, module, exports) {
var clean = require('to-no-case');
/**
* Expose `toCapitalCase`.
*/
module.exports = toCapitalCase;
/**
* Convert a `string` to capital case.
*
* @param {String} string
* @return {String}
*/
function toCapitalCase (string) {
return clean(string).replace(/(^|\s)(\w)/g, function (matches, previous, letter) {
return previous + letter.toUpperCase();
});
}
}, {"to-no-case":117}],
148: [function(require, module, exports) {
var snake = require('to-snake-case');
/**
* Expose `toConstantCase`.
*/
module.exports = toConstantCase;
/**
* Convert a `string` to constant case.
*
* @param {String} string
* @return {String}
*/
function toConstantCase (string) {
return snake(string).toUpperCase();
}
}, {"to-snake-case":153}],
153: [function(require, module, exports) {
var toSpace = require('to-space-case');
/**
* Expose `toSnakeCase`.
*/
module.exports = toSnakeCase;
/**
* Convert a `string` to snake case.
*
* @param {String} string
* @return {String}
*/
function toSnakeCase (string) {
return toSpace(string).replace(/\s/g, '_');
}
}, {"to-space-case":154}],
149: [function(require, module, exports) {
var toSpace = require('to-space-case');
/**
* Expose `toDotCase`.
*/
module.exports = toDotCase;
/**
* Convert a `string` to slug case.
*
* @param {String} string
* @return {String}
*/
function toDotCase (string) {
return toSpace(string).replace(/\s/g, '.');
}
}, {"to-space-case":154}],
150: [function(require, module, exports) {
var toSpace = require('to-space-case');
/**
* Expose `toPascalCase`.
*/
module.exports = toPascalCase;
/**
* Convert a `string` to pascal case.
*
* @param {String} string
* @return {String}
*/
function toPascalCase (string) {
return toSpace(string).replace(/(?:^|\s)(\w)/g, function (matches, letter) {
return letter.toUpperCase();
});
}
}, {"to-space-case":154}],
151: [function(require, module, exports) {
var clean = require('to-no-case');
/**
* Expose `toSentenceCase`.
*/
module.exports = toSentenceCase;
/**
* Convert a `string` to camel case.
*
* @param {String} string
* @return {String}
*/
function toSentenceCase (string) {
return clean(string).replace(/[a-z]/i, function (letter) {
return letter.toUpperCase();
});
}
}, {"to-no-case":117}],
152: [function(require, module, exports) {
var toSpace = require('to-space-case');
/**
* Expose `toSlugCase`.
*/
module.exports = toSlugCase;
/**
* Convert a `string` to slug case.
*
* @param {String} string
* @return {String}
*/
function toSlugCase (string) {
return toSpace(string).replace(/\s/g, '-');
}
}, {"to-space-case":154}],
155: [function(require, module, exports) {
var capital = require('to-capital-case')
, escape = require('escape-regexp')
, map = require('map')
, minors = require('title-case-minors');
/**
* Expose `toTitleCase`.
*/
module.exports = toTitleCase;
/**
* Minors.
*/
var escaped = map(minors, escape);
var minorMatcher = new RegExp('[^^]\\b(' + escaped.join('|') + ')\\b', 'ig');
var colonMatcher = /:\s*(\w)/g;
/**
* Convert a `string` to camel case.
*
* @param {String} string
* @return {String}
*/
function toTitleCase (string) {
return capital(string)
.replace(minorMatcher, function (minor) {
return minor.toLowerCase();
})
.replace(colonMatcher, function (letter) {
return letter.toUpperCase();
});
}
}, {"to-capital-case":147,"escape-regexp":156,"map":157,"title-case-minors":158}],
156: [function(require, module, exports) {
/**
* Escape regexp special characters in `str`.
*
* @param {String} str
* @return {String}
* @api public
*/
module.exports = function(str){
return String(str).replace(/([.*+?=^!:${}()|[\]\/\\])/g, '\\$1');
};
}, {}],
157: [function(require, module, exports) {
var each = require('each');
/**
* Map an array or object.
*
* @param {Array|Object} obj
* @param {Function} iterator
* @return {Mixed}
*/
module.exports = function map (obj, iterator) {
var arr = [];
each(obj, function (o) {
arr.push(iterator.apply(null, arguments));
});
return arr;
};
}, {"each":106}],
158: [function(require, module, exports) {
module.exports = [
'a',
'an',
'and',
'as',
'at',
'but',
'by',
'en',
'for',
'from',
'how',
'if',
'in',
'neither',
'nor',
'of',
'on',
'only',
'onto',
'out',
'or',
'per',
'so',
'than',
'that',
'the',
'to',
'until',
'up',
'upon',
'v',
'v.',
'versus',
'vs',
'vs.',
'via',
'when',
'with',
'without',
'yet'
];
}, {}],
139: [function(require, module, exports) {
var is = require('is');
var isodate = require('isodate');
var milliseconds = require('./milliseconds');
var seconds = require('./seconds');
/**
* Returns a new Javascript Date object, allowing a variety of extra input types
* over the native Date constructor.
*
* @param {Date|String|Number} val
*/
module.exports = function newDate (val) {
if (is.date(val)) return val;
if (is.number(val)) return new Date(toMs(val));
// date strings
if (isodate.is(val)) return isodate.parse(val);
if (milliseconds.is(val)) return milliseconds.parse(val);
if (seconds.is(val)) return seconds.parse(val);
// fallback to Date.parse
return new Date(val);
};
/**
* If the number passed val is seconds from the epoch, turn it into milliseconds.
* Milliseconds would be greater than 31557600000 (December 31, 1970).
*
* @param {Number} num
*/
function toMs (num) {
if (num < 31557600000) return num * 1000;
return num;
}
}, {"is":159,"isodate":141,"./milliseconds":160,"./seconds":161}],
159: [function(require, module, exports) {
var isEmpty = require('is-empty')
, typeOf = require('type');
/**
* Types.
*/
var types = [
'arguments',
'array',
'boolean',
'date',
'element',
'function',
'null',
'number',
'object',
'regexp',
'string',
'undefined'
];
/**
* Expose type checkers.
*
* @param {Mixed} value
* @return {Boolean}
*/
for (var i = 0, type; type = types[i]; i++) exports[type] = generate(type);
/**
* Add alias for `function` for old browsers.
*/
exports.fn = exports['function'];
/**
* Expose `empty` check.
*/
exports.empty = isEmpty;
/**
* Expose `nan` check.
*/
exports.nan = function (val) {
return exports.number(val) && val != val;
};
/**
* Generate a type checker.
*
* @param {String} type
* @return {Function}
*/
function generate (type) {
return function (value) {
return type === typeOf(value);
};
}
}, {"is-empty":118,"type":7}],
160: [function(require, module, exports) {
/**
* Matcher.
*/
var matcher = /\d{13}/;
/**
* Check whether a string is a millisecond date string.
*
* @param {String} string
* @return {Boolean}
*/
exports.is = function (string) {
return matcher.test(string);
};
/**
* Convert a millisecond string to a date.
*
* @param {String} millis
* @return {Date}
*/
exports.parse = function (millis) {
millis = parseInt(millis, 10);
return new Date(millis);
};
}, {}],
161: [function(require, module, exports) {
/**
* Matcher.
*/
var matcher = /\d{10}/;
/**
* Check whether a string is a second date string.
*
* @param {String} string
* @return {Boolean}
*/
exports.is = function (string) {
return matcher.test(string);
};
/**
* Convert a second string to a date.
*
* @param {String} seconds
* @return {Date}
*/
exports.parse = function (seconds) {
var millis = parseInt(seconds, 10) * 1000;
return new Date(millis);
};
}, {}],
128: [function(require, module, exports) {
/**
* Module dependencies.
*/
var inherit = require('./utils').inherit;
var Facade = require('./facade');
/**
* Expose `Alias` facade.
*/
module.exports = Alias;
/**
* Initialize a new `Alias` facade with a `dictionary` of arguments.
*
* @param {Object} dictionary
* @property {String} from
* @property {String} to
* @property {Object} options
*/
function Alias (dictionary) {
Facade.call(this, dictionary);
}
/**
* Inherit from `Facade`.
*/
inherit(Alias, Facade);
/**
* Return type of facade.
*
* @return {String}
*/
Alias.prototype.type =
Alias.prototype.action = function () {
return 'alias';
};
/**
* Get `previousId`.
*
* @return {Mixed}
* @api public
*/
Alias.prototype.from =
Alias.prototype.previousId = function(){
return this.field('previousId')
|| this.field('from');
};
/**
* Get `userId`.
*
* @return {String}
* @api public
*/
Alias.prototype.to =
Alias.prototype.userId = function(){
return this.field('userId')
|| this.field('to');
};
}, {"./utils":136,"./facade":127}],
129: [function(require, module, exports) {
/**
* Module dependencies.
*/
var inherit = require('./utils').inherit;
var address = require('./address');
var isEmail = require('is-email');
var newDate = require('new-date');
var Facade = require('./facade');
/**
* Expose `Group` facade.
*/
module.exports = Group;
/**
* Initialize a new `Group` facade with a `dictionary` of arguments.
*
* @param {Object} dictionary
* @param {String} userId
* @param {String} groupId
* @param {Object} properties
* @param {Object} options
*/
function Group (dictionary) {
Facade.call(this, dictionary);
}
/**
* Inherit from `Facade`
*/
inherit(Group, Facade);
/**
* Get the facade's action.
*/
Group.prototype.type =
Group.prototype.action = function () {
return 'group';
};
/**
* Setup some basic proxies.
*/
Group.prototype.groupId = Facade.field('groupId');
/**
* Get created or createdAt.
*
* @return {Date}
*/
Group.prototype.created = function(){
var created = this.proxy('traits.createdAt')
|| this.proxy('traits.created')
|| this.proxy('properties.createdAt')
|| this.proxy('properties.created');
if (created) return newDate(created);
};
/**
* Get the group's email, falling back to the group ID if it's a valid email.
*
* @return {String}
*/
Group.prototype.email = function () {
var email = this.proxy('traits.email');
if (email) return email;
var groupId = this.groupId();
if (isEmail(groupId)) return groupId;
};
/**
* Get the group's traits.
*
* @param {Object} aliases
* @return {Object}
*/
Group.prototype.traits = function (aliases) {
var ret = this.properties();
var id = this.groupId();
aliases = aliases || {};
if (id) ret.id = id;
for (var alias in aliases) {
var value = null == this[alias]
? this.proxy('traits.' + alias)
: this[alias]();
if (null == value) continue;
ret[aliases[alias]] = value;
delete ret[alias];
}
return ret;
};
/**
* Special traits.
*/
Group.prototype.name = Facade.proxy('traits.name');
Group.prototype.industry = Facade.proxy('traits.industry');
Group.prototype.employees = Facade.proxy('traits.employees');
/**
* Get traits or properties.
*
* TODO: remove me
*
* @return {Object}
*/
Group.prototype.properties = function(){
return this.field('traits')
|| this.field('properties')
|| {};
};
}, {"./utils":136,"./address":137,"is-email":162,"new-date":139,"./facade":127}],
162: [function(require, module, exports) {
/**
* Expose `isEmail`.
*/
module.exports = isEmail;
/**
* Email address matcher.
*/
var matcher = /.+\@.+\..+/;
/**
* Loosely validate an email address.
*
* @param {String} string
* @return {Boolean}
*/
function isEmail (string) {
return matcher.test(string);
}
}, {}],
130: [function(require, module, exports) {
var address = require('./address');
var Facade = require('./facade');
var isEmail = require('is-email');
var newDate = require('new-date');
var utils = require('./utils');
var get = require('obj-case');
var trim = require('trim');
var inherit = utils.inherit;
var clone = utils.clone;
var type = utils.type;
/**
* Expose `Idenfity` facade.
*/
module.exports = Identify;
/**
* Initialize a new `Identify` facade with a `dictionary` of arguments.
*
* @param {Object} dictionary
* @param {String} userId
* @param {String} sessionId
* @param {Object} traits
* @param {Object} options
*/
function Identify (dictionary) {
Facade.call(this, dictionary);
}
/**
* Inherit from `Facade`.
*/
inherit(Identify, Facade);
/**
* Get the facade's action.
*/
Identify.prototype.type =
Identify.prototype.action = function () {
return 'identify';
};
/**
* Get the user's traits.
*
* @param {Object} aliases
* @return {Object}
*/
Identify.prototype.traits = function (aliases) {
var ret = this.field('traits') || {};
var id = this.userId();
aliases = aliases || {};
if (id) ret.id = id;
for (var alias in aliases) {
var value = null == this[alias]
? this.proxy('traits.' + alias)
: this[alias]();
if (null == value) continue;
ret[aliases[alias]] = value;
if (alias !== aliases[alias]) delete ret[alias];
}
return ret;
};
/**
* Get the user's email, falling back to their user ID if it's a valid email.
*
* @return {String}
*/
Identify.prototype.email = function () {
var email = this.proxy('traits.email');
if (email) return email;
var userId = this.userId();
if (isEmail(userId)) return userId;
};
/**
* Get the user's created date, optionally looking for `createdAt` since lots of
* people do that instead.
*
* @return {Date or Undefined}
*/
Identify.prototype.created = function () {
var created = this.proxy('traits.created') || this.proxy('traits.createdAt');
if (created) return newDate(created);
};
/**
* Get the company created date.
*
* @return {Date or undefined}
*/
Identify.prototype.companyCreated = function(){
var created = this.proxy('traits.company.created')
|| this.proxy('traits.company.createdAt');
if (created) return newDate(created);
};
/**
* Get the user's name, optionally combining a first and last name if that's all
* that was provided.
*
* @return {String or Undefined}
*/
Identify.prototype.name = function () {
var name = this.proxy('traits.name');
if (typeof name === 'string') return trim(name);
var firstName = this.firstName();
var lastName = this.lastName();
if (firstName && lastName) return trim(firstName + ' ' + lastName);
};
/**
* Get the user's first name, optionally splitting it out of a single name if
* that's all that was provided.
*
* @return {String or Undefined}
*/
Identify.prototype.firstName = function () {
var firstName = this.proxy('traits.firstName');
if (typeof firstName === 'string') return trim(firstName);
var name = this.proxy('traits.name');
if (typeof name === 'string') return trim(name).split(' ')[0];
};
/**
* Get the user's last name, optionally splitting it out of a single name if
* that's all that was provided.
*
* @return {String or Undefined}
*/
Identify.prototype.lastName = function () {
var lastName = this.proxy('traits.lastName');
if (typeof lastName === 'string') return trim(lastName);
var name = this.proxy('traits.name');
if (typeof name !== 'string') return;
var space = trim(name).indexOf(' ');
if (space === -1) return;
return trim(name.substr(space + 1));
};
/**
* Get the user's unique id.
*
* @return {String or undefined}
*/
Identify.prototype.uid = function(){
return this.userId()
|| this.username()
|| this.email();
};
/**
* Get description.
*
* @return {String}
*/
Identify.prototype.description = function(){
return this.proxy('traits.description')
|| this.proxy('traits.background');
};
/**
* Get the age.
*
* If the age is not explicitly set
* the method will compute it from `.birthday()`
* if possible.
*
* @return {Number}
*/
Identify.prototype.age = function(){
var date = this.birthday();
var age = get(this.traits(), 'age');
if (null != age) return age;
if ('date' != type(date)) return;
var now = new Date;
return now.getFullYear() - date.getFullYear();
};
/**
* Get the avatar.
*
* .photoUrl needed because help-scout
* implementation uses `.avatar || .photoUrl`.
*
* .avatarUrl needed because trakio uses it.
*
* @return {Mixed}
*/
Identify.prototype.avatar = function(){
var traits = this.traits();
return get(traits, 'avatar')
|| get(traits, 'photoUrl')
|| get(traits, 'avatarUrl');
};
/**
* Get the position.
*
* .jobTitle needed because some integrations use it.
*
* @return {Mixed}
*/
Identify.prototype.position = function(){
var traits = this.traits();
return get(traits, 'position') || get(traits, 'jobTitle');
};
/**
* Setup sme basic "special" trait proxies.
*/
Identify.prototype.username = Facade.proxy('traits.username');
Identify.prototype.website = Facade.one('traits.website');
Identify.prototype.websites = Facade.multi('traits.website');
Identify.prototype.phone = Facade.one('traits.phone');
Identify.prototype.phones = Facade.multi('traits.phone');
Identify.prototype.address = Facade.proxy('traits.address');
Identify.prototype.gender = Facade.proxy('traits.gender');
Identify.prototype.birthday = Facade.proxy('traits.birthday');
}, {"./address":137,"./facade":127,"is-email":162,"new-date":139,"./utils":136,"obj-case":138,"trim":163}],
163: [function(require, module, exports) {
exports = module.exports = trim;
function trim(str){
if (str.trim) return str.trim();
return str.replace(/^\s*|\s*$/g, '');
}
exports.left = function(str){
if (str.trimLeft) return str.trimLeft();
return str.replace(/^\s*/, '');
};
exports.right = function(str){
if (str.trimRight) return str.trimRight();
return str.replace(/\s*$/, '');
};
}, {}],
131: [function(require, module, exports) {
var inherit = require('./utils').inherit;
var clone = require('./utils').clone;
var type = require('./utils').type;
var Facade = require('./facade');
var Identify = require('./identify');
var isEmail = require('is-email');
var get = require('obj-case');
/**
* Expose `Track` facade.
*/
module.exports = Track;
/**
* Initialize a new `Track` facade with a `dictionary` of arguments.
*
* @param {object} dictionary
* @property {String} event
* @property {String} userId
* @property {String} sessionId
* @property {Object} properties
* @property {Object} options
*/
function Track (dictionary) {
Facade.call(this, dictionary);
}
/**
* Inherit from `Facade`.
*/
inherit(Track, Facade);
/**
* Return the facade's action.
*
* @return {String}
*/
Track.prototype.type =
Track.prototype.action = function () {
return 'track';
};
/**
* Setup some basic proxies.
*/
Track.prototype.event = Facade.field('event');
Track.prototype.value = Facade.proxy('properties.value');
/**
* Misc
*/
Track.prototype.category = Facade.proxy('properties.category');
Track.prototype.country = Facade.proxy('properties.country');
Track.prototype.state = Facade.proxy('properties.state');
Track.prototype.city = Facade.proxy('properties.city');
Track.prototype.zip = Facade.proxy('properties.zip');
/**
* Ecommerce
*/
Track.prototype.id = Facade.proxy('properties.id');
Track.prototype.sku = Facade.proxy('properties.sku');
Track.prototype.tax = Facade.proxy('properties.tax');
Track.prototype.name = Facade.proxy('properties.name');
Track.prototype.price = Facade.proxy('properties.price');
Track.prototype.total = Facade.proxy('properties.total');
Track.prototype.coupon = Facade.proxy('properties.coupon');
Track.prototype.shipping = Facade.proxy('properties.shipping');
/**
* Description
*/
Track.prototype.description = Facade.proxy('properties.description');
/**
* Plan
*/
Track.prototype.plan = Facade.proxy('properties.plan');
/**
* Order id.
*
* @return {String}
* @api public
*/
Track.prototype.orderId = function(){
return this.proxy('properties.id')
|| this.proxy('properties.orderId');
};
/**
* Get subtotal.
*
* @return {Number}
*/
Track.prototype.subtotal = function(){
var subtotal = get(this.properties(), 'subtotal');
var total = this.total();
var n;
if (subtotal) return subtotal;
if (!total) return 0;
if (n = this.tax()) total -= n;
if (n = this.shipping()) total -= n;
return total;
};
/**
* Get products.
*
* @return {Array}
*/
Track.prototype.products = function(){
var props = this.properties();
var products = get(props, 'products');
return 'array' == type(products)
? products
: [];
};
/**
* Get quantity.
*
* @return {Number}
*/
Track.prototype.quantity = function(){
var props = this.obj.properties || {};
return props.quantity || 1;
};
/**
* Get currency.
*
* @return {String}
*/
Track.prototype.currency = function(){
var props = this.obj.properties || {};
return props.currency || 'USD';
};
/**
* BACKWARDS COMPATIBILITY: should probably re-examine where these come from.
*/
Track.prototype.referrer = Facade.proxy('properties.referrer');
Track.prototype.query = Facade.proxy('options.query');
/**
* Get the call's properties.
*
* @param {Object} aliases
* @return {Object}
*/
Track.prototype.properties = function (aliases) {
var ret = this.field('properties') || {};
aliases = aliases || {};
for (var alias in aliases) {
var value = null == this[alias]
? this.proxy('properties.' + alias)
: this[alias]();
if (null == value) continue;
ret[aliases[alias]] = value;
delete ret[alias];
}
return ret;
};
/**
* Get the call's username.
*
* @return {String or Undefined}
*/
Track.prototype.username = function () {
return this.proxy('traits.username') ||
this.proxy('properties.username') ||
this.userId() ||
this.sessionId();
};
/**
* Get the call's email, using an the user ID if it's a valid email.
*
* @return {String or Undefined}
*/
Track.prototype.email = function () {
var email = this.proxy('traits.email');
email = email || this.proxy('properties.email');
if (email) return email;
var userId = this.userId();
if (isEmail(userId)) return userId;
};
/**
* Get the call's revenue, parsing it from a string with an optional leading
* dollar sign.
*
* For products/services that don't have shipping and are not directly taxed,
* they only care about tracking `revenue`. These are things like
* SaaS companies, who sell monthly subscriptions. The subscriptions aren't
* taxed directly, and since it's a digital product, it has no shipping.
*
* The only case where there's a difference between `revenue` and `total`
* (in the context of analytics) is on ecommerce platforms, where they want
* the `revenue` function to actually return the `total` (which includes
* tax and shipping, total = subtotal + tax + shipping). This is probably
* because on their backend they assume tax and shipping has been applied to
* the value, and so can get the revenue on their own.
*
* @return {Number}
*/
Track.prototype.revenue = function () {
var revenue = this.proxy('properties.revenue');
var event = this.event();
// it's always revenue, unless it's called during an order completion.
if (!revenue && event && event.match(/completed ?order/i)) {
revenue = this.proxy('properties.total');
}
return currency(revenue);
};
/**
* Get cents.
*
* @return {Number}
*/
Track.prototype.cents = function(){
var revenue = this.revenue();
return 'number' != typeof revenue
? this.value() || 0
: revenue * 100;
};
/**
* A utility to turn the pieces of a track call into an identify. Used for
* integrations with super properties or rate limits.
*
* TODO: remove me.
*
* @return {Facade}
*/
Track.prototype.identify = function () {
var json = this.json();
json.traits = this.traits();
return new Identify(json);
};
/**
* Get float from currency value.
*
* @param {Mixed} val
* @return {Number}
*/
function currency(val) {
if (!val) return;
if (typeof val === 'number') return val;
if (typeof val !== 'string') return;
val = val.replace(/\$/g, '');
val = parseFloat(val);
if (!isNaN(val)) return val;
}
}, {"./utils":136,"./facade":127,"./identify":130,"is-email":162,"obj-case":138}],
132: [function(require, module, exports) {
var inherit = require('./utils').inherit;
var Facade = require('./facade');
var Track = require('./track');
/**
* Expose `Page` facade
*/
module.exports = Page;
/**
* Initialize new `Page` facade with `dictionary`.
*
* @param {Object} dictionary
* @param {String} category
* @param {String} name
* @param {Object} traits
* @param {Object} options
*/
function Page(dictionary){
Facade.call(this, dictionary);
}
/**
* Inherit from `Facade`
*/
inherit(Page, Facade);
/**
* Get the facade's action.
*
* @return {String}
*/
Page.prototype.type =
Page.prototype.action = function(){
return 'page';
};
/**
* Fields
*/
Page.prototype.category = Facade.field('category');
Page.prototype.name = Facade.field('name');
/**
* Proxies.
*/
Page.prototype.title = Facade.proxy('properties.title');
Page.prototype.path = Facade.proxy('properties.path');
Page.prototype.url = Facade.proxy('properties.url');
/**
* Get the page properties mixing `category` and `name`.
*
* @return {Object}
*/
Page.prototype.properties = function(){
var props = this.field('properties') || {};
var category = this.category();
var name = this.name();
if (category) props.category = category;
if (name) props.name = name;
return props;
};
/**
* Get the page fullName.
*
* @return {String}
*/
Page.prototype.fullName = function(){
var category = this.category();
var name = this.name();
return name && category
? category + ' ' + name
: name;
};
/**
* Get event with `name`.
*
* @return {String}
*/
Page.prototype.event = function(name){
return name
? 'Viewed ' + name + ' Page'
: 'Loaded a Page';
};
/**
* Convert this Page to a Track facade with `name`.
*
* @param {String} name
* @return {Track}
*/
Page.prototype.track = function(name){
var props = this.properties();
return new Track({
event: this.event(name),
timestamp: this.timestamp(),
context: this.context(),
properties: props
});
};
}, {"./utils":136,"./facade":127,"./track":131}],
133: [function(require, module, exports) {
var inherit = require('./utils').inherit;
var Page = require('./page');
var Track = require('./track');
/**
* Expose `Screen` facade
*/
module.exports = Screen;
/**
* Initialize new `Screen` facade with `dictionary`.
*
* @param {Object} dictionary
* @param {String} category
* @param {String} name
* @param {Object} traits
* @param {Object} options
*/
function Screen(dictionary){
Page.call(this, dictionary);
}
/**
* Inherit from `Page`
*/
inherit(Screen, Page);
/**
* Get the facade's action.
*
* @return {String}
* @api public
*/
Screen.prototype.type =
Screen.prototype.action = function(){
return 'screen';
};
/**
* Get event with `name`.
*
* @param {String} name
* @return {String}
* @api public
*/
Screen.prototype.event = function(name){
return name
? 'Viewed ' + name + ' Screen'
: 'Loaded a Screen';
};
/**
* Convert this Screen.
*
* @param {String} name
* @return {Track}
* @api public
*/
Screen.prototype.track = function(name){
var props = this.properties();
return new Track({
event: this.event(name),
timestamp: this.timestamp(),
context: this.context(),
properties: props
});
};
}, {"./utils":136,"./page":132,"./track":131}],
125: [function(require, module, exports) {
/**
* Module dependencies.
*/
var stringify = require('querystring').stringify;
var sub = require('substitute');
/**
* Factory function to create a pixel loader.
*
* @param {String} path
* @return {Function}
* @api public
*/
module.exports = function(path){
return function(query, obj, fn){
if ('function' == typeof obj) fn = obj, obj = {};
obj = obj || {};
fn = fn || function(){};
var url = sub(path, obj);
var img = new Image;
img.onerror = error(fn, 'failed to load pixel', img);
img.onload = function(){ fn(); };
query = stringify(query);
if (query) query = '?' + query;
img.src = url + query;
img.width = 1;
img.height = 1;
return img;
};
};
/**
* Create an error handler.
*
* @param {Fucntion} fn
* @param {String} message
* @param {Image} img
* @return {Function}
* @api private
*/
function error(fn, message, img){
return function(e){
e = e || window.event;
var err = new Error(message);
err.event = e;
err.source = img;
fn(err);
};
}
}, {"querystring":126,"substitute":164}],
126: [function(require, module, exports) {
/**
* Module dependencies.
*/
var encode = encodeURIComponent;
var decode = decodeURIComponent;
var trim = require('trim');
var type = require('type');
/**
* Parse the given query `str`.
*
* @param {String} str
* @return {Object}
* @api public
*/
exports.parse = function(str){
if ('string' != typeof str) return {};
str = trim(str);
if ('' == str) return {};
if ('?' == str.charAt(0)) str = str.slice(1);
var obj = {};
var pairs = str.split('&');
for (var i = 0; i < pairs.length; i++) {
var parts = pairs[i].split('=');
var key = decode(parts[0]);
var m;
if (m = /(\w+)\[(\d+)\]/.exec(key)) {
obj[m[1]] = obj[m[1]] || [];
obj[m[1]][m[2]] = decode(parts[1]);
continue;
}
obj[parts[0]] = null == parts[1]
? ''
: decode(parts[1]);
}
return obj;
};
/**
* Stringify the given `obj`.
*
* @param {Object} obj
* @return {String}
* @api public
*/
exports.stringify = function(obj){
if (!obj) return '';
var pairs = [];
for (var key in obj) {
var value = obj[key];
if ('array' == type(value)) {
for (var i = 0; i < value.length; ++i) {
pairs.push(encode(key + '[' + i + ']') + '=' + encode(value[i]));
}
continue;
}
pairs.push(encode(key) + '=' + encode(obj[key]));
}
return pairs.join('&');
};
}, {"trim":163,"type":7}],
164: [function(require, module, exports) {
/**
* Expose `substitute`
*/
module.exports = substitute;
/**
* Type.
*/
var type = Object.prototype.toString;
/**
* Substitute `:prop` with the given `obj` in `str`
*
* @param {String} str
* @param {Object or Array} obj
* @param {RegExp} expr
* @return {String}
* @api public
*/
function substitute(str, obj, expr){
if (!obj) throw new TypeError('expected an object');
expr = expr || /:(\w+)/g;
return str.replace(expr, function(_, prop){
switch (type.call(obj)) {
case '[object Object]':
return null != obj[prop] ? obj[prop] : _;
case '[object Array]':
var val = obj.shift();
return null != val ? val : _;
}
});
}
}, {}],
17: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var tick = require('next-tick');
/**
* Expose `BugHerd` integration.
*/
var BugHerd = module.exports = integration('BugHerd')
.assumesPageview()
.global('BugHerdConfig')
.global('_bugHerd')
.option('apiKey', '')
.option('showFeedbackTab', true)
.tag('<script src="//www.bugherd.com/sidebarv2.js?apikey={{ apiKey }}">');
/**
* Initialize.
*
* http://support.bugherd.com/home
*
* @param {Object} page
*/
BugHerd.prototype.initialize = function(page){
window.BugHerdConfig = { feedback: { hide: !this.options.showFeedbackTab }};
var ready = this.ready;
this.load(function(){
tick(ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
BugHerd.prototype.loaded = function(){
return !! window._bugHerd;
};
}, {"analytics.js-integration":83,"next-tick":97}],
18: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var is = require('is');
var extend = require('extend');
var onError = require('on-error');
/**
* Expose `Bugsnag` integration.
*/
var Bugsnag = module.exports = integration('Bugsnag')
.global('Bugsnag')
.option('apiKey', '')
.tag('<script src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-2.min.js">');
/**
* Initialize.
*
* https://bugsnag.com/docs/notifiers/js
*
* @param {Object} page
*/
Bugsnag.prototype.initialize = function(page){
var self = this;
this.load(function(){
window.Bugsnag.apiKey = self.options.apiKey;
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Bugsnag.prototype.loaded = function(){
return is.object(window.Bugsnag);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Bugsnag.prototype.identify = function(identify){
window.Bugsnag.metaData = window.Bugsnag.metaData || {};
extend(window.Bugsnag.metaData, identify.traits());
};
}, {"analytics.js-integration":83,"is":86,"extend":122,"on-error":165}],
165: [function(require, module, exports) {
/**
* Expose `onError`.
*/
module.exports = onError;
/**
* Callbacks.
*/
var callbacks = [];
/**
* Preserve existing handler.
*/
if ('function' == typeof window.onerror) callbacks.push(window.onerror);
/**
* Bind to `window.onerror`.
*/
window.onerror = handler;
/**
* Error handler.
*/
function handler () {
for (var i = 0, fn; fn = callbacks[i]; i++) fn.apply(this, arguments);
}
/**
* Call a `fn` on `window.onerror`.
*
* @param {Function} fn
*/
function onError (fn) {
callbacks.push(fn);
if (window.onerror != handler) {
callbacks.push(window.onerror);
window.onerror = handler;
}
}
}, {}],
19: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var defaults = require('defaults');
var onBody = require('on-body');
/**
* Expose `Chartbeat` integration.
*/
var Chartbeat = module.exports = integration('Chartbeat')
.assumesPageview()
.global('_sf_async_config')
.global('_sf_endpt')
.global('pSUPERFLY')
.option('domain', '')
.option('uid', null)
.tag('<script src="//static.chartbeat.com/js/chartbeat.js">');
/**
* Initialize.
*
* http://chartbeat.com/docs/configuration_variables/
*
* @param {Object} page
*/
Chartbeat.prototype.initialize = function(page){
var self = this;
window._sf_async_config = window._sf_async_config || {};
window._sf_async_config.useCanonical = true;
defaults(window._sf_async_config, this.options);
onBody(function(){
window._sf_endpt = new Date().getTime();
// Note: Chartbeat depends on document.body existing so the script does
// not load until that is confirmed. Otherwise it may trigger errors.
self.load(self.ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Chartbeat.prototype.loaded = function(){
return !! window.pSUPERFLY;
};
/**
* Page.
*
* http://chartbeat.com/docs/handling_virtual_page_changes/
*
* @param {Page} page
*/
Chartbeat.prototype.page = function(page){
var props = page.properties();
var name = page.fullName();
window.pSUPERFLY.virtualPage(props.path, name || props.title);
};
}, {"analytics.js-integration":83,"defaults":166,"on-body":121}],
166: [function(require, module, exports) {
/**
* Expose `defaults`.
*/
module.exports = defaults;
function defaults (dest, defaults) {
for (var prop in defaults) {
if (! (prop in dest)) {
dest[prop] = defaults[prop];
}
}
return dest;
};
}, {}],
20: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_cbq');
var each = require('each');
/**
* HOP
*/
var has = Object.prototype.hasOwnProperty;
/**
* Supported events
*/
var supported = {
activation: true,
changePlan: true,
register: true,
refund: true,
charge: true,
cancel: true,
login: true
};
/**
* Expose `ChurnBee` integration.
*/
var ChurnBee = module.exports = integration('ChurnBee')
.global('_cbq')
.global('ChurnBee')
.option('apiKey', '')
.tag('<script src="//api.churnbee.com/cb.js">')
.mapping('events');
/**
* Initialize.
*
* https://churnbee.com/docs
*
* @param {Object} page
*/
ChurnBee.prototype.initialize = function(page){
push('_setApiKey', this.options.apiKey);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
ChurnBee.prototype.loaded = function(){
return !! window.ChurnBee;
};
/**
* Track.
*
* @param {Track} event
*/
ChurnBee.prototype.track = function(track){
var event = track.event();
var events = this.events(event);
events.push(event);
each(events, function(event){
if (true != supported[event]) return;
push(event, track.properties({ revenue: 'amount' }));
});
};
}, {"analytics.js-integration":83,"global-queue":167,"each":4}],
167: [function(require, module, exports) {
/**
* Expose `generate`.
*/
module.exports = generate;
/**
* Generate a global queue pushing method with `name`.
*
* @param {String} name
* @param {Object} options
* @property {Boolean} wrap
* @return {Function}
*/
function generate (name, options) {
options = options || {};
return function (args) {
args = [].slice.call(arguments);
window[name] || (window[name] = []);
options.wrap === false
? window[name].push.apply(window[name], args)
: window[name].push(args);
};
}
}, {}],
21: [function(require, module, exports) {
/**
* Module dependencies.
*/
var date = require('load-date');
var domify = require('domify');
var each = require('each');
var integration = require('analytics.js-integration');
var is = require('is');
var useHttps = require('use-https');
var onBody = require('on-body');
/**
* Expose `ClickTale` integration.
*/
var ClickTale = module.exports = integration('ClickTale')
.assumesPageview()
.global('WRInitTime')
.global('ClickTale')
.global('ClickTaleSetUID')
.global('ClickTaleField')
.global('ClickTaleEvent')
.option('httpCdnUrl', 'http://s.clicktale.net/WRe0.js')
.option('httpsCdnUrl', '')
.option('projectId', '')
.option('recordingRatio', 0.01)
.option('partitionId', '')
.tag('<script src="{{src}}">');
/**
* Initialize.
*
* http://wiki.clicktale.com/Article/JavaScript_API
*
* @param {Object} page
*/
ClickTale.prototype.initialize = function(page){
var self = this;
window.WRInitTime = date.getTime();
onBody(function(body){
body.appendChild(domify('<div id="ClickTaleDiv" style="display: none;">'));
});
var http = this.options.httpCdnUrl;
var https = this.options.httpsCdnUrl;
if (useHttps() && !https) return this.debug('https option required');
var src = useHttps() ? https : http;
this.load({ src: src }, function(){
window.ClickTale(
self.options.projectId,
self.options.recordingRatio,
self.options.partitionId
);
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
ClickTale.prototype.loaded = function(){
return is.fn(window.ClickTale);
};
/**
* Identify.
*
* http://wiki.clicktale.com/Article/ClickTaleTag#ClickTaleSetUID
* http://wiki.clicktale.com/Article/ClickTaleTag#ClickTaleField
*
* @param {Identify} identify
*/
ClickTale.prototype.identify = function(identify){
var id = identify.userId();
window.ClickTaleSetUID(id);
each(identify.traits(), function(key, value){
window.ClickTaleField(key, value);
});
};
/**
* Track.
*
* http://wiki.clicktale.com/Article/ClickTaleTag#ClickTaleEvent
*
* @param {Track} track
*/
ClickTale.prototype.track = function(track){
window.ClickTaleEvent(track.event());
};
}, {"load-date":168,"domify":119,"each":4,"analytics.js-integration":83,"is":86,"use-https":85,"on-body":121}],
168: [function(require, module, exports) {
/*
* Load date.
*
* For reference: http://www.html5rocks.com/en/tutorials/webperformance/basics/
*/
var time = new Date()
, perf = window.performance;
if (perf && perf.timing && perf.timing.responseEnd) {
time = new Date(perf.timing.responseEnd);
}
module.exports = time;
}, {}],
22: [function(require, module, exports) {
/**
* Module dependencies.
*/
var Identify = require('facade').Identify;
var extend = require('extend');
var integration = require('analytics.js-integration');
var is = require('is');
/**
* Expose `Clicky` integration.
*/
var Clicky = module.exports = integration('Clicky')
.assumesPageview()
.global('clicky')
.global('clicky_site_ids')
.global('clicky_custom')
.option('siteId', null)
.tag('<script src="//static.getclicky.com/js"></script>');
/**
* Initialize.
*
* http://clicky.com/help/customization
*
* @param {Object} page
*/
Clicky.prototype.initialize = function(page){
var user = this.analytics.user();
window.clicky_site_ids = window.clicky_site_ids || [this.options.siteId];
this.identify(new Identify({
userId: user.id(),
traits: user.traits()
}));
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Clicky.prototype.loaded = function(){
return is.object(window.clicky);
};
/**
* Page.
*
* http://clicky.com/help/customization#/help/custom/manual
*
* @param {Page} page
*/
Clicky.prototype.page = function(page){
var properties = page.properties();
var category = page.category();
var name = page.fullName();
window.clicky.log(properties.path, name || properties.title);
};
/**
* Identify.
*
* @param {Identify} id (optional)
*/
Clicky.prototype.identify = function(identify){
window.clicky_custom = window.clicky_custom || {};
window.clicky_custom.session = window.clicky_custom.session || {};
extend(window.clicky_custom.session, identify.traits());
};
/**
* Track.
*
* http://clicky.com/help/customization#/help/custom/manual
*
* @param {Track} event
*/
Clicky.prototype.track = function(track){
window.clicky.goal(track.event(), track.revenue());
};
}, {"facade":124,"extend":122,"analytics.js-integration":83,"is":86}],
23: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var useHttps = require('use-https');
/**
* Expose `Comscore` integration.
*/
var Comscore = module.exports = integration('comScore')
.assumesPageview()
.global('_comscore')
.global('COMSCORE')
.option('c1', '2')
.option('c2', '')
.tag('http', '<script src="http://b.scorecardresearch.com/beacon.js">')
.tag('https', '<script src="https://sb.scorecardresearch.com/beacon.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Comscore.prototype.initialize = function(page){
window._comscore = window._comscore || [this.options];
var name = useHttps() ? 'https' : 'http';
this.load(name, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Comscore.prototype.loaded = function(){
return !! window.COMSCORE;
};
}, {"analytics.js-integration":83,"use-https":85}],
24: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `CrazyEgg` integration.
*/
var CrazyEgg = module.exports = integration('Crazy Egg')
.assumesPageview()
.global('CE2')
.option('accountNumber', '')
.tag('<script src="//dnn506yrbagrg.cloudfront.net/pages/scripts/{{ path }}.js?{{ cache }}">');
/**
* Initialize.
*
* @param {Object} page
*/
CrazyEgg.prototype.initialize = function(page){
var number = this.options.accountNumber;
var path = number.slice(0,4) + '/' + number.slice(4);
var cache = Math.floor(new Date().getTime() / 3600000);
this.load({ path: path, cache: cache }, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
CrazyEgg.prototype.loaded = function(){
return !! window.CE2;
};
}, {"analytics.js-integration":83}],
25: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_curebitq');
var Identify = require('facade').Identify;
var throttle = require('throttle');
var Track = require('facade').Track;
var iso = require('to-iso-string');
var clone = require('clone');
var each = require('each');
var bind = require('bind');
/**
* Expose `Curebit` integration.
*/
var Curebit = module.exports = integration('Curebit')
.global('_curebitq')
.global('curebit')
.option('siteId', '')
.option('iframeWidth', '100%')
.option('iframeHeight', '480')
.option('iframeBorder', 0)
.option('iframeId', 'curebit_integration')
.option('responsive', true)
.option('device', '')
.option('insertIntoId', '')
.option('campaigns', {})
.option('server', 'https://www.curebit.com')
.tag('<script src="//d2jjzw81hqbuqv.cloudfront.net/integration/curebit-1.0.min.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Curebit.prototype.initialize = function(page){
push('init', { site_id: this.options.siteId, server: this.options.server });
this.load(this.ready);
// throttle the call to `page` since curebit needs to append an iframe
this.page = throttle(bind(this, this.page), 250);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Curebit.prototype.loaded = function(){
return !!window.curebit;
};
/**
* Page.
*
* Call the `register_affiliate` method of the Curebit API that will load a
* custom iframe onto the page, only if this page's path is marked as a
* campaign.
*
* http://www.curebit.com/docs/affiliate/registration
*
* This is throttled to prevent accidentally drawing the iframe multiple times,
* from multiple `.page()` calls. The `250` is from the curebit script.
*
* @param {String} url
* @param {String} id
* @param {Function} fn
* @api private
*/
Curebit.prototype.injectIntoId = function(url, id, fn){
var server = this.options.server;
when(function(){
return document.getElementById(id);
}, function(){
var script = document.createElement('script');
script.src = url;
var parent = document.getElementById(id);
parent.appendChild(script);
onload(script, fn);
});
};
/**
* Campaign tags.
*
* @param {Page} page
*/
Curebit.prototype.page = function(page){
var user = this.analytics.user();
var campaigns = this.options.campaigns;
var path = window.location.pathname;
if (!campaigns[path]) return;
var tags = (campaigns[path] || '').split(',');
if (!tags.length) return;
var settings = {
responsive: this.options.responsive,
device: this.options.device,
campaign_tags: tags,
iframe: {
width: this.options.iframeWidth,
height: this.options.iframeHeight,
id: this.options.iframeId,
frameborder: this.options.iframeBorder,
container: this.options.insertIntoId
}
};
var identify = new Identify({
userId: user.id(),
traits: user.traits()
});
// if we have an email, add any information about the user
if (identify.email()) {
settings.affiliate_member = {
email: identify.email(),
first_name: identify.firstName(),
last_name: identify.lastName(),
customer_id: identify.userId()
};
}
push('register_affiliate', settings);
};
/**
* Completed order.
*
* Fire the Curebit `register_purchase` with the order details and items.
*
* https://www.curebit.com/docs/ecommerce/custom
*
* @param {Track} track
*/
Curebit.prototype.completedOrder = function(track){
var user = this.analytics.user();
var orderId = track.orderId();
var products = track.products();
var props = track.properties();
var items = [];
var identify = new Identify({
traits: user.traits(),
userId: user.id()
});
each(products, function(product){
var track = new Track({ properties: product });
items.push({
product_id: track.id() || track.sku(),
quantity: track.quantity(),
image_url: product.image,
price: track.price(),
title: track.name(),
url: product.url,
});
});
push('register_purchase', {
order_date: iso(props.date || new Date()),
order_number: orderId,
coupon_code: track.coupon(),
subtotal: track.total(),
customer_id: identify.userId(),
first_name: identify.firstName(),
last_name: identify.lastName(),
email: identify.email(),
items: items
});
};
}, {"analytics.js-integration":83,"global-queue":167,"facade":124,"throttle":169,"to-iso-string":170,"clone":171,"each":4,"bind":95}],
169: [function(require, module, exports) {
/**
* Module exports.
*/
module.exports = throttle;
/**
* Returns a new function that, when invoked, invokes `func` at most one time per
* `wait` milliseconds.
*
* @param {Function} func The `Function` instance to wrap.
* @param {Number} wait The minimum number of milliseconds that must elapse in between `func` invokations.
* @return {Function} A new function that wraps the `func` function passed in.
* @api public
*/
function throttle (func, wait) {
var rtn; // return value
var last = 0; // last invokation timestamp
return function throttled () {
var now = new Date().getTime();
var delta = now - last;
if (delta >= wait) {
rtn = func.apply(this, arguments);
last = now;
}
return rtn;
};
}
}, {}],
170: [function(require, module, exports) {
/**
* Expose `toIsoString`.
*/
module.exports = toIsoString;
/**
* Turn a `date` into an ISO string.
*
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
*
* @param {Date} date
* @return {String}
*/
function toIsoString (date) {
return date.getUTCFullYear()
+ '-' + pad(date.getUTCMonth() + 1)
+ '-' + pad(date.getUTCDate())
+ 'T' + pad(date.getUTCHours())
+ ':' + pad(date.getUTCMinutes())
+ ':' + pad(date.getUTCSeconds())
+ '.' + String((date.getUTCMilliseconds()/1000).toFixed(3)).slice(2, 5)
+ 'Z';
}
/**
* Pad a `number` with a ten's place zero.
*
* @param {Number} number
* @return {String}
*/
function pad (number) {
var n = number.toString();
return n.length === 1 ? '0' + n : n;
}
}, {}],
171: [function(require, module, exports) {
/**
* Module dependencies.
*/
var type;
try {
type = require('type');
} catch(e){
type = require('type-component');
}
/**
* Module exports.
*/
module.exports = clone;
/**
* Clones objects.
*
* @param {Mixed} any object
* @api public
*/
function clone(obj){
switch (type(obj)) {
case 'object':
var copy = {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
copy[key] = clone(obj[key]);
}
}
return copy;
case 'array':
var copy = new Array(obj.length);
for (var i = 0, l = obj.length; i < l; i++) {
copy[i] = clone(obj[i]);
}
return copy;
case 'regexp':
// from millermedeiros/amd-utils - MIT
var flags = '';
flags += obj.multiline ? 'm' : '';
flags += obj.global ? 'g' : '';
flags += obj.ignoreCase ? 'i' : '';
return new RegExp(obj.source, flags);
case 'date':
return new Date(obj.getTime());
default: // string, number, boolean, …
return obj;
}
}
}, {"type":7}],
26: [function(require, module, exports) {
/**
* Module dependencies.
*/
var alias = require('alias');
var convertDates = require('convert-dates');
var Identify = require('facade').Identify;
var integration = require('analytics.js-integration');
/**
* Expose `Customerio` integration.
*/
var Customerio = module.exports = integration('Customer.io')
.assumesPageview()
.global('_cio')
.option('siteId', '')
.tag('<script id="cio-tracker" src="https://assets.customer.io/assets/track.js" data-site-id="{{ siteId }}">');
/**
* Initialize.
*
* http://customer.io/docs/api/javascript.html
*
* @param {Object} page
*/
Customerio.prototype.initialize = function(page){
window._cio = window._cio || [];
(function(){var a,b,c; a = function(f){return function(){window._cio.push([f].concat(Array.prototype.slice.call(arguments,0))); }; }; b = ['identify', 'track']; for (c = 0; c < b.length; c++) {window._cio[b[c]] = a(b[c]); } })();
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Customerio.prototype.loaded = function(){
return (!! window._cio) && (window._cio.push !== Array.prototype.push);
};
/**
* Identify.
*
* http://customer.io/docs/api/javascript.html#section-Identify_customers
*
* @param {Identify} identify
*/
Customerio.prototype.identify = function(identify){
if (!identify.userId()) return this.debug('user id required');
var traits = identify.traits({ created: 'created_at' });
traits = convertDates(traits, convertDate);
window._cio.identify(traits);
};
/**
* Group.
*
* @param {Group} group
*/
Customerio.prototype.group = function(group){
var traits = group.traits();
var user = this.analytics.user();
traits = alias(traits, function(trait){
return 'Group ' + trait;
});
this.identify(new Identify({
userId: user.id(),
traits: traits
}));
};
/**
* Track.
*
* http://customer.io/docs/api/javascript.html#section-Track_a_custom_event
*
* @param {Track} track
*/
Customerio.prototype.track = function(track){
var properties = track.properties();
properties = convertDates(properties, convertDate);
window._cio.track(track.event(), properties);
};
/**
* Convert a date to the format Customer.io supports.
*
* @param {Date} date
* @return {Number}
*/
function convertDate(date){
return Math.floor(date.getTime() / 1000);
}
}, {"alias":172,"convert-dates":173,"facade":124,"analytics.js-integration":83}],
172: [function(require, module, exports) {
var type = require('type');
try {
var clone = require('clone');
} catch (e) {
var clone = require('clone-component');
}
/**
* Expose `alias`.
*/
module.exports = alias;
/**
* Alias an `object`.
*
* @param {Object} obj
* @param {Mixed} method
*/
function alias (obj, method) {
switch (type(method)) {
case 'object': return aliasByDictionary(clone(obj), method);
case 'function': return aliasByFunction(clone(obj), method);
}
}
/**
* Convert the keys in an `obj` using a dictionary of `aliases`.
*
* @param {Object} obj
* @param {Object} aliases
*/
function aliasByDictionary (obj, aliases) {
for (var key in aliases) {
if (undefined === obj[key]) continue;
obj[aliases[key]] = obj[key];
delete obj[key];
}
return obj;
}
/**
* Convert the keys in an `obj` using a `convert` function.
*
* @param {Object} obj
* @param {Function} convert
*/
function aliasByFunction (obj, convert) {
// have to create another object so that ie8 won't infinite loop on keys
var output = {};
for (var key in obj) output[convert(key)] = obj[key];
return output;
}
}, {"type":7,"clone":143}],
173: [function(require, module, exports) {
var is = require('is');
try {
var clone = require('clone');
} catch (e) {
var clone = require('clone-component');
}
/**
* Expose `convertDates`.
*/
module.exports = convertDates;
/**
* Recursively convert an `obj`'s dates to new values.
*
* @param {Object} obj
* @param {Function} convert
* @return {Object}
*/
function convertDates (obj, convert) {
obj = clone(obj);
for (var key in obj) {
var val = obj[key];
if (is.date(val)) obj[key] = convert(val);
if (is.object(val)) obj[key] = convertDates(val, convert);
}
return obj;
}
}, {"is":86,"clone":89}],
27: [function(require, module, exports) {
/**
* Module dependencies.
*/
var alias = require('alias');
var integration = require('analytics.js-integration');
var is = require('is');
var load = require('load-script');
var push = require('global-queue')('_dcq');
/**
* Expose `Drip` integration.
*/
var Drip = module.exports = integration('Drip')
.assumesPageview()
.global('dc')
.global('_dcq')
.global('_dcs')
.option('account', '')
.tag('<script src="//tag.getdrip.com/{{ account }}.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Drip.prototype.initialize = function(page){
window._dcq = window._dcq || [];
window._dcs = window._dcs || {};
window._dcs.account = this.options.account;
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Drip.prototype.loaded = function(){
return is.object(window.dc);
};
/**
* Track.
*
* @param {Track} track
*/
Drip.prototype.track = function(track){
var props = track.properties();
var cents = track.cents();
if (cents) props.value = cents;
delete props.revenue;
push('track', track.event(), props);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Drip.prototype.identify = function (identify) {
push('identify', identify.traits());
};
}, {"alias":172,"analytics.js-integration":83,"is":86,"load-script":120,"global-queue":167}],
28: [function(require, module, exports) {
/**
* Module dependencies.
*/
var extend = require('extend');
var integration = require('analytics.js-integration');
var onError = require('on-error');
var push = require('global-queue')('_errs');
/**
* Expose `Errorception` integration.
*/
var Errorception = module.exports = integration('Errorception')
.assumesPageview()
.global('_errs')
.option('projectId', '')
.option('meta', true)
.tag('<script src="//beacon.errorception.com/{{ projectId }}.js">');
/**
* Initialize.
*
* https://github.com/amplitude/Errorception-Javascript
*
* @param {Object} page
*/
Errorception.prototype.initialize = function(page){
window._errs = window._errs || [this.options.projectId];
onError(push);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Errorception.prototype.loaded = function(){
return !! (window._errs && window._errs.push !== Array.prototype.push);
};
/**
* Identify.
*
* http://blog.errorception.com/2012/11/capture-custom-data-with-your-errors.html
*
* @param {Object} identify
*/
Errorception.prototype.identify = function(identify){
if (!this.options.meta) return;
var traits = identify.traits();
window._errs = window._errs || [];
window._errs.meta = window._errs.meta || {};
extend(window._errs.meta, traits);
};
}, {"extend":122,"analytics.js-integration":83,"on-error":165,"global-queue":167}],
29: [function(require, module, exports) {
/**
* Module dependencies.
*/
var each = require('each');
var integration = require('analytics.js-integration');
var push = require('global-queue')('_aaq');
/**
* Expose `Evergage` integration.integration.
*/
var Evergage = module.exports = integration('Evergage')
.assumesPageview()
.global('_aaq')
.option('account', '')
.option('dataset', '')
.tag('<script src="//cdn.evergage.com/beacon/{{ account }}/{{ dataset }}/scripts/evergage.min.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Evergage.prototype.initialize = function(page){
var account = this.options.account;
var dataset = this.options.dataset;
window._aaq = window._aaq || [];
push('setEvergageAccount', account);
push('setDataset', dataset);
push('setUseSiteConfig', true);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Evergage.prototype.loaded = function(){
return !! (window._aaq && window._aaq.push !== Array.prototype.push);
};
/**
* Page.
*
* @param {Page} page
*/
Evergage.prototype.page = function(page){
var props = page.properties();
var name = page.name();
if (name) push('namePage', name);
each(props, function(key, value){
push('setCustomField', key, value, 'page');
});
window.Evergage.init(true);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Evergage.prototype.identify = function(identify){
var id = identify.userId();
if (!id) return;
push('setUser', id);
var traits = identify.traits({
email: 'userEmail',
name: 'userName'
});
each(traits, function(key, value){
push('setUserField', key, value, 'page');
});
};
/**
* Group.
*
* @param {Group} group
*/
Evergage.prototype.group = function(group){
var props = group.traits();
var id = group.groupId();
if (!id) return;
push('setCompany', id);
each(props, function(key, value){
push('setAccountField', key, value, 'page');
});
};
/**
* Track.
*
* @param {Track} track
*/
Evergage.prototype.track = function(track){
push('trackAction', track.event(), track.properties());
};
}, {"each":4,"analytics.js-integration":83,"global-queue":167}],
30: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_fbq');
var each = require('each');
/**
* HOP
*/
var has = Object.prototype.hasOwnProperty;
/**
* Expose `Facebook`
*/
var Facebook = module.exports = integration('Facebook Conversion Tracking')
.global('_fbq')
.option('currency', 'USD')
.tag('<script src="//connect.facebook.net/en_US/fbds.js">')
.mapping('events');
/**
* Initialize Facebook Conversion Tracking
*
* https://developers.facebook.com/docs/ads-for-websites/conversion-pixel-code-migration
*
* @param {Object} page
*/
Facebook.prototype.initialize = function(page){
window._fbq = window._fbq || [];
this.load(this.ready);
window._fbq.loaded = true;
};
/**
* Loaded?
*
* @return {Boolean}
*/
Facebook.prototype.loaded = function(){
return !! (window._fbq && window._fbq.loaded);
};
/**
* Track.
*
* https://developers.facebook.com/docs/reference/ads-api/custom-audience-website-faq/#fbpixel
*
* @param {Track} track
*/
Facebook.prototype.track = function(track){
var event = track.event();
var events = this.events(event);
var revenue = track.revenue() || 0;
var self = this;
each(events, function(event){
push('track', event, {
value: String(revenue.toFixed(2)),
currency: self.options.currency
});
});
if (!events.length) {
var data = track.properties();
push('track', event, data);
}
};
}, {"analytics.js-integration":83,"global-queue":167,"each":4}],
31: [function(require, module, exports) {
/**
* Module dependencies.
*/
var push = require('global-queue')('_fxm');
var integration = require('analytics.js-integration');
var Track = require('facade').Track;
var each = require('each');
/**
* Expose `FoxMetrics` integration.
*/
var FoxMetrics = module.exports = integration('FoxMetrics')
.assumesPageview()
.global('_fxm')
.option('appId', '')
.tag('<script src="//d35tca7vmefkrc.cloudfront.net/scripts/{{ appId }}.js">');
/**
* Initialize.
*
* http://foxmetrics.com/documentation/apijavascript
*
* @param {Object} page
*/
FoxMetrics.prototype.initialize = function(page){
window._fxm = window._fxm || [];
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
FoxMetrics.prototype.loaded = function(){
return !! (window._fxm && window._fxm.appId);
};
/**
* Page.
*
* @param {Page} page
*/
FoxMetrics.prototype.page = function(page){
var properties = page.proxy('properties');
var category = page.category();
var name = page.name();
this._category = category; // store for later
push(
'_fxm.pages.view',
properties.title, // title
name, // name
category, // category
properties.url, // url
properties.referrer // referrer
);
};
/**
* Identify.
*
* @param {Identify} identify
*/
FoxMetrics.prototype.identify = function(identify){
var id = identify.userId();
if (!id) return;
push(
'_fxm.visitor.profile',
id, // user id
identify.firstName(), // first name
identify.lastName(), // last name
identify.email(), // email
identify.address(), // address
undefined, // social
undefined, // partners
identify.traits() // attributes
);
};
/**
* Track.
*
* @param {Track} track
*/
FoxMetrics.prototype.track = function(track){
var props = track.properties();
var category = this._category || props.category;
push(track.event(), category, props);
};
/**
* Viewed product.
*
* @param {Track} track
* @api private
*/
FoxMetrics.prototype.viewedProduct = function(track){
ecommerce('productview', track);
};
/**
* Removed product.
*
* @param {Track} track
* @api private
*/
FoxMetrics.prototype.removedProduct = function(track){
ecommerce('removecartitem', track);
};
/**
* Added product.
*
* @param {Track} track
* @api private
*/
FoxMetrics.prototype.addedProduct = function(track){
ecommerce('cartitem', track);
};
/**
* Completed Order.
*
* @param {Track} track
* @api private
*/
FoxMetrics.prototype.completedOrder = function(track){
var orderId = track.orderId();
// transaction
push(
'_fxm.ecommerce.order',
orderId,
track.subtotal(),
track.shipping(),
track.tax(),
track.city(),
track.state(),
track.zip(),
track.quantity()
);
// items
each(track.products(), function(product){
var track = new Track({ properties: product });
ecommerce('purchaseitem', track, [
track.quantity(),
track.price(),
orderId
]);
});
};
/**
* Track ecommerce `event` with `track`
* with optional `arr` to append.
*
* @param {String} event
* @param {Track} track
* @param {Array} arr
* @api private
*/
function ecommerce(event, track, arr){
push.apply(null, [
'_fxm.ecommerce.' + event,
track.id() || track.sku(),
track.name(),
track.category()
].concat(arr || []));
}
}, {"global-queue":167,"analytics.js-integration":83,"facade":124,"each":4}],
32: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var bind = require('bind');
var when = require('when');
var is = require('is');
/**
* Expose `Frontleaf` integration.
*/
var Frontleaf = module.exports = integration('Frontleaf')
.assumesPageview()
.global('_fl')
.global('_flBaseUrl')
.option('baseUrl', 'https://api.frontleaf.com')
.option('token', '')
.option('stream', '')
.option('trackNamedPages', false)
.option('trackCategorizedPages', false)
.tag('<script id="_fl" src="{{ baseUrl }}/lib/tracker.js">');
/**
* Initialize.
*
* http://docs.frontleaf.com/#/technical-implementation/tracking-customers/tracking-beacon
*
* @param {Object} page
*/
Frontleaf.prototype.initialize = function(page){
window._fl = window._fl || [];
window._flBaseUrl = window._flBaseUrl || this.options.baseUrl;
this._push('setApiToken', this.options.token);
this._push('setStream', this.options.stream);
var loaded = bind(this, this.loaded);
var ready = this.ready;
this.load({ baseUrl: window._flBaseUrl }, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Frontleaf.prototype.loaded = function(){
return is.array(window._fl) && window._fl.ready === true;
};
/**
* Identify.
*
* @param {Identify} identify
*/
Frontleaf.prototype.identify = function(identify){
var userId = identify.userId();
if (userId) {
this._push('setUser', {
id: userId,
name: identify.name() || identify.username(),
data: clean(identify.traits())
});
}
};
/**
* Group.
*
* @param {Group} group
*/
Frontleaf.prototype.group = function(group){
var groupId = group.groupId();
if (groupId) {
this._push('setAccount', {
id: groupId,
name: group.proxy('traits.name'),
data: clean(group.traits())
});
}
};
/**
* Page.
*
* @param {Page} page
*/
Frontleaf.prototype.page = function(page){
var category = page.category();
var name = page.fullName();
var opts = this.options;
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
};
/**
* Track.
*
* @param {Track} track
*/
Frontleaf.prototype.track = function(track){
var event = track.event();
this._push('event', event, clean(track.properties()));
};
/**
* Push a command onto the global Frontleaf queue.
*
* @param {String} command
* @return {Object} args
* @api private
*/
Frontleaf.prototype._push = function(command){
var args = [].slice.call(arguments, 1);
window._fl.push(function(t){ t[command].apply(command, args); });
};
/**
* Clean all nested objects and arrays.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function clean(obj){
var ret = {};
// Remove traits/properties that are already represented
// outside of the data container
var excludeKeys = ["id","name","firstName","lastName"];
var len = excludeKeys.length;
for (var i = 0; i < len; i++) {
clear(obj, excludeKeys[i]);
}
// Flatten nested hierarchy, preserving arrays
obj = flatten(obj);
// Discard nulls, represent arrays as comma-separated strings
for (var key in obj) {
var val = obj[key];
if (null == val) {
continue;
}
if (is.array(val)) {
ret[key] = val.toString();
continue;
}
ret[key] = val;
}
return ret;
}
/**
* Remove a property from an object if set.
*
* @param {Object} obj
* @param {String} key
* @api private
*/
function clear(obj, key){
if (obj.hasOwnProperty(key)) {
delete obj[key];
}
}
/**
* Flatten a nested object into a single level space-delimited
* hierarchy.
*
* Based on https://github.com/hughsk/flat
*
* @param {Object} source
* @return {Object}
* @api private
*/
function flatten(source){
var output = {};
function step(object, prev){
for (var key in object) {
var value = object[key];
var newKey = prev ? prev + ' ' + key : key;
if (!is.array(value) && is.object(value)) {
return step(value, newKey);
}
output[newKey] = value;
}
}
step(source);
return output;
}
}, {"analytics.js-integration":83,"bind":95,"when":123,"is":86}],
33: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_gauges');
/**
* Expose `Gauges` integration.
*/
var Gauges = module.exports = integration('Gauges')
.assumesPageview()
.global('_gauges')
.option('siteId', '')
.tag('<script id="gauges-tracker" src="//secure.gaug.es/track.js" data-site-id="{{ siteId }}">');
/**
* Initialize Gauges.
*
* http://get.gaug.es/documentation/tracking/
*
* @param {Object} page
*/
Gauges.prototype.initialize = function(page){
window._gauges = window._gauges || [];
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Gauges.prototype.loaded = function(){
return !! (window._gauges && window._gauges.push !== Array.prototype.push);
};
/**
* Page.
*
* @param {Page} page
*/
Gauges.prototype.page = function(page){
push('track');
};
}, {"analytics.js-integration":83,"global-queue":167}],
34: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var onBody = require('on-body');
/**
* Expose `GetSatisfaction` integration.
*/
var GetSatisfaction = module.exports = integration('Get Satisfaction')
.assumesPageview()
.global('GSFN')
.option('widgetId', '')
.tag('<script src="https://loader.engage.gsfn.us/loader.js">');
/**
* Initialize.
*
* https://console.getsatisfaction.com/start/101022?signup=true#engage
*
* @param {Object} page
*/
GetSatisfaction.prototype.initialize = function(page){
var self = this;
var widget = this.options.widgetId;
var div = document.createElement('div');
var id = div.id = 'getsat-widget-' + widget;
onBody(function(body){ body.appendChild(div); });
// usually the snippet is sync, so wait for it before initializing the tab
this.load(function(){
window.GSFN.loadWidget(widget, { containerId: id });
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
GetSatisfaction.prototype.loaded = function(){
return !! window.GSFN;
};
}, {"analytics.js-integration":83,"on-body":121}],
35: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_gaq');
var length = require('object').length;
var canonical = require('canonical');
var useHttps = require('use-https');
var Track = require('facade').Track;
var callback = require('callback');
var load = require('load-script');
var keys = require('object').keys;
var dot = require('obj-case');
var each = require('each');
var type = require('type');
var url = require('url');
var is = require('is');
var group;
var user;
/**
* Expose plugin.
*/
module.exports = exports = function(analytics){
analytics.addIntegration(GA);
group = analytics.group();
user = analytics.user();
};
/**
* Expose `GA` integration.
*
* http://support.google.com/analytics/bin/answer.py?hl=en&answer=2558867
* https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._setSiteSpeedSampleRate
*/
var GA = exports.Integration = integration('Google Analytics')
.readyOnLoad()
.global('ga')
.global('gaplugins')
.global('_gaq')
.global('GoogleAnalyticsObject')
.option('anonymizeIp', false)
.option('classic', false)
.option('domain', 'none')
.option('doubleClick', false)
.option('enhancedLinkAttribution', false)
.option('ignoredReferrers', null)
.option('includeSearch', false)
.option('siteSpeedSampleRate', 1)
.option('trackingId', '')
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.option('sendUserId', false)
.option('metrics', {})
.option('dimensions', {})
.tag('library', '<script src="//www.google-analytics.com/analytics.js">')
.tag('double click', '<script src="//stats.g.doubleclick.net/dc.js">')
.tag('http', '<script src="http://www.google-analytics.com/ga.js">')
.tag('https', '<script src="https://ssl.google-analytics.com/ga.js">');
/**
* When in "classic" mode, on `construct` swap all of the method to point to
* their classic counterparts.
*/
GA.on('construct', function(integration){
if (!integration.options.classic) return;
integration.initialize = integration.initializeClassic;
integration.loaded = integration.loadedClassic;
integration.page = integration.pageClassic;
integration.track = integration.trackClassic;
integration.completedOrder = integration.completedOrderClassic;
});
/**
* Initialize.
*
* https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced
*/
GA.prototype.initialize = function(){
var opts = this.options;
// setup the tracker globals
window.GoogleAnalyticsObject = 'ga';
window.ga = window.ga || function(){
window.ga.q = window.ga.q || [];
window.ga.q.push(arguments);
};
window.ga.l = new Date().getTime();
window.ga('create', opts.trackingId, {
cookieDomain: opts.domain || GA.prototype.defaults.domain, // to protect against empty string
siteSpeedSampleRate: opts.siteSpeedSampleRate,
allowLinker: true
});
// display advertising
if (opts.doubleClick) {
window.ga('require', 'displayfeatures');
}
// send global id
if (opts.sendUserId && user.id()) {
window.ga('set', 'userId', user.id());
}
// anonymize after initializing, otherwise a warning is shown
// in google analytics debugger
if (opts.anonymizeIp) window.ga('set', 'anonymizeIp', true);
// custom dimensions & metrics
var custom = metrics(user.traits(), opts);
if (length(custom)) window.ga('set', custom);
this.load('library', this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
GA.prototype.loaded = function(){
return !! window.gaplugins;
};
/**
* Page.
*
* https://developers.google.com/analytics/devguides/collection/analyticsjs/pages
*
* @param {Page} page
*/
GA.prototype.page = function(page){
var category = page.category();
var props = page.properties();
var name = page.fullName();
var pageview = {};
var track;
this._category = category; // store for later
// send
window.ga('send', 'pageview', {
page: path(props, this.options),
title: name || props.title,
location: props.url
});
// categorized pages
if (category && this.options.trackCategorizedPages) {
track = page.track(category);
this.track(track, { noninteraction: true });
}
// named pages
if (name && this.options.trackNamedPages) {
track = page.track(name);
this.track(track, { noninteraction: true });
}
};
/**
* Track.
*
* https://developers.google.com/analytics/devguides/collection/analyticsjs/events
* https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference
*
* @param {Track} event
*/
GA.prototype.track = function(track, options){
var opts = options || track.options(this.name);
var props = track.properties();
window.ga('send', 'event', {
eventAction: track.event(),
eventCategory: props.category || this._category || 'All',
eventLabel: props.label,
eventValue: formatValue(props.value || track.revenue()),
nonInteraction: props.noninteraction || opts.noninteraction
});
};
/**
* Completed order.
*
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
* https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#multicurrency
*
* @param {Track} track
* @api private
*/
GA.prototype.completedOrder = function(track){
var total = track.total() || track.revenue() || 0;
var orderId = track.orderId();
var products = track.products();
var props = track.properties();
// orderId is required.
if (!orderId) return;
// require ecommerce
if (!this.ecommerce) {
window.ga('require', 'ecommerce');
this.ecommerce = true;
}
// add transaction
window.ga('ecommerce:addTransaction', {
affiliation: props.affiliation,
shipping: track.shipping(),
revenue: total,
tax: track.tax(),
id: orderId,
currency: track.currency()
});
// add products
each(products, function(product){
var track = new Track({ properties: product });
window.ga('ecommerce:addItem', {
category: track.category(),
quantity: track.quantity(),
price: track.price(),
name: track.name(),
sku: track.sku(),
id: orderId,
currency: track.currency()
});
});
// send
window.ga('ecommerce:send');
};
/**
* Initialize (classic).
*
* https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration
*/
GA.prototype.initializeClassic = function(){
var opts = this.options;
var anonymize = opts.anonymizeIp;
var db = opts.doubleClick;
var domain = opts.domain;
var enhanced = opts.enhancedLinkAttribution;
var ignore = opts.ignoredReferrers;
var sample = opts.siteSpeedSampleRate;
window._gaq = window._gaq || [];
push('_setAccount', opts.trackingId);
push('_setAllowLinker', true);
if (anonymize) push('_gat._anonymizeIp');
if (domain) push('_setDomainName', domain);
if (sample) push('_setSiteSpeedSampleRate', sample);
if (enhanced) {
var protocol = 'https:' === document.location.protocol ? 'https:' : 'http:';
var pluginUrl = protocol + '//www.google-analytics.com/plugins/ga/inpage_linkid.js';
push('_require', 'inpage_linkid', pluginUrl);
}
if (ignore) {
if (!is.array(ignore)) ignore = [ignore];
each(ignore, function (domain) {
push('_addIgnoredRef', domain);
});
}
if (this.options.doubleClick) {
this.load('double click', this.ready);
} else {
var name = useHttps() ? 'https' : 'http';
this.load(name, this.ready);
}
};
/**
* Loaded? (classic)
*
* @return {Boolean}
*/
GA.prototype.loadedClassic = function(){
return !! (window._gaq && window._gaq.push !== Array.prototype.push);
};
/**
* Page (classic).
*
* https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration
*
* @param {Page} page
*/
GA.prototype.pageClassic = function(page){
var opts = page.options(this.name);
var category = page.category();
var props = page.properties();
var name = page.fullName();
var track;
push('_trackPageview', path(props, this.options));
// categorized pages
if (category && this.options.trackCategorizedPages) {
track = page.track(category);
this.track(track, { noninteraction: true });
}
// named pages
if (name && this.options.trackNamedPages) {
track = page.track(name);
this.track(track, { noninteraction: true });
}
};
/**
* Track (classic).
*
* https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEventTracking
*
* @param {Track} track
*/
GA.prototype.trackClassic = function(track, options){
var opts = options || track.options(this.name);
var props = track.properties();
var revenue = track.revenue();
var event = track.event();
var category = this._category || props.category || 'All';
var label = props.label;
var value = formatValue(revenue || props.value);
var noninteraction = props.noninteraction || opts.noninteraction;
push('_trackEvent', category, event, label, value, noninteraction);
};
/**
* Completed order.
*
* https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingEcommerce
* https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingEcommerce#localcurrencies
*
* @param {Track} track
* @api private
*/
GA.prototype.completedOrderClassic = function(track){
var total = track.total() || track.revenue() || 0;
var orderId = track.orderId();
var products = track.products() || [];
var props = track.properties();
var currency = track.currency();
// required
if (!orderId) return;
// add transaction
push('_addTrans'
, orderId
, props.affiliation
, total
, track.tax()
, track.shipping()
, track.city()
, track.state()
, track.country());
// add items
each(products, function(product){
var track = new Track({ properties: product });
push('_addItem'
, orderId
, track.sku()
, track.name()
, track.category()
, track.price()
, track.quantity());
});
// send
push('_set', 'currencyCode', currency);
push('_trackTrans');
};
/**
* Return the path based on `properties` and `options`.
*
* @param {Object} properties
* @param {Object} options
*/
function path(properties, options) {
if (!properties) return;
var str = properties.path;
if (options.includeSearch && properties.search) str += properties.search;
return str;
}
/**
* Format the value property to Google's liking.
*
* @param {Number} value
* @return {Number}
*/
function formatValue(value) {
if (!value || value < 0) return 0;
return Math.round(value);
}
/**
* Map google's custom dimensions & metrics with `obj`.
*
* Example:
*
* metrics({ revenue: 1.9 }, { { metrics : { revenue: 'metric8' } });
* // => { metric8: 1.9 }
*
* metrics({ revenue: 1.9 }, {});
* // => {}
*
* @param {Object} obj
* @param {Object} data
* @return {Object|null}
* @api private
*/
function metrics(obj, data){
var dimensions = data.dimensions;
var metrics = data.metrics;
var names = keys(metrics).concat(keys(dimensions));
var ret = {};
for (var i = 0; i < names.length; ++i) {
var name = names[i];
var key = metrics[name] || dimensions[name];
var value = dot(obj, name) || obj[name];
if (null == value) continue;
ret[key] = value;
}
return ret;
}
}, {"analytics.js-integration":83,"global-queue":167,"object":174,"canonical":175,"use-https":85,"facade":124,"callback":88,"load-script":120,"obj-case":138,"each":4,"type":7,"url":176,"is":86}],
174: [function(require, module, exports) {
/**
* HOP ref.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Return own keys in `obj`.
*
* @param {Object} obj
* @return {Array}
* @api public
*/
exports.keys = Object.keys || function(obj){
var keys = [];
for (var key in obj) {
if (has.call(obj, key)) {
keys.push(key);
}
}
return keys;
};
/**
* Return own values in `obj`.
*
* @param {Object} obj
* @return {Array}
* @api public
*/
exports.values = function(obj){
var vals = [];
for (var key in obj) {
if (has.call(obj, key)) {
vals.push(obj[key]);
}
}
return vals;
};
/**
* Merge `b` into `a`.
*
* @param {Object} a
* @param {Object} b
* @return {Object} a
* @api public
*/
exports.merge = function(a, b){
for (var key in b) {
if (has.call(b, key)) {
a[key] = b[key];
}
}
return a;
};
/**
* Return length of `obj`.
*
* @param {Object} obj
* @return {Number}
* @api public
*/
exports.length = function(obj){
return exports.keys(obj).length;
};
/**
* Check if `obj` is empty.
*
* @param {Object} obj
* @return {Boolean}
* @api public
*/
exports.isEmpty = function(obj){
return 0 == exports.length(obj);
};
}, {}],
175: [function(require, module, exports) {
module.exports = function canonical () {
var tags = document.getElementsByTagName('link');
for (var i = 0, tag; tag = tags[i]; i++) {
if ('canonical' == tag.getAttribute('rel')) return tag.getAttribute('href');
}
};
}, {}],
176: [function(require, module, exports) {
/**
* Parse the given `url`.
*
* @param {String} str
* @return {Object}
* @api public
*/
exports.parse = function(url){
var a = document.createElement('a');
a.href = url;
return {
href: a.href,
host: a.host,
port: a.port,
hash: a.hash,
hostname: a.hostname,
pathname: a.pathname,
protocol: a.protocol,
search: a.search,
query: a.search.slice(1)
}
};
/**
* Check if `url` is absolute.
*
* @param {String} url
* @return {Boolean}
* @api public
*/
exports.isAbsolute = function(url){
if (0 == url.indexOf('//')) return true;
if (~url.indexOf('://')) return true;
return false;
};
/**
* Check if `url` is relative.
*
* @param {String} url
* @return {Boolean}
* @api public
*/
exports.isRelative = function(url){
return ! exports.isAbsolute(url);
};
/**
* Check if `url` is cross domain.
*
* @param {String} url
* @return {Boolean}
* @api public
*/
exports.isCrossDomain = function(url){
url = exports.parse(url);
return url.hostname != location.hostname
|| url.port != location.port
|| url.protocol != location.protocol;
};
}, {}],
36: [function(require, module, exports) {
/**
* Module dependencies.
*/
var push = require('global-queue')('dataLayer', { wrap: false });
var integration = require('analytics.js-integration');
/**
* Expose `GTM`.
*/
var GTM = module.exports = integration('Google Tag Manager')
.assumesPageview()
.global('dataLayer')
.global('google_tag_manager')
.option('containerId', '')
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.tag('<script src="//www.googletagmanager.com/gtm.js?id={{ containerId }}&l=dataLayer">');
/**
* Initialize.
*
* https://developers.google.com/tag-manager
*
* @param {Object} page
*/
GTM.prototype.initialize = function(){
push({ 'gtm.start': +new Date, event: 'gtm.js' });
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
GTM.prototype.loaded = function(){
return !! (window.dataLayer && [].push != window.dataLayer.push);
};
/**
* Page.
*
* @param {Page} page
* @api public
*/
GTM.prototype.page = function(page){
var category = page.category();
var props = page.properties();
var name = page.fullName();
var opts = this.options;
var track;
// all
if (opts.trackAllPages) {
this.track(page.track());
}
// categorized
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
// named
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
};
/**
* Track.
*
* https://developers.google.com/tag-manager/devguide#events
*
* @param {Track} track
* @api public
*/
GTM.prototype.track = function(track){
var props = track.properties();
props.event = track.event();
push(props);
};
}, {"global-queue":167,"analytics.js-integration":83}],
37: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var Identify = require('facade').Identify;
var Track = require('facade').Track;
var callback = require('callback');
var load = require('load-script');
var onBody = require('on-body');
var each = require('each');
/**
* Expose `GoSquared` integration.
*/
var GoSquared = module.exports = integration('GoSquared')
.assumesPageview()
.global('_gs')
.option('siteToken', '')
.option('anonymizeIP', false)
.option('cookieDomain', null)
.option('useCookies', true)
.option('trackHash', false)
.option('trackLocal', false)
.option('trackParams', true)
.tag('<script src="//d1l6p2sc9645hc.cloudfront.net/tracker.js">');
/**
* Initialize.
*
* https://www.gosquared.com/developer/tracker
* Options: https://www.gosquared.com/developer/tracker/configuration
*
* @param {Object} page
*/
GoSquared.prototype.initialize = function(page){
var self = this;
var options = this.options;
var user = this.analytics.user();
push(options.siteToken);
each(options, function(name, value){
if ('siteToken' == name) return;
if (null == value) return;
push('set', name, value);
});
self.identify(new Identify({
traits: user.traits(),
userId: user.id()
}));
self.load(this.ready);
};
/**
* Loaded? (checks if the tracker version is set)
*
* @return {Boolean}
*/
GoSquared.prototype.loaded = function(){
return !! (window._gs && window._gs.v);
};
/**
* Page.
*
* https://www.gosquared.com/developer/tracker/pageviews
*
* @param {Page} page
*/
GoSquared.prototype.page = function(page){
var props = page.properties();
var name = page.fullName();
push('track', props.path, name || props.title)
};
/**
* Identify.
*
* https://www.gosquared.com/developer/tracker/tagging
*
* @param {Identify} identify
*/
GoSquared.prototype.identify = function(identify){
var traits = identify.traits({ userId: 'userID' });
var username = identify.username();
var email = identify.email();
var id = identify.userId();
if (id) push('set', 'visitorID', id);
var name = email || username || id;
if (name) push('set', 'visitorName', name);
push('set', 'visitor', traits);
};
/**
* Track.
*
* https://www.gosquared.com/developer/tracker/events
*
* @param {Track} track
*/
GoSquared.prototype.track = function(track){
push('event', track.event(), track.properties());
};
/**
* Checked out.
*
* @param {Track} track
* @api private
*/
GoSquared.prototype.completedOrder = function(track){
var products = track.products();
var items = [];
each(products, function(product){
var track = new Track({ properties: product });
items.push({
category: track.category(),
quantity: track.quantity(),
price: track.price(),
name: track.name(),
});
})
push('transaction', track.orderId(), {
revenue: track.total(),
track: true
}, items);
};
/**
* Push to `_gs.q`.
*
* @param {...} args
* @api private
*/
function push(){
var _gs = window._gs = window._gs || function(){
(_gs.q = _gs.q || []).push(arguments);
};
_gs.apply(null, arguments);
}
}, {"analytics.js-integration":83,"facade":124,"callback":88,"load-script":120,"on-body":121,"each":4}],
38: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var alias = require('alias');
/**
* Expose `Heap` integration.
*/
var Heap = module.exports = integration('Heap')
.assumesPageview()
.global('heap')
.global('_heapid')
.option('apiKey', '')
.tag('<script src="//d36lvucg9kzous.cloudfront.net">');
/**
* Initialize.
*
* https://heapanalytics.com/docs#installWeb
*
* @param {Object} page
*/
Heap.prototype.initialize = function(page){
window.heap=window.heap||[];window.heap.load=function(a){window._heapid=a;var d=function(a){return function(){window.heap.push([a].concat(Array.prototype.slice.call(arguments,0)));};},e=["identify","track"];for (var f=0;f<e.length;f++)window.heap[e[f]]=d(e[f]);};
window.heap.load(this.options.apiKey);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Heap.prototype.loaded = function(){
return (window.heap && window.heap.appid);
};
/**
* Identify.
*
* https://heapanalytics.com/docs#identify
*
* @param {Identify} identify
*/
Heap.prototype.identify = function(identify){
var traits = identify.traits();
var username = identify.username();
var id = identify.userId();
var handle = username || id;
if (handle) traits.handle = handle;
delete traits.username;
window.heap.identify(traits);
};
/**
* Track.
*
* https://heapanalytics.com/docs#track
*
* @param {Track} track
*/
Heap.prototype.track = function(track){
window.heap.track(track.event(), track.properties());
};
}, {"analytics.js-integration":83,"alias":172}],
39: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `hellobar.com` integration.
*/
var Hellobar = module.exports = integration('Hello Bar')
.assumesPageview()
.global('_hbq')
.option('apiKey', '')
.tag('<script src="//s3.amazonaws.com/scripts.hellobar.com/{{ apiKey }}.js">');
/**
* Initialize.
*
* https://s3.amazonaws.com/scripts.hellobar.com/bb900665a3090a79ee1db98c3af21ea174bbc09f.js
*
* @param {Object} page
*/
Hellobar.prototype.initialize = function(page){
window._hbq = window._hbq || [];
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Hellobar.prototype.loaded = function(){
return !! (window._hbq && window._hbq.push !== Array.prototype.push);
};
}, {"analytics.js-integration":83}],
40: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var is = require('is');
/**
* Expose `HitTail` integration.
*/
var HitTail = module.exports = integration('HitTail')
.assumesPageview()
.global('htk')
.option('siteId', '')
.tag('<script src="//{{ siteId }}.hittail.com/mlt.js">');
/**
* Initialize.
*
* @param {Object} page
*/
HitTail.prototype.initialize = function(page){
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
HitTail.prototype.loaded = function(){
return is.fn(window.htk);
};
}, {"analytics.js-integration":83,"is":86}],
41: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `hublo.com` integration.
*/
var Hublo = module.exports = integration('Hublo')
.assumesPageview()
.global('_hublo_')
.option('apiKey', null)
.tag('<script src="//cdn.hublo.co/{{ apiKey }}.js">');
/**
* Initialize.
*
* https://cdn.hublo.co/5353a2e62b26c1277b000004.js
*
* @param {Object} page
*/
Hublo.prototype.initialize = function(page){
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Hublo.prototype.loaded = function(){
return !! (window._hublo_ && typeof window._hublo_.setup === 'function');
};
}, {"analytics.js-integration":83}],
42: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_hsq');
var convert = require('convert-dates');
/**
* Expose `HubSpot` integration.
*/
var HubSpot = module.exports = integration('HubSpot')
.assumesPageview()
.global('_hsq')
.option('portalId', null)
.tag('<script id="hs-analytics" src="https://js.hs-analytics.net/analytics/{{ cache }}/{{ portalId }}.js">');
/**
* Initialize.
*
* @param {Object} page
*/
HubSpot.prototype.initialize = function(page){
window._hsq = [];
var cache = Math.ceil(new Date() / 300000) * 300000;
this.load({ cache: cache }, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
HubSpot.prototype.loaded = function(){
return !! (window._hsq && window._hsq.push !== Array.prototype.push);
};
/**
* Page.
*
* @param {String} category (optional)
* @param {String} name (optional)
* @param {Object} properties (optional)
* @param {Object} options (optional)
*/
HubSpot.prototype.page = function(page){
push('_trackPageview');
};
/**
* Identify.
*
* @param {Identify} identify
*/
HubSpot.prototype.identify = function(identify){
if (!identify.email()) return;
var traits = identify.traits();
traits = convertDates(traits);
push('identify', traits);
};
/**
* Track.
*
* @param {Track} track
*/
HubSpot.prototype.track = function(track){
var props = track.properties();
props = convertDates(props);
push('trackEvent', track.event(), props);
};
/**
* Convert all the dates in the HubSpot properties to millisecond times
*
* @param {Object} properties
*/
function convertDates(properties){
return convert(properties, function(date){ return date.getTime(); });
}
}, {"analytics.js-integration":83,"global-queue":167,"convert-dates":173}],
43: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var alias = require('alias');
/**
* Expose `Improvely` integration.
*/
var Improvely = module.exports = integration('Improvely')
.assumesPageview()
.global('_improvely')
.global('improvely')
.option('domain', '')
.option('projectId', null)
.tag('<script src="//{{ domain }}.iljmp.com/improvely.js">');
/**
* Initialize.
*
* http://www.improvely.com/docs/landing-page-code
*
* @param {Object} page
*/
Improvely.prototype.initialize = function(page){
window._improvely = [];
window.improvely = { init: function(e, t){ window._improvely.push(["init", e, t]); }, goal: function(e){ window._improvely.push(["goal", e]); }, label: function(e){ window._improvely.push(["label", e]); }};
var domain = this.options.domain;
var id = this.options.projectId;
window.improvely.init(domain, id);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Improvely.prototype.loaded = function(){
return !! (window.improvely && window.improvely.identify);
};
/**
* Identify.
*
* http://www.improvely.com/docs/labeling-visitors
*
* @param {Identify} identify
*/
Improvely.prototype.identify = function(identify){
var id = identify.userId();
if (id) window.improvely.label(id);
};
/**
* Track.
*
* http://www.improvely.com/docs/conversion-code
*
* @param {Track} track
*/
Improvely.prototype.track = function(track){
var props = track.properties({ revenue: 'amount' });
props.type = track.event();
window.improvely.goal(props);
};
}, {"analytics.js-integration":83,"alias":172}],
44: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_iva');
var Track = require('facade').Track;
var is = require('is');
/**
* HOP.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Expose `InsideVault` integration.
*/
var InsideVault = module.exports = integration('InsideVault')
.global('_iva')
.option('clientId', '')
.option('domain', '')
.tag('<script src="//analytics.staticiv.com/iva.js">')
.mapping('events');
/**
* Initialize.
*
* @param page
*/
InsideVault.prototype.initialize = function(page){
var domain = this.options.domain;
window._iva = window._iva || [];
push('setClientId', this.options.clientId);
if (domain) push('setDomain', domain);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
InsideVault.prototype.loaded = function(){
return !! (window._iva && window._iva.push !== Array.prototype.push);
};
/**
* Page.
*
* @param {Page} page
*/
InsideVault.prototype.page = function(page){
// they want every landing page to send a "click" event.
push('trackEvent', 'click');
};
/**
* Track.
*
* Tracks everything except 'sale' events.
*
* @param {Track} track
*/
InsideVault.prototype.track = function(track){
var user = this.analytics.user();
var events = this.options.events;
var event = track.event();
var value = track.revenue() || track.value() || 0;
var eventId = track.orderId() || user.id() || '';
if (!has.call(events, event)) return;
event = events[event];
// 'sale' is a special event that will be routed to a table that is deprecated on InsideVault's end.
// They don't want a generic 'sale' event to go to their deprecated table.
if (event != 'sale') {
push('trackEvent', event, value, eventId);
}
};
}, {"analytics.js-integration":83,"global-queue":167,"facade":124,"is":86}],
45: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('__insp');
var alias = require('alias');
var clone = require('clone');
/**
* Expose `Inspectlet` integration.
*/
var Inspectlet = module.exports = integration('Inspectlet')
.assumesPageview()
.global('__insp')
.global('__insp_')
.option('wid', '')
.tag('<script src="//www.inspectlet.com/inspectlet.js">');
/**
* Initialize.
*
* https://www.inspectlet.com/dashboard/embedcode/1492461759/initial
*
* @param {Object} page
*/
Inspectlet.prototype.initialize = function(page){
push('wid', this.options.wid);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Inspectlet.prototype.loaded = function(){
return !! window.__insp_;
};
/**
* Identify.
*
* http://www.inspectlet.com/docs#tagging
*
* @param {Identify} identify
*/
Inspectlet.prototype.identify = function (identify) {
var traits = identify.traits({ id: 'userid' });
push('tagSession', traits);
};
/**
* Track.
*
* http://www.inspectlet.com/docs/tags
*
* @param {Track} track
*/
Inspectlet.prototype.track = function(track){
push('tagSession', track.event());
};
}, {"analytics.js-integration":83,"global-queue":167,"alias":172,"clone":171}],
46: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var convertDates = require('convert-dates');
var defaults = require('defaults');
var isEmail = require('is-email');
var load = require('load-script');
var empty = require('is-empty');
var alias = require('alias');
var each = require('each');
var when = require('when');
var is = require('is');
/**
* Expose `Intercom` integration.
*/
var Intercom = module.exports = integration('Intercom')
.assumesPageview()
.global('Intercom')
.option('activator', '#IntercomDefaultWidget')
.option('appId', '')
.option('inbox', false)
.tag('<script src="https://static.intercomcdn.com/intercom.v1.js">');
/**
* Initialize.
*
* http://docs.intercom.io/
* http://docs.intercom.io/#IntercomJS
*
* @param {Object} page
*/
Intercom.prototype.initialize = function(page){
var self = this;
this.load(function(){
when(function(){ return self.loaded(); }, self.ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Intercom.prototype.loaded = function(){
return is.fn(window.Intercom);
};
/**
* Page.
*
* @param {Page} page
*/
Intercom.prototype.page = function(page){
window.Intercom('update');
};
/**
* Identify.
*
* http://docs.intercom.io/#IntercomJS
*
* @param {Identify} identify
*/
Intercom.prototype.identify = function(identify){
var traits = identify.traits({ userId: 'user_id' });
var activator = this.options.activator;
var opts = identify.options(this.name);
var companyCreated = identify.companyCreated();
var created = identify.created();
var email = identify.email();
var name = identify.name();
var id = identify.userId();
var group = this.analytics.group();
if (!id && !traits.email) return; // one is required
traits.app_id = this.options.appId;
// intercom requires `company` to be an object. default it with group traits
// so that we guarantee an `id` is there, since they require it
if (null != traits.company && !is.object(traits.company)) delete traits.company;
if (traits.company) defaults(traits.company, group.traits());
// name
if (name) traits.name = name;
// handle dates
if (traits.company && companyCreated) traits.company.created = companyCreated;
if (created) traits.created = created;
// convert dates
traits = convertDates(traits, formatDate);
traits = alias(traits, { created: 'created_at'});
if (traits.company) traits.company = alias(traits.company, { created: 'created_at' });
// handle options
if (opts.increments) traits.increments = opts.increments;
if (opts.userHash) traits.user_hash = opts.userHash;
if (opts.user_hash) traits.user_hash = opts.user_hash;
// Intercom, will force the widget to appear
// if the selector is #IntercomDefaultWidget
// so no need to check inbox, just need to check
// that the selector isn't #IntercomDefaultWidget.
if ('#IntercomDefaultWidget' != activator) {
traits.widget = { activator: activator };
}
var method = this._id !== id ? 'boot': 'update';
this._id = id; // cache for next time
window.Intercom(method, traits);
};
/**
* Group.
*
* @param {Group} group
*/
Intercom.prototype.group = function(group){
var props = group.properties();
var id = group.groupId();
if (id) props.id = id;
window.Intercom('update', { company: props });
};
/**
* Track.
*
* @param {Track} track
*/
Intercom.prototype.track = function(track){
window.Intercom('trackEvent', track.event(), track.properties());
};
/**
* Format a date to Intercom's liking.
*
* @param {Date} date
* @return {Number}
*/
function formatDate(date) {
return Math.floor(date / 1000);
}
}, {"analytics.js-integration":83,"convert-dates":173,"defaults":166,"is-email":162,"load-script":120,"is-empty":118,"alias":172,"each":4,"when":123,"is":86}],
47: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `Keen IO` integration.
*/
var Keen = module.exports = integration('Keen IO')
.global('Keen')
.option('projectId', '')
.option('readKey', '')
.option('writeKey', '')
.option('ipAddon', false)
.option('uaAddon', false)
.option('urlAddon', false)
.option('referrerAddon', false)
.option('trackNamedPages', true)
.option('trackAllPages', false)
.option('trackCategorizedPages', true)
.tag('<script src="//d26b395fwzu5fz.cloudfront.net/3.0.7/{{ lib }}.min.js">');
/**
* Initialize.
*
* https://keen.io/docs/
*/
Keen.prototype.initialize = function(){
var options = this.options;
!function(a,b){if(void 0===b[a]){b["_"+a]={},b[a]=function(c){b["_"+a].clients=b["_"+a].clients||{},b["_"+a].clients[c.projectId]=this,this._config=c},b[a].ready=function(c){b["_"+a].ready=b["_"+a].ready||[],b["_"+a].ready.push(c)};for(var c=["addEvent","setGlobalProperties","trackExternalLink","on"],d=0;d<c.length;d++){var e=c[d],f=function(a){return function(){return this["_"+a]=this["_"+a]||[],this["_"+a].push(arguments),this}};b[a].prototype[e]=f(e)}}}("Keen",window);
this.client = new window.Keen({
projectId: options.projectId,
writeKey: options.writeKey,
readKey: options.readKey
});
// if you have a read-key, then load the full keen library
var lib = this.options.readKey ? 'keen' : 'keen-tracker';
this.load({ lib: lib }, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Keen.prototype.loaded = function(){
return !!(window.Keen && window.Keen.prototype.configure);
};
/**
* Page.
*
* @param {Page} page
*/
Keen.prototype.page = function(page){
var category = page.category();
var props = page.properties();
var name = page.fullName();
var opts = this.options;
// all pages
if (opts.trackAllPages) {
this.track(page.track());
}
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
};
/**
* Identify.
*
* TODO: migrate from old `userId` to simpler `id`
* https://keen.io/docs/data-collection/data-enrichment/#add-ons
*
* Set up the Keen addons object. These must be specifically
* enabled by the settings in order to include the plugins, or else
* Keen will reject the request.
*
* @param {Identify} identify
*/
Keen.prototype.identify = function(identify){
var traits = identify.traits();
var id = identify.userId();
var user = {};
var options = this.options;
if (id) user.userId = id;
if (traits) user.traits = traits;
var props = { user: user };
var addons = [];
if (options.ipAddon) {
addons.push({
name: 'keen:ip_to_geo',
input: { ip: 'ip_address' },
output: 'ip_geo_info'
});
props.ip_address = '${keen.ip}';
}
if (options.uaAddon) {
addons.push({
name: 'keen:ua_parser',
input: { ua_string: 'user_agent' },
output: 'parsed_user_agent'
});
props.user_agent = '${keen.user_agent}';
}
if (options.urlAddon) {
addons.push({
name: 'keen:url_parser',
input: { url: 'page_url' },
output: 'parsed_page_url'
});
props.page_url = document.location.href;
}
if (options.referrerAddon) {
addons.push({
name: 'keen:referrer_parser',
input: {
referrer_url: 'referrer_url',
page_url: 'page_url'
},
output: 'referrer_info'
});
props.referrer_url = document.referrer;
props.page_url = document.location.href;
}
props.keen = {
timestamp: identify.timestamp(),
addons: addons
};
this.client.setGlobalProperties(function(){
return props;
});
};
/**
* Track.
*
* @param {Track} track
*/
Keen.prototype.track = function(track){
this.client.addEvent(track.event(), track.properties());
};
}, {"analytics.js-integration":83}],
48: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var indexof = require('indexof');
var is = require('is');
/**
* Expose `Kenshoo` integration.
*/
var Kenshoo = module.exports = integration('Kenshoo')
.global('k_trackevent')
.option('cid', '')
.option('subdomain', '')
.option('events', [])
.tag('<script src="//{{ subdomain }}.xg4ken.com/media/getpx.php?cid={{ cid }}">');
/**
* Initialize.
*
* See https://gist.github.com/justinboyle/7875832
*
* @param {Object} page
*/
Kenshoo.prototype.initialize = function(page){
this.load(this.ready);
};
/**
* Loaded? (checks if the tracking function is set)
*
* @return {Boolean}
*/
Kenshoo.prototype.loaded = function(){
return is.fn(window.k_trackevent);
};
/**
* Track.
*
* Only tracks events if they are listed in the events array option.
* We've asked for docs a few times but no go :/
*
* https://github.com/jorgegorka/the_tracker/blob/master/lib/the_tracker/trackers/kenshoo.rb
*
* @param {Track} event
*/
Kenshoo.prototype.track = function(track){
var events = this.options.events;
var traits = track.traits();
var event = track.event();
var revenue = track.revenue() || 0;
if (!~indexof(events, event)) return;
var params = [
'id=' + this.options.cid,
'type=conv',
'val=' + revenue,
'orderId=' + track.orderId(),
'promoCode=' + track.coupon(),
'valueCurrency=' + track.currency(),
// Live tracking fields. Ignored for now (until we get documentation).
'GCID=',
'kw=',
'product='
];
window.k_trackevent(params, this.options.subdomain);
};
}, {"analytics.js-integration":83,"indexof":109,"is":86}],
49: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_kmq');
var Track = require('facade').Track;
var alias = require('alias');
var Batch = require('batch');
var each = require('each');
var is = require('is');
/**
* Expose `KISSmetrics` integration.
*/
var KISSmetrics = module.exports = integration('KISSmetrics')
.assumesPageview()
.global('_kmq')
.global('KM')
.global('_kmil')
.option('apiKey', '')
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.option('prefixProperties', true)
.tag('useless', '<script src="//i.kissmetrics.com/i.js">')
.tag('library', '<script src="//doug1izaerwt3.cloudfront.net/{{ apiKey }}.1.js">');
/**
* Check if browser is mobile, for kissmetrics.
*
* http://support.kissmetrics.com/how-tos/browser-detection.html#mobile-vs-non-mobile
*/
exports.isMobile = navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/iPhone|iPod/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/Opera Mini/i)
|| navigator.userAgent.match(/IEMobile/i);
/**
* Initialize.
*
* http://support.kissmetrics.com/apis/javascript
*
* @param {Object} page
*/
KISSmetrics.prototype.initialize = function(page){
var self = this;
window._kmq = [];
if (exports.isMobile) push('set', { 'Mobile Session': 'Yes' });
var batch = new Batch();
batch.push(function(done){ self.load('useless', done); }) // :)
batch.push(function(done){ self.load('library', done); })
batch.end(function(){
self.trackPage(page);
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
KISSmetrics.prototype.loaded = function(){
return is.object(window.KM);
};
/**
* Page.
*
* @param {Page} page
*/
KISSmetrics.prototype.page = function(page){
if (!window.KM_SKIP_PAGE_VIEW) window.KM.pageView();
this.trackPage(page);
};
/**
* Track page.
*
* @param {Page} page
*/
KISSmetrics.prototype.trackPage = function(page){
var category = page.category();
var name = page.fullName();
var opts = this.options;
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
};
/**
* Identify.
*
* @param {Identify} identify
*/
KISSmetrics.prototype.identify = function(identify){
var traits = identify.traits();
var id = identify.userId();
if (id) push('identify', id);
if (traits) push('set', traits);
};
/**
* Track.
*
* @param {Track} track
*/
KISSmetrics.prototype.track = function(track){
var mapping = { revenue: 'Billing Amount' };
var event = track.event();
var properties = track.properties(mapping);
if (this.options.prefixProperties) properties = prefix(event, properties);
push('record', event, properties);
};
/**
* Alias.
*
* @param {Alias} to
*/
KISSmetrics.prototype.alias = function(alias){
push('alias', alias.to(), alias.from());
};
/**
* Completed order.
*
* @param {Track} track
* @api private
*/
KISSmetrics.prototype.completedOrder = function(track){
var products = track.products();
var event = track.event();
// transaction
push('record', event, prefix(event, track.properties()));
// items
window._kmq.push(function(){
var km = window.KM;
each(products, function(product, i){
var temp = new Track({ event: event, properties: product });
var item = prefix(event, product);
item._t = km.ts() + i;
item._d = 1;
km.set(item);
});
});
};
/**
* Prefix properties with the event name.
*
* @param {String} event
* @param {Object} properties
* @return {Object} prefixed
* @api private
*/
function prefix(event, properties){
var prefixed = {};
each(properties, function(key, val){
if (key === 'Billing Amount') {
prefixed[key] = val;
} else {
prefixed[event + ' - ' + key] = val;
}
});
return prefixed;
}
}, {"analytics.js-integration":83,"global-queue":167,"facade":124,"alias":172,"batch":177,"each":4,"is":86}],
177: [function(require, module, exports) {
/**
* Module dependencies.
*/
try {
var EventEmitter = require('events').EventEmitter;
} catch (err) {
var Emitter = require('emitter');
}
/**
* Noop.
*/
function noop(){}
/**
* Expose `Batch`.
*/
module.exports = Batch;
/**
* Create a new Batch.
*/
function Batch() {
if (!(this instanceof Batch)) return new Batch;
this.fns = [];
this.concurrency(Infinity);
this.throws(true);
for (var i = 0, len = arguments.length; i < len; ++i) {
this.push(arguments[i]);
}
}
/**
* Inherit from `EventEmitter.prototype`.
*/
if (EventEmitter) {
Batch.prototype.__proto__ = EventEmitter.prototype;
} else {
Emitter(Batch.prototype);
}
/**
* Set concurrency to `n`.
*
* @param {Number} n
* @return {Batch}
* @api public
*/
Batch.prototype.concurrency = function(n){
this.n = n;
return this;
};
/**
* Queue a function.
*
* @param {Function} fn
* @return {Batch}
* @api public
*/
Batch.prototype.push = function(fn){
this.fns.push(fn);
return this;
};
/**
* Set wether Batch will or will not throw up.
*
* @param {Boolean} throws
* @return {Batch}
* @api public
*/
Batch.prototype.throws = function(throws) {
this.e = !!throws;
return this;
};
/**
* Execute all queued functions in parallel,
* executing `cb(err, results)`.
*
* @param {Function} cb
* @return {Batch}
* @api public
*/
Batch.prototype.end = function(cb){
var self = this
, total = this.fns.length
, pending = total
, results = []
, errors = []
, cb = cb || noop
, fns = this.fns
, max = this.n
, throws = this.e
, index = 0
, done;
// empty
if (!fns.length) return cb(null, results);
// process
function next() {
var i = index++;
var fn = fns[i];
if (!fn) return;
var start = new Date;
try {
fn(callback);
} catch (err) {
callback(err);
}
function callback(err, res){
if (done) return;
if (err && throws) return done = true, cb(err);
var complete = total - pending + 1;
var end = new Date;
results[i] = res;
errors[i] = err;
self.emit('progress', {
index: i,
value: res,
error: err,
pending: pending,
total: total,
complete: complete,
percent: complete / total * 100 | 0,
start: start,
end: end,
duration: end - start
});
if (--pending) next()
else if(!throws) cb(errors, results);
else cb(null, results);
}
}
// concurrency
for (var i = 0; i < fns.length; i++) {
if (i == max) break;
next();
}
return this;
};
}, {"emitter":178}],
178: [function(require, module, exports) {
/**
* Expose `Emitter`.
*/
module.exports = Emitter;
/**
* Initialize a new `Emitter`.
*
* @api public
*/
function Emitter(obj) {
if (obj) return mixin(obj);
};
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
return obj;
}
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
(this._callbacks[event] = this._callbacks[event] || [])
.push(fn);
return this;
};
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.once = function(event, fn){
var self = this;
this._callbacks = this._callbacks || {};
function on() {
self.off(event, on);
fn.apply(this, arguments);
}
on.fn = fn;
this.on(event, on);
return this;
};
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
// all
if (0 == arguments.length) {
this._callbacks = {};
return this;
}
// specific event
var callbacks = this._callbacks[event];
if (!callbacks) return this;
// remove all handlers
if (1 == arguments.length) {
delete this._callbacks[event];
return this;
}
// remove specific handler
var cb;
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
}
return this;
};
/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/
Emitter.prototype.emit = function(event){
this._callbacks = this._callbacks || {};
var args = [].slice.call(arguments, 1)
, callbacks = this._callbacks[event];
if (callbacks) {
callbacks = callbacks.slice(0);
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
return this;
};
/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/
Emitter.prototype.listeners = function(event){
this._callbacks = this._callbacks || {};
return this._callbacks[event] || [];
};
/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/
Emitter.prototype.hasListeners = function(event){
return !! this.listeners(event).length;
};
}, {}],
50: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_learnq');
var tick = require('next-tick');
var alias = require('alias');
/**
* Trait aliases.
*/
var aliases = {
id: '$id',
email: '$email',
firstName: '$first_name',
lastName: '$last_name',
phone: '$phone_number',
title: '$title'
};
/**
* Expose `Klaviyo` integration.
*/
var Klaviyo = module.exports = integration('Klaviyo')
.assumesPageview()
.global('_learnq')
.option('apiKey', '')
.tag('<script src="//a.klaviyo.com/media/js/learnmarklet.js">');
/**
* Initialize.
*
* https://www.klaviyo.com/docs/getting-started
*
* @param {Object} page
*/
Klaviyo.prototype.initialize = function(page){
var self = this;
push('account', this.options.apiKey);
this.load(function(){
tick(self.ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Klaviyo.prototype.loaded = function(){
return !! (window._learnq && window._learnq.push !== Array.prototype.push);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Klaviyo.prototype.identify = function(identify){
var traits = identify.traits(aliases);
if (!traits.$id && !traits.$email) return;
push('identify', traits);
};
/**
* Group.
*
* @param {Group} group
*/
Klaviyo.prototype.group = function(group){
var props = group.properties();
if (!props.name) return;
push('identify', { $organization: props.name });
};
/**
* Track.
*
* @param {Track} track
*/
Klaviyo.prototype.track = function(track){
push('track', track.event(), track.properties({
revenue: '$value'
}));
};
}, {"analytics.js-integration":83,"global-queue":167,"next-tick":97,"alias":172}],
51: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `LeadLander` integration.
*/
var LeadLander = module.exports = integration('LeadLander')
.assumesPageview()
.global('llactid')
.global('trackalyzer')
.option('accountId', null)
.tag('<script src="http://t6.trackalyzer.com/trackalyze-nodoc.js">');
/**
* Initialize.
*
* @param {Object} page
*/
LeadLander.prototype.initialize = function(page){
window.llactid = this.options.accountId;
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
LeadLander.prototype.loaded = function(){
return !! window.trackalyzer;
};
}, {"analytics.js-integration":83}],
52: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var clone = require('clone');
var each = require('each');
var Identify = require('facade').Identify;
var when = require('when');
/**
* Expose `LiveChat` integration.
*/
var LiveChat = module.exports = integration('LiveChat')
.assumesPageview()
.global('__lc')
.global('__lc_inited')
.global('LC_API')
.global('LC_Invite')
.option('group', 0)
.option('license', '')
.tag('<script src="//cdn.livechatinc.com/tracking.js">');
/**
* Initialize.
*
* http://www.livechatinc.com/api/javascript-api
*
* @param {Object} page
*/
LiveChat.prototype.initialize = function(page){
var self = this;
var user = this.analytics.user();
var identify = new Identify({
userId: user.id(),
traits: user.traits()
});
window.__lc = clone(this.options);
window.__lc.visitor = {
name: identify.name(),
email: identify.email()
};
this.load(function(){
when(function(){ return self.loaded(); }, self.ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
LiveChat.prototype.loaded = function(){
return !!(window.LC_API && window.LC_Invite);
};
/**
* Identify.
*
* @param {Identify} identify
*/
LiveChat.prototype.identify = function(identify){
var traits = identify.traits({ userId: 'User ID' });
window.LC_API.set_custom_variables(convert(traits));
};
/**
* Convert a traits object into the format LiveChat requires.
*
* @param {Object} traits
* @return {Array}
*/
function convert(traits){
var arr = [];
each(traits, function(key, value){
arr.push({ name: key, value: value });
});
return arr;
}
}, {"analytics.js-integration":83,"clone":171,"each":4,"facade":124,"when":123}],
53: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var Identify = require('facade').Identify;
var useHttps = require('use-https');
/**
* Expose `LuckyOrange` integration.
*/
var LuckyOrange = module.exports = integration('Lucky Orange')
.assumesPageview()
.global('_loq')
.global('__wtw_watcher_added')
.global('__wtw_lucky_site_id')
.global('__wtw_lucky_is_segment_io')
.global('__wtw_custom_user_data')
.option('siteId', null)
.tag('http', '<script src="http://www.luckyorange.com/w.js?{{ cache }}">')
.tag('https', '<script src="https://ssl.luckyorange.com/w.js?{{ cache }}">');
/**
* Initialize.
*
* @param {Object} page
*/
LuckyOrange.prototype.initialize = function(page){
var user = this.analytics.user();
window._loq || (window._loq = []);
window.__wtw_lucky_site_id = this.options.siteId;
this.identify(new Identify({
traits: user.traits(),
userId: user.id()
}));
var cache = Math.floor(new Date().getTime() / 60000);
var name = useHttps() ? 'https' : 'http';
this.load(name, { cache: cache }, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
LuckyOrange.prototype.loaded = function(){
return !! window.__wtw_watcher_added;
};
/**
* Identify.
*
* @param {Identify} identify
*/
LuckyOrange.prototype.identify = function(identify){
var traits = identify.traits();
var email = identify.email();
var name = identify.name();
if (name) traits.name = name;
if (email) traits.email = email;
window.__wtw_custom_user_data = traits;
};
}, {"analytics.js-integration":83,"facade":124,"use-https":85}],
54: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var alias = require('alias');
/**
* Expose `Lytics` integration.
*/
var Lytics = module.exports = integration('Lytics')
.global('jstag')
.option('cid', '')
.option('cookie', 'seerid')
.option('delay', 2000)
.option('sessionTimeout', 1800)
.option('url', '//c.lytics.io')
.tag('<script src="//c.lytics.io/static/io.min.js">');
/**
* Options aliases.
*/
var aliases = {
sessionTimeout: 'sessecs'
};
/**
* Initialize.
*
* http://admin.lytics.io/doc#jstag
*
* @param {Object} page
*/
Lytics.prototype.initialize = function(page){
var options = alias(this.options, aliases);
window.jstag = (function(){var t = { _q: [], _c: options, ts: (new Date()).getTime() }; t.send = function(){this._q.push(['ready', 'send', Array.prototype.slice.call(arguments)]); return this; }; return t; })();
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Lytics.prototype.loaded = function(){
return !! (window.jstag && window.jstag.bind);
};
/**
* Page.
*
* @param {Page} page
*/
Lytics.prototype.page = function(page){
window.jstag.send(page.properties());
};
/**
* Idenfity.
*
* @param {Identify} identify
*/
Lytics.prototype.identify = function(identify){
var traits = identify.traits({ userId: '_uid' });
window.jstag.send(traits);
};
/**
* Track.
*
* @param {String} event
* @param {Object} properties (optional)
* @param {Object} options (optional)
*/
Lytics.prototype.track = function(track){
var props = track.properties();
props._e = track.event();
window.jstag.send(props);
};
}, {"analytics.js-integration":83,"alias":172}],
55: [function(require, module, exports) {
/**
* Module dependencies.
*/
var alias = require('alias');
var clone = require('clone');
var dates = require('convert-dates');
var integration = require('analytics.js-integration');
var is = require('is');
var iso = require('to-iso-string');
var indexof = require('indexof');
var del = require('obj-case').del;
var some = require('some');
/**
* Expose `Mixpanel` integration.
*/
var Mixpanel = module.exports = integration('Mixpanel')
.global('mixpanel')
.option('increments', [])
.option('cookieName', '')
.option('nameTag', true)
.option('pageview', false)
.option('people', false)
.option('token', '')
.option('trackAllPages', false)
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.tag('<script src="//cdn.mxpnl.com/libs/mixpanel-2.2.min.js">');
/**
* Options aliases.
*/
var optionsAliases = {
cookieName: 'cookie_name'
};
/**
* Initialize.
*
* https://mixpanel.com/help/reference/javascript#installing
* https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.init
*/
Mixpanel.prototype.initialize = function(){
(function(c, a){window.mixpanel = a; var b, d, h, e; a._i = []; a.init = function(b, c, f){function d(a, b){var c = b.split('.'); 2 == c.length && (a = a[c[0]], b = c[1]); a[b] = function(){a.push([b].concat(Array.prototype.slice.call(arguments, 0))); }; } var g = a; 'undefined' !== typeof f ? g = a[f] = [] : f = 'mixpanel'; g.people = g.people || []; h = ['disable', 'track', 'track_pageview', 'track_links', 'track_forms', 'register', 'register_once', 'unregister', 'identify', 'alias', 'name_tag', 'set_config', 'people.set', 'people.increment', 'people.track_charge', 'people.append']; for (e = 0; e < h.length; e++) d(g, h[e]); a._i.push([b, c, f]); }; a.__SV = 1.2; })(document, window.mixpanel || []);
this.options.increments = lowercase(this.options.increments);
var options = alias(this.options, optionsAliases);
window.mixpanel.init(options.token, options);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Mixpanel.prototype.loaded = function(){
return !! (window.mixpanel && window.mixpanel.config);
};
/**
* Page.
*
* https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.track_pageview
*
* @param {String} category (optional)
* @param {String} name (optional)
* @param {Object} properties (optional)
* @param {Object} options (optional)
*/
Mixpanel.prototype.page = function(page){
var category = page.category();
var name = page.fullName();
var opts = this.options;
// all pages
if (opts.trackAllPages) {
this.track(page.track());
}
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
};
/**
* Trait aliases.
*/
var traitAliases = {
created: '$created',
email: '$email',
firstName: '$first_name',
lastName: '$last_name',
lastSeen: '$last_seen',
name: '$name',
username: '$username',
phone: '$phone'
};
/**
* Identify.
*
* https://mixpanel.com/help/reference/javascript#super-properties
* https://mixpanel.com/help/reference/javascript#user-identity
* https://mixpanel.com/help/reference/javascript#storing-user-profiles
*
* @param {Identify} identify
*/
Mixpanel.prototype.identify = function(identify){
var username = identify.username();
var email = identify.email();
var id = identify.userId();
// id
if (id) window.mixpanel.identify(id);
// name tag
var nametag = email || username || id;
if (nametag) window.mixpanel.name_tag(nametag);
// traits
var traits = identify.traits(traitAliases);
if (traits.$created) del(traits, 'createdAt');
window.mixpanel.register(dates(traits, iso));
if (this.options.people) window.mixpanel.people.set(traits);
};
/**
* Track.
*
* https://mixpanel.com/help/reference/javascript#sending-events
* https://mixpanel.com/help/reference/javascript#tracking-revenue
*
* @param {Track} track
*/
Mixpanel.prototype.track = function(track){
var increments = this.options.increments;
var increment = track.event().toLowerCase();
var people = this.options.people;
var props = track.properties();
var revenue = track.revenue();
// delete mixpanel's reserved properties, so they don't conflict
delete props.distinct_id;
delete props.ip;
delete props.mp_name_tag;
delete props.mp_note;
delete props.token;
// convert arrays of objects to length, since mixpanel doesn't support object arrays
for (var key in props) {
var val = props[key];
if (is.array(val) && some(val, is.object)) props[key] = val.length;
}
// increment properties in mixpanel people
if (people && ~indexof(increments, increment)) {
window.mixpanel.people.increment(track.event());
window.mixpanel.people.set('Last ' + track.event(), new Date);
}
// track the event
props = dates(props, iso);
window.mixpanel.track(track.event(), props);
// track revenue specifically
if (revenue && people) {
window.mixpanel.people.track_charge(revenue);
}
};
/**
* Alias.
*
* https://mixpanel.com/help/reference/javascript#user-identity
* https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.alias
*
* @param {Alias} alias
*/
Mixpanel.prototype.alias = function(alias){
var mp = window.mixpanel;
var to = alias.to();
if (mp.get_distinct_id && mp.get_distinct_id() === to) return;
// HACK: internal mixpanel API to ensure we don't overwrite
if (mp.get_property && mp.get_property('$people_distinct_id') === to) return;
// although undocumented, mixpanel takes an optional original id
mp.alias(to, alias.from());
};
/**
* Lowercase the given `arr`.
*
* @param {Array} arr
* @return {Array}
* @api private
*/
function lowercase(arr){
var ret = new Array(arr.length);
for (var i = 0; i < arr.length; ++i) {
ret[i] = String(arr[i]).toLowerCase();
}
return ret;
}
}, {"alias":172,"clone":171,"convert-dates":173,"analytics.js-integration":83,"is":86,"to-iso-string":170,"indexof":109,"obj-case":138,"some":179}],
179: [function(require, module, exports) {
/**
* some
*/
var some = [].some;
/**
* test whether some elements in
* the array pass the test implemented
* by `fn`.
*
* example:
*
* some([1, 'foo', 'bar'], function (el, i) {
* return 'string' == typeof el;
* });
* // > true
*
* @param {Array} arr
* @param {Function} fn
* @return {bool}
*/
module.exports = function (arr, fn) {
if (some) return some.call(arr, fn);
for (var i = 0, l = arr.length; i < l; ++i) {
if (fn(arr[i], i)) return true;
}
return false;
};
}, {}],
56: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var bind = require('bind');
var when = require('when');
var is = require('is');
/**
* Expose `Mojn`
*/
var Mojn = module.exports = integration('Mojn')
.option('customerCode', '')
.global('_mojnTrack')
.tag('<script src="https://track.idtargeting.com/{{ customerCode }}/track.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Mojn.prototype.initialize = function(){
window._mojnTrack = window._mojnTrack || [];
window._mojnTrack.push({ cid: this.options.customerCode });
var loaded = bind(this, this.loaded);
var ready = this.ready;
this.load(function(){
when(loaded, ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Mojn.prototype.loaded = function(){
return is.object(window._mojnTrack);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Mojn.prototype.identify = function(identify){
var email = identify.email();
if (!email) return;
var img = new Image();
img.src = '//matcher.idtargeting.com/analytics.gif?cid=' + this.options.customerCode + '&_mjnctid='+email;
img.width = 1;
img.height = 1;
return img;
};
/**
* Track.
*
* @param {Track} event
*/
Mojn.prototype.track = function(track){
var properties = track.properties();
var revenue = properties.revenue;
var currency = properties.currency || '';
var conv = currency + revenue;
if (!revenue) return;
window._mojnTrack.push({ conv: conv });
return conv;
};
}, {"analytics.js-integration":83,"bind":95,"when":123,"is":86}],
57: [function(require, module, exports) {
/**
* Module dependencies.
*/
var push = require('global-queue')('_mfq');
var integration = require('analytics.js-integration');
var each = require('each');
/**
* Expose `Mouseflow`.
*/
var Mouseflow = module.exports = integration('Mouseflow')
.assumesPageview()
.global('mouseflow')
.global('_mfq')
.option('apiKey', '')
.option('mouseflowHtmlDelay', 0)
.tag('<script src="//cdn.mouseflow.com/projects/{{ apiKey }}.js">');
/**
* Initalize.
*
* @param {Object} page
*/
Mouseflow.prototype.initialize = function(page){
window.mouseflowHtmlDelay = this.options.mouseflowHtmlDelay;
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Mouseflow.prototype.loaded = function(){
return !! window.mouseflow;
};
/**
* Page.
*
* http://mouseflow.zendesk.com/entries/22528817-Single-page-websites
*
* @param {Page} page
*/
Mouseflow.prototype.page = function(page){
if (!window.mouseflow) return;
if ('function' != typeof mouseflow.newPageView) return;
mouseflow.newPageView();
};
/**
* Identify.
*
* http://mouseflow.zendesk.com/entries/24643603-Custom-Variables-Tagging
*
* @param {Identify} identify
*/
Mouseflow.prototype.identify = function(identify){
set(identify.traits());
};
/**
* Track.
*
* http://mouseflow.zendesk.com/entries/24643603-Custom-Variables-Tagging
*
* @param {Track} track
*/
Mouseflow.prototype.track = function(track){
var props = track.properties();
props.event = track.event();
set(props);
};
/**
* Push each key and value in the given `obj` onto the queue.
*
* @param {Object} obj
*/
function set(obj){
each(obj, function(key, value){
push('setVariable', key, value);
});
}
}, {"global-queue":167,"analytics.js-integration":83,"each":4}],
58: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var useHttps = require('use-https');
var each = require('each');
var is = require('is');
/**
* Expose `MouseStats` integration.
*/
var MouseStats = module.exports = integration('MouseStats')
.assumesPageview()
.global('msaa')
.global('MouseStatsVisitorPlaybacks')
.option('accountNumber', '')
.tag('http', '<script src="http://www2.mousestats.com/js/{{ path }}.js?{{ cache }}">')
.tag('https', '<script src="https://ssl.mousestats.com/js/{{ path }}.js?{{ cache }}">');
/**
* Initialize.
*
* http://www.mousestats.com/docs/pages/allpages
*
* @param {Object} page
*/
MouseStats.prototype.initialize = function(page){
var number = this.options.accountNumber;
var path = number.slice(0,1) + '/' + number.slice(1,2) + '/' + number;
var cache = Math.floor(new Date().getTime() / 60000);
var name = useHttps() ? 'https' : 'http';
this.load(name, { path: path, cache: cache }, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
MouseStats.prototype.loaded = function(){
return is.array(window.MouseStatsVisitorPlaybacks);
};
/**
* Identify.
*
* http://www.mousestats.com/docs/wiki/7/how-to-add-custom-data-to-visitor-playbacks
*
* @param {Identify} identify
*/
MouseStats.prototype.identify = function(identify){
each(identify.traits(), function (key, value) {
window.MouseStatsVisitorPlaybacks.customVariable(key, value);
});
};
}, {"analytics.js-integration":83,"use-https":85,"each":4,"is":86}],
59: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('__nls');
/**
* Expose `Navilytics` integration.
*/
var Navilytics = module.exports = integration('Navilytics')
.assumesPageview()
.global('__nls')
.option('memberId', '')
.option('projectId', '')
.tag('<script src="//www.navilytics.com/nls.js?mid={{ memberId }}&pid={{ projectId }}">');
/**
* Initialize.
*
* https://www.navilytics.com/member/code_settings
*
* @param {Object} page
*/
Navilytics.prototype.initialize = function(page){
window.__nls = window.__nls || [];
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Navilytics.prototype.loaded = function(){
return !! (window.__nls && [].push != window.__nls.push);
};
/**
* Track.
*
* https://www.navilytics.com/docs#tags
*
* @param {Track} track
*/
Navilytics.prototype.track = function(track){
push('tagRecording', track.event());
};
}, {"analytics.js-integration":83,"global-queue":167}],
60: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var https = require('use-https');
var tick = require('next-tick');
/**
* Expose `Olark` integration.
*/
var Olark = module.exports = integration('Olark')
.assumesPageview()
.global('olark')
.option('identify', true)
.option('page', true)
.option('siteId', '')
.option('groupId', '')
.option('track', false);
/**
* Initialize.
*
* http://www.olark.com/documentation
* https://www.olark.com/documentation/javascript/api.chat.setOperatorGroup
*
* @param {Facade} page
*/
Olark.prototype.initialize = function(page){
var self = this;
this.load(function(){
tick(self.ready);
});
// assign chat to a specific site
var groupId = this.options.groupId;
if (groupId) api('chat.setOperatorGroup', { group: groupId });
// keep track of the widget's open state
api('box.onExpand', function(){ self._open = true; });
api('box.onShrink', function(){ self._open = false; });
};
/**
* Loaded?
*
* @return {Boolean}
*/
Olark.prototype.loaded = function(){
return !! window.olark;
};
/**
* Load.
*
* @param {Function} callback
*/
Olark.prototype.load = function(callback){
var el = document.getElementById('olark');
window.olark||(function(c){var f=window,d=document,l=https()?"https:":"http:",z=c.name,r="load";var nt=function(){f[z]=function(){(a.s=a.s||[]).push(arguments)};var a=f[z]._={},q=c.methods.length;while (q--) {(function(n){f[z][n]=function(){f[z]("call",n,arguments)}})(c.methods[q])}a.l=c.loader;a.i=nt;a.p={ 0:+new Date() };a.P=function(u){a.p[u]=new Date()-a.p[0]};function s(){a.P(r);f[z](r)}f.addEventListener?f.addEventListener(r,s,false):f.attachEvent("on"+r,s);var ld=function(){function p(hd){hd="head";return ["<",hd,"></",hd,"><",i,' onl' + 'oad="var d=',g,";d.getElementsByTagName('head')[0].",j,"(d.",h,"('script')).",k,"='",l,"//",a.l,"'",'"',"></",i,">"].join("")}var i="body",m=d[i];if (!m) {return setTimeout(ld,100)}a.P(1);var j="appendChild",h="createElement",k="src",n=d[h]("div"),v=n[j](d[h](z)),b=d[h]("iframe"),g="document",e="domain",o;n.style.display="none";m.insertBefore(n,m.firstChild).id=z;b.frameBorder="0";b.id=z+"-loader";if (/MSIE[ ]+6/.test(navigator.userAgent)) {b.src="javascript:false"}b.allowTransparency="true";v[j](b);try {b.contentWindow[g].open()}catch (w) {c[e]=d[e];o="javascript:var d="+g+".open();d.domain='"+d.domain+"';";b[k]=o+"void(0);"}try {var t=b.contentWindow[g];t.write(p());t.close()}catch (x) {b[k]=o+'d.write("'+p().replace(/"/g,String.fromCharCode(92)+'"')+'");d.close();'}a.P(2)};ld()};nt()})({ loader: "static.olark.com/jsclient/loader0.js", name:"olark", methods:["configure","extend","declare","identify"] });
window.olark.identify(this.options.siteId);
callback();
};
/**
* Page.
*
* @param {Facade} page
*/
Olark.prototype.page = function(page){
if (!this.options.page) return;
var props = page.properties();
var name = page.fullName();
if (!name && !props.url) return;
name = name ? name + ' page' : props.url;
this.notify('looking at ' + name);
};
/**
* Identify.
*
* @param {Facade} identify
*/
Olark.prototype.identify = function(identify){
if (!this.options.identify) return;
var username = identify.username();
var traits = identify.traits();
var id = identify.userId();
var email = identify.email();
var phone = identify.phone();
var name = identify.name() || identify.firstName();
if (traits) api('visitor.updateCustomFields', traits);
if (email) api('visitor.updateEmailAddress', { emailAddress: email });
if (phone) api('visitor.updatePhoneNumber', { phoneNumber: phone });
if (name) api('visitor.updateFullName', { fullName: name });
// figure out best nickname
var nickname = name || email || username || id;
if (name && email) nickname += ' (' + email + ')';
if (nickname) api('chat.updateVisitorNickname', { snippet: nickname });
};
/**
* Track.
*
* @param {Facade} track
*/
Olark.prototype.track = function(track){
if (!this.options.track) return;
this.notify('visitor triggered "' + track.event() + '"');
};
/**
* Send a notification `message` to the operator, only when a chat is active and
* when the chat is open.
*
* @param {String} message
*/
Olark.prototype.notify = function(message){
if (!this._open) return;
// lowercase since olark does
message = message.toLowerCase();
api('visitor.getDetails', function(data){
if (!data || !data.isConversing) return;
api('chat.sendNotificationToOperator', { body: message });
});
};
/**
* Helper for Olark API calls.
*
* @param {String} action
* @param {Object} value
*/
function api(action, value) {
window.olark('api.' + action, value);
}
}, {"analytics.js-integration":83,"use-https":85,"next-tick":97}],
61: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('optimizely');
var callback = require('callback');
var tick = require('next-tick');
var bind = require('bind');
var each = require('each');
/**
* Expose `Optimizely` integration.
*/
var Optimizely = module.exports = integration('Optimizely')
.option('variations', true)
.option('trackNamedPages', true)
.option('trackCategorizedPages', true);
/**
* Initialize.
*
* https://www.optimizely.com/docs/api#function-calls
*/
Optimizely.prototype.initialize = function(){
if (this.options.variations) {
var self = this;
tick(function(){
self.replay();
});
}
this.ready();
};
/**
* Track.
*
* https://www.optimizely.com/docs/api#track-event
*
* @param {Track} track
*/
Optimizely.prototype.track = function(track){
var props = track.properties();
if (props.revenue) props.revenue *= 100;
push('trackEvent', track.event(), props);
};
/**
* Page.
*
* https://www.optimizely.com/docs/api#track-event
*
* @param {Page} page
*/
Optimizely.prototype.page = function(page){
var category = page.category();
var name = page.fullName();
var opts = this.options;
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
};
/**
* Replay experiment data as traits to other enabled providers.
*
* https://www.optimizely.com/docs/api#data-object
*/
Optimizely.prototype.replay = function(){
if (!window.optimizely) return; // in case the snippet isnt on the page
var data = window.optimizely.data;
if (!data) return;
var experiments = data.experiments;
var map = data.state.variationNamesMap;
var traits = {};
each(map, function(experimentId, variation){
var experiment = experiments[experimentId].name;
traits['Experiment: ' + experiment] = variation;
});
this.analytics.identify(traits);
};
}, {"analytics.js-integration":83,"global-queue":167,"callback":88,"next-tick":97,"bind":95,"each":4}],
62: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `PerfectAudience` integration.
*/
var PerfectAudience = module.exports = integration('Perfect Audience')
.assumesPageview()
.global('_pa')
.option('siteId', '')
.tag('<script src="//tag.perfectaudience.com/serve/{{ siteId }}.js">');
/**
* Initialize.
*
* https://www.perfectaudience.com/docs#javascript_api_autoopen
*
* @param {Object} page
*/
PerfectAudience.prototype.initialize = function(page){
window._pa = window._pa || {};
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
PerfectAudience.prototype.loaded = function(){
return !! (window._pa && window._pa.track);
};
/**
* Track.
*
* @param {Track} event
*/
PerfectAudience.prototype.track = function(track){
window._pa.track(track.event(), track.properties());
};
}, {"analytics.js-integration":83}],
63: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_prum');
var date = require('load-date');
/**
* Expose `Pingdom` integration.
*/
var Pingdom = module.exports = integration('Pingdom')
.assumesPageview()
.global('_prum')
.global('PRUM_EPISODES')
.option('id', '')
.tag('<script src="//rum-static.pingdom.net/prum.min.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Pingdom.prototype.initialize = function(page){
window._prum = window._prum || [];
push('id', this.options.id);
push('mark', 'firstbyte', date.getTime());
var self = this;
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Pingdom.prototype.loaded = function(){
return !! (window._prum && window._prum.push !== Array.prototype.push);
};
}, {"analytics.js-integration":83,"global-queue":167,"load-date":168}],
64: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_paq');
var each = require('each');
/**
* Expose `Piwik` integration.
*/
var Piwik = module.exports = integration('Piwik')
.global('_paq')
.option('url', null)
.option('siteId', '')
.mapping('goals')
.tag('<script src="{{ url }}/piwik.js">');
/**
* Initialize.
*
* http://piwik.org/docs/javascript-tracking/#toc-asynchronous-tracking
*/
Piwik.prototype.initialize = function(){
window._paq = window._paq || [];
push('setSiteId', this.options.siteId);
push('setTrackerUrl', this.options.url + '/piwik.php');
push('enableLinkTracking');
this.load(this.ready);
};
/**
* Check if Piwik is loaded
*/
Piwik.prototype.loaded = function(){
return !! (window._paq && window._paq.push != [].push);
};
/**
* Page
*
* @param {Page} page
*/
Piwik.prototype.page = function(page){
push('trackPageView');
};
/**
* Track.
*
* @param {Track} track
*/
Piwik.prototype.track = function(track){
var goals = this.goals(track.event());
var revenue = track.revenue() || 0;
each(goals, function(goal){
push('trackGoal', goal, revenue);
});
};
}, {"analytics.js-integration":83,"global-queue":167,"each":4}],
65: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var convertDates = require('convert-dates');
var push = require('global-queue')('_lnq');
var alias = require('alias');
/**
* Expose `Preact` integration.
*/
var Preact = module.exports = integration('Preact')
.assumesPageview()
.global('_lnq')
.option('projectCode', '')
.tag('<script src="//d2bbvl6dq48fa6.cloudfront.net/js/ln-2.4.min.js">');
/**
* Initialize.
*
* http://www.preact.io/api/javascript
*
* @param {Object} page
*/
Preact.prototype.initialize = function(page){
window._lnq = window._lnq || [];
push('_setCode', this.options.projectCode);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Preact.prototype.loaded = function(){
return !! (window._lnq && window._lnq.push !== Array.prototype.push);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Preact.prototype.identify = function(identify){
if (!identify.userId()) return;
var traits = identify.traits({ created: 'created_at' });
traits = convertDates(traits, convertDate);
push('_setPersonData', {
name: identify.name(),
email: identify.email(),
uid: identify.userId(),
properties: traits
});
};
/**
* Group.
*
* @param {String} id
* @param {Object} properties (optional)
* @param {Object} options (optional)
*/
Preact.prototype.group = function(group){
if (!group.groupId()) return;
push('_setAccount', group.traits());
};
/**
* Track.
*
* @param {Track} track
*/
Preact.prototype.track = function(track){
var props = track.properties();
var revenue = track.revenue();
var event = track.event();
var special = { name: event };
if (revenue) {
special.revenue = revenue * 100;
delete props.revenue;
}
if (props.note) {
special.note = props.note;
delete props.note;
}
push('_logEvent', special, props);
};
/**
* Convert a `date` to a format Preact supports.
*
* @param {Date} date
* @return {Number}
*/
function convertDate(date){
return Math.floor(date / 1000);
}
}, {"analytics.js-integration":83,"convert-dates":173,"global-queue":167,"alias":172}],
66: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_kiq');
var Facade = require('facade');
var Identify = Facade.Identify;
var bind = require('bind');
var when = require('when');
/**
* Expose `Qualaroo` integration.
*/
var Qualaroo = module.exports = integration('Qualaroo')
.assumesPageview()
.global('_kiq')
.option('customerId', '')
.option('siteToken', '')
.option('track', false)
.tag('<script src="//s3.amazonaws.com/ki.js/{{ customerId }}/{{ siteToken }}.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Qualaroo.prototype.initialize = function(page){
window._kiq = window._kiq || [];
var loaded = bind(this, this.loaded);
var ready = this.ready;
this.load(function(){
when(loaded, ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Qualaroo.prototype.loaded = function(){
return !! (window._kiq && window._kiq.push !== Array.prototype.push);
};
/**
* Identify.
*
* http://help.qualaroo.com/customer/portal/articles/731085-identify-survey-nudge-takers
* http://help.qualaroo.com/customer/portal/articles/731091-set-additional-user-properties
*
* @param {Identify} identify
*/
Qualaroo.prototype.identify = function(identify){
var traits = identify.traits();
var id = identify.userId();
var email = identify.email();
if (email) id = email;
if (id) push('identify', id);
if (traits) push('set', traits);
};
/**
* Track.
*
* @param {String} event
* @param {Object} properties (optional)
* @param {Object} options (optional)
*/
Qualaroo.prototype.track = function(track){
if (!this.options.track) return;
var event = track.event();
var traits = {};
traits['Triggered: ' + event] = true;
this.identify(new Identify({ traits: traits }));
};
}, {"analytics.js-integration":83,"global-queue":167,"facade":124,"bind":95,"when":123}],
67: [function(require, module, exports) {
/**
* Module dependencies.
*/
var push = require('global-queue')('_qevents', { wrap: false });
var integration = require('analytics.js-integration');
var useHttps = require('use-https');
/**
* Expose `Quantcast` integration.
*/
var Quantcast = module.exports = integration('Quantcast')
.assumesPageview()
.global('_qevents')
.global('__qc')
.option('pCode', null)
.option('advertise', false)
.tag('http', '<script src="http://edge.quantserve.com/quant.js">')
.tag('https', '<script src="https://secure.quantserve.com/quant.js">');
/**
* Initialize.
*
* https://www.quantcast.com/learning-center/guides/using-the-quantcast-asynchronous-tag/
* https://www.quantcast.com/help/cross-platform-audience-measurement-guide/
*
* @param {Page} page
*/
Quantcast.prototype.initialize = function(page){
window._qevents = window._qevents || [];
var opts = this.options;
var settings = { qacct: opts.pCode };
var user = this.analytics.user();
if (user.id()) settings.uid = user.id();
if (page) {
settings.labels = this.labels('page', page.category(), page.name());
}
push(settings);
var name = useHttps() ? 'https' : 'http';
this.load(name, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Quantcast.prototype.loaded = function(){
return !! window.__qc;
};
/**
* Page.
*
* https://cloudup.com/cBRRFAfq6mf
*
* @param {Page} page
*/
Quantcast.prototype.page = function(page){
var category = page.category();
var name = page.name();
var settings = {
event: 'refresh',
labels: this.labels('page', category, name),
qacct: this.options.pCode,
};
var user = this.analytics.user();
if (user.id()) settings.uid = user.id();
push(settings);
};
/**
* Identify.
*
* https://www.quantcast.com/help/cross-platform-audience-measurement-guide/
*
* @param {String} id (optional)
*/
Quantcast.prototype.identify = function(identify){
// edit the initial quantcast settings
// TODO: could be done in a cleaner way
var id = identify.userId();
if (id) {
window._qevents[0] = window._qevents[0] || {};
window._qevents[0].uid = id;
}
};
/**
* Track.
*
* https://cloudup.com/cBRRFAfq6mf
*
* @param {Track} track
*/
Quantcast.prototype.track = function(track){
var name = track.event();
var revenue = track.revenue();
var settings = {
event: 'click',
labels: this.labels('event', name),
qacct: this.options.pCode
};
var user = this.analytics.user();
if (null != revenue) settings.revenue = (revenue+''); // convert to string
if (user.id()) settings.uid = user.id();
push(settings);
};
/**
* Completed Order.
*
* @param {Track} track
* @api private
*/
Quantcast.prototype.completedOrder = function(track){
var name = track.event();
var revenue = track.total();
var labels = this.labels('event', name);
var category = track.category();
if (this.options.advertise && category) {
labels += ',' + this.labels('pcat', category);
}
var settings = {
event: 'refresh', // the example Quantcast sent has completed order send refresh not click
labels: labels,
revenue: (revenue+''), // convert to string
orderid: track.orderId(),
qacct: this.options.pCode
};
push(settings);
};
/**
* Generate quantcast labels.
*
* Example:
*
* options.advertise = false;
* labels('event', 'my event');
* // => "event.my event"
*
* options.advertise = true;
* labels('event', 'my event');
* // => "_fp.event.my event"
*
* @param {String} type
* @param {String} ...
* @return {String}
* @api private
*/
Quantcast.prototype.labels = function(type){
var args = [].slice.call(arguments, 1);
var advertise = this.options.advertise;
var ret = [];
if (advertise && 'page' == type) type = 'event';
if (advertise) type = '_fp.' + type;
for (var i = 0; i < args.length; ++i) {
if (null == args[i]) continue;
var value = String(args[i]);
ret.push(value.replace(/,/g, ';'));
}
ret = advertise ? ret.join(' ') : ret.join('.');
return [type, ret].join('.');
};
}, {"global-queue":167,"analytics.js-integration":83,"use-https":85}],
68: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var extend = require('extend');
var is = require('is');
/**
* Expose `Rollbar` integration.
*/
var RollbarIntegration = module.exports = integration('Rollbar')
.global('Rollbar')
.option('identify', true)
.option('accessToken', '')
.option('environment', 'unknown')
.option('captureUncaught', true);
/**
* Initialize.
*
* @param {Object} page
*/
RollbarIntegration.prototype.initialize = function(page){
var _rollbarConfig = this.config = {
accessToken: this.options.accessToken,
captureUncaught: this.options.captureUncaught,
payload: {
environment: this.options.environment
}
};
(function(a){function b(b){this.shimId=++g,this.notifier=null,this.parentShim=b,this.logger=function(){},a.console&&void 0 === a.console.shimId&&(this.logger=a.console.log)}function c(b,c,d){!d[4]&&a._rollbarWrappedError&&(d[4]=a._rollbarWrappedError,a._rollbarWrappedError=null),b.uncaughtError.apply(b,d),c&&c.apply(a,d)}function d(c){var d=b;return f(function(){if (this.notifier)return this.notifier[c].apply(this.notifier,arguments);var b=this,e="scope"===c;e&&(b=new d(this));var f=Array.prototype.slice.call(arguments,0),g={ shim:b, method:c, args:f, ts:new Date };return a._rollbarShimQueue.push(g),e?b:void 0})}function e(a,b){if (b.hasOwnProperty&&b.hasOwnProperty("addEventListener")){var c=b.addEventListener;b.addEventListener=function(b,d,e){c.call(this,b,a.wrap(d),e)};var d=b.removeEventListener;b.removeEventListener=function(a,b,c){d.call(this,a,b._wrapped||b,c)}}}function f(a,b){return b=b||this.logger,function(){try {return a.apply(this,arguments)} catch (c) {b("Rollbar internal error:",c)}}}var g=0;b.init=function(a,d){var g=d.globalAlias||"Rollbar";if ("object"==typeof a[g])return a[g];a._rollbarShimQueue=[],a._rollbarWrappedError=null,d=d||{};var h=new b;return f(function(){if (h.configure(d),d.captureUncaught){var b=a.onerror;a.onerror=function(){var a=Array.prototype.slice.call(arguments,0);c(h,b,a)};var f,i,j=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];for (f=0;f<j.length;++f)i=j[f],a[i]&&a[i].prototype&&e(h,a[i].prototype)}return a[g]=h,h},h.logger)()},b.prototype.loadFull=function(a,b,c,d,e){var g=f(function(){var a=b.createElement("script"),e=b.getElementsByTagName("script")[0];a.src=d.rollbarJsUrl,a.async=!c,a.onload=h,e.parentNode.insertBefore(a,e)},this.logger),h=f(function(){var b;if (void 0===a._rollbarPayloadQueue){var c,d,f,g;for (b=new Error("rollbar.js did not load");c=a._rollbarShimQueue.shift();)for (f=c.args,g=0;g<f.length;++g)if (d=f[g],"function"==typeof d){d(b);break}}e&&e(b)},this.logger);f(function(){c?g():a.addEventListener?a.addEventListener("load",g,!1):a.attachEvent("onload",g)},this.logger)()},b.prototype.wrap=function(b){if ("function"!=typeof b)return b;if (b._isWrap)return b;if (!b._wrapped){b._wrapped=function(){try {return b.apply(this,arguments)} catch (c) {throw a._rollbarWrappedError=c,c}},b._wrapped._isWrap=!0;for (var c in b)b.hasOwnProperty(c)&&(b._wrapped[c]=b[c])}return b._wrapped};for (var h="log,debug,info,warn,warning,error,critical,global,configure,scope,uncaughtError".split(","),i=0;i<h.length;++i)b.prototype[h[i]]=d(h[i]);var j="//d37gvrvc0wt4s1.cloudfront.net/js/v1.0/rollbar.min.js";_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||j,b.init(a,_rollbarConfig)})(window,document);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
RollbarIntegration.prototype.loaded = function(){
return is.object(window.Rollbar) && null == window.Rollbar.shimId;
};
/**
* Load.
*
* @param {Function} callback
*/
RollbarIntegration.prototype.load = function(callback){
window.Rollbar.loadFull(window, document, true, this.config, callback);
};
/**
* Identify.
*
* @param {Identify} identify
*/
RollbarIntegration.prototype.identify = function(identify){
// do stuff with `id` or `traits`
if (!this.options.identify) return;
// Don't allow identify without a user id
var uid = identify.userId();
if (uid === null || uid === undefined) return;
var rollbar = window.Rollbar;
var person = { id: uid };
extend(person, identify.traits());
rollbar.configure({ payload: { person: person }});
};
}, {"analytics.js-integration":83,"extend":122,"is":86}],
69: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
/**
* Expose `SaaSquatch` integration.
*/
var SaaSquatch = module.exports = integration('SaaSquatch')
.option('tenantAlias', '')
.global('_sqh')
.tag('<script src="//d2rcp9ak152ke1.cloudfront.net/assets/javascripts/squatch.min.js">');
/**
* Initialize.
*
* @param {Page} page
*/
SaaSquatch.prototype.initialize = function(page){
window._sqh = window._sqh || [];
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
SaaSquatch.prototype.loaded = function(){
return window._sqh && window._sqh.push != [].push;
};
/**
* Identify.
*
* @param {Facade} identify
*/
SaaSquatch.prototype.identify = function(identify){
var sqh = window._sqh;
var accountId = identify.proxy('traits.accountId');
var image = identify.proxy('traits.referralImage');
var opts = identify.options(this.name);
var id = identify.userId();
var email = identify.email();
if (!(id || email)) return;
if (this.called) return;
var init = {
tenant_alias: this.options.tenantAlias,
first_name: identify.firstName(),
last_name: identify.lastName(),
user_image: identify.avatar(),
email: email,
user_id: id,
};
if (accountId) init.account_id = accountId;
if (opts.checksum) init.checksum = opts.checksum;
if (image) init.fb_share_image = image;
sqh.push(['init', init]);
this.called = true;
this.load();
};
}, {"analytics.js-integration":83}],
70: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var is = require('is');
/**
* Expose `Sentry` integration.
*/
var Sentry = module.exports = integration('Sentry')
.global('Raven')
.option('config', '')
.tag('<script src="//cdn.ravenjs.com/1.1.10/native/raven.min.js">');
/**
* Initialize.
*
* http://raven-js.readthedocs.org/en/latest/config/index.html
*/
Sentry.prototype.initialize = function(){
var config = this.options.config;
var self = this;
this.load(function(){
// for now, raven basically requires `install` to be called
// https://github.com/getsentry/raven-js/blob/master/src/raven.js#L113
window.Raven.config(config).install();
self.ready();
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Sentry.prototype.loaded = function(){
return is.object(window.Raven);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Sentry.prototype.identify = function(identify){
window.Raven.setUser(identify.traits());
};
}, {"analytics.js-integration":83,"is":86}],
71: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var is = require('is');
/**
* Expose `SnapEngage` integration.
*/
var SnapEngage = module.exports = integration('SnapEngage')
.assumesPageview()
.global('SnapABug')
.option('apiKey', '')
.tag('<script src="//commondatastorage.googleapis.com/code.snapengage.com/js/{{ apiKey }}.js">');
/**
* Initialize.
*
* http://help.snapengage.com/installation-guide-getting-started-in-a-snap/
*
* @param {Object} page
*/
SnapEngage.prototype.initialize = function(page){
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
SnapEngage.prototype.loaded = function(){
return is.object(window.SnapABug);
};
/**
* Identify.
*
* @param {Identify} identify
*/
SnapEngage.prototype.identify = function(identify){
var email = identify.email();
if (!email) return;
window.SnapABug.setUserEmail(email);
};
}, {"analytics.js-integration":83,"is":86}],
72: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var bind = require('bind');
var when = require('when');
/**
* Expose `Spinnakr` integration.
*/
var Spinnakr = module.exports = integration('Spinnakr')
.assumesPageview()
.global('_spinnakr_site_id')
.global('_spinnakr')
.option('siteId', '')
.tag('<script src="//d3ojzyhbolvoi5.cloudfront.net/js/so.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Spinnakr.prototype.initialize = function(page){
window._spinnakr_site_id = this.options.siteId;
var loaded = bind(this, this.loaded);
var ready = this.ready;
this.load(function(){
when(loaded, ready);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Spinnakr.prototype.loaded = function(){
return !! window._spinnakr;
};
}, {"analytics.js-integration":83,"bind":95,"when":123}],
73: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var slug = require('slug');
var push = require('global-queue')('_tsq');
/**
* Expose `Tapstream` integration.
*/
var Tapstream = module.exports = integration('Tapstream')
.assumesPageview()
.global('_tsq')
.option('accountName', '')
.option('trackAllPages', true)
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.tag('<script src="//cdn.tapstream.com/static/js/tapstream.js">');
/**
* Initialize.
*
* @param {Object} page
*/
Tapstream.prototype.initialize = function(page){
window._tsq = window._tsq || [];
push('setAccountName', this.options.accountName);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Tapstream.prototype.loaded = function(){
return !! (window._tsq && window._tsq.push !== Array.prototype.push);
};
/**
* Page.
*
* @param {Page} page
*/
Tapstream.prototype.page = function(page){
var category = page.category();
var opts = this.options;
var name = page.fullName();
// all pages
if (opts.trackAllPages) {
this.track(page.track());
}
// named pages
if (name && opts.trackNamedPages) {
this.track(page.track(name));
}
// categorized pages
if (category && opts.trackCategorizedPages) {
this.track(page.track(category));
}
};
/**
* Track.
*
* @param {Track} track
*/
Tapstream.prototype.track = function(track){
var props = track.properties();
push('fireHit', slug(track.event()), [props.url]); // needs events as slugs
};
}, {"analytics.js-integration":83,"slug":93,"global-queue":167}],
74: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var alias = require('alias');
var clone = require('clone');
/**
* Expose `Trakio` integration.
*/
var Trakio = module.exports = integration('trak.io')
.assumesPageview()
.global('trak')
.option('token', '')
.option('trackNamedPages', true)
.option('trackCategorizedPages', true)
.tag('<script src="//d29p64779x43zo.cloudfront.net/v1/trak.io.min.js">');
/**
* Options aliases.
*/
var optionsAliases = {
initialPageview: 'auto_track_page_view'
};
/**
* Initialize.
*
* https://docs.trak.io
*
* @param {Object} page
*/
Trakio.prototype.initialize = function(page){
var options = this.options;
window.trak = window.trak || [];
window.trak.io = window.trak.io || {};
window.trak.push = window.trak.push || function(){};
window.trak.io.load = window.trak.io.load || function(e){var r = function(e){return function(){window.trak.push([e].concat(Array.prototype.slice.call(arguments,0))); }; } ,i=["initialize","identify","track","alias","channel","source","host","protocol","page_view"]; for (var s=0;s<i.length;s++) window.trak.io[i[s]]=r(i[s]); window.trak.io.initialize.apply(window.trak.io,arguments); };
window.trak.io.load(options.token, alias(options, optionsAliases));
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Trakio.prototype.loaded = function(){
return !! (window.trak && window.trak.loaded);
};
/**
* Page.
*
* @param {Page} page
*/
Trakio.prototype.page = function(page){
var category = page.category();
var props = page.properties();
var name = page.fullName();
window.trak.io.page_view(props.path, name || props.title);
// named pages
if (name && this.options.trackNamedPages) {
this.track(page.track(name));
}
// categorized pages
if (category && this.options.trackCategorizedPages) {
this.track(page.track(category));
}
};
/**
* Trait aliases.
*
* http://docs.trak.io/properties.html#special
*/
var traitAliases = {
avatar: 'avatar_url',
firstName: 'first_name',
lastName: 'last_name'
};
/**
* Identify.
*
* @param {Identify} identify
*/
Trakio.prototype.identify = function(identify){
var traits = identify.traits(traitAliases);
var id = identify.userId();
if (id) {
window.trak.io.identify(id, traits);
} else {
window.trak.io.identify(traits);
}
};
/**
* Group.
*
* @param {String} id (optional)
* @param {Object} properties (optional)
* @param {Object} options (optional)
*
* TODO: add group
* TODO: add `trait.company/organization` from trak.io docs http://docs.trak.io/properties.html#special
*/
/**
* Track.
*
* @param {Track} track
*/
Trakio.prototype.track = function(track){
window.trak.io.track(track.event(), track.properties());
};
/**
* Alias.
*
* @param {Alias} alias
*/
Trakio.prototype.alias = function(alias){
if (!window.trak.io.distinct_id) return;
var from = alias.from();
var to = alias.to();
if (to === window.trak.io.distinct_id()) return;
if (from) {
window.trak.io.alias(from, to);
} else {
window.trak.io.alias(to);
}
};
}, {"analytics.js-integration":83,"alias":172,"clone":171}],
75: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var each = require('each');
/**
* HOP.
*/
var has = Object.prototype.hasOwnProperty;
/**
* Expose `TwitterAds`.
*/
var TwitterAds = module.exports = integration('Twitter Ads')
.option('page', '')
.tag('<img src="//analytics.twitter.com/i/adsct?txn_id={{ pixelId }}&p_id=Twitter"/>')
.mapping('events');
/**
* Initialize.
*
* @param {Object} page
*/
TwitterAds.prototype.initialize = function(){
this.ready();
};
/**
* Page.
*
* @param {Page} page
*/
TwitterAds.prototype.page = function(page){
if (this.options.page) {
this.load({ pixelId: this.options.page });
}
};
/**
* Track.
*
* @param {Track} track
*/
TwitterAds.prototype.track = function(track){
var events = this.events(track.event());
var self = this;
each(events, function(pixelId){
self.load({ pixelId: pixelId });
});
};
}, {"analytics.js-integration":83,"each":4}],
76: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_uc');
/**
* Expose `Usercycle` integration.
*/
var Usercycle = module.exports = integration('USERcycle')
.assumesPageview()
.global('_uc')
.option('key', '')
.tag('<script src="//api.usercycle.com/javascripts/track.js">');
/**
* Initialize.
*
* http://docs.usercycle.com/javascript_api
*
* @param {Object} page
*/
Usercycle.prototype.initialize = function(page){
push('_key', this.options.key);
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Usercycle.prototype.loaded = function(){
return !! (window._uc && window._uc.push !== Array.prototype.push);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Usercycle.prototype.identify = function(identify){
var traits = identify.traits();
var id = identify.userId();
if (id) push('uid', id);
// there's a special `came_back` event used for retention and traits
push('action', 'came_back', traits);
};
/**
* Track.
*
* @param {Track} track
*/
Usercycle.prototype.track = function(track){
push('action', track.event(), track.properties({
revenue: 'revenue_amount'
}));
};
}, {"analytics.js-integration":83,"global-queue":167}],
77: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('UserVoice');
var convertDates = require('convert-dates');
var unix = require('to-unix-timestamp');
var alias = require('alias');
var clone = require('clone');
/**
* Expose `UserVoice` integration.
*/
var UserVoice = module.exports = integration('UserVoice')
.assumesPageview()
.global('UserVoice')
.global('showClassicWidget')
.option('apiKey', '')
.option('classic', false)
.option('forumId', null)
.option('showWidget', true)
.option('mode', 'contact')
.option('accentColor', '#448dd6')
.option('smartvote', true)
.option('trigger', null)
.option('triggerPosition', 'bottom-right')
.option('triggerColor', '#ffffff')
.option('triggerBackgroundColor', 'rgba(46, 49, 51, 0.6)')
// BACKWARDS COMPATIBILITY: classic options
.option('classicMode', 'full')
.option('primaryColor', '#cc6d00')
.option('linkColor', '#007dbf')
.option('defaultMode', 'support')
.option('tabLabel', 'Feedback & Support')
.option('tabColor', '#cc6d00')
.option('tabPosition', 'middle-right')
.option('tabInverted', false)
.tag('<script src="//widget.uservoice.com/{{ apiKey }}.js">');
/**
* When in "classic" mode, on `construct` swap all of the method to point to
* their classic counterparts.
*/
UserVoice.on('construct', function(integration){
if (!integration.options.classic) return;
integration.group = undefined;
integration.identify = integration.identifyClassic;
integration.initialize = integration.initializeClassic;
});
/**
* Initialize.
*
* @param {Object} page
*/
UserVoice.prototype.initialize = function(page){
var options = this.options;
var opts = formatOptions(options);
push('set', opts);
push('autoprompt', {});
if (options.showWidget) {
options.trigger
? push('addTrigger', options.trigger, opts)
: push('addTrigger', opts);
}
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
UserVoice.prototype.loaded = function(){
return !! (window.UserVoice && window.UserVoice.push !== Array.prototype.push);
};
/**
* Identify.
*
* @param {Identify} identify
*/
UserVoice.prototype.identify = function(identify){
var traits = identify.traits({ created: 'created_at' });
traits = convertDates(traits, unix);
push('identify', traits);
};
/**
* Group.
*
* @param {Group} group
*/
UserVoice.prototype.group = function(group){
var traits = group.traits({ created: 'created_at' });
traits = convertDates(traits, unix);
push('identify', { account: traits });
};
/**
* Initialize (classic).
*
* @param {Object} options
* @param {Function} ready
*/
UserVoice.prototype.initializeClassic = function(){
var options = this.options;
window.showClassicWidget = showClassicWidget; // part of public api
if (options.showWidget) showClassicWidget('showTab', formatClassicOptions(options));
this.load(this.ready);
};
/**
* Identify (classic).
*
* @param {Identify} identify
*/
UserVoice.prototype.identifyClassic = function(identify){
push('setCustomFields', identify.traits());
};
/**
* Format the options for UserVoice.
*
* @param {Object} options
* @return {Object}
*/
function formatOptions(options){
return alias(options, {
forumId: 'forum_id',
accentColor: 'accent_color',
smartvote: 'smartvote_enabled',
triggerColor: 'trigger_color',
triggerBackgroundColor: 'trigger_background_color',
triggerPosition: 'trigger_position'
});
}
/**
* Format the classic options for UserVoice.
*
* @param {Object} options
* @return {Object}
*/
function formatClassicOptions(options){
return alias(options, {
forumId: 'forum_id',
classicMode: 'mode',
primaryColor: 'primary_color',
tabPosition: 'tab_position',
tabColor: 'tab_color',
linkColor: 'link_color',
defaultMode: 'default_mode',
tabLabel: 'tab_label',
tabInverted: 'tab_inverted'
});
}
/**
* Show the classic version of the UserVoice widget. This method is usually part
* of UserVoice classic's public API.
*
* @param {String} type ('showTab' or 'showLightbox')
* @param {Object} options (optional)
*/
function showClassicWidget(type, options){
type = type || 'showLightbox';
push(type, 'classic_widget', options);
}
}, {"analytics.js-integration":83,"global-queue":167,"convert-dates":173,"to-unix-timestamp":180,"alias":172,"clone":171}],
180: [function(require, module, exports) {
/**
* Expose `toUnixTimestamp`.
*/
module.exports = toUnixTimestamp;
/**
* Convert a `date` into a Unix timestamp.
*
* @param {Date}
* @return {Number}
*/
function toUnixTimestamp (date) {
return Math.floor(date.getTime() / 1000);
}
}, {}],
78: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var push = require('global-queue')('_veroq');
var cookie = require('component/cookie');
/**
* Expose `Vero` integration.
*/
var Vero = module.exports = integration('Vero')
.global('_veroq')
.option('apiKey', '')
.tag('<script src="//d3qxef4rp70elm.cloudfront.net/m.js">');
/**
* Initialize.
*
* https://github.com/getvero/vero-api/blob/master/sections/js.md
*
* @param {Object} page
*/
Vero.prototype.initialize = function(page){
// clear default cookie so vero parses correctly.
// this is for the tests.
// basically, they have window.addEventListener('unload')
// which then saves their "command_store", which is an array.
// so we just want to create that initially so we can reload the tests.
if (!cookie('__veroc4')) cookie('__veroc4', '[]');
push('init', { api_key: this.options.apiKey });
this.load(this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
Vero.prototype.loaded = function(){
return !! (window._veroq && window._veroq.push !== Array.prototype.push);
};
/**
* Page.
*
* https://www.getvero.com/knowledge-base#/questions/71768-Does-Vero-track-pageviews
*
* @param {Page} page
*/
Vero.prototype.page = function(page){
push('trackPageview');
};
/**
* Identify.
*
* https://github.com/getvero/vero-api/blob/master/sections/js.md#user-identification
*
* @param {Identify} identify
*/
Vero.prototype.identify = function(identify){
var traits = identify.traits();
var email = identify.email();
var id = identify.userId();
if (!id || !email) return; // both required
push('user', traits);
};
/**
* Track.
*
* https://github.com/getvero/vero-api/blob/master/sections/js.md#tracking-events
*
* @param {Track} track
*/
Vero.prototype.track = function(track){
push('track', track.event(), track.properties());
};
}, {"analytics.js-integration":83,"global-queue":167,"component/cookie":181}],
181: [function(require, module, exports) {
/**
* Encode.
*/
var encode = encodeURIComponent;
/**
* Decode.
*/
var decode = decodeURIComponent;
/**
* Set or get cookie `name` with `value` and `options` object.
*
* @param {String} name
* @param {String} value
* @param {Object} options
* @return {Mixed}
* @api public
*/
module.exports = function(name, value, options){
switch (arguments.length) {
case 3:
case 2:
return set(name, value, options);
case 1:
return get(name);
default:
return all();
}
};
/**
* Set cookie `name` to `value`.
*
* @param {String} name
* @param {String} value
* @param {Object} options
* @api private
*/
function set(name, value, options) {
options = options || {};
var str = encode(name) + '=' + encode(value);
if (null == value) options.maxage = -1;
if (options.maxage) {
options.expires = new Date(+new Date + options.maxage);
}
if (options.path) str += '; path=' + options.path;
if (options.domain) str += '; domain=' + options.domain;
if (options.expires) str += '; expires=' + options.expires.toGMTString();
if (options.secure) str += '; secure';
document.cookie = str;
}
/**
* Return all cookies.
*
* @return {Object}
* @api private
*/
function all() {
return parse(document.cookie);
}
/**
* Get cookie `name`.
*
* @param {String} name
* @return {String}
* @api private
*/
function get(name) {
return all()[name];
}
/**
* Parse cookie `str`.
*
* @param {String} str
* @return {Object}
* @api private
*/
function parse(str) {
var obj = {};
var pairs = str.split(/ *; */);
var pair;
if ('' == pairs[0]) return obj;
for (var i = 0; i < pairs.length; ++i) {
pair = pairs[i].split('=');
obj[decode(pair[0])] = decode(pair[1]);
}
return obj;
}
}, {}],
79: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var tick = require('next-tick');
var each = require('each');
/**
* Expose `VWO` integration.
*/
var VWO = module.exports = integration('Visual Website Optimizer')
.option('replay', true);
/**
* Initialize.
*
* http://v2.visualwebsiteoptimizer.com/tools/get_tracking_code.php
*/
VWO.prototype.initialize = function(){
if (this.options.replay) this.replay();
this.ready();
};
/**
* Replay the experiments the user has seen as traits to all other integrations.
* Wait for the next tick to replay so that the `analytics` object and all of
* the integrations are fully initialized.
*/
VWO.prototype.replay = function(){
var analytics = this.analytics;
tick(function(){
experiments(function(err, traits){
if (traits) analytics.identify(traits);
});
});
};
/**
* Get dictionary of experiment keys and variations.
*
* http://visualwebsiteoptimizer.com/knowledge/integration-of-vwo-with-kissmetrics/
*
* @param {Function} fn
* @return {Object}
*/
function experiments(fn){
enqueue(function(){
var data = {};
var ids = window._vwo_exp_ids;
if (!ids) return fn();
each(ids, function(id){
var name = variation(id);
if (name) data['Experiment: ' + id] = name;
});
fn(null, data);
});
}
/**
* Add a `fn` to the VWO queue, creating one if it doesn't exist.
*
* @param {Function} fn
*/
function enqueue(fn){
window._vis_opt_queue = window._vis_opt_queue || [];
window._vis_opt_queue.push(fn);
}
/**
* Get the chosen variation's name from an experiment `id`.
*
* http://visualwebsiteoptimizer.com/knowledge/integration-of-vwo-with-kissmetrics/
*
* @param {String} id
* @return {String}
*/
function variation(id){
var experiments = window._vwo_exp;
if (!experiments) return null;
var experiment = experiments[id];
var variationId = experiment.combination_chosen;
return variationId ? experiment.comb_n[variationId] : null;
}
}, {"analytics.js-integration":83,"next-tick":97,"each":4}],
80: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var useHttps = require('use-https');
/**
* Expose `WebEngage` integration.
*/
var WebEngage = module.exports = integration('WebEngage')
.assumesPageview()
.global('_weq')
.global('webengage')
.option('widgetVersion', '4.0')
.option('licenseCode', '')
.tag('http', '<script src="http://cdn.widgets.webengage.com/js/widget/webengage-min-v-4.0.js">')
.tag('https', '<script src="https://ssl.widgets.webengage.com/js/widget/webengage-min-v-4.0.js">');
/**
* Initialize.
*
* @param {Object} page
*/
WebEngage.prototype.initialize = function(page){
var _weq = window._weq = window._weq || {};
_weq['webengage.licenseCode'] = this.options.licenseCode;
_weq['webengage.widgetVersion'] = this.options.widgetVersion;
var name = useHttps() ? 'https' : 'http';
this.load(name, this.ready);
};
/**
* Loaded?
*
* @return {Boolean}
*/
WebEngage.prototype.loaded = function(){
return !! window.webengage;
};
}, {"analytics.js-integration":83,"use-https":85}],
81: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var snake = require('to-snake-case');
var isEmail = require('is-email');
var extend = require('extend');
var each = require('each');
var type = require('type');
/**
* Expose `Woopra` integration.
*/
var Woopra = module.exports = integration('Woopra')
.global('woopra')
.option('domain', '')
.option('cookieName', 'wooTracker')
.option('cookieDomain', null)
.option('cookiePath', '/')
.option('ping', true)
.option('pingInterval', 12000)
.option('idleTimeout', 300000)
.option('downloadTracking', true)
.option('outgoingTracking', true)
.option('outgoingIgnoreSubdomain', true)
.option('downloadPause', 200)
.option('outgoingPause', 400)
.option('ignoreQueryUrl', true)
.option('hideCampaign', false)
.tag('<script src="//static.woopra.com/js/w.js">');
/**
* Initialize.
*
* http://www.woopra.com/docs/setup/javascript-tracking/
*
* @param {Object} page
*/
Woopra.prototype.initialize = function(page){
(function () {var i, s, z, w = window, d = document, a = arguments, q = 'script', f = ['config', 'track', 'identify', 'visit', 'push', 'call'], c = function () {var i, self = this; self._e = []; for (i = 0; i < f.length; i++) {(function (f) {self[f] = function () {self._e.push([f].concat(Array.prototype.slice.call(arguments, 0))); return self; }; })(f[i]); } }; w._w = w._w || {}; for (i = 0; i < a.length; i++) { w._w[a[i]] = w[a[i]] = w[a[i]] || new c(); } })('woopra');
this.load(this.ready);
each(this.options, function(key, value){
key = snake(key);
if (null == value) return;
if ('' === value) return;
window.woopra.config(key, value);
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Woopra.prototype.loaded = function(){
return !! (window.woopra && window.woopra.loaded);
};
/**
* Page.
*
* @param {String} category (optional)
*/
Woopra.prototype.page = function(page){
var props = page.properties();
var name = page.fullName();
if (name) props.title = name;
window.woopra.track('pv', props);
};
/**
* Identify.
*
* @param {Identify} identify
*/
Woopra.prototype.identify = function(identify){
var traits = identify.traits();
if (identify.name()) traits.name = identify.name();
window.woopra.identify(traits).push(); // `push` sends it off async
};
/**
* Track.
*
* @param {Track} track
*/
Woopra.prototype.track = function(track){
window.woopra.track(track.event(), track.properties());
};
}, {"analytics.js-integration":83,"to-snake-case":84,"is-email":162,"extend":122,"each":4,"type":7}],
82: [function(require, module, exports) {
/**
* Module dependencies.
*/
var integration = require('analytics.js-integration');
var tick = require('next-tick');
var bind = require('bind');
var when = require('when');
/**
* Expose `Yandex` integration.
*/
var Yandex = module.exports = integration('Yandex Metrica')
.assumesPageview()
.global('yandex_metrika_callbacks')
.global('Ya')
.option('counterId', null)
.option('clickmap', false)
.option('webvisor', false)
.tag('<script src="//mc.yandex.ru/metrika/watch.js">');
/**
* Initialize.
*
* http://api.yandex.com/metrika/
* https://metrica.yandex.com/22522351?step=2#tab=code
*
* @param {Object} page
*/
Yandex.prototype.initialize = function(page){
var id = this.options.counterId;
var clickmap = this.options.clickmap;
var webvisor = this.options.webvisor;
push(function(){
window['yaCounter' + id] = new window.Ya.Metrika({
id: id,
clickmap: clickmap,
webvisor: webvisor
});
});
var loaded = bind(this, this.loaded);
var ready = this.ready;
this.load(function(){
when(loaded, function(){
tick(ready);
});
});
};
/**
* Loaded?
*
* @return {Boolean}
*/
Yandex.prototype.loaded = function(){
return !! (window.Ya && window.Ya.Metrika);
};
/**
* Push a new callback on the global Yandex queue.
*
* @param {Function} callback
*/
function push(callback){
window.yandex_metrika_callbacks = window.yandex_metrika_callbacks || [];
window.yandex_metrika_callbacks.push(callback);
}
}, {"analytics.js-integration":83,"next-tick":97,"bind":95,"when":123}],
3: [function(require, module, exports) {
var after = require('after');
var bind = require('bind');
var callback = require('callback');
var canonical = require('canonical');
var clone = require('clone');
var cookie = require('./cookie');
var debug = require('debug');
var defaults = require('defaults');
var each = require('each');
var Emitter = require('emitter');
var group = require('./group');
var is = require('is');
var isEmail = require('is-email');
var isMeta = require('is-meta');
var newDate = require('new-date');
var on = require('event').bind;
var prevent = require('prevent');
var querystring = require('querystring');
var size = require('object').length;
var store = require('./store');
var url = require('url');
var user = require('./user');
var Facade = require('facade');
var Identify = Facade.Identify;
var Group = Facade.Group;
var Alias = Facade.Alias;
var Track = Facade.Track;
var Page = Facade.Page;
/**
* Expose `Analytics`.
*/
exports = module.exports = Analytics;
/**
* Expose `cookie`
*/
exports.cookie = cookie;
exports.store = store;
/**
* Initialize a new `Analytics` instance.
*/
function Analytics () {
this.Integrations = {};
this._integrations = {};
this._readied = false;
this._timeout = 300;
this._user = user; // BACKWARDS COMPATIBILITY
bind.all(this);
var self = this;
this.on('initialize', function (settings, options) {
if (options.initialPageview) self.page();
});
this.on('initialize', function () {
self._parseQuery();
});
}
/**
* Event Emitter.
*/
Emitter(Analytics.prototype);
/**
* Use a `plugin`.
*
* @param {Function} plugin
* @return {Analytics}
*/
Analytics.prototype.use = function (plugin) {
plugin(this);
return this;
};
/**
* Define a new `Integration`.
*
* @param {Function} Integration
* @return {Analytics}
*/
Analytics.prototype.addIntegration = function (Integration) {
var name = Integration.prototype.name;
if (!name) throw new TypeError('attempted to add an invalid integration');
this.Integrations[name] = Integration;
return this;
};
/**
* Initialize with the given integration `settings` and `options`. Aliased to
* `init` for convenience.
*
* @param {Object} settings
* @param {Object} options (optional)
* @return {Analytics}
*/
Analytics.prototype.init =
Analytics.prototype.initialize = function (settings, options) {
settings = settings || {};
options = options || {};
this._options(options);
this._readied = false;
// clean unknown integrations from settings
var self = this;
each(settings, function (name) {
var Integration = self.Integrations[name];
if (!Integration) delete settings[name];
});
// add integrations
each(settings, function (name, opts) {
var Integration = self.Integrations[name];
var integration = new Integration(clone(opts));
self.add(integration);
});
var integrations = this._integrations;
// load user now that options are set
user.load();
group.load();
// make ready callback
var ready = after(size(integrations), function () {
self._readied = true;
self.emit('ready');
});
// initialize integrations, passing ready
each(integrations, function (name, integration) {
if (options.initialPageview && integration.options.initialPageview === false) {
integration.page = after(2, integration.page);
}
integration.analytics = self;
integration.once('ready', ready);
integration.initialize();
});
// backwards compat with angular plugin.
// TODO: remove
this.initialized = true;
this.emit('initialize', settings, options);
return this;
};
/**
* Add an integration.
*
* @param {Integration} integration
*/
Analytics.prototype.add = function(integration){
this._integrations[integration.name] = integration;
return this;
};
/**
* Identify a user by optional `id` and `traits`.
*
* @param {String} id (optional)
* @param {Object} traits (optional)
* @param {Object} options (optional)
* @param {Function} fn (optional)
* @return {Analytics}
*/
Analytics.prototype.identify = function (id, traits, options, fn) {
if (is.fn(options)) fn = options, options = null;
if (is.fn(traits)) fn = traits, options = null, traits = null;
if (is.object(id)) options = traits, traits = id, id = user.id();
// clone traits before we manipulate so we don't do anything uncouth, and take
// from `user` so that we carryover anonymous traits
user.identify(id, traits);
id = user.id();
traits = user.traits();
this._invoke('identify', message(Identify, {
options: options,
traits: traits,
userId: id
}));
// emit
this.emit('identify', id, traits, options);
this._callback(fn);
return this;
};
/**
* Return the current user.
*
* @return {Object}
*/
Analytics.prototype.user = function () {
return user;
};
/**
* Identify a group by optional `id` and `traits`. Or, if no arguments are
* supplied, return the current group.
*
* @param {String} id (optional)
* @param {Object} traits (optional)
* @param {Object} options (optional)
* @param {Function} fn (optional)
* @return {Analytics or Object}
*/
Analytics.prototype.group = function (id, traits, options, fn) {
if (0 === arguments.length) return group;
if (is.fn(options)) fn = options, options = null;
if (is.fn(traits)) fn = traits, options = null, traits = null;
if (is.object(id)) options = traits, traits = id, id = group.id();
// grab from group again to make sure we're taking from the source
group.identify(id, traits);
id = group.id();
traits = group.traits();
this._invoke('group', message(Group, {
options: options,
traits: traits,
groupId: id
}));
this.emit('group', id, traits, options);
this._callback(fn);
return this;
};
/**
* Track an `event` that a user has triggered with optional `properties`.
*
* @param {String} event
* @param {Object} properties (optional)
* @param {Object} options (optional)
* @param {Function} fn (optional)
* @return {Analytics}
*/
Analytics.prototype.track = function (event, properties, options, fn) {
if (is.fn(options)) fn = options, options = null;
if (is.fn(properties)) fn = properties, options = null, properties = null;
this._invoke('track', message(Track, {
properties: properties,
options: options,
event: event
}));
this.emit('track', event, properties, options);
this._callback(fn);
return this;
};
/**
* Helper method to track an outbound link that would normally navigate away
* from the page before the analytics calls were sent.
*
* BACKWARDS COMPATIBILITY: aliased to `trackClick`.
*
* @param {Element or Array} links
* @param {String or Function} event
* @param {Object or Function} properties (optional)
* @return {Analytics}
*/
Analytics.prototype.trackClick =
Analytics.prototype.trackLink = function (links, event, properties) {
if (!links) return this;
if (is.element(links)) links = [links]; // always arrays, handles jquery
var self = this;
each(links, function (el) {
if (!is.element(el)) throw new TypeError('Must pass HTMLElement to `analytics.trackLink`.');
on(el, 'click', function (e) {
var ev = is.fn(event) ? event(el) : event;
var props = is.fn(properties) ? properties(el) : properties;
self.track(ev, props);
if (el.href && el.target !== '_blank' && !isMeta(e)) {
prevent(e);
self._callback(function () {
window.location.href = el.href;
});
}
});
});
return this;
};
/**
* Helper method to track an outbound form that would normally navigate away
* from the page before the analytics calls were sent.
*
* BACKWARDS COMPATIBILITY: aliased to `trackSubmit`.
*
* @param {Element or Array} forms
* @param {String or Function} event
* @param {Object or Function} properties (optional)
* @return {Analytics}
*/
Analytics.prototype.trackSubmit =
Analytics.prototype.trackForm = function (forms, event, properties) {
if (!forms) return this;
if (is.element(forms)) forms = [forms]; // always arrays, handles jquery
var self = this;
each(forms, function (el) {
if (!is.element(el)) throw new TypeError('Must pass HTMLElement to `analytics.trackForm`.');
function handler (e) {
prevent(e);
var ev = is.fn(event) ? event(el) : event;
var props = is.fn(properties) ? properties(el) : properties;
self.track(ev, props);
self._callback(function () {
el.submit();
});
}
// support the events happening through jQuery or Zepto instead of through
// the normal DOM API, since `el.submit` doesn't bubble up events...
var $ = window.jQuery || window.Zepto;
if ($) {
$(el).submit(handler);
} else {
on(el, 'submit', handler);
}
});
return this;
};
/**
* Trigger a pageview, labeling the current page with an optional `category`,
* `name` and `properties`.
*
* @param {String} category (optional)
* @param {String} name (optional)
* @param {Object or String} properties (or path) (optional)
* @param {Object} options (optional)
* @param {Function} fn (optional)
* @return {Analytics}
*/
Analytics.prototype.page = function (category, name, properties, options, fn) {
if (is.fn(options)) fn = options, options = null;
if (is.fn(properties)) fn = properties, options = properties = null;
if (is.fn(name)) fn = name, options = properties = name = null;
if (is.object(category)) options = name, properties = category, name = category = null;
if (is.object(name)) options = properties, properties = name, name = null;
if (is.string(category) && !is.string(name)) name = category, category = null;
var defs = {
path: canonicalPath(),
referrer: document.referrer,
title: document.title,
search: location.search
};
if (name) defs.name = name;
if (category) defs.category = category;
properties = clone(properties) || {};
defaults(properties, defs);
properties.url = properties.url || canonicalUrl(properties.search);
this._invoke('page', message(Page, {
properties: properties,
category: category,
options: options,
name: name
}));
this.emit('page', category, name, properties, options);
this._callback(fn);
return this;
};
/**
* BACKWARDS COMPATIBILITY: convert an old `pageview` to a `page` call.
*
* @param {String} url (optional)
* @param {Object} options (optional)
* @return {Analytics}
* @api private
*/
Analytics.prototype.pageview = function (url, options) {
var properties = {};
if (url) properties.path = url;
this.page(properties);
return this;
};
/**
* Merge two previously unassociated user identities.
*
* @param {String} to
* @param {String} from (optional)
* @param {Object} options (optional)
* @param {Function} fn (optional)
* @return {Analytics}
*/
Analytics.prototype.alias = function (to, from, options, fn) {
if (is.fn(options)) fn = options, options = null;
if (is.fn(from)) fn = from, options = null, from = null;
if (is.object(from)) options = from, from = null;
this._invoke('alias', message(Alias, {
options: options,
from: from,
to: to
}));
this.emit('alias', to, from, options);
this._callback(fn);
return this;
};
/**
* Register a `fn` to be fired when all the analytics services are ready.
*
* @param {Function} fn
* @return {Analytics}
*/
Analytics.prototype.ready = function (fn) {
if (!is.fn(fn)) return this;
this._readied
? callback.async(fn)
: this.once('ready', fn);
return this;
};
/**
* Set the `timeout` (in milliseconds) used for callbacks.
*
* @param {Number} timeout
*/
Analytics.prototype.timeout = function (timeout) {
this._timeout = timeout;
};
/**
* Enable or disable debug.
*
* @param {String or Boolean} str
*/
Analytics.prototype.debug = function(str){
if (0 == arguments.length || str) {
debug.enable('analytics:' + (str || '*'));
} else {
debug.disable();
}
};
/**
* Apply options.
*
* @param {Object} options
* @return {Analytics}
* @api private
*/
Analytics.prototype._options = function (options) {
options = options || {};
cookie.options(options.cookie);
store.options(options.localStorage);
user.options(options.user);
group.options(options.group);
return this;
};
/**
* Callback a `fn` after our defined timeout period.
*
* @param {Function} fn
* @return {Analytics}
* @api private
*/
Analytics.prototype._callback = function (fn) {
callback.async(fn, this._timeout);
return this;
};
/**
* Call `method` with `facade` on all enabled integrations.
*
* @param {String} method
* @param {Facade} facade
* @return {Analytics}
* @api private
*/
Analytics.prototype._invoke = function (method, facade) {
var options = facade.options();
this.emit('invoke', facade);
each(this._integrations, function (name, integration) {
if (!facade.enabled(name)) return;
integration.invoke.call(integration, method, facade);
});
return this;
};
/**
* Push `args`.
*
* @param {Array} args
* @api private
*/
Analytics.prototype.push = function(args){
var method = args.shift();
if (!this[method]) return;
this[method].apply(this, args);
};
/**
* Parse the query string for callable methods.
*
* @return {Analytics}
* @api private
*/
Analytics.prototype._parseQuery = function () {
// Identify and track any `ajs_uid` and `ajs_event` parameters in the URL.
var q = querystring.parse(window.location.search);
if (q.ajs_uid) this.identify(q.ajs_uid);
if (q.ajs_event) this.track(q.ajs_event);
return this;
};
/**
* Return the canonical path for the page.
*
* @return {String}
*/
function canonicalPath () {
var canon = canonical();
if (!canon) return window.location.pathname;
var parsed = url.parse(canon);
return parsed.pathname;
}
/**
* Return the canonical URL for the page concat the given `search`
* and strip the hash.
*
* @param {String} search
* @return {String}
*/
function canonicalUrl (search) {
var canon = canonical();
if (canon) return ~canon.indexOf('?') ? canon : canon + search;
var url = window.location.href;
var i = url.indexOf('#');
return -1 == i ? url : url.slice(0, i);
}
/**
* Create a new message with `Type` and `msg`
*
* the function will make sure that the `msg.options`
* is merged to `msg` and deletes `msg.options` if it
* has `.context / .timestamp / .integrations / .anonymousId`.
*
* Example:
*
* message(Identify, {
* options: { timestamp: Date, context: Object, integrations: Object },
* traits: { trait: true },
* userId: 123
* });
*
* // =>
*
* {
* userId: 123,
* context: Object,
* timestamp: Date,
* integrations: Object
* traits: { trait: true }
* }
*
* @param {Function} Type
* @param {Object} msg
* @return {Facade}
*/
function message(Type, msg){
var ctx = msg.options || {};
if (ctx.timestamp || ctx.integrations || ctx.context || ctx.anonymousId) {
msg = defaults(ctx, msg);
delete msg.options;
}
return new Type(msg);
}
}, {"after":105,"bind":182,"callback":88,"canonical":175,"clone":89,"./cookie":183,"debug":184,"defaults":91,"each":4,"emitter":102,"./group":185,"is":86,"is-email":162,"is-meta":186,"new-date":139,"event":187,"prevent":188,"querystring":189,"object":174,"./store":190,"url":176,"./user":191,"facade":124}],
182: [function(require, module, exports) {
try {
var bind = require('bind');
} catch (e) {
var bind = require('bind-component');
}
var bindAll = require('bind-all');
/**
* Expose `bind`.
*/
module.exports = exports = bind;
/**
* Expose `bindAll`.
*/
exports.all = bindAll;
/**
* Expose `bindMethods`.
*/
exports.methods = bindMethods;
/**
* Bind `methods` on `obj` to always be called with the `obj` as context.
*
* @param {Object} obj
* @param {String} methods...
*/
function bindMethods (obj, methods) {
methods = [].slice.call(arguments, 1);
for (var i = 0, method; method = methods[i]; i++) {
obj[method] = bind(obj, obj[method]);
}
return obj;
}
}, {"bind":95,"bind-all":96}],
183: [function(require, module, exports) {
var debug = require('debug')('analytics.js:cookie');
var bind = require('bind');
var cookie = require('cookie');
var clone = require('clone');
var defaults = require('defaults');
var json = require('json');
var topDomain = require('top-domain');
/**
* Initialize a new `Cookie` with `options`.
*
* @param {Object} options
*/
function Cookie (options) {
this.options(options);
}
/**
* Get or set the cookie options.
*
* @param {Object} options
* @field {Number} maxage (1 year)
* @field {String} domain
* @field {String} path
* @field {Boolean} secure
*/
Cookie.prototype.options = function (options) {
if (arguments.length === 0) return this._options;
options = options || {};
var domain = '.' + topDomain(window.location.href);
this._options = defaults(options, {
maxage: 31536000000, // default to a year
path: '/',
domain: domain
});
// http://curl.haxx.se/rfc/cookie_spec.html
// https://publicsuffix.org/list/effective_tld_names.dat
//
// try setting a dummy cookie with the options
// if the cookie isn't set, it probably means
// that the domain is on the public suffix list
// like myapp.herokuapp.com or localhost / ip.
this.set('ajs:test', true);
if (!this.get('ajs:test')) {
debug('fallback to domain=null');
this._options.domain = null;
}
this.remove('ajs:test');
};
/**
* Set a `key` and `value` in our cookie.
*
* @param {String} key
* @param {Object} value
* @return {Boolean} saved
*/
Cookie.prototype.set = function (key, value) {
try {
value = json.stringify(value);
cookie(key, value, clone(this._options));
return true;
} catch (e) {
return false;
}
};
/**
* Get a value from our cookie by `key`.
*
* @param {String} key
* @return {Object} value
*/
Cookie.prototype.get = function (key) {
try {
var value = cookie(key);
value = value ? json.parse(value) : null;
return value;
} catch (e) {
return null;
}
};
/**
* Remove a value from our cookie by `key`.
*
* @param {String} key
* @return {Boolean} removed
*/
Cookie.prototype.remove = function (key) {
try {
cookie(key, null, clone(this._options));
return true;
} catch (e) {
return false;
}
};
/**
* Expose the cookie singleton.
*/
module.exports = bind.all(new Cookie());
/**
* Expose the `Cookie` constructor.
*/
module.exports.Cookie = Cookie;
}, {"debug":184,"bind":182,"cookie":181,"clone":89,"defaults":91,"json":192,"top-domain":193}],
184: [function(require, module, exports) {
if ('undefined' == typeof window) {
module.exports = require('./lib/debug');
} else {
module.exports = require('./debug');
}
}, {"./lib/debug":194,"./debug":195}],
194: [function(require, module, exports) {
/**
* Module dependencies.
*/
var tty = require('tty');
/**
* Expose `debug()` as the module.
*/
module.exports = debug;
/**
* Enabled debuggers.
*/
var names = []
, skips = [];
(process.env.DEBUG || '')
.split(/[\s,]+/)
.forEach(function(name){
name = name.replace('*', '.*?');
if (name[0] === '-') {
skips.push(new RegExp('^' + name.substr(1) + '$'));
} else {
names.push(new RegExp('^' + name + '$'));
}
});
/**
* Colors.
*/
var colors = [6, 2, 3, 4, 5, 1];
/**
* Previous debug() call.
*/
var prev = {};
/**
* Previously assigned color.
*/
var prevColor = 0;
/**
* Is stdout a TTY? Colored output is disabled when `true`.
*/
var isatty = tty.isatty(2);
/**
* Select a color.
*
* @return {Number}
* @api private
*/
function color() {
return colors[prevColor++ % colors.length];
}
/**
* Humanize the given `ms`.
*
* @param {Number} m
* @return {String}
* @api private
*/
function humanize(ms) {
var sec = 1000
, min = 60 * 1000
, hour = 60 * min;
if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
if (ms >= min) return (ms / min).toFixed(1) + 'm';
if (ms >= sec) return (ms / sec | 0) + 's';
return ms + 'ms';
}
/**
* Create a debugger with the given `name`.
*
* @param {String} name
* @return {Type}
* @api public
*/
function debug(name) {
function disabled(){}
disabled.enabled = false;
var match = skips.some(function(re){
return re.test(name);
});
if (match) return disabled;
match = names.some(function(re){
return re.test(name);
});
if (!match) return disabled;
var c = color();
function colored(fmt) {
fmt = coerce(fmt);
var curr = new Date;
var ms = curr - (prev[name] || curr);
prev[name] = curr;
fmt = ' \u001b[9' + c + 'm' + name + ' '
+ '\u001b[3' + c + 'm\u001b[90m'
+ fmt + '\u001b[3' + c + 'm'
+ ' +' + humanize(ms) + '\u001b[0m';
console.error.apply(this, arguments);
}
function plain(fmt) {
fmt = coerce(fmt);
fmt = new Date().toUTCString()
+ ' ' + name + ' ' + fmt;
console.error.apply(this, arguments);
}
colored.enabled = plain.enabled = true;
return isatty || process.env.DEBUG_COLORS
? colored
: plain;
}
/**
* Coerce `val`.
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}
}, {}],
195: [function(require, module, exports) {
/**
* Expose `debug()` as the module.
*/
module.exports = debug;
/**
* Create a debugger with the given `name`.
*
* @param {String} name
* @return {Type}
* @api public
*/
function debug(name) {
if (!debug.enabled(name)) return function(){};
return function(fmt){
fmt = coerce(fmt);
var curr = new Date;
var ms = curr - (debug[name] || curr);
debug[name] = curr;
fmt = name
+ ' '
+ fmt
+ ' +' + debug.humanize(ms);
// This hackery is required for IE8
// where `console.log` doesn't have 'apply'
window.console
&& console.log
&& Function.prototype.apply.call(console.log, console, arguments);
}
}
/**
* The currently active debug mode names.
*/
debug.names = [];
debug.skips = [];
/**
* Enables a debug mode by name. This can include modes
* separated by a colon and wildcards.
*
* @param {String} name
* @api public
*/
debug.enable = function(name) {
try {
localStorage.debug = name;
} catch(e){}
var split = (name || '').split(/[\s,]+/)
, len = split.length;
for (var i = 0; i < len; i++) {
name = split[i].replace('*', '.*?');
if (name[0] === '-') {
debug.skips.push(new RegExp('^' + name.substr(1) + '$'));
}
else {
debug.names.push(new RegExp('^' + name + '$'));
}
}
};
/**
* Disable debug output.
*
* @api public
*/
debug.disable = function(){
debug.enable('');
};
/**
* Humanize the given `ms`.
*
* @param {Number} m
* @return {String}
* @api private
*/
debug.humanize = function(ms) {
var sec = 1000
, min = 60 * 1000
, hour = 60 * min;
if (ms >= hour) return (ms / hour).toFixed(1) + 'h';
if (ms >= min) return (ms / min).toFixed(1) + 'm';
if (ms >= sec) return (ms / sec | 0) + 's';
return ms + 'ms';
};
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
debug.enabled = function(name) {
for (var i = 0, len = debug.skips.length; i < len; i++) {
if (debug.skips[i].test(name)) {
return false;
}
}
for (var i = 0, len = debug.names.length; i < len; i++) {
if (debug.names[i].test(name)) {
return true;
}
}
return false;
};
/**
* Coerce `val`.
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}
// persist
try {
if (window.localStorage) debug.enable(localStorage.debug);
} catch(e){}
}, {}],
192: [function(require, module, exports) {
var json = window.JSON || {};
var stringify = json.stringify;
var parse = json.parse;
module.exports = parse && stringify
? JSON
: require('json-fallback');
}, {"json-fallback":196}],
196: [function(require, module, exports) {
/*
json2.js
2014-02-04
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
This file creates a global JSON object containing two methods: stringify
and parse.
JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.
replacer an optional parameter that determines how object
values are stringified for objects. It can be a
function or an array of strings.
space an optional parameter that specifies the indentation
of nested structures. If it is omitted, the text will
be packed without extra whitespace. If it is a number,
it will specify the number of spaces to indent at each
level. If it is a string (such as '\t' or ' '),
it contains the characters used to indent at each level.
This method produces a JSON text from a JavaScript value.
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the value
For example, this would serialize Dates as ISO strings.
Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
You can provide an optional replacer method. It will be passed the
key and value of each member, with this bound to the containing
object. The value that is returned from your method will be
serialized. If your method returns undefined, then the member will
be excluded from the serialization.
If the replacer parameter is an array of strings, then it will be
used to select the members to be serialized. It filters the results
such that only members with keys listed in the replacer array are
stringified.
Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.
The optional space parameter produces a stringification of the
value that is filled with line breaks and indentation to make it
easier to read.
If the space parameter is a non-empty string, then that string will
be used for indentation. If the space parameter is a number, then
the indentation will be that many spaces.
Example:
text = JSON.stringify(['e', {pluribus: 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
});
// text is '["Date(---current time---)"]'
JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
It can throw a SyntaxError exception.
The optional reviver parameter is a function that can filter and
transform the results. It receives each of the keys and values,
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.
Example:
// Parse the text. Values that look like ISO date strings will
// be converted to Date objects.
myData = JSON.parse(text, function (key, value) {
var a;
if (typeof value === 'string') {
a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+a[5], +a[6]));
}
}
return value;
});
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
var d;
if (typeof value === 'string' &&
value.slice(0, 5) === 'Date(' &&
value.slice(-1) === ')') {
d = new Date(value.slice(5, -1));
if (d) {
return d;
}
}
return value;
});
This is a reference implementation. You are free to copy, modify, or
redistribute.
*/
/*jslint evil: true, regexp: true */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
(function () {
'use strict';
var JSON = module.exports = {};
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function () {
return isFinite(this.valueOf())
? this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z'
: null;
};
String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function () {
return this.valueOf();
};
}
var cx,
escapable,
gap,
indent,
meta,
rep;
function quote(string) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string'
? c
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
// What happens next depends on the value's type.
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case 'object':
// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if (!value) {
return 'null';
}
// Make an array to hold the partial results of stringifying this object value.
gap += indent;
partial = [];
// Is the value an array?
if (Object.prototype.toString.apply(value) === '[object Array]') {
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v = partial.length === 0
? '[]'
: gap
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
: '[' + partial.join(',') + ']';
gap = mind;
return v;
}
// If the replacer is an array, use it to select the members to be stringified.
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
if (typeof rep[i] === 'string') {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
// Otherwise, iterate through all of the keys in the object.
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v = partial.length === 0
? '{}'
: gap
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
: '{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
// If the JSON object does not yet have a stringify method, give it one.
if (typeof JSON.stringify !== 'function') {
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
};
JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;
gap = '';
indent = '';
// If the space parameter is a number, make an indent string containing that
// many spaces.
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
// If the space parameter is a string, it will be used as the indent string.
} else if (typeof space === 'string') {
indent = space;
}
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str('', {'': value});
};
}
// If the JSON object does not yet have a parse method, give it one.
if (typeof JSON.parse !== 'function') {
cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
JSON.parse = function (text, reviver) {
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;
function walk(holder, key) {
// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j = eval('(' + text + ')');
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver === 'function'
? walk({'': j}, '')
: j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError('JSON.parse');
};
}
}());
}, {}],
193: [function(require, module, exports) {
/**
* Module dependencies.
*/
var parse = require('url').parse;
/**
* Expose `domain`
*/
module.exports = domain;
/**
* RegExp
*/
var regexp = /[a-z0-9][a-z0-9\-]*[a-z0-9]\.[a-z\.]{2,6}$/i;
/**
* Get the top domain.
*
* Official Grammar: http://tools.ietf.org/html/rfc883#page-56
* Look for tlds with up to 2-6 characters.
*
* Example:
*
* domain('http://localhost:3000/baz');
* // => ''
* domain('http://dev:3000/baz');
* // => ''
* domain('http://127.0.0.1:3000/baz');
* // => ''
* domain('http://segment.io/baz');
* // => 'segment.io'
*
* @param {String} url
* @return {String}
* @api public
*/
function domain(url){
var host = parse(url).hostname;
var match = host.match(regexp);
return match ? match[0] : '';
};
}, {"url":176}],
185: [function(require, module, exports) {
var debug = require('debug')('analytics:group');
var Entity = require('./entity');
var inherit = require('inherit');
var bind = require('bind');
/**
* Group defaults
*/
Group.defaults = {
persist: true,
cookie: {
key: 'ajs_group_id'
},
localStorage: {
key: 'ajs_group_properties'
}
};
/**
* Initialize a new `Group` with `options`.
*
* @param {Object} options
*/
function Group (options) {
this.defaults = Group.defaults;
this.debug = debug;
Entity.call(this, options);
}
/**
* Inherit `Entity`
*/
inherit(Group, Entity);
/**
* Expose the group singleton.
*/
module.exports = bind.all(new Group());
/**
* Expose the `Group` constructor.
*/
module.exports.Group = Group;
}, {"debug":184,"./entity":197,"inherit":198,"bind":182}],
197: [function(require, module, exports) {
var traverse = require('isodate-traverse');
var defaults = require('defaults');
var cookie = require('./cookie');
var store = require('./store');
var extend = require('extend');
var clone = require('clone');
/**
* Expose `Entity`
*/
module.exports = Entity;
/**
* Initialize new `Entity` with `options`.
*
* @param {Object} options
*/
function Entity(options){
this.protocol = window.location.protocol;
this.options(options);
}
/**
* Get the storage.
*
* When .protocol is `file:` or `chrome-extension:`
* the method will return the localstorage (store)
* otherwise it will return the cookie.
*
* @return {Object}
*/
Entity.prototype.storage = function(){
return 'file:' == this.protocol
|| 'chrome-extension:' == this.protocol
? store
: cookie;
};
/**
* Get or set storage `options`.
*
* @param {Object} options
* @property {Object} cookie
* @property {Object} localStorage
* @property {Boolean} persist (default: `true`)
*/
Entity.prototype.options = function (options) {
if (arguments.length === 0) return this._options;
options || (options = {});
defaults(options, this.defaults || {});
this._options = options;
};
/**
* Get or set the entity's `id`.
*
* @param {String} id
*/
Entity.prototype.id = function (id) {
switch (arguments.length) {
case 0: return this._getId();
case 1: return this._setId(id);
}
};
/**
* Get the entity's id.
*
* @return {String}
*/
Entity.prototype._getId = function () {
var storage = this.storage();
var ret = this._options.persist
? storage.get(this._options.cookie.key)
: this._id;
return ret === undefined ? null : ret;
};
/**
* Set the entity's `id`.
*
* @param {String} id
*/
Entity.prototype._setId = function (id) {
var storage = this.storage();
if (this._options.persist) {
storage.set(this._options.cookie.key, id);
} else {
this._id = id;
}
};
/**
* Get or set the entity's `traits`.
*
* BACKWARDS COMPATIBILITY: aliased to `properties`
*
* @param {Object} traits
*/
Entity.prototype.properties =
Entity.prototype.traits = function (traits) {
switch (arguments.length) {
case 0: return this._getTraits();
case 1: return this._setTraits(traits);
}
};
/**
* Get the entity's traits. Always convert ISO date strings into real dates,
* since they aren't parsed back from local storage.
*
* @return {Object}
*/
Entity.prototype._getTraits = function () {
var ret = this._options.persist
? store.get(this._options.localStorage.key)
: this._traits;
return ret ? traverse(clone(ret)) : {};
};
/**
* Set the entity's `traits`.
*
* @param {Object} traits
*/
Entity.prototype._setTraits = function (traits) {
traits || (traits = {});
if (this._options.persist) {
store.set(this._options.localStorage.key, traits);
} else {
this._traits = traits;
}
};
/**
* Identify the entity with an `id` and `traits`. If we it's the same entity,
* extend the existing `traits` instead of overwriting.
*
* @param {String} id
* @param {Object} traits
*/
Entity.prototype.identify = function (id, traits) {
traits || (traits = {});
var current = this.id();
if (current === null || current === id) traits = extend(this.traits(), traits);
if (id) this.id(id);
this.debug('identify %o, %o', id, traits);
this.traits(traits);
this.save();
};
/**
* Save the entity to local storage and the cookie.
*
* @return {Boolean}
*/
Entity.prototype.save = function () {
if (!this._options.persist) return false;
cookie.set(this._options.cookie.key, this.id());
store.set(this._options.localStorage.key, this.traits());
return true;
};
/**
* Log the entity out, reseting `id` and `traits` to defaults.
*/
Entity.prototype.logout = function () {
this.id(null);
this.traits({});
cookie.remove(this._options.cookie.key);
store.remove(this._options.localStorage.key);
};
/**
* Reset all entity state, logging out and returning options to defaults.
*/
Entity.prototype.reset = function () {
this.logout();
this.options({});
};
/**
* Load saved entity `id` or `traits` from storage.
*/
Entity.prototype.load = function () {
this.id(cookie.get(this._options.cookie.key));
this.traits(store.get(this._options.localStorage.key));
};
}, {"isodate-traverse":134,"defaults":91,"./cookie":183,"./store":190,"extend":122,"clone":89}],
190: [function(require, module, exports) {
var bind = require('bind');
var defaults = require('defaults');
var store = require('store.js');
/**
* Initialize a new `Store` with `options`.
*
* @param {Object} options
*/
function Store (options) {
this.options(options);
}
/**
* Set the `options` for the store.
*
* @param {Object} options
* @field {Boolean} enabled (true)
*/
Store.prototype.options = function (options) {
if (arguments.length === 0) return this._options;
options = options || {};
defaults(options, { enabled : true });
this.enabled = options.enabled && store.enabled;
this._options = options;
};
/**
* Set a `key` and `value` in local storage.
*
* @param {String} key
* @param {Object} value
*/
Store.prototype.set = function (key, value) {
if (!this.enabled) return false;
return store.set(key, value);
};
/**
* Get a value from local storage by `key`.
*
* @param {String} key
* @return {Object}
*/
Store.prototype.get = function (key) {
if (!this.enabled) return null;
return store.get(key);
};
/**
* Remove a value from local storage by `key`.
*
* @param {String} key
*/
Store.prototype.remove = function (key) {
if (!this.enabled) return false;
return store.remove(key);
};
/**
* Expose the store singleton.
*/
module.exports = bind.all(new Store());
/**
* Expose the `Store` constructor.
*/
module.exports.Store = Store;
}, {"bind":182,"defaults":91,"store.js":199}],
199: [function(require, module, exports) {
var json = require('json')
, store = {}
, win = window
, doc = win.document
, localStorageName = 'localStorage'
, namespace = '__storejs__'
, storage;
store.disabled = false
store.set = function(key, value) {}
store.get = function(key) {}
store.remove = function(key) {}
store.clear = function() {}
store.transact = function(key, defaultVal, transactionFn) {
var val = store.get(key)
if (transactionFn == null) {
transactionFn = defaultVal
defaultVal = null
}
if (typeof val == 'undefined') { val = defaultVal || {} }
transactionFn(val)
store.set(key, val)
}
store.getAll = function() {}
store.serialize = function(value) {
return json.stringify(value)
}
store.deserialize = function(value) {
if (typeof value != 'string') { return undefined }
try { return json.parse(value) }
catch(e) { return value || undefined }
}
// Functions to encapsulate questionable FireFox 3.6.13 behavior
// when about.config::dom.storage.enabled === false
// See https://github.com/marcuswestin/store.js/issues#issue/13
function isLocalStorageNameSupported() {
try { return (localStorageName in win && win[localStorageName]) }
catch(err) { return false }
}
if (isLocalStorageNameSupported()) {
storage = win[localStorageName]
store.set = function(key, val) {
if (val === undefined) { return store.remove(key) }
storage.setItem(key, store.serialize(val))
return val
}
store.get = function(key) { return store.deserialize(storage.getItem(key)) }
store.remove = function(key) { storage.removeItem(key) }
store.clear = function() { storage.clear() }
store.getAll = function() {
var ret = {}
for (var i=0; i<storage.length; ++i) {
var key = storage.key(i)
ret[key] = store.get(key)
}
return ret
}
} else if (doc.documentElement.addBehavior) {
var storageOwner,
storageContainer
// Since #userData storage applies only to specific paths, we need to
// somehow link our data to a specific path. We choose /favicon.ico
// as a pretty safe option, since all browsers already make a request to
// this URL anyway and being a 404 will not hurt us here. We wrap an
// iframe pointing to the favicon in an ActiveXObject(htmlfile) object
// (see: http://msdn.microsoft.com/en-us/library/aa752574(v=VS.85).aspx)
// since the iframe access rules appear to allow direct access and
// manipulation of the document element, even for a 404 page. This
// document can be used instead of the current document (which would
// have been limited to the current path) to perform #userData storage.
try {
storageContainer = new ActiveXObject('htmlfile')
storageContainer.open()
storageContainer.write('<s' + 'cript>document.w=window</s' + 'cript><iframe src="/favicon.ico"></iframe>')
storageContainer.close()
storageOwner = storageContainer.w.frames[0].document
storage = storageOwner.createElement('div')
} catch(e) {
// somehow ActiveXObject instantiation failed (perhaps some special
// security settings or otherwse), fall back to per-path storage
storage = doc.createElement('div')
storageOwner = doc.body
}
function withIEStorage(storeFunction) {
return function() {
var args = Array.prototype.slice.call(arguments, 0)
args.unshift(storage)
// See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx
// and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx
storageOwner.appendChild(storage)
storage.addBehavior('#default#userData')
storage.load(localStorageName)
var result = storeFunction.apply(store, args)
storageOwner.removeChild(storage)
return result
}
}
// In IE7, keys may not contain special chars. See all of https://github.com/marcuswestin/store.js/issues/40
var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g")
function ieKeyFix(key) {
return key.replace(forbiddenCharsRegex, '___')
}
store.set = withIEStorage(function(storage, key, val) {
key = ieKeyFix(key)
if (val === undefined) { return store.remove(key) }
storage.setAttribute(key, store.serialize(val))
storage.save(localStorageName)
return val
})
store.get = withIEStorage(function(storage, key) {
key = ieKeyFix(key)
return store.deserialize(storage.getAttribute(key))
})
store.remove = withIEStorage(function(storage, key) {
key = ieKeyFix(key)
storage.removeAttribute(key)
storage.save(localStorageName)
})
store.clear = withIEStorage(function(storage) {
var attributes = storage.XMLDocument.documentElement.attributes
storage.load(localStorageName)
for (var i=0, attr; attr=attributes[i]; i++) {
storage.removeAttribute(attr.name)
}
storage.save(localStorageName)
})
store.getAll = withIEStorage(function(storage) {
var attributes = storage.XMLDocument.documentElement.attributes
var ret = {}
for (var i=0, attr; attr=attributes[i]; ++i) {
var key = ieKeyFix(attr.name)
ret[attr.name] = store.deserialize(storage.getAttribute(key))
}
return ret
})
}
try {
store.set(namespace, namespace)
if (store.get(namespace) != namespace) { store.disabled = true }
store.remove(namespace)
} catch(e) {
store.disabled = true
}
store.enabled = !store.disabled
module.exports = store;
}, {"json":192}],
198: [function(require, module, exports) {
module.exports = function(a, b){
var fn = function(){};
fn.prototype = b.prototype;
a.prototype = new fn;
a.prototype.constructor = a;
};
}, {}],
186: [function(require, module, exports) {
module.exports = function isMeta (e) {
if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) return true;
// Logic that handles checks for the middle mouse button, based
// on [jQuery](https://github.com/jquery/jquery/blob/master/src/event.js#L466).
var which = e.which, button = e.button;
if (!which && button !== undefined) {
return (!button & 1) && (!button & 2) && (button & 4);
} else if (which === 2) {
return true;
}
return false;
};
}, {}],
187: [function(require, module, exports) {
/**
* Bind `el` event `type` to `fn`.
*
* @param {Element} el
* @param {String} type
* @param {Function} fn
* @param {Boolean} capture
* @return {Function}
* @api public
*/
exports.bind = function(el, type, fn, capture){
if (el.addEventListener) {
el.addEventListener(type, fn, capture || false);
} else {
el.attachEvent('on' + type, fn);
}
return fn;
};
/**
* Unbind `el` event `type`'s callback `fn`.
*
* @param {Element} el
* @param {String} type
* @param {Function} fn
* @param {Boolean} capture
* @return {Function}
* @api public
*/
exports.unbind = function(el, type, fn, capture){
if (el.removeEventListener) {
el.removeEventListener(type, fn, capture || false);
} else {
el.detachEvent('on' + type, fn);
}
return fn;
};
}, {}],
188: [function(require, module, exports) {
/**
* prevent default on the given `e`.
*
* examples:
*
* anchor.onclick = prevent;
* anchor.onclick = function(e){
* if (something) return prevent(e);
* };
*
* @param {Event} e
*/
module.exports = function(e){
e = e || window.event
return e.preventDefault
? e.preventDefault()
: e.returnValue = false;
};
}, {}],
189: [function(require, module, exports) {
/**
* Module dependencies.
*/
var encode = encodeURIComponent;
var decode = decodeURIComponent;
var trim = require('trim');
var type = require('type');
/**
* Parse the given query `str`.
*
* @param {String} str
* @return {Object}
* @api public
*/
exports.parse = function(str){
if ('string' != typeof str) return {};
str = trim(str);
if ('' == str) return {};
if ('?' == str.charAt(0)) str = str.slice(1);
var obj = {};
var pairs = str.split('&');
for (var i = 0; i < pairs.length; i++) {
var parts = pairs[i].split('=');
var key = decode(parts[0]);
var m;
if (m = /(\w+)\[(\d+)\]/.exec(key)) {
obj[m[1]] = obj[m[1]] || [];
obj[m[1]][m[2]] = decode(parts[1]);
continue;
}
obj[parts[0]] = null == parts[1]
? ''
: decode(parts[1]);
}
return obj;
};
/**
* Stringify the given `obj`.
*
* @param {Object} obj
* @return {String}
* @api public
*/
exports.stringify = function(obj){
if (!obj) return '';
var pairs = [];
for (var key in obj) {
var value = obj[key];
if ('array' == type(value)) {
for (var i = 0; i < value.length; ++i) {
pairs.push(encode(key + '[' + i + ']') + '=' + encode(value[i]));
}
continue;
}
pairs.push(encode(key) + '=' + encode(obj[key]));
}
return pairs.join('&');
};
}, {"trim":163,"type":7}],
191: [function(require, module, exports) {
var debug = require('debug')('analytics:user');
var Entity = require('./entity');
var inherit = require('inherit');
var bind = require('bind');
var cookie = require('./cookie');
/**
* User defaults
*/
User.defaults = {
persist: true,
cookie: {
key: 'ajs_user_id',
oldKey: 'ajs_user'
},
localStorage: {
key: 'ajs_user_traits'
}
};
/**
* Initialize a new `User` with `options`.
*
* @param {Object} options
*/
function User (options) {
this.defaults = User.defaults;
this.debug = debug;
Entity.call(this, options);
}
/**
* Inherit `Entity`
*/
inherit(User, Entity);
/**
* Load saved user `id` or `traits` from storage.
*/
User.prototype.load = function () {
if (this._loadOldCookie()) return;
Entity.prototype.load.call(this);
};
/**
* BACKWARDS COMPATIBILITY: Load the old user from the cookie.
*
* @return {Boolean}
* @api private
*/
User.prototype._loadOldCookie = function () {
var user = cookie.get(this._options.cookie.oldKey);
if (!user) return false;
this.id(user.id);
this.traits(user.traits);
cookie.remove(this._options.cookie.oldKey);
return true;
};
/**
* Expose the user singleton.
*/
module.exports = bind.all(new User());
/**
* Expose the `User` constructor.
*/
module.exports.User = User;
}, {"debug":184,"./entity":197,"inherit":198,"bind":182,"./cookie":183}],
5: [function(require, module, exports) {
module.exports = '2.3.17';
}, {}]}, {}, {"1":"analytics"})
|
ajax/libs/instantsearch.js/1.8.6/instantsearch-preact.min.js | sreym/cdnjs | /*! instantsearch.js 1.8.6 | © Algolia Inc. and other contributors; Licensed MIT | github.com/algolia/instantsearch.js */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.instantsearch=t():e.instantsearch=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].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";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(1),o=r(i);e.exports=o.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),n(2),n(3);var i=n(4),o=r(i),a=n(5),s=r(a),u=n(34),c=r(u),l=n(324),f=r(l),p=n(341),d=r(p),h=n(345),m=r(h),v=n(349),g=r(v),y=n(354),b=r(y),_=n(358),w=r(_),x=n(362),R=r(x),j=n(364),P=r(j),C=n(366),O=r(C),S=n(367),E=r(S),F=n(376),k=r(F),N=n(381),T=r(N),A=n(383),M=r(A),H=n(390),L=r(H),U=n(391),D=r(U),I=n(394),V=r(I),q=n(397),B=r(q),Q=n(321),z=r(Q),W=(0,o.default)(s.default);W.widgets={clearAll:f.default,currentRefinedValues:d.default,hierarchicalMenu:m.default,hits:g.default,hitsPerPageSelector:b.default,menu:w.default,refinementList:R.default,numericRefinementList:P.default,numericSelector:O.default,pagination:E.default,priceRanges:k.default,searchBox:T.default,rangeSlider:M.default,sortBySelector:L.default,starRating:D.default,stats:V.default,toggle:B.default},W.version=z.default,W.createQueryString=c.default.url.getQueryStringFromState,t.default=W},function(e,t){"use strict";Object.freeze||(Object.freeze=function(e){if(Object(e)!==e)throw new TypeError("Object.freeze can only be called on Objects.");return e})},function(e,t){"use strict";var n={};Object.setPrototypeOf||n.__proto__||!function(){var e=Object.getPrototypeOf;Object.getPrototypeOf=function(t){return t.__proto__?t.__proto__:e.call(Object,t)}}()},function(e,t){"use strict";function n(e){var t=function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return new(r.apply(e,[null].concat(n)))};return t.__proto__=e,t.prototype=e.prototype,t}var r=Function.prototype.bind;e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(){return"#"}function u(e){return function(t,n){if(!n.getConfiguration)return t;var r=n.getConfiguration(t,e),i=function e(t,n){return Array.isArray(t)?(0,_.default)(t,n):(0,j.default)(t)?(0,y.default)({},t,n,e):void 0};return(0,y.default)({},t,r,i)}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=n(6),p=r(f),d=n(34),h=r(d),m=n(155),v=r(m),g=n(315),y=r(g),b=n(316),_=r(b),w=n(319),x=r(w),R=n(44),j=r(R),P=n(300),C=n(320),O=r(C),S=n(321),E=r(S),F=n(323),k=r(F),N=function(e){function t(e){var n=e.appId,r=void 0===n?null:n,a=e.apiKey,s=void 0===a?null:a,u=e.indexName,l=void 0===u?null:u,f=e.numberLocale,d=e.searchParameters,h=void 0===d?{}:d,m=e.urlSync,v=void 0===m?null:m,g=e.searchFunction;i(this,t);var y=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(null===r||null===s||null===l){var b="\nUsage: instantsearch({\n appId: 'my_application_id',\n apiKey: 'my_search_api_key',\n indexName: 'my_index_name'\n});";throw new Error(b)}var _=(0,p.default)(r,s);return _.addAlgoliaAgent("instantsearch.js "+E.default),y.client=_,y.helper=null,y.indexName=l,y.searchParameters=c({},h,{index:l}),y.widgets=[],y.templatesConfig={helpers:(0,k.default)({numberLocale:f}),compileOptions:{}},g&&(y._searchFunction=g),y.urlSync=v===!0?{}:v,y}return a(t,e),l(t,[{key:"addWidget",value:function(e){if(void 0===e.render&&void 0===e.init)throw new Error("Widget definition missing render or init method");this.widgets.push(e)}},{key:"start",value:function(){var e=this;if(!this.widgets)throw new Error("No widgets were added to instantsearch.js");var t=void 0;if(this.urlSync){var n=(0,O.default)(this.urlSync);this._createURL=n.createURL.bind(n),this._createAbsoluteURL=function(t){return e._createURL(t,{absolute:!0})},this._onHistoryChange=n.onHistoryChange.bind(n),this.widgets.push(n),t=n.searchParametersFromUrl}else this._createURL=s,this._createAbsoluteURL=s,this._onHistoryChange=function(){};this.searchParameters=this.widgets.reduce(u(t),this.searchParameters);var r=(0,h.default)(this.client,this.searchParameters.index||this.indexName,this.searchParameters);this._searchFunction&&(this._originalHelperSearch=r.search.bind(r),r.search=this._wrappedSearch.bind(this)),this.helper=r,this._init(r.state,r),r.on("result",this._render.bind(this,r)),r.search()}},{key:"_wrappedSearch",value:function(){var e=(0,x.default)(this.helper);e.search=this._originalHelperSearch,this._searchFunction(e)}},{key:"createURL",value:function(e){if(!this._createURL)throw new Error("You need to call start() before calling createURL()");return this._createURL(this.helper.state.setQueryParameters(e))}},{key:"_render",value:function(e,t,n){var r=this;(0,v.default)(this.widgets,function(i){i.render&&i.render({templatesConfig:r.templatesConfig,results:t,state:n,helper:e,createURL:r._createAbsoluteURL})}),this.emit("render")}},{key:"_init",value:function(e,t){var n=this;(0,v.default)(this.widgets,function(r){r.init&&r.init({state:e,helper:t,templatesConfig:n.templatesConfig,createURL:n._createAbsoluteURL,onHistoryChange:n._onHistoryChange})})}}]),t}(P.EventEmitter);t.default=N},function(e,t,n){"use strict";var r=n(7),i=n(21);e.exports=i(r,"(lite) ")},function(e,t,n){function r(e,t,r){var o=n(17)("algoliasearch"),s=n(20),c=n(15),l=n(16),f="Usage: algoliasearch(applicationID, apiKey, opts)";if(r._allowEmptyCredentials!==!0&&!e)throw new u.AlgoliaSearchError("Please provide an application ID. "+f);if(r._allowEmptyCredentials!==!0&&!t)throw new u.AlgoliaSearchError("Please provide an API key. "+f);this.applicationID=e,this.apiKey=t;var p=a([this.applicationID+"-1.algolianet.com",this.applicationID+"-2.algolianet.com",this.applicationID+"-3.algolianet.com"]);this.hosts={read:[],write:[]},this.hostIndex={read:0,write:0},r=r||{};var d=r.protocol||"https:",h=void 0===r.timeout?2e3:r.timeout;if(/:$/.test(d)||(d+=":"),"http:"!==r.protocol&&"https:"!==r.protocol)throw new u.AlgoliaSearchError("protocol must be `http:` or `https:` (was `"+r.protocol+"`)");r.hosts?c(r.hosts)?(this.hosts.read=s(r.hosts),this.hosts.write=s(r.hosts)):(this.hosts.read=s(r.hosts.read),this.hosts.write=s(r.hosts.write)):(this.hosts.read=[this.applicationID+"-dsn.algolia.net"].concat(p),this.hosts.write=[this.applicationID+".algolia.net"].concat(p)),this.hosts.read=l(this.hosts.read,i(d)),this.hosts.write=l(this.hosts.write,i(d)),this.requestTimeout=h,this.extraHeaders=[],this.cache=r._cache||{},this._ua=r._ua,this._useCache=!(void 0!==r._useCache&&!r._cache)||r._useCache,this._useFallback=void 0===r.useFallback||r.useFallback,this._setTimeout=r._setTimeout,o("init done, %j",this)}function i(e){return function(t){return e+"//"+t.toLowerCase()}}function o(e){if(void 0===Array.prototype.toJSON)return JSON.stringify(e);var t=Array.prototype.toJSON;delete Array.prototype.toJSON;var n=JSON.stringify(e);return Array.prototype.toJSON=t,n}function a(e){for(var t,n,r=e.length;0!==r;)n=Math.floor(Math.random()*r),r-=1,t=e[r],e[r]=e[n],e[n]=t;return e}function s(e){var t={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r;r="x-algolia-api-key"===n||"x-algolia-application-id"===n?"**hidden for security purposes**":e[n],t[n]=r}return t}e.exports=r;var u=n(8),c=n(11),l=n(12),f=500;r.prototype.initIndex=function(e){return new l(this,e)},r.prototype.setExtraHeader=function(e,t){this.extraHeaders.push({name:e.toLowerCase(),value:t})},r.prototype.addAlgoliaAgent=function(e){this._ua+=";"+e},r.prototype._jsonRequest=function(e){function t(n,c){function f(e){var t=e&&e.body&&e.body.message&&e.body.status||e.statusCode||e&&e.body&&200;a("received response: statusCode: %s, computed statusCode: %d, headers: %j",e.statusCode,t,e.headers);var n=2===Math.floor(t/100),o=new Date;if(v.push({currentHost:x,headers:s(i),content:r||null,contentLength:void 0!==r?r.length:null,method:c.method,timeout:c.timeout,url:c.url,startTime:w,endTime:o,duration:o-w,statusCode:t}),n)return p._useCache&&l&&(l[_]=e.responseText),e.body;var f=4!==Math.floor(t/100);if(f)return d+=1,y();a("unrecoverable error");var h=new u.AlgoliaSearchError(e.body&&e.body.message,{debugData:v,statusCode:t});return p._promise.reject(h)}function g(t){a("error: %s, stack: %s",t.message,t.stack);var n=new Date;return v.push({currentHost:x,headers:s(i),content:r||null,contentLength:void 0!==r?r.length:null,method:c.method,timeout:c.timeout,url:c.url,startTime:w,endTime:n,duration:n-w}),t instanceof u.AlgoliaSearchError||(t=new u.Unknown(t&&t.message,t)),d+=1,t instanceof u.Unknown||t instanceof u.UnparsableJSON||d>=p.hosts[e.hostType].length&&(h||!m)?(t.debugData=v,p._promise.reject(t)):t instanceof u.RequestTimeout?b():y()}function y(){return a("retrying request"),p.hostIndex[e.hostType]=(p.hostIndex[e.hostType]+1)%p.hosts[e.hostType].length,t(n,c)}function b(){return a("retrying request with higher timeout"),p.hostIndex[e.hostType]=(p.hostIndex[e.hostType]+1)%p.hosts[e.hostType].length,c.timeout=p.requestTimeout*(d+1),t(n,c)}var _,w=new Date;if(p._useCache&&(_=e.url),p._useCache&&r&&(_+="_body_"+c.body),p._useCache&&l&&void 0!==l[_])return a("serving response from cache"),p._promise.resolve(JSON.parse(l[_]));if(d>=p.hosts[e.hostType].length)return!m||h?(a("could not get any response"),p._promise.reject(new u.AlgoliaSearchError("Cannot connect to the AlgoliaSearch API. Send an email to [email protected] to report and resolve the issue. Application id was: "+p.applicationID,{debugData:v}))):(a("switching to fallback"),d=0,c.method=e.fallback.method,c.url=e.fallback.url,c.jsonBody=e.fallback.body,c.jsonBody&&(c.body=o(c.jsonBody)),i=p._computeRequestHeaders(),c.timeout=p.requestTimeout*(d+1),p.hostIndex[e.hostType]=0,h=!0,t(p._request.fallback,c));var x=p.hosts[e.hostType][p.hostIndex[e.hostType]],R=x+c.url,j={body:c.body,jsonBody:c.jsonBody,method:c.method,headers:i,timeout:c.timeout,debug:a};return a("method: %s, url: %s, headers: %j, timeout: %d",j.method,R,j.headers,j.timeout),n===p._request.fallback&&a("using fallback"),n.call(p,R,j).then(f,g)}var r,i,a=n(17)("algoliasearch:"+e.url),l=e.cache,p=this,d=0,h=!1,m=p._useFallback&&p._request.fallback&&e.fallback;this.apiKey.length>f&&void 0!==e.body&&void 0!==e.body.params?(e.body.apiKey=this.apiKey,i=this._computeRequestHeaders(!1)):i=this._computeRequestHeaders(),void 0!==e.body&&(r=o(e.body)),a("request start");var v=[],g=t(p._request,{url:e.url,method:e.method,body:r,jsonBody:e.body,timeout:p.requestTimeout*(d+1)});return e.callback?void g.then(function(t){c(function(){e.callback(null,t)},p._setTimeout||setTimeout)},function(t){c(function(){e.callback(t)},p._setTimeout||setTimeout)}):g},r.prototype._getSearchParams=function(e,t){if(void 0===e||null===e)return t;for(var n in e)null!==n&&void 0!==e[n]&&e.hasOwnProperty(n)&&(t+=""===t?"":"&",t+=n+"="+encodeURIComponent("[object Array]"===Object.prototype.toString.call(e[n])?o(e[n]):e[n]));return t},r.prototype._computeRequestHeaders=function(e){var t=n(10),r={"x-algolia-agent":this._ua,"x-algolia-application-id":this.applicationID};return e!==!1&&(r["x-algolia-api-key"]=this.apiKey),this.userToken&&(r["x-algolia-usertoken"]=this.userToken),this.securityTags&&(r["x-algolia-tagfilters"]=this.securityTags),this.extraHeaders&&t(this.extraHeaders,function(e){r[e.name]=e.value}),r},r.prototype.search=function(e,t,r){var i=n(15),o=n(16),a="Usage: client.search(arrayOfQueries[, callback])";if(!i(e))throw new Error(a);"function"==typeof t?(r=t,t={}):void 0===t&&(t={});var s=this,u={requests:o(e,function(e){var t="";return void 0!==e.query&&(t+="query="+encodeURIComponent(e.query)),{indexName:e.indexName,params:s._getSearchParams(e.params,t)}})},c=o(u.requests,function(e,t){return t+"="+encodeURIComponent("/1/indexes/"+encodeURIComponent(e.indexName)+"?"+e.params)}).join("&"),l="/1/indexes/*/queries";return void 0!==t.strategy&&(l+="?strategy="+t.strategy),this._jsonRequest({cache:this.cache,method:"POST",url:l,body:u,hostType:"read",fallback:{method:"GET",url:"/1/indexes/*",body:{params:c}},callback:r})},r.prototype.setSecurityTags=function(e){if("[object Array]"===Object.prototype.toString.call(e)){for(var t=[],n=0;n<e.length;++n)if("[object Array]"===Object.prototype.toString.call(e[n])){for(var r=[],i=0;i<e[n].length;++i)r.push(e[n][i]);t.push("("+r.join(",")+")")}else t.push(e[n]);e=t.join(",")}this.securityTags=e},r.prototype.setUserToken=function(e){this.userToken=e},r.prototype.clearCache=function(){this.cache={}},r.prototype.setRequestTimeout=function(e){e&&(this.requestTimeout=parseInt(e,10))}},function(e,t,n){"use strict";function r(e,t){var r=n(10),i=this;"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):i.stack=(new Error).stack||"Cannot get a stacktrace, browser is too old",this.name="AlgoliaSearchError",this.message=e||"Unknown error",t&&r(t,function(e,t){i[t]=e})}function i(e,t){function n(){var n=Array.prototype.slice.call(arguments,0);"string"!=typeof n[0]&&n.unshift(t),r.apply(this,n),this.name="AlgoliaSearch"+e+"Error"}return o(n,r),n}var o=n(9);o(r,Error),e.exports={AlgoliaSearchError:r,UnparsableJSON:i("UnparsableJSON","Could not parse the incoming response as JSON, see err.more for details"),RequestTimeout:i("RequestTimeout","Request timedout before getting a response"),Network:i("Network","Network issue, see err.more for details"),JSONPScriptFail:i("JSONPScriptFail","<script> was loaded but did not call our provided callback"),JSONPScriptError:i("JSONPScriptError","<script> unable to load due to an `error` event on it"),Unknown:i("Unknown","Unknown error occured")}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t){var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString;e.exports=function(e,t,i){if("[object Function]"!==r.call(t))throw new TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var a=0;a<o;a++)t.call(i,e[a],a,e);else for(var s in e)n.call(e,s)&&t.call(i,e[s],s,e)}},function(e,t){e.exports=function(e,t){t(e,0)}},function(e,t,n){function r(e,t){this.indexName=t,this.as=e,this.typeAheadArgs=null,this.typeAheadValueOption=null,this.cache={}}var i=n(13);e.exports=r,r.prototype.clearCache=function(){this.cache={}},r.prototype.search=i("query"),r.prototype.similarSearch=i("similarQuery"),r.prototype.browse=function(e,t,r){var i,o,a=n(14),s=this;0===arguments.length||1===arguments.length&&"function"==typeof arguments[0]?(i=0,r=arguments[0],e=void 0):"number"==typeof arguments[0]?(i=arguments[0],"number"==typeof arguments[1]?o=arguments[1]:"function"==typeof arguments[1]&&(r=arguments[1],o=void 0),e=void 0,t=void 0):"object"==typeof arguments[0]?("function"==typeof arguments[1]&&(r=arguments[1]),t=arguments[0],e=void 0):"string"==typeof arguments[0]&&"function"==typeof arguments[1]&&(r=arguments[1],t=void 0),t=a({},t||{},{page:i,hitsPerPage:o,query:e});var u=this.as._getSearchParams(t,"");return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(s.indexName)+"/browse?"+u,hostType:"read",callback:r})},r.prototype.browseFrom=function(e,t){return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/browse?cursor="+encodeURIComponent(e),hostType:"read",callback:t})},r.prototype._search=function(e,t,n){return this.as._jsonRequest({cache:this.cache,method:"POST",url:t||"/1/indexes/"+encodeURIComponent(this.indexName)+"/query",body:{params:e},hostType:"read",fallback:{method:"GET",url:"/1/indexes/"+encodeURIComponent(this.indexName),body:{params:e}},callback:n})},r.prototype.getObject=function(e,t,n){var r=this;1!==arguments.length&&"function"!=typeof t||(n=t,t=void 0);var i="";if(void 0!==t){i="?attributes=";for(var o=0;o<t.length;++o)0!==o&&(i+=","),i+=t[o]}return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(r.indexName)+"/"+encodeURIComponent(e)+i,hostType:"read",callback:n})},r.prototype.getObjects=function(e,t,r){var i=n(15),o=n(16),a="Usage: index.getObjects(arrayOfObjectIDs[, callback])";if(!i(e))throw new Error(a);var s=this;1!==arguments.length&&"function"!=typeof t||(r=t,t=void 0);var u={requests:o(e,function(e){var n={indexName:s.indexName,objectID:e};return t&&(n.attributesToRetrieve=t.join(",")),n})};return this.as._jsonRequest({method:"POST",url:"/1/indexes/*/objects",hostType:"read",body:u,callback:r})},r.prototype.as=null,r.prototype.indexName=null,r.prototype.typeAheadArgs=null,r.prototype.typeAheadValueOption=null},function(e,t,n){function r(e,t){return function(n,r,o){if("function"==typeof n&&"object"==typeof r||"object"==typeof o)throw new i.AlgoliaSearchError("index.search usage is index.search(query, params, cb)");0===arguments.length||"function"==typeof n?(o=n,n=""):1!==arguments.length&&"function"!=typeof r||(o=r,r=void 0),"object"==typeof n&&null!==n?(r=n,n=void 0):void 0!==n&&null!==n||(n="");var a="";return void 0!==n&&(a+=e+"="+encodeURIComponent(n)),void 0!==r&&(a=this.as._getSearchParams(r,a)),this._search(a,t,o)}}e.exports=r;var i=n(8)},function(e,t,n){var r=n(10);e.exports=function e(t){var n=Array.prototype.slice.call(arguments);return r(n,function(n){for(var r in n)n.hasOwnProperty(r)&&("object"==typeof t[r]&&"object"==typeof n[r]?t[r]=e({},t[r],n[r]):void 0!==n[r]&&(t[r]=n[r]))}),t}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){var r=n(10);e.exports=function(e,t){var n=[];return r(e,function(r,i){n.push(t(r,i,e))}),n}},function(e,t,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function s(){var e;try{e=t.storage.debug}catch(e){}return e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=n(18),t.log=o,t.formatArgs=i,t.save=a,t.load=s,t.useColors=r,t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){return JSON.stringify(e)},t.enable(s())},function(e,t,n){function r(){return t.colors[l++%t.colors.length]}function i(e){function n(){}function i(){var e=i,n=+new Date,o=n-(c||n);e.diff=o,e.prev=c,e.curr=n,c=n,null==e.useColors&&(e.useColors=t.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(n,r){if("%%"===n)return n;s++;var i=t.formatters[r];if("function"==typeof i){var o=a[s];n=i.call(e,o),a.splice(s,1),s--}return n}),"function"==typeof t.formatArgs&&(a=t.formatArgs.apply(e,a));var u=i.log||t.log||console.log.bind(console);u.apply(e,a)}n.enabled=!1,i.enabled=!0;var o=t.enabled(e)?i:n;return o.namespace=e,o}function o(e){t.save(e);for(var n=(e||"").split(/[\s,]+/),r=n.length,i=0;i<r;i++)n[i]&&(e=n[i].replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))}function a(){t.enable("")}function s(e){var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=i,t.coerce=u,t.disable=a,t.enable=o,t.enabled=s,t.humanize=n(19),t.names=[],t.skips=[],t.formatters={};var c,l=0},function(e,t){function n(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*u;case"minutes":case"minute":case"mins":case"min":case"m":return n*s;case"seconds":case"second":case"secs":case"sec":case"s":return n*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function r(e){return e>=c?Math.round(e/c)+"d":e>=u?Math.round(e/u)+"h":e>=s?Math.round(e/s)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function i(e){return o(e,c,"day")||o(e,u,"hour")||o(e,s,"minute")||o(e,a,"second")||e+" ms"}function o(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var a=1e3,s=60*a,u=60*s,c=24*u,l=365.25*c;e.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t.long?i(e):r(e)}},function(e,t){e.exports=function(e){return JSON.parse(JSON.stringify(e))}},function(e,t,n){"use strict";var r=n(22),i=r.Promise||n(23).Promise;e.exports=function(e,t){function o(e,t,r){var i=n(20),s=n(32);return r=i(r||{}),void 0===r.protocol&&(r.protocol=s()),r._ua=r._ua||o.ua,new a(e,t,r)}function a(){e.apply(this,arguments)}var s=n(9),u=n(8),c=n(28),l=n(30),f=n(31);t=t||"",o.version=n(33),o.ua="Algolia for vanilla JavaScript "+t+o.version,o.initPlaces=f(o),r.__algolia={debug:n(17),algoliasearch:o};var p={hasXMLHttpRequest:"XMLHttpRequest"in r,hasXDomainRequest:"XDomainRequest"in r};return p.hasXMLHttpRequest&&(p.cors="withCredentials"in new XMLHttpRequest,p.timeout="timeout"in new XMLHttpRequest),s(a,e),a.prototype._request=function(e,t){return new i(function(n,r){function i(){if(!l){p.timeout||clearTimeout(s);var e;try{e={body:JSON.parse(d.responseText),responseText:d.responseText,statusCode:d.status,headers:d.getAllResponseHeaders&&d.getAllResponseHeaders()||{}}}catch(t){e=new u.UnparsableJSON({more:d.responseText})}e instanceof u.UnparsableJSON?r(e):n(e)}}function o(e){l||(p.timeout||clearTimeout(s),r(new u.Network({more:e})))}function a(){p.timeout||(l=!0,d.abort()),r(new u.RequestTimeout)}if(!p.cors&&!p.hasXDomainRequest)return void r(new u.Network("CORS not supported"));e=c(e,t.headers);var s,l,f=t.body,d=p.cors?new XMLHttpRequest:new XDomainRequest;d instanceof XMLHttpRequest?d.open(t.method,e,!0):d.open(t.method,e),p.cors&&(f&&("POST"===t.method?d.setRequestHeader("content-type","application/x-www-form-urlencoded"):d.setRequestHeader("content-type","application/json")),d.setRequestHeader("accept","application/json")),d.onprogress=function(){},d.onload=i,d.onerror=o,p.timeout?(d.timeout=t.timeout,d.ontimeout=a):s=setTimeout(a,t.timeout),d.send(f)})},a.prototype._request.fallback=function(e,t){return e=c(e,t.headers),new i(function(n,r){l(e,t,function(e,t){return e?void r(e):void n(t)})})},a.prototype._promise={reject:function(e){return i.reject(e)},resolve:function(e){return i.resolve(e)},delay:function(e){return new i(function(t){setTimeout(t,e)})}},o}},function(e,t){(function(t){"undefined"!=typeof window?e.exports=window:"undefined"!=typeof t?e.exports=t:"undefined"!=typeof self?e.exports=self:e.exports={}}).call(t,function(){return this}())},function(e,t,n){var r;(function(e,i,o){(function(){"use strict";function a(e){return"function"==typeof e||"object"==typeof e&&null!==e}function s(e){return"function"==typeof e}function u(e){G=e}function c(e){ee=e}function l(){return function(){e.nextTick(m)}}function f(){return function(){J(m)}}function p(){var e=0,t=new re(m),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function d(){var e=new MessageChannel;return e.port1.onmessage=m,function(){e.port2.postMessage(0)}}function h(){return function(){setTimeout(m,1)}}function m(){for(var e=0;e<Z;e+=2){var t=ae[e],n=ae[e+1];t(n),ae[e]=void 0,ae[e+1]=void 0}Z=0}function v(){try{var e=n(26);return J=e.runOnLoop||e.runOnContext,f()}catch(e){return h()}}function g(e,t){var n=this,r=new this.constructor(b);void 0===r[ce]&&U(r);var i=n._state;if(i){var o=arguments[i-1];ee(function(){M(i,r,o,n._result)})}else k(n,r,e,t);return r}function y(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(b);return O(n,e),n}function b(){}function _(){return new TypeError("You cannot resolve a promise with itself")}function w(){return new TypeError("A promises callback cannot return that same promise.")}function x(e){try{return e.then}catch(e){return de.error=e,de}}function R(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}function j(e,t,n){ee(function(e){var r=!1,i=R(n,t,function(n){r||(r=!0,t!==n?O(e,n):E(e,n))},function(t){r||(r=!0,F(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&i&&(r=!0,F(e,i))},e)}function P(e,t){t._state===fe?E(e,t._result):t._state===pe?F(e,t._result):k(t,void 0,function(t){O(e,t)},function(t){F(e,t)})}function C(e,t,n){t.constructor===e.constructor&&n===se&&constructor.resolve===ue?P(e,t):n===de?F(e,de.error):void 0===n?E(e,t):s(n)?j(e,t,n):E(e,t)}function O(e,t){e===t?F(e,_()):a(t)?C(e,t,x(t)):E(e,t)}function S(e){e._onerror&&e._onerror(e._result),N(e)}function E(e,t){e._state===le&&(e._result=t,e._state=fe,0!==e._subscribers.length&&ee(N,e))}function F(e,t){e._state===le&&(e._state=pe,e._result=t,ee(S,e))}function k(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+fe]=n,i[o+pe]=r,0===o&&e._state&&ee(N,e)}function N(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i,o=e._result,a=0;a<t.length;a+=3)r=t[a],i=t[a+n],r?M(n,r,i,o):i(o);e._subscribers.length=0}}function T(){this.error=null}function A(e,t){try{return e(t)}catch(e){return he.error=e,he}}function M(e,t,n,r){var i,o,a,u,c=s(n);if(c){if(i=A(n,r),i===he?(u=!0,o=i.error,i=null):a=!0,t===i)return void F(t,w())}else i=r,a=!0;t._state!==le||(c&&a?O(t,i):u?F(t,o):e===fe?E(t,i):e===pe&&F(t,i))}function H(e,t){try{t(function(t){O(e,t)},function(t){F(e,t)})}catch(t){F(e,t)}}function L(){return me++}function U(e){e[ce]=me++,e._state=void 0,e._result=void 0,e._subscribers=[]}function D(e){return new _e(this,e).promise}function I(e){var t=this;return new t(Y(e)?function(n,r){for(var i=e.length,o=0;o<i;o++)t.resolve(e[o]).then(n,r)}:function(e,t){t(new TypeError("You must pass an array to race."))})}function V(e){var t=this,n=new t(b);return F(n,e),n}function q(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function Q(e){this[ce]=L(),this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&q(),this instanceof Q?H(this,e):B())}function z(e,t){this._instanceConstructor=e,this.promise=new e(b),this.promise[ce]||U(this.promise),Y(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?E(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&E(this.promise,this._result))):F(this.promise,W())}function W(){return new Error("Array Methods must be provided an Array")}function K(){var e;if("undefined"!=typeof i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;t&&"[object Promise]"===Object.prototype.toString.call(t.resolve())&&!t.cast||(e.Promise=be)}var $;$=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var J,G,X,Y=$,Z=0,ee=function(e,t){ae[Z]=e,ae[Z+1]=t,Z+=2,2===Z&&(G?G(m):X())},te="undefined"!=typeof window?window:void 0,ne=te||{},re=ne.MutationObserver||ne.WebKitMutationObserver,ie="undefined"==typeof self&&"undefined"!=typeof e&&"[object process]"==={}.toString.call(e),oe="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,ae=new Array(1e3);X=ie?l():re?p():oe?d():void 0===te?v():h();var se=g,ue=y,ce=Math.random().toString(36).substring(16),le=void 0,fe=1,pe=2,de=new T,he=new T,me=0,ve=D,ge=I,ye=V,be=Q;Q.all=ve,Q.race=ge,Q.resolve=ue,Q.reject=ye,Q._setScheduler=u,Q._setAsap=c,Q._asap=ee,Q.prototype={constructor:Q,then:se,catch:function(e){return this.then(null,e)}};var _e=z;z.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===le&&n<e;n++)this._eachEntry(t[n],n)},z.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===ue){var i=x(e);if(i===se&&e._state!==le)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===be){var o=new n(b);C(o,e,i),this._willSettleAt(o,t)}else this._willSettleAt(new n(function(t){t(e)}),t)}else this._willSettleAt(r(e),t)},z.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===le&&(this._remaining--,e===pe?F(r,n):this._result[t]=n),0===this._remaining&&E(r,this._result)},z.prototype._willSettleAt=function(e,t){var n=this;k(e,void 0,function(e){n._settledAt(fe,t,e)},function(e){n._settledAt(pe,t,e)})};var we=K,xe={Promise:be,polyfill:we};n(27).amd?(r=function(){return xe}.call(t,n,t,o),!(void 0!==r&&(o.exports=r))):"undefined"!=typeof o&&o.exports?o.exports=xe:"undefined"!=typeof this&&(this.ES6Promise=xe),we()}).call(this)}).call(t,n(24),function(){return this}(),n(25)(e))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function o(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){m&&d&&(m=!1,d.length?h=d.concat(h):v=-1,h.length&&s())}function s(){if(!m){var e=i(a);m=!0;for(var t=h.length;t;){for(d=h,h=[];++v<t;)d&&d[v].run();v=-1,t=h.length}d=null,m=!1,o(e)}}function u(e,t){this.fun=e,this.array=t}function c(){}var l,f,p=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(e){f=r}}();
var d,h=[],m=!1,v=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new u(e,t)),1!==h.length||m||i(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t){},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t,n){"use strict";function r(e,t){return e+=/\?/.test(e)?"&":"?",e+i(t)}e.exports=r;var i=n(29)},function(e,t){"use strict";function n(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,a,s){return t=t||"&",a=a||"=",null===e&&(e=void 0),"object"==typeof e?n(o(e),function(o){var s=encodeURIComponent(r(o))+a;return i(e[o])?n(e[o],function(e){return s+encodeURIComponent(r(e))}).join(t):s+encodeURIComponent(r(e[o]))}).join(t):s?encodeURIComponent(r(s))+a+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(e,t,n){"use strict";function r(e,t,n){function r(){t.debug("JSONP: success"),v||p||(v=!0,f||(t.debug("JSONP: Fail. Script loaded but did not call the callback"),s(),n(new i.JSONPScriptFail)))}function a(){"loaded"!==this.readyState&&"complete"!==this.readyState||r()}function s(){clearTimeout(g),h.onload=null,h.onreadystatechange=null,h.onerror=null,d.removeChild(h)}function u(){try{delete window[m],delete window[m+"_loaded"]}catch(e){window[m]=window[m+"_loaded"]=void 0}}function c(){t.debug("JSONP: Script timeout"),p=!0,s(),n(new i.RequestTimeout)}function l(){t.debug("JSONP: Script error"),v||p||(s(),n(new i.JSONPScriptError))}if("GET"!==t.method)return void n(new Error("Method "+t.method+" "+e+" is not supported by JSONP."));t.debug("JSONP: start");var f=!1,p=!1;o+=1;var d=document.getElementsByTagName("head")[0],h=document.createElement("script"),m="algoliaJSONP_"+o,v=!1;window[m]=function(e){return u(),p?void t.debug("JSONP: Late answer, ignoring"):(f=!0,s(),void n(null,{body:e}))},e+="&callback="+m,t.jsonBody&&t.jsonBody.params&&(e+="&"+t.jsonBody.params);var g=setTimeout(c,t.timeout);h.onreadystatechange=a,h.onload=r,h.onerror=l,h.async=!0,h.defer=!0,h.src=e,d.appendChild(h)}e.exports=r;var i=n(8),o=0},function(e,t,n){function r(e){return function(t,r,o){var a=n(20);o=o&&a(o)||{},o.hosts=o.hosts||["places-dsn.algolia.net","places-1.algolianet.com","places-2.algolianet.com","places-3.algolianet.com"],0!==arguments.length&&"object"!=typeof t&&void 0!==t||(t="",r="",o._allowEmptyCredentials=!0);var s=e(t,r,o),u=s.initIndex("places");return u.search=i("query","/1/places/query"),u}}e.exports=r;var i=n(13)},function(e,t){"use strict";function n(){var e=window.document.location.protocol;return"http:"!==e&&"https:"!==e&&(e="http:"),e}e.exports=n},function(e,t){"use strict";e.exports="3.18.0"},function(e,t,n){"use strict";function r(e,t,n){return new i(e,t,n)}var i=n(35),o=n(36),a=n(242);r.version=n(314),r.AlgoliaSearchHelper=i,r.SearchParameters=o,r.SearchResults=a,r.url=n(302),e.exports=r},function(e,t,n){"use strict";function r(e,t,n){this.client=e;var r=n||{};r.index=t,this.state=a.make(r),this.lastResults=null,this._queryId=0,this._lastQueryIdReceived=-1}function i(e){if(e<0)throw new Error("Page requested below 0.");return this.state=this.state.setPage(e),this._change(),this}function o(){return this.state.page}var a=n(36),s=n(242),u=n(296),c=n(297),l=n(300),f=n(155),p=n(301),d=n(189),h=n(302);c.inherits(r,l.EventEmitter),r.prototype.search=function(){return this._search(),this},r.prototype.searchOnce=function(e,t){var n=e?this.state.setQueryParameters(e):this.state,r=u._getQueries(n.index,n);return t?this.client.search(r,function(e,r){t(e,new s(n,r),n)}):this.client.search(r).then(function(e){return{content:new s(n,e),state:n,_originalResponse:e}})},r.prototype.setQuery=function(e){return this.state=this.state.setPage(0).setQuery(e),this._change(),this},r.prototype.clearRefinements=function(e){return this.state=this.state.setPage(0).clearRefinements(e),this._change(),this},r.prototype.clearTags=function(){return this.state=this.state.setPage(0).clearTags(),this._change(),this},r.prototype.addDisjunctiveFacetRefinement=function(e,t){return this.state=this.state.setPage(0).addDisjunctiveFacetRefinement(e,t),this._change(),this},r.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},r.prototype.addHierarchicalFacetRefinement=function(e,t){return this.state=this.state.setPage(0).addHierarchicalFacetRefinement(e,t),this._change(),this},r.prototype.addNumericRefinement=function(e,t,n){return this.state=this.state.setPage(0).addNumericRefinement(e,t,n),this._change(),this},r.prototype.addFacetRefinement=function(e,t){return this.state=this.state.setPage(0).addFacetRefinement(e,t),this._change(),this},r.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},r.prototype.addFacetExclusion=function(e,t){return this.state=this.state.setPage(0).addExcludeRefinement(e,t),this._change(),this},r.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},r.prototype.addTag=function(e){return this.state=this.state.setPage(0).addTagRefinement(e),this._change(),this},r.prototype.removeNumericRefinement=function(e,t,n){return this.state=this.state.setPage(0).removeNumericRefinement(e,t,n),this._change(),this},r.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this.state=this.state.setPage(0).removeDisjunctiveFacetRefinement(e,t),this._change(),this},r.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},r.prototype.removeHierarchicalFacetRefinement=function(e){return this.state=this.state.setPage(0).removeHierarchicalFacetRefinement(e),this._change(),this},r.prototype.removeFacetRefinement=function(e,t){return this.state=this.state.setPage(0).removeFacetRefinement(e,t),this._change(),this},r.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},r.prototype.removeFacetExclusion=function(e,t){return this.state=this.state.setPage(0).removeExcludeRefinement(e,t),this._change(),this},r.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},r.prototype.removeTag=function(e){return this.state=this.state.setPage(0).removeTagRefinement(e),this._change(),this},r.prototype.toggleFacetExclusion=function(e,t){return this.state=this.state.setPage(0).toggleExcludeFacetRefinement(e,t),this._change(),this},r.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},r.prototype.toggleRefinement=function(e,t){return this.state=this.state.setPage(0).toggleRefinement(e,t),this._change(),this},r.prototype.toggleRefine=function(){return this.toggleRefinement.apply(this,arguments)},r.prototype.toggleTag=function(e){return this.state=this.state.setPage(0).toggleTagRefinement(e),this._change(),this},r.prototype.nextPage=function(){return this.setPage(this.state.page+1)},r.prototype.previousPage=function(){return this.setPage(this.state.page-1)},r.prototype.setCurrentPage=i,r.prototype.setPage=i,r.prototype.setIndex=function(e){return this.state=this.state.setPage(0).setIndex(e),this._change(),this},r.prototype.setQueryParameter=function(e,t){var n=this.state.setPage(0).setQueryParameter(e,t);return this.state===n?this:(this.state=n,this._change(),this)},r.prototype.setState=function(e){return this.state=new a(e),this._change(),this},r.prototype.getState=function(e){return void 0===e?this.state:this.state.filter(e)},r.prototype.getStateAsQueryString=function(e){var t=e&&e.filters||["query","attribute:*"],n=this.getState(t);return h.getQueryStringFromState(n,e)},r.getConfigurationFromQueryString=h.getStateFromQueryString,r.getForeignConfigurationInQueryString=h.getUnrecognizedParametersInQueryString,r.prototype.setStateFromQueryString=function(e,t){var n=t&&t.triggerChange||!1,r=h.getStateFromQueryString(e,t),i=this.state.setQueryParameters(r);n?this.setState(i):this.overrideStateWithoutTriggeringChangeEvent(i)},r.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new a(e),this},r.prototype.isRefined=function(e,t){if(this.state.isConjunctiveFacet(e))return this.state.isFacetRefined(e,t);if(this.state.isDisjunctiveFacet(e))return this.state.isDisjunctiveFacetRefined(e,t);throw new Error(e+" is not properly defined in this helper configuration(use the facets or disjunctiveFacets keys to configure it)")},r.prototype.hasRefinements=function(e){return!d(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},r.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},r.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},r.prototype.hasTag=function(e){return this.state.isTagRefined(e)},r.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},r.prototype.getIndex=function(){return this.state.index},r.prototype.getCurrentPage=o,r.prototype.getPage=o,r.prototype.getTags=function(){return this.state.tagRefinements},r.prototype.getQueryParameter=function(e){return this.state.getQueryParameter(e)},r.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e)){var n=this.state.getConjunctiveRefinements(e);f(n,function(e){t.push({value:e,type:"conjunctive"})});var r=this.state.getExcludeRefinements(e);f(r,function(e){t.push({value:e,type:"exclude"})})}else if(this.state.isDisjunctiveFacet(e)){var i=this.state.getDisjunctiveRefinements(e);f(i,function(e){t.push({value:e,type:"disjunctive"})})}var o=this.state.getNumericRefinements(e);return f(o,function(e,n){t.push({value:e,operator:n,type:"numeric"})}),t},r.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},r.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},r.prototype._search=function(){var e=this.state,t=u._getQueries(e.index,e);this.emit("search",e,this.lastResults),this.client.search(t,p(this._handleResponse,this,e,this._queryId++))},r.prototype._handleResponse=function(e,t,n,r){if(!(t<this._lastQueryIdReceived)){if(this._lastQueryIdReceived=t,n)return void this.emit("error",n);var i=this.lastResults=new s(e,r);this.emit("result",i,e)}},r.prototype.containsRefinement=function(e,t,n,r){return e||0!==t.length||0!==n.length||0!==r.length},r.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},r.prototype._change=function(){this.emit("change",this.state,this.lastResults)},r.prototype.clearCache=function(){this.client.clearCache()},e.exports=r},function(e,t,n){"use strict";function r(e,t){return w(e,function(e){return g(e,t)})}function i(e){var t=e?i._parseNumbers(e):{};this.index=t.index||"",this.query=t.query||"",this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{},this.numericFilters=t.numericFilters,this.tagFilters=t.tagFilters,this.optionalTagFilters=t.optionalTagFilters,this.optionalFacetFilters=t.optionalFacetFilters,this.hitsPerPage=t.hitsPerPage,this.maxValuesPerFacet=t.maxValuesPerFacet,this.page=t.page||0,this.queryType=t.queryType,this.typoTolerance=t.typoTolerance,this.minWordSizefor1Typo=t.minWordSizefor1Typo,this.minWordSizefor2Typos=t.minWordSizefor2Typos,this.minProximity=t.minProximity,this.allowTyposOnNumericTokens=t.allowTyposOnNumericTokens,this.ignorePlurals=t.ignorePlurals,this.restrictSearchableAttributes=t.restrictSearchableAttributes,this.advancedSyntax=t.advancedSyntax,this.analytics=t.analytics,this.analyticsTags=t.analyticsTags,this.synonyms=t.synonyms,this.replaceSynonymsInHighlight=t.replaceSynonymsInHighlight,this.optionalWords=t.optionalWords,this.removeWordsIfNoResults=t.removeWordsIfNoResults,this.attributesToRetrieve=t.attributesToRetrieve,this.attributesToHighlight=t.attributesToHighlight,this.highlightPreTag=t.highlightPreTag,this.highlightPostTag=t.highlightPostTag,this.attributesToSnippet=t.attributesToSnippet,this.getRankingInfo=t.getRankingInfo,this.distinct=t.distinct,this.aroundLatLng=t.aroundLatLng,this.aroundLatLngViaIP=t.aroundLatLngViaIP,this.aroundRadius=t.aroundRadius,this.minimumAroundRadius=t.minimumAroundRadius,this.aroundPrecision=t.aroundPrecision,this.insideBoundingBox=t.insideBoundingBox,this.insidePolygon=t.insidePolygon,this.snippetEllipsisText=t.snippetEllipsisText,this.disableExactOnAttributes=t.disableExactOnAttributes,this.enableExactOnSingleWordQuery=t.enableExactOnSingleWordQuery,this.offset=t.offset,this.length=t.length;var n=this;s(t,function(e,t){i.PARAMETERS.indexOf(t)===-1&&(n[t]=e)})}var o=n(37),a=n(53),s=n(102),u=n(155),c=n(159),l=n(162),f=n(164),p=n(167),d=n(183),h=n(187),m=n(47),v=n(189),g=n(192),y=n(193),b=n(194),_=n(43),w=n(195),x=n(198),R=n(207),j=n(214),P=n(239),C=n(240),O=n(241);i.PARAMETERS=o(new i),i._parseNumbers=function(e){if(e instanceof i)return e;var t={},n=["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"];if(u(n,function(n){var r=e[n];if(b(r)){var i=parseFloat(r);t[n]=h(i)?r:i}}),e.numericRefinements){var r={};u(e.numericRefinements,function(e,t){r[t]={},u(e,function(e,n){var i=l(e,function(e){return m(e)?l(e,function(e){return b(e)?parseFloat(e):e}):b(e)?parseFloat(e):e});r[t][n]=i})}),t.numericRefinements=r}return j({},e,t)},i.make=function(e){var t=new i(e);return u(e.hierarchicalFacets,function(e){if(e.rootPath){var n=t.getHierarchicalRefinement(e.name);n.length>0&&0!==n[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),n=t.getHierarchicalRefinement(e.name),0===n.length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}}),t},i.validate=function(e,t){var n=t||{};return e.tagFilters&&n.tagRefinements&&n.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&n.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&n.numericRefinements&&!v(n.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):!v(e.numericRefinements)&&n.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},i.prototype={constructor:i,clearRefinements:function(e){var t=O.clearRefinement;return this.setQueryParameters({numericRefinements:this._clearNumericRefinements(e),facetsRefinements:t(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:t(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:t(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:t(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")})},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,n){var r=P(n);if(this.isNumericRefined(e,t,r))return this;var i=j({},this.numericRefinements);return i[e]=j({},i[e]),i[e][t]?(i[e][t]=i[e][t].slice(),i[e][t].push(r)):i[e][t]=[r],this.setQueryParameters({numericRefinements:i})},getConjunctiveRefinements:function(e){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.disjunctiveFacetsRefinements[e]||[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t,n){if(void 0!==n){var r=P(n);return this.isNumericRefined(e,t,r)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(n,i){return i===e&&n.op===t&&g(n.val,r)})}):this}return void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(n,r){return r===e&&n.op===t})}):this:this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(t,n){return n===e})}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){return y(e)?{}:b(e)?p(this.numericRefinements,e):_(e)?f(this.numericRefinements,function(t,n,r){var i={};return u(n,function(t,n){var o=[];u(t,function(t){var i=e({val:t,op:n},r,"numeric");i||o.push(t)}),v(o)||(i[n]=o)}),v(i)||(t[r]=i),t},{}):void 0},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return O.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:O.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return O.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:O.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return O.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:O.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:c(this.facets,function(t){return t!==e})}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:c(this.disjunctiveFacets,function(t){return t!==e})}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:c(this.hierarchicalFacets,function(t){return t.name!==e})}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return O.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:O.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return O.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:O.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return O.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:O.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:c(this.tagRefinements,function(t){return t!==e})};return this.setQueryParameters(t)},toggleRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:O.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:O.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:O.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var n=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),r={},i=void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+n));return i?t.indexOf(n)===-1?r[e]=[]:r[e]=[t.slice(0,t.lastIndexOf(n))]:r[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:R({},r,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw new Error(e+" is already refined.");var n={};return n[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:R({},n,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))throw new Error(e+" is not refined.");var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:R({},t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return d(this.disjunctiveFacets,e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return d(this.facets,e)>-1},isFacetRefined:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return O.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return O.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return O.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var n=this.getHierarchicalRefinement(e);return t?d(n,t)!==-1:n.length>0},isNumericRefined:function(e,t,n){if(y(n)&&y(t))return!!this.numericRefinements[e];var i=this.numericRefinements[e]&&!y(this.numericRefinements[e][t]);if(y(n)||!i)return i;var o=P(n),a=!y(r(this.numericRefinements[e][t],o));return i&&a},isTagRefined:function(e){return d(this.tagRefinements,e)!==-1},getRefinedDisjunctiveFacets:function(){var e=a(o(this.numericRefinements),this.disjunctiveFacets);return o(this.disjunctiveFacetsRefinements).concat(e).concat(this.getRefinedHierarchicalFacets())},getRefinedHierarchicalFacets:function(){return a(l(this.hierarchicalFacets,"name"),o(this.hierarchicalFacetsRefinements))},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return c(this.disjunctiveFacets,function(t){return d(e,t)===-1})},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacets","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={};return s(this,function(n,r){d(e,r)===-1&&void 0!==n&&(t[r]=n)}),t},getQueryParameter:function(e){if(!this.hasOwnProperty(e))throw new Error("Parameter '"+e+"' is not an attribute of SearchParameters (http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html)");return this[e]},setQueryParameter:function(e,t){if(this[e]===t)return this;var n={};return n[e]=t,this.setQueryParameters(n)},setQueryParameters:function(e){if(!e)return this;var t=i.validate(this,e);if(t)throw t;var n=i._parseNumbers(e);return this.mutateMe(function(t){var r=o(e);return u(r,function(e){t[e]=n[e]}),t})},filter:function(e){return C(this,e)},mutateMe:function(e){var t=new this.constructor(this);return e(t,this),t},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"!=typeof e.showParentLevel||e.showParentLevel},getHierarchicalFacetByName:function(e){return w(this.hierarchicalFacets,{name:e})},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))throw new Error("Cannot get the breadcrumb of an unknown hierarchical facet: `"+e+"`");var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var n=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),r=t.split(n);return l(r,x)}},e.exports=i},function(e,t,n){function r(e){return a(e)?i(e):o(e)}var i=n(38),o=n(49),a=n(42);e.exports=r},function(e,t,n){function r(e,t){var n=a(e)||o(e)?i(e.length,String):[],r=n.length,u=!!r;for(var l in e)!t&&!c.call(e,l)||u&&("length"==l||s(l,r))||n.push(l);return n}var i=n(39),o=n(40),a=n(47),s=n(48),u=Object.prototype,c=u.hasOwnProperty;e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}e.exports=n},function(e,t,n){function r(e){return i(e)&&s.call(e,"callee")&&(!c.call(e,"callee")||u.call(e)==o)}var i=n(41),o="[object Arguments]",a=Object.prototype,s=a.hasOwnProperty,u=a.toString,c=a.propertyIsEnumerable;e.exports=r},function(e,t,n){function r(e){return o(e)&&i(e)}var i=n(42),o=n(46);e.exports=r},function(e,t,n){function r(e){return null!=e&&o(e.length)&&!i(e)}var i=n(43),o=n(45);e.exports=r},function(e,t,n){function r(e){var t=i(e)?u.call(e):"";return t==o||t==a}var i=n(44),o="[object Function]",a="[object GeneratorFunction]",s=Object.prototype,u=s.toString;e.exports=r},function(e,t){function n(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=n},function(e,t){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}var r=9007199254740991;e.exports=n},function(e,t){function n(e){return!!e&&"object"==typeof e}e.exports=n},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){function n(e,t){return t=null==t?r:t,!!t&&("number"==typeof e||i.test(e))&&e>-1&&e%1==0&&e<t}var r=9007199254740991,i=/^(?:0|[1-9]\d*)$/;e.exports=n},function(e,t,n){function r(e){if(!i(e))return o(e);var t=[];for(var n in Object(e))s.call(e,n)&&"constructor"!=n&&t.push(n);return t}var i=n(50),o=n(51),a=Object.prototype,s=a.hasOwnProperty;e.exports=r},function(e,t){function n(e){var t=e&&e.constructor,n="function"==typeof t&&t.prototype||r;return e===n}var r=Object.prototype;e.exports=n},function(e,t,n){var r=n(52),i=r(Object.keys,Object);e.exports=i},function(e,t){function n(e,t){return function(n){return e(t(n))}}e.exports=n},function(e,t,n){var r=n(54),i=n(55),o=n(99),a=n(101),s=o(function(e){var t=r(e,a);return t.length&&t[0]===e[0]?i(t):[]});e.exports=s},function(e,t){function n(e,t){for(var n=-1,r=e?e.length:0,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}e.exports=n},function(e,t,n){function r(e,t,n){for(var r=n?a:o,f=e[0].length,p=e.length,d=p,h=Array(p),m=1/0,v=[];d--;){var g=e[d];d&&t&&(g=s(g,u(t))),m=l(g.length,m),h[d]=!n&&(t||f>=120&&g.length>=120)?new i(d&&g):void 0}g=e[0];var y=-1,b=h[0];e:for(;++y<f&&v.length<m;){var _=g[y],w=t?t(_):_;if(_=n||0!==_?_:0,!(b?c(b,w):r(v,w,n))){for(d=p;--d;){var x=h[d];if(!(x?c(x,w):r(e[d],w,n)))continue e}b&&b.push(w),v.push(_)}}return v}var i=n(56),o=n(92),a=n(96),s=n(54),u=n(97),c=n(98),l=Math.min;e.exports=r},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.__data__=new i;++t<n;)this.add(e[t])}var i=n(57),o=n(90),a=n(91);r.prototype.add=r.prototype.push=o,r.prototype.has=a,e.exports=r},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var i=n(58),o=n(84),a=n(87),s=n(88),u=n(89);r.prototype.clear=i,r.prototype.delete=o,r.prototype.get=a,r.prototype.has=s,r.prototype.set=u,e.exports=r},function(e,t,n){function r(){this.__data__={hash:new i,map:new(a||o),string:new i}}var i=n(59),o=n(75),a=n(83);
e.exports=r},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var i=n(60),o=n(71),a=n(72),s=n(73),u=n(74);r.prototype.clear=i,r.prototype.delete=o,r.prototype.get=a,r.prototype.has=s,r.prototype.set=u,e.exports=r},function(e,t,n){function r(){this.__data__=i?i(null):{}}var i=n(61);e.exports=r},function(e,t,n){var r=n(62),i=r(Object,"create");e.exports=i},function(e,t,n){function r(e,t){var n=o(e,t);return i(n)?n:void 0}var i=n(63),o=n(70);e.exports=r},function(e,t,n){function r(e){if(!s(e)||a(e))return!1;var t=i(e)||o(e)?m:l;return t.test(u(e))}var i=n(43),o=n(64),a=n(65),s=n(44),u=n(69),c=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,f=Function.prototype,p=Object.prototype,d=f.toString,h=p.hasOwnProperty,m=RegExp("^"+d.call(h).replace(c,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},function(e,t){function n(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}e.exports=n},function(e,t,n){function r(e){return!!o&&o in e}var i=n(66),o=function(){var e=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();e.exports=r},function(e,t,n){var r=n(67),i=r["__core-js_shared__"];e.exports=i},function(e,t,n){var r=n(68),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},function(e,t){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(t,function(){return this}())},function(e,t){function n(e){if(null!=e){try{return i.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var r=Function.prototype,i=r.toString;e.exports=n},function(e,t){function n(e,t){return null==e?void 0:e[t]}e.exports=n},function(e,t){function n(e){return this.has(e)&&delete this.__data__[e]}e.exports=n},function(e,t,n){function r(e){var t=this.__data__;if(i){var n=t[e];return n===o?void 0:n}return s.call(t,e)?t[e]:void 0}var i=n(61),o="__lodash_hash_undefined__",a=Object.prototype,s=a.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){var t=this.__data__;return i?void 0!==t[e]:a.call(t,e)}var i=n(61),o=Object.prototype,a=o.hasOwnProperty;e.exports=r},function(e,t,n){function r(e,t){var n=this.__data__;return n[e]=i&&void 0===t?o:t,this}var i=n(61),o="__lodash_hash_undefined__";e.exports=r},function(e,t,n){function r(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}var i=n(76),o=n(77),a=n(80),s=n(81),u=n(82);r.prototype.clear=i,r.prototype.delete=o,r.prototype.get=a,r.prototype.has=s,r.prototype.set=u,e.exports=r},function(e,t){function n(){this.__data__=[]}e.exports=n},function(e,t,n){function r(e){var t=this.__data__,n=i(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():a.call(t,n,1),!0}var i=n(78),o=Array.prototype,a=o.splice;e.exports=r},function(e,t,n){function r(e,t){for(var n=e.length;n--;)if(i(e[n][0],t))return n;return-1}var i=n(79);e.exports=r},function(e,t){function n(e,t){return e===t||e!==e&&t!==t}e.exports=n},function(e,t,n){function r(e){var t=this.__data__,n=i(t,e);return n<0?void 0:t[n][1]}var i=n(78);e.exports=r},function(e,t,n){function r(e){return i(this.__data__,e)>-1}var i=n(78);e.exports=r},function(e,t,n){function r(e,t){var n=this.__data__,r=i(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}var i=n(78);e.exports=r},function(e,t,n){var r=n(62),i=n(67),o=r(i,"Map");e.exports=o},function(e,t,n){function r(e){return i(this,e).delete(e)}var i=n(85);e.exports=r},function(e,t,n){function r(e,t){var n=e.__data__;return i(t)?n["string"==typeof t?"string":"hash"]:n.map}var i=n(86);e.exports=r},function(e,t){function n(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=n},function(e,t,n){function r(e){return i(this,e).get(e)}var i=n(85);e.exports=r},function(e,t,n){function r(e){return i(this,e).has(e)}var i=n(85);e.exports=r},function(e,t,n){function r(e,t){return i(this,e).set(e,t),this}var i=n(85);e.exports=r},function(e,t){function n(e){return this.__data__.set(e,r),this}var r="__lodash_hash_undefined__";e.exports=n},function(e,t){function n(e){return this.__data__.has(e)}e.exports=n},function(e,t,n){function r(e,t){var n=e?e.length:0;return!!n&&i(e,t,0)>-1}var i=n(93);e.exports=r},function(e,t,n){function r(e,t,n){if(t!==t)return i(e,o,n);for(var r=n-1,a=e.length;++r<a;)if(e[r]===t)return r;return-1}var i=n(94),o=n(95);e.exports=r},function(e,t){function n(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}e.exports=n},function(e,t){function n(e){return e!==e}e.exports=n},function(e,t){function n(e,t,n){for(var r=-1,i=e?e.length:0;++r<i;)if(n(t,e[r]))return!0;return!1}e.exports=n},function(e,t){function n(e){return function(t){return e(t)}}e.exports=n},function(e,t){function n(e,t){return e.has(t)}e.exports=n},function(e,t,n){function r(e,t){return t=o(void 0===t?e.length-1:t,0),function(){for(var n=arguments,r=-1,a=o(n.length-t,0),s=Array(a);++r<a;)s[r]=n[t+r];r=-1;for(var u=Array(t+1);++r<t;)u[r]=n[r];return u[t]=s,i(e,this,u)}}var i=n(100),o=Math.max;e.exports=r},function(e,t){function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}e.exports=n},function(e,t,n){function r(e){return i(e)?e:[]}var i=n(41);e.exports=r},function(e,t,n){function r(e,t){return e&&i(e,o(t,3))}var i=n(103),o=n(106);e.exports=r},function(e,t,n){function r(e,t){return e&&i(e,t,o)}var i=n(104),o=n(37);e.exports=r},function(e,t,n){var r=n(105),i=r();e.exports=i},function(e,t){function n(e){return function(t,n,r){for(var i=-1,o=Object(t),a=r(t),s=a.length;s--;){var u=a[e?s:++i];if(n(o[u],u,o)===!1)break}return t}}e.exports=n},function(e,t,n){function r(e){return"function"==typeof e?e:null==e?a:"object"==typeof e?s(e)?o(e[0],e[1]):i(e):u(e)}var i=n(107),o=n(137),a=n(151),s=n(47),u=n(152);e.exports=r},function(e,t,n){function r(e){var t=o(e);return 1==t.length&&t[0][2]?a(t[0][0],t[0][1]):function(n){return n===e||i(n,e,t)}}var i=n(108),o=n(134),a=n(136);e.exports=r},function(e,t,n){function r(e,t,n,r){var u=n.length,c=u,l=!r;if(null==e)return!c;for(e=Object(e);u--;){var f=n[u];if(l&&f[2]?f[1]!==e[f[0]]:!(f[0]in e))return!1}for(;++u<c;){f=n[u];var p=f[0],d=e[p],h=f[1];if(l&&f[2]){if(void 0===d&&!(p in e))return!1}else{var m=new i;if(r)var v=r(d,h,p,e,t,m);if(!(void 0===v?o(h,d,r,a|s,m):v))return!1}}return!0}var i=n(109),o=n(115),a=1,s=2;e.exports=r},function(e,t,n){function r(e){this.__data__=new i(e)}var i=n(75),o=n(110),a=n(111),s=n(112),u=n(113),c=n(114);r.prototype.clear=o,r.prototype.delete=a,r.prototype.get=s,r.prototype.has=u,r.prototype.set=c,e.exports=r},function(e,t,n){function r(){this.__data__=new i}var i=n(75);e.exports=r},function(e,t){function n(e){return this.__data__.delete(e)}e.exports=n},function(e,t){function n(e){return this.__data__.get(e)}e.exports=n},function(e,t){function n(e){return this.__data__.has(e)}e.exports=n},function(e,t,n){function r(e,t){var n=this.__data__;if(n instanceof i){var r=n.__data__;if(!o||r.length<s-1)return r.push([e,t]),this;n=this.__data__=new a(r)}return n.set(e,t),this}var i=n(75),o=n(83),a=n(57),s=200;e.exports=r},function(e,t,n){function r(e,t,n,s,u){return e===t||(null==e||null==t||!o(e)&&!a(t)?e!==e&&t!==t:i(e,t,r,n,s,u))}var i=n(116),o=n(44),a=n(46);e.exports=r},function(e,t,n){function r(e,t,n,r,v,y){var b=c(e),_=c(t),w=h,x=h;b||(w=u(e),w=w==d?m:w),_||(x=u(t),x=x==d?m:x);var R=w==m&&!l(e),j=x==m&&!l(t),P=w==x;if(P&&!R)return y||(y=new i),b||f(e)?o(e,t,n,r,v,y):a(e,t,w,n,r,v,y);if(!(v&p)){var C=R&&g.call(e,"__wrapped__"),O=j&&g.call(t,"__wrapped__");if(C||O){var S=C?e.value():e,E=O?t.value():t;return y||(y=new i),n(S,E,r,v,y)}}return!!P&&(y||(y=new i),s(e,t,n,r,v,y))}var i=n(109),o=n(117),a=n(119),s=n(124),u=n(125),c=n(47),l=n(64),f=n(131),p=2,d="[object Arguments]",h="[object Array]",m="[object Object]",v=Object.prototype,g=v.hasOwnProperty;e.exports=r},function(e,t,n){function r(e,t,n,r,u,c){var l=u&s,f=e.length,p=t.length;if(f!=p&&!(l&&p>f))return!1;var d=c.get(e);if(d&&c.get(t))return d==t;var h=-1,m=!0,v=u&a?new i:void 0;for(c.set(e,t),c.set(t,e);++h<f;){var g=e[h],y=t[h];if(r)var b=l?r(y,g,h,t,e,c):r(g,y,h,e,t,c);if(void 0!==b){if(b)continue;m=!1;break}if(v){if(!o(t,function(e,t){if(!v.has(t)&&(g===e||n(g,e,r,u,c)))return v.add(t)})){m=!1;break}}else if(g!==y&&!n(g,y,r,u,c)){m=!1;break}}return c.delete(e),c.delete(t),m}var i=n(56),o=n(118),a=1,s=2;e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=e?e.length:0;++n<r;)if(t(e[n],n,e))return!0;return!1}e.exports=n},function(e,t,n){function r(e,t,n,r,i,R,P){switch(n){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case w:return!(e.byteLength!=t.byteLength||!r(new o(e),new o(t)));case p:case d:case v:return a(+e,+t);case h:return e.name==t.name&&e.message==t.message;case g:case b:return e==t+"";case m:var C=u;case y:var O=R&f;if(C||(C=c),e.size!=t.size&&!O)return!1;var S=P.get(e);if(S)return S==t;R|=l,P.set(e,t);var E=s(C(e),C(t),r,i,R,P);return P.delete(e),E;case _:if(j)return j.call(e)==j.call(t)}return!1}var i=n(120),o=n(121),a=n(79),s=n(117),u=n(122),c=n(123),l=1,f=2,p="[object Boolean]",d="[object Date]",h="[object Error]",m="[object Map]",v="[object Number]",g="[object RegExp]",y="[object Set]",b="[object String]",_="[object Symbol]",w="[object ArrayBuffer]",x="[object DataView]",R=i?i.prototype:void 0,j=R?R.valueOf:void 0;e.exports=r},function(e,t,n){var r=n(67),i=r.Symbol;e.exports=i},function(e,t,n){var r=n(67),i=r.Uint8Array;e.exports=i},function(e,t){function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}e.exports=n},function(e,t){function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}e.exports=n},function(e,t,n){function r(e,t,n,r,a,u){var c=a&o,l=i(e),f=l.length,p=i(t),d=p.length;if(f!=d&&!c)return!1;for(var h=f;h--;){var m=l[h];if(!(c?m in t:s.call(t,m)))return!1}var v=u.get(e);if(v&&u.get(t))return v==t;var g=!0;u.set(e,t),u.set(t,e);for(var y=c;++h<f;){m=l[h];var b=e[m],_=t[m];if(r)var w=c?r(_,b,m,t,e,u):r(b,_,m,e,t,u);if(!(void 0===w?b===_||n(b,_,r,a,u):w)){g=!1;break}y||(y="constructor"==m)}if(g&&!y){var x=e.constructor,R=t.constructor;x!=R&&"constructor"in e&&"constructor"in t&&!("function"==typeof x&&x instanceof x&&"function"==typeof R&&R instanceof R)&&(g=!1)}return u.delete(e),u.delete(t),g}var i=n(37),o=2,a=Object.prototype,s=a.hasOwnProperty;e.exports=r},function(e,t,n){var r=n(126),i=n(83),o=n(127),a=n(128),s=n(129),u=n(130),c=n(69),l="[object Map]",f="[object Object]",p="[object Promise]",d="[object Set]",h="[object WeakMap]",m="[object DataView]",v=Object.prototype,g=v.toString,y=c(r),b=c(i),_=c(o),w=c(a),x=c(s),R=u;(r&&R(new r(new ArrayBuffer(1)))!=m||i&&R(new i)!=l||o&&R(o.resolve())!=p||a&&R(new a)!=d||s&&R(new s)!=h)&&(R=function(e){var t=g.call(e),n=t==f?e.constructor:void 0,r=n?c(n):void 0;if(r)switch(r){case y:return m;case b:return l;case _:return p;case w:return d;case x:return h}return t}),e.exports=R},function(e,t,n){var r=n(62),i=n(67),o=r(i,"DataView");e.exports=o},function(e,t,n){var r=n(62),i=n(67),o=r(i,"Promise");e.exports=o},function(e,t,n){var r=n(62),i=n(67),o=r(i,"Set");e.exports=o},function(e,t,n){var r=n(62),i=n(67),o=r(i,"WeakMap");e.exports=o},function(e,t){function n(e){return i.call(e)}var r=Object.prototype,i=r.toString;e.exports=n},function(e,t,n){var r=n(132),i=n(97),o=n(133),a=o&&o.isTypedArray,s=a?i(a):r;e.exports=s},function(e,t,n){function r(e){return o(e)&&i(e.length)&&!!F[N.call(e)]}var i=n(45),o=n(46),a="[object Arguments]",s="[object Array]",u="[object Boolean]",c="[object Date]",l="[object Error]",f="[object Function]",p="[object Map]",d="[object Number]",h="[object Object]",m="[object RegExp]",v="[object Set]",g="[object String]",y="[object WeakMap]",b="[object ArrayBuffer]",_="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",R="[object Int8Array]",j="[object Int16Array]",P="[object Int32Array]",C="[object Uint8Array]",O="[object Uint8ClampedArray]",S="[object Uint16Array]",E="[object Uint32Array]",F={};F[w]=F[x]=F[R]=F[j]=F[P]=F[C]=F[O]=F[S]=F[E]=!0,F[a]=F[s]=F[b]=F[u]=F[_]=F[c]=F[l]=F[f]=F[p]=F[d]=F[h]=F[m]=F[v]=F[g]=F[y]=!1;var k=Object.prototype,N=k.toString;e.exports=r},function(e,t,n){(function(e){var r=n(68),i="object"==typeof t&&t&&!t.nodeType&&t,o=i&&"object"==typeof e&&e&&!e.nodeType&&e,a=o&&o.exports===i,s=a&&r.process,u=function(){try{return s&&s.binding("util")}catch(e){}}();e.exports=u}).call(t,n(25)(e))},function(e,t,n){function r(e){for(var t=o(e),n=t.length;n--;){var r=t[n],a=e[r];t[n]=[r,a,i(a)]}return t}var i=n(135),o=n(37);e.exports=r},function(e,t,n){function r(e){return e===e&&!i(e)}var i=n(44);e.exports=r},function(e,t){function n(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}e.exports=n},function(e,t,n){function r(e,t){return s(e)&&u(t)?c(l(e),t):function(n){var r=o(n,e);return void 0===r&&r===t?a(n,e):i(t,r,void 0,f|p)}}var i=n(115),o=n(138),a=n(148),s=n(146),u=n(135),c=n(136),l=n(147),f=1,p=2;e.exports=r},function(e,t,n){function r(e,t,n){var r=null==e?void 0:i(e,t);return void 0===r?n:r}var i=n(139);e.exports=r},function(e,t,n){function r(e,t){t=o(t,e)?[t]:i(t);for(var n=0,r=t.length;null!=e&&n<r;)e=e[a(t[n++])];return n&&n==r?e:void 0}var i=n(140),o=n(146),a=n(147);e.exports=r},function(e,t,n){function r(e){return i(e)?e:o(e)}var i=n(47),o=n(141);e.exports=r},function(e,t,n){var r=n(142),i=n(143),o=/^\./,a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,u=r(function(e){e=i(e);var t=[];return o.test(e)&&t.push(""),e.replace(a,function(e,n,r,i){t.push(r?i.replace(s,"$1"):n||e)}),t});e.exports=u},function(e,t,n){function r(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a),a};return n.cache=new(r.Cache||i),n}var i=n(57),o="Expected a function";r.Cache=i,e.exports=r},function(e,t,n){function r(e){return null==e?"":i(e)}var i=n(144);e.exports=r},function(e,t,n){function r(e){if("string"==typeof e)return e;if(o(e))return u?u.call(e):"";var t=e+"";return"0"==t&&1/e==-a?"-0":t}var i=n(120),o=n(145),a=1/0,s=i?i.prototype:void 0,u=s?s.toString:void 0;e.exports=r},function(e,t,n){function r(e){return"symbol"==typeof e||i(e)&&s.call(e)==o}var i=n(46),o="[object Symbol]",a=Object.prototype,s=a.toString;e.exports=r},function(e,t,n){function r(e,t){if(i(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o(e))||(s.test(e)||!a.test(e)||null!=t&&e in Object(t))}var i=n(47),o=n(145),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=r},function(e,t,n){function r(e){if("string"==typeof e||i(e))return e;var t=e+"";return"0"==t&&1/e==-o?"-0":t}var i=n(145),o=1/0;e.exports=r},function(e,t,n){function r(e,t){return null!=e&&o(e,t,i)}var i=n(149),o=n(150);e.exports=r},function(e,t){function n(e,t){return null!=e&&t in Object(e)}e.exports=n},function(e,t,n){function r(e,t,n){t=u(t,e)?[t]:i(t);for(var r,f=-1,p=t.length;++f<p;){var d=l(t[f]);if(!(r=null!=e&&n(e,d)))break;e=e[d]}if(r)return r;var p=e?e.length:0;return!!p&&c(p)&&s(d,p)&&(a(e)||o(e))}var i=n(140),o=n(40),a=n(47),s=n(48),u=n(146),c=n(45),l=n(147);e.exports=r},function(e,t){function n(e){return e}e.exports=n},function(e,t,n){function r(e){return a(e)?i(s(e)):o(e)}var i=n(153),o=n(154),a=n(146),s=n(147);e.exports=r},function(e,t){function n(e){return function(t){return null==t?void 0:t[e]}}e.exports=n},function(e,t,n){function r(e){return function(t){return i(t,e)}}var i=n(139);e.exports=r},function(e,t,n){function r(e,t){var n=s(e)?i:o;return n(e,a(t,3))}var i=n(156),o=n(157),a=n(106),s=n(47);e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=e?e.length:0;++n<r&&t(e[n],n,e)!==!1;);return e}e.exports=n},function(e,t,n){var r=n(103),i=n(158),o=i(r);e.exports=o},function(e,t,n){function r(e,t){return function(n,r){if(null==n)return n;if(!i(n))return e(n,r);for(var o=n.length,a=t?o:-1,s=Object(n);(t?a--:++a<o)&&r(s[a],a,s)!==!1;);return n}}var i=n(42);e.exports=r},function(e,t,n){function r(e,t){var n=s(e)?i:o;return n(e,a(t,3))}var i=n(160),o=n(161),a=n(106),s=n(47);e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=e?e.length:0,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}e.exports=n},function(e,t,n){function r(e,t){var n=[];return i(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}var i=n(157);e.exports=r},function(e,t,n){function r(e,t){var n=s(e)?i:a;return n(e,o(t,3))}var i=n(54),o=n(106),a=n(163),s=n(47);e.exports=r},function(e,t,n){function r(e,t){var n=-1,r=o(e)?Array(e.length):[];return i(e,function(e,i,o){r[++n]=t(e,i,o)}),r}var i=n(157),o=n(42);e.exports=r},function(e,t,n){function r(e,t,n){var r=u(e)?i:s,c=arguments.length<3;return r(e,a(t,4),n,c,o)}var i=n(165),o=n(157),a=n(106),s=n(166),u=n(47);e.exports=r},function(e,t){function n(e,t,n,r){var i=-1,o=e?e.length:0;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}e.exports=n},function(e,t){function n(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}e.exports=n},function(e,t,n){var r=n(54),i=n(168),o=n(169),a=n(172),s=n(99),u=n(174),c=n(147),l=s(function(e,t){return null==e?{}:(t=r(o(t,1),c),a(e,i(u(e),t)))});e.exports=l},function(e,t,n){function r(e,t,n,r){var f=-1,p=o,d=!0,h=e.length,m=[],v=t.length;if(!h)return m;n&&(t=s(t,u(n))),r?(p=a,d=!1):t.length>=l&&(p=c,d=!1,t=new i(t));e:for(;++f<h;){var g=e[f],y=n?n(g):g;if(g=r||0!==g?g:0,d&&y===y){for(var b=v;b--;)if(t[b]===y)continue e;m.push(g)}else p(t,y,r)||m.push(g)}return m}var i=n(56),o=n(92),a=n(96),s=n(54),u=n(97),c=n(98),l=200;e.exports=r},function(e,t,n){function r(e,t,n,a,s){var u=-1,c=e.length;for(n||(n=o),s||(s=[]);++u<c;){var l=e[u];t>0&&n(l)?t>1?r(l,t-1,n,a,s):i(s,l):a||(s[s.length]=l)}return s}var i=n(170),o=n(171);e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}e.exports=n},function(e,t,n){function r(e){return a(e)||o(e)||!!(s&&e&&e[s])}var i=n(120),o=n(40),a=n(47),s=i?i.isConcatSpreadable:void 0;e.exports=r},function(e,t,n){function r(e,t){return e=Object(e),i(e,t,function(t,n){return n in e})}var i=n(173);e.exports=r},function(e,t){function n(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=e[a];n(s,a)&&(o[a]=s)}return o}e.exports=n},function(e,t,n){function r(e){return i(e,a,o)}var i=n(175),o=n(176),a=n(180);e.exports=r},function(e,t,n){function r(e,t,n){var r=t(e);return o(e)?r:i(r,n(e))}var i=n(170),o=n(47);e.exports=r},function(e,t,n){var r=n(170),i=n(177),o=n(178),a=n(179),s=Object.getOwnPropertySymbols,u=s?function(e){for(var t=[];e;)r(t,o(e)),e=i(e);return t}:a;e.exports=u},function(e,t,n){var r=n(52),i=r(Object.getPrototypeOf,Object);e.exports=i},function(e,t,n){var r=n(52),i=n(179),o=Object.getOwnPropertySymbols,a=o?r(o,Object):i;e.exports=a},function(e,t){function n(){return[]}e.exports=n},function(e,t,n){function r(e){return a(e)?i(e,!0):o(e)}var i=n(38),o=n(181),a=n(42);e.exports=r},function(e,t,n){function r(e){if(!i(e))return a(e);var t=o(e),n=[];for(var r in e)("constructor"!=r||!t&&u.call(e,r))&&n.push(r);return n}var i=n(44),o=n(50),a=n(182),s=Object.prototype,u=s.hasOwnProperty;e.exports=r},function(e,t){function n(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}e.exports=n},function(e,t,n){function r(e,t,n){var r=e?e.length:0;if(!r)return-1;var s=null==n?0:o(n);return s<0&&(s=a(r+s,0)),i(e,t,s)}var i=n(93),o=n(184),a=Math.max;e.exports=r},function(e,t,n){function r(e){var t=i(e),n=t%1;return t===t?n?t-n:t:0}var i=n(185);e.exports=r},function(e,t,n){function r(e){if(!e)return 0===e?e:0;if(e=i(e),e===o||e===-o){var t=e<0?-1:1;return t*a}return e===e?e:0}var i=n(186),o=1/0,a=1.7976931348623157e308;e.exports=r},function(e,t,n){function r(e){if("number"==typeof e)return e;if(o(e))return a;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var n=c.test(e);return n||l.test(e)?f(e.slice(2),n?2:8):u.test(e)?a:+e}var i=n(44),o=n(145),a=NaN,s=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,f=parseInt;e.exports=r},function(e,t,n){function r(e){return i(e)&&e!=+e}var i=n(188);e.exports=r},function(e,t,n){function r(e){return"number"==typeof e||i(e)&&s.call(e)==o}var i=n(46),o="[object Number]",a=Object.prototype,s=a.toString;e.exports=r},function(e,t,n){function r(e){if(s(e)&&(a(e)||"string"==typeof e||"function"==typeof e.splice||u(e)||o(e)))return!e.length;var t=i(e);if(t==f||t==p)return!e.size;if(v||c(e))return!l(e).length;for(var n in e)if(h.call(e,n))return!1;return!0}var i=n(125),o=n(40),a=n(47),s=n(42),u=n(190),c=n(50),l=n(51),f="[object Map]",p="[object Set]",d=Object.prototype,h=d.hasOwnProperty,m=d.propertyIsEnumerable,v=!m.call({valueOf:1},"valueOf");e.exports=r},function(e,t,n){(function(e){var r=n(67),i=n(191),o="object"==typeof t&&t&&!t.nodeType&&t,a=o&&"object"==typeof e&&e&&!e.nodeType&&e,s=a&&a.exports===o,u=s?r.Buffer:void 0,c=u?u.isBuffer:void 0,l=c||i;e.exports=l}).call(t,n(25)(e))},function(e,t){function n(){return!1}e.exports=n},function(e,t,n){function r(e,t){return i(e,t)}var i=n(115);e.exports=r},function(e,t){function n(e){return void 0===e}e.exports=n},function(e,t,n){function r(e){return"string"==typeof e||!i(e)&&o(e)&&u.call(e)==a}var i=n(47),o=n(46),a="[object String]",s=Object.prototype,u=s.toString;e.exports=r},function(e,t,n){var r=n(196),i=n(197),o=r(i);e.exports=o},function(e,t,n){function r(e){return function(t,n,r){var s=Object(t);if(!o(t)){var u=i(n,3);t=a(t),n=function(e){return u(s[e],e,s)}}var c=e(t,n,r);return c>-1?s[u?t[c]:c]:void 0}}var i=n(106),o=n(42),a=n(37);e.exports=r},function(e,t,n){function r(e,t,n){var r=e?e.length:0;if(!r)return-1;var u=null==n?0:a(n);return u<0&&(u=s(r+u,0)),i(e,o(t,3),u)}var i=n(94),o=n(106),a=n(184),s=Math.max;e.exports=r},function(e,t,n){function r(e,t,n){if(e=c(e),e&&(n||void 0===t))return e.replace(l,"");if(!e||!(t=i(t)))return e;var r=u(e),f=u(t),p=s(r,f),d=a(r,f)+1;return o(r,p,d).join("")}var i=n(144),o=n(199),a=n(201),s=n(202),u=n(203),c=n(143),l=/^\s+|\s+$/g;e.exports=r},function(e,t,n){function r(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:i(e,t,n)}var i=n(200);e.exports=r},function(e,t){function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}e.exports=n},function(e,t,n){function r(e,t){for(var n=e.length;n--&&i(t,e[n],0)>-1;);return n}var i=n(93);e.exports=r},function(e,t,n){function r(e,t){for(var n=-1,r=e.length;++n<r&&i(t,e[n],0)>-1;);return n}var i=n(93);e.exports=r},function(e,t,n){function r(e){return o(e)?a(e):i(e)}var i=n(204),o=n(205),a=n(206);e.exports=r},function(e,t){function n(e){return e.split("")}e.exports=n},function(e,t){function n(e){return u.test(e)}var r="\\ud800-\\udfff",i="\\u0300-\\u036f\\ufe20-\\ufe23",o="\\u20d0-\\u20f0",a="\\ufe0e\\ufe0f",s="\\u200d",u=RegExp("["+s+r+i+o+a+"]");e.exports=n},function(e,t){function n(e){return e.match(_)||[]}var r="\\ud800-\\udfff",i="\\u0300-\\u036f\\ufe20-\\ufe23",o="\\u20d0-\\u20f0",a="\\ufe0e\\ufe0f",s="["+r+"]",u="["+i+o+"]",c="\\ud83c[\\udffb-\\udfff]",l="(?:"+u+"|"+c+")",f="[^"+r+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",h="\\u200d",m=l+"?",v="["+a+"]?",g="(?:"+h+"(?:"+[f,p,d].join("|")+")"+v+m+")*",y=v+m+g,b="(?:"+[f+u+"?",u,p,d,s].join("|")+")",_=RegExp(c+"(?="+c+")|"+b+y,"g");e.exports=n},function(e,t,n){var r=n(100),i=n(208),o=n(209),a=n(99),s=a(function(e){return e.push(void 0,i),r(o,void 0,e)});e.exports=s},function(e,t,n){function r(e,t,n,r){return void 0===e||i(e,o[n])&&!a.call(r,n)?t:e}var i=n(79),o=Object.prototype,a=o.hasOwnProperty;e.exports=r},function(e,t,n){var r=n(210),i=n(212),o=n(180),a=i(function(e,t,n,i){r(t,o(t),e,i)});e.exports=a},function(e,t,n){function r(e,t,n,r){n||(n={});for(var o=-1,a=t.length;++o<a;){var s=t[o],u=r?r(n[s],e[s],s,n,e):void 0;i(n,s,void 0===u?e[s]:u)}return n}var i=n(211);e.exports=r},function(e,t,n){function r(e,t,n){var r=e[t];a.call(e,t)&&i(r,n)&&(void 0!==n||t in e)||(e[t]=n)}var i=n(79),o=Object.prototype,a=o.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){return i(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,s&&o(n[0],n[1],s)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var u=n[r];u&&e(t,u,r,a)}return t})}var i=n(99),o=n(213);e.exports=r},function(e,t,n){function r(e,t,n){if(!s(n))return!1;var r=typeof t;return!!("number"==r?o(n)&&a(t,n.length):"string"==r&&t in n)&&i(n[t],e)}var i=n(79),o=n(42),a=n(48),s=n(44);e.exports=r},function(e,t,n){var r=n(215),i=n(212),o=i(function(e,t,n){r(e,t,n)});e.exports=o},function(e,t,n){function r(e,t,n,p,d){if(e!==t){if(!c(t)&&!f(t))var h=s(t);o(h||t,function(o,s){if(h&&(s=o,o=t[s]),l(o))d||(d=new i),u(e,t,s,n,r,p,d);else{var c=p?p(e[s],o,s+"",e,t,d):void 0;void 0===c&&(c=o),a(e,s,c)}})}}var i=n(109),o=n(156),a=n(216),s=n(181),u=n(217),c=n(47),l=n(44),f=n(131);e.exports=r},function(e,t,n){function r(e,t,n){(void 0===n||i(e[t],n))&&("number"!=typeof t||void 0!==n||t in e)||(e[t]=n)}var i=n(79);e.exports=r},function(e,t,n){function r(e,t,n,r,m,v,g){var y=e[n],b=t[n],_=g.get(b);if(_)return void i(e,n,_);var w=v?v(y,b,n+"",e,t,g):void 0,x=void 0===w;x&&(w=b,u(b)||d(b)?u(y)?w=y:c(y)?w=a(y):(x=!1,w=o(b,!0)):p(b)||s(b)?s(y)?w=h(y):!f(y)||r&&l(y)?(x=!1,w=o(b,!0)):w=y:x=!1),x&&(g.set(b,w),m(w,b,r,v,g),g.delete(b)),i(e,n,w)}var i=n(216),o=n(218),a=n(221),s=n(40),u=n(47),c=n(41),l=n(43),f=n(44),p=n(237),d=n(131),h=n(238);e.exports=r},function(e,t,n){function r(e,t,n,x,R,j,P){var S;if(x&&(S=j?x(e,R,j,P):x(e)),void 0!==S)return S;if(!b(e))return e;var E=v(e);if(E){if(S=d(e),!t)return c(e,S)}else{var k=p(e),N=k==C||k==O;if(g(e))return u(e,t);if(k==F||k==w||N&&!j){if(y(e))return j?e:{};if(S=m(N?{}:e),!t)return l(e,s(S,e))}else{if(!K[k])return j?e:{};S=h(e,k,r,t)}}P||(P=new i);var T=P.get(e);if(T)return T;if(P.set(e,S),!E)var A=n?f(e):_(e);return o(A||e,function(i,o){A&&(o=i,i=e[o]),a(S,o,r(i,t,n,x,o,e,P))}),S}var i=n(109),o=n(156),a=n(211),s=n(219),u=n(220),c=n(221),l=n(222),f=n(223),p=n(125),d=n(224),h=n(225),m=n(235),v=n(47),g=n(190),y=n(64),b=n(44),_=n(37),w="[object Arguments]",x="[object Array]",R="[object Boolean]",j="[object Date]",P="[object Error]",C="[object Function]",O="[object GeneratorFunction]",S="[object Map]",E="[object Number]",F="[object Object]",k="[object RegExp]",N="[object Set]",T="[object String]",A="[object Symbol]",M="[object WeakMap]",H="[object ArrayBuffer]",L="[object DataView]",U="[object Float32Array]",D="[object Float64Array]",I="[object Int8Array]",V="[object Int16Array]",q="[object Int32Array]",B="[object Uint8Array]",Q="[object Uint8ClampedArray]",z="[object Uint16Array]",W="[object Uint32Array]",K={};K[w]=K[x]=K[H]=K[L]=K[R]=K[j]=K[U]=K[D]=K[I]=K[V]=K[q]=K[S]=K[E]=K[F]=K[k]=K[N]=K[T]=K[A]=K[B]=K[Q]=K[z]=K[W]=!0,K[P]=K[C]=K[M]=!1,e.exports=r},function(e,t,n){function r(e,t){return e&&i(t,o(t),e)}var i=n(210),o=n(37);e.exports=r},function(e,t){function n(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}e.exports=n},function(e,t){function n(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}e.exports=n},function(e,t,n){function r(e,t){return i(e,o(e),t)}var i=n(210),o=n(178);e.exports=r},function(e,t,n){function r(e){return i(e,a,o)}var i=n(175),o=n(178),a=n(37);e.exports=r},function(e,t){function n(e){var t=e.length,n=e.constructor(t);return t&&"string"==typeof e[0]&&i.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var r=Object.prototype,i=r.hasOwnProperty;e.exports=n},function(e,t,n){function r(e,t,n,r){var F=e.constructor;switch(t){case b:return i(e);case f:case p:return new F(+e);case _:return o(e,r);case w:case x:case R:case j:case P:case C:case O:case S:case E:return l(e,r);case d:return a(e,r,n);case h:case g:return new F(e);case m:return s(e);case v:return u(e,r,n);case y:return c(e)}}var i=n(226),o=n(227),a=n(228),s=n(230),u=n(231),c=n(233),l=n(234),f="[object Boolean]",p="[object Date]",d="[object Map]",h="[object Number]",m="[object RegExp]",v="[object Set]",g="[object String]",y="[object Symbol]",b="[object ArrayBuffer]",_="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",R="[object Int8Array]",j="[object Int16Array]",P="[object Int32Array]",C="[object Uint8Array]",O="[object Uint8ClampedArray]",S="[object Uint16Array]",E="[object Uint32Array]";e.exports=r},function(e,t,n){function r(e){var t=new e.constructor(e.byteLength);return new i(t).set(new i(e)),t}var i=n(121);e.exports=r},function(e,t,n){function r(e,t){var n=t?i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var i=n(226);e.exports=r},function(e,t,n){function r(e,t,n){var r=t?n(a(e),!0):a(e);return o(r,i,new e.constructor)}var i=n(229),o=n(165),a=n(122);e.exports=r},function(e,t){function n(e,t){return e.set(t[0],t[1]),e}e.exports=n},function(e,t){function n(e){var t=new e.constructor(e.source,r.exec(e));return t.lastIndex=e.lastIndex,t}var r=/\w*$/;e.exports=n},function(e,t,n){function r(e,t,n){var r=t?n(a(e),!0):a(e);return o(r,i,new e.constructor)}var i=n(232),o=n(165),a=n(123);e.exports=r},function(e,t){function n(e,t){return e.add(t),e}e.exports=n},function(e,t,n){function r(e){return a?Object(a.call(e)):{}}var i=n(120),o=i?i.prototype:void 0,a=o?o.valueOf:void 0;e.exports=r},function(e,t,n){function r(e,t){var n=t?i(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var i=n(226);e.exports=r},function(e,t,n){function r(e){return"function"!=typeof e.constructor||a(e)?{}:i(o(e))}var i=n(236),o=n(177),a=n(50);e.exports=r},function(e,t,n){function r(e){return i(e)?o(e):{}}var i=n(44),o=Object.create;e.exports=r},function(e,t,n){function r(e){if(!a(e)||d.call(e)!=s||o(e))return!1;var t=i(e);if(null===t)return!0;var n=f.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&l.call(n)==p}var i=n(177),o=n(64),a=n(46),s="[object Object]",u=Function.prototype,c=Object.prototype,l=u.toString,f=c.hasOwnProperty,p=l.call(Object),d=c.toString;e.exports=r},function(e,t,n){function r(e){return i(e,o(e))}var i=n(210),o=n(180);e.exports=r},function(e,t,n){"use strict";function r(e){if(a(e))return e;if(s(e))return parseFloat(e);if(o(e))return i(e,r);throw new Error("The value should be a number, a parseable string or an array of those.")}var i=n(162),o=n(47),a=n(188),s=n(194);e.exports=r},function(e,t,n){"use strict";function r(e,t){var n={},r=o(t,function(e){return e.indexOf("attribute:")!==-1}),c=a(r,function(e){return e.split(":")[1]});u(c,"*")===-1?i(c,function(t){e.isConjunctiveFacet(t)&&e.isFacetRefined(t)&&(n.facetsRefinements||(n.facetsRefinements={}),n.facetsRefinements[t]=e.facetsRefinements[t]),e.isDisjunctiveFacet(t)&&e.isDisjunctiveFacetRefined(t)&&(n.disjunctiveFacetsRefinements||(n.disjunctiveFacetsRefinements={}),n.disjunctiveFacetsRefinements[t]=e.disjunctiveFacetsRefinements[t]),e.isHierarchicalFacet(t)&&e.isHierarchicalFacetRefined(t)&&(n.hierarchicalFacetsRefinements||(n.hierarchicalFacetsRefinements={}),n.hierarchicalFacetsRefinements[t]=e.hierarchicalFacetsRefinements[t]);var r=e.getNumericRefinements(t);s(r)||(n.numericRefinements||(n.numericRefinements={}),n.numericRefinements[t]=e.numericRefinements[t])}):(s(e.numericRefinements)||(n.numericRefinements=e.numericRefinements),s(e.facetsRefinements)||(n.facetsRefinements=e.facetsRefinements),s(e.disjunctiveFacetsRefinements)||(n.disjunctiveFacetsRefinements=e.disjunctiveFacetsRefinements),s(e.hierarchicalFacetsRefinements)||(n.hierarchicalFacetsRefinements=e.hierarchicalFacetsRefinements));var l=o(t,function(e){return e.indexOf("attribute:")===-1;
});return i(l,function(t){n[t]=e[t]}),n}var i=n(155),o=n(159),a=n(162),s=n(189),u=n(183);e.exports=r},function(e,t,n){"use strict";var r=n(193),i=n(194),o=n(43),a=n(189),s=n(207),u=n(164),c=n(159),l=n(167),f={addRefinement:function(e,t,n){if(f.isRefined(e,t,n))return e;var r=""+n,i=e[t]?e[t].concat(r):[r],o={};return o[t]=i,s({},o,e)},removeRefinement:function(e,t,n){if(r(n))return f.clearRefinement(e,t);var i=""+n;return f.clearRefinement(e,function(e,n){return t===n&&i===e})},toggleRefinement:function(e,t,n){if(r(n))throw new Error("toggleRefinement should be used with a value");return f.isRefined(e,t,n)?f.removeRefinement(e,t,n):f.addRefinement(e,t,n)},clearRefinement:function(e,t,n){return r(t)?{}:i(t)?l(e,t):o(t)?u(e,function(e,r,i){var o=c(r,function(e){return!t(e,i,n)});return a(o)||(e[i]=o),e},{}):void 0},isRefined:function(e,t,i){var o=n(183),a=!!e[t]&&e[t].length>0;if(r(i)||!a)return a;var s=""+i;return o(e[t],s)!==-1}};e.exports=f},function(e,t,n){"use strict";function r(e){var t={};return d(e,function(e,n){t[e]=n}),t}function i(e,t,n){t&&t[n]&&(e.stats=t[n])}function o(e,t){return b(e,function(e){return _(e.attributes,t)})}function a(e,t){var n=t.results[0];this.query=n.query,this.parsedQuery=n.parsedQuery,this.hits=n.hits,this.index=n.index,this.hitsPerPage=n.hitsPerPage,this.nbHits=n.nbHits,this.nbPages=n.nbPages,this.page=n.page,this.processingTimeMS=y(t.results,"processingTimeMS"),this.aroundLatLng=n.aroundLatLng,this.automaticRadius=n.automaticRadius,this.serverUsed=n.serverUsed,this.timeoutCounts=n.timeoutCounts,this.timeoutHits=n.timeoutHits,this.disjunctiveFacets=[],this.hierarchicalFacets=w(e.hierarchicalFacets,function(){return[]}),this.facets=[];var a=e.getRefinedDisjunctiveFacets(),s=r(e.facets),u=r(e.disjunctiveFacets),c=1,l=this;d(n.facets,function(t,r){var a=o(e.hierarchicalFacets,r);if(a){var c=a.attributes.indexOf(r),f=v(e.hierarchicalFacets,{name:a.name});l.hierarchicalFacets[f][c]={attribute:r,data:t,exhaustive:n.exhaustiveFacetsCount}}else{var p,d=m(e.disjunctiveFacets,r)!==-1,h=m(e.facets,r)!==-1;d&&(p=u[r],l.disjunctiveFacets[p]={name:r,data:t,exhaustive:n.exhaustiveFacetsCount},i(l.disjunctiveFacets[p],n.facets_stats,r)),h&&(p=s[r],l.facets[p]={name:r,data:t,exhaustive:n.exhaustiveFacetsCount},i(l.facets[p],n.facets_stats,r))}}),this.hierarchicalFacets=h(this.hierarchicalFacets),d(a,function(r){var o=t.results[c],a=e.getHierarchicalFacetByName(r);d(o.facets,function(t,r){var s;if(a){s=v(e.hierarchicalFacets,{name:a.name});var c=v(l.hierarchicalFacets[s],{attribute:r});if(c===-1)return;l.hierarchicalFacets[s][c].data=j({},l.hierarchicalFacets[s][c].data,t)}else{s=u[r];var f=n.facets&&n.facets[r]||{};l.disjunctiveFacets[s]={name:r,data:R({},t,f),exhaustive:o.exhaustiveFacetsCount},i(l.disjunctiveFacets[s],o.facets_stats,r),e.disjunctiveFacetsRefinements[r]&&d(e.disjunctiveFacetsRefinements[r],function(t){!l.disjunctiveFacets[s].data[t]&&m(e.disjunctiveFacetsRefinements[r],t)>-1&&(l.disjunctiveFacets[s].data[t]=0)})}}),c++}),d(e.getRefinedHierarchicalFacets(),function(n){var r=e.getHierarchicalFacetByName(n),i=e._getHierarchicalFacetSeparator(r),o=e.getHierarchicalRefinement(n);if(!(0===o.length||o[0].split(i).length<2)){var a=t.results[c];d(a.facets,function(t,n){var a=v(e.hierarchicalFacets,{name:r.name}),s=v(l.hierarchicalFacets[a],{attribute:n});if(s!==-1){var u={};if(o.length>0){var c=o[0].split(i)[0];u[c]=l.hierarchicalFacets[a][s].data[c]}l.hierarchicalFacets[a][s].data=R(u,t,l.hierarchicalFacets[a][s].data)}}),c++}}),d(e.facetsExcludes,function(e,t){var r=s[t];l.facets[r]={name:t,data:n.facets[t],exhaustive:n.exhaustiveFacetsCount},d(e,function(e){l.facets[r]=l.facets[r]||{name:t},l.facets[r].data=l.facets[r].data||{},l.facets[r].data[e]=0})}),this.hierarchicalFacets=w(this.hierarchicalFacets,F(e)),this.facets=h(this.facets),this.disjunctiveFacets=h(this.disjunctiveFacets),this._state=e}function s(e,t){var n={name:t};if(e._state.isConjunctiveFacet(t)){var r=b(e.facets,n);return r?w(r.data,function(n,r){return{name:r,count:n,isRefined:e._state.isFacetRefined(t,r),isExcluded:e._state.isExcludeRefined(t,r)}}):[]}if(e._state.isDisjunctiveFacet(t)){var i=b(e.disjunctiveFacets,n);return i?w(i.data,function(n,r){return{name:r,count:n,isRefined:e._state.isDisjunctiveFacetRefined(t,r)}}):[]}if(e._state.isHierarchicalFacet(t))return b(e.hierarchicalFacets,n)}function u(e,t){if(!t.data||0===t.data.length)return t;var n=w(t.data,O(u,e)),r=e(n),i=j({},t,{data:r});return i}function c(e,t){return t.sort(e)}function l(e,t){var n=b(e,{name:t});return n&&n.stats}function f(e,t,n,r,i){var o=b(i,{name:n}),a=g(o,"data["+r+"]"),s=g(o,"exhaustive");return{type:t,attributeName:n,name:r,count:a||0,exhaustive:s||!1}}function p(e,t,n,r){for(var i=b(r,{name:t}),o=e.getHierarchicalFacetByName(t),a=n.split(o.separator),s=a[a.length-1],u=0;void 0!==i&&u<a.length;++u)i=b(i.data,{name:a[u]});var c=g(i,"count"),l=g(i,"exhaustive");return{type:"hierarchical",attributeName:t,name:s,count:c||0,exhaustive:l||!1}}var d=n(155),h=n(243),m=n(183),v=n(197),g=n(138),y=n(244),b=n(195),_=n(246),w=n(162),x=n(249),R=n(207),j=n(214),P=n(47),C=n(43),O=n(254),S=n(289),E=n(290),F=n(293);a.prototype.getFacetByName=function(e){var t={name:e};return b(this.facets,t)||b(this.disjunctiveFacets,t)||b(this.hierarchicalFacets,t)},a.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],a.prototype.getFacetValues=function(e,t){var n=s(this,e);if(!n)throw new Error(e+" is not a retrieved facet.");var r=R({},t,{sortBy:a.DEFAULT_SORT});if(P(r.sortBy)){var i=E(r.sortBy,a.DEFAULT_SORT);return P(n)?x(n,i[0],i[1]):u(S(x,i[0],i[1]),n)}if(C(r.sortBy))return P(n)?n.sort(r.sortBy):u(O(c,r.sortBy),n);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")},a.prototype.getFacetStats=function(e){if(this._state.isConjunctiveFacet(e))return l(this.facets,e);if(this._state.isDisjunctiveFacet(e))return l(this.disjunctiveFacets,e);throw new Error(e+" is not present in `facets` or `disjunctiveFacets`")},a.prototype.getRefinements=function(){var e=this._state,t=this,n=[];return d(e.facetsRefinements,function(r,i){d(r,function(r){n.push(f(e,"facet",i,r,t.facets))})}),d(e.facetsExcludes,function(r,i){d(r,function(r){n.push(f(e,"exclude",i,r,t.facets))})}),d(e.disjunctiveFacetsRefinements,function(r,i){d(r,function(r){n.push(f(e,"disjunctive",i,r,t.disjunctiveFacets))})}),d(e.hierarchicalFacetsRefinements,function(r,i){d(r,function(r){n.push(p(e,i,r,t.hierarchicalFacets))})}),d(e.numericRefinements,function(e,t){d(e,function(e,r){d(e,function(e){n.push({type:"numeric",attributeName:t,name:e,numericValue:e,operator:r})})})}),d(e.tagRefinements,function(e){n.push({type:"tag",attributeName:"_tags",name:e})}),n},e.exports=a},function(e,t){function n(e){for(var t=-1,n=e?e.length:0,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i}e.exports=n},function(e,t,n){function r(e,t){return e&&e.length?o(e,i(t,2)):0}var i=n(106),o=n(245);e.exports=r},function(e,t){function n(e,t){for(var n,r=-1,i=e.length;++r<i;){var o=t(e[r]);void 0!==o&&(n=void 0===n?o:n+o)}return n}e.exports=n},function(e,t,n){function r(e,t,n,r){e=o(e)?e:u(e),n=n&&!r?s(n):0;var l=e.length;return n<0&&(n=c(l+n,0)),a(e)?n<=l&&e.indexOf(t,n)>-1:!!l&&i(e,t,n)>-1}var i=n(93),o=n(42),a=n(194),s=n(184),u=n(247),c=Math.max;e.exports=r},function(e,t,n){function r(e){return e?i(e,o(e)):[]}var i=n(248),o=n(37);e.exports=r},function(e,t,n){function r(e,t){return i(t,function(t){return e[t]})}var i=n(54);e.exports=r},function(e,t,n){function r(e,t,n,r){return null==e?[]:(o(t)||(t=null==t?[]:[t]),n=r?void 0:n,o(n)||(n=null==n?[]:[n]),i(e,t,n))}var i=n(250),o=n(47);e.exports=r},function(e,t,n){function r(e,t,n){var r=-1;t=i(t.length?t:[l],u(o));var f=a(e,function(e,n,o){var a=i(t,function(t){return t(e)});return{criteria:a,index:++r,value:e}});return s(f,function(e,t){return c(e,t,n)})}var i=n(54),o=n(106),a=n(163),s=n(251),u=n(97),c=n(252),l=n(151);e.exports=r},function(e,t){function n(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}e.exports=n},function(e,t,n){function r(e,t,n){for(var r=-1,o=e.criteria,a=t.criteria,s=o.length,u=n.length;++r<s;){var c=i(o[r],a[r]);if(c){if(r>=u)return c;var l=n[r];return c*("desc"==l?-1:1)}}return e.index-t.index}var i=n(253);e.exports=r},function(e,t,n){function r(e,t){if(e!==t){var n=void 0!==e,r=null===e,o=e===e,a=i(e),s=void 0!==t,u=null===t,c=t===t,l=i(t);if(!u&&!l&&!a&&e>t||a&&s&&c&&!u&&!l||r&&s&&c||!n&&c||!o)return 1;if(!r&&!a&&!l&&e<t||l&&n&&o&&!r&&!a||u&&n&&o||!s&&o||!c)return-1}return 0}var i=n(145);e.exports=r},function(e,t,n){var r=n(99),i=n(255),o=n(284),a=n(286),s=32,u=r(function(e,t){var n=a(t,o(u));return i(e,s,void 0,t,n)});u.placeholder={},e.exports=u},function(e,t,n){function r(e,t,n,r,x,R,j,P){var C=t&v;if(!C&&"function"!=typeof e)throw new TypeError(h);var O=r?r.length:0;if(O||(t&=~(b|_),r=x=void 0),j=void 0===j?j:w(d(j),0),P=void 0===P?P:d(P),O-=x?x.length:0,t&_){var S=r,E=x;r=x=void 0}var F=C?void 0:c(e),k=[e,t,n,r,x,S,E,R,j,P];if(F&&l(k,F),e=k[0],t=k[1],n=k[2],r=k[3],x=k[4],P=k[9]=null==k[9]?C?0:e.length:w(k[9]-O,0),!P&&t&(g|y)&&(t&=~(g|y)),t&&t!=m)N=t==g||t==y?a(e,t,P):t!=b&&t!=(m|b)||x.length?s.apply(void 0,k):u(e,t,n,r);else var N=o(e,t,n);var T=F?i:f;return p(T(N,k),e,t)}var i=n(256),o=n(258),a=n(260),s=n(261),u=n(287),c=n(269),l=n(288),f=n(276),p=n(278),d=n(184),h="Expected a function",m=1,v=2,g=8,y=16,b=32,_=64,w=Math.max;e.exports=r},function(e,t,n){var r=n(151),i=n(257),o=i?function(e,t){return i.set(e,t),e}:r;e.exports=o},function(e,t,n){var r=n(129),i=r&&new r;e.exports=i},function(e,t,n){function r(e,t,n){function r(){var t=this&&this!==o&&this instanceof r?u:e;return t.apply(s?n:this,arguments)}var s=t&a,u=i(e);return r}var i=n(259),o=n(67),a=1;e.exports=r},function(e,t,n){function r(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=i(e.prototype),r=e.apply(n,t);return o(r)?r:n}}var i=n(236),o=n(44);e.exports=r},function(e,t,n){function r(e,t,n){function r(){for(var o=arguments.length,p=Array(o),d=o,h=u(r);d--;)p[d]=arguments[d];var m=o<3&&p[0]!==h&&p[o-1]!==h?[]:c(p,h);if(o-=m.length,o<n)return s(e,t,a,r.placeholder,void 0,p,m,void 0,void 0,n-o);var v=this&&this!==l&&this instanceof r?f:e;return i(v,this,p)}var f=o(e);return r}var i=n(100),o=n(259),a=n(261),s=n(265),u=n(284),c=n(286),l=n(67);e.exports=r},function(e,t,n){function r(e,t,n,b,_,w,x,R,j,P){function C(){for(var d=arguments.length,h=Array(d),m=d;m--;)h[m]=arguments[m];if(F)var v=c(C),g=a(h,v);if(b&&(h=i(h,b,_,F)),w&&(h=o(h,w,x,F)),d-=g,F&&d<P){var y=f(h,v);return u(e,t,r,C.placeholder,n,h,y,R,j,P-d)}var T=S?n:this,A=E?T[e]:e;return d=h.length,R?h=l(h,R):k&&d>1&&h.reverse(),O&&j<d&&(h.length=j),this&&this!==p&&this instanceof C&&(A=N||s(A)),A.apply(T,h)}var O=t&g,S=t&d,E=t&h,F=t&(m|v),k=t&y,N=E?void 0:s(e);return C}var i=n(262),o=n(263),a=n(264),s=n(259),u=n(265),c=n(284),l=n(285),f=n(286),p=n(67),d=1,h=2,m=8,v=16,g=128,y=512;e.exports=r},function(e,t){function n(e,t,n,i){for(var o=-1,a=e.length,s=n.length,u=-1,c=t.length,l=r(a-s,0),f=Array(c+l),p=!i;++u<c;)f[u]=t[u];for(;++o<s;)(p||o<a)&&(f[n[o]]=e[o]);for(;l--;)f[u++]=e[o++];return f}var r=Math.max;e.exports=n},function(e,t){function n(e,t,n,i){for(var o=-1,a=e.length,s=-1,u=n.length,c=-1,l=t.length,f=r(a-u,0),p=Array(f+l),d=!i;++o<f;)p[o]=e[o];for(var h=o;++c<l;)p[h+c]=t[c];for(;++s<u;)(d||o<a)&&(p[h+n[s]]=e[o++]);return p}var r=Math.max;e.exports=n},function(e,t){function n(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&r++;return r}e.exports=n},function(e,t,n){function r(e,t,n,r,d,h,m,v,g,y){var b=t&l,_=b?m:void 0,w=b?void 0:m,x=b?h:void 0,R=b?void 0:h;t|=b?f:p,t&=~(b?p:f),t&c||(t&=~(s|u));var j=[e,t,d,x,_,R,w,v,g,y],P=n.apply(void 0,j);return i(e)&&o(P,j),P.placeholder=r,a(P,e,t)}var i=n(266),o=n(276),a=n(278),s=1,u=2,c=4,l=8,f=32,p=64;e.exports=r},function(e,t,n){function r(e){var t=a(e),n=s[t];if("function"!=typeof n||!(t in i.prototype))return!1;if(e===n)return!0;var r=o(n);return!!r&&e===r[0]}var i=n(267),o=n(269),a=n(271),s=n(273);e.exports=r},function(e,t,n){function r(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=a,this.__views__=[]}var i=n(236),o=n(268),a=4294967295;r.prototype=i(o.prototype),r.prototype.constructor=r,e.exports=r},function(e,t){function n(){}e.exports=n},function(e,t,n){var r=n(257),i=n(270),o=r?function(e){return r.get(e)}:i;e.exports=o},function(e,t){function n(){}e.exports=n},function(e,t,n){function r(e){for(var t=e.name+"",n=i[t],r=a.call(i,t)?n.length:0;r--;){var o=n[r],s=o.func;if(null==s||s==e)return o.name}return t}var i=n(272),o=Object.prototype,a=o.hasOwnProperty;e.exports=r},function(e,t){var n={};e.exports=n},function(e,t,n){function r(e){if(u(e)&&!s(e)&&!(e instanceof i)){if(e instanceof o)return e;if(f.call(e,"__wrapped__"))return c(e)}return new o(e)}var i=n(267),o=n(274),a=n(268),s=n(47),u=n(46),c=n(275),l=Object.prototype,f=l.hasOwnProperty;r.prototype=a.prototype,r.prototype.constructor=r,e.exports=r},function(e,t,n){function r(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}var i=n(236),o=n(268);r.prototype=i(o.prototype),r.prototype.constructor=r,e.exports=r},function(e,t,n){function r(e){if(e instanceof i)return e.clone();var t=new o(e.__wrapped__,e.__chain__);return t.__actions__=a(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var i=n(267),o=n(274),a=n(221);e.exports=r},function(e,t,n){var r=n(256),i=n(277),o=150,a=16,s=function(){var e=0,t=0;return function(n,s){var u=i(),c=a-(u-t);if(t=u,c>0){if(++e>=o)return n}else e=0;return r(n,s)}}();e.exports=s},function(e,t,n){var r=n(67),i=function(){return r.Date.now()};e.exports=i},function(e,t,n){var r=n(279),i=n(280),o=n(281),a=n(151),s=n(282),u=n(283),c=i?function(e,t,n){var a=t+"";return i(e,"toString",{configurable:!0,enumerable:!1,value:r(s(a,u(o(a),n)))})}:a;e.exports=c},function(e,t){function n(e){return function(){return e}}e.exports=n},function(e,t,n){var r=n(62),i=function(){var e=r(Object,"defineProperty"),t=r.name;return t&&t.length>2?e:void 0}();e.exports=i},function(e,t){function n(e){var t=e.match(r);return t?t[1].split(i):[]}var r=/\{\n\/\* \[wrapped with (.+)\] \*/,i=/,? & /;e.exports=n},function(e,t){function n(e,t){var n=t.length,i=n-1;return t[i]=(n>1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(r,"{\n/* [wrapped with "+t+"] */\n")}var r=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=n},function(e,t,n){function r(e,t){return i(m,function(n){var r="_."+n[0];t&n[1]&&!o(e,r)&&e.push(r)}),e.sort()}var i=n(156),o=n(92),a=1,s=2,u=8,c=16,l=32,f=64,p=128,d=256,h=512,m=[["ary",p],["bind",a],["bindKey",s],["curry",u],["curryRight",c],["flip",h],["partial",l],["partialRight",f],["rearg",d]];e.exports=r},function(e,t){function n(e){var t=e;return t.placeholder}e.exports=n},function(e,t,n){function r(e,t){for(var n=e.length,r=a(t.length,n),s=i(e);r--;){var u=t[r];e[r]=o(u,n)?s[u]:void 0}return e}var i=n(221),o=n(48),a=Math.min;e.exports=r},function(e,t){function n(e,t){for(var n=-1,i=e.length,o=0,a=[];++n<i;){var s=e[n];s!==t&&s!==r||(e[n]=r,a[o++]=n)}return a}var r="__lodash_placeholder__";e.exports=n},function(e,t,n){function r(e,t,n,r){function u(){for(var t=-1,o=arguments.length,s=-1,f=r.length,p=Array(f+o),d=this&&this!==a&&this instanceof u?l:e;++s<f;)p[s]=r[s];for(;o--;)p[s++]=arguments[++t];return i(d,c?n:this,p)}var c=t&s,l=o(e);return u}var i=n(100),o=n(259),a=n(67),s=1;e.exports=r},function(e,t,n){function r(e,t){var n=e[1],r=t[1],m=n|r,v=m<(u|c|p),g=r==p&&n==f||r==p&&n==d&&e[7].length<=t[8]||r==(p|d)&&t[7].length<=t[8]&&n==f;if(!v&&!g)return e;r&u&&(e[2]=t[2],m|=n&u?0:l);var y=t[3];if(y){var b=e[3];e[3]=b?i(b,y,t[4]):y,e[4]=b?a(e[3],s):t[4]}return y=t[5],y&&(b=e[5],e[5]=b?o(b,y,t[6]):y,e[6]=b?a(e[5],s):t[6]),y=t[7],y&&(e[7]=y),r&p&&(e[8]=null==e[8]?t[8]:h(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=m,e}var i=n(262),o=n(263),a=n(286),s="__lodash_placeholder__",u=1,c=2,l=4,f=8,p=128,d=256,h=Math.min;e.exports=r},function(e,t,n){var r=n(99),i=n(255),o=n(284),a=n(286),s=64,u=r(function(e,t){var n=a(t,o(u));return i(e,s,void 0,t,n)});u.placeholder={},e.exports=u},function(e,t,n){"use strict";var r=n(164),i=n(195),o=n(291);e.exports=function(e,t){return r(e,function(e,n){var r=n.split(":");if(t&&1===r.length){var a=i(t,function(e){return o(e,n[0])});a&&(r=a.split(":"))}return e[0].push(r[0]),e[1].push(r[1]),e},[[],[]])}},function(e,t,n){function r(e,t,n){return e=s(e),n=i(a(n),0,e.length),t=o(t),e.slice(n,n+t.length)==t}var i=n(292),o=n(144),a=n(184),s=n(143);e.exports=r},function(e,t){function n(e,t,n){return e===e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}e.exports=n},function(e,t,n){"use strict";function r(e){return function(t,n){var r=e.hierarchicalFacets[n],o=e.hierarchicalFacetsRefinements[r.name]&&e.hierarchicalFacetsRefinements[r.name][0]||"",a=e._getHierarchicalFacetSeparator(r),s=e._getHierarchicalRootPath(r),u=e._getHierarchicalShowParentLevel(r),l=h(e._getHierarchicalFacetSortBy(r)),f=i(l,a,s,u,o),p=t;return s&&(p=t.slice(s.split(a).length)),c(p,f,{name:e.hierarchicalFacets[n].name,count:null,isRefined:!0,path:null,data:null})}}function i(e,t,n,r,i){return function(s,c,f){var h=s;if(f>0){var m=0;for(h=s;m<f;)h=h&&p(h.data,{isRefined:!0}),m++}if(h){var v=o(h.path||n,i,t,n,r);h.data=l(u(d(c.data,v),a(t,i)),e[0],e[1])}return s}}function o(e,t,n,r,i){return function(o,a){return(!r||0===a.indexOf(r)&&r!==a)&&(!r&&a.indexOf(n)===-1||r&&a.split(n).length-r.split(n).length===1||a.indexOf(n)===-1&&t.indexOf(n)===-1||0===t.indexOf(a)||0===a.indexOf(e+n)&&(i||0===a.indexOf(t)))}}function a(e,t){return function(n,r){return{name:f(s(r.split(e))),path:r,count:n,isRefined:t===r||0===t.indexOf(r+e),data:null}}}e.exports=r;var s=n(294),u=n(162),c=n(164),l=n(249),f=n(198),p=n(195),d=n(295),h=n(290)},function(e,t){function n(e){var t=e?e.length:0;return t?e[t-1]:void 0}e.exports=n},function(e,t,n){function r(e,t){return null==e?{}:o(e,a(e),i(t))}var i=n(106),o=n(173),a=n(174);e.exports=r},function(e,t,n){"use strict";var r=n(155),i=n(162),o=n(164),a=n(214),s=n(47),u={_getQueries:function(e,t){var n=[];return n.push({indexName:e,params:u._getHitsSearchParams(t)}),r(t.getRefinedDisjunctiveFacets(),function(r){n.push({indexName:e,params:u._getDisjunctiveFacetSearchParams(t,r)})}),r(t.getRefinedHierarchicalFacets(),function(r){var i=t.getHierarchicalFacetByName(r),o=t.getHierarchicalRefinement(r),a=t._getHierarchicalFacetSeparator(i);o.length>0&&o[0].split(a).length>1&&n.push({indexName:e,params:u._getDisjunctiveFacetSearchParams(t,r,!0)})}),n},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(u._getHitsHierarchicalFacetsAttributes(e)),n=u._getFacetFilters(e),r=u._getNumericFilters(e),i=u._getTagFilters(e),o={facets:t,tagFilters:i};return n.length>0&&(o.facetFilters=n),r.length>0&&(o.numericFilters=r),a(e.getQueryParams(),o)},_getDisjunctiveFacetSearchParams:function(e,t,n){var r=u._getFacetFilters(e,t,n),i=u._getNumericFilters(e,t),o=u._getTagFilters(e),s={hitsPerPage:1,page:0,attributesToRetrieve:[],attributesToHighlight:[],attributesToSnippet:[],tagFilters:o},c=e.getHierarchicalFacetByName(t);return c?s.facets=u._getDisjunctiveHierarchicalFacetAttribute(e,c,n):s.facets=t,i.length>0&&(s.numericFilters=i),r.length>0&&(s.facetFilters=r),a(e.getQueryParams(),s)},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var n=[];return r(e.numericRefinements,function(e,o){r(e,function(e,a){t!==o&&r(e,function(e){if(s(e)){var t=i(e,function(e){return o+a+e});n.push(t)}else n.push(o+a+e)})})}),n},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,n){var i=[];return r(e.facetsRefinements,function(e,t){r(e,function(e){i.push(t+":"+e)})}),r(e.facetsExcludes,function(e,t){r(e,function(e){i.push(t+":-"+e)})}),r(e.disjunctiveFacetsRefinements,function(e,n){if(n!==t&&e&&0!==e.length){var o=[];r(e,function(e){o.push(n+":"+e)}),i.push(o)}}),r(e.hierarchicalFacetsRefinements,function(r,o){var a=r[0];if(void 0!==a){var s,u,c=e.getHierarchicalFacetByName(o),l=e._getHierarchicalFacetSeparator(c),f=e._getHierarchicalRootPath(c);if(t===o){if(a.indexOf(l)===-1||!f&&n===!0||f&&f.split(l).length===a.split(l).length)return;f?(u=f.split(l).length-1,a=f):(u=a.split(l).length-2,a=a.slice(0,a.lastIndexOf(l))),s=c.attributes[u]}else u=a.split(l).length-1,s=c.attributes[u];s&&i.push([s+":"+a])}}),i},_getHitsHierarchicalFacetsAttributes:function(e){var t=[];return o(e.hierarchicalFacets,function(t,n){var r=e.getHierarchicalRefinement(n.name)[0];if(!r)return t.push(n.attributes[0]),t;var i=e._getHierarchicalFacetSeparator(n),o=r.split(i).length,a=n.attributes.slice(0,o+1);return t.concat(a)},t)},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,n){var r=e._getHierarchicalFacetSeparator(t);if(n===!0){var i=e._getHierarchicalRootPath(t),o=0;return i&&(o=i.split(r).length),[t.attributes[o]]}var a=e.getHierarchicalRefinement(t.name)[0]||"",s=a.split(r).length-1;return t.attributes.slice(0,s+1)}};e.exports=u},function(e,t,n){(function(e,r){function i(e,n){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(n)?r.showHidden=n:n&&t._extend(r,n),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,n,r){if(e.customInspect&&n&&C(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return b(i)||(i=u(e,i,r)),i}var o=c(e,n);if(o)return o;var a=Object.keys(n),m=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),P(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(n);if(0===a.length){if(C(n)){var v=n.name?": "+n.name:"";return e.stylize("[Function"+v+"]","special")}if(x(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(j(n))return e.stylize(Date.prototype.toString.call(n),"date");if(P(n))return l(n)}var g="",y=!1,_=["{","}"];if(h(n)&&(y=!0,_=["[","]"]),C(n)){var w=n.name?": "+n.name:"";g=" [Function"+w+"]"}if(x(n)&&(g=" "+RegExp.prototype.toString.call(n)),j(n)&&(g=" "+Date.prototype.toUTCString.call(n)),P(n)&&(g=" "+l(n)),0===a.length&&(!y||0==n.length))return _[0]+g+_[1];if(r<0)return x(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var R;return R=y?f(e,n,r,m,a):a.map(function(t){return p(e,n,r,m,t,y)}),e.seen.pop(),d(R,g,_)}function c(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return y(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)k(t,String(a))?o.push(p(e,t,n,r,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(p(e,t,n,r,i,!0))}),o}function p(e,t,n,r,i,o){var a,s,c;if(c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},c.get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),k(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=v(n)?u(e,c.value,null):u(e,c.value,n-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function h(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function v(e){return null===e}function g(e){return null==e}function y(e){return"number"==typeof e}function b(e){return"string"==typeof e}function _(e){return"symbol"==typeof e}function w(e){return void 0===e}function x(e){return R(e)&&"[object RegExp]"===S(e)}function R(e){return"object"==typeof e&&null!==e}function j(e){return R(e)&&"[object Date]"===S(e)}function P(e){return R(e)&&("[object Error]"===S(e)||e instanceof Error)}function C(e){return"function"==typeof e}function O(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function S(e){return Object.prototype.toString.call(e)}function E(e){return e<10?"0"+e.toString(10):e.toString(10)}function F(){var e=new Date,t=[E(e.getHours()),E(e.getMinutes()),E(e.getSeconds())].join(":");return[e.getDate(),M[e.getMonth()],t].join(" ")}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var N=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(i(arguments[n]));return t.join(" ")}for(var n=1,r=arguments,o=r.length,a=String(e).replace(N,function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),s=r[n];n<o;s=r[++n])a+=v(s)||!R(s)?" "+s:" "+i(s);return a},t.deprecate=function(n,i){function o(){if(!a){if(r.throwDeprecation)throw new Error(i);r.traceDeprecation?console.trace(i):console.error(i),a=!0}return n.apply(this,arguments)}if(w(e.process))return function(){return t.deprecate(n,i).apply(this,arguments)};if(r.noDeprecation===!0)return n;var a=!1;return o};var T,A={};t.debuglog=function(e){if(w(T)&&(T={NODE_ENV:"production"}.NODE_DEBUG||""),e=e.toUpperCase(),!A[e])if(new RegExp("\\b"+e+"\\b","i").test(T)){var n=r.pid;A[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else A[e]=function(){};return A[e]},t.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=h,t.isBoolean=m,t.isNull=v,t.isNullOrUndefined=g,t.isNumber=y,t.isString=b,t.isSymbol=_,t.isUndefined=w,t.isRegExp=x,t.isObject=R,t.isDate=j,t.isError=P,t.isFunction=C,t.isPrimitive=O,t.isBuffer=n(298);var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];t.log=function(){console.log("%s - %s",F(),t.format.apply(t,arguments))},t.inherits=n(299),t._extend=function(e,t){if(!t||!R(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(t,function(){return this}(),n(24))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,s,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(o(n))for(s=Array.prototype.slice.call(arguments,1),c=n.slice(),i=c.length,u=0;u<i;u++)c[u].apply(this,s);return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(i=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[e].length>i&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){i=s;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;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(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){var r=n(99),i=n(255),o=n(284),a=n(286),s=1,u=32,c=r(function(e,t,n){var r=s;if(n.length){var l=a(n,o(c));r|=u}return i(e,r,t,n,l)});c.placeholder={},e.exports=c},function(e,t,n){"use strict";function r(e){return m(e)?d(e,r):v(e)?f(e,r):h(e)?y(e):e}function i(e,t,n,r){if(null!==e&&(n=n.replace(e,""),r=r.replace(e,"")),n=t[n]||n,r=t[r]||r,_.indexOf(n)!==-1||_.indexOf(r)!==-1){
if("q"===n)return-1;if("q"===r)return 1;var i=b.indexOf(n)!==-1,o=b.indexOf(r)!==-1;if(i&&!o)return 1;if(o&&!i)return-1}return n.localeCompare(r)}var o=n(303),a=n(36),s=n(307),u=n(301),c=n(155),l=n(311),f=n(162),p=n(312),d=n(313),h=n(194),m=n(237),v=n(47),g=n(304),y=n(309).encode,b=["dFR","fR","nR","hFR","tR"],_=o.ENCODED_PARAMETERS;t.getStateFromQueryString=function(e,t){var n=t&&t.prefix||"",r=t&&t.mapping||{},i=g(r),u=s.parse(e),c=new RegExp("^"+n),f=p(u,function(e,t){var r=n&&c.test(t),a=r?t.replace(c,""):t,s=o.decode(i[a]||a);return s||a}),d=a._parseNumbers(f);return l(d,a.PARAMETERS)},t.getUnrecognizedParametersInQueryString=function(e,t){var n=t&&t.prefix,r=t&&t.mapping||{},i=g(r),a={},u=s.parse(e);if(n){var l=new RegExp("^"+n);c(u,function(e,t){l.test(t)||(a[t]=e)})}else c(u,function(e,t){o.decode(i[t]||t)||(a[t]=e)});return a},t.getQueryStringFromState=function(e,t){var n=t&&t.moreAttributes,a=t&&t.prefix||"",c=t&&t.mapping||{},l=t&&t.safe||!1,f=g(c),d=l?e:r(e),h=p(d,function(e,t){var n=o.encode(t);return a+(c[n]||n)}),m=""===a?null:new RegExp("^"+a),v=u(i,null,m,f);if(n){var y=s.stringify(h,{encode:l,sort:v}),b=s.stringify(n,{encode:l});return y?y+"&"+b:b}return s.stringify(h,{encode:l,sort:v})}},function(e,t,n){"use strict";var r=n(304),i=n(37),o={advancedSyntax:"aS",allowTyposOnNumericTokens:"aTONT",analyticsTags:"aT",analytics:"a",aroundLatLngViaIP:"aLLVIP",aroundLatLng:"aLL",aroundPrecision:"aP",aroundRadius:"aR",attributesToHighlight:"aTH",attributesToRetrieve:"aTR",attributesToSnippet:"aTS",disjunctiveFacetsRefinements:"dFR",disjunctiveFacets:"dF",distinct:"d",facetsExcludes:"fE",facetsRefinements:"fR",facets:"f",getRankingInfo:"gRI",hierarchicalFacetsRefinements:"hFR",hierarchicalFacets:"hF",highlightPostTag:"hPoT",highlightPreTag:"hPrT",hitsPerPage:"hPP",ignorePlurals:"iP",index:"idx",insideBoundingBox:"iBB",insidePolygon:"iPg",length:"l",maxValuesPerFacet:"mVPF",minimumAroundRadius:"mAR",minProximity:"mP",minWordSizefor1Typo:"mWS1T",minWordSizefor2Typos:"mWS2T",numericFilters:"nF",numericRefinements:"nR",offset:"o",optionalWords:"oW",page:"p",queryType:"qT",query:"q",removeWordsIfNoResults:"rWINR",replaceSynonymsInHighlight:"rSIH",restrictSearchableAttributes:"rSA",synonyms:"s",tagFilters:"tF",tagRefinements:"tR",typoTolerance:"tT",optionalTagFilters:"oTF",optionalFacetFilters:"oFF",snippetEllipsisText:"sET",disableExactOnAttributes:"dEOA",enableExactOnSingleWordQuery:"eEOSWQ"},a=r(o);e.exports={ENCODED_PARAMETERS:i(a),decode:function(e){return a[e]},encode:function(e){return o[e]}}},function(e,t,n){var r=n(279),i=n(305),o=n(151),a=i(function(e,t,n){e[t]=n},r(o));e.exports=a},function(e,t,n){function r(e,t){return function(n,r){return i(n,e,t(r),{})}}var i=n(306);e.exports=r},function(e,t,n){function r(e,t,n,r){return i(e,function(e,i,o){t(r,n(e),i,o)}),r}var i=n(103);e.exports=r},function(e,t,n){"use strict";var r=n(308),i=n(310);e.exports={stringify:r,parse:i}},function(e,t,n){"use strict";var r=n(309),i={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},o={delimiter:"&",strictNullHandling:!1,skipNulls:!1,encode:!0,encoder:r.encode},a=function e(t,n,i,o,a,s,u,c,l){var f=t;if("function"==typeof u)f=u(n,f);else if(f instanceof Date)f=f.toISOString();else if(null===f){if(o)return s?s(n):n;f=""}if("string"==typeof f||"number"==typeof f||"boolean"==typeof f||r.isBuffer(f))return s?[s(n)+"="+s(f)]:[n+"="+String(f)];var p=[];if("undefined"==typeof f)return p;var d;if(Array.isArray(u))d=u;else{var h=Object.keys(f);d=c?h.sort(c):h}for(var m=0;m<d.length;++m){var v=d[m];a&&null===f[v]||(p=Array.isArray(f)?p.concat(e(f[v],i(n,v),i,o,a,s,u,c,l)):p.concat(e(f[v],n+(l?"."+v:"["+v+"]"),i,o,a,s,u,c,l)))}return p};e.exports=function(e,t){var n,r,s=e,u=t||{},c="undefined"==typeof u.delimiter?o.delimiter:u.delimiter,l="boolean"==typeof u.strictNullHandling?u.strictNullHandling:o.strictNullHandling,f="boolean"==typeof u.skipNulls?u.skipNulls:o.skipNulls,p="boolean"==typeof u.encode?u.encode:o.encode,d=p?"function"==typeof u.encoder?u.encoder:o.encoder:null,h="function"==typeof u.sort?u.sort:null,m="undefined"!=typeof u.allowDots&&u.allowDots;if(null!==u.encoder&&void 0!==u.encoder&&"function"!=typeof u.encoder)throw new TypeError("Encoder has to be a function.");"function"==typeof u.filter?(r=u.filter,s=r("",s)):Array.isArray(u.filter)&&(n=r=u.filter);var v=[];if("object"!=typeof s||null===s)return"";var g;g=u.arrayFormat in i?u.arrayFormat:"indices"in u?u.indices?"indices":"repeat":"indices";var y=i[g];n||(n=Object.keys(s)),h&&n.sort(h);for(var b=0;b<n.length;++b){var _=n[b];f&&null===s[_]||(v=v.concat(a(s[_],_,y,l,f,d,r,h,m)))}return v.join(c)}},function(e,t){"use strict";var n=function(){for(var e=new Array(256),t=0;t<256;++t)e[t]="%"+((t<16?"0":"")+t.toString(16)).toUpperCase();return e}();t.arrayToObject=function(e,t){for(var n=t.plainObjects?Object.create(null):{},r=0;r<e.length;++r)"undefined"!=typeof e[r]&&(n[r]=e[r]);return n},t.merge=function(e,n,r){if(!n)return e;if("object"!=typeof n){if(Array.isArray(e))e.push(n);else{if("object"!=typeof e)return[e,n];e[n]=!0}return e}if("object"!=typeof e)return[e].concat(n);var i=e;return Array.isArray(e)&&!Array.isArray(n)&&(i=t.arrayToObject(e,r)),Object.keys(n).reduce(function(e,i){var o=n[i];return Object.prototype.hasOwnProperty.call(e,i)?e[i]=t.merge(e[i],o,r):e[i]=o,e},i)},t.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},t.encode=function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),r="",i=0;i<t.length;++i){var o=t.charCodeAt(i);45===o||46===o||95===o||126===o||o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122?r+=t.charAt(i):o<128?r+=n[o]:o<2048?r+=n[192|o>>6]+n[128|63&o]:o<55296||o>=57344?r+=n[224|o>>12]+n[128|o>>6&63]+n[128|63&o]:(i+=1,o=65536+((1023&o)<<10|1023&t.charCodeAt(i)),r+=n[240|o>>18]+n[128|o>>12&63]+n[128|o>>6&63]+n[128|63&o])}return r},t.compact=function(e,n){if("object"!=typeof e||null===e)return e;var r=n||[],i=r.indexOf(e);if(i!==-1)return r[i];if(r.push(e),Array.isArray(e)){for(var o=[],a=0;a<e.length;++a)e[a]&&"object"==typeof e[a]?o.push(t.compact(e[a],r)):"undefined"!=typeof e[a]&&o.push(e[a]);return o}for(var s=Object.keys(e),u=0;u<s.length;++u){var c=s[u];e[c]=t.compact(e[c],r)}return e},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.isBuffer=function(e){return null!==e&&"undefined"!=typeof e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},function(e,t,n){"use strict";var r=n(309),i=Object.prototype.hasOwnProperty,o={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1,decoder:r.decode},a=function(e,t){for(var n={},r=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),o=0;o<r.length;++o){var a,s,u=r[o],c=u.indexOf("]=")===-1?u.indexOf("="):u.indexOf("]=")+1;c===-1?(a=t.decoder(u),s=t.strictNullHandling?null:""):(a=t.decoder(u.slice(0,c)),s=t.decoder(u.slice(c+1))),i.call(n,a)?n[a]=[].concat(n[a]).concat(s):n[a]=s}return n},s=function e(t,n,r){if(!t.length)return n;var i,o=t.shift();if("[]"===o)i=[],i=i.concat(e(t,n,r));else{i=r.plainObjects?Object.create(null):{};var a="["===o[0]&&"]"===o[o.length-1]?o.slice(1,o.length-1):o,s=parseInt(a,10);!isNaN(s)&&o!==a&&String(s)===a&&s>=0&&r.parseArrays&&s<=r.arrayLimit?(i=[],i[s]=e(t,n,r)):i[a]=e(t,n,r)}return i},u=function(e,t,n){if(e){var r=n.allowDots?e.replace(/\.([^\.\[]+)/g,"[$1]"):e,o=/^([^\[\]]*)/,a=/(\[[^\[\]]*\])/g,u=o.exec(r),c=[];if(u[1]){if(!n.plainObjects&&i.call(Object.prototype,u[1])&&!n.allowPrototypes)return;c.push(u[1])}for(var l=0;null!==(u=a.exec(r))&&l<n.depth;)l+=1,(n.plainObjects||!i.call(Object.prototype,u[1].replace(/\[|\]/g,""))||n.allowPrototypes)&&c.push(u[1]);return u&&c.push("["+r.slice(u.index)+"]"),s(c,t,n)}};e.exports=function(e,t){var n=t||{};if(null!==n.decoder&&void 0!==n.decoder&&"function"!=typeof n.decoder)throw new TypeError("Decoder has to be a function.");if(n.delimiter="string"==typeof n.delimiter||r.isRegExp(n.delimiter)?n.delimiter:o.delimiter,n.depth="number"==typeof n.depth?n.depth:o.depth,n.arrayLimit="number"==typeof n.arrayLimit?n.arrayLimit:o.arrayLimit,n.parseArrays=n.parseArrays!==!1,n.decoder="function"==typeof n.decoder?n.decoder:o.decoder,n.allowDots="boolean"==typeof n.allowDots?n.allowDots:o.allowDots,n.plainObjects="boolean"==typeof n.plainObjects?n.plainObjects:o.plainObjects,n.allowPrototypes="boolean"==typeof n.allowPrototypes?n.allowPrototypes:o.allowPrototypes,n.parameterLimit="number"==typeof n.parameterLimit?n.parameterLimit:o.parameterLimit,n.strictNullHandling="boolean"==typeof n.strictNullHandling?n.strictNullHandling:o.strictNullHandling,""===e||null===e||"undefined"==typeof e)return n.plainObjects?Object.create(null):{};for(var i="string"==typeof e?a(e,n):e,s=n.plainObjects?Object.create(null):{},c=Object.keys(i),l=0;l<c.length;++l){var f=c[l],p=u(f,i[f],n);s=r.merge(s,p,n)}return r.compact(s)}},function(e,t,n){var r=n(54),i=n(169),o=n(172),a=n(99),s=n(147),u=a(function(e,t){return null==e?{}:o(e,r(i(t,1),s))});e.exports=u},function(e,t,n){function r(e,t){var n={};return t=o(t,3),i(e,function(e,r,i){n[t(e,r,i)]=e}),n}var i=n(103),o=n(106);e.exports=r},function(e,t,n){function r(e,t){var n={};return t=o(t,3),i(e,function(e,r,i){n[r]=t(e,r,i)}),n}var i=n(103),o=n(106);e.exports=r},function(e,t){"use strict";e.exports="2.14.0"},function(e,t,n){var r=n(215),i=n(212),o=i(function(e,t,n,i){r(e,t,n,i)});e.exports=o},function(e,t,n){var r=n(169),i=n(99),o=n(317),a=n(41),s=i(function(e){return o(r(e,1,a,!0))});e.exports=s},function(e,t,n){function r(e,t,n){var r=-1,f=o,p=e.length,d=!0,h=[],m=h;if(n)d=!1,f=a;else if(p>=l){var v=t?null:u(e);if(v)return c(v);d=!1,f=s,m=new i}else m=t?[]:h;e:for(;++r<p;){var g=e[r],y=t?t(g):g;if(g=n||0!==g?g:0,d&&y===y){for(var b=m.length;b--;)if(m[b]===y)continue e;t&&m.push(y),h.push(g)}else f(m,y,n)||(m!==h&&m.push(y),h.push(g))}return h}var i=n(56),o=n(92),a=n(96),s=n(98),u=n(318),c=n(123),l=200;e.exports=r},function(e,t,n){var r=n(128),i=n(270),o=n(123),a=1/0,s=r&&1/o(new r([,-0]))[1]==a?function(e){return new r(e)}:i;e.exports=s},function(e,t,n){function r(e){return i(e,!1,!0)}var i=n(218);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){var t=e;return function(){var e=Date.now(),n=e-t;return t=e,n}}function a(e){return s()+window.location.pathname+e}function s(){return window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}function u(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.useHash||!1,n=t?R:j;return new P(n,e)}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(34),f=r(l),p=n(321),d=r(p),h=n(302),m=r(h),v=n(192),g=r(v),y=n(322),b=r(y),_=f.default.AlgoliaSearchHelper,w=d.default.split(".")[0],x=!0,R={character:"#",onpopstate:function(e){window.addEventListener("hashchange",e)},pushState:function(e){window.location.assign(a(this.createURL(e)))},replaceState:function(e){window.location.replace(a(this.createURL(e)))},createURL:function(e){return window.location.search+this.character+e},readUrl:function(){return window.location.hash.slice(1)}},j={character:"?",onpopstate:function(e){window.addEventListener("popstate",e)},pushState:function(e,t){var n=t.getHistoryState;window.history.pushState(n(),"",a(this.createURL(e)))},replaceState:function(e,t){var n=t.getHistoryState;window.history.replaceState(n(),"",a(this.createURL(e)))},createURL:function(e){return this.character+e+document.location.hash},readUrl:function(){return window.location.search.slice(1)}},P=function(){function e(t,n){i(this,e),this.urlUtils=t,this.originalConfig=null,this.timer=o(Date.now()),this.mapping=n.mapping||{},this.getHistoryState=n.getHistoryState||function(){return null},this.threshold=n.threshold||700,this.trackedParameters=n.trackedParameters||["query","attribute:*","index","page","hitsPerPage"],this.searchParametersFromUrl=_.getConfigurationFromQueryString(this.urlUtils.readUrl(),{mapping:this.mapping})}return c(e,[{key:"getConfiguration",value:function(e){return this.originalConfig=(0,f.default)({},e.index,e).state,this.searchParametersFromUrl}},{key:"render",value:function(e){var t=this,n=e.helper;x&&(x=!1,this.onHistoryChange(this.onPopState.bind(this,n)),n.on("change",function(e){return t.renderURLFromState(e)}))}},{key:"onPopState",value:function(e,t){var n=e.getState(this.trackedParameters),r=(0,b.default)({},this.originalConfig,n);(0,g.default)(r,t)||e.overrideStateWithoutTriggeringChangeEvent(t).search()}},{key:"renderURLFromState",value:function(e){var t=this.urlUtils.readUrl(),n=_.getForeignConfigurationInQueryString(t,{mapping:this.mapping});n.is_v=w;var r=m.default.getQueryStringFromState(e.filter(this.trackedParameters),{moreAttributes:n,mapping:this.mapping,safe:!0});this.timer()<this.threshold?this.urlUtils.replaceState(r,{getHistoryState:this.getHistoryState}):this.urlUtils.pushState(r,{getHistoryState:this.getHistoryState})}},{key:"createURL",value:function(e,t){var n=t.absolute,r=this.urlUtils.readUrl(),i=e.filter(this.trackedParameters),o=f.default.url.getUnrecognizedParametersInQueryString(r,{mapping:this.mapping});o.is_v=w;var s=this.urlUtils.createURL(f.default.url.getQueryStringFromState(i,{mapping:this.mapping}));return n?a(s):s}},{key:"onHistoryChange",value:function(e){var t=this;this.urlUtils.onpopstate(function(){var n=t.urlUtils.readUrl(),r=_.getConfigurationFromQueryString(n,{mapping:t.mapping}),i=(0,b.default)({},t.originalConfig,r);e(i)})}}]),e}();t.default=u},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default="1.8.6"},function(e,t,n){var r=n(211),i=n(210),o=n(212),a=n(42),s=n(50),u=n(37),c=Object.prototype,l=c.hasOwnProperty,f=c.propertyIsEnumerable,p=!f.call({valueOf:1},"valueOf"),d=o(function(e,t){if(p||s(t)||a(t))return void i(t,u(t),e);for(var n in t)l.call(t,n)&&r(e,n,t[n])});e.exports=d},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.numberLocale;return{formatNumber:function(e,n){return Number(n(e)).toLocaleString(t)}}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.templates,r=void 0===n?g.default:n,i=e.cssClasses,o=void 0===i?{}:i,s=e.collapsible,l=void 0!==s&&s,p=e.autoHideContainer,h=void 0===p||p,v=e.excludeAttributes,y=void 0===v?[]:v;if(!t)throw new Error(w);var x=(0,c.getContainerNode)(t),R=(0,m.default)(b.default);h===!0&&(R=(0,d.default)(R));var j={root:(0,f.default)(_(null),o.root),header:(0,f.default)(_("header"),o.header),body:(0,f.default)(_("body"),o.body),footer:(0,f.default)(_("footer"),o.footer),link:(0,f.default)(_("link"),o.link)};return{init:function(e){var t=e.helper,n=e.templatesConfig;this.clearAll=this.clearAll.bind(this,t),this._templateProps=(0,c.prepareTemplateProps)({defaultTemplates:g.default,templatesConfig:n,templates:r})},render:function(e){var t=e.results,n=e.state,r=e.createURL;this.clearAttributes=(0,c.getRefinements)(t,n).map(function(e){return e.attributeName}).filter(function(e){return y.indexOf(e)===-1});var i=0!==this.clearAttributes.length,o=r((0,c.clearRefinementsFromState)(n));u.default.render(a.default.createElement(R,{clearAll:this.clearAll,collapsible:l,cssClasses:j,hasRefinements:i,shouldAutoHideContainer:!i,templateProps:this._templateProps,url:o}),x)},clearAll:function(e){this.clearAttributes.length>0&&(0,c.clearRefinementsAndSearch)(e,this.clearAttributes)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(330),f=r(l),p=n(331),d=r(p),h=n(332),m=r(h),v=n(339),g=r(v),y=n(340),b=r(y),_=(0,c.bemHelper)("ais-clear-all"),w="Usage:\nclearAll({\n container,\n [ cssClasses.{root,header,body,footer,link}={} ],\n [ templates.{header,link,footer}={link: 'Clear all'} ],\n [ autoHideContainer=true ],\n [ collapsible=false ],\n [ excludeAttributes=[] ]\n})";t.default=i},function(e,t,n){(function(t){!function(t,r){e.exports=r(n(326),n(327))}(this,function(e,n){function r(e,t,r){var i=t._preactCompatRendered;i&&i.parentNode!==t&&(i=null),i||(i=t.children[0]);for(var o=t.childNodes.length;o--;)t.childNodes[o]!==i&&t.removeChild(t.childNodes[o]);var a=n.render(e,t,i);return t._preactCompatRendered=a,"function"==typeof r&&r(),a&&a._component||a.base}function i(e,t,i,o){var a=n.h(I,{context:e.context},t),s=r(a,i);return o&&o(s),s}function o(e){var t=e._preactCompatRendered;return!(!t||t.parentNode!==e)&&(n.render(n.h(L),e,t),!0)}function a(e){return f.bind(null,e)}function s(e,t){for(var n=t||0;n<e.length;n++){var r=e[n];Array.isArray(r)?s(r):r&&"object"==typeof r&&!h(r)&&(r.props&&r.type||r.attributes&&r.nodeName||r.children)&&(e[n]=f(r.type||r.nodeName,r.props||r.attributes,r.children))}}function u(e){return"function"==typeof e&&!(e.prototype&&e.prototype.render)}function c(e){return function(t,n){return O.call(e,t,n),e(t,n)}}function l(e){var t=e[W];return t?t===!0?e:t:(t=c(e),Object.defineProperty(t,W,{configurable:!0,value:!0}),t.displayName=e.displayName,t.propTypes=e.propTypes,t.defaultProps=e.defaultProps,Object.defineProperty(e,W,{configurable:!0,value:t}),t)}function f(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return s(e,2),p(n.h.apply(void 0,e))}function p(e){g(e),u(e.nodeName)&&(e.nodeName=l(e.nodeName));var t=e.attributes&&e.attributes.ref,n=t&&typeof t;return!V||"string"!==n&&"number"!==n||(e.attributes.ref=m(t,V)),v(e),e}function d(e,t){for(var r=[],i=arguments.length-2;i-- >0;)r[i]=arguments[i+2];var o=n.h(e.nodeName||e.type,e.attributes||e.props,e.children||e.props.children);return p(n.cloneElement.apply(void 0,[o,t].concat(r)))}function h(e){return e&&(e instanceof U||e.$$typeof===T)}function m(e,t){return t._refProxies[e]||(t._refProxies[e]=function(n){t&&t.refs&&(t.refs[e]=n,null===n&&(delete t._refProxies[e],t=null))})}function v(e){var t=e.nodeName,n=e.attributes;if(n&&"string"==typeof t){var r={};for(var i in n)r[i.toLowerCase()]=i;if(r.onchange){t=t.toLowerCase();var o="select"===t?"onchange":"oninput";"input"===t&&"checkbox"===String(n.type).toLowerCase()&&(o="onclick"),n[r[o]||o]=P(n[r[o]],n[r.onchange])}}}function g(e){var t=e.attributes;if(t){var n=t.className||t.class;n&&(t.className=n)}}function y(e,t,n){for(var r in t)n!==!0&&null==t[r]||(e[r]=t[r]);return e}function b(){}function _(e){function t(t,r){y(this,e),n&&x(this,n),F.call(this,t,r,M),R(this),C.call(this,t,r)}var n=e.mixins&&w(e.mixins);return e.statics&&y(t,e.statics),e.propTypes&&(t.propTypes=e.propTypes),e.defaultProps&&(t.defaultProps=e.defaultProps),e.getDefaultProps&&(t.defaultProps=e.getDefaultProps()),b.prototype=F.prototype,t.prototype=new b,t.prototype.constructor=t,t.displayName=e.displayName||"Component",t}function w(e){for(var t={},n=0;n<e.length;n++){var r=e[n];for(var i in r)r.hasOwnProperty(i)&&"function"==typeof r[i]&&(t[i]||(t[i]=[])).push(r[i])}return t}function x(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=P.apply(void 0,t[n].concat(e[n]||n)))}function R(e){for(var t in e){var n=e[t];"function"!=typeof n||n.__bound||A.hasOwnProperty(t)||((e[t]=n.bind(e)).__bound=!0)}}function j(e,t,n){if("string"==typeof t&&(t=e.constructor.prototype[t]),"function"==typeof t)return t.apply(e,n)}function P(){var e=arguments;return function(){for(var t,n=arguments,r=this,i=0;i<e.length;i++){var o=j(r,e[i],n);void 0!==o&&(t=o)}return t}}function C(e,t){O.call(this,e,t),this.componentWillReceiveProps=P(this.componentWillReceiveProps||"componentWillReceiveProps",O),this.render=P(S,this.render||"render",E)}function O(e,t){var n=this;if(e){var r=e.children;if(r&&1===r.length&&(e.children=r[0],e.children&&"object"==typeof e.children&&(e.children.length=1,e.children[0]=e.children)),H){var i="function"==typeof this?this:this.constructor,o=this.propTypes||i.propTypes;if(o)for(var a in o)if(o.hasOwnProperty(a)&&"function"==typeof o[a]){var s=n.displayName||i.name,u=o[a](e,a,s,"prop");u&&console.error(new Error(u.message||u))}}}}function S(){V=this}function E(){V===this&&(V=null)}function F(e,t,r){n.Component.call(this,e,t),this.refs={},this._refProxies={},r!==M&&C.call(this,e,t)}e="default"in e?e.default:e;var k="15.1.0",N="a abbr address area article aside audio b base bdi bdo big blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd keygen label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt ruby s samp script section select small source span strong style sub summary sup table tbody td textarea tfoot th thead time title tr track u ul var video wbr circle clipPath defs ellipse g image line linearGradient mask path pattern polygon polyline radialGradient rect stop svg text tspan".split(" "),T="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,A={constructor:1,render:1,shouldComponentUpdate:1,componentWillReceiveProps:1,componentWillUpdate:1,componentDidUpdate:1,componentWillMount:1,componentDidMount:1,componentWillUnmount:1,componentDidUnmount:1},M={},H="undefined"!=typeof t&&{NODE_ENV:"production"}&&!1,L=function(){return null},U=n.h("").constructor;U.prototype.$$typeof=T,Object.defineProperty(U.prototype,"type",{get:function(){return this.nodeName},set:function(e){this.nodeName=e},configurable:!0}),Object.defineProperty(U.prototype,"props",{get:function(){return this.attributes},set:function(e){this.attributes=e},configurable:!0});var D=n.options.vnode||L;n.options.vnode=function(e){var t=e.attributes;t||(t=e.attributes={}),Object.isExtensible&&!Object.isExtensible(t)&&(t=y({},t,!0)),t.children=e.children,D(e)};var I=function(){};I.prototype.getChildContext=function(){return this.props.context},I.prototype.render=function(e){return e.children[0]};for(var V,q=[],B={map:function(e,t,n){return e=B.toArray(e),n&&n!==e&&(t=t.bind(n)),e.map(t)},forEach:function(e,t,n){e=B.toArray(e),n&&n!==e&&(t=t.bind(n)),e.forEach(t)},count:function(e){return e=B.toArray(e),e.length},only:function(e){if(e=B.toArray(e),1!==e.length)throw new Error("Children.only() expects only one child.");return e[0]},toArray:function(e){return Array.isArray&&Array.isArray(e)?e:q.concat(e)}},Q={},z=N.length;z--;)Q[N[z]]=a(N[z]);var W="undefined"!=typeof Symbol?Symbol.for("__preactCompatWrapper"):"__preactCompatWrapper",K=function(e){return e&&e.base||e};F.prototype=new n.Component,y(F.prototype,{constructor:F,isReactComponent:{},getDOMNode:function(){return this.base},isMounted:function(){return!!this.base}});var $={version:k,DOM:Q,PropTypes:e,Children:B,render:r,createClass:_,createFactory:a,createElement:f,cloneElement:d,isValidElement:h,findDOMNode:K,unmountComponentAtNode:o,Component:F,unstable_renderSubtreeIntoContainer:i};return $})}).call(t,n(24))},function(e,t,n){var r,i,o;!function(n,a){i=[t,e],r=a,o="function"==typeof r?r.apply(t,i):r,!(void 0!==o&&(e.exports=o))}(this,function(e,t){"use strict";function n(e){var t=e&&(x&&e[x]||e[R]);if("function"==typeof t)return t}function r(e){function t(t,n,r,i,o,a){if(i=i||j,a=a||r,null==n[r]){var s=_[o];return t?new Error("Required "+s+" `"+a+"` was not specified in "+("`"+i+"`.")):null}return e(n,r,i,o,a)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function i(e){function t(t,n,r,i,o){var a=t[n],s=m(a);if(s!==e){var u=_[i],c=v(a);return new Error("Invalid "+u+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return r(t)}function o(){return r(w.thatReturns(null))}function a(e){function t(t,n,r,i,o){var a=t[n];if(!Array.isArray(a)){var s=_[i],u=m(a);return new Error("Invalid "+s+" `"+o+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an array."))}for(var c=0;c<a.length;c++){var l=e(a,c,r,i,o+"["+c+"]");if(l instanceof Error)return l}return null}return r(t)}function s(){function e(e,t,n,r,i){if(!b.isValidElement(e[t])){var o=_[r];return new Error("Invalid "+o+" `"+i+"` supplied to "+("`"+n+"`, expected a single ReactElement."))}return null}return r(e)}function u(e){function t(t,n,r,i,o){if(!(t[n]instanceof e)){var a=_[i],s=e.name||j,u=g(t[n]);return new Error("Invalid "+a+" `"+o+"` of type "+("`"+u+"` supplied to `"+r+"`, expected ")+("instance of `"+s+"`."))}return null}return r(t)}function c(e){function t(t,n,r,i,o){for(var a=t[n],s=0;s<e.length;s++)if(a===e[s])return null;var u=_[i],c=JSON.stringify(e);return new Error("Invalid "+u+" `"+o+"` of value `"+a+"` "+("supplied to `"+r+"`, expected one of "+c+"."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOf, expected an instance of array.")})}function l(e){function t(t,n,r,i,o){var a=t[n],s=m(a);if("object"!==s){var u=_[i];return new Error("Invalid "+u+" `"+o+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an object."))}for(var c in a)if(a.hasOwnProperty(c)){var l=e(a,c,r,i,o+"."+c);if(l instanceof Error)return l}return null}return r(t)}function f(e){function t(t,n,r,i,o){for(var a=0;a<e.length;a++){var s=e[a];if(null==s(t,n,r,i,o))return null}var u=_[i];return new Error("Invalid "+u+" `"+o+"` supplied to "+("`"+r+"`."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOfType, expected an instance of array.")})}function p(){function e(e,t,n,r,i){if(!h(e[t])){var o=_[r];return new Error("Invalid "+o+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return r(e)}function d(e){function t(t,n,r,i,o){var a=t[n],s=m(a);if("object"!==s){var u=_[i];return new Error("Invalid "+u+" `"+o+"` of type `"+s+"` "+("supplied to `"+r+"`, expected `object`."))}for(var c in e){var l=e[c];if(l){var f=l(a,c,r,i,o+"."+c);if(f)return f}}return null}return r(t)}function h(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(h);if(null===e||b.isValidElement(e))return!0;var t=n(e);if(!t)return!1;var r,i=t.call(e);if(t!==e.entries){for(;!(r=i.next()).done;)if(!h(r.value))return!1}else for(;!(r=i.next()).done;){var o=r.value;if(o&&!h(o[1]))return!1}return!0;default:return!1}}function m(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function v(e){var t=m(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function g(e){return e.constructor&&e.constructor.name?e.constructor.name:j}var y="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,b={};b.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===y};var _={prop:"prop",context:"context",childContext:"child context"},w={thatReturns:function(e){return function(){return e}}},x="function"==typeof Symbol&&Symbol.iterator,R="@@iterator",j="<<anonymous>>",P={array:i("array"),bool:i("boolean"),func:i("function"),number:i("number"),object:i("object"),string:i("string"),any:o(),arrayOf:a,element:s(),instanceOf:u,node:p(),objectOf:l,oneOf:c,oneOfType:f,shape:d};t.exports=P})},function(e,t,n){!function(e,n){n(t)}(this,function(e){function t(e,t,n){this.nodeName=e,this.attributes=t,this.children=n,this.key=t&&t.key}function n(e,t){if(t)for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}function r(e){return n({},e)}function i(e,t){for(var n=t.split("."),r=0;r<n.length&&e;r++)e=e[n[r]];return e}function o(e,t){return[].slice.call(e,t)}function a(e){return"function"==typeof e}function s(e){return"string"==typeof e}function u(e){return void 0===e||null===e}function c(e){return e===!1||u(e)}function l(e){var t="";for(var n in e)e[n]&&(t&&(t+=" "),t+=n);return t}function f(e,n,r){var i,o,u,p=arguments.length;if(p>2){var d=typeof r;if(3===p&&"object"!==d&&"function"!==d)c(r)||(i=[String(r)]);else{i=[];for(var h=2;h<p;h++){var m=arguments[h];if(!c(m)){m.join?o=m:(o=Y)[0]=m;for(var v=0;v<o.length;v++){var g=o[v],y=!(c(g)||a(g)||g instanceof t);y&&!s(g)&&(g=String(g)),y&&u?i[i.length-1]+=g:c(g)||(i.push(g),u=y)}}}}}else if(n&&n.children)return f(e,n,n.children);n&&(n.children&&delete n.children,a(e)||("className"in n&&(n.class=n.className,delete n.className),u=n.class,u&&!s(u)&&(n.class=l(u))));var b=new t(e,n||void 0,i);return K.vnode&&K.vnode(b),b}function p(e,t){return f(e.nodeName,n(r(e.attributes),t),arguments.length>2?o(arguments,2):e.children)}function d(e,t,n){var r=t.split("."),o=r[0];return function(t){var a,u,c,l=t&&t.currentTarget||this,f=e.state,p=f;if(u=s(n)?i(t,n):l.nodeName?(l.nodeName+l.type).match(/^input(check|rad)/i)?l.checked:l.value:t,r.length>1){for(c=0;c<r.length-1;c++)p=p[r[c]]||(p[r[c]]={});p[r[c]]=u,u=f[o]}e.setState((a={},a[o]=u,a))}}function h(e){1===re.push(e)&&(K.debounceRendering||X)(m)}function m(){if(re.length){var e,t=re;for(re=ie,ie=t;e=t.pop();)e._dirty&&q(e)}}function v(e){var t=e&&e.nodeName;return t&&a(t)&&!(t.prototype&&t.prototype.render)}function g(e,t){return e.nodeName(O(e),t||Z)}function y(e,t){return e[ee]||(e[ee]=t||{})}function b(e){return e instanceof Text?3:e instanceof Element?1:0}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function w(e,t,n,r,i){if(y(e)[t]=n,"key"!==t&&"children"!==t&&"innerHTML"!==t)if("class"!==t||i)if("style"===t){if((!n||s(n)||s(r))&&(e.style.cssText=n||""),n&&"object"==typeof n){if(!s(r))for(var o in r)o in n||(e.style[o]="");for(var o in n)e.style[o]="number"!=typeof n[o]||te[o]?n[o]:n[o]+"px"}}else if("dangerouslySetInnerHTML"===t)n&&(e.innerHTML=n.__html);else if("o"==t[0]&&"n"==t[1]){var l=e._listeners||(e._listeners={});t=J(t.substring(2)),n?l[t]||e.addEventListener(t,R,!!ne[t]):l[t]&&e.removeEventListener(t,R,!!ne[t]),l[t]=n}else if("type"!==t&&!i&&t in e)x(e,t,u(n)?"":n),c(n)&&e.removeAttribute(t);else{var f=i&&t.match(/^xlink\:?(.+)/);c(n)?f?e.removeAttributeNS("http://www.w3.org/1999/xlink",J(f[1])):e.removeAttribute(t):"object"==typeof n||a(n)||(f?e.setAttributeNS("http://www.w3.org/1999/xlink",J(f[1]),n):e.setAttribute(t,n))}else e.className=n||""}function x(e,t,n){try{e[t]=n}catch(e){}}function R(e){return this._listeners[e.type](K.event&&K.event(e)||e)}function j(e){for(var t={},n=e.attributes.length;n--;)t[e.attributes[n].name]=e.attributes[n].value;return t}function P(e,t){return s(t)?3===b(e):s(t.nodeName)?C(e,t.nodeName):a(t.nodeName)?e._componentConstructor===t.nodeName||v(t):void 0}function C(e,t){return e.normalizedNodeName===t||J(e.nodeName)===J(t)}function O(e){var t=e.nodeName.defaultProps,i=r(t||e.attributes);return t&&n(i,e.attributes),e.children&&(i.children=e.children),i}function S(e){if(_(e),1===b(e)){F(e);var t=J(e.nodeName),n=oe[t];n?n.push(e):oe[t]=[e]}}function E(e,t){var n=J(e),r=oe[n]&&oe[n].pop()||(t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e));return y(r),r.normalizedNodeName=n,r}function F(e){y(e,j(e)),e._component=e._componentConstructor=null}function k(){for(var e;e=ae.pop();)e.componentDidMount&&e.componentDidMount()}function N(e,t,n,r,i,o){se++;var a=T(e,t,n,r,o);return i&&a.parentNode!==i&&i.appendChild(a),--se||k(),a}function T(e,t,n,r,i){for(var o=t&&t.attributes;v(t);)t=g(t,n);if(u(t)&&(t="",i)){if(e){if(8===e.nodeType)return e;H(e)}return document.createComment(t)}if(s(t)){if(e){if(3===b(e)&&e.parentNode)return e.nodeValue=t,e;H(e)}return document.createTextNode(t)}var c=e,l=t.nodeName,f=ue;if(a(l))return B(e,t,n,r);if(s(l)||(l=String(l)),ue="svg"===l||"foreignObject"!==l&&ue,e){if(!C(e,l)){for(c=E(l,ue);e.firstChild;)c.appendChild(e.firstChild);
H(e)}}else c=E(l,ue);return t.children&&1===t.children.length&&"string"==typeof t.children[0]&&1===c.childNodes.length&&c.firstChild instanceof Text?c.firstChild.nodeValue=t.children[0]:(t.children||c.firstChild)&&A(c,t.children,n,r),L(c,t.attributes),o&&o.ref&&(c[ee].ref=o.ref)(c),ue=f,c}function A(e,t,n,r){var i,o,s,c,l=e.childNodes,f=[],p={},d=0,h=0,m=l.length,v=0,g=t&&t.length;if(m)for(var y=0;y<m;y++){var b=l[y],_=g?(o=b._component)?o.__key:(o=b[ee])?o.key:null:null;_||0===_?(d++,p[_]=b):f[v++]=b}if(g)for(var y=0;y<g;y++){s=t[y],c=null;var _=s.key;if(u(_)){if(!c&&h<v){for(i=h;i<v;i++)if(o=f[i],o&&P(o,s)){c=o,f[i]=void 0,i===v-1&&v--,i===h&&h++;break}!c&&h<v&&a(s.nodeName)&&r&&(c=f[h],f[h++]=void 0)}}else d&&_ in p&&(c=p[_],p[_]=void 0,d--);c=T(c,s,n,r),c!==l[y]&&e.insertBefore(c,l[y]||null)}if(d)for(var y in p)p[y]&&(f[h=v++]=p[y]);h<v&&M(f)}function M(e,t){for(var n=e.length;n--;){var r=e[n];r&&H(r,t)}}function H(e,t){var n=e._component;n?Q(n,!t):(e[ee]&&e[ee].ref&&e[ee].ref(null),t||S(e),e.childNodes&&e.childNodes.length&&M(e.childNodes,t))}function L(e,t){var n=e[ee]||j(e);for(var r in n)t&&r in t||w(e,r,null,n[r],ue);if(t)for(var i in t)i in n&&t[i]==n[i]&&("value"!==i&&"checked"!==i||t[i]==e[i])||w(e,i,t[i],n[i],ue)}function U(e){var t=e.constructor.name,n=ce[t];n?n.push(e):ce[t]=[e]}function D(e,t,n){var r=new e(t,n),i=ce[e.name];if(r.props=t,r.context=n,i)for(var o=i.length;o--;)if(i[o].constructor===e){r.nextBase=i[o].nextBase,i.splice(o,1);break}return r}function I(e){e._dirty||(e._dirty=!0,h(e))}function V(e,t,n,r,i){var o=e.base;e._disableRendering||(e._disableRendering=!0,(e.__ref=t.ref)&&delete t.ref,(e.__key=t.key)&&delete t.key,u(o)||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,r),r&&r!==e.context&&(e.prevContext||(e.prevContext=e.context),e.context=r),e.prevProps||(e.prevProps=e.props),e.props=t,e._disableRendering=!1,0!==n&&(1!==n&&K.syncComponentUpdates===!1&&o?I(e):q(e,1,i)),e.__ref&&e.__ref(e))}function q(e,t,i){if(!e._disableRendering){var o,s,u=e.props,c=e.state,l=e.context,f=e.prevProps||u,p=e.prevState||c,d=e.prevContext||l,h=e.base,m=h||e.nextBase,y=e._component;if(h&&(e.props=f,e.state=p,e.context=d,2!==t&&e.shouldComponentUpdate&&e.shouldComponentUpdate(u,c,l)===!1?o=!0:e.componentWillUpdate&&e.componentWillUpdate(u,c,l),e.props=u,e.state=c,e.context=l),e.prevProps=e.prevState=e.prevContext=e.nextBase=null,e._dirty=!1,!o){for(e.render&&(s=e.render(u,c,l)),e.getChildContext&&(l=n(r(l),e.getChildContext()));v(s);)s=g(s,l);var b,_,w=s&&s.nodeName;if(a(w)&&w.prototype.render){var x=y,R=O(s);x&&x.constructor===w?V(x,R,1,l):(b=x,x=D(w,R,l),x.nextBase=x.nextBase||i&&m,x._parentComponent=e,e._component=x,V(x,R,0,l),q(x,1)),_=x.base}else{var j=m;b=y,b&&(j=e._component=null),(m||1===t)&&(j&&(j._component=null),_=N(j,s,l,i||!h,m&&m.parentNode,!0))}if(m&&_!==m){var P=m.parentNode;P&&_!==P&&P.replaceChild(_,m),!b&&e._parentComponent&&(m._component=null,H(m))}if(b&&Q(b,!0),e.base=_,_){for(var C=e,S=e;S=S._parentComponent;)C=S;_._component=C,_._componentConstructor=C.constructor}}!h||i?(ae.unshift(e),se||k()):!o&&e.componentDidUpdate&&e.componentDidUpdate(f,p,d);var E,F=e._renderCallbacks;if(F)for(;E=F.pop();)E.call(e);return s}}function B(e,t,n,r){for(var i=e&&e._component,o=e,a=i&&e._componentConstructor===t.nodeName,s=a,u=O(t);i&&!s&&(i=i._parentComponent);)s=i.constructor===t.nodeName;return!s||r&&!i._component?(i&&!a&&(Q(i,!0),e=o=null),i=D(t.nodeName,u,n),e&&!i.nextBase&&(i.nextBase=e),V(i,u,1,n,r),e=i.base,o&&e!==o&&(o._component=null,H(o))):(V(i,u,3,n,r),e=i.base),e}function Q(e,t){var n=e.base;e._disableRendering=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var r=e._component;r?Q(r,t):n&&(n[ee]&&n[ee].ref&&n[ee].ref(null),e.nextBase=n,t&&(_(n),U(e)),M(n.childNodes,!t)),e.__ref&&e.__ref(null),e.componentDidUnmount&&e.componentDidUnmount()}function z(e,t){this._dirty=!0,this._disableRendering=!1,this.prevState=this.prevProps=this.prevContext=this.base=this.nextBase=this._parentComponent=this._component=this.__ref=this.__key=this._linkedStates=this._renderCallbacks=null,this.context=t,this.props=e,this.state=this.getInitialState&&this.getInitialState()||{}}function W(e,t,n){return N(n,e,{},!1,t)}var K={},$={},J=function(e){return $[e]||($[e]=e.toLowerCase())},G="undefined"!=typeof Promise&&Promise.resolve(),X=G?function(e){G.then(e)}:setTimeout,Y=[],Z={},ee="undefined"!=typeof Symbol?Symbol.for("preactattr"):"__preactattr_",te={boxFlex:1,boxFlexGroup:1,columnCount:1,fillOpacity:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,strokeOpacity:1,widows:1,zIndex:1,zoom:1},ne={blur:1,error:1,focus:1,load:1,resize:1,scroll:1},re=[],ie=[],oe={},ae=[],se=0,ue=!1,ce={};n(z.prototype,{linkState:function(e,t){var n=this._linkedStates||(this._linkedStates={}),r=e+"|"+t;return n[r]||(n[r]=d(this,e,t))},setState:function(e,t){var i=this.state;this.prevState||(this.prevState=r(i)),n(i,a(e)?e(i,this.props):e),t&&(this._renderCallbacks=this._renderCallbacks||[]).push(t),I(this)},forceUpdate:function(){q(this,2)},render:function(){return null}}),e.h=f,e.cloneElement=p,e.Component=z,e.render=W,e.rerender=m,e.options=K})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e){var t="string"==typeof e,n=void 0;if(n=t?document.querySelector(e):e,!a(n)){var r="Container must be `string` or `HTMLElement`.";throw t&&(r+=" Unable to find "+e),new Error(r)}return n}function a(e){return e instanceof window.HTMLElement||Boolean(e)&&e.nodeType>0}function s(e){var t=1===e.button;return t||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function u(e){return function(t,n){return t&&!n?e+"--"+t:t&&n?e+"--"+t+"__"+n:!t&&n?e+"__"+n:e}}function c(e){var t=e.transformData,n=e.defaultTemplates,r=e.templates,i=e.templatesConfig,o=l(n,r);return v({transformData:t,templatesConfig:i},o)}function l(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=(0,F.default)([].concat(i((0,S.default)(e)),i((0,S.default)(t))));return(0,y.default)(n,function(n,r){var i=e[r],o=t[r],a=void 0!==o&&o!==i;return n.templates[r]=a?o:i,n.useCustomCompileOptions[r]=a,n},{templates:{},useCustomCompileOptions:{}})}function f(e,t,n,r,i){var o={type:t,attributeName:n,name:r},a=(0,x.default)(i,{name:n}),s=void 0;if("hierarchical"===t){var u=e.getHierarchicalFacetByName(n),c=r.split(u.separator);o.name=c[c.length-1];for(var l=0;void 0!==a&&l<c.length;++l)a=(0,x.default)(a.data,{name:c[l]});s=(0,j.default)(a,"count")}else s=(0,j.default)(a,'data["'+o.name+'"]');var f=(0,j.default)(a,"exhaustive");return void 0!==s&&(o.count=s),void 0!==f&&(o.exhaustive=f),o}function p(e,t){var n=[];return(0,_.default)(t.facetsRefinements,function(r,i){(0,_.default)(r,function(r){n.push(f(t,"facet",i,r,e.facets))})}),(0,_.default)(t.facetsExcludes,function(e,t){(0,_.default)(e,function(e){n.push({type:"exclude",attributeName:t,name:e,exclude:!0})})}),(0,_.default)(t.disjunctiveFacetsRefinements,function(r,i){(0,_.default)(r,function(r){n.push(f(t,"disjunctive",i,r,e.disjunctiveFacets))})}),(0,_.default)(t.hierarchicalFacetsRefinements,function(r,i){(0,_.default)(r,function(r){n.push(f(t,"hierarchical",i,r,e.hierarchicalFacets))})}),(0,_.default)(t.numericRefinements,function(e,t){(0,_.default)(e,function(e,r){(0,_.default)(e,function(e){n.push({type:"numeric",attributeName:t,name:""+e,numericValue:e,operator:r})})})}),(0,_.default)(t.tagRefinements,function(e){n.push({type:"tag",attributeName:"_tags",name:e})}),n}function d(e,t){var n=e;return(0,C.default)(t)?(n=n.clearTags(),n=n.clearRefinements()):((0,_.default)(t,function(e){n="_tags"===e?n.clearTags():n.clearRefinements(e)}),n)}function h(e,t){e.setState(d(e.state,t)).search()}function m(e,t){if(t)return(0,N.default)(t,function(t,n){return e+n})}Object.defineProperty(t,"__esModule",{value:!0}),t.prefixKeys=t.clearRefinementsAndSearch=t.clearRefinementsFromState=t.getRefinements=t.isDomElement=t.isSpecialClick=t.prepareTemplateProps=t.bemHelper=t.getContainerNode=void 0;var v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},g=n(164),y=r(g),b=n(155),_=r(b),w=n(195),x=r(w),R=n(138),j=r(R),P=n(189),C=r(P),O=n(37),S=r(O),E=n(329),F=r(E),k=n(312),N=r(k);t.getContainerNode=o,t.bemHelper=u,t.prepareTemplateProps=c,t.isSpecialClick=s,t.isDomElement=a,t.getRefinements=p,t.clearRefinementsFromState=d,t.clearRefinementsAndSearch=h,t.prefixKeys=m},function(e,t,n){function r(e){return e&&e.length?i(e):[]}var i=n(317);e.exports=r},function(e,t,n){var r,i;!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r))e.push(n.apply(null,r));else if("object"===i)for(var a in r)o.call(r,a)&&r[a]&&e.push(a)}}return e.join(" ")}var o={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(r=[],i=function(){return n}.apply(t,r),!(void 0!==i&&(e.exports=i)))}()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=function(t){function n(){return i(this,n),o(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return a(n,t),u(n,[{key:"componentDidMount",value:function(){this._hideOrShowContainer(this.props)}},{key:"componentWillReceiveProps",value:function(e){this.props.shouldAutoHideContainer!==e.shouldAutoHideContainer&&this._hideOrShowContainer(e)}},{key:"shouldComponentUpdate",value:function(e){return e.shouldAutoHideContainer===!1}},{key:"_hideOrShowContainer",value:function(e){var t=p.default.findDOMNode(this).parentNode;t.style.display=e.shouldAutoHideContainer===!0?"none":""}},{key:"render",value:function(){return l.default.createElement(e,this.props)}}]),n}(l.default.Component);return t.displayName=e.name+"-AutoHide",t}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(325),p=r(f);t.default=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=function(t){function n(e){i(this,n);var t=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.handleHeaderClick=t.handleHeaderClick.bind(t),t.state={collapsed:e.collapsible&&e.collapsible.collapsed},t._cssClasses={root:(0,d.default)("ais-root",t.props.cssClasses.root),body:(0,d.default)("ais-body",t.props.cssClasses.body)},t._footerElement=t._getElement({type:"footer"}),t}return a(n,t),c(n,[{key:"_getElement",value:function(e){var t=e.type,n=e.handleClick,r=void 0===n?null:n,i=this.props.templateProps.templates;if(!i||!i[t])return null;var o=(0,d.default)(this.props.cssClasses[t],"ais-"+t),a=(0,m.default)(this.props,"headerFooterData."+t);return f.default.createElement(g.default,u({},this.props.templateProps,{data:a,rootProps:{className:o,onClick:r},templateKey:t,transformData:null}))}},{key:"handleHeaderClick",value:function(){this.setState({collapsed:!this.state.collapsed})}},{key:"render",value:function(){var t=[this._cssClasses.root];this.props.collapsible&&t.push("ais-root__collapsible"),this.state.collapsed&&t.push("ais-root__collapsed");var n=u({},this._cssClasses,{root:(0,d.default)(t)}),r=this._getElement({type:"header",handleClick:this.props.collapsible?this.handleHeaderClick:null});return f.default.createElement("div",{className:n.root},r,f.default.createElement("div",{className:n.body},f.default.createElement(e,this.props)),this._footerElement)}}]),n}(f.default.Component);return t.defaultProps={cssClasses:{},collapsible:!1},t.displayName=e.name+"-HeaderFooter",t}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(325),f=r(l),p=n(330),d=r(p),h=n(138),m=r(h),v=n(333),g=r(v);t.default=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t,n){if(!e)return n;var r=(0,y.default)(n),i=void 0,o="undefined"==typeof e?"undefined":l(e);if("function"===o)i=e(r);else{if("object"!==o)throw new Error("transformData must be a function or an object, was "+o+" (key : "+t+")");i=e[t]?e[t](r):n}var a="undefined"==typeof i?"undefined":l(i),s="undefined"==typeof n?"undefined":l(n);if(a!==s)throw new Error("`transformData` must return a `"+s+"`, got `"+a+"`.");return i}function u(e){var t=e.templates,n=e.templateKey,r=e.compileOptions,i=e.helpers,o=e.data,a=t[n],s="undefined"==typeof a?"undefined":l(a),u="string"===s,p="function"===s;if(u||p){if(p)return a(o);var d=c(i,r,o),h=f({},o,{helpers:d});return x.default.compile(a,r).render(h)}throw new Error("Template must be 'string' or 'function', was '"+s+"' (key: "+n+")")}function c(e,t,n){return(0,_.default)(e,function(e){return(0,v.default)(function(r){var i=this,o=function(e){return x.default.compile(e,t).render(i)};return e.call(n,r,o)})})}Object.defineProperty(t,"__esModule",{value:!0});var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(325),h=r(d),m=n(334),v=r(m),g=n(335),y=r(g),b=n(313),_=r(b),w=n(336),x=r(w),R=n(192),j=r(R),P=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),p(t,[{key:"shouldComponentUpdate",value:function(e){return!(0,j.default)(this.props.data,e.data)||this.props.templateKey!==e.templateKey}},{key:"render",value:function(){var e=this.props.useCustomCompileOptions[this.props.templateKey],t=e?this.props.templatesConfig.compileOptions:{},n=u({templates:this.props.templates,templateKey:this.props.templateKey,compileOptions:t,helpers:this.props.templatesConfig.helpers,data:s(this.props.transformData,this.props.templateKey,this.props.data)});return null===n?null:h.default.isValidElement(n)?h.default.createElement("div",this.props.rootProps,n):h.default.createElement("div",f({},this.props.rootProps,{dangerouslySetInnerHTML:{__html:n}}))}}]),t}(h.default.Component);P.defaultProps={data:{},useCustomCompileOptions:{},templates:{},templatesConfig:{}},t.default=P},function(e,t,n){function r(e,t,n){t=n?void 0:t;var a=i(e,o,void 0,void 0,void 0,void 0,void 0,t);return a.placeholder=r.placeholder,a}var i=n(255),o=8;r.placeholder={},e.exports=r},function(e,t,n){function r(e){return i(e,!0,!0)}var i=n(218);e.exports=r},function(e,t,n){var r=n(337);r.Template=n(338).Template,r.template=r.Template,e.exports=r},function(e,t,n){!function(e){function t(e){"}"===e.n.substr(e.n.length-1)&&(e.n=e.n.substring(0,e.n.length-1))}function n(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}function r(e,t,n){if(t.charAt(n)!=e.charAt(0))return!1;for(var r=1,i=e.length;r<i;r++)if(t.charAt(n+r)!=e.charAt(r))return!1;return!0}function i(t,n,r,s){var u=[],c=null,l=null,f=null;for(l=r[r.length-1];t.length>0;){if(f=t.shift(),l&&"<"==l.tag&&!(f.tag in w))throw new Error("Illegal content in < super tag.");if(e.tags[f.tag]<=e.tags.$||o(f,s))r.push(f),f.nodes=i(t,f.tag,r,s);else{if("/"==f.tag){if(0===r.length)throw new Error("Closing tag without opener: /"+f.n);if(c=r.pop(),f.n!=c.n&&!a(f.n,c.n,s))throw new Error("Nesting error: "+c.n+" vs. "+f.n);return c.end=f.i,u}"\n"==f.tag&&(f.last=0==t.length||"\n"==t[0].tag)}u.push(f)}if(r.length>0)throw new Error("missing closing tag: "+r.pop().n);return u}function o(e,t){for(var n=0,r=t.length;n<r;n++)if(t[n].o==e.n)return e.tag="#",!0}function a(e,t,n){for(var r=0,i=n.length;r<i;r++)if(n[r].c==e&&n[r].o==t)return!0}function s(e){var t=[];for(var n in e)t.push('"'+c(n)+'": function(c,p,t,i) {'+e[n]+"}");return"{ "+t.join(",")+" }"}function u(e){var t=[];for(var n in e.partials)t.push('"'+c(n)+'":{name:"'+c(e.partials[n].name)+'", '+u(e.partials[n])+"}");return"partials: {"+t.join(",")+"}, subs: "+s(e.subs)}function c(e){return e.replace(y,"\\\\").replace(m,'\\"').replace(v,"\\n").replace(g,"\\r").replace(b,"\\u2028").replace(_,"\\u2029")}function l(e){return~e.indexOf(".")?"d":"f"}function f(e,t){var n="<"+(t.prefix||""),r=n+e.n+x++;return t.partials[r]={name:e.n,partials:{}},t.code+='t.b(t.rp("'+c(r)+'",c,p,"'+(e.indent||"")+'"));',r}function p(e,t){t.code+="t.b(t.t(t."+l(e.n)+'("'+c(e.n)+'",c,p,0)));'}function d(e){return"t.b("+e+");"}var h=/\S/,m=/\"/g,v=/\n/g,g=/\r/g,y=/\\/g,b=/\u2028/,_=/\u2029/;e.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},e.scan=function(i,o){function a(){y.length>0&&(b.push({tag:"_t",text:new String(y)}),y="")}function s(){for(var t=!0,n=x;n<b.length;n++)if(t=e.tags[b[n].tag]<e.tags._v||"_t"==b[n].tag&&null===b[n].text.match(h),!t)return!1;return t}function u(e,t){if(a(),e&&s())for(var n,r=x;r<b.length;r++)b[r].text&&((n=b[r+1])&&">"==n.tag&&(n.indent=b[r].text.toString()),b.splice(r,1));else t||b.push({tag:"\n"});_=!1,x=b.length}function c(e,t){var r="="+j,i=e.indexOf(r,t),o=n(e.substring(e.indexOf("=",t)+1,i)).split(" ");return R=o[0],j=o[o.length-1],i+r.length-1}var l=i.length,f=0,p=1,d=2,m=f,v=null,g=null,y="",b=[],_=!1,w=0,x=0,R="{{",j="}}";for(o&&(o=o.split(" "),R=o[0],j=o[1]),w=0;w<l;w++)m==f?r(R,i,w)?(--w,a(),m=p):"\n"==i.charAt(w)?u(_):y+=i.charAt(w):m==p?(w+=R.length-1,g=e.tags[i.charAt(w+1)],v=g?i.charAt(w+1):"_v","="==v?(w=c(i,w),m=f):(g&&w++,m=d),_=w):r(j,i,w)?(b.push({tag:v,n:n(y),otag:R,ctag:j,i:"/"==v?_-R.length:w+j.length}),y="",w+=j.length-1,m=f,"{"==v&&("}}"==j?w++:t(b[b.length-1]))):y+=i.charAt(w);return u(_,!0),b};var w={_t:!0,"\n":!0,$:!0,"/":!0};e.stringify=function(t,n,r){return"{code: function (c,p,i) { "+e.wrapMain(t.code)+" },"+u(t)+"}"};var x=0;e.generate=function(t,n,r){x=0;var i={code:"",subs:{},partials:{}};return e.walk(t,i),r.asString?this.stringify(i,n,r):this.makeTemplate(i,n,r)},e.wrapMain=function(e){return'var t=this;t.b(i=i||"");'+e+"return t.fl();"},e.template=e.Template,e.makeTemplate=function(e,t,n){var r=this.makePartials(e);return r.code=new Function("c","p","i",this.wrapMain(e.code)),new this.template(r,t,this,n)},e.makePartials=function(e){var t,n={subs:{},partials:e.partials,name:e.name};for(t in n.partials)n.partials[t]=this.makePartials(n.partials[t]);for(t in e.subs)n.subs[t]=new Function("c","p","t","i",e.subs[t]);return n},e.codegen={"#":function(t,n){n.code+="if(t.s(t."+l(t.n)+'("'+c(t.n)+'",c,p,1),c,p,0,'+t.i+","+t.end+',"'+t.otag+" "+t.ctag+'")){t.rs(c,p,function(c,p,t){',e.walk(t.nodes,n),n.code+="});c.pop();}"},"^":function(t,n){n.code+="if(!t.s(t."+l(t.n)+'("'+c(t.n)+'",c,p,1),c,p,1,0,0,"")){',e.walk(t.nodes,n),n.code+="};"},">":f,"<":function(t,n){var r={partials:{},code:"",subs:{},inPartial:!0};e.walk(t.nodes,r);var i=n.partials[f(t,n)];i.subs=r.subs,i.partials=r.partials},$:function(t,n){var r={subs:{},code:"",partials:n.partials,prefix:t.n};e.walk(t.nodes,r),n.subs[t.n]=r.code,n.inPartial||(n.code+='t.sub("'+c(t.n)+'",c,p,i);')},"\n":function(e,t){t.code+=d('"\\n"'+(e.last?"":" + i"))},_v:function(e,t){t.code+="t.b(t.v(t."+l(e.n)+'("'+c(e.n)+'",c,p,0)));'},_t:function(e,t){t.code+=d('"'+c(e.text)+'"')},"{":p,"&":p},e.walk=function(t,n){for(var r,i=0,o=t.length;i<o;i++)r=e.codegen[t[i].tag],r&&r(t[i],n);return n},e.parse=function(e,t,n){return n=n||{},i(e,"",[],n.sectionTags||[])},e.cache={},e.cacheKey=function(e,t){return[e,!!t.asString,!!t.disableLambda,t.delimiters,!!t.modelGet].join("||")},e.compile=function(t,n){n=n||{};var r=e.cacheKey(t,n),i=this.cache[r];if(i){var o=i.partials;for(var a in o)delete o[a].instance;return i}return i=this.generate(this.parse(this.scan(t,n.delimiters),t,n),t,n),this.cache[r]=i}}(t)},function(e,t,n){!function(e){function t(e,t,n){var r;return t&&"object"==typeof t&&(void 0!==t[e]?r=t[e]:n&&t.get&&"function"==typeof t.get&&(r=t.get(e))),r}function n(e,t,n,r,i,o){function a(){}function s(){}a.prototype=e,s.prototype=e.subs;var u,c=new a;c.subs=new s,c.subsText={},c.buf="",r=r||{},c.stackSubs=r,c.subsText=o;for(u in t)r[u]||(r[u]=t[u]);for(u in r)c.subs[u]=r[u];i=i||{},c.stackPartials=i;for(u in n)i[u]||(i[u]=n[u]);for(u in i)c.partials[u]=i[u];return c}function r(e){return String(null===e||void 0===e?"":e)}function i(e){return e=r(e),l.test(e)?e.replace(o,"&").replace(a,"<").replace(s,">").replace(u,"'").replace(c,"""):e}e.Template=function(e,t,n,r){e=e||{},this.r=e.code||this.r,this.c=n,this.options=r||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.buf=""},e.Template.prototype={r:function(e,t,n){return""},v:i,t:r,render:function(e,t,n){return this.ri([e],t||{},n)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var r=this.partials[e],i=t[r.name];if(r.instance&&r.base==i)return r.instance;if("string"==typeof i){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}if(!i)return null;if(this.partials[e].base=i,r.subs){t.stackText||(t.stackText={});for(key in r.subs)t.stackText[key]||(t.stackText[key]=void 0!==this.activeSub&&t.stackText[this.activeSub]?t.stackText[this.activeSub]:this.text);i=n(i,r.subs,r.partials,this.stackSubs,this.stackPartials,t.stackText)}return this.partials[e].instance=i,i},rp:function(e,t,n,r){var i=this.ep(e,n);return i?i.ri(t,n,r):""},rs:function(e,t,n){var r=e[e.length-1];if(!f(r))return void n(e,t,this);for(var i=0;i<r.length;i++)e.push(r[i]),n(e,t,this),e.pop()},s:function(e,t,n,r,i,o,a){var s;return(!f(e)||0!==e.length)&&("function"==typeof e&&(e=this.ms(e,t,n,r,i,o,a)),s=!!e,!r&&s&&t&&t.push("object"==typeof e?e:t[t.length-1]),s)},d:function(e,n,r,i){var o,a=e.split("."),s=this.f(a[0],n,r,i),u=this.options.modelGet,c=null;if("."===e&&f(n[n.length-2]))s=n[n.length-1];else for(var l=1;l<a.length;l++)o=t(a[l],s,u),void 0!==o?(c=s,s=o):s="";return!(i&&!s)&&(i||"function"!=typeof s||(n.push(c),s=this.mv(s,n,r),n.pop()),s)},f:function(e,n,r,i){for(var o=!1,a=null,s=!1,u=this.options.modelGet,c=n.length-1;c>=0;c--)if(a=n[c],o=t(e,a,u),void 0!==o){s=!0;break}return s?(i||"function"!=typeof o||(o=this.mv(o,n,r)),o):!i&&""},ls:function(e,t,n,i,o){var a=this.options.delimiters;return this.options.delimiters=o,this.b(this.ct(r(e.call(t,i)),t,n)),this.options.delimiters=a,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,t,n,r,i,o,a){var s,u=t[t.length-1],c=e.call(u);return"function"==typeof c?!!r||(s=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(c,u,n,s.substring(i,o),a)):c},mv:function(e,t,n){var i=t[t.length-1],o=e.call(i);return"function"==typeof o?this.ct(r(o.call(i)),i,n):o},sub:function(e,t,n,r){var i=this.subs[e];i&&(this.activeSub=e,i(t,n,this,r),this.activeSub=!1)}};var o=/&/g,a=/</g,s=/>/g,u=/\'/g,c=/\"/g,l=/[&<>\"\']/,f=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}}(t)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",link:"Clear all",footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(333),p=r(f),d=n(328),h=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleClick=this.handleClick.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return this.props.url!==e.url||this.props.hasRefinements!==e.hasRefinements}},{key:"handleClick",value:function(e){(0,d.isSpecialClick)(e)||(e.preventDefault(),this.props.clearAll())}},{key:"render",value:function(){var e={hasRefinements:this.props.hasRefinements};return l.default.createElement("a",{className:this.props.cssClasses.link,href:this.props.url,onClick:this.handleClick},l.default.createElement(p.default,s({data:e,templateKey:"link"},this.props.templateProps)))}}]),t}(l.default.Component);t.default=h},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.container,n=e.attributes,r=void 0===n?[]:n,i=e.onlyListedAttributes,o=void 0!==i&&i,a=e.clearAll,l=void 0===a?"before":a,p=e.templates,m=void 0===p?q.default:p,g=e.collapsible,b=void 0!==g&&g,w=e.transformData,R=e.autoHideContainer,P=void 0===R||R,O=e.cssClasses,E=void 0===O?{}:O,F=(0,j.default)(r)&&(0,A.default)(r,function(e,t){return e&&(0,C.default)(t)&&(0,x.default)(t.name)&&((0,y.default)(t.label)||(0,x.default)(t.label))&&((0,y.default)(t.template)||(0,x.default)(t.template)||(0,S.default)(t.template))&&((0,y.default)(t.transformData)||(0,S.default)(t.transformData))},!0),k=["header","item","clearAll","footer"],T=(0,C.default)(m)&&(0,A.default)(m,function(e,t,n){return e&&k.indexOf(n)!==-1&&((0,x.default)(t)||(0,S.default)(t))},!0),M=["root","header","body","clearAll","list","item","link","count","footer"],H=(0,C.default)(E)&&(0,A.default)(E,function(e,t,n){return e&&M.indexOf(n)!==-1&&(0,x.default)(t)||(0,j.default)(t)},!0),L=(0,y.default)(w)||(0,S.default)(w)||(0,C.default)(w)&&(0,S.default)(w.item),D=!(((0,x.default)(t)||(0,h.isDomElement)(t))&&(0,j.default)(r)&&F&&(0,_.default)(o)&&[!1,"before","after"].indexOf(l)!==-1&&(0,C.default)(m)&&T&&L&&(0,_.default)(P)&&H);if(D)throw new Error(W);var V=(0,h.getContainerNode)(t),B=(0,U.default)(Q.default);P===!0&&(B=(0,I.default)(B));var K=(0,N.default)(r,function(e){return e.name}),$=o?K:[],J=(0,A.default)(r,function(e,t){return e[t.name]=t,e},{});return{init:function(e){var t=e.helper;this._clearRefinementsAndSearch=h.clearRefinementsAndSearch.bind(null,t,$)},render:function(e){var t=e.results,n=e.helper,r=e.state,i=e.templatesConfig,a=e.createURL,p={root:(0,v.default)(z(null),E.root),header:(0,v.default)(z("header"),E.header),body:(0,v.default)(z("body"),E.body),clearAll:(0,v.default)(z("clear-all"),E.clearAll),list:(0,v.default)(z("list"),E.list),item:(0,v.default)(z("item"),E.item),link:(0,v.default)(z("link"),E.link),count:(0,v.default)(z("count"),E.count),footer:(0,v.default)(z("footer"),E.footer)},g=(0,h.prepareTemplateProps)({transformData:w,defaultTemplates:q.default,templatesConfig:i,templates:m}),y=a((0,h.clearRefinementsFromState)(r,$)),_=s(t,r,K,o),x=_.map(function(e){return a(u(r,e))}),R=_.map(function(e){return c.bind(null,n,e)}),j=0===_.length;d.default.render(f.default.createElement(B,{attributes:J,clearAllClick:this._clearRefinementsAndSearch,clearAllPosition:l,clearAllURL:y,clearRefinementClicks:R,clearRefinementURLs:x,collapsible:b,cssClasses:p,refinements:_,shouldAutoHideContainer:j,templateProps:g}),V)}}}function o(e,t,n){var r=e.indexOf(n);return r!==-1?r:e.length+t.indexOf(n)}function a(e,t,n,r){var i=o(e,t,n.attributeName),a=o(e,t,r.attributeName);return i===a?n.name===r.name?0:n.name<r.name?-1:1:i<a?-1:1}function s(e,t,n,r){var i=(0,h.getRefinements)(e,t),o=(0,A.default)(i,function(e,t){return n.indexOf(t.attributeName)===-1&&e.indexOf(t.attributeName===-1)&&e.push(t.attributeName),e},[]);return i=i.sort(a.bind(null,n,o)),r&&!(0,F.default)(n)&&(i=(0,H.default)(i,function(e){return n.indexOf(e.attributeName)!==-1})),i}function u(e,t){switch(t.type){case"facet":return e.removeFacetRefinement(t.attributeName,t.name);case"disjunctive":return e.removeDisjunctiveFacetRefinement(t.attributeName,t.name);case"hierarchical":return e.clearRefinements(t.attributeName);case"exclude":return e.removeExcludeRefinement(t.attributeName,t.name);case"numeric":return e.removeNumericRefinement(t.attributeName,t.operator,t.numericValue);case"tag":return e.removeTagRefinement(t.name);default:throw new Error("clearRefinement: type "+t.type+" is not handled")}}function c(e,t){e.setState(u(e.state,t)).search()}Object.defineProperty(t,"__esModule",{value:!0});var l=n(325),f=r(l),p=n(325),d=r(p),h=n(328),m=n(330),v=r(m),g=n(193),y=r(g),b=n(342),_=r(b),w=n(194),x=r(w),R=n(47),j=r(R),P=n(237),C=r(P),O=n(43),S=r(O),E=n(189),F=r(E),k=n(162),N=r(k),T=n(164),A=r(T),M=n(159),H=r(M),L=n(332),U=r(L),D=n(331),I=r(D),V=n(343),q=r(V),B=n(344),Q=r(B),z=(0,h.bemHelper)("ais-current-refined-values"),W="Usage:\ncurrentRefinedValues({\n container,\n [ attributes: [{name[, label, template, transformData]}] ],\n [ onlyListedAttributes = false ],\n [ clearAll = 'before' ] // One of ['before', 'after', false]\n [ templates.{header,item,clearAll,footer} ],\n [ transformData.{item} ],\n [ autoHideContainer = true ],\n [ cssClasses.{root, header, body, clearAll, list, item, link, count, footer} = {} ],\n [ collapsible=false ]\n})";
t.default=i},function(e,t,n){function r(e){return e===!0||e===!1||i(e)&&s.call(e)==o}var i=n(46),o="[object Boolean]",a=Object.prototype,s=a.toString;e.exports=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'{{#label}}{{label}}{{^operator}}:{{/operator}} {{/label}}{{#operator}}{{{displayOperator}}} {{/operator}}{{#exclude}}-{{/exclude}}{{name}} <span class="{{cssClasses.count}}">{{count}}</span>',clearAll:"Clear all",footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t={};return void 0!==e.template&&(t.templates={item:e.template}),void 0!==e.transformData&&(t.transformData=e.transformData),t}function u(e,t,n){var r=(0,_.default)(t);return r.cssClasses=n,void 0!==e.label&&(r.label=e.label),void 0!==r.operator&&(r.displayOperator=r.operator,">="===r.operator&&(r.displayOperator="≥"),"<="===r.operator&&(r.displayOperator="≤")),r}function c(e){return function(t){(0,v.isSpecialClick)(t)||(t.preventDefault(),e())}}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),p=n(325),d=r(p),h=n(333),m=r(h),v=n(328),g=n(162),y=r(g),b=n(335),_=r(b),w=n(192),x=r(w),R=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),f(t,[{key:"shouldComponentUpdate",value:function(e){return!(0,x.default)(this.props.refinements,e.refinements)}},{key:"_clearAllElement",value:function(e,t){if(t===e)return d.default.createElement("a",{className:this.props.cssClasses.clearAll,href:this.props.clearAllURL,onClick:c(this.props.clearAllClick)},d.default.createElement(m.default,l({templateKey:"clearAll"},this.props.templateProps)))}},{key:"_refinementElement",value:function(e,t){var n=this.props.attributes[e.attributeName]||{},r=u(n,e,this.props.cssClasses),i=s(n),o=e.attributeName+(e.operator?e.operator:":")+(e.exclude?e.exclude:"")+e.name;return d.default.createElement("div",{className:this.props.cssClasses.item,key:o},d.default.createElement("a",{className:this.props.cssClasses.link,href:this.props.clearRefinementURLs[t],onClick:c(this.props.clearRefinementClicks[t])},d.default.createElement(m.default,l({data:r,templateKey:"item"},this.props.templateProps,i))))}},{key:"render",value:function(){return d.default.createElement("div",null,this._clearAllElement("before",this.props.clearAllPosition),d.default.createElement("div",{className:this.props.cssClasses.list},(0,y.default)(this.props.refinements,this._refinementElement.bind(this))),this._clearAllElement("after",this.props.clearAllPosition))}}]),t}(d.default.Component);t.default=R},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributes,r=e.separator,i=void 0===r?" > ":r,o=e.rootPath,s=void 0===o?null:o,l=e.showParentLevel,p=void 0===l||l,h=e.limit,v=void 0===h?10:h,y=e.sortBy,x=void 0===y?["name:asc"]:y,R=e.cssClasses,j=void 0===R?{}:R,P=e.autoHideContainer,C=void 0===P||P,O=e.templates,S=void 0===O?g.default:O,E=e.collapsible,F=void 0!==E&&E,k=e.transformData;if(!t||!n||!n.length)throw new Error(w);var N=(0,c.getContainerNode)(t),T=(0,m.default)(b.default);C===!0&&(T=(0,d.default)(T));var A=n[0],M={root:(0,f.default)(_(null),j.root),header:(0,f.default)(_("header"),j.header),body:(0,f.default)(_("body"),j.body),footer:(0,f.default)(_("footer"),j.footer),list:(0,f.default)(_("list"),j.list),depth:_("list","lvl"),item:(0,f.default)(_("item"),j.item),active:(0,f.default)(_("item","active"),j.active),link:(0,f.default)(_("link"),j.link),count:(0,f.default)(_("count"),j.count)};return{getConfiguration:function(e){return{hierarchicalFacets:[{name:A,attributes:n,separator:i,rootPath:s,showParentLevel:p}],maxValuesPerFacet:void 0!==e.maxValuesPerFacet?Math.max(e.maxValuesPerFacet,v):v}},init:function(e){var t=e.helper,n=e.templatesConfig;this._toggleRefinement=function(e){return t.toggleRefinement(A,e).search()},this._templateProps=(0,c.prepareTemplateProps)({transformData:k,defaultTemplates:g.default,templatesConfig:n,templates:S})},_prepareFacetValues:function(e,t){var n=this;return e.slice(0,v).map(function(e){return Array.isArray(e.data)&&(e.data=n._prepareFacetValues(e.data,t)),e})},render:function(e){function t(e){return i(r.toggleRefinement(A,e))}var n=e.results,r=e.state,i=e.createURL,o=n.getFacetValues(A,{sortBy:x}).data||[];o=this._prepareFacetValues(o,r),u.default.render(a.default.createElement(T,{attributeNameKey:"path",collapsible:F,createURL:t,cssClasses:M,facetValues:o,shouldAutoHideContainer:0===o.length,templateProps:this._templateProps,toggleRefinement:this._toggleRefinement}),N)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(330),f=r(l),p=n(331),d=r(p),h=n(332),m=r(h),v=n(346),g=r(v),y=n(347),b=r(y),_=(0,c.bemHelper)("ais-hierarchical-menu"),w="Usage:\nhierarchicalMenu({\n container,\n attributes,\n [ separator=' > ' ],\n [ rootPath ],\n [ showParentLevel=true ],\n [ limit=10 ],\n [ sortBy=['name:asc'] ],\n [ cssClasses.{root , header, body, footer, list, depth, item, active, link}={} ],\n [ templates.{header, item, footer} ],\n [ transformData.{item} ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t.default=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'<a class="{{cssClasses.link}}" href="{{url}}">{{name}} <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span></a>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(325),f=r(l),p=n(330),d=r(p),h=n(328),m=n(333),v=r(m),g=n(348),y=r(g),b=n(192),_=r(b),w=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={isShowMoreOpen:!1},n.handleItemClick=n.handleItemClick.bind(n),n.handleClickShowMore=n.handleClickShowMore.bind(n),n}return s(t,e),c(t,[{key:"shouldComponentUpdate",value:function(e,t){var n=t!==this.state,r=!(0,_.default)(this.props.facetValues,e.facetValues),i=n||r;return i}},{key:"refine",value:function(e,t){this.props.toggleRefinement(e,t)}},{key:"_generateFacetItem",value:function(e){var n=void 0,r=e.data&&e.data.length>0;r&&(n=f.default.createElement(t,u({},this.props,{depth:this.props.depth+1,facetValues:e.data})));var o=this.props.createURL(e[this.props.attributeNameKey]),a=u({},e,{url:o,cssClasses:this.props.cssClasses}),s=(0,d.default)(this.props.cssClasses.item,i({},this.props.cssClasses.active,e.isRefined)),c=e[this.props.attributeNameKey];return void 0!==e.isRefined&&(c+="/"+e.isRefined),void 0!==e.count&&(c+="/"+e.count),f.default.createElement(y.default,{facetValueToRefine:e[this.props.attributeNameKey],handleClick:this.handleItemClick,isRefined:e.isRefined,itemClassName:s,key:c,subItems:n,templateData:a,templateKey:"item",templateProps:this.props.templateProps})}},{key:"handleItemClick",value:function(e){var t=e.facetValueToRefine,n=e.originalEvent,r=e.isRefined;if(!(0,h.isSpecialClick)(n)){if("INPUT"===n.target.tagName)return void this.refine(t,r);for(var i=n.target;i!==n.currentTarget;){if("LABEL"===i.tagName&&(i.querySelector('input[type="checkbox"]')||i.querySelector('input[type="radio"]')))return;"A"===i.tagName&&i.href&&n.preventDefault(),i=i.parentNode}n.stopPropagation(),this.refine(t,r)}}},{key:"handleClickShowMore",value:function(){var e=!this.state.isShowMoreOpen;this.setState({isShowMoreOpen:e})}},{key:"render",value:function(){var e=[this.props.cssClasses.list];this.props.cssClasses.depth&&e.push(""+this.props.cssClasses.depth+this.props.depth);var t=this.state.isShowMoreOpen?this.props.limitMax:this.props.limitMin,n=this.props.facetValues.slice(0,t),r=this.props.showMore===!0&&this.props.facetValues.length>n.length||this.state.isShowMoreOpen&&n.length>this.props.limitMin,i=r?f.default.createElement(v.default,u({rootProps:{onClick:this.handleClickShowMore},templateKey:"show-more-"+(this.state.isShowMoreOpen?"active":"inactive")},this.props.templateProps)):void 0;return f.default.createElement("div",{className:(0,d.default)(e)},n.map(this._generateFacetItem,this),i)}}]),t}(f.default.Component);w.defaultProps={cssClasses:{},depth:0,attributeNameKey:"name"},t.default=w},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(333),p=r(f),d=n(192),h=r(d),m=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleClick=this.handleClick.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return!(0,h.default)(this.props,e)}},{key:"handleClick",value:function(e){this.props.handleClick({facetValueToRefine:this.props.facetValueToRefine,isRefined:this.props.isRefined,originalEvent:e})}},{key:"render",value:function(){return l.default.createElement("div",{className:this.props.itemClassName,onClick:this.handleClick},l.default.createElement(p.default,s({data:this.props.templateData,templateKey:this.props.templateKey},this.props.templateProps)),this.props.subItems)}}]),t}(l.default.Component);t.default=m},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.cssClasses,r=void 0===n?{}:n,i=e.templates,o=void 0===i?m.default:i,s=e.transformData,l=e.hitsPerPage,p=void 0===l?20:l;if(!t)throw new Error("Must provide a container."+g);if(o.item&&o.allItems)throw new Error("Must contain only allItems OR item template."+g);var h=(0,c.getContainerNode)(t),y={root:(0,f.default)(v(null),r.root),item:(0,f.default)(v("item"),r.item),empty:(0,f.default)(v(null,"empty"),r.empty)};return{getConfiguration:function(){return{hitsPerPage:p}},init:function(e){var t=e.templatesConfig;this._templateProps=(0,c.prepareTemplateProps)({transformData:s,defaultTemplates:m.default,templatesConfig:t,templates:o})},render:function(e){var t=e.results;u.default.render(a.default.createElement(d.default,{cssClasses:y,hits:t.hits,results:t,templateProps:this._templateProps}),h)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(330),f=r(l),p=n(350),d=r(p),h=n(353),m=r(h),v=(0,c.bemHelper)("ais-hits"),g="\nUsage:\nhits({\n container,\n [ cssClasses.{root,empty,item}={} ],\n [ templates.{empty,item} | templates.{empty, allItems} ],\n [ transformData.{empty,item} | transformData.{empty, allItems} ],\n [ hitsPerPage=20 ]\n})";t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(162),p=r(f),d=n(333),h=r(d),m=n(351),v=r(m),g=n(330),y=r(g),b=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"renderWithResults",value:function(){var e=this,t=(0,p.default)(this.props.results.hits,function(t,n){var r=s({},t,{__hitIndex:n});return l.default.createElement(h.default,s({data:r,key:r.objectID,rootProps:{className:e.props.cssClasses.item},templateKey:"item"},e.props.templateProps))});return l.default.createElement("div",{className:this.props.cssClasses.root},t)}},{key:"renderAllResults",value:function(){var e=(0,y.default)(this.props.cssClasses.root,this.props.cssClasses.allItems);return l.default.createElement(h.default,s({data:this.props.results,rootProps:{className:e},templateKey:"allItems"},this.props.templateProps))}},{key:"renderNoResults",value:function(){var e=(0,y.default)(this.props.cssClasses.root,this.props.cssClasses.empty);return l.default.createElement(h.default,s({data:this.props.results,rootProps:{className:e},templateKey:"empty"},this.props.templateProps))}},{key:"render",value:function(){var e=this.props.results.hits.length>0,t=(0,v.default)(this.props,"templateProps.templates.allItems");return e?t?this.renderAllResults():this.renderWithResults():this.renderNoResults()}}]),t}(l.default.Component);b.defaultProps={results:{hits:[]}},t.default=b},function(e,t,n){function r(e,t){return null!=e&&o(e,t,i)}var i=n(352),o=n(150);e.exports=r},function(e,t){function n(e,t){return null!=e&&i.call(e,t)}var r=Object.prototype,i=r.hasOwnProperty;e.exports=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={empty:"No results",item:function(e){return JSON.stringify(e,null,2)}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.options,r=e.cssClasses,i=void 0===r?{}:r,o=e.autoHideContainer,s=void 0!==o&&o,l=n;if(!t||!l)throw new Error(b);var p=(0,c.getContainerNode)(t),h=g.default;s===!0&&(h=(0,m.default)(h));var v={root:(0,d.default)(y(null),i.root),item:(0,d.default)(y("item"),i.item)};return{init:function(e){var t=e.helper,n=e.state,r=(0,f.default)(l,function(e){return Number(n.hitsPerPage)===Number(e.value)});r||(void 0===n.hitsPerPage?window.console&&window.console.log("[Warning][hitsPerPageSelector] hitsPerPage not defined.\nYou should probably use a `hits` widget or set the value `hitsPerPage`\nusing the searchParameters attribute of the instantsearch constructor."):window.console&&window.console.log("[Warning][hitsPerPageSelector] No option in `options`\nwith `value: hitsPerPage` (hitsPerPage: "+n.hitsPerPage+")"),l=[{value:void 0,label:""}].concat(l)),this.setHitsPerPage=function(e){return t.setQueryParameter("hitsPerPage",Number(e)).search()}},render:function(e){var t=e.state,n=e.results,r=t.hitsPerPage,i=0===n.nbHits;u.default.render(a.default.createElement(h,{cssClasses:v,currentValue:r,options:l,setValue:this.setHitsPerPage,shouldAutoHideContainer:i}),p)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(355),f=r(l),p=n(330),d=r(p),h=n(331),m=r(h),v=n(357),g=r(v),y=(0,c.bemHelper)("ais-hits-per-page-selector"),b="Usage:\nhitsPerPageSelector({\n container,\n options,\n [ cssClasses.{root,item}={} ],\n [ autoHideContainer=false ]\n})";t.default=i},function(e,t,n){function r(e,t,n){var r=s(e)?i:a;return n&&u(e,t,n)&&(t=void 0),r(e,o(t,3))}var i=n(118),o=n(106),a=n(356),s=n(47),u=n(213);e.exports=r},function(e,t,n){function r(e,t){var n;return i(e,function(e,r,i){return n=t(e,r,i),!n}),!!n}var i=n(157);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(325),c=r(u),l=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),s(t,[{key:"componentWillMount",value:function(){this.handleChange=this.handleChange.bind(this)}},{key:"handleChange",value:function(e){this.props.setValue(e.target.value)}},{key:"render",value:function(){var e=this,t=this.props,n=t.currentValue,r=t.options;return c.default.createElement("select",{className:this.props.cssClasses.root,onChange:this.handleChange,value:n},r.map(function(t){return c.default.createElement("option",{className:e.props.cssClasses.item,key:t.value,value:t.value},t.label)}))}}]),t}(c.default.Component);t.default=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributeName,r=e.sortBy,i=void 0===r?["count:desc","name:asc"]:r,a=e.limit,u=void 0===a?10:a,f=e.cssClasses,d=void 0===f?{}:f,m=e.templates,g=void 0===m?_.default:m,b=e.collapsible,w=void 0!==b&&b,P=e.transformData,C=e.autoHideContainer,O=void 0===C||C,S=e.showMore,E=void 0!==S&&S,F=(0,y.default)(E);if(F&&F.limit<u)throw new Error("showMore.limit configuration should be > than the limit in the main configuration");var k=F&&F.limit||u;if(!t||!n)throw new Error(j);var N=(0,l.getContainerNode)(t),T=(0,v.default)(x.default);O===!0&&(T=(0,h.default)(T));var A=n,M=F&&(0,l.prefixKeys)("show-more-",F.templates),H=M?o({},g,M):g,L={root:(0,p.default)(R(null),d.root),header:(0,p.default)(R("header"),d.header),body:(0,p.default)(R("body"),d.body),footer:(0,p.default)(R("footer"),d.footer),list:(0,p.default)(R("list"),d.list),item:(0,p.default)(R("item"),d.item),active:(0,p.default)(R("item","active"),d.active),link:(0,p.default)(R("link"),d.link),count:(0,p.default)(R("count"),d.count)};return{getConfiguration:function(e){var t={hierarchicalFacets:[{name:A,attributes:[n]}]},r=e.maxValuesPerFacet||0;return t.maxValuesPerFacet=Math.max(r,k),t},init:function(e){var t=e.templatesConfig,n=e.helper,r=e.createURL;this._templateProps=(0,l.prepareTemplateProps)({transformData:P,defaultTemplates:_.default,templatesConfig:t,templates:H}),this._createURL=function(e,t){return r(e.toggleRefinement(A,t))},this._toggleRefinement=function(e){return n.toggleRefinement(A,e).search()}},_prepareFacetValues:function(e,t){var n=this;return e.map(function(e){return e.url=n._createURL(t,e),e})},render:function(e){function t(e){return a(o.toggleRefinement(n,e))}var r=e.results,o=e.state,a=e.createURL,l=r.getFacetValues(A,{sortBy:i}).data||[];l=this._prepareFacetValues(l,o),c.default.render(s.default.createElement(T,{collapsible:w,createURL:t,cssClasses:L,facetValues:l,limitMax:k,limitMin:u,shouldAutoHideContainer:0===l.length,showMore:null!==F,templateProps:this._templateProps,toggleRefinement:this._toggleRefinement}),N)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(325),s=r(a),u=n(325),c=r(u),l=n(328),f=n(330),p=r(f),d=n(331),h=r(d),m=n(332),v=r(m),g=n(359),y=r(g),b=n(361),_=r(b),w=n(347),x=r(w),R=(0,l.bemHelper)("ais-menu"),j="Usage:\nmenu({\n container,\n attributeName,\n [ sortBy=['count:desc', 'name:asc'] ],\n [ limit=10 ],\n [ cssClasses.{root,list,item} ],\n [ templates.{header,item,footer} ],\n [ transformData.{item} ],\n [ autoHideContainer ],\n [ showMore.{templates: {active, inactive}, limit} ],\n [ collapsible=false ]\n})";t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(!e)return null;if(e===!0)return u;var t=o({},e);return e.templates||(t.templates=u.templates),e.limit||(t.limit=u.limit),t}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=i;var a=n(360),s=r(a),u={templates:s.default,limit:100}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={active:'<a class="ais-show-more ais-show-more__active">Show less</a>',inactive:'<a class="ais-show-more ais-show-more__inactive">Show more</a>'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'<a class="{{cssClasses.link}}" href="{{url}}">{{name}} <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span></a>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){var t=e.container,n=e.attributeName,r=e.operator,o=void 0===r?"or":r,s=e.sortBy,c=void 0===s?["count:desc","name:asc"]:s,p=e.limit,h=void 0===p?10:p,v=e.cssClasses,y=void 0===v?{}:v,_=e.templates,x=void 0===_?R.default:_,j=e.collapsible,S=void 0!==j&&j,E=e.transformData,F=e.autoHideContainer,k=void 0===F||F,N=e.showMore,T=void 0!==N&&N,A=(0,w.default)(T);if(A&&A.limit<h)throw new Error("showMore.limit configuration should be > than the limit in the main configuration");var M=A&&A.limit||h,H=P.default;if(!t||!n)throw new Error(O);H=(0,b.default)(H),k===!0&&(H=(0,g.default)(H));var L=(0,f.getContainerNode)(t);if(o&&(o=o.toLowerCase(),"and"!==o&&"or"!==o))throw new Error(O);var U=A&&(0,f.prefixKeys)("show-more-",A.templates),D=U?a({},x,U):x,I={root:(0,d.default)(C(null),y.root),header:(0,d.default)(C("header"),y.header),body:(0,d.default)(C("body"),y.body),footer:(0,d.default)(C("footer"),y.footer),list:(0,d.default)(C("list"),y.list),item:(0,d.default)(C("item"),y.item),active:(0,d.default)(C("item","active"),y.active),label:(0,d.default)(C("label"),y.label),checkbox:(0,d.default)(C("checkbox"),y.checkbox),count:(0,d.default)(C("count"),y.count)};return{getConfiguration:function(e){var t=i({},"and"===o?"facets":"disjunctiveFacets",[n]),r=e.maxValuesPerFacet||0;return t.maxValuesPerFacet=Math.max(r,M),t},init:function(e){var t=e.templatesConfig,r=e.helper;this._templateProps=(0,f.prepareTemplateProps)({transformData:E,defaultTemplates:R.default,templatesConfig:t,templates:D}),this.toggleRefinement=function(e){return r.toggleRefinement(n,e).search()}},render:function(e){function t(e){return o(i.toggleRefinement(n,e))}var r=e.results,i=e.state,o=e.createURL,a=r.getFacetValues(n,{sortBy:c}),s=(0,m.default)(a,{isRefined:!0}).length,f={header:{refinedFacetsCount:s}};l.default.render(u.default.createElement(H,{collapsible:S,createURL:t,cssClasses:I,facetValues:a,headerFooterData:f,limitMax:M,limitMin:h,shouldAutoHideContainer:0===a.length,showMore:null!==A,templateProps:this._templateProps,toggleRefinement:this.toggleRefinement}),L)}}}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=n(325),u=r(s),c=n(325),l=r(c),f=n(328),p=n(330),d=r(p),h=n(159),m=r(h),v=n(331),g=r(v),y=n(332),b=r(y),_=n(359),w=r(_),x=n(363),R=r(x),j=n(347),P=r(j),C=(0,f.bemHelper)("ais-refinement-list"),O="Usage:\nrefinementList({\n container,\n attributeName,\n [ operator='or' ],\n [ sortBy=['count:desc', 'name:asc'] ],\n [ limit=10 ],\n [ cssClasses.{root, header, body, footer, list, item, active, label, checkbox, count}],\n [ templates.{header,item,footer} ],\n [ transformData.{item} ],\n [ autoHideContainer=true ],\n [ collapsible=false ],\n [ showMore.{templates: {active, inactive}, limit} ],\n [ collapsible=false ]\n})";t.default=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'<label class="{{cssClasses.label}}">\n <input type="checkbox" class="{{cssClasses.checkbox}}" value="{{name}}" {{#isRefined}}checked{{/isRefined}} />{{name}}\n <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>\n</label>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.container,n=e.attributeName,r=e.options,i=e.cssClasses,s=void 0===i?{}:i,c=e.templates,f=void 0===c?P.default:c,h=e.collapsible,v=void 0!==h&&h,g=e.transformData,y=e.autoHideContainer,b=void 0===y||y;if(!t||!n||!r)throw new Error(E);var _=(0,d.getContainerNode)(t),x=(0,R.default)(O.default);b===!0&&(x=(0,w.default)(x));var j={root:(0,m.default)(S(null),s.root),header:(0,m.default)(S("header"),s.header),body:(0,m.default)(S("body"),s.body),footer:(0,m.default)(S("footer"),s.footer),list:(0,m.default)(S("list"),s.list),item:(0,m.default)(S("item"),s.item),label:(0,m.default)(S("label"),s.label),radio:(0,m.default)(S("radio"),s.radio),active:(0,m.default)(S("item","active"),s.active)};return{init:function(e){var t=e.templatesConfig,i=e.helper;this._templateProps=(0,d.prepareTemplateProps)({transformData:g,defaultTemplates:P.default,templatesConfig:t,templates:f}),this._toggleRefinement=function(e){var t=a(i.state,n,r,e);i.setState(t).search()}},render:function(e){function t(e){return c(a(s,n,r,e))}var i=e.results,s=e.state,c=e.createURL,f=r.map(function(e){return u({},e,{isRefined:o(s,n,e),attributeName:n})});p.default.render(l.default.createElement(x,{collapsible:v,createURL:t,cssClasses:j,facetValues:f,shouldAutoHideContainer:0===i.nbHits,templateProps:this._templateProps,toggleRefinement:this._toggleRefinement}),_)}}}function o(e,t,n){var r=e.getNumericRefinements(t);return void 0!==n.start&&void 0!==n.end&&n.start===n.end?s(r,"=",n.start):void 0!==n.start?s(r,">=",n.start):void 0!==n.end?s(r,"<=",n.end):void 0===n.start&&void 0===n.end?0===Object.keys(r).length:void 0}function a(e,t,n,r){var i=e,a=(0,g.default)(n,{name:r}),u=i.getNumericRefinements(t);if(void 0===a.start&&void 0===a.end)return i.clearRefinements(t);if(o(i,t,a)||(i=i.clearRefinements(t)),void 0!==a.start&&void 0!==a.end){if(a.start>a.end)throw new Error("option.start should be > to option.end");if(a.start===a.end)return i=s(u,"=",a.start)?i.removeNumericRefinement(t,"=",a.start):i.addNumericRefinement(t,"=",a.start)}return void 0!==a.start&&(i=s(u,">=",a.start)?i.removeNumericRefinement(t,">=",a.start):i.addNumericRefinement(t,">=",a.start)),void 0!==a.end&&(i=s(u,"<=",a.end)?i.removeNumericRefinement(t,"<=",a.end):i.addNumericRefinement(t,"<=",a.end)),i}function s(e,t,n){var r=void 0!==e[t],i=(0,b.default)(e[t],n);return r&&i}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=n(325),l=r(c),f=n(325),p=r(f),d=n(328),h=n(330),m=r(h),v=n(195),g=r(v),y=n(246),b=r(y),_=n(331),w=r(_),x=n(332),R=r(x),j=n(365),P=r(j),C=n(347),O=r(C),S=(0,d.bemHelper)("ais-refinement-list"),E="Usage:\nnumericRefinementList({\n container,\n attributeName,\n options,\n [ cssClasses.{root,header,body,footer,list,item,active,label,checkbox,count} ],\n [ templates.{header,item,footer} ],\n [ transformData.{item} ],\n [ autoHideContainer ],\n [ collapsible=false ]\n})";t.default=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'<label class="{{cssClasses.label}}">\n <input type="radio" class="{{cssClasses.checkbox}}" name="{{attributeName}}" {{#isRefined}}checked{{/isRefined}} />{{name}}\n</label>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.container,n=e.operator,r=void 0===n?"=":n,i=e.attributeName,o=e.options,s=e.cssClasses,l=void 0===s?{}:s,p=e.autoHideContainer,h=void 0!==p&&p,v=(0,c.getContainerNode)(t),b="Usage: numericSelector({\n container,\n attributeName,\n options,\n cssClasses.{root,item},\n autoHideContainer\n })",_=g.default;if(h===!0&&(_=(0,m.default)(_)),!t||!o||0===o.length||!i)throw new Error(b);var w={root:(0,f.default)(y(null),l.root),item:(0,f.default)(y("item"),l.item)};return{init:function(e){var t=e.helper,n=this._getRefinedValue(t);void 0!==n&&t.addNumericRefinement(i,r,n),this._refine=function(e){t.clearRefinements(i),void 0!==e&&t.addNumericRefinement(i,r,e),t.search()}},render:function(e){
var t=e.helper,n=e.results;u.default.render(a.default.createElement(_,{cssClasses:w,currentValue:this._getRefinedValue(t),options:o,setValue:this._refine,shouldAutoHideContainer:0===n.nbHits}),v)},_getRefinedValue:function(e){var t=e.getRefinements(i),n=(0,d.default)(t,{operator:r});return n&&void 0!==n.value&&void 0!==n.value[0]?n.value[0]:o[0].value}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(330),f=r(l),p=n(195),d=r(p),h=n(331),m=r(h),v=n(357),g=r(v),y=(0,c.bemHelper)("ais-numeric-selector");t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.cssClasses,r=void 0===n?{}:n,i=e.labels,o=void 0===i?{}:i,s=e.maxPages,c=e.padding,f=void 0===c?3:c,h=e.showFirstLast,v=void 0===h||h,w=e.autoHideContainer,x=void 0===w||w,R=e.scrollTo,j=void 0===R?"body":R,P=j;if(!t)throw new Error(_);P===!0&&(P="body");var C=(0,d.getContainerNode)(t),O=P!==!1&&(0,d.getContainerNode)(P),S=g.default;x===!0&&(S=(0,m.default)(S));var E={root:(0,p.default)(b(null),r.root),item:(0,p.default)(b("item"),r.item),link:(0,p.default)(b("link"),r.link),page:(0,p.default)(b("item","page"),r.page),previous:(0,p.default)(b("item","previous"),r.previous),next:(0,p.default)(b("item","next"),r.next),first:(0,p.default)(b("item","first"),r.first),last:(0,p.default)(b("item","last"),r.last),active:(0,p.default)(b("item","active"),r.active),disabled:(0,p.default)(b("item","disabled"),r.disabled)},F=(0,l.default)(o,y);return{init:function(e){var t=e.helper;this.setCurrentPage=function(e){t.setCurrentPage(e),O!==!1&&O.scrollIntoView(),t.search()}},getMaxPage:function(e){return void 0!==s?Math.min(s,e.nbPages):e.nbPages},render:function(e){var t=e.results,n=e.state,r=e.createURL;u.default.render(a.default.createElement(S,{createURL:function(e){return r(n.setPage(e))},cssClasses:E,currentPage:t.page,labels:F,nbHits:t.nbHits,nbPages:this.getMaxPage(t),padding:f,setCurrentPage:this.setCurrentPage,shouldAutoHideContainer:0===t.nbHits,showFirstLast:v}),C)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(207),l=r(c),f=n(330),p=r(f),d=n(328),h=n(331),m=r(h),v=n(368),g=r(v),y={previous:"‹",next:"›",first:"«",last:"»"},b=(0,d.bemHelper)("ais-pagination"),_="Usage:\npagination({\n container,\n [ cssClasses.{root,item,page,previous,next,first,last,active,disabled}={} ],\n [ labels.{previous,next,first,last} ],\n [ maxPages ],\n [ padding=3 ],\n [ showFirstLast=true ],\n [ autoHideContainer=true ],\n [ scrollTo='body' ]\n})";t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(325),c=r(u),l=n(155),f=r(l),p=n(369),d=r(p),h=n(328),m=n(371),v=r(m),g=n(375),y=r(g),b=n(330),_=r(b),w=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,d.default)(e,t.defaultProps)));return n.handleClick=n.handleClick.bind(n),n}return a(t,e),s(t,[{key:"pageLink",value:function(e){var t=e.label,n=e.ariaLabel,r=e.pageNumber,i=e.additionalClassName,o=void 0===i?null:i,a=e.isDisabled,s=void 0!==a&&a,u=e.isActive,l=void 0!==u&&u,f=e.createURL,p={item:(0,_.default)(this.props.cssClasses.item,o),link:(0,_.default)(this.props.cssClasses.link)};s?p.item=(0,_.default)(p.item,this.props.cssClasses.disabled):l&&(p.item=(0,_.default)(p.item,this.props.cssClasses.active));var d=f&&!s?f(r):"#";return c.default.createElement(y.default,{ariaLabel:n,cssClasses:p,handleClick:this.handleClick,isDisabled:s,key:t+r,label:t,pageNumber:r,url:d})}},{key:"previousPageLink",value:function(e,t){return this.pageLink({ariaLabel:"Previous",additionalClassName:this.props.cssClasses.previous,isDisabled:e.isFirstPage(),label:this.props.labels.previous,pageNumber:e.currentPage-1,createURL:t})}},{key:"nextPageLink",value:function(e,t){return this.pageLink({ariaLabel:"Next",additionalClassName:this.props.cssClasses.next,isDisabled:e.isLastPage(),label:this.props.labels.next,pageNumber:e.currentPage+1,createURL:t})}},{key:"firstPageLink",value:function(e,t){return this.pageLink({ariaLabel:"First",additionalClassName:this.props.cssClasses.first,isDisabled:e.isFirstPage(),label:this.props.labels.first,pageNumber:0,createURL:t})}},{key:"lastPageLink",value:function(e,t){return this.pageLink({ariaLabel:"Last",additionalClassName:this.props.cssClasses.last,isDisabled:e.isLastPage(),label:this.props.labels.last,pageNumber:e.total-1,createURL:t})}},{key:"pages",value:function e(t,n){var r=this,e=[];return(0,f.default)(t.pages(),function(i){var o=i===t.currentPage;e.push(r.pageLink({ariaLabel:i+1,additionalClassName:r.props.cssClasses.page,isActive:o,label:i+1,pageNumber:i,createURL:n}))}),e}},{key:"handleClick",value:function(e,t){(0,h.isSpecialClick)(t)||(t.preventDefault(),this.props.setCurrentPage(e))}},{key:"render",value:function(){var e=new v.default({currentPage:this.props.currentPage,total:this.props.nbPages,padding:this.props.padding}),t=this.props.createURL;return c.default.createElement("ul",{className:this.props.cssClasses.root},this.props.showFirstLast?this.firstPageLink(e,t):null,this.previousPageLink(e,t),this.pages(e,t),this.nextPageLink(e,t),this.props.showFirstLast?this.lastPageLink(e,t):null)}}]),t}(c.default.Component);w.defaultProps={nbHits:0,currentPage:0,nbPages:0},t.default=w},function(e,t,n){var r=n(100),i=n(99),o=n(370),a=n(315),s=i(function(e){return e.push(void 0,o),r(a,void 0,e)});e.exports=s},function(e,t,n){function r(e,t,n,a,s,u){return o(e)&&o(t)&&(u.set(t,e),i(e,t,void 0,r,u),u.delete(t)),e}var i=n(215),o=n(44);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(372),s=r(a),u=function(){function e(t){i(this,e),this.currentPage=t.currentPage,this.total=t.total,this.padding=t.padding}return o(e,[{key:"pages",value:function(){var e=this.total,t=this.currentPage,n=this.padding,r=this.nbPagesDisplayed(n,e);if(r===e)return(0,s.default)(0,e);var i=this.calculatePaddingLeft(t,n,e,r),o=r-i,a=t-i,u=t+o;return(0,s.default)(a,u)}},{key:"nbPagesDisplayed",value:function(e,t){return Math.min(2*e+1,t)}},{key:"calculatePaddingLeft",value:function(e,t,n,r){return e<=t?e:e>=n-t?r-(n-e):t}},{key:"isLastPage",value:function(){return this.currentPage===this.total-1}},{key:"isFirstPage",value:function(){return 0===this.currentPage}}]),e}();t.default=u},function(e,t,n){var r=n(373),i=r();e.exports=i},function(e,t,n){function r(e){return function(t,n,r){return r&&"number"!=typeof r&&o(t,n,r)&&(n=r=void 0),t=a(t),void 0===n?(n=t,t=0):n=a(n),r=void 0===r?t<n?1:-1:a(r),i(t,n,r,e)}}var i=n(374),o=n(213),a=n(185);e.exports=r},function(e,t){function n(e,t,n,o){for(var a=-1,s=i(r((t-e)/(n||1)),0),u=Array(s);s--;)u[o?s:++a]=e,e+=n;return u}var r=Math.ceil,i=Math.max;e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(192),p=r(f),d=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleClick=this.handleClick.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return!(0,p.default)(this.props,e)}},{key:"handleClick",value:function(e){this.props.handleClick(this.props.pageNumber,e)}},{key:"render",value:function(){var e=this.props,t=e.cssClasses,n=e.label,r=e.ariaLabel,i=e.url,o=e.isDisabled,a="span",u={className:t.link,dangerouslySetInnerHTML:{__html:n}};o||(a="a",u=s({},u,{"aria-label":r,href:i,onClick:this.handleClick}));var c=l.default.createElement(a,u);return l.default.createElement("li",{className:t.item},c)}}]),t}(l.default.Component);t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributeName,r=e.cssClasses,i=void 0===r?{}:r,a=e.templates,u=void 0===a?h.default:a,f=e.collapsible,d=void 0!==f&&f,m=e.labels,g=void 0===m?{}:m,b=e.currency,w=void 0===b?"$":b,P=e.autoHideContainer,C=void 0===P||P,O=w;if(!t||!n)throw new Error(j);var S=(0,l.getContainerNode)(t),E=(0,y.default)(x.default);C===!0&&(E=(0,v.default)(E));var F=o({button:"Go",separator:"to"},g),k={root:(0,_.default)(R(null),i.root),header:(0,_.default)(R("header"),i.header),body:(0,_.default)(R("body"),i.body),list:(0,_.default)(R("list"),i.list),link:(0,_.default)(R("link"),i.link),item:(0,_.default)(R("item"),i.item),active:(0,_.default)(R("item","active"),i.active),form:(0,_.default)(R("form"),i.form),label:(0,_.default)(R("label"),i.label),input:(0,_.default)(R("input"),i.input),currency:(0,_.default)(R("currency"),i.currency),button:(0,_.default)(R("button"),i.button),separator:(0,_.default)(R("separator"),i.separator),footer:(0,_.default)(R("footer"),i.footer)};return void 0!==g.currency&&g.currency!==O&&(O=g.currency),{getConfiguration:function(){return{facets:[n]}},_generateRanges:function(e){var t=e.getFacetStats(n);return(0,p.default)(t)},_extractRefinedRange:function(e){var t=e.getRefinements(n),r=void 0,i=void 0;return 0===t.length?[]:(t.forEach(function(e){e.operator.indexOf(">")!==-1?r=Math.floor(e.value[0]):e.operator.indexOf("<")!==-1&&(i=Math.ceil(e.value[0]))}),[{from:r,to:i,isRefined:!0}])},_refine:function(e,t,r){var i=this._extractRefinedRange(e);e.clearRefinements(n),0!==i.length&&i[0].from===t&&i[0].to===r||("undefined"!=typeof t&&e.addNumericRefinement(n,">=",Math.floor(t)),"undefined"!=typeof r&&e.addNumericRefinement(n,"<=",Math.ceil(r))),e.search()},init:function(e){var t=e.helper,n=e.templatesConfig;this._refine=this._refine.bind(this,t),this._templateProps=(0,l.prepareTemplateProps)({defaultTemplates:h.default,templatesConfig:n,templates:u})},render:function(e){var t=e.results,r=e.helper,i=e.state,o=e.createURL,a=void 0;t.hits.length>0?(a=this._extractRefinedRange(r),0===a.length&&(a=this._generateRanges(t))):a=[],a.map(function(e){var t=i.clearRefinements(n);return e.isRefined||(void 0!==e.from&&(t=t.addNumericRefinement(n,">=",Math.floor(e.from))),void 0!==e.to&&(t=t.addNumericRefinement(n,"<=",Math.ceil(e.to)))),e.url=o(t),e}),c.default.render(s.default.createElement(E,{collapsible:d,cssClasses:k,currency:O,facetValues:a,labels:F,refine:this._refine,shouldAutoHideContainer:0===a.length,templateProps:this._templateProps}),S)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(325),s=r(a),u=n(325),c=r(u),l=n(328),f=n(377),p=r(f),d=n(378),h=r(d),m=n(331),v=r(m),g=n(332),y=r(g),b=n(330),_=r(b),w=n(379),x=r(w),R=(0,l.bemHelper)("ais-price-ranges"),j="Usage:\npriceRanges({\n container,\n attributeName,\n [ currency=$ ],\n [ cssClasses.{root,header,body,list,item,active,link,form,label,input,currency,separator,button,footer} ],\n [ templates.{header,item,footer} ],\n [ labels.{currency,separator,button} ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t.default=i},function(e,t){"use strict";function n(e,t){var n=Math.round(e/t)*t;return n<1&&(n=1),n}function r(e){var t=void 0;t=e.avg<100?1:e.avg<1e3?10:100;for(var r=n(Math.round(e.avg),t),i=Math.ceil(e.min),o=n(Math.floor(e.max),t);o>e.max;)o-=t;var a=void 0,s=void 0,u=[];if(i!==o){for(a=i,u.push({to:a});a<r;)s=u[u.length-1].to,a=n(s+(r-i)/3,t),a<=s&&(a=s+1),u.push({from:s,to:a});for(;a<o;)s=u[u.length-1].to,a=n(s+(o-r)/3,t),a<=s&&(a=s+1),u.push({from:s,to:a});1===u.length&&a!==r&&(u.push({from:a,to:r}),a=r),1===u.length?(u[0].from=e.min,u[0].to=e.max):delete u[u.length-1].to}return u}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:"\n {{#from}}\n {{^to}}\n ≥\n {{/to}}\n {{currency}}{{from}}\n {{/from}}\n {{#to}}\n {{#from}}\n -\n {{/from}}\n {{^from}}\n ≤\n {{/from}}\n {{to}}\n {{/to}}\n ",footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(325),f=r(l),p=n(333),d=r(p),h=n(380),m=r(h),v=n(330),g=r(v),y=n(192),b=r(y),_=function(e){function t(){return o(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),c(t,[{key:"componentWillMount",value:function(){this.refine=this.refine.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return!(0,b.default)(this.props.facetValues,e.facetValues)}},{key:"getForm",value:function(){var e=u({currency:this.props.currency},this.props.labels),t=void 0;return t=1===this.props.facetValues.length?{from:void 0!==this.props.facetValues[0].from?this.props.facetValues[0].from:"",to:void 0!==this.props.facetValues[0].to?this.props.facetValues[0].to:""}:{from:"",to:""},f.default.createElement(m.default,{cssClasses:this.props.cssClasses,currentRefinement:t,labels:e,refine:this.refine})}},{key:"getItemFromFacetValue",value:function(e){var t=(0,g.default)(this.props.cssClasses.item,i({},this.props.cssClasses.active,e.isRefined)),n=e.from+"_"+e.to,r=this.refine.bind(this,e.from,e.to),o=u({currency:this.props.currency},e);return f.default.createElement("div",{className:t,key:n},f.default.createElement("a",{className:this.props.cssClasses.link,href:e.url,onClick:r},f.default.createElement(d.default,u({data:o,templateKey:"item"},this.props.templateProps))))}},{key:"refine",value:function(e,t,n){n.preventDefault(),this.props.refine(e,t)}},{key:"render",value:function(){var e=this;return f.default.createElement("div",null,f.default.createElement("div",{className:this.props.cssClasses.list},this.props.facetValues.map(function(t){return e.getItemFromFacetValue(t)})),this.getForm())}}]),t}(f.default.Component);_.defaultProps={cssClasses:{}},t.default=_},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={from:e.currentRefinement.from,to:e.currentRefinement.to},n}return s(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleSubmit=this.handleSubmit.bind(this)}},{key:"componentWillReceiveProps",value:function(e){this.setState({from:e.currentRefinement.from,to:e.currentRefinement.to})}},{key:"getInput",value:function(e){var t=this;return l.default.createElement("label",{className:this.props.cssClasses.label},l.default.createElement("span",{className:this.props.cssClasses.currency},this.props.labels.currency," "),l.default.createElement("input",{className:this.props.cssClasses.input,onChange:function(n){return t.setState(i({},e,n.target.value))},ref:e,type:"number",value:this.state[e]}))}},{key:"handleSubmit",value:function(e){var t=""!==this.refs.from.value?parseInt(this.refs.from.value,10):void 0,n=""!==this.refs.to.value?parseInt(this.refs.to.value,10):void 0;this.props.refine(t,n,e)}},{key:"render",value:function(){var e=this.getInput("from"),t=this.getInput("to"),n=this.handleSubmit;return l.default.createElement("form",{className:this.props.cssClasses.form,onSubmit:n,ref:"form"},e,l.default.createElement("span",{className:this.props.cssClasses.separator}," ",this.props.labels.separator," "),t,l.default.createElement("button",{className:this.props.cssClasses.button,type:"submit"},this.props.labels.button))}}]),t}(l.default.Component);f.defaultProps={cssClasses:{},labels:{}},t.default=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.container,n=e.placeholder,r=void 0===n?"":n,i=e.cssClasses,a=void 0===i?{}:i,f=e.poweredBy,d=void 0!==f&&f,m=e.wrapInput,g=void 0===m||m,b=e.autofocus,w=void 0===b?"auto":b,O=e.searchOnEnterKeyPressOnly,S=void 0!==O&&O,E=e.queryHook,F=window.addEventListener?"input":"propertychange";if(!t)throw new Error(C);return t=(0,l.getContainerNode)(t),"boolean"!=typeof w&&(w="auto"),d===!0&&(d={}),{getInput:function(){return"INPUT"===t.tagName?t:document.createElement("input")},wrapInput:function(e){var t=document.createElement("div"),n=(0,y.default)(R(null),a.root).split(" ");return n.forEach(function(e){return t.classList.add(e)}),t.appendChild(e),t},addDefaultAttributesToInput:function(e,t){var n={autocapitalize:"off",autocomplete:"off",autocorrect:"off",placeholder:r,role:"textbox",spellcheck:"false",type:"text",value:t};(0,p.default)(n,function(t,n){e.hasAttribute(n)||e.setAttribute(n,t)});var i=(0,y.default)(R("input"),a.input).split(" ");i.forEach(function(t){return e.classList.add(t)})},addPoweredBy:function(e){d=c({cssClasses:{},template:x.default.poweredBy},d);var t={root:(0,y.default)(R("powered-by"),d.cssClasses.root),link:(0,y.default)(R("powered-by-link"),d.cssClasses.link)},n="https://www.algolia.com/?utm_source=instantsearch.js&utm_medium=website&"+("utm_content="+location.hostname+"&")+"utm_campaign=poweredby",r={cssClasses:t,url:n},i=d.template,o=void 0;(0,h.default)(i)&&(o=_.default.compile(i).render(r)),(0,v.default)(i)&&(o=i(r));var a=document.createElement("div");a.innerHTML="<span>"+o.trim()+"</span>";var s=a.firstChild;e.parentNode.insertBefore(s,e.nextSibling)},init:function(e){function n(e){return E?void E(e,a):void i(e)}function r(e){e!==l.state.query&&(m=l.state.query,l.setQuery(e))}function i(e){void 0!==m&&m!==e&&l.search()}function a(e){r(e),i(e)}var c=e.state,l=e.helper,f=e.onHistoryChange,p="INPUT"===t.tagName,h=this._input=this.getInput(),m=void 0;if(this.addDefaultAttributesToInput(h,c.query),E||o(h,F,u(r)),S?o(h,"keyup",s(j,u(n))):(o(h,F,u(n)),("propertychange"===F||window.attachEvent)&&(o(h,"keyup",s(P,u(r))),o(h,"keyup",s(P,u(n))))),p){var v=document.createElement("div");h.parentNode.insertBefore(v,h);var y=h.parentNode,b=g?this.wrapInput(h):h;y.replaceChild(b,v)}else{var _=g?this.wrapInput(h):h;t.appendChild(_)}d&&this.addPoweredBy(h),f(function(e){h.value=e.query||""}),window.addEventListener("pageshow",function(){h.value=l.state.query}),(w===!0||"auto"===w&&""===l.state.query)&&(h.focus(),h.setSelectionRange(l.state.query.length,l.state.query.length))},render:function(e){var t=e.helper;document.activeElement!==this._input&&t.state.query!==this._input.value&&(this._input.value=t.state.query)}}}function o(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent("on"+t,n)}function a(e){return(e.currentTarget?e.currentTarget:e.srcElement).value}function s(e,t){return function(n){return n.keyCode===e&&t(n)}}function u(e){return function(t){return e(a(t))}}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=n(328),f=n(155),p=r(f),d=n(194),h=r(d),m=n(43),v=r(m),g=n(330),y=r(g),b=n(336),_=r(b),w=n(382),x=r(w),R=(0,l.bemHelper)("ais-search-box"),j=13,P=8,C="Usage:\nsearchBox({\n container,\n [ placeholder ],\n [ cssClasses.{input,poweredBy} ],\n [ poweredBy=false || poweredBy.{template, cssClasses.{root,link}} ],\n [ wrapInput ],\n [ autofocus ],\n [ searchOnEnterKeyPressOnly ],\n [ queryHook ]\n})";t.default=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={poweredBy:'\n<div class="{{cssClasses.root}}">\n Search by\n <a class="{{cssClasses.link}}" href="{{url}}" target="_blank">Algolia</a>\n</div>'}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributeName,r=e.tooltips,o=void 0===r||r,a=e.templates,u=void 0===a?j:a,f=e.collapsible,d=void 0!==f&&f,m=e.cssClasses,g=void 0===m?{}:m,b=e.step,w=void 0===b?1:b,C=e.pips,O=void 0===C||C,S=e.autoHideContainer,E=void 0===S||S,F=e.min,k=e.max;if(!t||!n)throw new Error(P);var N=(0,l.getContainerNode)(t),T=(0,v.default)(_.default);E===!0&&(T=(0,h.default)(T));var A={root:(0,y.default)(R(null),g.root),header:(0,y.default)(R("header"),g.header),body:(0,y.default)(R("body"),g.body),footer:(0,y.default)(R("footer"),g.footer)};return{getConfiguration:function(e){var t={disjunctiveFacets:[n]};return void 0===F&&void 0===k||e&&(!e.numericRefinements||void 0!==e.numericRefinements[n])||(t.numericRefinements=i({},n,{}),void 0!==F&&(t.numericRefinements[n][">="]=[F]),void 0!==k&&(t.numericRefinements[n]["<="]=[k])),t},_getCurrentRefinement:function(e){var t=e.state.getNumericRefinement(n,">="),r=e.state.getNumericRefinement(n,"<=");return t=t&&t.length?t[0]:-(1/0),r=r&&r.length?r[0]:1/0,{min:t,max:r}},_refine:function(e,t,r){e.clearRefinements(n),r[0]>t.min&&e.addNumericRefinement(n,">=",r[0]),r[1]<t.max&&e.addNumericRefinement(n,"<=",r[1]),e.search()},init:function(e){var t=e.templatesConfig;this._templateProps=(0,l.prepareTemplateProps)({defaultTemplates:j,templatesConfig:t,templates:u})},render:function(e){var t=e.results,r=e.helper,i=(0,p.default)(t.disjunctiveFacets,{name:n}),a=void 0!==i&&void 0!==i.stats?i.stats:{min:null,max:null},u=(0,x.default)(w)?function(e){return Math.round(Number(e)).toLocaleString()}:function(e){return Number(e).toLocaleString()};void 0!==F&&(a.min=F),void 0!==k&&(a.max=k);var l=this._getCurrentRefinement(r);void 0!==o.format&&(o=[{to:o.format},{to:o.format}]),c.default.render(s.default.createElement(T,{collapsible:d,cssClasses:A,onChange:this._refine.bind(this,r,a),pips:O,range:{min:Math.floor(a.min),max:Math.ceil(a.max)},shouldAutoHideContainer:a.min===a.max,start:[l.min,l.max],step:w,templateProps:this._templateProps,tooltips:o,pipsFormatter:u}),N)}}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(325),s=r(a),u=n(325),c=r(u),l=n(328),f=n(195),p=r(f),d=n(331),h=r(d),m=n(332),v=r(m),g=n(330),y=r(g),b=n(384),_=r(b),w=n(387),x=r(w),R=(0,l.bemHelper)("ais-range-slider"),j={header:"",footer:""},P="Usage:\nrangeSlider({\n container,\n attributeName,\n [ tooltips=true ],\n [ templates.{header, footer} ],\n [ cssClasses.{root, header, body, footer} ],\n [ step=1 ],\n [ pips=true ],\n [ autoHideContainer=true ],\n [ collapsible=false ],\n [ min ],\n [ max ]\n});\n";t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(167),p=r(f),d=n(385),h=r(d),m=n(192),v=r(m),g="ais-range-slider--",y=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleChange=this.handleChange.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return!(0,v.default)(this.props.range,e.range)||!(0,v.default)(this.props.start,e.start)}},{key:"handleChange",value:function(e,t,n){this.props.onChange(n)}},{key:"render",value:function(){if(this.props.range.min===this.props.range.max)return null;var e=void 0;return e=this.props.pips===!1?void 0:this.props.pips===!0||"undefined"==typeof this.props.pips?{mode:"positions",density:3,values:[0,50,100],stepped:!0,format:{to:this.props.pipsFormatter}}:this.props.pips,l.default.createElement(h.default,s({},(0,p.default)(this.props,["cssClasses","pipsFormatter"]),{animate:!1,behaviour:"snap",connect:!0,cssPrefix:g,onChange:this.handleChange,pips:e}))}}]),t}(l.default.Component);t.default=y},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var i=e,o=t,a=n;r=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,o);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(a)}var c=Object.getPrototypeOf(i);if(null===c)return;e=c,t=o,n=a,r=!0,s=c=void 0}},c=n(325),l=r(c),f=n(386),p=r(f),d=function(e){function t(){i(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return o(t,e),s(t,[{key:"componentDidMount",value:function(){this.props.disabled?this.sliderContainer.setAttribute("disabled",!0):this.sliderContainer.removeAttribute("disabled"),this.createSlider()}},{key:"componentDidUpdate",value:function(){this.props.disabled?this.sliderContainer.setAttribute("disabled",!0):this.sliderContainer.removeAttribute("disabled"),this.slider.destroy(),this.createSlider()}},{key:"componentWillUnmount",value:function(){this.slider.destroy()}},{key:"createSlider",value:function(){var e=this.slider=p.default.create(this.sliderContainer,a({},this.props));this.props.onUpdate&&e.on("update",this.props.onUpdate),this.props.onChange&&e.on("change",this.props.onChange),this.props.onSlide&&e.on("slide",this.props.onSlide),this.props.onStart&&e.on("start",this.props.onStart),this.props.onEnd&&e.on("end",this.props.onEnd)}},{key:"render",value:function(){var e=this;return l.default.createElement("div",{ref:function(t){e.sliderContainer=t}})}}]),t}(l.default.Component);d.propTypes={animate:l.default.PropTypes.bool,behaviour:l.default.PropTypes.string,connect:l.default.PropTypes.oneOfType([l.default.PropTypes.oneOf(["lower","upper"]),l.default.PropTypes.bool]),cssPrefix:l.default.PropTypes.string,direction:l.default.PropTypes.oneOf(["ltr","rtl"]),disabled:l.default.PropTypes.bool,limit:l.default.PropTypes.number,margin:l.default.PropTypes.number,onChange:l.default.PropTypes.func,onEnd:l.default.PropTypes.func,onSlide:l.default.PropTypes.func,onStart:l.default.PropTypes.func,onUpdate:l.default.PropTypes.func,orientation:l.default.PropTypes.oneOf(["horizontal","vertical"]),pips:l.default.PropTypes.object,range:l.default.PropTypes.object.isRequired,start:l.default.PropTypes.arrayOf(l.default.PropTypes.number).isRequired,
step:l.default.PropTypes.number,tooltips:l.default.PropTypes.oneOfType([l.default.PropTypes.bool,l.default.PropTypes.arrayOf(l.default.PropTypes.shape({to:l.default.PropTypes.func}))])},e.exports=d},function(e,t,n){var r,i,o;!function(n){i=[],r=n,o="function"==typeof r?r.apply(t,i):r,!(void 0!==o&&(e.exports=o))}(function(){"use strict";function e(e){return e.filter(function(e){return!this[e]&&(this[e]=!0)},{})}function t(e,t){return Math.round(e/t)*t}function n(e){var t=e.getBoundingClientRect(),n=e.ownerDocument,r=n.documentElement,i=f();return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(i.x=0),{top:t.top+i.y-r.clientTop,left:t.left+i.x-r.clientLeft}}function r(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function i(e,t,n){u(e,t),setTimeout(function(){c(e,t)},n)}function o(e){return Math.max(Math.min(e,100),0)}function a(e){return Array.isArray(e)?e:[e]}function s(e){var t=e.split(".");return t.length>1?t[1].length:0}function u(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function c(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function l(e,t){return e.classList?e.classList.contains(t):new RegExp("\\b"+t+"\\b").test(e.className)}function f(){var e=void 0!==window.pageXOffset,t="CSS1Compat"===(document.compatMode||""),n=e?window.pageXOffset:t?document.documentElement.scrollLeft:document.body.scrollLeft,r=e?window.pageYOffset:t?document.documentElement.scrollTop:document.body.scrollTop;return{x:n,y:r}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function d(e,t){return 100/(t-e)}function h(e,t){return 100*t/(e[1]-e[0])}function m(e,t){return h(e,e[0]<0?t+Math.abs(e[0]):t-e[0])}function v(e,t){return t*(e[1]-e[0])/100+e[0]}function g(e,t){for(var n=1;e>=t[n];)n+=1;return n}function y(e,t,n){if(n>=e.slice(-1)[0])return 100;var r,i,o,a,s=g(n,e);return r=e[s-1],i=e[s],o=t[s-1],a=t[s],o+m([r,i],n)/d(o,a)}function b(e,t,n){if(n>=100)return e.slice(-1)[0];var r,i,o,a,s=g(n,t);return r=e[s-1],i=e[s],o=t[s-1],a=t[s],v([r,i],(n-o)*d(o,a))}function _(e,n,r,i){if(100===i)return i;var o,a,s=g(i,e);return r?(o=e[s-1],a=e[s],i-o>(a-o)/2?a:o):n[s-1]?e[s-1]+t(i-e[s-1],n[s-1]):i}function w(e,t,n){var i;if("number"==typeof t&&(t=[t]),"[object Array]"!==Object.prototype.toString.call(t))throw new Error("noUiSlider: 'range' contains invalid value.");if(i="min"===e?0:"max"===e?100:parseFloat(e),!r(i)||!r(t[0]))throw new Error("noUiSlider: 'range' value isn't numeric.");n.xPct.push(i),n.xVal.push(t[0]),i?n.xSteps.push(!isNaN(t[1])&&t[1]):isNaN(t[1])||(n.xSteps[0]=t[1])}function x(e,t,n){return!t||void(n.xSteps[e]=h([n.xVal[e],n.xVal[e+1]],t)/d(n.xPct[e],n.xPct[e+1]))}function R(e,t,n,r){this.xPct=[],this.xVal=[],this.xSteps=[r||!1],this.xNumSteps=[!1],this.snap=t,this.direction=n;var i,o=[];for(i in e)e.hasOwnProperty(i)&&o.push([e[i],i]);for(o.length&&"object"==typeof o[0][0]?o.sort(function(e,t){return e[0][0]-t[0][0]}):o.sort(function(e,t){return e[0]-t[0]}),i=0;i<o.length;i++)w(o[i][1],o[i][0],this);for(this.xNumSteps=this.xSteps.slice(0),i=0;i<this.xNumSteps.length;i++)x(i,this.xNumSteps[i],this)}function j(e,t){if(!r(t))throw new Error("noUiSlider: 'step' is not numeric.");e.singleStep=t}function P(e,t){if("object"!=typeof t||Array.isArray(t))throw new Error("noUiSlider: 'range' is not an object.");if(void 0===t.min||void 0===t.max)throw new Error("noUiSlider: Missing 'min' or 'max' in 'range'.");if(t.min===t.max)throw new Error("noUiSlider: 'range' 'min' and 'max' cannot be equal.");e.spectrum=new R(t,e.snap,e.dir,e.singleStep)}function C(e,t){if(t=a(t),!Array.isArray(t)||!t.length||t.length>2)throw new Error("noUiSlider: 'start' option is incorrect.");e.handles=t.length,e.start=t}function O(e,t){if(e.snap=t,"boolean"!=typeof t)throw new Error("noUiSlider: 'snap' option must be a boolean.")}function S(e,t){if(e.animate=t,"boolean"!=typeof t)throw new Error("noUiSlider: 'animate' option must be a boolean.")}function E(e,t){if(e.animationDuration=t,"number"!=typeof t)throw new Error("noUiSlider: 'animationDuration' option must be a number.")}function F(e,t){if("lower"===t&&1===e.handles)e.connect=1;else if("upper"===t&&1===e.handles)e.connect=2;else if(t===!0&&2===e.handles)e.connect=3;else{if(t!==!1)throw new Error("noUiSlider: 'connect' option doesn't match handle count.");e.connect=0}}function k(e,t){switch(t){case"horizontal":e.ort=0;break;case"vertical":e.ort=1;break;default:throw new Error("noUiSlider: 'orientation' option is invalid.")}}function N(e,t){if(!r(t))throw new Error("noUiSlider: 'margin' option must be numeric.");if(0!==t&&(e.margin=e.spectrum.getMargin(t),!e.margin))throw new Error("noUiSlider: 'margin' option is only supported on linear sliders.")}function T(e,t){if(!r(t))throw new Error("noUiSlider: 'limit' option must be numeric.");if(e.limit=e.spectrum.getMargin(t),!e.limit)throw new Error("noUiSlider: 'limit' option is only supported on linear sliders.")}function A(e,t){switch(t){case"ltr":e.dir=0;break;case"rtl":e.dir=1,e.connect=[0,2,1,3][e.connect];break;default:throw new Error("noUiSlider: 'direction' option was not recognized.")}}function M(e,t){if("string"!=typeof t)throw new Error("noUiSlider: 'behaviour' must be a string containing options.");var n=t.indexOf("tap")>=0,r=t.indexOf("drag")>=0,i=t.indexOf("fixed")>=0,o=t.indexOf("snap")>=0,a=t.indexOf("hover")>=0;if(r&&!e.connect)throw new Error("noUiSlider: 'drag' behaviour must be used with 'connect': true.");e.events={tap:n||o,drag:r,fixed:i,snap:o,hover:a}}function H(e,t){var n;if(t!==!1)if(t===!0)for(e.tooltips=[],n=0;n<e.handles;n++)e.tooltips.push(!0);else{if(e.tooltips=a(t),e.tooltips.length!==e.handles)throw new Error("noUiSlider: must pass a formatter for all handles.");e.tooltips.forEach(function(e){if("boolean"!=typeof e&&("object"!=typeof e||"function"!=typeof e.to))throw new Error("noUiSlider: 'tooltips' must be passed a formatter or 'false'.")})}}function L(e,t){if(e.format=t,"function"==typeof t.to&&"function"==typeof t.from)return!0;throw new Error("noUiSlider: 'format' requires 'to' and 'from' methods.")}function U(e,t){if(void 0!==t&&"string"!=typeof t&&t!==!1)throw new Error("noUiSlider: 'cssPrefix' must be a string or `false`.");e.cssPrefix=t}function D(e,t){if(void 0!==t&&"object"!=typeof t)throw new Error("noUiSlider: 'cssClasses' must be an object.");if("string"==typeof e.cssPrefix){e.cssClasses={};for(var n in t)t.hasOwnProperty(n)&&(e.cssClasses[n]=e.cssPrefix+t[n])}else e.cssClasses=t}function I(e){var t,n={margin:0,limit:0,animate:!0,animationDuration:300,format:B};t={step:{r:!1,t:j},start:{r:!0,t:C},connect:{r:!0,t:F},direction:{r:!0,t:A},snap:{r:!1,t:O},animate:{r:!1,t:S},animationDuration:{r:!1,t:E},range:{r:!0,t:P},orientation:{r:!1,t:k},margin:{r:!1,t:N},limit:{r:!1,t:T},behaviour:{r:!0,t:M},format:{r:!1,t:L},tooltips:{r:!1,t:H},cssPrefix:{r:!1,t:U},cssClasses:{r:!1,t:D}};var r={connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal",cssPrefix:"noUi-",cssClasses:{target:"target",base:"base",origin:"origin",handle:"handle",handleLower:"handle-lower",handleUpper:"handle-upper",horizontal:"horizontal",vertical:"vertical",background:"background",connect:"connect",ltr:"ltr",rtl:"rtl",draggable:"draggable",drag:"state-drag",tap:"state-tap",active:"active",stacking:"stacking",tooltip:"tooltip",pips:"pips",pipsHorizontal:"pips-horizontal",pipsVertical:"pips-vertical",marker:"marker",markerHorizontal:"marker-horizontal",markerVertical:"marker-vertical",markerNormal:"marker-normal",markerLarge:"marker-large",markerSub:"marker-sub",value:"value",valueHorizontal:"value-horizontal",valueVertical:"value-vertical",valueNormal:"value-normal",valueLarge:"value-large",valueSub:"value-sub"}};return Object.keys(t).forEach(function(i){if(void 0===e[i]&&void 0===r[i]){if(t[i].r)throw new Error("noUiSlider: '"+i+"' is required.");return!0}t[i].t(n,void 0===e[i]?r[i]:e[i])}),n.pips=e.pips,n.style=n.ort?"top":"left",n}function V(t,r,d){function h(e,t,n){var r=e+t[0],i=e+t[1];return n?(r<0&&(i+=Math.abs(r)),i>100&&(r-=i-100),[o(r),o(i)]):[r,i]}function m(e,t){e.preventDefault();var n,r,i=0===e.type.indexOf("touch"),o=0===e.type.indexOf("mouse"),a=0===e.type.indexOf("pointer"),s=e;return 0===e.type.indexOf("MSPointer")&&(a=!0),i&&(n=e.changedTouches[0].pageX,r=e.changedTouches[0].pageY),t=t||f(),(o||a)&&(n=e.clientX+t.x,r=e.clientY+t.y),s.pageOffset=t,s.points=[n,r],s.cursor=o||a,s}function v(e,t){var n=document.createElement("div"),i=document.createElement("div"),o=[r.cssClasses.handleLower,r.cssClasses.handleUpper];return e&&o.reverse(),u(i,r.cssClasses.handle),u(i,o[t]),u(n,r.cssClasses.origin),n.appendChild(i),n}function g(e,t,n){switch(e){case 1:u(t,r.cssClasses.connect),u(n[0],r.cssClasses.background);break;case 3:u(n[1],r.cssClasses.background);case 2:u(n[0],r.cssClasses.connect);case 0:u(t,r.cssClasses.background)}}function y(e,t,n){var r,i=[];for(r=0;r<e;r+=1)i.push(n.appendChild(v(t,r)));return i}function b(e,t,n){u(n,r.cssClasses.target),0===e?u(n,r.cssClasses.ltr):u(n,r.cssClasses.rtl),0===t?u(n,r.cssClasses.horizontal):u(n,r.cssClasses.vertical);var i=document.createElement("div");return u(i,r.cssClasses.base),n.appendChild(i),i}function _(e,t){if(!r.tooltips[t])return!1;var n=document.createElement("div");return n.className=r.cssClasses.tooltip,e.firstChild.appendChild(n)}function w(){r.dir&&r.tooltips.reverse();var e=$.map(_);r.dir&&(e.reverse(),r.tooltips.reverse()),Q("update",function(t,n,i){e[n]&&(e[n].innerHTML=r.tooltips[n]===!0?t[n]:r.tooltips[n].to(i[n]))})}function x(e,t,n){if("range"===e||"steps"===e)return Z.xVal;if("count"===e){var r,i=100/(t-1),o=0;for(t=[];(r=o++*i)<=100;)t.push(r);e="positions"}return"positions"===e?t.map(function(e){return Z.fromStepping(n?Z.getStep(e):e)}):"values"===e?n?t.map(function(e){return Z.fromStepping(Z.getStep(Z.toStepping(e)))}):t:void 0}function R(t,n,r){function i(e,t){return(e+t).toFixed(7)/1}var o=Z.direction,a={},s=Z.xVal[0],u=Z.xVal[Z.xVal.length-1],c=!1,l=!1,f=0;return Z.direction=0,r=e(r.slice().sort(function(e,t){return e-t})),r[0]!==s&&(r.unshift(s),c=!0),r[r.length-1]!==u&&(r.push(u),l=!0),r.forEach(function(e,o){var s,u,p,d,h,m,v,g,y,b,_=e,w=r[o+1];if("steps"===n&&(s=Z.xNumSteps[o]),s||(s=w-_),_!==!1&&void 0!==w)for(u=_;u<=w;u=i(u,s)){for(d=Z.toStepping(u),h=d-f,g=h/t,y=Math.round(g),b=h/y,p=1;p<=y;p+=1)m=f+p*b,a[m.toFixed(5)]=["x",0];v=r.indexOf(u)>-1?1:"steps"===n?2:0,!o&&c&&(v=0),u===w&&l||(a[d.toFixed(5)]=[u,v]),f=d}}),Z.direction=o,a}function j(e,t,n){function i(e,t){var n=t===r.cssClasses.value,i=n?p:d,o=n?l:f;return t+" "+i[r.ort]+" "+o[e]}function o(e,t,n){return'class="'+i(n[1],t)+'" style="'+r.style+": "+e+'%"'}function a(e,i){Z.direction&&(e=100-e),i[1]=i[1]&&t?t(i[0],i[1]):i[1],c+="<div "+o(e,r.cssClasses.marker,i)+"></div>",i[1]&&(c+="<div "+o(e,r.cssClasses.value,i)+">"+n.to(i[0])+"</div>")}var s=document.createElement("div"),c="",l=[r.cssClasses.valueNormal,r.cssClasses.valueLarge,r.cssClasses.valueSub],f=[r.cssClasses.markerNormal,r.cssClasses.markerLarge,r.cssClasses.markerSub],p=[r.cssClasses.valueHorizontal,r.cssClasses.valueVertical],d=[r.cssClasses.markerHorizontal,r.cssClasses.markerVertical];return u(s,r.cssClasses.pips),u(s,0===r.ort?r.cssClasses.pipsHorizontal:r.cssClasses.pipsVertical),Object.keys(e).forEach(function(t){a(t,e[t])}),s.innerHTML=c,s}function P(e){var t=e.mode,n=e.density||1,r=e.filter||!1,i=e.values||!1,o=e.stepped||!1,a=x(t,i,o),s=R(n,t,a),u=e.format||{to:Math.round};return X.appendChild(j(s,r,u))}function C(){var e=K.getBoundingClientRect(),t="offset"+["Width","Height"][r.ort];return 0===r.ort?e.width||K[t]:e.height||K[t]}function O(e,t,n){var i;for(i=0;i<r.handles;i++)if(Y[i]===-1)return;void 0!==t&&1!==r.handles&&(t=Math.abs(t-r.dir)),Object.keys(te).forEach(function(r){var i=r.split(".")[0];e===i&&te[r].forEach(function(e){e.call(J,a(V()),t,a(S(Array.prototype.slice.call(ee))),n||!1,Y)})})}function S(e){return 1===e.length?e[0]:r.dir?e.reverse():e}function E(e,t,n,i){var o=function(t){return!X.hasAttribute("disabled")&&(!l(X,r.cssClasses.tap)&&(t=m(t,i.pageOffset),!(e===G.start&&void 0!==t.buttons&&t.buttons>1)&&((!i.hover||!t.buttons)&&(t.calcPoint=t.points[r.ort],void n(t,i)))))},a=[];return e.split(" ").forEach(function(e){t.addEventListener(e,o,!1),a.push([e,o])}),a}function F(e,t){if(navigator.appVersion.indexOf("MSIE 9")===-1&&0===e.buttons&&0!==t.buttonsProperty)return k(e,t);var n,r,i=t.handles||$,o=!1,a=100*(e.calcPoint-t.start)/t.baseSize,s=i[0]===$[0]?0:1;if(n=h(a,t.positions,i.length>1),o=L(i[0],n[s],1===i.length),i.length>1){if(o=L(i[1],n[s?0:1],!1)||o)for(r=0;r<t.handles.length;r++)O("slide",r)}else o&&O("slide",s)}function k(e,t){var n=K.querySelector("."+r.cssClasses.active),i=t.handles[0]===$[0]?0:1;null!==n&&c(n,r.cssClasses.active),e.cursor&&(document.body.style.cursor="",document.body.removeEventListener("selectstart",document.body.noUiListener));var o=document.documentElement;o.noUiListeners.forEach(function(e){o.removeEventListener(e[0],e[1])}),c(X,r.cssClasses.drag),O("set",i),O("change",i),void 0!==t.handleNumber&&O("end",t.handleNumber)}function N(e,t){"mouseout"===e.type&&"HTML"===e.target.nodeName&&null===e.relatedTarget&&k(e,t)}function T(e,t){var n=document.documentElement;if(1===t.handles.length){if(t.handles[0].hasAttribute("disabled"))return!1;u(t.handles[0].children[0],r.cssClasses.active)}e.preventDefault(),e.stopPropagation();var i=E(G.move,n,F,{start:e.calcPoint,baseSize:C(),pageOffset:e.pageOffset,handles:t.handles,handleNumber:t.handleNumber,buttonsProperty:e.buttons,positions:[Y[0],Y[$.length-1]]}),o=E(G.end,n,k,{handles:t.handles,handleNumber:t.handleNumber}),a=E("mouseout",n,N,{handles:t.handles,handleNumber:t.handleNumber});if(n.noUiListeners=i.concat(o,a),e.cursor){document.body.style.cursor=getComputedStyle(e.target).cursor,$.length>1&&u(X,r.cssClasses.drag);var s=function(){return!1};document.body.noUiListener=s,document.body.addEventListener("selectstart",s,!1)}void 0!==t.handleNumber&&O("start",t.handleNumber)}function A(e){var t,o,a=e.calcPoint,s=0;return e.stopPropagation(),$.forEach(function(e){s+=n(e)[r.style]}),t=a<s/2||1===$.length?0:1,$[t].hasAttribute("disabled")&&(t=t?0:1),a-=n(K)[r.style],o=100*a/C(),r.events.snap||i(X,r.cssClasses.tap,r.animationDuration),!$[t].hasAttribute("disabled")&&(L($[t],o),O("slide",t,!0),O("set",t,!0),O("change",t,!0),void(r.events.snap&&T(e,{handles:[$[t]]})))}function M(e){var t=e.calcPoint-n(K)[r.style],i=Z.getStep(100*t/C()),o=Z.fromStepping(i);Object.keys(te).forEach(function(e){"hover"===e.split(".")[0]&&te[e].forEach(function(e){e.call(J,o)})})}function H(e){if(e.fixed||$.forEach(function(e,t){E(G.start,e.children[0],T,{handles:[e],handleNumber:t})}),e.tap&&E(G.start,K,A,{handles:$}),e.hover&&E(G.move,K,M,{hover:!0}),e.drag){var t=[K.querySelector("."+r.cssClasses.connect)];u(t[0],r.cssClasses.draggable),e.fixed&&t.push($[t[0]===$[0]?1:0].children[0]),t.forEach(function(e){E(G.start,e,T,{handles:$})})}}function L(e,t,n){var i=e!==$[0]?1:0,a=Y[0]+r.margin,s=Y[1]-r.margin,l=Y[0]+r.limit,f=Y[1]-r.limit;return $.length>1&&(t=i?Math.max(t,a):Math.min(t,s)),n!==!1&&r.limit&&$.length>1&&(t=i?Math.min(t,l):Math.max(t,f)),t=Z.getStep(t),t=o(t),t!==Y[i]&&(window.requestAnimationFrame?window.requestAnimationFrame(function(){e.style[r.style]=t+"%"}):e.style[r.style]=t+"%",e.previousSibling||(c(e,r.cssClasses.stacking),t>50&&u(e,r.cssClasses.stacking)),Y[i]=t,ee[i]=Z.fromStepping(t),O("update",i),!0)}function U(e,t){var n,i,o;for(r.limit&&(e+=1),n=0;n<e;n+=1)i=n%2,o=t[i],null!==o&&o!==!1&&("number"==typeof o&&(o=String(o)),o=r.format.from(o),(o===!1||isNaN(o)||L($[i],Z.toStepping(o),n===3-r.dir)===!1)&&O("update",i))}function D(e,t){var n,o,s=a(e);for(t=void 0===t||!!t,r.dir&&r.handles>1&&s.reverse(),r.animate&&Y[0]!==-1&&i(X,r.cssClasses.tap,r.animationDuration),n=$.length>1?3:1,1===s.length&&(n=1),U(n,s),o=0;o<$.length;o++)null!==s[o]&&t&&O("set",o)}function V(){var e,t=[];for(e=0;e<r.handles;e+=1)t[e]=r.format.to(ee[e]);return S(t)}function q(){for(var e in r.cssClasses)r.cssClasses.hasOwnProperty(e)&&c(X,r.cssClasses[e]);for(;X.firstChild;)X.removeChild(X.firstChild);delete X.noUiSlider}function B(){var e=Y.map(function(e,t){var n=Z.getApplicableStep(e),r=s(String(n[2])),i=ee[t],o=100===e?null:n[2],a=Number((i-n[2]).toFixed(r)),u=0===e?null:a>=n[1]?n[2]:n[0]||!1;return[u,o]});return S(e)}function Q(e,t){te[e]=te[e]||[],te[e].push(t),"update"===e.split(".")[0]&&$.forEach(function(e,t){O("update",t)})}function z(e){var t=e&&e.split(".")[0],n=t&&e.substring(t.length);Object.keys(te).forEach(function(e){var r=e.split(".")[0],i=e.substring(r.length);t&&t!==r||n&&n!==i||delete te[e]})}function W(e,t){var n=V(),i=I({start:[0,0],margin:e.margin,limit:e.limit,step:void 0===e.step?r.singleStep:e.step,range:e.range,animate:e.animate,snap:void 0===e.snap?r.snap:e.snap});["margin","limit","range","animate"].forEach(function(t){void 0!==e[t]&&(r[t]=e[t])}),i.spectrum.direction=Z.direction,Z=i.spectrum,Y=[-1,-1],D(e.start||n,t)}var K,$,J,G=p(),X=t,Y=[-1,-1],Z=r.spectrum,ee=[],te={};if(X.noUiSlider)throw new Error("Slider was already initialized.");return K=b(r.dir,r.ort,X),$=y(r.handles,r.dir,K),g(r.connect,X,$),r.pips&&P(r.pips),r.tooltips&&w(),J={destroy:q,steps:B,on:Q,off:z,get:V,set:D,updateOptions:W,options:d,target:X,pips:P},H(r.events),J}function q(e,t){if(!e.nodeName)throw new Error("noUiSlider.create requires a single element.");var n=I(t,e),r=V(e,n,t);return r.set(n.start),e.noUiSlider=r,r}R.prototype.getMargin=function(e){return 2===this.xPct.length&&h(this.xVal,e)},R.prototype.toStepping=function(e){return e=y(this.xVal,this.xPct,e),this.direction&&(e=100-e),e},R.prototype.fromStepping=function(e){return this.direction&&(e=100-e),b(this.xVal,this.xPct,e)},R.prototype.getStep=function(e){return this.direction&&(e=100-e),e=_(this.xPct,this.xSteps,this.snap,e),this.direction&&(e=100-e),e},R.prototype.getApplicableStep=function(e){var t=g(e,this.xPct),n=100===e?2:1;return[this.xNumSteps[t-2],this.xVal[t-n],this.xNumSteps[t-n]]},R.prototype.convert=function(e){return this.getStep(this.toStepping(e))};var B={to:function(e){return void 0!==e&&e.toFixed(2)},from:Number};return{create:q}})},function(e,t,n){var r=n(388);e.exports=Number.isInteger||function(e){return"number"==typeof e&&r(e)&&Math.floor(e)===e}},function(e,t,n){"use strict";var r=n(389);e.exports=Number.isFinite||function(e){return!("number"!=typeof e||r(e)||e===1/0||e===-(1/0))}},function(e,t){"use strict";e.exports=Number.isNaN||function(e){return e!==e}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.indices,r=e.cssClasses,i=void 0===r?{}:r,o=e.autoHideContainer,s=void 0!==o&&o;if(!t||!n)throw new Error(w);var c=(0,d.getContainerNode)(t),f=b.default;s===!0&&(f=(0,g.default)(f));var h=(0,p.default)(n,function(e){return{label:e.label,value:e.name}}),v={root:(0,m.default)(_(null),i.root),item:(0,m.default)(_("item"),i.item)};return{init:function(e){var t=e.helper,r=t.getIndex(),i=(0,l.default)(n,{name:r})!==-1;if(!i)throw new Error("[sortBySelector]: Index "+r+" not present in `indices`");this.setIndex=function(e){return t.setIndex(e).search()}},render:function(e){var t=e.helper,n=e.results;u.default.render(a.default.createElement(f,{cssClasses:v,currentValue:t.getIndex(),options:h,setValue:this.setIndex,shouldAutoHideContainer:0===n.nbHits}),c)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(197),l=r(c),f=n(162),p=r(f),d=n(328),h=n(330),m=r(h),v=n(331),g=r(v),y=n(357),b=r(y),_=(0,d.bemHelper)("ais-sort-by-selector"),w="Usage:\nsortBySelector({\n container,\n indices,\n [cssClasses.{root,item}={}],\n [autoHideContainer=false]\n})";t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.container,n=e.attributeName,r=e.max,i=void 0===r?5:r,o=e.cssClasses,s=void 0===o?{}:o,l=e.labels,p=void 0===l?b.default:l,h=e.templates,v=void 0===h?g.default:h,y=e.collapsible,_=void 0!==y&&y,j=e.transformData,P=e.autoHideContainer,C=void 0===P||P,O=(0,c.getContainerNode)(t),S=(0,m.default)(w.default);if(C===!0&&(S=(0,d.default)(S)),!t||!n)throw new Error(R);var E={root:(0,f.default)(x(null),s.root),header:(0,f.default)(x("header"),s.header),body:(0,f.default)(x("body"),s.body),footer:(0,f.default)(x("footer"),s.footer),list:(0,f.default)(x("list"),s.list),item:(0,f.default)(x("item"),s.item),link:(0,f.default)(x("link"),s.link),disabledLink:(0,f.default)(x("link","disabled"),s.disabledLink),count:(0,f.default)(x("count"),s.count),star:(0,f.default)(x("star"),s.star),emptyStar:(0,f.default)(x("star","empty"),s.emptyStar),active:(0,f.default)(x("item","active"),s.active)};return{getConfiguration:function(){return{disjunctiveFacets:[n]}},init:function(e){var t=e.templatesConfig,n=e.helper;this._templateProps=(0,c.prepareTemplateProps)({transformData:j,defaultTemplates:g.default,templatesConfig:t,templates:v}),this._toggleRefinement=this._toggleRefinement.bind(this,n)},render:function(e){function t(e){return c(s.toggleRefinement(n,e))}for(var r=e.helper,o=e.results,s=e.state,c=e.createURL,l=[],f={},d=i-1;d>=0;--d)f[d]=0;o.getFacetValues(n).forEach(function(e){var t=Math.round(e.name);if(t&&!(t>i-1))for(var n=t;n>=1;--n)f[n]+=e.count});for(var h=this._getRefinedStar(r),m=i-1;m>=1;--m){var v=f[m];if(!h||m===h||0!==v){for(var g=[],y=1;y<=i;++y)g.push(y<=m);l.push({stars:g,name:String(m),count:v,isRefined:h===m,labels:p})}}u.default.render(a.default.createElement(S,{collapsible:_,createURL:t,cssClasses:E,facetValues:l,shouldAutoHideContainer:0===o.nbHits,templateProps:this._templateProps,toggleRefinement:this._toggleRefinement}),O)},_toggleRefinement:function(e,t){var r=this._getRefinedStar(e)===Number(t);if(e.clearRefinements(n),!r)for(var o=Number(t);o<=i;++o)e.addDisjunctiveFacetRefinement(n,o);e.search()},_getRefinedStar:function(e){var t=void 0,r=e.getRefinements(n);return r.forEach(function(e){(!t||Number(e.value)<t)&&(t=Number(e.value))}),t}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(330),f=r(l),p=n(331),d=r(p),h=n(332),m=r(h),v=n(392),g=r(v),y=n(393),b=r(y),_=n(347),w=r(_),x=(0,c.bemHelper)("ais-star-rating"),R="Usage:\nstarRating({\n container,\n attributeName,\n [ max=5 ],\n [ cssClasses.{root,header,body,footer,list,item,active,link,disabledLink,star,emptyStar,count} ],\n [ templates.{header,item,footer} ],\n [ transformData.{item} ],\n [ labels.{andUp} ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t.default=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'<a class="{{cssClasses.link}}{{^count}} {{cssClasses.disabledLink}}{{/count}}" {{#count}}href="{{href}}"{{/count}}>\n {{#stars}}<span class="{{#.}}{{cssClasses.star}}{{/.}}{{^.}}{{cssClasses.emptyStar}}{{/.}}"></span>{{/stars}}\n {{labels.andUp}}\n {{#count}}<span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>{{/count}}\n</a>',footer:""}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={andUp:"& Up"}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.cssClasses,r=void 0===n?{}:n,i=e.autoHideContainer,o=void 0===i||i,s=e.templates,l=void 0===s?b.default:s,p=e.collapsible,h=void 0!==p&&p,v=e.transformData;if(!t)throw new Error(w);var y=(0,c.getContainerNode)(t),x=(0,d.default)(m.default);if(o===!0&&(x=(0,f.default)(x)),!y)throw new Error(w);var R={body:(0,g.default)(_("body"),r.body),footer:(0,g.default)(_("footer"),r.footer),header:(0,g.default)(_("header"),r.header),root:(0,g.default)(_(null),r.root),time:(0,g.default)(_("time"),r.time)};return{init:function(e){var t=e.templatesConfig;this._templateProps=(0,c.prepareTemplateProps)({transformData:v,defaultTemplates:b.default,templatesConfig:t,templates:l})},render:function(e){var t=e.results;u.default.render(a.default.createElement(x,{collapsible:h,cssClasses:R,hitsPerPage:t.hitsPerPage,nbHits:t.nbHits,nbPages:t.nbPages,page:t.page,processingTimeMS:t.processingTimeMS,query:t.query,shouldAutoHideContainer:0===t.nbHits,templateProps:this._templateProps}),y)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(325),a=r(o),s=n(325),u=r(s),c=n(328),l=n(331),f=r(l),p=n(332),d=r(p),h=n(395),m=r(h),v=n(330),g=r(v),y=n(396),b=r(y),_=(0,c.bemHelper)("ais-stats"),w="Usage:\nstats({\n container,\n [ templates.{header,body,footer} ],\n [ transformData.{body} ],\n [ autoHideContainer]\n})";t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(325),l=r(c),f=n(333),p=r(f),d=function(e){function t(){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),u(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.nbHits!==e.hits||this.props.processingTimeMS!==e.processingTimeMS}},{key:"render",value:function(){var e={hasManyResults:this.props.nbHits>1,hasNoResults:0===this.props.nbHits,hasOneResult:1===this.props.nbHits,hitsPerPage:this.props.hitsPerPage,nbHits:this.props.nbHits,nbPages:this.props.nbPages,page:this.props.page,processingTimeMS:this.props.processingTimeMS,query:this.props.query,cssClasses:this.props.cssClasses};return l.default.createElement(p.default,s({data:e,templateKey:"body"},this.props.templateProps))}}]),t}(l.default.Component);t.default=d},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",body:'{{#hasNoResults}}No results{{/hasNoResults}}\n {{#hasOneResult}}1 result{{/hasOneResult}}\n {{#hasManyResults}}{{#helpers.formatNumber}}{{nbHits}}{{/helpers.formatNumber}} results{{/hasManyResults}}\n <span class="{{cssClasses.time}}">found in {{processingTimeMS}}ms</span>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributeName,r=e.label,i=e.values,a=void 0===i?{on:!0,off:void 0}:i,u=e.templates,l=void 0===u?s.default:u,p=e.collapsible,h=void 0!==p&&p,v=e.cssClasses,y=void 0===v?{}:v,R=e.transformData,j=e.autoHideContainer,P=void 0===j||j,C=(0,o.getContainerNode)(t);if(!t||!n||!r)throw new Error(x);var O=(0,d.default)(m.default);P===!0&&(O=(0,f.default)(O));var S=void 0!==a.off,E={root:(0,c.default)(_(null),y.root),header:(0,c.default)(_("header"),y.header),body:(0,c.default)(_("body"),y.body),footer:(0,c.default)(_("footer"),y.footer),list:(0,c.default)(_("list"),y.list),item:(0,c.default)(_("item"),y.item),active:(0,c.default)(_("item","active"),y.active),label:(0,c.default)(_("label"),y.label),checkbox:(0,c.default)(_("checkbox"),y.checkbox),count:(0,c.default)(_("count"),y.count)},F={attributeName:n,label:r,userValues:a,templates:l,collapsible:h,transformData:R,hasAnOffValue:S,containerNode:C,RefinementList:O,cssClasses:E};return{getConfiguration:function(e,t){var r=w(n,e)||w(n,t),i=r?(0,b.default)(F):(0,g.default)(F);return this.init=i.init.bind(i),this.render=i.render.bind(i),i.getConfiguration(e,t)},init:function(){},render:function(){}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(328),a=n(398),s=r(a),u=n(330),c=r(u),l=n(331),f=r(l),p=n(332),d=r(p),h=n(347),m=r(h),v=n(399),g=r(v),y=n(400),b=r(y),_=(0,o.bemHelper)("ais-toggle"),w=function(e,t){return t&&t.facetsRefinements&&void 0!==t.facetsRefinements[e]},x="Usage:\ntoggle({\n container,\n attributeName,\n label,\n [ values={on: true, off: undefined} ],\n [ cssClasses.{root,header,body,footer,list,item,active,label,checkbox,count} ],\n [ templates.{header,item,footer} ],\n [ transformData.{item} ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t.default=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={header:"",item:'<label class="{{cssClasses.label}}">\n <input type="checkbox" class="{{cssClasses.checkbox}}" value="{{name}}" {{#isRefined}}checked{{/isRefined}} />{{name}}\n <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>\n</label>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(195),o=r(i),a=n(325),s=r(a),u=n(325),c=r(u),l=n(398),f=r(l),p=n(328),d=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.attributeName,n=e.label,r=e.userValues,i=e.templates,a=e.collapsible,u=e.transformData,l=e.hasAnOffValue,d=e.containerNode,h=e.RefinementList,m=e.cssClasses;return{getConfiguration:function(){return{disjunctiveFacets:[t]}},toggleRefinement:function(e,n,i){var o=r.on,a=r.off;i?(e.removeDisjunctiveFacetRefinement(t,o),l&&e.addDisjunctiveFacetRefinement(t,a)):(l&&e.removeDisjunctiveFacetRefinement(t,a),e.addDisjunctiveFacetRefinement(t,o)),e.search()},init:function(e){var n=e.state,o=e.helper,a=e.templatesConfig;if(this._templateProps=(0,p.prepareTemplateProps)({transformData:u,defaultTemplates:f.default,templatesConfig:a,templates:i}),this.toggleRefinement=this.toggleRefinement.bind(this,o),l){var s=n.isDisjunctiveFacetRefined(t,r.on);s||o.addDisjunctiveFacetRefinement(t,r.off)}},render:function(e){function i(){return v(p.removeDisjunctiveFacetRefinement(t,g?y:r.off).addDisjunctiveFacetRefinement(t,g?r.off:y))}var u=e.helper,f=e.results,p=e.state,v=e.createURL,g=u.state.isDisjunctiveFacetRefined(t,r.on),y=r.on,b=void 0!==r.off&&r.off,_=f.getFacetValues(t),w=(0,o.default)(_,{name:y.toString()}),x={name:n,isRefined:void 0!==w&&w.isRefined,count:void 0===w?null:w.count},R=l?(0,o.default)(_,{name:b.toString()}):void 0,j={name:n,isRefined:void 0!==R&&R.isRefined,count:void 0===R?f.nbHits:R.count},P=g?j:x,C={name:n,isRefined:g,count:void 0===P?null:P.count,onFacetValue:x,offFacetValue:j};c.default.render(s.default.createElement(h,{collapsible:a,createURL:i,cssClasses:m,facetValues:[C],shouldAutoHideContainer:0===C.count||null===C.count,templateProps:this._templateProps,toggleRefinement:this.toggleRefinement}),d)}}};t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.attributeName,n=e.label,r=e.userValues,i=e.templates,o=e.collapsible,s=e.transformData,c=e.hasAnOffValue,f=e.containerNode,h=e.RefinementList,m=e.cssClasses;return{getConfiguration:function(){return{facets:[t]}},toggleRefinement:function(e,n,i){var o=r.on,a=r.off;
i?(e.removeFacetRefinement(t,o),c&&e.addFacetRefinement(t,a)):(c&&e.removeFacetRefinement(t,a),e.addFacetRefinement(t,o)),e.search()},init:function(e){var n=e.state,o=e.helper,a=e.templatesConfig;if(this._templateProps=(0,d.prepareTemplateProps)({transformData:s,defaultTemplates:p.default,templatesConfig:a,templates:i}),this.toggleRefinement=this.toggleRefinement.bind(this,o),c){var u=n.isFacetRefined(t,r.on);u||o.addFacetRefinement(t,r.off)}},render:function(e){function i(){return d(p.toggleRefinement(t,v))}var s=e.helper,c=e.results,p=e.state,d=e.createURL,v=s.state.isFacetRefined(t,r.on),g=v?r.on:r.off,y=void 0;if("number"==typeof g)y=c.getFacetStats(t).sum;else{var b=(0,a.default)(c.getFacetValues(t),{name:v.toString()});y=void 0!==b?b.count:null}var _={name:n,isRefined:v,count:y};l.default.render(u.default.createElement(h,{collapsible:o,createURL:i,cssClasses:m,facetValues:[_],shouldAutoHideContainer:0===c.nbHits,templateProps:this._templateProps,toggleRefinement:this.toggleRefinement}),f)}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=n(195),a=r(o),s=n(325),u=r(s),c=n(325),l=r(c),f=n(398),p=r(f),d=n(328)}])});
//# sourceMappingURL=instantsearch-preact.min.js.map |
src/components/Annotation.js | cltk/annotations | // @flow
import React from 'react'
import {
ANNOTATION_BLUE,
ANNOTATION_HOVER_BLUE
} from '../constants'
export type Props = {
children: string | Object,
entityKey: string,
hoverEntityKey: string,
onClick: (entityKey: string) => void,
onHover: (entityKey: ?string) => void,
}
export const AnnotationComponent = (props: Props) => {
const hoverEntityKey = props.hoverEntityKey || ''
const style = {
backgroundColor: hoverEntityKey === props.entityKey ?
ANNOTATION_HOVER_BLUE :
ANNOTATION_BLUE,
cursor: 'pointer',
display: 'inline-block',
}
const handleClick = () => props.onClick(props.entityKey)
const handleMouseLeave = () => props.onHover('')
const handleMouseEnter = () => props.onHover(props.entityKey)
return (
<span
onClick={handleClick}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
style={style}
>
{props.children}
</span>
)
}
const AnnotationWrapper = (
hoverEntityKey: string,
onHover: (entityKey: ?string) => void,
onClick: (entityKey: string) => void,
) => {
return (props: Props) => (
<AnnotationComponent
{...props}
hoverEntityKey={hoverEntityKey}
onClick={onClick}
onHover={onHover}
/>
)
}
export default AnnotationWrapper
|
files/xe-core/1.7.5.2/common/js/jquery-1.x.min.js | cake654326/jsdelivr | /*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.2.min.map
!*/
(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e){return this}if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n){return !n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n)){for(i in n){x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i])}}return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2]){return r.find(e)}this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++){if(null!=(o=arguments[l])){for(i in o){e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r))}}}return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body){return setTimeout(x.ready)}x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return !isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e)){return !1}try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf")){return !1}}catch(r){return !1}if(x.support.ownLast){for(n in e){return v.call(e,n)}}for(n in e){}return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e){return !1}return !0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e){return null}"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n){return null}try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++){if(r=t.apply(e[i],n),r===!1){break}}}else{for(i in e){if(r=t.apply(e[i],n),r===!1){break}}}}else{if(a){for(;o>i;i++){if(r=t.call(e[i],i,e[i]),r===!1){break}}}else{for(i in e){if(r=t.call(e[i],i,e[i]),r===!1){break}}}}return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m){return m.call(t,e,n)}for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++){if(n in t&&t[n]===e){return n}}}return -1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r){for(;r>o;o++){e[i++]=n[o]}}else{while(n[o]!==t){e[i++]=n[o++]}}return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++){r=!!t(e[o],o),n!==r&&i.push(e[o])}return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a){for(;o>i;i++){r=t(e[i],i,n),null!=r&&(s[s.length]=r)}}else{for(i in e){r=t(e[i],i,n),null!=r&&(s[s.length]=r)}}return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r){x.access(e,n,l,r[l],!0,a,s)}}else{if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n)){for(;u>l;l++){n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)))}}}return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t){a[o]=e.style[o],e.style[o]=t[o]}i=n.apply(e,r||[]);for(o in t){e.style[o]=a[o]}return i}}),x.ready.promise=function(t){if(!n){if(n=x.Deferred(),"complete"===a.readyState){setTimeout(x.ready)}else{if(a.addEventListener){a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1)}else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}}}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++){if(this[t]===e){return t}}return -1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]){}e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e){return n}if(1!==(l=t.nodeType)&&9!==l){return[]}if(h&&!i){if(o=Z.exec(e)){if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode){return n}if(a.id===s){return n.push(a),n}}else{if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s){return n.push(a),n}}}else{if(o[2]){return M.apply(n,t.getElementsByTagName(e)),n}if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName){return M.apply(n,t.getElementsByClassName(s)),n}}}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--){c[u]=m+yt(c[u])}y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x){try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return !!e(t)}catch(n){return !1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--){o.attrHandle[n[r]]=t}}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r){return r}if(n){while(n=n.nextSibling){if(n===t){return -1}}}return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--){n[i=o[a]]&&(n[i]=!(r[i]=n[i]))}})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++]){1===n.nodeType&&r.push(n)}return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t){while(t=t.parentNode){if(t===e){return !0}}}return !1},A=d.compareDocumentPosition?function(e,t){if(e===t){return S=!0,0}var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t){return S=!0,0}if(!o||!a){return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0}if(o===a){return pt(e,t)}r=e;while(r=r.parentNode){s.unshift(r)}r=t;while(r=r.parentNode){l.unshift(r)}while(s[i]===l[i]){i++}return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t))){try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType){return n}}catch(i){}}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++]){t===e[o]&&(i=n.push(o))}while(i--){e.splice(n[i],1)}}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent){return e.textContent}for(e=e.firstChild;e;e=e.nextSibling){n+=a(e)}}else{if(3===i||4===i){return e.nodeValue}}}else{for(;t=e[r];r++){n+=a(t)}}return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return !0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return !!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g]){if(s?p.nodeName.toLowerCase()===y:1===p.nodeType){return !1}}h=g="only"===e&&!h&&"nextSibling"}return !0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop()){if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}}else{if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T){f=u[1]}else{while(p=++d&&p&&p[g]||(f=d=0)||h.pop()){if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t)){break}}}}return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--){i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--){(o=a[s])&&(e[s]=!(t[s]=o))}}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do{if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang")){return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-")}}while((t=t.parentNode)&&1===t.nodeType);return !1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling){if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType){return !1}}return !0},parent:function(e){return !o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2){e.push(n)}return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2){e.push(n)}return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;){e.push(r)}return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;){e.push(r)}return e})}},o.pseudos.nth=o.pseudos.eq;for(n in {radio:!0,checkbox:!0,file:!0,password:!0,image:!0}){o.pseudos[n]=ft(n)}for(n in {submit:!0,reset:!0}){o.pseudos[n]=dt(n)}function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c){return t?0:c.slice(0)}s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter){!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length))}if(!n){break}}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++){r+=e[t].value}return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r]){if(1===t.nodeType||o){return e(t,n,i)}}}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r]){if((1===t.nodeType||o)&&e(t,n,s)){return !0}}}else{while(t=t[r]){if(1===t.nodeType||o){if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i){return l===!0}}else{if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0){return !0}}}}}}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--){if(!e[i](t,n,r)){return !1}}return !0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++){(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s))}return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--){(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}}if(o){if(i||e){if(i){u=[],c=y.length;while(c--){(p=y[c])&&u.push(m[c]=p)}i(null,y=[],u,l)}c=y.length;while(c--){(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}}else{y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)}})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return !a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++){if(n=o.relative[e[l].type]){f=[vt(bt(f),n)]}else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++){if(o.relative[e[r].type]){break}}return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||0.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++]){if(m(h,l,c)){p.push(h);break}}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++]){m(x,y,l,c)}if(s){if(v>0){while(b--){x[b]||y[b]||(y[b]=q.call(p))}}y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--){o=Tt(t[n]),o[b]?r.push(o):i.push(o)}o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++){at(e,t[r],n)}return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t){return n}e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type]){break}if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e){return M.apply(n,i),n}break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++){if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1){l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return !l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return !u},fireWith:function(e,t){return !l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return !!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1){for(s=Array(r),l=Array(r),u=Array(r);r>t;t++){n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i}}return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length){return t}s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in {submit:!0,change:!0,focusin:!0}){d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1}d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t)){break}return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n){return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--){delete r[t[i]]}if(n?!I(r):!x.isEmptyObject(r)){return}}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType){return !1}var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return !t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++){i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]))}x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else{r=t}}return r}function I(e){var t;for(t in e){if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t){return !1}}return !0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--){r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l))}return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e)){return this.each(function(t){x(this).addClass(e.call(this,t,this.className))})}if(l){for(t=(e||"").match(T)||[];s>a;a++){if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++]){0>r.indexOf(" "+i+" ")&&(r+=i+" ")}n.className=x.trim(r)}}}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e)){return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))})}if(l){for(t=(e||"").match(T)||[];s>a;a++){if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++]){while(r.indexOf(" "+i+" ")>=0){r=r.replace(" "+i+" "," ")}}n.className=e?x.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++]){o.hasClass(t)?o.removeClass(t):o.addClass(t)}}else{(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")}})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++){if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0){return !0}}return !1},val:function(e){var n,r,i,o=this[0];if(arguments.length){return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set" in r&&r.set(this,o,"value")!==t||(this.value=o))})}if(o){return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get" in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++){if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o){return t}a.push(t)}}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--){r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0)}return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s){return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get" in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set" in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))}},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType){while(n=o[i++]){r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)}}},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s){return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set" in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get" in o&&null!==(i=o.get(e,n))?i:e[n]}},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return !0}function ot(){return !1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--){s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0)}e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--){if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--){a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a))}l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else{for(d in c){x.event.remove(e,d+t[u],n,r,!0)}}}x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode){h.push(u),f=u}f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped()){n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault()}if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped()){(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type)){for(;u!=this;u=u.parentNode||this){if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++){i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i)}o.length&&s.push({elem:u,handlers:o})}}}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando]){return e}var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--){n=r[t],e[n]=o[n]}return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus){try{return this.focus(),!1}catch(e){}}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e){this.on(a,n,r,e[a],o)}return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1){i=ot}else{if(!i){return this}}return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj){return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this}if("object"==typeof e){for(o in e){this.off(o,n,e[o])}return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e){return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++){if(x.contains(r[t],this)){return !0}}}))}for(t=0;i>t;t++){x.find(e,r[t],n)}return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++){if(x.contains(this,n[t])){return !0}}})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return !!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++){for(n=this[r];n&&n!==t;n=n.parentNode){if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}}}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do{e=e[t]}while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r))){1===o.nodeType&&i.push(o),o=o[n]}return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling){1===e.nodeType&&e!==t&&n.push(e)}return n}});function ft(e,t,n){if(x.isFunction(t)){return x.grep(e,function(e,r){return !!t.call(e,r,e)!==n})}if(t.nodeType){return x.grep(e,function(e){return e===t!==n})}if("string"==typeof t){if(st.test(t)){return x.filter(t,e,n)}t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement){while(t.length){n.createElement(t.pop())}}return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++){t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n))}return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild){e.removeChild(e.firstChild)}e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t){return 1===n.nodeType?n.innerHTML.replace(gt,""):t}if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++){n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e)}n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h)){return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)})}if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++){i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u)}if(o){for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++){i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")))}}l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++){x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s){for(r=0,i=s[n].length;i>r;r++){x.event.add(t,n,s[n][r])}}}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events){x.removeEvent(t,r,i.handle)}t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++){n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get())}return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s){for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++){!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n))}}return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e))){for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a){r[a]&&Ot(i,r[a])}}if(t){if(n){for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++){Mt(i,r[a])}}else{Mt(e,o)}}return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++){if(o=e[h],o||0===o){if("object"===x.type(o)){x.merge(d,o.nodeType?[o]:o)}else{if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--){s=s.lastChild}if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--){x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild){s.removeChild(s.firstChild)}s=f.lastChild}else{d.push(t.createTextNode(o))}}}}s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++]){if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++]){kt.test(o.type||"")&&n.push(o)}}}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++){if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events){for(r in a.events){f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle)}}u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e)){return this.each(function(t){x(this).wrapAll(e.call(this,t))})}if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType){e=e.firstChild}return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e){return t}var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--){if(t=en[i]+n,t in e){return t}}return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++){r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))))}for(a=0;s>a;a++){r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"))}return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++){a[n[s]]=x.css(e,n[s],!1,o)}return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t){return s&&"get" in s&&(o=s.get(e,!1,i))!==t?o:u[n]}if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set" in s&&(r=s.set(e,r,i))===t))){try{u[n]=r}catch(c){}}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get" in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2){"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)))}return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i)){return i}r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?0.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return !x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++){i[e+Zt[r]+t]=o[r]||o[r-2]||o[0]}return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e)){x.each(e,function(){o(this.name,this.value)})}else{for(r in e){gn(r,e[r],n,o)}}return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t)){x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)})}else{if(n||"object"!==x.type(t)){r(e,t)}else{for(i in t){gn(e+"["+i+"]",t[i],n,r)}}}}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]!*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="!*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n)){while(r=o[i++]){"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n){n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i])}return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn){return Sn.apply(this,arguments)}var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a)){c[t[1].toLowerCase()]=t[2]}}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e){if(2>b){for(t in e){m[t]=[m[t],e[t]]}}else{C.always(e[C.status])}}return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b){return C}l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers){C.setRequestHeader(i,p.headers[i])}if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b)){return C.abort()}w="abort";for(i in {success:1,error:1,complete:1}){C[i](p[i])}if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b)){throw N}k(-1,N)}}else{k(-1,"No Transport")}function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0]){u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"))}if(o){for(s in l){if(l[s]&&l[s].test(o)){u.unshift(s);break}}}if(u[0] in r){a=u[0]}else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1]){for(a in e.converters){u[a.toLowerCase()]=e.converters[a]}}o=c.shift();while(o){if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift()){if("*"===o){o=l}else{if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a){for(i in u){if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}}}if(a!==!0){if(a&&e["throws"]){t=a(t)}else{try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}}}}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn){Pn[e](t,!0)}};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return !this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials" in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields){for(s in n.xhrFields){l[s]=n.xhrFields[s]}}n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i){l.setRequestHeader(s,i[s])}}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState)){if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i){4!==l.readyState&&l.abort()}else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do{s=s||".5",a/=s,x.style(n.elem,e,a+o)}while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++){if(r=i[o].call(n,t,e)){return r}}}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i){return !1}var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++){u.tweens[a].run(o)}return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i){return this}for(i=!0;r>n;n++){u.tweens[n].run(1)}return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++){if(r=Gn[o].call(u,e,c,u.opts)){return r}}return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e){if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand" in a){o=a.expand(o),delete e[r];for(n in o){n in e||(e[n]=o[n],t[n]=i)}}else{t[r]=i}}}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++){n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)}},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height" in t||"width" in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show")){continue}c[r]=d&&d[r]||x.style(e,r)}}if(!x.isEmptyObject(c)){d?"hidden" in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c){x.style(e,t,c[t])}});for(r in c){a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n){a[n]&&a[n].stop&&i(a[n])}else{for(n in a){a[n]&&a[n].stop&&Jn.test(n)&&i(a[n])}}for(n=o.length;n--;){o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1))}(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;){o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1))}for(t=0;a>t;t++){r[t]&&r[t].finish&&r[t].finish.call(this)}delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t){n=Zt[i],r["margin"+n]=r["padding"+n]=e}return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return 0.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++){e=n[r],e()||n[r]!==e||n.splice(r--,1)}n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length){return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)})}var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s){return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o}},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using" in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position")){e=e.offsetParent}return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
/*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license !*/
jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){function r(n){var r=t.console;i[n]||(i[n]=!0,e.migrateWarnings.push(n),r&&r.warn&&!e.migrateMute&&(r.warn("JQMIGRATE: "+n),e.migrateTrace&&r.trace&&r.trace()))}function a(t,a,i,o){if(Object.defineProperty){try{return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){return r(o),i},set:function(e){r(o),i=e}}),n}catch(s){}}e._definePropertyBroken=!0,t[a]=i}var i={};e.migrateWarnings=[],!e.migrateMute&&t.console&&t.console.log&&t.console.log("JQMIGRATE: Logging is active"),e.migrateTrace===n&&(e.migrateTrace=!0),e.migrateReset=function(){i={},e.migrateWarnings.length=0},"BackCompat"===document.compatMode&&r("jQuery is not compatible with Quirks Mode");var o=e("<input/>",{size:1}).attr("size")&&e.attrFn,s=e.attr,u=e.attrHooks.value&&e.attrHooks.value.get||function(){return null},c=e.attrHooks.value&&e.attrHooks.value.set||function(){return n},l=/^(?:input|button)$/i,d=/^[238]$/,p=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",o||{},"jQuery.attrFn is deprecated"),e.attr=function(t,a,i,u){var c=a.toLowerCase(),g=t&&t.nodeType;return u&&(4>s.length&&r("jQuery.fn.attr( props, pass ) is deprecated"),t&&!d.test(g)&&(o?a in o:e.isFunction(e.fn[a])))?e(t)[a](i):("type"===a&&i!==n&&l.test(t.nodeName)&&t.parentNode&&r("Can't change the 'type' of an input or button in IE 6/7/8"),!e.attrHooks[c]&&p.test(c)&&(e.attrHooks[c]={get:function(t,r){var a,i=e.prop(t,r);return i===!0||"boolean"!=typeof i&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:function(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase())),r}},f.test(c)&&r("jQuery.fn.attr('"+c+"') may use property instead of attribute")),s.call(e,t,a,i))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?u.apply(this,arguments):("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply(this,arguments):("input"!==a&&"option"!==a&&r("jQuery.fn.attr('value', val) no longer sets properties"),e.value=t,n)}};var g,h,v=e.fn.init,m=e.parseJSON,y=/^([^<]*)(<[\w\W]+>)([^>]*)$/;e.fn.init=function(t,n,a){var i;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(i=y.exec(e.trim(t)))&&i[0]&&("<"!==t.charAt(0)&&r("$(html) HTML strings must start with '<' character"),i[3]&&r("$(html) HTML text after last tag is ignored"),"#"===i[0].charAt(0)&&(r("HTML string cannot start with a '#' character"),e.error("JQMIGRATE: Invalid selector string (XSS)")),n&&n.context&&(n=n.context),e.parseHTML)?v.call(this,e.parseHTML(i[2],n,!0),n,a):v.apply(this,arguments)},e.fn.init.prototype=e.fn,e.parseJSON=function(e){return e||null===e?m.apply(this,arguments):(r("jQuery.parseJSON requires a valid JSON string"),null)},e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e.browser||(g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!0,h.version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser=h),a(e,"browser",e.browser,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is deprecated"),t},e.ajaxSetup({converters:{"text json":e.parseJSON}});var b=e.fn.data;e.fn.data=function(t){var a,i,o=this[0];return !o||"events"!==t||1!==arguments.length||(a=e.data(o,t),i=e._data(o,t),a!==n&&a!==i||i===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),i)};var j=/\/(java|ecma)script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,i,o){a=a||document,a=!a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery.clean() is deprecated");var s,u,c,l,d=[];if(e.merge(d,e.buildFragment(t,a).childNodes),i){for(c=function(e){return !e.type||j.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):i.appendChild(e):n},s=0;null!=(u=d[s]);s++){e.nodeName(u,"script")&&c(u)||(i.appendChild(u),u.getElementsByTagName!==n&&(l=e.grep(e.merge([],u.getElementsByTagName("script")),c),d.splice.apply(d,[s+1,0].concat(l)),s+=l.length))}}return d});var Q=e.event.add,x=e.event.remove,k=e.event.trigger,N=e.fn.toggle,T=e.fn.live,M=e.fn.die,S="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",C=RegExp("\\b(?:"+S+")\\b"),H=/(?:^|\s)hover(\.\S+|)\b/,A=function(t){return"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),e.event.dispatch&&a(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),e.event.add=function(e,t,n,a,i){e!==document&&C.test(t)&&r("AJAX events should be attached to document: "+t),Q.call(this,e,A(t||""),n,a,i)},e.event.remove=function(e,t,n,r,a){x.call(this,e,A(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e):(this.triggerHandler.apply(this,e),this)},e.fn.toggle=function(t,n){if(!e.isFunction(t)||!e.isFunction(n)){return N.apply(this,arguments)}r("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,i=t.guid||e.guid++,o=0,s=function(n){var r=(e._data(this,"lastToggle"+t.guid)||0)%o;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault(),a[r].apply(this,arguments)||!1};for(s.guid=i;a.length>o;){a[o++].guid=i}return this.click(s)},e.fn.live=function(t,n,a){return r("jQuery.fn.live() is deprecated"),T?T.apply(this,arguments):(e(this.context).on(t,this.selector,n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),M?M.apply(this,arguments):(e(this.context).off(t,this.selector||"**",n),this)},e.event.trigger=function(e,t,n,a){return n||C.test(e)||r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each(S.split("|"),function(t,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add(document,n+"."+e.guid,function(){e.event.trigger(n,null,t,!0)}),e._data(this,n,e.guid++)),!1},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}(jQuery,window); |
src/Hello/Hello.js | radsquad/listiq | import React from 'react'
class Hello extends React.Component {
render () {
return (
<div>
<span style={{color: 'cyan'}}>HelloComponent</span>
</div>
)
}
}
export default Hello
|
client-src/pages/list/index.js | jgunnison/react-boilerplate | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import List from '../../components/list';
class ListPage extends Component {
static propTypes = {
listContent: PropTypes.array,
};
static defaultProps = {
listContent: [],
};
render() {
return (
<List data={this.props.listContent} />
);
}
}
function mapStateToProps(state) {
return {
listContent: state.listContentReducer,
};
}
export default connect(mapStateToProps)(ListPage);
|
src/js/components/docker/partial/DockerNotification.js | ajainsyn/project | import React from 'react';
import dockerplatform from '../../../../assets/images/dockerplatform.png';
const DockerNotification = ({...props}) => (
<section className="section bg-blue" id="emailNotification">
<div className="container">
<div className="row align-items-center">
<div className="col-sm-6">
<div className="section-copy">
<h2 className="title">About Docker Service Platform</h2>
<p>SynBaaS provides platform to <strong>build and deploy machine learning/analytics models</strong> (R and Python) as microservices and exposes the models as APIs.</p>
<p>Enterprise applications and external users can connect to the platform using <strong>REST API to score, evaluate and monitor</strong> the models.</p>
<button className="btn" onClick={props.onLaunchModel} >Launch Demo</button>
</div>
</div>
<div className="col-sm-6">
<div className="section-copy has-bgimage">
<img src={dockerplatform} alt="" />
</div>
</div>
</div>
</div>
</section>
);
export default DockerNotification; |
src/js/components/Box/stories/Fixed.js | grommet/grommet | import React from 'react';
import { Box, Text } from 'grommet';
export const FixedSizesBox = () => (
// Uncomment <Grommet> lines when using outside of storybook
// <Grommet theme={...}>
<Box pad="small" gap="small">
<Box
width="small"
height="small"
round="small"
align="center"
justify="center"
background="brand"
overflow={{ horizontal: 'hidden', vertical: 'scroll' }}
>
{Array(20)
.fill()
.map((_, i) => (
// eslint-disable-next-line react/no-array-index-key
<Text key={i}>{`Small (${i})`}</Text>
))}
</Box>
<Box
width="medium"
height="medium"
round="small"
align="center"
justify="center"
background="brand"
>
Medium
</Box>
<Box
width="large"
height="large"
round="small"
align="center"
justify="center"
background="brand"
>
Large
</Box>
</Box>
// </Grommet>
);
FixedSizesBox.storyName = 'Fixed sizes';
export default {
title: `Layout/Box/Fixed sizes`,
};
|
BusinessWeb/template_content/assets/plugins/flot/jquery.js | nehemiekoffi/BusinessManager | /*!
* 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 );
|
src/routes/savoringYourPet/SavoringYourPet.js | goldylucks/adamgoldman.me | // @flow
/* eslint-disable react/no-unescaped-entities */
import React from 'react'
import axios from 'axios'
import withStyles from 'isomorphic-style-loader/lib/withStyles'
import MessengerFixed from './MessengerFixed'
import testimonials from './testimonialsData'
import FAQContainer from './FAQContainer'
import MobileNav from './MobileNav'
import { cloudImg, scrollToTopOfNode } from '../../utils'
import Link from '../../components/Link'
import Footer from '../../components/Footer'
import ExternalA from '../../components/ExternalA'
import Benefits from '../../components/Benefits'
import Testimonials from '../../components/Testimonials'
import './SavoringYourPet.css'
export const TOP_BAR_HRIGHT = 56
type Props = {}
type State = {
isCouponApplied: boolean,
isProcessingCoupon: boolean,
couponInputValue: string,
}
class SavoringYourPet extends React.Component<Props, State> {
state = {
isCouponApplied: false,
isProcessingCoupon: false,
couponInputValue: '',
}
render() {
return (
<div style={{ paddingTop: TOP_BAR_HRIGHT }}>
<MessengerFixed />
{this.renderTopBar()}
<div className='container'>
<div className={`mainheading ${s.widthContainer}`}>
<h1 className='sitetitle text-center'>
How to honor your furry friend's memory after the transition
</h1>
<p className='lead text-center'>
And savor the relationship in a healing way
</p>
<div className='text-center'>
<div>
<img
src={cloudImg('adamgoldman.me/until-loved-animal')}
alt='Grief for pet love'
style={{ maxWidth: '100%' }}
/>
</div>
<span>
Source:{' '}
<ExternalA href='https://me.me/i/until-one-has-loved-an-animal-a-part-of-ones-21452968'>
me.me
</ExternalA>
</span>
</div>
</div>
<div className={s.widthContainer}>
<p>
Losing your beloved pet is one of{' '}
<strong>
the most devastating experiences a human can go through
</strong>
. The pain can be greater than losing a family member.
</p>
<p>
The unconditional love, the acceptance, the beloved companionship
... It’s something you rarely get anywhere else.
</p>
<hr className={s.hr} />
<h4
ref={el => {
this.elTrauma = el
}}
className='text-center'
>
“The death of a pet can be a truly traumatic experience and create
a large void in our hearts and lives” <br />-{' '}
<strong>Ralph Ryback M.D.</strong>
</h4>
<hr className={s.hr} />
<h2 className='text-center' style={{ marginBottom: 20 }}>
Do you feel any of the following?
</h2>
<ul>
<li>
<strong>Emptiness</strong> as you go through your day?
</li>
<li>
<strong>Guilt & regret</strong> about what you did or didn’t do?
</li>
<li>
<strong>Doubt</strong> you will ever fill this void?
</li>
</ul>
<p>
You need to know <strong>you are NOT alone</strong> in this, and
what you are going through is very, VERY understandable. It’s not
uncommon to hear the following outcries from fellow grieving souls
who’ve shared similar fate:
</p>
<ul>
<li>"I have nothing to look forward to"</li>
<li>
<strong>“A big part of me has died”</strong>
</li>
<li>"Will this pain ever go away?"</li>
</ul>
<hr className={s.hr} />
<h4 className='text-center'>
“Unattended grief is one of the leading underlying causes for
depression” <br />- <strong>Steve Andreas, M.A.</strong>
</h4>
<hr className={s.hr} />
<p>
This is exactly the reason why{' '}
<strong>I’ve been dedicating the last year to</strong> develop and
refine a method to{' '}
<strong>
soften this pain, and alleviate much of the suffering
</strong>{' '}
you and others are feeling right now.
</p>
<p>
I’ve talked and listened to hundreds of people just like you, and
helped dozens experiencing crippling grief and unbearable pain,
while consulting with two amazing people (see below) whose work
has impacted thousands of lives already.
</p>
<p>
Our combined work gave birth to a new program, unlike anything
we’ve seen or experienced before.
</p>
<hr className={s.hr} />
<strong className='text-center'>Presenting ...</strong>
<h1
ref={el => {
this.elProgram = el
}}
className='text-center'
>
Savoring Your Pet
</h1>
<p className='lead'>
A step by step gentle journey from grief to appreciation, that
will show you how to transform and soften your grief in a
healthier way, alleviate much of your pain, so you can expect to
...
</p>
{this.renderBenefitsSection()}
<h2
className='text-center'
style={{ marginTop: 20, marginBottom: 20 }}
>
How is this program different?
</h2>
<p>
I know we all had our share of things that did not work, so let me
start by listing what we will NOT be doing together:
</p>
<div>
<div>❌ Medication</div>
<div>❌ Life advice or coaching</div>
<div>❌ Positive affirmations</div>
<div>❌ Traditional therapy and psychoanalysis</div>
<div>❌ Mediums / channeling / other dimension communication</div>
<div>❌ New age woo-woo methods</div>
</div>
<h5
className='text-center'
style={{ marginTop: 20, marginBottom: 20 }}
>
It’s not about saying goodbye
</h5>
<p>
Most people (even professionals!) make the common mistake of
thinking grief is about learning to say goodbye. I have NOT found
this to be useful!
</p>
<p>
Why would any of us would want to say goodbye to such a beautiful,
ever loving, unconditionally accepting relationship?
</p>
<p>
I don't want you to say goodbye, I want you to{' '}
<strong>learn how to say hello again</strong>. How to think of
your loved one in a way that honors them, and{' '}
<strong>treasure the good experiences</strong> you shared, and
everything that relationship has given you.
</p>
<p>
One of the first things you’ll soon learn is how to gently
implement the following simple yet beautiful wisdom:
</p>
<div className='text-center'>
<img
src={cloudImg('adamgoldman.me/dr-sauss-it-happened')}
alt='Smile because it happened'
style={{ maxWidth: '100%' }}
/>
<span>
Source:{' '}
<ExternalA href='https://www.scoopnest.com/user/Jestepar/758043485618528257-don-t-cry-because-it-s-over-smile-because-it-happened-dr-seuss-quote-thankfulthursday'>
scoopnest.com
</ExternalA>
</span>
</div>
<hr className={s.hr} />
<h2
ref={el => {
this.elModules = el
}}
className='text-center'
style={{ marginBottom: 30 }}
>
Here’s what you’re getting when you get your copy of the program
today:
</h2>
{this.renderModules()}
{this.renderBuyNowScrollButton()}
<hr className={s.hr} />
<div className='text-center'>
<h2>Trusted by a leading brand</h2>
<img
src={cloudImg('i-love-vet-cover_y5radw')}
alt='Animal grief partners'
style={{ maxWidth: '100%' }}
/>
<ExternalA href='https://iloveveterinary.com/'>
I Love Veterinary
</ExternalA>
</div>
</div>
<div className={s.widthContainer}>
<hr className={s.hr} />
</div>
{this.renderAndreas()}
<div className={s.widthContainer}>
<hr className={s.hr} />
<div className={s.widthContainer}>
{this.renderAboutMeSection()}
</div>
<hr className={s.hr} />
</div>
{this.renderTestimonialsSection()}
<div className={s.widthContainer}>
<hr className={s.hr} />
<h2
ref={el => {
this.elBuyNow = el
}}
className='text-center'
>
“So how much will it cost me?”
</h2>
<p>
I have invested thousands of dollars, and countless days and
nights of work and research into this program, but I want to keep
it affordable for you and others who are going through this, so I
am asking a lot less than the actual value of the program.
</p>
<div>
<h4 className='text-center'>
<small>Instead of the full price of </small>
<s>312$</s>
</h4>
{this.renderFinalPrice()}
{this.renderPaymentButton()}
{this.renderPaypalSecure()}
</div>
<hr className={s.hr} />
<p>
That’s right, you can <strong>guarantee</strong> your{' '}
<strong>lifetime access</strong> to this program{' '}
<strong>for less than the price of 1 therapy session</strong>.
</p>
<p>
I am so confident this will help you beyond your expectations, I’m
willing to personally take all the risk off your hands when you
invest in this today, with a double guarantee:
</p>
<div
ref={el => {
this.elGuarantee = el
}}
className='text-center'
style={{ marginBottom: 40 }}
>
<h4 className='text-center'>
30 days no hassle money back guarantee
</h4>
<img
src={cloudImg('30-day-refund-guarantee_ug806q')}
alt='30 day refund guarantee'
/>
</div>
<h4 className='text-center' style={{ marginBottom: 40 }}>
Complementary private session guarantee (100$ value)
</h4>
<p>
In fact, I’m willing to make this even easier for you to get on
board today. I charge 200$ for a private 1 hour session. and after
you’re done with this program, if you still don’t feel this is one
of the best decisions you ever took since embarking on your
journey of grief, I will not only refund you in full, I will get
on a complementary one on one 30 minute private video session with
you, to explore other methods to assist you and facilitate in your
healing.
</p>
<p>
You either get immense benefits from this program, or you get a
100$ worth free session. Either way, it’s a win-win for you.
</p>
<hr className={s.hr} />
<h5 style={{ marginBottom: 30 }} className='text-center'>
No need to continue suffering more than you have to
</h5>
<p>
<strong>Instead of feeling pain</strong> as you think of your
beloved close companion, you have the opportunity to literally
rewire your mind to{' '}
<strong>
reclaim the good feelings, warmth and appreciation
</strong>{' '}
about everything you valued and didn’t want to lose.
</p>
<p>
<strong>Instead of losing sleep</strong> and missing any more
opportunities for a better life, you can learn how to{' '}
<strong>let the qualities you appreciate</strong> in your furry
friend, compel and <strong>draw you forward</strong> to an ever{' '}
<strong>brightening future</strong>.
</p>
<p>
I am very curious to hear about all the ways the decision you took
today has brought peace, comfort and love to your life.
</p>
<p>
Best to you on your journey,
<br />- <strong>Adam Goldman</strong>
</p>
{this.renderBuyNowScrollButton()}
<p style={{ marginTop: 40 }}>
<strong>Ps.</strong>Yes, you can literally rewire your mind, body
and feelings, to transform your current grief to feeling of
appreciation, in way that will honor your lost furry friend in a
comprehensive way.
</p>
<p>
<strong>Ps.s. </strong>Remember all the risk is on me, so when you
gain access today there’s nothing for you to lose other than
unwanted negative feelings.
</p>
<section style={{ marginTop: 40 }}>
<FAQContainer />
</section>
</div>
</div>
<div className='container container-footer'>
<Footer />
</div>
</div>
)
}
renderTopBar() {
const navitems = [
{ text: 'Trauma', nodeId: 'elTrauma' },
{ text: 'Program', nodeId: 'elProgram' },
{ text: 'Modules', nodeId: 'elModules' },
{ text: 'Research', nodeId: 'elResearch' },
{ text: 'About Me', nodeId: 'elAboutMe' },
{ text: 'Guarantee', nodeId: 'elGuarantee' },
]
const title = 'Savoring Your Pet'
return (
<nav className='navbar navbar-expand-lg fixed-top main-nav navbar-light'>
<div className='container'>
<MobileNav
items={navitems}
onItemClick={this.scrollTo}
title={title}
/>
<Link className='navbar-brand mr-auto' to='/savoring-your-pet'>
{title}
</Link>
<div className='collapse navbar-collapse'>
<ul className='navbar-nav ml-auto'>
{navitems.map(({ text, nodeId }) => (
<li className='nav-item' key={nodeId}>
<a className='nav-link' onClick={() => this.scrollTo(nodeId)}>
{text}
</a>
</li>
))}
<li className='nav-item' key='buyNow'>
<a
className='nav-link btn btn-primary btn-sm'
onClick={() => this.scrollTo('elBuyNow')}
>
Claim Access
</a>
</li>
</ul>
</div>
</div>
</nav>
)
}
scrollTo = nodeId => {
scrollToTopOfNode(this[nodeId], {
duration: 1000,
topOffest: TOP_BAR_HRIGHT,
})
}
renderBenefitsSection() {
return (
<section>
<div className='row justify-content-md-center'>
<div className='col col-lg-10'>
<Benefits
benefits={[
'Enjoy thinking about your beloved furry friend again',
'Focus on the good experiences shared',
'Feel their love & presence even more',
'Look forward to a brightening future',
'Increase the peace & love in your life',
]}
/>
</div>
</div>
<small>
* Results may vary (
<ExternalA href='/legal-stuff' style={{ color: 'inherit' }}>
full disclaimer
</ExternalA>
)
</small>
</section>
)
}
renderModules() {
return (
<div>
<div>
<h3>Module 1: Clarity and order</h3>
<p>
We’ll go over 6 common aspects of grief and carefully separate them
to distinct concepts, before we examine and transform them one by
one.
<br /> <strong>✔️ Value: 30$</strong>
</p>
</div>
<div>
<h3>Module 2: Peaceful Ending</h3>
<p>
Soften the unpleasantness and negative feelings regarding the moment
of transition, and the events regarding the transition, and rewire
your mind to go back to the happy memories. This will also pacify
disturbing or graphic images you might still have. <br />{' '}
<strong>✔️ Value: 47$</strong>
</p>
</div>
<div>
<h3>Module 3: Savoring future plans</h3>
<p>
Increase the peace and acceptance towards the future that will not
be, and events you might have planned with your beloved furry
friend. <br /> <strong>✔️ Value: 47$</strong>
</p>
</div>
<div>
<h3>Module 4: Reunion</h3>
<p>
Say “hello” again, and regain access to the good times shared, and
what you valued in the relationship and didn’t want to lose. <br />{' '}
<strong>✔️ Value: 47$</strong>
</p>
</div>
<div>
<h3>Module 5: Relationship Consolidation</h3>
<p>
Every relationship has ups and downs. Learn how to intensify the
good feelings from the good experiences, and soften and discharge
bad experiences and events you had. <br />{' '}
<strong>✔️ Value: 47$</strong>
</p>
</div>
<div>
<h3>Module 6: Special Days</h3>
<p>
Some days of the year are usually harder than others, like memorial
days, anniversary days for getting or adopting your pet, or their
birthday. In this process you learn how to use these days as an
opportunity to remind yourself how lucky you are to have had them in
your life, reminisce about your relationship and honor it even more.{' '}
<br /> <strong>✔️ Value: 47$</strong>
</p>
</div>
<div>
<h3>Module 7: Re-engaging the future</h3>
<p>
Now that we transformed much of the emptiness to presence and
appreciation, it’s time to create a compelling ever brightening
future, as you learn how to let the qualities in this valued
relationship draw you forward. <br /> <strong>✔️ Value: 47$</strong>
</p>
</div>
<div className='text-center'>
<h2>How much does it worth?</h2>
30$ + 47$ + 47$ + 47$ + 47$ + 47$ + 47$ =
<h3 style={{ marginTop: 20 }}>312$</h3>
</div>
</div>
)
}
renderBuyNowScrollButton() {
return (
<button
onClick={() => scrollToTopOfNode(this.elBuyNow, 1000)}
className={`btn btn-primary ${s.getStartedButton}`}
>
Get Started
</button>
)
}
renderAndreas() {
return (
<div
ref={el => {
this.elResearch = el
}}
>
<div className={s.widthContainer}>
<h2 className='text-center'>
Made possible by decades of research and field experience
</h2>
<p>
Many parts of this program are based on the work of Steve and
Connirae Andreas, a couple of humble and extremely precise personal
change practitioners, with{' '}
<strong>
more than 80+ years of experience in the field of psychology and
personal change
</strong>
.
</p>
<h6 className='text-center'>Connirae & Steve Andreas</h6>
</div>
<div className={s.andreasContainerBoth}>
<div className={s.andreasContainerIndividual}>
<img
src={cloudImg('adamgoldman.me/Connirae_Andreas')}
alt='Connirae Andreas'
/>
<ExternalA
className={s.andreasCaption}
href='https://andreasnlptrainings.com/connirae-andreas-bio/'
>
Connirae Andreas, Ph.D., master trainer
</ExternalA>
</div>
<div className={s.andreasContainerIndividual}>
<img
src={cloudImg('adamgoldman.me/Steve_Andreas')}
alt='Steve Andreas'
/>
<ExternalA
className={s.andreasCaption}
href='http://steveandreas.com/cv.html'
>
Steve Andreas, M.A., master trainer
</ExternalA>
</div>
</div>
<div className={s.widthContainer}>
<blockquote style={{ marginTop: 20 }}>
Adam Goldman is a brilliant new colleague whose depth and breadth of
understanding of the principles of personal change is exceptional,
combined with the hands-on skills to manifest this in the experience
of clients.
<br />
<br />
Perceptive, intelligent, creative, confident, one of the fastest and
most thorough learners I’ve ever met, able and willing to question
established wisdom and discuss differences of opinion openly when
that’s appropriate.
<br />
<br />
He has created online programs to guide participants through
effective change processes on their own, a huge opportunity for so
many who would otherwise not be able to even think of affording it.
<br />
<br />
His work is a detailed challenge to the rest of us to learn how to
“up our game” or be left behind in the dustbin of history.
<br />
<strong>- Steve Andreas, MA, master trainer and author.</strong>
</blockquote>
</div>
</div>
)
}
renderTestimonialsSection() {
return (
<section>
<div className={s.widthContainer}>
<p className='text-center'>
But don’t take my word for it, listen to what people I’ve worked
with on grief have to say ...{' '}
<span className={s.asterixDisclaimer}>*</span>
</p>
</div>
<Testimonials testimonials={testimonials} />
<small>
* Results may vary (
<ExternalA href='/legal-stuff' style={{ color: 'inherit' }}>
full disclaimer
</ExternalA>
)
</small>
</section>
)
}
renderAboutMeSection() {
return (
<section
ref={el => {
this.elAboutMe = el
}}
id='about-me'
>
<h1 className='text-center'>
Who am I to guide you through this journey?
</h1>
<div className={s.aboutContainer}>
<img
src={cloudImg('adamgoldman.me/profile-smiling')}
alt='About Adam Goldman'
/>
<p className='lead'>
I've been guiding people through and developing personal change
processes for almost a decade.
<br />
<br />
I’ve gone through countless courses, videos, books, and programs,
and <strong>my passion is distilling</strong> the most useful and{' '}
<strong>
powerful processes into easy to follow, step by step personal
journeys
</strong>{' '}
for people just like you to experience in a very gentle and
comfortable way.
</p>
</div>
</section>
)
}
renderFinalPrice() {
const { isCouponApplied } = this.state
if (!isCouponApplied) {
return (
<h3 className='text-center'>
<small>Order today for</small>
<br /> <strong>Only 97$</strong>
</h3>
)
}
return (
<div>
<h3 className='text-center' style={{ textDecoration: 'line-through' }}>
<small>Order today for</small>
<br /> <strong>Only 97$</strong>
</h3>
<h2 className='text-center'>
Limited time offer for I Love Veterinary customers!
</h2>
<h3 className='text-center'>
<small>Order today for</small>
<br /> <strong>Only 47$</strong>
</h3>
</div>
)
}
renderPaymentButton() {
const { isCouponApplied, couponInputValue, isProcessingCoupon } = this.state
return (
<div>
<form
action='https://www.paypal.com/cgi-bin/webscr'
method='post'
target='_blank'
className='text-center'
>
<input type='hidden' name='cmd' value='_s-xclick' />
<input type='hidden' name='landing_page' value='billing' />
<input
type='hidden'
name='hosted_button_id'
value={isCouponApplied ? 'RHHHM7QUDJRXE' : '5RVFWYZP5HMBG'}
/>
<input
type='image'
src='http://res.cloudinary.com/goldylucks/image/upload/v1531924994/get-access-now_pqssf4.jpg'
border='0'
name='submit'
alt='PayPal - The safer, easier way to pay online!'
/>
<img
alt=''
border='0'
src='https://www.paypalobjects.com/en_US/i/scr/pixel.gif'
width='1'
height='1'
/>
</form>
<form onSubmit={this.onSubmitCoupon} className='text-center'>
<input
type='text'
value={couponInputValue}
onChange={this.onCouponInputChange}
placeholder='Coupon'
/>
<button>Validate Coupon</button>
</form>
{isProcessingCoupon && <p>Loading, please wait ...</p>}
</div>
)
}
onCouponInputChange = evt => {
this.setState({ couponInputValue: evt.target.value })
}
onSubmitCoupon = async evt => {
const { couponInputValue, isProcessingCoupon } = this.state
evt.preventDefault()
if (isProcessingCoupon) {
return
}
this.setState({ isProcessingCoupon: true })
try {
const { data: isValid } = await axios.post('/api/savoringPetCoupon', {
coupon: couponInputValue,
})
if (isValid) {
global.alert('Valid coupon, enjoy your discount')
this.setState({ isCouponApplied: true, isProcessingCoupon: false })
} else {
global.alert(
'invalid coupon, please contact me if you think it is a mistake',
)
this.setState({ isProcessingCoupon: false })
}
} catch (err) {
this.setState({ isProcessingCoupon: false })
global.alert('error validating the coupon, please try again')
}
}
renderPaypalSecure() {
return (
<div className='text-center'>
<img
src={cloudImg('pay-pal-secured_z1lxgq')}
alt='Paypal secured'
style={{ maxWidth: '100px', marginTop: 10, marginBottm: 10 }}
/>
<div>
<span>
Source:{' '}
<ExternalA href='https://e-trimas.com/page/payment-method'>
e-trimas.com
</ExternalA>
</span>
</div>
</div>
)
}
}
export default withStyles(s)(SavoringYourPet)
|
pages/index.js | hillcitymnag/www.hillcitymnag.church | import css from 'next/css'
import Head from 'next/head'
import React from 'react'
import 'whatwg-fetch'
import Contact from '../components/contact'
import Footer from '../components/footer'
import Header from '../components/header'
import LatestSermon from '../components/latest-sermon'
import Navigation from '../components/navigation'
import SundayService from '../components/sunday-service'
import UpcomingEvent from '../components/upcoming-event'
// import UpcomingEventStatic from '../components/upcoming-event-static'
import Updates from '../components/updates'
import events from '../static/events.json'
import sermons from '../static/sermons.json'
export default class extends React.Component {
static async getInitialProps() {
const latestSermon = sermons[0]
const today = Date.now()
const upcomingEvent = [...events]
.reverse()
.filter(event => new Date(event.startTime) > today)[0]
return {latestSermon, upcomingEvent}
}
render() {
return (
<div className={fontSettings}>
<Head>
<script dangerouslySetInnerHTML={typekitFonts()} />
<meta charSet="utf-8" />
<title>Hill City Assembly of God Church</title>
<link
rel="apple-touch-icon"
href="static/apple-touch-icon.png"
sizes="180x180"
/>
<link
rel="icon"
href="static/favicon-32x32.png"
sizes="32x32"
type="image/png"
/>
<link
rel="icon"
href="static/favicon-16x16.png"
sizes="16x16"
type="image/png"
/>
<link rel="manifest" href="static/manifest.json" />
<link
rel="mask-icon"
href="static/safari-pinned-tab.svg"
color="#18371b"
/>
<meta name="msapplication-TileColor" content="#ffffff" />
<meta
name="msapplication-square150x150logo"
content="static/apple-touch-icon.png"
/>
<meta name="apple-mobile-web-app-title" content="HCAG" />
<meta name="application-name" content="HCAG" />
<meta name="theme-color" content="#ffffff" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
/>
<link rel="stylesheet" href="static/css/bootstrap.min.css" />
<link rel="stylesheet" href="static/css/font-awesome.min.css" />
</Head>
<Navigation />
<main>
<Header />
<SundayService />
{/* <hr {...separator} />
<UpcomingEventStatic upcomingEvent={this.props.upcomingEvent} /> */}
<hr className="hidden-md hidden-lg" {...separator} />
<Updates>
<LatestSermon latestSermon={this.props.latestSermon} />
<hr className="hidden-md hidden-lg" {...separator} />
<UpcomingEvent upcomingEvent={this.props.upcomingEvent} />
</Updates>
<Contact />
<Footer />
</main>
<script
type="text/javascript"
src="static/js/jquery-3.1.1.slim.min.js"
/>
<script type="text/javascript" src="static/js/bootstrap.min.js" />
</div>
)
}
}
const fontSettings = css({
MozOsxFontSmoothing: 'grayscale',
WebkitFontSmoothing: 'antialiased',
fontFamily: 'proxima-nova,Helvetica Neue,Open Sans,Arial,sans-serif'
})
const separator = css({
margin: '75px auto',
width: '75%'
})
const typekitFonts = () => ({
__html: `
(function(d) {
var config = {
kitId: 'aly8gvz',
scriptTimeout: 3000,
async: true
},
h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
})(document);
`
})
|
src/js/views/transitions-target.js | electronspin/touchstonejs-starter | import Container from 'react-container';
import React from 'react';
import Timers from 'react-timers';
import { Mixins } from 'touchstonejs';
module.exports = React.createClass({
mixins: [Mixins.Transitions, Timers()],
statics: {
navigationBar: 'main',
getNavigation (props) {
return {
title: props.navbarTitle
}
}
},
componentDidMount () {
var self = this;
this.setTimeout(function () {
self.transitionTo('tabs:transitions', { transition: 'fade' });
}, 1000);
},
render () {
return (
<Container direction="column" align="center" justify="center" className="no-results">
<div className="no-results__icon ion-ios-photos" />
<div className="no-results__text">Hold on a sec...</div>
</Container>
);
}
});
|
packages/ringcentral-widgets-docs/src/app/pages/Components/SlideMenu/index.js | u9520107/ringcentral-js-widget | import React from 'react';
import { parse } from 'react-docgen';
import CodeExample from '../../../components/CodeExample';
import ComponentHeader from '../../../components/ComponentHeader';
import PropTypeDescription from '../../../components/PropTypeDescription';
import Demo from './Demo';
// eslint-disable-next-line
import demoCode from '!raw-loader!./Demo';
// eslint-disable-next-line
import componentCode from '!raw-loader!ringcentral-widgets/components/SlideMenu';
const SlideMenuPage = () => {
const info = parse(componentCode);
return (
<div>
<ComponentHeader name="SlideMenu" description={info.description} />
<CodeExample
code={demoCode}
title="SlideMenu Example"
>
<Demo />
</CodeExample>
<PropTypeDescription componentInfo={info} />
</div>
);
};
export default SlideMenuPage;
|
src/svg-icons/image/filter-9.js | kasra-co/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageFilter9 = (props) => (
<SvgIcon {...props}>
<path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14zM15 5h-2c-1.1 0-2 .89-2 2v2c0 1.11.9 2 2 2h2v2h-4v2h4c1.1 0 2-.89 2-2V7c0-1.11-.9-2-2-2zm0 4h-2V7h2v2z"/>
</SvgIcon>
);
ImageFilter9 = pure(ImageFilter9);
ImageFilter9.displayName = 'ImageFilter9';
ImageFilter9.muiName = 'SvgIcon';
export default ImageFilter9;
|
app/javascript/mastodon/features/ui/components/video_modal.js | ikuradon/mastodon | import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import Video from 'mastodon/features/video';
import ImmutablePureComponent from 'react-immutable-pure-component';
import Footer from 'mastodon/features/picture_in_picture/components/footer';
import { getAverageFromBlurhash } from 'mastodon/blurhash';
export default class VideoModal extends ImmutablePureComponent {
static propTypes = {
media: ImmutablePropTypes.map.isRequired,
statusId: PropTypes.string,
options: PropTypes.shape({
startTime: PropTypes.number,
autoPlay: PropTypes.bool,
defaultVolume: PropTypes.number,
}),
onClose: PropTypes.func.isRequired,
onChangeBackgroundColor: PropTypes.func.isRequired,
};
componentDidMount () {
const { media, onChangeBackgroundColor } = this.props;
const backgroundColor = getAverageFromBlurhash(media.get('blurhash'));
if (backgroundColor) {
onChangeBackgroundColor(backgroundColor);
}
}
render () {
const { media, statusId, onClose } = this.props;
const options = this.props.options || {};
return (
<div className='modal-root__modal video-modal'>
<div className='video-modal__container'>
<Video
preview={media.get('preview_url')}
frameRate={media.getIn(['meta', 'original', 'frame_rate'])}
blurhash={media.get('blurhash')}
src={media.get('url')}
currentTime={options.startTime}
autoPlay={options.autoPlay}
volume={options.defaultVolume}
onCloseVideo={onClose}
detailed
alt={media.get('description')}
/>
</div>
<div className='media-modal__overlay'>
{statusId && <Footer statusId={statusId} withOpenButton onClose={onClose} />}
</div>
</div>
);
}
}
|
src/www/js/components/view-row.js | training4developers/bootcamp_04112016 | import React from 'react';
export default props => <tr>
<td>{props.widget.name}</td>
<td>{props.widget.description}</td>
<td className='capitalize'>{props.widget.color}</td>
<td className='capitalize'>{props.widget.size}</td>
<td className='number'>{props.widget.quantity}</td>
<td>{props.widget.owner.name}</td>
<td>
<button className='btn btn-primary btn-sm' type='button'
onClick={() => props.onEdit(props.widget.id)}>Edit</button>
<button className='btn btn-danger btn-sm' type='button'
onClick={() => props.onDelete(props.widget)}>Delete</button>
</td>
</tr>;
|
modules/experimental/AsyncProps.js | keathley/react-router | import React from 'react';
import invariant from 'invariant';
var { func, array, shape, object } = React.PropTypes;
var contextTypes = {
asyncProps: shape({
reloadComponent: func,
propsArray: array,
componentsArray: array
})
};
var _serverPropsArray = null;
function setServerPropsArray(array) {
invariant(!_serverPropsArray, 'You cannot call AsyncProps.hydrate more than once');
_serverPropsArray = array;
}
export function _clearCacheForTesting() {
_serverPropsArray = null;
}
function hydrate(routerState, cb) {
var { components, params } = routerState;
var flatComponents = filterAndFlattenComponents(components);
loadAsyncProps(flatComponents, params, cb);
}
function eachComponents(components, iterator) {
for (var i = 0, l = components.length; i < l; i++) {
if (typeof components[i] === 'object') {
for (var key in components[i]) {
iterator(components[i][key], i, key);
}
} else {
iterator(components[i], i);
}
}
}
function filterAndFlattenComponents(components) {
var flattened = [];
eachComponents(components, function(Component) {
if (Component.loadProps)
flattened.push(Component);
});
return flattened;
}
function loadAsyncProps(components, params, cb) {
var propsArray = [];
var componentsArray = [];
var canceled = false;
var needToLoadCounter = components.length;
components.forEach(function(Component, index) {
Component.loadProps(params, function(error, props) {
needToLoadCounter--;
propsArray[index] = props;
componentsArray[index] = Component;
maybeFinish();
});
});
function maybeFinish() {
if (canceled === false && needToLoadCounter === 0)
cb(null, {propsArray, componentsArray});
}
return {
cancel () {
canceled = true;
}
};
}
function getPropsForComponent(Component, componentsArray, propsArray) {
var index = componentsArray.indexOf(Component);
return propsArray[index];
}
function mergeAsyncProps(current, changes) {
for (var i = 0, l = changes.propsArray.length; i < l; i++) {
let Component = changes.componentsArray[i];
let position = current.componentsArray.indexOf(Component);
let isNew = position === -1;
if (isNew) {
current.propsArray.push(changes.propsArray[i]);
current.componentsArray.push(changes.componentsArray[i]);
} else {
current.propsArray[position] = changes.propsArray[i];
}
}
}
function arrayDiff(previous, next) {
var diff = [];
for (var i = 0, l = next.length; i < l; i++)
if (previous.indexOf(next[i]) === -1)
diff.push(next[i]);
return diff;
}
function shallowEqual(a, b) {
var key;
var ka = 0;
var kb = 0;
for (key in a) {
if (a.hasOwnProperty(key) && a[key] !== b[key])
return false;
ka++;
}
for (key in b)
if (b.hasOwnProperty(key))
kb++;
return ka === kb;
}
var RouteComponentWrapper = React.createClass({
contextTypes: contextTypes,
// this is here to meet the case of reloading the props when a component's params change,
// the place we know that is here, but the problem is we get occasional waterfall loads
// when clicking links quickly at the same route, AsyncProps doesn't know to load the next
// props until the previous finishes rendering.
//
// if we could tell that a component needs its props reloaded in AsyncProps instead of here
// (by the arrayDiff stuff in componentWillReceiveProps) then we wouldn't need this code at
// all, and we coudl get rid of the terrible forceUpdate hack as well. I'm just not sure
// right now if we can know to reload a pivot transition.
componentWillReceiveProps(nextProps, context) {
var paramsChanged = !shallowEqual(
this.props.routerState.routeParams,
nextProps.routerState.routeParams
);
if (paramsChanged) {
this.reloadProps(nextProps.routerState.routeParams);
}
},
reloadProps(params) {
this.context.asyncProps.reloadComponent(
this.props.Component,
params || this.props.routerState.routeParams,
this
);
},
render() {
var { Component, routerState } = this.props;
var { componentsArray, propsArray, loading } = this.context.asyncProps;
var asyncProps = getPropsForComponent(Component, componentsArray, propsArray);
return <Component {...routerState} {...asyncProps} loading={loading} reloadAsyncProps={this.reloadProps} />;
}
});
var AsyncProps = React.createClass({
statics: {
hydrate: hydrate,
rehydrate: setServerPropsArray,
createElement(Component, state) {
return typeof Component.loadProps === 'function' ?
<RouteComponentWrapper Component={Component} routerState={state}/> :
<Component {...state}/>;
}
},
childContextTypes: contextTypes,
getChildContext() {
return {
asyncProps: Object.assign({
reloadComponent: this.reloadComponent,
loading: this.state.previousProps !== null
}, this.state.asyncProps),
};
},
getInitialState() {
return {
asyncProps: {
propsArray: _serverPropsArray,
componentsArray: _serverPropsArray ? filterAndFlattenComponents(this.props.components) : null,
},
previousProps: null
};
},
componentDidMount() {
var initialLoad = this.state.asyncProps.propsArray === null;
if (initialLoad) {
hydrate(this.props, (err, asyncProps) => {
this.setState({ asyncProps });
});
}
},
componentWillReceiveProps(nextProps) {
var routerTransitioned = nextProps.location !== this.props.location;
if (!routerTransitioned)
return;
var oldComponents = this.props.components;
var newComponents = nextProps.components;
var components = arrayDiff(
filterAndFlattenComponents(oldComponents),
filterAndFlattenComponents(newComponents)
);
if (components.length === 0)
return;
this.loadAsyncProps(components, nextProps.params);
},
beforeLoad(cb) {
this.setState({
previousProps: this.props
}, cb);
},
afterLoad(err, asyncProps, cb) {
this.inflightLoader = null;
mergeAsyncProps(this.state.asyncProps, asyncProps);
this.setState({
previousProps: null,
asyncProps: this.state.asyncProps
}, cb);
},
loadAsyncProps(components, params, cb) {
if (this.inflightLoader) {
this.inflightLoader.cancel();
}
this.beforeLoad(() => {
this.inflightLoader = loadAsyncProps(components, params, (err, asyncProps) => {
this.afterLoad(err, asyncProps, cb);
});
});
},
reloadComponent(Component, params, instance) {
this.loadAsyncProps([Component], params, () => {
// gotta fix this hack ... change in context doesn't cause the
// RouteComponentWrappers to rerender (first one will because
// of cloneElement)
if (instance.isMounted())
instance.forceUpdate();
});
},
render() {
var { route } = this.props;
var { asyncProps, previousProps } = this.state;
var initialLoad = asyncProps.propsArray === null;
if (initialLoad)
return route.renderInitialLoad ? route.renderInitialLoad() : null;
else if (previousProps)
return React.cloneElement(previousProps.children, { loading: true });
else
return this.props.children;
}
});
export default AsyncProps;
|
react-flux-mui/js/material-ui/src/DatePicker/CalendarActionButtons.js | pbogdan/react-flux-mui | import React, {Component, PropTypes} from 'react';
import FlatButton from '../FlatButton';
class CalendarActionButton extends Component {
static propTypes = {
autoOk: PropTypes.bool,
cancelLabel: PropTypes.node,
okLabel: PropTypes.node,
onTouchTapCancel: PropTypes.func,
onTouchTapOk: PropTypes.func,
};
render() {
const {cancelLabel, okLabel} = this.props;
const styles = {
root: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'flex-end',
margin: 0,
maxHeight: 48,
padding: 0,
},
flatButtons: {
fontsize: 14,
margin: '4px 8px 8px 0px',
maxHeight: 36,
minWidth: 64,
padding: 0,
},
};
return (
<div style={styles.root} >
<FlatButton
label={cancelLabel}
onTouchTap={this.props.onTouchTapCancel}
primary={true}
style={styles.flatButtons}
/>
{!this.props.autoOk &&
<FlatButton
disabled={this.refs.calendar !== undefined && this.refs.calendar.isSelectedDateDisabled()}
label={okLabel}
onTouchTap={this.props.onTouchTapOk}
primary={true}
style={styles.flatButtons}
/>
}
</div>
);
}
}
export default CalendarActionButton;
|
examples/redirect-using-index/app.js | fanhc019/react-router | import React from 'react';
import { Router, Route, IndexRoute, Link } from 'react-router';
var App = React.createClass({
render() {
return (
<div>
{this.props.children}
</div>
);
}
});
var Index = React.createClass({
render () {
return (
<div>
<h1>You should not see this.</h1>
{this.props.children}
</div>
)
}
});
var Child = React.createClass({
render () {
return (
<div>
<h2>Redirected to "/child"</h2>
<Link to="/">Try going to "/"</Link>
</div>
)
}
});
function redirectToChild(location, replaceWith) {
replaceWith(null, '/child');
}
React.render((
<Router>
<Route path="/" component={App}>
<IndexRoute component={Index} onEnter={redirectToChild}/>
<Route path="/child" component={Child}/>
</Route>
</Router>
), document.getElementById('example'));
|
ajax/libs/amcharts4/4.10.18/.internal/core/interaction/InteractionObject.js | cdnjs/cdnjs | /**
* Interaction Object module
*/
import { __extends } from "tslib";
/**
* ============================================================================
* IMPORTS
* ============================================================================
* @hidden
*/
import { InteractionObjectEventDispatcher } from "./InteractionObjectEvents";
import { BaseObjectEvents } from "../Base";
import { List } from "../utils/List";
import { Dictionary, DictionaryDisposer } from "../utils/Dictionary";
import { getInteraction } from "./Interaction";
import * as $type from "../utils/Type";
/**
* Re-exports
*/
export { InteractionObjectEventDispatcher };
/**
* Interaction object represents an object that is subject for any kind of
* interaction with it with any input devices: mouse, touch or keyboard.
*
* Any DOM element can be wrapped into an Internaction object which in turn
* enables attaching various interaction events to it, such as: hit, drag,
* swipe, etc.
*
* To create an [[InteractionObject]] out of a [[Sprite]], use:
* `interaction.getInteractionFromSprite(sprite: Sprite)`
*
* To create an [[InteractionObject]] out of a a regular element:
* `interaction.getInteraction(element: HTMLElement)`
*/
var InteractionObject = /** @class */ (function (_super) {
__extends(InteractionObject, _super);
/**
* Constructor
*/
function InteractionObject(element) {
var _this = _super.call(this) || this;
/**
* @ignore
* An [[EventDispatcher]] instance which holds events for this object
*/
_this._eventDispatcher = new InteractionObjectEventDispatcher(_this);
/**
* Collection of Disposers for various events. (so that those get disposed
* when the whole InteractionObject is disposed)
*
* @ignore Exclude from docs
*/
_this.eventDisposers = new Dictionary();
/**
* A [[Dictionary]] that holds temporarily replaced original style values for
* HTML element, so that they can be restored when the functionality that
* replaced them is done.
*
* @ignore Exclude from docs
*/
_this.replacedStyles = new Dictionary();
_this._clickable = false;
_this._contextMenuDisabled = false;
_this._hoverable = false;
_this._trackable = false;
_this._draggable = false;
_this._swipeable = false;
_this._resizable = false;
_this._wheelable = false;
_this._inert = false;
/**
* Is element currently hovered?
*/
_this._isHover = false;
/**
* Was this element hovered via pointer or is it just "pretenting" to be
* hovered.
*
* @ignore
*/
_this.isRealHover = false;
/**
* Is the element hovered by touch pointer?
*/
_this._isHoverByTouch = false;
/**
* Has element got any pointers currently pressing down on it?
*/
_this._isDown = false;
/**
* Does element have focus?
*/
_this._isFocused = false;
/**
* Is element currently protected from touch interactions?
*/
_this._isTouchProtected = false;
/**
* Options used for inertia functionality.
*/
_this._inertiaOptions = new Dictionary();
/**
* A collection of different inertia types, currently playing out.
*
* @ignore Exclude from docs
*/
_this.inertias = new Dictionary();
/**
* Click/tap options.
*/
_this._hitOptions = {};
/**
* Hover options.
*/
_this._hoverOptions = {};
/**
* Swipe gesture options.
*/
_this._swipeOptions = {};
/**
* Keyboard options.
*/
_this._keyboardOptions = {};
/**
* Mouse options.
*/
_this._mouseOptions = {};
/**
* Cursor options.
*/
_this._cursorOptions = {
"defaultStyle": [{
"property": "cursor",
"value": "default"
}]
};
_this._disposers.push(_this._eventDispatcher);
_this._element = element;
_this.className = "InteractionObject";
_this._disposers.push(new DictionaryDisposer(_this.inertias));
_this._disposers.push(new DictionaryDisposer(_this.eventDisposers));
_this.applyTheme();
return _this;
}
;
Object.defineProperty(InteractionObject.prototype, "events", {
/**
* An [[EventDispatcher]] instance which holds events for this object
*/
get: function () {
return this._eventDispatcher;
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "isHover", {
/**
* @return Hovered?
*/
get: function () {
return this._isHover;
},
/**
* Indicates if this element is currently hovered.
*
* @param value Hovered?
*/
set: function (value) {
if (this.isHover != value) {
this._isHover = value;
if (value) {
getInteraction().overObjects.moveValue(this);
}
else {
this.isRealHover = false;
getInteraction().overObjects.removeValue(this);
}
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "isHoverByTouch", {
/**
* @return Hovered?
*/
get: function () {
return this._isHoverByTouch;
},
/**
* Indicates if this element is currently hovered.
*
* @param value Hovered?
*/
set: function (value) {
if (this.isHoverByTouch != value) {
this._isHoverByTouch = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "overPointers", {
/**
* A list of pointers currently over the element.
*
* @see {@link Pointer}
* @return List if pointers currently hovering the element
*/
get: function () {
if (!this._overPointers) {
this._overPointers = new List();
}
return this._overPointers;
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "isDown", {
/**
* @return Has down pointers?
*/
get: function () {
return this._isDown;
},
/**
* Indicates if this element has currently any pointers pressing on it.
*
* @param value Has down pointers?
*/
set: function (value) {
if (this.isDown != value) {
this._isDown = value;
if (value) {
getInteraction().downObjects.moveValue(this);
}
else {
getInteraction().downObjects.removeValue(this);
}
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "downPointers", {
/**
* A list of pointers currently pressing down on this element.
*
* @see {@link Pointer}
* @return List of down pointers
*/
get: function () {
if (!this._downPointers) {
this._downPointers = new List();
}
return this._downPointers;
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "isFocused", {
/**
* @return Focused?
*/
get: function () {
return this._isFocused;
},
/**
* Indicates if this element is currently focused.
*
* @param value Focused?
*/
set: function (value) {
if (this.isFocused != value) {
this._isFocused = value;
if (value) {
getInteraction().focusedObject = this;
}
else {
getInteraction().focusedObject = undefined;
}
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "isTouchProtected", {
/**
* @ignore
* @return Touch protected?
*/
get: function () {
return this._isTouchProtected;
},
/**
* Indicates if this element is currently being protected from touch actions.
*
* @ignore
* @param value Touch protected?
*/
set: function (value) {
if (this._isTouchProtected != value) {
this._isTouchProtected = value;
if (value) {
getInteraction().unprepElement(this);
}
else if (this.draggable || this.swipeable || this.trackable || this.resizable) {
getInteraction().prepElement(this);
}
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "clickable", {
/**
* @return Clickable?
*/
get: function () {
return this._clickable;
},
/**
* Is element clickable? Clickable elements will generate "hit" events when
* clicked or tapped.
*
* @param value Clickable?
*/
set: function (value) {
if (this._clickable !== value) {
this._clickable = value;
getInteraction().processClickable(this);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "contextMenuDisabled", {
/**
* @return Context menu disabled?
*/
get: function () {
return this._contextMenuDisabled;
},
/**
* Should element prevent context menu to be displayed, e.g. when
* right-clicked?
*
* @default false
* @param value Context menu disabled?
*/
set: function (value) {
if (this._contextMenuDisabled !== value) {
this._contextMenuDisabled = value;
getInteraction().processContextMenu(this);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "hoverable", {
/**
* @return Hoverable?
*/
get: function () {
return this._hoverable;
},
/**
* Indicates if element should generate hover events.
*
* @param value Hoverable?
*/
set: function (value) {
if (this._hoverable !== value) {
this._hoverable = value;
getInteraction().processHoverable(this);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "trackable", {
/**
* @return Track pointer?
*/
get: function () {
return this._trackable;
},
/**
* Indicates if pointer movement over element should be tracked.
*
* @param value Track pointer?
*/
set: function (value) {
if (this._trackable !== value) {
this._trackable = value;
getInteraction().processTrackable(this);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "draggable", {
/**
* @return Draggable?
*/
get: function () {
return this._draggable;
},
/**
* Indicates if element can be dragged. (moved)
*
* @param value Draggable?
*/
set: function (value) {
if (this._draggable !== value) {
this._draggable = value;
getInteraction().processDraggable(this);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "swipeable", {
/**
* @return Track swipe?
*/
get: function () {
return this._swipeable;
},
/**
* Indicates whether element should react to swipe gesture.
*
* @param value Track swipe?
*/
set: function (value) {
if (this._swipeable !== value) {
this._swipeable = value;
getInteraction().processSwipeable(this);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "resizable", {
/**
* @return Resizeble?
*/
get: function () {
return this._resizable;
},
/**
* Indicates if element can be resized.
*
* @param value Resizeable?
*/
set: function (value) {
if (this._resizable !== value) {
this._resizable = value;
getInteraction().processResizable(this);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "wheelable", {
/**
* @return Track wheel?
*/
get: function () {
return this._wheelable;
},
/**
* Indicates whether track moouse wheel rotation over element.
*
* @param value Track wheel?
*/
set: function (value) {
if (this._wheelable !== value) {
this._wheelable = value;
getInteraction().processWheelable(this);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "inert", {
/**
* @return Inert?
*/
get: function () {
return this._inert;
},
/**
* Indicates if element is inert, i.e. if it should carry movement momentum
* after it is dragged and released.
*
* @param value Inert?
*/
set: function (value) {
if (this._inert !== value) {
this._inert = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "focusable", {
/**
* @return Focusable?
*/
get: function () {
return this._focusable;
},
/**
* Indicates if element can gain focus.
*
* @param value Focusable?
*/
set: function (value) {
if (this._focusable !== value) {
this._focusable = value;
if (this._focusable && this.tabindex == -1) {
this._tabindex = 1;
}
getInteraction().processFocusable(this);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "tabindex", {
/**
* @return Tab index
*/
get: function () {
return $type.getValueDefault(this._tabindex, -1);
},
/**
* Element's tab index.
*
* @param value Tab index
*/
set: function (value) {
if (this._tabindex !== value) {
this._tabindex = value;
if (value > -1) {
this.focusable = true;
}
getInteraction().processFocusable(this);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "element", {
/**
* @return Element
*/
get: function () {
return this._element;
},
/**
* A DOM element associated with this element.
*
* @param element Element
*/
set: function (element) {
this._element = element;
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "originalPosition", {
/**
* @ignore Exclude from docs
* @return Position.
*/
get: function () {
return this._originalPosition || { x: 0, y: 0 };
},
/**
* Element's original position.
*
* @ignore Exclude from docs
* @param value Position
*/
set: function (value) {
this._originalPosition = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "originalScale", {
/**
* @return Scale
*/
get: function () {
return $type.getValueDefault(this._originalScale, 1);
},
/**
* Element's original scale.
*
* @ignore Exclude from docs
* @param value Scale
*/
set: function (value) {
if (this._originalScale !== value) {
this._originalScale = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "originalAngle", {
/**
* @return Angle
*/
get: function () {
return $type.getValueDefault(this._originalAngle, 0);
},
/**
* Element's original angle.
*
* @ignore Exclude from docs
* @param value Angle
*/
set: function (value) {
if (this._originalAngle !== value) {
this._originalAngle = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "inertiaOptions", {
/**
* @return Options
*/
get: function () {
if (this.sprite && this.sprite._adapterO) {
return this.sprite._adapterO.apply("inertiaOptions", this._inertiaOptions);
}
else {
return this._inertiaOptions;
}
},
/**
* Inertia options.
*
* @param value Options
*/
set: function (value) {
this._inertiaOptions = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "hitOptions", {
/**
* @return Options
*/
get: function () {
if (this.sprite && this.sprite._adapterO) {
return this.sprite._adapterO.apply("hitOptions", this._hitOptions);
}
else {
return this._hitOptions;
}
},
/**
* Hit options.
*
* @param value Options
*/
set: function (value) {
this._hitOptions = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "hoverOptions", {
/**
* @return Options
*/
get: function () {
if (this.sprite && this.sprite._adapterO) {
return this.sprite._adapterO.apply("hoverOptions", this._hoverOptions);
}
else {
return this._hoverOptions;
}
},
/**
* Hover options.
*
* @param value Options
*/
set: function (value) {
this._hoverOptions = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "swipeOptions", {
/**
* @return Options
*/
get: function () {
if (this.sprite && this.sprite._adapterO) {
return this.sprite._adapterO.apply("swipeOptions", this._swipeOptions);
}
else {
return this._swipeOptions;
}
},
/**
* Swipe options.
*
* @param value Options
*/
set: function (value) {
this._swipeOptions = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "keyboardOptions", {
/**
* @return Options
*/
get: function () {
if (this.sprite && this.sprite._adapterO) {
return this.sprite._adapterO.apply("keyboardOptions", this._keyboardOptions);
}
else {
return this._keyboardOptions;
}
},
/**
* Keyboard options.
*
* @param value Options
*/
set: function (value) {
this._keyboardOptions = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "mouseOptions", {
/**
* @return Options
*/
get: function () {
if (this.sprite && this.sprite._adapterO) {
return this.sprite._adapterO.apply("mouseOptions", this._mouseOptions);
}
else {
return this._mouseOptions;
}
},
/**
* Mouse options.
*
* Enables controlling options related to the mouse, for example sensitivity
* of its mouse wheel.
*
* E.g. the below will reduce chart's wheel-zoom speed to half its default
* speed:
*
* ```TypeScript
* chart.plotContainer.mouseOptions.sensitivity = 0.5;
* ```
* ```JavaScript
* chart.plotContainer.mouseOptions.sensitivity = 0.5;
* ```
* ```JSON
* {
* // ...
* "plotContainer": {
* "mouseOptions": {
* "sensitivity": 0.5
* }
* }
* }
* ```
*
* @since 4.5.14
* @param value Options
*/
set: function (value) {
this._mouseOptions = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(InteractionObject.prototype, "cursorOptions", {
/**
* @return Options
*/
get: function () {
if (this.sprite && this.sprite._adapterO) {
return this.sprite._adapterO.apply("cursorOptions", this._cursorOptions);
}
else {
return this._cursorOptions;
}
},
/**
* Cursor options.
*
* @param value Options
*/
set: function (value) {
this._cursorOptions = value;
},
enumerable: true,
configurable: true
});
/**
* Copies all properties and related assets from another object of the same
* type.
*
* @param source Source object
*/
InteractionObject.prototype.copyFrom = function (source) {
_super.prototype.copyFrom.call(this, source);
this.inertiaOptions = source.inertiaOptions;
this.hitOptions = source.hitOptions;
this.hoverOptions = source.hoverOptions;
this.swipeOptions = source.swipeOptions;
this.keyboardOptions = source.keyboardOptions;
this.cursorOptions = source.cursorOptions;
this.contextMenuDisabled = source.contextMenuDisabled;
getInteraction().applyCursorOverStyle(this);
};
/**
* @ignore Exclude from docs
*/
InteractionObject.prototype.setEventDisposer = function (key, value, f) {
var disposer = this.eventDisposers.getKey(key);
if (value) {
if (disposer == null) {
this.eventDisposers.setKey(key, f());
}
}
else {
if (disposer != null) {
disposer.dispose();
this.eventDisposers.removeKey(key);
}
}
};
/**
* Disposes object.
*/
InteractionObject.prototype.dispose = function () {
_super.prototype.dispose.call(this);
// Remove from all interaction registries
var interaction = getInteraction();
interaction.overObjects.removeValue(this);
interaction.downObjects.removeValue(this);
interaction.trackedObjects.removeValue(this);
interaction.transformedObjects.removeValue(this);
// Unlock document wheel
if (this.isHover && this.wheelable) {
interaction.unlockWheel();
}
if (interaction.focusedObject === this) {
interaction.focusedObject = undefined;
}
};
return InteractionObject;
}(BaseObjectEvents));
export { InteractionObject };
//# sourceMappingURL=InteractionObject.js.map |
ajax/libs/x-editable/1.4.5/jquery-editable/js/jquery-editable-poshytip.js | jessepollak/cdnjs | /*! X-editable - v1.4.5
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
* http://github.com/vitalets/x-editable
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
/**
Form with single input element, two buttons and two states: normal/loading.
Applied as jQuery method to DIV tag (not to form tag!). This is because form can be in loading state when spinner shown.
Editableform is linked with one of input types, e.g. 'text', 'select' etc.
@class editableform
@uses text
@uses textarea
**/
(function ($) {
"use strict";
var EditableForm = function (div, options) {
this.options = $.extend({}, $.fn.editableform.defaults, options);
this.$div = $(div); //div, containing form. Not form tag. Not editable-element.
if(!this.options.scope) {
this.options.scope = this;
}
//nothing shown after init
};
EditableForm.prototype = {
constructor: EditableForm,
initInput: function() { //called once
//take input from options (as it is created in editable-element)
this.input = this.options.input;
//set initial value
//todo: may be add check: typeof str === 'string' ?
this.value = this.input.str2value(this.options.value);
},
initTemplate: function() {
this.$form = $($.fn.editableform.template);
},
initButtons: function() {
var $btn = this.$form.find('.editable-buttons');
$btn.append($.fn.editableform.buttons);
if(this.options.showbuttons === 'bottom') {
$btn.addClass('editable-buttons-bottom');
}
},
/**
Renders editableform
@method render
**/
render: function() {
//init loader
this.$loading = $($.fn.editableform.loading);
this.$div.empty().append(this.$loading);
//init form template and buttons
this.initTemplate();
if(this.options.showbuttons) {
this.initButtons();
} else {
this.$form.find('.editable-buttons').remove();
}
//show loading state
this.showLoading();
//flag showing is form now saving value to server.
//It is needed to wait when closing form.
this.isSaving = false;
/**
Fired when rendering starts
@event rendering
@param {Object} event event object
**/
this.$div.triggerHandler('rendering');
//init input
this.initInput();
//append input to form
this.input.prerender();
this.$form.find('div.editable-input').append(this.input.$tpl);
//append form to container
this.$div.append(this.$form);
//render input
$.when(this.input.render())
.then($.proxy(function () {
//setup input to submit automatically when no buttons shown
if(!this.options.showbuttons) {
this.input.autosubmit();
}
//attach 'cancel' handler
this.$form.find('.editable-cancel').click($.proxy(this.cancel, this));
if(this.input.error) {
this.error(this.input.error);
this.$form.find('.editable-submit').attr('disabled', true);
this.input.$input.attr('disabled', true);
//prevent form from submitting
this.$form.submit(function(e){ e.preventDefault(); });
} else {
this.error(false);
this.input.$input.removeAttr('disabled');
this.$form.find('.editable-submit').removeAttr('disabled');
this.input.value2input(this.value);
//attach submit handler
this.$form.submit($.proxy(this.submit, this));
}
/**
Fired when form is rendered
@event rendered
@param {Object} event event object
**/
this.$div.triggerHandler('rendered');
this.showForm();
//call postrender method to perform actions required visibility of form
if(this.input.postrender) {
this.input.postrender();
}
}, this));
},
cancel: function() {
/**
Fired when form was cancelled by user
@event cancel
@param {Object} event event object
**/
this.$div.triggerHandler('cancel');
},
showLoading: function() {
var w, h;
if(this.$form) {
//set loading size equal to form
w = this.$form.outerWidth();
h = this.$form.outerHeight();
if(w) {
this.$loading.width(w);
}
if(h) {
this.$loading.height(h);
}
this.$form.hide();
} else {
//stretch loading to fill container width
w = this.$loading.parent().width();
if(w) {
this.$loading.width(w);
}
}
this.$loading.show();
},
showForm: function(activate) {
this.$loading.hide();
this.$form.show();
if(activate !== false) {
this.input.activate();
}
/**
Fired when form is shown
@event show
@param {Object} event event object
**/
this.$div.triggerHandler('show');
},
error: function(msg) {
var $group = this.$form.find('.control-group'),
$block = this.$form.find('.editable-error-block'),
lines;
if(msg === false) {
$group.removeClass($.fn.editableform.errorGroupClass);
$block.removeClass($.fn.editableform.errorBlockClass).empty().hide();
} else {
//convert newline to <br> for more pretty error display
if(msg) {
lines = msg.split("\n");
for (var i = 0; i < lines.length; i++) {
lines[i] = $('<div>').text(lines[i]).html();
}
msg = lines.join('<br>');
}
$group.addClass($.fn.editableform.errorGroupClass);
$block.addClass($.fn.editableform.errorBlockClass).html(msg).show();
}
},
submit: function(e) {
e.stopPropagation();
e.preventDefault();
var error,
newValue = this.input.input2value(); //get new value from input
//validation
if (error = this.validate(newValue)) {
this.error(error);
this.showForm();
return;
}
//if value not changed --> trigger 'nochange' event and return
/*jslint eqeq: true*/
if (!this.options.savenochange && this.input.value2str(newValue) == this.input.value2str(this.value)) {
/*jslint eqeq: false*/
/**
Fired when value not changed but form is submitted. Requires savenochange = false.
@event nochange
@param {Object} event event object
**/
this.$div.triggerHandler('nochange');
return;
}
//convert value for submitting to server
var submitValue = this.input.value2submit(newValue);
this.isSaving = true;
//sending data to server
$.when(this.save(submitValue))
.done($.proxy(function(response) {
this.isSaving = false;
//run success callback
var res = typeof this.options.success === 'function' ? this.options.success.call(this.options.scope, response, newValue) : null;
//if success callback returns false --> keep form open and do not activate input
if(res === false) {
this.error(false);
this.showForm(false);
return;
}
//if success callback returns string --> keep form open, show error and activate input
if(typeof res === 'string') {
this.error(res);
this.showForm();
return;
}
//if success callback returns object like {newValue: <something>} --> use that value instead of submitted
//it is usefull if you want to chnage value in url-function
if(res && typeof res === 'object' && res.hasOwnProperty('newValue')) {
newValue = res.newValue;
}
//clear error message
this.error(false);
this.value = newValue;
/**
Fired when form is submitted
@event save
@param {Object} event event object
@param {Object} params additional params
@param {mixed} params.newValue raw new value
@param {mixed} params.submitValue submitted value as string
@param {Object} params.response ajax response
@example
$('#form-div').on('save'), function(e, params){
if(params.newValue === 'username') {...}
});
**/
this.$div.triggerHandler('save', {newValue: newValue, submitValue: submitValue, response: response});
}, this))
.fail($.proxy(function(xhr) {
this.isSaving = false;
var msg;
if(typeof this.options.error === 'function') {
msg = this.options.error.call(this.options.scope, xhr, newValue);
} else {
msg = typeof xhr === 'string' ? xhr : xhr.responseText || xhr.statusText || 'Unknown error!';
}
this.error(msg);
this.showForm();
}, this));
},
save: function(submitValue) {
//try parse composite pk defined as json string in data-pk
this.options.pk = $.fn.editableutils.tryParseJson(this.options.pk, true);
var pk = (typeof this.options.pk === 'function') ? this.options.pk.call(this.options.scope) : this.options.pk,
/*
send on server in following cases:
1. url is function
2. url is string AND (pk defined OR send option = always)
*/
send = !!(typeof this.options.url === 'function' || (this.options.url && ((this.options.send === 'always') || (this.options.send === 'auto' && pk !== null && pk !== undefined)))),
params;
if (send) { //send to server
this.showLoading();
//standard params
params = {
name: this.options.name || '',
value: submitValue,
pk: pk
};
//additional params
if(typeof this.options.params === 'function') {
params = this.options.params.call(this.options.scope, params);
} else {
//try parse json in single quotes (from data-params attribute)
this.options.params = $.fn.editableutils.tryParseJson(this.options.params, true);
$.extend(params, this.options.params);
}
if(typeof this.options.url === 'function') { //user's function
return this.options.url.call(this.options.scope, params);
} else {
//send ajax to server and return deferred object
return $.ajax($.extend({
url : this.options.url,
data : params,
type : 'POST'
}, this.options.ajaxOptions));
}
}
},
validate: function (value) {
if (value === undefined) {
value = this.value;
}
if (typeof this.options.validate === 'function') {
return this.options.validate.call(this.options.scope, value);
}
},
option: function(key, value) {
if(key in this.options) {
this.options[key] = value;
}
if(key === 'value') {
this.setValue(value);
}
//do not pass option to input as it is passed in editable-element
},
setValue: function(value, convertStr) {
if(convertStr) {
this.value = this.input.str2value(value);
} else {
this.value = value;
}
//if form is visible, update input
if(this.$form && this.$form.is(':visible')) {
this.input.value2input(this.value);
}
}
};
/*
Initialize editableform. Applied to jQuery object.
@method $().editableform(options)
@params {Object} options
@example
var $form = $('<div>').editableform({
type: 'text',
name: 'username',
url: '/post',
value: 'vitaliy'
});
//to display form you should call 'render' method
$form.editableform('render');
*/
$.fn.editableform = function (option) {
var args = arguments;
return this.each(function () {
var $this = $(this),
data = $this.data('editableform'),
options = typeof option === 'object' && option;
if (!data) {
$this.data('editableform', (data = new EditableForm(this, options)));
}
if (typeof option === 'string') { //call method
data[option].apply(data, Array.prototype.slice.call(args, 1));
}
});
};
//keep link to constructor to allow inheritance
$.fn.editableform.Constructor = EditableForm;
//defaults
$.fn.editableform.defaults = {
/* see also defaults for input */
/**
Type of input. Can be <code>text|textarea|select|date|checklist</code>
@property type
@type string
@default 'text'
**/
type: 'text',
/**
Url for submit, e.g. <code>'/post'</code>
If function - it will be called instead of ajax. Function should return deferred object to run fail/done callbacks.
@property url
@type string|function
@default null
@example
url: function(params) {
var d = new $.Deferred;
if(params.value === 'abc') {
return d.reject('error message'); //returning error via deferred object
} else {
//async saving data in js model
someModel.asyncSaveMethod({
...,
success: function(){
d.resolve();
}
});
return d.promise();
}
}
**/
url:null,
/**
Additional params for submit. If defined as <code>object</code> - it is **appended** to original ajax data (pk, name and value).
If defined as <code>function</code> - returned object **overwrites** original ajax data.
@example
params: function(params) {
//originally params contain pk, name and value
params.a = 1;
return params;
}
@property params
@type object|function
@default null
**/
params:null,
/**
Name of field. Will be submitted on server. Can be taken from <code>id</code> attribute
@property name
@type string
@default null
**/
name: null,
/**
Primary key of editable object (e.g. record id in database). For composite keys use object, e.g. <code>{id: 1, lang: 'en'}</code>.
Can be calculated dynamically via function.
@property pk
@type string|object|function
@default null
**/
pk: null,
/**
Initial value. If not defined - will be taken from element's content.
For __select__ type should be defined (as it is ID of shown text).
@property value
@type string|object
@default null
**/
value: null,
/**
Strategy for sending data on server. Can be <code>auto|always|never</code>.
When 'auto' data will be sent on server only if pk defined, otherwise new value will be stored in element.
@property send
@type string
@default 'auto'
**/
send: 'auto',
/**
Function for client-side validation. If returns string - means validation not passed and string showed as error.
@property validate
@type function
@default null
@example
validate: function(value) {
if($.trim(value) == '') {
return 'This field is required';
}
}
**/
validate: null,
/**
Success callback. Called when value successfully sent on server and **response status = 200**.
Usefull to work with json response. For example, if your backend response can be <code>{success: true}</code>
or <code>{success: false, msg: "server error"}</code> you can check it inside this callback.
If it returns **string** - means error occured and string is shown as error message.
If it returns **object like** <code>{newValue: <something>}</code> - it overwrites value, submitted by user.
Otherwise newValue simply rendered into element.
@property success
@type function
@default null
@example
success: function(response, newValue) {
if(!response.success) return response.msg;
}
**/
success: null,
/**
Error callback. Called when request failed (response status != 200).
Usefull when you want to parse error response and display a custom message.
Must return **string** - the message to be displayed in the error block.
@property error
@type function
@default null
@since 1.4.4
@example
error: function(response, newValue) {
if(response.status === 500) {
return 'Service unavailable. Please try later.';
} else {
return response.responseText;
}
}
**/
error: null,
/**
Additional options for submit ajax request.
List of values: http://api.jquery.com/jQuery.ajax
@property ajaxOptions
@type object
@default null
@since 1.1.1
@example
ajaxOptions: {
type: 'put',
dataType: 'json'
}
**/
ajaxOptions: null,
/**
Where to show buttons: left(true)|bottom|false
Form without buttons is auto-submitted.
@property showbuttons
@type boolean|string
@default true
@since 1.1.1
**/
showbuttons: true,
/**
Scope for callback methods (success, validate).
If <code>null</code> means editableform instance itself.
@property scope
@type DOMElement|object
@default null
@since 1.2.0
@private
**/
scope: null,
/**
Whether to save or cancel value when it was not changed but form was submitted
@property savenochange
@type boolean
@default false
@since 1.2.0
**/
savenochange: false
};
/*
Note: following params could redefined in engine: bootstrap or jqueryui:
Classes 'control-group' and 'editable-error-block' must always present!
*/
$.fn.editableform.template = '<form class="form-inline editableform">'+
'<div class="control-group">' +
'<div><div class="editable-input"></div><div class="editable-buttons"></div></div>'+
'<div class="editable-error-block"></div>' +
'</div>' +
'</form>';
//loading div
$.fn.editableform.loading = '<div class="editableform-loading"></div>';
//buttons
$.fn.editableform.buttons = '<button type="submit" class="editable-submit">ok</button>'+
'<button type="button" class="editable-cancel">cancel</button>';
//error class attached to control-group
$.fn.editableform.errorGroupClass = null;
//error class attached to editable-error-block
$.fn.editableform.errorBlockClass = 'editable-error';
}(window.jQuery));
/**
* EditableForm utilites
*/
(function ($) {
"use strict";
//utils
$.fn.editableutils = {
/**
* classic JS inheritance function
*/
inherit: function (Child, Parent) {
var F = function() { };
F.prototype = Parent.prototype;
Child.prototype = new F();
Child.prototype.constructor = Child;
Child.superclass = Parent.prototype;
},
/**
* set caret position in input
* see http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area
*/
setCursorPosition: function(elem, pos) {
if (elem.setSelectionRange) {
elem.setSelectionRange(pos, pos);
} else if (elem.createTextRange) {
var range = elem.createTextRange();
range.collapse(true);
range.moveEnd('character', pos);
range.moveStart('character', pos);
range.select();
}
},
/**
* function to parse JSON in *single* quotes. (jquery automatically parse only double quotes)
* That allows such code as: <a data-source="{'a': 'b', 'c': 'd'}">
* safe = true --> means no exception will be thrown
* for details see http://stackoverflow.com/questions/7410348/how-to-set-json-format-to-html5-data-attributes-in-the-jquery
*/
tryParseJson: function(s, safe) {
if (typeof s === 'string' && s.length && s.match(/^[\{\[].*[\}\]]$/)) {
if (safe) {
try {
/*jslint evil: true*/
s = (new Function('return ' + s))();
/*jslint evil: false*/
} catch (e) {} finally {
return s;
}
} else {
/*jslint evil: true*/
s = (new Function('return ' + s))();
/*jslint evil: false*/
}
}
return s;
},
/**
* slice object by specified keys
*/
sliceObj: function(obj, keys, caseSensitive /* default: false */) {
var key, keyLower, newObj = {};
if (!$.isArray(keys) || !keys.length) {
return newObj;
}
for (var i = 0; i < keys.length; i++) {
key = keys[i];
if (obj.hasOwnProperty(key)) {
newObj[key] = obj[key];
}
if(caseSensitive === true) {
continue;
}
//when getting data-* attributes via $.data() it's converted to lowercase.
//details: http://stackoverflow.com/questions/7602565/using-data-attributes-with-jquery
//workaround is code below.
keyLower = key.toLowerCase();
if (obj.hasOwnProperty(keyLower)) {
newObj[key] = obj[keyLower];
}
}
return newObj;
},
/*
exclude complex objects from $.data() before pass to config
*/
getConfigData: function($element) {
var data = {};
$.each($element.data(), function(k, v) {
if(typeof v !== 'object' || (v && typeof v === 'object' && (v.constructor === Object || v.constructor === Array))) {
data[k] = v;
}
});
return data;
},
/*
returns keys of object
*/
objectKeys: function(o) {
if (Object.keys) {
return Object.keys(o);
} else {
if (o !== Object(o)) {
throw new TypeError('Object.keys called on a non-object');
}
var k=[], p;
for (p in o) {
if (Object.prototype.hasOwnProperty.call(o,p)) {
k.push(p);
}
}
return k;
}
},
/**
method to escape html.
**/
escape: function(str) {
return $('<div>').text(str).html();
},
/*
returns array items from sourceData having value property equal or inArray of 'value'
*/
itemsByValue: function(value, sourceData, valueProp) {
if(!sourceData || value === null) {
return [];
}
valueProp = valueProp || 'value';
var isValArray = $.isArray(value),
result = [],
that = this;
$.each(sourceData, function(i, o) {
if(o.children) {
result = result.concat(that.itemsByValue(value, o.children, valueProp));
} else {
/*jslint eqeq: true*/
if(isValArray) {
if($.grep(value, function(v){ return v == (o && typeof o === 'object' ? o[valueProp] : o); }).length) {
result.push(o);
}
} else {
if(value == (o && typeof o === 'object' ? o[valueProp] : o)) {
result.push(o);
}
}
/*jslint eqeq: false*/
}
});
return result;
},
/*
Returns input by options: type, mode.
*/
createInput: function(options) {
var TypeConstructor, typeOptions, input,
type = options.type;
//`date` is some kind of virtual type that is transformed to one of exact types
//depending on mode and core lib
if(type === 'date') {
//inline
if(options.mode === 'inline') {
if($.fn.editabletypes.datefield) {
type = 'datefield';
} else if($.fn.editabletypes.dateuifield) {
type = 'dateuifield';
}
//popup
} else {
if($.fn.editabletypes.date) {
type = 'date';
} else if($.fn.editabletypes.dateui) {
type = 'dateui';
}
}
//if type still `date` and not exist in types, replace with `combodate` that is base input
if(type === 'date' && !$.fn.editabletypes.date) {
type = 'combodate';
}
}
//`datetime` should be datetimefield in 'inline' mode
if(type === 'datetime' && options.mode === 'inline') {
type = 'datetimefield';
}
//change wysihtml5 to textarea for jquery UI and plain versions
if(type === 'wysihtml5' && !$.fn.editabletypes[type]) {
type = 'textarea';
}
//create input of specified type. Input will be used for converting value, not in form
if(typeof $.fn.editabletypes[type] === 'function') {
TypeConstructor = $.fn.editabletypes[type];
typeOptions = this.sliceObj(options, this.objectKeys(TypeConstructor.defaults));
input = new TypeConstructor(typeOptions);
return input;
} else {
$.error('Unknown type: '+ type);
return false;
}
},
//see http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
supportsTransitions: function () {
var b = document.body || document.documentElement,
s = b.style,
p = 'transition',
v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms'];
if(typeof s[p] === 'string') {
return true;
}
// Tests for vendor specific prop
p = p.charAt(0).toUpperCase() + p.substr(1);
for(var i=0; i<v.length; i++) {
if(typeof s[v[i] + p] === 'string') {
return true;
}
}
return false;
}
};
}(window.jQuery));
/**
Attaches stand-alone container with editable-form to HTML element. Element is used only for positioning, value is not stored anywhere.<br>
This method applied internally in <code>$().editable()</code>. You should subscribe on it's events (save / cancel) to get profit of it.<br>
Final realization can be different: bootstrap-popover, jqueryui-tooltip, poshytip, inline-div. It depends on which js file you include.<br>
Applied as jQuery method.
@class editableContainer
@uses editableform
**/
(function ($) {
"use strict";
var Popup = function (element, options) {
this.init(element, options);
};
var Inline = function (element, options) {
this.init(element, options);
};
//methods
Popup.prototype = {
containerName: null, //tbd in child class
innerCss: null, //tbd in child class
containerClass: 'editable-container editable-popup', //css class applied to container element
init: function(element, options) {
this.$element = $(element);
//since 1.4.1 container do not use data-* directly as they already merged into options.
this.options = $.extend({}, $.fn.editableContainer.defaults, options);
this.splitOptions();
//set scope of form callbacks to element
this.formOptions.scope = this.$element[0];
this.initContainer();
//flag to hide container, when saving value will finish
this.delayedHide = false;
//bind 'destroyed' listener to destroy container when element is removed from dom
this.$element.on('destroyed', $.proxy(function(){
this.destroy();
}, this));
//attach document handler to close containers on click / escape
if(!$(document).data('editable-handlers-attached')) {
//close all on escape
$(document).on('keyup.editable', function (e) {
if (e.which === 27) {
$('.editable-open').editableContainer('hide');
//todo: return focus on element
}
});
//close containers when click outside
//(mousedown could be better than click, it closes everything also on drag drop)
$(document).on('click.editable', function(e) {
var $target = $(e.target), i,
exclude_classes = ['.editable-container',
'.ui-datepicker-header',
'.datepicker', //in inline mode datepicker is rendered into body
'.modal-backdrop',
'.bootstrap-wysihtml5-insert-image-modal',
'.bootstrap-wysihtml5-insert-link-modal'
];
//check if element is detached. It occurs when clicking in bootstrap datepicker
if (!$.contains(document.documentElement, e.target)) {
return;
}
//for some reason FF 20 generates extra event (click) in select2 widget with e.target = document
//we need to filter it via construction below. See https://github.com/vitalets/x-editable/issues/199
//Possibly related to http://stackoverflow.com/questions/10119793/why-does-firefox-react-differently-from-webkit-and-ie-to-click-event-on-selec
if($target.is(document)) {
return;
}
//if click inside one of exclude classes --> no nothing
for(i=0; i<exclude_classes.length; i++) {
if($target.is(exclude_classes[i]) || $target.parents(exclude_classes[i]).length) {
return;
}
}
//close all open containers (except one - target)
Popup.prototype.closeOthers(e.target);
});
$(document).data('editable-handlers-attached', true);
}
},
//split options on containerOptions and formOptions
splitOptions: function() {
this.containerOptions = {};
this.formOptions = {};
if(!$.fn[this.containerName]) {
throw new Error(this.containerName + ' not found. Have you included corresponding js file?');
}
var cDef = $.fn[this.containerName].defaults;
//keys defined in container defaults go to container, others go to form
for(var k in this.options) {
if(k in cDef) {
this.containerOptions[k] = this.options[k];
} else {
this.formOptions[k] = this.options[k];
}
}
},
/*
Returns jquery object of container
@method tip()
*/
tip: function() {
return this.container() ? this.container().$tip : null;
},
/* returns container object */
container: function() {
return this.$element.data(this.containerDataName || this.containerName);
},
/* call native method of underlying container, e.g. this.$element.popover('method') */
call: function() {
this.$element[this.containerName].apply(this.$element, arguments);
},
initContainer: function(){
this.call(this.containerOptions);
},
renderForm: function() {
this.$form
.editableform(this.formOptions)
.on({
save: $.proxy(this.save, this), //click on submit button (value changed)
nochange: $.proxy(function(){ this.hide('nochange'); }, this), //click on submit button (value NOT changed)
cancel: $.proxy(function(){ this.hide('cancel'); }, this), //click on calcel button
show: $.proxy(function() {
if(this.delayedHide) {
this.hide(this.delayedHide.reason);
this.delayedHide = false;
} else {
this.setPosition();
}
}, this), //re-position container every time form is shown (occurs each time after loading state)
rendering: $.proxy(this.setPosition, this), //this allows to place container correctly when loading shown
resize: $.proxy(this.setPosition, this), //this allows to re-position container when form size is changed
rendered: $.proxy(function(){
/**
Fired when container is shown and form is rendered (for select will wait for loading dropdown options).
**Note:** Bootstrap popover has own `shown` event that now cannot be separated from x-editable's one.
The workaround is to check `arguments.length` that is always `2` for x-editable.
@event shown
@param {Object} event event object
@example
$('#username').on('shown', function(e, editable) {
editable.input.$input.val('overwriting value of input..');
});
**/
/*
TODO: added second param mainly to distinguish from bootstrap's shown event. It's a hotfix that will be solved in future versions via namespaced events.
*/
this.$element.triggerHandler('shown', this);
}, this)
})
.editableform('render');
},
/**
Shows container with form
@method show()
@param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true.
**/
/* Note: poshytip owerwrites this method totally! */
show: function (closeAll) {
this.$element.addClass('editable-open');
if(closeAll !== false) {
//close all open containers (except this)
this.closeOthers(this.$element[0]);
}
//show container itself
this.innerShow();
this.tip().addClass(this.containerClass);
/*
Currently, form is re-rendered on every show.
The main reason is that we dont know, what will container do with content when closed:
remove(), detach() or just hide() - it depends on container.
Detaching form itself before hide and re-insert before show is good solution,
but visually it looks ugly --> container changes size before hide.
*/
//if form already exist - delete previous data
if(this.$form) {
//todo: destroy prev data!
//this.$form.destroy();
}
this.$form = $('<div>');
//insert form into container body
if(this.tip().is(this.innerCss)) {
//for inline container
this.tip().append(this.$form);
} else {
this.tip().find(this.innerCss).append(this.$form);
}
//render form
this.renderForm();
},
/**
Hides container with form
@method hide()
@param {string} reason Reason caused hiding. Can be <code>save|cancel|onblur|nochange|undefined (=manual)</code>
**/
hide: function(reason) {
if(!this.tip() || !this.tip().is(':visible') || !this.$element.hasClass('editable-open')) {
return;
}
//if form is saving value, schedule hide
if(this.$form.data('editableform').isSaving) {
this.delayedHide = {reason: reason};
return;
} else {
this.delayedHide = false;
}
this.$element.removeClass('editable-open');
this.innerHide();
/**
Fired when container was hidden. It occurs on both save or cancel.
**Note:** Bootstrap popover has own `hidden` event that now cannot be separated from x-editable's one.
The workaround is to check `arguments.length` that is always `2` for x-editable.
@event hidden
@param {object} event event object
@param {string} reason Reason caused hiding. Can be <code>save|cancel|onblur|nochange|manual</code>
@example
$('#username').on('hidden', function(e, reason) {
if(reason === 'save' || reason === 'cancel') {
//auto-open next editable
$(this).closest('tr').next().find('.editable').editable('show');
}
});
**/
this.$element.triggerHandler('hidden', reason || 'manual');
},
/* internal show method. To be overwritten in child classes */
innerShow: function () {
},
/* internal hide method. To be overwritten in child classes */
innerHide: function () {
},
/**
Toggles container visibility (show / hide)
@method toggle()
@param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true.
**/
toggle: function(closeAll) {
if(this.container() && this.tip() && this.tip().is(':visible')) {
this.hide();
} else {
this.show(closeAll);
}
},
/*
Updates the position of container when content changed.
@method setPosition()
*/
setPosition: function() {
//tbd in child class
},
save: function(e, params) {
/**
Fired when new value was submitted. You can use <code>$(this).data('editableContainer')</code> inside handler to access to editableContainer instance
@event save
@param {Object} event event object
@param {Object} params additional params
@param {mixed} params.newValue submitted value
@param {Object} params.response ajax response
@example
$('#username').on('save', function(e, params) {
//assuming server response: '{success: true}'
var pk = $(this).data('editableContainer').options.pk;
if(params.response && params.response.success) {
alert('value: ' + params.newValue + ' with pk: ' + pk + ' saved!');
} else {
alert('error!');
}
});
**/
this.$element.triggerHandler('save', params);
//hide must be after trigger, as saving value may require methods of plugin, applied to input
this.hide('save');
},
/**
Sets new option
@method option(key, value)
@param {string} key
@param {mixed} value
**/
option: function(key, value) {
this.options[key] = value;
if(key in this.containerOptions) {
this.containerOptions[key] = value;
this.setContainerOption(key, value);
} else {
this.formOptions[key] = value;
if(this.$form) {
this.$form.editableform('option', key, value);
}
}
},
setContainerOption: function(key, value) {
this.call('option', key, value);
},
/**
Destroys the container instance
@method destroy()
**/
destroy: function() {
this.hide();
this.innerDestroy();
this.$element.off('destroyed');
this.$element.removeData('editableContainer');
},
/* to be overwritten in child classes */
innerDestroy: function() {
},
/*
Closes other containers except one related to passed element.
Other containers can be cancelled or submitted (depends on onblur option)
*/
closeOthers: function(element) {
$('.editable-open').each(function(i, el){
//do nothing with passed element and it's children
if(el === element || $(el).find(element).length) {
return;
}
//otherwise cancel or submit all open containers
var $el = $(el),
ec = $el.data('editableContainer');
if(!ec) {
return;
}
if(ec.options.onblur === 'cancel') {
$el.data('editableContainer').hide('onblur');
} else if(ec.options.onblur === 'submit') {
$el.data('editableContainer').tip().find('form').submit();
}
});
},
/**
Activates input of visible container (e.g. set focus)
@method activate()
**/
activate: function() {
if(this.tip && this.tip().is(':visible') && this.$form) {
this.$form.data('editableform').input.activate();
}
}
};
/**
jQuery method to initialize editableContainer.
@method $().editableContainer(options)
@params {Object} options
@example
$('#edit').editableContainer({
type: 'text',
url: '/post',
pk: 1,
value: 'hello'
});
**/
$.fn.editableContainer = function (option) {
var args = arguments;
return this.each(function () {
var $this = $(this),
dataKey = 'editableContainer',
data = $this.data(dataKey),
options = typeof option === 'object' && option,
Constructor = (options.mode === 'inline') ? Inline : Popup;
if (!data) {
$this.data(dataKey, (data = new Constructor(this, options)));
}
if (typeof option === 'string') { //call method
data[option].apply(data, Array.prototype.slice.call(args, 1));
}
});
};
//store constructors
$.fn.editableContainer.Popup = Popup;
$.fn.editableContainer.Inline = Inline;
//defaults
$.fn.editableContainer.defaults = {
/**
Initial value of form input
@property value
@type mixed
@default null
@private
**/
value: null,
/**
Placement of container relative to element. Can be <code>top|right|bottom|left</code>. Not used for inline container.
@property placement
@type string
@default 'top'
**/
placement: 'top',
/**
Whether to hide container on save/cancel.
@property autohide
@type boolean
@default true
@private
**/
autohide: true,
/**
Action when user clicks outside the container. Can be <code>cancel|submit|ignore</code>.
Setting <code>ignore</code> allows to have several containers open.
@property onblur
@type string
@default 'cancel'
@since 1.1.1
**/
onblur: 'cancel',
/**
Animation speed (inline mode only)
@property anim
@type string
@default false
**/
anim: false,
/**
Mode of editable, can be `popup` or `inline`
@property mode
@type string
@default 'popup'
@since 1.4.0
**/
mode: 'popup'
};
/*
* workaround to have 'destroyed' event to destroy popover when element is destroyed
* see http://stackoverflow.com/questions/2200494/jquery-trigger-event-when-an-element-is-removed-from-the-dom
*/
jQuery.event.special.destroyed = {
remove: function(o) {
if (o.handler) {
o.handler();
}
}
};
}(window.jQuery));
/**
* Editable Inline
* ---------------------
*/
(function ($) {
"use strict";
//copy prototype from EditableContainer
//extend methods
$.extend($.fn.editableContainer.Inline.prototype, $.fn.editableContainer.Popup.prototype, {
containerName: 'editableform',
innerCss: '.editable-inline',
containerClass: 'editable-container editable-inline', //css class applied to container element
initContainer: function(){
//container is <span> element
this.$tip = $('<span></span>');
//convert anim to miliseconds (int)
if(!this.options.anim) {
this.options.anim = 0;
}
},
splitOptions: function() {
//all options are passed to form
this.containerOptions = {};
this.formOptions = this.options;
},
tip: function() {
return this.$tip;
},
innerShow: function () {
this.$element.hide();
this.tip().insertAfter(this.$element).show();
},
innerHide: function () {
this.$tip.hide(this.options.anim, $.proxy(function() {
this.$element.show();
this.innerDestroy();
}, this));
},
innerDestroy: function() {
if(this.tip()) {
this.tip().empty().remove();
}
}
});
}(window.jQuery));
/**
Makes editable any HTML element on the page. Applied as jQuery method.
@class editable
@uses editableContainer
**/
(function ($) {
"use strict";
var Editable = function (element, options) {
this.$element = $(element);
//data-* has more priority over js options: because dynamically created elements may change data-*
this.options = $.extend({}, $.fn.editable.defaults, options, $.fn.editableutils.getConfigData(this.$element));
if(this.options.selector) {
this.initLive();
} else {
this.init();
}
//check for transition support
if(this.options.highlight && !$.fn.editableutils.supportsTransitions()) {
this.options.highlight = false;
}
};
Editable.prototype = {
constructor: Editable,
init: function () {
var isValueByText = false,
doAutotext, finalize;
//name
this.options.name = this.options.name || this.$element.attr('id');
//create input of specified type. Input needed already here to convert value for initial display (e.g. show text by id for select)
//also we set scope option to have access to element inside input specific callbacks (e. g. source as function)
this.options.scope = this.$element[0];
this.input = $.fn.editableutils.createInput(this.options);
if(!this.input) {
return;
}
//set value from settings or by element's text
if (this.options.value === undefined || this.options.value === null) {
this.value = this.input.html2value($.trim(this.$element.html()));
isValueByText = true;
} else {
/*
value can be string when received from 'data-value' attribute
for complext objects value can be set as json string in data-value attribute,
e.g. data-value="{city: 'Moscow', street: 'Lenina'}"
*/
this.options.value = $.fn.editableutils.tryParseJson(this.options.value, true);
if(typeof this.options.value === 'string') {
this.value = this.input.str2value(this.options.value);
} else {
this.value = this.options.value;
}
}
//add 'editable' class to every editable element
this.$element.addClass('editable');
//attach handler activating editable. In disabled mode it just prevent default action (useful for links)
if(this.options.toggle !== 'manual') {
this.$element.addClass('editable-click');
this.$element.on(this.options.toggle + '.editable', $.proxy(function(e){
//prevent following link if editable enabled
if(!this.options.disabled) {
e.preventDefault();
}
//stop propagation not required because in document click handler it checks event target
//e.stopPropagation();
if(this.options.toggle === 'mouseenter') {
//for hover only show container
this.show();
} else {
//when toggle='click' we should not close all other containers as they will be closed automatically in document click listener
var closeAll = (this.options.toggle !== 'click');
this.toggle(closeAll);
}
}, this));
} else {
this.$element.attr('tabindex', -1); //do not stop focus on element when toggled manually
}
//if display is function it's far more convinient to have autotext = always to render correctly on init
//see https://github.com/vitalets/x-editable-yii/issues/34
if(typeof this.options.display === 'function') {
this.options.autotext = 'always';
}
//check conditions for autotext:
switch(this.options.autotext) {
case 'always':
doAutotext = true;
break;
case 'auto':
//if element text is empty and value is defined and value not generated by text --> run autotext
doAutotext = !$.trim(this.$element.text()).length && this.value !== null && this.value !== undefined && !isValueByText;
break;
default:
doAutotext = false;
}
//depending on autotext run render() or just finilize init
$.when(doAutotext ? this.render() : true).then($.proxy(function() {
if(this.options.disabled) {
this.disable();
} else {
this.enable();
}
/**
Fired when element was initialized by `$().editable()` method.
Please note that you should setup `init` handler **before** applying `editable`.
@event init
@param {Object} event event object
@param {Object} editable editable instance (as here it cannot accessed via data('editable'))
@since 1.2.0
@example
$('#username').on('init', function(e, editable) {
alert('initialized ' + editable.options.name);
});
$('#username').editable();
**/
this.$element.triggerHandler('init', this);
}, this));
},
/*
Initializes parent element for live editables
*/
initLive: function() {
//store selector
var selector = this.options.selector;
//modify options for child elements
this.options.selector = false;
this.options.autotext = 'never';
//listen toggle events
this.$element.on(this.options.toggle + '.editable', selector, $.proxy(function(e){
var $target = $(e.target);
if(!$target.data('editable')) {
//if delegated element initially empty, we need to clear it's text (that was manually set to `empty` by user)
//see https://github.com/vitalets/x-editable/issues/137
if($target.hasClass(this.options.emptyclass)) {
$target.empty();
}
$target.editable(this.options).trigger(e);
}
}, this));
},
/*
Renders value into element's text.
Can call custom display method from options.
Can return deferred object.
@method render()
@param {mixed} response server response (if exist) to pass into display function
*/
render: function(response) {
//do not display anything
if(this.options.display === false) {
return;
}
//if input has `value2htmlFinal` method, we pass callback in third param to be called when source is loaded
if(this.input.value2htmlFinal) {
return this.input.value2html(this.value, this.$element[0], this.options.display, response);
//if display method defined --> use it
} else if(typeof this.options.display === 'function') {
return this.options.display.call(this.$element[0], this.value, response);
//else use input's original value2html() method
} else {
return this.input.value2html(this.value, this.$element[0]);
}
},
/**
Enables editable
@method enable()
**/
enable: function() {
this.options.disabled = false;
this.$element.removeClass('editable-disabled');
this.handleEmpty(this.isEmpty);
if(this.options.toggle !== 'manual') {
if(this.$element.attr('tabindex') === '-1') {
this.$element.removeAttr('tabindex');
}
}
},
/**
Disables editable
@method disable()
**/
disable: function() {
this.options.disabled = true;
this.hide();
this.$element.addClass('editable-disabled');
this.handleEmpty(this.isEmpty);
//do not stop focus on this element
this.$element.attr('tabindex', -1);
},
/**
Toggles enabled / disabled state of editable element
@method toggleDisabled()
**/
toggleDisabled: function() {
if(this.options.disabled) {
this.enable();
} else {
this.disable();
}
},
/**
Sets new option
@method option(key, value)
@param {string|object} key option name or object with several options
@param {mixed} value option new value
@example
$('.editable').editable('option', 'pk', 2);
**/
option: function(key, value) {
//set option(s) by object
if(key && typeof key === 'object') {
$.each(key, $.proxy(function(k, v){
this.option($.trim(k), v);
}, this));
return;
}
//set option by string
this.options[key] = value;
//disabled
if(key === 'disabled') {
return value ? this.disable() : this.enable();
}
//value
if(key === 'value') {
this.setValue(value);
}
//transfer new option to container!
if(this.container) {
this.container.option(key, value);
}
//pass option to input directly (as it points to the same in form)
if(this.input.option) {
this.input.option(key, value);
}
},
/*
* set emptytext if element is empty
*/
handleEmpty: function (isEmpty) {
//do not handle empty if we do not display anything
if(this.options.display === false) {
return;
}
/*
isEmpty may be set directly as param of method.
It is required when we enable/disable field and can't rely on content
as node content is text: "Empty" that is not empty %)
*/
if(isEmpty !== undefined) {
this.isEmpty = isEmpty;
} else {
//detect empty
if($.trim(this.$element.html()) === '') {
this.isEmpty = true;
} else if($.trim(this.$element.text()) !== '') {
this.isEmpty = false;
} else {
//e.g. '<img>'
this.isEmpty = !this.$element.height() || !this.$element.width();
}
}
//emptytext shown only for enabled
if(!this.options.disabled) {
if (this.isEmpty) {
this.$element.html(this.options.emptytext);
if(this.options.emptyclass) {
this.$element.addClass(this.options.emptyclass);
}
} else if(this.options.emptyclass) {
this.$element.removeClass(this.options.emptyclass);
}
} else {
//below required if element disable property was changed
if(this.isEmpty) {
this.$element.empty();
if(this.options.emptyclass) {
this.$element.removeClass(this.options.emptyclass);
}
}
}
},
/**
Shows container with form
@method show()
@param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true.
**/
show: function (closeAll) {
if(this.options.disabled) {
return;
}
//init editableContainer: popover, tooltip, inline, etc..
if(!this.container) {
var containerOptions = $.extend({}, this.options, {
value: this.value,
input: this.input //pass input to form (as it is already created)
});
this.$element.editableContainer(containerOptions);
//listen `save` event
this.$element.on("save.internal", $.proxy(this.save, this));
this.container = this.$element.data('editableContainer');
} else if(this.container.tip().is(':visible')) {
return;
}
//show container
this.container.show(closeAll);
},
/**
Hides container with form
@method hide()
**/
hide: function () {
if(this.container) {
this.container.hide();
}
},
/**
Toggles container visibility (show / hide)
@method toggle()
@param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true.
**/
toggle: function(closeAll) {
if(this.container && this.container.tip().is(':visible')) {
this.hide();
} else {
this.show(closeAll);
}
},
/*
* called when form was submitted
*/
save: function(e, params) {
//mark element with unsaved class if needed
if(this.options.unsavedclass) {
/*
Add unsaved css to element if:
- url is not user's function
- value was not sent to server
- params.response === undefined, that means data was not sent
- value changed
*/
var sent = false;
sent = sent || typeof this.options.url === 'function';
sent = sent || this.options.display === false;
sent = sent || params.response !== undefined;
sent = sent || (this.options.savenochange && this.input.value2str(this.value) !== this.input.value2str(params.newValue));
if(sent) {
this.$element.removeClass(this.options.unsavedclass);
} else {
this.$element.addClass(this.options.unsavedclass);
}
}
//highlight when saving
if(this.options.highlight) {
var $e = this.$element,
$bgColor = $e.css('background-color');
$e.css('background-color', this.options.highlight);
setTimeout(function(){
$e.css('background-color', $bgColor);
$e.addClass('editable-bg-transition');
setTimeout(function(){
$e.removeClass('editable-bg-transition');
}, 1700);
}, 0);
}
//set new value
this.setValue(params.newValue, false, params.response);
/**
Fired when new value was submitted. You can use <code>$(this).data('editable')</code> to access to editable instance
@event save
@param {Object} event event object
@param {Object} params additional params
@param {mixed} params.newValue submitted value
@param {Object} params.response ajax response
@example
$('#username').on('save', function(e, params) {
alert('Saved value: ' + params.newValue);
});
**/
//event itself is triggered by editableContainer. Description here is only for documentation
},
validate: function () {
if (typeof this.options.validate === 'function') {
return this.options.validate.call(this, this.value);
}
},
/**
Sets new value of editable
@method setValue(value, convertStr)
@param {mixed} value new value
@param {boolean} convertStr whether to convert value from string to internal format
**/
setValue: function(value, convertStr, response) {
if(convertStr) {
this.value = this.input.str2value(value);
} else {
this.value = value;
}
if(this.container) {
this.container.option('value', this.value);
}
$.when(this.render(response))
.then($.proxy(function() {
this.handleEmpty();
}, this));
},
/**
Activates input of visible container (e.g. set focus)
@method activate()
**/
activate: function() {
if(this.container) {
this.container.activate();
}
},
/**
Removes editable feature from element
@method destroy()
**/
destroy: function() {
this.disable();
if(this.container) {
this.container.destroy();
}
this.input.destroy();
if(this.options.toggle !== 'manual') {
this.$element.removeClass('editable-click');
this.$element.off(this.options.toggle + '.editable');
}
this.$element.off("save.internal");
this.$element.removeClass('editable editable-open editable-disabled');
this.$element.removeData('editable');
}
};
/* EDITABLE PLUGIN DEFINITION
* ======================= */
/**
jQuery method to initialize editable element.
@method $().editable(options)
@params {Object} options
@example
$('#username').editable({
type: 'text',
url: '/post',
pk: 1
});
**/
$.fn.editable = function (option) {
//special API methods returning non-jquery object
var result = {}, args = arguments, datakey = 'editable';
switch (option) {
/**
Runs client-side validation for all matched editables
@method validate()
@returns {Object} validation errors map
@example
$('#username, #fullname').editable('validate');
// possible result:
{
username: "username is required",
fullname: "fullname should be minimum 3 letters length"
}
**/
case 'validate':
this.each(function () {
var $this = $(this), data = $this.data(datakey), error;
if (data && (error = data.validate())) {
result[data.options.name] = error;
}
});
return result;
/**
Returns current values of editable elements.
Note that it returns an **object** with name-value pairs, not a value itself. It allows to get data from several elements.
If value of some editable is `null` or `undefined` it is excluded from result object.
When param `isSingle` is set to **true** - it is supposed you have single element and will return value of editable instead of object.
@method getValue()
@param {bool} isSingle whether to return just value of single element
@returns {Object} object of element names and values
@example
$('#username, #fullname').editable('getValue');
//result:
{
username: "superuser",
fullname: "John"
}
//isSingle = true
$('#username').editable('getValue', true);
//result "superuser"
**/
case 'getValue':
if(arguments.length === 2 && arguments[1] === true) { //isSingle = true
result = this.eq(0).data(datakey).value;
} else {
this.each(function () {
var $this = $(this), data = $this.data(datakey);
if (data && data.value !== undefined && data.value !== null) {
result[data.options.name] = data.input.value2submit(data.value);
}
});
}
return result;
/**
This method collects values from several editable elements and submit them all to server.
Internally it runs client-side validation for all fields and submits only in case of success.
See <a href="#newrecord">creating new records</a> for details.
@method submit(options)
@param {object} options
@param {object} options.url url to submit data
@param {object} options.data additional data to submit
@param {object} options.ajaxOptions additional ajax options
@param {function} options.error(obj) error handler
@param {function} options.success(obj,config) success handler
@returns {Object} jQuery object
**/
case 'submit': //collects value, validate and submit to server for creating new record
var config = arguments[1] || {},
$elems = this,
errors = this.editable('validate'),
values;
if($.isEmptyObject(errors)) {
values = this.editable('getValue');
if(config.data) {
$.extend(values, config.data);
}
$.ajax($.extend({
url: config.url,
data: values,
type: 'POST'
}, config.ajaxOptions))
.success(function(response) {
//successful response 200 OK
if(typeof config.success === 'function') {
config.success.call($elems, response, config);
}
})
.error(function(){ //ajax error
if(typeof config.error === 'function') {
config.error.apply($elems, arguments);
}
});
} else { //client-side validation error
if(typeof config.error === 'function') {
config.error.call($elems, errors);
}
}
return this;
}
//return jquery object
return this.each(function () {
var $this = $(this),
data = $this.data(datakey),
options = typeof option === 'object' && option;
if (!data) {
$this.data(datakey, (data = new Editable(this, options)));
}
if (typeof option === 'string') { //call method
data[option].apply(data, Array.prototype.slice.call(args, 1));
}
});
};
$.fn.editable.defaults = {
/**
Type of input. Can be <code>text|textarea|select|date|checklist</code> and more
@property type
@type string
@default 'text'
**/
type: 'text',
/**
Sets disabled state of editable
@property disabled
@type boolean
@default false
**/
disabled: false,
/**
How to toggle editable. Can be <code>click|dblclick|mouseenter|manual</code>.
When set to <code>manual</code> you should manually call <code>show/hide</code> methods of editable.
**Note**: if you call <code>show</code> or <code>toggle</code> inside **click** handler of some DOM element,
you need to apply <code>e.stopPropagation()</code> because containers are being closed on any click on document.
@example
$('#edit-button').click(function(e) {
e.stopPropagation();
$('#username').editable('toggle');
});
@property toggle
@type string
@default 'click'
**/
toggle: 'click',
/**
Text shown when element is empty.
@property emptytext
@type string
@default 'Empty'
**/
emptytext: 'Empty',
/**
Allows to automatically set element's text based on it's value. Can be <code>auto|always|never</code>. Useful for select and date.
For example, if dropdown list is <code>{1: 'a', 2: 'b'}</code> and element's value set to <code>1</code>, it's html will be automatically set to <code>'a'</code>.
<code>auto</code> - text will be automatically set only if element is empty.
<code>always|never</code> - always(never) try to set element's text.
@property autotext
@type string
@default 'auto'
**/
autotext: 'auto',
/**
Initial value of input. If not set, taken from element's text.
Note, that if element's text is empty - text is automatically generated from value and can be customized (see `autotext` option).
For example, to display currency sign:
@example
<a id="price" data-type="text" data-value="100"></a>
<script>
$('#price').editable({
...
display: function(value) {
$(this).text(value + '$');
}
})
</script>
@property value
@type mixed
@default element's text
**/
value: null,
/**
Callback to perform custom displaying of value in element's text.
If `null`, default input's display used.
If `false`, no displaying methods will be called, element's text will never change.
Runs under element's scope.
_**Parameters:**_
* `value` current value to be displayed
* `response` server response (if display called after ajax submit), since 1.4.0
For _inputs with source_ (select, checklist) parameters are different:
* `value` current value to be displayed
* `sourceData` array of items for current input (e.g. dropdown items)
* `response` server response (if display called after ajax submit), since 1.4.0
To get currently selected items use `$.fn.editableutils.itemsByValue(value, sourceData)`.
@property display
@type function|boolean
@default null
@since 1.2.0
@example
display: function(value, sourceData) {
//display checklist as comma-separated values
var html = [],
checked = $.fn.editableutils.itemsByValue(value, sourceData);
if(checked.length) {
$.each(checked, function(i, v) { html.push($.fn.editableutils.escape(v.text)); });
$(this).html(html.join(', '));
} else {
$(this).empty();
}
}
**/
display: null,
/**
Css class applied when editable text is empty.
@property emptyclass
@type string
@since 1.4.1
@default editable-empty
**/
emptyclass: 'editable-empty',
/**
Css class applied when value was stored but not sent to server (`pk` is empty or `send = 'never'`).
You may set it to `null` if you work with editables locally and submit them together.
@property unsavedclass
@type string
@since 1.4.1
@default editable-unsaved
**/
unsavedclass: 'editable-unsaved',
/**
If selector is provided, editable will be delegated to the specified targets.
Usefull for dynamically generated DOM elements.
**Please note**, that delegated targets can't be initialized with `emptytext` and `autotext` options,
as they actually become editable only after first click.
You should manually set class `editable-click` to these elements.
Also, if element originally empty you should add class `editable-empty`, set `data-value=""` and write emptytext into element:
@property selector
@type string
@since 1.4.1
@default null
@example
<div id="user">
<!-- empty -->
<a href="#" data-name="username" data-type="text" class="editable-click editable-empty" data-value="" title="Username">Empty</a>
<!-- non-empty -->
<a href="#" data-name="group" data-type="select" data-source="/groups" data-value="1" class="editable-click" title="Group">Operator</a>
</div>
<script>
$('#user').editable({
selector: 'a',
url: '/post',
pk: 1
});
</script>
**/
selector: null,
/**
Color used to highlight element after update. Implemented via CSS3 transition, works in modern browsers.
@property highlight
@type string|boolean
@since 1.4.5
@default #FFFF80
**/
highlight: '#FFFF80'
};
}(window.jQuery));
/**
AbstractInput - base class for all editable inputs.
It defines interface to be implemented by any input type.
To create your own input you can inherit from this class.
@class abstractinput
**/
(function ($) {
"use strict";
//types
$.fn.editabletypes = {};
var AbstractInput = function () { };
AbstractInput.prototype = {
/**
Initializes input
@method init()
**/
init: function(type, options, defaults) {
this.type = type;
this.options = $.extend({}, defaults, options);
},
/*
this method called before render to init $tpl that is inserted in DOM
*/
prerender: function() {
this.$tpl = $(this.options.tpl); //whole tpl as jquery object
this.$input = this.$tpl; //control itself, can be changed in render method
this.$clear = null; //clear button
this.error = null; //error message, if input cannot be rendered
},
/**
Renders input from tpl. Can return jQuery deferred object.
Can be overwritten in child objects
@method render()
**/
render: function() {
},
/**
Sets element's html by value.
@method value2html(value, element)
@param {mixed} value
@param {DOMElement} element
**/
value2html: function(value, element) {
$(element).text($.trim(value));
},
/**
Converts element's html to value
@method html2value(html)
@param {string} html
@returns {mixed}
**/
html2value: function(html) {
return $('<div>').html(html).text();
},
/**
Converts value to string (for internal compare). For submitting to server used value2submit().
@method value2str(value)
@param {mixed} value
@returns {string}
**/
value2str: function(value) {
return value;
},
/**
Converts string received from server into value. Usually from `data-value` attribute.
@method str2value(str)
@param {string} str
@returns {mixed}
**/
str2value: function(str) {
return str;
},
/**
Converts value for submitting to server. Result can be string or object.
@method value2submit(value)
@param {mixed} value
@returns {mixed}
**/
value2submit: function(value) {
return value;
},
/**
Sets value of input.
@method value2input(value)
@param {mixed} value
**/
value2input: function(value) {
this.$input.val(value);
},
/**
Returns value of input. Value can be object (e.g. datepicker)
@method input2value()
**/
input2value: function() {
return this.$input.val();
},
/**
Activates input. For text it sets focus.
@method activate()
**/
activate: function() {
if(this.$input.is(':visible')) {
this.$input.focus();
}
},
/**
Creates input.
@method clear()
**/
clear: function() {
this.$input.val(null);
},
/**
method to escape html.
**/
escape: function(str) {
return $('<div>').text(str).html();
},
/**
attach handler to automatically submit form when value changed (useful when buttons not shown)
**/
autosubmit: function() {
},
/**
Additional actions when destroying element
**/
destroy: function() {
},
// -------- helper functions --------
setClass: function() {
if(this.options.inputclass) {
this.$input.addClass(this.options.inputclass);
}
},
setAttr: function(attr) {
if (this.options[attr] !== undefined && this.options[attr] !== null) {
this.$input.attr(attr, this.options[attr]);
}
},
option: function(key, value) {
this.options[key] = value;
}
};
AbstractInput.defaults = {
/**
HTML template of input. Normally you should not change it.
@property tpl
@type string
@default ''
**/
tpl: '',
/**
CSS class automatically applied to input
@property inputclass
@type string
@default input-medium
**/
inputclass: 'input-medium',
//scope for external methods (e.g. source defined as function)
//for internal use only
scope: null,
//need to re-declare showbuttons here to get it's value from common config (passed only options existing in defaults)
showbuttons: true
};
$.extend($.fn.editabletypes, {abstractinput: AbstractInput});
}(window.jQuery));
/**
List - abstract class for inputs that have source option loaded from js array or via ajax
@class list
@extends abstractinput
**/
(function ($) {
"use strict";
var List = function (options) {
};
$.fn.editableutils.inherit(List, $.fn.editabletypes.abstractinput);
$.extend(List.prototype, {
render: function () {
var deferred = $.Deferred();
this.error = null;
this.onSourceReady(function () {
this.renderList();
deferred.resolve();
}, function () {
this.error = this.options.sourceError;
deferred.resolve();
});
return deferred.promise();
},
html2value: function (html) {
return null; //can't set value by text
},
value2html: function (value, element, display, response) {
var deferred = $.Deferred(),
success = function () {
if(typeof display === 'function') {
//custom display method
display.call(element, value, this.sourceData, response);
} else {
this.value2htmlFinal(value, element);
}
deferred.resolve();
};
//for null value just call success without loading source
if(value === null) {
success.call(this);
} else {
this.onSourceReady(success, function () { deferred.resolve(); });
}
return deferred.promise();
},
// ------------- additional functions ------------
onSourceReady: function (success, error) {
//run source if it function
var source;
if ($.isFunction(this.options.source)) {
source = this.options.source.call(this.options.scope);
this.sourceData = null;
//note: if function returns the same source as URL - sourceData will be taken from cahce and no extra request performed
} else {
source = this.options.source;
}
//if allready loaded just call success
if(this.options.sourceCache && $.isArray(this.sourceData)) {
success.call(this);
return;
}
//try parse json in single quotes (for double quotes jquery does automatically)
try {
source = $.fn.editableutils.tryParseJson(source, false);
} catch (e) {
error.call(this);
return;
}
//loading from url
if (typeof source === 'string') {
//try to get sourceData from cache
if(this.options.sourceCache) {
var cacheID = source,
cache;
if (!$(document).data(cacheID)) {
$(document).data(cacheID, {});
}
cache = $(document).data(cacheID);
//check for cached data
if (cache.loading === false && cache.sourceData) { //take source from cache
this.sourceData = cache.sourceData;
this.doPrepend();
success.call(this);
return;
} else if (cache.loading === true) { //cache is loading, put callback in stack to be called later
cache.callbacks.push($.proxy(function () {
this.sourceData = cache.sourceData;
this.doPrepend();
success.call(this);
}, this));
//also collecting error callbacks
cache.err_callbacks.push($.proxy(error, this));
return;
} else { //no cache yet, activate it
cache.loading = true;
cache.callbacks = [];
cache.err_callbacks = [];
}
}
//loading sourceData from server
$.ajax({
url: source,
type: 'get',
cache: false,
dataType: 'json',
success: $.proxy(function (data) {
if(cache) {
cache.loading = false;
}
this.sourceData = this.makeArray(data);
if($.isArray(this.sourceData)) {
if(cache) {
//store result in cache
cache.sourceData = this.sourceData;
//run success callbacks for other fields waiting for this source
$.each(cache.callbacks, function () { this.call(); });
}
this.doPrepend();
success.call(this);
} else {
error.call(this);
if(cache) {
//run error callbacks for other fields waiting for this source
$.each(cache.err_callbacks, function () { this.call(); });
}
}
}, this),
error: $.proxy(function () {
error.call(this);
if(cache) {
cache.loading = false;
//run error callbacks for other fields
$.each(cache.err_callbacks, function () { this.call(); });
}
}, this)
});
} else { //options as json/array
this.sourceData = this.makeArray(source);
if($.isArray(this.sourceData)) {
this.doPrepend();
success.call(this);
} else {
error.call(this);
}
}
},
doPrepend: function () {
if(this.options.prepend === null || this.options.prepend === undefined) {
return;
}
if(!$.isArray(this.prependData)) {
//run prepend if it is function (once)
if ($.isFunction(this.options.prepend)) {
this.options.prepend = this.options.prepend.call(this.options.scope);
}
//try parse json in single quotes
this.options.prepend = $.fn.editableutils.tryParseJson(this.options.prepend, true);
//convert prepend from string to object
if (typeof this.options.prepend === 'string') {
this.options.prepend = {'': this.options.prepend};
}
this.prependData = this.makeArray(this.options.prepend);
}
if($.isArray(this.prependData) && $.isArray(this.sourceData)) {
this.sourceData = this.prependData.concat(this.sourceData);
}
},
/*
renders input list
*/
renderList: function() {
// this method should be overwritten in child class
},
/*
set element's html by value
*/
value2htmlFinal: function(value, element) {
// this method should be overwritten in child class
},
/**
* convert data to array suitable for sourceData, e.g. [{value: 1, text: 'abc'}, {...}]
*/
makeArray: function(data) {
var count, obj, result = [], item, iterateItem;
if(!data || typeof data === 'string') {
return null;
}
if($.isArray(data)) { //array
/*
function to iterate inside item of array if item is object.
Caclulates count of keys in item and store in obj.
*/
iterateItem = function (k, v) {
obj = {value: k, text: v};
if(count++ >= 2) {
return false;// exit from `each` if item has more than one key.
}
};
for(var i = 0; i < data.length; i++) {
item = data[i];
if(typeof item === 'object') {
count = 0; //count of keys inside item
$.each(item, iterateItem);
//case: [{val1: 'text1'}, {val2: 'text2} ...]
if(count === 1) {
result.push(obj);
//case: [{value: 1, text: 'text1'}, {value: 2, text: 'text2'}, ...]
} else if(count > 1) {
//removed check of existance: item.hasOwnProperty('value') && item.hasOwnProperty('text')
if(item.children) {
item.children = this.makeArray(item.children);
}
result.push(item);
}
} else {
//case: ['text1', 'text2' ...]
result.push({value: item, text: item});
}
}
} else { //case: {val1: 'text1', val2: 'text2, ...}
$.each(data, function (k, v) {
result.push({value: k, text: v});
});
}
return result;
},
option: function(key, value) {
this.options[key] = value;
if(key === 'source') {
this.sourceData = null;
}
if(key === 'prepend') {
this.prependData = null;
}
}
});
List.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
Source data for list.
If **array** - it should be in format: `[{value: 1, text: "text1"}, {value: 2, text: "text2"}, ...]`
For compability, object format is also supported: `{"1": "text1", "2": "text2" ...}` but it does not guarantee elements order.
If **string** - considered ajax url to load items. In that case results will be cached for fields with the same source and name. See also `sourceCache` option.
If **function**, it should return data in format above (since 1.4.0).
Since 1.4.1 key `children` supported to render OPTGROUP (for **select** input only).
`[{text: "group1", children: [{value: 1, text: "text1"}, {value: 2, text: "text2"}]}, ...]`
@property source
@type string | array | object | function
@default null
**/
source: null,
/**
Data automatically prepended to the beginning of dropdown list.
@property prepend
@type string | array | object | function
@default false
**/
prepend: false,
/**
Error message when list cannot be loaded (e.g. ajax error)
@property sourceError
@type string
@default Error when loading list
**/
sourceError: 'Error when loading list',
/**
if <code>true</code> and source is **string url** - results will be cached for fields with the same source.
Usefull for editable column in grid to prevent extra requests.
@property sourceCache
@type boolean
@default true
@since 1.2.0
**/
sourceCache: true
});
$.fn.editabletypes.list = List;
}(window.jQuery));
/**
Text input
@class text
@extends abstractinput
@final
@example
<a href="#" id="username" data-type="text" data-pk="1">awesome</a>
<script>
$(function(){
$('#username').editable({
url: '/post',
title: 'Enter username'
});
});
</script>
**/
(function ($) {
"use strict";
var Text = function (options) {
this.init('text', options, Text.defaults);
};
$.fn.editableutils.inherit(Text, $.fn.editabletypes.abstractinput);
$.extend(Text.prototype, {
render: function() {
this.renderClear();
this.setClass();
this.setAttr('placeholder');
},
activate: function() {
if(this.$input.is(':visible')) {
this.$input.focus();
$.fn.editableutils.setCursorPosition(this.$input.get(0), this.$input.val().length);
if(this.toggleClear) {
this.toggleClear();
}
}
},
//render clear button
renderClear: function() {
if (this.options.clear) {
this.$clear = $('<span class="editable-clear-x"></span>');
this.$input.after(this.$clear)
.css('padding-right', 24)
.keyup($.proxy(function(e) {
//arrows, enter, tab, etc
if(~$.inArray(e.keyCode, [40,38,9,13,27])) {
return;
}
clearTimeout(this.t);
var that = this;
this.t = setTimeout(function() {
that.toggleClear(e);
}, 100);
}, this))
.parent().css('position', 'relative');
this.$clear.click($.proxy(this.clear, this));
}
},
postrender: function() {
/*
//now `clear` is positioned via css
if(this.$clear) {
//can position clear button only here, when form is shown and height can be calculated
// var h = this.$input.outerHeight(true) || 20,
var h = this.$clear.parent().height(),
delta = (h - this.$clear.height()) / 2;
//this.$clear.css({bottom: delta, right: delta});
}
*/
},
//show / hide clear button
toggleClear: function(e) {
if(!this.$clear) {
return;
}
var len = this.$input.val().length,
visible = this.$clear.is(':visible');
if(len && !visible) {
this.$clear.show();
}
if(!len && visible) {
this.$clear.hide();
}
},
clear: function() {
this.$clear.hide();
this.$input.val('').focus();
}
});
Text.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
@property tpl
@default <input type="text">
**/
tpl: '<input type="text">',
/**
Placeholder attribute of input. Shown when input is empty.
@property placeholder
@type string
@default null
**/
placeholder: null,
/**
Whether to show `clear` button
@property clear
@type boolean
@default true
**/
clear: true
});
$.fn.editabletypes.text = Text;
}(window.jQuery));
/**
Textarea input
@class textarea
@extends abstractinput
@final
@example
<a href="#" id="comments" data-type="textarea" data-pk="1">awesome comment!</a>
<script>
$(function(){
$('#comments').editable({
url: '/post',
title: 'Enter comments',
rows: 10
});
});
</script>
**/
(function ($) {
"use strict";
var Textarea = function (options) {
this.init('textarea', options, Textarea.defaults);
};
$.fn.editableutils.inherit(Textarea, $.fn.editabletypes.abstractinput);
$.extend(Textarea.prototype, {
render: function () {
this.setClass();
this.setAttr('placeholder');
this.setAttr('rows');
//ctrl + enter
this.$input.keydown(function (e) {
if (e.ctrlKey && e.which === 13) {
$(this).closest('form').submit();
}
});
},
value2html: function(value, element) {
var html = '', lines;
if(value) {
lines = value.split("\n");
for (var i = 0; i < lines.length; i++) {
lines[i] = $('<div>').text(lines[i]).html();
}
html = lines.join('<br>');
}
$(element).html(html);
},
html2value: function(html) {
if(!html) {
return '';
}
var regex = new RegExp(String.fromCharCode(10), 'g');
var lines = html.split(/<br\s*\/?>/i);
for (var i = 0; i < lines.length; i++) {
var text = $('<div>').html(lines[i]).text();
// Remove newline characters (\n) to avoid them being converted by value2html() method
// thus adding extra <br> tags
text = text.replace(regex, '');
lines[i] = text;
}
return lines.join("\n");
},
activate: function() {
$.fn.editabletypes.text.prototype.activate.call(this);
}
});
Textarea.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
@property tpl
@default <textarea></textarea>
**/
tpl:'<textarea></textarea>',
/**
@property inputclass
@default input-large
**/
inputclass: 'input-large',
/**
Placeholder attribute of input. Shown when input is empty.
@property placeholder
@type string
@default null
**/
placeholder: null,
/**
Number of rows in textarea
@property rows
@type integer
@default 7
**/
rows: 7
});
$.fn.editabletypes.textarea = Textarea;
}(window.jQuery));
/**
Select (dropdown)
@class select
@extends list
@final
@example
<a href="#" id="status" data-type="select" data-pk="1" data-url="/post" data-original-title="Select status"></a>
<script>
$(function(){
$('#status').editable({
value: 2,
source: [
{value: 1, text: 'Active'},
{value: 2, text: 'Blocked'},
{value: 3, text: 'Deleted'}
]
});
});
</script>
**/
(function ($) {
"use strict";
var Select = function (options) {
this.init('select', options, Select.defaults);
};
$.fn.editableutils.inherit(Select, $.fn.editabletypes.list);
$.extend(Select.prototype, {
renderList: function() {
this.$input.empty();
var fillItems = function($el, data) {
if($.isArray(data)) {
for(var i=0; i<data.length; i++) {
if(data[i].children) {
$el.append(fillItems($('<optgroup>', {label: data[i].text}), data[i].children));
} else {
$el.append($('<option>', {value: data[i].value}).text(data[i].text));
}
}
}
return $el;
};
fillItems(this.$input, this.sourceData);
this.setClass();
//enter submit
this.$input.on('keydown.editable', function (e) {
if (e.which === 13) {
$(this).closest('form').submit();
}
});
},
value2htmlFinal: function(value, element) {
var text = '',
items = $.fn.editableutils.itemsByValue(value, this.sourceData);
if(items.length) {
text = items[0].text;
}
$(element).text(text);
},
autosubmit: function() {
this.$input.off('keydown.editable').on('change.editable', function(){
$(this).closest('form').submit();
});
}
});
Select.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
/**
@property tpl
@default <select></select>
**/
tpl:'<select></select>'
});
$.fn.editabletypes.select = Select;
}(window.jQuery));
/**
List of checkboxes.
Internally value stored as javascript array of values.
@class checklist
@extends list
@final
@example
<a href="#" id="options" data-type="checklist" data-pk="1" data-url="/post" data-original-title="Select options"></a>
<script>
$(function(){
$('#options').editable({
value: [2, 3],
source: [
{value: 1, text: 'option1'},
{value: 2, text: 'option2'},
{value: 3, text: 'option3'}
]
});
});
</script>
**/
(function ($) {
"use strict";
var Checklist = function (options) {
this.init('checklist', options, Checklist.defaults);
};
$.fn.editableutils.inherit(Checklist, $.fn.editabletypes.list);
$.extend(Checklist.prototype, {
renderList: function() {
var $label, $div;
this.$tpl.empty();
if(!$.isArray(this.sourceData)) {
return;
}
for(var i=0; i<this.sourceData.length; i++) {
$label = $('<label>').append($('<input>', {
type: 'checkbox',
value: this.sourceData[i].value
}))
.append($('<span>').text(' '+this.sourceData[i].text));
$('<div>').append($label).appendTo(this.$tpl);
}
this.$input = this.$tpl.find('input[type="checkbox"]');
this.setClass();
},
value2str: function(value) {
return $.isArray(value) ? value.sort().join($.trim(this.options.separator)) : '';
},
//parse separated string
str2value: function(str) {
var reg, value = null;
if(typeof str === 'string' && str.length) {
reg = new RegExp('\\s*'+$.trim(this.options.separator)+'\\s*');
value = str.split(reg);
} else if($.isArray(str)) {
value = str;
} else {
value = [str];
}
return value;
},
//set checked on required checkboxes
value2input: function(value) {
this.$input.prop('checked', false);
if($.isArray(value) && value.length) {
this.$input.each(function(i, el) {
var $el = $(el);
// cannot use $.inArray as it performs strict comparison
$.each(value, function(j, val){
/*jslint eqeq: true*/
if($el.val() == val) {
/*jslint eqeq: false*/
$el.prop('checked', true);
}
});
});
}
},
input2value: function() {
var checked = [];
this.$input.filter(':checked').each(function(i, el) {
checked.push($(el).val());
});
return checked;
},
//collect text of checked boxes
value2htmlFinal: function(value, element) {
var html = [],
checked = $.fn.editableutils.itemsByValue(value, this.sourceData);
if(checked.length) {
$.each(checked, function(i, v) { html.push($.fn.editableutils.escape(v.text)); });
$(element).html(html.join('<br>'));
} else {
$(element).empty();
}
},
activate: function() {
this.$input.first().focus();
},
autosubmit: function() {
this.$input.on('keydown', function(e){
if (e.which === 13) {
$(this).closest('form').submit();
}
});
}
});
Checklist.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
/**
@property tpl
@default <div></div>
**/
tpl:'<div class="editable-checklist"></div>',
/**
@property inputclass
@type string
@default null
**/
inputclass: null,
/**
Separator of values when reading from `data-value` attribute
@property separator
@type string
@default ','
**/
separator: ','
});
$.fn.editabletypes.checklist = Checklist;
}(window.jQuery));
/**
HTML5 input types.
Following types are supported:
* password
* email
* url
* tel
* number
* range
Learn more about html5 inputs:
http://www.w3.org/wiki/HTML5_form_additions
To check browser compatibility please see:
https://developer.mozilla.org/en-US/docs/HTML/Element/Input
@class html5types
@extends text
@final
@since 1.3.0
@example
<a href="#" id="email" data-type="email" data-pk="1">[email protected]</a>
<script>
$(function(){
$('#email').editable({
url: '/post',
title: 'Enter email'
});
});
</script>
**/
/**
@property tpl
@default depends on type
**/
/*
Password
*/
(function ($) {
"use strict";
var Password = function (options) {
this.init('password', options, Password.defaults);
};
$.fn.editableutils.inherit(Password, $.fn.editabletypes.text);
$.extend(Password.prototype, {
//do not display password, show '[hidden]' instead
value2html: function(value, element) {
if(value) {
$(element).text('[hidden]');
} else {
$(element).empty();
}
},
//as password not displayed, should not set value by html
html2value: function(html) {
return null;
}
});
Password.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
tpl: '<input type="password">'
});
$.fn.editabletypes.password = Password;
}(window.jQuery));
/*
Email
*/
(function ($) {
"use strict";
var Email = function (options) {
this.init('email', options, Email.defaults);
};
$.fn.editableutils.inherit(Email, $.fn.editabletypes.text);
Email.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
tpl: '<input type="email">'
});
$.fn.editabletypes.email = Email;
}(window.jQuery));
/*
Url
*/
(function ($) {
"use strict";
var Url = function (options) {
this.init('url', options, Url.defaults);
};
$.fn.editableutils.inherit(Url, $.fn.editabletypes.text);
Url.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
tpl: '<input type="url">'
});
$.fn.editabletypes.url = Url;
}(window.jQuery));
/*
Tel
*/
(function ($) {
"use strict";
var Tel = function (options) {
this.init('tel', options, Tel.defaults);
};
$.fn.editableutils.inherit(Tel, $.fn.editabletypes.text);
Tel.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
tpl: '<input type="tel">'
});
$.fn.editabletypes.tel = Tel;
}(window.jQuery));
/*
Number
*/
(function ($) {
"use strict";
var NumberInput = function (options) {
this.init('number', options, NumberInput.defaults);
};
$.fn.editableutils.inherit(NumberInput, $.fn.editabletypes.text);
$.extend(NumberInput.prototype, {
render: function () {
NumberInput.superclass.render.call(this);
this.setAttr('min');
this.setAttr('max');
this.setAttr('step');
},
postrender: function() {
if(this.$clear) {
//increase right ffset for up/down arrows
this.$clear.css({right: 24});
/*
//can position clear button only here, when form is shown and height can be calculated
var h = this.$input.outerHeight(true) || 20,
delta = (h - this.$clear.height()) / 2;
//add 12px to offset right for up/down arrows
this.$clear.css({top: delta, right: delta + 16});
*/
}
}
});
NumberInput.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
tpl: '<input type="number">',
inputclass: 'input-mini',
min: null,
max: null,
step: null
});
$.fn.editabletypes.number = NumberInput;
}(window.jQuery));
/*
Range (inherit from number)
*/
(function ($) {
"use strict";
var Range = function (options) {
this.init('range', options, Range.defaults);
};
$.fn.editableutils.inherit(Range, $.fn.editabletypes.number);
$.extend(Range.prototype, {
render: function () {
this.$input = this.$tpl.filter('input');
this.setClass();
this.setAttr('min');
this.setAttr('max');
this.setAttr('step');
this.$input.on('input', function(){
$(this).siblings('output').text($(this).val());
});
},
activate: function() {
this.$input.focus();
}
});
Range.defaults = $.extend({}, $.fn.editabletypes.number.defaults, {
tpl: '<input type="range"><output style="width: 30px; display: inline-block"></output>',
inputclass: 'input-medium'
});
$.fn.editabletypes.range = Range;
}(window.jQuery));
/**
Select2 input. Based on amazing work of Igor Vaynberg https://github.com/ivaynberg/select2.
Please see [original select2 docs](http://ivaynberg.github.com/select2) for detailed description and options.
Compatible **select2 version is 3.4.1**!
You should manually download and include select2 distributive:
<link href="select2/select2.css" rel="stylesheet" type="text/css"></link>
<script src="select2/select2.js"></script>
To make it **bootstrap-styled** you can use css from [here](https://github.com/t0m/select2-bootstrap-css):
<link href="select2-bootstrap.css" rel="stylesheet" type="text/css"></link>
**Note:** currently `autotext` feature does not work for select2 with `ajax` remote source.
You need initially put both `data-value` and element's text youself:
<a href="#" data-type="select2" data-value="1">Text1</a>
@class select2
@extends abstractinput
@since 1.4.1
@final
@example
<a href="#" id="country" data-type="select2" data-pk="1" data-value="ru" data-url="/post" data-title="Select country"></a>
<script>
$(function(){
$('#country').editable({
source: [
{id: 'gb', text: 'Great Britain'},
{id: 'us', text: 'United States'},
{id: 'ru', text: 'Russia'}
],
select2: {
multiple: true
}
});
});
</script>
**/
(function ($) {
"use strict";
var Constructor = function (options) {
this.init('select2', options, Constructor.defaults);
options.select2 = options.select2 || {};
this.sourceData = null;
//placeholder
if(options.placeholder) {
options.select2.placeholder = options.placeholder;
}
//if not `tags` mode, use source
if(!options.select2.tags && options.source) {
var source = options.source;
//if source is function, call it (once!)
if ($.isFunction(options.source)) {
source = options.source.call(options.scope);
}
if (typeof source === 'string') {
options.select2.ajax = options.select2.ajax || {};
//some default ajax params
if(!options.select2.ajax.data) {
options.select2.ajax.data = function(term) {return { query:term };};
}
if(!options.select2.ajax.results) {
options.select2.ajax.results = function(data) { return {results:data };};
}
options.select2.ajax.url = source;
} else {
//check format and convert x-editable format to select2 format (if needed)
this.sourceData = this.convertSource(source);
options.select2.data = this.sourceData;
}
}
//overriding objects in config (as by default jQuery extend() is not recursive)
this.options.select2 = $.extend({}, Constructor.defaults.select2, options.select2);
//detect whether it is multi-valued
this.isMultiple = this.options.select2.tags || this.options.select2.multiple;
this.isRemote = ('ajax' in this.options.select2);
};
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
$.extend(Constructor.prototype, {
render: function() {
this.setClass();
//apply select2
this.$input.select2(this.options.select2);
//when data is loaded via ajax, we need to know when it's done to populate listData
if(this.isRemote) {
//listen to loaded event to populate data
this.$input.on('select2-loaded', $.proxy(function(e) {
this.sourceData = e.items.results;
}, this));
}
//trigger resize of editableform to re-position container in multi-valued mode
if(this.isMultiple) {
this.$input.on('change', function() {
$(this).closest('form').parent().triggerHandler('resize');
});
}
},
value2html: function(value, element) {
var text = '', data;
if(this.options.select2.tags) { //in tags mode just assign value
data = value;
} else if(this.sourceData) {
data = $.fn.editableutils.itemsByValue(value, this.sourceData, 'id');
} else {
//can not get list of possible values (e.g. autotext for select2 with ajax source)
}
//data may be array (when multiple values allowed)
if($.isArray(data)) {
//collect selected data and show with separator
text = [];
$.each(data, function(k, v){
text.push(v && typeof v === 'object' ? v.text : v);
});
} else if(data) {
text = data.text;
}
text = $.isArray(text) ? text.join(this.options.viewseparator) : text;
$(element).text(text);
},
html2value: function(html) {
return this.options.select2.tags ? this.str2value(html, this.options.viewseparator) : null;
},
value2input: function(value) {
//for remote source .val() is not working, need to look in sourceData
if(this.isRemote) {
//todo: check value for array
var item, items;
//if sourceData loaded, use it to get text for display
if(this.sourceData) {
items = $.fn.editableutils.itemsByValue(value, this.sourceData, 'id');
if(items.length) {
item = items[0];
}
}
//if item not found by sourceData, use element text (e.g. for the first show)
if(!item) {
item = {id: value, text: $(this.options.scope).text()};
}
//select2('data', ...) allows to set both id and text --> usefull for initial show when items are not loaded
this.$input.select2('data', item).trigger('change', true); //second argument needed to separate initial change from user's click (for autosubmit)
} else {
this.$input.val(value).trigger('change', true); //second argument needed to separate initial change from user's click (for autosubmit)
}
},
input2value: function() {
return this.$input.select2('val');
},
str2value: function(str, separator) {
if(typeof str !== 'string' || !this.isMultiple) {
return str;
}
separator = separator || this.options.select2.separator || $.fn.select2.defaults.separator;
var val, i, l;
if (str === null || str.length < 1) {
return null;
}
val = str.split(separator);
for (i = 0, l = val.length; i < l; i = i + 1) {
val[i] = $.trim(val[i]);
}
return val;
},
autosubmit: function() {
this.$input.on('change', function(e, isInitial){
if(!isInitial) {
$(this).closest('form').submit();
}
});
},
/*
Converts source from x-editable format: {value: 1, text: "1"} to
select2 format: {id: 1, text: "1"}
*/
convertSource: function(source) {
if($.isArray(source) && source.length && source[0].value !== undefined) {
for(var i = 0; i<source.length; i++) {
if(source[i].value !== undefined) {
source[i].id = source[i].value;
delete source[i].value;
}
}
}
return source;
}
});
Constructor.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
@property tpl
@default <input type="hidden">
**/
tpl:'<input type="hidden">',
/**
Configuration of select2. [Full list of options](http://ivaynberg.github.com/select2).
@property select2
@type object
@default null
**/
select2: null,
/**
Placeholder attribute of select
@property placeholder
@type string
@default null
**/
placeholder: null,
/**
Source data for select. It will be assigned to select2 `data` property and kept here just for convenience.
Please note, that format is different from simple `select` input: use 'id' instead of 'value'.
E.g. `[{id: 1, text: "text1"}, {id: 2, text: "text2"}, ...]`.
@property source
@type array
@default null
**/
source: null,
/**
Separator used to display tags.
@property viewseparator
@type string
@default ', '
**/
viewseparator: ', '
});
$.fn.editabletypes.select2 = Constructor;
}(window.jQuery));
/**
* Combodate - 1.0.4
* Dropdown date and time picker.
* Converts text input into dropdowns to pick day, month, year, hour, minute and second.
* Uses momentjs as datetime library http://momentjs.com.
* For i18n include corresponding file from https://github.com/timrwood/moment/tree/master/lang
*
* Confusion at noon and midnight - see http://en.wikipedia.org/wiki/12-hour_clock#Confusion_at_noon_and_midnight
* In combodate:
* 12:00 pm --> 12:00 (24-h format, midday)
* 12:00 am --> 00:00 (24-h format, midnight, start of day)
*
* Differs from momentjs parse rules:
* 00:00 pm, 12:00 pm --> 12:00 (24-h format, day not change)
* 00:00 am, 12:00 am --> 00:00 (24-h format, day not change)
*
*
* Author: Vitaliy Potapov
* Project page: http://github.com/vitalets/combodate
* Copyright (c) 2012 Vitaliy Potapov. Released under MIT License.
**/
(function ($) {
var Combodate = function (element, options) {
this.$element = $(element);
if(!this.$element.is('input')) {
$.error('Combodate should be applied to INPUT element');
return;
}
this.options = $.extend({}, $.fn.combodate.defaults, options, this.$element.data());
this.init();
};
Combodate.prototype = {
constructor: Combodate,
init: function () {
this.map = {
//key regexp moment.method
day: ['D', 'date'],
month: ['M', 'month'],
year: ['Y', 'year'],
hour: ['[Hh]', 'hours'],
minute: ['m', 'minutes'],
second: ['s', 'seconds'],
ampm: ['[Aa]', '']
};
this.$widget = $('<span class="combodate"></span>').html(this.getTemplate());
this.initCombos();
//update original input on change
this.$widget.on('change', 'select', $.proxy(function(){
this.$element.val(this.getValue());
}, this));
this.$widget.find('select').css('width', 'auto');
//hide original input and insert widget
this.$element.hide().after(this.$widget);
//set initial value
this.setValue(this.$element.val() || this.options.value);
},
/*
Replace tokens in template with <select> elements
*/
getTemplate: function() {
var tpl = this.options.template;
//first pass
$.each(this.map, function(k, v) {
v = v[0];
var r = new RegExp(v+'+'),
token = v.length > 1 ? v.substring(1, 2) : v;
tpl = tpl.replace(r, '{'+token+'}');
});
//replace spaces with
tpl = tpl.replace(/ /g, ' ');
//second pass
$.each(this.map, function(k, v) {
v = v[0];
var token = v.length > 1 ? v.substring(1, 2) : v;
tpl = tpl.replace('{'+token+'}', '<select class="'+k+'"></select>');
});
return tpl;
},
/*
Initialize combos that presents in template
*/
initCombos: function() {
var that = this;
$.each(this.map, function(k, v) {
var $c = that.$widget.find('.'+k), f, items;
if($c.length) {
that['$'+k] = $c; //set properties like this.$day, this.$month etc.
f = 'fill' + k.charAt(0).toUpperCase() + k.slice(1); //define method name to fill items, e.g `fillDays`
items = that[f]();
that['$'+k].html(that.renderItems(items));
}
});
},
/*
Initialize items of combos. Handles `firstItem` option
*/
initItems: function(key) {
var values = [],
relTime;
if(this.options.firstItem === 'name') {
//need both to support moment ver < 2 and >= 2
relTime = moment.relativeTime || moment.langData()._relativeTime;
var header = typeof relTime[key] === 'function' ? relTime[key](1, true, key, false) : relTime[key];
//take last entry (see momentjs lang files structure)
header = header.split(' ').reverse()[0];
values.push(['', header]);
} else if(this.options.firstItem === 'empty') {
values.push(['', '']);
}
return values;
},
/*
render items to string of <option> tags
*/
renderItems: function(items) {
var str = [];
for(var i=0; i<items.length; i++) {
str.push('<option value="'+items[i][0]+'">'+items[i][1]+'</option>');
}
return str.join("\n");
},
/*
fill day
*/
fillDay: function() {
var items = this.initItems('d'), name, i,
twoDigit = this.options.template.indexOf('DD') !== -1;
for(i=1; i<=31; i++) {
name = twoDigit ? this.leadZero(i) : i;
items.push([i, name]);
}
return items;
},
/*
fill month
*/
fillMonth: function() {
var items = this.initItems('M'), name, i,
longNames = this.options.template.indexOf('MMMM') !== -1,
shortNames = this.options.template.indexOf('MMM') !== -1,
twoDigit = this.options.template.indexOf('MM') !== -1;
for(i=0; i<=11; i++) {
if(longNames) {
//see https://github.com/timrwood/momentjs.com/pull/36
name = moment().date(1).month(i).format('MMMM');
} else if(shortNames) {
name = moment().date(1).month(i).format('MMM');
} else if(twoDigit) {
name = this.leadZero(i+1);
} else {
name = i+1;
}
items.push([i, name]);
}
return items;
},
/*
fill year
*/
fillYear: function() {
var items = [], name, i,
longNames = this.options.template.indexOf('YYYY') !== -1;
for(i=this.options.maxYear; i>=this.options.minYear; i--) {
name = longNames ? i : (i+'').substring(2);
items[this.options.yearDescending ? 'push' : 'unshift']([i, name]);
}
items = this.initItems('y').concat(items);
return items;
},
/*
fill hour
*/
fillHour: function() {
var items = this.initItems('h'), name, i,
h12 = this.options.template.indexOf('h') !== -1,
h24 = this.options.template.indexOf('H') !== -1,
twoDigit = this.options.template.toLowerCase().indexOf('hh') !== -1,
min = h12 ? 1 : 0,
max = h12 ? 12 : 23;
for(i=min; i<=max; i++) {
name = twoDigit ? this.leadZero(i) : i;
items.push([i, name]);
}
return items;
},
/*
fill minute
*/
fillMinute: function() {
var items = this.initItems('m'), name, i,
twoDigit = this.options.template.indexOf('mm') !== -1;
for(i=0; i<=59; i+= this.options.minuteStep) {
name = twoDigit ? this.leadZero(i) : i;
items.push([i, name]);
}
return items;
},
/*
fill second
*/
fillSecond: function() {
var items = this.initItems('s'), name, i,
twoDigit = this.options.template.indexOf('ss') !== -1;
for(i=0; i<=59; i+= this.options.secondStep) {
name = twoDigit ? this.leadZero(i) : i;
items.push([i, name]);
}
return items;
},
/*
fill ampm
*/
fillAmpm: function() {
var ampmL = this.options.template.indexOf('a') !== -1,
ampmU = this.options.template.indexOf('A') !== -1,
items = [
['am', ampmL ? 'am' : 'AM'],
['pm', ampmL ? 'pm' : 'PM']
];
return items;
},
/*
Returns current date value from combos.
If format not specified - `options.format` used.
If format = `null` - Moment object returned.
*/
getValue: function(format) {
var dt, values = {},
that = this,
notSelected = false;
//getting selected values
$.each(this.map, function(k, v) {
if(k === 'ampm') {
return;
}
var def = k === 'day' ? 1 : 0;
values[k] = that['$'+k] ? parseInt(that['$'+k].val(), 10) : def;
if(isNaN(values[k])) {
notSelected = true;
return false;
}
});
//if at least one visible combo not selected - return empty string
if(notSelected) {
return '';
}
//convert hours 12h --> 24h
if(this.$ampm) {
//12:00 pm --> 12:00 (24-h format, midday), 12:00 am --> 00:00 (24-h format, midnight, start of day)
if(values.hour === 12) {
values.hour = this.$ampm.val() === 'am' ? 0 : 12;
} else {
values.hour = this.$ampm.val() === 'am' ? values.hour : values.hour+12;
}
}
dt = moment([values.year, values.month, values.day, values.hour, values.minute, values.second]);
//highlight invalid date
this.highlight(dt);
format = format === undefined ? this.options.format : format;
if(format === null) {
return dt.isValid() ? dt : null;
} else {
return dt.isValid() ? dt.format(format) : '';
}
},
setValue: function(value) {
if(!value) {
return;
}
var dt = typeof value === 'string' ? moment(value, this.options.format) : moment(value),
that = this,
values = {};
//function to find nearest value in select options
function getNearest($select, value) {
var delta = {};
$select.children('option').each(function(i, opt){
var optValue = $(opt).attr('value'),
distance;
if(optValue === '') return;
distance = Math.abs(optValue - value);
if(typeof delta.distance === 'undefined' || distance < delta.distance) {
delta = {value: optValue, distance: distance};
}
});
return delta.value;
}
if(dt.isValid()) {
//read values from date object
$.each(this.map, function(k, v) {
if(k === 'ampm') {
return;
}
values[k] = dt[v[1]]();
});
if(this.$ampm) {
//12:00 pm --> 12:00 (24-h format, midday), 12:00 am --> 00:00 (24-h format, midnight, start of day)
if(values.hour >= 12) {
values.ampm = 'pm';
if(values.hour > 12) {
values.hour -= 12;
}
} else {
values.ampm = 'am';
if(values.hour === 0) {
values.hour = 12;
}
}
}
$.each(values, function(k, v) {
//call val() for each existing combo, e.g. this.$hour.val()
if(that['$'+k]) {
if(k === 'minute' && that.options.minuteStep > 1 && that.options.roundTime) {
v = getNearest(that['$'+k], v);
}
if(k === 'second' && that.options.secondStep > 1 && that.options.roundTime) {
v = getNearest(that['$'+k], v);
}
that['$'+k].val(v);
}
});
this.$element.val(dt.format(this.options.format));
}
},
/*
highlight combos if date is invalid
*/
highlight: function(dt) {
if(!dt.isValid()) {
if(this.options.errorClass) {
this.$widget.addClass(this.options.errorClass);
} else {
//store original border color
if(!this.borderColor) {
this.borderColor = this.$widget.find('select').css('border-color');
}
this.$widget.find('select').css('border-color', 'red');
}
} else {
if(this.options.errorClass) {
this.$widget.removeClass(this.options.errorClass);
} else {
this.$widget.find('select').css('border-color', this.borderColor);
}
}
},
leadZero: function(v) {
return v <= 9 ? '0' + v : v;
},
destroy: function() {
this.$widget.remove();
this.$element.removeData('combodate').show();
}
//todo: clear method
};
$.fn.combodate = function ( option ) {
var d, args = Array.apply(null, arguments);
args.shift();
//getValue returns date as string / object (not jQuery object)
if(option === 'getValue' && this.length && (d = this.eq(0).data('combodate'))) {
return d.getValue.apply(d, args);
}
return this.each(function () {
var $this = $(this),
data = $this.data('combodate'),
options = typeof option == 'object' && option;
if (!data) {
$this.data('combodate', (data = new Combodate(this, options)));
}
if (typeof option == 'string' && typeof data[option] == 'function') {
data[option].apply(data, args);
}
});
};
$.fn.combodate.defaults = {
//in this format value stored in original input
format: 'DD-MM-YYYY HH:mm',
//in this format items in dropdowns are displayed
template: 'D / MMM / YYYY H : mm',
//initial value, can be `new Date()`
value: null,
minYear: 1970,
maxYear: 2015,
yearDescending: true,
minuteStep: 5,
secondStep: 1,
firstItem: 'empty', //'name', 'empty', 'none'
errorClass: null,
roundTime: true //whether to round minutes and seconds if step > 1
};
}(window.jQuery));
/**
Combodate input - dropdown date and time picker.
Based on [combodate](http://vitalets.github.com/combodate) plugin (included). To use it you should manually include [momentjs](http://momentjs.com).
<script src="js/moment.min.js"></script>
Allows to input:
* only date
* only time
* both date and time
Please note, that format is taken from momentjs and **not compatible** with bootstrap-datepicker / jquery UI datepicker.
Internally value stored as `momentjs` object.
@class combodate
@extends abstractinput
@final
@since 1.4.0
@example
<a href="#" id="dob" data-type="combodate" data-pk="1" data-url="/post" data-value="1984-05-15" data-original-title="Select date"></a>
<script>
$(function(){
$('#dob').editable({
format: 'YYYY-MM-DD',
viewformat: 'DD.MM.YYYY',
template: 'D / MMMM / YYYY',
combodate: {
minYear: 2000,
maxYear: 2015,
minuteStep: 1
}
}
});
});
</script>
**/
/*global moment*/
(function ($) {
"use strict";
var Constructor = function (options) {
this.init('combodate', options, Constructor.defaults);
//by default viewformat equals to format
if(!this.options.viewformat) {
this.options.viewformat = this.options.format;
}
//try parse combodate config defined as json string in data-combodate
options.combodate = $.fn.editableutils.tryParseJson(options.combodate, true);
//overriding combodate config (as by default jQuery extend() is not recursive)
this.options.combodate = $.extend({}, Constructor.defaults.combodate, options.combodate, {
format: this.options.format,
template: this.options.template
});
};
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
$.extend(Constructor.prototype, {
render: function () {
this.$input.combodate(this.options.combodate);
//"clear" link
/*
if(this.options.clear) {
this.$clear = $('<a href="#"></a>').html(this.options.clear).click($.proxy(function(e){
e.preventDefault();
e.stopPropagation();
this.clear();
}, this));
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
}
*/
},
value2html: function(value, element) {
var text = value ? value.format(this.options.viewformat) : '';
$(element).text(text);
},
html2value: function(html) {
return html ? moment(html, this.options.viewformat) : null;
},
value2str: function(value) {
return value ? value.format(this.options.format) : '';
},
str2value: function(str) {
return str ? moment(str, this.options.format) : null;
},
value2submit: function(value) {
return this.value2str(value);
},
value2input: function(value) {
this.$input.combodate('setValue', value);
},
input2value: function() {
return this.$input.combodate('getValue', null);
},
activate: function() {
this.$input.siblings('.combodate').find('select').eq(0).focus();
},
/*
clear: function() {
this.$input.data('datepicker').date = null;
this.$input.find('.active').removeClass('active');
},
*/
autosubmit: function() {
}
});
Constructor.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
@property tpl
@default <input type="text">
**/
tpl:'<input type="text">',
/**
@property inputclass
@default null
**/
inputclass: null,
/**
Format used for sending value to server. Also applied when converting date from <code>data-value</code> attribute.<br>
See list of tokens in [momentjs docs](http://momentjs.com/docs/#/parsing/string-format)
@property format
@type string
@default YYYY-MM-DD
**/
format:'YYYY-MM-DD',
/**
Format used for displaying date. Also applied when converting date from element's text on init.
If not specified equals to `format`.
@property viewformat
@type string
@default null
**/
viewformat: null,
/**
Template used for displaying dropdowns.
@property template
@type string
@default D / MMM / YYYY
**/
template: 'D / MMM / YYYY',
/**
Configuration of combodate.
Full list of options: http://vitalets.github.com/combodate/#docs
@property combodate
@type object
@default null
**/
combodate: null
/*
(not implemented yet)
Text shown as clear date button.
If <code>false</code> clear button will not be rendered.
@property clear
@type boolean|string
@default 'x clear'
*/
//clear: '× clear'
});
$.fn.editabletypes.combodate = Constructor;
}(window.jQuery));
/**
* Editable Poshytip
* ---------------------
* requires jquery.poshytip.js
*/
(function ($) {
"use strict";
//extend methods
$.extend($.fn.editableContainer.Popup.prototype, {
containerName: 'poshytip',
innerCss: 'div.tip-inner',
initContainer: function(){
this.handlePlacement();
$.extend(this.containerOptions, {
showOn: 'none',
content: '',
alignTo: 'target'
});
this.call(this.containerOptions);
},
/*
Overwrite totally show() method as poshytip requires content is set before show
*/
show: function (closeAll) {
this.$element.addClass('editable-open');
if(closeAll !== false) {
//close all open containers (except this)
this.closeOthers(this.$element[0]);
}
//render form
this.$form = $('<div>');
this.renderForm();
var $label = $('<label>').text(this.options.title || this.$element.data( "title") || this.$element.data( "originalTitle")),
$content = $('<div>').append($label).append(this.$form);
this.call('update', $content);
this.call('show');
this.tip().addClass(this.containerClass);
this.$form.data('editableform').input.activate();
},
/* hide */
innerHide: function () {
this.call('hide');
},
/* destroy */
innerDestroy: function() {
this.call('destroy');
},
setPosition: function() {
this.container().refresh(false);
},
handlePlacement: function() {
var x, y, ox = 0, oy = 0;
switch(this.options.placement) {
case 'top':
x = 'center';
y = 'top';
oy = 5;
break;
case 'right':
x = 'right';
y = 'center';
ox = 10;
break;
case 'bottom':
x = 'center';
y = 'bottom';
oy = 5;
break;
case 'left':
x = 'left';
y = 'center';
ox = 10;
break;
}
$.extend(this.containerOptions, {
alignX: x,
offsetX: ox,
alignY: y,
offsetY:oy
});
}
});
//defaults
$.fn.editableContainer.defaults = $.extend({}, $.fn.editableContainer.defaults, {
className: 'tip-yellowsimple'
});
/**
* Poshytip fix: disable incorrect table display
* see https://github.com/vadikom/poshytip/issues/7
*/
/*jshint eqeqeq:false, curly: false*/
if($.Poshytip) { //need this check, because in inline mode poshytip may not be loaded!
var tips = [],
reBgImage = /^url\(["']?([^"'\)]*)["']?\);?$/i,
rePNG = /\.png$/i,
ie6 = !!window.createPopup && document.documentElement.currentStyle.minWidth == 'undefined';
$.Poshytip.prototype.refresh = function(async) {
if (this.disabled)
return;
var currPos;
if (async) {
if (!this.$tip.data('active'))
return;
// save current position as we will need to animate
currPos = {left: this.$tip.css('left'), top: this.$tip.css('top')};
}
// reset position to avoid text wrapping, etc.
this.$tip.css({left: 0, top: 0}).appendTo(document.body);
// save default opacity
if (this.opacity === undefined)
this.opacity = this.$tip.css('opacity');
// check for images - this code is here (i.e. executed each time we show the tip and not on init) due to some browser inconsistencies
var bgImage = this.$tip.css('background-image').match(reBgImage),
arrow = this.$arrow.css('background-image').match(reBgImage);
if (bgImage) {
var bgImagePNG = rePNG.test(bgImage[1]);
// fallback to background-color/padding/border in IE6 if a PNG is used
if (ie6 && bgImagePNG) {
this.$tip.css('background-image', 'none');
this.$inner.css({margin: 0, border: 0, padding: 0});
bgImage = bgImagePNG = false;
} else {
this.$tip.prepend('<table class="fallback" border="0" cellpadding="0" cellspacing="0"><tr><td class="tip-top tip-bg-image" colspan="2"><span></span></td><td class="tip-right tip-bg-image" rowspan="2"><span></span></td></tr><tr><td class="tip-left tip-bg-image" rowspan="2"><span></span></td><td></td></tr><tr><td class="tip-bottom tip-bg-image" colspan="2"><span></span></td></tr></table>')
.css({border: 0, padding: 0, 'background-image': 'none', 'background-color': 'transparent'})
.find('.tip-bg-image').css('background-image', 'url("' + bgImage[1] +'")').end()
.find('td').eq(3).append(this.$inner);
}
// disable fade effect in IE due to Alpha filter + translucent PNG issue
if (bgImagePNG && !$.support.opacity)
this.opts.fade = false;
}
// IE arrow fixes
if (arrow && !$.support.opacity) {
// disable arrow in IE6 if using a PNG
if (ie6 && rePNG.test(arrow[1])) {
arrow = false;
this.$arrow.css('background-image', 'none');
}
// disable fade effect in IE due to Alpha filter + translucent PNG issue
this.opts.fade = false;
}
var $table = this.$tip.find('table.fallback');
if (ie6) {
// fix min/max-width in IE6
this.$tip[0].style.width = '';
$table.width('auto').find('td').eq(3).width('auto');
var tipW = this.$tip.width(),
minW = parseInt(this.$tip.css('min-width'), 10),
maxW = parseInt(this.$tip.css('max-width'), 10);
if (!isNaN(minW) && tipW < minW)
tipW = minW;
else if (!isNaN(maxW) && tipW > maxW)
tipW = maxW;
this.$tip.add($table).width(tipW).eq(0).find('td').eq(3).width('100%');
} else if ($table[0]) {
// fix the table width if we are using a background image
// IE9, FF4 use float numbers for width/height so use getComputedStyle for them to avoid text wrapping
// for details look at: http://vadikom.com/dailies/offsetwidth-offsetheight-useless-in-ie9-firefox4/
$table.width('auto').find('td').eq(3).width('auto').end().end().width(document.defaultView && document.defaultView.getComputedStyle && parseFloat(document.defaultView.getComputedStyle(this.$tip[0], null).width) || this.$tip.width()).find('td').eq(3).width('100%');
}
this.tipOuterW = this.$tip.outerWidth();
this.tipOuterH = this.$tip.outerHeight();
this.calcPos();
// position and show the arrow image
if (arrow && this.pos.arrow) {
this.$arrow[0].className = 'tip-arrow tip-arrow-' + this.pos.arrow;
this.$arrow.css('visibility', 'inherit');
}
if (async) {
this.asyncAnimating = true;
var self = this;
this.$tip.css(currPos).animate({left: this.pos.l, top: this.pos.t}, 200, function() { self.asyncAnimating = false; });
} else {
this.$tip.css({left: this.pos.l, top: this.pos.t});
}
};
}
/*jshinteqeqeq: true, curly: true*/
}(window.jQuery));
/**
jQuery UI Datepicker.
Description and examples: http://jqueryui.com/datepicker.
This input is also accessible as **date** type. Do not use it together with __bootstrap-datepicker__ as both apply <code>$().datepicker()</code> method.
For **i18n** you should include js file from here: https://github.com/jquery/jquery-ui/tree/master/ui/i18n.
@class dateui
@extends abstractinput
@final
@example
<a href="#" id="dob" data-type="date" data-pk="1" data-url="/post" data-original-title="Select date">15/05/1984</a>
<script>
$(function(){
$('#dob').editable({
format: 'yyyy-mm-dd',
viewformat: 'dd/mm/yyyy',
datepicker: {
firstDay: 1
}
}
});
});
</script>
**/
(function ($) {
"use strict";
var DateUI = function (options) {
this.init('dateui', options, DateUI.defaults);
this.initPicker(options, DateUI.defaults);
};
$.fn.editableutils.inherit(DateUI, $.fn.editabletypes.abstractinput);
$.extend(DateUI.prototype, {
initPicker: function(options, defaults) {
//by default viewformat equals to format
if(!this.options.viewformat) {
this.options.viewformat = this.options.format;
}
//correct formats: replace yyyy with yy (for compatibility with bootstrap datepicker)
this.options.viewformat = this.options.viewformat.replace('yyyy', 'yy');
this.options.format = this.options.format.replace('yyyy', 'yy');
//overriding datepicker config (as by default jQuery extend() is not recursive)
//since 1.4 datepicker internally uses viewformat instead of format. Format is for submit only
this.options.datepicker = $.extend({}, defaults.datepicker, options.datepicker, {
dateFormat: this.options.viewformat
});
},
render: function () {
this.$input.datepicker(this.options.datepicker);
//"clear" link
if(this.options.clear) {
this.$clear = $('<a href="#"></a>').html(this.options.clear).click($.proxy(function(e){
e.preventDefault();
e.stopPropagation();
this.clear();
}, this));
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
}
},
value2html: function(value, element) {
var text = $.datepicker.formatDate(this.options.viewformat, value);
DateUI.superclass.value2html(text, element);
},
html2value: function(html) {
if(typeof html !== 'string') {
return html;
}
//if string does not match format, UI datepicker throws exception
var d;
try {
d = $.datepicker.parseDate(this.options.viewformat, html);
} catch(e) {}
return d;
},
value2str: function(value) {
return $.datepicker.formatDate(this.options.format, value);
},
str2value: function(str) {
if(typeof str !== 'string') {
return str;
}
//if string does not match format, UI datepicker throws exception
var d;
try {
d = $.datepicker.parseDate(this.options.format, str);
} catch(e) {}
return d;
},
value2submit: function(value) {
return this.value2str(value);
},
value2input: function(value) {
this.$input.datepicker('setDate', value);
},
input2value: function() {
return this.$input.datepicker('getDate');
},
activate: function() {
},
clear: function() {
this.$input.datepicker('setDate', null);
},
autosubmit: function() {
this.$input.on('mouseup', 'table.ui-datepicker-calendar a.ui-state-default', function(e){
var $form = $(this).closest('form');
setTimeout(function() {
$form.submit();
}, 200);
});
}
});
DateUI.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
@property tpl
@default <div></div>
**/
tpl:'<div class="editable-date"></div>',
/**
@property inputclass
@default null
**/
inputclass: null,
/**
Format used for sending value to server. Also applied when converting date from <code>data-value</code> attribute.<br>
Full list of tokens: http://docs.jquery.com/UI/Datepicker/formatDate
@property format
@type string
@default yyyy-mm-dd
**/
format:'yyyy-mm-dd',
/**
Format used for displaying date. Also applied when converting date from element's text on init.
If not specified equals to <code>format</code>
@property viewformat
@type string
@default null
**/
viewformat: null,
/**
Configuration of datepicker.
Full list of options: http://api.jqueryui.com/datepicker
@property datepicker
@type object
@default {
firstDay: 0,
changeYear: true,
changeMonth: true
}
**/
datepicker: {
firstDay: 0,
changeYear: true,
changeMonth: true,
showOtherMonths: true
},
/**
Text shown as clear date button.
If <code>false</code> clear button will not be rendered.
@property clear
@type boolean|string
@default 'x clear'
**/
clear: '× clear'
});
$.fn.editabletypes.dateui = DateUI;
}(window.jQuery));
/**
jQuery UI datefield input - modification for inline mode.
Shows normal <input type="text"> and binds popup datepicker.
Automatically shown in inline mode.
@class dateuifield
@extends dateui
@since 1.4.0
**/
(function ($) {
"use strict";
var DateUIField = function (options) {
this.init('dateuifield', options, DateUIField.defaults);
this.initPicker(options, DateUIField.defaults);
};
$.fn.editableutils.inherit(DateUIField, $.fn.editabletypes.dateui);
$.extend(DateUIField.prototype, {
render: function () {
// this.$input = this.$tpl.find('input');
this.$input.datepicker(this.options.datepicker);
$.fn.editabletypes.text.prototype.renderClear.call(this);
},
value2input: function(value) {
this.$input.val($.datepicker.formatDate(this.options.viewformat, value));
},
input2value: function() {
return this.html2value(this.$input.val());
},
activate: function() {
$.fn.editabletypes.text.prototype.activate.call(this);
},
toggleClear: function() {
$.fn.editabletypes.text.prototype.toggleClear.call(this);
},
autosubmit: function() {
//reset autosubmit to empty
}
});
DateUIField.defaults = $.extend({}, $.fn.editabletypes.dateui.defaults, {
/**
@property tpl
@default <input type="text">
**/
tpl: '<input type="text"/>',
/**
@property inputclass
@default null
**/
inputclass: null,
/* datepicker config */
datepicker: {
showOn: "button",
buttonImage: "http://jqueryui.com/resources/demos/datepicker/images/calendar.gif",
buttonImageOnly: true,
firstDay: 0,
changeYear: true,
changeMonth: true,
showOtherMonths: true
},
/* disable clear link */
clear: false
});
$.fn.editabletypes.dateuifield = DateUIField;
}(window.jQuery)); |
ajax/libs/rxjs/2.3.17/rx.all.compat.js | tmorin/cdnjs | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (undefined) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
var Rx = {
internals: {},
config: {
Promise: root.Promise // Detect if promise exists
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
isScheduler = Rx.helpers.isScheduler = function (x) { return x instanceof Rx.Scheduler; },
identity = Rx.helpers.identity = function (x) { return x; },
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
just = Rx.helpers.just = function (value) { return function () { return value; }; },
defaultNow = Rx.helpers.defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()),
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
not = Rx.helpers.not = function (a) { return !a; },
isFunction = Rx.helpers.isFunction = (function () {
var isFn = function (value) {
return typeof value == 'function' || false;
}
// fallback for older versions of Chrome and Safari
if (isFn(/x/)) {
isFn = function(value) {
return typeof value == 'function' && toString.call(value) == '[object Function]';
};
}
return isFn;
}());
// Errors
var sequenceContainsNoElements = 'Sequence contains no elements.';
var argumentOutOfRange = 'Argument out of range';
var objectDisposed = 'Object has been disposed';
function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
// Shim in iterator support
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
'_es6shim_iterator_';
// Bug for mozilla version
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
$iterator$ = '@@iterator';
}
var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined };
var isIterable = Rx.helpers.isIterable = function (o) {
return o[$iterator$] !== undefined;
}
var isArrayLike = Rx.helpers.isArrayLike = function (o) {
return o && o.length !== undefined;
}
Rx.helpers.iterator = $iterator$;
var deprecate = Rx.helpers.deprecate = function (name, alternative) {
if (typeof console !== "undefined" && typeof console.warn === "function") {
console.warn(name + ' is deprecated, use ' + alternative + ' instead.', new Error('').stack);
}
}
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
errorClass = '[object Error]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
var toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
suportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
suportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch (e) {
suportNodeClass = true;
}
var shadowedProps = [
'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'
];
var nonEnumProps = {};
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
nonEnumProps[objectClass] = { 'constructor': true };
var support = {};
(function () {
var ctor = function() { this.x = 1; },
props = [];
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var key in new ctor) { props.push(key); }
for (key in arguments) { }
// Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
// Detect if `prototype` properties are enumerable by default.
support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
// Detect if `arguments` object indexes are non-enumerable
support.nonEnumArgs = key != 0;
// Detect if properties shadowing those on `Object.prototype` are non-enumerable.
support.nonEnumShadows = !/valueOf/.test(props);
}(1));
function isObject(value) {
// check if the value is the ECMAScript language type of Object
// http://es5.github.io/#x8
// and avoid a V8 bug
// https://code.google.com/p/v8/issues/detail?id=2291
var type = typeof value;
return value && (type == 'function' || type == 'object') || false;
}
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
}
if (support.nonEnumArgs && object.length && isArguments(object)) {
object = slice.call(object);
}
var skipProto = support.enumPrototypes && typeof object == 'function',
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name'))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var ctor = object.constructor,
index = -1,
length = shadowedProps.length;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
nonEnum = nonEnumProps[className];
}
while (++index < length) {
key = shadowedProps[index];
if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
result.push(key);
}
}
}
return result;
}
function internalFor(object, callback, keysFunc) {
var index = -1,
props = keysFunc(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
}
function internalForIn(object, callback) {
return internalFor(object, callback, keysIn);
}
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
function isArguments(value) {
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
}
// fallback for browsers that can't detect `arguments` objects by [[Class]]
if (!supportsArgsClass) {
isArguments = function(value) {
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
};
}
var isEqual = Rx.internals.isEqual = function (x, y) {
return deepEquals(x, y, [], []);
};
/** @private
* Used for deep comparison
**/
function deepEquals(a, b, stackA, stackB) {
// exit early for identical values
if (a === b) {
// treat `+0` vs. `-0` as not equal
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
// exit early for unlike primitive values
if (a === a && (a == null || b == null ||
(type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) {
return false;
}
// compare [[Class]] names
var className = toString.call(a),
otherClass = toString.call(b);
if (className == argsClass) {
className = objectClass;
}
if (otherClass == argsClass) {
otherClass = objectClass;
}
if (className != otherClass) {
return false;
}
switch (className) {
case boolClass:
case dateClass:
// coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
return +a == +b;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (a != +a) ?
b != +b :
// but treat `-0` vs. `+0` as not equal
(a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass:
case stringClass:
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and their corresponding object instances as equal
return a == String(b);
}
var isArr = className == arrayClass;
if (!isArr) {
// exit for functions and DOM nodes
if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
return false;
}
// in older versions of Opera, `arguments` objects have `Array` constructors
var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
// non `Object` object instances with different constructors are not equal
if (ctorA != ctorB &&
!(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) &&
!(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
('constructor' in a && 'constructor' in b)
) {
return false;
}
}
// assume cyclic structures are equal
// the algorithm for detecting cyclic structures is adapted from ES 5.1
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
var initedStack = !stackA;
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == a) {
return stackB[length] == b;
}
}
var size = 0;
var result = true;
// add `a` and `b` to the stack of traversed objects
stackA.push(a);
stackB.push(b);
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
// compare lengths to determine if a deep comparison is necessary
length = a.length;
size = b.length;
result = size == length;
if (result) {
// deep compare the contents, ignoring non-numeric properties
while (size--) {
var index = length,
value = b[size];
if (!(result = deepEquals(a[size], value, stackA, stackB))) {
break;
}
}
}
}
else {
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
// which, in this case, is more costly
internalForIn(b, function(value, key, b) {
if (hasOwnProperty.call(b, key)) {
// count the number of properties.
size++;
// deep compare each property value.
return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB));
}
});
if (result) {
// ensure both objects have the same number of properties
internalForIn(a, function(value, key, a) {
if (hasOwnProperty.call(a, key)) {
// `size` will be `-1` if `a` has more properties than `b`
return (result = --size > -1);
}
});
}
}
stackA.pop();
stackB.pop();
return result;
}
var slice = Array.prototype.slice;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
var hasProp = {}.hasOwnProperty;
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
var addProperties = Rx.internals.addProperties = function (obj) {
var sources = slice.call(arguments, 1);
for (var i = 0, len = sources.length; i < len; i++) {
var source = sources[i];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
// Utilities
if (!Function.prototype.bind) {
Function.prototype.bind = function (that) {
var target = this,
args = slice.call(arguments, 1);
var bound = function () {
if (this instanceof bound) {
function F() { }
F.prototype = target.prototype;
var self = new F();
var result = target.apply(self, args.concat(slice.call(arguments)));
if (Object(result) === result) {
return result;
}
return self;
} else {
return target.apply(that, args.concat(slice.call(arguments)));
}
};
return bound;
};
}
if (!Array.prototype.forEach) {
Array.prototype.forEach = function (callback, thisArg) {
var T, k;
if (this == null) {
throw new TypeError(" this is null or not defined");
}
var O = Object(this);
var len = O.length >>> 0;
if (typeof callback !== "function") {
throw new TypeError(callback + " is not a function");
}
if (arguments.length > 1) {
T = thisArg;
}
k = 0;
while (k < len) {
var kValue;
if (k in O) {
kValue = O[k];
callback.call(T, kValue, k, O);
}
k++;
}
};
}
var boxedString = Object("a"),
splitString = boxedString[0] != "a" || !(0 in boxedString);
if (!Array.prototype.every) {
Array.prototype.every = function every(fun /*, thisp */) {
var object = Object(this),
self = splitString && {}.toString.call(this) == stringClass ?
this.split("") :
object,
length = self.length >>> 0,
thisp = arguments[1];
if ({}.toString.call(fun) != funcClass) {
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.map) {
Array.prototype.map = function map(fun /*, thisp*/) {
var object = Object(this),
self = splitString && {}.toString.call(this) == stringClass ?
this.split("") :
object,
length = self.length >>> 0,
result = Array(length),
thisp = arguments[1];
if ({}.toString.call(fun) != funcClass) {
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 (predicate) {
var results = [], item, t = new Object(this);
for (var i = 0, len = t.length >>> 0; i < len; i++) {
item = t[i];
if (i in t && predicate.call(arguments[1], item, i, t)) {
results.push(item);
}
}
return results;
};
}
if (!Array.isArray) {
Array.isArray = function (arg) {
return {}.toString.call(arg) == arrayClass;
};
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function indexOf(searchElement) {
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
return -1;
}
var n = 0;
if (arguments.length > 1) {
n = Number(arguments[1]);
if (n !== n) {
n = 0;
} else if (n !== 0 && n != Infinity && n !== -Infinity) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
}
if (n >= len) {
return -1;
}
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
for (; k < len; k++) {
if (k in t && t[k] === searchElement) {
return k;
}
}
return -1;
};
}
// Collections
function IndexedItem(id, value) {
this.id = id;
this.value = value;
}
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
c === 0 && (c = this.id - other.id);
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) { return; }
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) { return; }
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
+index || (index = 0);
if (index >= this.length || index < 0) { return; }
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () { return this.items[0].value; };
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
delete this.items[this.length];
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
this.disposables = argsOrArray(arguments, 0);
this.isDisposed = false;
this.length = this.disposables.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Converts the existing CompositeDisposable to an array of disposables
* @returns {Array} An array of disposable objects.
*/
CompositeDisposablePrototype.toArray = function () {
return this.disposables.slice(0);
};
/**
* Provides a set of static methods for creating Disposables.
*
* @constructor
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
/** Performs the task of cleaning up resources. */
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function () {
function BooleanDisposable () {
this.isDisposed = false;
this.current = null;
}
var booleanDisposablePrototype = BooleanDisposable.prototype;
/**
* Gets the underlying disposable.
* @return The underlying disposable.
*/
booleanDisposablePrototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
* @param {Disposable} value The new underlying disposable.
*/
booleanDisposablePrototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed, old;
if (!shouldDispose) {
old = this.current;
this.current = value;
}
old && old.dispose();
shouldDispose && value && value.dispose();
};
/**
* Disposes the underlying disposable as well as all future replacements.
*/
booleanDisposablePrototype.dispose = function () {
var old;
if (!this.isDisposed) {
this.isDisposed = true;
old = this.current;
this.current = null;
}
old && old.dispose();
};
return BooleanDisposable;
}());
var SerialDisposable = Rx.SerialDisposable = SingleAssignmentDisposable;
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed) {
if (!this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
if (!this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler;
this.disposable = disposable;
this.isDisposed = false;
}
ScheduledDisposable.prototype.dispose = function () {
var parent = this;
this.scheduler.schedule(function () {
if (!parent.isDisposed) {
parent.isDisposed = true;
parent.disposable.dispose();
}
});
};
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
ScheduledItem.prototype.invoke = function () {
this.disposable.setDisposable(this.invokeCore());
};
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
timeSpan < 0 && (timeSpan = 0);
return timeSpan;
};
return Scheduler;
}());
var normalizeTime = Scheduler.normalize;
(function (schedulerProto) {
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function scheduleInnerRecursive(action, self) {
action(function(dt) { self(action, dt); });
}
/**
* Schedules an action to be executed recursively.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, function (_action, self) {
_action(function () { self(_action); }); });
};
/**
* Schedules an action to be executed recursively.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState({ first: state, second: action }, invokeRecImmediate);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, action);
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) {
if (typeof root.setInterval === 'undefined') { throw new Error('Periodic scheduling not supported.'); }
var s = state;
var id = root.setInterval(function () {
s = action(s);
}, period);
return disposableCreate(function () {
root.clearInterval(id);
});
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.
* @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false.
* @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling.
*/
schedulerProto.catchError = schedulerProto['catch'] = function (handler) {
return new CatchScheduler(this, handler);
};
}(Scheduler.prototype));
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
function SchedulePeriodicRecursive(scheduler, state, period, action) {
this._scheduler = scheduler;
this._state = state;
this._period = period;
this._action = action;
}
SchedulePeriodicRecursive.prototype.start = function () {
var d = new SingleAssignmentDisposable();
this._cancel = d;
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
return d;
};
return SchedulePeriodicRecursive;
}());
/**
* Gets a scheduler that schedules work immediately on the current thread.
*/
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) { return action(this, state); }
function scheduleRelative(state, dueTime, action) {
var dt = normalizeTime(dt);
while (dt - this.now() > 0) { }
return action(this, state);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function runTrampoline (q) {
var item;
while (q.length > 0) {
item = q.dequeue();
if (!item.isCancelled()) {
// Note, do not schedule blocking work!
while (item.dueTime - Scheduler.now() > 0) {
}
if (!item.isCancelled()) {
item.invoke();
}
}
}
}
function scheduleNow(state, action) {
return this.scheduleWithRelativeAndState(state, 0, action);
}
function scheduleRelative(state, dueTime, action) {
var dt = this.now() + Scheduler.normalize(dueTime),
si = new ScheduledItem(this, state, action, dt);
if (!queue) {
queue = new PriorityQueue(4);
queue.enqueue(si);
try {
runTrampoline(queue);
} catch (e) {
throw e;
} finally {
queue = null;
}
} else {
queue.enqueue(si);
}
return si.disposable;
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
currentScheduler.scheduleRequired = function () { return !queue; };
currentScheduler.ensureTrampoline = function (action) {
if (!queue) { this.schedule(action); } else { action(); }
};
return currentScheduler;
}());
var scheduleMethod, clearMethod = noop;
var localTimer = (function () {
var localSetTimeout, localClearTimeout = noop;
if ('WScript' in this) {
localSetTimeout = function (fn, time) {
WScript.Sleep(time);
fn();
};
} else if (!!root.setTimeout) {
localSetTimeout = root.setTimeout;
localClearTimeout = root.clearTimeout;
} else {
throw new Error('No concurrency detected!');
}
return {
setTimeout: localSetTimeout,
clearTimeout: localClearTimeout
};
}());
var localSetTimeout = localTimer.setTimeout,
localClearTimeout = localTimer.clearTimeout;
(function () {
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate,
clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' &&
!reNative.test(clearImmediate) && clearImmediate;
function postMessageSupported () {
// Ensure not in a worker
if (!root.postMessage || root.importScripts) { return false; }
var isAsync = false,
oldHandler = root.onmessage;
// Test for async
root.onmessage = function () { isAsync = true; };
root.postMessage('', '*');
root.onmessage = oldHandler;
return isAsync;
}
// Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout
if (typeof setImmediate === 'function') {
scheduleMethod = setImmediate;
clearMethod = clearImmediate;
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = process.nextTick;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
var handleId = event.data.substring(MSG_PREFIX.length),
action = tasks[handleId];
action();
delete tasks[handleId];
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else {
root.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var currentId = taskId++;
tasks[currentId] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel(),
channelTasks = {},
channelTaskId = 0;
channel.port1.onmessage = function (event) {
var id = event.data,
action = channelTasks[id];
action();
delete channelTasks[id];
};
scheduleMethod = function (action) {
var id = channelTaskId++;
channelTasks[id] = action;
channel.port2.postMessage(id);
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
scriptElement.onreadystatechange = function () {
action();
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
};
} else {
scheduleMethod = function (action) { return localSetTimeout(action, 0); };
clearMethod = localClearTimeout;
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = (function () {
function scheduleNow(state, action) {
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this,
dt = Scheduler.normalize(dueTime);
if (dt === 0) {
return scheduler.scheduleWithState(state, action);
}
var disposable = new SingleAssignmentDisposable();
var id = localSetTimeout(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
localClearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
var CatchScheduler = (function (__super__) {
function scheduleNow(state, action) {
return this._scheduler.scheduleWithState(state, this._wrap(action));
}
function scheduleRelative(state, dueTime, action) {
return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action));
}
function scheduleAbsolute(state, dueTime, action) {
return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action));
}
inherits(CatchScheduler, __super__);
function CatchScheduler(scheduler, handler) {
this._scheduler = scheduler;
this._handler = handler;
this._recursiveOriginal = null;
this._recursiveWrapper = null;
__super__.call(this, this._scheduler.now.bind(this._scheduler), scheduleNow, scheduleRelative, scheduleAbsolute);
}
CatchScheduler.prototype._clone = function (scheduler) {
return new CatchScheduler(scheduler, this._handler);
};
CatchScheduler.prototype._wrap = function (action) {
var parent = this;
return function (self, state) {
try {
return action(parent._getRecursiveWrapper(self), state);
} catch (e) {
if (!parent._handler(e)) { throw e; }
return disposableEmpty;
}
};
};
CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) {
if (this._recursiveOriginal !== scheduler) {
this._recursiveOriginal = scheduler;
var wrapper = this._clone(scheduler);
wrapper._recursiveOriginal = scheduler;
wrapper._recursiveWrapper = wrapper;
this._recursiveWrapper = wrapper;
}
return this._recursiveWrapper;
};
CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) {
var self = this, failed = false, d = new SingleAssignmentDisposable();
d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) {
if (failed) { return null; }
try {
return action(state1);
} catch (e) {
failed = true;
if (!self._handler(e)) { throw e; }
d.dispose();
return null;
}
}));
return d;
};
return CatchScheduler;
}(Scheduler));
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, hasValue) {
this.hasValue = hasValue == null ? false : hasValue;
this.kind = kind;
}
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
return observerOrOnNext && typeof observerOrOnNext === 'object' ?
this._acceptObservable(observerOrOnNext) :
this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notifications
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
Notification.prototype.toObservable = function (scheduler) {
var notification = this;
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
notification._acceptObservable(observer);
notification.kind === 'N' && observer.onCompleted();
});
});
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept (onNext) { return onNext(this.value); }
function _acceptObservable(observer) { return observer.onNext(this.value); }
function toString () { return 'OnNext(' + this.value + ')'; }
return function (value) {
var notification = new Notification('N', true);
notification.value = value;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) { return onError(this.exception); }
function _acceptObservable(observer) { return observer.onError(this.exception); }
function toString () { return 'OnError(' + this.exception + ')'; }
return function (e) {
var notification = new Notification('E');
notification.exception = e;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) { return onCompleted(); }
function _acceptObservable(observer) { return observer.onCompleted(); }
function toString () { return 'OnCompleted()'; }
return function () {
var notification = new Notification('C');
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
var Enumerator = Rx.internals.Enumerator = function (next) {
this._next = next;
};
Enumerator.prototype.next = function () {
return this._next();
};
Enumerator.prototype[$iterator$] = function () { return this; }
var Enumerable = Rx.internals.Enumerable = function (iterator) {
this._iterator = iterator;
};
Enumerable.prototype[$iterator$] = function () {
return this._iterator();
};
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch (err) {
observer.onError();
return;
}
var isDisposed,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var currentItem;
if (isDisposed) { return; }
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
observer.onCompleted();
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () { self(); })
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchError = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch (err) {
observer.onError();
return;
}
var isDisposed,
lastException,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
var currentItem;
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
if (lastException) {
observer.onError(lastException);
} else {
observer.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
function (exn) {
lastException = exn;
self();
},
observer.onCompleted.bind(observer)));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
if (repeatCount == null) { repeatCount = -1; }
return new Enumerable(function () {
var left = repeatCount;
return new Enumerator(function () {
if (left === 0) { return doneEnumerator; }
if (left > 0) { left--; }
return { done: false, value: value };
});
});
};
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
selector || (selector = identity);
return new Enumerable(function () {
var index = -1;
return new Enumerator(
function () {
return ++index < source.length ?
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
doneEnumerator;
});
});
};
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) { return n.accept(observer); };
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.
* If a violation is detected, an Error is thrown from the offending observer method call.
* @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
*/
Observer.prototype.checked = function () { return new CheckedObserver(this); };
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
*
* @static
* @memberOf Observer
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler, thisArg) {
return new AnonymousObserver(function (x) {
return handler.call(thisArg, notificationCreateOnNext(x));
}, function (e) {
return handler.call(thisArg, notificationCreateOnError(e));
}, function () {
return handler.call(thisArg, notificationCreateOnCompleted());
});
};
/**
* Schedules the invocation of observer methods on the given scheduler.
* @param {Scheduler} scheduler Scheduler to schedule observer messages on.
* @returns {Observer} Observer whose messages are scheduled on the given scheduler.
*/
Observer.notifyOn = function (scheduler) {
return new ObserveOnObserver(scheduler, this);
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {
inherits(AbstractObserver, __super__);
/**
* Creates a new observer in a non-stopped state.
*/
function AbstractObserver() {
this.isStopped = false;
__super__.call(this);
}
/**
* Notifies the observer of a new element in the sequence.
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) { this.next(value); }
};
/**
* Notifies the observer that an exception has occurred.
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.error(e);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) {
inherits(AnonymousObserver, __super__);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
__super__.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
* @param {Any} error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (error) {
this._onError(error);
};
/**
* Calls the onCompleted action.
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var CheckedObserver = (function (_super) {
inherits(CheckedObserver, _super);
function CheckedObserver(observer) {
_super.call(this);
this._observer = observer;
this._state = 0; // 0 - idle, 1 - busy, 2 - done
}
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();
try {
this._observer.onNext(value);
} catch (e) {
throw e;
} finally {
this._state = 0;
}
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
try {
this._observer.onError(err);
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
try {
this._observer.onCompleted();
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
if (this._state === 2) { throw new Error('Observer completed'); }
if (this._state === 0) { this._state = 1; }
};
return CheckedObserver;
}(Observer));
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) {
inherits(ScheduledObserver, __super__);
function ScheduledObserver(scheduler, observer) {
__super__.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () {
self.observer.onNext(value);
});
};
ScheduledObserver.prototype.error = function (err) {
var self = this;
this.queue.push(function () {
self.observer.onError(err);
});
};
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () {
self.observer.onCompleted();
});
};
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false, parent = this;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
try {
work();
} catch (ex) {
parent.queue = [];
parent.hasFaulted = true;
throw ex;
}
self();
}));
}
};
ScheduledObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
var ObserveOnObserver = (function (__super__) {
inherits(ObserveOnObserver, __super__);
function ObserveOnObserver() {
__super__.apply(this, arguments);
}
ObserveOnObserver.prototype.next = function (value) {
__super__.prototype.next.call(this, value);
this.ensureActive();
};
ObserveOnObserver.prototype.error = function (e) {
__super__.prototype.error.call(this, e);
this.ensureActive();
};
ObserveOnObserver.prototype.completed = function () {
__super__.prototype.completed.call(this);
this.ensureActive();
};
return ObserveOnObserver;
})(ScheduledObserver);
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
function Observable(subscribe) {
this._subscribe = subscribe;
}
observableProto = Observable.prototype;
/**
* Subscribes an observer to the observable sequence.
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
return this._subscribe(typeof observerOrOnNext === 'object' ?
observerOrOnNext :
observerCreate(observerOrOnNext, onError, onCompleted));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnNext = function (onNext, thisArg) {
return this._subscribe(observerCreate(arguments.length === 2 ? function(x) { onNext.call(thisArg, x); } : onNext));
};
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnError = function (onError, thisArg) {
return this._subscribe(observerCreate(null, arguments.length === 2 ? function(e) { onError.call(thisArg, e); } : onError));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {
return this._subscribe(observerCreate(null, null, arguments.length === 2 ? function() { onCompleted.call(thisArg); } : onCompleted));
};
return Observable;
})();
/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/
observableProto.observeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(new ObserveOnObserver(scheduler, observer));
});
};
/**
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
d.setDisposable(m);
m.setDisposable(scheduler.schedule(function () {
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
}));
return d;
});
};
/**
* Converts a Promise to an Observable sequence
* @param {Promise} An ES6 Compliant promise.
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
*/
var observableFromPromise = Observable.fromPromise = function (promise) {
return observableDefer(function () {
var subject = new Rx.AsyncSubject();
promise.then(
function (value) {
if (!subject.isDisposed) {
subject.onNext(value);
subject.onCompleted();
}
},
subject.onError.bind(subject));
return subject;
});
};
/*
* Converts an existing observable sequence to an ES6 Compatible Promise
* @example
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
*
* // With config
* Rx.config.Promise = RSVP.Promise;
* var promise = Rx.Observable.return(42).toPromise();
* @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.
* @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.
*/
observableProto.toPromise = function (promiseCtor) {
promiseCtor || (promiseCtor = Rx.config.Promise);
if (!promiseCtor) { throw new TypeError('Promise type not provided nor in Rx.config.Promise'); }
var source = this;
return new promiseCtor(function (resolve, reject) {
// No cancellation can be done
var value, hasValue = false;
source.subscribe(function (v) {
value = v;
hasValue = true;
}, reject, function () {
hasValue && resolve(value);
});
});
};
/**
* Creates an array from an observable sequence.
* @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
var self = this;
return new AnonymousObservable(function(observer) {
var arr = [];
return self.subscribe(
arr.push.bind(arr),
observer.onError.bind(observer),
function () {
observer.onNext(arr);
observer.onCompleted();
});
});
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* var res = Rx.Observable.create(function (observer) { return function () { } );
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* var res = Rx.Observable.create(function (observer) { } );
*
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = Observable.createWithDisposable = function (subscribe) {
return new AnonymousObservable(subscribe);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
isPromise(result) && (result = observableFromPromise(result));
return result.subscribe(observer);
});
};
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* var res = Rx.Observable.empty();
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onCompleted();
});
});
};
var maxSafeInteger = Math.pow(2, 53) - 1;
function StringIterable(str) {
this._s = s;
}
StringIterable.prototype[$iterator$] = function () {
return new StringIterator(this._s);
};
function StringIterator(str) {
this._s = s;
this._l = s.length;
this._i = 0;
}
StringIterator.prototype[$iterator$] = function () {
return this;
};
StringIterator.prototype.next = function () {
if (this._i < this._l) {
var val = this._s.charAt(this._i++);
return { done: false, value: val };
} else {
return doneEnumerator;
}
};
function ArrayIterable(a) {
this._a = a;
}
ArrayIterable.prototype[$iterator$] = function () {
return new ArrayIterator(this._a);
};
function ArrayIterator(a) {
this._a = a;
this._l = toLength(a);
this._i = 0;
}
ArrayIterator.prototype[$iterator$] = function () {
return this;
};
ArrayIterator.prototype.next = function () {
if (this._i < this._l) {
var val = this._a[this._i++];
return { done: false, value: val };
} else {
return doneEnumerator;
}
};
function numberIsFinite(value) {
return typeof value === 'number' && root.isFinite(value);
}
function isNan(n) {
return n !== n;
}
function getIterable(o) {
var i = o[$iterator$], it;
if (!i && typeof o === 'string') {
it = new StringIterable(o);
return it[$iterator$]();
}
if (!i && o.length !== undefined) {
it = new ArrayIterable(o);
return it[$iterator$]();
}
if (!i) { throw new TypeError('Object is not iterable'); }
return o[$iterator$]();
}
function sign(value) {
var number = +value;
if (number === 0) { return number; }
if (isNaN(number)) { return number; }
return number < 0 ? -1 : 1;
}
function toLength(o) {
var len = +o.length;
if (isNaN(len)) { return 0; }
if (len === 0 || !numberIsFinite(len)) { return len; }
len = sign(len) * Math.floor(Math.abs(len));
if (len <= 0) { return 0; }
if (len > maxSafeInteger) { return maxSafeInteger; }
return len;
}
/**
* This method creates a new Observable sequence from an array-like or iterable object.
* @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.
* @param {Function} [mapFn] Map function to call on every element of the array.
* @param {Any} [thisArg] The context to use calling the mapFn if provided.
* @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
*/
var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isFunction(mapFn)) {
throw new Error('mapFn when provided must be a function');
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
var list = Object(iterable), it = getIterable(list);
return new AnonymousObservable(function (observer) {
var i = 0;
return scheduler.scheduleRecursive(function (self) {
var next;
try {
next = it.next();
} catch (e) {
observer.onError(e);
return;
}
if (next.done) {
observer.onCompleted();
return;
}
var result = next.value;
if (mapFn && isFunction(mapFn)) {
try {
result = mapFn.call(thisArg, result, i);
} catch (e) {
observer.onError(e);
return;
}
}
observer.onNext(result);
i++;
self();
});
});
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
* @deprecated use Observable.from or Observable.of
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
//deprecate('fromArray', 'from');
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0, len = array.length;
return scheduler.scheduleRecursive(function (self) {
if (count < len) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var first = true, state = initialState;
return scheduler.scheduleRecursive(function (self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
}
} catch (exception) {
observer.onError(exception);
return;
}
if (hasResult) {
observer.onNext(result);
self();
} else {
observer.onCompleted();
}
});
});
};
function observableOf (scheduler, array) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0, len = array.length;
return scheduler.scheduleRecursive(function (self) {
if (count < len) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
}
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.of = function () {
return observableOf(null, arguments);
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.ofWithScheduler = function (scheduler) {
return observableOf(scheduler, slice.call(arguments, 1));
};
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new AnonymousObservable(function () {
return disposableEmpty;
});
};
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.range(0, 10);
* var res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout);
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleRecursiveWithState(0, function (i, self) {
if (i < count) {
observer.onNext(start + i);
self(i + 1);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.repeat(42);
* var res = Rx.Observable.repeat(42, 4);
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return observableReturn(value, scheduler).repeat(repeatCount == null ? -1 : repeatCount);
};
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'just', and 'returnValue' for browsers <IE9.
*
* @example
* var res = Rx.Observable.return(42);
* var res = Rx.Observable.return(42, Rx.Scheduler.timeout);
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onNext(value);
observer.onCompleted();
});
});
};
/** @deprecated use return or just */
Observable.returnValue = function () {
deprecate('returnValue', 'return or just');
return observableReturn.apply(null, arguments);
};
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwError' for browsers <IE9.
* @param {Mixed} exception An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable['throw'] = Observable.throwException = Observable.throwError = function (exception, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onError(exception);
});
});
};
/**
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
* @param {Function} resourceFactory Factory function to obtain a resource object.
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
*/
Observable.using = function (resourceFactory, observableFactory) {
return new AnonymousObservable(function (observer) {
var disposable = disposableEmpty, resource, source;
try {
resource = resourceFactory();
resource && (disposable = resource);
source = observableFactory(resource);
} catch (exception) {
return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable);
}
return new CompositeDisposable(source.subscribe(observer), disposable);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
* @param {Observable} rightSource Second observable sequence or Promise.
* @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.
*/
observableProto.amb = function (rightSource) {
var leftSource = this;
return new AnonymousObservable(function (observer) {
var choice,
leftChoice = 'L', rightChoice = 'R',
leftSubscription = new SingleAssignmentDisposable(),
rightSubscription = new SingleAssignmentDisposable();
isPromise(rightSource) && (rightSource = observableFromPromise(rightSource));
function choiceL() {
if (!choice) {
choice = leftChoice;
rightSubscription.dispose();
}
}
function choiceR() {
if (!choice) {
choice = rightChoice;
leftSubscription.dispose();
}
}
leftSubscription.setDisposable(leftSource.subscribe(function (left) {
choiceL();
if (choice === leftChoice) {
observer.onNext(left);
}
}, function (err) {
choiceL();
if (choice === leftChoice) {
observer.onError(err);
}
}, function () {
choiceL();
if (choice === leftChoice) {
observer.onCompleted();
}
}));
rightSubscription.setDisposable(rightSource.subscribe(function (right) {
choiceR();
if (choice === rightChoice) {
observer.onNext(right);
}
}, function (err) {
choiceR();
if (choice === rightChoice) {
observer.onError(err);
}
}, function () {
choiceR();
if (choice === rightChoice) {
observer.onCompleted();
}
}));
return new CompositeDisposable(leftSubscription, rightSubscription);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
*
* @example
* var = Rx.Observable.amb(xs, ys, zs);
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/
Observable.amb = function () {
var acc = observableNever(),
items = argsOrArray(arguments, 0);
function func(previous, current) {
return previous.amb(current);
}
for (var i = 0, len = items.length; i < len; i++) {
acc = func(acc, items[i]);
}
return acc;
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (observer) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) {
var d, result;
try {
result = handler(exception);
} catch (ex) {
observer.onError(ex);
return;
}
isPromise(result) && (result = observableFromPromise(result));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(observer));
}, observer.onCompleted.bind(observer)));
return subscription;
});
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto['catch'] = observableProto.catchError = function (handlerOrSecond) {
return typeof handlerOrSecond === 'function' ?
observableCatchHandler(this, handlerOrSecond) :
observableCatch([this, handlerOrSecond]);
};
/**
* @deprecated use #catch or #catchError instead.
*/
observableProto.catchException = function (handlerOrSecond) {
deprecate('catchException', 'catch or catchError');
return this.catchError(handlerOrSecond);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchError = Observable['catch'] = function () {
return enumerableOf(argsOrArray(arguments, 0)).catchError();
};
/**
* @deprecated use #catch or #catchError instead.
*/
Observable.catchException = function () {
deprecate('catchException', 'catch or catchError');
return observableCatch.apply(null, arguments);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var args = slice.call(arguments);
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var args = slice.call(arguments), resultSelector = args.pop();
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
}
function done (i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
values[i] = x;
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
*
* @example
* 1 - concatenated = xs.concat(ys, zs);
* 2 - concatenated = xs.concat([ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
var items = slice.call(arguments, 0);
items.unshift(this);
return observableConcat.apply(this, items);
};
/**
* Concatenates all the observable sequences.
* @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
return enumerableOf(argsOrArray(arguments, 0)).concat();
};
/**
* Concatenates an observable sequence of observable sequences.
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatAll = function () {
return this.merge(1);
};
/** @deprecated Use `concatAll` instead. */
observableProto.concatObservable = function () {
deprecate('concatObservable', 'concatAll');
return this.merge(1);
};
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
if (typeof maxConcurrentOrOther !== 'number') { return observableMerge(this, maxConcurrentOrOther); }
var sources = this;
return new AnonymousObservable(function (observer) {
var activeCount = 0, group = new CompositeDisposable(), isStopped = false, q = [];
function subscribe(xs) {
var subscription = new SingleAssignmentDisposable();
group.add(subscription);
// Check for promises support
isPromise(xs) && (xs = observableFromPromise(xs));
subscription.setDisposable(xs.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
group.remove(subscription);
if (q.length > 0) {
subscribe(q.shift());
} else {
activeCount--;
isStopped && activeCount === 0 && observer.onCompleted();
}
}));
}
group.add(sources.subscribe(function (innerSource) {
if (activeCount < maxConcurrentOrOther) {
activeCount++;
subscribe(innerSource);
} else {
q.push(innerSource);
}
}, observer.onError.bind(observer), function () {
isStopped = true;
activeCount === 0 && observer.onCompleted();
}));
return group;
});
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
*
* @example
* 1 - merged = Rx.Observable.merge(xs, ys, zs);
* 2 - merged = Rx.Observable.merge([xs, ys, zs]);
* 3 - merged = Rx.Observable.merge(scheduler, xs, ys, zs);
* 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]);
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources;
if (!arguments[0]) {
scheduler = immediateScheduler;
sources = slice.call(arguments, 1);
} else if (arguments[0].now) {
scheduler = arguments[0];
sources = slice.call(arguments, 1);
} else {
scheduler = immediateScheduler;
sources = slice.call(arguments, 0);
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableOf(scheduler, sources).mergeAll();
};
/**
* Merges an observable sequence of observable sequences into an observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeAll = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable(),
isStopped = false,
m = new SingleAssignmentDisposable();
group.add(m);
m.setDisposable(sources.subscribe(function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
// Check for promises support
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
group.remove(innerSubscription);
isStopped && group.length === 1 && observer.onCompleted();
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
group.length === 1 && observer.onCompleted();
}));
return group;
});
};
/**
* @deprecated use #mergeAll instead.
*/
observableProto.mergeObservable = function () {
deprecate('mergeObservable', 'mergeAll');
return this.mergeAll.apply(this, arguments);
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
* @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.
* @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
*/
observableProto.onErrorResumeNext = function (second) {
if (!second) { throw new Error('Second observable is required'); }
return onErrorResumeNext([this, second]);
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs);
* 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]);
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
var onErrorResumeNext = Observable.onErrorResumeNext = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var pos = 0, subscription = new SerialDisposable(),
cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, d;
if (pos < sources.length) {
current = sources[pos++];
isPromise(current) && (current = observableFromPromise(current));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(observer.onNext.bind(observer), self, self));
} else {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
isOpen && observer.onNext(left);
}, observer.onError.bind(observer), function () {
isOpen && observer.onCompleted();
}));
isPromise(other) && (other = observableFromPromise(other));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, observer.onError.bind(observer), function () {
rightSubscription.dispose();
}));
return disposables;
});
};
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto['switch'] = observableProto.switchLatest = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasLatest = false,
innerSubscription = new SerialDisposable(),
isStopped = false,
latest = 0,
subscription = sources.subscribe(
function (innerSource) {
var d = new SingleAssignmentDisposable(), id = ++latest;
hasLatest = true;
innerSubscription.setDisposable(d);
// Check if Promise or Observable
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
d.setDisposable(innerSource.subscribe(
function (x) { latest === id && observer.onNext(x); },
function (e) { latest === id && observer.onError(e); },
function () {
if (latest === id) {
hasLatest = false;
isStopped && observer.onCompleted();
}
}));
},
observer.onError.bind(observer),
function () {
isStopped = true;
!hasLatest && observer.onCompleted();
});
return new CompositeDisposable(subscription, innerSubscription);
});
};
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
isPromise(other) && (other = observableFromPromise(other));
return new CompositeDisposable(
source.subscribe(observer),
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
);
});
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) {
return zipArray.apply(this, arguments);
}
var parent = this, sources = slice.call(arguments), resultSelector = sources.pop();
sources.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
var res, queuedValues;
if (queues.every(function (x) { return x.length > 0; })) {
try {
queuedValues = queues.map(function (x) { return x.shift(); });
res = resultSelector.apply(parent, queuedValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = sources[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
* @param arguments Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function () {
var args = slice.call(arguments, 0), first = args.shift();
return first.zip.apply(first, args);
};
/**
* Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
* @param arguments Observable sources.
* @returns {Observable} An observable sequence containing lists of elements at corresponding indexes.
*/
Observable.zipArray = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
return;
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
return;
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
var compositeDisposable = new CompositeDisposable(subscriptions);
compositeDisposable.add(disposableCreate(function () {
for (var qIdx = 0, qLen = queues.length; qIdx < qLen; qIdx++) { queues[qIdx] = []; }
}));
return compositeDisposable;
});
};
/**
* Hides the identity of an observable sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
return new AnonymousObservable(this.subscribe.bind(this));
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
*
* @example
* var res = xs.bufferWithCount(10);
* var res = xs.bufferWithCount(10, 1);
* @param {Number} count Length of each buffer.
* @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithCount = function (count, skip) {
if (typeof skip !== 'number') {
skip = count;
}
return this.windowWithCount(count, skip).selectMany(function (x) {
return x.toArray();
}).where(function (x) {
return x.length > 0;
});
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
return x.accept(observer);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* var obs = observable.distinctUntilChanged();
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
keySelector || (keySelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var comparerEquals = false, key;
try {
key = keySelector(value);
} catch (exception) {
observer.onError(exception);
return;
}
if (hasCurrentKey) {
try {
comparerEquals = comparer(currentKey, key);
} catch (exception) {
observer.onError(exception);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto['do'] = observableProto.tap = function (observerOrOnNext, onError, onCompleted) {
var source = this, onNextFunc;
if (typeof observerOrOnNext === 'function') {
onNextFunc = observerOrOnNext;
} else {
onNextFunc = observerOrOnNext.onNext.bind(observerOrOnNext);
onError = observerOrOnNext.onError.bind(observerOrOnNext);
onCompleted = observerOrOnNext.onCompleted.bind(observerOrOnNext);
}
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
try {
onNextFunc(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (err) {
if (onError) {
try {
onError(err);
} catch (e) {
observer.onError(e);
}
}
observer.onError(err);
}, function () {
if (onCompleted) {
try {
onCompleted();
} catch (e) {
observer.onError(e);
}
}
observer.onCompleted();
});
});
};
/** @deprecated use #do or #tap instead. */
observableProto.doAction = function () {
deprecate('doAction', 'do or tap');
return this.tap.apply(this, arguments);
};
/**
* Invokes an action for each element in the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onNext Action to invoke for each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {
return this.tap(arguments.length === 2 ? function (x) { onNext.call(thisArg, x); } : onNext);
};
/**
* Invokes an action upon exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {
return this.tap(noop, arguments.length === 2 ? function (e) { onError.call(thisArg, e); } : onError);
};
/**
* Invokes an action upon graceful termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {
return this.tap(noop, null, arguments.length === 2 ? function () { onCompleted.call(thisArg); } : onCompleted);
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto['finally'] = observableProto.ensure = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription;
try {
subscription = source.subscribe(observer);
} catch (e) {
action();
throw e;
}
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
});
};
/**
* @deprecated use #finally or #ensure instead.
*/
observableProto.finallyAction = function (action) {
deprecate('finallyAction', 'finally or ensure');
return this.ensure(action);
};
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (e) {
observer.onNext(notificationCreateOnError(e));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
});
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
* Note if you encounter an error and want it to retry once, then you must use .retry(2);
*
* @example
* var res = retried = retry.repeat();
* var res = retried = retry.repeat(2);
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchError();
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @example
* var res = source.scan(function (acc, x) { return acc + x; });
* var res = source.scan(0, function (acc, x) { return acc + x; });
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var hasSeed = false, seed, accumulator, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (observer) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
!hasValue && (hasValue = true);
try {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(accumulation);
},
observer.onError.bind(observer),
function () {
!hasValue && hasSeed && observer.onNext(seed);
observer.onCompleted();
}
);
});
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
* @description
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && observer.onNext(q.shift());
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
* @example
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
* @param {Arguments} args The specified values to prepend to the observable sequence
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && isScheduler(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
values = slice.call(arguments, start);
return enumerableOf([observableFromArray(values, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence.
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, observer.onError.bind(observer), function () {
while (q.length > 0) { observer.onNext(q.shift()); }
observer.onCompleted();
});
});
};
/**
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, observer.onError.bind(observer), function () {
observer.onNext(q);
observer.onCompleted();
});
});
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
*
* var res = xs.windowWithCount(10);
* var res = xs.windowWithCount(10, 1);
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithCount = function (count, skip) {
var source = this;
+count || (count = 0);
Math.abs(count) === Infinity && (count = 0);
if (count <= 0) { throw new Error(argumentOutOfRange); }
skip == null && (skip = count);
+skip || (skip = 0);
Math.abs(skip) === Infinity && (skip = 0);
if (skip <= 0) { throw new Error(argumentOutOfRange); }
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [];
function createWindow () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
}
createWindow();
m.setDisposable(source.subscribe(
function (x) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
var c = n - count + 1;
c >= 0 && c % skip === 0 && q.shift().onCompleted();
++n % skip === 0 && createWindow();
},
function (e) {
while (q.length > 0) { q.shift().onError(e); }
observer.onError(e);
},
function () {
while (q.length > 0) { q.shift().onCompleted(); }
observer.onCompleted();
}
));
return refCountDisposable;
});
};
function concatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).concatAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
if (isFunction(selector) && isFunction(resultSelector)) {
return this.concatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
});
}
return isFunction(selector) ?
concatMap(this, selector, thisArg) :
concatMap(this, function () { return selector; });
};
/**
* Projects each notification of an observable sequence to an observable sequence and concats the resulting observable sequences into one observable sequence.
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
*/
observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNext.call(thisArg, x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onError.call(thisArg, err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompleted.call(thisArg);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}).concatAll();
};
/**
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
*
* var res = obs = xs.defaultIfEmpty();
* 2 - obs = xs.defaultIfEmpty(false);
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/
observableProto.defaultIfEmpty = function (defaultValue) {
var source = this;
if (defaultValue === undefined) {
defaultValue = null;
}
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
}, observer.onError.bind(observer), function () {
if (!found) {
observer.onNext(defaultValue);
}
observer.onCompleted();
});
});
};
// Swap out for Array.findIndex
function arrayIndexOfComparer(array, item, comparer) {
for (var i = 0, len = array.length; i < len; i++) {
if (comparer(array[i], item)) { return i; }
}
return -1;
}
function HashSet(comparer) {
this.comparer = comparer;
this.set = [];
}
HashSet.prototype.push = function(value) {
var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1;
retValue && this.set.push(value);
return retValue;
};
/**
* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @example
* var res = obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; });
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [comparer] Used to compare items in the collection.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/
observableProto.distinct = function (keySelector, comparer) {
var source = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hashSet = new HashSet(comparer);
return source.subscribe(function (x) {
var key = x;
if (keySelector) {
try {
key = keySelector(x);
} catch (e) {
observer.onError(e);
return;
}
}
hashSet.push(key) && observer.onNext(x);
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer));
});
};
/**
* Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
*
* @example
* var res = observable.groupBy(function (x) { return x.id; });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} [elementSelector] A function to map each source element to an element in an observable group.
* @param {Function} [comparer] Used to determine whether the objects are equal.
* @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
*/
observableProto.groupBy = function (keySelector, elementSelector, comparer) {
return this.groupByUntil(keySelector, elementSelector, observableNever, comparer);
};
/**
* Groups the elements of an observable sequence according to a specified key selector function.
* A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
* key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
*
* @example
* var res = observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} durationSelector A function to signal the expiration of a group.
* @param {Function} [comparer] Used to compare objects. When not specified, the default comparer is used.
* @returns {Observable}
* A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
* If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
*
*/
observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector, comparer) {
var source = this;
elementSelector || (elementSelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
function handleError(e) { return function (item) { item.onError(e); }; }
var map = new Dictionary(0, comparer),
groupDisposable = new CompositeDisposable(),
refCountDisposable = new RefCountDisposable(groupDisposable);
groupDisposable.add(source.subscribe(function (x) {
var key;
try {
key = keySelector(x);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
var fireNewMapEntry = false,
writer = map.tryGetValue(key);
if (!writer) {
writer = new Subject();
map.set(key, writer);
fireNewMapEntry = true;
}
if (fireNewMapEntry) {
var group = new GroupedObservable(key, writer, refCountDisposable),
durationGroup = new GroupedObservable(key, writer);
try {
duration = durationSelector(durationGroup);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
observer.onNext(group);
var md = new SingleAssignmentDisposable();
groupDisposable.add(md);
var expire = function () {
map.remove(key) && writer.onCompleted();
groupDisposable.remove(md);
};
md.setDisposable(duration.take(1).subscribe(
noop,
function (exn) {
map.getValues().forEach(handleError(exn));
observer.onError(exn);
},
expire)
);
}
var element;
try {
element = elementSelector(x);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
writer.onNext(element);
}, function (ex) {
map.getValues().forEach(handleError(ex));
observer.onError(ex);
}, function () {
map.getValues().forEach(function (item) { item.onCompleted(); });
observer.onCompleted();
}));
return refCountDisposable;
});
};
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.select = observableProto.map = function (selector, thisArg) {
var selectorFn = isFunction(selector) ? selector : function () { return selector; },
source = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return source.subscribe(function (value) {
var result;
try {
result = selectorFn.call(thisArg, value, count++, source);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Retrieves the value of a specified property from all elements in the Observable sequence.
* @param {String} prop The property to pluck.
* @returns {Observable} Returns a new Observable sequence of property values.
*/
observableProto.pluck = function (prop) {
return this.map(function (x) { return x[prop]; });
};
function flatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).mergeAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
if (isFunction(selector) && isFunction(resultSelector)) {
return this.flatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
}, thisArg);
}
return isFunction(selector) ?
flatMap(this, selector, thisArg) :
flatMap(this, function () { return selector; });
};
/**
* Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
*/
observableProto.flatMapObserver = observableProto.selectManyObserver = function (onNext, onError, onCompleted, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNext.call(thisArg, x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onError.call(thisArg, err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompleted.call(thisArg);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}).mergeAll();
};
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function (selector, thisArg) {
return this.select(selector, thisArg).switchLatest();
};
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) { throw new Error(argumentOutOfRange); }
var source = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return source.subscribe(function (x) {
if (remaining <= 0) {
observer.onNext(x);
} else {
remaining--;
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* var res = source.skipWhile(function (value) { return value < 10; });
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !predicate.call(thisArg, x, i++, source);
} catch (e) {
observer.onError(e);
return;
}
}
running && observer.onNext(x);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* var res = source.take(5);
* var res = source.take(0, Rx.Scheduler.timeout);
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) { throw new RangeError(argumentOutOfRange); }
if (count === 0) { return observableEmpty(scheduler); }
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining-- > 0) {
observer.onNext(x);
remaining === 0 && observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var observable = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = true;
return observable.subscribe(function (x) {
if (running) {
try {
running = predicate.call(thisArg, x, i++, observable);
} catch (e) {
observer.onError(e);
return;
}
if (running) {
observer.onNext(x);
} else {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
*
* @example
* var res = source.where(function (value) { return value < 10; });
* var res = source.where(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.where = observableProto.filter = function (predicate, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, value, count++, parent);
} catch (e) {
observer.onError(e);
return;
}
shouldRun && observer.onNext(value);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
observableProto.finalValue = function () {
var source = this;
return new AnonymousObservable(function (observer) {
var hasValue = false, value;
return source.subscribe(function (x) {
hasValue = true;
value = x;
}, observer.onError.bind(observer), function () {
if (!hasValue) {
observer.onError(new Error(sequenceContainsNoElements));
} else {
observer.onNext(value);
observer.onCompleted();
}
});
});
};
function extremaBy(source, keySelector, comparer) {
return new AnonymousObservable(function (observer) {
var hasValue = false, lastKey = null, list = [];
return source.subscribe(function (x) {
var comparison, key;
try {
key = keySelector(x);
} catch (ex) {
observer.onError(ex);
return;
}
comparison = 0;
if (!hasValue) {
hasValue = true;
lastKey = key;
} else {
try {
comparison = comparer(key, lastKey);
} catch (ex1) {
observer.onError(ex1);
return;
}
}
if (comparison > 0) {
lastKey = key;
list = [];
}
if (comparison >= 0) { list.push(x); }
}, observer.onError.bind(observer), function () {
observer.onNext(list);
observer.onCompleted();
});
});
}
function firstOnly(x) {
if (x.length === 0) {
throw new Error(sequenceContainsNoElements);
}
return x[0];
}
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @deprecated Use #reduce instead
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
observableProto.aggregate = function () {
deprecate('aggregate', 'reduce');
var seed, hasSeed, accumulator;
if (arguments.length === 2) {
seed = arguments[0];
hasSeed = true;
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue();
};
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @param {Any} [seed] The initial accumulator value.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
observableProto.reduce = function (accumulator) {
var seed, hasSeed;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[1];
}
return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue();
};
/**
* Determines whether any element of an observable sequence satisfies a condition if present, else if any items are in the sequence.
* @param {Function} [predicate] A function to test each element for a condition.
* @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
*/
observableProto.some = function (predicate, thisArg) {
var source = this;
return predicate ?
source.filter(predicate, thisArg).some() :
new AnonymousObservable(function (observer) {
return source.subscribe(function () {
observer.onNext(true);
observer.onCompleted();
}, observer.onError.bind(observer), function () {
observer.onNext(false);
observer.onCompleted();
});
});
};
/** @deprecated use #some instead */
observableProto.any = function () {
deprecate('any', 'some');
return this.some.apply(this, arguments);
};
/**
* Determines whether an observable sequence is empty.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.
*/
observableProto.isEmpty = function () {
return this.any().map(not);
};
/**
* Determines whether all elements of an observable sequence satisfy a condition.
* @param {Function} [predicate] A function to test each element for a condition.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.
*/
observableProto.every = function (predicate, thisArg) {
return this.filter(function (v) { return !predicate(v); }, thisArg).some().map(not);
};
/** @deprecated use #every instead */
observableProto.all = function () {
deprecate('all', 'every');
return this.every.apply(this, arguments);
};
/**
* Determines whether an observable sequence contains a specified element with an optional equality comparer.
* @param searchElement The value to locate in the source sequence.
* @param {Number} [fromIndex] An equality comparer to compare elements.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value from the given index.
*/
observableProto.contains = function (searchElement, fromIndex) {
var source = this;
function comparer(a, b) {
return (a === 0 && b === 0) || (a === b || (isNaN(a) && isNaN(b)));
}
return new AnonymousObservable(function (observer) {
var i = 0, n = +fromIndex || 0;
Math.abs(n) === Infinity && (n = 0);
if (n < 0) {
observer.onNext(false);
observer.onCompleted();
return disposableEmpty;
}
return source.subscribe(
function (x) {
if (i++ >= n && comparer(x, searchElement)) {
observer.onNext(true);
observer.onCompleted();
}
},
observer.onError.bind(observer),
function () {
observer.onNext(false);
observer.onCompleted();
});
});
};
/**
* Returns an observable sequence containing a value that represents how many elements in the specified observable sequence satisfy a condition if provided, else the count of items.
* @example
* res = source.count();
* res = source.count(function (x) { return x > 3; });
* @param {Function} [predicate]A function to test each element for a condition.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function if provided, else the count of items in the sequence.
*/
observableProto.count = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).count() :
this.aggregate(0, function (count) {
return count + 1;
});
};
/**
* Returns the first index at which a given element can be found in the observable sequence, or -1 if it is not present.
* @param {Any} searchElement Element to locate in the array.
* @param {Number} [fromIndex] The index to start the search. If not specified, defaults to 0.
* @returns {Observable} And observable sequence containing the first index at which a given element can be found in the observable sequence, or -1 if it is not present.
*/
observableProto.indexOf = function(searchElement, fromIndex) {
var source = this;
return new AnonymousObservable(function (observer) {
var i = 0, n = +fromIndex || 0;
Math.abs(n) === Infinity && (n = 0);
if (n < 0) {
observer.onNext(-1);
observer.onCompleted();
return disposableEmpty;
}
return source.subscribe(
function (x) {
if (i >= n && x === searchElement) {
observer.onNext(i);
observer.onCompleted();
}
i++;
},
observer.onError.bind(observer),
function () {
observer.onNext(-1);
observer.onCompleted();
});
});
};
/**
* Computes the sum of a sequence of values that are obtained by invoking an optional transform function on each element of the input sequence, else if not specified computes the sum on each item in the sequence.
* @example
* var res = source.sum();
* var res = source.sum(function (x) { return x.value; });
* @param {Function} [selector] A transform function to apply to each element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence.
*/
observableProto.sum = function (keySelector, thisArg) {
return keySelector && isFunction(keySelector) ?
this.map(keySelector, thisArg).sum() :
this.reduce(function (prev, curr) {
return prev + curr;
}, 0);
};
/**
* Returns the elements in an observable sequence with the minimum key value according to the specified comparer.
* @example
* var res = source.minBy(function (x) { return x.value; });
* var res = source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value.
*/
observableProto.minBy = function (keySelector, comparer) {
comparer || (comparer = defaultSubComparer);
return extremaBy(this, keySelector, function (x, y) { return comparer(x, y) * -1; });
};
/**
* Returns the minimum element in an observable sequence according to the optional comparer else a default greater than less than check.
* @example
* var res = source.min();
* var res = source.min(function (x, y) { return x.value - y.value; });
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the minimum element in the source sequence.
*/
observableProto.min = function (comparer) {
return this.minBy(identity, comparer).map(function (x) { return firstOnly(x); });
};
/**
* Returns the elements in an observable sequence with the maximum key value according to the specified comparer.
* @example
* var res = source.maxBy(function (x) { return x.value; });
* var res = source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value.
*/
observableProto.maxBy = function (keySelector, comparer) {
comparer || (comparer = defaultSubComparer);
return extremaBy(this, keySelector, comparer);
};
/**
* Returns the maximum value in an observable sequence according to the specified comparer.
* @example
* var res = source.max();
* var res = source.max(function (x, y) { return x.value - y.value; });
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the maximum element in the source sequence.
*/
observableProto.max = function (comparer) {
return this.maxBy(identity, comparer).map(function (x) { return firstOnly(x); });
};
/**
* Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present.
* @param {Function} [selector] A transform function to apply to each element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values.
*/
observableProto.average = function (keySelector, thisArg) {
return keySelector && isFunction(keySelector) ?
this.select(keySelector, thisArg).average() :
this.scan({sum: 0, count: 0 }, function (prev, cur) {
return {
sum: prev.sum + cur,
count: prev.count + 1
};
}).finalValue().map(function (s) {
if (s.count === 0) {
throw new Error('The input sequence was empty');
}
return s.sum / s.count;
});
};
/**
* Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.
*
* @example
* var res = res = source.sequenceEqual([1,2,3]);
* var res = res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; });
* 3 - res = source.sequenceEqual(Rx.Observable.returnValue(42));
* 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; });
* @param {Observable} second Second observable sequence or array to compare.
* @param {Function} [comparer] Comparer used to compare elements of both sequences.
* @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.
*/
observableProto.sequenceEqual = function (second, comparer) {
var first = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var donel = false, doner = false, ql = [], qr = [];
var subscription1 = first.subscribe(function (x) {
var equal, v;
if (qr.length > 0) {
v = qr.shift();
try {
equal = comparer(v, x);
} catch (e) {
observer.onError(e);
return;
}
if (!equal) {
observer.onNext(false);
observer.onCompleted();
}
} else if (doner) {
observer.onNext(false);
observer.onCompleted();
} else {
ql.push(x);
}
}, observer.onError.bind(observer), function () {
donel = true;
if (ql.length === 0) {
if (qr.length > 0) {
observer.onNext(false);
observer.onCompleted();
} else if (doner) {
observer.onNext(true);
observer.onCompleted();
}
}
});
(isArrayLike(second) || isIterable(second)) && (second = observableFrom(second));
isPromise(second) && (second = observableFromPromise(second));
var subscription2 = second.subscribe(function (x) {
var equal;
if (ql.length > 0) {
var v = ql.shift();
try {
equal = comparer(v, x);
} catch (exception) {
observer.onError(exception);
return;
}
if (!equal) {
observer.onNext(false);
observer.onCompleted();
}
} else if (donel) {
observer.onNext(false);
observer.onCompleted();
} else {
qr.push(x);
}
}, observer.onError.bind(observer), function () {
doner = true;
if (qr.length === 0) {
if (ql.length > 0) {
observer.onNext(false);
observer.onCompleted();
} else if (donel) {
observer.onNext(true);
observer.onCompleted();
}
}
});
return new CompositeDisposable(subscription1, subscription2);
});
};
function elementAtOrDefault(source, index, hasDefault, defaultValue) {
if (index < 0) {
throw new Error(argumentOutOfRange);
}
return new AnonymousObservable(function (observer) {
var i = index;
return source.subscribe(function (x) {
if (i === 0) {
observer.onNext(x);
observer.onCompleted();
}
i--;
}, observer.onError.bind(observer), function () {
if (!hasDefault) {
observer.onError(new Error(argumentOutOfRange));
} else {
observer.onNext(defaultValue);
observer.onCompleted();
}
});
});
}
/**
* Returns the element at a specified index in a sequence.
* @example
* var res = source.elementAt(5);
* @param {Number} index The zero-based index of the element to retrieve.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence.
*/
observableProto.elementAt = function (index) {
return elementAtOrDefault(this, index, false);
};
/**
* Returns the element at a specified index in a sequence or a default value if the index is out of range.
* @example
* var res = source.elementAtOrDefault(5);
* var res = source.elementAtOrDefault(5, 0);
* @param {Number} index The zero-based index of the element to retrieve.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.
*/
observableProto.elementAtOrDefault = function (index, defaultValue) {
return elementAtOrDefault(this, index, true, defaultValue);
};
function singleOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (observer) {
var value = defaultValue, seenValue = false;
return source.subscribe(function (x) {
if (seenValue) {
observer.onError(new Error('Sequence contains more than one element'));
} else {
value = x;
seenValue = true;
}
}, observer.onError.bind(observer), function () {
if (!seenValue && !hasDefault) {
observer.onError(new Error(sequenceContainsNoElements));
} else {
observer.onNext(value);
observer.onCompleted();
}
});
});
}
/**
* Returns the only element of an observable sequence that satisfies the condition in the optional predicate, and reports an exception if there is not exactly one element in the observable sequence.
* @example
* var res = res = source.single();
* var res = res = source.single(function (x) { return x === 42; });
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.
*/
observableProto.single = function (predicate, thisArg) {
return predicate && isFunction(predicate) ?
this.where(predicate, thisArg).single() :
singleOrDefaultAsync(this, false);
};
/**
* Returns the only element of an observable sequence that matches the predicate, or a default value if no such element exists; this method reports an exception if there is more than one element in the observable sequence.
* @example
* var res = res = source.singleOrDefault();
* var res = res = source.singleOrDefault(function (x) { return x === 42; });
* res = source.singleOrDefault(function (x) { return x === 42; }, 0);
* res = source.singleOrDefault(null, 0);
* @memberOf Observable#
* @param {Function} predicate A predicate function to evaluate for elements in the source sequence.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.singleOrDefault = function (predicate, defaultValue, thisArg) {
return predicate && isFunction(predicate) ?
this.where(predicate, thisArg).singleOrDefault(null, defaultValue) :
singleOrDefaultAsync(this, true, defaultValue);
};
function firstOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
observer.onNext(x);
observer.onCompleted();
}, observer.onError.bind(observer), function () {
if (!hasDefault) {
observer.onError(new Error(sequenceContainsNoElements));
} else {
observer.onNext(defaultValue);
observer.onCompleted();
}
});
});
}
/**
* Returns the first element of an observable sequence that satisfies the condition in the predicate if present else the first item in the sequence.
* @example
* var res = res = source.first();
* var res = res = source.first(function (x) { return x > 3; });
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate if provided, else the first item in the sequence.
*/
observableProto.first = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).first() :
firstOrDefaultAsync(this, false);
};
/**
* Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
* @example
* var res = res = source.firstOrDefault();
* var res = res = source.firstOrDefault(function (x) { return x > 3; });
* var res = source.firstOrDefault(function (x) { return x > 3; }, 0);
* var res = source.firstOrDefault(null, 0);
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [defaultValue] The default value if no such element exists. If not specified, defaults to null.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.firstOrDefault = function (predicate, defaultValue, thisArg) {
return predicate ?
this.where(predicate).firstOrDefault(null, defaultValue) :
firstOrDefaultAsync(this, true, defaultValue);
};
function lastOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (observer) {
var value = defaultValue, seenValue = false;
return source.subscribe(function (x) {
value = x;
seenValue = true;
}, observer.onError.bind(observer), function () {
if (!seenValue && !hasDefault) {
observer.onError(new Error(sequenceContainsNoElements));
} else {
observer.onNext(value);
observer.onCompleted();
}
});
});
}
/**
* Returns the last element of an observable sequence that satisfies the condition in the predicate if specified, else the last element.
* @example
* var res = source.last();
* var res = source.last(function (x) { return x > 3; });
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.
*/
observableProto.last = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).last() :
lastOrDefaultAsync(this, false);
};
/**
* Returns the last element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
* @example
* var res = source.lastOrDefault();
* var res = source.lastOrDefault(function (x) { return x > 3; });
* var res = source.lastOrDefault(function (x) { return x > 3; }, 0);
* var res = source.lastOrDefault(null, 0);
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param [defaultValue] The default value if no such element exists. If not specified, defaults to null.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.lastOrDefault = function (predicate, defaultValue, thisArg) {
return predicate ?
this.where(predicate, thisArg).lastOrDefault(null, defaultValue) :
lastOrDefaultAsync(this, true, defaultValue);
};
function findValue (source, predicate, thisArg, yieldIndex) {
return new AnonymousObservable(function (observer) {
var i = 0;
return source.subscribe(function (x) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, x, i, source);
} catch (e) {
observer.onError(e);
return;
}
if (shouldRun) {
observer.onNext(yieldIndex ? i : x);
observer.onCompleted();
} else {
i++;
}
}, observer.onError.bind(observer), function () {
observer.onNext(yieldIndex ? -1 : undefined);
observer.onCompleted();
});
});
}
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Observable sequence.
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} An Observable sequence with the first element that matches the conditions defined by the specified predicate, if found; otherwise, undefined.
*/
observableProto.find = function (predicate, thisArg) {
return findValue(this, predicate, thisArg, false);
};
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns
* an Observable sequence with the zero-based index of the first occurrence within the entire Observable sequence.
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} An Observable sequence with the zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, –1.
*/
observableProto.findIndex = function (predicate, thisArg) {
return findValue(this, predicate, thisArg, true);
};
if (!!root.Set) {
/**
* Converts the observable sequence to a Set if it exists.
* @returns {Observable} An observable sequence with a single value of a Set containing the values from the observable sequence.
*/
observableProto.toSet = function () {
var source = this;
return new AnonymousObservable(function (observer) {
var s = new root.Set();
return source.subscribe(
s.add.bind(s),
observer.onError.bind(observer),
function () {
observer.onNext(s);
observer.onCompleted();
});
});
};
}
if (!!root.Map) {
/**
* Converts the observable sequence to a Map if it exists.
* @param {Function} keySelector A function which produces the key for the Map.
* @param {Function} [elementSelector] An optional function which produces the element for the Map. If not present, defaults to the value from the observable sequence.
* @returns {Observable} An observable sequence with a single value of a Map containing the values from the observable sequence.
*/
observableProto.toMap = function (keySelector, elementSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new root.Map();
return source.subscribe(
function (x) {
var key;
try {
key = keySelector(x);
} catch (e) {
observer.onError(e);
return;
}
var element = x;
if (elementSelector) {
try {
element = elementSelector(x);
} catch (e) {
observer.onError(e);
return;
}
}
m.set(key, element);
},
observer.onError.bind(observer),
function () {
observer.onNext(m);
observer.onCompleted();
});
});
};
}
var fnString = 'function',
throwString = 'throw';
function toThunk(obj, ctx) {
if (Array.isArray(obj)) { return objectToThunk.call(ctx, obj); }
if (isGeneratorFunction(obj)) { return observableSpawn(obj.call(ctx)); }
if (isGenerator(obj)) { return observableSpawn(obj); }
if (isObservable(obj)) { return observableToThunk(obj); }
if (isPromise(obj)) { return promiseToThunk(obj); }
if (typeof obj === fnString) { return obj; }
if (isObject(obj) || Array.isArray(obj)) { return objectToThunk.call(ctx, obj); }
return obj;
}
function objectToThunk(obj) {
var ctx = this;
return function (done) {
var keys = Object.keys(obj),
pending = keys.length,
results = new obj.constructor(),
finished;
if (!pending) {
timeoutScheduler.schedule(function () { done(null, results); });
return;
}
for (var i = 0, len = keys.length; i < len; i++) {
run(obj[keys[i]], keys[i]);
}
function run(fn, key) {
if (finished) { return; }
try {
fn = toThunk(fn, ctx);
if (typeof fn !== fnString) {
results[key] = fn;
return --pending || done(null, results);
}
fn.call(ctx, function(err, res) {
if (finished) { return; }
if (err) {
finished = true;
return done(err);
}
results[key] = res;
--pending || done(null, results);
});
} catch (e) {
finished = true;
done(e);
}
}
}
}
function observableToThunk(observable) {
return function (fn) {
var value, hasValue = false;
observable.subscribe(
function (v) {
value = v;
hasValue = true;
},
fn,
function () {
hasValue && fn(null, value);
});
}
}
function promiseToThunk(promise) {
return function(fn) {
promise.then(function(res) {
fn(null, res);
}, fn);
}
}
function isObservable(obj) {
return obj && typeof obj.subscribe === fnString;
}
function isGeneratorFunction(obj) {
return obj && obj.constructor && obj.constructor.name === 'GeneratorFunction';
}
function isGenerator(obj) {
return obj && typeof obj.next === fnString && typeof obj[throwString] === fnString;
}
function isObject(val) {
return val && val.constructor === Object;
}
/*
* Spawns a generator function which allows for Promises, Observable sequences, Arrays, Objects, Generators and functions.
* @param {Function} The spawning function.
* @returns {Function} a function which has a done continuation.
*/
var observableSpawn = Rx.spawn = function (fn) {
var isGenFun = isGeneratorFunction(fn);
return function (done) {
var ctx = this,
gen = fn;
if (isGenFun) {
var args = slice.call(arguments),
len = args.length,
hasCallback = len && typeof args[len - 1] === fnString;
done = hasCallback ? args.pop() : error;
gen = fn.apply(this, args);
} else {
done = done || error;
}
next();
function exit(err, res) {
timeoutScheduler.schedule(done.bind(ctx, err, res));
}
function next(err, res) {
var ret;
// multiple args
if (arguments.length > 2) {
res = slice.call(arguments, 1);
}
if (err) {
try {
ret = gen[throwString](err);
} catch (e) {
return exit(e);
}
}
if (!err) {
try {
ret = gen.next(res);
} catch (e) {
return exit(e);
}
}
if (ret.done) {
return exit(null, ret.value);
}
ret.value = toThunk(ret.value, ctx);
if (typeof ret.value === fnString) {
var called = false;
try {
ret.value.call(ctx, function() {
if (called) {
return;
}
called = true;
next.apply(ctx, arguments);
});
} catch (e) {
timeoutScheduler.schedule(function () {
if (called) {
return;
}
called = true;
next.call(ctx, e);
});
}
return;
}
// Not supported
next(new TypeError('Rx.spawn only supports a function, Promise, Observable, Object or Array.'));
}
}
};
/**
* Takes a function with a callback and turns it into a thunk.
* @param {Function} A function with a callback such as fs.readFile
* @returns {Function} A function, when executed will continue the state machine.
*/
Rx.denodify = function (fn) {
return function () {
var args = slice.call(arguments),
results,
called,
callback;
args.push(function() {
results = arguments;
if (callback && !called) {
called = true;
cb.apply(this, results);
}
});
fn.apply(this, args);
return function (fn) {
callback = fn;
if (results && !called) {
called = true;
fn.apply(this, results);
}
}
}
};
function error(err) {
if (!err) { return; }
timeoutScheduler.schedule(function() {
throw err;
});
}
/**
* Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
*
* @example
* var res = Rx.Observable.start(function () { console.log('hello'); });
* var res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout);
* var res = Rx.Observable.start(function () { this.log('hello'); }, Rx.Scheduler.timeout, console);
*
* @param {Function} func Function to run asynchronously.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*
* Remarks
* * The function is called immediately, not during the subscription of the resulting sequence.
* * Multiple subscriptions to the resulting sequence can observe the function's result.
*/
Observable.start = function (func, context, scheduler) {
return observableToAsync(func, context, scheduler)();
};
/**
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
*
* @example
* var res = Rx.Observable.toAsync(function (x, y) { return x + y; })(4, 3);
* var res = Rx.Observable.toAsync(function (x, y) { return x + y; }, Rx.Scheduler.timeout)(4, 3);
* var res = Rx.Observable.toAsync(function (x) { this.log(x); }, Rx.Scheduler.timeout, console)('hello');
*
* @param {Function} function Function to convert to an asynchronous function.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Function} Asynchronous function.
*/
var observableToAsync = Observable.toAsync = function (func, context, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return function () {
var args = arguments,
subject = new AsyncSubject();
scheduler.schedule(function () {
var result;
try {
result = func.apply(context, args);
} catch (e) {
subject.onError(e);
return;
}
subject.onNext(result);
subject.onCompleted();
});
return subject.asObservable();
};
};
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
Observable.fromCallback = function (func, context, selector) {
return function () {
var args = slice.call(arguments, 0);
return new AnonymousObservable(function (observer) {
function handler(e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
observer.onError(err);
return;
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
Observable.fromNodeCallback = function (func, context, selector) {
return function () {
var args = slice.call(arguments, 0);
return new AnonymousObservable(function (observer) {
function handler(err) {
if (err) {
observer.onError(err);
return;
}
var results = slice.call(arguments, 1);
if (selector) {
try {
results = selector(results);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
function fixEvent(event) {
var stopPropagation = function () {
this.cancelBubble = true;
};
var preventDefault = function () {
this.bubbledKeyCode = this.keyCode;
if (this.ctrlKey) {
try {
this.keyCode = 0;
} catch (e) { }
}
this.defaultPrevented = true;
this.returnValue = false;
this.modified = true;
};
event || (event = root.event);
if (!event.target) {
event.target = event.target || event.srcElement;
if (event.type == 'mouseover') {
event.relatedTarget = event.fromElement;
}
if (event.type == 'mouseout') {
event.relatedTarget = event.toElement;
}
// Adding stopPropogation and preventDefault to IE
if (!event.stopPropagation) {
event.stopPropagation = stopPropagation;
event.preventDefault = preventDefault;
}
// Normalize key events
switch (event.type) {
case 'keypress':
var c = ('charCode' in event ? event.charCode : event.keyCode);
if (c == 10) {
c = 0;
event.keyCode = 13;
} else if (c == 13 || c == 27) {
c = 0;
} else if (c == 3) {
c = 99;
}
event.charCode = c;
event.keyChar = event.charCode ? String.fromCharCode(event.charCode) : '';
break;
}
}
return event;
}
function createListener (element, name, handler) {
// Standards compliant
if (element.addEventListener) {
element.addEventListener(name, handler, false);
return disposableCreate(function () {
element.removeEventListener(name, handler, false);
});
}
if (element.attachEvent) {
// IE Specific
var innerHandler = function (event) {
handler(fixEvent(event));
};
element.attachEvent('on' + name, innerHandler);
return disposableCreate(function () {
element.detachEvent('on' + name, innerHandler);
});
}
// Level 1 DOM Events
element['on' + name] = handler;
return disposableCreate(function () {
element['on' + name] = null;
});
}
function createEventListener (el, eventName, handler) {
var disposables = new CompositeDisposable();
// Asume NodeList
if (Object.prototype.toString.call(el) === '[object NodeList]') {
for (var i = 0, len = el.length; i < len; i++) {
disposables.add(createEventListener(el.item(i), eventName, handler));
}
} else if (el) {
disposables.add(createListener(el, eventName, handler));
}
return disposables;
}
/**
* Configuration option to determine whether to use native events only
*/
Rx.config.useNativeEvents = false;
// Check for Angular/jQuery/Zepto support
var jq =
!!root.angular && !!angular.element ? angular.element :
(!!root.jQuery ? root.jQuery : (
!!root.Zepto ? root.Zepto : null));
// Check for ember
var ember = !!root.Ember && typeof root.Ember.addListener === 'function';
// Check for Backbone.Marionette. Note if using AMD add Marionette as a dependency of rxjs
// for proper loading order!
var marionette = !!root.Backbone && !!root.Backbone.Marionette;
/**
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
*
* @example
* var source = Rx.Observable.fromEvent(element, 'mouseup');
*
* @param {Object} element The DOMElement or NodeList to attach a listener.
* @param {String} eventName The event name to attach the observable sequence.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
*/
Observable.fromEvent = function (element, eventName, selector) {
// Node.js specific
if (element.addListener) {
return fromEventPattern(
function (h) { element.addListener(eventName, h); },
function (h) { element.removeListener(eventName, h); },
selector);
}
// Use only if non-native events are allowed
if (!Rx.config.useNativeEvents) {
if (marionette) {
return fromEventPattern(
function (h) { element.on(eventName, h); },
function (h) { element.off(eventName, h); },
selector);
}
if (ember) {
return fromEventPattern(
function (h) { Ember.addListener(element, eventName, h); },
function (h) { Ember.removeListener(element, eventName, h); },
selector);
}
if (jq) {
var $elem = jq(element);
return fromEventPattern(
function (h) { $elem.on(eventName, h); },
function (h) { $elem.off(eventName, h); },
selector);
}
}
return new AnonymousObservable(function (observer) {
return createEventListener(
element,
eventName,
function handler (e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
observer.onError(err);
return
}
}
observer.onNext(results);
});
}).publish().refCount();
};
/**
* Creates an observable sequence from an event emitter via an addHandler/removeHandler pair.
* @param {Function} addHandler The function to add a handler to the emitter.
* @param {Function} [removeHandler] The optional function to remove a handler from an emitter.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
return new AnonymousObservable(function (observer) {
function innerHandler (e) {
var result = e;
if (selector) {
try {
result = selector(arguments);
} catch (err) {
observer.onError(err);
return;
}
}
observer.onNext(result);
}
var returnValue = addHandler(innerHandler);
return disposableCreate(function () {
if (removeHandler) {
removeHandler(innerHandler, returnValue);
}
});
}).publish().refCount();
};
/**
* Invokes the asynchronous function, surfacing the result through an observable sequence.
* @param {Function} functionAsync Asynchronous function which returns a Promise to run.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*/
Observable.startAsync = function (functionAsync) {
var promise;
try {
promise = functionAsync();
} catch (e) {
return observableThrow(e);
}
return observableFromPromise(promise);
}
var PausableObservable = (function (_super) {
inherits(PausableObservable, _super);
function subscribe(observer) {
var conn = this.source.publish(),
subscription = conn.subscribe(observer),
connection = disposableEmpty;
var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {
if (b) {
connection = conn.connect();
} else {
connection.dispose();
connection = disposableEmpty;
}
});
return new CompositeDisposable(subscription, connection, pausable);
}
function PausableObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
_super.call(this, subscribe);
}
PausableObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausable(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausable = function (pauser) {
return new PausableObservable(this, pauser);
};
function combineLatestSource(source, subject, resultSelector) {
return new AnonymousObservable(function (observer) {
var hasValue = [false, false],
hasValueAll = false,
isDone = false,
values = new Array(2),
err;
function next(x, i) {
values[i] = x
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
if (err) {
observer.onError(err);
return;
}
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
}
if (isDone && values[1]) {
observer.onCompleted();
}
}
return new CompositeDisposable(
source.subscribe(
function (x) {
next(x, 0);
},
function (e) {
if (values[1]) {
observer.onError(e);
} else {
err = e;
}
},
function () {
isDone = true;
values[1] && observer.onCompleted();
}),
subject.subscribe(
function (x) {
next(x, 1);
},
observer.onError.bind(observer),
function () {
isDone = true;
next(true, 1);
})
);
});
}
var PausableBufferedObservable = (function (__super__) {
inherits(PausableBufferedObservable, __super__);
function subscribe(observer) {
var q = [], previousShouldFire;
var subscription =
combineLatestSource(
this.source,
this.pauser.distinctUntilChanged().startWith(false),
function (data, shouldFire) {
return { data: data, shouldFire: shouldFire };
})
.subscribe(
function (results) {
if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) {
previousShouldFire = results.shouldFire;
// change in shouldFire
if (results.shouldFire) {
while (q.length > 0) {
observer.onNext(q.shift());
}
}
} else {
previousShouldFire = results.shouldFire;
// new data
if (results.shouldFire) {
observer.onNext(results.data);
} else {
q.push(results.data);
}
}
},
function (err) {
// Empty buffer before sending error
while (q.length > 0) {
observer.onNext(q.shift());
}
observer.onError(err);
},
function () {
// Empty buffer before sending completion
while (q.length > 0) {
observer.onNext(q.shift());
}
observer.onCompleted();
}
);
return subscription;
}
function PausableBufferedObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
__super__.call(this, subscribe);
}
PausableBufferedObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableBufferedObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableBufferedObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false,
* and yields the values that were buffered while paused.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausableBuffered(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausableBuffered = function (subject) {
return new PausableBufferedObservable(this, subject);
};
/**
* Attaches a controller to the observable sequence with the ability to queue.
* @example
* var source = Rx.Observable.interval(100).controlled();
* source.request(3); // Reads 3 values
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.controlled = function (enableQueue) {
if (enableQueue == null) { enableQueue = true; }
return new ControlledObservable(this, enableQueue);
};
var ControlledObservable = (function (_super) {
inherits(ControlledObservable, _super);
function subscribe (observer) {
return this.source.subscribe(observer);
}
function ControlledObservable (source, enableQueue) {
_super.call(this, subscribe);
this.subject = new ControlledSubject(enableQueue);
this.source = source.multicast(this.subject).refCount();
}
ControlledObservable.prototype.request = function (numberOfItems) {
if (numberOfItems == null) { numberOfItems = -1; }
return this.subject.request(numberOfItems);
};
return ControlledObservable;
}(Observable));
var ControlledSubject = Rx.ControlledSubject = (function (_super) {
function subscribe (observer) {
return this.subject.subscribe(observer);
}
inherits(ControlledSubject, _super);
function ControlledSubject(enableQueue) {
if (enableQueue == null) {
enableQueue = true;
}
_super.call(this, subscribe);
this.subject = new Subject();
this.enableQueue = enableQueue;
this.queue = enableQueue ? [] : null;
this.requestedCount = 0;
this.requestedDisposable = disposableEmpty;
this.error = null;
this.hasFailed = false;
this.hasCompleted = false;
this.controlledDisposable = disposableEmpty;
}
addProperties(ControlledSubject.prototype, Observer, {
onCompleted: function () {
checkDisposed.call(this);
this.hasCompleted = true;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onCompleted();
}
},
onError: function (error) {
checkDisposed.call(this);
this.hasFailed = true;
this.error = error;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onError(error);
}
},
onNext: function (value) {
checkDisposed.call(this);
var hasRequested = false;
if (this.requestedCount === 0) {
if (this.enableQueue) {
this.queue.push(value);
}
} else {
if (this.requestedCount !== -1) {
if (this.requestedCount-- === 0) {
this.disposeCurrentRequest();
}
}
hasRequested = true;
}
if (hasRequested) {
this.subject.onNext(value);
}
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
//console.log('queue length', this.queue.length);
while (this.queue.length >= numberOfItems && numberOfItems > 0) {
//console.log('number of items', numberOfItems);
this.subject.onNext(this.queue.shift());
numberOfItems--;
}
if (this.queue.length !== 0) {
return { numberOfItems: numberOfItems, returnValue: true };
} else {
return { numberOfItems: numberOfItems, returnValue: false };
}
}
if (this.hasFailed) {
this.subject.onError(this.error);
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
} else if (this.hasCompleted) {
this.subject.onCompleted();
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
}
return { numberOfItems: numberOfItems, returnValue: false };
},
request: function (number) {
checkDisposed.call(this);
this.disposeCurrentRequest();
var self = this,
r = this._processRequest(number);
number = r.numberOfItems;
if (!r.returnValue) {
this.requestedCount = number;
this.requestedDisposable = disposableCreate(function () {
self.requestedCount = 0;
});
return this.requestedDisposable
} else {
return disposableEmpty;
}
},
disposeCurrentRequest: function () {
this.requestedDisposable.dispose();
this.requestedDisposable = disposableEmpty;
},
dispose: function () {
this.isDisposed = true;
this.error = null;
this.subject.dispose();
this.requestedDisposable.dispose();
}
});
return ControlledSubject;
}(Observable));
/**
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
* subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
* invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param {Function|Subject} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
* Or:
* Subject to push source elements into.
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.multicast = function (subjectOrSubjectSelector, selector) {
var source = this;
return typeof subjectOrSubjectSelector === 'function' ?
new AnonymousObservable(function (observer) {
var connectable = source.multicast(subjectOrSubjectSelector());
return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect());
}) :
new ConnectableObservable(source, subjectOrSubjectSelector);
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of Multicast using a regular Subject.
*
* @example
* var resres = source.publish();
* var res = source.publish(function (x) { return x; });
*
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publish = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new Subject(); }, selector) :
this.multicast(new Subject());
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.share();
*
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.share = function () {
return this.publish().refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
* This operator is a specialization of Multicast using a AsyncSubject.
*
* @example
* var res = source.publishLast();
* var res = source.publishLast(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishLast = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new AsyncSubject(); }, selector) :
this.multicast(new AsyncSubject());
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
* This operator is a specialization of Multicast using a BehaviorSubject.
*
* @example
* var res = source.publishValue(42);
* var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishValue = function (initialValueOrSelector, initialValue) {
return arguments.length === 2 ?
this.multicast(function () {
return new BehaviorSubject(initialValue);
}, initialValueOrSelector) :
this.multicast(new BehaviorSubject(initialValueOrSelector));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareValue(42);
*
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareValue = function (initialValue) {
return this.publishValue(initialValue).refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of Multicast using a ReplaySubject.
*
* @example
* var res = source.replay(null, 3);
* var res = source.replay(null, 3, 500);
* var res = source.replay(null, 3, 500, scheduler);
* var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.replay = function (selector, bufferSize, window, scheduler) {
return selector && isFunction(selector) ?
this.multicast(function () { return new ReplaySubject(bufferSize, window, scheduler); }, selector) :
this.multicast(new ReplaySubject(bufferSize, window, scheduler));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareReplay(3);
* var res = source.shareReplay(3, 500);
* var res = source.shareReplay(3, 500, scheduler);
*
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareReplay = function (bufferSize, window, scheduler) {
return this.replay(null, bufferSize, window, scheduler).refCount();
};
/** @private */
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
/**
* @private
* @memberOf InnerSubscription
*/
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents a value that changes over time.
* Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
*/
var BehaviorSubject = Rx.BehaviorSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
observer.onNext(this.value);
return new InnerSubscription(this, observer);
}
var ex = this.exception;
if (ex) {
observer.onError(ex);
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(BehaviorSubject, __super__);
/**
* @constructor
* Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value.
* @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet.
*/
function BehaviorSubject(value) {
__super__.call(this, subscribe);
this.value = value,
this.observers = [],
this.isDisposed = false,
this.isStopped = false,
this.exception = null;
}
addProperties(BehaviorSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.isStopped = true;
for (var i = 0, os = this.observers.slice(0), len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.exception = error;
for (var i = 0, os = this.observers.slice(0), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers = [];
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.value = value;
for (var i = 0, os = this.observers.slice(0), len = os.length; i < len; i++) {
os[i].onNext(value);
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.value = null;
this.exception = null;
}
});
return BehaviorSubject;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
*/
var ReplaySubject = Rx.ReplaySubject = (function (__super__) {
function createRemovableDisposable(subject, observer) {
return disposableCreate(function () {
observer.dispose();
!subject.isDisposed && subject.observers.splice(subject.observers.indexOf(observer), 1);
});
}
function subscribe(observer) {
var so = new ScheduledObserver(this.scheduler, observer),
subscription = createRemovableDisposable(this, so);
checkDisposed.call(this);
this._trim(this.scheduler.now());
this.observers.push(so);
var n = this.q.length;
for (var i = 0, len = this.q.length; i < len; i++) {
so.onNext(this.q[i].value);
}
if (this.hasError) {
n++;
so.onError(this.error);
} else if (this.isStopped) {
n++;
so.onCompleted();
}
so.ensureActive(n);
return subscription;
}
inherits(ReplaySubject, __super__);
/**
* Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.
* @param {Number} [bufferSize] Maximum element count of the replay buffer.
* @param {Number} [windowSize] Maximum time length of the replay buffer.
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
*/
function ReplaySubject(bufferSize, windowSize, scheduler) {
this.bufferSize = bufferSize == null ? Number.MAX_VALUE : bufferSize;
this.windowSize = windowSize == null ? Number.MAX_VALUE : windowSize;
this.scheduler = scheduler || currentThreadScheduler;
this.q = [];
this.observers = [];
this.isStopped = false;
this.isDisposed = false;
this.hasError = false;
this.error = null;
__super__.call(this, subscribe);
}
addProperties(ReplaySubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
_trim: function (now) {
while (this.q.length > this.bufferSize) {
this.q.shift();
}
while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) {
this.q.shift();
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (this.isStopped) { return; }
var now = this.scheduler.now();
this.q.push({ interval: now, value: value });
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
var observer = o[i];
observer.onNext(value);
observer.ensureActive();
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.error = error;
this.hasError = true;
var now = this.scheduler.now();
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
var observer = o[i];
observer.onError(error);
observer.ensureActive();
}
this.observers = [];
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.isStopped = true;
var now = this.scheduler.now();
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
var observer = o[i];
observer.onCompleted();
observer.ensureActive();
}
this.observers = [];
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
return ReplaySubject;
}(Observable));
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
inherits(ConnectableObservable, __super__);
function ConnectableObservable(source, subject) {
var hasSubscription = false,
subscription,
sourceObservable = source.asObservable();
this.connect = function () {
if (!hasSubscription) {
hasSubscription = true;
subscription = new CompositeDisposable(sourceObservable.subscribe(subject), disposableCreate(function () {
hasSubscription = false;
}));
}
return subscription;
};
__super__.call(this, subject.subscribe.bind(subject));
}
ConnectableObservable.prototype.refCount = function () {
var connectableSubscription, count = 0, source = this;
return new AnonymousObservable(function (observer) {
var shouldConnect = ++count === 1,
subscription = source.subscribe(observer);
shouldConnect && (connectableSubscription = source.connect());
return function () {
subscription.dispose();
--count === 0 && connectableSubscription.dispose();
};
});
};
return ConnectableObservable;
}(Observable));
var Dictionary = (function () {
var primes = [1, 3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859, 134217689, 268435399, 536870909, 1073741789, 2147483647],
noSuchkey = "no such key",
duplicatekey = "duplicate key";
function isPrime(candidate) {
if (candidate & 1 === 0) { return candidate === 2; }
var num1 = Math.sqrt(candidate),
num2 = 3;
while (num2 <= num1) {
if (candidate % num2 === 0) { return false; }
num2 += 2;
}
return true;
}
function getPrime(min) {
var index, num, candidate;
for (index = 0; index < primes.length; ++index) {
num = primes[index];
if (num >= min) { return num; }
}
candidate = min | 1;
while (candidate < primes[primes.length - 1]) {
if (isPrime(candidate)) { return candidate; }
candidate += 2;
}
return min;
}
function stringHashFn(str) {
var hash = 757602046;
if (!str.length) { return hash; }
for (var i = 0, len = str.length; i < len; i++) {
var character = str.charCodeAt(i);
hash = ((hash << 5) - hash) + character;
hash = hash & hash;
}
return hash;
}
function numberHashFn(key) {
var c2 = 0x27d4eb2d;
key = (key ^ 61) ^ (key >>> 16);
key = key + (key << 3);
key = key ^ (key >>> 4);
key = key * c2;
key = key ^ (key >>> 15);
return key;
}
var getHashCode = (function () {
var uniqueIdCounter = 0;
return function (obj) {
if (obj == null) { throw new Error(noSuchkey); }
// Check for built-ins before tacking on our own for any object
if (typeof obj === 'string') { return stringHashFn(obj); }
if (typeof obj === 'number') { return numberHashFn(obj); }
if (typeof obj === 'boolean') { return obj === true ? 1 : 0; }
if (obj instanceof Date) { return numberHashFn(obj.valueOf()); }
if (obj instanceof RegExp) { return stringHashFn(obj.toString()); }
if (typeof obj.valueOf === 'function') {
// Hack check for valueOf
var valueOf = obj.valueOf();
if (typeof valueOf === 'number') { return numberHashFn(valueOf); }
if (typeof obj === 'string') { return stringHashFn(valueOf); }
}
if (obj.getHashCode) { return obj.getHashCode(); }
var id = 17 * uniqueIdCounter++;
obj.getHashCode = function () { return id; };
return id;
};
}());
function newEntry() {
return { key: null, value: null, next: 0, hashCode: 0 };
}
function Dictionary(capacity, comparer) {
if (capacity < 0) { throw new Error('out of range'); }
if (capacity > 0) { this._initialize(capacity); }
this.comparer = comparer || defaultComparer;
this.freeCount = 0;
this.size = 0;
this.freeList = -1;
}
var dictionaryProto = Dictionary.prototype;
dictionaryProto._initialize = function (capacity) {
var prime = getPrime(capacity), i;
this.buckets = new Array(prime);
this.entries = new Array(prime);
for (i = 0; i < prime; i++) {
this.buckets[i] = -1;
this.entries[i] = newEntry();
}
this.freeList = -1;
};
dictionaryProto.add = function (key, value) {
return this._insert(key, value, true);
};
dictionaryProto._insert = function (key, value, add) {
if (!this.buckets) { this._initialize(0); }
var index3,
num = getHashCode(key) & 2147483647,
index1 = num % this.buckets.length;
for (var index2 = this.buckets[index1]; index2 >= 0; index2 = this.entries[index2].next) {
if (this.entries[index2].hashCode === num && this.comparer(this.entries[index2].key, key)) {
if (add) { throw new Error(duplicatekey); }
this.entries[index2].value = value;
return;
}
}
if (this.freeCount > 0) {
index3 = this.freeList;
this.freeList = this.entries[index3].next;
--this.freeCount;
} else {
if (this.size === this.entries.length) {
this._resize();
index1 = num % this.buckets.length;
}
index3 = this.size;
++this.size;
}
this.entries[index3].hashCode = num;
this.entries[index3].next = this.buckets[index1];
this.entries[index3].key = key;
this.entries[index3].value = value;
this.buckets[index1] = index3;
};
dictionaryProto._resize = function () {
var prime = getPrime(this.size * 2),
numArray = new Array(prime);
for (index = 0; index < numArray.length; ++index) { numArray[index] = -1; }
var entryArray = new Array(prime);
for (index = 0; index < this.size; ++index) { entryArray[index] = this.entries[index]; }
for (var index = this.size; index < prime; ++index) { entryArray[index] = newEntry(); }
for (var index1 = 0; index1 < this.size; ++index1) {
var index2 = entryArray[index1].hashCode % prime;
entryArray[index1].next = numArray[index2];
numArray[index2] = index1;
}
this.buckets = numArray;
this.entries = entryArray;
};
dictionaryProto.remove = function (key) {
if (this.buckets) {
var num = getHashCode(key) & 2147483647,
index1 = num % this.buckets.length,
index2 = -1;
for (var index3 = this.buckets[index1]; index3 >= 0; index3 = this.entries[index3].next) {
if (this.entries[index3].hashCode === num && this.comparer(this.entries[index3].key, key)) {
if (index2 < 0) {
this.buckets[index1] = this.entries[index3].next;
} else {
this.entries[index2].next = this.entries[index3].next;
}
this.entries[index3].hashCode = -1;
this.entries[index3].next = this.freeList;
this.entries[index3].key = null;
this.entries[index3].value = null;
this.freeList = index3;
++this.freeCount;
return true;
} else {
index2 = index3;
}
}
}
return false;
};
dictionaryProto.clear = function () {
var index, len;
if (this.size <= 0) { return; }
for (index = 0, len = this.buckets.length; index < len; ++index) {
this.buckets[index] = -1;
}
for (index = 0; index < this.size; ++index) {
this.entries[index] = newEntry();
}
this.freeList = -1;
this.size = 0;
};
dictionaryProto._findEntry = function (key) {
if (this.buckets) {
var num = getHashCode(key) & 2147483647;
for (var index = this.buckets[num % this.buckets.length]; index >= 0; index = this.entries[index].next) {
if (this.entries[index].hashCode === num && this.comparer(this.entries[index].key, key)) {
return index;
}
}
}
return -1;
};
dictionaryProto.count = function () {
return this.size - this.freeCount;
};
dictionaryProto.tryGetValue = function (key) {
var entry = this._findEntry(key);
return entry >= 0 ?
this.entries[entry].value :
undefined;
};
dictionaryProto.getValues = function () {
var index = 0, results = [];
if (this.entries) {
for (var index1 = 0; index1 < this.size; index1++) {
if (this.entries[index1].hashCode >= 0) {
results[index++] = this.entries[index1].value;
}
}
}
return results;
};
dictionaryProto.get = function (key) {
var entry = this._findEntry(key);
if (entry >= 0) { return this.entries[entry].value; }
throw new Error(noSuchkey);
};
dictionaryProto.set = function (key, value) {
this._insert(key, value, false);
};
dictionaryProto.containskey = function (key) {
return this._findEntry(key) >= 0;
};
return Dictionary;
}());
/**
* Correlates the elements of two sequences based on overlapping durations.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
var left = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable();
var leftDone = false, rightDone = false;
var leftId = 0, rightId = 0;
var leftMap = new Dictionary(), rightMap = new Dictionary();
group.add(left.subscribe(
function (value) {
var id = leftId++;
var md = new SingleAssignmentDisposable();
leftMap.add(id, value);
group.add(md);
var expire = function () {
leftMap.remove(id) && leftMap.count() === 0 && leftDone && observer.onCompleted();
group.remove(md);
};
var duration;
try {
duration = leftDurationSelector(value);
} catch (e) {
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), expire));
rightMap.getValues().forEach(function (v) {
var result;
try {
result = resultSelector(value, v);
} catch (exn) {
observer.onError(exn);
return;
}
observer.onNext(result);
});
},
observer.onError.bind(observer),
function () {
leftDone = true;
(rightDone || leftMap.count() === 0) && observer.onCompleted();
})
);
group.add(right.subscribe(
function (value) {
var id = rightId++;
var md = new SingleAssignmentDisposable();
rightMap.add(id, value);
group.add(md);
var expire = function () {
rightMap.remove(id) && rightMap.count() === 0 && rightDone && observer.onCompleted();
group.remove(md);
};
var duration;
try {
duration = rightDurationSelector(value);
} catch (e) {
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), expire));
leftMap.getValues().forEach(function (v) {
var result;
try {
result = resultSelector(v, value);
} catch (exn) {
observer.onError(exn);
return;
}
observer.onNext(result);
});
},
observer.onError.bind(observer),
function () {
rightDone = true;
(leftDone || rightMap.count() === 0) && observer.onCompleted();
})
);
return group;
});
};
/**
* Correlates the elements of two sequences based on overlapping durations, and groups the results.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
observableProto.groupJoin = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
var left = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable();
var r = new RefCountDisposable(group);
var leftMap = new Dictionary(), rightMap = new Dictionary();
var leftId = 0, rightId = 0;
function handleError(e) { return function (v) { v.onError(e); }; };
group.add(left.subscribe(
function (value) {
var s = new Subject();
var id = leftId++;
leftMap.add(id, s);
var result;
try {
result = resultSelector(value, addRef(s, r));
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
observer.onNext(result);
rightMap.getValues().forEach(function (v) { s.onNext(v); });
var md = new SingleAssignmentDisposable();
group.add(md);
var expire = function () {
leftMap.remove(id) && s.onCompleted();
group.remove(md);
};
var duration;
try {
duration = leftDurationSelector(value);
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(
noop,
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
expire)
);
},
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
observer.onCompleted.bind(observer))
);
group.add(right.subscribe(
function (value) {
var id = rightId++;
rightMap.add(id, value);
var md = new SingleAssignmentDisposable();
group.add(md);
var expire = function () {
rightMap.remove(id);
group.remove(md);
};
var duration;
try {
duration = rightDurationSelector(value);
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(
noop,
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
expire)
);
leftMap.getValues().forEach(function (v) { v.onNext(value); });
},
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
})
);
return r;
});
};
/**
* Projects each element of an observable sequence into zero or more buffers.
*
* @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.buffer = function (bufferOpeningsOrClosingSelector, bufferClosingSelector) {
return this.window.apply(this, arguments).selectMany(function (x) { return x.toArray(); });
};
/**
* Projects each element of an observable sequence into zero or more windows.
*
* @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.window = function (windowOpeningsOrClosingSelector, windowClosingSelector) {
if (arguments.length === 1 && typeof arguments[0] !== 'function') {
return observableWindowWithBounaries.call(this, windowOpeningsOrClosingSelector);
}
return typeof windowOpeningsOrClosingSelector === 'function' ?
observableWindowWithClosingSelector.call(this, windowOpeningsOrClosingSelector) :
observableWindowWithOpenings.call(this, windowOpeningsOrClosingSelector, windowClosingSelector);
};
function observableWindowWithOpenings(windowOpenings, windowClosingSelector) {
return windowOpenings.groupJoin(this, windowClosingSelector, observableEmpty, function (_, win) {
return win;
});
}
function observableWindowWithBounaries(windowBoundaries) {
var source = this;
return new AnonymousObservable(function (observer) {
var win = new Subject(),
d = new CompositeDisposable(),
r = new RefCountDisposable(d);
observer.onNext(addRef(win, r));
d.add(source.subscribe(function (x) {
win.onNext(x);
}, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
observer.onCompleted();
}));
isPromise(windowBoundaries) && (windowBoundaries = observableFromPromise(windowBoundaries));
d.add(windowBoundaries.subscribe(function (w) {
win.onCompleted();
win = new Subject();
observer.onNext(addRef(win, r));
}, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
observer.onCompleted();
}));
return r;
});
}
function observableWindowWithClosingSelector(windowClosingSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SerialDisposable(),
d = new CompositeDisposable(m),
r = new RefCountDisposable(d),
win = new Subject();
observer.onNext(addRef(win, r));
d.add(source.subscribe(function (x) {
win.onNext(x);
}, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
observer.onCompleted();
}));
function createWindowClose () {
var windowClose;
try {
windowClose = windowClosingSelector();
} catch (e) {
observer.onError(e);
return;
}
isPromise(windowClose) && (windowClose = observableFromPromise(windowClose));
var m1 = new SingleAssignmentDisposable();
m.setDisposable(m1);
m1.setDisposable(windowClose.take(1).subscribe(noop, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
win = new Subject();
observer.onNext(addRef(win, r));
createWindowClose();
}));
}
createWindowClose();
return r;
});
}
/**
* Returns a new observable that triggers on the second and subsequent triggerings of the input observable.
* The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair.
* The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs.
* @returns {Observable} An observable that triggers on successive pairs of observations from the input observable as an array.
*/
observableProto.pairwise = function () {
var source = this;
return new AnonymousObservable(function (observer) {
var previous, hasPrevious = false;
return source.subscribe(
function (x) {
if (hasPrevious) {
observer.onNext([previous, x]);
} else {
hasPrevious = true;
}
previous = x;
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer));
});
};
/**
* Returns two observables which partition the observations of the source by the given function.
* The first will trigger observations for those values for which the predicate returns true.
* The second will trigger observations for those values where the predicate returns false.
* The predicate is executed once for each subscribed observer.
* Both also propagate all error observations arising from the source and each completes
* when the source completes.
* @param {Function} predicate
* The function to determine which output Observable will trigger a particular observation.
* @returns {Array}
* An array of observables. The first triggers when the predicate returns true,
* and the second triggers when the predicate returns false.
*/
observableProto.partition = function(predicate, thisArg) {
var published = this.publish().refCount();
return [
published.filter(predicate, thisArg),
published.filter(function (x, i, o) { return !predicate.call(thisArg, x, i, o); })
];
};
function enumerableWhile(condition, source) {
return new Enumerable(function () {
return new Enumerator(function () {
return condition() ?
{ done: false, value: source } :
{ done: true, value: undefined };
});
});
}
/**
* Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
* This operator allows for a fluent style of writing queries that use the same sequence multiple times.
*
* @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.letBind = observableProto['let'] = function (func) {
return func(this);
};
/**
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
*
* @example
* 1 - res = Rx.Observable.if(condition, obs1);
* 2 - res = Rx.Observable.if(condition, obs1, obs2);
* 3 - res = Rx.Observable.if(condition, obs1, scheduler);
* @param {Function} condition The condition which determines if the thenSource or elseSource will be run.
* @param {Observable} thenSource The observable sequence or Promise that will be run if the condition function returns true.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
* @returns {Observable} An observable sequence which is either the thenSource or elseSource.
*/
Observable['if'] = Observable.ifThen = function (condition, thenSource, elseSourceOrScheduler) {
return observableDefer(function () {
elseSourceOrScheduler || (elseSourceOrScheduler = observableEmpty());
isPromise(thenSource) && (thenSource = observableFromPromise(thenSource));
isPromise(elseSourceOrScheduler) && (elseSourceOrScheduler = observableFromPromise(elseSourceOrScheduler));
// Assume a scheduler for empty only
typeof elseSourceOrScheduler.now === 'function' && (elseSourceOrScheduler = observableEmpty(elseSourceOrScheduler));
return condition() ? thenSource : elseSourceOrScheduler;
});
};
/**
* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
* There is an alias for this method called 'forIn' for browsers <IE9
* @param {Array} sources An array of values to turn into an observable sequence.
* @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @returns {Observable} An observable sequence from the concatenated observable sequences.
*/
Observable['for'] = Observable.forIn = function (sources, resultSelector, thisArg) {
return enumerableOf(sources, resultSelector, thisArg).concat();
};
/**
* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
var observableWhileDo = Observable['while'] = Observable.whileDo = function (condition, source) {
isPromise(source) && (source = observableFromPromise(source));
return enumerableWhile(condition, source).concat();
};
/**
* Repeats source as long as condition holds emulating a do while loop.
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
observableProto.doWhile = function (condition) {
return observableConcat([this, observableWhileDo(condition, this)]);
};
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @param {Function} selector The function which extracts the value for to test in a case statement.
* @param {Array} sources A object which has keys which correspond to the case statement labels.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.
*
* @returns {Observable} An observable sequence which is determined by a case statement.
*/
Observable['case'] = Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) {
return observableDefer(function () {
isPromise(defaultSourceOrScheduler) && (defaultSourceOrScheduler = observableFromPromise(defaultSourceOrScheduler));
defaultSourceOrScheduler || (defaultSourceOrScheduler = observableEmpty());
typeof defaultSourceOrScheduler.now === 'function' && (defaultSourceOrScheduler = observableEmpty(defaultSourceOrScheduler));
var result = sources[selector()];
isPromise(result) && (result = observableFromPromise(result));
return result || defaultSourceOrScheduler;
});
};
/**
* Expands an observable sequence by recursively invoking selector.
*
* @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
* @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
* @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion.
*/
observableProto.expand = function (selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var q = [],
m = new SerialDisposable(),
d = new CompositeDisposable(m),
activeCount = 0,
isAcquired = false;
var ensureActive = function () {
var isOwner = false;
if (q.length > 0) {
isOwner = !isAcquired;
isAcquired = true;
}
if (isOwner) {
m.setDisposable(scheduler.scheduleRecursive(function (self) {
var work;
if (q.length > 0) {
work = q.shift();
} else {
isAcquired = false;
return;
}
var m1 = new SingleAssignmentDisposable();
d.add(m1);
m1.setDisposable(work.subscribe(function (x) {
observer.onNext(x);
var result = null;
try {
result = selector(x);
} catch (e) {
observer.onError(e);
}
q.push(result);
activeCount++;
ensureActive();
}, observer.onError.bind(observer), function () {
d.remove(m1);
activeCount--;
if (activeCount === 0) {
observer.onCompleted();
}
}));
self();
}));
}
};
q.push(source);
activeCount++;
ensureActive();
return d;
});
};
/**
* Runs all observable sequences in parallel and collect their last elements.
*
* @example
* 1 - res = Rx.Observable.forkJoin([obs1, obs2]);
* 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
* @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.
*/
Observable.forkJoin = function () {
var allSources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (subscriber) {
var count = allSources.length;
if (count === 0) {
subscriber.onCompleted();
return disposableEmpty;
}
var group = new CompositeDisposable(),
finished = false,
hasResults = new Array(count),
hasCompleted = new Array(count),
results = new Array(count);
for (var idx = 0; idx < count; idx++) {
(function (i) {
var source = allSources[i];
isPromise(source) && (source = observableFromPromise(source));
group.add(
source.subscribe(
function (value) {
if (!finished) {
hasResults[i] = true;
results[i] = value;
}
},
function (e) {
finished = true;
subscriber.onError(e);
group.dispose();
},
function () {
if (!finished) {
if (!hasResults[i]) {
subscriber.onCompleted();
return;
}
hasCompleted[i] = true;
for (var ix = 0; ix < count; ix++) {
if (!hasCompleted[ix]) { return; }
}
finished = true;
subscriber.onNext(results);
subscriber.onCompleted();
}
}));
})(idx);
}
return group;
});
};
/**
* Runs two observable sequences in parallel and combines their last elemenets.
*
* @param {Observable} second Second observable sequence.
* @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences.
* @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences.
*/
observableProto.forkJoin = function (second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var leftStopped = false, rightStopped = false,
hasLeft = false, hasRight = false,
lastLeft, lastRight,
leftSubscription = new SingleAssignmentDisposable(), rightSubscription = new SingleAssignmentDisposable();
isPromise(second) && (second = observableFromPromise(second));
leftSubscription.setDisposable(
first.subscribe(function (left) {
hasLeft = true;
lastLeft = left;
}, function (err) {
rightSubscription.dispose();
observer.onError(err);
}, function () {
leftStopped = true;
if (rightStopped) {
if (!hasLeft) {
observer.onCompleted();
} else if (!hasRight) {
observer.onCompleted();
} else {
var result;
try {
result = resultSelector(lastLeft, lastRight);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
observer.onCompleted();
}
}
})
);
rightSubscription.setDisposable(
second.subscribe(function (right) {
hasRight = true;
lastRight = right;
}, function (err) {
leftSubscription.dispose();
observer.onError(err);
}, function () {
rightStopped = true;
if (leftStopped) {
if (!hasLeft) {
observer.onCompleted();
} else if (!hasRight) {
observer.onCompleted();
} else {
var result;
try {
result = resultSelector(lastLeft, lastRight);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
observer.onCompleted();
}
}
})
);
return new CompositeDisposable(leftSubscription, rightSubscription);
});
};
/**
* Comonadic bind operator.
* @param {Function} selector A transform function to apply to each element.
* @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.
* @returns {Observable} An observable sequence which results from the comonadic bind operation.
*/
observableProto.manySelect = function (selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
var source = this;
return observableDefer(function () {
var chain;
return source
.map(function (x) {
var curr = new ChainObservable(x);
chain && chain.onNext(x);
chain = curr;
return curr;
})
.tap(
noop,
function (e) { chain && chain.onError(e); },
function () { chain && chain.onCompleted(); }
)
.observeOn(scheduler)
.map(selector);
});
};
var ChainObservable = (function (__super__) {
function subscribe (observer) {
var self = this, g = new CompositeDisposable();
g.add(currentThreadScheduler.schedule(function () {
observer.onNext(self.head);
g.add(self.tail.mergeAll().subscribe(observer));
}));
return g;
}
inherits(ChainObservable, __super__);
function ChainObservable(head) {
__super__.call(this, subscribe);
this.head = head;
this.tail = new AsyncSubject();
}
addProperties(ChainObservable.prototype, Observer, {
onCompleted: function () {
this.onNext(Observable.empty());
},
onError: function (e) {
this.onNext(Observable.throwException(e));
},
onNext: function (v) {
this.tail.onNext(v);
this.tail.onCompleted();
}
});
return ChainObservable;
}(Observable));
/** @private */
var Map = root.Map || (function () {
function Map() {
this._keys = [];
this._values = [];
}
Map.prototype.get = function (key) {
var i = this._keys.indexOf(key);
return i !== -1 ? this._values[i] : undefined;
};
Map.prototype.set = function (key, value) {
var i = this._keys.indexOf(key);
i !== -1 && (this._values[i] = value);
this._values[this._keys.push(key) - 1] = value;
};
Map.prototype.forEach = function (callback, thisArg) {
for (var i = 0, len = this._keys.length; i < len; i++) {
callback.call(thisArg, this._values[i], this._keys[i]);
}
};
return Map;
}());
/**
* @constructor
* Represents a join pattern over observable sequences.
*/
function Pattern(patterns) {
this.patterns = patterns;
}
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
* @param other Observable sequence to match in addition to the current pattern.
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
*/
Pattern.prototype.and = function (other) {
return new Pattern(this.patterns.concat(other));
};
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
Pattern.prototype.thenDo = function (selector) {
return new Plan(this, selector);
};
function Plan(expression, selector) {
this.expression = expression;
this.selector = selector;
}
Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) {
var self = this;
var joinObservers = [];
for (var i = 0, len = this.expression.patterns.length; i < len; i++) {
joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], observer.onError.bind(observer)));
}
var activePlan = new ActivePlan(joinObservers, function () {
var result;
try {
result = self.selector.apply(self, arguments);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
}, function () {
for (var j = 0, jlen = joinObservers.length; j < jlen; j++) {
joinObservers[j].removeActivePlan(activePlan);
}
deactivate(activePlan);
});
for (i = 0, len = joinObservers.length; i < len; i++) {
joinObservers[i].addActivePlan(activePlan);
}
return activePlan;
};
function planCreateObserver(externalSubscriptions, observable, onError) {
var entry = externalSubscriptions.get(observable);
if (!entry) {
var observer = new JoinObserver(observable, onError);
externalSubscriptions.set(observable, observer);
return observer;
}
return entry;
}
function ActivePlan(joinObserverArray, onNext, onCompleted) {
this.joinObserverArray = joinObserverArray;
this.onNext = onNext;
this.onCompleted = onCompleted;
this.joinObservers = new Map();
for (var i = 0, len = this.joinObserverArray.length; i < len; i++) {
var joinObserver = this.joinObserverArray[i];
this.joinObservers.set(joinObserver, joinObserver);
}
}
ActivePlan.prototype.dequeue = function () {
this.joinObservers.forEach(function (v) { v.queue.shift(); });
};
ActivePlan.prototype.match = function () {
var i, len, hasValues = true;
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
if (this.joinObserverArray[i].queue.length === 0) {
hasValues = false;
break;
}
}
if (hasValues) {
var firstValues = [],
isCompleted = false;
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
firstValues.push(this.joinObserverArray[i].queue[0]);
this.joinObserverArray[i].queue[0].kind === 'C' && (isCompleted = true);
}
if (isCompleted) {
this.onCompleted();
} else {
this.dequeue();
var values = [];
for (i = 0, len = firstValues.length; i < firstValues.length; i++) {
values.push(firstValues[i].value);
}
this.onNext.apply(this, values);
}
}
};
var JoinObserver = (function (__super__) {
inherits(JoinObserver, __super__);
function JoinObserver(source, onError) {
__super__.call(this);
this.source = source;
this.onError = onError;
this.queue = [];
this.activePlans = [];
this.subscription = new SingleAssignmentDisposable();
this.isDisposed = false;
}
var JoinObserverPrototype = JoinObserver.prototype;
JoinObserverPrototype.next = function (notification) {
if (!this.isDisposed) {
if (notification.kind === 'E') {
this.onError(notification.exception);
return;
}
this.queue.push(notification);
var activePlans = this.activePlans.slice(0);
for (var i = 0, len = activePlans.length; i < len; i++) {
activePlans[i].match();
}
}
};
JoinObserverPrototype.error = noop;
JoinObserverPrototype.completed = noop;
JoinObserverPrototype.addActivePlan = function (activePlan) {
this.activePlans.push(activePlan);
};
JoinObserverPrototype.subscribe = function () {
this.subscription.setDisposable(this.source.materialize().subscribe(this));
};
JoinObserverPrototype.removeActivePlan = function (activePlan) {
this.activePlans.splice(this.activePlans.indexOf(activePlan), 1);
this.activePlans.length === 0 && this.dispose();
};
JoinObserverPrototype.dispose = function () {
__super__.prototype.dispose.call(this);
if (!this.isDisposed) {
this.isDisposed = true;
this.subscription.dispose();
}
};
return JoinObserver;
} (AbstractObserver));
/**
* Creates a pattern that matches when both observable sequences have an available value.
*
* @param right Observable sequence to match with the current sequence.
* @return {Pattern} Pattern object that matches when both observable sequences have an available value.
*/
observableProto.and = function (right) {
return new Pattern([this, right]);
};
/**
* Matches when the observable sequence has an available value and projects the value.
*
* @param selector Selector that will be invoked for values in the source sequence.
* @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
observableProto.thenDo = function (selector) {
return new Pattern([this]).thenDo(selector);
};
/**
* Joins together the results from several patterns.
*
* @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.
* @returns {Observable} Observable sequence with the results form matching several patterns.
*/
Observable.when = function () {
var plans = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var activePlans = [],
externalSubscriptions = new Map();
var outObserver = observerCreate(
observer.onNext.bind(observer),
function (err) {
externalSubscriptions.forEach(function (v) { v.onError(err); });
observer.onError(err);
},
observer.onCompleted.bind(observer)
);
try {
for (var i = 0, len = plans.length; i < len; i++) {
activePlans.push(plans[i].activate(externalSubscriptions, outObserver, function (activePlan) {
var idx = activePlans.indexOf(activePlan);
activePlans.splice(idx, 1);
activePlans.length === 0 && observer.onCompleted();
}));
}
} catch (e) {
observableThrow(e).subscribe(observer);
}
var group = new CompositeDisposable();
externalSubscriptions.forEach(function (joinObserver) {
joinObserver.subscribe();
group.add(joinObserver);
});
return group;
});
};
function observableTimerDate(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithAbsolute(dueTime, function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerDateAndPeriod(dueTime, period, scheduler) {
return new AnonymousObservable(function (observer) {
var count = 0, d = dueTime, p = normalizeTime(period);
return scheduler.scheduleRecursiveWithAbsolute(d, function (self) {
if (p > 0) {
var now = scheduler.now();
d = d + p;
d <= now && (d = now + p);
}
observer.onNext(count++);
self(d);
});
});
}
function observableTimerTimeSpan(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithRelative(normalizeTime(dueTime), function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) {
return dueTime === period ?
new AnonymousObservable(function (observer) {
return scheduler.schedulePeriodicWithState(0, period, function (count) {
observer.onNext(count);
return count + 1;
});
}) :
observableDefer(function () {
return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler);
});
}
/**
* Returns an observable sequence that produces a value after each period.
*
* @example
* 1 - res = Rx.Observable.interval(1000);
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
*
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @returns {Observable} An observable sequence that produces a value after each period.
*/
var observableinterval = Observable.interval = function (period, scheduler) {
return observableTimerTimeSpanAndPeriod(period, period, isScheduler(scheduler) ? scheduler : timeoutScheduler);
};
/**
* Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/
var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {
var period;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (periodOrScheduler !== undefined && typeof periodOrScheduler === 'number') {
period = periodOrScheduler;
} else if (isScheduler(periodOrScheduler)) {
scheduler = periodOrScheduler;
}
if (dueTime instanceof Date && period === undefined) {
return observableTimerDate(dueTime.getTime(), scheduler);
}
if (dueTime instanceof Date && period !== undefined) {
period = periodOrScheduler;
return observableTimerDateAndPeriod(dueTime.getTime(), period, scheduler);
}
return period === undefined ?
observableTimerTimeSpan(dueTime, scheduler) :
observableTimerTimeSpanAndPeriod(dueTime, period, scheduler);
};
function observableDelayTimeSpan(source, dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
var active = false,
cancelable = new SerialDisposable(),
exception = null,
q = [],
running = false,
subscription;
subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) {
var d, shouldRun;
if (notification.value.kind === 'E') {
q = [];
q.push(notification);
exception = notification.value.exception;
shouldRun = !running;
} else {
q.push({ value: notification.value, timestamp: notification.timestamp + dueTime });
shouldRun = !active;
active = true;
}
if (shouldRun) {
if (exception !== null) {
observer.onError(exception);
} else {
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleRecursiveWithRelative(dueTime, function (self) {
var e, recurseDueTime, result, shouldRecurse;
if (exception !== null) {
return;
}
running = true;
do {
result = null;
if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) {
result = q.shift().value;
}
if (result !== null) {
result.accept(observer);
}
} while (result !== null);
shouldRecurse = false;
recurseDueTime = 0;
if (q.length > 0) {
shouldRecurse = true;
recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now());
} else {
active = false;
}
e = exception;
running = false;
if (e !== null) {
observer.onError(e);
} else if (shouldRecurse) {
self(recurseDueTime);
}
}));
}
}
});
return new CompositeDisposable(subscription, cancelable);
});
}
function observableDelayDate(source, dueTime, scheduler) {
return observableDefer(function () {
return observableDelayTimeSpan(source, dueTime - scheduler.now(), scheduler);
});
}
/**
* Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved.
*
* @example
* 1 - res = Rx.Observable.delay(new Date());
* 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout);
*
* 3 - res = Rx.Observable.delay(5000);
* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delay = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return dueTime instanceof Date ?
observableDelayDate(this, dueTime.getTime(), scheduler) :
observableDelayTimeSpan(this, dueTime, scheduler);
};
/**
* Ignores values from an observable sequence which are followed by another value before dueTime.
* @param {Number} dueTime Duration of the debounce period for each value (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the debounce timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The debounced sequence.
*/
observableProto.debounce = observableProto.throttleWithTimeout = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var cancelable = new SerialDisposable(), hasvalue = false, value, id = 0;
var subscription = source.subscribe(
function (x) {
hasvalue = true;
value = x;
id++;
var currentId = id,
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleWithRelative(dueTime, function () {
hasvalue && id === currentId && observer.onNext(value);
hasvalue = false;
}));
},
function (e) {
cancelable.dispose();
observer.onError(e);
hasvalue = false;
id++;
},
function () {
cancelable.dispose();
hasvalue && observer.onNext(value);
observer.onCompleted();
hasvalue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* @deprecated use #debounce or #throttleWithTimeout instead.
*/
observableProto.throttle = function(dueTime, scheduler) {
deprecate('throttle', 'debounce or throttleWithTimeout');
return this.debounce(dueTime, scheduler);
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on timing information.
* @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {
var source = this, timeShift;
timeShiftOrScheduler == null && (timeShift = timeSpan);
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (typeof timeShiftOrScheduler === 'number') {
timeShift = timeShiftOrScheduler;
} else if (isScheduler(timeShiftOrScheduler)) {
timeShift = timeSpan;
scheduler = timeShiftOrScheduler;
}
return new AnonymousObservable(function (observer) {
var groupDisposable,
nextShift = timeShift,
nextSpan = timeSpan,
q = [],
refCountDisposable,
timerD = new SerialDisposable(),
totalTime = 0;
groupDisposable = new CompositeDisposable(timerD),
refCountDisposable = new RefCountDisposable(groupDisposable);
function createTimer () {
var m = new SingleAssignmentDisposable(),
isSpan = false,
isShift = false;
timerD.setDisposable(m);
if (nextSpan === nextShift) {
isSpan = true;
isShift = true;
} else if (nextSpan < nextShift) {
isSpan = true;
} else {
isShift = true;
}
var newTotalTime = isSpan ? nextSpan : nextShift,
ts = newTotalTime - totalTime;
totalTime = newTotalTime;
if (isSpan) {
nextSpan += timeShift;
}
if (isShift) {
nextShift += timeShift;
}
m.setDisposable(scheduler.scheduleWithRelative(ts, function () {
if (isShift) {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
}
isSpan && q.shift().onCompleted();
createTimer();
}));
};
q.push(new Subject());
observer.onNext(addRef(q[0], refCountDisposable));
createTimer();
groupDisposable.add(source.subscribe(
function (x) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
},
function (e) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onError(e); }
observer.onError(e);
},
function () {
for (var i = 0, len = q.length; i < len; i++) { q[i].onCompleted(); }
observer.onCompleted();
}
));
return refCountDisposable;
});
};
/**
* Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.
* @param {Number} timeSpan Maximum time length of a window.
* @param {Number} count Maximum element count of a window.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithTimeOrCount = function (timeSpan, count, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var timerD = new SerialDisposable(),
groupDisposable = new CompositeDisposable(timerD),
refCountDisposable = new RefCountDisposable(groupDisposable),
n = 0,
windowId = 0,
s = new Subject();
function createTimer(id) {
var m = new SingleAssignmentDisposable();
timerD.setDisposable(m);
m.setDisposable(scheduler.scheduleWithRelative(timeSpan, function () {
if (id !== windowId) { return; }
n = 0;
var newId = ++windowId;
s.onCompleted();
s = new Subject();
observer.onNext(addRef(s, refCountDisposable));
createTimer(newId);
}));
}
observer.onNext(addRef(s, refCountDisposable));
createTimer(0);
groupDisposable.add(source.subscribe(
function (x) {
var newId = 0, newWindow = false;
s.onNext(x);
if (++n === count) {
newWindow = true;
n = 0;
newId = ++windowId;
s.onCompleted();
s = new Subject();
observer.onNext(addRef(s, refCountDisposable));
}
newWindow && createTimer(newId);
},
function (e) {
s.onError(e);
observer.onError(e);
}, function () {
s.onCompleted();
observer.onCompleted();
}
));
return refCountDisposable;
});
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.
*
* @example
* 1 - res = xs.bufferWithTime(1000, scheduler); // non-overlapping segments of 1 second
* 2 - res = xs.bufferWithTime(1000, 500, scheduler; // segments of 1 second with time shift 0.5 seconds
*
* @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.
* @param {Scheduler} [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {
return this.windowWithTime.apply(this, arguments).selectMany(function (x) { return x.toArray(); });
};
/**
* Projects each element of an observable sequence into a buffer that is completed when either it's full or a given amount of time has elapsed.
*
* @example
* 1 - res = source.bufferWithTimeOrCount(5000, 50); // 5s or 50 items in an array
* 2 - res = source.bufferWithTimeOrCount(5000, 50, scheduler); // 5s or 50 items in an array
*
* @param {Number} timeSpan Maximum time length of a buffer.
* @param {Number} count Maximum element count of a buffer.
* @param {Scheduler} [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithTimeOrCount = function (timeSpan, count, scheduler) {
return this.windowWithTimeOrCount(timeSpan, count, scheduler).selectMany(function (x) {
return x.toArray();
});
};
/**
* Records the time interval between consecutive values in an observable sequence.
*
* @example
* 1 - res = source.timeInterval();
* 2 - res = source.timeInterval(Rx.Scheduler.timeout);
*
* @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with time interval information on values.
*/
observableProto.timeInterval = function (scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return observableDefer(function () {
var last = scheduler.now();
return source.map(function (x) {
var now = scheduler.now(), span = now - last;
last = now;
return { value: x, interval: span };
});
});
};
/**
* Records the timestamp for each value in an observable sequence.
*
* @example
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
* 2 - res = source.timestamp(Rx.Scheduler.timeout);
*
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with timestamp information on values.
*/
observableProto.timestamp = function (scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return this.map(function (x) {
return { value: x, timestamp: scheduler.now() };
});
};
function sampleObservable(source, sampler) {
return new AnonymousObservable(function (observer) {
var atEnd, value, hasValue;
function sampleSubscribe() {
if (hasValue) {
hasValue = false;
observer.onNext(value);
}
atEnd && observer.onCompleted();
}
return new CompositeDisposable(
source.subscribe(function (newValue) {
hasValue = true;
value = newValue;
}, observer.onError.bind(observer), function () {
atEnd = true;
}),
sampler.subscribe(sampleSubscribe, observer.onError.bind(observer), sampleSubscribe)
);
});
}
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
observableProto.sample = observableProto.throttleLatest = function (intervalOrSampler, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return typeof intervalOrSampler === 'number' ?
sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :
sampleObservable(this, intervalOrSampler);
};
/**
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeout = function (dueTime, other, scheduler) {
(other == null || typeof other === 'string') && (other = observableThrow(new Error(other || 'Timeout')));
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = dueTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (observer) {
var id = 0,
original = new SingleAssignmentDisposable(),
subscription = new SerialDisposable(),
switched = false,
timer = new SerialDisposable();
subscription.setDisposable(original);
function createTimer() {
var myId = id;
timer.setDisposable(scheduler[schedulerMethod](dueTime, function () {
if (id === myId) {
isPromise(other) && (other = observableFromPromise(other));
subscription.setDisposable(other.subscribe(observer));
}
}));
}
createTimer();
original.setDisposable(source.subscribe(function (x) {
if (!switched) {
id++;
observer.onNext(x);
createTimer();
}
}, function (e) {
if (!switched) {
id++;
observer.onError(e);
}
}, function () {
if (!switched) {
id++;
observer.onCompleted();
}
}));
return new CompositeDisposable(subscription, timer);
});
};
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithAbsoluteTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return new Date(); }
* });
*
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
Observable.generateWithAbsoluteTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithAbsolute(scheduler.now(), function (self) {
hasResult && observer.onNext(result);
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
}
} catch (e) {
observer.onError(e);
return;
}
if (hasResult) {
self(time);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithRelativeTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return 500; }
* );
*
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithRelative(0, function (self) {
hasResult && observer.onNext(result);
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
}
} catch (e) {
observer.onError(e);
return;
}
if (hasResult) {
self(time);
} else {
observer.onCompleted();
}
});
});
};
/**
* Time shifts the observable sequence by delaying the subscription.
*
* @example
* 1 - res = source.delaySubscription(5000); // 5s
* 2 - res = source.delaySubscription(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Number} dueTime Absolute or relative time to perform the subscription at.
* @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delaySubscription = function (dueTime, scheduler) {
return this.delayWithSelector(observableTimer(dueTime, isScheduler(scheduler) ? scheduler : timeoutScheduler), observableEmpty);
};
/**
* Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
* 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
*
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
* @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) {
var source = this, subDelay, selector;
if (typeof subscriptionDelay === 'function') {
selector = subscriptionDelay;
} else {
subDelay = subscriptionDelay;
selector = delayDurationSelector;
}
return new AnonymousObservable(function (observer) {
var delays = new CompositeDisposable(), atEnd = false, done = function () {
if (atEnd && delays.length === 0) {
observer.onCompleted();
}
}, subscription = new SerialDisposable(), start = function () {
subscription.setDisposable(source.subscribe(function (x) {
var delay;
try {
delay = selector(x);
} catch (error) {
observer.onError(error);
return;
}
var d = new SingleAssignmentDisposable();
delays.add(d);
d.setDisposable(delay.subscribe(function () {
observer.onNext(x);
delays.remove(d);
done();
}, observer.onError.bind(observer), function () {
observer.onNext(x);
delays.remove(d);
done();
}));
}, observer.onError.bind(observer), function () {
atEnd = true;
subscription.dispose();
done();
}));
};
if (!subDelay) {
start();
} else {
subscription.setDisposable(subDelay.subscribe(function () {
start();
}, observer.onError.bind(observer), function () { start(); }));
}
return new CompositeDisposable(subscription, delays);
});
};
/**
* Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled.
* @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
* @param {Function} [timeoutDurationSelector] Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
* @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeoutWithSelector = function (firstTimeout, timeoutdurationSelector, other) {
if (arguments.length === 1) {
timeoutdurationSelector = firstTimeout;
firstTimeout = observableNever();
}
other || (other = observableThrow(new Error('Timeout')));
var source = this;
return new AnonymousObservable(function (observer) {
var subscription = new SerialDisposable(), timer = new SerialDisposable(), original = new SingleAssignmentDisposable();
subscription.setDisposable(original);
var id = 0, switched = false;
function setTimer(timeout) {
var myId = id;
function timerWins () {
return id === myId;
}
var d = new SingleAssignmentDisposable();
timer.setDisposable(d);
d.setDisposable(timeout.subscribe(function () {
timerWins() && subscription.setDisposable(other.subscribe(observer));
d.dispose();
}, function (e) {
timerWins() && observer.onError(e);
}, function () {
timerWins() && subscription.setDisposable(other.subscribe(observer));
}));
};
setTimer(firstTimeout);
function observerWins() {
var res = !switched;
if (res) { id++; }
return res;
}
original.setDisposable(source.subscribe(function (x) {
if (observerWins()) {
observer.onNext(x);
var timeout;
try {
timeout = timeoutdurationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
setTimer(isPromise(timeout) ? observableFromPromise(timeout) : timeout);
}
}, function (e) {
observerWins() && observer.onError(e);
}, function () {
observerWins() && observer.onCompleted();
}));
return new CompositeDisposable(subscription, timer);
});
};
/**
* Ignores values from an observable sequence which are followed by another value within a computed throttle duration.
* @param {Function} durationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
* @returns {Observable} The debounced sequence.
*/
observableProto.debounceWithSelector = function (durationSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var value, hasValue = false, cancelable = new SerialDisposable(), id = 0;
var subscription = source.subscribe(function (x) {
var throttle;
try {
throttle = durationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
isPromise(throttle) && (throttle = observableFromPromise(throttle));
hasValue = true;
value = x;
id++;
var currentid = id, d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(throttle.subscribe(function () {
hasValue && id === currentid && observer.onNext(value);
hasValue = false;
d.dispose();
}, observer.onError.bind(observer), function () {
hasValue && id === currentid && observer.onNext(value);
hasValue = false;
d.dispose();
}));
}, function (e) {
cancelable.dispose();
observer.onError(e);
hasValue = false;
id++;
}, function () {
cancelable.dispose();
hasValue && observer.onNext(value);
observer.onCompleted();
hasValue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
});
};
observableProto.throttleWithSelector = function () {
deprecate('throttleWithSelector', 'debounceWithSelector');
return this.debounceWithSelector.apply(this, arguments);
};
/**
* Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
*
* 1 - res = source.skipLastWithTime(5000);
* 2 - res = source.skipLastWithTime(5000, scheduler);
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for skipping elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
*/
observableProto.skipLastWithTime = function (duration, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
observer.onNext(q.shift().value);
}
}, observer.onError.bind(observer), function () {
var now = scheduler.now();
while (q.length > 0 && now - q[0].interval >= duration) {
observer.onNext(q.shift().value);
}
observer.onCompleted();
});
});
};
/**
* Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.
*/
observableProto.takeLastWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
q.shift();
}
}, observer.onError.bind(observer), function () {
var now = scheduler.now();
while (q.length > 0) {
var next = q.shift();
if (now - next.interval <= duration) { observer.onNext(next.value); }
}
observer.onCompleted();
});
});
};
/**
* Returns an array with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
*/
observableProto.takeLastBufferWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
q.shift();
}
}, observer.onError.bind(observer), function () {
var now = scheduler.now(), res = [];
while (q.length > 0) {
var next = q.shift();
if (now - next.interval <= duration) { res.push(next.value); }
}
observer.onNext(res);
observer.onCompleted();
});
});
};
/**
* Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.takeWithTime(5000, [optional scheduler]);
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.
*/
observableProto.takeWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(scheduler.scheduleWithRelative(duration, observer.onCompleted.bind(observer)), source.subscribe(observer));
});
};
/**
* Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.skipWithTime(5000, [optional scheduler]);
*
* @description
* Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.
* This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
* may not execute immediately, despite the zero due time.
*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
* @param {Number} duration Duration for skipping elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
*/
observableProto.skipWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var open = false;
return new CompositeDisposable(
scheduler.scheduleWithRelative(duration, function () { open = true; }),
source.subscribe(function (x) { open && observer.onNext(x); }, observer.onError.bind(observer), observer.onCompleted.bind(observer)));
});
};
/**
* Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time.
*
* @examples
* 1 - res = source.skipUntilWithTime(new Date(), [scheduler]);
* 2 - res = source.skipUntilWithTime(5000, [scheduler]);
* @param {Date|Number} startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped until the specified start time.
*/
observableProto.skipUntilWithTime = function (startTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = startTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (observer) {
var open = false;
return new CompositeDisposable(
scheduler[schedulerMethod](startTime, function () { open = true; }),
source.subscribe(
function (x) { open && observer.onNext(x); },
observer.onError.bind(observer),
observer.onCompleted.bind(observer)));
});
};
/**
* Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
* @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
* @param {Scheduler} [scheduler] Scheduler to run the timer on.
* @returns {Observable} An observable sequence with the elements taken until the specified end time.
*/
observableProto.takeUntilWithTime = function (endTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = endTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(
scheduler[schedulerMethod](endTime, observer.onCompleted.bind(observer)),
source.subscribe(observer));
});
};
/**
* Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.
* @param {Number} windowDuration time to wait before emitting another item after emitting the last item
* @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.
* @returns {Observable} An Observable that performs the throttle operation.
*/
observableProto.throttleFirst = function (windowDuration, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var duration = +windowDuration || 0;
if (duration <= 0) { throw new RangeError('windowDuration cannot be less or equal zero.'); }
var source = this;
return new AnonymousObservable(function (observer) {
var lastOnNext = 0;
return source.subscribe(
function (x) {
var now = scheduler.now();
if (lastOnNext === 0 || now - lastOnNext >= duration) {
lastOnNext = now;
observer.onNext(x);
}
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer)
);
});
};
/*
* Performs a exclusive waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @returns {Observable} A exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusive = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasCurrent = false,
isStopped = false,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
var innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
innerSubscription.setDisposable(innerSource.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
observer.onError.bind(observer),
function () {
isStopped = true;
if (!hasCurrent && g.length === 1) {
observer.onCompleted();
}
}));
return g;
});
};
/*
* Performs a exclusive map waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @param {Function} selector Selector to invoke for every item in the current subscription.
* @param {Any} [thisArg] An optional context to invoke with the selector parameter.
* @returns {Observable} An exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusiveMap = function (selector, thisArg) {
var sources = this;
return new AnonymousObservable(function (observer) {
var index = 0,
hasCurrent = false,
isStopped = true,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(
function (x) {
var result;
try {
result = selector.call(thisArg, x, index++, innerSource);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
},
observer.onError.bind(observer),
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
observer.onError.bind(observer),
function () {
isStopped = true;
if (g.length === 1 && !hasCurrent) {
observer.onCompleted();
}
}));
return g;
});
};
/**
* Executes a transducer to transform the observable sequence
* @param {Transducer} transducer A transducer to execute
* @returns {Observable} An Observable sequence containing the results from the transducer.
*/
observableProto.transduce = function(transducer) {
var source = this;
function transformForObserver(observer) {
return {
init: function() {
return observer;
},
step: function(obs, input) {
return obs.onNext(input);
},
result: function(obs) {
return obs.onCompleted();
}
};
}
return new AnonymousObservable(function(observer) {
var xform = transducer(transformForObserver(observer));
return source.subscribe(
function(v) {
try {
xform.step(observer, v);
} catch (e) {
observer.onError(e);
}
},
observer.onError.bind(observer),
function() { xform.result(observer); }
);
});
};
/** Provides a set of extension methods for virtual time scheduling. */
Rx.VirtualTimeScheduler = (function (__super__) {
function notImplemented() {
throw new Error('Not implemented');
}
function localNow() {
return this.toDateTimeOffset(this.clock);
}
function scheduleNow(state, action) {
return this.scheduleAbsoluteWithState(state, this.clock, action);
}
function scheduleRelative(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime), action);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime - this.now()), action);
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
inherits(VirtualTimeScheduler, __super__);
/**
* Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.
*
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function VirtualTimeScheduler(initialClock, comparer) {
this.clock = initialClock;
this.comparer = comparer;
this.isEnabled = false;
this.queue = new PriorityQueue(1024);
__super__.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
VirtualTimeSchedulerPrototype.add = notImplemented;
/**
* Converts an absolute time to a number
* @param {Any} The absolute time.
* @returns {Number} The absolute time in ms
*/
VirtualTimeSchedulerPrototype.toDateTimeOffset = notImplemented;
/**
* Converts the TimeSpan value to a relative virtual time value.
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
VirtualTimeSchedulerPrototype.toRelative = notImplemented;
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
VirtualTimeSchedulerPrototype.schedulePeriodicWithState = function (state, period, action) {
var s = new SchedulePeriodicRecursive(this, state, period, action);
return s.start();
};
/**
* Schedules an action to be executed after dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelativeWithState = function (state, dueTime, action) {
var runAt = this.add(this.clock, dueTime);
return this.scheduleAbsoluteWithState(state, runAt, action);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelative = function (dueTime, action) {
return this.scheduleRelativeWithState(action, dueTime, invokeAction);
};
/**
* Starts the virtual time scheduler.
*/
VirtualTimeSchedulerPrototype.start = function () {
if (!this.isEnabled) {
this.isEnabled = true;
do {
var next = this.getNext();
if (next !== null) {
this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
}
};
/**
* Stops the virtual time scheduler.
*/
VirtualTimeSchedulerPrototype.stop = function () {
this.isEnabled = false;
};
/**
* Advances the scheduler's clock to the specified time, running all work till that point.
* @param {Number} time Absolute time to advance the scheduler's clock to.
*/
VirtualTimeSchedulerPrototype.advanceTo = function (time) {
var dueToClock = this.comparer(this.clock, time);
if (this.comparer(this.clock, time) > 0) {
throw new Error(argumentOutOfRange);
}
if (dueToClock === 0) {
return;
}
if (!this.isEnabled) {
this.isEnabled = true;
do {
var next = this.getNext();
if (next !== null && this.comparer(next.dueTime, time) <= 0) {
this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
this.clock = time;
}
};
/**
* Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.advanceBy = function (time) {
var dt = this.add(this.clock, time),
dueToClock = this.comparer(this.clock, dt);
if (dueToClock > 0) { throw new Error(argumentOutOfRange); }
if (dueToClock === 0) { return; }
this.advanceTo(dt);
};
/**
* Advances the scheduler's clock by the specified relative time.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.sleep = function (time) {
var dt = this.add(this.clock, time);
if (this.comparer(this.clock, dt) >= 0) { throw new Error(argumentOutOfRange); }
this.clock = dt;
};
/**
* Gets the next scheduled item to be executed.
* @returns {ScheduledItem} The next scheduled item.
*/
VirtualTimeSchedulerPrototype.getNext = function () {
while (this.queue.length > 0) {
var next = this.queue.peek();
if (next.isCancelled()) {
this.queue.dequeue();
} else {
return next;
}
}
return null;
};
/**
* Schedules an action to be executed at dueTime.
* @param {Scheduler} scheduler Scheduler to execute the action on.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsolute = function (dueTime, action) {
return this.scheduleAbsoluteWithState(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsoluteWithState = function (state, dueTime, action) {
var self = this;
function run(scheduler, state1) {
self.queue.remove(si);
return action(scheduler, state1);
}
var si = new ScheduledItem(this, state, run, dueTime, this.comparer);
this.queue.enqueue(si);
return si.disposable;
};
return VirtualTimeScheduler;
}(Scheduler));
/** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */
Rx.HistoricalScheduler = (function (__super__) {
inherits(HistoricalScheduler, __super__);
/**
* Creates a new historical scheduler with the specified initial clock value.
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function HistoricalScheduler(initialClock, comparer) {
var clock = initialClock == null ? 0 : initialClock;
var cmp = comparer || defaultSubComparer;
__super__.call(this, clock, cmp);
}
var HistoricalSchedulerProto = HistoricalScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
HistoricalSchedulerProto.add = function (absolute, relative) {
return absolute + relative;
};
HistoricalSchedulerProto.toDateTimeOffset = function (absolute) {
return new Date(absolute).getTime();
};
/**
* Converts the TimeSpan value to a relative virtual time value.
* @memberOf HistoricalScheduler
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
HistoricalSchedulerProto.toRelative = function (timeSpan) {
return timeSpan;
};
return HistoricalScheduler;
}(Rx.VirtualTimeScheduler));
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
inherits(AnonymousObservable, __super__);
// Fix subscriber to check for undefined or function returned to decorate as Disposable
function fixSubscriber(subscriber) {
if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
return typeof subscriber === 'function' ?
disposableCreate(subscriber) :
disposableEmpty;
}
function AnonymousObservable(subscribe) {
if (!(this instanceof AnonymousObservable)) {
return new AnonymousObservable(subscribe);
}
function s(observer) {
var setDisposable = function () {
try {
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
};
var autoDetachObserver = new AutoDetachObserver(observer);
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.schedule(setDisposable);
} else {
setDisposable();
}
return autoDetachObserver;
}
__super__.call(this, s);
}
return AnonymousObservable;
}(Observable));
/** @private */
var AutoDetachObserver = (function (_super) {
inherits(AutoDetachObserver, _super);
function AutoDetachObserver(observer) {
_super.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
AutoDetachObserverPrototype.next = function (value) {
var noError = false;
try {
this.observer.onNext(value);
noError = true;
} catch (e) {
throw e;
} finally {
if (!noError) {
this.dispose();
}
}
};
AutoDetachObserverPrototype.error = function (exn) {
try {
this.observer.onError(exn);
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.completed = function () {
try {
this.observer.onCompleted();
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function (value) { return this.m.getDisposable(); };
/* @private */
AutoDetachObserverPrototype.disposable = function (value) {
return arguments.length ? this.getDisposable() : setDisposable(value);
};
AutoDetachObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
var GroupedObservable = (function (__super__) {
inherits(GroupedObservable, __super__);
function subscribe(observer) {
return this.underlyingObservable.subscribe(observer);
}
function GroupedObservable(key, underlyingObservable, mergedDisposable) {
__super__.call(this, subscribe);
this.key = key;
this.underlyingObservable = !mergedDisposable ?
underlyingObservable :
new AnonymousObservable(function (observer) {
return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
});
}
return GroupedObservable;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.exception) {
observer.onError(this.exception);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, _super);
/**
* Creates a subject.
* @constructor
*/
function Subject() {
_super.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
}
addProperties(Subject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
var ex = this.exception,
hv = this.hasValue,
v = this.value;
if (ex) {
observer.onError(ex);
} else if (hv) {
observer.onNext(v);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, __super__);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
* @constructor
*/
function AsyncSubject() {
__super__.call(this, subscribe);
this.isDisposed = false;
this.isStopped = false;
this.value = null;
this.hasValue = false;
this.observers = [];
this.exception = null;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
checkDisposed.call(this);
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*/
onCompleted: function () {
var o, i, len;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
var os = this.observers.slice(0),
v = this.value,
hv = this.hasValue;
if (hv) {
for (i = 0, len = os.length; i < len; i++) {
o = os[i];
o.onNext(v);
o.onCompleted();
}
} else {
for (i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the error.
* @param {Mixed} error The Error to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = error;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers = [];
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed.call(this);
if (this.isStopped) { return; }
this.value = value;
this.hasValue = true;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
inherits(AnonymousSubject, __super__);
function AnonymousSubject(observer, observable) {
this.observer = observer;
this.observable = observable;
__super__.call(this, this.observable.subscribe.bind(this.observable));
}
addProperties(AnonymousSubject.prototype, Observer, {
onCompleted: function () {
this.observer.onCompleted();
},
onError: function (exception) {
this.observer.onError(exception);
},
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
});
} else if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Rx).Rx = Rx;
} else {
freeExports.Rx = Rx;
}
} else {
// in a browser or Rhino
root.Rx = Rx;
}
}.call(this));
|
src/Parser/DestructionWarlock/Modules/Talents/ReverseEntropy.js | mwwscott0/WoWAnalyzer | import React from 'react';
import Module from 'Parser/Core/Module';
import Combatants from 'Parser/Core/Modules/Combatants';
import SPELLS from 'common/SPELLS';
import SpellIcon from 'common/SpellIcon';
import { formatNumber, formatPercentage } from 'common/format';
import StatisticBox, { STATISTIC_ORDER } from 'Main/StatisticBox';
import getDamageBonus from '../WarlockCore/getDamageBonus';
const REVERSE_ENTROPY_DAMAGE_BONUS = 0.1;
class ReverseEntropy extends Module {
static dependencies = {
combatants: Combatants,
};
bonusDmg = 0;
on_initialized() {
this.active = this.combatants.selected.hasTalent(SPELLS.REVERSE_ENTROPY_TALENT.id);
}
on_byPlayer_damage(event) {
if (event.ability.guid !== SPELLS.CHAOS_BOLT.id && event.ability.guid !== SPELLS.RAIN_OF_FIRE_DAMAGE.id) {
return;
}
this.bonusDmg += getDamageBonus(event, REVERSE_ENTROPY_DAMAGE_BONUS);
}
statistic() {
// could show mana returned too, but that's kinda irrelevant for Warlocks anyway
return (
<StatisticBox
icon={<SpellIcon id={SPELLS.REVERSE_ENTROPY_TALENT.id} />}
value={`${formatNumber(this.bonusDmg / this.owner.fightDuration * 1000)} DPS`}
label="Damage contributed"
tooltip={`Your Reverse Entropy talent contributed ${formatNumber(this.bonusDmg)} total damage (${formatPercentage(this.owner.getPercentageOfTotalDamageDone(this.bonusDmg))} %)`}
/>
);
}
statisticOrder = STATISTIC_ORDER.OPTIONAL(1);
}
export default ReverseEntropy;
|
old/stuff/vendor/fontawesome-free/js/brands.js | AlexFine/alexfine.github.io | /*!
* Font Awesome Free 5.8.1 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
(function () {
'use strict';
var _WINDOW = {};
var _DOCUMENT = {};
try {
if (typeof window !== 'undefined') _WINDOW = window;
if (typeof document !== 'undefined') _DOCUMENT = document;
} catch (e) {}
var _ref = _WINDOW.navigator || {},
_ref$userAgent = _ref.userAgent,
userAgent = _ref$userAgent === void 0 ? '' : _ref$userAgent;
var WINDOW = _WINDOW;
var DOCUMENT = _DOCUMENT;
var IS_BROWSER = !!WINDOW.document;
var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function';
var IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/');
var NAMESPACE_IDENTIFIER = '___FONT_AWESOME___';
var PRODUCTION = function () {
try {
return "production" === 'production';
} catch (e) {
return false;
}
}();
function bunker(fn) {
try {
fn();
} catch (e) {
if (!PRODUCTION) {
throw e;
}
}
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
var w = WINDOW || {};
if (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};
if (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};
if (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};
if (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];
var namespace = w[NAMESPACE_IDENTIFIER];
function defineIcons(prefix, icons) {
var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var _params$skipHooks = params.skipHooks,
skipHooks = _params$skipHooks === void 0 ? false : _params$skipHooks;
var normalized = Object.keys(icons).reduce(function (acc, iconName) {
var icon = icons[iconName];
var expanded = !!icon.icon;
if (expanded) {
acc[icon.iconName] = icon.icon;
} else {
acc[iconName] = icon;
}
return acc;
}, {});
if (typeof namespace.hooks.addPack === 'function' && !skipHooks) {
namespace.hooks.addPack(prefix, normalized);
} else {
namespace.styles[prefix] = _objectSpread({}, namespace.styles[prefix] || {}, normalized);
}
/**
* Font Awesome 4 used the prefix of `fa` for all icons. With the introduction
* of new styles we needed to differentiate between them. Prefix `fa` is now an alias
* for `fas` so we'll easy the upgrade process for our users by automatically defining
* this as well.
*/
if (prefix === 'fas') {
defineIcons('fa', icons);
}
}
var icons = {
"500px": [448, 512, [], "f26e", "M103.3 344.3c-6.5-14.2-6.9-18.3 7.4-23.1 25.6-8 8 9.2 43.2 49.2h.3v-93.9c1.2-50.2 44-92.2 97.7-92.2 53.9 0 97.7 43.5 97.7 96.8 0 63.4-60.8 113.2-128.5 93.3-10.5-4.2-2.1-31.7 8.5-28.6 53 0 89.4-10.1 89.4-64.4 0-61-77.1-89.6-116.9-44.6-23.5 26.4-17.6 42.1-17.6 157.6 50.7 31 118.3 22 160.4-20.1 24.8-24.8 38.5-58 38.5-93 0-35.2-13.8-68.2-38.8-93.3-24.8-24.8-57.8-38.5-93.3-38.5s-68.8 13.8-93.5 38.5c-.3.3-16 16.5-21.2 23.9l-.5.6c-3.3 4.7-6.3 9.1-20.1 6.1-6.9-1.7-14.3-5.8-14.3-11.8V20c0-5 3.9-10.5 10.5-10.5h241.3c8.3 0 8.3 11.6 8.3 15.1 0 3.9 0 15.1-8.3 15.1H130.3v132.9h.3c104.2-109.8 282.8-36 282.8 108.9 0 178.1-244.8 220.3-310.1 62.8zm63.3-260.8c-.5 4.2 4.6 24.5 14.6 20.6C306 56.6 384 144.5 390.6 144.5c4.8 0 22.8-15.3 14.3-22.8-93.2-89-234.5-57-238.3-38.2zM393 414.7C283 524.6 94 475.5 61 310.5c0-12.2-30.4-7.4-28.9 3.3 24 173.4 246 256.9 381.6 121.3 6.9-7.8-12.6-28.4-20.7-20.4zM213.6 306.6c0 4 4.3 7.3 5.5 8.5 3 3 6.1 4.4 8.5 4.4 3.8 0 2.6.2 22.3-19.5 19.6 19.3 19.1 19.5 22.3 19.5 5.4 0 18.5-10.4 10.7-18.2L265.6 284l18.2-18.2c6.3-6.8-10.1-21.8-16.2-15.7L249.7 268c-18.6-18.8-18.4-19.5-21.5-19.5-5 0-18 11.7-12.4 17.3L234 284c-18.1 17.9-20.4 19.2-20.4 22.6z"],
"accessible-icon": [448, 512, [], "f368", "M423.9 255.8L411 413.1c-3.3 40.7-63.9 35.1-60.6-4.9l10-122.5-41.1 2.3c10.1 20.7 15.8 43.9 15.8 68.5 0 41.2-16.1 78.7-42.3 106.5l-39.3-39.3c57.9-63.7 13.1-167.2-74-167.2-25.9 0-49.5 9.9-67.2 26L73 243.2c22-20.7 50.1-35.1 81.4-40.2l75.3-85.7-42.6-24.8-51.6 46c-30 26.8-70.6-18.5-40.5-45.4l68-60.7c9.8-8.8 24.1-10.2 35.5-3.6 0 0 139.3 80.9 139.5 81.1 16.2 10.1 20.7 36 6.1 52.6L285.7 229l106.1-5.9c18.5-1.1 33.6 14.4 32.1 32.7zm-64.9-154c28.1 0 50.9-22.8 50.9-50.9C409.9 22.8 387.1 0 359 0c-28.1 0-50.9 22.8-50.9 50.9 0 28.1 22.8 50.9 50.9 50.9zM179.6 456.5c-80.6 0-127.4-90.6-82.7-156.1l-39.7-39.7C36.4 287 24 320.3 24 356.4c0 130.7 150.7 201.4 251.4 122.5l-39.7-39.7c-16 10.9-35.3 17.3-56.1 17.3z"],
"accusoft": [640, 512, [], "f369", "M322.1 252v-1l-51.2-65.8s-12 1.6-25 15.1c-9 9.3-242.1 239.1-243.4 240.9-7 10 1.6 6.8 15.7 1.7.8 0 114.5-36.6 114.5-36.6.5-.6-.1-.1.6-.6-.4-5.1-.8-26.2-1-27.7-.6-5.2 2.2-6.9 7-8.9l92.6-33.8c.6-.8 88.5-81.7 90.2-83.3zm160.1 120.1c13.3 16.1 20.7 13.3 30.8 9.3 3.2-1.2 115.4-47.6 117.8-48.9 8-4.3-1.7-16.7-7.2-23.4-2.1-2.5-205.1-245.6-207.2-248.3-9.7-12.2-14.3-12.9-38.4-12.8-10.2 0-106.8.5-116.5.6-19.2.1-32.9-.3-19.2 16.9C250 75 476.5 365.2 482.2 372.1zm152.7 1.6c-2.3-.3-24.6-4.7-38-7.2 0 0-115 50.4-117.5 51.6-16 7.3-26.9-3.2-36.7-14.6l-57.1-74c-5.4-.9-60.4-9.6-65.3-9.3-3.1.2-9.6.8-14.4 2.9-4.9 2.1-145.2 52.8-150.2 54.7-5.1 2-11.4 3.6-11.1 7.6.2 2.5 2 2.6 4.6 3.5 2.7.8 300.9 67.6 308 69.1 15.6 3.3 38.5 10.5 53.6 1.7 2.1-1.2 123.8-76.4 125.8-77.8 5.4-4 4.3-6.8-1.7-8.2z"],
"acquisitions-incorporated": [384, 512, [], "f6af", "M357.45 468.2c-1.2-7.7-1.3-7.6-9.6-7.6-99.8.2-111.8-2.4-112.7-2.6-12.3-1.7-20.6-10.5-21-23.1-.1-1.6-.2-71.6-1-129.1-.1-4.7 1.6-6.4 5.9-7.5 12.5-3 24.9-6.1 37.3-9.7 4.3-1.3 6.8-.2 8.4 3.5 4.5 10.3 8.8 20.6 13.2 30.9 1.6 3.7.1 4.4-3.4 4.4-10-.2-20-.1-30.4-.1v27h116c-1.4-9.5-2.7-18.1-4-27.5-7 0-13.8.4-20.4-.1-22.6-1.6-18.3-4.4-84-158.6-8.8-20.1-27.9-62.1-36.5-89.2-4.4-14 5.5-25.4 18.9-26.6 18.6-1.7 37.5-1.6 56.2-2 20.6-.4 41.2-.4 61.8-.5 3.1 0 4-1.4 4.3-4.3 1.2-9.8 2.7-19.5 4-29.2.8-5.3 1.6-10.7 2.4-16.1L23.75 0c-3.6 0-5.3 1.1-4.6 5.3 2.2 13.2-.8.8 6.4 45.3 63.4 0 71.8.9 101.8.5 12.3-.2 37 3.5 37.7 22.1.4 11.4-1.1 11.3-32.6 87.4-53.8 129.8-50.7 120.3-67.3 161-1.7 4.1-3.6 5.2-7.6 5.2-8.5-.2-17-.3-25.4.1-1.9.1-5.2 1.8-5.5 3.2-1.5 8.1-2.2 16.3-3.2 24.9h114.3v-27.6c-6.9 0-33.5.4-35.3-2.9 5.3-12.3 10.4-24.4 15.7-36.7 16.3 4 31.9 7.8 47.6 11.7 3.4.9 4.6 3 4.6 6.8-.1 42.9.1 85.9.2 128.8 0 10.2-5.5 19.1-14.9 23.1-6.5 2.7-3.3 3.4-121.4 2.4-5.3 0-7.1 2-7.6 6.8-1.5 12.9-2.9 25.9-5 38.8-.8 5 1.3 5.7 5.3 5.7 183.2.6-30.7 0 337.1 0-2.5-15-4.4-29.4-6.6-43.7zm-174.9-205.7c-13.3-4.2-26.6-8.2-39.9-12.5a44.53 44.53 0 0 1-5.8-2.9c17.2-44.3 34.2-88.1 51.3-132.1 7.5 2.4 7.9-.8 9.4 0 9.3 22.5 18.1 60.1 27 82.8 6.6 16.7 13 33.5 19.7 50.9a35.78 35.78 0 0 1-3.9 2.1c-13.1 3.9-26.4 7.5-39.4 11.7a27.66 27.66 0 0 1-18.4 0z"],
"adn": [496, 512, [], "f170", "M248 167.5l64.9 98.8H183.1l64.9-98.8zM496 256c0 136.9-111.1 248-248 248S0 392.9 0 256 111.1 8 248 8s248 111.1 248 248zm-99.8 82.7L248 115.5 99.8 338.7h30.4l33.6-51.7h168.6l33.6 51.7h30.2z"],
"adobe": [512, 512, [], "f778", "M315.5 64h170.9v384L315.5 64zm-119 0H25.6v384L196.5 64zM256 206.1L363.5 448h-73l-30.7-76.8h-78.7L256 206.1z"],
"adversal": [512, 512, [], "f36a", "M482.1 32H28.7C5.8 32 0 37.9 0 60.9v390.2C0 474.4 5.8 480 28.7 480h453.4c24.4 0 29.9-5.2 29.9-29.7V62.2c0-24.6-5.4-30.2-29.9-30.2zM178.4 220.3c-27.5-20.2-72.1-8.7-84.2 23.4-4.3 11.1-9.3 9.5-17.5 8.3-9.7-1.5-17.2-3.2-22.5-5.5-28.8-11.4 8.6-55.3 24.9-64.3 41.1-21.4 83.4-22.2 125.3-4.8 40.9 16.8 34.5 59.2 34.5 128.5 2.7 25.8-4.3 58.3 9.3 88.8 1.9 4.4.4 7.9-2.7 10.7-8.4 6.7-39.3 2.2-46.6-7.4-1.9-2.2-1.8-3.6-3.9-6.2-3.6-3.9-7.3-2.2-11.9 1-57.4 36.4-140.3 21.4-147-43.3-3.1-29.3 12.4-57.1 39.6-71 38.2-19.5 112.2-11.8 114-30.9 1.1-10.2-1.9-20.1-11.3-27.3zm286.7 222c0 15.1-11.1 9.9-17.8 9.9H52.4c-7.4 0-18.2 4.8-17.8-10.7.4-13.9 10.5-9.1 17.1-9.1 132.3-.4 264.5-.4 396.8 0 6.8 0 16.6-4.4 16.6 9.9zm3.8-340.5v291c0 5.7-.7 13.9-8.1 13.9-12.4-.4-27.5 7.1-36.1-5.6-5.8-8.7-7.8-4-12.4-1.2-53.4 29.7-128.1 7.1-144.4-85.2-6.1-33.4-.7-67.1 15.7-100 11.8-23.9 56.9-76.1 136.1-30.5v-71c0-26.2-.1-26.2 26-26.2 3.1 0 6.6.4 9.7 0 10.1-.8 13.6 4.4 13.6 14.3-.1.2-.1.3-.1.5zm-51.5 232.3c-19.5 47.6-72.9 43.3-90 5.2-15.1-33.3-15.5-68.2.4-101.5 16.3-34.1 59.7-35.7 81.5-4.8 20.6 28.8 14.9 84.6 8.1 101.1zm-294.8 35.3c-7.5-1.3-33-3.3-33.7-27.8-.4-13.9 7.8-23 19.8-25.8 24.4-5.9 49.3-9.9 73.7-14.7 8.9-2 7.4 4.4 7.8 9.5 1.4 33-26.1 59.2-67.6 58.8z"],
"affiliatetheme": [512, 512, [], "f36b", "M159.7 237.4C108.4 308.3 43.1 348.2 14 326.6-15.2 304.9 2.8 230 54.2 159.1c51.3-70.9 116.6-110.8 145.7-89.2 29.1 21.6 11.1 96.6-40.2 167.5zm351.2-57.3C437.1 303.5 319 367.8 246.4 323.7c-25-15.2-41.3-41.2-49-73.8-33.6 64.8-92.8 113.8-164.1 133.2 49.8 59.3 124.1 96.9 207 96.9 150 0 271.6-123.1 271.6-274.9.1-8.5-.3-16.8-1-25z"],
"airbnb": [448, 512, [], "f834", "M224 373.12c-25.24-31.67-40.08-59.43-45-83.18-22.55-88 112.61-88 90.06 0-5.45 24.25-20.29 52-45 83.18zm138.15 73.23c-42.06 18.31-83.67-10.88-119.3-50.47 103.9-130.07 46.11-200-18.85-200-54.92 0-85.16 46.51-73.28 100.5 6.93 29.19 25.23 62.39 54.43 99.5-32.53 36.05-60.55 52.69-85.15 54.92-50 7.43-89.11-41.06-71.3-91.09 15.1-39.16 111.72-231.18 115.87-241.56 15.75-30.07 25.56-57.4 59.38-57.4 32.34 0 43.4 25.94 60.37 59.87 36 70.62 89.35 177.48 114.84 239.09 13.17 33.07-1.37 71.29-37.01 86.64zm47-136.12C280.27 35.93 273.13 32 224 32c-45.52 0-64.87 31.67-84.66 72.79C33.18 317.1 22.89 347.19 22 349.81-3.22 419.14 48.74 480 111.63 480c21.71 0 60.61-6.06 112.37-62.4 58.68 63.78 101.26 62.4 112.37 62.4 62.89.05 114.85-60.86 89.61-130.19.02-3.89-16.82-38.9-16.82-39.58z"],
"algolia": [448, 512, [], "f36c", "M229.3 182.6c-49.3 0-89.2 39.9-89.2 89.2 0 49.3 39.9 89.2 89.2 89.2s89.2-39.9 89.2-89.2c0-49.3-40-89.2-89.2-89.2zm62.7 56.6l-58.9 30.6c-1.8.9-3.8-.4-3.8-2.3V201c0-1.5 1.3-2.7 2.7-2.6 26.2 1 48.9 15.7 61.1 37.1.7 1.3.2 3-1.1 3.7zM389.1 32H58.9C26.4 32 0 58.4 0 90.9V421c0 32.6 26.4 59 58.9 59H389c32.6 0 58.9-26.4 58.9-58.9V90.9C448 58.4 421.6 32 389.1 32zm-202.6 84.7c0-10.8 8.7-19.5 19.5-19.5h45.3c10.8 0 19.5 8.7 19.5 19.5v15.4c0 1.8-1.7 3-3.3 2.5-12.3-3.4-25.1-5.1-38.1-5.1-13.5 0-26.7 1.8-39.4 5.5-1.7.5-3.4-.8-3.4-2.5v-15.8zm-84.4 37l9.2-9.2c7.6-7.6 19.9-7.6 27.5 0l7.7 7.7c1.1 1.1 1 3-.3 4-6.2 4.5-12.1 9.4-17.6 14.9-5.4 5.4-10.4 11.3-14.8 17.4-1 1.3-2.9 1.5-4 .3l-7.7-7.7c-7.6-7.5-7.6-19.8 0-27.4zm127.2 244.8c-70 0-126.6-56.7-126.6-126.6s56.7-126.6 126.6-126.6c70 0 126.6 56.6 126.6 126.6 0 69.8-56.7 126.6-126.6 126.6z"],
"alipay": [448, 512, [], "f642", "M377.74 32H70.26C31.41 32 0 63.41 0 102.26v307.48C0 448.59 31.41 480 70.26 480h307.48c38.52 0 69.76-31.08 70.26-69.6-45.96-25.62-110.59-60.34-171.6-88.44-32.07 43.97-84.14 81-148.62 81-70.59 0-93.73-45.3-97.04-76.37-3.97-39.01 14.88-81.5 99.52-81.5 35.38 0 79.35 10.25 127.13 24.96 16.53-30.09 26.45-60.34 26.45-60.34h-178.2v-16.7h92.08v-31.24H88.28v-19.01h109.44V92.34h50.92v50.42h109.44v19.01H248.63v31.24h88.77s-15.21 46.62-38.35 90.92c48.93 16.7 100.01 36.04 148.62 52.74V102.26C447.83 63.57 416.43 32 377.74 32zM47.28 322.95c.99 20.17 10.25 53.73 69.93 53.73 52.07 0 92.58-39.68 117.87-72.9-44.63-18.68-84.48-31.41-109.44-31.41-67.45 0-79.35 33.06-78.36 50.58z"],
"amazon": [448, 512, [], "f270", "M257.2 162.7c-48.7 1.8-169.5 15.5-169.5 117.5 0 109.5 138.3 114 183.5 43.2 6.5 10.2 35.4 37.5 45.3 46.8l56.8-56S341 288.9 341 261.4V114.3C341 89 316.5 32 228.7 32 140.7 32 94 87 94 136.3l73.5 6.8c16.3-49.5 54.2-49.5 54.2-49.5 40.7-.1 35.5 29.8 35.5 69.1zm0 86.8c0 80-84.2 68-84.2 17.2 0-47.2 50.5-56.7 84.2-57.8v40.6zm136 163.5c-7.7 10-70 67-174.5 67S34.2 408.5 9.7 379c-6.8-7.7 1-11.3 5.5-8.3C88.5 415.2 203 488.5 387.7 401c7.5-3.7 13.3 2 5.5 12zm39.8 2.2c-6.5 15.8-16 26.8-21.2 31-5.5 4.5-9.5 2.7-6.5-3.8s19.3-46.5 12.7-55c-6.5-8.3-37-4.3-48-3.2-10.8 1-13 2-14-.3-2.3-5.7 21.7-15.5 37.5-17.5 15.7-1.8 41-.8 46 5.7 3.7 5.1 0 27.1-6.5 43.1z"],
"amazon-pay": [640, 512, [], "f42c", "M14 325.3c2.3-4.2 5.2-4.9 9.7-2.5 10.4 5.6 20.6 11.4 31.2 16.7a595.88 595.88 0 0 0 127.4 46.3 616.61 616.61 0 0 0 63.2 11.8 603.33 603.33 0 0 0 95 5.2c17.4-.4 34.8-1.8 52.1-3.8a603.66 603.66 0 0 0 163.3-42.8c2.9-1.2 5.9-2 9.1-1.2 6.7 1.8 9 9 4.1 13.9a70 70 0 0 1-9.6 7.4c-30.7 21.1-64.2 36.4-99.6 47.9a473.31 473.31 0 0 1-75.1 17.6 431 431 0 0 1-53.2 4.8 21.3 21.3 0 0 0-2.5.3H308a21.3 21.3 0 0 0-2.5-.3c-3.6-.2-7.2-.3-10.7-.4a426.3 426.3 0 0 1-50.4-5.3A448.4 448.4 0 0 1 164 420a443.33 443.33 0 0 1-145.6-87c-1.8-1.6-3-3.8-4.4-5.7zM172 65.1l-4.3.6a80.92 80.92 0 0 0-38 15.1c-2.4 1.7-4.6 3.5-7.1 5.4a4.29 4.29 0 0 1-.4-1.4c-.4-2.7-.8-5.5-1.3-8.2-.7-4.6-3-6.6-7.6-6.6h-11.5c-6.9 0-8.2 1.3-8.2 8.2v209.3c0 1 0 2 .1 3 .2 3 2 4.9 4.9 5 7 .1 14.1.1 21.1 0 2.9 0 4.7-2 5-5 .1-1 .1-2 .1-3v-72.4c1.1.9 1.7 1.4 2.2 1.9 17.9 14.9 38.5 19.8 61 15.4 20.4-4 34.6-16.5 43.8-34.9 7-13.9 9.9-28.7 10.3-44.1.5-17.1-1.2-33.9-8.1-49.8-8.5-19.6-22.6-32.5-43.9-36.9-3.2-.7-6.5-1-9.8-1.5-2.8-.1-5.5-.1-8.3-.1zM124.6 107a3.48 3.48 0 0 1 1.7-3.3c13.7-9.5 28.8-14.5 45.6-13.2 14.9 1.1 27.1 8.4 33.5 25.9 3.9 10.7 4.9 21.8 4.9 33 0 10.4-.8 20.6-4 30.6-6.8 21.3-22.4 29.4-42.6 28.5-14-.6-26.2-6-37.4-13.9a3.57 3.57 0 0 1-1.7-3.3c.1-14.1 0-28.1 0-42.2s.1-28 0-42.1zm205.7-41.9c-1 .1-2 .3-2.9.4a148 148 0 0 0-28.9 4.1c-6.1 1.6-12 3.8-17.9 5.8-3.6 1.2-5.4 3.8-5.3 7.7.1 3.3-.1 6.6 0 9.9.1 4.8 2.1 6.1 6.8 4.9 7.8-2 15.6-4.2 23.5-5.7 12.3-2.3 24.7-3.3 37.2-1.4 6.5 1 12.6 2.9 16.8 8.4 3.7 4.8 5.1 10.5 5.3 16.4.3 8.3.2 16.6.3 24.9a7.84 7.84 0 0 1-.2 1.4c-.5-.1-.9 0-1.3-.1a180.56 180.56 0 0 0-32-4.9c-11.3-.6-22.5.1-33.3 3.9-12.9 4.5-23.3 12.3-29.4 24.9-4.7 9.8-5.4 20.2-3.9 30.7 2 14 9 24.8 21.4 31.7 11.9 6.6 24.8 7.4 37.9 5.4 15.1-2.3 28.5-8.7 40.3-18.4a7.36 7.36 0 0 1 1.6-1.1c.6 3.8 1.1 7.4 1.8 11 .6 3.1 2.5 5.1 5.4 5.2 5.4.1 10.9.1 16.3 0a4.84 4.84 0 0 0 4.8-4.7 26.2 26.2 0 0 0 .1-2.8v-106a80 80 0 0 0-.9-12.9c-1.9-12.9-7.4-23.5-19-30.4-6.7-4-14.1-6-21.8-7.1-3.6-.5-7.2-.8-10.8-1.3-3.9.1-7.9.1-11.9.1zm35 127.7a3.33 3.33 0 0 1-1.5 3c-11.2 8.1-23.5 13.5-37.4 14.9-5.7.6-11.4.4-16.8-1.8a20.08 20.08 0 0 1-12.4-13.3 32.9 32.9 0 0 1-.1-19.4c2.5-8.3 8.4-13 16.4-15.6a61.33 61.33 0 0 1 24.8-2.2c8.4.7 16.6 2.3 25 3.4 1.6.2 2.1 1 2.1 2.6-.1 4.8 0 9.5 0 14.3s-.2 9.4-.1 14.1zm259.9 129.4c-1-5-4.8-6.9-9.1-8.3a88.42 88.42 0 0 0-21-3.9 147.32 147.32 0 0 0-39.2 1.9c-14.3 2.7-27.9 7.3-40 15.6a13.75 13.75 0 0 0-3.7 3.5 5.11 5.11 0 0 0-.5 4c.4 1.5 2.1 1.9 3.6 1.8a16.2 16.2 0 0 0 2.2-.1c7.8-.8 15.5-1.7 23.3-2.5 11.4-1.1 22.9-1.8 34.3-.9a71.64 71.64 0 0 1 14.4 2.7c5.1 1.4 7.4 5.2 7.6 10.4.4 8-1.4 15.7-3.5 23.3-4.1 15.4-10 30.3-15.8 45.1a17.6 17.6 0 0 0-1 3c-.5 2.9 1.2 4.8 4.1 4.1a10.56 10.56 0 0 0 4.8-2.5 145.91 145.91 0 0 0 12.7-13.4c12.8-16.4 20.3-35.3 24.7-55.6.8-3.6 1.4-7.3 2.1-10.9v-17.3zM493.1 199q-19.35-53.55-38.7-107.2c-2-5.7-4.2-11.3-6.3-16.9-1.1-2.9-3.2-4.8-6.4-4.8-7.6-.1-15.2-.2-22.9-.1-2.5 0-3.7 2-3.2 4.5a43.1 43.1 0 0 0 1.9 6.1q29.4 72.75 59.1 145.5c1.7 4.1 2.1 7.6.2 11.8-3.3 7.3-5.9 15-9.3 22.3-3 6.5-8 11.4-15.2 13.3a42.13 42.13 0 0 1-15.4 1.1c-2.5-.2-5-.8-7.5-1-3.4-.2-5.1 1.3-5.2 4.8q-.15 5 0 9.9c.1 5.5 2 8 7.4 8.9a108.18 108.18 0 0 0 16.9 2c17.1.4 30.7-6.5 39.5-21.4a131.63 131.63 0 0 0 9.2-18.4q35.55-89.7 70.6-179.6a26.62 26.62 0 0 0 1.6-5.5c.4-2.8-.9-4.4-3.7-4.4-6.6-.1-13.3 0-19.9 0a7.54 7.54 0 0 0-7.7 5.2c-.5 1.4-1.1 2.7-1.6 4.1l-34.8 100c-2.5 7.2-5.1 14.5-7.7 22.2-.4-1.1-.6-1.7-.9-2.4z"],
"amilia": [448, 512, [], "f36d", "M240.1 32c-61.9 0-131.5 16.9-184.2 55.4-5.1 3.1-9.1 9.2-7.2 19.4 1.1 5.1 5.1 27.4 10.2 39.6 4.1 10.2 14.2 10.2 20.3 6.1 32.5-22.3 96.5-47.7 152.3-47.7 57.9 0 58.9 28.4 58.9 73.1v38.5C203 227.7 78.2 251 46.7 264.2 11.2 280.5 16.3 357.7 16.3 376s15.2 104 124.9 104c47.8 0 113.7-20.7 153.3-42.1v25.4c0 3 2.1 8.2 6.1 9.1 3.1 1 50.7 2 59.9 2s62.5.3 66.5-.7c4.1-1 5.1-6.1 5.1-9.1V168c-.1-80.3-57.9-136-192-136zm50.2 348c-21.4 13.2-48.7 24.4-79.1 24.4-52.8 0-58.9-33.5-59-44.7 0-12.2-3-42.7 18.3-52.9 24.3-13.2 75.1-29.4 119.8-33.5z"],
"android": [448, 512, [], "f17b", "M89.6 204.5v115.8c0 15.4-12.1 27.7-27.5 27.7-15.3 0-30.1-12.4-30.1-27.7V204.5c0-15.1 14.8-27.5 30.1-27.5 15.1 0 27.5 12.4 27.5 27.5zm10.8 157c0 16.4 13.2 29.6 29.6 29.6h19.9l.3 61.1c0 36.9 55.2 36.6 55.2 0v-61.1h37.2v61.1c0 36.7 55.5 36.8 55.5 0v-61.1h20.2c16.2 0 29.4-13.2 29.4-29.6V182.1H100.4v179.4zm248-189.1H99.3c0-42.8 25.6-80 63.6-99.4l-19.1-35.3c-2.8-4.9 4.3-8 6.7-3.8l19.4 35.6c34.9-15.5 75-14.7 108.3 0L297.5 34c2.5-4.3 9.5-1.1 6.7 3.8L285.1 73c37.7 19.4 63.3 56.6 63.3 99.4zm-170.7-55.5c0-5.7-4.6-10.5-10.5-10.5-5.7 0-10.2 4.8-10.2 10.5s4.6 10.5 10.2 10.5c5.9 0 10.5-4.8 10.5-10.5zm113.4 0c0-5.7-4.6-10.5-10.2-10.5-5.9 0-10.5 4.8-10.5 10.5s4.6 10.5 10.5 10.5c5.6 0 10.2-4.8 10.2-10.5zm94.8 60.1c-15.1 0-27.5 12.1-27.5 27.5v115.8c0 15.4 12.4 27.7 27.5 27.7 15.4 0 30.1-12.4 30.1-27.7V204.5c0-15.4-14.8-27.5-30.1-27.5z"],
"angellist": [448, 512, [], "f209", "M347.1 215.4c11.7-32.6 45.4-126.9 45.4-157.1 0-26.6-15.7-48.9-43.7-48.9-44.6 0-84.6 131.7-97.1 163.1C242 144 196.6 0 156.6 0c-31.1 0-45.7 22.9-45.7 51.7 0 35.3 34.2 126.8 46.6 162-6.3-2.3-13.1-4.3-20-4.3-23.4 0-48.3 29.1-48.3 52.6 0 8.9 4.9 21.4 8 29.7-36.9 10-51.1 34.6-51.1 71.7C46 435.6 114.4 512 210.6 512c118 0 191.4-88.6 191.4-202.9 0-43.1-6.9-82-54.9-93.7zM311.7 108c4-12.3 21.1-64.3 37.1-64.3 8.6 0 10.9 8.9 10.9 16 0 19.1-38.6 124.6-47.1 148l-34-6 33.1-93.7zM142.3 48.3c0-11.9 14.5-45.7 46.3 47.1l34.6 100.3c-15.6-1.3-27.7-3-35.4 1.4-10.9-28.8-45.5-119.7-45.5-148.8zM140 244c29.3 0 67.1 94.6 67.1 107.4 0 5.1-4.9 11.4-10.6 11.4-20.9 0-76.9-76.9-76.9-97.7.1-7.7 12.7-21.1 20.4-21.1zm184.3 186.3c-29.1 32-66.3 48.6-109.7 48.6-59.4 0-106.3-32.6-128.9-88.3-17.1-43.4 3.8-68.3 20.6-68.3 11.4 0 54.3 60.3 54.3 73.1 0 4.9-7.7 8.3-11.7 8.3-16.1 0-22.4-15.5-51.1-51.4-29.7 29.7 20.5 86.9 58.3 86.9 26.1 0 43.1-24.2 38-42 3.7 0 8.3.3 11.7-.6 1.1 27.1 9.1 59.4 41.7 61.7 0-.9 2-7.1 2-7.4 0-17.4-10.6-32.6-10.6-50.3 0-28.3 21.7-55.7 43.7-71.7 8-6 17.7-9.7 27.1-13.1 9.7-3.7 20-8 27.4-15.4-1.1-11.2-5.7-21.1-16.9-21.1-27.7 0-120.6 4-120.6-39.7 0-6.7.1-13.1 17.4-13.1 32.3 0 114.3 8 138.3 29.1 18.1 16.1 24.3 113.2-31 174.7zm-98.6-126c9.7 3.1 19.7 4 29.7 6-7.4 5.4-14 12-20.3 19.1-2.8-8.5-6.2-16.8-9.4-25.1z"],
"angrycreative": [640, 512, [], "f36e", "M640 238.2l-3.2 28.2-34.5 2.3-2 18.1 34.5-2.3-3.2 28.2-34.4 2.2-2.3 20.1 34.4-2.2-3 26.1-64.7 4.1 12.7-113.2L527 365.2l-31.9 2-23.8-117.8 30.3-2 13.6 79.4 31.7-82.4 93.1-6.2zM426.8 371.5l28.3-1.8L468 249.6l-28.4 1.9-12.8 120zM162 388.1l-19.4-36-3.5 37.4-28.2 1.7 2.7-29.1c-11 18-32 34.3-56.9 35.8C23.9 399.9-3 377 .3 339.7c2.6-29.3 26.7-62.8 67.5-65.4 37.7-2.4 47.6 23.2 51.3 28.8l2.8-30.8 38.9-2.5c20.1-1.3 38.7 3.7 42.5 23.7l2.6-26.6 64.8-4.2-2.7 27.9-36.4 2.4-1.7 17.9 36.4-2.3-2.7 27.9-36.4 2.3-1.9 19.9 36.3-2.3-2.1 20.8 55-117.2 23.8-1.6L370.4 369l8.9-85.6-22.3 1.4 2.9-27.9 75-4.9-3 28-24.3 1.6-9.7 91.9-58 3.7-4.3-15.6-39.4 2.5-8 16.3-126.2 7.7zm-44.3-70.2l-26.4 1.7C84.6 307.2 76.9 303 65 303.8c-19 1.2-33.3 17.5-34.6 33.3-1.4 16 7.3 32.5 28.7 31.2 12.8-.8 21.3-8.6 28.9-18.9l27-1.7 2.7-29.8zm56.1-7.7c1.2-12.9-7.6-13.6-26.1-12.4l-2.7 28.5c14.2-.9 27.5-2.1 28.8-16.1zm21.1 70.8l5.8-60c-5 13.5-14.7 21.1-27.9 26.6l22.1 33.4zm135.4-45l-7.9-37.8-15.8 39.3 23.7-1.5zm-170.1-74.6l-4.3-17.5-39.6 2.6-8.1 18.2-31.9 2.1 57-121.9 23.9-1.6 30.7 102 9.9-104.7 27-1.8 37.8 63.6 6.5-66.6 28.5-1.9-4 41.2c7.4-13.5 22.9-44.7 63.6-47.5 40.5-2.8 52.4 29.3 53.4 30.3l3.3-32 39.3-2.7c12.7-.9 27.8.3 36.3 9.7l-4.4-11.9 32.2-2.2 12.9 43.2 23-45.7 31-2.2-43.6 78.4-4.8 44.3-28.4 1.9 4.8-44.3-15.8-43c1 22.3-9.2 40.1-32 49.6l25.2 38.8-36.4 2.4-19.2-36.8-4 38.3-28.4 1.9 3.3-31.5c-6.7 9.3-19.7 35.4-59.6 38-26.2 1.7-45.6-10.3-55.4-39.2l-4 40.3-25 1.6-37.6-63.3-6.3 66.2-56.8 3.7zm276.6-82.1c10.2-.7 17.5-2.1 21.6-4.3 4.5-2.4 7-6.4 7.6-12.1.6-5.3-.6-8.8-3.4-10.4-3.6-2.1-10.6-2.8-22.9-2l-2.9 28.8zM327.7 214c5.6 5.9 12.7 8.5 21.3 7.9 4.7-.3 9.1-1.8 13.3-4.1 5.5-3 10.6-8 15.1-14.3l-34.2 2.3 2.4-23.9 63.1-4.3 1.2-12-31.2 2.1c-4.1-3.7-7.8-6.6-11.1-8.1-4-1.7-8.1-2.8-12.2-2.5-8 .5-15.3 3.6-22 9.2-7.7 6.4-12 14.5-12.9 24.4-1.1 9.6 1.4 17.3 7.2 23.3zm-201.3 8.2l23.8-1.6-8.3-37.6-15.5 39.2z"],
"angular": [448, 512, [], "f420", "M185.7 268.1h76.2l-38.1-91.6-38.1 91.6zM223.8 32L16 106.4l31.8 275.7 176 97.9 176-97.9 31.8-275.7zM354 373.8h-48.6l-26.2-65.4H168.6l-26.2 65.4H93.7L223.8 81.5z"],
"app-store": [512, 512, [], "f36f", "M255.9 120.9l9.1-15.7c5.6-9.8 18.1-13.1 27.9-7.5 9.8 5.6 13.1 18.1 7.5 27.9l-87.5 151.5h63.3c20.5 0 32 24.1 23.1 40.8H113.8c-11.3 0-20.4-9.1-20.4-20.4 0-11.3 9.1-20.4 20.4-20.4h52l66.6-115.4-20.8-36.1c-5.6-9.8-2.3-22.2 7.5-27.9 9.8-5.6 22.2-2.3 27.9 7.5l8.9 15.7zm-78.7 218l-19.6 34c-5.6 9.8-18.1 13.1-27.9 7.5-9.8-5.6-13.1-18.1-7.5-27.9l14.6-25.2c16.4-5.1 29.8-1.2 40.4 11.6zm168.9-61.7h53.1c11.3 0 20.4 9.1 20.4 20.4 0 11.3-9.1 20.4-20.4 20.4h-29.5l19.9 34.5c5.6 9.8 2.3 22.2-7.5 27.9-9.8 5.6-22.2 2.3-27.9-7.5-33.5-58.1-58.7-101.6-75.4-130.6-17.1-29.5-4.9-59.1 7.2-69.1 13.4 23 33.4 57.7 60.1 104zM256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm216 248c0 118.7-96.1 216-216 216-118.7 0-216-96.1-216-216 0-118.7 96.1-216 216-216 118.7 0 216 96.1 216 216z"],
"app-store-ios": [448, 512, [], "f370", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM127 384.5c-5.5 9.6-17.8 12.8-27.3 7.3-9.6-5.5-12.8-17.8-7.3-27.3l14.3-24.7c16.1-4.9 29.3-1.1 39.6 11.4L127 384.5zm138.9-53.9H84c-11 0-20-9-20-20s9-20 20-20h51l65.4-113.2-20.5-35.4c-5.5-9.6-2.2-21.8 7.3-27.3 9.6-5.5 21.8-2.2 27.3 7.3l8.9 15.4 8.9-15.4c5.5-9.6 17.8-12.8 27.3-7.3 9.6 5.5 12.8 17.8 7.3 27.3l-85.8 148.6h62.1c20.2 0 31.5 23.7 22.7 40zm98.1 0h-29l19.6 33.9c5.5 9.6 2.2 21.8-7.3 27.3-9.6 5.5-21.8 2.2-27.3-7.3-32.9-56.9-57.5-99.7-74-128.1-16.7-29-4.8-58 7.1-67.8 13.1 22.7 32.7 56.7 58.9 102h52c11 0 20 9 20 20 0 11.1-9 20-20 20z"],
"apper": [640, 512, [], "f371", "M42.1 239.1c22.2 0 29 2.8 33.5 14.6h.8v-22.9c0-11.3-4.8-15.4-17.9-15.4-11.3 0-14.4 2.5-15.1 12.8H4.8c.3-13.9 1.5-19.1 5.8-24.4C17.9 195 29.5 192 56.7 192c33 0 47.1 5 53.9 18.9 2 4.3 4 15.6 4 23.7v76.3H76.3l1.3-19.1h-1c-5.3 15.6-13.6 20.4-35.5 20.4-30.3 0-41.1-10.1-41.1-37.3 0-25.2 12.3-35.8 42.1-35.8zm17.1 48.1c13.1 0 16.9-3 16.9-13.4 0-9.1-4.3-11.6-19.6-11.6-13.1 0-17.9 3-17.9 12.1-.1 10.4 3.7 12.9 20.6 12.9zm77.8-94.9h38.3l-1.5 20.6h.8c9.1-17.1 15.9-20.9 37.5-20.9 14.4 0 24.7 3 31.5 9.1 9.8 8.6 12.8 20.4 12.8 48.1 0 30-3 43.1-12.1 52.9-6.8 7.3-16.4 10.1-33.2 10.1-20.4 0-29.2-5.5-33.8-21.2h-.8v70.3H137v-169zm80.9 60.7c0-27.5-3.3-32.5-20.7-32.5-16.9 0-20.7 5-20.7 28.7 0 28 3.5 33.5 21.2 33.5 16.4 0 20.2-5.6 20.2-29.7zm57.9-60.7h38.3l-1.5 20.6h.8c9.1-17.1 15.9-20.9 37.5-20.9 14.4 0 24.7 3 31.5 9.1 9.8 8.6 12.8 20.4 12.8 48.1 0 30-3 43.1-12.1 52.9-6.8 7.3-16.4 10.1-33.3 10.1-20.4 0-29.2-5.5-33.8-21.2h-.8v70.3h-39.5v-169zm80.9 60.7c0-27.5-3.3-32.5-20.7-32.5-16.9 0-20.7 5-20.7 28.7 0 28 3.5 33.5 21.2 33.5 16.4 0 20.2-5.6 20.2-29.7zm53.8-3.8c0-25.4 3.3-37.8 12.3-45.8 8.8-8.1 22.2-11.3 45.1-11.3 42.8 0 55.7 12.8 55.7 55.7v11.1h-75.3c-.3 2-.3 4-.3 4.8 0 16.9 4.5 21.9 20.1 21.9 13.9 0 17.9-3 17.9-13.9h37.5v2.3c0 9.8-2.5 18.9-6.8 24.7-7.3 9.8-19.6 13.6-44.3 13.6-27.5 0-41.6-3.3-50.6-12.3-8.5-8.5-11.3-21.3-11.3-50.8zm76.4-11.6c-.3-1.8-.3-3.3-.3-3.8 0-12.3-3.3-14.6-19.6-14.6-14.4 0-17.1 3-18.1 15.1l-.3 3.3h38.3zm55.6-45.3h38.3l-1.8 19.9h.7c6.8-14.9 14.4-20.2 29.7-20.2 10.8 0 19.1 3.3 23.4 9.3 5.3 7.3 6.8 14.4 6.8 34 0 1.5 0 5 .2 9.3h-35c.3-1.8.3-3.3.3-4 0-15.4-2-19.4-10.3-19.4-6.3 0-10.8 3.3-13.1 9.3-1 3-1 4.3-1 12.3v68h-38.3V192.3z"],
"apple": [384, 512, [], "f179", "M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"],
"apple-pay": [640, 512, [], "f415", "M116.9 158.5c-7.5 8.9-19.5 15.9-31.5 14.9-1.5-12 4.4-24.8 11.3-32.6 7.5-9.1 20.6-15.6 31.3-16.1 1.2 12.4-3.7 24.7-11.1 33.8m10.9 17.2c-17.4-1-32.3 9.9-40.5 9.9-8.4 0-21-9.4-34.8-9.1-17.9.3-34.5 10.4-43.6 26.5-18.8 32.3-4.9 80 13.3 106.3 8.9 13 19.5 27.3 33.5 26.8 13.3-.5 18.5-8.6 34.5-8.6 16.1 0 20.8 8.6 34.8 8.4 14.5-.3 23.6-13 32.5-26 10.1-14.8 14.3-29.1 14.5-29.9-.3-.3-28-10.9-28.3-42.9-.3-26.8 21.9-39.5 22.9-40.3-12.5-18.6-32-20.6-38.8-21.1m100.4-36.2v194.9h30.3v-66.6h41.9c38.3 0 65.1-26.3 65.1-64.3s-26.4-64-64.1-64h-73.2zm30.3 25.5h34.9c26.3 0 41.3 14 41.3 38.6s-15 38.8-41.4 38.8h-34.8V165zm162.2 170.9c19 0 36.6-9.6 44.6-24.9h.6v23.4h28v-97c0-28.1-22.5-46.3-57.1-46.3-32.1 0-55.9 18.4-56.8 43.6h27.3c2.3-12 13.4-19.9 28.6-19.9 18.5 0 28.9 8.6 28.9 24.5v10.8l-37.8 2.3c-35.1 2.1-54.1 16.5-54.1 41.5.1 25.2 19.7 42 47.8 42zm8.2-23.1c-16.1 0-26.4-7.8-26.4-19.6 0-12.3 9.9-19.4 28.8-20.5l33.6-2.1v11c0 18.2-15.5 31.2-36 31.2zm102.5 74.6c29.5 0 43.4-11.3 55.5-45.4L640 193h-30.8l-35.6 115.1h-.6L537.4 193h-31.6L557 334.9l-2.8 8.6c-4.6 14.6-12.1 20.3-25.5 20.3-2.4 0-7-.3-8.9-.5v23.4c1.8.4 9.3.7 11.6.7z"],
"artstation": [512, 512, [], "f77a", "M2 377.4l43 74.3A51.35 51.35 0 0 0 90.9 480h285.4l-59.2-102.6zM501.8 350L335.6 59.3A51.38 51.38 0 0 0 290.2 32h-88.4l257.3 447.6 40.7-70.5c1.9-3.2 21-29.7 2-59.1zM275 304.5l-115.5-200L44 304.5z"],
"asymmetrik": [576, 512, [], "f372", "M517.5 309.2c38.8-40 58.1-80 58.5-116.1.8-65.5-59.4-118.2-169.4-135C277.9 38.4 118.1 73.6 0 140.5 52 114 110.6 92.3 170.7 82.3c74.5-20.5 153-25.4 221.3-14.8C544.5 91.3 588.8 195 490.8 299.2c-10.2 10.8-22 21.1-35 30.6L304.9 103.4 114.7 388.9c-65.6-29.4-76.5-90.2-19.1-151.2 20.8-22.2 48.3-41.9 79.5-58.1 20-12.2 39.7-22.6 62-30.7-65.1 20.3-122.7 52.9-161.6 92.9-27.7 28.6-41.4 57.1-41.7 82.9-.5 35.1 23.4 65.1 68.4 83l-34.5 51.7h101.6l22-34.4c22.2 1 45.3 0 68.6-2.7l-22.8 37.1h135.5L340 406.3c18.6-5.3 36.9-11.5 54.5-18.7l45.9 71.8H542L468.6 349c18.5-12.1 35-25.5 48.9-39.8zm-187.6 80.5l-25-40.6-32.7 53.3c-23.4 3.5-46.7 5.1-69.2 4.4l101.9-159.3 78.7 123c-17.2 7.4-35.3 13.9-53.7 19.2z"],
"atlassian": [512, 512, [], "f77b", "M152.2 236.4c-7.7-8.2-19.7-7.7-24.8 2.8L1.6 490.2c-5 10 2.4 21.7 13.4 21.7h175c5.8.1 11-3.2 13.4-8.4 37.9-77.8 15.1-196.3-51.2-267.1zM244.4 8.1c-122.3 193.4-8.5 348.6 65 495.5 2.5 5.1 7.7 8.4 13.4 8.4H497c11.2 0 18.4-11.8 13.4-21.7 0 0-234.5-470.6-240.4-482.3-5.3-10.6-18.8-10.8-25.6.1z"],
"audible": [640, 512, [], "f373", "M640 199.9v54l-320 200L0 254v-54l320 200 320-200.1zm-194.5 72l47.1-29.4c-37.2-55.8-100.7-92.6-172.7-92.6-72 0-135.5 36.7-172.6 92.4h.3c2.5-2.3 5.1-4.5 7.7-6.7 89.7-74.4 219.4-58.1 290.2 36.3zm-220.1 18.8c16.9-11.9 36.5-18.7 57.4-18.7 34.4 0 65.2 18.4 86.4 47.6l45.4-28.4c-20.9-29.9-55.6-49.5-94.8-49.5-38.9 0-73.4 19.4-94.4 49zM103.6 161.1c131.8-104.3 318.2-76.4 417.5 62.1l.7 1 48.8-30.4C517.1 112.1 424.8 58.1 319.9 58.1c-103.5 0-196.6 53.5-250.5 135.6 9.9-10.5 22.7-23.5 34.2-32.6zm467 32.7z"],
"autoprefixer": [640, 512, [], "f41c", "M318.4 16l-161 480h77.5l25.4-81.4h119.5L405 496h77.5L318.4 16zm-40.3 341.9l41.2-130.4h1.5l40.9 130.4h-83.6zM640 405l-10-31.4L462.1 358l19.4 56.5L640 405zm-462.1-47L10 373.7 0 405l158.5 9.4 19.4-56.4z"],
"avianex": [512, 512, [], "f374", "M453.1 32h-312c-38.9 0-76.2 31.2-83.3 69.7L1.2 410.3C-5.9 448.8 19.9 480 58.9 480h312c38.9 0 76.2-31.2 83.3-69.7l56.7-308.5c7-38.6-18.8-69.8-57.8-69.8zm-58.2 347.3l-32 13.5-115.4-110c-14.7 10-29.2 19.5-41.7 27.1l22.1 64.2-17.9 12.7-40.6-61-52.4-48.1 15.7-15.4 58 31.1c9.3-10.5 20.8-22.6 32.8-34.9L203 228.9l-68.8-99.8 18.8-28.9 8.9-4.8L265 207.8l4.9 4.5c19.4-18.8 33.8-32.4 33.8-32.4 7.7-6.5 21.5-2.9 30.7 7.9 9 10.5 10.6 24.7 2.7 31.3-1.8 1.3-15.5 11.4-35.3 25.6l4.5 7.3 94.9 119.4-6.3 7.9z"],
"aviato": [640, 512, [], "f421", "M107.2 283.5l-19-41.8H36.1l-19 41.8H0l62.2-131.4 62.2 131.4h-17.2zm-45-98.1l-19.6 42.5h39.2l-19.6-42.5zm112.7 102.4l-62.2-131.4h17.1l45.1 96 45.1-96h17l-62.1 131.4zm80.6-4.3V156.4H271v127.1h-15.5zm209.1-115.6v115.6h-17.3V167.9h-41.2v-11.5h99.6v11.5h-41.1zM640 218.8c0 9.2-1.7 17.8-5.1 25.8-3.4 8-8.2 15.1-14.2 21.1-6 6-13.1 10.8-21.1 14.2-8 3.4-16.6 5.1-25.8 5.1s-17.8-1.7-25.8-5.1c-8-3.4-15.1-8.2-21.1-14.2-6-6-10.8-13-14.2-21.1-3.4-8-5.1-16.6-5.1-25.8s1.7-17.8 5.1-25.8c3.4-8 8.2-15.1 14.2-21.1 6-6 13-8.4 21.1-11.9 8-3.4 16.6-5.1 25.8-5.1s17.8 1.7 25.8 5.1c8 3.4 15.1 5.8 21.1 11.9 6 6 10.7 13.1 14.2 21.1 3.4 8 5.1 16.6 5.1 25.8zm-15.5 0c0-7.3-1.3-14-3.9-20.3-2.6-6.3-6.2-11.7-10.8-16.3-4.6-4.6-10-8.2-16.2-10.9-6.2-2.7-12.8-4-19.8-4s-13.6 1.3-19.8 4c-6.2 2.7-11.6 6.3-16.2 10.9-4.6 4.6-8.2 10-10.8 16.3-2.6 6.3-3.9 13.1-3.9 20.3 0 7.3 1.3 14 3.9 20.3 2.6 6.3 6.2 11.7 10.8 16.3 4.6 4.6 10 8.2 16.2 10.9 6.2 2.7 12.8 4 19.8 4s13.6-1.3 19.8-4c6.2-2.7 11.6-6.3 16.2-10.9 4.6-4.6 8.2-10 10.8-16.3 2.6-6.3 3.9-13.1 3.9-20.3zm-94.8 96.7v-6.3l88.9-10-242.9 13.4c.6-2.2 1.1-4.6 1.4-7.2.3-2 .5-4.2.6-6.5l64.8-8.1-64.9 1.9c0-.4-.1-.7-.1-1.1-2.8-17.2-25.5-23.7-25.5-23.7l-1.1-26.3h23.8l19 41.8h17.1L348.6 152l-62.2 131.4h17.1l19-41.8h23.6L345 268s-22.7 6.5-25.5 23.7c-.1.3-.1.7-.1 1.1l-64.9-1.9 64.8 8.1c.1 2.3.3 4.4.6 6.5.3 2.6.8 5 1.4 7.2L78.4 299.2l88.9 10v6.3c-5.9.9-10.5 6-10.5 12.2 0 6.8 5.6 12.4 12.4 12.4 6.8 0 12.4-5.6 12.4-12.4 0-6.2-4.6-11.3-10.5-12.2v-5.8l80.3 9v5.4c-5.7 1.1-9.9 6.2-9.9 12.1 0 6.8 5.6 10.2 12.4 10.2 6.8 0 12.4-3.4 12.4-10.2 0-6-4.3-11-9.9-12.1v-4.9l28.4 3.2v23.7h-5.9V360h5.9v-6.6h5v6.6h5.9v-13.8h-5.9V323l38.3 4.3c8.1 11.4 19 13.6 19 13.6l-.1 6.7-5.1.2-.1 12.1h4.1l.1-5h5.2l.1 5h4.1l-.1-12.1-5.1-.2-.1-6.7s10.9-2.1 19-13.6l38.3-4.3v23.2h-5.9V360h5.9v-6.6h5v6.6h5.9v-13.8h-5.9v-23.7l28.4-3.2v4.9c-5.7 1.1-9.9 6.2-9.9 12.1 0 6.8 5.6 10.2 12.4 10.2 6.8 0 12.4-3.4 12.4-10.2 0-6-4.3-11-9.9-12.1v-5.4l80.3-9v5.8c-5.9.9-10.5 6-10.5 12.2 0 6.8 5.6 12.4 12.4 12.4 6.8 0 12.4-5.6 12.4-12.4-.2-6.3-4.7-11.4-10.7-12.3zm-200.8-87.6l19.6-42.5 19.6 42.5h-17.9l-1.7-40.3-1.7 40.3h-17.9z"],
"aws": [640, 512, [], "f375", "M180.41 203.01c-.72 22.65 10.6 32.68 10.88 39.05a8.164 8.164 0 0 1-4.1 6.27l-12.8 8.96a10.66 10.66 0 0 1-5.63 1.92c-.43-.02-8.19 1.83-20.48-25.61a78.608 78.608 0 0 1-62.61 29.45c-16.28.89-60.4-9.24-58.13-56.21-1.59-38.28 34.06-62.06 70.93-60.05 7.1.02 21.6.37 46.99 6.27v-15.62c2.69-26.46-14.7-46.99-44.81-43.91-2.4.01-19.4-.5-45.84 10.11-7.36 3.38-8.3 2.82-10.75 2.82-7.41 0-4.36-21.48-2.94-24.2 5.21-6.4 35.86-18.35 65.94-18.18a76.857 76.857 0 0 1 55.69 17.28 70.285 70.285 0 0 1 17.67 52.36l-.01 69.29zM93.99 235.4c32.43-.47 46.16-19.97 49.29-30.47 2.46-10.05 2.05-16.41 2.05-27.4-9.67-2.32-23.59-4.85-39.56-4.87-15.15-1.14-42.82 5.63-41.74 32.26-1.24 16.79 11.12 31.4 29.96 30.48zm170.92 23.05c-7.86.72-11.52-4.86-12.68-10.37l-49.8-164.65c-.97-2.78-1.61-5.65-1.92-8.58a4.61 4.61 0 0 1 3.86-5.25c.24-.04-2.13 0 22.25 0 8.78-.88 11.64 6.03 12.55 10.37l35.72 140.83 33.16-140.83c.53-3.22 2.94-11.07 12.8-10.24h17.16c2.17-.18 11.11-.5 12.68 10.37l33.42 142.63L420.98 80.1c.48-2.18 2.72-11.37 12.68-10.37h19.72c.85-.13 6.15-.81 5.25 8.58-.43 1.85 3.41-10.66-52.75 169.9-1.15 5.51-4.82 11.09-12.68 10.37h-18.69c-10.94 1.15-12.51-9.66-12.68-10.75L328.67 110.7l-32.78 136.99c-.16 1.09-1.73 11.9-12.68 10.75h-18.3zm273.48 5.63c-5.88.01-33.92-.3-57.36-12.29a12.802 12.802 0 0 1-7.81-11.91v-10.75c0-8.45 6.2-6.9 8.83-5.89 10.04 4.06 16.48 7.14 28.81 9.6 36.65 7.53 52.77-2.3 56.72-4.48 13.15-7.81 14.19-25.68 5.25-34.95-10.48-8.79-15.48-9.12-53.13-21-4.64-1.29-43.7-13.61-43.79-52.36-.61-28.24 25.05-56.18 69.52-55.95 12.67-.01 46.43 4.13 55.57 15.62 1.35 2.09 2.02 4.55 1.92 7.04v10.11c0 4.44-1.62 6.66-4.87 6.66-7.71-.86-21.39-11.17-49.16-10.75-6.89-.36-39.89.91-38.41 24.97-.43 18.96 26.61 26.07 29.7 26.89 36.46 10.97 48.65 12.79 63.12 29.58 17.14 22.25 7.9 48.3 4.35 55.44-19.08 37.49-68.42 34.44-69.26 34.42zm40.2 104.86c-70.03 51.72-171.69 79.25-258.49 79.25A469.127 469.127 0 0 1 2.83 327.46c-6.53-5.89-.77-13.96 7.17-9.47a637.37 637.37 0 0 0 316.88 84.12 630.22 630.22 0 0 0 241.59-49.55c11.78-5 21.77 7.8 10.12 16.38zm29.19-33.29c-8.96-11.52-59.28-5.38-81.81-2.69-6.79.77-7.94-5.12-1.79-9.47 40.07-28.17 105.88-20.1 113.44-10.63 7.55 9.47-2.05 75.41-39.56 106.91-5.76 4.87-11.27 2.3-8.71-4.1 8.44-21.25 27.39-68.49 18.43-80.02z"],
"bandcamp": [496, 512, [], "f2d5", "M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm48.2 326.1h-181L199.9 178h181l-84.7 156.1z"],
"battle-net": [512, 512, [], "f835", "M448.61 225.62c26.87.18 35.57-7.43 38.92-12.37 12.47-16.32-7.06-47.6-52.85-71.33 17.76-33.58 30.11-63.68 36.34-85.3 3.38-11.83 1.09-19 .45-20.25-1.72 10.52-15.85 48.46-48.2 100.05-25-11.22-56.52-20.1-93.77-23.8-8.94-16.94-34.88-63.86-60.48-88.93C252.18 7.14 238.7 1.07 228.18.22h-.05c-13.83-1.55-22.67 5.85-27.4 11-17.2 18.53-24.33 48.87-25 84.07-7.24-12.35-17.17-24.63-28.5-25.93h-.18c-20.66-3.48-38.39 29.22-36 81.29-38.36 1.38-71 5.75-93 11.23-9.9 2.45-16.22 7.27-17.76 9.72 1-.38 22.4-9.22 111.56-9.22 5.22 53 29.75 101.82 26 93.19-9.73 15.4-38.24 62.36-47.31 97.7-5.87 22.88-4.37 37.61.15 47.14 5.57 12.75 16.41 16.72 23.2 18.26 25 5.71 55.38-3.63 86.7-21.14-7.53 12.84-13.9 28.51-9.06 39.34 7.31 19.65 44.49 18.66 88.44-9.45 20.18 32.18 40.07 57.94 55.7 74.12a39.79 39.79 0 0 0 8.75 7.09c5.14 3.21 8.58 3.37 8.58 3.37-8.24-6.75-34-38-62.54-91.78 22.22-16 45.65-38.87 67.47-69.27 122.82 4.6 143.29-24.76 148-31.64 14.67-19.88 3.43-57.44-57.32-93.69zm-77.85 106.22c23.81-37.71 30.34-67.77 29.45-92.33 27.86 17.57 47.18 37.58 49.06 58.83 1.14 12.93-8.1 29.12-78.51 33.5zM216.9 387.69c9.76-6.23 19.53-13.12 29.2-20.49 6.68 13.33 13.6 26.1 20.6 38.19-40.6 21.86-68.84 12.76-49.8-17.7zm215-171.35c-10.29-5.34-21.16-10.34-32.38-15.05a722.459 722.459 0 0 0 22.74-36.9c39.06 24.1 45.9 53.18 9.64 51.95zM279.18 398c-5.51-11.35-11-23.5-16.5-36.44 43.25 1.27 62.42-18.73 63.28-20.41 0 .07-25 15.64-62.53 12.25a718.78 718.78 0 0 0 85.06-84q13.06-15.31 24.93-31.11c-.36-.29-1.54-3-16.51-12-51.7 60.27-102.34 98-132.75 115.92-20.59-11.18-40.84-31.78-55.71-61.49-20-39.92-30-82.39-31.57-116.07 12.3.91 25.27 2.17 38.85 3.88-22.29 36.8-14.39 63-13.47 64.23 0-.07-.95-29.17 20.14-59.57a695.23 695.23 0 0 0 44.67 152.84c.93-.38 1.84.88 18.67-8.25-26.33-74.47-33.76-138.17-34-173.43 20-12.42 48.18-19.8 81.63-17.81 44.57 2.67 86.36 15.25 116.32 30.71q-10.69 15.66-23.33 32.47C365.63 152 339.1 145.84 337.5 146c.11 0 25.9 14.07 41.52 47.22a717.63 717.63 0 0 0-115.34-31.71 646.608 646.608 0 0 0-39.39-6.05c-.07.45-1.81 1.85-2.16 20.33C300 190.28 358.78 215.68 389.36 233c.74 23.55-6.95 51.61-25.41 79.57-24.6 37.31-56.39 67.23-84.77 85.43zm27.4-287c-44.56-1.66-73.58 7.43-94.69 20.67 2-52.3 21.31-76.38 38.21-75.28C267 52.15 305 108.55 306.58 111zm-130.65 3.1c.48 12.11 1.59 24.62 3.21 37.28-14.55-.85-28.74-1.25-42.4-1.26-.08 3.24-.12-51 24.67-49.59h.09c5.76 1.09 10.63 6.88 14.43 13.57zm-28.06 162c20.76 39.7 43.3 60.57 65.25 72.31-46.79 24.76-77.53 20-84.92 4.51-.2-.21-11.13-15.3 19.67-76.81zm210.06 74.8"],
"behance": [576, 512, [], "f1b4", "M232 237.2c31.8-15.2 48.4-38.2 48.4-74 0-70.6-52.6-87.8-113.3-87.8H0v354.4h171.8c64.4 0 124.9-30.9 124.9-102.9 0-44.5-21.1-77.4-64.7-89.7zM77.9 135.9H151c28.1 0 53.4 7.9 53.4 40.5 0 30.1-19.7 42.2-47.5 42.2h-79v-82.7zm83.3 233.7H77.9V272h84.9c34.3 0 56 14.3 56 50.6 0 35.8-25.9 47-57.6 47zm358.5-240.7H376V94h143.7v34.9zM576 305.2c0-75.9-44.4-139.2-124.9-139.2-78.2 0-131.3 58.8-131.3 135.8 0 79.9 50.3 134.7 131.3 134.7 61.3 0 101-27.6 120.1-86.3H509c-6.7 21.9-34.3 33.5-55.7 33.5-41.3 0-63-24.2-63-65.3h185.1c.3-4.2.6-8.7.6-13.2zM390.4 274c2.3-33.7 24.7-54.8 58.5-54.8 35.4 0 53.2 20.8 56.2 54.8H390.4z"],
"behance-square": [448, 512, [], "f1b5", "M186.5 293c0 19.3-14 25.4-31.2 25.4h-45.1v-52.9h46c18.6.1 30.3 7.8 30.3 27.5zm-7.7-82.3c0-17.7-13.7-21.9-28.9-21.9h-39.6v44.8H153c15.1 0 25.8-6.6 25.8-22.9zm132.3 23.2c-18.3 0-30.5 11.4-31.7 29.7h62.2c-1.7-18.5-11.3-29.7-30.5-29.7zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zM271.7 185h77.8v-18.9h-77.8V185zm-43 110.3c0-24.1-11.4-44.9-35-51.6 17.2-8.2 26.2-17.7 26.2-37 0-38.2-28.5-47.5-61.4-47.5H68v192h93.1c34.9-.2 67.6-16.9 67.6-55.9zM380 280.5c0-41.1-24.1-75.4-67.6-75.4-42.4 0-71.1 31.8-71.1 73.6 0 43.3 27.3 73 71.1 73 33.2 0 54.7-14.9 65.1-46.8h-33.7c-3.7 11.9-18.6 18.1-30.2 18.1-22.4 0-34.1-13.1-34.1-35.3h100.2c.1-2.3.3-4.8.3-7.2z"],
"bimobject": [448, 512, [], "f378", "M416 32H32C14.4 32 0 46.4 0 64v384c0 17.6 14.4 32 32 32h384c17.6 0 32-14.4 32-32V64c0-17.6-14.4-32-32-32zm-64 257.4c0 49.4-11.4 82.6-103.8 82.6h-16.9c-44.1 0-62.4-14.9-70.4-38.8h-.9V368H96V136h64v74.7h1.1c4.6-30.5 39.7-38.8 69.7-38.8h17.3c92.4 0 103.8 33.1 103.8 82.5v35zm-64-28.9v22.9c0 21.7-3.4 33.8-38.4 33.8h-45.3c-28.9 0-44.1-6.5-44.1-35.7v-19c0-29.3 15.2-35.7 44.1-35.7h45.3c35-.2 38.4 12 38.4 33.7z"],
"bitbucket": [512, 512, [], "f171", "M22.2 32A16 16 0 0 0 6 47.8a26.35 26.35 0 0 0 .2 2.8l67.9 412.1a21.77 21.77 0 0 0 21.3 18.2h325.7a16 16 0 0 0 16-13.4L505 50.7a16 16 0 0 0-13.2-18.3 24.58 24.58 0 0 0-2.8-.2L22.2 32zm285.9 297.8h-104l-28.1-147h157.3l-25.2 147z"],
"bitcoin": [512, 512, [], "f379", "M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zm-141.651-35.33c4.937-32.999-20.191-50.739-54.55-62.573l11.146-44.702-27.213-6.781-10.851 43.524c-7.154-1.783-14.502-3.464-21.803-5.13l10.929-43.81-27.198-6.781-11.153 44.686c-5.922-1.349-11.735-2.682-17.377-4.084l.031-.14-37.53-9.37-7.239 29.062s20.191 4.627 19.765 4.913c11.022 2.751 13.014 10.044 12.68 15.825l-12.696 50.925c.76.194 1.744.473 2.829.907-.907-.225-1.876-.473-2.876-.713l-17.796 71.338c-1.349 3.348-4.767 8.37-12.471 6.464.271.395-19.78-4.937-19.78-4.937l-13.51 31.147 35.414 8.827c6.588 1.651 13.045 3.379 19.4 5.006l-11.262 45.213 27.182 6.781 11.153-44.733a1038.209 1038.209 0 0 0 21.687 5.627l-11.115 44.523 27.213 6.781 11.262-45.128c46.404 8.781 81.299 5.239 95.986-36.727 11.836-33.79-.589-53.281-25.004-65.991 17.78-4.098 31.174-15.792 34.747-39.949zm-62.177 87.179c-8.41 33.79-65.308 15.523-83.755 10.943l14.944-59.899c18.446 4.603 77.6 13.717 68.811 48.956zm8.417-87.667c-7.673 30.736-55.031 15.12-70.393 11.292l13.548-54.327c15.363 3.828 64.836 10.973 56.845 43.035z"],
"bity": [496, 512, [], "f37a", "M78.4 67.2C173.8-22 324.5-24 421.5 71c14.3 14.1-6.4 37.1-22.4 21.5-84.8-82.4-215.8-80.3-298.9-3.2-16.3 15.1-36.5-8.3-21.8-22.1zm98.9 418.6c19.3 5.7 29.3-23.6 7.9-30C73 421.9 9.4 306.1 37.7 194.8c5-19.6-24.9-28.1-30.2-7.1-32.1 127.4 41.1 259.8 169.8 298.1zm148.1-2c121.9-40.2 192.9-166.9 164.4-291-4.5-19.7-34.9-13.8-30 7.9 24.2 107.7-37.1 217.9-143.2 253.4-21.2 7-10.4 36 8.8 29.7zm-62.9-79l.2-71.8c0-8.2-6.6-14.8-14.8-14.8-8.2 0-14.8 6.7-14.8 14.8l-.2 71.8c0 8.2 6.6 14.8 14.8 14.8s14.8-6.6 14.8-14.8zm71-269c2.1 90.9 4.7 131.9-85.5 132.5-92.5-.7-86.9-44.3-85.5-132.5 0-21.8-32.5-19.6-32.5 0v71.6c0 69.3 60.7 90.9 118 90.1 57.3.8 118-20.8 118-90.1v-71.6c0-19.6-32.5-21.8-32.5 0z"],
"black-tie": [448, 512, [], "f27e", "M0 32v448h448V32H0zm316.5 325.2L224 445.9l-92.5-88.7 64.5-184-64.5-86.6h184.9L252 173.2l64.5 184z"],
"blackberry": [512, 512, [], "f37b", "M166 116.9c0 23.4-16.4 49.1-72.5 49.1H23.4l21-88.8h67.8c42.1 0 53.8 23.3 53.8 39.7zm126.2-39.7h-67.8L205.7 166h70.1c53.8 0 70.1-25.7 70.1-49.1.1-16.4-11.6-39.7-53.7-39.7zM88.8 208.1H21L0 296.9h70.1c56.1 0 72.5-23.4 72.5-49.1 0-16.3-11.7-39.7-53.8-39.7zm180.1 0h-67.8l-18.7 88.8h70.1c53.8 0 70.1-23.4 70.1-49.1 0-16.3-11.7-39.7-53.7-39.7zm189.3-53.8h-67.8l-18.7 88.8h70.1c53.8 0 70.1-23.4 70.1-49.1.1-16.3-11.6-39.7-53.7-39.7zm-28 137.9h-67.8L343.7 381h70.1c56.1 0 70.1-23.4 70.1-49.1 0-16.3-11.6-39.7-53.7-39.7zM240.8 346H173l-18.7 88.8h70.1c56.1 0 70.1-25.7 70.1-49.1.1-16.3-11.6-39.7-53.7-39.7z"],
"blogger": [448, 512, [], "f37c", "M162.4 196c4.8-4.9 6.2-5.1 36.4-5.1 27.2 0 28.1.1 32.1 2.1 5.8 2.9 8.3 7 8.3 13.6 0 5.9-2.4 10-7.6 13.4-2.8 1.8-4.5 1.9-31.1 2.1-16.4.1-29.5-.2-31.5-.8-10.3-2.9-14.1-17.7-6.6-25.3zm61.4 94.5c-53.9 0-55.8.2-60.2 4.1-3.5 3.1-5.7 9.4-5.1 13.9.7 4.7 4.8 10.1 9.2 12 2.2 1 14.1 1.7 56.3 1.2l47.9-.6 9.2-1.5c9-5.1 10.5-17.4 3.1-24.4-5.3-4.7-5-4.7-60.4-4.7zm223.4 130.1c-3.5 28.4-23 50.4-51.1 57.5-7.2 1.8-9.7 1.9-172.9 1.8-157.8 0-165.9-.1-172-1.8-8.4-2.2-15.6-5.5-22.3-10-5.6-3.8-13.9-11.8-17-16.4-3.8-5.6-8.2-15.3-10-22C.1 423 0 420.3 0 256.3 0 93.2 0 89.7 1.8 82.6 8.1 57.9 27.7 39 53 33.4c7.3-1.6 332.1-1.9 340-.3 21.2 4.3 37.9 17.1 47.6 36.4 7.7 15.3 7-1.5 7.3 180.6.2 115.8 0 164.5-.7 170.5zm-85.4-185.2c-1.1-5-4.2-9.6-7.7-11.5-1.1-.6-8-1.3-15.5-1.7-12.4-.6-13.8-.8-17.8-3.1-6.2-3.6-7.9-7.6-8-18.3 0-20.4-8.5-39.4-25.3-56.5-12-12.2-25.3-20.5-40.6-25.1-3.6-1.1-11.8-1.5-39.2-1.8-42.9-.5-52.5.4-67.1 6.2-27 10.7-46.3 33.4-53.4 62.4-1.3 5.4-1.6 14.2-1.9 64.3-.4 62.8 0 72.1 4 84.5 9.7 30.7 37.1 53.4 64.6 58.4 9.2 1.7 122.2 2.1 133.7.5 20.1-2.7 35.9-10.8 50.7-25.9 10.7-10.9 17.4-22.8 21.8-38.5 3.2-10.9 2.9-88.4 1.7-93.9z"],
"blogger-b": [448, 512, [], "f37d", "M446.6 222.7c-1.8-8-6.8-15.4-12.5-18.5-1.8-1-13-2.2-25-2.7-20.1-.9-22.3-1.3-28.7-5-10.1-5.9-12.8-12.3-12.9-29.5-.1-33-13.8-63.7-40.9-91.3-19.3-19.7-40.9-33-65.5-40.5-5.9-1.8-19.1-2.4-63.3-2.9-69.4-.8-84.8.6-108.4 10C45.9 59.5 14.7 96.1 3.3 142.9 1.2 151.7.7 165.8.2 246.8c-.6 101.5.1 116.4 6.4 136.5 15.6 49.6 59.9 86.3 104.4 94.3 14.8 2.7 197.3 3.3 216 .8 32.5-4.4 58-17.5 81.9-41.9 17.3-17.7 28.1-36.8 35.2-62.1 4.9-17.6 4.5-142.8 2.5-151.7zm-322.1-63.6c7.8-7.9 10-8.2 58.8-8.2 43.9 0 45.4.1 51.8 3.4 9.3 4.7 13.4 11.3 13.4 21.9 0 9.5-3.8 16.2-12.3 21.6-4.6 2.9-7.3 3.1-50.3 3.3-26.5.2-47.7-.4-50.8-1.2-16.6-4.7-22.8-28.5-10.6-40.8zm191.8 199.8l-14.9 2.4-77.5.9c-68.1.8-87.3-.4-90.9-2-7.1-3.1-13.8-11.7-14.9-19.4-1.1-7.3 2.6-17.3 8.2-22.4 7.1-6.4 10.2-6.6 97.3-6.7 89.6-.1 89.1-.1 97.6 7.8 12.1 11.3 9.5 31.2-4.9 39.4z"],
"bluetooth": [448, 512, [], "f293", "M292.6 171.1L249.7 214l-.3-86 43.2 43.1m-43.2 219.8l43.1-43.1-42.9-42.9-.2 86zM416 259.4C416 465 344.1 512 230.9 512S32 465 32 259.4 115.4 0 228.6 0 416 53.9 416 259.4zm-158.5 0l79.4-88.6L211.8 36.5v176.9L138 139.6l-27 26.9 92.7 93-92.7 93 26.9 26.9 73.8-73.8 2.3 170 127.4-127.5-83.9-88.7z"],
"bluetooth-b": [320, 512, [], "f294", "M196.48 260.023l92.626-103.333L143.125 0v206.33l-86.111-86.111-31.406 31.405 108.061 108.399L25.608 368.422l31.406 31.405 86.111-86.111L145.84 512l148.552-148.644-97.912-103.333zm40.86-102.996l-49.977 49.978-.338-100.295 50.315 50.317zM187.363 313.04l49.977 49.978-50.315 50.316.338-100.294z"],
"bootstrap": [448, 512, [], "f836", "M292.3 311.93c0 42.41-39.72 41.43-43.92 41.43h-80.89v-81.69h80.89c42.56 0 43.92 31.9 43.92 40.26zm-50.15-73.13c.67 0 38.44 1 38.44-36.31 0-15.52-3.51-35.87-38.44-35.87h-74.66v72.18h74.66zM448 106.67v298.66A74.89 74.89 0 0 1 373.33 480H74.67A74.89 74.89 0 0 1 0 405.33V106.67A74.89 74.89 0 0 1 74.67 32h298.66A74.89 74.89 0 0 1 448 106.67zM338.05 317.86c0-21.57-6.65-58.29-49.05-67.35v-.73c22.91-9.78 37.34-28.25 37.34-55.64 0-7 2-64.78-77.6-64.78h-127v261.33c128.23 0 139.87 1.68 163.6-5.71 14.21-4.42 52.71-17.98 52.71-67.12z"],
"btc": [384, 512, [], "f15a", "M310.204 242.638c27.73-14.18 45.377-39.39 41.28-81.3-5.358-57.351-52.458-76.573-114.85-81.929V0h-48.528v77.203c-12.605 0-25.525.315-38.444.63V0h-48.528v79.409c-17.842.539-38.622.276-97.37 0v51.678c38.314-.678 58.417-3.14 63.023 21.427v217.429c-2.925 19.492-18.524 16.685-53.255 16.071L3.765 443.68c88.481 0 97.37.315 97.37.315V512h48.528v-67.06c13.234.315 26.154.315 38.444.315V512h48.528v-68.005c81.299-4.412 135.647-24.894 142.895-101.467 5.671-61.446-23.32-88.862-69.326-99.89zM150.608 134.553c27.415 0 113.126-8.507 113.126 48.528 0 54.515-85.71 48.212-113.126 48.212v-96.74zm0 251.776V279.821c32.772 0 133.127-9.138 133.127 53.255-.001 60.186-100.355 53.253-133.127 53.253z"],
"buffer": [448, 512, [], "f837", "M427.84 380.67l-196.5 97.82a18.6 18.6 0 0 1-14.67 0L20.16 380.67c-4-2-4-5.28 0-7.29L67.22 350a18.65 18.65 0 0 1 14.69 0l134.76 67a18.51 18.51 0 0 0 14.67 0l134.76-67a18.62 18.62 0 0 1 14.68 0l47.06 23.43c4.05 1.96 4.05 5.24 0 7.24zm0-136.53l-47.06-23.43a18.62 18.62 0 0 0-14.68 0l-134.76 67.08a18.68 18.68 0 0 1-14.67 0L81.91 220.71a18.65 18.65 0 0 0-14.69 0l-47.06 23.43c-4 2-4 5.29 0 7.31l196.51 97.8a18.6 18.6 0 0 0 14.67 0l196.5-97.8c4.05-2.02 4.05-5.3 0-7.31zM20.16 130.42l196.5 90.29a20.08 20.08 0 0 0 14.67 0l196.51-90.29c4-1.86 4-4.89 0-6.74L231.33 33.4a19.88 19.88 0 0 0-14.67 0l-196.5 90.28c-4.05 1.85-4.05 4.88 0 6.74z"],
"buromobelexperte": [448, 512, [], "f37f", "M0 32v128h128V32H0zm120 120H8V40h112v112zm40-120v128h128V32H160zm120 120H168V40h112v112zm40-120v128h128V32H320zm120 120H328V40h112v112zM0 192v128h128V192H0zm120 120H8V200h112v112zm40-120v128h128V192H160zm120 120H168V200h112v112zm40-120v128h128V192H320zm120 120H328V200h112v112zM0 352v128h128V352H0zm120 120H8V360h112v112zm40-120v128h128V352H160zm120 120H168V360h112v112zm40-120v128h128V352H320z"],
"buysellads": [448, 512, [], "f20d", "M224 150.7l42.9 160.7h-85.8L224 150.7zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-65.3 325.3l-94.5-298.7H159.8L65.3 405.3H156l111.7-91.6 24.2 91.6h90.8z"],
"canadian-maple-leaf": [512, 512, [], "f785", "M383.8 351.7c2.5-2.5 105.2-92.4 105.2-92.4l-17.5-7.5c-10-4.9-7.4-11.5-5-17.4 2.4-7.6 20.1-67.3 20.1-67.3s-47.7 10-57.7 12.5c-7.5 2.4-10-2.5-12.5-7.5s-15-32.4-15-32.4-52.6 59.9-55.1 62.3c-10 7.5-20.1 0-17.6-10 0-10 27.6-129.6 27.6-129.6s-30.1 17.4-40.1 22.4c-7.5 5-12.6 5-17.6-5C293.5 72.3 255.9 0 255.9 0s-37.5 72.3-42.5 79.8c-5 10-10 10-17.6 5-10-5-40.1-22.4-40.1-22.4S183.3 182 183.3 192c2.5 10-7.5 17.5-17.6 10-2.5-2.5-55.1-62.3-55.1-62.3S98.1 167 95.6 172s-5 9.9-12.5 7.5C73 177 25.4 167 25.4 167s17.6 59.7 20.1 67.3c2.4 6 5 12.5-5 17.4L23 259.3s102.6 89.9 105.2 92.4c5.1 5 10 7.5 5.1 22.5-5.1 15-10.1 35.1-10.1 35.1s95.2-20.1 105.3-22.6c8.7-.9 18.3 2.5 18.3 12.5S241 512 241 512h30s-5.8-102.7-5.8-112.8 9.5-13.4 18.4-12.5c10 2.5 105.2 22.6 105.2 22.6s-5-20.1-10-35.1 0-17.5 5-22.5z"],
"cc-amazon-pay": [576, 512, [], "f42d", "M124.7 201.8c.1-11.8 0-23.5 0-35.3v-35.3c0-1.3.4-2 1.4-2.7 11.5-8 24.1-12.1 38.2-11.1 12.5.9 22.7 7 28.1 21.7 3.3 8.9 4.1 18.2 4.1 27.7 0 8.7-.7 17.3-3.4 25.6-5.7 17.8-18.7 24.7-35.7 23.9-11.7-.5-21.9-5-31.4-11.7-.9-.8-1.4-1.6-1.3-2.8zm154.9 14.6c4.6 1.8 9.3 2 14.1 1.5 11.6-1.2 21.9-5.7 31.3-12.5.9-.6 1.3-1.3 1.3-2.5-.1-3.9 0-7.9 0-11.8 0-4-.1-8 0-12 0-1.4-.4-2-1.8-2.2-7-.9-13.9-2.2-20.9-2.9-7-.6-14-.3-20.8 1.9-6.7 2.2-11.7 6.2-13.7 13.1-1.6 5.4-1.6 10.8.1 16.2 1.6 5.5 5.2 9.2 10.4 11.2zM576 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h480c26.5 0 48 21.5 48 48zm-207.5 23.9c.4 1.7.9 3.4 1.6 5.1 16.5 40.6 32.9 81.3 49.5 121.9 1.4 3.5 1.7 6.4.2 9.9-2.8 6.2-4.9 12.6-7.8 18.7-2.6 5.5-6.7 9.5-12.7 11.2-4.2 1.1-8.5 1.3-12.9.9-2.1-.2-4.2-.7-6.3-.8-2.8-.2-4.2 1.1-4.3 4-.1 2.8-.1 5.6 0 8.3.1 4.6 1.6 6.7 6.2 7.5 4.7.8 9.4 1.6 14.2 1.7 14.3.3 25.7-5.4 33.1-17.9 2.9-4.9 5.6-10.1 7.7-15.4 19.8-50.1 39.5-100.3 59.2-150.5.6-1.5 1.1-3 1.3-4.6.4-2.4-.7-3.6-3.1-3.7-5.6-.1-11.1 0-16.7 0-3.1 0-5.3 1.4-6.4 4.3-.4 1.1-.9 2.3-1.3 3.4l-29.1 83.7c-2.1 6.1-4.2 12.1-6.5 18.6-.4-.9-.6-1.4-.8-1.9-10.8-29.9-21.6-59.9-32.4-89.8-1.7-4.7-3.5-9.5-5.3-14.2-.9-2.5-2.7-4-5.4-4-6.4-.1-12.8-.2-19.2-.1-2.2 0-3.3 1.6-2.8 3.7zM242.4 206c1.7 11.7 7.6 20.8 18 26.6 9.9 5.5 20.7 6.2 31.7 4.6 12.7-1.9 23.9-7.3 33.8-15.5.4-.3.8-.6 1.4-1 .5 3.2.9 6.2 1.5 9.2.5 2.6 2.1 4.3 4.5 4.4 4.6.1 9.1.1 13.7 0 2.3-.1 3.8-1.6 4-3.9.1-.8.1-1.6.1-2.3v-88.8c0-3.6-.2-7.2-.7-10.8-1.6-10.8-6.2-19.7-15.9-25.4-5.6-3.3-11.8-5-18.2-5.9-3-.4-6-.7-9.1-1.1h-10c-.8.1-1.6.3-2.5.3-8.2.4-16.3 1.4-24.2 3.5-5.1 1.3-10 3.2-15 4.9-3 1-4.5 3.2-4.4 6.5.1 2.8-.1 5.6 0 8.3.1 4.1 1.8 5.2 5.7 4.1 6.5-1.7 13.1-3.5 19.7-4.8 10.3-1.9 20.7-2.7 31.1-1.2 5.4.8 10.5 2.4 14.1 7 3.1 4 4.2 8.8 4.4 13.7.3 6.9.2 13.9.3 20.8 0 .4-.1.7-.2 1.2-.4 0-.8 0-1.1-.1-8.8-2.1-17.7-3.6-26.8-4.1-9.5-.5-18.9.1-27.9 3.2-10.8 3.8-19.5 10.3-24.6 20.8-4.1 8.3-4.6 17-3.4 25.8zM98.7 106.9v175.3c0 .8 0 1.7.1 2.5.2 2.5 1.7 4.1 4.1 4.2 5.9.1 11.8.1 17.7 0 2.5 0 4-1.7 4.1-4.1.1-.8.1-1.7.1-2.5v-60.7c.9.7 1.4 1.2 1.9 1.6 15 12.5 32.2 16.6 51.1 12.9 17.1-3.4 28.9-13.9 36.7-29.2 5.8-11.6 8.3-24.1 8.7-37 .5-14.3-1-28.4-6.8-41.7-7.1-16.4-18.9-27.3-36.7-30.9-2.7-.6-5.5-.8-8.2-1.2h-7c-1.2.2-2.4.3-3.6.5-11.7 1.4-22.3 5.8-31.8 12.7-2 1.4-3.9 3-5.9 4.5-.1-.5-.3-.8-.4-1.2-.4-2.3-.7-4.6-1.1-6.9-.6-3.9-2.5-5.5-6.4-5.6h-9.7c-5.9-.1-6.9 1-6.9 6.8zM493.6 339c-2.7-.7-5.1 0-7.6 1-43.9 18.4-89.5 30.2-136.8 35.8-14.5 1.7-29.1 2.8-43.7 3.2-26.6.7-53.2-.8-79.6-4.3-17.8-2.4-35.5-5.7-53-9.9-37-8.9-72.7-21.7-106.7-38.8-8.8-4.4-17.4-9.3-26.1-14-3.8-2.1-6.2-1.5-8.2 2.1v1.7c1.2 1.6 2.2 3.4 3.7 4.8 36 32.2 76.6 56.5 122 72.9 21.9 7.9 44.4 13.7 67.3 17.5 14 2.3 28 3.8 42.2 4.5 3 .1 6 .2 9 .4.7 0 1.4.2 2.1.3h17.7c.7-.1 1.4-.3 2.1-.3 14.9-.4 29.8-1.8 44.6-4 21.4-3.2 42.4-8.1 62.9-14.7 29.6-9.6 57.7-22.4 83.4-40.1 2.8-1.9 5.7-3.8 8-6.2 4.3-4.4 2.3-10.4-3.3-11.9zm50.4-27.7c-.8-4.2-4-5.8-7.6-7-5.7-1.9-11.6-2.8-17.6-3.3-11-.9-22-.4-32.8 1.6-12 2.2-23.4 6.1-33.5 13.1-1.2.8-2.4 1.8-3.1 3-.6.9-.7 2.3-.5 3.4.3 1.3 1.7 1.6 3 1.5.6 0 1.2 0 1.8-.1l19.5-2.1c9.6-.9 19.2-1.5 28.8-.8 4.1.3 8.1 1.2 12 2.2 4.3 1.1 6.2 4.4 6.4 8.7.3 6.7-1.2 13.1-2.9 19.5-3.5 12.9-8.3 25.4-13.3 37.8-.3.8-.7 1.7-.8 2.5-.4 2.5 1 4 3.4 3.5 1.4-.3 3-1.1 4-2.1 3.7-3.6 7.5-7.2 10.6-11.2 10.7-13.8 17-29.6 20.7-46.6.7-3 1.2-6.1 1.7-9.1.2-4.7.2-9.6.2-14.5z"],
"cc-amex": [576, 512, [], "f1f3", "M325.1 167.8c0-16.4-14.1-18.4-27.4-18.4l-39.1-.3v69.3H275v-25.1h18c18.4 0 14.5 10.3 14.8 25.1h16.6v-13.5c0-9.2-1.5-15.1-11-18.4 7.4-3 11.8-10.7 11.7-18.7zm-29.4 11.3H275v-15.3h21c5.1 0 10.7 1 10.7 7.4 0 6.6-5.3 7.9-11 7.9zM279 268.6h-52.7l-21 22.8-20.5-22.8h-66.5l-.1 69.3h65.4l21.3-23 20.4 23h32.2l.1-23.3c18.9 0 49.3 4.6 49.3-23.3 0-17.3-12.3-22.7-27.9-22.7zm-103.8 54.7h-40.6v-13.8h36.3v-14.1h-36.3v-12.5h41.7l17.9 20.2zm65.8 8.2l-25.3-28.1L241 276zm37.8-31h-21.2v-17.6h21.5c5.6 0 10.2 2.3 10.2 8.4 0 6.4-4.6 9.2-10.5 9.2zm-31.6-136.7v-14.6h-55.5v69.3h55.5v-14.3h-38.9v-13.8h37.8v-14.1h-37.8v-12.5zM576 255.4h-.2zm-194.6 31.9c0-16.4-14.1-18.7-27.1-18.7h-39.4l-.1 69.3h16.6l.1-25.3h17.6c11 0 14.8 2 14.8 13.8l-.1 11.5h16.6l.1-13.8c0-8.9-1.8-15.1-11-18.4 7.7-3.1 11.8-10.8 11.9-18.4zm-29.2 11.2h-20.7v-15.6h21c5.1 0 10.7 1 10.7 7.4 0 6.9-5.4 8.2-11 8.2zm-172.8-80v-69.3h-27.6l-19.7 47-21.7-47H83.3v65.7l-28.1-65.7H30.7L1 218.5h17.9l6.4-15.3h34.5l6.4 15.3H100v-54.2l24 54.2h14.6l24-54.2v54.2zM31.2 188.8l11.2-27.6 11.5 27.6zm477.4 158.9v-4.5c-10.8 5.6-3.9 4.5-156.7 4.5 0-25.2.1-23.9 0-25.2-1.7-.1-3.2-.1-9.4-.1 0 17.9-.1 6.8-.1 25.3h-39.6c0-12.1.1-15.3.1-29.2-10 6-22.8 6.4-34.3 6.2 0 14.7-.1 8.3-.1 23h-48.9c-5.1-5.7-2.7-3.1-15.4-17.4-3.2 3.5-12.8 13.9-16.1 17.4h-82v-92.3h83.1c5 5.6 2.8 3.1 15.5 17.2 3.2-3.5 12.2-13.4 15.7-17.2h58c9.8 0 18 1.9 24.3 5.6v-5.6c54.3 0 64.3-1.4 75.7 5.1v-5.1h78.2v5.2c11.4-6.9 19.6-5.2 64.9-5.2v5c10.3-5.9 16.6-5.2 54.3-5V80c0-26.5-21.5-48-48-48h-480c-26.5 0-48 21.5-48 48v109.8c9.4-21.9 19.7-46 23.1-53.9h39.7c4.3 10.1 1.6 3.7 9 21.1v-21.1h46c2.9 6.2 11.1 24 13.9 30 5.8-13.6 10.1-23.9 12.6-30h103c0-.1 11.5 0 11.6 0 43.7.2 53.6-.8 64.4 5.3v-5.3H363v9.3c7.6-6.1 17.9-9.3 30.7-9.3h27.6c0 .5 1.9.3 2.3.3H456c4.2 9.8 2.6 6 8.8 20.6v-20.6h43.3c4.9 8-1-1.8 11.2 18.4v-18.4h39.9v92h-41.6c-5.4-9-1.4-2.2-13.2-21.9v21.9h-52.8c-6.4-14.8-.1-.3-6.6-15.3h-19c-4.2 10-2.2 5.2-6.4 15.3h-26.8c-12.3 0-22.3-3-29.7-8.9v8.9h-66.5c-.3-13.9-.1-24.8-.1-24.8-1.8-.3-3.4-.2-9.8-.2v25.1H151.2v-11.4c-2.5 5.6-2.7 5.9-5.1 11.4h-29.5c-4-8.9-2.9-6.4-5.1-11.4v11.4H58.6c-4.2-10.1-2.2-5.3-6.4-15.3H33c-4.2 10-2.2 5.2-6.4 15.3H0V432c0 26.5 21.5 48 48 48h480.1c26.5 0 48-21.5 48-48v-90.4c-12.7 8.3-32.7 6.1-67.5 6.1zm36.3-64.5H575v-14.6h-32.9c-12.8 0-23.8 6.6-23.8 20.7 0 33 42.7 12.8 42.7 27.4 0 5.1-4.3 6.4-8.4 6.4h-32l-.1 14.8h32c8.4 0 17.6-1.8 22.5-8.9v-25.8c-10.5-13.8-39.3-1.3-39.3-13.5 0-5.8 4.6-6.5 9.2-6.5zm-57 39.8h-32.2l-.1 14.8h32.2c14.8 0 26.2-5.6 26.2-22 0-33.2-42.9-11.2-42.9-26.3 0-5.6 4.9-6.4 9.2-6.4h30.4v-14.6h-33.2c-12.8 0-23.5 6.6-23.5 20.7 0 33 42.7 12.5 42.7 27.4-.1 5.4-4.7 6.4-8.8 6.4zm-42.2-40.1v-14.3h-55.2l-.1 69.3h55.2l.1-14.3-38.6-.3v-13.8H445v-14.1h-37.8v-12.5zm-56.3-108.1c-.3.2-1.4 2.2-1.4 7.6 0 6 .9 7.7 1.1 7.9.2.1 1.1.5 3.4.5l7.3-16.9c-1.1 0-2.1-.1-3.1-.1-5.6 0-7 .7-7.3 1zm20.4-10.5h-.1zm-16.2-15.2c-23.5 0-34 12-34 35.3 0 22.2 10.2 34 33 34h19.2l6.4-15.3h34.3l6.6 15.3h33.7v-51.9l31.2 51.9h23.6v-69h-16.9v48.1l-29.1-48.1h-25.3v65.4l-27.9-65.4h-24.8l-23.5 54.5h-7.4c-13.3 0-16.1-8.1-16.1-19.9 0-23.8 15.7-20 33.1-19.7v-15.2zm42.1 12.1l11.2 27.6h-22.8zm-101.1-12v69.3h16.9v-69.3z"],
"cc-apple-pay": [576, 512, [], "f416", "M302.2 218.4c0 17.2-10.5 27.1-29 27.1h-24.3v-54.2h24.4c18.4 0 28.9 9.8 28.9 27.1zm47.5 62.6c0 8.3 7.2 13.7 18.5 13.7 14.4 0 25.2-9.1 25.2-21.9v-7.7l-23.5 1.5c-13.3.9-20.2 5.8-20.2 14.4zM576 79v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h480c26.5 0 48 21.5 48 48zM127.8 197.2c8.4.7 16.8-4.2 22.1-10.4 5.2-6.4 8.6-15 7.7-23.7-7.4.3-16.6 4.9-21.9 11.3-4.8 5.5-8.9 14.4-7.9 22.8zm60.6 74.5c-.2-.2-19.6-7.6-19.8-30-.2-18.7 15.3-27.7 16-28.2-8.8-13-22.4-14.4-27.1-14.7-12.2-.7-22.6 6.9-28.4 6.9-5.9 0-14.7-6.6-24.3-6.4-12.5.2-24.2 7.3-30.5 18.6-13.1 22.6-3.4 56 9.3 74.4 6.2 9.1 13.7 19.1 23.5 18.7 9.3-.4 13-6 24.2-6 11.3 0 14.5 6 24.3 5.9 10.2-.2 16.5-9.1 22.8-18.2 6.9-10.4 9.8-20.4 10-21zm135.4-53.4c0-26.6-18.5-44.8-44.9-44.8h-51.2v136.4h21.2v-46.6h29.3c26.8 0 45.6-18.4 45.6-45zm90 23.7c0-19.7-15.8-32.4-40-32.4-22.5 0-39.1 12.9-39.7 30.5h19.1c1.6-8.4 9.4-13.9 20-13.9 13 0 20.2 6 20.2 17.2v7.5l-26.4 1.6c-24.6 1.5-37.9 11.6-37.9 29.1 0 17.7 13.7 29.4 33.4 29.4 13.3 0 25.6-6.7 31.2-17.4h.4V310h19.6v-68zM516 210.9h-21.5l-24.9 80.6h-.4l-24.9-80.6H422l35.9 99.3-1.9 6c-3.2 10.2-8.5 14.2-17.9 14.2-1.7 0-4.9-.2-6.2-.3v16.4c1.2.4 6.5.5 8.1.5 20.7 0 30.4-7.9 38.9-31.8L516 210.9z"],
"cc-diners-club": [576, 512, [], "f24c", "M239.7 79.9c-96.9 0-175.8 78.6-175.8 175.8 0 96.9 78.9 175.8 175.8 175.8 97.2 0 175.8-78.9 175.8-175.8 0-97.2-78.6-175.8-175.8-175.8zm-39.9 279.6c-41.7-15.9-71.4-56.4-71.4-103.8s29.7-87.9 71.4-104.1v207.9zm79.8.3V151.6c41.7 16.2 71.4 56.7 71.4 104.1s-29.7 87.9-71.4 104.1zM528 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM329.7 448h-90.3c-106.2 0-193.8-85.5-193.8-190.2C45.6 143.2 133.2 64 239.4 64h90.3c105 0 200.7 79.2 200.7 193.8 0 104.7-95.7 190.2-200.7 190.2z"],
"cc-discover": [576, 512, [], "f1f2", "M520.4 196.1c0-7.9-5.5-12.1-15.6-12.1h-4.9v24.9h4.7c10.3 0 15.8-4.4 15.8-12.8zM528 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-44.1 138.9c22.6 0 52.9-4.1 52.9 24.4 0 12.6-6.6 20.7-18.7 23.2l25.8 34.4h-19.6l-22.2-32.8h-2.2v32.8h-16zm-55.9.1h45.3v14H444v18.2h28.3V217H444v22.2h29.3V253H428zm-68.7 0l21.9 55.2 22.2-55.2h17.5l-35.5 84.2h-8.6l-35-84.2zm-55.9-3c24.7 0 44.6 20 44.6 44.6 0 24.7-20 44.6-44.6 44.6-24.7 0-44.6-20-44.6-44.6 0-24.7 20-44.6 44.6-44.6zm-49.3 6.1v19c-20.1-20.1-46.8-4.7-46.8 19 0 25 27.5 38.5 46.8 19.2v19c-29.7 14.3-63.3-5.7-63.3-38.2 0-31.2 33.1-53 63.3-38zm-97.2 66.3c11.4 0 22.4-15.3-3.3-24.4-15-5.5-20.2-11.4-20.2-22.7 0-23.2 30.6-31.4 49.7-14.3l-8.4 10.8c-10.4-11.6-24.9-6.2-24.9 2.5 0 4.4 2.7 6.9 12.3 10.3 18.2 6.6 23.6 12.5 23.6 25.6 0 29.5-38.8 37.4-56.6 11.3l10.3-9.9c3.7 7.1 9.9 10.8 17.5 10.8zM55.4 253H32v-82h23.4c26.1 0 44.1 17 44.1 41.1 0 18.5-13.2 40.9-44.1 40.9zm67.5 0h-16v-82h16zM544 433c0 8.2-6.8 15-15 15H128c189.6-35.6 382.7-139.2 416-160zM74.1 191.6c-5.2-4.9-11.6-6.6-21.9-6.6H48v54.2h4.2c10.3 0 17-2 21.9-6.4 5.7-5.2 8.9-12.8 8.9-20.7s-3.2-15.5-8.9-20.5z"],
"cc-jcb": [576, 512, [], "f24b", "M431.5 244.3V212c41.2 0 38.5.2 38.5.2 7.3 1.3 13.3 7.3 13.3 16 0 8.8-6 14.5-13.3 15.8-1.2.4-3.3.3-38.5.3zm42.8 20.2c-2.8-.7-3.3-.5-42.8-.5v35c39.6 0 40 .2 42.8-.5 7.5-1.5 13.5-8 13.5-17 0-8.7-6-15.5-13.5-17zM576 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h480c26.5 0 48 21.5 48 48zM182 192.3h-57c0 67.1 10.7 109.7-35.8 109.7-19.5 0-38.8-5.7-57.2-14.8v28c30 8.3 68 8.3 68 8.3 97.9 0 82-47.7 82-131.2zm178.5 4.5c-63.4-16-165-14.9-165 59.3 0 77.1 108.2 73.6 165 59.2V287C312.9 311.7 253 309 253 256s59.8-55.6 107.5-31.2v-28zM544 286.5c0-18.5-16.5-30.5-38-32v-.8c19.5-2.7 30.3-15.5 30.3-30.2 0-19-15.7-30-37-31 0 0 6.3-.3-120.3-.3v127.5h122.7c24.3.1 42.3-12.9 42.3-33.2z"],
"cc-mastercard": [576, 512, [], "f1f1", "M482.9 410.3c0 6.8-4.6 11.7-11.2 11.7-6.8 0-11.2-5.2-11.2-11.7 0-6.5 4.4-11.7 11.2-11.7 6.6 0 11.2 5.2 11.2 11.7zm-310.8-11.7c-7.1 0-11.2 5.2-11.2 11.7 0 6.5 4.1 11.7 11.2 11.7 6.5 0 10.9-4.9 10.9-11.7-.1-6.5-4.4-11.7-10.9-11.7zm117.5-.3c-5.4 0-8.7 3.5-9.5 8.7h19.1c-.9-5.7-4.4-8.7-9.6-8.7zm107.8.3c-6.8 0-10.9 5.2-10.9 11.7 0 6.5 4.1 11.7 10.9 11.7 6.8 0 11.2-4.9 11.2-11.7 0-6.5-4.4-11.7-11.2-11.7zm105.9 26.1c0 .3.3.5.3 1.1 0 .3-.3.5-.3 1.1-.3.3-.3.5-.5.8-.3.3-.5.5-1.1.5-.3.3-.5.3-1.1.3-.3 0-.5 0-1.1-.3-.3 0-.5-.3-.8-.5-.3-.3-.5-.5-.5-.8-.3-.5-.3-.8-.3-1.1 0-.5 0-.8.3-1.1 0-.5.3-.8.5-1.1.3-.3.5-.3.8-.5.5-.3.8-.3 1.1-.3.5 0 .8 0 1.1.3.5.3.8.3 1.1.5s.2.6.5 1.1zm-2.2 1.4c.5 0 .5-.3.8-.3.3-.3.3-.5.3-.8 0-.3 0-.5-.3-.8-.3 0-.5-.3-1.1-.3h-1.6v3.5h.8V426h.3l1.1 1.4h.8l-1.1-1.3zM576 81v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V81c0-26.5 21.5-48 48-48h480c26.5 0 48 21.5 48 48zM64 220.6c0 76.5 62.1 138.5 138.5 138.5 27.2 0 53.9-8.2 76.5-23.1-72.9-59.3-72.4-171.2 0-230.5-22.6-15-49.3-23.1-76.5-23.1-76.4-.1-138.5 62-138.5 138.2zm224 108.8c70.5-55 70.2-162.2 0-217.5-70.2 55.3-70.5 162.6 0 217.5zm-142.3 76.3c0-8.7-5.7-14.4-14.7-14.7-4.6 0-9.5 1.4-12.8 6.5-2.4-4.1-6.5-6.5-12.2-6.5-3.8 0-7.6 1.4-10.6 5.4V392h-8.2v36.7h8.2c0-18.9-2.5-30.2 9-30.2 10.2 0 8.2 10.2 8.2 30.2h7.9c0-18.3-2.5-30.2 9-30.2 10.2 0 8.2 10 8.2 30.2h8.2v-23zm44.9-13.7h-7.9v4.4c-2.7-3.3-6.5-5.4-11.7-5.4-10.3 0-18.2 8.2-18.2 19.3 0 11.2 7.9 19.3 18.2 19.3 5.2 0 9-1.9 11.7-5.4v4.6h7.9V392zm40.5 25.6c0-15-22.9-8.2-22.9-15.2 0-5.7 11.9-4.8 18.5-1.1l3.3-6.5c-9.4-6.1-30.2-6-30.2 8.2 0 14.3 22.9 8.3 22.9 15 0 6.3-13.5 5.8-20.7.8l-3.5 6.3c11.2 7.6 32.6 6 32.6-7.5zm35.4 9.3l-2.2-6.8c-3.8 2.1-12.2 4.4-12.2-4.1v-16.6h13.1V392h-13.1v-11.2h-8.2V392h-7.6v7.3h7.6V416c0 17.6 17.3 14.4 22.6 10.9zm13.3-13.4h27.5c0-16.2-7.4-22.6-17.4-22.6-10.6 0-18.2 7.9-18.2 19.3 0 20.5 22.6 23.9 33.8 14.2l-3.8-6c-7.8 6.4-19.6 5.8-21.9-4.9zm59.1-21.5c-4.6-2-11.6-1.8-15.2 4.4V392h-8.2v36.7h8.2V408c0-11.6 9.5-10.1 12.8-8.4l2.4-7.6zm10.6 18.3c0-11.4 11.6-15.1 20.7-8.4l3.8-6.5c-11.6-9.1-32.7-4.1-32.7 15 0 19.8 22.4 23.8 32.7 15l-3.8-6.5c-9.2 6.5-20.7 2.6-20.7-8.6zm66.7-18.3H408v4.4c-8.3-11-29.9-4.8-29.9 13.9 0 19.2 22.4 24.7 29.9 13.9v4.6h8.2V392zm33.7 0c-2.4-1.2-11-2.9-15.2 4.4V392h-7.9v36.7h7.9V408c0-11 9-10.3 12.8-8.4l2.4-7.6zm40.3-14.9h-7.9v19.3c-8.2-10.9-29.9-5.1-29.9 13.9 0 19.4 22.5 24.6 29.9 13.9v4.6h7.9v-51.7zm7.6-75.1v4.6h.8V302h1.9v-.8h-4.6v.8h1.9zm6.6 123.8c0-.5 0-1.1-.3-1.6-.3-.3-.5-.8-.8-1.1-.3-.3-.8-.5-1.1-.8-.5 0-1.1-.3-1.6-.3-.3 0-.8.3-1.4.3-.5.3-.8.5-1.1.8-.5.3-.8.8-.8 1.1-.3.5-.3 1.1-.3 1.6 0 .3 0 .8.3 1.4 0 .3.3.8.8 1.1.3.3.5.5 1.1.8.5.3 1.1.3 1.4.3.5 0 1.1 0 1.6-.3.3-.3.8-.5 1.1-.8.3-.3.5-.8.8-1.1.3-.6.3-1.1.3-1.4zm3.2-124.7h-1.4l-1.6 3.5-1.6-3.5h-1.4v5.4h.8v-4.1l1.6 3.5h1.1l1.4-3.5v4.1h1.1v-5.4zm4.4-80.5c0-76.2-62.1-138.3-138.5-138.3-27.2 0-53.9 8.2-76.5 23.1 72.1 59.3 73.2 171.5 0 230.5 22.6 15 49.5 23.1 76.5 23.1 76.4.1 138.5-61.9 138.5-138.4z"],
"cc-paypal": [576, 512, [], "f1f4", "M186.3 258.2c0 12.2-9.7 21.5-22 21.5-9.2 0-16-5.2-16-15 0-12.2 9.5-22 21.7-22 9.3 0 16.3 5.7 16.3 15.5zM80.5 209.7h-4.7c-1.5 0-3 1-3.2 2.7l-4.3 26.7 8.2-.3c11 0 19.5-1.5 21.5-14.2 2.3-13.4-6.2-14.9-17.5-14.9zm284 0H360c-1.8 0-3 1-3.2 2.7l-4.2 26.7 8-.3c13 0 22-3 22-18-.1-10.6-9.6-11.1-18.1-11.1zM576 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h480c26.5 0 48 21.5 48 48zM128.3 215.4c0-21-16.2-28-34.7-28h-40c-2.5 0-5 2-5.2 4.7L32 294.2c-.3 2 1.2 4 3.2 4h19c2.7 0 5.2-2.9 5.5-5.7l4.5-26.6c1-7.2 13.2-4.7 18-4.7 28.6 0 46.1-17 46.1-45.8zm84.2 8.8h-19c-3.8 0-4 5.5-4.2 8.2-5.8-8.5-14.2-10-23.7-10-24.5 0-43.2 21.5-43.2 45.2 0 19.5 12.2 32.2 31.7 32.2 9 0 20.2-4.9 26.5-11.9-.5 1.5-1 4.7-1 6.2 0 2.3 1 4 3.2 4H200c2.7 0 5-2.9 5.5-5.7l10.2-64.3c.3-1.9-1.2-3.9-3.2-3.9zm40.5 97.9l63.7-92.6c.5-.5.5-1 .5-1.7 0-1.7-1.5-3.5-3.2-3.5h-19.2c-1.7 0-3.5 1-4.5 2.5l-26.5 39-11-37.5c-.8-2.2-3-4-5.5-4h-18.7c-1.7 0-3.2 1.8-3.2 3.5 0 1.2 19.5 56.8 21.2 62.1-2.7 3.8-20.5 28.6-20.5 31.6 0 1.8 1.5 3.2 3.2 3.2h19.2c1.8-.1 3.5-1.1 4.5-2.6zm159.3-106.7c0-21-16.2-28-34.7-28h-39.7c-2.7 0-5.2 2-5.5 4.7l-16.2 102c-.2 2 1.3 4 3.2 4h20.5c2 0 3.5-1.5 4-3.2l4.5-29c1-7.2 13.2-4.7 18-4.7 28.4 0 45.9-17 45.9-45.8zm84.2 8.8h-19c-3.8 0-4 5.5-4.3 8.2-5.5-8.5-14-10-23.7-10-24.5 0-43.2 21.5-43.2 45.2 0 19.5 12.2 32.2 31.7 32.2 9.3 0 20.5-4.9 26.5-11.9-.3 1.5-1 4.7-1 6.2 0 2.3 1 4 3.2 4H484c2.7 0 5-2.9 5.5-5.7l10.2-64.3c.3-1.9-1.2-3.9-3.2-3.9zm47.5-33.3c0-2-1.5-3.5-3.2-3.5h-18.5c-1.5 0-3 1.2-3.2 2.7l-16.2 104-.3.5c0 1.8 1.5 3.5 3.5 3.5h16.5c2.5 0 5-2.9 5.2-5.7L544 191.2v-.3zm-90 51.8c-12.2 0-21.7 9.7-21.7 22 0 9.7 7 15 16.2 15 12 0 21.7-9.2 21.7-21.5.1-9.8-6.9-15.5-16.2-15.5z"],
"cc-stripe": [576, 512, [], "f1f5", "M492.4 220.8c-8.9 0-18.7 6.7-18.7 22.7h36.7c0-16-9.3-22.7-18-22.7zM375 223.4c-8.2 0-13.3 2.9-17 7l.2 52.8c3.5 3.7 8.5 6.7 16.8 6.7 13.1 0 21.9-14.3 21.9-33.4 0-18.6-9-33.2-21.9-33.1zM528 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM122.2 281.1c0 25.6-20.3 40.1-49.9 40.3-12.2 0-25.6-2.4-38.8-8.1v-33.9c12 6.4 27.1 11.3 38.9 11.3 7.9 0 13.6-2.1 13.6-8.7 0-17-54-10.6-54-49.9 0-25.2 19.2-40.2 48-40.2 11.8 0 23.5 1.8 35.3 6.5v33.4c-10.8-5.8-24.5-9.1-35.3-9.1-7.5 0-12.1 2.2-12.1 7.7 0 16 54.3 8.4 54.3 50.7zm68.8-56.6h-27V275c0 20.9 22.5 14.4 27 12.6v28.9c-4.7 2.6-13.3 4.7-24.9 4.7-21.1 0-36.9-15.5-36.9-36.5l.2-113.9 34.7-7.4v30.8H191zm74 2.4c-4.5-1.5-18.7-3.6-27.1 7.4v84.4h-35.5V194.2h30.7l2.2 10.5c8.3-15.3 24.9-12.2 29.6-10.5h.1zm44.1 91.8h-35.7V194.2h35.7zm0-142.9l-35.7 7.6v-28.9l35.7-7.6zm74.1 145.5c-12.4 0-20-5.3-25.1-9l-.1 40.2-35.5 7.5V194.2h31.3l1.8 8.8c4.9-4.5 13.9-11.1 27.8-11.1 24.9 0 48.4 22.5 48.4 63.8 0 45.1-23.2 65.5-48.6 65.6zm160.4-51.5h-69.5c1.6 16.6 13.8 21.5 27.6 21.5 14.1 0 25.2-3 34.9-7.9V312c-9.7 5.3-22.4 9.2-39.4 9.2-34.6 0-58.8-21.7-58.8-64.5 0-36.2 20.5-64.9 54.3-64.9 33.7 0 51.3 28.7 51.3 65.1 0 3.5-.3 10.9-.4 12.9z"],
"cc-visa": [576, 512, [], "f1f0", "M470.1 231.3s7.6 37.2 9.3 45H446c3.3-8.9 16-43.5 16-43.5-.2.3 3.3-9.1 5.3-14.9l2.8 13.4zM576 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h480c26.5 0 48 21.5 48 48zM152.5 331.2L215.7 176h-42.5l-39.3 106-4.3-21.5-14-71.4c-2.3-9.9-9.4-12.7-18.2-13.1H32.7l-.7 3.1c15.8 4 29.9 9.8 42.2 17.1l35.8 135h42.5zm94.4.2L272.1 176h-40.2l-25.1 155.4h40.1zm139.9-50.8c.2-17.7-10.6-31.2-33.7-42.3-14.1-7.1-22.7-11.9-22.7-19.2.2-6.6 7.3-13.4 23.1-13.4 13.1-.3 22.7 2.8 29.9 5.9l3.6 1.7 5.5-33.6c-7.9-3.1-20.5-6.6-36-6.6-39.7 0-67.6 21.2-67.8 51.4-.3 22.3 20 34.7 35.2 42.2 15.5 7.6 20.8 12.6 20.8 19.3-.2 10.4-12.6 15.2-24.1 15.2-16 0-24.6-2.5-37.7-8.3l-5.3-2.5-5.6 34.9c9.4 4.3 26.8 8.1 44.8 8.3 42.2.1 69.7-20.8 70-53zM528 331.4L495.6 176h-31.1c-9.6 0-16.9 2.8-21 12.9l-59.7 142.5H426s6.9-19.2 8.4-23.3H486c1.2 5.5 4.8 23.3 4.8 23.3H528z"],
"centercode": [512, 512, [], "f380", "M329.2 268.6c-3.8 35.2-35.4 60.6-70.6 56.8-35.2-3.8-60.6-35.4-56.8-70.6 3.8-35.2 35.4-60.6 70.6-56.8 35.1 3.8 60.6 35.4 56.8 70.6zm-85.8 235.1C96.7 496-8.2 365.5 10.1 224.3c11.2-86.6 65.8-156.9 139.1-192 161-77.1 349.7 37.4 354.7 216.6 4.1 147-118.4 262.2-260.5 254.8zm179.9-180c27.9-118-160.5-205.9-237.2-234.2-57.5 56.3-69.1 188.6-33.8 344.4 68.8 15.8 169.1-26.4 271-110.2z"],
"centos": [448, 512, [], "f789", "M289.6 97.5l31.6 31.7-76.3 76.5V97.5zm-162.4 31.7l76.3 76.5V97.5h-44.7zm41.5-41.6h44.7v127.9l10.8 10.8 10.8-10.8V87.6h44.7L224.2 32zm26.2 168.1l-10.8-10.8H55.5v-44.8L0 255.7l55.5 55.6v-44.8h128.6l10.8-10.8zm79.3-20.7h107.9v-44.8l-31.6-31.7zm173.3 20.7L392 200.1v44.8H264.3l-10.8 10.8 10.8 10.8H392v44.8l55.5-55.6zM65.4 176.2l32.5-31.7 90.3 90.5h15.3v-15.3l-90.3-90.5 31.6-31.7H65.4zm316.7-78.7h-78.5l31.6 31.7-90.3 90.5V235h15.3l90.3-90.5 31.6 31.7zM203.5 413.9V305.8l-76.3 76.5 31.6 31.7h44.7zM65.4 235h108.8l-76.3-76.5-32.5 31.7zm316.7 100.2l-31.6 31.7-90.3-90.5h-15.3v15.3l90.3 90.5-31.6 31.7h78.5zm0-58.8H274.2l76.3 76.5 31.6-31.7zm-60.9 105.8l-76.3-76.5v108.1h44.7zM97.9 352.9l76.3-76.5H65.4v44.8zm181.8 70.9H235V295.9l-10.8-10.8-10.8 10.8v127.9h-44.7l55.5 55.6zm-166.5-41.6l90.3-90.5v-15.3h-15.3l-90.3 90.5-32.5-31.7v78.7h79.4z"],
"chrome": [496, 512, [], "f268", "M131.5 217.5L55.1 100.1c47.6-59.2 119-91.8 192-92.1 42.3-.3 85.5 10.5 124.8 33.2 43.4 25.2 76.4 61.4 97.4 103L264 133.4c-58.1-3.4-113.4 29.3-132.5 84.1zm32.9 38.5c0 46.2 37.4 83.6 83.6 83.6s83.6-37.4 83.6-83.6-37.4-83.6-83.6-83.6-83.6 37.3-83.6 83.6zm314.9-89.2L339.6 174c37.9 44.3 38.5 108.2 6.6 157.2L234.1 503.6c46.5 2.5 94.4-7.7 137.8-32.9 107.4-62 150.9-192 107.4-303.9zM133.7 303.6L40.4 120.1C14.9 159.1 0 205.9 0 256c0 124 90.8 226.7 209.5 244.9l63.7-124.8c-57.6 10.8-113.2-20.8-139.5-72.5z"],
"chromecast": [512, 512, [], "f838", "M447.83 64H64a42.72 42.72 0 0 0-42.72 42.72v63.92H64v-63.92h383.83v298.56H298.64V448H448a42.72 42.72 0 0 0 42.72-42.72V106.72A42.72 42.72 0 0 0 448 64zM21.28 383.58v63.92h63.91a63.91 63.91 0 0 0-63.91-63.92zm0-85.28V341a106.63 106.63 0 0 1 106.64 106.66v.34h42.72a149.19 149.19 0 0 0-149-149.36h-.33zm0-85.27v42.72c106-.1 192 85.75 192.08 191.75v.5h42.72c-.46-129.46-105.34-234.27-234.8-234.64z"],
"cloudscale": [448, 512, [], "f383", "M318.1 154l-9.4 7.6c-22.5-19.3-51.5-33.6-83.3-33.6C153.8 128 96 188.8 96 260.3c0 6.6.4 13.1 1.4 19.4-2-56 41.8-97.4 92.6-97.4 24.2 0 46.2 9.4 62.6 24.7l-25.2 20.4c-8.3-.9-16.8 1.8-23.1 8.1-11.1 11-11.1 28.9 0 40 11.1 11 28.9 11 40 0 6.3-6.3 9-14.9 8.1-23.1l75.2-88.8c6.3-6.5-3.3-15.9-9.5-9.6zm-83.8 111.5c-5.6 5.5-14.6 5.5-20.2 0-5.6-5.6-5.6-14.6 0-20.2s14.6-5.6 20.2 0 5.6 14.7 0 20.2zM224 32C100.5 32 0 132.5 0 256s100.5 224 224 224 224-100.5 224-224S347.5 32 224 32zm0 384c-88.2 0-160-71.8-160-160S135.8 96 224 96s160 71.8 160 160-71.8 160-160 160z"],
"cloudsmith": [332, 512, [], "f384", "M332.5 419.9c0 46.4-37.6 84.1-84 84.1s-84-37.7-84-84.1 37.6-84 84-84 84 37.6 84 84zm-84-243.9c46.4 0 80-37.6 80-84s-33.6-84-80-84-88 37.6-88 84-29.6 76-76 76-84 41.6-84 88 37.6 80 84 80 84-33.6 84-80 33.6-80 80-80z"],
"cloudversify": [616, 512, [], "f385", "M148.6 304c8.2 68.5 67.4 115.5 146 111.3 51.2 43.3 136.8 45.8 186.4-5.6 69.2 1.1 118.5-44.6 131.5-99.5 14.8-62.5-18.2-132.5-92.1-155.1-33-88.1-131.4-101.5-186.5-85-57.3 17.3-84.3 53.2-99.3 109.7-7.8 2.7-26.5 8.9-45 24.1 11.7 0 15.2 8.9 15.2 19.5v20.4c0 10.7-8.7 19.5-19.5 19.5h-20.2c-10.7 0-19.5-6-19.5-16.7V240H98.8C95 240 88 244.3 88 251.9v40.4c0 6.4 5.3 11.8 11.7 11.8h48.9zm227.4 8c-10.7 46.3 21.7 72.4 55.3 86.8C324.1 432.6 259.7 348 296 288c-33.2 21.6-33.7 71.2-29.2 92.9-17.9-12.4-53.8-32.4-57.4-79.8-3-39.9 21.5-75.7 57-93.9C297 191.4 369.9 198.7 400 248c-14.1-48-53.8-70.1-101.8-74.8 30.9-30.7 64.4-50.3 114.2-43.7 69.8 9.3 133.2 82.8 67.7 150.5 35-16.3 48.7-54.4 47.5-76.9l10.5 19.6c11.8 22 15.2 47.6 9.4 72-9.2 39-40.6 68.8-79.7 76.5-32.1 6.3-83.1-5.1-91.8-59.2zM128 208H88.2c-8.9 0-16.2-7.3-16.2-16.2v-39.6c0-8.9 7.3-16.2 16.2-16.2H128c8.9 0 16.2 7.3 16.2 16.2v39.6c0 8.9-7.3 16.2-16.2 16.2zM10.1 168C4.5 168 0 163.5 0 157.9v-27.8c0-5.6 4.5-10.1 10.1-10.1h27.7c5.5 0 10.1 4.5 10.1 10.1v27.8c0 5.6-4.5 10.1-10.1 10.1H10.1zM168 142.7v-21.4c0-5.1 4.2-9.3 9.3-9.3h21.4c5.1 0 9.3 4.2 9.3 9.3v21.4c0 5.1-4.2 9.3-9.3 9.3h-21.4c-5.1 0-9.3-4.2-9.3-9.3zM56 235.5v25c0 6.3-5.1 11.5-11.4 11.5H19.4C13.1 272 8 266.8 8 260.5v-25c0-6.3 5.1-11.5 11.4-11.5h25.1c6.4 0 11.5 5.2 11.5 11.5z"],
"codepen": [512, 512, [], "f1cb", "M502.285 159.704l-234-156c-7.987-4.915-16.511-4.96-24.571 0l-234 156C3.714 163.703 0 170.847 0 177.989v155.999c0 7.143 3.714 14.286 9.715 18.286l234 156.022c7.987 4.915 16.511 4.96 24.571 0l234-156.022c6-3.999 9.715-11.143 9.715-18.286V177.989c-.001-7.142-3.715-14.286-9.716-18.285zM278 63.131l172.286 114.858-76.857 51.429L278 165.703V63.131zm-44 0v102.572l-95.429 63.715-76.857-51.429L234 63.131zM44 219.132l55.143 36.857L44 292.846v-73.714zm190 229.715L61.714 333.989l76.857-51.429L234 346.275v102.572zm22-140.858l-77.715-52 77.715-52 77.715 52-77.715 52zm22 140.858V346.275l95.429-63.715 76.857 51.429L278 448.847zm190-156.001l-55.143-36.857L468 219.132v73.714z"],
"codiepie": [472, 512, [], "f284", "M422.5 202.9c30.7 0 33.5 53.1-.3 53.1h-10.8v44.3h-26.6v-97.4h37.7zM472 352.6C429.9 444.5 350.4 504 248 504 111 504 0 393 0 256S111 8 248 8c97.4 0 172.8 53.7 218.2 138.4l-186 108.8L472 352.6zm-38.5 12.5l-60.3-30.7c-27.1 44.3-70.4 71.4-122.4 71.4-82.5 0-149.2-66.7-149.2-148.9 0-82.5 66.7-149.2 149.2-149.2 48.4 0 88.9 23.5 116.9 63.4l59.5-34.6c-40.7-62.6-104.7-100-179.2-100-121.2 0-219.5 98.3-219.5 219.5S126.8 475.5 248 475.5c78.6 0 146.5-42.1 185.5-110.4z"],
"confluence": [512, 512, [], "f78d", "M2.3 412.2c-4.5 7.6-2.1 17.5 5.5 22.2l105.9 65.2c7.7 4.7 17.7 2.4 22.4-5.3 0-.1.1-.2.1-.2 67.1-112.2 80.5-95.9 280.9-.7 8.1 3.9 17.8.4 21.7-7.7.1-.1.1-.3.2-.4l50.4-114.1c3.6-8.1-.1-17.6-8.1-21.3-22.2-10.4-66.2-31.2-105.9-50.3C127.5 179 44.6 345.3 2.3 412.2zm507.4-312.1c4.5-7.6 2.1-17.5-5.5-22.2L398.4 12.8c-7.5-5-17.6-3.1-22.6 4.4-.2.3-.4.6-.6 1-67.3 112.6-81.1 95.6-280.6.9-8.1-3.9-17.8-.4-21.7 7.7-.1.1-.1.3-.2.4L22.2 141.3c-3.6 8.1.1 17.6 8.1 21.3 22.2 10.4 66.3 31.2 106 50.4 248 120 330.8-45.4 373.4-112.9z"],
"connectdevelop": [576, 512, [], "f20e", "M550.5 241l-50.089-86.786c1.071-2.142 1.875-4.553 1.875-7.232 0-8.036-6.696-14.733-14.732-15.001l-55.447-95.893c.536-1.607 1.071-3.214 1.071-4.821 0-8.571-6.964-15.268-15.268-15.268-4.821 0-8.839 2.143-11.786 5.625H299.518C296.839 18.143 292.821 16 288 16s-8.839 2.143-11.518 5.625H170.411C167.464 18.143 163.447 16 158.625 16c-8.303 0-15.268 6.696-15.268 15.268 0 1.607.536 3.482 1.072 4.821l-55.983 97.233c-5.356 2.41-9.107 7.5-9.107 13.661 0 .535.268 1.071.268 1.607l-53.304 92.143c-7.232 1.339-12.59 7.5-12.59 15 0 7.232 5.089 13.393 12.054 15l55.179 95.358c-.536 1.607-.804 2.946-.804 4.821 0 7.232 5.089 13.393 12.054 14.732l51.697 89.732c-.536 1.607-1.071 3.482-1.071 5.357 0 8.571 6.964 15.268 15.268 15.268 4.821 0 8.839-2.143 11.518-5.357h106.875C279.161 493.857 283.447 496 288 496s8.839-2.143 11.518-5.357h107.143c2.678 2.946 6.696 4.821 10.982 4.821 8.571 0 15.268-6.964 15.268-15.268 0-1.607-.267-2.946-.803-4.285l51.697-90.268c6.964-1.339 12.054-7.5 12.054-14.732 0-1.607-.268-3.214-.804-4.821l54.911-95.358c6.964-1.339 12.322-7.5 12.322-15-.002-7.232-5.092-13.393-11.788-14.732zM153.535 450.732l-43.66-75.803h43.66v75.803zm0-83.839h-43.66c-.268-1.071-.804-2.142-1.339-3.214l44.999-47.41v50.624zm0-62.411l-50.357 53.304c-1.339-.536-2.679-1.34-4.018-1.607L43.447 259.75c.535-1.339.535-2.679.535-4.018s0-2.41-.268-3.482l51.965-90c2.679-.268 5.357-1.072 7.768-2.679l50.089 51.965v92.946zm0-102.322l-45.803-47.41c1.339-2.143 2.143-4.821 2.143-7.767 0-.268-.268-.804-.268-1.072l43.928-15.804v72.053zm0-80.625l-43.66 15.804 43.66-75.536v59.732zm326.519 39.108l.804 1.339L445.5 329.125l-63.75-67.232 98.036-101.518.268.268zM291.75 355.107l11.518 11.786H280.5l11.25-11.786zm-.268-11.25l-83.303-85.446 79.553-84.375 83.036 87.589-79.286 82.232zm5.357 5.893l79.286-82.232 67.5 71.25-5.892 28.125H313.714l-16.875-17.143zM410.411 44.393c1.071.536 2.142 1.072 3.482 1.34l57.857 100.714v.536c0 2.946.803 5.624 2.143 7.767L376.393 256l-83.035-87.589L410.411 44.393zm-9.107-2.143L287.732 162.518l-57.054-60.268 166.339-60h4.287zm-123.483 0c2.678 2.678 6.16 4.285 10.179 4.285s7.5-1.607 10.179-4.285h75L224.786 95.821 173.893 42.25h103.928zm-116.249 5.625l1.071-2.142a33.834 33.834 0 0 0 2.679-.804l51.161 53.84-54.911 19.821V47.875zm0 79.286l60.803-21.964 59.732 63.214-79.553 84.107-40.982-42.053v-83.304zm0 92.678L198 257.607l-36.428 38.304v-76.072zm0 87.858l42.053-44.464 82.768 85.982-17.143 17.678H161.572v-59.196zm6.964 162.053c-1.607-1.607-3.482-2.678-5.893-3.482l-1.071-1.607v-89.732h99.91l-91.607 94.821h-1.339zm129.911 0c-2.679-2.41-6.428-4.285-10.447-4.285s-7.767 1.875-10.447 4.285h-96.429l91.607-94.821h38.304l91.607 94.821H298.447zm120-11.786l-4.286 7.5c-1.339.268-2.41.803-3.482 1.339l-89.196-91.875h114.376l-17.412 83.036zm12.856-22.232l12.858-60.803h21.964l-34.822 60.803zm34.822-68.839h-20.357l4.553-21.16 17.143 18.214c-.535.803-1.071 1.874-1.339 2.946zm66.161-107.411l-55.447 96.697c-1.339.535-2.679 1.071-4.018 1.874l-20.625-21.964 34.554-163.928 45.803 79.286c-.267 1.339-.803 2.678-.803 4.285 0 1.339.268 2.411.536 3.75z"],
"contao": [512, 512, [], "f26d", "M45.4 305c14.4 67.1 26.4 129 68.2 175H34c-18.7 0-34-15.2-34-34V66c0-18.7 15.2-34 34-34h57.7C77.9 44.6 65.6 59.2 54.8 75.6c-45.4 70-27 146.8-9.4 229.4zM478 32h-90.2c21.4 21.4 39.2 49.5 52.7 84.1l-137.1 29.3c-14.9-29-37.8-53.3-82.6-43.9-24.6 5.3-41 19.3-48.3 34.6-8.8 18.7-13.2 39.8 8.2 140.3 21.1 100.2 33.7 117.7 49.5 131.2 12.9 11.1 33.4 17 58.3 11.7 44.5-9.4 55.7-40.7 57.4-73.2l137.4-29.6c3.2 71.5-18.7 125.2-57.4 163.6H478c18.7 0 34-15.2 34-34V66c0-18.8-15.2-34-34-34z"],
"cpanel": [640, 512, [], "f388", "M210.3 220.2c-5.6-24.8-26.9-41.2-51-41.2h-37c-7.1 0-12.5 4.5-14.3 10.9L73.1 320l24.7-.1c6.8 0 12.3-4.5 14.2-10.7l25.8-95.7h19.8c8.4 0 16.2 5.6 18.3 14.8 2.5 10.9-5.9 22.6-18.3 22.6h-10.3c-7 0-12.5 4.6-14.3 10.8l-6.4 23.8h32c37.2 0 58.3-36.2 51.7-65.3zm-156.5 28h18.6c6.9 0 12.4-4.4 14.3-10.9l6.2-23.6h-40C30 213.7 9 227.8 1.7 254.8-7 288.6 18.5 320 52 320h12.4l7.1-26.1c1.2-4.4-2.2-8.3-6.4-8.3H53.8c-24.7 0-24.9-37.4 0-37.4zm247.5-34.8h-77.9l-3.5 13.4c-2.4 9.6 4.5 18.5 14.2 18.5h57.5c4 0 2.4 4.3 2.1 5.3l-8.6 31.8c-.4 1.4-.9 5.3-5.5 5.3h-34.9c-5.3 0-5.3-7.9 0-7.9h21.6c6.8 0 12.3-4.6 14.2-10.8l3.5-13.2h-48.4c-39.2 0-43.6 63.8-.7 63.8l57.5.2c11.2 0 20.6-7.2 23.4-17.8l14-51.8c4.8-19.2-9.7-36.8-28.5-36.8zM633.1 179h-18.9c-4.9 0-9.2 3.2-10.4 7.9L568.2 320c20.7 0 39.8-13.8 44.9-34.5l26.5-98.2c1.2-4.3-2-8.3-6.5-8.3zm-236.3 34.7v.1h-48.3l-26.2 98c-1.2 4.4 2.2 8.3 6.4 8.3h18.9c4.8 0 9.2-3 10.4-7.8l17.2-64H395c12.5 0 21.4 11.8 18.1 23.4l-10.6 40c-1.2 4.3 1.9 8.3 6.4 8.3H428c4.6 0 9.1-2.9 10.3-7.8l8.8-33.1c9-33.1-15.9-65.4-50.3-65.4zm98.3 74.6c-3.6 0-6-3.4-5.1-6.7l8-30c.9-3.9 3.7-6 7.8-6h32.9c2.6 0 4.6 2.4 3.9 5.1l-.7 2.6c-.6 2-1.9 3-3.9 3h-21.6c-7 0-12.6 4.6-14.2 10.8l-3.5 13h53.4c10.5 0 20.3-6.6 23.2-17.6l3.2-12c4.9-19.1-9.3-36.8-28.3-36.8h-47.3c-17.9 0-33.8 12-38.6 29.6l-10.8 40c-5 17.7 8.3 36.7 28.3 36.7h66.7c6.8 0 12.3-4.5 14.2-10.7l5.7-21z"],
"creative-commons": [496, 512, [], "f25e", "M245.83 214.87l-33.22 17.28c-9.43-19.58-25.24-19.93-27.46-19.93-22.13 0-33.22 14.61-33.22 43.84 0 23.57 9.21 43.84 33.22 43.84 14.47 0 24.65-7.09 30.57-21.26l30.55 15.5c-6.17 11.51-25.69 38.98-65.1 38.98-22.6 0-73.96-10.32-73.96-77.05 0-58.69 43-77.06 72.63-77.06 30.72-.01 52.7 11.95 65.99 35.86zm143.05 0l-32.78 17.28c-9.5-19.77-25.72-19.93-27.9-19.93-22.14 0-33.22 14.61-33.22 43.84 0 23.55 9.23 43.84 33.22 43.84 14.45 0 24.65-7.09 30.54-21.26l31 15.5c-2.1 3.75-21.39 38.98-65.09 38.98-22.69 0-73.96-9.87-73.96-77.05 0-58.67 42.97-77.06 72.63-77.06 30.71-.01 52.58 11.95 65.56 35.86zM247.56 8.05C104.74 8.05 0 123.11 0 256.05c0 138.49 113.6 248 247.56 248 129.93 0 248.44-100.87 248.44-248 0-137.87-106.62-248-248.44-248zm.87 450.81c-112.54 0-203.7-93.04-203.7-202.81 0-105.42 85.43-203.27 203.72-203.27 112.53 0 202.82 89.46 202.82 203.26-.01 121.69-99.68 202.82-202.84 202.82z"],
"creative-commons-by": [496, 512, [], "f4e7", "M314.9 194.4v101.4h-28.3v120.5h-77.1V295.9h-28.3V194.4c0-4.4 1.6-8.2 4.6-11.3 3.1-3.1 6.9-4.7 11.3-4.7H299c4.1 0 7.8 1.6 11.1 4.7 3.1 3.2 4.8 6.9 4.8 11.3zm-101.5-63.7c0-23.3 11.5-35 34.5-35s34.5 11.7 34.5 35c0 23-11.5 34.5-34.5 34.5s-34.5-11.5-34.5-34.5zM247.6 8C389.4 8 496 118.1 496 256c0 147.1-118.5 248-248.4 248C113.6 504 0 394.5 0 256 0 123.1 104.7 8 247.6 8zm.8 44.7C130.2 52.7 44.7 150.6 44.7 256c0 109.8 91.2 202.8 203.7 202.8 103.2 0 202.8-81.1 202.8-202.8.1-113.8-90.2-203.3-202.8-203.3z"],
"creative-commons-nc": [496, 512, [], "f4e8", "M247.6 8C387.4 8 496 115.9 496 256c0 147.2-118.5 248-248.4 248C113.1 504 0 393.2 0 256 0 123.1 104.7 8 247.6 8zM55.8 189.1c-7.4 20.4-11.1 42.7-11.1 66.9 0 110.9 92.1 202.4 203.7 202.4 122.4 0 177.2-101.8 178.5-104.1l-93.4-41.6c-7.7 37.1-41.2 53-68.2 55.4v38.1h-28.8V368c-27.5-.3-52.6-10.2-75.3-29.7l34.1-34.5c31.7 29.4 86.4 31.8 86.4-2.2 0-6.2-2.2-11.2-6.6-15.1-14.2-6-1.8-.1-219.3-97.4zM248.4 52.3c-38.4 0-112.4 8.7-170.5 93l94.8 42.5c10-31.3 40.4-42.9 63.8-44.3v-38.1h28.8v38.1c22.7 1.2 43.4 8.9 62 23L295 199.7c-42.7-29.9-83.5-8-70 11.1 53.4 24.1 43.8 19.8 93 41.6l127.1 56.7c4.1-17.4 6.2-35.1 6.2-53.1 0-57-19.8-105-59.3-143.9-39.3-39.9-87.2-59.8-143.6-59.8z"],
"creative-commons-nc-eu": [496, 512, [], "f4e9", "M247.7 8C103.6 8 0 124.8 0 256c0 136.3 111.7 248 247.7 248C377.9 504 496 403.1 496 256 496 117 388.4 8 247.7 8zm.6 450.7c-112 0-203.6-92.5-203.6-202.7 0-23.2 3.7-45.2 10.9-66l65.7 29.1h-4.7v29.5h23.3c0 6.2-.4 3.2-.4 19.5h-22.8v29.5h27c11.4 67 67.2 101.3 124.6 101.3 26.6 0 50.6-7.9 64.8-15.8l-10-46.1c-8.7 4.6-28.2 10.8-47.3 10.8-28.2 0-58.1-10.9-67.3-50.2h90.3l128.3 56.8c-1.5 2.1-56.2 104.3-178.8 104.3zm-16.7-190.6l-.5-.4.9.4h-.4zm77.2-19.5h3.7v-29.5h-70.3l-28.6-12.6c2.5-5.5 5.4-10.5 8.8-14.3 12.9-15.8 31.1-22.4 51.1-22.4 18.3 0 35.3 5.4 46.1 10l11.6-47.3c-15-6.6-37-12.4-62.3-12.4-39 0-72.2 15.8-95.9 42.3-5.3 6.1-9.8 12.9-13.9 20.1l-81.6-36.1c64.6-96.8 157.7-93.6 170.7-93.6 113 0 203 90.2 203 203.4 0 18.7-2.1 36.3-6.3 52.9l-136.1-60.5z"],
"creative-commons-nc-jp": [496, 512, [], "f4ea", "M247.7 8C103.6 8 0 124.8 0 256c0 136.4 111.8 248 247.7 248C377.9 504 496 403.2 496 256 496 117.2 388.5 8 247.7 8zm.6 450.7c-112 0-203.6-92.5-203.6-202.7 0-21.1 3-41.2 9-60.3l127 56.5h-27.9v38.6h58.1l5.7 11.8v18.7h-63.8V360h63.8v56h61.7v-56h64.2v-35.7l81 36.1c-1.5 2.2-57.1 98.3-175.2 98.3zm87.6-137.3h-57.6v-18.7l2.9-5.6 54.7 24.3zm6.5-51.4v-17.8h-38.6l63-116H301l-43.4 96-23-10.2-39.6-85.7h-65.8l27.3 51-81.9-36.5c27.8-44.1 82.6-98.1 173.7-98.1 112.8 0 203 90 203 203.4 0 21-2.7 40.6-7.9 59l-101-45.1z"],
"creative-commons-nd": [496, 512, [], "f4eb", "M247.6 8C389.4 8 496 118.1 496 256c0 147.1-118.5 248-248.4 248C113.6 504 0 394.5 0 256 0 123.1 104.7 8 247.6 8zm.8 44.7C130.2 52.7 44.7 150.6 44.7 256c0 109.8 91.2 202.8 203.7 202.8 103.2 0 202.8-81.1 202.8-202.8.1-113.8-90.2-203.3-202.8-203.3zm94 144.3v42.5H162.1V197h180.3zm0 79.8v42.5H162.1v-42.5h180.3z"],
"creative-commons-pd": [496, 512, [], "f4ec", "M248 8C111 8 0 119.1 0 256c0 137 111 248 248 248s248-111 248-248C496 119.1 385 8 248 8zm0 449.5c-139.2 0-235.8-138-190.2-267.9l78.8 35.1c-2.1 10.5-3.3 21.5-3.3 32.9 0 99 73.9 126.9 120.4 126.9 22.9 0 53.5-6.7 79.4-29.5L297 311.1c-5.5 6.3-17.6 16.7-36.3 16.7-37.8 0-53.7-39.9-53.9-71.9 230.4 102.6 216.5 96.5 217.9 96.8-34.3 62.4-100.6 104.8-176.7 104.8zm194.2-150l-224-100c18.8-34 54.9-30.7 74.7-11l40.4-41.6c-27.1-23.3-58-27.5-78.1-27.5-47.4 0-80.9 20.5-100.7 51.6l-74.9-33.4c36.1-54.9 98.1-91.2 168.5-91.2 111.1 0 201.5 90.4 201.5 201.5 0 18-2.4 35.4-6.8 52-.3-.1-.4-.2-.6-.4z"],
"creative-commons-pd-alt": [496, 512, [], "f4ed", "M247.6 8C104.7 8 0 123.1 0 256c0 138.5 113.6 248 247.6 248C377.5 504 496 403.1 496 256 496 118.1 389.4 8 247.6 8zm.8 450.8c-112.5 0-203.7-93-203.7-202.8 0-105.4 85.5-203.3 203.7-203.3 112.6 0 202.9 89.5 202.8 203.3 0 121.7-99.6 202.8-202.8 202.8zM316.7 186h-53.2v137.2h53.2c21.4 0 70-5.1 70-68.6 0-63.4-48.6-68.6-70-68.6zm.8 108.5h-19.9v-79.7l19.4-.1c3.8 0 35-2.1 35 39.9 0 24.6-10.5 39.9-34.5 39.9zM203.7 186h-68.2v137.3h34.6V279h27c54.1 0 57.1-37.5 57.1-46.5 0-31-16.8-46.5-50.5-46.5zm-4.9 67.3h-29.2v-41.6h28.3c30.9 0 28.8 41.6.9 41.6z"],
"creative-commons-remix": [496, 512, [], "f4ee", "M247.6 8C389.4 8 496 118.1 496 256c0 147.1-118.5 248-248.4 248C113.6 504 0 394.5 0 256 0 123.1 104.7 8 247.6 8zm.8 44.7C130.2 52.7 44.7 150.6 44.7 256c0 109.8 91.2 202.8 203.7 202.8 103.2 0 202.8-81.1 202.8-202.8.1-113.8-90.2-203.3-202.8-203.3zm161.7 207.7l4.9 2.2v70c-7.2 3.6-63.4 27.5-67.3 28.8-6.5-1.8-113.7-46.8-137.3-56.2l-64.2 26.6-63.3-27.5v-63.8l59.3-24.8c-.7-.7-.4 5-.4-70.4l67.3-29.7L361 178.5v61.6l49.1 20.3zm-70.4 81.5v-43.8h-.4v-1.8l-113.8-46.5V295l113.8 46.9v-.4l.4.4zm7.5-57.6l39.9-16.4-36.8-15.5-39 16.4 35.9 15.5zm52.3 38.1v-43L355.2 298v43.4l44.3-19z"],
"creative-commons-sa": [496, 512, [], "f4ef", "M247.6 8C389.4 8 496 118.1 496 256c0 147.1-118.5 248-248.4 248C113.6 504 0 394.5 0 256 0 123.1 104.7 8 247.6 8zm.8 44.7C130.2 52.7 44.7 150.6 44.7 256c0 109.8 91.2 202.8 203.7 202.8 103.2 0 202.8-81.1 202.8-202.8.1-113.8-90.2-203.3-202.8-203.3zM137.7 221c13-83.9 80.5-95.7 108.9-95.7 99.8 0 127.5 82.5 127.5 134.2 0 63.6-41 132.9-128.9 132.9-38.9 0-99.1-20-109.4-97h62.5c1.5 30.1 19.6 45.2 54.5 45.2 23.3 0 58-18.2 58-82.8 0-82.5-49.1-80.6-56.7-80.6-33.1 0-51.7 14.6-55.8 43.8h18.2l-49.2 49.2-49-49.2h19.4z"],
"creative-commons-sampling": [496, 512, [], "f4f0", "M247.6 8C389.4 8 496 118.1 496 256c0 147.1-118.5 248-248.4 248C113.6 504 0 394.5 0 256 0 123.1 104.7 8 247.6 8zm.8 44.7C130.2 52.7 44.7 150.6 44.7 256c0 109.8 91.2 202.8 203.7 202.8 103.2 0 202.8-81.1 202.8-202.8.1-113.8-90.2-203.3-202.8-203.3zm3.6 53.2c2.8-.3 11.5 1 11.5 11.5l6.6 107.2 4.9-59.3c0-6 4.7-10.6 10.6-10.6 5.9 0 10.6 4.7 10.6 10.6 0 2.5-.5-5.7 5.7 81.5l5.8-64.2c.3-2.9 2.9-9.3 10.2-9.3 3.8 0 9.9 2.3 10.6 8.9l11.5 96.5 5.3-12.8c1.8-4.4 5.2-6.6 10.2-6.6h58v21.3h-50.9l-18.2 44.3c-3.9 9.9-19.5 9.1-20.8-3.1l-4-31.9-7.5 92.6c-.3 3-3 9.3-10.2 9.3-3 0-9.8-2.1-10.6-9.3 0-1.9.6 5.8-6.2-77.9l-5.3 72.2c-1.1 4.8-4.8 9.3-10.6 9.3-2.9 0-9.8-2-10.6-9.3 0-1.9.5 6.7-5.8-87.7l-5.8 94.8c0 6.3-3.6 12.4-10.6 12.4-5.2 0-10.6-4.1-10.6-12l-5.8-87.7c-5.8 92.5-5.3 84-5.3 85.9-1.1 4.8-4.8 9.3-10.6 9.3-3 0-9.8-2.1-10.6-9.3 0-.7-.4-1.1-.4-2.6l-6.2-88.6L182 348c-.7 6.5-6.7 9.3-10.6 9.3-5.8 0-9.6-4.1-10.6-8.9L149.7 272c-2 4-3.5 8.4-11.1 8.4H87.2v-21.3H132l13.7-27.9c4.4-9.9 18.2-7.2 19.9 2.7l3.1 20.4 8.4-97.9c0-6 4.8-10.6 10.6-10.6.5 0 10.6-.2 10.6 12.4l4.9 69.1 6.6-92.6c0-10.1 9.5-10.6 10.2-10.6.6 0 10.6.7 10.6 10.6l5.3 80.6 6.2-97.9c.1-1.1-.6-10.3 9.9-11.5z"],
"creative-commons-sampling-plus": [496, 512, [], "f4f1", "M247.6 8C389.4 8 496 118.1 496 256c0 147.1-118.5 248-248.4 248C113.6 504 0 394.5 0 256 0 123.1 104.7 8 247.6 8zm.8 44.7C130.2 52.7 44.7 150.6 44.7 256c0 109.8 91.2 202.8 203.7 202.8 103.2 0 202.8-81.1 202.8-202.8.1-113.8-90.2-203.3-202.8-203.3zm107 205.6c-4.7 0-9 2.8-10.7 7.2l-4 9.5-11-92.8c-1.7-13.9-22-13.4-23.1.4l-4.3 51.4-5.2-68.8c-1.1-14.3-22.1-14.2-23.2 0l-3.5 44.9-5.9-94.3c-.9-14.5-22.3-14.4-23.2 0l-5.1 83.7-4.3-66.3c-.9-14.4-22.2-14.4-23.2 0l-5.3 80.2-4.1-57c-1.1-14.3-22-14.3-23.2-.2l-7.7 89.8-1.8-12.2c-1.7-11.4-17.1-13.6-22-3.3l-13.2 27.7H87.5v23.2h51.3c4.4 0 8.4-2.5 10.4-6.4l10.7 73.1c2 13.5 21.9 13 23.1-.7l3.8-43.6 5.7 78.3c1.1 14.4 22.3 14.2 23.2-.1l4.6-70.4 4.8 73.3c.9 14.4 22.3 14.4 23.2-.1l4.9-80.5 4.5 71.8c.9 14.3 22.1 14.5 23.2.2l4.6-58.6 4.9 64.4c1.1 14.3 22 14.2 23.1.1l6.8-83 2.7 22.3c1.4 11.8 17.7 14.1 22.3 3.1l18-43.4h50.5V258l-58.4.3zm-78 5.2h-21.9v21.9c0 4.1-3.3 7.5-7.5 7.5-4.1 0-7.5-3.3-7.5-7.5v-21.9h-21.9c-4.1 0-7.5-3.3-7.5-7.5 0-4.1 3.4-7.5 7.5-7.5h21.9v-21.9c0-4.1 3.4-7.5 7.5-7.5s7.5 3.3 7.5 7.5v21.9h21.9c4.1 0 7.5 3.3 7.5 7.5 0 4.1-3.4 7.5-7.5 7.5z"],
"creative-commons-share": [496, 512, [], "f4f2", "M247.6 8C389.4 8 496 118.1 496 256c0 147.1-118.5 248-248.4 248C113.6 504 0 394.5 0 256 0 123.1 104.7 8 247.6 8zm.8 44.7C130.2 52.7 44.7 150.6 44.7 256c0 109.8 91.2 202.8 203.7 202.8 103.2 0 202.8-81.1 202.8-202.8.1-113.8-90.2-203.3-202.8-203.3zm101 132.4c7.8 0 13.7 6.1 13.7 13.7v182.5c0 7.7-6.1 13.7-13.7 13.7H214.3c-7.7 0-13.7-6-13.7-13.7v-54h-54c-7.8 0-13.7-6-13.7-13.7V131.1c0-8.2 6.6-12.7 12.4-13.7h136.4c7.7 0 13.7 6 13.7 13.7v54h54zM159.9 300.3h40.7V198.9c0-7.4 5.8-12.6 12-13.7h55.8v-40.3H159.9v155.4zm176.2-88.1H227.6v155.4h108.5V212.2z"],
"creative-commons-zero": [496, 512, [], "f4f3", "M247.6 8C389.4 8 496 118.1 496 256c0 147.1-118.5 248-248.4 248C113.6 504 0 394.5 0 256 0 123.1 104.7 8 247.6 8zm.8 44.7C130.2 52.7 44.7 150.6 44.7 256c0 109.8 91.2 202.8 203.7 202.8 103.2 0 202.8-81.1 202.8-202.8.1-113.8-90.2-203.3-202.8-203.3zm-.4 60.5c-81.9 0-102.5 77.3-102.5 142.8 0 65.5 20.6 142.8 102.5 142.8S350.5 321.5 350.5 256c0-65.5-20.6-142.8-102.5-142.8zm0 53.9c3.3 0 6.4.5 9.2 1.2 5.9 5.1 8.8 12.1 3.1 21.9l-54.5 100.2c-1.7-12.7-1.9-25.1-1.9-34.4 0-28.8 2-88.9 44.1-88.9zm40.8 46.2c2.9 15.4 3.3 31.4 3.3 42.7 0 28.9-2 88.9-44.1 88.9-13.5 0-32.6-7.7-20.1-26.4l60.9-105.2z"],
"critical-role": [448, 512, [], "f6c9", "M225.82 0c.26.15 216.57 124.51 217.12 124.72 3 1.18 3.7 3.46 3.7 6.56q-.11 125.17 0 250.36a5.88 5.88 0 0 1-3.38 5.78c-21.37 12-207.86 118.29-218.93 124.58h-3C142 466.34 3.08 386.56 2.93 386.48a3.29 3.29 0 0 1-1.88-3.24c0-.87 0-225.94-.05-253.1a5 5 0 0 1 2.93-4.93C27.19 112.11 213.2 6 224.07 0zM215.4 20.42l-.22-.16Q118.06 75.55 21 130.87c0 .12.08.23.13.35l30.86 11.64c-7.71 6-8.32 6-10.65 5.13-.1 0-24.17-9.28-26.8-10v230.43c.88-1.41 64.07-110.91 64.13-111 1.62-2.82 3-1.92 9.12-1.52 1.4.09 1.48.22.78 1.42-41.19 71.33-36.4 63-67.48 116.94-.81 1.4-.61 1.13 1.25 1.13h186.5c1.44 0 1.69-.23 1.7-1.64v-8.88c0-1.34 2.36-.81-18.37-1-7.46-.07-14.14-3.22-21.38-12.7-7.38-9.66-14.62-19.43-21.85-29.21-2.28-3.08-3.45-2.38-16.76-2.38-1.75 0-1.78 0-1.76 1.82.29 26.21.15 25.27 1 32.66.52 4.37 2.16 4.2 9.69 4.81 3.14.26 3.88 4.08.52 4.92-1.57.39-31.6.51-33.67-.1a2.42 2.42 0 0 1 .3-4.73c3.29-.76 6.16.81 6.66-4.44 1.3-13.66 1.17-9 1.1-79.42 0-10.82-.35-12.58-5.36-13.55-1.22-.24-3.54-.16-4.69-.55-2.88-1-2-4.84 1.77-4.85 33.67 0 46.08-1.07 56.06 4.86 7.74 4.61 12 11.48 12.51 20.4.88 14.59-6.51 22.35-15 32.59a1.46 1.46 0 0 0 0 2.22c2.6 3.25 5 6.63 7.71 9.83 27.56 33.23 24.11 30.54 41.28 33.06.89.13 1-.42 1-1.15v-11c0-1 .32-1.43 1.41-1.26a72.37 72.37 0 0 0 23.58-.3c1.08-.15 1.5.2 1.48 1.33 0 .11.88 26.69.87 26.8-.05 1.52.67 1.62 1.89 1.62h186.71Q386.51 304.6 346 234.33c2.26-.66-.4 0 6.69-1.39 2-.39 2.05-.41 3.11 1.44 7.31 12.64 77.31 134 77.37 134.06V138c-1.72.5-103.3 38.72-105.76 39.68-1.08.42-1.55.2-1.91-.88-.63-1.9-1.34-3.76-2.09-5.62-.32-.79-.09-1.13.65-1.39.1 0 95.53-35.85 103-38.77-65.42-37.57-130.56-75-196-112.6l86.82 150.39-.28.33c-9.57-.9-10.46-1.6-11.8-3.94-1-1.69-73.5-127.71-82-142.16-9.1 14.67-83.56 146.21-85.37 146.32-2.93.17-5.88.08-9.25.08q43.25-74.74 86.18-149zm51.93 129.92a37.68 37.68 0 0 0 5.54-.85c1.69-.3 2.53.2 2.6 1.92 0 .11.07 19.06-.86 20.45s-1.88 1.22-2.6-.19c-5-9.69 6.22-9.66-39.12-12-.7 0-1 .23-1 .93 0 .13 3.72 122 3.73 122.11 0 .89.52 1.2 1.21 1.51a83.92 83.92 0 0 1 8.7 4.05c7.31 4.33 11.38 10.84 12.41 19.31 1.44 11.8-2.77 35.77-32.21 37.14-2.75.13-28.26 1.08-34.14-23.25-4.66-19.26 8.26-32.7 19.89-36.4a2.45 2.45 0 0 0 2-2.66c.1-5.63 3-107.1 3.71-121.35.05-1.08-.62-1.16-1.35-1.15-32.35.52-36.75-.34-40.22 8.52-2.42 6.18-4.14 1.32-3.95.23q1.59-9 3.31-18c.4-2.11 1.43-2.61 3.43-1.86 5.59 2.11 6.72 1.7 37.25 1.92 1.73 0 1.78-.08 1.82-1.85.68-27.49.58-22.59 1-29.55a2.69 2.69 0 0 0-1.63-2.8c-5.6-2.91-8.75-7.55-8.9-13.87-.35-14.81 17.72-21.67 27.38-11.51 6.84 7.19 5.8 18.91-2.45 24.15a4.35 4.35 0 0 0-2.22 4.34c0 .59-.11-4.31 1 30.05 0 .9.43 1.12 1.24 1.11.1 0 23-.09 34.47-.37zM68.27 141.7c19.84-4.51 32.68-.56 52.49 1.69 2.76.31 3.74 1.22 3.62 4-.21 5-1.16 22.33-1.24 23.15a2.65 2.65 0 0 1-1.63 2.34c-4.06 1.7-3.61-4.45-4-7.29-3.13-22.43-73.87-32.7-74.63 25.4-.31 23.92 17 53.63 54.08 50.88 27.24-2 19-20.19 24.84-20.47a2.72 2.72 0 0 1 3 3.36c-1.83 10.85-3.42 18.95-3.45 19.15-1.54 9.17-86.7 22.09-93.35-42.06-2.71-25.85 10.44-53.37 40.27-60.15zm80 87.67h-19.49a2.57 2.57 0 0 1-2.66-1.79c2.38-3.75 5.89.92 5.86-6.14-.08-25.75.21-38 .23-40.1 0-3.42-.53-4.65-3.32-4.94-7-.72-3.11-3.37-1.11-3.38 11.84-.1 22.62-.18 30.05.72 8.77 1.07 16.71 12.63 7.93 22.62-2 2.25-4 4.42-6.14 6.73.95 1.15 6.9 8.82 17.28 19.68 2.66 2.78 6.15 3.51 9.88 3.13a2.21 2.21 0 0 0 2.23-2.12c.3-3.42.26 4.73.45-40.58 0-5.65-.34-6.58-3.23-6.83-3.95-.35-4-2.26-.69-3.37l19.09-.09c.32 0 4.49.53 1 3.38 0 .05-.16 0-.24 0-3.61.26-3.94 1-4 4.62-.27 43.93.07 40.23.41 42.82.11.84.27 2.23 5.1 2.14 2.49 0 3.86 3.37 0 3.4-10.37.08-20.74 0-31.11.07-10.67 0-13.47-6.2-24.21-20.82-1.6-2.18-8.31-2.36-8.2-.37.88 16.47 0 17.78 4 17.67 4.75-.1 4.73 3.57.83 3.55zm275-10.15c-1.21 7.13.17 10.38-5.3 10.34-61.55-.42-47.82-.22-50.72-.31a18.4 18.4 0 0 1-3.63-.73c-2.53-.6 1.48-1.23-.38-5.6-1.43-3.37-2.78-6.78-4.11-10.19a1.94 1.94 0 0 0-2-1.44 138 138 0 0 0-14.58.07 2.23 2.23 0 0 0-1.62 1.06c-1.58 3.62-3.07 7.29-4.51 11-1.27 3.23 7.86 1.32 12.19 2.16 3 .57 4.53 3.72.66 3.73H322.9c-2.92 0-3.09-3.15-.74-3.21a6.3 6.3 0 0 0 5.92-3.47c1.5-3 2.8-6 4.11-9.09 18.18-42.14 17.06-40.17 18.42-41.61a1.83 1.83 0 0 1 3 0c2.93 3.34 18.4 44.71 23.62 51.92 2 2.7 5.74 2 6.36 2 3.61.13 4-1.11 4.13-4.29.09-1.87.08 1.17.07-41.24 0-4.46-2.36-3.74-5.55-4.27-.26 0-2.56-.63-.08-3.06.21-.2-.89-.24 21.7-.15 2.32 0 5.32 2.75-1.21 3.45a2.56 2.56 0 0 0-2.66 2.83c-.07 1.63-.19 38.89.29 41.21a3.06 3.06 0 0 0 3.23 2.43c13.25.43 14.92.44 16-3.41 1.67-5.78 4.13-2.52 3.73-.19zm-104.72 64.37c-4.24 0-4.42-3.39-.61-3.41 35.91-.16 28.11.38 37.19-.65 1.68-.19 2.38.24 2.25 1.89-.26 3.39-.64 6.78-1 10.16-.25 2.16-3.2 2.61-3.4-.15-.38-5.31-2.15-4.45-15.63-5.08-1.58-.07-1.64 0-1.64 1.52V304c0 1.65 0 1.6 1.62 1.47 3.12-.25 10.31.34 15.69-1.52.47-.16 3.3-1.79 3.07 1.76 0 .21-.76 10.35-1.18 11.39-.53 1.29-1.88 1.51-2.58.32-1.17-2 0-5.08-3.71-5.3-15.42-.9-12.91-2.55-12.91 6 0 12.25-.76 16.11 3.89 16.24 16.64.48 14.4 0 16.43-5.71.84-2.37 3.5-1.77 3.18.58-.44 3.21-.85 6.43-1.23 9.64 0 .36-.16 2.4-4.66 2.39-37.16-.08-34.54-.19-35.21-.31-2.72-.51-2.2-3 .22-3.45 1.1-.19 4 .54 4.16-2.56 2.44-56.22-.07-51.34-3.91-51.33zm-.41-109.52c2.46.61 3.13 1.76 2.95 4.65-.33 5.3-.34 9-.55 9.69-.66 2.23-3.15 2.12-3.34-.27-.38-4.81-3.05-7.82-7.57-9.15-26.28-7.73-32.81 15.46-27.17 30.22 5.88 15.41 22 15.92 28.86 13.78 5.92-1.85 5.88-6.5 6.91-7.58 1.23-1.3 2.25-1.84 3.12 1.1 0 .1.57 11.89-6 12.75-1.6.21-19.38 3.69-32.68-3.39-21-11.19-16.74-35.47-6.88-45.33 14-14.06 39.91-7.06 42.32-6.47zM289.8 280.14c3.28 0 3.66 3 .16 3.43-2.61.32-5-.42-5 5.46 0 2-.19 29.05.4 41.45.11 2.29 1.15 3.52 3.44 3.65 22 1.21 14.95-1.65 18.79-6.34 1.83-2.24 2.76.84 2.76 1.08.35 13.62-4 12.39-5.19 12.4l-38.16-.19c-1.93-.23-2.06-3-.42-3.38 2-.48 4.94.4 5.13-2.8 1-15.87.57-44.65.34-47.81-.27-3.77-2.8-3.27-5.68-3.71-2.47-.38-2-3.22.34-3.22 1.45-.02 17.97-.03 23.09-.02zm-31.63-57.79c.07 4.08 2.86 3.46 6 3.58 2.61.1 2.53 3.41-.07 3.43-6.48 0-13.7 0-21.61-.06-3.84 0-3.38-3.35 0-3.37 4.49 0 3.24 1.61 3.41-45.54 0-5.08-3.27-3.54-4.72-4.23-2.58-1.23-1.36-3.09.41-3.15 1.29 0 20.19-.41 21.17.21s1.87 1.65-.42 2.86c-1 .52-3.86-.28-4.15 2.47 0 .21-.82 1.63-.07 43.8zm-36.91 274.27a2.93 2.93 0 0 0 3.26 0c17-9.79 182-103.57 197.42-112.51-.14-.43 11.26-.18-181.52-.27-1.22 0-1.57.37-1.53 1.56 0 .1 1.25 44.51 1.22 50.38a28.33 28.33 0 0 1-1.36 7.71c-.55 1.83.38-.5-13.5 32.23-.73 1.72-1 2.21-2-.08-4.19-10.34-8.28-20.72-12.57-31a23.6 23.6 0 0 1-2-10.79c.16-2.46.8-16.12 1.51-48 0-1.95 0-2-2-2h-183c2.58 1.63 178.32 102.57 196 112.76zm-90.9-188.75c0 2.4.36 2.79 2.76 3 11.54 1.17 21 3.74 25.64-7.32 6-14.46 2.66-34.41-12.48-38.84-2-.59-16-2.76-15.94 1.51.05 8.04.01 11.61.02 41.65zm105.75-15.05c0 2.13 1.07 38.68 1.09 39.13.34 9.94-25.58 5.77-25.23-2.59.08-2 1.37-37.42 1.1-39.43-14.1 7.44-14.42 40.21 6.44 48.8a17.9 17.9 0 0 0 22.39-7.07c4.91-7.76 6.84-29.47-5.43-39a2.53 2.53 0 0 1-.36.12zm-12.28-198c-9.83 0-9.73 14.75-.07 14.87s10.1-14.88.07-14.91zm-80.15 103.83c0 1.8.41 2.4 2.17 2.58 13.62 1.39 12.51-11 12.16-13.36-1.69-11.22-14.38-10.2-14.35-7.81.05 4.5-.03 13.68.02 18.59zm212.32 6.4l-6.1-15.84c-2.16 5.48-4.16 10.57-6.23 15.84z"],
"css3": [512, 512, [], "f13c", "M480 32l-64 368-223.3 80L0 400l19.6-94.8h82l-8 40.6L210 390.2l134.1-44.4 18.8-97.1H29.5l16-82h333.7l10.5-52.7H56.3l16.3-82H480z"],
"css3-alt": [384, 512, [], "f38b", "M0 32l34.9 395.8L192 480l157.1-52.2L384 32H0zm313.1 80l-4.8 47.3L193 208.6l-.3.1h111.5l-12.8 146.6-98.2 28.7-98.8-29.2-6.4-73.9h48.9l3.2 38.3 52.6 13.3 54.7-15.4 3.7-61.6-166.3-.5v-.1l-.2.1-3.6-46.3L193.1 162l6.5-2.7H76.7L70.9 112h242.2z"],
"cuttlefish": [440, 512, [], "f38c", "M344 305.5c-17.5 31.6-57.4 54.5-96 54.5-56.6 0-104-47.4-104-104s47.4-104 104-104c38.6 0 78.5 22.9 96 54.5 13.7-50.9 41.7-93.3 87-117.8C385.7 39.1 320.5 8 248 8 111 8 0 119 0 256s111 248 248 248c72.5 0 137.7-31.1 183-80.7-45.3-24.5-73.3-66.9-87-117.8z"],
"d-and-d": [576, 512, [], "f38d", "M82.5 98.9c-.6-17.2 2-33.8 12.7-48.2.3 7.4 1.2 14.5 4.2 21.6 5.9-27.5 19.7-49.3 42.3-65.5-1.9 5.9-3.5 11.8-3 17.7 8.7-7.4 18.8-17.8 44.4-22.7 14.7-2.8 29.7-2 42.1 1 38.5 9.3 61 34.3 69.7 72.3 5.3 23.1.7 45-8.3 66.4-5.2 12.4-12 24.4-20.7 35.1-2-1.9-3.9-3.8-5.8-5.6-42.8-40.8-26.8-25.2-37.4-37.4-1.1-1.2-1-2.2-.1-3.6 8.3-13.5 11.8-28.2 10-44-1.1-9.8-4.3-18.9-11.3-26.2-14.5-15.3-39.2-15-53.5.6-11.4 12.5-14.1 27.4-10.9 43.6.2 1.3.4 2.7 0 3.9-3.4 13.7-4.6 27.6-2.5 41.6.1.5.1 1.1.1 1.6 0 .3-.1.5-.2 1.1-21.8-11-36-28.3-43.2-52.2-8.3 17.8-11.1 35.5-6.6 54.1-15.6-15.2-21.3-34.3-22-55.2zm469.6 123.2c-11.6-11.6-25-20.4-40.1-26.6-12.8-5.2-26-7.9-39.9-7.1-10 .6-19.6 3.1-29 6.4-2.5.9-5.1 1.6-7.7 2.2-4.9 1.2-7.3-3.1-4.7-6.8 3.2-4.6 3.4-4.2 15-12 .6-.4 1.2-.8 2.2-1.5h-2.5c-.6 0-1.2.2-1.9.3-19.3 3.3-30.7 15.5-48.9 29.6-10.4 8.1-13.8 3.8-12-.5 1.4-3.5 3.3-6.7 5.1-10 1-1.8 2.3-3.4 3.5-5.1-.2-.2-.5-.3-.7-.5-27 18.3-46.7 42.4-57.7 73.3.3.3.7.6 1 .9.3-.6.5-1.2.9-1.7 10.4-12.1 22.8-21.8 36.6-29.8 18.2-10.6 37.5-18.3 58.7-20.2 4.3-.4 8.7-.1 13.1-.1-1.8.7-3.5.9-5.3 1.1-18.5 2.4-35.5 9-51.5 18.5-30.2 17.9-54.5 42.2-75.1 70.4-.3.4-.4.9-.7 1.3 14.5 5.3 24 17.3 36.1 25.6.2-.1.3-.2.4-.4l1.2-2.7c12.2-26.9 27-52.3 46.7-74.5 16.7-18.8 38-25.3 62.5-20 5.9 1.3 11.4 4.4 17.2 6.8 2.3-1.4 5.1-3.2 8-4.7 8.4-4.3 17.4-7 26.7-9 14.7-3.1 29.5-4.9 44.5-1.3v-.5c-.5-.4-1.2-.8-1.7-1.4zM316.7 397.6c-39.4-33-22.8-19.5-42.7-35.6-.8.9 0-.2-1.9 3-11.2 19.1-25.5 35.3-44 47.6-10.3 6.8-21.5 11.8-34.1 11.8-21.6 0-38.2-9.5-49.4-27.8-12-19.5-13.3-40.7-8.2-62.6 7.8-33.8 30.1-55.2 38.6-64.3-18.7-6.2-33 1.7-46.4 13.9.8-13.9 4.3-26.2 11.8-37.3-24.3 10.6-45.9 25-64.8 43.9-.3-5.8 5.4-43.7 5.6-44.7.3-2.7-.6-5.3-3-7.4-24.2 24.7-44.5 51.8-56.1 84.6 7.4-5.9 14.9-11.4 23.6-16.2-8.3 22.3-19.6 52.8-7.8 101.1 4.6 19 11.9 36.8 24.1 52.3 2.9 3.7 6.3 6.9 9.5 10.3.2-.2.4-.3.6-.5-1.4-7-2.2-14.1-1.5-21.9 2.2 3.2 3.9 6 5.9 8.6 12.6 16 28.7 27.4 47.2 35.6 25 11.3 51.1 13.3 77.9 8.6 54.9-9.7 90.7-48.6 116-98.8 1-1.8.6-2.9-.9-4.2zm172-46.4c-9.5-3.1-22.2-4.2-28.7-2.9 9.9 4 14.1 6.6 18.8 12 12.6 14.4 10.4 34.7-5.4 45.6-11.7 8.1-24.9 10.5-38.9 9.1-1.2-.1-2.3-.4-3-.6 2.8-3.7 6-7 8.1-10.8 9.4-16.8 5.4-42.1-8.7-56.1-2.1-2.1-4.6-3.9-7-5.9-.3 1.3-.1 2.1.1 2.8 4.2 16.6-8.1 32.4-24.8 31.8-7.6-.3-13.9-3.8-19.6-8.5-19.5-16.1-39.1-32.1-58.5-48.3-5.9-4.9-12.5-8.1-20.1-8.7-4.6-.4-9.3-.6-13.9-.9-5.9-.4-8.8-2.8-10.4-8.4-.9-3.4-1.5-6.8-2.2-10.2-1.5-8.1-6.2-13-14.3-14.2-4.4-.7-8.9-1-13.3-1.5-13-1.4-19.8-7.4-22.6-20.3-5 11-1.6 22.4 7.3 29.9 4.5 3.8 9.3 7.3 13.8 11.2 4.6 3.8 7.4 8.7 7.9 14.8.4 4.7.8 9.5 1.8 14.1 2.2 10.6 8.9 18.4 17 25.1 16.5 13.7 33 27.3 49.5 41.1 17.9 15 13.9 32.8 13 56-.9 22.9 12.2 42.9 33.5 51.2 1 .4 2 .6 3.6 1.1-15.7-18.2-10.1-44.1.7-52.3.3 2.2.4 4.3.9 6.4 9.4 44.1 45.4 64.2 85 56.9 16-2.9 30.6-8.9 42.9-19.8 2-1.8 3.7-4.1 5.9-6.5-19.3 4.6-35.8.1-50.9-10.6.7-.3 1.3-.3 1.9-.3 21.3 1.8 40.6-3.4 57-17.4 19.5-16.6 26.6-42.9 17.4-66-8.3-20.1-23.6-32.3-43.8-38.9zM99.4 179.3c-5.3-9.2-13.2-15.6-22.1-21.3 13.7-.5 26.6.2 39.6 3.7-7-12.2-8.5-24.7-5-38.7 5.3 11.9 13.7 20.1 23.6 26.8 19.7 13.2 35.7 19.6 46.7 30.2 3.4 3.3 6.3 7.1 9.6 10.9-.8-2.1-1.4-4.1-2.2-6-5-10.6-13-18.6-22.6-25-1.8-1.2-2.8-2.5-3.4-4.5-3.3-12.5-3-25.1-.7-37.6 1-5.5 2.8-10.9 4.5-16.3.8-2.4 2.3-4.6 4-6.6.6 6.9 0 25.5 19.6 46 10.8 11.3 22.4 21.9 33.9 32.7 9 8.5 18.3 16.7 25.5 26.8 1.1 1.6 2.2 3.3 3.8 4.7-5-13-14.2-24.1-24.2-33.8-9.6-9.3-19.4-18.4-29.2-27.4-3.3-3-4.6-6.7-5.1-10.9-1.2-10.4 0-20.6 4.3-30.2.5-1 1.1-2 1.9-3.3.5 4.2.6 7.9 1.4 11.6 4.8 23.1 20.4 36.3 49.3 63.5 10 9.4 19.3 19.2 25.6 31.6 4.8 9.3 7.3 19 5.7 29.6-.1.6.5 1.7 1.1 2 6.2 2.6 10 6.9 9.7 14.3 7.7-2.6 12.5-8 16.4-14.5 4.2 20.2-9.1 50.3-27.2 58.7.4-4.5 5-23.4-16.5-27.7-6.8-1.3-12.8-1.3-22.9-2.1 4.7-9 10.4-20.6.5-22.4-24.9-4.6-52.8 1.9-57.8 4.6 8.2.4 16.3 1 23.5 3.3-2 6.5-4 12.7-5.8 18.9-1.9 6.5 2.1 14.6 9.3 9.6 1.2-.9 2.3-1.9 3.3-2.7-3.1 17.9-2.9 15.9-2.8 18.3.3 10.2 9.5 7.8 15.7 7.3-2.5 11.8-29.5 27.3-45.4 25.8 7-4.7 12.7-10.3 15.9-17.9-6.5.8-12.9 1.6-19.2 2.4l-.3-.9c4.7-3.4 8-7.8 10.2-13.1 8.7-21.1-3.6-38-25-39.9-9.1-.8-17.8.8-25.9 5.5 6.2-15.6 17.2-26.6 32.6-34.5-15.2-4.3-8.9-2.7-24.6-6.3 14.6-9.3 30.2-13.2 46.5-14.6-5.2-3.2-48.1-3.6-70.2 20.9 7.9 1.4 15.5 2.8 23.2 4.2-23.8 7-44 19.7-62.4 35.6 1.1-4.8 2.7-9.5 3.3-14.3.6-4.5.8-9.2.1-13.6-1.5-9.4-8.9-15.1-19.7-16.3-7.9-.9-15.6.1-23.3 1.3-.9.1-1.7.3-2.9 0 15.8-14.8 36-21.7 53.1-33.5 6-4.5 6.8-8.2 3-14.9zm128.4 26.8c3.3 16 12.6 25.5 23.8 24.3-4.6-11.3-12.1-19.5-23.8-24.3z"],
"d-and-d-beyond": [640, 512, [], "f6ca", "M313.8 241.5c13.8 0 21-10.1 24.8-17.9-1-1.1-5-4.2-7.4-6.6-2.4 4.3-8.2 10.7-13.9 10.7-10.2 0-15.4-14.7-3.2-26.6-.5-.2-4.3-1.8-8 2.4 0-3 1-5.1 2.1-6.6-3.5 1.3-9.8 5.6-11.4 7.9.2-5.8 1.6-7.5.6-9l-.2-.2s-8.5 5.6-9.3 14.7c0 0 1.1-1.6 2.1-1.9.6-.3 1.3 0 .6 1.9-.2.6-5.8 15.7 5.1 26-.6-1.6-1.9-7.6 2.4-1.9-.3.1 5.8 7.1 15.7 7.1zm52.4-21.1c0-4-4.9-4.4-5.6-4.5 2 3.9.9 7.5.2 9 2.5-.4 5.4-1.6 5.4-4.5zm10.3 5.2c0-6.4-6.2-11.4-13.5-10.7 8 1.3 5.6 13.8-5 11.4 3.7-2.6 3.2-9.9-1.3-12.5 1.4 4.2-3 8.2-7.4 4.6-2.4-1.9-8-6.6-10.6-8.6-2.4-2.1-5.5-1-6.6-1.8-1.3-1.1-.5-3.8-2.2-5-1.6-.8-3-.3-4.8-1-1.6-.6-2.7-1.9-2.6-3.5-2.5 4.4 3.4 6.3 4.5 8.5 1 1.9-.8 4.8 4 8.5 14.8 11.6 9.1 8 10.4 18.1.6 4.3 4.2 6.7 6.4 7.4-2.1-1.9-2.9-6.4 0-9.3 0 13.9 19.2 13.3 23.1 6.4-2.4 1.1-7-.2-9-1.9 7.7 1 14.2-4.1 14.6-10.6zm-39.4-18.4c2 .8 1.6.7 6.4 4.5 10.2-24.5 21.7-15.7 22-15.5 2.2-1.9 9.8-3.8 13.8-2.7-2.4-2.7-7.5-6.2-13.3-6.2-4.7 0-7.4 2.2-8 1.3-.8-1.4 3.2-3.4 3.2-3.4-5.4.2-9.6 6.7-11.2 5.9-1.1-.5 1.4-3.7 1.4-3.7-5.1 2.9-9.3 9.1-10.2 13 4.6-5.8 13.8-9.8 19.7-9-10.5.5-19.5 9.7-23.8 15.8zm242.5 51.9c-20.7 0-40 1.3-50.3 2.1l7.4 8.2v77.2l-7.4 8.2c10.4.8 30.9 2.1 51.6 2.1 42.1 0 59.1-20.7 59.1-48.9 0-29.3-23.2-48.9-60.4-48.9zm-15.1 75.6v-53.3c30.1-3.3 46.8 3.8 46.8 26.3 0 25.6-21.4 30.2-46.8 27zM301.6 181c-1-3.4-.2-6.9 1.1-9.4 1 3 2.6 6.4 7.5 9-.5-2.4-.2-5.6.5-8-1.4-5.4 2.1-9.9 6.4-9.9 6.9 0 8.5 8.8 4.7 14.4 2.1 3.2 5.5 5.6 7.7 7.8 3.2-3.7 5.5-9.5 5.5-13.8 0-8.2-5.5-15.9-16.7-16.5-20-.9-20.2 16.6-20 18.9.5 5.2 3.4 7.8 3.3 7.5zm-.4 6c-.5 1.8-7 3.7-10.2 6.9 4.8-1 7-.2 7.8 1.8.5 1.4-.2 3.4-.5 5.6 1.6-1.8 7-5.5 11-6.2-1-.3-3.4-.8-4.3-.8 2.9-3.4 9.3-4.5 12.8-3.7-2.2-.2-6.7 1.1-8.5 2.6 1.6.3 3 .6 4.3 1.1-2.1.8-4.8 3.4-5.8 6.1 7-5 13.1 5.2 7 8.2.8.2 2.7 0 3.5-.5-.3 1.1-1.9 3-3 3.4 2.9 0 7-1.9 8.2-4.6 0 0-1.8.6-2.6-.2s.3-4.3.3-4.3c-2.3 2.9-3.4-1.3-1.3-4.2-1-.3-3.5-.6-4.6-.5 3.2-1.1 10.4-1.8 11.2-.3.6 1.1-1 3.4-1 3.4 4-.5 8.3 1.1 6.7 5.1 2.9-1.4 5.5-5.9 4.8-10.4-.3 1-1.6 2.4-2.9 2.7.2-1.4-1-2.2-1.9-2.6 1.7-9.6-14.6-14.2-14.1-23.9-1 1.3-1.8 5-.8 7.1 2.7 3.2 8.7 6.7 10.1 12.2-2.6-6.4-15.1-11.4-14.6-20.2-1.6 1.6-2.6 7.8-1.3 11 2.4 1.4 4.5 3.8 4.8 6.1-2.2-5.1-11.4-6.1-13.9-12.2-.6 2.2-.3 5 1 6.7 0 0-2.2-.8-7-.6 1.7.6 5.1 3.5 4.8 5.2zm25.9 7.4c-2.7 0-3.5-2.1-4.2-4.3 3.3 1.3 4.2 4.3 4.2 4.3zm38.9 3.7l-1-.6c-1.1-1-2.9-1.4-4.7-1.4-2.9 0-5.8 1.3-7.5 3.4-.8.8-1.4 1.8-2.1 2.6v15.7c3.5 2.6 7.1-2.9 3-7.2 1.5.3 4.6 2.7 5.1 3.2 0 0 2.6-.5 5-.5 2.1 0 3.9.3 5.6 1.1V196c-1.1.5-2.2 1-2.7 1.4zM79.9 305.9c17.2-4.6 16.2-18 16.2-19.9 0-20.6-24.1-25-37-25H3l8.3 8.6v29.5H0l11.4 14.6V346L3 354.6c61.7 0 73.8 1.5 86.4-5.9 6.7-4 9.9-9.8 9.9-17.6 0-5.1 2.6-18.8-19.4-25.2zm-41.3-27.5c20 0 29.6-.8 29.6 9.1v3c0 12.1-19 8.8-29.6 8.8zm0 59.2V315c12.2 0 32.7-2.3 32.7 8.8v4.5h.2c0 11.2-12.5 9.3-32.9 9.3zm101.2-19.3l23.1.2v-.2l14.1-21.2h-37.2v-14.9h52.4l-14.1-21v-.2l-73.5.2 7.4 8.2v77.1l-7.4 8.2h81.2l14.1-21.2-60.1.2zm214.7-60.1c-73.9 0-77.5 99.3-.3 99.3 77.9 0 74.1-99.3.3-99.3zm-.3 77.5c-37.4 0-36.9-55.3.2-55.3 36.8.1 38.8 55.3-.2 55.3zm-91.3-8.3l44.1-66.2h-41.7l6.1 7.2-20.5 37.2h-.3l-21-37.2 6.4-7.2h-44.9l44.1 65.8.2 19.4-7.7 8.2h42.6l-7.2-8.2zm-28.4-151.3c1.6 1.3 2.9 2.4 2.9 6.6v38.8c0 4.2-.8 5.3-2.7 6.4-.1.1-7.5 4.5-7.9 4.6h35.1c10 0 17.4-1.5 26-8.6-.6-5 .2-9.5.8-12 0-.2-1.8 1.4-2.7 3.5 0-5.7 1.6-15.4 9.6-20.5-.1 0-3.7-.8-9 1.1 2-3.1 10-7.9 10.4-7.9-8.2-26-38-22.9-32.2-22.9-30.9 0-32.6.3-39.9-4 .1.8.5 8.2 9.6 14.9zm21.5 5.5c4.6 0 23.1-3.3 23.1 17.3 0 20.7-18.4 17.3-23.1 17.3zm228.9 79.6l7 8.3V312h-.3c-5.4-14.4-42.3-41.5-45.2-50.9h-31.6l7.4 8.5v76.9l-7.2 8.3h39l-7.4-8.2v-47.4h.3c3.7 10.6 44.5 42.9 48.5 55.6h21.3v-85.2l7.4-8.3zm-106.7-96.1c-32.2 0-32.8.2-39.9-4 .1.7.5 8.3 9.6 14.9 3.1 2 2.9 4.3 2.9 9.5 1.8-1.1 3.8-2.2 6.1-3-1.1 1.1-2.7 2.7-3.5 4.5 1-1.1 7.5-5.1 14.6-3.5-1.6.3-4 1.1-6.1 2.9.1 0 2.1-1.1 7.5-.3v-4.3c4.7 0 23.1-3.4 23.1 17.3 0 20.5-18.5 17.3-19.7 17.3 5.7 4.4 5.8 12 2.2 16.3h.3c33.4 0 36.7-27.3 36.7-34 0-3.8-1.1-32-33.8-33.6z"],
"dashcube": [448, 512, [], "f210", "M326.6 104H110.4c-51.1 0-91.2 43.3-91.2 93.5V427c0 50.5 40.1 85 91.2 85h227.2c51.1 0 91.2-34.5 91.2-85V0L326.6 104zM153.9 416.5c-17.7 0-32.4-15.1-32.4-32.8V240.8c0-17.7 14.7-32.5 32.4-32.5h140.7c17.7 0 32 14.8 32 32.5v123.5l51.1 52.3H153.9z"],
"delicious": [448, 512, [], "f1a5", "M446.5 68c-.4-1.5-.9-3-1.4-4.5-.9-2.5-2-4.8-3.3-7.1-1.4-2.4-3-4.8-4.7-6.9-2.1-2.5-4.4-4.8-6.9-6.8-1.1-.9-2.2-1.7-3.3-2.5-1.3-.9-2.6-1.7-4-2.4-1.8-1-3.6-1.8-5.5-2.5-1.7-.7-3.5-1.3-5.4-1.7-3.8-1-7.9-1.5-12-1.5H48C21.5 32 0 53.5 0 80v352c0 4.1.5 8.2 1.5 12 2 7.7 5.8 14.6 11 20.3 1 1.1 2.1 2.2 3.3 3.3 5.7 5.2 12.6 9 20.3 11 3.8 1 7.9 1.5 12 1.5h352c26.5 0 48-21.5 48-48V80c-.1-4.1-.6-8.2-1.6-12zM416 432c0 8.8-7.2 16-16 16H224V256H32V80c0-8.8 7.2-16 16-16h176v192h192z"],
"deploydog": [512, 512, [], "f38e", "M382.2 136h51.7v239.6h-51.7v-20.7c-19.8 24.8-52.8 24.1-73.8 14.7-26.2-11.7-44.3-38.1-44.3-71.8 0-29.8 14.8-57.9 43.3-70.8 20.2-9.1 52.7-10.6 74.8 12.9V136zm-64.7 161.8c0 18.2 13.6 33.5 33.2 33.5 19.8 0 33.2-16.4 33.2-32.9 0-17.1-13.7-33.2-33.2-33.2-19.6 0-33.2 16.4-33.2 32.6zM188.5 136h51.7v239.6h-51.7v-20.7c-19.8 24.8-52.8 24.1-73.8 14.7-26.2-11.7-44.3-38.1-44.3-71.8 0-29.8 14.8-57.9 43.3-70.8 20.2-9.1 52.7-10.6 74.8 12.9V136zm-64.7 161.8c0 18.2 13.6 33.5 33.2 33.5 19.8 0 33.2-16.4 33.2-32.9 0-17.1-13.7-33.2-33.2-33.2-19.7 0-33.2 16.4-33.2 32.6zM448 96c17.5 0 32 14.4 32 32v256c0 17.5-14.4 32-32 32H64c-17.5 0-32-14.4-32-32V128c0-17.5 14.4-32 32-32h384m0-32H64C28.8 64 0 92.8 0 128v256c0 35.2 28.8 64 64 64h384c35.2 0 64-28.8 64-64V128c0-35.2-28.8-64-64-64z"],
"deskpro": [480, 512, [], "f38f", "M205.9 512l31.1-38.4c12.3-.2 25.6-1.4 36.5-6.6 38.9-18.6 38.4-61.9 38.3-63.8-.1-5-.8-4.4-28.9-37.4H362c-.2 50.1-7.3 68.5-10.2 75.7-9.4 23.7-43.9 62.8-95.2 69.4-8.7 1.1-32.8 1.2-50.7 1.1zm200.4-167.7c38.6 0 58.5-13.6 73.7-30.9l-175.5-.3-17.4 31.3 119.2-.1zm-43.6-223.9v168.3h-73.5l-32.7 55.5H250c-52.3 0-58.1-56.5-58.3-58.9-1.2-13.2-21.3-11.6-20.1 1.8 1.4 15.8 8.8 40 26.4 57.1h-91c-25.5 0-110.8-26.8-107-114V16.9C0 .9 9.7.3 15 .1h82c.2 0 .3.1.5.1 4.3-.4 50.1-2.1 50.1 43.7 0 13.3 20.2 13.4 20.2 0 0-18.2-5.5-32.8-15.8-43.7h84.2c108.7-.4 126.5 79.4 126.5 120.2zm-132.5 56l64 29.3c13.3-45.5-42.2-71.7-64-29.3z"],
"dev": [448, 512, [], "f6cc", "M120.12 208.29c-3.88-2.9-7.77-4.35-11.65-4.35H91.03v104.47h17.45c3.88 0 7.77-1.45 11.65-4.35 3.88-2.9 5.82-7.25 5.82-13.06v-69.65c-.01-5.8-1.96-10.16-5.83-13.06zM404.1 32H43.9C19.7 32 .06 51.59 0 75.8v360.4C.06 460.41 19.7 480 43.9 480h360.2c24.21 0 43.84-19.59 43.9-43.8V75.8c-.06-24.21-19.7-43.8-43.9-43.8zM154.2 291.19c0 18.81-11.61 47.31-48.36 47.25h-46.4V172.98h47.38c35.44 0 47.36 28.46 47.37 47.28l.01 70.93zm100.68-88.66H201.6v38.42h32.57v29.57H201.6v38.41h53.29v29.57h-62.18c-11.16.29-20.44-8.53-20.72-19.69V193.7c-.27-11.15 8.56-20.41 19.71-20.69h63.19l-.01 29.52zm103.64 115.29c-13.2 30.75-36.85 24.63-47.44 0l-38.53-144.8h32.57l29.71 113.72 29.57-113.72h32.58l-38.46 144.8z"],
"deviantart": [320, 512, [], "f1bd", "M320 93.2l-98.2 179.1 7.4 9.5H320v127.7H159.1l-13.5 9.2-43.7 84c-.3 0-8.6 8.6-9.2 9.2H0v-93.2l93.2-179.4-7.4-9.2H0V102.5h156l13.5-9.2 43.7-84c.3 0 8.6-8.6 9.2-9.2H320v93.1z"],
"dhl": [640, 512, [], "f790", "M238 301.2h58.7L319 271h-58.7L238 301.2zM0 282.9v6.4h81.8l4.7-6.4H0zM172.9 271c-8.7 0-6-3.6-4.6-5.5 2.8-3.8 7.6-10.4 10.4-14.1 2.8-3.7 2.8-5.9-2.8-5.9h-51l-41.1 55.8h100.1c33.1 0 51.5-22.5 57.2-30.3h-68.2zm317.5-6.9l39.3-53.4h-62.2l-39.3 53.4h62.2zM95.3 271H0v6.4h90.6l4.7-6.4zm111-26.6c-2.8 3.8-7.5 10.4-10.3 14.2-1.4 2-4.1 5.5 4.6 5.5h45.6s7.3-10 13.5-18.4c8.4-11.4.7-35-29.2-35H112.6l-20.4 27.8h111.4c5.6 0 5.5 2.2 2.7 5.9zM0 301.2h73.1l4.7-6.4H0v6.4zm323 0h58.7L404 271h-58.7c-.1 0-22.3 30.2-22.3 30.2zm222 .1h95v-6.4h-90.3l-4.7 6.4zm22.3-30.3l-4.7 6.4H640V271h-72.7zm-13.5 18.3H640v-6.4h-81.5l-4.7 6.4zm-164.2-78.6l-22.5 30.6h-26.2l22.5-30.6h-58.7l-39.3 53.4H409l39.3-53.4h-58.7zm33.5 60.3s-4.3 5.9-6.4 8.7c-7.4 10-.9 21.6 23.2 21.6h94.3l22.3-30.3H423.1z"],
"diaspora": [512, 512, [], "f791", "M251.64 354.55c-1.4 0-88 119.9-88.7 119.9S76.34 414 76 413.25s86.6-125.7 86.6-127.4c0-2.2-129.6-44-137.6-47.1-1.3-.5 31.4-101.8 31.7-102.1.6-.7 144.4 47 145.5 47 .4 0 .9-.6 1-1.3.4-2 1-148.6 1.7-149.6.8-1.2 104.5-.7 105.1-.3 1.5 1 3.5 156.1 6.1 156.1 1.4 0 138.7-47 139.3-46.3.8.9 31.9 102.2 31.5 102.6-.9.9-140.2 47.1-140.6 48.8-.3 1.4 82.8 122.1 82.5 122.9s-85.5 63.5-86.3 63.5c-1-.2-89-125.5-90.9-125.5z"],
"digg": [512, 512, [], "f1a6", "M81.7 172.3H0v174.4h132.7V96h-51v76.3zm0 133.4H50.9v-92.3h30.8v92.3zm297.2-133.4v174.4h81.8v28.5h-81.8V416H512V172.3H378.9zm81.8 133.4h-30.8v-92.3h30.8v92.3zm-235.6 41h82.1v28.5h-82.1V416h133.3V172.3H225.1v174.4zm51.2-133.3h30.8v92.3h-30.8v-92.3zM153.3 96h51.3v51h-51.3V96zm0 76.3h51.3v174.4h-51.3V172.3z"],
"digital-ocean": [512, 512, [], "f391", "M87 481.8h73.7v-73.6H87zM25.4 346.6v61.6H87v-61.6zm466.2-169.7c-23-74.2-82.4-133.3-156.6-156.6C164.9-32.8 8 93.7 8 255.9h95.8c0-101.8 101-180.5 208.1-141.7 39.7 14.3 71.5 46.1 85.8 85.7 39.1 107-39.7 207.8-141.4 208v.3h-.3V504c162.6 0 288.8-156.8 235.6-327.1zm-235.3 231v-95.3h-95.6v95.6H256v-.3z"],
"discord": [448, 512, [], "f392", "M297.216 243.2c0 15.616-11.52 28.416-26.112 28.416-14.336 0-26.112-12.8-26.112-28.416s11.52-28.416 26.112-28.416c14.592 0 26.112 12.8 26.112 28.416zm-119.552-28.416c-14.592 0-26.112 12.8-26.112 28.416s11.776 28.416 26.112 28.416c14.592 0 26.112-12.8 26.112-28.416.256-15.616-11.52-28.416-26.112-28.416zM448 52.736V512c-64.494-56.994-43.868-38.128-118.784-107.776l13.568 47.36H52.48C23.552 451.584 0 428.032 0 398.848V52.736C0 23.552 23.552 0 52.48 0h343.04C424.448 0 448 23.552 448 52.736zm-72.96 242.688c0-82.432-36.864-149.248-36.864-149.248-36.864-27.648-71.936-26.88-71.936-26.88l-3.584 4.096c43.52 13.312 63.744 32.512 63.744 32.512-60.811-33.329-132.244-33.335-191.232-7.424-9.472 4.352-15.104 7.424-15.104 7.424s21.248-20.224 67.328-33.536l-2.56-3.072s-35.072-.768-71.936 26.88c0 0-36.864 66.816-36.864 149.248 0 0 21.504 37.12 78.08 38.912 0 0 9.472-11.52 17.152-21.248-32.512-9.728-44.8-30.208-44.8-30.208 3.766 2.636 9.976 6.053 10.496 6.4 43.21 24.198 104.588 32.126 159.744 8.96 8.96-3.328 18.944-8.192 29.44-15.104 0 0-12.8 20.992-46.336 30.464 7.68 9.728 16.896 20.736 16.896 20.736 56.576-1.792 78.336-38.912 78.336-38.912z"],
"discourse": [448, 512, [], "f393", "M225.9 32C103.3 32 0 130.5 0 252.1 0 256 .1 480 .1 480l225.8-.2c122.7 0 222.1-102.3 222.1-223.9C448 134.3 348.6 32 225.9 32zM224 384c-19.4 0-37.9-4.3-54.4-12.1L88.5 392l22.9-75c-9.8-18.1-15.4-38.9-15.4-61 0-70.7 57.3-128 128-128s128 57.3 128 128-57.3 128-128 128z"],
"dochub": [416, 512, [], "f394", "M397.9 160H256V19.6L397.9 160zM304 192v130c0 66.8-36.5 100.1-113.3 100.1H96V84.8h94.7c12 0 23.1.8 33.1 2.5v-84C212.9 1.1 201.4 0 189.2 0H0v512h189.2C329.7 512 400 447.4 400 318.1V192h-96z"],
"docker": [640, 512, [], "f395", "M349.9 236.3h-66.1v-59.4h66.1v59.4zm0-204.3h-66.1v60.7h66.1V32zm78.2 144.8H362v59.4h66.1v-59.4zm-156.3-72.1h-66.1v60.1h66.1v-60.1zm78.1 0h-66.1v60.1h66.1v-60.1zm276.8 100c-14.4-9.7-47.6-13.2-73.1-8.4-3.3-24-16.7-44.9-41.1-63.7l-14-9.3-9.3 14c-18.4 27.8-23.4 73.6-3.7 103.8-8.7 4.7-25.8 11.1-48.4 10.7H2.4c-8.7 50.8 5.8 116.8 44 162.1 37.1 43.9 92.7 66.2 165.4 66.2 157.4 0 273.9-72.5 328.4-204.2 21.4.4 67.6.1 91.3-45.2 1.5-2.5 6.6-13.2 8.5-17.1l-13.3-8.9zm-511.1-27.9h-66v59.4h66.1v-59.4zm78.1 0h-66.1v59.4h66.1v-59.4zm78.1 0h-66.1v59.4h66.1v-59.4zm-78.1-72.1h-66.1v60.1h66.1v-60.1z"],
"draft2digital": [480, 512, [], "f396", "M480 398.1l-144-82.2v64.7h-91.3c30.8-35 81.8-95.9 111.8-149.3 35.2-62.6 16.1-123.4-12.8-153.3-4.4-4.6-62.2-62.9-166-41.2-59.1 12.4-89.4 43.4-104.3 67.3-13.1 20.9-17 39.8-18.2 47.7-5.5 33 19.4 67.1 56.7 67.1 31.7 0 57.3-25.7 57.3-57.4 0-27.1-19.7-52.1-48-56.8 1.8-7.3 17.7-21.1 26.3-24.7 41.1-17.3 78 5.2 83.3 33.5 8.3 44.3-37.1 90.4-69.7 127.6C84.5 328.1 18.3 396.8 0 415.9l336-.1V480zM369.9 371l47.1 27.2-47.1 27.2zM134.2 161.4c0 12.4-10 22.4-22.4 22.4s-22.4-10-22.4-22.4 10-22.4 22.4-22.4 22.4 10.1 22.4 22.4zM82.5 380.5c25.6-27.4 97.7-104.7 150.8-169.9 35.1-43.1 40.3-82.4 28.4-112.7-7.4-18.8-17.5-30.2-24.3-35.7 45.3 2.1 68 23.4 82.2 38.3 0 0 42.4 48.2 5.8 113.3-37 65.9-110.9 147.5-128.5 166.7z"],
"dribbble": [512, 512, [], "f17d", "M256 8C119.252 8 8 119.252 8 256s111.252 248 248 248 248-111.252 248-248S392.748 8 256 8zm163.97 114.366c29.503 36.046 47.369 81.957 47.835 131.955-6.984-1.477-77.018-15.682-147.502-6.818-5.752-14.041-11.181-26.393-18.617-41.614 78.321-31.977 113.818-77.482 118.284-83.523zM396.421 97.87c-3.81 5.427-35.697 48.286-111.021 76.519-34.712-63.776-73.185-116.168-79.04-124.008 67.176-16.193 137.966 1.27 190.061 47.489zm-230.48-33.25c5.585 7.659 43.438 60.116 78.537 122.509-99.087 26.313-186.36 25.934-195.834 25.809C62.38 147.205 106.678 92.573 165.941 64.62zM44.17 256.323c0-2.166.043-4.322.108-6.473 9.268.19 111.92 1.513 217.706-30.146 6.064 11.868 11.857 23.915 17.174 35.949-76.599 21.575-146.194 83.527-180.531 142.306C64.794 360.405 44.17 310.73 44.17 256.323zm81.807 167.113c22.127-45.233 82.178-103.622 167.579-132.756 29.74 77.283 42.039 142.053 45.189 160.638-68.112 29.013-150.015 21.053-212.768-27.882zm248.38 8.489c-2.171-12.886-13.446-74.897-41.152-151.033 66.38-10.626 124.7 6.768 131.947 9.055-9.442 58.941-43.273 109.844-90.795 141.978z"],
"dribbble-square": [448, 512, [], "f397", "M90.2 228.2c8.9-42.4 37.4-77.7 75.7-95.7 3.6 4.9 28 38.8 50.7 79-64 17-120.3 16.8-126.4 16.7zM314.6 154c-33.6-29.8-79.3-41.1-122.6-30.6 3.8 5.1 28.6 38.9 51 80 48.6-18.3 69.1-45.9 71.6-49.4zM140.1 364c40.5 31.6 93.3 36.7 137.3 18-2-12-10-53.8-29.2-103.6-55.1 18.8-93.8 56.4-108.1 85.6zm98.8-108.2c-3.4-7.8-7.2-15.5-11.1-23.2C159.6 253 93.4 252.2 87.4 252c0 1.4-.1 2.8-.1 4.2 0 35.1 13.3 67.1 35.1 91.4 22.2-37.9 67.1-77.9 116.5-91.8zm34.9 16.3c17.9 49.1 25.1 89.1 26.5 97.4 30.7-20.7 52.5-53.6 58.6-91.6-4.6-1.5-42.3-12.7-85.1-5.8zm-20.3-48.4c4.8 9.8 8.3 17.8 12 26.8 45.5-5.7 90.7 3.4 95.2 4.4-.3-32.3-11.8-61.9-30.9-85.1-2.9 3.9-25.8 33.2-76.3 53.9zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-64 176c0-88.2-71.8-160-160-160S64 167.8 64 256s71.8 160 160 160 160-71.8 160-160z"],
"dropbox": [528, 512, [], "f16b", "M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zM131.6 395.7l132-84.3 132 84.3-132 84.3-132-84.3zm132.8-111.6l132-84.3-132-83.6L395.7 32 528 116.3l-132.3 84.3L528 284.8l-132.3 84.3-131.3-85z"],
"drupal": [448, 512, [], "f1a9", "M319.5 114.7c-22.2-14-43.5-19.5-64.7-33.5-13-8.8-31.3-30-46.5-48.3-2.7 29.3-11.5 41.2-22 49.5-21.3 17-34.8 22.2-53.5 32.3C117 123 32 181.5 32 290.5 32 399.7 123.8 480 225.8 480 327.5 480 416 406 416 294c0-112.3-83-171-96.5-179.3zm2.5 325.6c-20.1 20.1-90.1 28.7-116.7 4.2-4.8-4.8.3-12 6.5-12 0 0 17 13.3 51.5 13.3 27 0 46-7.7 54.5-14 6.1-4.6 8.4 4.3 4.2 8.5zm-54.5-52.6c8.7-3.6 29-3.8 36.8 1.3 4.1 2.8 16.1 18.8 6.2 23.7-8.4 4.2-1.2-15.7-26.5-15.7-14.7 0-19.5 5.2-26.7 11-7 6-9.8 8-12.2 4.7-6-8.2 15.9-22.3 22.4-25zM360 405c-15.2-1-45.5-48.8-65-49.5-30.9-.9-104.1 80.7-161.3 42-38.8-26.6-14.6-104.8 51.8-105.2 49.5-.5 83.8 49 108.5 48.5 21.3-.3 61.8-41.8 81.8-41.8 48.7 0 23.3 109.3-15.8 106z"],
"dyalog": [416, 512, [], "f399", "M0 32v119.2h64V96h107.2C284.6 96 352 176.2 352 255.9 352 332 293.4 416 171.2 416H0v64h171.2C331.9 480 416 367.3 416 255.9c0-58.7-22.1-113.4-62.3-154.3C308.9 56 245.7 32 171.2 32H0z"],
"earlybirds": [480, 512, [], "f39a", "M313.2 47.5c1.2-13 21.3-14 36.6-8.7.9.3 26.2 9.7 19 15.2-27.9-7.4-56.4 18.2-55.6-6.5zm-201 6.9c30.7-8.1 62 20 61.1-7.1-1.3-14.2-23.4-15.3-40.2-9.6-1 .3-28.7 10.5-20.9 16.7zM319.4 160c-8.8 0-16 7.2-16 16s7.2 16 16 16 16-7.2 16-16-7.2-16-16-16zm-159.7 0c-8.8 0-16 7.2-16 16s7.2 16 16 16 16-7.2 16-16-7.2-16-16-16zm318.5 163.2c-9.9 24-40.7 11-63.9-1.2-13.5 69.1-58.1 111.4-126.3 124.2.3.9-2-.1 24 1 33.6 1.4 63.8-3.1 97.4-8-19.8-13.8-11.4-37.1-9.8-38.1 1.4-.9 14.7 1.7 21.6 11.5 8.6-12.5 28.4-14.8 30.2-13.6 1.6 1.1 6.6 20.9-6.9 34.6 4.7-.9 8.2-1.6 9.8-2.1 2.6-.8 17.7 11.3 3.1 13.3-14.3 2.3-22.6 5.1-47.1 10.8-45.9 10.7-85.9 11.8-117.7 12.8l1 11.6c3.8 18.1-23.4 24.3-27.6 6.2.8 17.9-27.1 21.8-28.4-1l-.5 5.3c-.7 18.4-28.4 17.9-28.3-.6-7.5 13.5-28.1 6.8-26.4-8.5l1.2-12.4c-36.7.9-59.7 3.1-61.8 3.1-20.9 0-20.9-31.6 0-31.6 2.4 0 27.7 1.3 63.2 2.8-61.1-15.5-103.7-55-114.9-118.2-25 12.8-57.5 26.8-68.2.8-10.5-25.4 21.5-42.6 66.8-73.4.7-6.6 1.6-13.3 2.7-19.8-14.4-19.6-11.6-36.3-16.1-60.4-16.8 2.4-23.2-9.1-23.6-23.1.3-7.3 2.1-14.9 2.4-15.4 1.1-1.8 10.1-2 12.7-2.6 6-31.7 50.6-33.2 90.9-34.5 19.7-21.8 45.2-41.5 80.9-48.3C203.3 29 215.2 8.5 216.2 8c1.7-.8 21.2 4.3 26.3 23.2 5.2-8.8 18.3-11.4 19.6-10.7 1.1.6 6.4 15-4.9 25.9 40.3 3.5 72.2 24.7 96 50.7 36.1 1.5 71.8 5.9 77.1 34 2.7.6 11.6.8 12.7 2.6.3.5 2.1 8.1 2.4 15.4-.5 13.9-6.8 25.4-23.6 23.1-3.2 17.3-2.7 32.9-8.7 47.7 2.4 11.7 4 23.8 4.8 36.4 37 25.4 70.3 42.5 60.3 66.9zM207.4 159.9c.9-44-37.9-42.2-78.6-40.3-21.7 1-38.9 1.9-45.5 13.9-11.4 20.9 5.9 92.9 23.2 101.2 9.8 4.7 73.4 7.9 86.3-7.1 8.2-9.4 15-49.4 14.6-67.7zm52 58.3c-4.3-12.4-6-30.1-15.3-32.7-2-.5-9-.5-11 0-10 2.8-10.8 22.1-17 37.2 15.4 0 19.3 9.7 23.7 9.7 4.3 0 6.3-11.3 19.6-14.2zm135.7-84.7c-6.6-12.1-24.8-12.9-46.5-13.9-40.2-1.9-78.2-3.8-77.3 40.3-.5 18.3 5 58.3 13.2 67.8 13 14.9 76.6 11.8 86.3 7.1 15.8-7.6 36.5-78.9 24.3-101.3z"],
"ebay": [640, 512, [], "f4f4", "M606 189.5l-54.8 109.9-54.9-109.9h-37.5l10.9 20.6c-11.5-19-35.9-26-63.3-26-31.8 0-67.9 8.7-71.5 43.1h33.7c1.4-13.8 15.7-21.8 35-21.8 26 0 41 9.6 41 33v3.4c-12.7 0-28 .1-41.7.4-42.4.9-69.6 10-76.7 34.4 1-5.2 1.5-10.6 1.5-16.2 0-52.1-39.7-76.2-75.4-76.2-21.3 0-43 5.5-58.7 24.2v-80.6h-32.1v169.5c0 10.3-.6 22.9-1.1 33.1h31.5c.7-6.3 1.1-12.9 1.1-19.5 13.6 16.6 35.4 24.9 58.7 24.9 36.9 0 64.9-21.9 73.3-54.2-.5 2.8-.7 5.8-.7 9 0 24.1 21.1 45 60.6 45 26.6 0 45.8-5.7 61.9-25.5 0 6.6.3 13.3 1.1 20.2h29.8c-.7-8.2-1-17.5-1-26.8v-65.6c0-9.3-1.7-17.2-4.8-23.8l61.5 116.1-28.5 54.1h35.9L640 189.5zM243.7 313.8c-29.6 0-50.2-21.5-50.2-53.8 0-32.4 20.6-53.8 50.2-53.8 29.8 0 50.2 21.4 50.2 53.8 0 32.3-20.4 53.8-50.2 53.8zm200.9-47.3c0 30-17.9 48.4-51.6 48.4-25.1 0-35-13.4-35-25.8 0-19.1 18.1-24.4 47.2-25.3 13.1-.5 27.6-.6 39.4-.6zm-411.9 1.6h128.8v-8.5c0-51.7-33.1-75.4-78.4-75.4-56.8 0-83 30.8-83 77.6 0 42.5 25.3 74 82.5 74 31.4 0 68-11.7 74.4-46.1h-33.1c-12 35.8-87.7 36.7-91.2-21.6zm95-21.4H33.3c6.9-56.6 92.1-54.7 94.4 0z"],
"edge": [512, 512, [], "f282", "M25.714 228.163c.111-.162.23-.323.342-.485-.021.162-.045.323-.065.485h-.277zm460.572 15.508c0-44.032-7.754-84.465-28.801-122.405C416.498 47.879 343.912 8.001 258.893 8.001 118.962 7.724 40.617 113.214 26.056 227.679c42.429-61.312 117.073-121.376 220.375-124.966 0 0 109.666 0 99.419 104.957H169.997c6.369-37.386 18.554-58.986 34.339-78.926-75.048 34.893-121.85 96.096-120.742 188.315.83 71.448 50.124 144.836 120.743 171.976 83.357 31.847 192.776 7.2 240.132-21.324V363.307c-80.864 56.494-270.871 60.925-272.255-67.572h314.073v-52.064z"],
"elementor": [448, 512, [], "f430", "M425.6 32H22.4C10 32 0 42 0 54.4v403.2C0 470 10 480 22.4 480h403.2c12.4 0 22.4-10 22.4-22.4V54.4C448 42 438 32 425.6 32M164.3 355.5h-39.8v-199h39.8v199zm159.3 0H204.1v-39.8h119.5v39.8zm0-79.6H204.1v-39.8h119.5v39.8zm0-79.7H204.1v-39.8h119.5v39.8z"],
"ello": [496, 512, [], "f5f1", "M248 8C111.03 8 0 119.03 0 256s111.03 248 248 248 248-111.03 248-248S384.97 8 248 8zm143.84 285.2C375.31 358.51 315.79 404.8 248 404.8s-127.31-46.29-143.84-111.6c-1.65-7.44 2.48-15.71 9.92-17.36 7.44-1.65 15.71 2.48 17.36 9.92 14.05 52.91 62 90.11 116.56 90.11s102.51-37.2 116.56-90.11c1.65-7.44 9.92-12.4 17.36-9.92 7.44 1.65 12.4 9.92 9.92 17.36z"],
"ember": [640, 512, [], "f423", "M639.9 254.6c-1.1-10.7-10.7-6.8-10.7-6.8s-15.6 12.1-29.3 10.7c-13.7-1.3-9.4-32-9.4-32s3-28.1-5.1-30.4c-8.1-2.4-18 7.3-18 7.3s-12.4 13.7-18.3 31.2l-1.6.5s1.9-30.6-.3-37.6c-1.6-3.5-16.4-3.2-18.8 3s-14.2 49.2-15 67.2c0 0-23.1 19.6-43.3 22.8s-25-9.4-25-9.4 54.8-15.3 52.9-59.1-44.2-27.6-49-24c-4.6 3.5-29.4 18.4-36.6 59.7-.2 1.4-.7 7.5-.7 7.5s-21.2 14.2-33 18c0 0 33-55.6-7.3-80.9-11.4-6.8-21.3-.5-27.2 5.3 13.6-17.3 46.4-64.2 36.9-105.2-5.8-24.4-18-27.1-29.2-23.1-17 6.7-23.5 16.7-23.5 16.7s-22 32-27.1 79.5-12.6 105.1-12.6 105.1-10.5 10.2-20.2 10.7-5.4-28.7-5.4-28.7 7.5-44.6 7-52.1-1.1-11.6-9.9-14.2c-8.9-2.7-18.5 8.6-18.5 8.6s-25.5 38.7-27.7 44.6l-1.3 2.4-1.3-1.6s18-52.7.8-53.5-28.5 18.8-28.5 18.8-19.6 32.8-20.4 36.5l-1.3-1.6s8.1-38.2 6.4-47.6c-1.6-9.4-10.5-7.5-10.5-7.5s-11.3-1.3-14.2 5.9-13.7 55.3-15 70.7c0 0-28.2 20.2-46.8 20.4-18.5.3-16.7-11.8-16.7-11.8s68-23.3 49.4-69.2c-8.3-11.8-18-15.5-31.7-15.3-13.7.3-30.3 8.6-41.3 33.3-5.3 11.8-6.8 23-7.8 31.5 0 0-12.3 2.4-18.8-2.9s-10 0-10 0-11.2 14-.1 18.3 28.1 6.1 28.1 6.1c1.6 7.5 6.2 19.5 19.6 29.7 20.2 15.3 58.8-1.3 58.8-1.3l15.9-8.8s.5 14.6 12.1 16.7 16.4 1 36.5-47.9c11.8-25 12.6-23.6 12.6-23.6l1.3-.3s-9.1 46.8-5.6 59.7C187.7 319.4 203 318 203 318s8.3 2.4 15-21.2 19.6-49.9 19.6-49.9h1.6s-5.6 48.1 3 63.7 30.9 5.3 30.9 5.3 15.6-7.8 18-10.2c0 0 18.5 15.8 44.6 12.9 58.3-11.5 79.1-25.9 79.1-25.9s10 24.4 41.1 26.7c35.5 2.7 54.8-18.6 54.8-18.6s-.3 13.5 12.1 18.6 20.7-22.8 20.7-22.8l20.7-57.2h1.9s1.1 37.3 21.5 43.2 47-13.7 47-13.7 6.4-3.5 5.3-14.3zm-578 5.3c.8-32 21.8-45.9 29-39 7.3 7 4.6 22-9.1 31.4-13.7 9.5-19.9 7.6-19.9 7.6zm272.8-123.8s19.1-49.7 23.6-25.5-40 96.2-40 96.2c.5-16.2 16.4-70.7 16.4-70.7zm22.8 138.4c-12.6 33-43.3 19.6-43.3 19.6s-3.5-11.8 6.4-44.9 33.3-20.2 33.3-20.2 16.2 12.4 3.6 45.5zm84.6-14.6s-3-10.5 8.1-30.6c11-20.2 19.6-9.1 19.6-9.1s9.4 10.2-1.3 25.5-26.4 14.2-26.4 14.2z"],
"empire": [496, 512, [], "f1d1", "M287.6 54.2c-10.8-2.2-22.1-3.3-33.5-3.6V32.4c78.1 2.2 146.1 44 184.6 106.6l-15.8 9.1c-6.1-9.7-12.7-18.8-20.2-27.1l-18 15.5c-26-29.6-61.4-50.7-101.9-58.4l4.8-23.9zM53.4 322.4l23-7.7c-6.4-18.3-10-38.2-10-58.7s3.3-40.4 9.7-58.7l-22.7-7.7c3.6-10.8 8.3-21.3 13.6-31l-15.8-9.1C34 181 24.1 217.5 24.1 256s10 75 27.1 106.6l15.8-9.1c-5.3-10-9.7-20.3-13.6-31.1zM213.1 434c-40.4-8-75.8-29.1-101.9-58.7l-18 15.8c-7.5-8.6-14.4-17.7-20.2-27.4l-16 9.4c38.5 62.3 106.8 104.3 184.9 106.6v-18.3c-11.3-.3-22.7-1.7-33.5-3.6l4.7-23.8zM93.3 120.9l18 15.5c26-29.6 61.4-50.7 101.9-58.4l-4.7-23.8c10.8-2.2 22.1-3.3 33.5-3.6V32.4C163.9 34.6 95.9 76.4 57.4 139l15.8 9.1c6-9.7 12.6-18.9 20.1-27.2zm309.4 270.2l-18-15.8c-26 29.6-61.4 50.7-101.9 58.7l4.7 23.8c-10.8 1.9-22.1 3.3-33.5 3.6v18.3c78.1-2.2 146.4-44.3 184.9-106.6l-16.1-9.4c-5.7 9.7-12.6 18.8-20.1 27.4zM496 256c0 137-111 248-248 248S0 393 0 256 111 8 248 8s248 111 248 248zm-12.2 0c0-130.1-105.7-235.8-235.8-235.8S12.2 125.9 12.2 256 117.9 491.8 248 491.8 483.8 386.1 483.8 256zm-39-106.6l-15.8 9.1c5.3 9.7 10 20.2 13.6 31l-22.7 7.7c6.4 18.3 9.7 38.2 9.7 58.7s-3.6 40.4-10 58.7l23 7.7c-3.9 10.8-8.3 21-13.6 31l15.8 9.1C462 331 471.9 294.5 471.9 256s-9.9-75-27.1-106.6zm-183 177.7c16.3-3.3 30.4-11.6 40.7-23.5l51.2 44.8c11.9-13.6 21.3-29.3 27.1-46.8l-64.2-22.1c2.5-7.5 3.9-15.2 3.9-23.5s-1.4-16.1-3.9-23.5l64.5-22.1c-6.1-17.4-15.5-33.2-27.4-46.8l-51.2 44.8c-10.2-11.9-24.4-20.5-40.7-23.8l13.3-66.4c-8.6-1.9-17.7-2.8-27.1-2.8-9.4 0-18.5.8-27.1 2.8l13.3 66.4c-16.3 3.3-30.4 11.9-40.7 23.8l-51.2-44.8c-11.9 13.6-21.3 29.3-27.4 46.8l64.5 22.1c-2.5 7.5-3.9 15.2-3.9 23.5s1.4 16.1 3.9 23.5l-64.2 22.1c5.8 17.4 15.2 33.2 27.1 46.8l51.2-44.8c10.2 11.9 24.4 20.2 40.7 23.5l-13.3 66.7c8.6 1.7 17.7 2.8 27.1 2.8 9.4 0 18.5-1.1 27.1-2.8l-13.3-66.7z"],
"envira": [448, 512, [], "f299", "M0 32c477.6 0 366.6 317.3 367.1 366.3L448 480h-26l-70.4-71.2c-39 4.2-124.4 34.5-214.4-37C47 300.3 52 214.7 0 32zm79.7 46c-49.7-23.5-5.2 9.2-5.2 9.2 45.2 31.2 66 73.7 90.2 119.9 31.5 60.2 79 139.7 144.2 167.7 65 28 34.2 12.5 6-8.5-28.2-21.2-68.2-87-91-130.2-31.7-60-61-118.6-144.2-158.1z"],
"erlang": [640, 512, [], "f39d", "M87.2 53.5H0v405h100.4c-49.7-52.6-78.8-125.3-78.7-212.1-.1-76.7 24-142.7 65.5-192.9zm238.2 9.7c-45.9.1-85.1 33.5-89.2 83.2h169.9c-1.1-49.7-34.5-83.1-80.7-83.2zm230.7-9.6h.3l-.1-.1zm.3 0c31.4 42.7 48.7 97.5 46.2 162.7.5 6 .5 11.7 0 24.1H230.2c-.2 109.7 38.9 194.9 138.6 195.3 68.5-.3 118-51 151.9-106.1l96.4 48.2c-17.4 30.9-36.5 57.8-57.9 80.8H640v-405z"],
"ethereum": [320, 512, [], "f42e", "M311.9 260.8L160 353.6 8 260.8 160 0l151.9 260.8zM160 383.4L8 290.6 160 512l152-221.4-152 92.8z"],
"etsy": [384, 512, [], "f2d7", "M384 348c-1.75 10.75-13.75 110-15.5 132-117.879-4.299-219.895-4.743-368.5 0v-25.5c45.457-8.948 60.627-8.019 61-35.25 1.793-72.322 3.524-244.143 0-322-1.029-28.46-12.13-26.765-61-36v-25.5c73.886 2.358 255.933 8.551 362.999-3.75-3.5 38.25-7.75 126.5-7.75 126.5H332C320.947 115.665 313.241 68 277.25 68h-137c-10.25 0-10.75 3.5-10.75 9.75V241.5c58 .5 88.5-2.5 88.5-2.5 29.77-.951 27.56-8.502 40.75-65.251h25.75c-4.407 101.351-3.91 61.829-1.75 160.25H257c-9.155-40.086-9.065-61.045-39.501-61.5 0 0-21.5-2-88-2v139c0 26 14.25 38.25 44.25 38.25H263c63.636 0 66.564-24.996 98.751-99.75H384z"],
"evernote": [384, 512, [], "f839", "M120.82 132.21c1.6 22.31-17.55 21.59-21.61 21.59-68.93 0-73.64-1-83.58 3.34-.56.22-.74 0-.37-.37L123.79 46.45c.38-.37.6-.22.38.37-4.35 9.99-3.35 15.09-3.35 85.39zm79 308c-14.68-37.08 13-76.93 52.52-76.62 17.49 0 22.6 23.21 7.95 31.42-6.19 3.3-24.95 1.74-25.14 19.2-.05 17.09 19.67 25 31.2 24.89A45.64 45.64 0 0 0 312 393.45v-.08c0-11.63-7.79-47.22-47.54-55.34-7.72-1.54-65-6.35-68.35-50.52-3.74 16.93-17.4 63.49-43.11 69.09-8.74 1.94-69.68 7.64-112.92-36.77 0 0-18.57-15.23-28.23-57.95-3.38-15.75-9.28-39.7-11.14-62 0-18 11.14-30.45 25.07-32.2 81 0 90 2.32 101-7.8 9.82-9.24 7.8-15.5 7.8-102.78 1-8.3 7.79-30.81 53.41-24.14 6 .86 31.91 4.18 37.48 30.64l64.26 11.15c20.43 3.71 70.94 7 80.6 57.94 22.66 121.09 8.91 238.46 7.8 238.46C362.15 485.53 267.06 480 267.06 480c-18.95-.23-54.25-9.4-67.27-39.83zm80.94-204.84c-1 1.92-2.2 6 .85 7 14.09 4.93 39.75 6.84 45.88 5.53 3.11-.25 3.05-4.43 2.48-6.65-3.53-21.85-40.83-26.5-49.24-5.92z"],
"expeditedssl": [496, 512, [], "f23e", "M248 43.4C130.6 43.4 35.4 138.6 35.4 256S130.6 468.6 248 468.6 460.6 373.4 460.6 256 365.4 43.4 248 43.4zm-97.4 132.9c0-53.7 43.7-97.4 97.4-97.4s97.4 43.7 97.4 97.4v26.6c0 5-3.9 8.9-8.9 8.9h-17.7c-5 0-8.9-3.9-8.9-8.9v-26.6c0-82.1-124-82.1-124 0v26.6c0 5-3.9 8.9-8.9 8.9h-17.7c-5 0-8.9-3.9-8.9-8.9v-26.6zM389.7 380c0 9.7-8 17.7-17.7 17.7H124c-9.7 0-17.7-8-17.7-17.7V238.3c0-9.7 8-17.7 17.7-17.7h248c9.7 0 17.7 8 17.7 17.7V380zm-248-137.3v132.9c0 2.5-1.9 4.4-4.4 4.4h-8.9c-2.5 0-4.4-1.9-4.4-4.4V242.7c0-2.5 1.9-4.4 4.4-4.4h8.9c2.5 0 4.4 1.9 4.4 4.4zm141.7 48.7c0 13-7.2 24.4-17.7 30.4v31.6c0 5-3.9 8.9-8.9 8.9h-17.7c-5 0-8.9-3.9-8.9-8.9v-31.6c-10.5-6.1-17.7-17.4-17.7-30.4 0-19.7 15.8-35.4 35.4-35.4s35.5 15.8 35.5 35.4zM248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 478.3C121 486.3 17.7 383 17.7 256S121 25.7 248 25.7 478.3 129 478.3 256 375 486.3 248 486.3z"],
"facebook": [448, 512, [], "f09a", "M448 56.7v398.5c0 13.7-11.1 24.7-24.7 24.7H309.1V306.5h58.2l8.7-67.6h-67v-43.2c0-19.6 5.4-32.9 33.5-32.9h35.8v-60.5c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9h-58.4v67.6h58.4V480H24.7C11.1 480 0 468.9 0 455.3V56.7C0 43.1 11.1 32 24.7 32h398.5c13.7 0 24.8 11.1 24.8 24.7z"],
"facebook-f": [264, 512, [], "f39e", "M215.8 85H264V3.6C255.7 2.5 227.1 0 193.8 0 124.3 0 76.7 42.4 76.7 120.3V192H0v91h76.7v229h94V283h73.6l11.7-91h-85.3v-62.7c0-26.3 7.3-44.3 45.1-44.3z"],
"facebook-messenger": [448, 512, [], "f39f", "M224 32C15.9 32-77.5 278 84.6 400.6V480l75.7-42c142.2 39.8 285.4-59.9 285.4-198.7C445.8 124.8 346.5 32 224 32zm23.4 278.1L190 250.5 79.6 311.6l121.1-128.5 57.4 59.6 110.4-61.1-121.1 128.5z"],
"facebook-square": [448, 512, [], "f082", "M448 80v352c0 26.5-21.5 48-48 48h-85.3V302.8h60.6l8.7-67.6h-69.3V192c0-19.6 5.4-32.9 33.5-32.9H384V98.7c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9H184v67.6h60.9V480H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48z"],
"fantasy-flight-games": [512, 512, [], "f6dc", "M256 32.86L32.86 256 256 479.14 479.14 256 256 32.86zM88.34 255.83c1.96-2 11.92-12.3 96.49-97.48 41.45-41.75 86.19-43.77 119.77-18.69 24.63 18.4 62.06 58.9 62.15 59 .68.74 1.07 2.86.58 3.38-11.27 11.84-22.68 23.54-33.5 34.69-34.21-32.31-40.52-38.24-48.51-43.95-17.77-12.69-41.4-10.13-56.98 5.1-2.17 2.13-1.79 3.43.12 5.35 2.94 2.95 28.1 28.33 35.09 35.78-11.95 11.6-23.66 22.97-35.69 34.66-12.02-12.54-24.48-25.53-36.54-38.11-21.39 21.09-41.69 41.11-61.85 60.99a42569.01 42569.01 0 0 1-41.13-40.72zm234.82 101.6c-35.49 35.43-78.09 38.14-106.99 20.47-22.08-13.5-39.38-32.08-72.93-66.84 12.05-12.37 23.79-24.42 35.37-36.31 33.02 31.91 37.06 36.01 44.68 42.09 18.48 14.74 42.52 13.67 59.32-1.8 3.68-3.39 3.69-3.64.14-7.24-10.59-10.73-21.19-21.44-31.77-32.18-1.32-1.34-3.03-2.48-.8-4.69 10.79-10.71 21.48-21.52 32.21-32.29.26-.26.65-.38 1.91-1.07 12.37 12.87 24.92 25.92 37.25 38.75 21.01-20.73 41.24-40.68 61.25-60.42 13.68 13.4 27.13 26.58 40.86 40.03-20.17 20.86-81.68 82.71-100.5 101.5zM256 0L0 256l256 256 256-256L256 0zM16 256L256 16l240 240-240 240L16 256z"],
"fedex": [640, 512, [], "f797", "M586 284.5l53.3-59.9h-62.4l-21.7 24.8-22.5-24.8H414v-16h56.1v-48.1H318.9V236h-.5c-9.6-11-21.5-14.8-35.4-14.8-28.4 0-49.8 19.4-57.3 44.9-18-59.4-97.4-57.6-121.9-14v-24.2H49v-26.2h60v-41.1H0V345h49v-77.5h48.9c-1.5 5.7-2.3 11.8-2.3 18.2 0 73.1 102.6 91.4 130.2 23.7h-42c-14.7 20.9-45.8 8.9-45.8-14.6h85.5c3.7 30.5 27.4 56.9 60.1 56.9 14.1 0 27-6.9 34.9-18.6h.5V345h212.2l22.1-25 22.3 25H640l-54-60.5zm-446.7-16.6c6.1-26.3 41.7-25.6 46.5 0h-46.5zm153.4 48.9c-34.6 0-34-62.8 0-62.8 32.6 0 34.5 62.8 0 62.8zm167.8 19.1h-94.4V169.4h95v30.2H405v33.9h55.5v28.1h-56.1v44.7h56.1v29.6zm-45.9-39.8v-24.4h56.1v-44l50.7 57-50.7 57v-45.6h-56.1zm138.6 10.3l-26.1 29.5H489l45.6-51.2-45.6-51.2h39.7l26.6 29.3 25.6-29.3h38.5l-45.4 51 46 51.4h-40.5l-26.3-29.5z"],
"fedora": [448, 512, [], "f798", "M225 32C101.3 31.7.8 131.7.4 255.4L0 425.7a53.6 53.6 0 0 0 53.6 53.9l170.2.4c123.7.3 224.3-99.7 224.6-223.4S348.7 32.3 225 32zm169.8 157.2L333 126.6c2.3-4.7 3.8-9.2 3.8-14.3v-1.6l55.2 56.1a101 101 0 0 1 2.8 22.4zM331 94.3a106.06 106.06 0 0 1 58.5 63.8l-54.3-54.6a26.48 26.48 0 0 0-4.2-9.2zM118.1 247.2a49.66 49.66 0 0 0-7.7 11.4l-8.5-8.5a85.78 85.78 0 0 1 16.2-2.9zM97 251.4l11.8 11.9-.9 8a34.74 34.74 0 0 0 2.4 12.5l-27-27.2a80.6 80.6 0 0 1 13.7-5.2zm-18.2 7.4l38.2 38.4a53.17 53.17 0 0 0-14.1 4.7L67.6 266a107 107 0 0 1 11.2-7.2zm-15.2 9.8l35.3 35.5a67.25 67.25 0 0 0-10.5 8.5L53.5 278a64.33 64.33 0 0 1 10.1-9.4zm-13.3 12.3l34.9 35a56.84 56.84 0 0 0-7.7 11.4l-35.8-35.9c2.8-3.8 5.7-7.2 8.6-10.5zm-11 14.3l36.4 36.6a48.29 48.29 0 0 0-3.6 15.2l-39.5-39.8a99.81 99.81 0 0 1 6.7-12zm-8.8 16.3l41.3 41.8a63.47 63.47 0 0 0 6.7 26.2L25.8 326c1.4-4.9 2.9-9.6 4.7-14.5zm-7.9 43l61.9 62.2a31.24 31.24 0 0 0-3.6 14.3v1.1l-55.4-55.7a88.27 88.27 0 0 1-2.9-21.9zm5.3 30.7l54.3 54.6a28.44 28.44 0 0 0 4.2 9.2 106.32 106.32 0 0 1-58.5-63.8zm-5.3-37a80.69 80.69 0 0 1 2.1-17l72.2 72.5a37.59 37.59 0 0 0-9.9 8.7zm253.3-51.8l-42.6-.1-.1 56c-.2 69.3-64.4 115.8-125.7 102.9-5.7 0-19.9-8.7-19.9-24.2a24.89 24.89 0 0 1 24.5-24.6c6.3 0 6.3 1.6 15.7 1.6a55.91 55.91 0 0 0 56.1-55.9l.1-47c0-4.5-4.5-9-8.9-9l-33.6-.1c-32.6-.1-32.5-49.4.1-49.3l42.6.1.1-56a105.18 105.18 0 0 1 105.6-105 86.35 86.35 0 0 1 20.2 2.3c11.2 1.8 19.9 11.9 19.9 24 0 15.5-14.9 27.8-30.3 23.9-27.4-5.9-65.9 14.4-66 54.9l-.1 47a8.94 8.94 0 0 0 8.9 9l33.6.1c32.5.2 32.4 49.5-.2 49.4zm23.5-.3a35.58 35.58 0 0 0 7.6-11.4l8.5 8.5a102 102 0 0 1-16.1 2.9zm21-4.2L308.6 280l.9-8.1a34.74 34.74 0 0 0-2.4-12.5l27 27.2a74.89 74.89 0 0 1-13.7 5.3zm18-7.4l-38-38.4c4.9-1.1 9.6-2.4 13.7-4.7l36.2 35.9c-3.8 2.5-7.9 5-11.9 7.2zm15.5-9.8l-35.3-35.5a61.06 61.06 0 0 0 10.5-8.5l34.9 35a124.56 124.56 0 0 1-10.1 9zm13.2-12.3l-34.9-35a63.18 63.18 0 0 0 7.7-11.4l35.8 35.9a130.28 130.28 0 0 1-8.6 10.5zm11-14.3l-36.4-36.6a48.29 48.29 0 0 0 3.6-15.2l39.5 39.8a87.72 87.72 0 0 1-6.7 12zm13.5-30.9a140.63 140.63 0 0 1-4.7 14.3L345.6 190a58.19 58.19 0 0 0-7.1-26.2zm1-5.6l-71.9-72.1a32 32 0 0 0 9.9-9.2l64.3 64.7a90.93 90.93 0 0 1-2.3 16.6z"],
"figma": [384, 512, [], "f799", "M277 170.7A85.35 85.35 0 0 0 277 0H106.3a85.3 85.3 0 0 0 0 170.6 85.35 85.35 0 0 0 0 170.7 85.35 85.35 0 1 0 85.3 85.4v-256zm0 0a85.3 85.3 0 1 0 85.3 85.3 85.31 85.31 0 0 0-85.3-85.3z"],
"firefox": [480, 512, [], "f269", "M478.1 235.3c-.7-4.5-1.4-7.1-1.4-7.1s-1.8 2-4.7 5.9c-.9-10.7-2.8-21.2-5.8-31.6-3.7-12.9-8.5-25.4-14.5-37.4-3.8-8-8.2-15.6-13.3-22.8-1.8-2.7-3.7-5.4-5.6-7.9-8.8-14.4-19-23.3-30.7-40-7.6-12.8-12.9-26.9-15.4-41.6-3.2 8.9-5.7 18-7.4 27.3-12.1-12.2-22.5-20.8-28.9-26.7C319.4 24.2 323 9.1 323 9.1S264.7 74.2 289.9 142c8.7 23 23.8 43.1 43.4 57.9 24.4 20.2 50.8 36 64.7 76.6-11.2-21.3-28.1-39.2-48.8-51.5 6.2 14.7 9.4 30.6 9.3 46.5 0 61-49.6 110.5-110.6 110.4-8.3 0-16.5-.9-24.5-2.8-9.5-1.8-18.7-4.9-27.4-9.3-12.9-7.8-24-18.1-32.8-30.3l-.2-.3 2 .7c4.6 1.6 9.2 2.8 14 3.7 18.7 4 38.3 1.7 55.6-6.6 17.5-9.7 28-16.9 36.6-14h.2c8.4 2.7 15-5.5 9-14-10.4-13.4-27.4-20-44.2-17-17.5 2.5-33.5 15-56.4 2.9-1.5-.8-2.9-1.6-4.3-2.5-1.6-.9 4.9 1.3 3.4.3-5-2.5-9.8-5.4-14.4-8.6-.3-.3 3.5 1.1 3.1.8-5.9-4-11-9.2-15-15.2-4.1-7.4-4.5-16.4-1-24.1 2.1-3.8 5.4-6.9 9.3-8.7 3 1.5 4.8 2.6 4.8 2.6s-1.3-2.5-2.1-3.8c.3-.1.5 0 .8-.2 2.6 1.1 8.3 4 11.4 5.8 2.1 1.1 3.8 2.7 5.2 4.7 0 0 1-.5.3-2.7-1.1-2.7-2.9-5-5.4-6.6h.2c2.3 1.2 4.5 2.6 6.6 4.1 1.9-4.4 2.8-9.2 2.6-14 .2-2.6-.2-5.3-1.1-7.8-.8-1.6.5-2.2 1.9-.5-.2-1.3-.7-2.5-1.2-3.7v-.1s.8-1.1 1.2-1.5c1-1 2.1-1.9 3.4-2.7 7.2-4.5 14.8-8.4 22.7-11.6 6.4-2.8 11.7-4.9 12.8-5.6 1.6-1 3.1-2.2 4.5-3.5 5.3-4.5 9-10.8 10.2-17.7.1-.9.2-1.8.3-2.8v-1.5c-.9-3.5-6.9-6.1-38.4-9.1-11.1-1.8-20-10.1-22.5-21.1v-.1c6-15.7 16.8-29.1 30.8-38.3.8-.7-3.2.2-2.4-.5 2.7-1.3 5.4-2.5 8.2-3.5 1.4-.6-6-3.4-12.6-2.7-4 .2-8 1.2-11.7 2.8 1.6-1.3 6.2-3.1 5.1-3.1-8.4 1.6-16.5 4.7-23.9 9 0-.8.1-1.5.5-2.2-5.9 2.5-11 6.5-15 11.5.1-.9.2-1.8.2-2.7-2.7 2-5.2 4.3-7.3 6.9l-.1.1c-17.4-6.7-36.3-8.3-54.6-4.7l-.2-.1h.2c-3.8-3.1-7.1-6.7-9.7-10.9l-.2.1-.4-.2c-1.2-1.8-2.4-3.8-3.7-6-.9-1.6-1.8-3.4-2.7-5.2 0-.1-.1-.2-.2-.2-.4 0-.6 1.7-.9 1.3v-.1c-3.2-8.3-4.7-17.2-4.4-26.2l-.2.1c-5.1 3.5-9 8.6-11.1 14.5-.9 2.1-1.6 3.3-2.2 4.5v-.5c.1-1.1.6-3.3.5-3.1s-.2.3-.3.4c-1.5 1.7-2.9 3.7-3.9 5.8-.9 1.9-1.7 3.9-2.3 5.9-.1.3 0-.3 0-1s.1-2 0-1.7l-.3.7c-6.7 14.9-10.9 30.8-12.4 47.1-.4 2.8-.6 5.6-.5 8.3v.2c-4.8 5.2-9 11-12.7 17.1-12.1 20.4-21.1 42.5-26.8 65.6 4-8.8 8.8-17.2 14.3-25.1C5.5 228.5 0 257.4 0 286.6c1.8-8.6 4.2-17 7-25.3-1.7 34.5 4.9 68.9 19.4 100.3 19.4 43.5 51.6 80 92.3 104.7 16.6 11.2 34.7 19.9 53.8 25.8 2.5.9 5.1 1.8 7.7 2.7-.8-.3-1.6-.7-2.4-1 22.6 6.8 46.2 10.3 69.8 10.3 83.7 0 111.3-31.9 113.8-35 4.1-3.7 7.5-8.2 9.9-13.3 1.6-.7 3.2-1.4 4.9-2.1l1-.5 1.9-.9c12.6-5.9 24.5-13.4 35.3-22.1 16.3-11.7 27.9-28.7 32.9-48.1 3-7.1 3.1-15 .4-22.2.9-1.4 1.7-2.8 2.7-4.3 18-28.9 28.2-61.9 29.6-95.9v-2.8c0-7.3-.6-14.5-1.9-21.6zm-299-97.6c-.4 1.1-.9 2.3-1.3 3.5.4-1.2.8-2.3 1.3-3.5z"],
"first-order": [448, 512, [], "f2b0", "M12.9 229.2c.1-.1.2-.3.3-.4 0 .1 0 .3-.1.4h-.2zM224 96.6c-7.1 0-14.6.6-21.4 1.7l3.7 67.4-22-64c-14.3 3.7-27.7 9.4-40 16.6l29.4 61.4-45.1-50.9c-11.4 8.9-21.7 19.1-30.6 30.9l50.6 45.4-61.1-29.7c-7.1 12.3-12.9 25.7-16.6 40l64.3 22.6-68-4c-.9 7.1-1.4 14.6-1.4 22s.6 14.6 1.4 21.7l67.7-4-64 22.6c3.7 14.3 9.4 27.7 16.6 40.3l61.1-29.7L97.7 352c8.9 11.7 19.1 22.3 30.9 30.9l44.9-50.9-29.5 61.4c12.3 7.4 25.7 13.1 40 16.9l22.3-64.6-4 68c7.1 1.1 14.6 1.7 21.7 1.7 7.4 0 14.6-.6 21.7-1.7l-4-68.6 22.6 65.1c14.3-4 27.7-9.4 40-16.9L274.9 332l44.9 50.9c11.7-8.9 22-19.1 30.6-30.9l-50.6-45.1 61.1 29.4c7.1-12.3 12.9-25.7 16.6-40.3l-64-22.3 67.4 4c1.1-7.1 1.4-14.3 1.4-21.7s-.3-14.9-1.4-22l-67.7 4 64-22.3c-3.7-14.3-9.1-28-16.6-40.3l-60.9 29.7 50.6-45.4c-8.9-11.7-19.1-22-30.6-30.9l-45.1 50.9 29.4-61.1c-12.3-7.4-25.7-13.1-40-16.9L241.7 166l4-67.7c-7.1-1.2-14.3-1.7-21.7-1.7zM443.4 128v256L224 512 4.6 384V128L224 0l219.4 128zm-17.1 10.3L224 20.9 21.7 138.3v235.1L224 491.1l202.3-117.7V138.3zM224 37.1l187.7 109.4v218.9L224 474.9 36.3 365.4V146.6L224 37.1zm0 50.9c-92.3 0-166.9 75.1-166.9 168 0 92.6 74.6 167.7 166.9 167.7 92 0 166.9-75.1 166.9-167.7 0-92.9-74.9-168-166.9-168z"],
"first-order-alt": [496, 512, [], "f50a", "M248 8C111.03 8 0 119.03 0 256s111.03 248 248 248 248-111.03 248-248S384.97 8 248 8zm0 488.21C115.34 496.21 7.79 388.66 7.79 256S115.34 15.79 248 15.79 488.21 123.34 488.21 256 380.66 496.21 248 496.21zm0-459.92C126.66 36.29 28.29 134.66 28.29 256S126.66 475.71 248 475.71 467.71 377.34 467.71 256 369.34 36.29 248 36.29zm0 431.22c-116.81 0-211.51-94.69-211.51-211.51S131.19 44.49 248 44.49 459.51 139.19 459.51 256 364.81 467.51 248 467.51zm186.23-162.98a191.613 191.613 0 0 1-20.13 48.69l-74.13-35.88 61.48 54.82a193.515 193.515 0 0 1-37.2 37.29l-54.8-61.57 35.88 74.27a190.944 190.944 0 0 1-48.63 20.23l-27.29-78.47 4.79 82.93c-8.61 1.18-17.4 1.8-26.33 1.8s-17.72-.62-26.33-1.8l4.76-82.46-27.15 78.03a191.365 191.365 0 0 1-48.65-20.2l35.93-74.34-54.87 61.64a193.85 193.85 0 0 1-37.22-37.28l61.59-54.9-74.26 35.93a191.638 191.638 0 0 1-20.14-48.69l77.84-27.11-82.23 4.76c-1.16-8.57-1.78-17.32-1.78-26.21 0-9 .63-17.84 1.82-26.51l82.38 4.77-77.94-27.16a191.726 191.726 0 0 1 20.23-48.67l74.22 35.92-61.52-54.86a193.85 193.85 0 0 1 37.28-37.22l54.76 61.53-35.83-74.17a191.49 191.49 0 0 1 48.65-20.13l26.87 77.25-4.71-81.61c8.61-1.18 17.39-1.8 26.32-1.8s17.71.62 26.32 1.8l-4.74 82.16 27.05-77.76c17.27 4.5 33.6 11.35 48.63 20.17l-35.82 74.12 54.72-61.47a193.13 193.13 0 0 1 37.24 37.23l-61.45 54.77 74.12-35.86a191.515 191.515 0 0 1 20.2 48.65l-77.81 27.1 82.24-4.75c1.19 8.66 1.82 17.5 1.82 26.49 0 8.88-.61 17.63-1.78 26.19l-82.12-4.75 77.72 27.09z"],
"firstdraft": [384, 512, [], "f3a1", "M384 192h-64v128H192v128H0v-25.6h166.4v-128h128v-128H384V192zm-25.6 38.4v128h-128v128H64V512h192V384h128V230.4h-25.6zm25.6 192h-89.6V512H320v-64h64v-25.6zM0 0v384h128V256h128V128h128V0H0z"],
"flickr": [448, 512, [], "f16e", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM144.5 319c-35.1 0-63.5-28.4-63.5-63.5s28.4-63.5 63.5-63.5 63.5 28.4 63.5 63.5-28.4 63.5-63.5 63.5zm159 0c-35.1 0-63.5-28.4-63.5-63.5s28.4-63.5 63.5-63.5 63.5 28.4 63.5 63.5-28.4 63.5-63.5 63.5z"],
"flipboard": [448, 512, [], "f44d", "M0 32v448h448V32H0zm358.4 179.2h-89.6v89.6h-89.6v89.6H89.6V121.6h268.8v89.6z"],
"fly": [384, 512, [], "f417", "M197.8 427.8c12.9 11.7 33.7 33.3 33.2 50.7 0 .8-.1 1.6-.1 2.5-1.8 19.8-18.8 31.1-39.1 31-25-.1-39.9-16.8-38.7-35.8 1-16.2 20.5-36.7 32.4-47.6 2.3-2.1 2.7-2.7 5.6-3.6 3.4 0 3.9.3 6.7 2.8zM331.9 67.3c-16.3-25.7-38.6-40.6-63.3-52.1C243.1 4.5 214-.2 192 0c-44.1 0-71.2 13.2-81.1 17.3C57.3 45.2 26.5 87.2 28 158.6c7.1 82.2 97 176 155.8 233.8 1.7 1.6 4.5 4.5 6.2 5.1l3.3.1c2.1-.7 1.8-.5 3.5-2.1 52.3-49.2 140.7-145.8 155.9-215.7 7-39.2 3.1-72.5-20.8-112.5zM186.8 351.9c-28-51.1-65.2-130.7-69.3-189-3.4-47.5 11.4-131.2 69.3-136.7v325.7zM328.7 180c-16.4 56.8-77.3 128-118.9 170.3C237.6 298.4 275 217 277 158.4c1.6-45.9-9.8-105.8-48-131.4 88.8 18.3 115.5 98.1 99.7 153z"],
"font-awesome": [448, 512, [], "f2b4", "M397.8 32H50.2C22.7 32 0 54.7 0 82.2v347.6C0 457.3 22.7 480 50.2 480h347.6c27.5 0 50.2-22.7 50.2-50.2V82.2c0-27.5-22.7-50.2-50.2-50.2zm-45.4 284.3c0 4.2-3.6 6-7.8 7.8-16.7 7.2-34.6 13.7-53.8 13.7-26.9 0-39.4-16.7-71.7-16.7-23.3 0-47.8 8.4-67.5 17.3-1.2.6-2.4.6-3.6 1.2V385c0 1.8 0 3.6-.6 4.8v1.2c-2.4 8.4-10.2 14.3-19.1 14.3-11.3 0-20.3-9-20.3-20.3V166.4c-7.8-6-13.1-15.5-13.1-26.3 0-18.5 14.9-33.5 33.5-33.5 18.5 0 33.5 14.9 33.5 33.5 0 10.8-4.8 20.3-13.1 26.3v18.5c1.8-.6 3.6-1.2 5.4-2.4 18.5-7.8 40.6-14.3 61.5-14.3 22.7 0 40.6 6 60.9 13.7 4.2 1.8 8.4 2.4 13.1 2.4 22.7 0 47.8-16.1 53.8-16.1 4.8 0 9 3.6 9 7.8v140.3z"],
"font-awesome-alt": [448, 512, [], "f35c", "M339.3 171.2c-6 0-29.9 15.5-52.6 15.5-4.2 0-8.4-.6-12.5-2.4-19.7-7.8-37-13.7-59.1-13.7-20.3 0-41.8 6.6-59.7 13.7-1.8.6-3.6 1.2-4.8 1.8v-17.9c7.8-6 12.5-14.9 12.5-25.7 0-17.9-14.3-32.3-32.3-32.3s-32.3 14.3-32.3 32.3c0 10.2 4.8 19.7 12.5 25.7v212.1c0 10.8 9 19.7 19.7 19.7 9 0 16.1-6 18.5-13.7V385c.6-1.8.6-3 .6-4.8V336c1.2 0 2.4-.6 3-1.2 19.7-8.4 43-16.7 65.7-16.7 31.1 0 43 16.1 69.3 16.1 18.5 0 36.4-6.6 52-13.7 4.2-1.8 7.2-3.6 7.2-7.8V178.3c1.8-4.1-2.3-7.1-7.7-7.1zM397.8 32H50.2C22.7 32 0 54.7 0 82.2v347.6C0 457.3 22.7 480 50.2 480h347.6c27.5 0 50.2-22.7 50.2-50.2V82.2c0-27.5-22.7-50.2-50.2-50.2zm14.3 397.7c0 7.8-6.6 14.3-14.3 14.3H50.2c-7.8 0-14.3-6.6-14.3-14.3V82.2c0-7.8 6.6-14.3 14.3-14.3h347.6v-.1c7.8 0 14.3 6.6 14.3 14.3z"],
"font-awesome-flag": [448, 512, [], "f425", "M444.373 359.424c0 7.168-6.144 10.24-13.312 13.312-28.672 12.288-59.392 23.552-92.16 23.552-46.08 0-67.584-28.672-122.88-28.672-39.936 0-81.92 14.336-115.712 29.696-2.048 1.024-4.096 1.024-6.144 2.048v77.824c0 21.405-16.122 34.816-33.792 34.816-19.456 0-34.816-15.36-34.816-34.816V102.4C12.245 92.16 3.029 75.776 3.029 57.344 3.029 25.6 28.629 0 60.373 0s57.344 25.6 57.344 57.344c0 18.432-8.192 34.816-22.528 45.056v31.744c4.124-1.374 58.768-28.672 114.688-28.672 65.27 0 97.676 27.648 126.976 27.648 38.912 0 81.92-27.648 92.16-27.648 8.192 0 15.36 6.144 15.36 13.312v240.64z"],
"font-awesome-logo-full": [3992, 512, ["Font Awesome"], "f4e6", "M454.6 0H57.4C25.9 0 0 25.9 0 57.4v397.3C0 486.1 25.9 512 57.4 512h397.3c31.4 0 57.4-25.9 57.4-57.4V57.4C512 25.9 486.1 0 454.6 0zm-58.9 324.9c0 4.8-4.1 6.9-8.9 8.9-19.2 8.1-39.7 15.7-61.5 15.7-40.5 0-68.7-44.8-163.2 2.5v51.8c0 30.3-45.7 30.2-45.7 0v-250c-9-7-15-17.9-15-30.3 0-21 17.1-38.2 38.2-38.2 21 0 38.2 17.1 38.2 38.2 0 12.2-5.8 23.2-14.9 30.2v21c37.1-12 65.5-34.4 146.1-3.4 26.6 11.4 68.7-15.7 76.5-15.7 5.5 0 10.3 4.1 10.3 8.9v160.4zm432.9-174.2h-137v70.1H825c39.8 0 40.4 62.2 0 62.2H691.6v105.6c0 45.5-70.7 46.4-70.7 0V128.3c0-22 18-39.8 39.8-39.8h167.8c39.6 0 40.5 62.2.1 62.2zm191.1 23.4c-169.3 0-169.1 252.4 0 252.4 169.9 0 169.9-252.4 0-252.4zm0 196.1c-81.6 0-82.1-139.8 0-139.8 82.5 0 82.4 139.8 0 139.8zm372.4 53.4c-17.5 0-31.4-13.9-31.4-31.4v-117c0-62.4-72.6-52.5-99.1-16.4v133.4c0 41.5-63.3 41.8-63.3 0V208c0-40 63.1-41.6 63.1 0v3.4c43.3-51.6 162.4-60.4 162.4 39.3v141.5c.3 30.4-31.5 31.4-31.7 31.4zm179.7 2.9c-44.3 0-68.3-22.9-68.3-65.8V235.2H1488c-35.6 0-36.7-55.3 0-55.3h15.5v-37.3c0-41.3 63.8-42.1 63.8 0v37.5h24.9c35.4 0 35.7 55.3 0 55.3h-24.9v108.5c0 29.6 26.1 26.3 27.4 26.3 31.4 0 52.6 56.3-22.9 56.3zM1992 123c-19.5-50.2-95.5-50-114.5 0-107.3 275.7-99.5 252.7-99.5 262.8 0 42.8 58.3 51.2 72.1 14.4l13.5-35.9H2006l13 35.9c14.2 37.7 72.1 27.2 72.1-14.4 0-10.1 5.3 6.8-99.1-262.8zm-108.9 179.1l51.7-142.9 51.8 142.9h-103.5zm591.3-85.6l-53.7 176.3c-12.4 41.2-72 41-84 0l-42.3-135.9-42.3 135.9c-12.4 40.9-72 41.2-84.5 0l-54.2-176.3c-12.5-39.4 49.8-56.1 60.2-16.9L2213 342l45.3-139.5c10.9-32.7 59.6-34.7 71.2 0l45.3 139.5 39.3-142.4c10.3-38.3 72.6-23.8 60.3 16.9zm275.4 75.1c0-42.4-33.9-117.5-119.5-117.5-73.2 0-124.4 56.3-124.4 126 0 77.2 55.3 126.4 128.5 126.4 31.7 0 93-11.5 93-39.8 0-18.3-21.1-31.5-39.3-22.4-49.4 26.2-109 8.4-115.9-43.8h148.3c16.3 0 29.3-13.4 29.3-28.9zM2571 277.7c9.5-73.4 113.9-68.6 118.6 0H2571zm316.7 148.8c-31.4 0-81.6-10.5-96.6-31.9-12.4-17 2.5-39.8 21.8-39.8 16.3 0 36.8 22.9 77.7 22.9 27.4 0 40.4-11 40.4-25.8 0-39.8-142.9-7.4-142.9-102 0-40.4 35.3-75.7 98.6-75.7 31.4 0 74.1 9.9 87.6 29.4 10.8 14.8-1.4 36.2-20.9 36.2-15.1 0-26.7-17.3-66.2-17.3-22.9 0-37.8 10.5-37.8 23.8 0 35.9 142.4 6 142.4 103.1-.1 43.7-37.4 77.1-104.1 77.1zm266.8-252.4c-169.3 0-169.1 252.4 0 252.4 170.1 0 169.6-252.4 0-252.4zm0 196.1c-81.8 0-82-139.8 0-139.8 82.5 0 82.4 139.8 0 139.8zm476.9 22V268.7c0-53.8-61.4-45.8-85.7-10.5v134c0 41.3-63.8 42.1-63.8 0V268.7c0-52.1-59.5-47.4-85.7-10.1v133.6c0 41.5-63.3 41.8-63.3 0V208c0-40 63.1-41.6 63.1 0v3.4c9.9-14.4 41.8-37.3 78.6-37.3 35.3 0 57.7 16.4 66.7 43.8 13.9-21.8 45.8-43.8 82.6-43.8 44.3 0 70.7 23.4 70.7 72.7v145.3c.5 17.3-13.5 31.4-31.9 31.4 3.5.1-31.3 1.1-31.3-31.3zM3992 291.6c0-42.4-32.4-117.5-117.9-117.5-73.2 0-127.5 56.3-127.5 126 0 77.2 58.3 126.4 131.6 126.4 31.7 0 91.5-11.5 91.5-39.8 0-18.3-21.1-31.5-39.3-22.4-49.4 26.2-110.5 8.4-117.5-43.8h149.8c16.3 0 29.1-13.4 29.3-28.9zm-180.5-13.9c9.7-74.4 115.9-68.3 120.1 0h-120.1z"],
"fonticons": [448, 512, [], "f280", "M0 32v448h448V32zm187 140.9c-18.4 0-19 9.9-19 27.4v23.3c0 2.4-3.5 4.4-.6 4.4h67.4l-11.1 37.3H168v112.9c0 5.8-2 6.7 3.2 7.3l43.5 4.1v25.1H84V389l21.3-2c5.2-.6 6.7-2.3 6.7-7.9V267.7c0-2.3-2.9-2.3-5.8-2.3H84V228h28v-21c0-49.6 26.5-70 77.3-70 34.1 0 64.7 8.2 64.7 52.8l-50.7 6.1c.3-18.7-4.4-23-16.3-23zm74.3 241.8v-25.1l20.4-2.6c5.2-.6 7.6-1.7 7.6-7.3V271.8c0-4.1-2.9-6.7-6.7-7.9l-24.2-6.4 6.7-29.5h80.2v151.7c0 5.8-2.6 6.4 2.9 7.3l15.7 2.6v25.1zm80.8-255.5l9 33.2-7.3 7.3-31.2-16.6-31.2 16.6-7.3-7.3 9-33.2-21.8-24.2 3.5-9.6h27.7l15.5-28h9.3l15.5 28h27.7l3.5 9.6z"],
"fonticons-fi": [384, 512, [], "f3a2", "M114.4 224h92.4l-15.2 51.2h-76.4V433c0 8-2.8 9.2 4.4 10l59.6 5.6V483H0v-35.2l29.2-2.8c7.2-.8 9.2-3.2 9.2-10.8V278.4c0-3.2-4-3.2-8-3.2H0V224h38.4v-28.8c0-68 36.4-96 106-96 46.8 0 88.8 11.2 88.8 72.4l-69.6 8.4c.4-25.6-6-31.6-22.4-31.6-25.2 0-26 13.6-26 37.6v32c0 3.2-4.8 6-.8 6zM384 483H243.2v-34.4l28-3.6c7.2-.8 10.4-2.4 10.4-10V287c0-5.6-4-9.2-9.2-10.8l-33.2-8.8 9.2-40.4h110v208c0 8-3.6 8.8 4 10l21.6 3.6V483zm-30-347.2l12.4 45.6-10 10-42.8-22.8-42.8 22.8-10-10 12.4-45.6-30-36.4 4.8-10h38L307.2 51H320l21.2 38.4h38l4.8 13.2-30 33.2z"],
"fort-awesome": [512, 512, [], "f286", "M489.2 287.9h-27.4c-2.6 0-4.6 2-4.6 4.6v32h-36.6V146.2c0-2.6-2-4.6-4.6-4.6h-27.4c-2.6 0-4.6 2-4.6 4.6v32h-36.6v-32c0-2.6-2-4.6-4.6-4.6h-27.4c-2.6 0-4.6 2-4.6 4.6v32h-36.6v-32c0-6-8-4.6-11.7-4.6v-38c8.3-2 17.1-3.4 25.7-3.4 10.9 0 20.9 4.3 31.4 4.3 4.6 0 27.7-1.1 27.7-8v-60c0-2.6-2-4.6-4.6-4.6-5.1 0-15.1 4.3-24 4.3-9.7 0-20.9-4.3-32.6-4.3-8 0-16 1.1-23.7 2.9v-4.9c5.4-2.6 9.1-8.3 9.1-14.3 0-20.7-31.4-20.8-31.4 0 0 6 3.7 11.7 9.1 14.3v111.7c-3.7 0-11.7-1.4-11.7 4.6v32h-36.6v-32c0-2.6-2-4.6-4.6-4.6h-27.4c-2.6 0-4.6 2-4.6 4.6v32H128v-32c0-2.6-2-4.6-4.6-4.6H96c-2.6 0-4.6 2-4.6 4.6v178.3H54.8v-32c0-2.6-2-4.6-4.6-4.6H22.8c-2.6 0-4.6 2-4.6 4.6V512h182.9v-96c0-72.6 109.7-72.6 109.7 0v96h182.9V292.5c.1-2.6-1.9-4.6-4.5-4.6zm-288.1-4.5c0 2.6-2 4.6-4.6 4.6h-27.4c-2.6 0-4.6-2-4.6-4.6v-64c0-2.6 2-4.6 4.6-4.6h27.4c2.6 0 4.6 2 4.6 4.6v64zm146.4 0c0 2.6-2 4.6-4.6 4.6h-27.4c-2.6 0-4.6-2-4.6-4.6v-64c0-2.6 2-4.6 4.6-4.6h27.4c2.6 0 4.6 2 4.6 4.6v64z"],
"fort-awesome-alt": [512, 512, [], "f3a3", "M208 237.4h-22.2c-2.1 0-3.7 1.6-3.7 3.7v51.7c0 2.1 1.6 3.7 3.7 3.7H208c2.1 0 3.7-1.6 3.7-3.7v-51.7c0-2.1-1.6-3.7-3.7-3.7zm118.2 0H304c-2.1 0-3.7 1.6-3.7 3.7v51.7c0 2.1 1.6 3.7 3.7 3.7h22.2c2.1 0 3.7-1.6 3.7-3.7v-51.7c-.1-2.1-1.7-3.7-3.7-3.7zm132-125.1c-2.3-3.2-4.6-6.4-7.1-9.5-9.8-12.5-20.8-24-32.8-34.4-4.5-3.9-9.1-7.6-13.9-11.2-1.6-1.2-3.2-2.3-4.8-3.5C372 34.1 340.3 20 306 13c-16.2-3.3-32.9-5-50-5s-33.9 1.7-50 5c-34.3 7.1-66 21.2-93.3 40.8-1.6 1.1-3.2 2.3-4.8 3.5-4.8 3.6-9.4 7.3-13.9 11.2-3 2.6-5.9 5.3-8.8 8s-5.7 5.5-8.4 8.4c-5.5 5.7-10.7 11.8-15.6 18-2.4 3.1-4.8 6.3-7.1 9.5C25.2 153 8.3 202.5 8.3 256c0 2 .1 4 .1 6 .1.7.1 1.3.1 2 .1 1.3.1 2.7.2 4 0 .8.1 1.5.1 2.3 0 1.3.1 2.5.2 3.7.1.8.1 1.6.2 2.4.1 1.1.2 2.3.3 3.5 0 .8.1 1.6.2 2.4.1 1.2.3 2.4.4 3.6.1.8.2 1.5.3 2.3.1 1.3.3 2.6.5 3.9.1.6.2 1.3.3 1.9l.9 5.7c.1.6.2 1.1.3 1.7.3 1.3.5 2.7.8 4 .2.8.3 1.6.5 2.4.2 1 .5 2.1.7 3.2.2.9.4 1.7.6 2.6.2 1 .4 2 .7 3 .2.9.5 1.8.7 2.7.3 1 .5 1.9.8 2.9.3.9.5 1.8.8 2.7.2.9.5 1.9.8 2.8s.5 1.8.8 2.7c.3 1 .6 1.9.9 2.8.6 1.6 1.1 3.3 1.7 4.9.4 1 .7 1.9 1 2.8.3 1 .7 2 1.1 3 .3.8.6 1.5.9 2.3l1.2 3c.3.7.6 1.5.9 2.2.4 1 .9 2 1.3 3l.9 2.1c.5 1 .9 2 1.4 3 .3.7.6 1.3.9 2 .5 1 1 2.1 1.5 3.1.2.6.5 1.1.8 1.7.6 1.1 1.1 2.2 1.7 3.3.1.2.2.3.3.5 2.2 4.1 4.4 8.2 6.8 12.2.2.4.5.8.7 1.2.7 1.1 1.3 2.2 2 3.3.3.5.6.9.9 1.4.6 1.1 1.3 2.1 2 3.2.3.5.6.9.9 1.4.7 1.1 1.4 2.1 2.1 3.2.2.4.5.8.8 1.2.7 1.1 1.5 2.2 2.3 3.3.2.2.3.5.5.7 37.5 51.7 94.4 88.5 160 99.4.9.1 1.7.3 2.6.4 1 .2 2.1.4 3.1.5s1.9.3 2.8.4c1 .2 2 .3 3 .4.9.1 1.9.2 2.9.3s1.9.2 2.9.3 2.1.2 3.1.3c.9.1 1.8.1 2.7.2 1.1.1 2.3.1 3.4.2.8 0 1.7.1 2.5.1 1.3 0 2.6.1 3.9.1.7.1 1.4.1 2.1.1 2 .1 4 .1 6 .1s4-.1 6-.1c.7 0 1.4-.1 2.1-.1 1.3 0 2.6 0 3.9-.1.8 0 1.7-.1 2.5-.1 1.1-.1 2.3-.1 3.4-.2.9 0 1.8-.1 2.7-.2 1-.1 2.1-.2 3.1-.3s1.9-.2 2.9-.3c.9-.1 1.9-.2 2.9-.3s2-.3 3-.4 1.9-.3 2.8-.4c1-.2 2.1-.3 3.1-.5.9-.1 1.7-.3 2.6-.4 65.6-11 122.5-47.7 160.1-102.4.2-.2.3-.5.5-.7.8-1.1 1.5-2.2 2.3-3.3.2-.4.5-.8.8-1.2.7-1.1 1.4-2.1 2.1-3.2.3-.5.6-.9.9-1.4.6-1.1 1.3-2.1 2-3.2.3-.5.6-.9.9-1.4.7-1.1 1.3-2.2 2-3.3.2-.4.5-.8.7-1.2 2.4-4 4.6-8.1 6.8-12.2.1-.2.2-.3.3-.5.6-1.1 1.1-2.2 1.7-3.3.2-.6.5-1.1.8-1.7.5-1 1-2.1 1.5-3.1.3-.7.6-1.3.9-2 .5-1 1-2 1.4-3l.9-2.1c.5-1 .9-2 1.3-3 .3-.7.6-1.5.9-2.2l1.2-3c.3-.8.6-1.5.9-2.3.4-1 .7-2 1.1-3s.7-1.9 1-2.8c.6-1.6 1.2-3.3 1.7-4.9.3-1 .6-1.9.9-2.8s.5-1.8.8-2.7c.2-.9.5-1.9.8-2.8s.6-1.8.8-2.7c.3-1 .5-1.9.8-2.9.2-.9.5-1.8.7-2.7.2-1 .5-2 .7-3 .2-.9.4-1.7.6-2.6.2-1 .5-2.1.7-3.2.2-.8.3-1.6.5-2.4.3-1.3.6-2.7.8-4 .1-.6.2-1.1.3-1.7l.9-5.7c.1-.6.2-1.3.3-1.9.1-1.3.3-2.6.5-3.9.1-.8.2-1.5.3-2.3.1-1.2.3-2.4.4-3.6 0-.8.1-1.6.2-2.4.1-1.1.2-2.3.3-3.5.1-.8.1-1.6.2-2.4.1 1.7.1.5.2-.7 0-.8.1-1.5.1-2.3.1-1.3.2-2.7.2-4 .1-.7.1-1.3.1-2 .1-2 .1-4 .1-6 0-53.5-16.9-103-45.8-143.7zM448 371.5c-9.4 15.5-20.6 29.9-33.6 42.9-20.6 20.6-44.5 36.7-71.2 48-13.9 5.8-28.2 10.3-42.9 13.2v-75.8c0-58.6-88.6-58.6-88.6 0v75.8c-14.7-2.9-29-7.3-42.9-13.2-26.7-11.3-50.6-27.4-71.2-48-13-13-24.2-27.4-33.6-42.9v-71.3c0-2.1 1.6-3.7 3.7-3.7h22.1c2.1 0 3.7 1.6 3.7 3.7V326h29.6V182c0-2.1 1.6-3.7 3.7-3.7h22.1c2.1 0 3.7 1.6 3.7 3.7v25.9h29.5V182c0-2.1 1.6-3.7 3.7-3.7H208c2.1 0 3.7 1.6 3.7 3.7v25.9h29.5V182c0-4.8 6.5-3.7 9.5-3.7V88.1c-4.4-2-7.4-6.7-7.4-11.5 0-16.8 25.4-16.8 25.4 0 0 4.8-3 9.4-7.4 11.5V92c6.3-1.4 12.7-2.3 19.2-2.3 9.4 0 18.4 3.5 26.3 3.5 7.2 0 15.2-3.5 19.4-3.5 2.1 0 3.7 1.6 3.7 3.7v48.4c0 5.6-18.7 6.5-22.4 6.5-8.6 0-16.6-3.5-25.4-3.5-7 0-14.1 1.2-20.8 2.8v30.7c3 0 9.5-1.1 9.5 3.7v25.9h29.5V182c0-2.1 1.6-3.7 3.7-3.7h22.2c2.1 0 3.7 1.6 3.7 3.7v25.9h29.5V182c0-2.1 1.6-3.7 3.7-3.7h22.1c2.1 0 3.7 1.6 3.7 3.7v144h29.5v-25.8c0-2.1 1.6-3.7 3.7-3.7h22.2c2.1 0 3.7 1.6 3.7 3.7z"],
"forumbee": [448, 512, [], "f211", "M5.8 309.7C2 292.7 0 275.5 0 258.3 0 135 99.8 35 223.1 35c16.6 0 33.3 2 49.3 5.5C149 87.5 51.9 186 5.8 309.7zm392.9-189.2C385 103 369 87.8 350.9 75.2c-149.6 44.3-266.3 162.1-309.7 312 12.5 18.1 28 35.6 45.2 49 43.1-151.3 161.2-271.7 312.3-315.7zm15.8 252.7c15.2-25.1 25.4-53.7 29.5-82.8-79.4 42.9-145 110.6-187.6 190.3 30-4.4 58.9-15.3 84.6-31.3 35 13.1 70.9 24.3 107 33.6-9.3-36.5-20.4-74.5-33.5-109.8zm29.7-145.5c-2.6-19.5-7.9-38.7-15.8-56.8C290.5 216.7 182 327.5 137.1 466c18.1 7.6 37 12.5 56.6 15.2C240 367.1 330.5 274.4 444.2 227.7z"],
"foursquare": [368, 512, [], "f180", "M323.1 3H49.9C12.4 3 0 31.3 0 49.1v433.8c0 20.3 12.1 27.7 18.2 30.1 6.2 2.5 22.8 4.6 32.9-7.1C180 356.5 182.2 354 182.2 354c3.1-3.4 3.4-3.1 6.8-3.1h83.4c35.1 0 40.6-25.2 44.3-39.7l48.6-243C373.8 25.8 363.1 3 323.1 3zm-16.3 73.8l-11.4 59.7c-1.2 6.5-9.5 13.2-16.9 13.2H172.1c-12 0-20.6 8.3-20.6 20.3v13c0 12 8.6 20.6 20.6 20.6h90.4c8.3 0 16.6 9.2 14.8 18.2-1.8 8.9-10.5 53.8-11.4 58.8-.9 4.9-6.8 13.5-16.9 13.5h-73.5c-13.5 0-17.2 1.8-26.5 12.6 0 0-8.9 11.4-89.5 108.3-.9.9-1.8.6-1.8-.3V75.9c0-7.7 6.8-16.6 16.6-16.6h219c8.2 0 15.6 7.7 13.5 17.5z"],
"free-code-camp": [576, 512, [], "f2c5", "M69.3 144.5c-41 68.5-36.4 163 1 227C92.5 409.7 120 423.9 120 438c0 6.8-6 13-12.8 13C87.7 451 8 375.5 8 253.2c0-111.5 78-186 97.1-186 6 0 14.9 4.8 14.9 11.1 0 12.7-28.3 28.6-50.7 66.2zm195.8 213.8c4.5 1.8 12.3 5.2 12.3-1.2 0-2.7-2.2-2.9-4.3-3.6-8.5-3.4-14-7.7-19.1-15.2-8.2-12.1-10.1-24.2-10.1-38.6 0-32.1 44.2-37.9 44.2-70 0-12.3-7.7-15.9-7.7-19.3 0-2.2.7-2.2 2.9-2.2 8 0 19.1 13.3 22.5 19.8 2.2 4.6 2.4 6 2.4 11.1 0 7-.7 14.2-.7 21.3 0 27 31.9 19.8 31.9 6.8 0-6-3.6-11.6-3.6-17.4 0-.7 0-1.2.7-1.2 3.4 0 9.4 7.7 11.1 10.1 5.8 8.9 8.5 20.8 8.5 31.4 0 32.4-29.5 49-29.5 56 0 1 2.9 7.7 12.1 1.9 29.7-15.1 53.1-47.6 53.1-89.8 0-33.6-8.7-57.7-32.1-82.6-3.9-4.1-16.4-16.9-22.5-16.9-8.2 0 7.2 18.6 7.2 31.2 0 7.2-4.8 12.3-12.3 12.3-11.6 0-14.5-25.4-15.9-33.3-5.8-33.8-12.8-58.2-46.4-74.1-10.4-5-36.5-11.8-36.5-2.2 0 2.4 2.7 4.1 4.6 5.1 9.2 5.6 19.6 21.4 19.6 38.2 0 46.1-57.7 88.2-57.7 136.2-.2 40.3 28.1 72.6 65.3 86.2zM470.4 67c-6 0-14.4 6.5-14.4 12.6 0 8.7 12.1 19.6 17.6 25.4 81.6 85.1 78.6 214.3 17.6 291-7 8.9-35.3 35.3-35.3 43.5 0 5.1 8.2 11.4 13.2 11.4 25.4 0 98.8-80.8 98.8-185.7C568 145.9 491.8 67 470.4 67zm-42.3 323.1H167c-9.4 0-15.5 7.5-15.5 16.4 0 8.5 7 15.5 15.5 15.5h261.1c9.4 0 11.9-7.5 11.9-16.4 0-8.5-3.5-15.5-11.9-15.5z"],
"freebsd": [448, 512, [], "f3a4", "M303.7 96.2c11.1-11.1 115.5-77 139.2-53.2 23.7 23.7-42.1 128.1-53.2 139.2-11.1 11.1-39.4.9-63.1-22.9-23.8-23.7-34.1-52-22.9-63.1zM109.9 68.1C73.6 47.5 22 24.6 5.6 41.1c-16.6 16.6 7.1 69.4 27.9 105.7 18.5-32.2 44.8-59.3 76.4-78.7zM406.7 174c3.3 11.3 2.7 20.7-2.7 26.1-20.3 20.3-87.5-27-109.3-70.1-18-32.3-11.1-53.4 14.9-48.7 5.7-3.6 12.3-7.6 19.6-11.6-29.8-15.5-63.6-24.3-99.5-24.3-119.1 0-215.6 96.5-215.6 215.6 0 119 96.5 215.6 215.6 215.6S445.3 380.1 445.3 261c0-38.4-10.1-74.5-27.7-105.8-3.9 7-7.6 13.3-10.9 18.8z"],
"fulcrum": [320, 512, [], "f50b", "M95.75 164.14l-35.38 43.55L25 164.14l35.38-43.55zM144.23 0l-20.54 198.18L72.72 256l51 57.82L144.23 512V300.89L103.15 256l41.08-44.89zm79.67 164.14l35.38 43.55 35.38-43.55-35.38-43.55zm-48.48 47L216.5 256l-41.08 44.89V512L196 313.82 247 256l-51-57.82L175.42 0z"],
"galactic-republic": [496, 512, [], "f50c", "M248 504C111.25 504 0 392.75 0 256S111.25 8 248 8s248 111.25 248 248-111.25 248-248 248zm0-479.47C120.37 24.53 16.53 128.37 16.53 256S120.37 487.47 248 487.47 479.47 383.63 479.47 256 375.63 24.53 248 24.53zm27.62 21.81v24.62a185.933 185.933 0 0 1 83.57 34.54l17.39-17.36c-28.75-22.06-63.3-36.89-100.96-41.8zm-55.37.07c-37.64 4.94-72.16 19.8-100.88 41.85l17.28 17.36h.08c24.07-17.84 52.55-30.06 83.52-34.67V46.41zm12.25 50.17v82.87c-10.04 2.03-19.42 5.94-27.67 11.42l-58.62-58.59-21.93 21.93 58.67 58.67c-5.47 8.23-9.45 17.59-11.47 27.62h-82.9v31h82.9c2.02 10.02 6.01 19.31 11.47 27.54l-58.67 58.69 21.93 21.93 58.62-58.62a77.873 77.873 0 0 0 27.67 11.47v82.9h31v-82.9c10.05-2.03 19.37-6.06 27.62-11.55l58.67 58.69 21.93-21.93-58.67-58.69c5.46-8.23 9.47-17.52 11.5-27.54h82.87v-31h-82.87c-2.02-10.02-6.03-19.38-11.5-27.62l58.67-58.67-21.93-21.93-58.67 58.67c-8.25-5.49-17.57-9.47-27.62-11.5V96.58h-31zm183.24 30.72l-17.36 17.36a186.337 186.337 0 0 1 34.67 83.67h24.62c-4.95-37.69-19.83-72.29-41.93-101.03zm-335.55.13c-22.06 28.72-36.91 63.26-41.85 100.91h24.65c4.6-30.96 16.76-59.45 34.59-83.52l-17.39-17.39zM38.34 283.67c4.92 37.64 19.75 72.18 41.8 100.9l17.36-17.39c-17.81-24.07-29.92-52.57-34.51-83.52H38.34zm394.7 0c-4.61 30.99-16.8 59.5-34.67 83.6l17.36 17.36c22.08-28.74 36.98-63.29 41.93-100.96h-24.62zM136.66 406.38l-17.36 17.36c28.73 22.09 63.3 36.98 100.96 41.93v-24.64c-30.99-4.63-59.53-16.79-83.6-34.65zm222.53.05c-24.09 17.84-52.58 30.08-83.57 34.67v24.57c37.67-4.92 72.21-19.79 100.96-41.85l-17.31-17.39h-.08z"],
"galactic-senate": [512, 512, [], "f50d", "M249.86 33.48v26.07C236.28 80.17 226 168.14 225.39 274.9c11.74-15.62 19.13-33.33 19.13-48.24v-16.88c-.03-5.32.75-10.53 2.19-15.65.65-2.14 1.39-4.08 2.62-5.82 1.23-1.75 3.43-3.79 6.68-3.79 3.24 0 5.45 2.05 6.68 3.79 1.23 1.75 1.97 3.68 2.62 5.82 1.44 5.12 2.22 10.33 2.19 15.65v16.88c0 14.91 7.39 32.62 19.13 48.24-.63-106.76-10.91-194.73-24.49-215.35V33.48h-12.28zm-26.34 147.77c-9.52 2.15-18.7 5.19-27.46 9.08 8.9 16.12 9.76 32.64 1.71 37.29-8 4.62-21.85-4.23-31.36-19.82-11.58 8.79-21.88 19.32-30.56 31.09 14.73 9.62 22.89 22.92 18.32 30.66-4.54 7.7-20.03 7.14-35.47-.96-5.78 13.25-9.75 27.51-11.65 42.42 9.68.18 18.67 2.38 26.18 6.04 17.78-.3 32.77-1.96 40.49-4.22 5.55-26.35 23.02-48.23 46.32-59.51.73-25.55 1.88-49.67 3.48-72.07zm64.96 0c1.59 22.4 2.75 46.52 3.47 72.07 23.29 11.28 40.77 33.16 46.32 59.51 7.72 2.26 22.71 3.92 40.49 4.22 7.51-3.66 16.5-5.85 26.18-6.04-1.9-14.91-5.86-29.17-11.65-42.42-15.44 8.1-30.93 8.66-35.47.96-4.57-7.74 3.6-21.05 18.32-30.66-8.68-11.77-18.98-22.3-30.56-31.09-9.51 15.59-23.36 24.44-31.36 19.82-8.05-4.65-7.19-21.16 1.71-37.29a147.49 147.49 0 0 0-27.45-9.08zm-32.48 8.6c-3.23 0-5.86 8.81-6.09 19.93h-.05v16.88c0 41.42-49.01 95.04-93.49 95.04-52 0-122.75-1.45-156.37 29.17v2.51c9.42 17.12 20.58 33.17 33.18 47.97C45.7 380.26 84.77 360.4 141.2 360c45.68 1.02 79.03 20.33 90.76 40.87.01.01-.01.04 0 .05 7.67 2.14 15.85 3.23 24.04 3.21 8.19.02 16.37-1.07 24.04-3.21.01-.01-.01-.04 0-.05 11.74-20.54 45.08-39.85 90.76-40.87 56.43.39 95.49 20.26 108.02 41.35 12.6-14.8 23.76-30.86 33.18-47.97v-2.51c-33.61-30.62-104.37-29.17-156.37-29.17-44.48 0-93.49-53.62-93.49-95.04v-16.88h-.05c-.23-11.12-2.86-19.93-6.09-19.93zm0 96.59c22.42 0 40.6 18.18 40.6 40.6s-18.18 40.65-40.6 40.65-40.6-18.23-40.6-40.65c0-22.42 18.18-40.6 40.6-40.6zm0 7.64c-18.19 0-32.96 14.77-32.96 32.96S237.81 360 256 360s32.96-14.77 32.96-32.96-14.77-32.96-32.96-32.96zm0 6.14c14.81 0 26.82 12.01 26.82 26.82s-12.01 26.82-26.82 26.82-26.82-12.01-26.82-26.82 12.01-26.82 26.82-26.82zm-114.8 66.67c-10.19.07-21.6.36-30.5 1.66.43 4.42 1.51 18.63 7.11 29.76 9.11-2.56 18.36-3.9 27.62-3.9 41.28.94 71.48 34.35 78.26 74.47l.11 4.7c10.4 1.91 21.19 2.94 32.21 2.94 11.03 0 21.81-1.02 32.21-2.94l.11-4.7c6.78-40.12 36.98-73.53 78.26-74.47 9.26 0 18.51 1.34 27.62 3.9 5.6-11.13 6.68-25.34 7.11-29.76-8.9-1.3-20.32-1.58-30.5-1.66-18.76.42-35.19 4.17-48.61 9.67-12.54 16.03-29.16 30.03-49.58 33.07-.09.02-.17.04-.27.05-.05.01-.11.04-.16.05-5.24 1.07-10.63 1.6-16.19 1.6-5.55 0-10.95-.53-16.19-1.6-.05-.01-.11-.04-.16-.05-.1-.02-.17-.04-.27-.05-20.42-3.03-37.03-17.04-49.58-33.07-13.42-5.49-29.86-9.25-48.61-9.67z"],
"get-pocket": [448, 512, [], "f265", "M407.6 64h-367C18.5 64 0 82.5 0 104.6v135.2C0 364.5 99.7 464 224.2 464c124 0 223.8-99.5 223.8-224.2V104.6c0-22.4-17.7-40.6-40.4-40.6zm-162 268.5c-12.4 11.8-31.4 11.1-42.4 0C89.5 223.6 88.3 227.4 88.3 209.3c0-16.9 13.8-30.7 30.7-30.7 17 0 16.1 3.8 105.2 89.3 90.6-86.9 88.6-89.3 105.5-89.3 16.9 0 30.7 13.8 30.7 30.7 0 17.8-2.9 15.7-114.8 123.2z"],
"gg": [512, 512, [], "f260", "M179.2 230.4l102.4 102.4-102.4 102.4L0 256 179.2 76.8l44.8 44.8-25.6 25.6-19.2-19.2-128 128 128 128 51.5-51.5-77.1-76.5 25.6-25.6zM332.8 76.8L230.4 179.2l102.4 102.4 25.6-25.6-77.1-76.5 51.5-51.5 128 128-128 128-19.2-19.2-25.6 25.6 44.8 44.8L512 256 332.8 76.8z"],
"gg-circle": [512, 512, [], "f261", "M257 8C120 8 9 119 9 256s111 248 248 248 248-111 248-248S394 8 257 8zm-49.5 374.8L81.8 257.1l125.7-125.7 35.2 35.4-24.2 24.2-11.1-11.1-77.2 77.2 77.2 77.2 26.6-26.6-53.1-52.9 24.4-24.4 77.2 77.2-75 75.2zm99-2.2l-35.2-35.2 24.1-24.4 11.1 11.1 77.2-77.2-77.2-77.2-26.5 26.5 53.1 52.9-24.4 24.4-77.2-77.2 75-75L432.2 255 306.5 380.6z"],
"git": [448, 512, [], "f1d3", "M18.8 221.7c0 25.3 16.2 60 41.5 68.5v1c-18.8 8.3-24 50.6 1 65.8v1C34 367 16 384.3 16 414.2c0 51.5 48.8 65.8 91.5 65.8 52 0 90.7-18.7 90.7-76 0-70.5-101-44.5-101-82.8 0-13.5 7.2-18.7 19.7-21.3 41.5-7.7 67.5-40 67.5-82.2 0-7.3-1.5-14.2-4-21 6.7-1.5 13.2-3.3 19.7-5.5v-50.5c-17.2 6.8-35.7 11.8-54.5 11.8-53.8-31-126.8 1.3-126.8 69.2zm87.7 163.8c17 0 41.2 3 41.2 25 0 21.8-19.5 26.3-37.7 26.3-17.3 0-43.3-2.7-43.3-25.2.1-22.3 22.1-26.1 39.8-26.1zM103.3 256c-22 0-31.3-13-31.3-33.8 0-49.3 61-48.8 61-.5 0 20.3-8 34.3-29.7 34.3zM432 305.5v49c-13.3 7.3-30.5 9.8-45.5 9.8-53.5 0-59.8-42.2-59.8-85.7v-87.7h.5v-1c-7 0-7.3-1.6-24 1v-47.5h24c0-22.3.3-31-1.5-41.2h56.7c-2 13.8-1.5 27.5-1.5 41.2h51v47.5s-19.3-1-51-1V281c0 14.8 3.3 32.8 21.8 32.8 9.8 0 21.3-2.8 29.3-8.3zM286 68.7c0 18.7-14.5 36.2-33.8 36.2-19.8 0-34.5-17.2-34.5-36.2 0-19.3 14.5-36.7 34.5-36.7C272 32 286 50 286 68.7zm-6.2 74.5c-1.8 14.6-1.6 199.8 0 217.8h-55.5c1.6-18.1 1.8-203 0-217.8h55.5z"],
"git-square": [448, 512, [], "f1d2", "M140.1 348.5c12.1 0 29.5 2.1 29.5 17.9 0 15.5-13.9 18.8-27 18.8-12.3 0-30.9-2-30.9-18s15.7-18.7 28.4-18.7zm-24.7-116.6c0 14.8 6.6 24.1 22.3 24.1 15.5 0 21.2-10 21.2-24.5.1-34.4-43.5-34.8-43.5.4zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-241 93.7c-12.3 4.8-25.5 8.4-38.9 8.4-38.5-22.1-90.7.9-90.7 49.5 0 18 11.6 42.9 29.6 48.9v.7c-13.4 5.9-17.1 36.1.7 47v.7c-19.5 6.4-32.3 18.8-32.3 40.2 0 36.8 34.8 47 65.4 47 37.1 0 64.8-13.4 64.8-54.3 0-50.4-72.1-31.8-72.1-59.1 0-9.6 5.2-13.4 14.1-15.2 29.6-5.5 48.2-28.6 48.2-58.7 0-5.2-1.1-10.2-2.9-15 4.8-1.1 9.5-2.3 14.1-3.9v-36.2zm56.8 1.8h-39.6c1.3 10.6 1.1 142.6 0 155.5h39.6c-1.1-12.8-1.2-145.1 0-155.5zm4.5-53.3c0-13.4-10-26.2-24.1-26.2-14.3 0-24.6 12.5-24.6 26.2 0 13.6 10.5 25.9 24.6 25.9 13.7 0 24.1-12.5 24.1-25.9zm104.3 53.3h-36.4c0-9.8-.4-19.6 1.1-29.5h-40.5c1.3 7.3 1.1 13.6 1.1 29.5h-17.1v33.9c11.9-1.9 12.1-.7 17.1-.7v.7h-.4v62.7c0 31.1 4.5 61.2 42.7 61.2 10.7 0 23-1.8 32.5-7v-35c-5.7 3.9-13.9 5.9-20.9 5.9-13.2 0-15.5-12.9-15.5-23.4v-65.2c22.7 0 36.4.7 36.4.7v-33.8z"],
"github": [496, 512, [], "f09b", "M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"],
"github-alt": [480, 512, [], "f113", "M186.1 328.7c0 20.9-10.9 55.1-36.7 55.1s-36.7-34.2-36.7-55.1 10.9-55.1 36.7-55.1 36.7 34.2 36.7 55.1zM480 278.2c0 31.9-3.2 65.7-17.5 95-37.9 76.6-142.1 74.8-216.7 74.8-75.8 0-186.2 2.7-225.6-74.8-14.6-29-20.2-63.1-20.2-95 0-41.9 13.9-81.5 41.5-113.6-5.2-15.8-7.7-32.4-7.7-48.8 0-21.5 4.9-32.3 14.6-51.8 45.3 0 74.3 9 108.8 36 29-6.9 58.8-10 88.7-10 27 0 54.2 2.9 80.4 9.2 34-26.7 63-35.2 107.8-35.2 9.8 19.5 14.6 30.3 14.6 51.8 0 16.4-2.6 32.7-7.7 48.2 27.5 32.4 39 72.3 39 114.2zm-64.3 50.5c0-43.9-26.7-82.6-73.5-82.6-18.9 0-37 3.4-56 6-14.9 2.3-29.8 3.2-45.1 3.2-15.2 0-30.1-.9-45.1-3.2-18.7-2.6-37-6-56-6-46.8 0-73.5 38.7-73.5 82.6 0 87.8 80.4 101.3 150.4 101.3h48.2c70.3 0 150.6-13.4 150.6-101.3zm-82.6-55.1c-25.8 0-36.7 34.2-36.7 55.1s10.9 55.1 36.7 55.1 36.7-34.2 36.7-55.1-10.9-55.1-36.7-55.1z"],
"github-square": [448, 512, [], "f092", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM277.3 415.7c-8.4 1.5-11.5-3.7-11.5-8 0-5.4.2-33 .2-55.3 0-15.6-5.2-25.5-11.3-30.7 37-4.1 76-9.2 76-73.1 0-18.2-6.5-27.3-17.1-39 1.7-4.3 7.4-22-1.7-45-13.9-4.3-45.7 17.9-45.7 17.9-13.2-3.7-27.5-5.6-41.6-5.6-14.1 0-28.4 1.9-41.6 5.6 0 0-31.8-22.2-45.7-17.9-9.1 22.9-3.5 40.6-1.7 45-10.6 11.7-15.6 20.8-15.6 39 0 63.6 37.3 69 74.3 73.1-4.8 4.3-9.1 11.7-10.6 22.3-9.5 4.3-33.8 11.7-48.3-13.9-9.1-15.8-25.5-17.1-25.5-17.1-16.2-.2-1.1 10.2-1.1 10.2 10.8 5 18.4 24.2 18.4 24.2 9.7 29.7 56.1 19.7 56.1 19.7 0 13.9.2 36.5.2 40.6 0 4.3-3 9.5-11.5 8-66-22.1-112.2-84.9-112.2-158.3 0-91.8 70.2-161.5 162-161.5S388 165.6 388 257.4c.1 73.4-44.7 136.3-110.7 158.3zm-98.1-61.1c-1.9.4-3.7-.4-3.9-1.7-.2-1.5 1.1-2.8 3-3.2 1.9-.2 3.7.6 3.9 1.9.3 1.3-1 2.6-3 3zm-9.5-.9c0 1.3-1.5 2.4-3.5 2.4-2.2.2-3.7-.9-3.7-2.4 0-1.3 1.5-2.4 3.5-2.4 1.9-.2 3.7.9 3.7 2.4zm-13.7-1.1c-.4 1.3-2.4 1.9-4.1 1.3-1.9-.4-3.2-1.9-2.8-3.2.4-1.3 2.4-1.9 4.1-1.5 2 .6 3.3 2.1 2.8 3.4zm-12.3-5.4c-.9 1.1-2.8.9-4.3-.6-1.5-1.3-1.9-3.2-.9-4.1.9-1.1 2.8-.9 4.3.6 1.3 1.3 1.8 3.3.9 4.1zm-9.1-9.1c-.9.6-2.6 0-3.7-1.5s-1.1-3.2 0-3.9c1.1-.9 2.8-.2 3.7 1.3 1.1 1.5 1.1 3.3 0 4.1zm-6.5-9.7c-.9.9-2.4.4-3.5-.6-1.1-1.3-1.3-2.8-.4-3.5.9-.9 2.4-.4 3.5.6 1.1 1.3 1.3 2.8.4 3.5zm-6.7-7.4c-.4.9-1.7 1.1-2.8.4-1.3-.6-1.9-1.7-1.5-2.6.4-.6 1.5-.9 2.8-.4 1.3.7 1.9 1.8 1.5 2.6z"],
"gitkraken": [592, 512, [], "f3a6", "M565.7 118.1c-2.3-6.1-9.3-9.2-15.3-6.6-5.7 2.4-8.5 8.9-6.3 14.6 10.9 29 16.9 60.5 16.9 93.3 0 134.6-100.3 245.7-230.2 262.7V358.4c7.9-1.5 15.5-3.6 23-6.2v104c106.7-25.9 185.9-122.1 185.9-236.8 0-91.8-50.8-171.8-125.8-213.3-5.7-3.2-13-.9-15.9 5-2.7 5.5-.6 12.2 4.7 15.1 67.9 37.6 113.9 110 113.9 193.2 0 93.3-57.9 173.1-139.8 205.4v-92.2c14.2-4.5 24.9-17.7 24.9-33.5 0-13.1-6.8-24.4-17.3-30.5 8.3-79.5 44.5-58.6 44.5-83.9V170c0-38-87.9-161.8-129-164.7-2.5-.2-5-.2-7.6 0C251.1 8.3 163.2 132 163.2 170v14.8c0 25.3 36.3 4.3 44.5 83.9-10.6 6.1-17.3 17.4-17.3 30.5 0 15.8 10.6 29 24.8 33.5v92.2c-81.9-32.2-139.8-112-139.8-205.4 0-83.1 46-155.5 113.9-193.2 5.4-3 7.4-9.6 4.7-15.1-2.9-5.9-10.1-8.2-15.9-5-75 41.5-125.8 121.5-125.8 213.3 0 114.7 79.2 210.8 185.9 236.8v-104c7.6 2.5 15.1 4.6 23 6.2v123.7C131.4 465.2 31 354.1 31 219.5c0-32.8 6-64.3 16.9-93.3 2.2-5.8-.6-12.2-6.3-14.6-6-2.6-13 .4-15.3 6.6C14.5 149.7 8 183.8 8 219.5c0 155.1 122.6 281.6 276.3 287.8V361.4c6.8.4 15 .5 23.4 0v145.8C461.4 501.1 584 374.6 584 219.5c0-35.7-6.5-69.8-18.3-101.4zM365.9 275.5c13 0 23.7 10.5 23.7 23.7 0 13.1-10.6 23.7-23.7 23.7-13 0-23.7-10.5-23.7-23.7 0-13.1 10.6-23.7 23.7-23.7zm-139.8 47.3c-13.2 0-23.7-10.7-23.7-23.7s10.5-23.7 23.7-23.7c13.1 0 23.7 10.6 23.7 23.7 0 13-10.5 23.7-23.7 23.7z"],
"gitlab": [512, 512, [], "f296", "M105.2 24.9c-3.1-8.9-15.7-8.9-18.9 0L29.8 199.7h132c-.1 0-56.6-174.8-56.6-174.8zM.9 287.7c-2.6 8 .3 16.9 7.1 22l247.9 184-226.2-294zm160.8-88l94.3 294 94.3-294zm349.4 88l-28.8-88-226.3 294 247.9-184c6.9-5.1 9.7-14 7.2-22zM425.7 24.9c-3.1-8.9-15.7-8.9-18.9 0l-56.6 174.8h132z"],
"gitter": [384, 512, [], "f426", "M66.4 322.5H16V0h50.4v322.5zM166.9 76.1h-50.4V512h50.4V76.1zm100.6 0h-50.4V512h50.4V76.1zM368 76h-50.4v247H368V76z"],
"glide": [448, 512, [], "f2a5", "M252.8 148.6c0 8.8-1.6 17.7-3.4 26.4-5.8 27.8-11.6 55.8-17.3 83.6-1.4 6.3-8.3 4.9-13.7 4.9-23.8 0-30.5-26-30.5-45.5 0-29.3 11.2-68.1 38.5-83.1 4.3-2.5 9.2-4.2 14.1-4.2 11.4 0 12.3 8.3 12.3 17.9zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-64 187c0-5.1-20.8-37.7-25.5-39.5-2.2-.9-7.2-2.3-9.6-2.3-23.1 0-38.7 10.5-58.2 21.5l-.5-.5c4.3-29.4 14.6-57.2 14.6-87.4 0-44.6-23.8-62.7-67.5-62.7-71.7 0-108 70.8-108 123.5 0 54.7 32 85 86.3 85 7.5 0 6.9-.6 6.9 2.3-10.5 80.3-56.5 82.9-56.5 58.9 0-24.4 28-36.5 28.3-38-.2-7.6-29.3-17.2-36.7-17.2-21.1 0-32.7 33-32.7 50.6 0 32.3 20.4 54.7 53.3 54.7 48.2 0 83.4-49.7 94.3-91.7 9.4-37.7 7-39.4 12.3-42.1 20-10.1 35.8-16.8 58.4-16.8 11.1 0 19 2.3 36.7 5.2 1.8.1 4.1-1.7 4.1-3.5z"],
"glide-g": [448, 512, [], "f2a6", "M407.1 211.2c-3.5-1.4-11.6-3.8-15.4-3.8-37.1 0-62.2 16.8-93.5 34.5l-.9-.9c7-47.3 23.5-91.9 23.5-140.4C320.8 29.1 282.6 0 212.4 0 97.3 0 39 113.7 39 198.4 39 286.3 90.3 335 177.6 335c12 0 11-1 11 3.8-16.9 128.9-90.8 133.1-90.8 94.6 0-39.2 45-58.6 45.5-61-.3-12.2-47-27.6-58.9-27.6-33.9.1-52.4 51.2-52.4 79.3C32 476 64.8 512 117.5 512c77.4 0 134-77.8 151.4-145.4 15.1-60.5 11.2-63.3 19.7-67.6 32.2-16.2 57.5-27 93.8-27 17.8 0 30.5 3.7 58.9 8.4 2.9 0 6.7-2.9 6.7-5.8 0-8-33.4-60.5-40.9-63.4zm-175.3-84.4c-9.3 44.7-18.6 89.6-27.8 134.3-2.3 10.2-13.3 7.8-22 7.8-38.3 0-49-41.8-49-73.1 0-47 18-109.3 61.8-133.4 7-4.1 14.8-6.7 22.6-6.7 18.6 0 20 13.3 20 28.7-.1 14.3-2.7 28.5-5.6 42.4z"],
"gofore": [400, 512, [], "f3a7", "M324 319.8h-13.2v34.7c-24.5 23.1-56.3 35.8-89.9 35.8-73.2 0-132.4-60.2-132.4-134.4 0-74.1 59.2-134.4 132.4-134.4 35.3 0 68.6 14 93.6 39.4l62.3-63.3C335 55.3 279.7 32 220.7 32 98 32 0 132.6 0 256c0 122.5 97 224 220.7 224 63.2 0 124.5-26.2 171-82.5-2-27.6-13.4-77.7-67.7-77.7zm-12.1-112.5H205.6v89H324c33.5 0 60.5 15.1 76 41.8v-30.6c0-65.2-40.4-100.2-88.1-100.2z"],
"goodreads": [448, 512, [], "f3a8", "M299.9 191.2c5.1 37.3-4.7 79-35.9 100.7-22.3 15.5-52.8 14.1-70.8 5.7-37.1-17.3-49.5-58.6-46.8-97.2 4.3-60.9 40.9-87.9 75.3-87.5 46.9-.2 71.8 31.8 78.2 78.3zM448 88v336c0 30.9-25.1 56-56 56H56c-30.9 0-56-25.1-56-56V88c0-30.9 25.1-56 56-56h336c30.9 0 56 25.1 56 56zM330 313.2s-.1-34-.1-217.3h-29v40.3c-.8.3-1.2-.5-1.6-1.2-9.6-20.7-35.9-46.3-76-46-51.9.4-87.2 31.2-100.6 77.8-4.3 14.9-5.8 30.1-5.5 45.6 1.7 77.9 45.1 117.8 112.4 115.2 28.9-1.1 54.5-17 69-45.2.5-1 1.1-1.9 1.7-2.9.2.1.4.1.6.2.3 3.8.2 30.7.1 34.5-.2 14.8-2 29.5-7.2 43.5-7.8 21-22.3 34.7-44.5 39.5-17.8 3.9-35.6 3.8-53.2-1.2-21.5-6.1-36.5-19-41.1-41.8-.3-1.6-1.3-1.3-2.3-1.3h-26.8c.8 10.6 3.2 20.3 8.5 29.2 24.2 40.5 82.7 48.5 128.2 37.4 49.9-12.3 67.3-54.9 67.4-106.3z"],
"goodreads-g": [384, 512, [], "f3a9", "M42.6 403.3h2.8c12.7 0 25.5 0 38.2.1 1.6 0 3.1-.4 3.6 2.1 7.1 34.9 30 54.6 62.9 63.9 26.9 7.6 54.1 7.8 81.3 1.8 33.8-7.4 56-28.3 68-60.4 8-21.5 10.7-43.8 11-66.5.1-5.8.3-47-.2-52.8l-.9-.3c-.8 1.5-1.7 2.9-2.5 4.4-22.1 43.1-61.3 67.4-105.4 69.1-103 4-169.4-57-172-176.2-.5-23.7 1.8-46.9 8.3-69.7C58.3 47.7 112.3.6 191.6 0c61.3-.4 101.5 38.7 116.2 70.3.5 1.1 1.3 2.3 2.4 1.9V10.6h44.3c0 280.3.1 332.2.1 332.2-.1 78.5-26.7 143.7-103 162.2-69.5 16.9-159 4.8-196-57.2-8-13.5-11.8-28.3-13-44.5zM188.9 36.5c-52.5-.5-108.5 40.7-115 133.8-4.1 59 14.8 122.2 71.5 148.6 27.6 12.9 74.3 15 108.3-8.7 47.6-33.2 62.7-97 54.8-154-9.7-71.1-47.8-120-119.6-119.7z"],
"google": [488, 512, [], "f1a0", "M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z"],
"google-drive": [512, 512, [], "f3aa", "M339 314.9L175.4 32h161.2l163.6 282.9H339zm-137.5 23.6L120.9 480h310.5L512 338.5H201.5zM154.1 67.4L0 338.5 80.6 480 237 208.8 154.1 67.4z"],
"google-play": [512, 512, [], "f3ab", "M325.3 234.3L104.6 13l280.8 161.2-60.1 60.1zM47 0C34 6.8 25.3 19.2 25.3 35.3v441.3c0 16.1 8.7 28.5 21.7 35.3l256.6-256L47 0zm425.2 225.6l-58.9-34.1-65.7 64.5 65.7 64.5 60.1-34.1c18-14.3 18-46.5-1.2-60.8zM104.6 499l280.8-161.2-60.1-60.1L104.6 499z"],
"google-plus": [496, 512, [], "f2b3", "M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8zm-70.7 372c-68.8 0-124-55.5-124-124s55.2-124 124-124c31.3 0 60.1 11 83 32.3l-33.6 32.6c-13.2-12.9-31.3-19.1-49.4-19.1-42.9 0-77.2 35.5-77.2 78.1s34.2 78.1 77.2 78.1c32.6 0 64.9-19.1 70.1-53.3h-70.1v-42.6h116.9c1.3 6.8 1.9 13.6 1.9 20.7 0 70.8-47.5 121.2-118.8 121.2zm230.2-106.2v35.5H372v-35.5h-35.5v-35.5H372v-35.5h35.5v35.5h35.2v35.5h-35.2z"],
"google-plus-g": [640, 512, [], "f0d5", "M386.061 228.496c1.834 9.692 3.143 19.384 3.143 31.956C389.204 370.205 315.599 448 204.8 448c-106.084 0-192-85.915-192-192s85.916-192 192-192c51.864 0 95.083 18.859 128.611 50.292l-52.126 50.03c-14.145-13.621-39.028-29.599-76.485-29.599-65.484 0-118.92 54.221-118.92 121.277 0 67.056 53.436 121.277 118.92 121.277 75.961 0 104.513-54.745 108.965-82.773H204.8v-66.009h181.261zm185.406 6.437V179.2h-56.001v55.733h-55.733v56.001h55.733v55.733h56.001v-55.733H627.2v-56.001h-55.733z"],
"google-plus-square": [448, 512, [], "f0d4", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM164 356c-55.3 0-100-44.7-100-100s44.7-100 100-100c27 0 49.5 9.8 67 26.2l-27.1 26.1c-7.4-7.1-20.3-15.4-39.8-15.4-34.1 0-61.9 28.2-61.9 63.2 0 34.9 27.8 63.2 61.9 63.2 39.6 0 54.4-28.5 56.8-43.1H164v-34.4h94.4c1 5 1.6 10.1 1.6 16.6 0 57.1-38.3 97.6-96 97.6zm220-81.8h-29v29h-29.2v-29h-29V245h29v-29H355v29h29v29.2z"],
"google-wallet": [448, 512, [], "f1ee", "M156.8 126.8c37.6 60.6 64.2 113.1 84.3 162.5-8.3 33.8-18.8 66.5-31.3 98.3-13.2-52.3-26.5-101.3-56-148.5 6.5-36.4 2.3-73.6 3-112.3zM109.3 200H16.1c-6.5 0-10.5 7.5-6.5 12.7C51.8 267 81.3 330.5 101.3 400h103.5c-16.2-69.7-38.7-133.7-82.5-193.5-3-4-8-6.5-13-6.5zm47.8-88c68.5 108 130 234.5 138.2 368H409c-12-138-68.4-265-143.2-368H157.1zm251.8-68.5c-1.8-6.8-8.2-11.5-15.2-11.5h-88.3c-5.3 0-9 5-7.8 10.3 13.2 46.5 22.3 95.5 26.5 146 48.2 86.2 79.7 178.3 90.6 270.8 15.8-60.5 25.3-133.5 25.3-203 0-73.6-12.1-145.1-31.1-212.6z"],
"gratipay": [496, 512, [], "f184", "M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8zm114.6 226.4l-113 152.7-112.7-152.7c-8.7-11.9-19.1-50.4 13.6-72 28.1-18.1 54.6-4.2 68.5 11.9 15.9 17.9 46.6 16.9 61.7 0 13.9-16.1 40.4-30 68.1-11.9 32.9 21.6 22.6 60 13.8 72z"],
"grav": [512, 512, [], "f2d6", "M301.1 212c4.4 4.4 4.4 11.9 0 16.3l-9.7 9.7c-4.4 4.7-11.9 4.7-16.6 0l-10.5-10.5c-4.4-4.7-4.4-11.9 0-16.6l9.7-9.7c4.4-4.4 11.9-4.4 16.6 0l10.5 10.8zm-30.2-19.7c3-3 3-7.8 0-10.5-2.8-3-7.5-3-10.5 0-2.8 2.8-2.8 7.5 0 10.5 3.1 2.8 7.8 2.8 10.5 0zm-26 5.3c-3 2.8-3 7.5 0 10.2 2.8 3 7.5 3 10.5 0 2.8-2.8 2.8-7.5 0-10.2-3-3-7.7-3-10.5 0zm72.5-13.3c-19.9-14.4-33.8-43.2-11.9-68.1 21.6-24.9 40.7-17.2 59.8.8 11.9 11.3 29.3 24.9 17.2 48.2-12.5 23.5-45.1 33.2-65.1 19.1zm47.7-44.5c-8.9-10-23.3 6.9-15.5 16.1 7.4 9 32.1 2.4 15.5-16.1zM504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-66.2 42.6c2.5-16.1-20.2-16.6-25.2-25.7-13.6-24.1-27.7-36.8-54.5-30.4 11.6-8 23.5-6.1 23.5-6.1.3-6.4 0-13-9.4-24.9 3.9-12.5.3-22.4.3-22.4 15.5-8.6 26.8-24.4 29.1-43.2 3.6-31-18.8-59.2-49.8-62.8-22.1-2.5-43.7 7.7-54.3 25.7-23.2 40.1 1.4 70.9 22.4 81.4-14.4-1.4-34.3-11.9-40.1-34.3-6.6-25.7 2.8-49.8 8.9-61.4 0 0-4.4-5.8-8-8.9 0 0-13.8 0-24.6 5.3 11.9-15.2 25.2-14.4 25.2-14.4 0-6.4-.6-14.9-3.6-21.6-5.4-11-23.8-12.9-31.7 2.8.1-.2.3-.4.4-.5-5 11.9-1.1 55.9 16.9 87.2-2.5 1.4-9.1 6.1-13 10-21.6 9.7-56.2 60.3-56.2 60.3-28.2 10.8-77.2 50.9-70.6 79.7.3 3 1.4 5.5 3 7.5-2.8 2.2-5.5 5-8.3 8.3-11.9 13.8-5.3 35.2 17.7 24.4 15.8-7.2 29.6-20.2 36.3-30.4 0 0-5.5-5-16.3-4.4 27.7-6.6 34.3-9.4 46.2-9.1 8 3.9 8-34.3 8-34.3 0-14.7-2.2-31-11.1-41.5 12.5 12.2 29.1 32.7 28 60.6-.8 18.3-15.2 23-15.2 23-9.1 16.6-43.2 65.9-30.4 106 0 0-9.7-14.9-10.2-22.1-17.4 19.4-46.5 52.3-24.6 64.5 26.6 14.7 108.8-88.6 126.2-142.3 34.6-20.8 55.4-47.3 63.9-65 22 43.5 95.3 94.5 101.1 59z"],
"gripfire": [384, 512, [], "f3ac", "M112.5 301.4c0-73.8 105.1-122.5 105.1-203 0-47.1-34-88-39.1-90.4.4 3.3.6 6.7.6 10C179.1 110.1 32 171.9 32 286.6c0 49.8 32.2 79.2 66.5 108.3 65.1 46.7 78.1 71.4 78.1 86.6 0 10.1-4.8 17-4.8 22.3 13.1-16.7 17.4-31.9 17.5-46.4 0-29.6-21.7-56.3-44.2-86.5-16-22.3-32.6-42.6-32.6-69.5zm205.3-39c-12.1-66.8-78-124.4-94.7-130.9l4 7.2c2.4 5.1 3.4 10.9 3.4 17.1 0 44.7-54.2 111.2-56.6 116.7-2.2 5.1-3.2 10.5-3.2 15.8 0 20.1 15.2 42.1 17.9 42.1 2.4 0 56.6-55.4 58.1-87.7 6.4 11.7 9.1 22.6 9.1 33.4 0 41.2-41.8 96.9-41.8 96.9 0 11.6 31.9 53.2 35.5 53.2 1 0 2.2-1.4 3.2-2.4 37.9-39.3 67.3-85 67.3-136.8 0-8-.7-16.2-2.2-24.6z"],
"grunt": [384, 512, [], "f3ad", "M61.3 189.3c-1.1 10 5.2 19.1 5.2 19.1.7-7.5 2.2-12.8 4-16.6.4 10.3 3.2 23.5 12.8 34.1 6.9 7.6 35.6 23.3 54.9 6.1 1 2.4 2.1 5.3 3 8.5 2.9 10.3-2.7 25.3-2.7 25.3s15.1-17.1 13.9-32.5c10.8-.5 21.4-8.4 21.1-19.5 0 0-18.9 10.4-35.5-8.8-9.7-11.2-40.9-42-83.1-31.8 4.3 1 8.9 2.4 13.5 4.1h-.1c-4.2 2-6.5 7.1-7 12zm28.3-1.8c19.5 11 37.4 25.7 44.9 37-5.7 3.3-21.7 10.4-38-1.7-10.3-7.6-9.8-26.2-6.9-35.3zm142.1 45.8c-1.2 15.5 13.9 32.5 13.9 32.5s-5.6-15-2.7-25.3c.9-3.2 2-6 3-8.5 19.3 17.3 48 1.5 54.8-6.1 9.6-10.6 12.3-23.8 12.8-34.1 1.8 3.8 3.4 9.1 4 16.6 0 0 6.4-9.1 5.2-19.1-.6-5-2.9-10-7-11.8h-.1c4.6-1.8 9.2-3.2 13.5-4.1-42.3-10.2-73.4 20.6-83.1 31.8-16.7 19.2-35.5 8.8-35.5 8.8-.2 10.9 10.4 18.9 21.2 19.3zm62.7-45.8c3 9.1 3.4 27.7-7 35.4-16.3 12.1-32.2 5-37.9 1.6 7.5-11.4 25.4-26 44.9-37zM160 418.5h-29.4c-5.5 0-8.2 1.6-9.5 2.9-1.9 2-2.2 4.7-.9 8.1 3.5 9.1 11.4 16.5 13.7 18.6 3.1 2.7 7.5 4.3 11.8 4.3 4.4 0 8.3-1.7 11-4.6 7.5-8.2 11.9-17.1 13-19.8.6-1.5 1.3-4.5-.9-6.8-1.8-1.8-4.7-2.7-8.8-2.7zm189.2-101.2c-2.4 17.9-13 33.8-24.6 43.7-3.1-22.7-3.7-55.5-3.7-62.4 0-14.7 9.5-24.5 12.2-26.1 2.5-1.5 5.4-3 8.3-4.6 18-9.6 40.4-21.6 40.4-43.7 0-16.2-9.3-23.2-15.4-27.8-.8-.6-1.5-1.1-2.2-1.7-2.1-1.7-3.7-3-4.3-4.4-4.4-9.8-3.6-34.2-1.7-37.6.6-.6 16.7-20.9 11.8-39.2-2-7.4-6.9-13.3-14.1-17-5.3-2.7-11.9-4.2-19.5-4.5-.1-2-.5-3.9-.9-5.9-.6-2.6-1.1-5.3-.9-8.1.4-4.7.8-9 2.2-11.3 8.4-13.3 28.8-17.6 29-17.6l12.3-2.4-8.1-9.5c-.1-.2-17.3-17.5-46.3-17.5-7.9 0-16 1.3-24.1 3.9-24.2 7.8-42.9 30.5-49.4 39.3-3.1-1-6.3-1.9-9.6-2.7-4.2-15.8 9-38.5 9-38.5s-13.6-3-33.7 15.2c-2.6-6.5-8.1-20.5-1.8-37.2C184.6 10.1 177.2 26 175 40.4c-7.6-5.4-6.7-23.1-7.2-27.6-7.5.9-29.2 21.9-28.2 48.3-2 .5-3.9 1.1-5.9 1.7-6.5-8.8-25.1-31.5-49.4-39.3-7.9-2.2-16-3.5-23.9-3.5-29 0-46.1 17.3-46.3 17.5L6 46.9l12.3 2.4c.2 0 20.6 4.3 29 17.6 1.4 2.2 1.8 6.6 2.2 11.3.2 2.8-.4 5.5-.9 8.1-.4 1.9-.8 3.9-.9 5.9-7.7.3-14.2 1.8-19.5 4.5-7.2 3.7-12.1 9.6-14.1 17-5 18.2 11.2 38.5 11.8 39.2 1.9 3.4 2.7 27.8-1.7 37.6-.6 1.4-2.2 2.7-4.3 4.4-.7.5-1.4 1.1-2.2 1.7-6.1 4.6-15.4 11.7-15.4 27.8 0 22.1 22.4 34.1 40.4 43.7 3 1.6 5.8 3.1 8.3 4.6 2.7 1.6 12.2 11.4 12.2 26.1 0 6.9-.6 39.7-3.7 62.4-11.6-9.9-22.2-25.9-24.6-43.8 0 0-29.2 22.6-20.6 70.8 5.2 29.5 23.2 46.1 47 54.7 8.8 19.1 29.4 45.7 67.3 49.6C143 504.3 163 512 192.2 512h.2c29.1 0 49.1-7.7 63.6-19.5 37.9-3.9 58.5-30.5 67.3-49.6 23.8-8.7 41.7-25.2 47-54.7 8.2-48.4-21.1-70.9-21.1-70.9zM305.7 37.7c5.6-1.8 11.6-2.7 17.7-2.7 11 0 19.9 3 24.7 5-3.1 1.4-6.4 3.2-9.7 5.3-2.4-.4-5.6-.8-9.2-.8-10.5 0-20.5 3.1-28.7 8.9-12.3 8.7-18 16.9-20.7 22.4-2.2-1.3-4.5-2.5-7.1-3.7-1.6-.8-3.1-1.5-4.7-2.2 6.1-9.1 19.9-26.5 37.7-32.2zm21 18.2c-.8 1-1.6 2.1-2.3 3.2-3.3 5.2-3.9 11.6-4.4 17.8-.5 6.4-1.1 12.5-4.4 17-4.2.8-8.1 1.7-11.5 2.7-2.3-3.1-5.6-7-10.5-11.2 1.4-4.8 5.5-16.1 13.5-22.5 5.6-4.3 12.2-6.7 19.6-7zM45.6 45.3c-3.3-2.2-6.6-4-9.7-5.3 4.8-2 13.7-5 24.7-5 6.1 0 12 .9 17.7 2.7 17.8 5.8 31.6 23.2 37.7 32.1-1.6.7-3.2 1.4-4.8 2.2-2.5 1.2-4.9 2.5-7.1 3.7-2.6-5.4-8.3-13.7-20.7-22.4-8.3-5.8-18.2-8.9-28.8-8.9-3.4.1-6.6.5-9 .9zm44.7 40.1c-4.9 4.2-8.3 8-10.5 11.2-3.4-.9-7.3-1.9-11.5-2.7C65 89.5 64.5 83.4 64 77c-.5-6.2-1.1-12.6-4.4-17.8-.7-1.1-1.5-2.2-2.3-3.2 7.4.3 14 2.6 19.5 7 8 6.3 12.1 17.6 13.5 22.4zM58.1 259.9c-2.7-1.6-5.6-3.1-8.4-4.6-14.9-8-30.2-16.3-30.2-30.5 0-11.1 4.3-14.6 8.9-18.2l.5-.4c.7-.6 1.4-1.2 2.2-1.8-.9 7.2-1.9 13.3-2.7 14.9 0 0 12.1-15 15.7-44.3 1.4-11.5-1.1-34.3-5.1-43 .2 4.9 0 9.8-.3 14.4-.4-.8-.8-1.6-1.3-2.2-3.2-4-11.8-17.5-9.4-26.6.9-3.5 3.1-6 6.7-7.8 3.8-1.9 8.8-2.9 15.1-2.9 12.3 0 25.9 3.7 32.9 6 25.1 8 55.4 30.9 64.1 37.7.2.2.4.3.4.3l5.6 3.9-3.5-5.8c-.2-.3-19.1-31.4-53.2-46.5 2-2.9 7.4-8.1 21.6-15.1 21.4-10.5 46.5-15.8 74.3-15.8 27.9 0 52.9 5.3 74.3 15.8 14.2 6.9 19.6 12.2 21.6 15.1-34 15.1-52.9 46.2-53.1 46.5l-3.5 5.8 5.6-3.9s.2-.1.4-.3c8.7-6.8 39-29.8 64.1-37.7 7-2.2 20.6-6 32.9-6 6.3 0 11.3 1 15.1 2.9 3.5 1.8 5.7 4.4 6.7 7.8 2.5 9.1-6.1 22.6-9.4 26.6-.5.6-.9 1.3-1.3 2.2-.3-4.6-.5-9.5-.3-14.4-4 8.8-6.5 31.5-5.1 43 3.6 29.3 15.7 44.3 15.7 44.3-.8-1.6-1.8-7.7-2.7-14.9.7.6 1.5 1.2 2.2 1.8l.5.4c4.6 3.7 8.9 7.1 8.9 18.2 0 14.2-15.4 22.5-30.2 30.5-2.9 1.5-5.7 3.1-8.4 4.6-8.7 5-18 16.7-19.1 34.2-.9 14.6.9 49.9 3.4 75.9-12.4 4.8-26.7 6.4-39.7 6.8-2-4.1-3.9-8.5-5.5-13.1-.7-2-19.6-51.1-26.4-62.2 5.5 39 17.5 73.7 23.5 89.6-3.5-.5-7.3-.7-11.7-.7h-117c-4.4 0-8.3.3-11.7.7 6-15.9 18.1-50.6 23.5-89.6-6.8 11.2-25.7 60.3-26.4 62.2-1.6 4.6-3.5 9-5.5 13.1-13-.4-27.2-2-39.7-6.8 2.5-26 4.3-61.2 3.4-75.9-.9-17.4-10.3-29.2-19-34.2zM34.8 404.6c-12.1-20-8.7-54.1-3.7-59.1 10.9 34.4 47.2 44.3 74.4 45.4-2.7 4.2-5.2 7.6-7 10l-1.4 1.4c-7.2 7.8-8.6 18.5-4.1 31.8-22.7-.1-46.3-9.8-58.2-29.5zm45.7 43.5c6 1.1 12.2 1.9 18.6 2.4 3.5 8 7.4 15.9 12.3 23.1-14.4-5.9-24.4-16-30.9-25.5zM192 498.2c-60.6-.1-78.3-45.8-84.9-64.7-3.7-10.5-3.4-18.2.9-23.1 2.9-3.3 9.5-7.2 24.6-7.2h118.8c15.1 0 21.8 3.9 24.6 7.2 4.2 4.8 4.5 12.6.9 23.1-6.6 18.8-24.3 64.6-84.9 64.7zm80.6-24.6c4.9-7.2 8.8-15.1 12.3-23.1 6.4-.5 12.6-1.3 18.6-2.4-6.5 9.5-16.5 19.6-30.9 25.5zm76.6-69c-12 19.7-35.6 29.3-58.1 29.7 4.5-13.3 3.1-24.1-4.1-31.8-.4-.5-.9-1-1.4-1.5-1.8-2.4-4.3-5.8-7-10 27.2-1.2 63.5-11 74.4-45.4 5 5 8.4 39.1-3.8 59zM191.9 187.7h.2c12.7-.1 27.2-17.8 27.2-17.8-9.9 6-18.8 8.1-27.3 8.3-8.5-.2-17.4-2.3-27.3-8.3 0 0 14.5 17.6 27.2 17.8zm61.7 230.7h-29.4c-4.2 0-7.2.9-8.9 2.7-2.2 2.3-1.5 5.2-.9 6.7 1 2.6 5.5 11.3 13 19.3 2.7 2.9 6.6 4.5 11 4.5s8.7-1.6 11.8-4.2c2.3-2 10.2-9.2 13.7-18.1 1.3-3.3 1-6-.9-7.9-1.3-1.3-4-2.9-9.4-3z"],
"gulp": [256, 512, [], "f3ae", "M209.8 391.1l-14.1 24.6-4.6 80.2c0 8.9-28.3 16.1-63.1 16.1s-63.1-7.2-63.1-16.1l-5.8-79.4-14.9-25.4c41.2 17.3 126 16.7 165.6 0zm-196-253.3l13.6 125.5c5.9-20 20.8-47 40-55.2 6.3-2.7 12.7-2.7 18.7.9 5.2 3 9.6 9.3 10.1 11.8 1.2 6.5-2 9.1-4.5 9.1-3 0-5.3-4.6-6.8-7.3-4.1-7.3-10.3-7.6-16.9-2.8-6.9 5-12.9 13.4-17.1 20.7-5.1 8.8-9.4 18.5-12 28.2-1.5 5.6-2.9 14.6-.6 19.9 1 2.2 2.5 3.6 4.9 3.6 5 0 12.3-6.6 15.8-10.1 4.5-4.5 10.3-11.5 12.5-16l5.2-15.5c2.6-6.8 9.9-5.6 9.9 0 0 10.2-3.7 13.6-10 34.7-5.8 19.5-7.6 25.8-7.6 25.8-.7 2.8-3.4 7.5-6.3 7.5-1.2 0-2.1-.4-2.6-1.2-1-1.4-.9-5.3-.8-6.3.2-3.2 6.3-22.2 7.3-25.2-2 2.2-4.1 4.4-6.4 6.6-5.4 5.1-14.1 11.8-21.5 11.8-3.4 0-5.6-.9-7.7-2.4l7.6 79.6c2 5 39.2 17.1 88.2 17.1 49.1 0 86.3-12.2 88.2-17.1l10.9-94.6c-5.7 5.2-12.3 11.6-19.6 14.8-5.4 2.3-17.4 3.8-17.4-5.7 0-5.2 9.1-14.8 14.4-21.5 1.4-1.7 4.7-5.9 4.7-8.1 0-2.9-6-2.2-11.7 2.5-3.2 2.7-6.2 6.3-8.7 9.7-4.3 6-6.6 11.2-8.5 15.5-6.2 14.2-4.1 8.6-9.1 22-5 13.3-4.2 11.8-5.2 14-.9 1.9-2.2 3.5-4 4.5-1.9 1-4.5.9-6.1-.3-.9-.6-1.3-1.9-1.3-3.7 0-.9.1-1.8.3-2.7 1.5-6.1 7.8-18.1 15-34.3 1.6-3.7 1-2.6.8-2.3-6.2 6-10.9 8.9-14.4 10.5-5.8 2.6-13 2.6-14.5-4.1-.1-.4-.1-.8-.2-1.2-11.8 9.2-24.3 11.7-20-8.1-4.6 8.2-12.6 14.9-22.4 14.9-4.1 0-7.1-1.4-8.6-5.1-2.3-5.5 1.3-14.9 4.6-23.8 1.7-4.5 4-9.9 7.1-16.2 1.6-3.4 4.2-5.4 7.6-4.5.6.2 1.1.4 1.6.7 2.6 1.8 1.6 4.5.3 7.2-3.8 7.5-7.1 13-9.3 20.8-.9 3.3-2 9 1.5 9 2.4 0 4.7-.8 6.9-2.4 4.6-3.4 8.3-8.5 11.1-13.5 2-3.6 4.4-8.3 5.6-12.3.5-1.7 1.1-3.3 1.8-4.8 1.1-2.5 2.6-5.1 5.2-5.1 1.3 0 2.4.5 3.2 1.5 1.7 2.2 1.3 4.5.4 6.9-2 5.6-4.7 10.6-6.9 16.7-1.3 3.5-2.7 8-2.7 11.7 0 3.4 3.7 2.6 6.8 1.2 2.4-1.1 4.8-2.8 6.8-4.5 1.2-4.9.9-3.8 26.4-68.2 1.3-3.3 3.7-4.7 6.1-4.7 1.2 0 2.2.4 3.2 1.1 1.7 1.3 1.7 4.1 1 6.2-.7 1.9-.6 1.3-4.5 10.5-5.2 12.1-8.6 20.8-13.2 31.9-1.9 4.6-7.7 18.9-8.7 22.3-.6 2.2-1.3 5.8 1 5.8 5.4 0 19.3-13.1 23.1-17 .2-.3.5-.4.9-.6.6-1.9 1.2-3.7 1.7-5.5 1.4-3.8 2.7-8.2 5.3-11.3.8-1 1.7-1.6 2.7-1.6 2.8 0 4.2 1.2 4.2 4 0 1.1-.7 5.1-1.1 6.2 1.4-1.5 2.9-3 4.5-4.5 15-13.9 25.7-6.8 25.7.2 0 7.4-8.9 17.7-13.8 23.4-1.6 1.9-4.9 5.4-5 6.4 0 1.3.9 1.8 2.2 1.8 2 0 6.4-3.5 8-4.7 5-3.9 11.8-9.9 16.6-14.1l14.8-136.8c-30.5 17.1-197.6 17.2-228.3.2zm229.7-8.5c0 21-231.2 21-231.2 0 0-8.8 51.8-15.9 115.6-15.9 9 0 17.8.1 26.3.4l12.6-48.7L228.1.6c1.4-1.4 5.8-.2 9.9 3.5s6.6 7.9 5.3 9.3l-.1.1L185.9 74l-10 40.7c39.9 2.6 67.6 8.1 67.6 14.6zm-69.4 4.6c0-.8-.9-1.5-2.5-2.1l-.2.8c0 1.3-5 2.4-11.1 2.4s-11.1-1.1-11.1-2.4c0-.1 0-.2.1-.3l.2-.7c-1.8.6-3 1.4-3 2.3 0 2.1 6.2 3.7 13.7 3.7 7.7.1 13.9-1.6 13.9-3.7z"],
"hacker-news": [448, 512, [], "f1d4", "M0 32v448h448V32H0zm21.2 197.2H21c.1-.1.2-.3.3-.4 0 .1 0 .3-.1.4zm218 53.9V384h-31.4V281.3L128 128h37.3c52.5 98.3 49.2 101.2 59.3 125.6 12.3-27 5.8-24.4 60.6-125.6H320l-80.8 155.1z"],
"hacker-news-square": [448, 512, [], "f3af", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM21.2 229.2H21c.1-.1.2-.3.3-.4 0 .1 0 .3-.1.4zm218 53.9V384h-31.4V281.3L128 128h37.3c52.5 98.3 49.2 101.2 59.3 125.6 12.3-27 5.8-24.4 60.6-125.6H320l-80.8 155.1z"],
"hackerrank": [512, 512, [], "f5f7", "M477.5 128C463 103.05 285.13 0 256.16 0S49.25 102.79 34.84 128s-14.49 230.8 0 256 192.38 128 221.32 128S463 409.08 477.49 384s14.51-231 .01-256zM316.13 414.22c-4 0-40.91-35.77-38-38.69.87-.87 6.26-1.48 17.55-1.83 0-26.23.59-68.59.94-86.32 0-2-.44-3.43-.44-5.85h-79.93c0 7.1-.46 36.2 1.37 72.88.23 4.54-1.58 6-5.74 5.94-10.13 0-20.27-.11-30.41-.08-4.1 0-5.87-1.53-5.74-6.11.92-33.44 3-84-.15-212.67v-3.17c-9.67-.35-16.38-1-17.26-1.84-2.92-2.92 34.54-38.69 38.49-38.69s41.17 35.78 38.27 38.69c-.87.87-7.9 1.49-16.77 1.84v3.16c-2.42 25.75-2 79.59-2.63 105.39h80.26c0-4.55.39-34.74-1.2-83.64-.1-3.39.95-5.17 4.21-5.2 11.07-.08 22.15-.13 33.23-.06 3.46 0 4.57 1.72 4.5 5.38C333 354.64 336 341.29 336 373.69c8.87.35 16.82 1 17.69 1.84 2.88 2.91-33.62 38.69-37.58 38.69z"],
"hips": [640, 512, [], "f452", "M251.6 157.6c0-1.9-.9-2.8-2.8-2.8h-40.9c-1.6 0-2.7 1.4-2.7 2.8v201.8c0 1.4 1.1 2.8 2.7 2.8h40.9c1.9 0 2.8-.9 2.8-2.8zM156.5 168c-16.1-11.8-36.3-17.9-60.3-18-18.1-.1-34.6 3.7-49.8 11.4V80.2c0-1.8-.9-2.7-2.8-2.7H2.7c-1.8 0-2.7.9-2.7 2.7v279.2c0 1.9.9 2.8 2.7 2.8h41c1.9 0 2.8-.9 2.8-2.8V223.3c0-.8-2.8-27 45.8-27 48.5 0 45.8 26.1 45.8 27v122.6c0 9 7.3 16.3 16.4 16.3h27.3c1.8 0 2.7-.9 2.7-2.8V223.3c0-23.4-9.3-41.8-28-55.3zm478.4 110.1c-6.8-15.7-18.4-27-34.9-34.1l-57.6-25.3c-8.6-3.6-9.2-11.2-2.6-16.1 7.4-5.5 44.3-13.9 84 6.8 1.7 1 4-.3 4-2.4v-44.7c0-1.3-.6-2.1-1.9-2.6-17.7-6.6-36.1-9.9-55.1-9.9-26.5 0-45.3 5.8-58.5 15.4-.5.4-28.4 20-22.7 53.7 3.4 19.6 15.8 34.2 37.2 43.6l53.6 23.5c11.6 5.1 15.2 13.3 12.2 21.2-3.7 9.1-13.2 13.6-36.5 13.6-24.3 0-44.7-8.9-58.4-19.1-2.1-1.4-4.4.2-4.4 2.3v34.4c0 10.4 4.9 17.3 14.6 20.7 15.6 5.5 31.6 8.2 48.2 8.2 12.7 0 25.8-1.2 36.3-4.3.7-.3 36-8.9 45.6-45.8 3.5-13.5 2.4-26.5-3.1-39.1zM376.2 149.8c-31.7 0-104.2 20.1-104.2 103.5v183.5c0 .8.6 2.7 2.7 2.7h40.9c1.9 0 2.8-.9 2.8-2.7V348c16.5 12.7 35.8 19.1 57.7 19.1 60.5 0 108.7-48.5 108.7-108.7.1-60.3-48.2-108.6-108.6-108.6zm0 170.9c-17.2 0-31.9-6.1-44-18.2-12.2-12.2-18.2-26.8-18.2-44 0-34.5 27.6-62.2 62.2-62.2 34.5 0 62.2 27.6 62.2 62.2.1 34.3-27.3 62.2-62.2 62.2zM228.3 72.5c-15.9 0-28.8 12.9-28.9 28.9 0 15.6 12.7 28.9 28.9 28.9s28.9-13.1 28.9-28.9c0-16.2-13-28.9-28.9-28.9z"],
"hire-a-helper": [512, 512, [], "f3b0", "M443.1 0H71.9C67.9 37.3 37.4 67.8 0 71.7v371.5c37.4 4.9 66 32.4 71.9 68.8h372.2c3-36.4 32.5-65.8 67.9-69.8V71.7c-36.4-5.9-65-35.3-68.9-71.7zm-37 404.9c-36.3 0-18.8-2-55.1-2-35.8 0-21 2-56.1 2-5.9 0-4.9-8.2 0-9.8 22.8-7.6 22.9-10.2 24.6-12.8 10.4-15.6 5.9-83 5.9-113 0-5.3-6.4-12.8-13.8-12.8H200.4c-7.4 0-13.8 7.5-13.8 12.8 0 30-4.5 97.4 5.9 113 1.7 2.5 1.8 5.2 24.6 12.8 4.9 1.6 6 9.8 0 9.8-35.1 0-20.3-2-56.1-2-36.3 0-18.8 2-55.1 2-7.9 0-5.8-10.8 0-10.8 10.2-3.4 13.5-3.5 21.7-13.8 7.7-12.9 7.9-44.4 7.9-127.8V151.3c0-22.2-12.2-28.3-28.6-32.4-8.8-2.2-4-11.8 1-11.8 36.5 0 20.6 2 57.1 2 32.7 0 16.5-2 49.2-2 3.3 0 8.5 8.3 1 10.8-4.9 1.6-27.6 3.7-27.6 39.3 0 45.6-.2 55.8 1 68.8 0 1.3 2.3 12.8 12.8 12.8h109.2c10.5 0 12.8-11.5 12.8-12.8 1.2-13 1-23.2 1-68.8 0-35.6-22.7-37.7-27.6-39.3-7.5-2.5-2.3-10.8 1-10.8 32.7 0 16.5 2 49.2 2 36.5 0 20.6-2 57.1-2 4.9 0 9.9 9.6 1 11.8-16.4 4.1-28.6 10.3-28.6 32.4v101.2c0 83.4.1 114.9 7.9 127.8 8.2 10.2 11.4 10.4 21.7 13.8 5.8 0 7.8 10.8 0 10.8z"],
"hooli": [640, 512, [], "f427", "M144.5 352l38.3.8c-13.2-4.6-26-10.2-38.3-16.8zm57.7-5.3v5.3l-19.4.8c36.5 12.5 69.9 14.2 94.7 7.2-19.9.2-45.8-2.6-75.3-13.3zm408.9-115.2c15.9 0 28.9-12.9 28.9-28.9s-12.9-24.5-28.9-24.5c-15.9 0-28.9 8.6-28.9 24.5s12.9 28.9 28.9 28.9zm-29 120.5H640V241.5h-57.9zm-73.7 0h57.9V156.7L508.4 184zm-31-119.4c-18.2-18.2-50.4-17.1-50.4-17.1s-32.3-1.1-50.4 17.1c-18.2 18.2-16.8 33.9-16.8 52.6s-1.4 34.3 16.8 52.5 50.4 17.1 50.4 17.1 32.3 1.1 50.4-17.1c18.2-18.2 16.8-33.8 16.8-52.5-.1-18.8 1.3-34.5-16.8-52.6zm-39.8 71.9c0 3.6-1.8 12.5-10.7 12.5s-10.7-8.9-10.7-12.5v-40.4c0-8.7 7.3-10.9 10.7-10.9s10.7 2.1 10.7 10.9zm-106.2-71.9c-18.2-18.2-50.4-17.1-50.4-17.1s-32.2-1.1-50.4 17.1c-1.9 1.9-3.7 3.9-5.3 6-38.2-29.6-72.5-46.5-102.1-61.1v-20.7l-22.5 10.6c-54.4-22.1-89-18.2-97.3.1 0 0-24.9 32.8 61.8 110.8V352h57.9v-28.6c-6.5-4.2-13-8.7-19.4-13.6-14.8-11.2-27.4-21.6-38.4-31.4v-31c13.1 14.7 30.5 31.4 53.4 50.3l4.5 3.6v-29.8c0-6.9 1.7-18.2 10.8-18.2s10.6 6.9 10.6 15V317c18 12.2 37.3 22.1 57.7 29.6v-93.9c0-18.7-13.4-37.4-40.6-37.4-15.8-.1-30.5 8.2-38.5 21.9v-54.3c41.9 20.9 83.9 46.5 99.9 58.3-10.2 14.6-9.3 28.1-9.3 43.7 0 18.7-1.4 34.3 16.8 52.5s50.4 17.1 50.4 17.1 32.3 1.1 50.4-17.1c18.2-18.2 16.7-33.8 16.7-52.5 0-18.5 1.5-34.2-16.7-52.3zM65.2 184v63.3c-48.7-54.5-38.9-76-35.2-79.1 13.5-11.4 37.5-8 64.4 2.1zm226.5 120.5c0 3.6-1.8 12.5-10.7 12.5s-10.7-8.9-10.7-12.5v-40.4c0-8.7 7.3-10.9 10.7-10.9s10.7 2.1 10.7 10.9z"],
"hornbill": [512, 512, [], "f592", "M76.38 370.3a37.8 37.8 0 1 1-32.07-32.42c-78.28-111.35 52-190.53 52-190.53-5.86 43-8.24 91.16-8.24 91.16-67.31 41.49.93 64.06 39.81 72.87a140.38 140.38 0 0 0 131.66 91.94c1.92 0 3.77-.21 5.67-.28l.11 18.86c-99.22 1.39-158.7-29.14-188.94-51.6zm108-327.7A37.57 37.57 0 0 0 181 21.45a37.95 37.95 0 1 0-31.17 54.22c-22.55 29.91-53.83 89.57-52.42 190l21.84-.15c0-.9-.14-1.77-.14-2.68A140.42 140.42 0 0 1 207 132.71c8-37.71 30.7-114.3 73.8-44.29 0 0 48.14 2.38 91.18 8.24 0 0-77.84-128-187.59-54.06zm304.19 134.17a37.94 37.94 0 1 0-53.84-28.7C403 126.13 344.89 99 251.28 100.33l.14 22.5c2.7-.15 5.39-.41 8.14-.41a140.37 140.37 0 0 1 130.49 88.76c39.1 9 105.06 31.58 38.46 72.54 0 0-2.34 48.13-8.21 91.16 0 0 133.45-81.16 49-194.61a37.45 37.45 0 0 0 19.31-3.5zM374.06 436.24c21.43-32.46 46.42-89.69 45.14-179.66l-19.52.14c.08 2.06.3 4.07.3 6.15a140.34 140.34 0 0 1-91.39 131.45c-8.85 38.95-31.44 106.66-72.77 39.49 0 0-48.12-2.34-91.19-8.22 0 0 79.92 131.34 191.9 51a37.5 37.5 0 0 0 3.64 14 37.93 37.93 0 1 0 33.89-54.29z"],
"hotjar": [448, 512, [], "f3b1", "M414.9 161.5C340.2 29 121.1 0 121.1 0S222.2 110.4 93 197.7C11.3 252.8-21 324.4 14 402.6c26.8 59.9 83.5 84.3 144.6 93.4-29.2-55.1-6.6-122.4-4.1-129.6 57.1 86.4 165 0 110.8-93.9 71 15.4 81.6 138.6 27.1 215.5 80.5-25.3 134.1-88.9 148.8-145.6 15.5-59.3 3.7-127.9-26.3-180.9z"],
"houzz": [448, 512, [], "f27c", "M275.9 330.7H171.3V480H17V32h109.5v104.5l305.1 85.6V480H275.9z"],
"html5": [384, 512, [], "f13b", "M0 32l34.9 395.8L191.5 480l157.6-52.2L384 32H0zm308.2 127.9H124.4l4.1 49.4h175.6l-13.6 148.4-97.9 27v.3h-1.1l-98.7-27.3-6-75.8h47.7L138 320l53.5 14.5 53.7-14.5 6-62.2H84.3L71.5 112.2h241.1l-4.4 47.7z"],
"hubspot": [512, 512, [], "f3b2", "M267.4 211.6c-25.1 23.7-40.8 57.3-40.8 94.6 0 29.3 9.7 56.3 26 78L203.1 434c-4.4-1.6-9.1-2.5-14-2.5-10.8 0-20.9 4.2-28.5 11.8-7.6 7.6-11.8 17.8-11.8 28.6s4.2 20.9 11.8 28.5c7.6 7.6 17.8 11.6 28.5 11.6 10.8 0 20.9-3.9 28.6-11.6 7.6-7.6 11.8-17.8 11.8-28.5 0-4.2-.6-8.2-1.9-12.1l50-50.2c22 16.9 49.4 26.9 79.3 26.9 71.9 0 130-58.3 130-130.2 0-65.2-47.7-119.2-110.2-128.7V116c17.5-7.4 28.2-23.8 28.2-42.9 0-26.1-20.9-47.9-47-47.9S311.2 47 311.2 73.1c0 19.1 10.7 35.5 28.2 42.9v61.2c-15.2 2.1-29.6 6.7-42.7 13.6-27.6-20.9-117.5-85.7-168.9-124.8 1.2-4.4 2-9 2-13.8C129.8 23.4 106.3 0 77.4 0 48.6 0 25.2 23.4 25.2 52.2c0 28.9 23.4 52.3 52.2 52.3 9.8 0 18.9-2.9 26.8-7.6l163.2 114.7zm89.5 163.6c-38.1 0-69-30.9-69-69s30.9-69 69-69 69 30.9 69 69-30.9 69-69 69z"],
"imdb": [448, 512, [], "f2d8", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM21.3 229.2H21c.1-.1.2-.3.3-.4zM97 319.8H64V192h33zm113.2 0h-28.7v-86.4l-11.6 86.4h-20.6l-12.2-84.5v84.5h-29V192h42.8c3.3 19.8 6 39.9 8.7 59.9l7.6-59.9h43zm11.4 0V192h24.6c17.6 0 44.7-1.6 49 20.9 1.7 7.6 1.4 16.3 1.4 24.4 0 88.5 11.1 82.6-75 82.5zm160.9-29.2c0 15.7-2.4 30.9-22.2 30.9-9 0-15.2-3-20.9-9.8l-1.9 8.1h-29.8V192h31.7v41.7c6-6.5 12-9.2 20.9-9.2 21.4 0 22.2 12.8 22.2 30.1zM265 229.9c0-9.7 1.6-16-10.3-16v83.7c12.2.3 10.3-8.7 10.3-18.4zm85.5 26.1c0-5.4 1.1-12.7-6.2-12.7-6 0-4.9 8.9-4.9 12.7 0 .6-1.1 39.6 1.1 44.7.8 1.6 2.2 2.4 3.8 2.4 7.8 0 6.2-9 6.2-14.4z"],
"instagram": [448, 512, [], "f16d", "M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"],
"intercom": [448, 512, [], "f7af", "M392 32H56C25.1 32 0 57.1 0 88v336c0 30.9 25.1 56 56 56h336c30.9 0 56-25.1 56-56V88c0-30.9-25.1-56-56-56zm-108.3 82.1c0-19.8 29.9-19.8 29.9 0v199.5c0 19.8-29.9 19.8-29.9 0V114.1zm-74.6-7.5c0-19.8 29.9-19.8 29.9 0v216.5c0 19.8-29.9 19.8-29.9 0V106.6zm-74.7 7.5c0-19.8 29.9-19.8 29.9 0v199.5c0 19.8-29.9 19.8-29.9 0V114.1zM59.7 144c0-19.8 29.9-19.8 29.9 0v134.3c0 19.8-29.9 19.8-29.9 0V144zm323.4 227.8c-72.8 63-241.7 65.4-318.1 0-15-12.8 4.4-35.5 19.4-22.7 65.9 55.3 216.1 53.9 279.3 0 14.9-12.9 34.3 9.8 19.4 22.7zm5.2-93.5c0 19.8-29.9 19.8-29.9 0V144c0-19.8 29.9-19.8 29.9 0v134.3z"],
"internet-explorer": [512, 512, [], "f26b", "M483.049 159.706c10.855-24.575 21.424-60.438 21.424-87.871 0-72.722-79.641-98.371-209.673-38.577-107.632-7.181-211.221 73.67-237.098 186.457 30.852-34.862 78.271-82.298 121.977-101.158C125.404 166.85 79.128 228.002 43.992 291.725 23.246 329.651 0 390.94 0 436.747c0 98.575 92.854 86.5 180.251 42.006 31.423 15.43 66.559 15.573 101.695 15.573 97.124 0 184.249-54.294 216.814-146.022H377.927c-52.509 88.593-196.819 52.996-196.819-47.436H509.9c6.407-43.581-1.655-95.715-26.851-141.162zM64.559 346.877c17.711 51.15 53.703 95.871 100.266 123.304-88.741 48.94-173.267 29.096-100.266-123.304zm115.977-108.873c2-55.151 50.276-94.871 103.98-94.871 53.418 0 101.981 39.72 103.981 94.871H180.536zm184.536-187.6c21.425-10.287 48.563-22.003 72.558-22.003 31.422 0 54.274 21.717 54.274 53.722 0 20.003-7.427 49.007-14.569 67.867-26.28-42.292-65.986-81.584-112.263-99.586z"],
"invision": [448, 512, [], "f7b0", "M407.4 32H40.6C18.2 32 0 50.2 0 72.6v366.8C0 461.8 18.2 480 40.6 480h366.8c22.4 0 40.6-18.2 40.6-40.6V72.6c0-22.4-18.2-40.6-40.6-40.6zM176.1 145.6c.4 23.4-22.4 27.3-26.6 27.4-14.9 0-27.1-12-27.1-27 .1-35.2 53.1-35.5 53.7-.4zM332.8 377c-65.6 0-34.1-74-25-106.6 14.1-46.4-45.2-59-59.9.7l-25.8 103.3H177l8.1-32.5c-31.5 51.8-94.6 44.4-94.6-4.3.1-14.3.9-14 23-104.1H81.7l9.7-35.6h76.4c-33.6 133.7-32.6 126.9-32.9 138.2 0 20.9 40.9 13.5 57.4-23.2l19.8-79.4h-32.3l9.7-35.6h68.8l-8.9 40.5c40.5-75.5 127.9-47.8 101.8 38-14.2 51.1-14.6 50.7-14.9 58.8 0 15.5 17.5 22.6 31.8-16.9L386 325c-10.5 36.7-29.4 52-53.2 52z"],
"ioxhost": [640, 512, [], "f208", "M616 160h-67.3C511.2 70.7 422.9 8 320 8 183 8 72 119 72 256c0 16.4 1.6 32.5 4.7 48H24c-13.3 0-24 10.8-24 24 0 13.3 10.7 24 24 24h67.3c37.5 89.3 125.8 152 228.7 152 137 0 248-111 248-248 0-16.4-1.6-32.5-4.7-48H616c13.3 0 24-10.8 24-24 0-13.3-10.7-24-24-24zm-96 96c0 110.5-89.5 200-200 200-75.7 0-141.6-42-175.5-104H424c13.3 0 24-10.8 24-24 0-13.3-10.7-24-24-24H125.8c-3.8-15.4-5.8-31.4-5.8-48 0-110.5 89.5-200 200-200 75.7 0 141.6 42 175.5 104H216c-13.3 0-24 10.8-24 24 0 13.3 10.7 24 24 24h298.2c3.8 15.4 5.8 31.4 5.8 48zm-304-24h208c13.3 0 24 10.7 24 24 0 13.2-10.7 24-24 24H216c-13.3 0-24-10.7-24-24 0-13.2 10.7-24 24-24z"],
"itch-io": [512, 512, [], "f83a", "M71.92 34.77C50.2 47.67 7.4 96.84 7 109.73v21.34c0 27.06 25.29 50.84 48.25 50.84 27.57 0 50.54-22.85 50.54-50 0 27.12 22.18 50 49.76 50s49-22.85 49-50c0 27.12 23.59 50 51.16 50h.5c27.57 0 51.16-22.85 51.16-50 0 27.12 21.47 50 49 50s49.76-22.85 49.76-50c0 27.12 23 50 50.54 50 23 0 48.25-23.78 48.25-50.84v-21.34c-.4-12.9-43.2-62.07-64.92-75C372.56 32.4 325.76 32 256 32S91.14 33.1 71.92 34.77zm132.32 134.39c-22 38.4-77.9 38.71-99.85.25-13.17 23.14-43.17 32.07-56 27.66-3.87 40.15-13.67 237.13 17.73 269.15 80 18.67 302.08 18.12 379.76 0 31.65-32.27 21.32-232 17.75-269.15-12.92 4.44-42.88-4.6-56-27.66-22 38.52-77.85 38.1-99.85-.24-7.1 12.49-23.05 28.94-51.76 28.94a57.54 57.54 0 0 1-51.75-28.94zm-41.58 53.77c16.47 0 31.09 0 49.22 19.78a436.91 436.91 0 0 1 88.18 0C318.22 223 332.85 223 349.31 223c52.33 0 65.22 77.53 83.87 144.45 17.26 62.15-5.52 63.67-33.95 63.73-42.15-1.57-65.49-32.18-65.49-62.79-39.25 6.43-101.93 8.79-155.55 0 0 30.61-23.34 61.22-65.49 62.79-28.42-.06-51.2-1.58-33.94-63.73 18.67-67 31.56-144.45 83.88-144.45zM256 270.79s-44.38 40.77-52.35 55.21l29-1.17v25.32c0 1.55 21.34.16 23.33.16 11.65.54 23.31 1 23.31-.16v-25.28l29 1.17c-8-14.48-52.35-55.24-52.35-55.24z"],
"itunes": [448, 512, [], "f3b4", "M223.6 80.3C129 80.3 52.5 157 52.5 251.5S129 422.8 223.6 422.8s171.2-76.7 171.2-171.2c0-94.6-76.7-171.3-171.2-171.3zm79.4 240c-3.2 13.6-13.5 21.2-27.3 23.8-12.1 2.2-22.2 2.8-31.9-5-11.8-10-12-26.4-1.4-36.8 8.4-8 20.3-9.6 38-12.8 3-.5 5.6-1.2 7.7-3.7 3.2-3.6 2.2-2 2.2-80.8 0-5.6-2.7-7.1-8.4-6.1-4 .7-91.9 17.1-91.9 17.1-5 1.1-6.7 2.6-6.7 8.3 0 116.1.5 110.8-1.2 118.5-2.1 9-7.6 15.8-14.9 19.6-8.3 4.6-23.4 6.6-31.4 5.2-21.4-4-28.9-28.7-14.4-42.9 8.4-8 20.3-9.6 38-12.8 3-.5 5.6-1.2 7.7-3.7 5-5.7.9-127 2.6-133.7.4-2.6 1.5-4.8 3.5-6.4 2.1-1.7 5.8-2.7 6.7-2.7 101-19 113.3-21.4 115.1-21.4 5.7-.4 9 3 9 8.7-.1 170.6.4 161.4-1 167.6zM345.2 32H102.8C45.9 32 0 77.9 0 134.8v242.4C0 434.1 45.9 480 102.8 480h242.4c57 0 102.8-45.9 102.8-102.8V134.8C448 77.9 402.1 32 345.2 32zM223.6 444c-106.3 0-192.5-86.2-192.5-192.5S117.3 59 223.6 59s192.5 86.2 192.5 192.5S329.9 444 223.6 444z"],
"itunes-note": [384, 512, [], "f3b5", "M381.9 388.2c-6.4 27.4-27.2 42.8-55.1 48-24.5 4.5-44.9 5.6-64.5-10.2-23.9-20.1-24.2-53.4-2.7-74.4 17-16.2 40.9-19.5 76.8-25.8 6-1.1 11.2-2.5 15.6-7.4 6.4-7.2 4.4-4.1 4.4-163.2 0-11.2-5.5-14.3-17-12.3-8.2 1.4-185.7 34.6-185.7 34.6-10.2 2.2-13.4 5.2-13.4 16.7 0 234.7 1.1 223.9-2.5 239.5-4.2 18.2-15.4 31.9-30.2 39.5-16.8 9.3-47.2 13.4-63.4 10.4-43.2-8.1-58.4-58-29.1-86.6 17-16.2 40.9-19.5 76.8-25.8 6-1.1 11.2-2.5 15.6-7.4 10.1-11.5 1.8-256.6 5.2-270.2.8-5.2 3-9.6 7.1-12.9 4.2-3.5 11.8-5.5 13.4-5.5 204-38.2 228.9-43.1 232.4-43.1 11.5-.8 18.1 6 18.1 17.6.2 344.5 1.1 326-1.8 338.5z"],
"java": [384, 512, [], "f4e4", "M277.74 312.9c9.8-6.7 23.4-12.5 23.4-12.5s-38.7 7-77.2 10.2c-47.1 3.9-97.7 4.7-123.1 1.3-60.1-8 33-30.1 33-30.1s-36.1-2.4-80.6 19c-52.5 25.4 130 37 224.5 12.1zm-85.4-32.1c-19-42.7-83.1-80.2 0-145.8C296 53.2 242.84 0 242.84 0c21.5 84.5-75.6 110.1-110.7 162.6-23.9 35.9 11.7 74.4 60.2 118.2zm114.6-176.2c.1 0-175.2 43.8-91.5 140.2 24.7 28.4-6.5 54-6.5 54s62.7-32.4 33.9-72.9c-26.9-37.8-47.5-56.6 64.1-121.3zm-6.1 270.5a12.19 12.19 0 0 1-2 2.6c128.3-33.7 81.1-118.9 19.8-97.3a17.33 17.33 0 0 0-8.2 6.3 70.45 70.45 0 0 1 11-3c31-6.5 75.5 41.5-20.6 91.4zM348 437.4s14.5 11.9-15.9 21.2c-57.9 17.5-240.8 22.8-291.6.7-18.3-7.9 16-19 26.8-21.3 11.2-2.4 17.7-2 17.7-2-20.3-14.3-131.3 28.1-56.4 40.2C232.84 509.4 401 461.3 348 437.4zM124.44 396c-78.7 22 47.9 67.4 148.1 24.5a185.89 185.89 0 0 1-28.2-13.8c-44.7 8.5-65.4 9.1-106 4.5-33.5-3.8-13.9-15.2-13.9-15.2zm179.8 97.2c-78.7 14.8-175.8 13.1-233.3 3.6 0-.1 11.8 9.7 72.4 13.6 92.2 5.9 233.8-3.3 237.1-46.9 0 0-6.4 16.5-76.2 29.7zM260.64 353c-59.2 11.4-93.5 11.1-136.8 6.6-33.5-3.5-11.6-19.7-11.6-19.7-86.8 28.8 48.2 61.4 169.5 25.9a60.37 60.37 0 0 1-21.1-12.8z"],
"jedi-order": [448, 512, [], "f50e", "M398.5 373.6c95.9-122.1 17.2-233.1 17.2-233.1 45.4 85.8-41.4 170.5-41.4 170.5 105-171.5-60.5-271.5-60.5-271.5 96.9 72.7-10.1 190.7-10.1 190.7 85.8 158.4-68.6 230.1-68.6 230.1s-.4-16.9-2.2-85.7c4.3 4.5 34.5 36.2 34.5 36.2l-24.2-47.4 62.6-9.1-62.6-9.1 20.2-55.5-31.4 45.9c-2.2-87.7-7.8-305.1-7.9-306.9v-2.4 1-1 2.4c0 1-5.6 219-7.9 306.9l-31.4-45.9 20.2 55.5-62.6 9.1 62.6 9.1-24.2 47.4 34.5-36.2c-1.8 68.8-2.2 85.7-2.2 85.7s-154.4-71.7-68.6-230.1c0 0-107-118.1-10.1-190.7 0 0-165.5 99.9-60.5 271.5 0 0-86.8-84.8-41.4-170.5 0 0-78.7 111 17.2 233.1 0 0-26.2-16.1-49.4-77.7 0 0 16.9 183.3 222 185.7h4.1c205-2.4 222-185.7 222-185.7-23.6 61.5-49.9 77.7-49.9 77.7z"],
"jenkins": [512, 512, [], "f3b6", "M487.1 425c-1.4-11.2-19-23.1-28.2-31.9-5.1-5-29-23.1-30.4-29.9-1.4-6.6 9.7-21.5 13.3-28.9 5.1-10.7 8.8-23.7 11.3-32.6 18.8-66.1 20.7-156.9-6.2-211.2-10.2-20.6-38.6-49-56.4-62.5-42-31.7-119.6-35.3-170.1-16.6-14.1 5.2-27.8 9.8-40.1 17.1-33.1 19.4-68.3 32.5-78.1 71.6-24.2 10.8-31.5 41.8-30.3 77.8.2 7 4.1 15.8 2.7 22.4-.7 3.3-5.2 7.6-6.1 9.8-11.6 27.7-2.3 64 11.1 83.7 8.1 11.9 21.5 22.4 39.2 25.2.7 10.6 3.3 19.7 8.2 30.4 3.1 6.8 14.7 19 10.4 27.7-2.2 4.4-21 13.8-27.3 17.6C89 407.2 73.7 415 54.2 429c-12.6 9-32.3 10.2-29.2 31.1 2.1 14.1 10.1 31.6 14.7 45.8.7 2 1.4 4.1 2.1 6h422c4.9-15.3 9.7-30.9 14.6-47.2 3.4-11.4 10.2-27.8 8.7-39.7zM205.9 33.7c1.8-.5 3.4.7 4.9 2.4-.2 5.2-5.4 5.1-8.9 6.8-5.4 6.7-13.4 9.8-20 17.2-6.8 7.5-14.4 27.7-23.4 30-4.5 1.1-9.7-.8-13.6-.5-10.4.7-17.7 6-28.3 7.5 13.6-29.9 56.1-54 89.3-63.4zm-104.8 93.6c13.5-14.9 32.1-24.1 54.8-25.9 11.7 29.7-8.4 65-.9 97.6 2.3 9.9 10.2 25.4-2.4 25.7.3-28.3-34.8-46.3-61.3-29.6-1.8-21.5-4.9-51.7 9.8-67.8zm36.7 200.2c-1-4.1-2.7-12.9-2.3-15.1 1.6-8.7 17.1-12.5 11-24.7-11.3-.1-13.8 10.2-24.1 11.3-26.7 2.6-45.6-35.4-44.4-58.4 1-19.5 17.6-38.2 40.1-35.8 16 1.8 21.4 19.2 24.5 34.7 9.2.5 22.5-.4 26.9-7.6-.6-17.5-8.8-31.6-8.2-47.7 1-30.3 17.5-57.6 4.8-87.4 13.6-30.9 53.5-55.3 83.1-70 36.6-18.3 94.9-3.7 129.3 15.8 19.7 11.1 34.4 32.7 48.3 50.7-19.5-5.8-36.1 4.2-33.1 20.3 16.3-14.9 44.2-.2 52.5 16.4 7.9 15.8 7.8 39.3 9 62.8 2.9 57-10.4 115.9-39.1 157.1-7.7 11-14.1 23-24.9 30.6-26 18.2-65.4 34.7-99.2 23.4-44.7-15-65-44.8-89.5-78.8.7 18.7 13.8 34.1 26.8 48.4 11.3 12.5 25 26.6 39.7 32.4-12.3-2.9-31.1-3.8-36.2 7.2-28.6-1.9-55.1-4.8-68.7-24.2-10.6-15.4-21.4-41.4-26.3-61.4zm222 124.1c4.1-3 11.1-2.9 17.4-3.6-5.4-2.7-13-3.7-19.3-2.2-.1-4.2-2-6.8-3.2-10.2 10.6-3.8 35.5-28.5 49.6-20.3 6.7 3.9 9.5 26.2 10.1 37 .4 9-.8 18-4.5 22.8-18.8-.6-35.8-2.8-50.7-7 .9-6.1-1-12.1.6-16.5zm-17.2-20c-16.8.8-26-1.2-38.3-10.8.2-.8 1.4-.5 1.5-1.4 18 8 40.8-3.3 59-4.9-7.9 5.1-14.6 11.6-22.2 17.1zm-12.1 33.2c-1.6-9.4-3.5-12-2.8-20.2 25-16.6 29.7 28.6 2.8 20.2zM226 438.6c-11.6-.7-48.1-14-38.5-23.7 9.4 6.5 27.5 4.9 41.3 7.3.8 4.4-2.8 10.2-2.8 16.4zM57.7 497.1c-4.3-12.7-9.2-25.1-14.8-36.9 30.8-23.8 65.3-48.9 102.2-63.5 2.8-1.1 23.2 25.4 26.2 27.6 16.5 11.7 37 21 56.2 30.2 1.2 8.8 3.9 20.2 8.7 35.5.7 2.3 1.4 4.7 2.2 7.2H57.7zm240.6 5.7h-.8c.3-.2.5-.4.8-.5v.5zm7.5-5.7c2.1-1.4 4.3-2.8 6.4-4.3 1.1 1.4 2.2 2.8 3.2 4.3h-9.6zm15.1-24.7c-10.8 7.3-20.6 18.3-33.3 25.2-6 3.3-27 11.7-33.4 10.2-3.6-.8-3.9-5.3-5.4-9.5-3.1-9-10.1-23.4-10.8-37-.8-17.2-2.5-46 16-42.4 14.9 2.9 32.3 9.7 43.9 16.1 7.1 3.9 11.1 8.6 21.9 9.5-.1 1.4-.1 2.8-.2 4.3-5.9 3.9-15.3 3.8-21.8 7.1 9.5.4 17 2.7 23.5 5.9-.1 3.4-.3 7-.4 10.6zm53.4 24.7h-14c-.1-3.2-2.8-5.8-6.1-5.8s-5.9 2.6-6.1 5.8h-17.4c-2.8-4.4-5.7-8.6-8.9-12.5 2.1-2.2 4-4.7 6-6.9 9 3.7 14.8-4.9 21.7-4.2 7.9.8 14.2 11.7 25.4 11l-.6 12.6zm8.7 0c.2-4 .4-7.8.6-11.5 15.6-7.3 29 1.3 35.7 11.5H383zm83.4-37c-2.3 11.2-5.8 24-9.9 37.1-.2-.1-.4-.1-.6-.1H428c.6-1.1 1.2-2.2 1.9-3.3-2.6-6.1-9-8.7-10.9-15.5 12.1-22.7 6.5-93.4-24.2-78.5 4.3-6.3 15.6-11.5 20.8-19.3 13 10.4 20.8 20.3 33.2 31.4 6.8 6 20 13.3 21.4 23.1.8 5.5-2.6 18.9-3.8 25.1zM222.2 130.5c5.4-14.9 27.2-34.7 45-32 7.7 1.2 18 8.2 12.2 17.7-30.2-7-45.2 12.6-54.4 33.1-8.1-2-4.9-13.1-2.8-18.8zm184.1 63.1c8.2-3.6 22.4-.7 29.6-5.3-4.2-11.5-10.3-21.4-9.3-37.7.5 0 1 0 1.4.1 6.8 14.2 12.7 29.2 21.4 41.7-5.7 13.5-43.6 25.4-43.1 1.2zm20.4-43zm-117.2 45.7c-6.8-10.9-19-32.5-14.5-45.3 6.5 11.9 8.6 24.4 17.8 33.3 4.1 4 12.2 9 8.2 20.2-.9 2.7-7.8 8.6-11.7 9.7-14.4 4.3-47.9.9-36.6-17.1 11.9.7 27.9 7.8 36.8-.8zm27.3 70c3.8 6.6 1.4 18.7 12.1 20.6 20.2 3.4 43.6-12.3 58.1-17.8 9-15.2-.8-20.7-8.9-30.5-16.6-20-38.8-44.8-38-74.7 6.7-4.9 7.3 7.4 8.2 9.7 8.7 20.3 30.4 46.2 46.3 63.5 3.9 4.3 10.3 8.4 11 11.2 2.1 8.2-5.4 18-4.5 23.5-21.7 13.9-45.8 29.1-81.4 25.6-7.4-6.7-10.3-21.4-2.9-31.1zm-201.3-9.2c-6.8-3.9-8.4-21-16.4-21.4-11.4-.7-9.3 22.2-9.3 35.5-7.8-7.1-9.2-29.1-3.5-40.3-6.6-3.2-9.5 3.6-13.1 5.9 4.7-34.1 49.8-15.8 42.3 20.3zm299.6 28.8c-10.1 19.2-24.4 40.4-54 41-.6-6.2-1.1-15.6 0-19.4 22.7-2.2 36.6-13.7 54-21.6zm-141.9 12.4c18.9 9.9 53.6 11 79.3 10.2 1.4 5.6 1.3 12.6 1.4 19.4-33 1.8-72-6.4-80.7-29.6zm92.2 46.7c-1.7 4.3-5.3 9.3-9.8 11.1-12.1 4.9-45.6 8.7-62.4-.3-10.7-5.7-17.5-18.5-23.4-26-2.8-3.6-16.9-12.9-.2-12.9 13.1 32.7 58 29 95.8 28.1z"],
"jira": [496, 512, [], "f7b1", "M490 241.7C417.1 169 320.6 71.8 248.5 0 83 164.9 6 241.7 6 241.7c-7.9 7.9-7.9 20.7 0 28.7C138.8 402.7 67.8 331.9 248.5 512c379.4-378 15.7-16.7 241.5-241.7 8-7.9 8-20.7 0-28.6zm-241.5 90l-76-75.7 76-75.7 76 75.7-76 75.7z"],
"joget": [496, 512, [], "f3b7", "M378.1 45C337.6 19.9 292.6 8 248.2 8 165 8 83.8 49.9 36.9 125.9c-71.9 116.6-35.6 269.3 81 341.2s269.3 35.6 341.2-80.9c71.9-116.6 35.6-269.4-81-341.2zm51.8 323.2c-40.4 65.5-110.4 101.5-182 101.5-6.8 0-13.6-.4-20.4-1-9-13.6-19.9-33.3-23.7-42.4-5.7-13.7-27.2-45.6 31.2-67.1 51.7-19.1 176.7-16.5 208.8-17.6-4 9-8.6 17.9-13.9 26.6zm-200.8-86.3c-55.5-1.4-81.7-20.8-58.5-48.2s51.1-40.7 68.9-51.2c17.9-10.5 27.3-33.7-23.6-29.7C87.3 161.5 48.6 252.1 37.6 293c-8.8-49.7-.1-102.7 28.5-149.1C128 43.4 259.6 12.2 360.1 74.1c74.8 46.1 111.2 130.9 99.3 212.7-24.9-.5-179.3-3.6-230.3-4.9zm183.8-54.8c-22.7-6-57 11.3-86.7 27.2-29.7 15.8-31.1 8.2-31.1 8.2s40.2-28.1 50.7-34.5 31.9-14 13.4-24.6c-3.2-1.8-6.7-2.7-10.4-2.7-17.8 0-41.5 18.7-67.5 35.6-31.5 20.5-65.3 31.3-65.3 31.3l169.5-1.6 46.5-23.4s3.6-9.5-19.1-15.5z"],
"joomla": [448, 512, [], "f1aa", "M.6 92.1C.6 58.8 27.4 32 60.4 32c30 0 54.5 21.9 59.2 50.2 32.6-7.6 67.1.6 96.5 30l-44.3 44.3c-20.5-20.5-42.6-16.3-55.4-3.5-14.3 14.3-14.3 37.9 0 52.2l99.5 99.5-44 44.3c-87.7-87.2-49.7-49.7-99.8-99.7-26.8-26.5-35-64.8-24.8-98.9C20.4 144.6.6 120.7.6 92.1zm129.5 116.4l44.3 44.3c10-10 89.7-89.7 99.7-99.8 14.3-14.3 37.6-14.3 51.9 0 12.8 12.8 17 35-3.5 55.4l44 44.3c31.2-31.2 38.5-67.6 28.9-101.2 29.2-4.1 51.9-29.2 51.9-59.5 0-33.2-26.8-60.1-59.8-60.1-30.3 0-55.4 22.5-59.5 51.6-33.8-9.9-71.7-1.5-98.3 25.1-18.3 19.1-71.1 71.5-99.6 99.9zm266.3 152.2c8.2-32.7-.9-68.5-26.3-93.9-11.8-12.2 5 4.7-99.5-99.7l-44.3 44.3 99.7 99.7c14.3 14.3 14.3 37.6 0 51.9-12.8 12.8-35 17-55.4-3.5l-44 44.3c27.6 30.2 68 38.8 102.7 28 5.5 27.4 29.7 48.1 58.9 48.1 33 0 59.8-26.8 59.8-60.1 0-30.2-22.5-55-51.6-59.1zm-84.3-53.1l-44-44.3c-87 86.4-50.4 50.4-99.7 99.8-14.3 14.3-37.6 14.3-51.9 0-13.1-13.4-16.9-35.3 3.2-55.4l-44-44.3c-30.2 30.2-38 65.2-29.5 98.3-26.7 6-46.2 29.9-46.2 58.2C0 453.2 26.8 480 59.8 480c28.6 0 52.5-19.8 58.6-46.7 32.7 8.2 68.5-.6 94.2-26 32.1-32 12.2-12.4 99.5-99.7z"],
"js": [448, 512, [], "f3b8", "M0 32v448h448V32H0zm243.8 349.4c0 43.6-25.6 63.5-62.9 63.5-33.7 0-53.2-17.4-63.2-38.5l34.3-20.7c6.6 11.7 12.6 21.6 27.1 21.6 13.8 0 22.6-5.4 22.6-26.5V237.7h42.1v143.7zm99.6 63.5c-39.1 0-64.4-18.6-76.7-43l34.3-19.8c9 14.7 20.8 25.6 41.5 25.6 17.4 0 28.6-8.7 28.6-20.8 0-14.4-11.4-19.5-30.7-28l-10.5-4.5c-30.4-12.9-50.5-29.2-50.5-63.5 0-31.6 24.1-55.6 61.6-55.6 26.8 0 46 9.3 59.8 33.7L368 290c-7.2-12.9-15-18-27.1-18-12.3 0-20.1 7.8-20.1 18 0 12.6 7.8 17.7 25.9 25.6l10.5 4.5c35.8 15.3 55.9 31 55.9 66.2 0 37.8-29.8 58.6-69.7 58.6z"],
"js-square": [448, 512, [], "f3b9", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM243.8 381.4c0 43.6-25.6 63.5-62.9 63.5-33.7 0-53.2-17.4-63.2-38.5l34.3-20.7c6.6 11.7 12.6 21.6 27.1 21.6 13.8 0 22.6-5.4 22.6-26.5V237.7h42.1v143.7zm99.6 63.5c-39.1 0-64.4-18.6-76.7-43l34.3-19.8c9 14.7 20.8 25.6 41.5 25.6 17.4 0 28.6-8.7 28.6-20.8 0-14.4-11.4-19.5-30.7-28l-10.5-4.5c-30.4-12.9-50.5-29.2-50.5-63.5 0-31.6 24.1-55.6 61.6-55.6 26.8 0 46 9.3 59.8 33.7L368 290c-7.2-12.9-15-18-27.1-18-12.3 0-20.1 7.8-20.1 18 0 12.6 7.8 17.7 25.9 25.6l10.5 4.5c35.8 15.3 55.9 31 55.9 66.2 0 37.8-29.8 58.6-69.7 58.6z"],
"jsfiddle": [576, 512, [], "f1cc", "M510.634 237.462c-4.727-2.621-5.664-5.748-6.381-10.776-2.352-16.488-3.539-33.619-9.097-49.095-35.895-99.957-153.99-143.386-246.849-91.646-27.37 15.25-48.971 36.369-65.493 63.903-3.184-1.508-5.458-2.71-7.824-3.686-30.102-12.421-59.049-10.121-85.331 9.167-25.531 18.737-36.422 44.548-32.676 76.408.355 3.025-1.967 7.621-4.514 9.545-39.712 29.992-56.031 78.065-41.902 124.615 13.831 45.569 57.514 79.796 105.608 81.433 30.291 1.031 60.637.546 90.959.539 84.041-.021 168.09.531 252.12-.48 52.664-.634 96.108-36.873 108.212-87.293 11.54-48.074-11.144-97.3-56.832-122.634zm21.107 156.88c-18.23 22.432-42.343 35.253-71.28 35.65-56.874.781-113.767.23-170.652.23 0 .7-163.028.159-163.728.154-43.861-.332-76.739-19.766-95.175-59.995-18.902-41.245-4.004-90.848 34.186-116.106 9.182-6.073 12.505-11.566 10.096-23.136-5.49-26.361 4.453-47.956 26.42-62.981 22.987-15.723 47.422-16.146 72.034-3.083 10.269 5.45 14.607 11.564 22.198-2.527 14.222-26.399 34.557-46.727 60.671-61.294 97.46-54.366 228.37 7.568 230.24 132.697.122 8.15 2.412 12.428 9.848 15.894 57.56 26.829 74.456 96.122 35.142 144.497zm-87.789-80.499c-5.848 31.157-34.622 55.096-66.666 55.095-16.953-.001-32.058-6.545-44.079-17.705-27.697-25.713-71.141-74.98-95.937-93.387-20.056-14.888-41.99-12.333-60.272 3.782-49.996 44.071 15.859 121.775 67.063 77.188 4.548-3.96 7.84-9.543 12.744-12.844 8.184-5.509 20.766-.884 13.168 10.622-17.358 26.284-49.33 38.197-78.863 29.301-28.897-8.704-48.84-35.968-48.626-70.179 1.225-22.485 12.364-43.06 35.414-55.965 22.575-12.638 46.369-13.146 66.991 2.474C295.68 280.7 320.467 323.97 352.185 343.47c24.558 15.099 54.254 7.363 68.823-17.506 28.83-49.209-34.592-105.016-78.868-63.46-3.989 3.744-6.917 8.932-11.41 11.72-10.975 6.811-17.333-4.113-12.809-10.353 20.703-28.554 50.464-40.44 83.271-28.214 31.429 11.714 49.108 44.366 42.76 78.186z"],
"kaggle": [320, 512, [], "f5fa", "M304.2 501.5L158.4 320.3 298.2 185c2.6-2.7 1.7-10.5-5.3-10.5h-69.2c-3.5 0-7 1.8-10.5 5.3L80.9 313.5V7.5q0-7.5-7.5-7.5H21.5Q14 0 14 7.5v497q0 7.5 7.5 7.5h51.9q7.5 0 7.5-7.5v-109l30.8-29.3 110.5 140.6c3 3.5 6.5 5.3 10.5 5.3h66.9q5.25 0 6-3z"],
"keybase": [448, 512, [], "f4f5", "M195.21 430.7a17.8 17.8 0 1 1-17.8-17.8 17.84 17.84 0 0 1 17.8 17.8zM288 412.8a17.8 17.8 0 1 0 17.8 17.8 17.84 17.84 0 0 0-17.8-17.8zm142.3-36c0 38.9-7.6 73.9-22.2 103h-27.3c23.5-38.7 30.5-94.8 22.4-134.3-16.1 29.5-52.1 38.6-85.9 28.8-127.8-37.5-192.5 19.7-234.6 50.3l18.9-59.3-39.9 42.3a173.31 173.31 0 0 0 31.2 72.3H64.11a197.27 197.27 0 0 1-22.2-51.3l-23.8 25.2c0-74.9-5.5-147.6 61.5-215.2a210.67 210.67 0 0 1 69.1-46.7c-6.8-13.5-9.5-29.2-7.8-46L121 144.7a32.68 32.68 0 0 1-30.6-34.4v-.1L92 84a32.75 32.75 0 0 1 32.5-30.6c1.3 0-.3-.1 28.2 1.7a32 32 0 0 1 22.8 11.4C182.61 56.1 190 46 200.11 32l20.6 12.1c-13.6 29-9.1 36.2-9 36.3 3.9 0 13.9-.5 32.4 5.7a76.19 76.19 0 0 1 46.1 102.3c19 6.1 51.3 19.9 82.4 51.8 36.6 37.6 57.7 87.4 57.7 136.6zM146 122.1a162.36 162.36 0 0 1 13.1-29.4c.1-2 2.2-13.1-7.8-13.8-28.5-1.8-26.3-1.6-26.7-1.6a8.57 8.57 0 0 0-8.6 8.1l-1.6 26.2a8.68 8.68 0 0 0 8.1 9.1zm25.8 61.8a52.3 52.3 0 0 0 22.3 20c0-21.2 28.5-41.9 52.8-17.5l8.4 10.3c20.8-18.8 19.4-45.3 12.1-60.9-13.8-29.1-46.9-32-54.3-31.7a24.24 24.24 0 0 1-23.7-15.3c-13.69 21.2-37.19 62.5-17.59 95.1zm82.9 68.4L235 268.4a4.46 4.46 0 0 0-.6 6.3l8.9 10.9a4.48 4.48 0 0 0 6.3.6l19.6-16 5.5 6.8c4.9 6 13.8-1.4 9-7.3-63.6-78.3-41.5-51.1-55.3-68.1-4.7-6-13.9 1.4-9 7.3 1.9 2.3 18.4 22.6 19.8 24.3l-9.6 7.9c-4.6 3.8 2.6 13.3 7.4 9.4l9.7-8 8 9.8zM373.11 278c-16.9-23.7-42.6-46.7-73.4-60.4a213.21 213.21 0 0 0-22.9-8.6 62.47 62.47 0 0 1-6.4 6.2l31.9 39.2a29.81 29.81 0 0 1-4.2 41.9c-1.3 1.1-13.1 10.7-29 4.9-2.9 2.3-10.1 9.9-22.2 9.9a28.42 28.42 0 0 1-22.1-10.5l-8.9-10.9a28.52 28.52 0 0 1-5-26.8 28.56 28.56 0 0 1-4.6-30c-7.2-1.3-26.7-6.2-42.7-21.4-55.8 20.7-88 64.4-101.3 91.2-14.9 30.2-18.8 60.9-19.9 90.2 8.2-8.7-3.9 4.1 114-120.9l-29.9 93.6c57.8-31.1 124-36 197.4-14.4 23.6 6.9 45.1 1.6 56-13.9 11.1-15.6 8.5-37.7-6.8-59.3zm-244.5-170.9l15.6 1 1-15.6-15.6-1z"],
"keycdn": [512, 512, [], "f3ba", "M63.8 409.3l60.5-59c32.1 42.8 71.1 66 126.6 67.4 30.5.7 60.3-7 86.4-22.4 5.1 5.3 18.5 19.5 20.9 22-32.2 20.7-69.6 31.1-108.1 30.2-43.3-1.1-84.6-16.7-117.7-44.4.3-.6-38.2 37.5-38.6 37.9 9.5 29.8-13.1 62.4-46.3 62.4C20.7 503.3 0 481.7 0 454.9c0-34.3 33.1-56.6 63.8-45.6zm354.9-252.4c19.1 31.3 29.6 67.4 28.7 104-1.1 44.8-19 87.5-48.6 121 .3.3 23.8 25.2 24.1 25.5 9.6-1.3 19.2 2 25.9 9.1 11.3 12 10.9 30.9-1.1 42.4-12 11.3-30.9 10.9-42.4-1.1-6.7-7-9.4-16.8-7.6-26.3-24.9-26.6-44.4-47.2-44.4-47.2 42.7-34.1 63.3-79.6 64.4-124.2.7-28.9-7.2-57.2-21.1-82.2l22.1-21zM104 53.1c6.7 7 9.4 16.8 7.6 26.3l45.9 48.1c-4.7 3.8-13.3 10.4-22.8 21.3-25.4 28.5-39.6 64.8-40.7 102.9-.7 28.9 6.1 57.2 20 82.4l-22 21.5C72.7 324 63.1 287.9 64.2 250.9c1-44.6 18.3-87.6 47.5-121.1l-25.3-26.4c-9.6 1.3-19.2-2-25.9-9.1-11.3-12-10.9-30.9 1.1-42.4C73.5 40.7 92.2 41 104 53.1zM464.9 8c26 0 47.1 22.4 47.1 48.3S490.9 104 464.9 104c-6.3.1-14-1.1-15.9-1.8l-62.9 59.7c-32.7-43.6-76.7-65.9-126.9-67.2-30.5-.7-60.3 6.8-86.2 22.4l-21.1-22C184.1 74.3 221.5 64 260 64.9c43.3 1.1 84.6 16.7 117.7 44.6l41.1-38.6c-1.5-4.7-2.2-9.6-2.2-14.5C416.5 29.7 438.9 8 464.9 8zM256.7 113.4c5.5 0 10.9.4 16.4 1.1 78.1 9.8 133.4 81.1 123.8 159.1-9.8 78.1-81.1 133.4-159.1 123.8-78.1-9.8-133.4-81.1-123.8-159.2 9.3-72.4 70.1-124.6 142.7-124.8zm-59 119.4c.6 22.7 12.2 41.8 32.4 52.2l-11 51.7h73.7l-11-51.7c20.1-10.9 32.1-29 32.4-52.2-.4-32.8-25.8-57.5-58.3-58.3-32.1.8-57.3 24.8-58.2 58.3zM256 160"],
"kickstarter": [448, 512, [], "f3bb", "M400 480H48c-26.4 0-48-21.6-48-48V80c0-26.4 21.6-48 48-48h352c26.4 0 48 21.6 48 48v352c0 26.4-21.6 48-48 48zM199.6 178.5c0-30.7-17.6-45.1-39.7-45.1-25.8 0-40 19.8-40 44.5v154.8c0 25.8 13.7 45.6 40.5 45.6 21.5 0 39.2-14 39.2-45.6v-41.8l60.6 75.7c12.3 14.9 39 16.8 55.8 0 14.6-15.1 14.8-36.8 4-50.4l-49.1-62.8 40.5-58.7c9.4-13.5 9.5-34.5-5.6-49.1-16.4-15.9-44.6-17.3-61.4 7l-44.8 64.7v-38.8z"],
"kickstarter-k": [384, 512, [], "f3bc", "M147.3 114.4c0-56.2-32.5-82.4-73.4-82.4C26.2 32 0 68.2 0 113.4v283c0 47.3 25.3 83.4 74.9 83.4 39.8 0 72.4-25.6 72.4-83.4v-76.5l112.1 138.3c22.7 27.2 72.1 30.7 103.2 0 27-27.6 27.3-67.4 7.4-92.2l-90.8-114.8 74.9-107.4c17.4-24.7 17.5-63.1-10.4-89.8-30.3-29-82.4-31.6-113.6 12.8L147.3 185v-70.6z"],
"korvue": [446, 512, [], "f42f", "M386.5 34h-327C26.8 34 0 60.8 0 93.5v327.1C0 453.2 26.8 480 59.5 480h327.1c33 0 59.5-26.8 59.5-59.5v-327C446 60.8 419.2 34 386.5 34zM87.1 120.8h96v116l61.8-116h110.9l-81.2 132H87.1v-132zm161.8 272.1l-65.7-113.6v113.6h-96V262.1h191.5l88.6 130.8H248.9z"],
"laravel": [640, 512, [], "f3bd", "M637.5 241.6c-4.2-4.8-62.8-78.1-73.1-90.5-10.3-12.4-15.4-10.2-21.7-9.3-6.4.9-80.5 13.4-89.1 14.8-8.6 1.5-14 4.9-8.7 12.3 4.7 6.6 53.4 75.7 64.2 90.9l-193.7 46.4L161.2 48.7c-6.1-9.1-7.4-12.3-21.4-11.6-14 .6-120.9 9.5-128.5 10.2-7.6.6-16 4-8.4 22s129 279.6 132.4 287.2c3.4 7.6 12.2 20 32.8 15 21.1-5.1 94.3-24.2 134.3-34.7 21.1 38.3 64.2 115.9 72.2 127 10.6 14.9 18 12.4 34.3 7.4 12.8-3.9 199.6-71.1 208-74.5 8.4-3.5 13.6-5.9 7.9-14.4-4.2-6.2-53.5-72.2-79.3-106.8 17.7-4.7 80.6-21.4 87.3-23.3 7.9-2 9-5.8 4.7-10.6zm-352.2 72c-2.3.5-110.8 26.5-116.6 27.8-5.8 1.3-5.8.7-6.5-1.3-.7-2-129-266.7-130.8-270-1.8-3.3-1.7-5.9 0-5.9s102.5-9 106-9.2c3.6-.2 3.2.6 4.5 2.8 0 0 142.2 245.4 144.6 249.7 2.6 4.3 1.1 5.6-1.2 6.1zm306 57.4c1.7 2.7 3.5 4.5-2 6.4-5.4 2-183.7 62.1-187.1 63.6-3.5 1.5-6.2 2-10.6-4.5s-62.4-106.8-62.4-106.8L518 280.6c4.7-1.5 6.2-2.5 9.2 2.2 2.9 4.8 62.4 85.5 64.1 88.2zm12.1-134.1c-4.2.9-73.6 18.1-73.6 18.1l-56.7-77.8c-1.6-2.3-2.9-4.5 1.1-5s68.4-12.2 71.3-12.8c2.9-.7 5.4-1.5 9 3.4 3.6 4.9 52.6 67 54.5 69.4 1.8 2.3-1.4 3.7-5.6 4.7z"],
"lastfm": [512, 512, [], "f202", "M225.8 367.1l-18.8-51s-30.5 34-76.2 34c-40.5 0-69.2-35.2-69.2-91.5 0-72.1 36.4-97.9 72.1-97.9 66.5 0 74.8 53.3 100.9 134.9 18.8 56.9 54 102.6 155.4 102.6 72.7 0 122-22.3 122-80.9 0-72.9-62.7-80.6-115-92.1-25.8-5.9-33.4-16.4-33.4-34 0-19.9 15.8-31.7 41.6-31.7 28.2 0 43.4 10.6 45.7 35.8l58.6-7c-4.7-52.8-41.1-74.5-100.9-74.5-52.8 0-104.4 19.9-104.4 83.9 0 39.9 19.4 65.1 68 76.8 44.9 10.6 79.8 13.8 79.8 45.7 0 21.7-21.1 30.5-61 30.5-59.2 0-83.9-31.1-97.9-73.9-32-96.8-43.6-163-161.3-163C45.7 113.8 0 168.3 0 261c0 89.1 45.7 137.2 127.9 137.2 66.2 0 97.9-31.1 97.9-31.1z"],
"lastfm-square": [448, 512, [], "f203", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-92.2 312.9c-63.4 0-85.4-28.6-97.1-64.1-16.3-51-21.5-84.3-63-84.3-22.4 0-45.1 16.1-45.1 61.2 0 35.2 18 57.2 43.3 57.2 28.6 0 47.6-21.3 47.6-21.3l11.7 31.9s-19.8 19.4-61.2 19.4c-51.3 0-79.9-30.1-79.9-85.8 0-57.9 28.6-92 82.5-92 73.5 0 80.8 41.4 100.8 101.9 8.8 26.8 24.2 46.2 61.2 46.2 24.9 0 38.1-5.5 38.1-19.1 0-19.9-21.8-22-49.9-28.6-30.4-7.3-42.5-23.1-42.5-48 0-40 32.3-52.4 65.2-52.4 37.4 0 60.1 13.6 63 46.6l-36.7 4.4c-1.5-15.8-11-22.4-28.6-22.4-16.1 0-26 7.3-26 19.8 0 11 4.8 17.6 20.9 21.3 32.7 7.1 71.8 12 71.8 57.5.1 36.7-30.7 50.6-76.1 50.6z"],
"leanpub": [576, 512, [], "f212", "M386.539 111.485l15.096 248.955-10.979-.275c-36.232-.824-71.64 8.783-102.657 27.997-31.016-19.214-66.424-27.997-102.657-27.997-45.564 0-82.07 10.705-123.516 27.723L93.117 129.6c28.546-11.803 61.484-18.115 92.226-18.115 41.173 0 73.836 13.175 102.657 42.544 27.723-28.271 59.013-41.721 98.539-42.544zM569.07 448c-25.526 0-47.485-5.215-70.542-15.645-34.31-15.645-69.993-24.978-107.871-24.978-38.977 0-74.934 12.901-102.657 40.623-27.723-27.723-63.68-40.623-102.657-40.623-37.878 0-73.561 9.333-107.871 24.978C55.239 442.236 32.731 448 8.303 448H6.93L49.475 98.859C88.726 76.626 136.486 64 181.775 64 218.83 64 256.984 71.685 288 93.095 319.016 71.685 357.17 64 394.225 64c45.289 0 93.049 12.626 132.3 34.859L569.07 448zm-43.368-44.741l-34.036-280.246c-30.742-13.999-67.248-21.41-101.009-21.41-38.428 0-74.385 12.077-102.657 38.702-28.272-26.625-64.228-38.702-102.657-38.702-33.761 0-70.267 7.411-101.009 21.41L50.298 403.259c47.211-19.487 82.894-33.486 135.045-33.486 37.604 0 70.817 9.606 102.657 29.644 31.84-20.038 65.052-29.644 102.657-29.644 52.151 0 87.834 13.999 135.045 33.486z"],
"less": [640, 512, [], "f41d", "M612.7 219c0-20.5 3.2-32.6 3.2-54.6 0-34.2-12.6-45.2-40.5-45.2h-20.5v24.2h6.3c14.2 0 17.3 4.7 17.3 22.1 0 16.3-1.6 32.6-1.6 51.5 0 24.2 7.9 33.6 23.6 37.3v1.6c-15.8 3.7-23.6 13.1-23.6 37.3 0 18.9 1.6 34.2 1.6 51.5 0 17.9-3.7 22.6-17.3 22.6v.5h-6.3V393h20.5c27.8 0 40.5-11 40.5-45.2 0-22.6-3.2-34.2-3.2-54.6 0-11 6.8-22.6 27.3-23.6v-27.3c-20.5-.7-27.3-12.3-27.3-23.3zm-105.6 32c-15.8-6.3-30.5-10-30.5-20.5 0-7.9 6.3-12.6 17.9-12.6s22.1 4.7 33.6 13.1l21-27.8c-13.1-10-31-20.5-55.2-20.5-35.7 0-59.9 20.5-59.9 49.4 0 25.7 22.6 38.9 41.5 46.2 16.3 6.3 32.1 11.6 32.1 22.1 0 7.9-6.3 13.1-20.5 13.1-13.1 0-26.3-5.3-40.5-16.3l-21 30.5c15.8 13.1 39.9 22.1 59.9 22.1 42 0 64.6-22.1 64.6-51s-22.5-41-43-47.8zm-358.9 59.4c-3.7 0-8.4-3.2-8.4-13.1V119.1H65.2c-28.4 0-41 11-41 45.2 0 22.6 3.2 35.2 3.2 54.6 0 11-6.8 22.6-27.3 23.6v27.3c20.5.5 27.3 12.1 27.3 23.1 0 19.4-3.2 31-3.2 53.6 0 34.2 12.6 45.2 40.5 45.2h20.5v-24.2h-6.3c-13.1 0-17.3-5.3-17.3-22.6s1.6-32.1 1.6-51.5c0-24.2-7.9-33.6-23.6-37.3v-1.6c15.8-3.7 23.6-13.1 23.6-37.3 0-18.9-1.6-34.2-1.6-51.5s3.7-22.1 17.3-22.1H93v150.8c0 32.1 11 53.1 43.1 53.1 10 0 17.9-1.6 23.6-3.7l-5.3-34.2c-3.1.8-4.6.8-6.2.8zM379.9 251c-16.3-6.3-31-10-31-20.5 0-7.9 6.3-12.6 17.9-12.6 11.6 0 22.1 4.7 33.6 13.1l21-27.8c-13.1-10-31-20.5-55.2-20.5-35.7 0-59.9 20.5-59.9 49.4 0 25.7 22.6 38.9 41.5 46.2 16.3 6.3 32.1 11.6 32.1 22.1 0 7.9-6.3 13.1-20.5 13.1-13.1 0-26.3-5.3-40.5-16.3l-20.5 30.5c15.8 13.1 39.9 22.1 59.9 22.1 42 0 64.6-22.1 64.6-51 .1-28.9-22.5-41-43-47.8zm-155-68.8c-38.4 0-75.1 32.1-74.1 82.5 0 52 34.2 82.5 79.3 82.5 18.9 0 39.9-6.8 56.2-17.9l-15.8-27.8c-11.6 6.8-22.6 10-34.2 10-21 0-37.3-10-41.5-34.2H290c.5-3.7 1.6-11 1.6-19.4.6-42.6-22.6-75.7-66.7-75.7zm-30 66.2c3.2-21 15.8-31 30.5-31 18.9 0 26.3 13.1 26.3 31h-56.8z"],
"line": [448, 512, [], "f3c0", "M272.1 204.2v71.1c0 1.8-1.4 3.2-3.2 3.2h-11.4c-1.1 0-2.1-.6-2.6-1.3l-32.6-44v42.2c0 1.8-1.4 3.2-3.2 3.2h-11.4c-1.8 0-3.2-1.4-3.2-3.2v-71.1c0-1.8 1.4-3.2 3.2-3.2H219c1 0 2.1.5 2.6 1.4l32.6 44v-42.2c0-1.8 1.4-3.2 3.2-3.2h11.4c1.8-.1 3.3 1.4 3.3 3.1zm-82-3.2h-11.4c-1.8 0-3.2 1.4-3.2 3.2v71.1c0 1.8 1.4 3.2 3.2 3.2h11.4c1.8 0 3.2-1.4 3.2-3.2v-71.1c0-1.7-1.4-3.2-3.2-3.2zm-27.5 59.6h-31.1v-56.4c0-1.8-1.4-3.2-3.2-3.2h-11.4c-1.8 0-3.2 1.4-3.2 3.2v71.1c0 .9.3 1.6.9 2.2.6.5 1.3.9 2.2.9h45.7c1.8 0 3.2-1.4 3.2-3.2v-11.4c0-1.7-1.4-3.2-3.1-3.2zM332.1 201h-45.7c-1.7 0-3.2 1.4-3.2 3.2v71.1c0 1.7 1.4 3.2 3.2 3.2h45.7c1.8 0 3.2-1.4 3.2-3.2v-11.4c0-1.8-1.4-3.2-3.2-3.2H301v-12h31.1c1.8 0 3.2-1.4 3.2-3.2V234c0-1.8-1.4-3.2-3.2-3.2H301v-12h31.1c1.8 0 3.2-1.4 3.2-3.2v-11.4c-.1-1.7-1.5-3.2-3.2-3.2zM448 113.7V399c-.1 44.8-36.8 81.1-81.7 81H81c-44.8-.1-81.1-36.9-81-81.7V113c.1-44.8 36.9-81.1 81.7-81H367c44.8.1 81.1 36.8 81 81.7zm-61.6 122.6c0-73-73.2-132.4-163.1-132.4-89.9 0-163.1 59.4-163.1 132.4 0 65.4 58 120.2 136.4 130.6 19.1 4.1 16.9 11.1 12.6 36.8-.7 4.1-3.3 16.1 14.1 8.8 17.4-7.3 93.9-55.3 128.2-94.7 23.6-26 34.9-52.3 34.9-81.5z"],
"linkedin": [448, 512, [], "f08c", "M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"],
"linkedin-in": [448, 512, [], "f0e1", "M100.28 448H7.4V148.9h92.88zM53.79 108.1C24.09 108.1 0 83.5 0 53.8a53.79 53.79 0 0 1 107.58 0c0 29.7-24.1 54.3-53.79 54.3zM447.9 448h-92.68V302.4c0-34.7-.7-79.2-48.29-79.2-48.29 0-55.69 37.7-55.69 76.7V448h-92.78V148.9h89.08v40.8h1.3c12.4-23.5 42.69-48.3 87.88-48.3 94 0 111.28 61.9 111.28 142.3V448z"],
"linode": [448, 512, [], "f2b8", "M437.4 226.3c-.3-.9-.9-1.4-1.4-2l-70-38.6c-.9-.6-2-.6-3.1 0l-58.9 36c-.9.6-1.4 1.7-1.4 2.6l-.9 31.4-24-16c-.9-.6-2.3-.6-3.1 0L240 260.9l-1.4-35.1c0-.9-.6-2-1.4-2.3l-36-24.3 33.7-17.4c1.1-.6 1.7-1.7 1.7-2.9l-5.7-132.3c0-.9-.9-2-1.7-2.6L138.6.3c-.9-.3-1.7-.3-2.3-.3L12.6 38.6c-1.4.6-2.3 2-2 3.7L38 175.4c.9 3.4 34 27.4 38.6 30.9l-26.9 12.9c-1.4.9-2 2.3-1.7 3.4l20.6 100.3c.6 2.9 23.7 23.1 27.1 26.3l-17.4 10.6c-.9.6-1.7 2-1.4 3.1 1.4 7.1 15.4 77.7 16.9 79.1l65.1 69.1c.6.6 1.4.6 2.3.9.6 0 1.1-.3 1.7-.6l83.7-66.9c.9-.6 1.1-1.4 1.1-2.3l-2-46 28 23.7c1.1.9 2.9.9 4 0l66.9-53.4c.9-.6 1.1-1.4 1.1-2.3l2.3-33.4 20.3 14c1.1.9 2.6.9 3.7 0l54.6-43.7c.6-.3 1.1-1.1 1.1-2 .9-6.5 10.3-70.8 9.7-72.8zm-204.8 4.8l4 92.6-90.6 61.2-14-96.6 100.6-57.2zm-7.7-180l5.4 126-106.6 55.4L104 97.7l120.9-46.6zM44 173.1L18 48l79.7 49.4 19.4 132.9L44 173.1zm30.6 147.8L55.7 230l70 58.3 13.7 93.4-64.8-60.8zm24.3 117.7l-13.7-67.1 61.7 60.9 9.7 67.4-57.7-61.2zm64.5 64.5l-10.6-70.9 85.7-61.4 3.1 70-78.2 62.3zm82-115.1c0-3.4.9-22.9-2-25.1l-24.3-20 22.3-14.9c2.3-1.7 1.1-5.7 1.1-8l29.4 22.6.6 68.3-27.1-22.9zm94.3-25.4l-60.9 48.6-.6-68.6 65.7-46.9-4.2 66.9zm27.7-25.7l-19.1-13.4 2-34c.3-.9-.3-2-1.1-2.6L308 259.7l.6-30 64.6 40.6-5.8 66.6zm54.6-39.8l-48.3 38.3 5.7-65.1 51.1-36.6-8.5 63.4z"],
"linux": [448, 512, [], "f17c", "M220.8 123.3c1 .5 1.8 1.7 3 1.7 1.1 0 2.8-.4 2.9-1.5.2-1.4-1.9-2.3-3.2-2.9-1.7-.7-3.9-1-5.5-.1-.4.2-.8.7-.6 1.1.3 1.3 2.3 1.1 3.4 1.7zm-21.9 1.7c1.2 0 2-1.2 3-1.7 1.1-.6 3.1-.4 3.5-1.6.2-.4-.2-.9-.6-1.1-1.6-.9-3.8-.6-5.5.1-1.3.6-3.4 1.5-3.2 2.9.1 1 1.8 1.5 2.8 1.4zM420 403.8c-3.6-4-5.3-11.6-7.2-19.7-1.8-8.1-3.9-16.8-10.5-22.4-1.3-1.1-2.6-2.1-4-2.9-1.3-.8-2.7-1.5-4.1-2 9.2-27.3 5.6-54.5-3.7-79.1-11.4-30.1-31.3-56.4-46.5-74.4-17.1-21.5-33.7-41.9-33.4-72C311.1 85.4 315.7.1 234.8 0 132.4-.2 158 103.4 156.9 135.2c-1.7 23.4-6.4 41.8-22.5 64.7-18.9 22.5-45.5 58.8-58.1 96.7-6 17.9-8.8 36.1-6.2 53.3-6.5 5.8-11.4 14.7-16.6 20.2-4.2 4.3-10.3 5.9-17 8.3s-14 6-18.5 14.5c-2.1 3.9-2.8 8.1-2.8 12.4 0 3.9.6 7.9 1.2 11.8 1.2 8.1 2.5 15.7.8 20.8-5.2 14.4-5.9 24.4-2.2 31.7 3.8 7.3 11.4 10.5 20.1 12.3 17.3 3.6 40.8 2.7 59.3 12.5 19.8 10.4 39.9 14.1 55.9 10.4 11.6-2.6 21.1-9.6 25.9-20.2 12.5-.1 26.3-5.4 48.3-6.6 14.9-1.2 33.6 5.3 55.1 4.1.6 2.3 1.4 4.6 2.5 6.7v.1c8.3 16.7 23.8 24.3 40.3 23 16.6-1.3 34.1-11 48.3-27.9 13.6-16.4 36-23.2 50.9-32.2 7.4-4.5 13.4-10.1 13.9-18.3.4-8.2-4.4-17.3-15.5-29.7zM223.7 87.3c9.8-22.2 34.2-21.8 44-.4 6.5 14.2 3.6 30.9-4.3 40.4-1.6-.8-5.9-2.6-12.6-4.9 1.1-1.2 3.1-2.7 3.9-4.6 4.8-11.8-.2-27-9.1-27.3-7.3-.5-13.9 10.8-11.8 23-4.1-2-9.4-3.5-13-4.4-1-6.9-.3-14.6 2.9-21.8zM183 75.8c10.1 0 20.8 14.2 19.1 33.5-3.5 1-7.1 2.5-10.2 4.6 1.2-8.9-3.3-20.1-9.6-19.6-8.4.7-9.8 21.2-1.8 28.1 1 .8 1.9-.2-5.9 5.5-15.6-14.6-10.5-52.1 8.4-52.1zm-13.6 60.7c6.2-4.6 13.6-10 14.1-10.5 4.7-4.4 13.5-14.2 27.9-14.2 7.1 0 15.6 2.3 25.9 8.9 6.3 4.1 11.3 4.4 22.6 9.3 8.4 3.5 13.7 9.7 10.5 18.2-2.6 7.1-11 14.4-22.7 18.1-11.1 3.6-19.8 16-38.2 14.9-3.9-.2-7-1-9.6-2.1-8-3.5-12.2-10.4-20-15-8.6-4.8-13.2-10.4-14.7-15.3-1.4-4.9 0-9 4.2-12.3zm3.3 334c-2.7 35.1-43.9 34.4-75.3 18-29.9-15.8-68.6-6.5-76.5-21.9-2.4-4.7-2.4-12.7 2.6-26.4v-.2c2.4-7.6.6-16-.6-23.9-1.2-7.8-1.8-15 .9-20 3.5-6.7 8.5-9.1 14.8-11.3 10.3-3.7 11.8-3.4 19.6-9.9 5.5-5.7 9.5-12.9 14.3-18 5.1-5.5 10-8.1 17.7-6.9 8.1 1.2 15.1 6.8 21.9 16l19.6 35.6c9.5 19.9 43.1 48.4 41 68.9zm-1.4-25.9c-4.1-6.6-9.6-13.6-14.4-19.6 7.1 0 14.2-2.2 16.7-8.9 2.3-6.2 0-14.9-7.4-24.9-13.5-18.2-38.3-32.5-38.3-32.5-13.5-8.4-21.1-18.7-24.6-29.9s-3-23.3-.3-35.2c5.2-22.9 18.6-45.2 27.2-59.2 2.3-1.7.8 3.2-8.7 20.8-8.5 16.1-24.4 53.3-2.6 82.4.6-20.7 5.5-41.8 13.8-61.5 12-27.4 37.3-74.9 39.3-112.7 1.1.8 4.6 3.2 6.2 4.1 4.6 2.7 8.1 6.7 12.6 10.3 12.4 10 28.5 9.2 42.4 1.2 6.2-3.5 11.2-7.5 15.9-9 9.9-3.1 17.8-8.6 22.3-15 7.7 30.4 25.7 74.3 37.2 95.7 6.1 11.4 18.3 35.5 23.6 64.6 3.3-.1 7 .4 10.9 1.4 13.8-35.7-11.7-74.2-23.3-84.9-4.7-4.6-4.9-6.6-2.6-6.5 12.6 11.2 29.2 33.7 35.2 59 2.8 11.6 3.3 23.7.4 35.7 16.4 6.8 35.9 17.9 30.7 34.8-2.2-.1-3.2 0-4.2 0 3.2-10.1-3.9-17.6-22.8-26.1-19.6-8.6-36-8.6-38.3 12.5-12.1 4.2-18.3 14.7-21.4 27.3-2.8 11.2-3.6 24.7-4.4 39.9-.5 7.7-3.6 18-6.8 29-32.1 22.9-76.7 32.9-114.3 7.2zm257.4-11.5c-.9 16.8-41.2 19.9-63.2 46.5-13.2 15.7-29.4 24.4-43.6 25.5s-26.5-4.8-33.7-19.3c-4.7-11.1-2.4-23.1 1.1-36.3 3.7-14.2 9.2-28.8 9.9-40.6.8-15.2 1.7-28.5 4.2-38.7 2.6-10.3 6.6-17.2 13.7-21.1.3-.2.7-.3 1-.5.8 13.2 7.3 26.6 18.8 29.5 12.6 3.3 30.7-7.5 38.4-16.3 9-.3 15.7-.9 22.6 5.1 9.9 8.5 7.1 30.3 17.1 41.6 10.6 11.6 14 19.5 13.7 24.6zM173.3 148.7c2 1.9 4.7 4.5 8 7.1 6.6 5.2 15.8 10.6 27.3 10.6 11.6 0 22.5-5.9 31.8-10.8 4.9-2.6 10.9-7 14.8-10.4s5.9-6.3 3.1-6.6-2.6 2.6-6 5.1c-4.4 3.2-9.7 7.4-13.9 9.8-7.4 4.2-19.5 10.2-29.9 10.2s-18.7-4.8-24.9-9.7c-3.1-2.5-5.7-5-7.7-6.9-1.5-1.4-1.9-4.6-4.3-4.9-1.4-.1-1.8 3.7 1.7 6.5z"],
"lyft": [512, 512, [], "f3c3", "M0 81.1h77.8v208.7c0 33.1 15 52.8 27.2 61-12.7 11.1-51.2 20.9-80.2-2.8C7.8 334 0 310.7 0 289V81.1zm485.9 173.5v-22h23.8v-76.8h-26.1c-10.1-46.3-51.2-80.7-100.3-80.7-56.6 0-102.7 46-102.7 102.7V357c16 2.3 35.4-.3 51.7-14 17.1-14 24.8-37.2 24.8-59v-6.7h38.8v-76.8h-38.8v-23.3c0-34.6 52.2-34.6 52.2 0v77.1c0 56.6 46 102.7 102.7 102.7v-76.5c-14.5 0-26.1-11.7-26.1-25.9zm-294.3-99v113c0 15.4-23.8 15.4-23.8 0v-113H91v132.7c0 23.8 8 54 45 63.9 37 9.8 58.2-10.6 58.2-10.6-2.1 13.4-14.5 23.3-34.9 25.3-15.5 1.6-35.2-3.6-45-7.8v70.3c25.1 7.5 51.5 9.8 77.6 4.7 47.1-9.1 76.8-48.4 76.8-100.8V155.1h-77.1v.5z"],
"magento": [448, 512, [], "f3c4", "M445.7 127.9V384l-63.4 36.5V164.7L223.8 73.1 65.2 164.7l.4 255.9L2.3 384V128.1L224.2 0l221.5 127.9zM255.6 420.5L224 438.9l-31.8-18.2v-256l-63.3 36.6.1 255.9 94.9 54.9 95.1-54.9v-256l-63.4-36.6v255.9z"],
"mailchimp": [448, 512, [], "f59e", "M232.7 73.1l-10-8.4 3.6 12.6c2-1.4 4.2-2.8 6.4-4.2zM110.9 314.3a4.31 4.31 0 0 1-1.7-2.4c-.4-1.8-.2-2.9 1.4-4 1.2-.8 2.2-1.2 2.2-1.7 0-1-4-2-6.8.8a8.68 8.68 0 0 0 .7 11.7c4.2 4.5 10.6 5.5 11.6 11.2a21.12 21.12 0 0 1 .2 2.6 16.21 16.21 0 0 1-.3 2.5c-1.2 5.4-6.4 10.6-14.9 9.3-1.6-.2-2.6-.4-2.9 0-.7.9 3 5.1 9.7 4.9 9.5-.2 17.4-9.9 15.5-20.7-1.9-9.5-11.2-11.5-14.7-14.2zm4.5-10.4c2.4 3.4 1.6 5.3 2.6 6.3a1.06 1.06 0 0 0 1.4.2c1.3-.6 2-2.7 2.1-4.2.3-3.6-1.6-7.7-4.1-10.5a24.19 24.19 0 0 0-14.3-7.7 30.67 30.67 0 0 0-12.1.7 23.35 23.35 0 0 0-2.5.7C74.1 295 67.9 309 70.9 323c.7 3.4 2.2 7.2 4.6 9.7 2.9 3.2 6.2 2.6 4.8-.4a25.81 25.81 0 0 1-2.3-10.2c-.2-6.2 1.2-12.7 5.2-17.7a23.8 23.8 0 0 1 7-5.5 7.74 7.74 0 0 1 1.6-.7 2.35 2.35 0 0 1 .8-.2 25 25 0 0 1 2.6-.7c9.8-2.2 17 2.1 20.2 6.6zm96.3-235.4l-4.9-17.7-2.9 8.8 1.7 6.9zm10.7 11.6l-20.6-6.3 13.6 11.4c2-1.5 4.3-3.3 7-5.1zm91.4 185.3c3.5 2 7.6 1.4 9-1.2s-.3-6.3-3.9-8.2-7.6-1.4-9 1.2.4 6.3 3.9 8.2zm-37.7-1.7c2.5.2 4.2.3 4.6-.4.9-1.5-5.8-6.5-14.9-5a29.92 29.92 0 0 0-3.2.8 3.58 3.58 0 0 0-1.1.4 18.83 18.83 0 0 0-6.1 3.8c-2.2 2.1-2.8 4-2.1 4.5s2.1-.2 4.4-1.2a36.59 36.59 0 0 1 18.4-2.9zm160.5 59.9a23.8 23.8 0 0 0-16.3-12.9 67.48 67.48 0 0 0-6.2-17.6c1.3-1.5 2.6-3 2.8-3.3 10.4-12.9 3.6-31.9-14.2-36.3-10-9.6-19.1-14.2-26.5-17.9-7.1-3.6-4.3-2.2-11-5.2-1.8-8.7-2.4-29-5.2-43.2-2.5-12.8-7.7-22.1-15.6-28.1-3.2-6.8-7.6-13.7-12.9-18.8 24.8-38.1 31.4-75.7 13.2-95.4-8.1-8.8-20.1-12.9-34.5-12.9-20.3 0-45.2 8.3-70.3 23.5 0 0-16.4-13.2-16.7-13.5C153-13.2-45.2 230.7 24.7 284l18.1 13.8c-11.3 31.5 4.4 69.1 37.3 81.2a56.71 56.71 0 0 0 23.3 3.5s53.1 97.4 165.1 97.4c129.6 0 162.5-126.7 162.9-127.9 0 0 10.5-15.5 5.2-28.4zM30.1 267.8c-14.2-24 10.5-73.2 28.1-101.2C101.7 97.5 174 43 206.8 50.7l9-3.5s24.7 20.8 24.7 20.9c17-10.2 38.6-20.6 58.8-22.6-12.3 2.8-27.3 9.2-45.1 20-.4.2-42 28.3-67.4 53.5-13.8 13.7-69.5 80.4-69.4 80.3 10.2-19.2 16.9-28.7 32.9-48.9 9.1-11.4 18.8-22.6 28.7-32.8 4.6-4.8 9.3-9.4 13.9-13.7 3.2-3 6.4-5.9 9.7-8.6 1.5-1.3 3-2.5 4.4-3.7l-32.6-26.9 1.7 12.1L200 97.6s-21 14.1-31.4 23c-41.8 35.7-82.8 90.4-98.1 143.7h.7c-7.6 4.2-15.1 10.9-21.7 20-.1 0-17-12.4-19.4-16.5zm69.1 100.1c-25 0-45.3-21.4-45.3-47.7s20.3-47.7 45.3-47.7a42.53 42.53 0 0 1 18.2 4s9.6 4.9 12.3 27.8a111.07 111.07 0 0 0 4.2-13.1 82.38 82.38 0 0 1 4.2 30.8c2.7-3.6 5.5-10.3 5.5-10.3 5.2 29.4-16.2 56.2-44.4 56.2zM155 199.4s19.5-37.1 62.3-61.6c-3.2-.5-11 .5-12.4.6 7.8-6.7 22.2-11.2 32.2-13.2-2.9-1.9-9.9-2.3-13.3-2.4h-2.2c9.4-5.2 26.8-8.3 42.7-5.5-2-2.6-6.5-4.6-9.7-5.5-.3-.1-1.5-.4-1.5-.4l1.2-.3c9.5-1.8 20.7.1 29.5 3.7-1-2.3-3.5-5-5.3-6.7-.2-.2-1.3-1-1.3-1a69.13 69.13 0 0 1 24.7 10.5 30.36 30.36 0 0 0-4.7-6.3c8.8 2.5 18.7 8.8 23 17.8a6.89 6.89 0 0 1 .4 1c-16.7-12.8-65.4-9.2-114.2 22.4-22.4 14.6-38.7 30.4-51.4 46.9zm263.4 146.3c-.6 1.2-6.7 34.4-41.9 62-44.4 34.9-102.7 31.3-124.7 11.8-11.8-11-16.9-26.7-16.9-26.7s-1.3 8.9-1.6 12.3c-8.9-15.1-8.1-33.5-8.1-33.5s-4.7 8.8-6.9 13.8c-6.5-16.6-3.2-33.8-3.2-33.8l-5.2 7.7s-2.4-18.8 3.5-34.5c6.4-16.7 18.7-28.9 21.1-30.4-9.4-3-20.1-11.5-20.1-11.5a30.21 30.21 0 0 0 7.3-.4s-18.9-13.5-22.2-34.3c2.7 3.4 8.5 7.2 8.5 7.2-1.9-5.4-3-17.5-1.2-29.4 3.6-22.7 22.3-37.4 43.4-37.3 22.5.2 37.7 4.9 56.6-12.5 4-3.7 7.2-6.9 12.8-8.1a17.25 17.25 0 0 1 13.8 1.5c10.2 6.1 12.5 22 13.6 33.7 4.1 43.3 2.4 35.6 19.9 44.5 8.4 4.2 17.7 8.3 28.4 19.7l.1.1h.1c9 .2 13.6 7.3 9.5 12.5-30.2 36.1-72.5 53.4-119.5 54.8-1.9 0-6.3.1-6.3.1-19 .6-25.2 25.2-13.3 40 7.5 9.4 22 12.4 34 12.5l.2-.1c51.5 1 103.1-35.4 112.1-55.4.1-.2.6-1.4.6-1.4-2.1 2.4-52.2 49.6-113.1 47.9a67.44 67.44 0 0 1-12.9-1.6c-8.3-1.9-14.5-5.6-17-13.8a98.53 98.53 0 0 0 18.9 1.7c44 0 75.6-20 72.3-20.2a1.09 1.09 0 0 0-.5.1c-5.1 1.2-58 21.7-91.4 11.2a13.52 13.52 0 0 1 .5-2.9c3-10 8.2-8.6 16.8-8.9a185.12 185.12 0 0 0 73.5-17.4c19.6-9.3 34.6-21.3 40-27.4 7 11.8 7 26.9 7 26.9a20.25 20.25 0 0 1 6.4-1c11.3 0 13.7 10.2 5.1 20.5zM269 358.9zm.7 4.1c0-.1-.1-.1-.1-.2 0 .1 0 .1.1.2 0-.1-.1-.2-.1-.4 0 .2 0 .3.1.4zm62.9-110.4c-.5 3.5 1.1 6.7 3.7 7.1s5.1-2.1 5.7-5.7-1.1-6.7-3.7-7.1-5.1 2.2-5.7 5.7zm-58-1.2c4 1.6 6.8 2.8 7.5 1.9.4-.4.1-1.5-.8-2.9-2.5-3.7-7.3-6.8-11.6-8.4a30.66 30.66 0 0 0-29.5 5.1c-4.1 3.4-6 6.8-4.1 7.1 1.2.2 3.6-.8 7-2.1 13.5-5.1 21.1-4.5 31.5-.7zm46.7-29.2a43 43 0 0 0 2.1 11.7 27.11 27.11 0 0 1 14.5 2.6c-.3-12.3-7.5-26.2-12.9-24.3-3.2 1.1-3.8 6.6-3.7 10z"],
"mandalorian": [448, 512, [], "f50f", "M232.27 511.89c-1-3.26-1.69-15.83-1.39-24.58.55-15.89 1-24.72 1.4-28.76.64-6.2 2.87-20.72 3.28-21.38.6-1 .4-27.87-.24-33.13-.31-2.58-.63-11.9-.69-20.73-.13-16.47-.53-20.12-2.73-24.76-1.1-2.32-1.23-3.84-1-11.43a92.38 92.38 0 0 0-.34-12.71c-2-13-3.46-27.7-3.25-33.9s.43-7.15 2.06-9.67c3.05-4.71 6.51-14 8.62-23.27 2.26-9.86 3.88-17.18 4.59-20.74a109.54 109.54 0 0 1 4.42-15.05c2.27-6.25 2.49-15.39.37-15.39-.3 0-1.38 1.22-2.41 2.71s-4.76 4.8-8.29 7.36c-8.37 6.08-11.7 9.39-12.66 12.58s-1 7.23-.16 7.76c.34.21 1.29 2.4 2.11 4.88a28.83 28.83 0 0 1 .72 15.36c-.39 1.77-1 5.47-1.46 8.23s-1 6.46-1.25 8.22a9.85 9.85 0 0 1-1.55 4.26c-1 1-1.14.91-2.05-.53a14.87 14.87 0 0 1-1.44-4.75c-.25-1.74-1.63-7.11-3.08-11.93-3.28-10.9-3.52-16.15-1-21a14.24 14.24 0 0 0 1.67-4.61c0-2.39-2.2-5.32-7.41-9.89-7-6.18-8.63-7.92-10.23-11.3-1.71-3.6-3.06-4.06-4.54-1.54-1.78 3-2.6 9.11-3 22l-.34 12.19 2 2.25c3.21 3.7 12.07 16.45 13.78 19.83 3.41 6.74 4.34 11.69 4.41 23.56s.95 22.75 2 24.71c.36.66.51 1.35.34 1.52s.41 2.09 1.29 4.27a38.14 38.14 0 0 1 2.06 9 91 91 0 0 0 1.71 10.37c2.23 9.56 2.77 14.08 2.39 20.14-.2 3.27-.53 11.07-.73 17.32-1.31 41.76-1.85 58-2 61.21-.12 2-.39 11.51-.6 21.07-.36 16.3-1.3 27.37-2.42 28.65-.64.73-8.07-4.91-12.52-9.49-3.75-3.87-4-4.79-2.83-9.95.7-3 2.26-18.29 3.33-32.62.36-4.78.81-10.5 1-12.71.83-9.37 1.66-20.35 2.61-34.78.56-8.46 1.33-16.44 1.72-17.73s.89-9.89 1.13-19.11l.43-16.77-2.26-4.3c-1.72-3.28-4.87-6.94-13.22-15.34-6-6.07-11.84-12.3-12.91-13.85l-1.95-2.81.75-10.9c1.09-15.71 1.1-48.57 0-59.06l-.89-8.7-3.28-4.52c-5.86-8.08-5.8-7.75-6.22-33.27-.1-6.07-.38-11.5-.63-12.06-.83-1.87-3.05-2.66-8.54-3.05-8.86-.62-11-1.9-23.85-14.55-6.15-6-12.34-12-13.75-13.19-2.81-2.42-2.79-2-.56-9.63l1.35-4.65-1.69-3a32.22 32.22 0 0 0-2.59-4.07c-1.33-1.51-5.5-10.89-6-13.49a4.24 4.24 0 0 1 .87-3.9c2.23-2.86 3.4-5.68 4.45-10.73 2.33-11.19 7.74-26.09 10.6-29.22 3.18-3.47 7.7-1 9.41 5 1.34 4.79 1.37 9.79.1 18.55a101.2 101.2 0 0 0-1 11.11c0 4 .19 4.69 2.25 7.39 3.33 4.37 7.73 7.41 15.2 10.52a18.67 18.67 0 0 1 4.72 2.85c11.17 10.72 18.62 16.18 22.95 16.85 5.18.8 8 4.54 10 13.39 1.31 5.65 4 11.14 5.46 11.14a9.38 9.38 0 0 0 3.33-1.39c2-1.22 2.25-1.73 2.25-4.18a132.88 132.88 0 0 0-2-17.84c-.37-1.66-.78-4.06-.93-5.35s-.61-3.85-1-5.69c-2.55-11.16-3.65-15.46-4.1-16-1.55-2-4.08-10.2-4.93-15.92-1.64-11.11-4-14.23-12.91-17.39A43.15 43.15 0 0 1 165.24 78c-1.15-1-4-3.22-6.35-5.06s-4.41-3.53-4.6-3.76a22.7 22.7 0 0 0-2.69-2c-6.24-4.22-8.84-7-11.26-12l-2.44-5-.22-13-.22-13 6.91-6.55c3.95-3.75 8.48-7.35 10.59-8.43 3.31-1.69 4.45-1.89 11.37-2 8.53-.19 10.12 0 11.66 1.56s1.36 6.4-.29 8.5a6.66 6.66 0 0 0-1.34 2.32c0 .58-2.61 4.91-5.42 9a30.39 30.39 0 0 0-2.37 6.82c20.44 13.39 21.55 3.77 14.07 29L194 66.92c3.11-8.66 6.47-17.26 8.61-26.22.29-7.63-12-4.19-15.4-8.68-2.33-5.93 3.13-14.18 6.06-19.2 1.6-2.34 6.62-4.7 8.82-4.15.88.22 4.16-.35 7.37-1.28a45.3 45.3 0 0 1 7.55-1.68 29.57 29.57 0 0 0 6-1.29c3.65-1.11 4.5-1.17 6.35-.4a29.54 29.54 0 0 0 5.82 1.36 18.18 18.18 0 0 1 6 1.91 22.67 22.67 0 0 0 5 2.17c2.51.68 3 .57 7.05-1.67l4.35-2.4L268.32 5c10.44-.4 10.81-.47 15.26-2.68L288.16 0l2.46 1.43c1.76 1 3.14 2.73 4.85 6 2.36 4.51 2.38 4.58 1.37 7.37-.88 2.44-.89 3.3-.1 6.39a35.76 35.76 0 0 0 2.1 5.91 13.55 13.55 0 0 1 1.31 4c.31 4.33 0 5.3-2.41 6.92-2.17 1.47-7 7.91-7 9.34a14.77 14.77 0 0 1-1.07 3c-5 11.51-6.76 13.56-14.26 17-9.2 4.2-12.3 5.19-16.21 5.19-3.1 0-4 .25-4.54 1.26a18.33 18.33 0 0 1-4.09 3.71 13.62 13.62 0 0 0-4.38 4.78 5.89 5.89 0 0 1-2.49 2.91 6.88 6.88 0 0 0-2.45 1.71 67.62 67.62 0 0 1-7 5.38c-3.33 2.34-6.87 5-7.87 6A7.27 7.27 0 0 1 224 100a5.76 5.76 0 0 0-2.13 1.65c-1.31 1.39-1.49 2.11-1.14 4.6a36.45 36.45 0 0 0 1.42 5.88c1.32 3.8 1.31 7.86 0 10.57s-.89 6.65 1.35 9.59c2 2.63 2.16 4.56.71 8.84a33.45 33.45 0 0 0-1.06 8.91c0 4.88.22 6.28 1.46 8.38s1.82 2.48 3.24 2.32c2-.23 2.3-1.05 4.71-12.12 2.18-10 3.71-11.92 13.76-17.08 2.94-1.51 7.46-4 10-5.44s6.79-3.69 9.37-4.91a40.09 40.09 0 0 0 15.22-11.67c7.11-8.79 10-16.22 12.85-33.3a18.37 18.37 0 0 1 2.86-7.73 20.39 20.39 0 0 0 2.89-7.31c1-5.3 2.85-9.08 5.58-11.51 4.7-4.18 6-1.09 4.59 10.87-.46 3.86-1.1 10.33-1.44 14.38l-.61 7.36 4.45 4.09 4.45 4.09.11 8.42c.06 4.63.47 9.53.92 10.89l.82 2.47-6.43 6.28c-8.54 8.33-12.88 13.93-16.76 21.61-1.77 3.49-3.74 7.11-4.38 8-2.18 3.11-6.46 13-8.76 20.26l-2.29 7.22-7 6.49c-3.83 3.57-8 7.25-9.17 8.17-3.05 2.32-4.26 5.15-4.26 10a14.62 14.62 0 0 0 1.59 7.26 42 42 0 0 1 2.09 4.83 9.28 9.28 0 0 0 1.57 2.89c1.4 1.59 1.92 16.12.83 23.22-.68 4.48-3.63 12-4.7 12-1.79 0-4.06 9.27-5.07 20.74-.18 2-.62 5.94-1 8.7s-1 10-1.35 16.05c-.77 12.22-.19 18.77 2 23.15 3.41 6.69.52 12.69-11 22.84l-4 3.49.07 5.19a40.81 40.81 0 0 0 1.14 8.87c4.61 16 4.73 16.92 4.38 37.13-.46 26.4-.26 40.27.63 44.15a61.31 61.31 0 0 1 1.08 7c.17 2 .66 5.33 1.08 7.36.47 2.26.78 11 .79 22.74v19.06l-1.81 2.63c-2.71 3.91-15.11 13.54-15.49 12.29zm29.53-45.11c-.18-.3-.33-6.87-.33-14.59 0-14.06-.89-27.54-2.26-34.45-.4-2-.81-9.7-.9-17.06-.15-11.93-1.4-24.37-2.64-26.38-.66-1.07-3-17.66-3-21.3 0-4.23 1-6 5.28-9.13s4.86-3.14 5.48-.72c.28 1.1 1.45 5.62 2.6 10 3.93 15.12 4.14 16.27 4.05 21.74-.1 5.78-.13 6.13-1.74 17.73-1 7.07-1.17 12.39-1 28.43.17 19.4-.64 35.73-2 41.27-.71 2.78-2.8 5.48-3.43 4.43zm-71-37.58a101 101 0 0 1-1.73-10.79 100.5 100.5 0 0 0-1.73-10.79 37.53 37.53 0 0 1-1-6.49c-.31-3.19-.91-7.46-1.33-9.48-1-4.79-3.35-19.35-3.42-21.07 0-.74-.34-4.05-.7-7.36-.67-6.21-.84-27.67-.22-28.29 1-1 6.63 2.76 11.33 7.43l5.28 5.25-.45 6.47c-.25 3.56-.6 10.23-.78 14.83s-.49 9.87-.67 11.71-.61 9.36-.94 16.72c-.79 17.41-1.94 31.29-2.65 32a.62.62 0 0 1-1-.14zm-87.18-266.59c21.07 12.79 17.84 14.15 28.49 17.66 13 4.29 18.87 7.13 23.15 16.87C111.6 233.28 86.25 255 78.55 268c-31 52-6 101.59 62.75 87.21-14.18 29.23-78 28.63-98.68-4.9-24.68-39.95-22.09-118.3 61-187.66zm210.79 179c56.66 6.88 82.32-37.74 46.54-89.23 0 0-26.87-29.34-64.28-68 3-15.45 9.49-32.12 30.57-53.82 89.2 63.51 92 141.61 92.46 149.36 4.3 70.64-78.7 91.18-105.29 61.71z"],
"markdown": [640, 512, [], "f60f", "M593.8 59.1H46.2C20.7 59.1 0 79.8 0 105.2v301.5c0 25.5 20.7 46.2 46.2 46.2h547.7c25.5 0 46.2-20.7 46.1-46.1V105.2c0-25.4-20.7-46.1-46.2-46.1zM338.5 360.6H277v-120l-61.5 76.9-61.5-76.9v120H92.3V151.4h61.5l61.5 76.9 61.5-76.9h61.5v209.2zm135.3 3.1L381.5 256H443V151.4h61.5V256H566z"],
"mastodon": [448, 512, [], "f4f6", "M433 179.11c0-97.2-63.71-125.7-63.71-125.7-62.52-28.7-228.56-28.4-290.48 0 0 0-63.72 28.5-63.72 125.7 0 115.7-6.6 259.4 105.63 289.1 40.51 10.7 75.32 13 103.33 11.4 50.81-2.8 79.32-18.1 79.32-18.1l-1.7-36.9s-36.31 11.4-77.12 10.1c-40.41-1.4-83-4.4-89.63-54a102.54 102.54 0 0 1-.9-13.9c85.63 20.9 158.65 9.1 178.75 6.7 56.12-6.7 105-41.3 111.23-72.9 9.8-49.8 9-121.5 9-121.5zm-75.12 125.2h-46.63v-114.2c0-49.7-64-51.6-64 6.9v62.5h-46.33V197c0-58.5-64-56.6-64-6.9v114.2H90.19c0-122.1-5.2-147.9 18.41-175 25.9-28.9 79.82-30.8 103.83 6.1l11.6 19.5 11.6-19.5c24.11-37.1 78.12-34.8 103.83-6.1 23.71 27.3 18.4 53 18.4 175z"],
"maxcdn": [512, 512, [], "f136", "M461.1 442.7h-97.4L415.6 200c2.3-10.2.9-19.5-4.4-25.7-5-6.1-13.7-9.6-24.2-9.6h-49.3l-59.5 278h-97.4l59.5-278h-83.4l-59.5 278H0l59.5-278-44.6-95.4H387c39.4 0 75.3 16.3 98.3 44.9 23.3 28.6 31.8 67.4 23.6 105.9l-47.8 222.6z"],
"medapps": [320, 512, [], "f3c6", "M118.3 238.4c3.5-12.5 6.9-33.6 13.2-33.6 8.3 1.8 9.6 23.4 18.6 36.6 4.6-23.5 5.3-85.1 14.1-86.7 9-.7 19.7 66.5 22 77.5 9.9 4.1 48.9 6.6 48.9 6.6 1.9 7.3-24 7.6-40 7.8-4.6 14.8-5.4 27.7-11.4 28-4.7.2-8.2-28.8-17.5-49.6l-9.4 65.5c-4.4 13-15.5-22.5-21.9-39.3-3.3-.1-62.4-1.6-47.6-7.8l31-5zM228 448c21.2 0 21.2-32 0-32H92c-21.2 0-21.2 32 0 32h136zm-24 64c21.2 0 21.2-32 0-32h-88c-21.2 0-21.2 32 0 32h88zm34.2-141.5c3.2-18.9 5.2-36.4 11.9-48.8 7.9-14.7 16.1-28.1 24-41 24.6-40.4 45.9-75.2 45.9-125.5C320 69.6 248.2 0 160 0S0 69.6 0 155.2c0 50.2 21.3 85.1 45.9 125.5 7.9 12.9 16 26.3 24 41 6.7 12.5 8.7 29.8 11.9 48.9 3.5 21 36.1 15.7 32.6-5.1-3.6-21.7-5.6-40.7-15.3-58.6C66.5 246.5 33 211.3 33 155.2 33 87.3 90 32 160 32s127 55.3 127 123.2c0 56.1-33.5 91.3-66.1 151.6-9.7 18-11.7 37.4-15.3 58.6-3.4 20.6 29 26.4 32.6 5.1z"],
"medium": [448, 512, [], "f23a", "M0 32v448h448V32H0zm372.2 106.1l-24 23c-2.1 1.6-3.1 4.2-2.7 6.7v169.3c-.4 2.6.6 5.2 2.7 6.7l23.5 23v5.1h-118V367l24.3-23.6c2.4-2.4 2.4-3.1 2.4-6.7V199.8l-67.6 171.6h-9.1L125 199.8v115c-.7 4.8 1 9.7 4.4 13.2l31.6 38.3v5.1H71.2v-5.1l31.6-38.3c3.4-3.5 4.9-8.4 4.1-13.2v-133c.4-3.7-1-7.3-3.8-9.8L75 138.1V133h87.3l67.4 148L289 133.1h83.2v5z"],
"medium-m": [512, 512, [], "f3c7", "M71.5 142.3c.6-5.9-1.7-11.8-6.1-15.8L20.3 72.1V64h140.2l108.4 237.7L364.2 64h133.7v8.1l-38.6 37c-3.3 2.5-5 6.7-4.3 10.8v272c-.7 4.1 1 8.3 4.3 10.8l37.7 37v8.1H307.3v-8.1l39.1-37.9c3.8-3.8 3.8-5 3.8-10.8V171.2L241.5 447.1h-14.7L100.4 171.2v184.9c-1.1 7.8 1.5 15.6 7 21.2l50.8 61.6v8.1h-144v-8L65 377.3c5.4-5.6 7.9-13.5 6.5-21.2V142.3z"],
"medrt": [544, 512, [], "f3c8", "M113.7 256c0 121.8 83.9 222.8 193.5 241.1-18.7 4.5-38.2 6.9-58.2 6.9C111.4 504 0 393 0 256S111.4 8 248.9 8c20.1 0 39.6 2.4 58.2 6.9C197.5 33.2 113.7 134.2 113.7 256m297.4 100.3c-77.7 55.4-179.6 47.5-240.4-14.6 5.5 14.1 12.7 27.7 21.7 40.5 61.6 88.2 182.4 109.3 269.7 47 87.3-62.3 108.1-184.3 46.5-272.6-9-12.9-19.3-24.3-30.5-34.2 37.4 78.8 10.7 178.5-67 233.9m-218.8-244c-1.4 1-2.7 2.1-4 3.1 64.3-17.8 135.9 4 178.9 60.5 35.7 47 42.9 106.6 24.4 158 56.7-56.2 67.6-142.1 22.3-201.8-50-65.5-149.1-74.4-221.6-19.8M296 224c-4.4 0-8-3.6-8-8v-40c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v40c0 4.4-3.6 8-8 8h-40c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h40c4.4 0 8 3.6 8 8v40c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-40c0-4.4 3.6-8 8-8h40c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8h-40z"],
"meetup": [512, 512, [], "f2e0", "M99 414.3c1.1 5.7-2.3 11.1-8 12.3-5.4 1.1-10.9-2.3-12-8-1.1-5.4 2.3-11.1 7.7-12.3 5.4-1.2 11.1 2.3 12.3 8zm143.1 71.4c-6.3 4.6-8 13.4-3.7 20 4.6 6.6 13.4 8.3 20 3.7 6.3-4.6 8-13.4 3.4-20-4.2-6.5-13.1-8.3-19.7-3.7zm-86-462.3c6.3-1.4 10.3-7.7 8.9-14-1.1-6.6-7.4-10.6-13.7-9.1-6.3 1.4-10.3 7.7-9.1 14 1.4 6.6 7.6 10.6 13.9 9.1zM34.4 226.3c-10-6.9-23.7-4.3-30.6 6-6.9 10-4.3 24 5.7 30.9 10 7.1 23.7 4.6 30.6-5.7 6.9-10.4 4.3-24.1-5.7-31.2zm272-170.9c10.6-6.3 13.7-20 7.7-30.3-6.3-10.6-19.7-14-30-7.7s-13.7 20-7.4 30.6c6 10.3 19.4 13.7 29.7 7.4zm-191.1 58c7.7-5.4 9.4-16 4.3-23.7s-15.7-9.4-23.1-4.3c-7.7 5.4-9.4 16-4.3 23.7 5.1 7.8 15.6 9.5 23.1 4.3zm372.3 156c-7.4 1.7-12.3 9.1-10.6 16.9 1.4 7.4 8.9 12.3 16.3 10.6 7.4-1.4 12.3-8.9 10.6-16.6-1.5-7.4-8.9-12.3-16.3-10.9zm39.7-56.8c-1.1-5.7-6.6-9.1-12-8-5.7 1.1-9.1 6.9-8 12.6 1.1 5.4 6.6 9.1 12.3 8 5.4-1.5 9.1-6.9 7.7-12.6zM447 138.9c-8.6 6-10.6 17.7-4.9 26.3 5.7 8.6 17.4 10.6 26 4.9 8.3-6 10.3-17.7 4.6-26.3-5.7-8.7-17.4-10.9-25.7-4.9zm-6.3 139.4c26.3 43.1 15.1 100-26.3 129.1-17.4 12.3-37.1 17.7-56.9 17.1-12 47.1-69.4 64.6-105.1 32.6-1.1.9-2.6 1.7-3.7 2.9-39.1 27.1-92.3 17.4-119.4-22.3-9.7-14.3-14.6-30.6-15.1-46.9-65.4-10.9-90-94-41.1-139.7-28.3-46.9.6-107.4 53.4-114.9C151.6 70 234.1 38.6 290.1 82c67.4-22.3 136.3 29.4 130.9 101.1 41.1 12.6 52.8 66.9 19.7 95.2zm-70 74.3c-3.1-20.6-40.9-4.6-43.1-27.1-3.1-32 43.7-101.1 40-128-3.4-24-19.4-29.1-33.4-29.4-13.4-.3-16.9 2-21.4 4.6-2.9 1.7-6.6 4.9-11.7-.3-6.3-6-11.1-11.7-19.4-12.9-12.3-2-17.7 2-26.6 9.7-3.4 2.9-12 12.9-20 9.1-3.4-1.7-15.4-7.7-24-11.4-16.3-7.1-40 4.6-48.6 20-12.9 22.9-38 113.1-41.7 125.1-8.6 26.6 10.9 48.6 36.9 47.1 11.1-.6 18.3-4.6 25.4-17.4 4-7.4 41.7-107.7 44.6-112.6 2-3.4 8.9-8 14.6-5.1 5.7 3.1 6.9 9.4 6 15.1-1.1 9.7-28 70.9-28.9 77.7-3.4 22.9 26.9 26.6 38.6 4 3.7-7.1 45.7-92.6 49.4-98.3 4.3-6.3 7.4-8.3 11.7-8 3.1 0 8.3.9 7.1 10.9-1.4 9.4-35.1 72.3-38.9 87.7-4.6 20.6 6.6 41.4 24.9 50.6 11.4 5.7 62.5 15.7 58.5-11.1zm5.7 92.3c-10.3 7.4-12.9 22-5.7 32.6 7.1 10.6 21.4 13.1 32 6 10.6-7.4 13.1-22 6-32.6-7.4-10.6-21.7-13.5-32.3-6z"],
"megaport": [496, 512, [], "f5a3", "M214.5 209.6v66.2l33.5 33.5 33.3-33.3v-66.4l-33.4-33.4zM248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm145.1 414.4L367 441.6l-26-19.2v-65.5l-33.4-33.4-33.4 33.4v65.5L248 441.6l-26.1-19.2v-65.5l-33.4-33.4-33.5 33.4v65.5l-26.1 19.2-26.1-19.2v-87l59.5-59.5V188l59.5-59.5V52.9l26.1-19.2L274 52.9v75.6l59.5 59.5v87.6l59.7 59.7v87.1z"],
"mendeley": [640, 512, [], "f7b3", "M624.6 325.2c-12.3-12.4-29.7-19.2-48.4-17.2-43.3-1-49.7-34.9-37.5-98.8 22.8-57.5-14.9-131.5-87.4-130.8-77.4.7-81.7 82-130.9 82-48.1 0-54-81.3-130.9-82-72.9-.8-110.1 73.3-87.4 130.8 12.2 63.9 5.8 97.8-37.5 98.8-21.2-2.3-37 6.5-53 22.5-19.9 19.7-19.3 94.8 42.6 102.6 47.1 5.9 81.6-42.9 61.2-87.8-47.3-103.7 185.9-106.1 146.5-8.2-.1.1-.2.2-.3.4-26.8 42.8 6.8 97.4 58.8 95.2 52.1 2.1 85.4-52.6 58.8-95.2-.1-.2-.2-.3-.3-.4-39.4-97.9 193.8-95.5 146.5 8.2-4.6 10-6.7 21.3-5.7 33 4.9 53.4 68.7 74.1 104.9 35.2 17.8-14.8 23.1-65.6 0-88.3zm-303.9-19.1h-.6c-43.4 0-62.8-37.5-62.8-62.8 0-34.7 28.2-62.8 62.8-62.8h.6c34.7 0 62.8 28.1 62.8 62.8 0 25-19.2 62.8-62.8 62.8z"],
"microsoft": [448, 512, [], "f3ca", "M0 32h214.6v214.6H0V32zm233.4 0H448v214.6H233.4V32zM0 265.4h214.6V480H0V265.4zm233.4 0H448V480H233.4V265.4z"],
"mix": [448, 512, [], "f3cb", "M0 64v348.9c0 56.2 88 58.1 88 0V174.3c7.9-52.9 88-50.4 88 6.5v175.3c0 57.9 96 58 96 0V240c5.3-54.7 88-52.5 88 4.3v23.8c0 59.9 88 56.6 88 0V64H0z"],
"mixcloud": [640, 512, [], "f289", "M424.43 219.729C416.124 134.727 344.135 68 256.919 68c-72.266 0-136.224 46.516-159.205 114.074-54.545 8.029-96.63 54.822-96.63 111.582 0 62.298 50.668 112.966 113.243 112.966h289.614c52.329 0 94.969-42.362 94.969-94.693 0-45.131-32.118-83.063-74.48-92.2zm-20.489 144.53H114.327c-39.04 0-70.881-31.564-70.881-70.604s31.841-70.604 70.881-70.604c18.827 0 36.548 7.475 49.838 20.766 19.963 19.963 50.133-10.227 30.18-30.18-14.675-14.398-32.672-24.365-52.053-29.349 19.935-44.3 64.79-73.926 114.628-73.926 69.496 0 125.979 56.483 125.979 125.702 0 13.568-2.215 26.857-6.369 39.594-8.943 27.517 32.133 38.939 40.147 13.29 2.769-8.306 4.984-16.889 6.369-25.472 19.381 7.476 33.502 26.303 33.502 48.453 0 28.795-23.535 52.33-52.607 52.33zm235.069-52.33c0 44.024-12.737 86.386-37.102 122.657-4.153 6.092-10.798 9.414-17.72 9.414-16.317 0-27.127-18.826-17.443-32.949 19.381-29.349 29.903-63.682 29.903-99.122s-10.521-69.773-29.903-98.845c-15.655-22.831 19.361-47.24 35.163-23.534 24.366 35.993 37.102 78.356 37.102 122.379zm-70.88 0c0 31.565-9.137 62.021-26.857 88.325-4.153 6.091-10.798 9.136-17.72 9.136-17.201 0-27.022-18.979-17.443-32.948 13.013-19.104 19.658-41.255 19.658-64.513 0-22.981-6.645-45.408-19.658-64.512-15.761-22.986 19.008-47.095 35.163-23.535 17.719 26.026 26.857 56.483 26.857 88.047z"],
"mizuni": [496, 512, [], "f3cc", "M248 8C111 8 0 119.1 0 256c0 137 111 248 248 248s248-111 248-248C496 119.1 385 8 248 8zm-80 351.9c-31.4 10.6-58.8 27.3-80 48.2V136c0-22.1 17.9-40 40-40s40 17.9 40 40v223.9zm120-9.9c-12.9-2-26.2-3.1-39.8-3.1-13.8 0-27.2 1.1-40.2 3.1V136c0-22.1 17.9-40 40-40s40 17.9 40 40v214zm120 57.7c-21.2-20.8-48.6-37.4-80-48V136c0-22.1 17.9-40 40-40s40 17.9 40 40v271.7z"],
"modx": [448, 512, [], "f285", "M356 241.8l36.7 23.7V480l-133-83.8L356 241.8zM440 75H226.3l-23 37.8 153.5 96.5L440 75zm-89 142.8L55.2 32v214.5l46 29L351 217.8zM97 294.2L8 437h213.7l125-200.5L97 294.2z"],
"monero": [496, 512, [], "f3d0", "M352 384h108.4C417 455.9 338.1 504 248 504S79 455.9 35.6 384H144V256.2L248 361l104-105v128zM88 336V128l159.4 159.4L408 128v208h74.8c8.5-25.1 13.2-52 13.2-80C496 119 385 8 248 8S0 119 0 256c0 28 4.6 54.9 13.2 80H88z"],
"napster": [496, 512, [], "f3d2", "M298.3 373.6c-14.2 13.6-31.3 24.1-50.4 30.5-19-6.4-36.2-16.9-50.3-30.5h100.7zm44-199.6c20-16.9 43.6-29.2 69.6-36.2V299c0 219.4-328 217.6-328 .3V137.7c25.9 6.9 49.6 19.6 69.5 36.4 56.8-40 132.5-39.9 188.9-.1zm-208.8-58.5c64.4-60 164.3-60.1 228.9-.2-7.1 3.5-13.9 7.3-20.6 11.5-58.7-30.5-129.2-30.4-187.9.1-6.3-4-13.9-8.2-20.4-11.4zM43.8 93.2v69.3c-58.4 36.5-58.4 121.1.1 158.3 26.4 245.1 381.7 240.3 407.6 1.5l.3-1.7c58.7-36.3 58.9-121.7.2-158.2V93.2c-17.3.5-34 3-50.1 7.4-82-91.5-225.5-91.5-307.5.1-16.3-4.4-33.1-7-50.6-7.5zM259.2 352s36-.3 61.3-1.5c10.2-.5 21.1-4 25.5-6.5 26.3-15.1 25.4-39.2 26.2-47.4-79.5-.6-99.9-3.9-113 55.4zm-135.5-55.3c.8 8.2-.1 32.3 26.2 47.4 4.4 2.5 15.2 6 25.5 6.5 25.3 1.1 61.3 1.5 61.3 1.5-13.2-59.4-33.7-56.1-113-55.4zm169.1 123.4c-3.2-5.3-6.9-7.3-6.9-7.3-24.8 7.3-52.2 6.9-75.9 0 0 0-2.9 1.5-6.4 6.6-2.8 4.1-3.7 9.6-3.7 9.6 29.1 17.6 67.1 17.6 96.2 0-.1-.1-.3-4-3.3-8.9z"],
"neos": [512, 512, [], "f612", "M415.44 512h-95.11L212.12 357.46v91.1L125.69 512H28V29.82L68.47 0h108.05l123.74 176.13V63.45L386.69 0h97.69v461.5zM38.77 35.27V496l72-52.88V194l215.5 307.64h84.79l52.35-38.17h-78.27L69 13zm82.54 466.61l80-58.78v-101l-79.76-114.4v220.94L49 501.89h72.34zM80.63 10.77l310.6 442.57h82.37V10.77h-79.75v317.56L170.91 10.77zM311 191.65l72 102.81V15.93l-72 53v122.72z"],
"nimblr": [384, 512, [], "f5a8", "M246.6 299.29c15.57 0 27.15 11.46 27.15 27s-11.62 27-27.15 27c-15.7 0-27.15-11.57-27.15-27s11.55-27 27.15-27zM113 326.25c0-15.61 11.68-27 27.15-27s27.15 11.46 27.15 27-11.47 27-27.15 27c-15.44 0-27.15-11.31-27.15-27M191.76 159C157 159 89.45 178.77 59.25 227L14 0v335.48C14 433.13 93.61 512 191.76 512s177.76-78.95 177.76-176.52S290.13 159 191.76 159zm0 308.12c-73.27 0-132.51-58.9-132.51-131.59s59.24-131.59 132.51-131.59 132.51 58.86 132.51 131.54S265 467.07 191.76 467.07z"],
"nintendo-switch": [448, 512, [], "f418", "M95.9 33.5c-44.6 8-80.5 41-91.8 84.4C0 133.6-.3 142.8.2 264.4.4 376 .5 378.6 2.4 387.3c10.3 46.5 43.3 79.6 90.3 90.5 6.1 1.4 13.9 1.7 64.1 1.9 51.9.4 57.3.3 58.7-1.1 1.4-1.4 1.5-19.3 1.5-222.2 0-150.5-.3-221.3-.9-222.6-.9-1.7-2.5-1.8-56.9-1.7-44.2.1-57.5.4-63.3 1.4zm83.9 222.6V444l-37.8-.5c-34.8-.4-38.5-.6-45.5-2.3-29.9-7.7-52-30.7-58.3-60.7-2-9.4-2-240.1-.1-249.3 5.6-26.1 23.7-47.7 48-57.4 12.2-4.9 17.9-5.5 57.6-5.6l35.9-.1v188zm-75.9-131.2c-5.8 1.1-14.7 5.6-19.5 9.7-9.7 8.4-14.6 20.4-13.8 34.5.4 7.3.8 9.3 3.8 15.2 4.4 9 10.9 15.6 19.9 20 6.2 3.1 7.8 3.4 15.9 3.7 7.3.3 9.9 0 14.8-1.7 20.1-6.8 32.3-26.3 28.8-46.4-3.9-23.7-26.6-39.7-49.9-35zm158.2-92.3c-.4.3-.6 100.8-.6 223.5 0 202.3.1 222.8 1.5 223.4 2.5.9 74.5.6 83.4-.4 37.7-4.3 71-27.2 89-61.2 2.3-4.4 5.4-11.7 7-16.2 5.8-17.4 5.7-12.8 5.7-146.1 0-106.4-.2-122.3-1.5-129-9.2-48.3-46.1-84.8-94.5-93.1-6.5-1.1-16.5-1.4-48.8-1.4-22.4-.1-40.9.2-41.2.5zm99.1 202.1c14.5 3.8 26.3 14.8 31.2 28.9 3.1 8.7 3 21.5-.1 29.5-5.7 14.7-16.8 25-31.1 28.8-23.2 6-47.9-8-54.6-31-2-7-1.9-18.9.4-26.2 6.9-22.7 31-36.1 54.2-30z"],
"node": [640, 512, [], "f419", "M316.3 452c-2.1 0-4.2-.6-6.1-1.6L291 439c-2.9-1.6-1.5-2.2-.5-2.5 3.8-1.3 4.6-1.6 8.7-4 .4-.2 1-.1 1.4.1l14.8 8.8c.5.3 1.3.3 1.8 0L375 408c.5-.3.9-.9.9-1.6v-66.7c0-.7-.3-1.3-.9-1.6l-57.8-33.3c-.5-.3-1.2-.3-1.8 0l-57.8 33.3c-.6.3-.9 1-.9 1.6v66.7c0 .6.4 1.2.9 1.5l15.8 9.1c8.6 4.3 13.9-.8 13.9-5.8v-65.9c0-.9.7-1.7 1.7-1.7h7.3c.9 0 1.7.7 1.7 1.7v65.9c0 11.5-6.2 18-17.1 18-3.3 0-6 0-13.3-3.6l-15.2-8.7c-3.7-2.2-6.1-6.2-6.1-10.5v-66.7c0-4.3 2.3-8.4 6.1-10.5l57.8-33.4c3.7-2.1 8.5-2.1 12.1 0l57.8 33.4c3.7 2.2 6.1 6.2 6.1 10.5v66.7c0 4.3-2.3 8.4-6.1 10.5l-57.8 33.4c-1.7 1.1-3.8 1.7-6 1.7zm46.7-65.8c0-12.5-8.4-15.8-26.2-18.2-18-2.4-19.8-3.6-19.8-7.8 0-3.5 1.5-8.1 14.8-8.1 11.9 0 16.3 2.6 18.1 10.6.2.8.8 1.3 1.6 1.3h7.5c.5 0 .9-.2 1.2-.5.3-.4.5-.8.4-1.3-1.2-13.8-10.3-20.2-28.8-20.2-16.5 0-26.3 7-26.3 18.6 0 12.7 9.8 16.1 25.6 17.7 18.9 1.9 20.4 4.6 20.4 8.3 0 6.5-5.2 9.2-17.4 9.2-15.3 0-18.7-3.8-19.8-11.4-.1-.8-.8-1.4-1.7-1.4h-7.5c-.9 0-1.7.7-1.7 1.7 0 9.7 5.3 21.3 30.6 21.3 18.5 0 29-7.2 29-19.8zm54.5-50.1c0 6.1-5 11.1-11.1 11.1s-11.1-5-11.1-11.1c0-6.3 5.2-11.1 11.1-11.1 6-.1 11.1 4.8 11.1 11.1zm-1.8 0c0-5.2-4.2-9.3-9.4-9.3-5.1 0-9.3 4.1-9.3 9.3 0 5.2 4.2 9.4 9.3 9.4 5.2-.1 9.4-4.3 9.4-9.4zm-4.5 6.2h-2.6c-.1-.6-.5-3.8-.5-3.9-.2-.7-.4-1.1-1.3-1.1h-2.2v5h-2.4v-12.5h4.3c1.5 0 4.4 0 4.4 3.3 0 2.3-1.5 2.8-2.4 3.1 1.7.1 1.8 1.2 2.1 2.8.1 1 .3 2.7.6 3.3zm-2.8-8.8c0-1.7-1.2-1.7-1.8-1.7h-2v3.5h1.9c1.6 0 1.9-1.1 1.9-1.8zM137.3 191c0-2.7-1.4-5.1-3.7-6.4l-61.3-35.3c-1-.6-2.2-.9-3.4-1h-.6c-1.2 0-2.3.4-3.4 1L3.7 184.6C1.4 185.9 0 188.4 0 191l.1 95c0 1.3.7 2.5 1.8 3.2 1.1.7 2.5.7 3.7 0L42 268.3c2.3-1.4 3.7-3.8 3.7-6.4v-44.4c0-2.6 1.4-5.1 3.7-6.4l15.5-8.9c1.2-.7 2.4-1 3.7-1 1.3 0 2.6.3 3.7 1l15.5 8.9c2.3 1.3 3.7 3.8 3.7 6.4v44.4c0 2.6 1.4 5.1 3.7 6.4l36.4 20.9c1.1.7 2.6.7 3.7 0 1.1-.6 1.8-1.9 1.8-3.2l.2-95zM472.5 87.3v176.4c0 2.6-1.4 5.1-3.7 6.4l-61.3 35.4c-2.3 1.3-5.1 1.3-7.4 0l-61.3-35.4c-2.3-1.3-3.7-3.8-3.7-6.4v-70.8c0-2.6 1.4-5.1 3.7-6.4l61.3-35.4c2.3-1.3 5.1-1.3 7.4 0l15.3 8.8c1.7 1 3.9-.3 3.9-2.2v-94c0-2.8 3-4.6 5.5-3.2l36.5 20.4c2.3 1.2 3.8 3.7 3.8 6.4zm-46 128.9c0-.7-.4-1.3-.9-1.6l-21-12.2c-.6-.3-1.3-.3-1.9 0l-21 12.2c-.6.3-.9.9-.9 1.6v24.3c0 .7.4 1.3.9 1.6l21 12.1c.6.3 1.3.3 1.8 0l21-12.1c.6-.3.9-.9.9-1.6v-24.3zm209.8-.7c2.3-1.3 3.7-3.8 3.7-6.4V192c0-2.6-1.4-5.1-3.7-6.4l-60.9-35.4c-2.3-1.3-5.1-1.3-7.4 0l-61.3 35.4c-2.3 1.3-3.7 3.8-3.7 6.4v70.8c0 2.7 1.4 5.1 3.7 6.4l60.9 34.7c2.2 1.3 5 1.3 7.3 0l36.8-20.5c2.5-1.4 2.5-5 0-6.4L550 241.6c-1.2-.7-1.9-1.9-1.9-3.2v-22.2c0-1.3.7-2.5 1.9-3.2l19.2-11.1c1.1-.7 2.6-.7 3.7 0l19.2 11.1c1.1.7 1.9 1.9 1.9 3.2v17.4c0 2.8 3.1 4.6 5.6 3.2l36.7-21.3zM559 219c-.4.3-.7.7-.7 1.2v13.6c0 .5.3 1 .7 1.2l11.8 6.8c.4.3 1 .3 1.4 0L584 235c.4-.3.7-.7.7-1.2v-13.6c0-.5-.3-1-.7-1.2l-11.8-6.8c-.4-.3-1-.3-1.4 0L559 219zm-254.2 43.5v-70.4c0-2.6-1.6-5.1-3.9-6.4l-61.1-35.2c-2.1-1.2-5-1.4-7.4 0l-61.1 35.2c-2.3 1.3-3.9 3.7-3.9 6.4v70.4c0 2.8 1.9 5.2 4 6.4l61.2 35.2c2.4 1.4 5.2 1.3 7.4 0l61-35.2c1.8-1 3.1-2.7 3.6-4.7.1-.5.2-1.1.2-1.7zm-74.3-124.9l-.8.5h1.1l-.3-.5zm76.2 130.2l-.4-.7v.9l.4-.2z"],
"node-js": [448, 512, [], "f3d3", "M224 508c-6.7 0-13.5-1.8-19.4-5.2l-61.7-36.5c-9.2-5.2-4.7-7-1.7-8 12.3-4.3 14.8-5.2 27.9-12.7 1.4-.8 3.2-.5 4.6.4l47.4 28.1c1.7 1 4.1 1 5.7 0l184.7-106.6c1.7-1 2.8-3 2.8-5V149.3c0-2.1-1.1-4-2.9-5.1L226.8 37.7c-1.7-1-4-1-5.7 0L36.6 144.3c-1.8 1-2.9 3-2.9 5.1v213.1c0 2 1.1 4 2.9 4.9l50.6 29.2c27.5 13.7 44.3-2.4 44.3-18.7V167.5c0-3 2.4-5.3 5.4-5.3h23.4c2.9 0 5.4 2.3 5.4 5.3V378c0 36.6-20 57.6-54.7 57.6-10.7 0-19.1 0-42.5-11.6l-48.4-27.9C8.1 389.2.7 376.3.7 362.4V149.3c0-13.8 7.4-26.8 19.4-33.7L204.6 9c11.7-6.6 27.2-6.6 38.8 0l184.7 106.7c12 6.9 19.4 19.8 19.4 33.7v213.1c0 13.8-7.4 26.7-19.4 33.7L243.4 502.8c-5.9 3.4-12.6 5.2-19.4 5.2zm149.1-210.1c0-39.9-27-50.5-83.7-58-57.4-7.6-63.2-11.5-63.2-24.9 0-11.1 4.9-25.9 47.4-25.9 37.9 0 51.9 8.2 57.7 33.8.5 2.4 2.7 4.2 5.2 4.2h24c1.5 0 2.9-.6 3.9-1.7s1.5-2.6 1.4-4.1c-3.7-44.1-33-64.6-92.2-64.6-52.7 0-84.1 22.2-84.1 59.5 0 40.4 31.3 51.6 81.8 56.6 60.5 5.9 65.2 14.8 65.2 26.7 0 20.6-16.6 29.4-55.5 29.4-48.9 0-59.6-12.3-63.2-36.6-.4-2.6-2.6-4.5-5.3-4.5h-23.9c-3 0-5.3 2.4-5.3 5.3 0 31.1 16.9 68.2 97.8 68.2 58.4-.1 92-23.2 92-63.4z"],
"npm": [576, 512, [], "f3d4", "M288 288h-32v-64h32v64zm288-128v192H288v32H160v-32H0V160h576zm-416 32H32v128h64v-96h32v96h32V192zm160 0H192v160h64v-32h64V192zm224 0H352v128h64v-96h32v96h32v-96h32v96h32V192z"],
"ns8": [640, 512, [], "f3d5", "M187.1 159.9l-34.2 113.7-54.5-113.7H49L0 320h44.9L76 213.5 126.6 320h56.9L232 159.9h-44.9zm452.5-.9c-2.9-18-23.9-28.1-42.1-31.3-44.6-7.8-101.9 16.3-88.5 58.8v.1c-43.8 8.7-74.3 26.8-94.2 48.2-3-9.8-13.6-16.6-34-16.6h-87.6c-9.3 0-12.9-2.3-11.5-7.4 1.6-5.5 1.9-6.8 3.7-12.2 2.1-6.4 7.8-7.1 13.3-7.1h133.5l9.7-31.5c-139.7 0-144.5-.5-160.1 1.2-12.3 1.3-23.5 4.8-30.6 15-6.8 9.9-14.4 35.6-17.6 47.1-5.4 19.4-.6 28.6 32.8 28.6h87.3c7.8 0 8.8 2.7 7.7 6.6-1.1 4.4-2.8 10-4.5 14.6-1.6 4.2-4.7 7.4-13.8 7.4H216.3L204.7 320c139.9 0 145.3-.6 160.9-2.3 6.6-.7 13-2.1 18.5-4.9.2 3.7.5 7.3 1.2 10.8 5.4 30.5 27.4 52.3 56.8 59.5 48.6 11.9 108.7-16.8 135.1-68 18.7-36.2 14.1-76.2-3.4-105.5h.1c29.6-5.9 70.3-22 65.7-50.6zM530.7 263.7c-5.9 29.5-36.6 47.8-61.6 43.9-30.9-4.8-38.5-39.5-14.1-64.8 16.2-16.8 45.2-24 68.5-26.9 6.7 14.1 10.3 32 7.2 47.8zm21.8-83.1c-4.2-6-9.8-18.5-2.5-26.3 6.7-7.2 20.9-10.1 31.8-7.7 15.3 3.4 19.7 15.9 4.9 24.4-10.7 6.1-23.6 8.1-34.2 9.6z"],
"nutritionix": [400, 512, [], "f3d6", "M88 8.1S221.4-.1 209 112.5c0 0 19.1-74.9 103-40.6 0 0-17.7 74-88 56 0 0 14.6-54.6 66.1-56.6 0 0-39.9-10.3-82.1 48.8 0 0-19.8-94.5-93.6-99.7 0 0 75.2 19.4 77.6 107.5 0 .1-106.4 7-104-119.8zm312 315.6c0 48.5-9.7 95.3-32 132.3-42.2 30.9-105 48-168 48-62.9 0-125.8-17.1-168-48C9.7 419 0 372.2 0 323.7 0 275.3 17.7 229 40 192c42.2-30.9 97.1-48.6 160-48.6 63 0 117.8 17.6 160 48.6 22.3 37 40 83.3 40 131.7zM120 428c0-15.5-12.5-28-28-28s-28 12.5-28 28 12.5 28 28 28 28-12.5 28-28zm0-66.2c0-15.5-12.5-28-28-28s-28 12.5-28 28 12.5 28 28 28 28-12.5 28-28zm0-66.2c0-15.5-12.5-28-28-28s-28 12.5-28 28 12.5 28 28 28 28-12.5 28-28zM192 428c0-15.5-12.5-28-28-28s-28 12.5-28 28 12.5 28 28 28 28-12.5 28-28zm0-66.2c0-15.5-12.5-28-28-28s-28 12.5-28 28 12.5 28 28 28 28-12.5 28-28zm0-66.2c0-15.5-12.5-28-28-28s-28 12.5-28 28 12.5 28 28 28 28-12.5 28-28zM264 428c0-15.5-12.5-28-28-28s-28 12.5-28 28 12.5 28 28 28 28-12.5 28-28zm0-66.2c0-15.5-12.5-28-28-28s-28 12.5-28 28 12.5 28 28 28 28-12.5 28-28zm0-66.2c0-15.5-12.5-28-28-28s-28 12.5-28 28 12.5 28 28 28 28-12.5 28-28zM336 428c0-15.5-12.5-28-28-28s-28 12.5-28 28 12.5 28 28 28 28-12.5 28-28zm0-66.2c0-15.5-12.5-28-28-28s-28 12.5-28 28 12.5 28 28 28 28-12.5 28-28zm0-66.2c0-15.5-12.5-28-28-28s-28 12.5-28 28 12.5 28 28 28 28-12.5 28-28zm24-39.6c-4.8-22.3-7.4-36.9-16-56-38.8-19.9-90.5-32-144-32S94.8 180.1 56 200c-8.8 19.5-11.2 33.9-16 56 42.2-7.9 98.7-14.8 160-14.8s117.8 6.9 160 14.8z"],
"odnoklassniki": [320, 512, [], "f263", "M275.1 334c-27.4 17.4-65.1 24.3-90 26.9l20.9 20.6 76.3 76.3c27.9 28.6-17.5 73.3-45.7 45.7-19.1-19.4-47.1-47.4-76.3-76.6L84 503.4c-28.2 27.5-73.6-17.6-45.4-45.7 19.4-19.4 47.1-47.4 76.3-76.3l20.6-20.6c-24.6-2.6-62.9-9.1-90.6-26.9-32.6-21-46.9-33.3-34.3-59 7.4-14.6 27.7-26.9 54.6-5.7 0 0 36.3 28.9 94.9 28.9s94.9-28.9 94.9-28.9c26.9-21.1 47.1-8.9 54.6 5.7 12.4 25.7-1.9 38-34.5 59.1zM30.3 129.7C30.3 58 88.6 0 160 0s129.7 58 129.7 129.7c0 71.4-58.3 129.4-129.7 129.4s-129.7-58-129.7-129.4zm66 0c0 35.1 28.6 63.7 63.7 63.7s63.7-28.6 63.7-63.7c0-35.4-28.6-64-63.7-64s-63.7 28.6-63.7 64z"],
"odnoklassniki-square": [448, 512, [], "f264", "M184.2 177.1c0-22.1 17.9-40 39.8-40s39.8 17.9 39.8 40c0 22-17.9 39.8-39.8 39.8s-39.8-17.9-39.8-39.8zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-305.1 97.1c0 44.6 36.4 80.9 81.1 80.9s81.1-36.2 81.1-80.9c0-44.8-36.4-81.1-81.1-81.1s-81.1 36.2-81.1 81.1zm174.5 90.7c-4.6-9.1-17.3-16.8-34.1-3.6 0 0-22.7 18-59.3 18s-59.3-18-59.3-18c-16.8-13.2-29.5-5.5-34.1 3.6-7.9 16.1 1.1 23.7 21.4 37 17.3 11.1 41.2 15.2 56.6 16.8l-12.9 12.9c-18.2 18-35.5 35.5-47.7 47.7-17.6 17.6 10.7 45.8 28.4 28.6l47.7-47.9c18.2 18.2 35.7 35.7 47.7 47.9 17.6 17.2 46-10.7 28.6-28.6l-47.7-47.7-13-12.9c15.5-1.6 39.1-5.9 56.2-16.8 20.4-13.3 29.3-21 21.5-37z"],
"old-republic": [496, 512, [], "f510", "M235.76 10.23c7.5-.31 15-.28 22.5-.09 3.61.14 7.2.4 10.79.73 4.92.27 9.79 1.03 14.67 1.62 2.93.43 5.83.98 8.75 1.46 7.9 1.33 15.67 3.28 23.39 5.4 12.24 3.47 24.19 7.92 35.76 13.21 26.56 12.24 50.94 29.21 71.63 49.88 20.03 20.09 36.72 43.55 48.89 69.19 1.13 2.59 2.44 5.1 3.47 7.74 2.81 6.43 5.39 12.97 7.58 19.63 4.14 12.33 7.34 24.99 9.42 37.83.57 3.14 1.04 6.3 1.4 9.47.55 3.83.94 7.69 1.18 11.56.83 8.34.84 16.73.77 25.1-.07 4.97-.26 9.94-.75 14.89-.24 3.38-.51 6.76-.98 10.12-.39 2.72-.63 5.46-1.11 8.17-.9 5.15-1.7 10.31-2.87 15.41-4.1 18.5-10.3 36.55-18.51 53.63-15.77 32.83-38.83 62.17-67.12 85.12a246.503 246.503 0 0 1-56.91 34.86c-6.21 2.68-12.46 5.25-18.87 7.41-3.51 1.16-7.01 2.38-10.57 3.39-6.62 1.88-13.29 3.64-20.04 5-4.66.91-9.34 1.73-14.03 2.48-5.25.66-10.5 1.44-15.79 1.74-6.69.66-13.41.84-20.12.81-6.82.03-13.65-.12-20.45-.79-3.29-.23-6.57-.5-9.83-.95-2.72-.39-5.46-.63-8.17-1.11-4.12-.72-8.25-1.37-12.35-2.22-4.25-.94-8.49-1.89-12.69-3.02-8.63-2.17-17.08-5.01-25.41-8.13-10.49-4.12-20.79-8.75-30.64-14.25-2.14-1.15-4.28-2.29-6.35-3.57-11.22-6.58-21.86-14.1-31.92-22.34-34.68-28.41-61.41-66.43-76.35-108.7-3.09-8.74-5.71-17.65-7.8-26.68-1.48-6.16-2.52-12.42-3.58-18.66-.4-2.35-.61-4.73-.95-7.09-.6-3.96-.75-7.96-1.17-11.94-.8-9.47-.71-18.99-.51-28.49.14-3.51.34-7.01.7-10.51.31-3.17.46-6.37.92-9.52.41-2.81.65-5.65 1.16-8.44.7-3.94 1.3-7.9 2.12-11.82 3.43-16.52 8.47-32.73 15.26-48.18 1.15-2.92 2.59-5.72 3.86-8.59 8.05-16.71 17.9-32.56 29.49-47.06 20-25.38 45.1-46.68 73.27-62.47 7.5-4.15 15.16-8.05 23.07-11.37 15.82-6.88 32.41-11.95 49.31-15.38 3.51-.67 7.04-1.24 10.56-1.85 2.62-.47 5.28-.7 7.91-1.08 3.53-.53 7.1-.68 10.65-1.04 2.46-.24 4.91-.36 7.36-.51m8.64 24.41c-9.23.1-18.43.99-27.57 2.23-7.3 1.08-14.53 2.6-21.71 4.3-13.91 3.5-27.48 8.34-40.46 14.42-10.46 4.99-20.59 10.7-30.18 17.22-4.18 2.92-8.4 5.8-12.34 9.03-5.08 3.97-9.98 8.17-14.68 12.59-2.51 2.24-4.81 4.7-7.22 7.06-28.22 28.79-48.44 65.39-57.5 104.69-2.04 8.44-3.54 17.02-4.44 25.65-1.1 8.89-1.44 17.85-1.41 26.8.11 7.14.38 14.28 1.22 21.37.62 7.12 1.87 14.16 3.2 21.18 1.07 4.65 2.03 9.32 3.33 13.91 6.29 23.38 16.5 45.7 30.07 65.75 8.64 12.98 18.78 24.93 29.98 35.77 16.28 15.82 35.05 29.04 55.34 39.22 7.28 3.52 14.66 6.87 22.27 9.63 5.04 1.76 10.06 3.57 15.22 4.98 11.26 3.23 22.77 5.6 34.39 7.06 2.91.29 5.81.61 8.72.9 13.82 1.08 27.74 1 41.54-.43 4.45-.6 8.92-.99 13.35-1.78 3.63-.67 7.28-1.25 10.87-2.1 4.13-.98 8.28-1.91 12.36-3.07 26.5-7.34 51.58-19.71 73.58-36.2 15.78-11.82 29.96-25.76 42.12-41.28 3.26-4.02 6.17-8.31 9.13-12.55 3.39-5.06 6.58-10.25 9.6-15.54 2.4-4.44 4.74-8.91 6.95-13.45 5.69-12.05 10.28-24.62 13.75-37.49 2.59-10.01 4.75-20.16 5.9-30.45 1.77-13.47 1.94-27.1 1.29-40.65-.29-3.89-.67-7.77-1-11.66-2.23-19.08-6.79-37.91-13.82-55.8-5.95-15.13-13.53-29.63-22.61-43.13-12.69-18.8-28.24-35.68-45.97-49.83-25.05-20-54.47-34.55-85.65-42.08-7.78-1.93-15.69-3.34-23.63-4.45-3.91-.59-7.85-.82-11.77-1.24-7.39-.57-14.81-.72-22.22-.58zM139.26 83.53c13.3-8.89 28.08-15.38 43.3-20.18-3.17 1.77-6.44 3.38-9.53 5.29-11.21 6.68-21.52 14.9-30.38 24.49-6.8 7.43-12.76 15.73-17.01 24.89-3.29 6.86-5.64 14.19-6.86 21.71-.93 4.85-1.3 9.81-1.17 14.75.13 13.66 4.44 27.08 11.29 38.82 5.92 10.22 13.63 19.33 22.36 27.26 4.85 4.36 10.24 8.09 14.95 12.6 2.26 2.19 4.49 4.42 6.43 6.91 2.62 3.31 4.89 6.99 5.99 11.1.9 3.02.66 6.2.69 9.31.02 4.1-.04 8.2.03 12.3.14 3.54-.02 7.09.11 10.63.08 2.38.02 4.76.05 7.14.16 5.77.06 11.53.15 17.3.11 2.91.02 5.82.13 8.74.03 1.63.13 3.28-.03 4.91-.91.12-1.82.18-2.73.16-10.99 0-21.88-2.63-31.95-6.93-6-2.7-11.81-5.89-17.09-9.83-5.75-4.19-11.09-8.96-15.79-14.31-6.53-7.24-11.98-15.39-16.62-23.95-1.07-2.03-2.24-4.02-3.18-6.12-1.16-2.64-2.62-5.14-3.67-7.82-4.05-9.68-6.57-19.94-8.08-30.31-.49-4.44-1.09-8.88-1.2-13.35-.7-15.73.84-31.55 4.67-46.82 2.12-8.15 4.77-16.18 8.31-23.83 6.32-14.2 15.34-27.18 26.3-38.19 6.28-6.2 13.13-11.84 20.53-16.67zm175.37-20.12c2.74.74 5.41 1.74 8.09 2.68 6.36 2.33 12.68 4.84 18.71 7.96 13.11 6.44 25.31 14.81 35.82 24.97 10.2 9.95 18.74 21.6 25.14 34.34 1.28 2.75 2.64 5.46 3.81 8.26 6.31 15.1 10 31.26 11.23 47.57.41 4.54.44 9.09.45 13.64.07 11.64-1.49 23.25-4.3 34.53-1.97 7.27-4.35 14.49-7.86 21.18-3.18 6.64-6.68 13.16-10.84 19.24-6.94 10.47-15.6 19.87-25.82 27.22-10.48 7.64-22.64 13.02-35.4 15.38-3.51.69-7.08 1.08-10.66 1.21-1.85.06-3.72.16-5.56-.1-.28-2.15 0-4.31-.01-6.46-.03-3.73.14-7.45.1-11.17.19-7.02.02-14.05.21-21.07.03-2.38-.03-4.76.03-7.14.17-5.07-.04-10.14.14-15.21.1-2.99-.24-6.04.51-8.96.66-2.5 1.78-4.86 3.09-7.08 4.46-7.31 11.06-12.96 17.68-18.26 5.38-4.18 10.47-8.77 15.02-13.84 7.68-8.37 14.17-17.88 18.78-28.27 2.5-5.93 4.52-12.1 5.55-18.46.86-4.37 1.06-8.83 1.01-13.27-.02-7.85-1.4-15.65-3.64-23.17-1.75-5.73-4.27-11.18-7.09-16.45-3.87-6.93-8.65-13.31-13.96-19.2-9.94-10.85-21.75-19.94-34.6-27.1-1.85-1.02-3.84-1.82-5.63-2.97zm-100.8 58.45c.98-1.18 1.99-2.33 3.12-3.38-.61.93-1.27 1.81-1.95 2.68-3.1 3.88-5.54 8.31-7.03 13.06-.87 3.27-1.68 6.6-1.73 10-.07 2.52-.08 5.07.32 7.57 1.13 7.63 4.33 14.85 8.77 21.12 2 2.7 4.25 5.27 6.92 7.33 1.62 1.27 3.53 2.09 5.34 3.05 3.11 1.68 6.32 3.23 9.07 5.48 2.67 2.09 4.55 5.33 4.4 8.79-.01 73.67 0 147.34-.01 221.02 0 1.35-.08 2.7.04 4.04.13 1.48.82 2.83 1.47 4.15.86 1.66 1.78 3.34 3.18 4.62.85.77 1.97 1.4 3.15 1.24 1.5-.2 2.66-1.35 3.45-2.57.96-1.51 1.68-3.16 2.28-4.85.76-2.13.44-4.42.54-6.63.14-4.03-.02-8.06.14-12.09.03-5.89.03-11.77.06-17.66.14-3.62.03-7.24.11-10.86.15-4.03-.02-8.06.14-12.09.03-5.99.03-11.98.07-17.97.14-3.62.02-7.24.11-10.86.14-3.93-.02-7.86.14-11.78.03-5.99.03-11.98.06-17.97.16-3.94-.01-7.88.19-11.82.29 1.44.13 2.92.22 4.38.19 3.61.42 7.23.76 10.84.32 3.44.44 6.89.86 10.32.37 3.1.51 6.22.95 9.31.57 4.09.87 8.21 1.54 12.29 1.46 9.04 2.83 18.11 5.09 26.99 1.13 4.82 2.4 9.61 4 14.3 2.54 7.9 5.72 15.67 10.31 22.62 1.73 2.64 3.87 4.98 6.1 7.21.27.25.55.51.88.71.6.25 1.31-.07 1.7-.57.71-.88 1.17-1.94 1.7-2.93 4.05-7.8 8.18-15.56 12.34-23.31.7-1.31 1.44-2.62 2.56-3.61 1.75-1.57 3.84-2.69 5.98-3.63 2.88-1.22 5.9-2.19 9.03-2.42 6.58-.62 13.11.75 19.56 1.85 3.69.58 7.4 1.17 11.13 1.41 3.74.1 7.48.05 11.21-.28 8.55-.92 16.99-2.96 24.94-6.25 5.3-2.24 10.46-4.83 15.31-7.93 11.46-7.21 21.46-16.57 30.04-27.01 1.17-1.42 2.25-2.9 3.46-4.28-1.2 3.24-2.67 6.37-4.16 9.48-1.25 2.9-2.84 5.61-4.27 8.42-5.16 9.63-11.02 18.91-17.75 27.52-4.03 5.21-8.53 10.05-13.33 14.57-6.64 6.05-14.07 11.37-22.43 14.76-8.21 3.37-17.31 4.63-26.09 3.29-3.56-.58-7.01-1.69-10.41-2.88-2.79-.97-5.39-2.38-8.03-3.69-3.43-1.71-6.64-3.81-9.71-6.08 2.71 3.06 5.69 5.86 8.7 8.61 4.27 3.76 8.74 7.31 13.63 10.23 3.98 2.45 8.29 4.4 12.84 5.51 1.46.37 2.96.46 4.45.6-1.25 1.1-2.63 2.04-3.99 2.98-9.61 6.54-20.01 11.86-30.69 16.43-20.86 8.7-43.17 13.97-65.74 15.34-4.66.24-9.32.36-13.98.36-4.98-.11-9.97-.13-14.92-.65-11.2-.76-22.29-2.73-33.17-5.43-10.35-2.71-20.55-6.12-30.3-10.55-8.71-3.86-17.12-8.42-24.99-13.79-1.83-1.31-3.74-2.53-5.37-4.08 6.6-1.19 13.03-3.39 18.99-6.48 5.74-2.86 10.99-6.66 15.63-11.07 2.24-2.19 4.29-4.59 6.19-7.09-3.43 2.13-6.93 4.15-10.62 5.78-4.41 2.16-9.07 3.77-13.81 5.02-5.73 1.52-11.74 1.73-17.61 1.14-8.13-.95-15.86-4.27-22.51-8.98-4.32-2.94-8.22-6.43-11.96-10.06-9.93-10.16-18.2-21.81-25.66-33.86-3.94-6.27-7.53-12.75-11.12-19.22-1.05-2.04-2.15-4.05-3.18-6.1 2.85 2.92 5.57 5.97 8.43 8.88 8.99 8.97 18.56 17.44 29.16 24.48 7.55 4.9 15.67 9.23 24.56 11.03 3.11.73 6.32.47 9.47.81 2.77.28 5.56.2 8.34.3 5.05.06 10.11.04 15.16-.16 3.65-.16 7.27-.66 10.89-1.09 2.07-.25 4.11-.71 6.14-1.2 3.88-.95 8.11-.96 11.83.61 4.76 1.85 8.44 5.64 11.38 9.71 2.16 3.02 4.06 6.22 5.66 9.58 1.16 2.43 2.46 4.79 3.55 7.26 1 2.24 2.15 4.42 3.42 6.52.67 1.02 1.4 2.15 2.62 2.55 1.06-.75 1.71-1.91 2.28-3.03 2.1-4.16 3.42-8.65 4.89-13.05 2.02-6.59 3.78-13.27 5.19-20.02 2.21-9.25 3.25-18.72 4.54-28.13.56-3.98.83-7.99 1.31-11.97.87-10.64 1.9-21.27 2.24-31.94.08-1.86.24-3.71.25-5.57.01-4.35.25-8.69.22-13.03-.01-2.38-.01-4.76 0-7.13.05-5.07-.2-10.14-.22-15.21-.2-6.61-.71-13.2-1.29-19.78-.73-5.88-1.55-11.78-3.12-17.51-2.05-7.75-5.59-15.03-9.8-21.82-3.16-5.07-6.79-9.88-11.09-14.03-3.88-3.86-8.58-7.08-13.94-8.45-1.5-.41-3.06-.45-4.59-.64.07-2.99.7-5.93 1.26-8.85 1.59-7.71 3.8-15.3 6.76-22.6 1.52-4.03 3.41-7.9 5.39-11.72 3.45-6.56 7.62-12.79 12.46-18.46zm31.27 1.7c.35-.06.71-.12 1.07-.19.19 1.79.09 3.58.1 5.37v38.13c-.01 1.74.13 3.49-.15 5.22-.36-.03-.71-.05-1.06-.05-.95-3.75-1.72-7.55-2.62-11.31-.38-1.53-.58-3.09-1.07-4.59-1.7-.24-3.43-.17-5.15-.2-5.06-.01-10.13 0-15.19-.01-1.66-.01-3.32.09-4.98-.03-.03-.39-.26-.91.16-1.18 1.28-.65 2.72-.88 4.06-1.35 3.43-1.14 6.88-2.16 10.31-3.31 1.39-.48 2.9-.72 4.16-1.54.04-.56.02-1.13-.05-1.68-1.23-.55-2.53-.87-3.81-1.28-3.13-1.03-6.29-1.96-9.41-3.02-1.79-.62-3.67-1-5.41-1.79-.03-.37-.07-.73-.11-1.09 5.09-.19 10.2.06 15.3-.12 3.36-.13 6.73.08 10.09-.07.12-.39.26-.77.37-1.16 1.08-4.94 2.33-9.83 3.39-14.75zm5.97-.2c.36.05.72.12 1.08.2.98 3.85 1.73 7.76 2.71 11.61.36 1.42.56 2.88 1.03 4.27 2.53.18 5.07-.01 7.61.05 5.16.12 10.33.12 15.49.07.76-.01 1.52.03 2.28.08-.04.36-.07.72-.1 1.08-1.82.83-3.78 1.25-5.67 1.89-3.73 1.23-7.48 2.39-11.22 3.57-.57.17-1.12.42-1.67.64-.15.55-.18 1.12-.12 1.69.87.48 1.82.81 2.77 1.09 4.88 1.52 9.73 3.14 14.63 4.6.38.13.78.27 1.13.49.4.27.23.79.15 1.18-1.66.13-3.31.03-4.97.04-5.17.01-10.33-.01-15.5.01-1.61.03-3.22-.02-4.82.21-.52 1.67-.72 3.42-1.17 5.11-.94 3.57-1.52 7.24-2.54 10.78-.36.01-.71.02-1.06.06-.29-1.73-.15-3.48-.15-5.22v-38.13c.02-1.78-.08-3.58.11-5.37zM65.05 168.33c1.12-2.15 2.08-4.4 3.37-6.46-1.82 7.56-2.91 15.27-3.62 23-.8 7.71-.85 15.49-.54 23.23 1.05 19.94 5.54 39.83 14.23 57.88 2.99 5.99 6.35 11.83 10.5 17.11 6.12 7.47 12.53 14.76 19.84 21.09 4.8 4.1 9.99 7.78 15.54 10.8 3.27 1.65 6.51 3.39 9.94 4.68 5.01 2.03 10.19 3.61 15.42 4.94 3.83.96 7.78 1.41 11.52 2.71 5 1.57 9.47 4.61 13.03 8.43 4.93 5.23 8.09 11.87 10.2 18.67.99 2.9 1.59 5.91 2.17 8.92.15.75.22 1.52.16 2.29-6.5 2.78-13.26 5.06-20.26 6.18-4.11.78-8.29.99-12.46 1.08-10.25.24-20.47-1.76-30.12-5.12-3.74-1.42-7.49-2.85-11.03-4.72-8.06-3.84-15.64-8.7-22.46-14.46-2.92-2.55-5.83-5.13-8.4-8.03-9.16-9.83-16.3-21.41-21.79-33.65-2.39-5.55-4.61-11.18-6.37-16.96-1.17-3.94-2.36-7.89-3.26-11.91-.75-2.94-1.22-5.95-1.87-8.92-.46-2.14-.69-4.32-1.03-6.48-.85-5.43-1.28-10.93-1.33-16.43.11-6.18.25-12.37 1.07-18.5.4-2.86.67-5.74 1.15-8.6.98-5.7 2.14-11.37 3.71-16.93 3.09-11.65 7.48-22.95 12.69-33.84zm363.73-6.44c1.1 1.66 1.91 3.48 2.78 5.26 2.1 4.45 4.24 8.9 6.02 13.49 7.61 18.76 12.3 38.79 13.04 59.05.02 1.76.07 3.52.11 5.29.13 9.57-1.27 19.09-3.18 28.45-.73 3.59-1.54 7.17-2.58 10.69-4.04 14.72-10 29-18.41 41.78-8.21 12.57-19.01 23.55-31.84 31.41-5.73 3.59-11.79 6.64-18.05 9.19-5.78 2.19-11.71 4.03-17.8 5.11-6.4 1.05-12.91 1.52-19.4 1.23-7.92-.48-15.78-2.07-23.21-4.85-1.94-.8-3.94-1.46-5.84-2.33-.21-1.51.25-2.99.53-4.46 1.16-5.74 3.03-11.36 5.7-16.58 2.37-4.51 5.52-8.65 9.46-11.9 2.43-2.05 5.24-3.61 8.16-4.83 3.58-1.5 7.47-1.97 11.24-2.83 7.23-1.71 14.37-3.93 21.15-7 10.35-4.65 19.71-11.38 27.65-19.46 1.59-1.61 3.23-3.18 4.74-4.87 3.37-3.76 6.71-7.57 9.85-11.53 7.48-10.07 12.82-21.59 16.71-33.48 1.58-5.3 3.21-10.6 4.21-16.05.63-2.87 1.04-5.78 1.52-8.68.87-6.09 1.59-12.22 1.68-18.38.12-6.65.14-13.32-.53-19.94-.73-7.99-1.87-15.96-3.71-23.78z"],
"opencart": [640, 512, [], "f23d", "M423.3 440.7c0 25.3-20.3 45.6-45.6 45.6s-45.8-20.3-45.8-45.6 20.6-45.8 45.8-45.8c25.4 0 45.6 20.5 45.6 45.8zm-253.9-45.8c-25.3 0-45.6 20.6-45.6 45.8s20.3 45.6 45.6 45.6 45.8-20.3 45.8-45.6-20.5-45.8-45.8-45.8zm291.7-270C158.9 124.9 81.9 112.1 0 25.7c34.4 51.7 53.3 148.9 373.1 144.2 333.3-5 130 86.1 70.8 188.9 186.7-166.7 319.4-233.9 17.2-233.9z"],
"openid": [448, 512, [], "f19b", "M271.5 432l-68 32C88.5 453.7 0 392.5 0 318.2c0-71.5 82.5-131 191.7-144.3v43c-71.5 12.5-124 53-124 101.3 0 51 58.5 93.3 135.7 103v-340l68-33.2v384zM448 291l-131.3-28.5 36.8-20.7c-19.5-11.5-43.5-20-70-24.8v-43c46.2 5.5 87.7 19.5 120.3 39.3l35-19.8L448 291z"],
"opera": [496, 512, [], "f26a", "M313.9 32.7c-170.2 0-252.6 223.8-147.5 355.1 36.5 45.4 88.6 75.6 147.5 75.6 36.3 0 70.3-11.1 99.4-30.4-43.8 39.2-101.9 63-165.3 63-3.9 0-8 0-11.9-.3C104.6 489.6 0 381.1 0 248 0 111 111 0 248 0h.8c63.1.3 120.7 24.1 164.4 63.1-29-19.4-63.1-30.4-99.3-30.4zm101.8 397.7c-40.9 24.7-90.7 23.6-132-5.8 56.2-20.5 97.7-91.6 97.7-176.6 0-84.7-41.2-155.8-97.4-176.6 41.8-29.2 91.2-30.3 132.9-5 105.9 98.7 105.5 265.7-1.2 364z"],
"optin-monster": [576, 512, [], "f23c", "M572.6 421.4c5.6-9.5 4.7-15.2-5.4-11.6-3-4.9-7-9.5-11.1-13.8 2.9-9.7-.7-14.2-10.8-9.2-4.6-3.2-10.3-6.5-15.9-9.2 0-15.1-11.6-11.6-17.6-5.7-10.4-1.5-18.7-.3-26.8 5.7.3-6.5.3-13 .3-19.7 12.6 0 40.2-11 45.9-36.2 1.4-6.8 1.6-13.8-.3-21.9-3-13.5-14.3-21.3-25.1-25.7-.8-5.9-7.6-14.3-14.9-15.9s-12.4 4.9-14.1 10.3c-8.5 0-19.2 2.8-21.1 8.4-5.4-.5-11.1-1.4-16.8-1.9 2.7-1.9 5.4-3.5 8.4-4.6 5.4-9.2 14.6-11.4 25.7-11.6V256c19.5-.5 43-5.9 53.8-18.1 12.7-13.8 14.6-37.3 12.4-55.1-2.4-17.3-9.7-37.6-24.6-48.1-8.4-5.9-21.6-.8-22.7 9.5-2.2 19.6 1.2 30-38.6 25.1-10.3-23.8-24.6-44.6-42.7-60C341 49.6 242.9 55.5 166.4 71.7c19.7 4.6 41.1 8.6 59.7 16.5-26.2 2.4-52.7 11.3-76.2 23.2-32.8 17-44 29.9-56.7 42.4 14.9-2.2 28.9-5.1 43.8-3.8-9.7 5.4-18.4 12.2-26.5 20-25.8.9-23.8-5.3-26.2-25.9-1.1-10.5-14.3-15.4-22.7-9.7-28.1 19.9-33.5 79.9-12.2 103.5 10.8 12.2 35.1 17.3 54.9 17.8-.3 1.1-.3 1.9-.3 2.7 10.8.5 19.5 2.7 24.6 11.6 3 1.1 5.7 2.7 8.1 4.6-5.4.5-11.1 1.4-16.5 1.9-3.3-6.6-13.7-8.1-21.1-8.1-1.6-5.7-6.5-12.2-14.1-10.3-6.8 1.9-14.1 10-14.9 15.9-22.5 9.5-30.1 26.8-25.1 47.6 5.3 24.8 33 36.2 45.9 36.2v19.7c-6.6-5-14.3-7.5-26.8-5.7-5.5-5.5-17.3-10.1-17.3 5.7-5.9 2.7-11.4 5.9-15.9 9.2-9.8-4.9-13.6-1.7-11.1 9.2-4.1 4.3-7.8 8.6-11.1 13.8-10.2-3.7-11 2.2-5.4 11.6-1.1 3.5-1.6 7-1.9 10.8-.5 31.6 44.6 64 73.5 65.1 17.3.5 34.6-8.4 43-23.5 113.2 4.9 226.7 4.1 340.2 0 8.1 15.1 25.4 24.3 42.7 23.5 29.2-1.1 74.3-33.5 73.5-65.1.2-3.7-.7-7.2-1.7-10.7zm-73.8-254c1.1-3 2.4-8.4 2.4-14.6 0-5.9 6.8-8.1 14.1-.8 11.1 11.6 14.9 40.5 13.8 51.1-4.1-13.6-13-29-30.3-35.7zm-4.6 6.7c19.5 6.2 28.6 27.6 29.7 48.9-1.1 2.7-3 5.4-4.9 7.6-5.7 5.9-15.4 10-26.2 12.2 4.3-21.3.3-47.3-12.7-63 4.9-.8 10.9-2.4 14.1-5.7zm-24.1 6.8c13.8 11.9 20 39.2 14.1 63.5-4.1.5-8.1.8-11.6.8-1.9-21.9-6.8-44-14.3-64.6 3.7.3 8.1.3 11.8.3zM47.5 203c-1.1-10.5 2.4-39.5 13.8-51.1 7-7.3 14.1-5.1 14.1.8 0 6.2 1.4 11.6 2.4 14.6-17.3 6.8-26.2 22.2-30.3 35.7zm9.7 27.6c-1.9-2.2-3.5-4.9-4.9-7.6 1.4-21.3 10.3-42.7 29.7-48.9 3.2 3.2 9.2 4.9 14.1 5.7-13 15.7-17 41.6-12.7 63-10.8-2.2-20.5-6-26.2-12.2zm47.9 14.6c-4.1 0-8.1-.3-12.7-.8-4.6-18.6-1.9-38.9 5.4-53v.3l12.2-5.1c4.9-1.9 9.7-3.8 14.9-4.9-10.7 19.7-17.4 41.3-19.8 63.5zm184-162.7c41.9 0 76.2 34 76.2 75.9 0 42.2-34.3 76.2-76.2 76.2s-76.2-34-76.2-76.2c0-41.8 34.3-75.9 76.2-75.9zm115.6 174.3c-.3 17.8-7 48.9-23 57-13.2 6.6-6.5-7.5-16.5-58.1 13.3.3 26.6.3 39.5 1.1zm-54-1.6c.8 4.9 3.8 40.3-1.6 41.9-11.6 3.5-40 4.3-51.1-1.1-4.1-3-4.6-35.9-4.3-41.1v.3c18.9-.3 38.1-.3 57 0zM278.3 309c-13 3.5-41.6 4.1-54.6-1.6-6.5-2.7-3.8-42.4-1.9-51.6 19.2-.5 38.4-.5 57.8-.8v.3c1.1 8.3 3.3 51.2-1.3 53.7zm-106.5-51.1c12.2-.8 24.6-1.4 36.8-1.6-2.4 15.4-3 43.5-4.9 52.2-1.1 6.8-4.3 6.8-9.7 4.3-21.9-9.8-27.6-35.2-22.2-54.9zm-35.4 31.3c7.8-1.1 15.7-1.9 23.5-2.7 1.6 6.2 3.8 11.9 7 17.6 10 17 44 35.7 45.1 7 6.2 14.9 40.8 12.2 54.9 10.8 15.7-1.4 23.8-1.4 26.8-14.3 12.4 4.3 30.8 4.1 44 3 11.3-.8 20.8-.5 24.6-8.9 1.1 5.1 1.9 11.6 4.6 16.8 10.8 21.3 37.3 1.4 46.8-31.6 8.6.8 17.6 1.9 26.5 2.7-.4 1.3-3.8 7.3 7.3 11.6-47.6 47-95.7 87.8-163.2 107-63.2-20.8-112.1-59.5-155.9-106.5 9.6-3.4 10.4-8.8 8-12.5zm-21.6 172.5c-3.8 17.8-21.9 29.7-39.7 28.9-19.2-.8-46.5-17-59.2-36.5-2.7-31.1 43.8-61.3 66.2-54.6 14.9 4.3 27.8 30.8 33.5 54 0 3-.3 5.7-.8 8.2zm-8.7-66c-.5-13.5-.5-27-.3-40.5h.3c2.7-1.6 5.7-3.8 7.8-6.5 6.5-1.6 13-5.1 15.1-9.2 3.3-7.1-7-7.5-5.4-12.4 2.7-1.1 5.7-2.2 7.8-3.5 29.2 29.2 58.6 56.5 97.3 77-36.8 11.3-72.4 27.6-105.9 47-1.2-18.6-7.7-35.9-16.7-51.9zm337.6 64.6c-103 3.5-206.2 4.1-309.4 0 0 .3 0 .3-.3.3v-.3h.3c35.1-21.6 72.2-39.2 112.4-50.8 11.6 5.1 23 9.5 34.9 13.2 2.2.8 2.2.8 4.3 0 14.3-4.1 28.4-9.2 42.2-15.4 41.5 11.7 78.8 31.7 115.6 53zm10.5-12.4c-35.9-19.5-73-35.9-111.9-47.6 38.1-20 71.9-47.3 103.5-76.7 2.2 1.4 4.6 2.4 7.6 3.2 0 .8.3 1.9.5 2.4-4.6 2.7-7.8 6.2-5.9 10.3 2.2 3.8 8.6 7.6 15.1 8.9 2.4 2.7 5.1 5.1 8.1 6.8 0 13.8-.3 27.6-.8 41.3l.3-.3c-9.3 15.9-15.5 37-16.5 51.7zm105.9 6.2c-12.7 19.5-40 35.7-59.2 36.5-19.3.9-40.5-13.2-40.5-37 5.7-23.2 18.9-49.7 33.5-54 22.7-6.9 69.2 23.4 66.2 54.5zM372.9 75.2c-3.8-72.1-100.8-79.7-126-23.5 44.6-24.3 90.3-15.7 126 23.5zM74.8 407.1c-15.7 1.6-49.5 25.4-49.5 43.2 0 11.6 15.7 19.5 32.2 14.9 12.2-3.2 31.1-17.6 35.9-27.3 6-11.6-3.7-32.7-18.6-30.8zm215.9-176.2c28.6 0 51.9-21.6 51.9-48.4 0-36.1-40.5-58.1-72.2-44.3 9.5 3 16.5 11.6 16.5 21.6 0 23.3-33.3 32-46.5 11.3-7.3 34.1 19.4 59.8 50.3 59.8zM68 474.1c.5 6.5 12.2 12.7 21.6 9.5 6.8-2.7 14.6-10.5 17.3-16.2 3-7-1.1-20-9.7-18.4-8.9 1.6-29.7 16.7-29.2 25.1zm433.2-67c-14.9-1.9-24.6 19.2-18.9 30.8 4.9 9.7 24.1 24.1 36.2 27.3 16.5 4.6 32.2-3.2 32.2-14.9 0-17.8-33.8-41.6-49.5-43.2zM478.8 449c-8.4-1.6-12.4 11.3-9.5 18.4 2.4 5.7 10.3 13.5 17.3 16.2 9.2 3.2 21.1-3 21.3-9.5.9-8.4-20.2-23.5-29.1-25.1z"],
"osi": [512, 512, [], "f41a", "M8 266.44C10.3 130.64 105.4 34 221.8 18.34c138.8-18.6 255.6 75.8 278 201.1 21.3 118.8-44 230-151.6 274-9.3 3.8-14.4 1.7-18-7.7q-26.7-69.45-53.4-139c-3.1-8.1-1-13.2 7-16.8 24.2-11 39.3-29.4 43.3-55.8a71.47 71.47 0 0 0-64.5-82.2c-39-3.4-71.8 23.7-77.5 59.7-5.2 33 11.1 63.7 41.9 77.7 9.6 4.4 11.5 8.6 7.8 18.4q-26.85 69.9-53.7 139.9c-2.6 6.9-8.3 9.3-15.5 6.5-52.6-20.3-101.4-61-130.8-119-24.9-49.2-25.2-87.7-26.8-108.7zm20.9-1.9c.4 6.6.6 14.3 1.3 22.1 6.3 71.9 49.6 143.5 131 183.1 3.2 1.5 4.4.8 5.6-2.3q22.35-58.65 45-117.3c1.3-3.3.6-4.8-2.4-6.7-31.6-19.9-47.3-48.5-45.6-86 1-21.6 9.3-40.5 23.8-56.3 30-32.7 77-39.8 115.5-17.6a91.64 91.64 0 0 1 45.2 90.4c-3.6 30.6-19.3 53.9-45.7 69.8-2.7 1.6-3.5 2.9-2.3 6q22.8 58.8 45.2 117.7c1.2 3.1 2.4 3.8 5.6 2.3 35.5-16.6 65.2-40.3 88.1-72 34.8-48.2 49.1-101.9 42.3-161-13.7-117.5-119.4-214.8-255.5-198-106.1 13-195.3 102.5-197.1 225.8z"],
"page4": [496, 512, [], "f3d7", "M248 504C111 504 0 393 0 256S111 8 248 8c20.9 0 41.3 2.6 60.7 7.5L42.3 392H248v112zm0-143.6V146.8L98.6 360.4H248zm96 31.6v92.7c45.7-19.2 84.5-51.7 111.4-92.7H344zm57.4-138.2l-21.2 8.4 21.2 8.3v-16.7zm-20.3 54.5c-6.7 0-8 6.3-8 12.9v7.7h16.2v-10c0-5.9-2.3-10.6-8.2-10.6zM496 256c0 37.3-8.2 72.7-23 104.4H344V27.3C433.3 64.8 496 153.1 496 256zM360.4 143.6h68.2V96h-13.9v32.6h-13.9V99h-13.9v29.6h-12.7V96h-13.9v47.6zm68.1 185.3H402v-11c0-15.4-5.6-25.2-20.9-25.2-15.4 0-20.7 10.6-20.7 25.9v25.3h68.2v-15zm0-103l-68.2 29.7V268l68.2 29.5v-16.6l-14.4-5.7v-26.5l14.4-5.9v-16.9zm-4.8-68.5h-35.6V184H402v-12.2h11c8.6 15.8 1.3 35.3-18.6 35.3-22.5 0-28.3-25.3-15.5-37.7l-11.6-10.6c-16.2 17.5-12.2 63.9 27.1 63.9 34 0 44.7-35.9 29.3-65.3z"],
"pagelines": [384, 512, [], "f18c", "M384 312.7c-55.1 136.7-187.1 54-187.1 54-40.5 81.8-107.4 134.4-184.6 134.7-16.1 0-16.6-24.4 0-24.4 64.4-.3 120.5-42.7 157.2-110.1-41.1 15.9-118.6 27.9-161.6-82.2 109-44.9 159.1 11.2 178.3 45.5 9.9-24.4 17-50.9 21.6-79.7 0 0-139.7 21.9-149.5-98.1 119.1-47.9 152.6 76.7 152.6 76.7 1.6-16.7 3.3-52.6 3.3-53.4 0 0-106.3-73.7-38.1-165.2 124.6 43 61.4 162.4 61.4 162.4.5 1.6.5 23.8 0 33.4 0 0 45.2-89 136.4-57.5-4.2 134-141.9 106.4-141.9 106.4-4.4 27.4-11.2 53.4-20 77.5 0 0 83-91.8 172-20z"],
"palfed": [576, 512, [], "f3d8", "M384.9 193.9c0-47.4-55.2-44.2-95.4-29.8-1.3 39.4-2.5 80.7-3 119.8.7 2.8 2.6 6.2 15.1 6.2 36.8 0 83.4-42.8 83.3-96.2zm-194.5 72.2c.2 0 6.5-2.7 11.2-2.7 26.6 0 20.7 44.1-14.4 44.1-21.5 0-37.1-18.1-37.1-43 0-42 42.9-95.6 100.7-126.5 1-12.4 3-22 10.5-28.2 11.2-9 26.6-3.5 29.5 11.1 72.2-22.2 135.2 1 135.2 72 0 77.9-79.3 152.6-140.1 138.2-.1 39.4.9 74.4 2.7 100v.2c.2 3.4.6 12.5-5.3 19.1-9.6 10.6-33.4 10-36.4-22.3-4.1-44.4.2-206.1 1.4-242.5-21.5 15-58.5 50.3-58.5 75.9.2 2.5.4 4 .6 4.6zM8 181.1s-.1 37.4 38.4 37.4h30l22.4 217.2s0 44.3 44.7 44.3h288.9s44.7-.4 44.7-44.3l22.4-217.2h30s38.4 1.2 38.4-37.4c0 0 .1-37.4-38.4-37.4h-30.1c-7.3-25.6-30.2-74.3-119.4-74.3h-28V50.3s-2.7-18.4-21.1-18.4h-85.8s-21.1 0-21.1 18.4v19.1h-28.1s-105 4.2-120.5 74.3h-29S8 142.5 8 181.1z"],
"patreon": [512, 512, [], "f3d9", "M512 194.8c0 101.3-82.4 183.8-183.8 183.8-101.7 0-184.4-82.4-184.4-183.8 0-101.6 82.7-184.3 184.4-184.3C429.6 10.5 512 93.2 512 194.8zM0 501.5h90v-491H0v491z"],
"paypal": [384, 512, [], "f1ed", "M111.4 295.9c-3.5 19.2-17.4 108.7-21.5 134-.3 1.8-1 2.5-3 2.5H12.3c-7.6 0-13.1-6.6-12.1-13.9L58.8 46.6c1.5-9.6 10.1-16.9 20-16.9 152.3 0 165.1-3.7 204 11.4 60.1 23.3 65.6 79.5 44 140.3-21.5 62.6-72.5 89.5-140.1 90.3-43.4.7-69.5-7-75.3 24.2zM357.1 152c-1.8-1.3-2.5-1.8-3 1.3-2 11.4-5.1 22.5-8.8 33.6-39.9 113.8-150.5 103.9-204.5 103.9-6.1 0-10.1 3.3-10.9 9.4-22.6 140.4-27.1 169.7-27.1 169.7-1 7.1 3.5 12.9 10.6 12.9h63.5c8.6 0 15.7-6.3 17.4-14.9.7-5.4-1.1 6.1 14.4-91.3 4.6-22 14.3-19.7 29.3-19.7 71 0 126.4-28.8 142.9-112.3 6.5-34.8 4.6-71.4-23.8-92.6z"],
"penny-arcade": [640, 512, [], "f704", "M421.91 164.27c-4.49 19.45-1.4 6.06-15.1 65.29l39.73-10.61c-22.34-49.61-17.29-38.41-24.63-54.68zm-206.09 51.11c-20.19 5.4-11.31 3.03-39.63 10.58l4.46 46.19c28.17-7.59 20.62-5.57 34.82-9.34 42.3-9.79 32.85-56.42.35-47.43zm326.16-26.19l-45.47-99.2c-5.69-12.37-19.46-18.84-32.62-15.33-70.27 18.75-38.72 10.32-135.59 36.23a27.618 27.618 0 0 0-18.89 17.41C144.26 113.27 0 153.75 0 226.67c0 33.5 30.67 67.11 80.9 95.37l1.74 17.88a27.891 27.891 0 0 0-17.77 28.67l4.3 44.48c1.39 14.31 13.43 25.21 27.8 25.2 5.18-.01-3.01 1.78 122.53-31.76 12.57-3.37 21.12-15.02 20.58-28.02 216.59 45.5 401.99-5.98 399.89-84.83.01-28.15-22.19-66.56-97.99-104.47zM255.14 298.3l-21.91 5.88-48.44 12.91 2.46 23.55 20.53-5.51 4.51 44.51-115.31 30.78-4.3-44.52 20.02-5.35-11.11-114.64-20.12 5.39-4.35-44.5c178.15-47.54 170.18-46.42 186.22-46.65 56.66-1.13 64.15 71.84 42.55 104.43a86.7 86.7 0 0 1-50.75 33.72zm199.18 16.62l-3.89-39.49 14.9-3.98-6.61-14.68-57.76 15.42-4.1 17.54 19.2-5.12 4.05 39.54-112.85 30.07-4.46-44.43 20.99-5.59 33.08-126.47-17.15 4.56-4.2-44.48c93.36-24.99 65.01-17.41 135.59-36.24l66.67 145.47 20.79-5.56 4.3 44.48-108.55 28.96z"],
"periscope": [448, 512, [], "f3da", "M370 63.6C331.4 22.6 280.5 0 226.6 0 111.9 0 18.5 96.2 18.5 214.4c0 75.1 57.8 159.8 82.7 192.7C137.8 455.5 192.6 512 226.6 512c41.6 0 112.9-94.2 120.9-105 24.6-33.1 82-118.3 82-192.6 0-56.5-21.1-110.1-59.5-150.8zM226.6 493.9c-42.5 0-190-167.3-190-279.4 0-107.4 83.9-196.3 190-196.3 100.8 0 184.7 89 184.7 196.3.1 112.1-147.4 279.4-184.7 279.4zM338 206.8c0 59.1-51.1 109.7-110.8 109.7-100.6 0-150.7-108.2-92.9-181.8v.4c0 24.5 20.1 44.4 44.8 44.4 24.7 0 44.8-19.9 44.8-44.4 0-18.2-11.1-33.8-26.9-40.7 76.6-19.2 141 39.3 141 112.4z"],
"phabricator": [496, 512, [], "f3db", "M323 262.1l-.1-13s21.7-19.8 21.1-21.2l-9.5-20c-.6-1.4-29.5-.5-29.5-.5l-9.4-9.3s.2-28.5-1.2-29.1l-20.1-9.2c-1.4-.6-20.7 21-20.7 21l-13.1-.2s-20.5-21.4-21.9-20.8l-20 8.3c-1.4.5.2 28.9.2 28.9l-9.1 9.1s-29.2-.9-29.7.4l-8.1 19.8c-.6 1.4 21 21 21 21l.1 12.9s-21.7 19.8-21.1 21.2l9.5 20c.6 1.4 29.5.5 29.5.5l9.4 9.3s-.2 31.8 1.2 32.3l20.1 8.3c1.4.6 20.7-23.5 20.7-23.5l13.1.2s20.5 23.8 21.8 23.3l20-7.5c1.4-.6-.2-32.1-.2-32.1l9.1-9.1s29.2.9 29.7-.5l8.1-19.8c.7-1.1-20.9-20.7-20.9-20.7zm-44.9-8.7c.7 17.1-12.8 31.6-30.1 32.4-17.3.8-32.1-12.5-32.8-29.6-.7-17.1 12.8-31.6 30.1-32.3 17.3-.8 32.1 12.5 32.8 29.5zm201.2-37.9l-97-97-.1.1c-75.1-73.3-195.4-72.8-269.8 1.6-50.9 51-27.8 27.9-95.7 95.3-22.3 22.3-22.3 58.7 0 81 69.9 69.4 46.4 46 97.4 97l.1-.1c75.1 73.3 195.4 72.9 269.8-1.6 51-50.9 27.9-27.9 95.3-95.3 22.3-22.3 22.3-58.7 0-81zM140.4 363.8c-59.6-59.5-59.6-156 0-215.5 59.5-59.6 156-59.5 215.6 0 59.5 59.5 59.6 156 0 215.6-59.6 59.5-156 59.4-215.6-.1z"],
"phoenix-framework": [640, 512, [], "f3dc", "M212.9 344.3c3.8-.1 22.8-1.4 25.6-2.2-2.4-2.6-43.6-1-68-49.6-4.3-8.6-7.5-17.6-6.4-27.6 2.9-25.5 32.9-30 52-18.5 36 21.6 63.3 91.3 113.7 97.5 37 4.5 84.6-17 108.2-45.4-.6-.1-.8-.2-1-.1-.4.1-.8.2-1.1.3-33.3 12.1-94.3 9.7-134.7-14.8-37.6-22.8-53.1-58.7-51.8-74.6 1.8-21.3 22.9-23.2 35.9-19.6 14.4 3.9 24.4 17.6 38.9 27.4 15.6 10.4 32.9 13.7 51.3 10.3 14.9-2.7 34.4-12.3 36.5-14.5-1.1-.1-1.8-.1-2.5-.2-6.2-.6-12.4-.8-18.5-1.7C279.8 194.5 262.1 47.4 138.5 37.9 94.2 34.5 39.1 46 2.2 72.9c-.8.6-1.5 1.2-2.2 1.8.1.2.1.3.2.5.8 0 1.6-.1 2.4-.2 6.3-1 12.5-.8 18.7.3 23.8 4.3 47.7 23.1 55.9 76.5 5.3 34.3-.7 50.8 8 86.1 19 77.1 91 107.6 127.7 106.4zM75.3 64.9c-.9-1-.9-1.2-1.3-2 12.1-2.6 24.2-4.1 36.6-4.8-1.1 14.7-22.2 21.3-35.3 6.8zm196.9 350.5c-42.8 1.2-92-26.7-123.5-61.4-4.6-5-16.8-20.2-18.6-23.4l.4-.4c6.6 4.1 25.7 18.6 54.8 27 24.2 7 48.1 6.3 71.6-3.3 22.7-9.3 41-.5 43.1 2.9-18.5 3.8-20.1 4.4-24 7.9-5.1 4.4-4.6 11.7 7 17.2 26.2 12.4 63-2.8 97.2 25.4 2.4 2 8.1 7.8 10.1 10.7-.1.2-.3.3-.4.5-4.8-1.5-16.4-7.5-40.2-9.3-24.7-2-46.3 5.3-77.5 6.2zm174.8-252c16.4-5.2 41.3-13.4 66.5-3.3 16.1 6.5 26.2 18.7 32.1 34.6 3.5 9.4 5.1 19.7 5.1 28.7-.2 0-.4 0-.6.1-.2-.4-.4-.9-.5-1.3-5-22-29.9-43.8-67.6-29.9-50.2 18.6-130.4 9.7-176.9-48-.7-.9-2.4-1.7-1.3-3.2.1-.2 2.1.6 3 1.3 18.1 13.4 38.3 21.9 60.3 26.2 30.5 6.1 54.6 2.9 79.9-5.2zm102.7 117.5c-32.4.2-33.8 50.1-103.6 64.4-18.2 3.7-38.7 4.6-44.9 4.2v-.4c2.8-1.5 14.7-2.6 29.7-16.6 7.9-7.3 15.3-15.1 22.8-22.9 19.5-20.2 41.4-42.2 81.9-39 23.1 1.8 29.3 8.2 36.1 12.7.3.2.4.5.7.9-.5 0-.7.1-.9 0-7-2.7-14.3-3.3-21.8-3.3zm-12.3-24.1c-.1.2-.1.4-.2.6-28.9-4.4-48-7.9-68.5 4-17 9.9-31.4 20.5-62 24.4-27.1 3.4-45.1 2.4-66.1-8-.3-.2-.6-.4-1-.6 0-.2.1-.3.1-.5 24.9 3.8 36.4 5.1 55.5-5.8 22.3-12.9 40.1-26.6 71.3-31 29.6-4.1 51.3 2.5 70.9 16.9zM268.6 97.3c-.6-.6-1.1-1.2-2.1-2.3 7.6 0 29.7-1.2 53.4 8.4 19.7 8 32.2 21 50.2 32.9 11.1 7.3 23.4 9.3 36.4 8.1 4.3-.4 8.5-1.2 12.8-1.7.4-.1.9 0 1.5.3-.6.4-1.2.9-1.8 1.2-8.1 4-16.7 6.3-25.6 7.1-26.1 2.6-50.3-3.7-73.4-15.4-19.3-9.9-36.4-22.9-51.4-38.6zM640 335.7c-3.5 3.1-22.7 11.6-42.7 5.3-12.3-3.9-19.5-14.9-31.6-24.1-10-7.6-20.9-7.9-28.1-8.4.6-.8.9-1.2 1.2-1.4 14.8-9.2 30.5-12.2 47.3-6.5 12.5 4.2 19.2 13.5 30.4 24.2 10.8 10.4 21 9.9 23.1 10.5.1-.1.2 0 .4.4zm-212.5 137c2.2 1.2 1.6 1.5 1.5 2-18.5-1.4-33.9-7.6-46.8-22.2-21.8-24.7-41.7-27.9-48.6-29.7.5-.2.8-.4 1.1-.4 13.1.1 26.1.7 38.9 3.9 25.3 6.4 35 25.4 41.6 35.3 3.2 4.8 7.3 8.3 12.3 11.1z"],
"phoenix-squadron": [512, 512, [], "f511", "M96 63.38C142.49 27.25 201.55 7.31 260.51 8.81c29.58-.38 59.11 5.37 86.91 15.33-24.13-4.63-49-6.34-73.38-2.45C231.17 27 191 48.84 162.21 80.87c5.67-1 10.78-3.67 16-5.86 18.14-7.87 37.49-13.26 57.23-14.83 19.74-2.13 39.64-.43 59.28 1.92-14.42 2.79-29.12 4.57-43 9.59-34.43 11.07-65.27 33.16-86.3 62.63-13.8 19.71-23.63 42.86-24.67 67.13-.35 16.49 5.22 34.81 19.83 44a53.27 53.27 0 0 0 37.52 6.74c15.45-2.46 30.07-8.64 43.6-16.33 11.52-6.82 22.67-14.55 32-24.25 3.79-3.22 2.53-8.45 2.62-12.79-2.12-.34-4.38-1.11-6.3.3a203 203 0 0 1-35.82 15.37c-20 6.17-42.16 8.46-62.1.78 12.79 1.73 26.06.31 37.74-5.44 20.23-9.72 36.81-25.2 54.44-38.77a526.57 526.57 0 0 1 88.9-55.31c25.71-12 52.94-22.78 81.57-24.12-15.63 13.72-32.15 26.52-46.78 41.38-14.51 14-27.46 29.5-40.11 45.18-3.52 4.6-8.95 6.94-13.58 10.16a150.7 150.7 0 0 0-51.89 60.1c-9.33 19.68-14.5 41.85-11.77 63.65 1.94 13.69 8.71 27.59 20.9 34.91 12.9 8 29.05 8.07 43.48 5.1 32.8-7.45 61.43-28.89 81-55.84 20.44-27.52 30.52-62.2 29.16-96.35-.52-7.5-1.57-15-1.66-22.49 8 19.48 14.82 39.71 16.65 60.83 2 14.28.75 28.76-1.62 42.9-1.91 11-5.67 21.51-7.78 32.43a165 165 0 0 0 39.34-81.07 183.64 183.64 0 0 0-14.21-104.64c20.78 32 32.34 69.58 35.71 107.48.49 12.73.49 25.51 0 38.23A243.21 243.21 0 0 1 482 371.34c-26.12 47.34-68 85.63-117.19 108-78.29 36.23-174.68 31.32-248-14.68A248.34 248.34 0 0 1 25.36 366 238.34 238.34 0 0 1 0 273.08v-31.34C3.93 172 40.87 105.82 96 63.38m222 80.33a79.13 79.13 0 0 0 16-4.48c5-1.77 9.24-5.94 10.32-11.22-8.96 4.99-17.98 9.92-26.32 15.7z"],
"php": [640, 512, [], "f457", "M320 104.5c171.4 0 303.2 72.2 303.2 151.5S491.3 407.5 320 407.5c-171.4 0-303.2-72.2-303.2-151.5S148.7 104.5 320 104.5m0-16.8C143.3 87.7 0 163 0 256s143.3 168.3 320 168.3S640 349 640 256 496.7 87.7 320 87.7zM218.2 242.5c-7.9 40.5-35.8 36.3-70.1 36.3l13.7-70.6c38 0 63.8-4.1 56.4 34.3zM97.4 350.3h36.7l8.7-44.8c41.1 0 66.6 3 90.2-19.1 26.1-24 32.9-66.7 14.3-88.1-9.7-11.2-25.3-16.7-46.5-16.7h-70.7L97.4 350.3zm185.7-213.6h36.5l-8.7 44.8c31.5 0 60.7-2.3 74.8 10.7 14.8 13.6 7.7 31-8.3 113.1h-37c15.4-79.4 18.3-86 12.7-92-5.4-5.8-17.7-4.6-47.4-4.6l-18.8 96.6h-36.5l32.7-168.6zM505 242.5c-8 41.1-36.7 36.3-70.1 36.3l13.7-70.6c38.2 0 63.8-4.1 56.4 34.3zM384.2 350.3H421l8.7-44.8c43.2 0 67.1 2.5 90.2-19.1 26.1-24 32.9-66.7 14.3-88.1-9.7-11.2-25.3-16.7-46.5-16.7H417l-32.8 168.7z"],
"pied-piper": [448, 512, [], "f2ae", "M32 419L0 479.2l.8-328C.8 85.3 54 32 120 32h327.2c-93 28.9-189.9 94.2-253.9 168.6C122.7 282 82.6 338 32 419M448 32S305.2 98.8 261.6 199.1c-23.2 53.6-28.9 118.1-71 158.6-28.9 27.8-69.8 38.2-105.3 56.3-23.2 12-66.4 40.5-84.9 66h328.4c66 0 119.3-53.3 119.3-119.2-.1 0-.1-328.8-.1-328.8z"],
"pied-piper-alt": [576, 512, [], "f1a8", "M244 246c-3.2-2-6.3-2.9-10.1-2.9-6.6 0-12.6 3.2-19.3 3.7l1.7 4.9zm135.9 197.9c-19 0-64.1 9.5-79.9 19.8l6.9 45.1c35.7 6.1 70.1 3.6 106-9.8-4.8-10-23.5-55.1-33-55.1zM340.8 177c6.6 2.8 11.5 9.2 22.7 22.1 2-1.4 7.5-5.2 7.5-8.6 0-4.9-11.8-13.2-13.2-23 11.2-5.7 25.2-6 37.6-8.9 68.1-16.4 116.3-52.9 146.8-116.7C548.3 29.3 554 16.1 554.6 2l-2 2.6c-28.4 50-33 63.2-81.3 100-31.9 24.4-69.2 40.2-106.6 54.6l-6.3-.3v-21.8c-19.6 1.6-19.7-14.6-31.6-23-18.7 20.6-31.6 40.8-58.9 51.1-12.7 4.8-19.6 10-25.9 21.8 34.9-16.4 91.2-13.5 98.8-10zM555.5 0l-.6 1.1-.3.9.6-.6zm-59.2 382.1c-33.9-56.9-75.3-118.4-150-115.5l-.3-6c-1.1-13.5 32.8 3.2 35.1-31l-14.4 7.2c-19.8-45.7-8.6-54.3-65.5-54.3-14.7 0-26.7 1.7-41.4 4.6 2.9 18.6 2.2 36.7-10.9 50.3l19.5 5.5c-1.7 3.2-2.9 6.3-2.9 9.8 0 21 42.8 2.9 42.8 33.6 0 18.4-36.8 60.1-54.9 60.1-8 0-53.7-50-53.4-60.1l.3-4.6 52.3-11.5c13-2.6 12.3-22.7-2.9-22.7-3.7 0-43.1 9.2-49.4 10.6-2-5.2-7.5-14.1-13.8-14.1-3.2 0-6.3 3.2-9.5 4-9.2 2.6-31 2.9-21.5 20.1L15.9 298.5c-5.5 1.1-8.9 6.3-8.9 11.8 0 6 5.5 10.9 11.5 10.9 8 0 131.3-28.4 147.4-32.2 2.6 3.2 4.6 6.3 7.8 8.6 20.1 14.4 59.8 85.9 76.4 85.9 24.1 0 58-22.4 71.3-41.9 3.2-4.3 6.9-7.5 12.4-6.9.6 13.8-31.6 34.2-33 43.7-1.4 10.2-1 35.2-.3 41.1 26.7 8.1 52-3.6 77.9-2.9 4.3-21 10.6-41.9 9.8-63.5l-.3-9.5c-1.4-34.2-10.9-38.5-34.8-58.6-1.1-1.1-2.6-2.6-3.7-4 2.2-1.4 1.1-1 4.6-1.7 88.5 0 56.3 183.6 111.5 229.9 33.1-15 72.5-27.9 103.5-47.2-29-25.6-52.6-45.7-72.7-79.9zm-196.2 46.1v27.2l11.8-3.4-2.9-23.8zm-68.7-150.4l24.1 61.2 21-13.8-31.3-50.9zm84.4 154.9l2 12.4c9-1.5 58.4-6.6 58.4-14.1 0-1.4-.6-3.2-.9-4.6-26.8 0-36.9 3.8-59.5 6.3z"],
"pied-piper-hat": [640, 512, [], "f4e5", "M640 24.9c-80.8 53.6-89.4 92.5-96.4 104.4-6.7 12.2-11.7 60.3-23.3 83.6-11.7 23.6-54.2 42.2-66.1 50-11.7 7.8-28.3 38.1-41.9 64.2-108.1-4.4-167.4 38.8-259.2 93.6 29.4-9.7 43.3-16.7 43.3-16.7 94.2-36 139.3-68.3 281.1-49.2 1.1 0 1.9.6 2.8.8 3.9 2.2 5.3 6.9 3.1 10.8l-53.9 95.8c-2.5 4.7-7.8 7.2-13.1 6.1-126.8-23.8-226.9 17.3-318.9 18.6C24.1 488 0 453.4 0 451.8c0-1.1.6-1.7 1.7-1.7 0 0 38.3 0 103.1-15.3C178.4 294.5 244 245.4 315.4 245.4c0 0 71.7 0 90.6 61.9 22.8-39.7 28.3-49.2 28.3-49.2 5.3-9.4 35-77.2 86.4-141.4 51.5-64 90.4-79.9 119.3-91.8z"],
"pied-piper-pp": [448, 512, [], "f1a7", "M205.3 174.6c0 21.1-14.2 38.1-31.7 38.1-7.1 0-12.8-1.2-17.2-3.7v-68c4.4-2.7 10.1-4.2 17.2-4.2 17.5 0 31.7 16.9 31.7 37.8zm52.6 67c-7.1 0-12.8 1.5-17.2 4.2v68c4.4 2.5 10.1 3.7 17.2 3.7 17.4 0 31.7-16.9 31.7-37.8 0-21.1-14.3-38.1-31.7-38.1zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zM185 255.1c41 0 74.2-35.6 74.2-79.6 0-44-33.2-79.6-74.2-79.6-12 0-24.1 3.2-34.6 8.8h-45.7V311l51.8-10.1v-50.6c8.6 3.1 18.1 4.8 28.5 4.8zm158.4 25.3c0-44-33.2-79.6-73.9-79.6-3.2 0-6.4.2-9.6.7-3.7 12.5-10.1 23.8-19.2 33.4-13.8 15-32.2 23.8-51.8 24.8V416l51.8-10.1v-50.6c8.6 3.2 18.2 4.7 28.7 4.7 40.8 0 74-35.6 74-79.6z"],
"pinterest": [496, 512, [], "f0d2", "M496 256c0 137-111 248-248 248-25.6 0-50.2-3.9-73.4-11.1 10.1-16.5 25.2-43.5 30.8-65 3-11.6 15.4-59 15.4-59 8.1 15.4 31.7 28.5 56.8 28.5 74.8 0 128.7-68.8 128.7-154.3 0-81.9-66.9-143.2-152.9-143.2-107 0-163.9 71.8-163.9 150.1 0 36.4 19.4 81.7 50.3 96.1 4.7 2.2 7.2 1.2 8.3-3.3.8-3.4 5-20.3 6.9-28.1.6-2.5.3-4.7-1.7-7.1-10.1-12.5-18.3-35.3-18.3-56.6 0-54.7 41.4-107.6 112-107.6 60.9 0 103.6 41.5 103.6 100.9 0 67.1-33.9 113.6-78 113.6-24.3 0-42.6-20.1-36.7-44.8 7-29.5 20.5-61.3 20.5-82.6 0-19-10.2-34.9-31.4-34.9-24.9 0-44.9 25.7-44.9 60.2 0 22 7.4 36.8 7.4 36.8s-24.5 103.8-29 123.2c-5 21.4-3 51.6-.9 71.2C65.4 450.9 0 361.1 0 256 0 119 111 8 248 8s248 111 248 248z"],
"pinterest-p": [384, 512, [], "f231", "M204 6.5C101.4 6.5 0 74.9 0 185.6 0 256 39.6 296 63.6 296c9.9 0 15.6-27.6 15.6-35.4 0-9.3-23.7-29.1-23.7-67.8 0-80.4 61.2-137.4 140.4-137.4 68.1 0 118.5 38.7 118.5 109.8 0 53.1-21.3 152.7-90.3 152.7-24.9 0-46.2-18-46.2-43.8 0-37.8 26.4-74.4 26.4-113.4 0-66.2-93.9-54.2-93.9 25.8 0 16.8 2.1 35.4 9.6 50.7-13.8 59.4-42 147.9-42 209.1 0 18.9 2.7 37.5 4.5 56.4 3.4 3.8 1.7 3.4 6.9 1.5 50.4-69 48.6-82.5 71.4-172.8 12.3 23.4 44.1 36 69.3 36 106.2 0 153.9-103.5 153.9-196.8C384 71.3 298.2 6.5 204 6.5z"],
"pinterest-square": [448, 512, [], "f0d3", "M448 80v352c0 26.5-21.5 48-48 48H154.4c9.8-16.4 22.4-40 27.4-59.3 3-11.5 15.3-58.4 15.3-58.4 8 15.3 31.4 28.2 56.3 28.2 74.1 0 127.4-68.1 127.4-152.7 0-81.1-66.2-141.8-151.4-141.8-106 0-162.2 71.1-162.2 148.6 0 36 19.2 80.8 49.8 95.1 4.7 2.2 7.1 1.2 8.2-3.3.8-3.4 5-20.1 6.8-27.8.6-2.5.3-4.6-1.7-7-10.1-12.3-18.3-34.9-18.3-56 0-54.2 41-106.6 110.9-106.6 60.3 0 102.6 41.1 102.6 99.9 0 66.4-33.5 112.4-77.2 112.4-24.1 0-42.1-19.9-36.4-44.4 6.9-29.2 20.3-60.7 20.3-81.8 0-53-75.5-45.7-75.5 25 0 21.7 7.3 36.5 7.3 36.5-31.4 132.8-36.1 134.5-29.6 192.6l2.2.8H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48z"],
"playstation": [576, 512, [], "f3df", "M570.9 372.3c-11.3 14.2-38.8 24.3-38.8 24.3L327 470.2v-54.3l150.9-53.8c17.1-6.1 19.8-14.8 5.8-19.4-13.9-4.6-39.1-3.3-56.2 2.9L327 381.1v-56.4c23.2-7.8 47.1-13.6 75.7-16.8 40.9-4.5 90.9.6 130.2 15.5 44.2 14 49.2 34.7 38 48.9zm-224.4-92.5v-139c0-16.3-3-31.3-18.3-35.6-11.7-3.8-19 7.1-19 23.4v347.9l-93.8-29.8V32c39.9 7.4 98 24.9 129.2 35.4C424.1 94.7 451 128.7 451 205.2c0 74.5-46 102.8-104.5 74.6zM43.2 410.2c-45.4-12.8-53-39.5-32.3-54.8 19.1-14.2 51.7-24.9 51.7-24.9l134.5-47.8v54.5l-96.8 34.6c-17.1 6.1-19.7 14.8-5.8 19.4 13.9 4.6 39.1 3.3 56.2-2.9l46.4-16.9v48.8c-51.6 9.3-101.4 7.3-153.9-10z"],
"product-hunt": [512, 512, [], "f288", "M326.3 218.8c0 20.5-16.7 37.2-37.2 37.2h-70.3v-74.4h70.3c20.5 0 37.2 16.7 37.2 37.2zM504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-128.1-37.2c0-47.9-38.9-86.8-86.8-86.8H169.2v248h49.6v-74.4h70.3c47.9 0 86.8-38.9 86.8-86.8z"],
"pushed": [432, 512, [], "f3e1", "M407 111.9l-98.5-9 14-33.4c10.4-23.5-10.8-40.4-28.7-37L22.5 76.9c-15.1 2.7-26 18.3-21.4 36.6l105.1 348.3c6.5 21.3 36.7 24.2 47.7 7l35.3-80.8 235.2-231.3c16.4-16.8 4.3-42.9-17.4-44.8zM297.6 53.6c5.1-.7 7.5 2.5 5.2 7.4L286 100.9 108.6 84.6l189-31zM22.7 107.9c-3.1-5.1 1-10 6.1-9.1l248.7 22.7-96.9 230.7L22.7 107.9zM136 456.4c-2.6 4-7.9 3.1-9.4-1.2L43.5 179.7l127.7 197.6c-7 15-35.2 79.1-35.2 79.1zm272.8-314.5L210.1 337.3l89.7-213.7 106.4 9.7c4 1.1 5.7 5.3 2.6 8.6z"],
"python": [448, 512, [], "f3e2", "M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z"],
"qq": [448, 512, [], "f1d6", "M433.754 420.445c-11.526 1.393-44.86-52.741-44.86-52.741 0 31.345-16.136 72.247-51.051 101.786 16.842 5.192 54.843 19.167 45.803 34.421-7.316 12.343-125.51 7.881-159.632 4.037-34.122 3.844-152.316 8.306-159.632-4.037-9.045-15.25 28.918-29.214 45.783-34.415-34.92-29.539-51.059-70.445-51.059-101.792 0 0-33.334 54.134-44.859 52.741-5.37-.65-12.424-29.644 9.347-99.704 10.261-33.024 21.995-60.478 40.144-105.779C60.683 98.063 108.982.006 224 0c113.737.006 163.156 96.133 160.264 214.963 18.118 45.223 29.912 72.85 40.144 105.778 21.768 70.06 14.716 99.053 9.346 99.704z"],
"quinscape": [512, 512, [], "f459", "M313.6 474.6h-1a158.1 158.1 0 0 1 0-316.2c94.9 0 168.2 83.1 157 176.6 4 5.1 8.2 9.6 11.2 15.3 13.4-30.3 20.3-62.4 20.3-97.7C501.1 117.5 391.6 8 256.5 8S12 117.5 12 252.6s109.5 244.6 244.5 244.6a237.36 237.36 0 0 0 70.4-10.1c-5.2-3.5-8.9-8.1-13.3-12.5zm-.1-.1l.4.1zm78.4-168.9a99.2 99.2 0 1 0 99.2 99.2 99.18 99.18 0 0 0-99.2-99.2z"],
"quora": [448, 512, [], "f2c4", "M440.5 386.7h-29.3c-1.5 13.5-10.5 30.8-33 30.8-20.5 0-35.3-14.2-49.5-35.8 44.2-34.2 74.7-87.5 74.7-153C403.5 111.2 306.8 32 205 32 105.3 32 7.3 111.7 7.3 228.7c0 134.1 131.3 221.6 249 189C276 451.3 302 480 351.5 480c81.8 0 90.8-75.3 89-93.3zM297 329.2C277.5 300 253.3 277 205.5 277c-30.5 0-54.3 10-69 22.8l12.2 24.3c6.2-3 13-4 19.8-4 35.5 0 53.7 30.8 69.2 61.3-10 3-20.7 4.2-32.7 4.2-75 0-107.5-53-107.5-156.7C97.5 124.5 130 71 205 71c76.2 0 108.7 53.5 108.7 157.7.1 41.8-5.4 75.6-16.7 100.5z"],
"r-project": [581, 512, [], "f4f7", "M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"],
"raspberry-pi": [407, 512, [], "f7bb", "M372 232.5l-3.7-6.5c.1-46.4-21.4-65.3-46.5-79.7 7.6-2 15.4-3.6 17.6-13.2 13.1-3.3 15.8-9.4 17.1-15.8 3.4-2.3 14.8-8.7 13.6-19.7 6.4-4.4 10-10.1 8.1-18.1 6.9-7.5 8.7-13.7 5.8-19.4 8.3-10.3 4.6-15.6 1.1-20.9 6.2-11.2.7-23.2-16.6-21.2-6.9-10.1-21.9-7.8-24.2-7.8-2.6-3.2-6-6-16.5-4.7-6.8-6.1-14.4-5-22.3-2.1-9.3-7.3-15.5-1.4-22.6.8C271.6.6 269 5.5 263.5 7.6c-12.3-2.6-16.1 3-22 8.9l-6.9-.1c-18.6 10.8-27.8 32.8-31.1 44.1-3.3-11.3-12.5-33.3-31.1-44.1l-6.9.1c-5.9-5.9-9.7-11.5-22-8.9-5.6-2-8.1-7-19.4-3.4-4.6-1.4-8.9-4.4-13.9-4.3-2.6.1-5.5 1-8.7 3.5-7.9-3-15.5-4-22.3 2.1-10.5-1.3-14 1.4-16.5 4.7-2.3 0-17.3-2.3-24.2 7.8C21.2 16 15.8 28 22 39.2c-3.5 5.4-7.2 10.7 1.1 20.9-2.9 5.7-1.1 11.9 5.8 19.4-1.8 8 1.8 13.7 8.1 18.1-1.2 11 10.2 17.4 13.6 19.7 1.3 6.4 4 12.4 17.1 15.8 2.2 9.5 10 11.2 17.6 13.2-25.1 14.4-46.6 33.3-46.5 79.7l-3.7 6.5c-28.8 17.2-54.7 72.7-14.2 117.7 2.6 14.1 7.1 24.2 11 35.4 5.9 45.2 44.5 66.3 54.6 68.8 14.9 11.2 30.8 21.8 52.2 29.2C159 504.2 181 512 203 512h1c22.1 0 44-7.8 64.2-28.4 21.5-7.4 37.3-18 52.2-29.2 10.2-2.5 48.7-23.6 54.6-68.8 3.9-11.2 8.4-21.3 11-35.4 40.6-45.1 14.7-100.5-14-117.7zm-22.2-8c-1.5 18.7-98.9-65.1-82.1-67.9 45.7-7.5 83.6 19.2 82.1 67.9zm-43 93.1c-24.5 15.8-59.8 5.6-78.8-22.8s-14.6-64.2 9.9-80c24.5-15.8 59.8-5.6 78.8 22.8s14.6 64.2-9.9 80zM238.9 29.3c.8 4.2 1.8 6.8 2.9 7.6 5.4-5.8 9.8-11.7 16.8-17.3 0 3.3-1.7 6.8 2.5 9.4 3.7-5 8.8-9.5 15.5-13.3-3.2 5.6-.6 7.3 1.2 9.6 5.1-4.4 10-8.8 19.4-12.3-2.6 3.1-6.2 6.2-2.4 9.8 5.3-3.3 10.6-6.6 23.1-8.9-2.8 3.1-8.7 6.3-5.1 9.4 6.6-2.5 14-4.4 22.1-5.4-3.9 3.2-7.1 6.3-3.9 8.8 7.1-2.2 16.9-5.1 26.4-2.6l-6 6.1c-.7.8 14.1.6 23.9.8-3.6 5-7.2 9.7-9.3 18.2 1 1 5.8.4 10.4 0-4.7 9.9-12.8 12.3-14.7 16.6 2.9 2.2 6.8 1.6 11.2.1-3.4 6.9-10.4 11.7-16 17.3 1.4 1 3.9 1.6 9.7.9-5.2 5.5-11.4 10.5-18.8 15 1.3 1.5 5.8 1.5 10 1.6-6.7 6.5-15.3 9.9-23.4 14.2 4 2.7 6.9 2.1 10 2.1-5.7 4.7-15.4 7.1-24.4 10 1.7 2.7 3.4 3.4 7.1 4.1-9.5 5.3-23.2 2.9-27 5.6.9 2.7 3.6 4.4 6.7 5.8-15.4.9-57.3-.6-65.4-32.3 15.7-17.3 44.4-37.5 93.7-62.6-38.4 12.8-73 30-102 53.5-34.3-15.9-10.8-55.9 5.8-71.8zm-34.4 114.6c24.2-.3 54.1 17.8 54 34.7-.1 15-21 27.1-53.8 26.9-32.1-.4-53.7-15.2-53.6-29.8 0-11.9 26.2-32.5 53.4-31.8zm-123-12.8c3.7-.7 5.4-1.5 7.1-4.1-9-2.8-18.7-5.3-24.4-10 3.1 0 6 .7 10-2.1-8.1-4.3-16.7-7.7-23.4-14.2 4.2-.1 8.7 0 10-1.6-7.4-4.5-13.6-9.5-18.8-15 5.8.7 8.3.1 9.7-.9-5.6-5.6-12.7-10.4-16-17.3 4.3 1.5 8.3 2 11.2-.1-1.9-4.2-10-6.7-14.7-16.6 4.6.4 9.4 1 10.4 0-2.1-8.5-5.8-13.3-9.3-18.2 9.8-.1 24.6 0 23.9-.8l-6-6.1c9.5-2.5 19.3.4 26.4 2.6 3.2-2.5-.1-5.6-3.9-8.8 8.1 1.1 15.4 2.9 22.1 5.4 3.5-3.1-2.3-6.3-5.1-9.4 12.5 2.3 17.8 5.6 23.1 8.9 3.8-3.6.2-6.7-2.4-9.8 9.4 3.4 14.3 7.9 19.4 12.3 1.7-2.3 4.4-4 1.2-9.6 6.7 3.8 11.8 8.3 15.5 13.3 4.1-2.6 2.5-6.2 2.5-9.4 7 5.6 11.4 11.5 16.8 17.3 1.1-.8 2-3.4 2.9-7.6 16.6 15.9 40.1 55.9 6 71.8-29-23.5-63.6-40.7-102-53.5 49.3 25 78 45.3 93.7 62.6-8 31.8-50 33.2-65.4 32.3 3.1-1.4 5.8-3.2 6.7-5.8-4-2.8-17.6-.4-27.2-5.6zm60.1 24.1c16.8 2.8-80.6 86.5-82.1 67.9-1.5-48.7 36.5-75.5 82.1-67.9zM38.2 342c-23.7-18.8-31.3-73.7 12.6-98.3 26.5-7 9 107.8-12.6 98.3zm91 98.2c-13.3 7.9-45.8 4.7-68.8-27.9-15.5-27.4-13.5-55.2-2.6-63.4 16.3-9.8 41.5 3.4 60.9 25.6 16.9 20 24.6 55.3 10.5 65.7zm-26.4-119.7c-24.5-15.8-28.9-51.6-9.9-80s54.3-38.6 78.8-22.8 28.9 51.6 9.9 80c-19.1 28.4-54.4 38.6-78.8 22.8zM205 496c-29.4 1.2-58.2-23.7-57.8-32.3-.4-12.7 35.8-22.6 59.3-22 23.7-1 55.6 7.5 55.7 18.9.5 11-28.8 35.9-57.2 35.4zm58.9-124.9c.2 29.7-26.2 53.8-58.8 54-32.6.2-59.2-23.8-59.4-53.4v-.6c-.2-29.7 26.2-53.8 58.8-54 32.6-.2 59.2 23.8 59.4 53.4v.6zm82.2 42.7c-25.3 34.6-59.6 35.9-72.3 26.3-13.3-12.4-3.2-50.9 15.1-72 20.9-23.3 43.3-38.5 58.9-26.6 10.5 10.3 16.7 49.1-1.7 72.3zm22.9-73.2c-21.5 9.4-39-105.3-12.6-98.3 43.9 24.7 36.3 79.6 12.6 98.3z"],
"ravelry": [512, 512, [], "f2d9", "M407.4 61.5C331.6 22.1 257.8 31 182.9 66c-11.3 5.2-15.5 10.6-19.9 19-10.3 19.2-16.2 37.4-19.9 52.7-21.2 25.6-36.4 56.1-43.3 89.9-10.6 18-20.9 41.4-23.1 71.4 0 0-.7 7.6-.5 7.9-35.3-4.6-76.2-27-76.2-27 9.1 14.5 61.3 32.3 76.3 37.9 0 0 1.7 98 64.5 131.2-11.3-17.2-13.3-20.2-13.3-20.2S94.8 369 100.4 324.7c.7 0 1.5.2 2.2.2 23.9 87.4 103.2 151.4 196.9 151.4 6.2 0 12.1-.2 18-.7 14 1.5 27.6.5 40.1-3.9 6.9-2.2 13.8-6.4 20.2-10.8 70.2-39.1 100.9-82 123.1-147.7 5.4-16 8.1-35.5 9.8-52.2 8.7-82.3-30.6-161.6-103.3-199.5zM138.8 163.2s-1.2 12.3-.7 19.7c-3.4 2.5-10.1 8.1-18.2 16.7 5.2-12.8 11.3-25.1 18.9-36.4zm-31.2 121.9c4.4-17.2 13.3-39.1 29.8-55.1 0 0 1.7 48 15.8 90.1l-41.4-6.9c-2.2-9.2-3.5-18.5-4.2-28.1zm7.9 42.8c14.8 3.2 34 7.6 43.1 9.1 27.3 76.8 108.3 124.3 108.3 124.3 1 .5 1.7.7 2.7 1-73.1-11.6-132.7-64.7-154.1-134.4zM386 444.1c-14.5 4.7-36.2 8.4-64.7 3.7 0 0-91.1-23.1-127.5-107.8 38.2.7 52.4-.2 78-3.9 39.4-5.7 79-16.2 115-33 11.8-5.4 11.1-19.4 9.6-29.8-2-12.8-11.1-12.1-21.4-4.7 0 0-82 58.6-189.8 53.7-18.7-32-26.8-110.8-26.8-110.8 41.4-35.2 83.2-59.6 168.4-52.4.2-6.4 3-27.1-20.4-28.1 0 0-93.5-11.1-146 33.5 2.5-16.5 5.9-29.3 11.1-39.4 34.2-30.8 79-49.5 128.3-49.5 106.4 0 193 87.1 193 194.5-.2 76-43.8 142-106.8 174z"],
"react": [512, 512, [], "f41b", "M418.2 177.2c-5.4-1.8-10.8-3.5-16.2-5.1.9-3.7 1.7-7.4 2.5-11.1 12.3-59.6 4.2-107.5-23.1-123.3-26.3-15.1-69.2.6-112.6 38.4-4.3 3.7-8.5 7.6-12.5 11.5-2.7-2.6-5.5-5.2-8.3-7.7-45.5-40.4-91.1-57.4-118.4-41.5-26.2 15.2-34 60.3-23 116.7 1.1 5.6 2.3 11.1 3.7 16.7-6.4 1.8-12.7 3.8-18.6 5.9C38.3 196.2 0 225.4 0 255.6c0 31.2 40.8 62.5 96.3 81.5 4.5 1.5 9 3 13.6 4.3-1.5 6-2.8 11.9-4 18-10.5 55.5-2.3 99.5 23.9 114.6 27 15.6 72.4-.4 116.6-39.1 3.5-3.1 7-6.3 10.5-9.7 4.4 4.3 9 8.4 13.6 12.4 42.8 36.8 85.1 51.7 111.2 36.6 27-15.6 35.8-62.9 24.4-120.5-.9-4.4-1.9-8.9-3-13.5 3.2-.9 6.3-1.9 9.4-2.9 57.7-19.1 99.5-50 99.5-81.7 0-30.3-39.4-59.7-93.8-78.4zM282.9 92.3c37.2-32.4 71.9-45.1 87.7-36 16.9 9.7 23.4 48.9 12.8 100.4-.7 3.4-1.4 6.7-2.3 10-22.2-5-44.7-8.6-67.3-10.6-13-18.6-27.2-36.4-42.6-53.1 3.9-3.7 7.7-7.2 11.7-10.7zM167.2 307.5c5.1 8.7 10.3 17.4 15.8 25.9-15.6-1.7-31.1-4.2-46.4-7.5 4.4-14.4 9.9-29.3 16.3-44.5 4.6 8.8 9.3 17.5 14.3 26.1zm-30.3-120.3c14.4-3.2 29.7-5.8 45.6-7.8-5.3 8.3-10.5 16.8-15.4 25.4-4.9 8.5-9.7 17.2-14.2 26-6.3-14.9-11.6-29.5-16-43.6zm27.4 68.9c6.6-13.8 13.8-27.3 21.4-40.6s15.8-26.2 24.4-38.9c15-1.1 30.3-1.7 45.9-1.7s31 .6 45.9 1.7c8.5 12.6 16.6 25.5 24.3 38.7s14.9 26.7 21.7 40.4c-6.7 13.8-13.9 27.4-21.6 40.8-7.6 13.3-15.7 26.2-24.2 39-14.9 1.1-30.4 1.6-46.1 1.6s-30.9-.5-45.6-1.4c-8.7-12.7-16.9-25.7-24.6-39s-14.8-26.8-21.5-40.6zm180.6 51.2c5.1-8.8 9.9-17.7 14.6-26.7 6.4 14.5 12 29.2 16.9 44.3-15.5 3.5-31.2 6.2-47 8 5.4-8.4 10.5-17 15.5-25.6zm14.4-76.5c-4.7-8.8-9.5-17.6-14.5-26.2-4.9-8.5-10-16.9-15.3-25.2 16.1 2 31.5 4.7 45.9 8-4.6 14.8-10 29.2-16.1 43.4zM256.2 118.3c10.5 11.4 20.4 23.4 29.6 35.8-19.8-.9-39.7-.9-59.5 0 9.8-12.9 19.9-24.9 29.9-35.8zM140.2 57c16.8-9.8 54.1 4.2 93.4 39 2.5 2.2 5 4.6 7.6 7-15.5 16.7-29.8 34.5-42.9 53.1-22.6 2-45 5.5-67.2 10.4-1.3-5.1-2.4-10.3-3.5-15.5-9.4-48.4-3.2-84.9 12.6-94zm-24.5 263.6c-4.2-1.2-8.3-2.5-12.4-3.9-21.3-6.7-45.5-17.3-63-31.2-10.1-7-16.9-17.8-18.8-29.9 0-18.3 31.6-41.7 77.2-57.6 5.7-2 11.5-3.8 17.3-5.5 6.8 21.7 15 43 24.5 63.6-9.6 20.9-17.9 42.5-24.8 64.5zm116.6 98c-16.5 15.1-35.6 27.1-56.4 35.3-11.1 5.3-23.9 5.8-35.3 1.3-15.9-9.2-22.5-44.5-13.5-92 1.1-5.6 2.3-11.2 3.7-16.7 22.4 4.8 45 8.1 67.9 9.8 13.2 18.7 27.7 36.6 43.2 53.4-3.2 3.1-6.4 6.1-9.6 8.9zm24.5-24.3c-10.2-11-20.4-23.2-30.3-36.3 9.6.4 19.5.6 29.5.6 10.3 0 20.4-.2 30.4-.7-9.2 12.7-19.1 24.8-29.6 36.4zm130.7 30c-.9 12.2-6.9 23.6-16.5 31.3-15.9 9.2-49.8-2.8-86.4-34.2-4.2-3.6-8.4-7.5-12.7-11.5 15.3-16.9 29.4-34.8 42.2-53.6 22.9-1.9 45.7-5.4 68.2-10.5 1 4.1 1.9 8.2 2.7 12.2 4.9 21.6 5.7 44.1 2.5 66.3zm18.2-107.5c-2.8.9-5.6 1.8-8.5 2.6-7-21.8-15.6-43.1-25.5-63.8 9.6-20.4 17.7-41.4 24.5-62.9 5.2 1.5 10.2 3.1 15 4.7 46.6 16 79.3 39.8 79.3 58 0 19.6-34.9 44.9-84.8 61.4zm-149.7-15c25.3 0 45.8-20.5 45.8-45.8s-20.5-45.8-45.8-45.8c-25.3 0-45.8 20.5-45.8 45.8s20.5 45.8 45.8 45.8z"],
"reacteurope": [576, 512, [], "f75d", "M250.6 211.74l5.8-4.1 5.8 4.1-2.1-6.8 5.7-4.3-7.1-.1-2.3-6.8-2.3 6.8-7.2.1 5.7 4.3zm63.7 0l5.8-4.1 5.8 4.1-2.1-6.8 5.7-4.3-7.2-.1-2.3-6.8-2.3 6.8-7.2.1 5.7 4.3zm-91.3 50.5h-3.4c-4.8 0-3.8 4-3.8 12.1 0 4.7-2.3 6.1-5.8 6.1s-5.8-1.4-5.8-6.1v-36.6c0-4.7 2.3-6.1 5.8-6.1s5.8 1.4 5.8 6.1c0 7.2-.7 10.5 3.8 10.5h3.4c4.7-.1 3.8-3.9 3.8-12.3 0-9.9-6.7-14.1-16.8-14.1h-.2c-10.1 0-16.8 4.2-16.8 14.1V276c0 10.4 6.7 14.1 16.8 14.1h.2c10.1 0 16.8-3.8 16.8-14.1 0-9.86 1.1-13.76-3.8-13.76zm-80.7 17.4h-14.7v-19.3H139c2.5 0 3.8-1.3 3.8-3.8v-2.1c0-2.5-1.3-3.8-3.8-3.8h-11.4v-18.3H142c2.5 0 3.8-1.3 3.8-3.8v-2.1c0-2.5-1.3-3.8-3.8-3.8h-21.7c-2.4-.1-3.7 1.3-3.7 3.8v59.1c0 2.5 1.3 3.8 3.8 3.8h21.9c2.5 0 3.8-1.3 3.8-3.8v-2.1c0-2.5-1.3-3.8-3.8-3.8zm-42-18.5c4.6-2 7.3-6 7.3-12.4v-11.9c0-10.1-6.7-14.1-16.8-14.1H77.4c-2.5 0-3.8 1.3-3.8 3.8v59.1c0 2.5 1.3 3.8 3.8 3.8h3.4c2.5 0 3.8-1.3 3.8-3.8v-22.9h5.6l7.4 23.5a4.1 4.1 0 0 0 4.3 3.2h3.3c2.8 0 4-1.8 3.2-4.4zm-3.8-14c0 4.8-2.5 6.1-6.1 6.1h-5.8v-20.9h5.8c3.6 0 6.1 1.3 6.1 6.1zM176 226a3.82 3.82 0 0 0-4.2-3.4h-6.9a3.68 3.68 0 0 0-4 3.4l-11 59.2c-.5 2.7.9 4.1 3.4 4.1h3a3.74 3.74 0 0 0 4.1-3.5l1.8-11.3h12.2l1.8 11.3a3.74 3.74 0 0 0 4.1 3.5h3.5c2.6 0 3.9-1.4 3.4-4.1zm-12.3 39.3l4.7-29.7 4.7 29.7zm89.3 20.2v-53.2h7.5c2.5 0 3.8-1.3 3.8-3.8v-2.1c0-2.5-1.3-3.8-3.8-3.8h-25.8c-2.5 0-3.8 1.3-3.8 3.8v2.1c0 2.5 1.3 3.8 3.8 3.8h7.3v53.2c0 2.5 1.3 3.8 3.8 3.8h3.4c2.5.04 3.8-1.3 3.8-3.76zm248-.8h-19.4V258h16.1a1.89 1.89 0 0 0 2-2v-.8a1.89 1.89 0 0 0-2-2h-16.1v-25.8h19.1a1.89 1.89 0 0 0 2-2v-.8a1.77 1.77 0 0 0-2-1.9h-22.2a1.62 1.62 0 0 0-2 1.8v63a1.81 1.81 0 0 0 2 1.9H501a1.81 1.81 0 0 0 2-1.9v-.8a1.84 1.84 0 0 0-2-1.96zm-93.1-62.9h-.8c-10.1 0-15.3 4.7-15.3 14.1V276c0 9.3 5.2 14.1 15.3 14.1h.8c10.1 0 15.3-4.8 15.3-14.1v-40.1c0-9.36-5.2-14.06-15.3-14.06zm10.2 52.4c-.1 8-3 11.1-10.5 11.1s-10.5-3.1-10.5-11.1v-36.6c0-7.9 3-11.1 10.5-11.1s10.5 3.2 10.5 11.1zm-46.5-14.5c6.1-1.6 9.2-6.1 9.2-13.3v-9.7c0-9.4-5.2-14.1-15.3-14.1h-13.7a1.81 1.81 0 0 0-2 1.9v63a1.81 1.81 0 0 0 2 1.9h1.2a1.74 1.74 0 0 0 1.9-1.9v-26.9h11.6l10.4 27.2a2.32 2.32 0 0 0 2.3 1.5h1.5c1.4 0 2-1 1.5-2.3zm-6.4-3.9H355v-28.5h10.2c7.5 0 10.5 3.1 10.5 11.1v6.4c0 7.84-3 11.04-10.5 11.04zm85.9-33.1h-13.7a1.62 1.62 0 0 0-2 1.8v63a1.81 1.81 0 0 0 2 1.9h1.2a1.74 1.74 0 0 0 1.9-1.9v-26.1h10.6c10.1 0 15.3-4.8 15.3-14.1v-10.5c0-9.4-5.2-14.1-15.3-14.1zm10.2 22.8c0 7.9-3 11.1-10.5 11.1h-10.2v-29.2h10.2c7.5-.1 10.5 3.1 10.5 11zM259.5 308l-2.3-6.8-2.3 6.8-7.1.1 5.7 4.3-2.1 6.8 5.8-4.1 5.8 4.1-2.1-6.8 5.7-4.3zm227.6-136.1a364.42 364.42 0 0 0-35.6-11.3c19.6-78 11.6-134.7-22.3-153.9C394.7-12.66 343.3 11 291 61.94q5.1 4.95 10.2 10.2c82.5-80 119.6-53.5 120.9-52.8 22.4 12.7 36 55.8 15.5 137.8a587.83 587.83 0 0 0-84.6-13C281.1 43.64 212.4 2 170.8 2 140 2 127 23 123.2 29.74c-18.1 32-13.3 84.2.1 133.8-70.5 20.3-120.7 54.1-120.3 95 .5 59.6 103.2 87.8 122.1 92.8-20.5 81.9-10.1 135.6 22.3 153.9 28 15.8 75.1 6 138.2-55.2q-5.1-4.95-10.2-10.2c-82.5 80-119.7 53.5-120.9 52.8-22.3-12.6-36-55.6-15.5-137.9 12.4 2.9 41.8 9.5 84.6 13 71.9 100.4 140.6 142 182.1 142 30.8 0 43.8-21 47.6-27.7 18-31.9 13.3-84.1-.1-133.8 152.3-43.8 156.2-130.2 33.9-176.3zM135.9 36.84c2.9-5.1 11.9-20.3 34.9-20.3 36.8 0 98.8 39.6 163.3 126.2a714 714 0 0 0-93.9.9 547.76 547.76 0 0 1 42.2-52.4Q277.3 86 272.2 81a598.25 598.25 0 0 0-50.7 64.2 569.69 569.69 0 0 0-84.4 14.6c-.2-1.4-24.3-82.2-1.2-123zm304.8 438.3c-2.9 5.1-11.8 20.3-34.9 20.3-36.7 0-98.7-39.4-163.3-126.2a695.38 695.38 0 0 0 93.9-.9 547.76 547.76 0 0 1-42.2 52.4q5.1 5.25 10.2 10.2a588.47 588.47 0 0 0 50.7-64.2c47.3-4.7 80.3-13.5 84.4-14.6 22.7 84.4 4.5 117 1.2 123zm9.1-138.6c-3.6-11.9-7.7-24.1-12.4-36.4a12.67 12.67 0 0 1-10.7-5.7l-.1.1a19.61 19.61 0 0 1-5.4 3.6c5.7 14.3 10.6 28.4 14.7 42.2a535.3 535.3 0 0 1-72 13c3.5-5.3 17.2-26.2 32.2-54.2a24.6 24.6 0 0 1-6-3.2c-1.1 1.2-3.6 4.2-10.9 4.2-6.2 11.2-17.4 30.9-33.9 55.2a711.91 711.91 0 0 1-112.4 1c-7.9-11.2-21.5-31.1-36.8-57.8a21 21 0 0 1-3-1.5c-1.9 1.6-3.9 3.2-12.6 3.2 6.3 11.2 17.5 30.7 33.8 54.6a548.81 548.81 0 0 1-72.2-11.7q5.85-21 14.1-42.9c-3.2 0-5.4.2-8.4-1a17.58 17.58 0 0 1-6.9 1c-4.9 13.4-9.1 26.5-12.7 39.4C-31.7 297-12.1 216 126.7 175.64c3.6 11.9 7.7 24.1 12.4 36.4 10.4 0 12.9 3.4 14.4 5.3a12 12 0 0 1 2.3-2.2c-5.8-14.7-10.9-29.2-15.2-43.3 7-1.8 32.4-8.4 72-13-15.9 24.3-26.7 43.9-32.8 55.3a14.22 14.22 0 0 1 6.4 8 23.42 23.42 0 0 1 10.2-8.4c6.5-11.7 17.9-31.9 34.8-56.9a711.72 711.72 0 0 1 112.4-1c31.5 44.6 28.9 48.1 42.5 64.5a21.42 21.42 0 0 1 10.4-7.4c-6.4-11.4-17.6-31-34.3-55.5 40.4 4.1 65 10 72.2 11.7-4 14.4-8.9 29.2-14.6 44.2a20.74 20.74 0 0 1 6.8 4.3l.1.1a12.72 12.72 0 0 1 8.9-5.6c4.9-13.4 9.2-26.6 12.8-39.5a359.71 359.71 0 0 1 34.5 11c106.1 39.9 74 87.9 72.6 90.4-19.8 35.1-80.1 55.2-105.7 62.5zm-114.4-114h-1.2a1.74 1.74 0 0 0-1.9 1.9v49.8c0 7.9-2.6 11.1-10.1 11.1s-10.1-3.1-10.1-11.1v-49.8a1.69 1.69 0 0 0-1.9-1.9H309a1.81 1.81 0 0 0-2 1.9v51.5c0 9.6 5 14.1 15.1 14.1h.4c10.1 0 15.1-4.6 15.1-14.1v-51.5a2 2 0 0 0-2.2-1.9zM321.7 308l-2.3-6.8-2.3 6.8-7.1.1 5.7 4.3-2.1 6.8 5.8-4.1 5.8 4.1-2.1-6.8 5.7-4.3zm-31.1 7.4l-2.3-6.8-2.3 6.8-7.1.1 5.7 4.3-2.1 6.8 5.8-4.1 5.8 4.1-2.1-6.8 5.7-4.3zm5.1-30.8h-19.4v-26.7h16.1a1.89 1.89 0 0 0 2-2v-.8a1.89 1.89 0 0 0-2-2h-16.1v-25.8h19.1a1.89 1.89 0 0 0 2-2v-.8a1.77 1.77 0 0 0-2-1.9h-22.2a1.81 1.81 0 0 0-2 1.9v63a1.81 1.81 0 0 0 2 1.9h22.5a1.77 1.77 0 0 0 2-1.9v-.8a1.83 1.83 0 0 0-2-2.06zm-7.4-99.4L286 192l-7.1.1 5.7 4.3-2.1 6.8 5.8-4.1 5.8 4.1-2.1-6.8 5.7-4.3-7.1-.1z"],
"readme": [576, 512, [], "f4d5", "M528.3 46.5H388.5c-48.1 0-89.9 33.3-100.4 80.3-10.6-47-52.3-80.3-100.4-80.3H48c-26.5 0-48 21.5-48 48v245.8c0 26.5 21.5 48 48 48h89.7c102.2 0 132.7 24.4 147.3 75 .7 2.8 5.2 2.8 6 0 14.7-50.6 45.2-75 147.3-75H528c26.5 0 48-21.5 48-48V94.6c0-26.4-21.3-47.9-47.7-48.1zM242 311.9c0 1.9-1.5 3.5-3.5 3.5H78.2c-1.9 0-3.5-1.5-3.5-3.5V289c0-1.9 1.5-3.5 3.5-3.5h160.4c1.9 0 3.5 1.5 3.5 3.5v22.9zm0-60.9c0 1.9-1.5 3.5-3.5 3.5H78.2c-1.9 0-3.5-1.5-3.5-3.5v-22.9c0-1.9 1.5-3.5 3.5-3.5h160.4c1.9 0 3.5 1.5 3.5 3.5V251zm0-60.9c0 1.9-1.5 3.5-3.5 3.5H78.2c-1.9 0-3.5-1.5-3.5-3.5v-22.9c0-1.9 1.5-3.5 3.5-3.5h160.4c1.9 0 3.5 1.5 3.5 3.5v22.9zm259.3 121.7c0 1.9-1.5 3.5-3.5 3.5H337.5c-1.9 0-3.5-1.5-3.5-3.5v-22.9c0-1.9 1.5-3.5 3.5-3.5h160.4c1.9 0 3.5 1.5 3.5 3.5v22.9zm0-60.9c0 1.9-1.5 3.5-3.5 3.5H337.5c-1.9 0-3.5-1.5-3.5-3.5V228c0-1.9 1.5-3.5 3.5-3.5h160.4c1.9 0 3.5 1.5 3.5 3.5v22.9zm0-60.9c0 1.9-1.5 3.5-3.5 3.5H337.5c-1.9 0-3.5-1.5-3.5-3.5v-22.8c0-1.9 1.5-3.5 3.5-3.5h160.4c1.9 0 3.5 1.5 3.5 3.5V190z"],
"rebel": [512, 512, [], "f1d0", "M256.5 504C117.2 504 9 387.8 13.2 249.9 16 170.7 56.4 97.7 129.7 49.5c.3 0 1.9-.6 1.1.8-5.8 5.5-111.3 129.8-14.1 226.4 49.8 49.5 90 2.5 90 2.5 38.5-50.1-.6-125.9-.6-125.9-10-24.9-45.7-40.1-45.7-40.1l28.8-31.8c24.4 10.5 43.2 38.7 43.2 38.7.8-29.6-21.9-61.4-21.9-61.4L255.1 8l44.3 50.1c-20.5 28.8-21.9 62.6-21.9 62.6 13.8-23 43.5-39.3 43.5-39.3l28.5 31.8c-27.4 8.9-45.4 39.9-45.4 39.9-15.8 28.5-27.1 89.4.6 127.3 32.4 44.6 87.7-2.8 87.7-2.8 102.7-91.9-10.5-225-10.5-225-6.1-5.5.8-2.8.8-2.8 50.1 36.5 114.6 84.4 116.2 204.8C500.9 400.2 399 504 256.5 504z"],
"red-river": [448, 512, [], "f3e3", "M353.2 32H94.8C42.4 32 0 74.4 0 126.8v258.4C0 437.6 42.4 480 94.8 480h258.4c52.4 0 94.8-42.4 94.8-94.8V126.8c0-52.4-42.4-94.8-94.8-94.8zM144.9 200.9v56.3c0 27-21.9 48.9-48.9 48.9V151.9c0-13.2 10.7-23.9 23.9-23.9h154.2c0 27-21.9 48.9-48.9 48.9h-56.3c-12.3-.6-24.6 11.6-24 24zm176.3 72h-56.3c-12.3-.6-24.6 11.6-24 24v56.3c0 27-21.9 48.9-48.9 48.9V247.9c0-13.2 10.7-23.9 23.9-23.9h154.2c0 27-21.9 48.9-48.9 48.9z"],
"reddit": [512, 512, [], "f1a1", "M201.5 305.5c-13.8 0-24.9-11.1-24.9-24.6 0-13.8 11.1-24.9 24.9-24.9 13.6 0 24.6 11.1 24.6 24.9 0 13.6-11.1 24.6-24.6 24.6zM504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-132.3-41.2c-9.4 0-17.7 3.9-23.8 10-22.4-15.5-52.6-25.5-86.1-26.6l17.4-78.3 55.4 12.5c0 13.6 11.1 24.6 24.6 24.6 13.8 0 24.9-11.3 24.9-24.9s-11.1-24.9-24.9-24.9c-9.7 0-18 5.8-22.1 13.8l-61.2-13.6c-3-.8-6.1 1.4-6.9 4.4l-19.1 86.4c-33.2 1.4-63.1 11.3-85.5 26.8-6.1-6.4-14.7-10.2-24.1-10.2-34.9 0-46.3 46.9-14.4 62.8-1.1 5-1.7 10.2-1.7 15.5 0 52.6 59.2 95.2 132 95.2 73.1 0 132.3-42.6 132.3-95.2 0-5.3-.6-10.8-1.9-15.8 31.3-16 19.8-62.5-14.9-62.5zM302.8 331c-18.2 18.2-76.1 17.9-93.6 0-2.2-2.2-6.1-2.2-8.3 0-2.5 2.5-2.5 6.4 0 8.6 22.8 22.8 87.3 22.8 110.2 0 2.5-2.2 2.5-6.1 0-8.6-2.2-2.2-6.1-2.2-8.3 0zm7.7-75c-13.6 0-24.6 11.1-24.6 24.9 0 13.6 11.1 24.6 24.6 24.6 13.8 0 24.9-11.1 24.9-24.6 0-13.8-11-24.9-24.9-24.9z"],
"reddit-alien": [512, 512, [], "f281", "M440.3 203.5c-15 0-28.2 6.2-37.9 15.9-35.7-24.7-83.8-40.6-137.1-42.3L293 52.3l88.2 19.8c0 21.6 17.6 39.2 39.2 39.2 22 0 39.7-18.1 39.7-39.7s-17.6-39.7-39.7-39.7c-15.4 0-28.7 9.3-35.3 22l-97.4-21.6c-4.9-1.3-9.7 2.2-11 7.1L246.3 177c-52.9 2.2-100.5 18.1-136.3 42.8-9.7-10.1-23.4-16.3-38.4-16.3-55.6 0-73.8 74.6-22.9 100.1-1.8 7.9-2.6 16.3-2.6 24.7 0 83.8 94.4 151.7 210.3 151.7 116.4 0 210.8-67.9 210.8-151.7 0-8.4-.9-17.2-3.1-25.1 49.9-25.6 31.5-99.7-23.8-99.7zM129.4 308.9c0-22 17.6-39.7 39.7-39.7 21.6 0 39.2 17.6 39.2 39.7 0 21.6-17.6 39.2-39.2 39.2-22 .1-39.7-17.6-39.7-39.2zm214.3 93.5c-36.4 36.4-139.1 36.4-175.5 0-4-3.5-4-9.7 0-13.7 3.5-3.5 9.7-3.5 13.2 0 27.8 28.5 120 29 149 0 3.5-3.5 9.7-3.5 13.2 0 4.1 4 4.1 10.2.1 13.7zm-.8-54.2c-21.6 0-39.2-17.6-39.2-39.2 0-22 17.6-39.7 39.2-39.7 22 0 39.7 17.6 39.7 39.7-.1 21.5-17.7 39.2-39.7 39.2z"],
"reddit-square": [448, 512, [], "f1a2", "M283.2 345.5c2.7 2.7 2.7 6.8 0 9.2-24.5 24.5-93.8 24.6-118.4 0-2.7-2.4-2.7-6.5 0-9.2 2.4-2.4 6.5-2.4 8.9 0 18.7 19.2 81 19.6 100.5 0 2.4-2.3 6.6-2.3 9 0zm-91.3-53.8c0-14.9-11.9-26.8-26.5-26.8-14.9 0-26.8 11.9-26.8 26.8 0 14.6 11.9 26.5 26.8 26.5 14.6 0 26.5-11.9 26.5-26.5zm90.7-26.8c-14.6 0-26.5 11.9-26.5 26.8 0 14.6 11.9 26.5 26.5 26.5 14.9 0 26.8-11.9 26.8-26.5 0-14.9-11.9-26.8-26.8-26.8zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-99.7 140.6c-10.1 0-19 4.2-25.6 10.7-24.1-16.7-56.5-27.4-92.5-28.6l18.7-84.2 59.5 13.4c0 14.6 11.9 26.5 26.5 26.5 14.9 0 26.8-12.2 26.8-26.8 0-14.6-11.9-26.8-26.8-26.8-10.4 0-19.3 6.2-23.8 14.9l-65.7-14.6c-3.3-.9-6.5 1.5-7.4 4.8l-20.5 92.8c-35.7 1.5-67.8 12.2-91.9 28.9-6.5-6.8-15.8-11-25.9-11-37.5 0-49.8 50.4-15.5 67.5-1.2 5.4-1.8 11-1.8 16.7 0 56.5 63.7 102.3 141.9 102.3 78.5 0 142.2-45.8 142.2-102.3 0-5.7-.6-11.6-2.1-17 33.6-17.2 21.2-67.2-16.1-67.2z"],
"redhat": [512, 512, [], "f7bc", "M312.4 401.2c1.3 1.3 3.6 5.6.8 11.1-1.6 2.9-3.2 4.9-6.2 7.3-3.6 2.9-10.6 6.2-20.3.1-5.2-3.3-5.5-4.4-12.7-3.4-5.1.7-7.1-4.5-5.3-8.8 1.9-4.3 9.4-7.7 18.8-2.2 4.2 2.5 10.8 7.7 16.6 3.1 2.4-1.9 3.8-3.2 7.2-7 .3-.5.8-.5 1.1-.2M256 29.7C114.6 29.7 0 144.3 0 285.6c0 28.6 4.7 56.1 13.3 81.8h17.8c15.8 0 30.4-3.8 42.8-10.2 3.1-1.6 6.6-2.6 10.4-2.6 19.1 0 18.3 15.3 30.3 22.9.7.4 7.5 4.3 15.8 3.9 3.4-.2 8.5-1 9.8-4.5 1.4-4-.3-7-5.3-9.1-9.7-4.1-9.5-11-15.8-18.2-3.9-4.3-8.6-8.5-9.5-17.8-.9-9.1 4.2-19.9 14.7-22.7 4-1.1 12.8-1.8 21.5 5 8.3 6.4 13.9 16.9 16.3 21.2 1.7 3 7.8 6.5 12.7 2.1 4.9-4.5 9.4-4.5 13.1 1.2 3.1 4.9 26.2 35.6 51.1 36.4 25.3.8 38.8-5.7 49.9-5.3 7.7.3 11.5 4.2 15.9 4.9 7.8 1.2 13.3-5.8 21.9-5.4 6.9.3 14.5 5 22.3 5 7.8 0 24.1-9.4 23.9-5.5-.4 6.8-5.7 18.9-6.9 24.5-.9 3.9-.1 13.2-2.4 20.8-2.1 7.6-9.2 17.4-11.1 20.1-6.3 9.4-10.8 12.2-16 22.1-5.7 11-15.1 21.2-17.6 24.5-.4.5-.4.9-.1 1.2 2 1.9 18.8-2.2 25.3-8.3 6.3-5.9 17.3-24 34.7-27.8 8.8-2 12.3-5 13-8.1.5-2.7-.6-2.9-.6-4.8 0-1.6.9-3 2.3-3.7 14.4-6 43.3-12.4 77.7-4.5 26-40.1 41.1-87.8 41.1-139.1C512 144.3 397.4 29.7 256 29.7zm208.2 250.8c-12.3 67.4-122.5 90-229.7 57.6-102.2-30.9-191.9-92.5-181.6-128.6 6-21 39.4-30 83.8-25.2-6.7 13.7-6.2 29.9 23.2 47.8 36 20.4 96.7 37.8 113.1 36.1 6.1-.6 11.6-3.7 6.1-7.3-24.8-16.6 7-36.4-55.7-48.4-82.9-15.8-79.6-39.2-77.2-52.7 0 0 7.4-33.1 10.4-44.7 3.1-11.6 11-38.3 64.3-26.3 30.8 6.9 47.5-1.7 55.9-3.9 23.1-5.9 48.6-1.8 62.7 12.7 14.6 15 34.7 61.3 44.3 95.9 4.9 17.6 3.6 26 1.1 32-1.8 4-2.8 6.6-8.9 16.9-1.1 1.8-.2 3.8 2.2 2.6 16-8.2 19.6-19.1 22.1-27.6 43.7 9.9 69.4 32.5 63.9 63.1zM229.6 135c-26.3 0-34.4 7-45.8-7.1-2.3-2.9-9.6-5.6-13.6 3.6-4 9.3 3.4 19.2 9.6 20.5 0 0 10.3 19.1 18.1 10.8 5.5-5.9 8.6-9.1 38.2-11.2 27.9-2.1 13.4-16.6-6.5-16.6zm61.1-40.2c-9.8 1-18.3 3.4-24.1 6.4-.7.3-.7 1.5.5 1.5 34.2-5.4 48.9 8.1 18.3 15.1-1.2.3-1.2 1.9 0 2.2 4.3 1.2 9.3 2 14.6 2.1 16.4.3 29.9-5.6 30.1-13.2.2-6.4-12.4-16.9-39.4-14.1z"],
"renren": [512, 512, [], "f18b", "M214 169.1c0 110.4-61 205.4-147.6 247.4C30 373.2 8 317.7 8 256.6 8 133.9 97.1 32.2 214 12.5v156.6zM255 504c-42.9 0-83.3-11-118.5-30.4C193.7 437.5 239.9 382.9 255 319c15.5 63.9 61.7 118.5 118.8 154.7C338.7 493 298.3 504 255 504zm190.6-87.5C359 374.5 298 279.6 298 169.1V12.5c116.9 19.7 206 121.4 206 244.1 0 61.1-22 116.6-58.4 159.9z"],
"replyd": [448, 512, [], "f3e6", "M320 480H128C57.6 480 0 422.4 0 352V160C0 89.6 57.6 32 128 32h192c70.4 0 128 57.6 128 128v192c0 70.4-57.6 128-128 128zM193.4 273.2c-6.1-2-11.6-3.1-16.4-3.1-7.2 0-13.5 1.9-18.9 5.6-5.4 3.7-9.6 9-12.8 15.8h-1.1l-4.2-18.3h-28v138.9h36.1v-89.7c1.5-5.4 4.4-9.8 8.7-13.2 4.3-3.4 9.8-5.1 16.2-5.1 4.6 0 9.8 1 15.6 3.1l4.8-34zm115.2 103.4c-3.2 2.4-7.7 4.8-13.7 7.1-6 2.3-12.8 3.5-20.4 3.5-12.2 0-21.1-3-26.5-8.9-5.5-5.9-8.5-14.7-9-26.4h83.3c.9-4.8 1.6-9.4 2.1-13.9.5-4.4.7-8.6.7-12.5 0-10.7-1.6-19.7-4.7-26.9-3.2-7.2-7.3-13-12.5-17.2-5.2-4.3-11.1-7.3-17.8-9.2-6.7-1.8-13.5-2.8-20.6-2.8-21.1 0-37.5 6.1-49.2 18.3s-17.5 30.5-17.5 55c0 22.8 5.2 40.7 15.6 53.7 10.4 13.1 26.8 19.6 49.2 19.6 10.7 0 20.9-1.5 30.4-4.6 9.5-3.1 17.1-6.8 22.6-11.2l-12-23.6zm-21.8-70.3c3.8 5.4 5.3 13.1 4.6 23.1h-51.7c.9-9.4 3.7-17 8.2-22.6 4.5-5.6 11.5-8.5 21-8.5 8.2-.1 14.1 2.6 17.9 8zm79.9 2.5c4.1 3.9 9.4 5.8 16.1 5.8 7 0 12.6-1.9 16.7-5.8s6.1-9.1 6.1-15.6-2-11.6-6.1-15.4c-4.1-3.8-9.6-5.7-16.7-5.7-6.7 0-12 1.9-16.1 5.7-4.1 3.8-6.1 8.9-6.1 15.4s2 11.7 6.1 15.6zm0 100.5c4.1 3.9 9.4 5.8 16.1 5.8 7 0 12.6-1.9 16.7-5.8s6.1-9.1 6.1-15.6-2-11.6-6.1-15.4c-4.1-3.8-9.6-5.7-16.7-5.7-6.7 0-12 1.9-16.1 5.7-4.1 3.8-6.1 8.9-6.1 15.4 0 6.6 2 11.7 6.1 15.6z"],
"researchgate": [448, 512, [], "f4f8", "M0 32v448h448V32H0zm262.2 334.4c-6.6 3-33.2 6-50-14.2-9.2-10.6-25.3-33.3-42.2-63.6-8.9 0-14.7 0-21.4-.6v46.4c0 23.5 6 21.2 25.8 23.9v8.1c-6.9-.3-23.1-.8-35.6-.8-13.1 0-26.1.6-33.6.8v-8.1c15.5-2.9 22-1.3 22-23.9V225c0-22.6-6.4-21-22-23.9V193c25.8 1 53.1-.6 70.9-.6 31.7 0 55.9 14.4 55.9 45.6 0 21.1-16.7 42.2-39.2 47.5 13.6 24.2 30 45.6 42.2 58.9 7.2 7.8 17.2 14.7 27.2 14.7v7.3zm22.9-135c-23.3 0-32.2-15.7-32.2-32.2V167c0-12.2 8.8-30.4 34-30.4s30.4 17.9 30.4 17.9l-10.7 7.2s-5.5-12.5-19.7-12.5c-7.9 0-19.7 7.3-19.7 19.7v26.8c0 13.4 6.6 23.3 17.9 23.3 14.1 0 21.5-10.9 21.5-26.8h-17.9v-10.7h30.4c0 20.5 4.7 49.9-34 49.9zm-116.5 44.7c-9.4 0-13.6-.3-20-.8v-69.7c6.4-.6 15-.6 22.5-.6 23.3 0 37.2 12.2 37.2 34.5 0 21.9-15 36.6-39.7 36.6z"],
"resolving": [496, 512, [], "f3e7", "M281.2 278.2c46-13.3 49.6-23.5 44-43.4L314 195.5c-6.1-20.9-18.4-28.1-71.1-12.8L54.7 236.8l28.6 98.6 197.9-57.2zM248.5 8C131.4 8 33.2 88.7 7.2 197.5l221.9-63.9c34.8-10.2 54.2-11.7 79.3-8.2 36.3 6.1 52.7 25 61.4 55.2l10.7 37.8c8.2 28.1 1 50.6-23.5 73.6-19.4 17.4-31.2 24.5-61.4 33.2L203 351.8l220.4 27.1 9.7 34.2-48.1 13.3-286.8-37.3 23 80.2c36.8 22 80.3 34.7 126.3 34.7 137 0 248.5-111.4 248.5-248.3C497 119.4 385.5 8 248.5 8zM38.3 388.6L0 256.8c0 48.5 14.3 93.4 38.3 131.8z"],
"rev": [448, 512, [], "f5b2", "M289.67 274.89a65.57 65.57 0 1 1-65.56-65.56 65.64 65.64 0 0 1 65.56 65.56zm139.55-5.05h-.13a204.69 204.69 0 0 0-74.32-153l-45.38 26.2a157.07 157.07 0 0 1 71.81 131.84C381.2 361.5 310.73 432 224.11 432S67 361.5 67 274.88c0-81.88 63-149.27 143-156.43v39.12l108.77-62.79L210 32v38.32c-106.7 7.25-191 96-191 204.57 0 111.59 89.12 202.29 200.06 205v.11h210.16V269.84z"],
"rocketchat": [576, 512, [], "f3e8", "M486.41 107.57c-76.93-50.83-179.18-62.4-264.12-47.07C127.26-31.16 20.77 11 0 23.12c0 0 73.08 62.1 61.21 116.49-86.52 88.2-45.39 186.4 0 232.77C73.08 426.77 0 488.87 0 488.87c20.57 12.16 126.77 54.19 222.29-37 84.75 15.23 187 3.76 264.12-47.16 119.26-76.14 119.65-220.61 0-297.15zM294.18 404.22a339.53 339.53 0 0 1-88.11-11.37l-19.77 19.09a179.74 179.74 0 0 1-36.59 27.39A143.14 143.14 0 0 1 98 454.06c1-1.78 1.88-3.56 2.77-5.24q29.67-55 16-98.69c-32.53-25.61-52-58.34-52-94.13 0-82 102.74-148.43 229.41-148.43S523.59 174 523.59 256 420.85 404.22 294.18 404.22zM184.12 291.3a34.32 34.32 0 0 1-34.8-33.72c-.7-45.39 67.83-46.38 68.52-1.09v.51a34 34 0 0 1-33.72 34.32zm73.77-33.72c-.79-45.39 67.74-46.48 68.53-1.19v.61c.39 45.08-67.74 45.57-68.53.58zm143.38 33.72a34.33 34.33 0 0 1-34.81-33.72c-.69-45.39 67.84-46.38 68.53-1.09v.51a33.89 33.89 0 0 1-33.72 34.32z"],
"rockrms": [496, 512, [], "f3e9", "M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm157.4 419.5h-90l-112-131.3c-17.9-20.4-3.9-56.1 26.6-56.1h75.3l-84.6-99.3-84.3 98.9h-90L193.5 67.2c14.4-18.4 41.3-17.3 54.5 0l157.7 185.1c19 22.8 2 57.2-27.6 56.1-.6 0-74.2.2-74.2.2l101.5 118.9z"],
"safari": [512, 512, [], "f267", "M236.9 256.8c0-9.1 6.6-17.7 16.3-17.7 8.9 0 17.4 6.4 17.4 16.1 0 9.1-6.4 17.7-16.1 17.7-9 0-17.6-6.7-17.6-16.1zM504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-26.6 0c0-122.3-99.1-221.4-221.4-221.4S34.6 133.7 34.6 256 133.7 477.4 256 477.4 477.4 378.3 477.4 256zm-72.5 96.6c0 3.6 13 10.2 16.3 12.2-27.4 41.5-69.8 71.4-117.9 83.3l-4.4-18.5c-.3-2.5-1.9-2.8-4.2-2.8-1.9 0-3 2.8-2.8 4.2l4.4 18.8c-13.3 2.8-26.8 4.2-40.4 4.2-36.3 0-72-10.2-103-29.1 1.7-2.8 12.2-18 12.2-20.2 0-1.9-1.7-3.6-3.6-3.6-3.9 0-12.2 16.6-14.7 19.9-41.8-27.7-72-70.6-83.6-119.6l19.1-4.2c2.2-.6 2.8-2.2 2.8-4.2 0-1.9-2.8-3-4.4-2.8L62 294.5c-2.5-12.7-3.9-25.5-3.9-38.5 0-37.1 10.5-73.6 30.2-104.9 2.8 1.7 16.1 10.8 18.3 10.8 1.9 0 3.6-1.4 3.6-3.3 0-3.9-14.7-11.3-18-13.6 28.2-41.2 71.1-70.9 119.8-81.9l4.2 18.5c.6 2.2 2.2 2.8 4.2 2.8s3-2.8 2.8-4.4L219 61.7c12.2-2.2 24.6-3.6 37.1-3.6 37.1 0 73.3 10.5 104.9 30.2-1.9 2.8-10.8 15.8-10.8 18 0 1.9 1.4 3.6 3.3 3.6 3.9 0 11.3-14.4 13.3-17.7 41 27.7 70.3 70 81.7 118.2l-15.5 3.3c-2.5.6-2.8 2.2-2.8 4.4 0 1.9 2.8 3 4.2 2.8l15.8-3.6c2.5 12.7 3.9 25.7 3.9 38.7 0 36.3-10 72-28.8 102.7-2.8-1.4-14.4-9.7-16.6-9.7-2.1 0-3.8 1.7-3.8 3.6zm-33.2-242.2c-13 12.2-134.2 123.7-137.6 129.5l-96.6 160.5c12.7-11.9 134.2-124 137.3-129.3l96.9-160.7z"],
"salesforce": [640, 512, [], "f83b", "M248.89 245.64h-26.35c.69-5.16 3.32-14.12 13.64-14.12 6.75 0 11.97 3.82 12.71 14.12zm136.66-13.88c-.47 0-14.11-1.77-14.11 20s13.63 20 14.11 20c13 0 14.11-13.54 14.11-20 0-21.76-13.66-20-14.11-20zm-243.22 23.76a8.63 8.63 0 0 0-3.29 7.29c0 4.78 2.08 6.05 3.29 7.05 4.7 3.7 15.07 2.12 20.93.95v-16.94c-5.32-1.07-16.73-1.96-20.93 1.65zM640 232c0 87.58-80 154.39-165.36 136.43-18.37 33-70.73 70.75-132.2 41.63-41.16 96.05-177.89 92.18-213.81-5.17C8.91 428.78-50.19 266.52 53.36 205.61 18.61 126.18 76 32 167.67 32a124.24 124.24 0 0 1 98.56 48.7c20.7-21.4 49.4-34.81 81.15-34.81 42.34 0 79 23.52 98.8 58.57C539 63.78 640 132.69 640 232zm-519.55 31.8c0-11.76-11.69-15.17-17.87-17.17-5.27-2.11-13.41-3.51-13.41-8.94 0-9.46 17-6.66 25.17-2.12 0 0 1.17.71 1.64-.47.24-.7 2.36-6.58 2.59-7.29a1.13 1.13 0 0 0-.7-1.41c-12.33-7.63-40.7-8.51-40.7 12.7 0 12.46 11.49 15.44 17.88 17.17 4.72 1.58 13.17 3 13.17 8.7 0 4-3.53 7.06-9.17 7.06a31.76 31.76 0 0 1-19-6.35c-.47-.23-1.42-.71-1.65.71l-2.4 7.47c-.47.94.23 1.18.23 1.41 1.75 1.4 10.3 6.59 22.82 6.59 13.17 0 21.4-7.06 21.4-18.11zm32-42.58c-10.13 0-18.66 3.17-21.4 5.18a1 1 0 0 0-.24 1.41l2.59 7.06a1 1 0 0 0 1.18.7c.65 0 6.8-4 16.93-4 4 0 7.06.71 9.18 2.36 3.6 2.8 3.06 8.29 3.06 10.58-4.79-.3-19.11-3.44-29.41 3.76a16.92 16.92 0 0 0-7.34 14.54c0 5.9 1.51 10.4 6.59 14.35 12.24 8.16 36.28 2 38.1 1.41 1.58-.32 3.53-.66 3.53-1.88v-33.88c.04-4.61.32-21.64-22.78-21.64zM199 200.24a1.11 1.11 0 0 0-1.18-1.18H188a1.11 1.11 0 0 0-1.17 1.18v79a1.11 1.11 0 0 0 1.17 1.18h9.88a1.11 1.11 0 0 0 1.18-1.18zm55.75 28.93c-2.1-2.31-6.79-7.53-17.65-7.53-3.51 0-14.16.23-20.7 8.94-6.35 7.63-6.58 18.11-6.58 21.41 0 3.12.15 14.26 7.06 21.17 2.64 2.91 9.06 8.23 22.81 8.23 10.82 0 16.47-2.35 18.58-3.76.47-.24.71-.71.24-1.88l-2.35-6.83a1.26 1.26 0 0 0-1.41-.7c-2.59.94-6.35 2.82-15.29 2.82-17.42 0-16.85-14.74-16.94-16.7h37.17a1.23 1.23 0 0 0 1.17-.94c-.29 0 2.07-14.7-6.09-24.23zm36.69 52.69c13.17 0 21.41-7.06 21.41-18.11 0-11.76-11.7-15.17-17.88-17.17-4.14-1.66-13.41-3.38-13.41-8.94 0-3.76 3.29-6.35 8.47-6.35a38.11 38.11 0 0 1 16.7 4.23s1.18.71 1.65-.47c.23-.7 2.35-6.58 2.58-7.29a1.13 1.13 0 0 0-.7-1.41c-7.91-4.9-16.74-4.94-20.23-4.94-12 0-20.46 7.29-20.46 17.64 0 12.46 11.48 15.44 17.87 17.17 6.11 2 13.17 3.26 13.17 8.7 0 4-3.52 7.06-9.17 7.06a31.8 31.8 0 0 1-19-6.35 1 1 0 0 0-1.65.71l-2.35 7.52c-.47.94.23 1.18.23 1.41 1.72 1.4 10.33 6.59 22.79 6.59zM357.09 224c0-.71-.24-1.18-1.18-1.18h-11.76c0-.14.94-8.94 4.47-12.47 4.16-4.15 11.76-1.64 12-1.64 1.17.47 1.41 0 1.64-.47l2.83-7.77c.7-.94 0-1.17-.24-1.41-5.09-2-17.35-2.87-24.46 4.24-5.48 5.48-7 13.92-8 19.52h-8.47a1.28 1.28 0 0 0-1.17 1.18l-1.42 7.76c0 .7.24 1.17 1.18 1.17h8.23c-8.51 47.9-8.75 50.21-10.35 55.52-1.08 3.62-3.29 6.9-5.88 7.76-.09 0-3.88 1.68-9.64-.24 0 0-.94-.47-1.41.71-.24.71-2.59 6.82-2.83 7.53s0 1.41.47 1.41c5.11 2 13 1.77 17.88 0 6.28-2.28 9.72-7.89 11.53-12.94 2.75-7.71 2.81-9.79 11.76-59.74h12.23a1.29 1.29 0 0 0 1.18-1.18zm53.39 16c-.56-1.68-5.1-18.11-25.17-18.11-15.25 0-23 10-25.16 18.11-1 3-3.18 14 0 23.52.09.3 4.41 18.12 25.16 18.12 14.95 0 22.9-9.61 25.17-18.12 3.21-9.61 1.01-20.52 0-23.52zm45.4-16.7c-5-1.65-16.62-1.9-22.11 5.41v-4.47a1.11 1.11 0 0 0-1.18-1.17h-9.4a1.11 1.11 0 0 0-1.18 1.17v55.28a1.12 1.12 0 0 0 1.18 1.18h9.64a1.12 1.12 0 0 0 1.18-1.18v-27.77c0-2.91.05-11.37 4.46-15.05 4.9-4.9 12-3.36 13.41-3.06a1.57 1.57 0 0 0 1.41-.94 74 74 0 0 0 3.06-8 1.16 1.16 0 0 0-.47-1.41zm46.81 54.1l-2.12-7.29c-.47-1.18-1.41-.71-1.41-.71-4.23 1.82-10.15 1.89-11.29 1.89-4.64 0-17.17-1.13-17.17-19.76 0-6.23 1.85-19.76 16.47-19.76a34.85 34.85 0 0 1 11.52 1.65s.94.47 1.18-.71c.94-2.59 1.64-4.47 2.59-7.53.23-.94-.47-1.17-.71-1.17-11.59-3.87-22.34-2.53-27.76 0-1.59.74-16.23 6.49-16.23 27.52 0 2.9-.58 30.11 28.94 30.11a44.45 44.45 0 0 0 15.52-2.83 1.3 1.3 0 0 0 .47-1.42zm53.87-39.52c-.8-3-5.37-16.23-22.35-16.23-16 0-23.52 10.11-25.64 18.59a38.58 38.58 0 0 0-1.65 11.76c0 25.87 18.84 29.4 29.88 29.4 10.82 0 16.46-2.35 18.58-3.76.47-.24.71-.71.24-1.88l-2.36-6.83a1.26 1.26 0 0 0-1.41-.7c-2.59.94-6.35 2.82-15.29 2.82-17.42 0-16.85-14.74-16.93-16.7h37.16a1.25 1.25 0 0 0 1.18-.94c-.24-.01.94-7.07-1.41-15.54zm-23.29-6.35c-10.33 0-13 9-13.64 14.12H546c-.88-11.92-7.62-14.13-12.73-14.13z"],
"sass": [640, 512, [], "f41e", "M301.84 378.92c-.3.6-.6 1.08 0 0zm249.13-87a131.16 131.16 0 0 0-58 13.5c-5.9-11.9-12-22.3-13-30.1-1.2-9.1-2.5-14.5-1.1-25.3s7.7-26.1 7.6-27.2-1.4-6.6-14.3-6.7-24 2.5-25.29 5.9a122.83 122.83 0 0 0-5.3 19.1c-2.3 11.7-25.79 53.5-39.09 75.3-4.4-8.5-8.1-16-8.9-22-1.2-9.1-2.5-14.5-1.1-25.3s7.7-26.1 7.6-27.2-1.4-6.6-14.29-6.7-24 2.5-25.3 5.9-2.7 11.4-5.3 19.1-33.89 77.3-42.08 95.4c-4.2 9.2-7.8 16.6-10.4 21.6-.4.8-.7 1.3-.9 1.7.3-.5.5-1 .5-.8-2.2 4.3-3.5 6.7-3.5 6.7v.1c-1.7 3.2-3.6 6.1-4.5 6.1-.6 0-1.9-8.4.3-19.9 4.7-24.2 15.8-61.8 15.7-63.1-.1-.7 2.1-7.2-7.3-10.7-9.1-3.3-12.4 2.2-13.2 2.2s-1.4 2-1.4 2 10.1-42.4-19.39-42.4c-18.4 0-44 20.2-56.58 38.5-7.9 4.3-25 13.6-43 23.5-6.9 3.8-14 7.7-20.7 11.4-.5-.5-.9-1-1.4-1.5-35.79-38.2-101.87-65.2-99.07-116.5 1-18.7 7.5-67.8 127.07-127.4 98-48.8 176.35-35.4 189.84-5.6 19.4 42.5-41.89 121.6-143.66 133-38.79 4.3-59.18-10.7-64.28-16.3-5.3-5.9-6.1-6.2-8.1-5.1-3.3 1.8-1.2 7 0 10.1 3 7.9 15.5 21.9 36.79 28.9 18.7 6.1 64.18 9.5 119.17-11.8 61.78-23.8 109.87-90.1 95.77-145.6C386.52 18.32 293-.18 204.57 31.22c-52.69 18.7-109.67 48.1-150.66 86.4-48.69 45.6-56.48 85.3-53.28 101.9 11.39 58.9 92.57 97.3 125.06 125.7-1.6.9-3.1 1.7-4.5 2.5-16.29 8.1-78.18 40.5-93.67 74.7-17.5 38.8 2.9 66.6 16.29 70.4 41.79 11.6 84.58-9.3 107.57-43.6s20.2-79.1 9.6-99.5c-.1-.3-.3-.5-.4-.8 4.2-2.5 8.5-5 12.8-7.5 8.29-4.9 16.39-9.4 23.49-13.3-4 10.8-6.9 23.8-8.4 42.6-1.8 22 7.3 50.5 19.1 61.7 5.2 4.9 11.49 5 15.39 5 13.8 0 20-11.4 26.89-25 8.5-16.6 16-35.9 16-35.9s-9.4 52.2 16.3 52.2c9.39 0 18.79-12.1 23-18.3v.1s.2-.4.7-1.2c1-1.5 1.5-2.4 1.5-2.4v-.3c3.8-6.5 12.1-21.4 24.59-46 16.2-31.8 31.69-71.5 31.69-71.5a201.24 201.24 0 0 0 6.2 25.8c2.8 9.5 8.7 19.9 13.4 30-3.8 5.2-6.1 8.2-6.1 8.2a.31.31 0 0 0 .1.2c-3 4-6.4 8.3-9.9 12.5-12.79 15.2-28 32.6-30 37.6-2.4 5.9-1.8 10.3 2.8 13.7 3.4 2.6 9.4 3 15.69 2.5 11.5-.8 19.6-3.6 23.5-5.4a82.2 82.2 0 0 0 20.19-10.6c12.5-9.2 20.1-22.4 19.4-39.8-.4-9.6-3.5-19.2-7.3-28.2 1.1-1.6 2.3-3.3 3.4-5C434.8 301.72 450.1 270 450.1 270a201.24 201.24 0 0 0 6.2 25.8c2.4 8.1 7.09 17 11.39 25.7-18.59 15.1-30.09 32.6-34.09 44.1-7.4 21.3-1.6 30.9 9.3 33.1 4.9 1 11.9-1.3 17.1-3.5a79.46 79.46 0 0 0 21.59-11.1c12.5-9.2 24.59-22.1 23.79-39.6-.3-7.9-2.5-15.8-5.4-23.4 15.7-6.6 36.09-10.2 62.09-7.2 55.68 6.5 66.58 41.3 64.48 55.8s-13.8 22.6-17.7 25-5.1 3.3-4.8 5.1c.5 2.6 2.3 2.5 5.6 1.9 4.6-.8 29.19-11.8 30.29-38.7 1.6-34-31.09-71.4-89-71.1zm-429.18 144.7c-18.39 20.1-44.19 27.7-55.28 21.3C54.61 451 59.31 421.42 82 400c13.8-13 31.59-25 43.39-32.4 2.7-1.6 6.6-4 11.4-6.9.8-.5 1.2-.7 1.2-.7.9-.6 1.9-1.1 2.9-1.7 8.29 30.4.3 57.2-19.1 78.3zm134.36-91.4c-6.4 15.7-19.89 55.7-28.09 53.6-7-1.8-11.3-32.3-1.4-62.3 5-15.1 15.6-33.1 21.9-40.1 10.09-11.3 21.19-14.9 23.79-10.4 3.5 5.9-12.2 49.4-16.2 59.2zm111 53c-2.7 1.4-5.2 2.3-6.4 1.6-.9-.5 1.1-2.4 1.1-2.4s13.9-14.9 19.4-21.7c3.2-4 6.9-8.7 10.89-13.9 0 .5.1 1 .1 1.6-.13 17.9-17.32 30-25.12 34.8zm85.58-19.5c-2-1.4-1.7-6.1 5-20.7 2.6-5.7 8.59-15.3 19-24.5a36.18 36.18 0 0 1 1.9 10.8c-.1 22.5-16.2 30.9-25.89 34.4z"],
"schlix": [448, 512, [], "f3ea", "M350.5 157.7l-54.2-46.1 73.4-39 78.3 44.2-97.5 40.9zM192 122.1l45.7-28.2 34.7 34.6-55.4 29-25-35.4zm-65.1 6.6l31.9-22.1L176 135l-36.7 22.5-12.4-28.8zm-23.3 88.2l-8.8-34.8 29.6-18.3 13.1 35.3-33.9 17.8zm-21.2-83.7l23.9-18.1 8.9 24-26.7 18.3-6.1-24.2zM59 206.5l-3.6-28.4 22.3-15.5 6.1 28.7L59 206.5zm-30.6 16.6l20.8-12.8 3.3 33.4-22.9 12-1.2-32.6zM1.4 268l19.2-10.2.4 38.2-21 8.8L1.4 268zm59.1 59.3l-28.3 8.3-1.6-46.8 25.1-10.7 4.8 49.2zM99 263.2l-31.1 13-5.2-40.8L90.1 221l8.9 42.2zM123.2 377l-41.6 5.9-8.1-63.5 35.2-10.8 14.5 68.4zm28.5-139.9l21.2 57.1-46.2 13.6-13.7-54.1 38.7-16.6zm85.7 230.5l-70.9-3.3-24.3-95.8 55.2-8.6 40 107.7zm-84.9-279.7l42.2-22.4 28 45.9-50.8 21.3-19.4-44.8zm41 94.9l61.3-18.7 52.8 86.6-79.8 11.3-34.3-79.2zm51.4-85.6l67.3-28.8 65.5 65.4-88.6 26.2-44.2-62.8z"],
"scribd": [384, 512, [], "f28a", "M42.3 252.7c-16.1-19-24.7-45.9-24.8-79.9 0-100.4 75.2-153.1 167.2-153.1 98.6-1.6 156.8 49 184.3 70.6l-50.5 72.1-37.3-24.6 26.9-38.6c-36.5-24-79.4-36.5-123-35.8-50.7-.8-111.7 27.2-111.7 76.2 0 18.7 11.2 20.7 28.6 15.6 23.3-5.3 41.9.6 55.8 14 26.4 24.3 23.2 67.6-.7 91.9-29.2 29.5-85.2 27.3-114.8-8.4zm317.7 5.9c-15.5-18.8-38.9-29.4-63.2-28.6-38.1-2-71.1 28-70.5 67.2-.7 16.8 6 33 18.4 44.3 14.1 13.9 33 19.7 56.3 14.4 17.4-5.1 28.6-3.1 28.6 15.6 0 4.3-.5 8.5-1.4 12.7-16.7 40.9-59.5 64.4-121.4 64.4-51.9.2-102.4-16.4-144.1-47.3l33.7-39.4-35.6-27.4L0 406.3l15.4 13.8c52.5 46.8 120.4 72.5 190.7 72.2 51.4 0 94.4-10.5 133.6-44.1 57.1-51.4 54.2-149.2 20.3-189.6z"],
"searchengin": [460, 512, [], "f3eb", "M220.6 130.3l-67.2 28.2V43.2L98.7 233.5l54.7-24.2v130.3l67.2-209.3zm-83.2-96.7l-1.3 4.7-15.2 52.9C80.6 106.7 52 145.8 52 191.5c0 52.3 34.3 95.9 83.4 105.5v53.6C57.5 340.1 0 272.4 0 191.6c0-80.5 59.8-147.2 137.4-158zm311.4 447.2c-11.2 11.2-23.1 12.3-28.6 10.5-5.4-1.8-27.1-19.9-60.4-44.4-33.3-24.6-33.6-35.7-43-56.7-9.4-20.9-30.4-42.6-57.5-52.4l-9.7-14.7c-24.7 16.9-53 26.9-81.3 28.7l2.1-6.6 15.9-49.5c46.5-11.9 80.9-54 80.9-104.2 0-54.5-38.4-102.1-96-107.1V32.3C254.4 37.4 320 106.8 320 191.6c0 33.6-11.2 64.7-29 90.4l14.6 9.6c9.8 27.1 31.5 48 52.4 57.4s32.2 9.7 56.8 43c24.6 33.2 42.7 54.9 44.5 60.3s.7 17.3-10.5 28.5zm-9.9-17.9c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8z"],
"sellcast": [448, 512, [], "f2da", "M353.4 32H94.7C42.6 32 0 74.6 0 126.6v258.7C0 437.4 42.6 480 94.7 480h258.7c52.1 0 94.7-42.6 94.7-94.6V126.6c0-52-42.6-94.6-94.7-94.6zm-50 316.4c-27.9 48.2-89.9 64.9-138.2 37.2-22.9 39.8-54.9 8.6-42.3-13.2l15.7-27.2c5.9-10.3 19.2-13.9 29.5-7.9 18.6 10.8-.1-.1 18.5 10.7 27.6 15.9 63.4 6.3 79.4-21.3 15.9-27.6 6.3-63.4-21.3-79.4-17.8-10.2-.6-.4-18.6-10.6-24.6-14.2-3.4-51.9 21.6-37.5 18.6 10.8-.1-.1 18.5 10.7 48.4 28 65.1 90.3 37.2 138.5zm21.8-208.8c-17 29.5-16.3 28.8-19 31.5-6.5 6.5-16.3 8.7-26.5 3.6-18.6-10.8.1.1-18.5-10.7-27.6-15.9-63.4-6.3-79.4 21.3s-6.3 63.4 21.3 79.4c0 0 18.5 10.6 18.6 10.6 24.6 14.2 3.4 51.9-21.6 37.5-18.6-10.8.1.1-18.5-10.7-48.2-27.8-64.9-90.1-37.1-138.4 27.9-48.2 89.9-64.9 138.2-37.2l4.8-8.4c14.3-24.9 52-3.3 37.7 21.5z"],
"sellsy": [640, 512, [], "f213", "M539.71 237.308c3.064-12.257 4.29-24.821 4.29-37.384C544 107.382 468.618 32 376.076 32c-77.22 0-144.634 53.012-163.02 127.781-15.322-13.176-34.934-20.53-55.157-20.53-46.271 0-83.962 37.69-83.962 83.961 0 7.354.92 15.015 3.065 22.369-42.9 20.225-70.785 63.738-70.785 111.234C6.216 424.843 61.68 480 129.401 480h381.198c67.72 0 123.184-55.157 123.184-123.184.001-56.384-38.916-106.025-94.073-119.508zM199.88 401.554c0 8.274-7.048 15.321-15.321 15.321H153.61c-8.274 0-15.321-7.048-15.321-15.321V290.626c0-8.273 7.048-15.321 15.321-15.321h30.949c8.274 0 15.321 7.048 15.321 15.321v110.928zm89.477 0c0 8.274-7.048 15.321-15.322 15.321h-30.949c-8.274 0-15.321-7.048-15.321-15.321V270.096c0-8.274 7.048-15.321 15.321-15.321h30.949c8.274 0 15.322 7.048 15.322 15.321v131.458zm89.477 0c0 8.274-7.047 15.321-15.321 15.321h-30.949c-8.274 0-15.322-7.048-15.322-15.321V238.84c0-8.274 7.048-15.321 15.322-15.321h30.949c8.274 0 15.321 7.048 15.321 15.321v162.714zm87.027 0c0 8.274-7.048 15.321-15.322 15.321h-28.497c-8.274 0-15.321-7.048-15.321-15.321V176.941c0-8.579 7.047-15.628 15.321-15.628h28.497c8.274 0 15.322 7.048 15.322 15.628v224.613z"],
"servicestack": [496, 512, [], "f3ec", "M88 216c81.7 10.2 273.7 102.3 304 232H0c99.5-8.1 184.5-137 88-232zm32-152c32.3 35.6 47.7 83.9 46.4 133.6C249.3 231.3 373.7 321.3 400 448h96C455.3 231.9 222.8 79.5 120 64z"],
"shirtsinbulk": [448, 512, [], "f214", "M100 410.3l30.6 13.4 4.4-9.9-30.6-13.4zm39.4 17.5l30.6 13.4 4.4-9.9-30.6-13.4zm172.1-14l4.4 9.9 30.6-13.4-4.4-9.9zM179.1 445l30.3 13.7 4.4-9.9-30.3-13.4zM60.4 392.8L91 406.2l4.4-9.6-30.6-13.7zm211.4 38.5l4.4 9.9 30.6-13.4-4.4-9.9zm-39.3 17.5l4.4 9.9 30.6-13.7-4.4-9.6zm118.4-52.2l4.4 9.6 30.6-13.4-4.4-9.9zM170 46.6h-33.5v10.5H170zm-47.2 0H89.2v10.5h33.5zm-47.3 0H42.3v10.5h33.3zm141.5 0h-33.2v10.5H217zm94.5 0H278v10.5h33.5zm47.3 0h-33.5v10.5h33.5zm-94.6 0H231v10.5h33.2zm141.5 0h-33.3v10.5h33.3zM52.8 351.1H42v33.5h10.8zm70-215.9H89.2v10.5h33.5zm-70 10.6h22.8v-10.5H42v33.5h10.8zm168.9 228.6c50.5 0 91.3-40.8 91.3-91.3 0-50.2-40.8-91.3-91.3-91.3-50.2 0-91.3 41.1-91.3 91.3 0 50.5 41.1 91.3 91.3 91.3zm-48.2-111.1c0-25.4 29.5-31.8 49.6-31.8 16.9 0 29.2 5.8 44.3 12l-8.8 16.9h-.9c-6.4-9.9-24.8-13.1-35.6-13.1-9 0-29.8 1.8-29.8 14.9 0 21.6 78.5-10.2 78.5 37.9 0 25.4-31.5 31.2-51 31.2-18.1 0-32.4-2.9-47.2-12.2l9-18.4h.9c6.1 12.2 23.6 14.9 35.9 14.9 8.7 0 32.7-1.2 32.7-14.3 0-26.1-77.6 6.3-77.6-38zM52.8 178.4H42V212h10.8zm342.4 206.2H406v-33.5h-10.8zM52.8 307.9H42v33.5h10.8zM0 3.7v406l221.7 98.6L448 409.7V3.7zm418.8 387.1L222 476.5 29.2 390.8V120.7h389.7v270.1zm0-299.3H29.2V32.9h389.7v58.6zm-366 130.1H42v33.5h10.8zm0 43.2H42v33.5h10.8zM170 135.2h-33.5v10.5H170zm225.2 163.1H406v-33.5h-10.8zm0-43.2H406v-33.5h-10.8zM217 135.2h-33.2v10.5H217zM395.2 212H406v-33.5h-10.8zm0 129.5H406V308h-10.8zm-131-206.3H231v10.5h33.2zm47.3 0H278v10.5h33.5zm83.7 33.6H406v-33.5h-33.5v10.5h22.8zm-36.4-33.6h-33.5v10.5h33.5z"],
"shopware": [512, 512, [], "f5b5", "M403.5 455.41A246.17 246.17 0 0 1 256 504C118.81 504 8 393 8 256 8 118.81 119 8 256 8a247.39 247.39 0 0 1 165.7 63.5 3.57 3.57 0 0 1-2.86 6.18A418.62 418.62 0 0 0 362.13 74c-129.36 0-222.4 53.47-222.4 155.35 0 109 92.13 145.88 176.83 178.73 33.64 13 65.4 25.36 87 41.59a3.58 3.58 0 0 1 0 5.72zM503 233.09a3.64 3.64 0 0 0-1.27-2.44c-51.76-43-93.62-60.48-144.48-60.48-84.13 0-80.25 52.17-80.25 53.63 0 42.6 52.06 62 112.34 84.49 31.07 11.59 63.19 23.57 92.68 39.93a3.57 3.57 0 0 0 5-1.82A249 249 0 0 0 503 233.09z"],
"simplybuilt": [512, 512, [], "f215", "M481.2 64h-106c-14.5 0-26.6 11.8-26.6 26.3v39.6H163.3V90.3c0-14.5-12-26.3-26.6-26.3h-106C16.1 64 4.3 75.8 4.3 90.3v331.4c0 14.5 11.8 26.3 26.6 26.3h450.4c14.8 0 26.6-11.8 26.6-26.3V90.3c-.2-14.5-12-26.3-26.7-26.3zM149.8 355.8c-36.6 0-66.4-29.7-66.4-66.4 0-36.9 29.7-66.6 66.4-66.6 36.9 0 66.6 29.7 66.6 66.6 0 36.7-29.7 66.4-66.6 66.4zm212.4 0c-36.9 0-66.6-29.7-66.6-66.6 0-36.6 29.7-66.4 66.6-66.4 36.6 0 66.4 29.7 66.4 66.4 0 36.9-29.8 66.6-66.4 66.6z"],
"sistrix": [448, 512, [], "f3ee", "M448 449L301.2 300.2c20-27.9 31.9-62.2 31.9-99.2 0-93.1-74.7-168.9-166.5-168.9C74.7 32 0 107.8 0 200.9s74.7 168.9 166.5 168.9c39.8 0 76.3-14.2 105-37.9l146 148.1 30.5-31zM166.5 330.8c-70.6 0-128.1-58.3-128.1-129.9S95.9 71 166.5 71s128.1 58.3 128.1 129.9-57.4 129.9-128.1 129.9z"],
"sith": [448, 512, [], "f512", "M0 32l69.71 118.75-58.86-11.52 69.84 91.03a146.741 146.741 0 0 0 0 51.45l-69.84 91.03 58.86-11.52L0 480l118.75-69.71-11.52 58.86 91.03-69.84c17.02 3.04 34.47 3.04 51.48 0l91.03 69.84-11.52-58.86L448 480l-69.71-118.78 58.86 11.52-69.84-91.03c3.03-17.01 3.04-34.44 0-51.45l69.84-91.03-58.86 11.52L448 32l-118.75 69.71 11.52-58.9-91.06 69.87c-8.5-1.52-17.1-2.29-25.71-2.29s-17.21.78-25.71 2.29l-91.06-69.87 11.52 58.9L0 32zm224 99.78c31.8 0 63.6 12.12 87.85 36.37 48.5 48.5 48.49 127.21 0 175.7s-127.2 48.46-175.7-.03c-48.5-48.5-48.49-127.21 0-175.7 24.24-24.25 56.05-36.34 87.85-36.34zm0 36.66c-22.42 0-44.83 8.52-61.92 25.61-34.18 34.18-34.19 89.68 0 123.87s89.65 34.18 123.84 0c34.18-34.18 34.19-89.68 0-123.87-17.09-17.09-39.5-25.61-61.92-25.61z"],
"sketch": [512, 512, [], "f7c6", "M27.5 162.2L9 187.1h90.5l6.9-130.7-78.9 105.8zM396.3 45.7L267.7 32l135.7 147.2-7.1-133.5zM112.2 218.3l-11.2-22H9.9L234.8 458zm2-31.2h284l-81.5-88.5L256.3 33zm297.3 9.1L277.6 458l224.8-261.7h-90.9zM415.4 69L406 56.4l.9 17.3 6.1 113.4h90.3zM113.5 93.5l-4.6 85.6L244.7 32 116.1 45.7zm287.7 102.7h-290l42.4 82.9L256.3 480l144.9-283.8z"],
"skyatlas": [640, 512, [], "f216", "M640 329.3c0 65.9-52.5 114.4-117.5 114.4-165.9 0-196.6-249.7-359.7-249.7-146.9 0-147.1 212.2 5.6 212.2 42.5 0 90.9-17.8 125.3-42.5 5.6-4.1 16.9-16.3 22.8-16.3s10.9 5 10.9 10.9c0 7.8-13.1 19.1-18.7 24.1-40.9 35.6-100.3 61.2-154.7 61.2-83.4.1-154-59-154-144.9s67.5-149.1 152.8-149.1c185.3 0 222.5 245.9 361.9 245.9 99.9 0 94.8-139.7 3.4-139.7-17.5 0-35 11.6-46.9 11.6-8.4 0-15.9-7.2-15.9-15.6 0-11.6 5.3-23.7 5.3-36.3 0-66.6-50.9-114.7-116.9-114.7-53.1 0-80 36.9-88.8 36.9-6.2 0-11.2-5-11.2-11.2 0-5.6 4.1-10.3 7.8-14.4 25.3-28.8 64.7-43.7 102.8-43.7 79.4 0 139.1 58.4 139.1 137.8 0 6.9-.3 13.7-1.2 20.6 11.9-3.1 24.1-4.7 35.9-4.7 60.7 0 111.9 45.3 111.9 107.2z"],
"skype": [448, 512, [], "f17e", "M424.7 299.8c2.9-14 4.7-28.9 4.7-43.8 0-113.5-91.9-205.3-205.3-205.3-14.9 0-29.7 1.7-43.8 4.7C161.3 40.7 137.7 32 112 32 50.2 32 0 82.2 0 144c0 25.7 8.7 49.3 23.3 68.2-2.9 14-4.7 28.9-4.7 43.8 0 113.5 91.9 205.3 205.3 205.3 14.9 0 29.7-1.7 43.8-4.7 19 14.6 42.6 23.3 68.2 23.3 61.8 0 112-50.2 112-112 .1-25.6-8.6-49.2-23.2-68.1zm-194.6 91.5c-65.6 0-120.5-29.2-120.5-65 0-16 9-30.6 29.5-30.6 31.2 0 34.1 44.9 88.1 44.9 25.7 0 42.3-11.4 42.3-26.3 0-18.7-16-21.6-42-28-62.5-15.4-117.8-22-117.8-87.2 0-59.2 58.6-81.1 109.1-81.1 55.1 0 110.8 21.9 110.8 55.4 0 16.9-11.4 31.8-30.3 31.8-28.3 0-29.2-33.5-75-33.5-25.7 0-42 7-42 22.5 0 19.8 20.8 21.8 69.1 33 41.4 9.3 90.7 26.8 90.7 77.6 0 59.1-57.1 86.5-112 86.5z"],
"slack": [448, 512, [], "f198", "M94.12 315.1c0 25.9-21.16 47.06-47.06 47.06S0 341 0 315.1c0-25.9 21.16-47.06 47.06-47.06h47.06v47.06zm23.72 0c0-25.9 21.16-47.06 47.06-47.06s47.06 21.16 47.06 47.06v117.84c0 25.9-21.16 47.06-47.06 47.06s-47.06-21.16-47.06-47.06V315.1zm47.06-188.98c-25.9 0-47.06-21.16-47.06-47.06S139 32 164.9 32s47.06 21.16 47.06 47.06v47.06H164.9zm0 23.72c25.9 0 47.06 21.16 47.06 47.06s-21.16 47.06-47.06 47.06H47.06C21.16 243.96 0 222.8 0 196.9s21.16-47.06 47.06-47.06H164.9zm188.98 47.06c0-25.9 21.16-47.06 47.06-47.06 25.9 0 47.06 21.16 47.06 47.06s-21.16 47.06-47.06 47.06h-47.06V196.9zm-23.72 0c0 25.9-21.16 47.06-47.06 47.06-25.9 0-47.06-21.16-47.06-47.06V79.06c0-25.9 21.16-47.06 47.06-47.06 25.9 0 47.06 21.16 47.06 47.06V196.9zM283.1 385.88c25.9 0 47.06 21.16 47.06 47.06 0 25.9-21.16 47.06-47.06 47.06-25.9 0-47.06-21.16-47.06-47.06v-47.06h47.06zm0-23.72c-25.9 0-47.06-21.16-47.06-47.06 0-25.9 21.16-47.06 47.06-47.06h117.84c25.9 0 47.06 21.16 47.06 47.06 0 25.9-21.16 47.06-47.06 47.06H283.1z"],
"slack-hash": [448, 512, [], "f3ef", "M446.2 270.4c-6.2-19-26.9-29.1-46-22.9l-45.4 15.1-30.3-90 45.4-15.1c19.1-6.2 29.1-26.8 23-45.9-6.2-19-26.9-29.1-46-22.9l-45.4 15.1-15.7-47c-6.2-19-26.9-29.1-46-22.9-19.1 6.2-29.1 26.8-23 45.9l15.7 47-93.4 31.2-15.7-47c-6.2-19-26.9-29.1-46-22.9-19.1 6.2-29.1 26.8-23 45.9l15.7 47-45.3 15c-19.1 6.2-29.1 26.8-23 45.9 5 14.5 19.1 24 33.6 24.6 6.8 1 12-1.6 57.7-16.8l30.3 90L78 354.8c-19 6.2-29.1 26.9-23 45.9 5 14.5 19.1 24 33.6 24.6 6.8 1 12-1.6 57.7-16.8l15.7 47c5.9 16.9 24.7 29 46 22.9 19.1-6.2 29.1-26.8 23-45.9l-15.7-47 93.6-31.3 15.7 47c5.9 16.9 24.7 29 46 22.9 19.1-6.2 29.1-26.8 23-45.9l-15.7-47 45.4-15.1c19-6 29.1-26.7 22.9-45.7zm-254.1 47.2l-30.3-90.2 93.5-31.3 30.3 90.2-93.5 31.3z"],
"slideshare": [512, 512, [], "f1e7", "M187.7 153.7c-34 0-61.7 25.7-61.7 57.7 0 31.7 27.7 57.7 61.7 57.7s61.7-26 61.7-57.7c0-32-27.7-57.7-61.7-57.7zm143.4 0c-34 0-61.7 25.7-61.7 57.7 0 31.7 27.7 57.7 61.7 57.7 34.3 0 61.7-26 61.7-57.7.1-32-27.4-57.7-61.7-57.7zm156.6 90l-6 4.3V49.7c0-27.4-20.6-49.7-46-49.7H76.6c-25.4 0-46 22.3-46 49.7V248c-2-1.4-4.3-2.9-6.3-4.3-15.1-10.6-25.1 4-16 17.7 18.3 22.6 53.1 50.3 106.3 72C58.3 525.1 252 555.7 248.9 457.5c0-.7.3-56.6.3-96.6 5.1 1.1 9.4 2.3 13.7 3.1 0 39.7.3 92.8.3 93.5-3.1 98.3 190.6 67.7 134.3-124 53.1-21.7 88-49.4 106.3-72 9.1-13.8-.9-28.3-16.1-17.8zm-30.5 19.2c-68.9 37.4-128.3 31.1-160.6 29.7-23.7-.9-32.6 9.1-33.7 24.9-10.3-7.7-18.6-15.5-20.3-17.1-5.1-5.4-13.7-8-27.1-7.7-31.7 1.1-89.7 7.4-157.4-28V72.3c0-34.9 8.9-45.7 40.6-45.7h317.7c30.3 0 40.9 12.9 40.9 45.7v190.6z"],
"snapchat": [496, 512, [], "f2ab", "M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm169.5 338.9c-3.5 8.1-18.1 14-44.8 18.2-1.4 1.9-2.5 9.8-4.3 15.9-1.1 3.7-3.7 5.9-8.1 5.9h-.2c-6.2 0-12.8-2.9-25.8-2.9-17.6 0-23.7 4-37.4 13.7-14.5 10.3-28.4 19.1-49.2 18.2-21 1.6-38.6-11.2-48.5-18.2-13.8-9.7-19.8-13.7-37.4-13.7-12.5 0-20.4 3.1-25.8 3.1-5.4 0-7.5-3.3-8.3-6-1.8-6.1-2.9-14.1-4.3-16-13.8-2.1-44.8-7.5-45.5-21.4-.2-3.6 2.3-6.8 5.9-7.4 46.3-7.6 67.1-55.1 68-57.1 0-.1.1-.2.2-.3 2.5-5 3-9.2 1.6-12.5-3.4-7.9-17.9-10.7-24-13.2-15.8-6.2-18-13.4-17-18.3 1.6-8.5 14.4-13.8 21.9-10.3 5.9 2.8 11.2 4.2 15.7 4.2 3.3 0 5.5-.8 6.6-1.4-1.4-23.9-4.7-58 3.8-77.1C183.1 100 230.7 96 244.7 96c.6 0 6.1-.1 6.7-.1 34.7 0 68 17.8 84.3 54.3 8.5 19.1 5.2 53.1 3.8 77.1 1.1.6 2.9 1.3 5.7 1.4 4.3-.2 9.2-1.6 14.7-4.2 4-1.9 9.6-1.6 13.6 0 6.3 2.3 10.3 6.8 10.4 11.9.1 6.5-5.7 12.1-17.2 16.6-1.4.6-3.1 1.1-4.9 1.7-6.5 2.1-16.4 5.2-19 11.5-1.4 3.3-.8 7.5 1.6 12.5.1.1.1.2.2.3.9 2 21.7 49.5 68 57.1 4 1 7.1 5.5 4.9 10.8z"],
"snapchat-ghost": [512, 512, [], "f2ac", "M510.846 392.673c-5.211 12.157-27.239 21.089-67.36 27.318-2.064 2.786-3.775 14.686-6.507 23.956-1.625 5.566-5.623 8.869-12.128 8.869l-.297-.005c-9.395 0-19.203-4.323-38.852-4.323-26.521 0-35.662 6.043-56.254 20.588-21.832 15.438-42.771 28.764-74.027 27.399-31.646 2.334-58.025-16.908-72.871-27.404-20.714-14.643-29.828-20.582-56.241-20.582-18.864 0-30.736 4.72-38.852 4.72-8.073 0-11.213-4.922-12.422-9.04-2.703-9.189-4.404-21.263-6.523-24.13-20.679-3.209-67.31-11.344-68.498-32.15a10.627 10.627 0 0 1 8.877-11.069c69.583-11.455 100.924-82.901 102.227-85.934.074-.176.155-.344.237-.515 3.713-7.537 4.544-13.849 2.463-18.753-5.05-11.896-26.872-16.164-36.053-19.796-23.715-9.366-27.015-20.128-25.612-27.504 2.437-12.836 21.725-20.735 33.002-15.453 8.919 4.181 16.843 6.297 23.547 6.297 5.022 0 8.212-1.204 9.96-2.171-2.043-35.936-7.101-87.29 5.687-115.969C158.122 21.304 229.705 15.42 250.826 15.42c.944 0 9.141-.089 10.11-.089 52.148 0 102.254 26.78 126.723 81.643 12.777 28.65 7.749 79.792 5.695 116.009 1.582.872 4.357 1.942 8.599 2.139 6.397-.286 13.815-2.389 22.069-6.257 6.085-2.846 14.406-2.461 20.48.058l.029.01c9.476 3.385 15.439 10.215 15.589 17.87.184 9.747-8.522 18.165-25.878 25.018-2.118.835-4.694 1.655-7.434 2.525-9.797 3.106-24.6 7.805-28.616 17.271-2.079 4.904-1.256 11.211 2.46 18.748.087.168.166.342.239.515 1.301 3.03 32.615 74.46 102.23 85.934 6.427 1.058 11.163 7.877 7.725 15.859z"],
"snapchat-square": [448, 512, [], "f2ad", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-6.5 314.9c-3.5 8.1-18.1 14-44.8 18.2-1.4 1.9-2.5 9.8-4.3 15.9-1.1 3.7-3.7 5.9-8.1 5.9h-.2c-6.2 0-12.8-2.9-25.8-2.9-17.6 0-23.7 4-37.4 13.7-14.5 10.3-28.4 19.1-49.2 18.2-21 1.6-38.6-11.2-48.5-18.2-13.8-9.7-19.8-13.7-37.4-13.7-12.5 0-20.4 3.1-25.8 3.1-5.4 0-7.5-3.3-8.3-6-1.8-6.1-2.9-14.1-4.3-16-13.8-2.1-44.8-7.5-45.5-21.4-.2-3.6 2.3-6.8 5.9-7.4 46.3-7.6 67.1-55.1 68-57.1 0-.1.1-.2.2-.3 2.5-5 3-9.2 1.6-12.5-3.4-7.9-17.9-10.7-24-13.2-15.8-6.2-18-13.4-17-18.3 1.6-8.5 14.4-13.8 21.9-10.3 5.9 2.8 11.2 4.2 15.7 4.2 3.3 0 5.5-.8 6.6-1.4-1.4-23.9-4.7-58 3.8-77.1C159.1 100 206.7 96 220.7 96c.6 0 6.1-.1 6.7-.1 34.7 0 68 17.8 84.3 54.3 8.5 19.1 5.2 53.1 3.8 77.1 1.1.6 2.9 1.3 5.7 1.4 4.3-.2 9.2-1.6 14.7-4.2 4-1.9 9.6-1.6 13.6 0 6.3 2.3 10.3 6.8 10.4 11.9.1 6.5-5.7 12.1-17.2 16.6-1.4.6-3.1 1.1-4.9 1.7-6.5 2.1-16.4 5.2-19 11.5-1.4 3.3-.8 7.5 1.6 12.5.1.1.1.2.2.3.9 2 21.7 49.5 68 57.1 4 1 7.1 5.5 4.9 10.8z"],
"soundcloud": [640, 512, [], "f1be", "M111.4 256.3l5.8 65-5.8 68.3c-.3 2.5-2.2 4.4-4.4 4.4s-4.2-1.9-4.2-4.4l-5.6-68.3 5.6-65c0-2.2 1.9-4.2 4.2-4.2 2.2 0 4.1 2 4.4 4.2zm21.4-45.6c-2.8 0-4.7 2.2-5 5l-5 105.6 5 68.3c.3 2.8 2.2 5 5 5 2.5 0 4.7-2.2 4.7-5l5.8-68.3-5.8-105.6c0-2.8-2.2-5-4.7-5zm25.5-24.1c-3.1 0-5.3 2.2-5.6 5.3l-4.4 130 4.4 67.8c.3 3.1 2.5 5.3 5.6 5.3 2.8 0 5.3-2.2 5.3-5.3l5.3-67.8-5.3-130c0-3.1-2.5-5.3-5.3-5.3zM7.2 283.2c-1.4 0-2.2 1.1-2.5 2.5L0 321.3l4.7 35c.3 1.4 1.1 2.5 2.5 2.5s2.2-1.1 2.5-2.5l5.6-35-5.6-35.6c-.3-1.4-1.1-2.5-2.5-2.5zm23.6-21.9c-1.4 0-2.5 1.1-2.5 2.5l-6.4 57.5 6.4 56.1c0 1.7 1.1 2.8 2.5 2.8s2.5-1.1 2.8-2.5l7.2-56.4-7.2-57.5c-.3-1.4-1.4-2.5-2.8-2.5zm25.3-11.4c-1.7 0-3.1 1.4-3.3 3.3L47 321.3l5.8 65.8c.3 1.7 1.7 3.1 3.3 3.1 1.7 0 3.1-1.4 3.1-3.1l6.9-65.8-6.9-68.1c0-1.9-1.4-3.3-3.1-3.3zm25.3-2.2c-1.9 0-3.6 1.4-3.6 3.6l-5.8 70 5.8 67.8c0 2.2 1.7 3.6 3.6 3.6s3.6-1.4 3.9-3.6l6.4-67.8-6.4-70c-.3-2.2-2-3.6-3.9-3.6zm241.4-110.9c-1.1-.8-2.8-1.4-4.2-1.4-2.2 0-4.2.8-5.6 1.9-1.9 1.7-3.1 4.2-3.3 6.7v.8l-3.3 176.7 1.7 32.5 1.7 31.7c.3 4.7 4.2 8.6 8.9 8.6s8.6-3.9 8.6-8.6l3.9-64.2-3.9-177.5c-.4-3-2-5.8-4.5-7.2zm-26.7 15.3c-1.4-.8-2.8-1.4-4.4-1.4s-3.1.6-4.4 1.4c-2.2 1.4-3.6 3.9-3.6 6.7l-.3 1.7-2.8 160.8s0 .3 3.1 65.6v.3c0 1.7.6 3.3 1.7 4.7 1.7 1.9 3.9 3.1 6.4 3.1 2.2 0 4.2-1.1 5.6-2.5 1.7-1.4 2.5-3.3 2.5-5.6l.3-6.7 3.1-58.6-3.3-162.8c-.3-2.8-1.7-5.3-3.9-6.7zm-111.4 22.5c-3.1 0-5.8 2.8-5.8 6.1l-4.4 140.6 4.4 67.2c.3 3.3 2.8 5.8 5.8 5.8 3.3 0 5.8-2.5 6.1-5.8l5-67.2-5-140.6c-.2-3.3-2.7-6.1-6.1-6.1zm376.7 62.8c-10.8 0-21.1 2.2-30.6 6.1-6.4-70.8-65.8-126.4-138.3-126.4-17.8 0-35 3.3-50.3 9.4-6.1 2.2-7.8 4.4-7.8 9.2v249.7c0 5 3.9 8.6 8.6 9.2h218.3c43.3 0 78.6-35 78.6-78.3.1-43.6-35.2-78.9-78.5-78.9zm-296.7-60.3c-4.2 0-7.5 3.3-7.8 7.8l-3.3 136.7 3.3 65.6c.3 4.2 3.6 7.5 7.8 7.5 4.2 0 7.5-3.3 7.5-7.5l3.9-65.6-3.9-136.7c-.3-4.5-3.3-7.8-7.5-7.8zm-53.6-7.8c-3.3 0-6.4 3.1-6.4 6.7l-3.9 145.3 3.9 66.9c.3 3.6 3.1 6.4 6.4 6.4 3.6 0 6.4-2.8 6.7-6.4l4.4-66.9-4.4-145.3c-.3-3.6-3.1-6.7-6.7-6.7zm26.7 3.4c-3.9 0-6.9 3.1-6.9 6.9L227 321.3l3.9 66.4c.3 3.9 3.1 6.9 6.9 6.9s6.9-3.1 6.9-6.9l4.2-66.4-4.2-141.7c0-3.9-3-6.9-6.9-6.9z"],
"sourcetree": [448, 512, [], "f7d3", "M427.2 203c0-112.1-90.9-203-203-203C112.1-.2 21.2 90.6 21 202.6A202.86 202.86 0 0 0 161.5 396v101.7a14.3 14.3 0 0 0 14.3 14.3h96.4a14.3 14.3 0 0 0 14.3-14.3V396.1A203.18 203.18 0 0 0 427.2 203zm-271.6 0c0-90.8 137.3-90.8 137.3 0-.1 89.9-137.3 91-137.3 0z"],
"speakap": [448, 512, [], "f3f3", "M64 391.78C-15.41 303.59-8 167.42 80.64 87.64s224.8-73 304.21 15.24 72 224.36-16.64 304.14c-18.74 16.87 64 43.09 42 52.26-82.06 34.21-253.91 35-346.23-67.5zm213.31-211.6l38.5-40.86c-9.61-8.89-32-26.83-76.17-27.6-52.33-.91-95.86 28.3-96.77 80-.2 11.33.29 36.72 29.42 54.83 34.46 21.42 86.52 21.51 86 52.26-.37 21.28-26.42 25.81-38.59 25.6-3-.05-30.23-.46-47.61-24.62l-40 42.61c28.16 27 59 32.62 83.49 33.05 10.23.18 96.42.33 97.84-81 .28-15.81-2.07-39.72-28.86-56.59-34.36-21.64-85-19.45-84.43-49.75.41-23.25 31-25.37 37.53-25.26.43 0 26.62.26 39.62 17.37z"],
"speaker-deck": [512, 512, [], "f83c", "M213.86 296H100a100 100 0 0 1 0-200h132.84a40 40 0 0 1 0 80H98c-26.47 0-26.45 40 0 40h113.82a100 100 0 0 1 0 200H40a40 40 0 0 1 0-80h173.86c26.48 0 26.46-40 0-40zM298 416a120.21 120.21 0 0 0 51.11-80h64.55a19.83 19.83 0 0 0 19.66-20V196a19.83 19.83 0 0 0-19.66-20H296.42a60.77 60.77 0 0 0 0-80h136.93c43.44 0 78.65 35.82 78.65 80v160c0 44.18-35.21 80-78.65 80z"],
"spotify": [496, 512, [], "f1bc", "M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8zm100.7 364.9c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4zm26.9-65.6c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm31-76.2c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3z"],
"squarespace": [512, 512, [], "f5be", "M186.12 343.34c-9.65 9.65-9.65 25.29 0 34.94 9.65 9.65 25.29 9.65 34.94 0L378.24 221.1c19.29-19.29 50.57-19.29 69.86 0s19.29 50.57 0 69.86L293.95 445.1c19.27 19.29 50.53 19.31 69.82.04l.04-.04 119.25-119.24c38.59-38.59 38.59-101.14 0-139.72-38.59-38.59-101.15-38.59-139.72 0l-157.22 157.2zm244.53-104.8c-9.65-9.65-25.29-9.65-34.93 0l-157.2 157.18c-19.27 19.29-50.53 19.31-69.82.05l-.05-.05c-9.64-9.64-25.27-9.65-34.92-.01l-.01.01c-9.65 9.64-9.66 25.28-.02 34.93l.02.02c38.58 38.57 101.14 38.57 139.72 0l157.2-157.2c9.65-9.65 9.65-25.29.01-34.93zm-261.99 87.33l157.18-157.18c9.64-9.65 9.64-25.29 0-34.94-9.64-9.64-25.27-9.64-34.91 0L133.72 290.93c-19.28 19.29-50.56 19.3-69.85.01l-.01-.01c-19.29-19.28-19.31-50.54-.03-69.84l.03-.03L218.03 66.89c-19.28-19.29-50.55-19.3-69.85-.02l-.02.02L28.93 186.14c-38.58 38.59-38.58 101.14 0 139.72 38.6 38.59 101.13 38.59 139.73.01zm-87.33-52.4c9.64 9.64 25.27 9.64 34.91 0l157.21-157.19c19.28-19.29 50.55-19.3 69.84-.02l.02.02c9.65 9.65 25.29 9.65 34.93 0 9.65-9.65 9.65-25.29 0-34.93-38.59-38.59-101.13-38.59-139.72 0L81.33 238.54c-9.65 9.64-9.65 25.28-.01 34.93h.01z"],
"stack-exchange": [448, 512, [], "f18d", "M17.7 332.3h412.7v22c0 37.7-29.3 68-65.3 68h-19L259.3 512v-89.7H83c-36 0-65.3-30.3-65.3-68v-22zm0-23.6h412.7v-85H17.7v85zm0-109.4h412.7v-85H17.7v85zM365 0H83C47 0 17.7 30.3 17.7 67.7V90h412.7V67.7C430.3 30.3 401 0 365 0z"],
"stack-overflow": [384, 512, [], "f16c", "M290.7 311L95 269.7 86.8 309l195.7 41zm51-87L188.2 95.7l-25.5 30.8 153.5 128.3zm-31.2 39.7L129.2 179l-16.7 36.5L293.7 300zM262 32l-32 24 119.3 160.3 32-24zm20.5 328h-200v39.7h200zm39.7 80H42.7V320h-40v160h359.5V320h-40z"],
"staylinked": [440, 512, [], "f3f5", "M382.7 292.5l2.7 2.7-170-167.3c-3.5-3.5-9.7-3.7-13.8-.5L144.3 171c-4.2 3.2-4.6 8.7-1.1 12.2l68.1 64.3c3.6 3.5 9.9 3.7 14 .5l.1-.1c4.1-3.2 10.4-3 14 .5l84 81.3c3.6 3.5 3.2 9-.9 12.2l-93.2 74c-4.2 3.3-10.5 3.1-14.2-.4L63.2 268c-3.5-3.5-9.7-3.7-13.9-.5L3.5 302.4c-4.2 3.2-4.7 8.7-1.2 12.2L211 510.7s7.4 6.8 17.3-.8l198-163.9c4-3.2 4.4-8.7.7-12.2zm54.5-83.4L226.7 2.5c-1.5-1.2-8-5.5-16.3 1.1L3.6 165.7c-4.2 3.2-4.8 8.7-1.2 12.2l42.3 41.7 171.7 165.1c3.7 3.5 10.1 3.7 14.3.4l50.2-38.8-.3-.3 7.7-6c4.2-3.2 4.6-8.7.9-12.2l-57.1-54.4c-3.6-3.5-10-3.7-14.2-.5l-.1.1c-4.2 3.2-10.5 3.1-14.2-.4L109 180.8c-3.6-3.5-3.1-8.9 1.1-12.2l92.2-71.5c4.1-3.2 10.3-3 13.9.5l160.4 159c3.7 3.5 10 3.7 14.1.5l45.8-35.8c4.1-3.2 4.4-8.7.7-12.2z"],
"steam": [496, 512, [], "f1b6", "M496 256c0 137-111.2 248-248.4 248-113.8 0-209.6-76.3-239-180.4l95.2 39.3c6.4 32.1 34.9 56.4 68.9 56.4 39.2 0 71.9-32.4 70.2-73.5l84.5-60.2c52.1 1.3 95.8-40.9 95.8-93.5 0-51.6-42-93.5-93.7-93.5s-93.7 42-93.7 93.5v1.2L176.6 279c-15.5-.9-30.7 3.4-43.5 12.1L0 236.1C10.2 108.4 117.1 8 247.6 8 384.8 8 496 119 496 256zM155.7 384.3l-30.5-12.6a52.79 52.79 0 0 0 27.2 25.8c26.9 11.2 57.8-1.6 69-28.4 5.4-13 5.5-27.3.1-40.3-5.4-13-15.5-23.2-28.5-28.6-12.9-5.4-26.7-5.2-38.9-.6l31.5 13c19.8 8.2 29.2 30.9 20.9 50.7-8.3 19.9-31 29.2-50.8 21zm173.8-129.9c-34.4 0-62.4-28-62.4-62.3s28-62.3 62.4-62.3 62.4 28 62.4 62.3-27.9 62.3-62.4 62.3zm.1-15.6c25.9 0 46.9-21 46.9-46.8 0-25.9-21-46.8-46.9-46.8s-46.9 21-46.9 46.8c.1 25.8 21.1 46.8 46.9 46.8z"],
"steam-square": [448, 512, [], "f1b7", "M185.2 356.5c7.7-18.5-1-39.7-19.6-47.4l-29.5-12.2c11.4-4.3 24.3-4.5 36.4.5 12.2 5.1 21.6 14.6 26.7 26.7 5 12.2 5 25.6-.1 37.7-10.5 25.1-39.4 37-64.6 26.5-11.6-4.8-20.4-13.6-25.4-24.2l28.5 11.8c18.6 7.8 39.9-.9 47.6-19.4zM400 32H48C21.5 32 0 53.5 0 80v160.7l116.6 48.1c12-8.2 26.2-12.1 40.7-11.3l55.4-80.2v-1.1c0-48.2 39.3-87.5 87.6-87.5s87.6 39.3 87.6 87.5c0 49.2-40.9 88.7-89.6 87.5l-79 56.3c1.6 38.5-29.1 68.8-65.7 68.8-31.8 0-58.5-22.7-64.5-52.7L0 319.2V432c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-99.7 222.5c-32.2 0-58.4-26.1-58.4-58.3s26.2-58.3 58.4-58.3 58.4 26.2 58.4 58.3-26.2 58.3-58.4 58.3zm.1-14.6c24.2 0 43.9-19.6 43.9-43.8 0-24.2-19.6-43.8-43.9-43.8-24.2 0-43.9 19.6-43.9 43.8 0 24.2 19.7 43.8 43.9 43.8z"],
"steam-symbol": [448, 512, [], "f3f6", "M395.5 177.5c0 33.8-27.5 61-61 61-33.8 0-61-27.3-61-61s27.3-61 61-61c33.5 0 61 27.2 61 61zm52.5.2c0 63-51 113.8-113.7 113.8L225 371.3c-4 43-40.5 76.8-84.5 76.8-40.5 0-74.7-28.8-83-67L0 358V250.7L97.2 290c15.1-9.2 32.2-13.3 52-11.5l71-101.7c.5-62.3 51.5-112.8 114-112.8C397 64 448 115 448 177.7zM203 363c0-34.7-27.8-62.5-62.5-62.5-4.5 0-9 .5-13.5 1.5l26 10.5c25.5 10.2 38 39 27.7 64.5-10.2 25.5-39.2 38-64.7 27.5-10.2-4-20.5-8.3-30.7-12.2 10.5 19.7 31.2 33.2 55.2 33.2 34.7 0 62.5-27.8 62.5-62.5zm207.5-185.3c0-42-34.3-76.2-76.2-76.2-42.3 0-76.5 34.2-76.5 76.2 0 42.2 34.3 76.2 76.5 76.2 41.9.1 76.2-33.9 76.2-76.2z"],
"sticker-mule": [576, 512, [], "f3f7", "M561.7 199.6c-1.3.3.3 0 0 0zm-6.2-77.4c-7.7-22.3-5.1-7.2-13.4-36.9-1.6-6.5-3.6-14.5-6.2-20-4.4-8.7-4.6-7.5-4.6-9.5 0-5.3 30.7-45.3 19-46.9-5.7-.6-12.2 11.6-20.6 17-8.6 4.2-8 5-10.3 5-2.6 0-5.7-3-6.2-5-2-5.7 1.9-25.9-3.6-25.9-3.6 0-12.3 24.8-17 25.8-5.2 1.3-27.9-11.4-75.1 18-25.3 13.2-86.9 65.2-87 65.3-6.7 4.7-20 4.7-35.5 16-44.4 30.1-109.6 9.4-110.7 9-110.6-26.8-128-15.2-159 11.5-20.8 17.9-23.7 36.5-24.2 38.9-4.2 20.4 5.2 48.3 6.7 64.3 1.8 19.3-2.7 17.7 7.7 98.3.5 1 4.1 0 5.1 1.5 0 8.4-3.8 12.1-4.1 13-1.5 4.5-1.5 10.5 0 16 2.3 8.2 8.2 37.2 8.2 46.9 0 41.8.4 44 2.6 49.4 3.9 10 12.5 9.1 17 12 3.1 3.5-.5 8.5 1 12.5.5 2 3.6 4 6.2 5 9.2 3.6 27 .3 29.9-2.5 1.6-1.5.5-4.5 3.1-5 5.1 0 10.8-.5 14.4-2.5 5.1-2.5 4.1-6 1.5-10.5-.4-.8-7-13.3-9.8-16-2.1-2-5.1-3-7.2-4.5-5.8-4.9-10.3-19.4-10.3-19.5-4.6-19.4-10.3-46.3-4.1-66.8 4.6-17.2 39.5-87.7 39.6-87.8 4.1-6.5 17-11.5 27.3-7 6 1.9 19.3 22 65.4 30.9 47.9 8.7 97.4-2 112.2-2 2.8 2-1.9 13-.5 38.9 0 26.4-.4 13.7-4.1 29.9-2.2 9.7 3.4 23.2-1.5 46.9-1.4 9.8-9.9 32.7-8.2 43.4.5 1 1 2 1.5 3.5.5 4.5 1.5 8.5 4.6 10 7.3 3.6 12-3.5 9.8 11.5-.7 3.1-2.6 12 1.5 15 4.4 3.7 30.6 3.4 36.5.5 2.6-1.5 1.6-4.5 6.4-7.4 1.9-.9 11.3-.4 11.3-6.5.3-1.8-9.2-19.9-9.3-20-2.6-3.5-9.2-4.5-11.3-8-6.9-10.1-1.7-52.6.5-59.4 3-11 5.6-22.4 8.7-32.4 11-42.5 10.3-50.6 16.5-68.3.8-1.8 6.4-23.1 10.3-29.9 9.3-17 21.7-32.4 33.5-47.4 18-22.9 34-46.9 52-69.8 6.1-7 8.2-13.7 18-8 10.8 5.7 21.6 7 31.9 17 14.6 12.8 10.2 18.2 11.8 22.9 1.5 5 7.7 10.5 14.9 9.5 10.4-2 13-2.5 13.4-2.5 2.6-.5 5.7-5 7.2-8 3.1-5.5 7.2-9 7.2-16.5 0-7.7-.4-2.8-20.6-52.9z"],
"strava": [384, 512, [], "f428", "M158.4 0L7 292h89.2l62.2-116.1L220.1 292h88.5zm150.2 292l-43.9 88.2-44.6-88.2h-67.6l112.2 220 111.5-220z"],
"stripe": [640, 512, [], "f429", "M165 144.7l-43.3 9.2-.2 142.4c0 26.3 19.8 43.3 46.1 43.3 14.6 0 25.3-2.7 31.2-5.9v-33.8c-5.7 2.3-33.7 10.5-33.7-15.7V221h33.7v-37.8h-33.7zm89.1 51.6l-2.7-13.1H213v153.2h44.3V233.3c10.5-13.8 28.2-11.1 33.9-9.3v-40.8c-6-2.1-26.7-6-37.1 13.1zm92.3-72.3l-44.6 9.5v36.2l44.6-9.5zM44.9 228.3c0-6.9 5.8-9.6 15.1-9.7 13.5 0 30.7 4.1 44.2 11.4v-41.8c-14.7-5.8-29.4-8.1-44.1-8.1-36 0-60 18.8-60 50.2 0 49.2 67.5 41.2 67.5 62.4 0 8.2-7.1 10.9-17 10.9-14.7 0-33.7-6.1-48.6-14.2v40c16.5 7.1 33.2 10.1 48.5 10.1 36.9 0 62.3-15.8 62.3-47.8 0-52.9-67.9-43.4-67.9-63.4zM640 261.6c0-45.5-22-81.4-64.2-81.4s-67.9 35.9-67.9 81.1c0 53.5 30.3 78.2 73.5 78.2 21.2 0 37.1-4.8 49.2-11.5v-33.4c-12.1 6.1-26 9.8-43.6 9.8-17.3 0-32.5-6.1-34.5-26.9h86.9c.2-2.3.6-11.6.6-15.9zm-87.9-16.8c0-20 12.3-28.4 23.4-28.4 10.9 0 22.5 8.4 22.5 28.4zm-112.9-64.6c-17.4 0-28.6 8.2-34.8 13.9l-2.3-11H363v204.8l44.4-9.4.1-50.2c6.4 4.7 15.9 11.2 31.4 11.2 31.8 0 60.8-23.2 60.8-79.6.1-51.6-29.3-79.7-60.5-79.7zm-10.6 122.5c-10.4 0-16.6-3.8-20.9-8.4l-.3-66c4.6-5.1 11-8.8 21.2-8.8 16.2 0 27.4 18.2 27.4 41.4.1 23.9-10.9 41.8-27.4 41.8zm-126.7 33.7h44.6V183.2h-44.6z"],
"stripe-s": [384, 512, [], "f42a", "M155.3 154.6c0-22.3 18.6-30.9 48.4-30.9 43.4 0 98.5 13.3 141.9 36.7V26.1C298.3 7.2 251.1 0 203.8 0 88.1 0 11 60.4 11 161.4c0 157.9 216.8 132.3 216.8 200.4 0 26.4-22.9 34.9-54.7 34.9-47.2 0-108.2-19.5-156.1-45.5v128.5a396.09 396.09 0 0 0 156 32.4c118.6 0 200.3-51 200.3-153.6 0-170.2-218-139.7-218-203.9z"],
"studiovinari": [512, 512, [], "f3f8", "M480.3 187.7l4.2 28v28l-25.1 44.1-39.8 78.4-56.1 67.5-79.1 37.8-17.7 24.5-7.7 12-9.6 4s17.3-63.6 19.4-63.6c2.1 0 20.3.7 20.3.7l66.7-38.6-92.5 26.1-55.9 36.8-22.8 28-6.6 1.4 20.8-73.6 6.9-5.5 20.7 12.9 88.3-45.2 56.8-51.5 14.8-68.4-125.4 23.3 15.2-18.2-173.4-53.3 81.9-10.5-166-122.9L133.5 108 32.2 0l252.9 126.6-31.5-38L378 163 234.7 64l18.7 38.4-49.6-18.1L158.3 0l194.6 122L310 66.2l108 96.4 12-8.9-21-16.4 4.2-37.8L451 89.1l29.2 24.7 11.5 4.2-7 6.2 8.5 12-13.1 7.4-10.3 20.2 10.5 23.9z"],
"stumbleupon": [512, 512, [], "f1a4", "M502.9 266v69.7c0 62.1-50.3 112.4-112.4 112.4-61.8 0-112.4-49.8-112.4-111.3v-70.2l34.3 16 51.1-15.2V338c0 14.7 12 26.5 26.7 26.5S417 352.7 417 338v-72h85.9zm-224.7-58.2l34.3 16 51.1-15.2V173c0-60.5-51.1-109-112.1-109-60.8 0-112.1 48.2-112.1 108.2v162.4c0 14.9-12 26.7-26.7 26.7S86 349.5 86 334.6V266H0v69.7C0 397.7 50.3 448 112.4 448c61.6 0 112.4-49.5 112.4-110.8V176.9c0-14.7 12-26.7 26.7-26.7s26.7 12 26.7 26.7v30.9z"],
"stumbleupon-circle": [496, 512, [], "f1a3", "M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 177.5c-9.8 0-17.8 8-17.8 17.8v106.9c0 40.9-33.9 73.9-74.9 73.9-41.4 0-74.9-33.5-74.9-74.9v-46.5h57.3v45.8c0 10 8 17.8 17.8 17.8s17.8-7.9 17.8-17.8V200.1c0-40 34.2-72.1 74.7-72.1 40.7 0 74.7 32.3 74.7 72.6v23.7l-34.1 10.1-22.9-10.7v-20.6c.1-9.6-7.9-17.6-17.7-17.6zm167.6 123.6c0 41.4-33.5 74.9-74.9 74.9-41.2 0-74.9-33.2-74.9-74.2V263l22.9 10.7 34.1-10.1v47.1c0 9.8 8 17.6 17.8 17.6s17.8-7.9 17.8-17.6v-48h57.3c-.1 45.9-.1 46.4-.1 46.4z"],
"superpowers": [448, 512, [], "f2dd", "M448 32c-83.3 11-166.8 22-250 33-92 12.5-163.3 86.7-169 180-3.3 55.5 18 109.5 57.8 148.2L0 480c83.3-11 166.5-22 249.8-33 91.8-12.5 163.3-86.8 168.7-179.8 3.5-55.5-18-109.5-57.7-148.2L448 32zm-79.7 232.3c-4.2 79.5-74 139.2-152.8 134.5-79.5-4.7-140.7-71-136.3-151 4.5-79.2 74.3-139.3 153-134.5 79.3 4.7 140.5 71 136.1 151z"],
"supple": [640, 512, [], "f3f9", "M640 262.5c0 64.1-109 116.1-243.5 116.1-24.8 0-48.6-1.8-71.1-5 7.7.4 15.5.6 23.4.6 134.5 0 243.5-56.9 243.5-127.1 0-29.4-19.1-56.4-51.2-78 60 21.1 98.9 55.1 98.9 93.4zM47.7 227.9c-.1-70.2 108.8-127.3 243.3-127.6 7.9 0 15.6.2 23.3.5-22.5-3.2-46.3-4.9-71-4.9C108.8 96.3-.1 148.5 0 212.6c.1 38.3 39.1 72.3 99.3 93.3-32.3-21.5-51.5-48.6-51.6-78zm60.2 39.9s10.5 13.2 29.3 13.2c17.9 0 28.4-11.5 28.4-25.1 0-28-40.2-25.1-40.2-39.7 0-5.4 5.3-9.1 12.5-9.1 5.7 0 11.3 2.6 11.3 6.6v3.9h14.2v-7.9c0-12.1-15.4-16.8-25.4-16.8-16.5 0-28.5 10.2-28.5 24.1 0 26.6 40.2 25.4 40.2 39.9 0 6.6-5.8 10.1-12.3 10.1-11.9 0-20.7-10.1-20.7-10.1l-8.8 10.9zm120.8-73.6v54.4c0 11.3-7.1 17.8-17.8 17.8-10.7 0-17.8-6.5-17.8-17.7v-54.5h-15.8v55c0 18.9 13.4 31.9 33.7 31.9 20.1 0 33.4-13 33.4-31.9v-55h-15.7zm34.4 85.4h15.8v-29.5h15.5c16 0 27.2-11.5 27.2-28.1s-11.2-27.8-27.2-27.8h-39.1v13.4h7.8v72zm15.8-43v-29.1h12.9c8.7 0 13.7 5.7 13.7 14.4 0 8.9-5.1 14.7-14 14.7h-12.6zm57 43h15.8v-29.5h15.5c16 0 27.2-11.5 27.2-28.1s-11.2-27.8-27.2-27.8h-39.1v13.4h7.8v72zm15.7-43v-29.1h12.9c8.7 0 13.7 5.7 13.7 14.4 0 8.9-5 14.7-14 14.7h-12.6zm57.1 34.8c0 5.8 2.4 8.2 8.2 8.2h37.6c5.8 0 8.2-2.4 8.2-8.2v-13h-14.3v5.2c0 1.7-1 2.6-2.6 2.6h-18.6c-1.7 0-2.6-1-2.6-2.6v-61.2c0-5.7-2.4-8.2-8.2-8.2H401v13.4h5.2c1.7 0 2.6 1 2.6 2.6v61.2zm63.4 0c0 5.8 2.4 8.2 8.2 8.2H519c5.7 0 8.2-2.4 8.2-8.2v-13h-14.3v5.2c0 1.7-1 2.6-2.6 2.6h-19.7c-1.7 0-2.6-1-2.6-2.6v-20.3h27.7v-13.4H488v-22.4h19.2c1.7 0 2.6 1 2.6 2.6v5.2H524v-13c0-5.7-2.5-8.2-8.2-8.2h-51.6v13.4h7.8v63.9zm58.9-76v5.9h1.6v-5.9h2.7v-1.2h-7v1.2h2.7zm5.7-1.2v7.1h1.5v-5.7l2.3 5.7h1.3l2.3-5.7v5.7h1.5v-7.1h-2.3l-2.1 5.1-2.1-5.1h-2.4z"],
"suse": [640, 512, [], "f7d6", "M471.08 102.66s-.3 18.3-.3 20.3c-9.1-3-74.4-24.1-135.7-26.3-51.9-1.8-122.8-4.3-223 57.3-19.4 12.4-73.9 46.1-99.6 109.7C7 277-.12 307 7 335.06a111 111 0 0 0 16.5 35.7c17.4 25 46.6 41.6 78.1 44.4 44.4 3.9 78.1-16 90-53.3 8.2-25.8 0-63.6-31.5-82.9-25.6-15.7-53.3-12.1-69.2-1.6-13.9 9.2-21.8 23.5-21.6 39.2.3 27.8 24.3 42.6 41.5 42.6a49 49 0 0 0 15.8-2.7c6.5-1.8 13.3-6.5 13.3-14.9 0-12.1-11.6-14.8-16.8-13.9-2.9.5-4.5 2-11.8 2.4-2-.2-12-3.1-12-14V316c.2-12.3 13.2-18 25.5-16.9 32.3 2.8 47.7 40.7 28.5 65.7-18.3 23.7-76.6 23.2-99.7-20.4-26-49.2 12.7-111.2 87-98.4 33.2 5.7 83.6 35.5 102.4 104.3h45.9c-5.7-17.6-8.9-68.3 42.7-68.3 56.7 0 63.9 39.9 79.8 68.3H460c-12.8-18.3-21.7-38.7-18.9-55.8 5.6-33.8 39.7-18.4 82.4-17.4 66.5.4 102.1-27 103.1-28 3.7-3.1 6.5-15.8 7-17.7 1.3-5.1-3.2-2.4-3.2-2.4-8.7 5.2-30.5 15.2-50.9 15.6-25.3.5-76.2-25.4-81.6-28.2-.3-.4.1 1.2-11-25.5 88.4 58.3 118.3 40.5 145.2 21.7.8-.6 4.3-2.9 3.6-5.7-13.8-48.1-22.4-62.7-34.5-69.6-37-21.6-125-34.7-129.2-35.3.1-.1-.9-.3-.9.7zm60.4 72.8a37.54 37.54 0 0 1 38.9-36.3c33.4 1.2 48.8 42.3 24.4 65.2-24.2 22.7-64.4 4.6-63.3-28.9zm38.6-25.3a26.27 26.27 0 1 0 25.4 27.2 26.19 26.19 0 0 0-25.4-27.2zm4.3 28.8c-15.4 0-15.4-15.6 0-15.6s15.4 15.64 0 15.64z"],
"symfony": [512, 512, [], "f83d", "M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm133.74 143.54c-11.47.41-19.4-6.45-19.77-16.87-.27-9.18 6.68-13.44 6.53-18.85-.23-6.55-10.16-6.82-12.87-6.67-39.78 1.29-48.59 57-58.89 113.85 21.43 3.15 36.65-.72 45.14-6.22 12-7.75-3.34-15.72-1.42-24.56 4-18.16 32.55-19 32 5.3-.36 17.86-25.92 41.81-77.6 35.7-10.76 59.52-18.35 115-58.2 161.72-29 34.46-58.4 39.82-71.58 40.26-24.65.85-41-12.31-41.58-29.84-.56-17 14.45-26.26 24.31-26.59 21.89-.75 30.12 25.67 14.88 34-12.09 9.71.11 12.61 2.05 12.55 10.42-.36 17.34-5.51 22.18-9 24-20 33.24-54.86 45.35-118.35 8.19-49.66 17-78 18.23-82-16.93-12.75-27.08-28.55-49.85-34.72-15.61-4.23-25.12-.63-31.81 7.83-7.92 10-5.29 23 2.37 30.7l12.63 14c15.51 17.93 24 31.87 20.8 50.62-5.06 29.93-40.72 52.9-82.88 39.94-36-11.11-42.7-36.56-38.38-50.62 7.51-24.15 42.36-11.72 34.62 13.6-2.79 8.6-4.92 8.68-6.28 13.07-4.56 14.77 41.85 28.4 51-1.39 4.47-14.52-5.3-21.71-22.25-39.85-28.47-31.75-16-65.49 2.95-79.67C204.23 140.13 251.94 197 262 205.29c37.17-109 100.53-105.46 102.43-105.53 25.16-.81 44.19 10.59 44.83 28.65.25 7.69-4.17 22.59-19.52 23.13z"],
"teamspeak": [512, 512, [], "f4f9", "M244.2 346.79c2.4-12.3-12-30-32.4-48.7-20.9-19.2-48.2-39.1-63.4-46.6-21.7-12-41.7-1.8-46.3 22.7-5 26.2 0 51.4 14.5 73.9 10.2 15.5 25.4 22.7 43.4 24 11.6.6 52.5 2.2 61.7-1 11.9-4.3 20.1-11.8 22.5-24.3zm205 20.8a5.22 5.22 0 0 0-8.3 2.4c-8 25.4-44.7 112.5-172.1 121.5-149.7 10.5 80.3 43.6 145.4-6.4 22.7-17.4 47.6-35 46.6-85.4-.4-10.1-4.9-26.69-11.6-32.1zm62-122.4c-.3-18.9-8.6-33.4-26-42.2-2.9-1.3-5-2.7-5.9-6.4A222.64 222.64 0 0 0 438.9 103c-1.1-1.5-3.5-3.2-2.2-5 8.5-11.5-.3-18-7-24.4Q321.4-31.11 177.4 13.09c-40.1 12.3-73.9 35.6-102 67.4-4 4.3-6.7 9.1-3 14.5 3 4 1.3 6.2-1 9.3C51.6 132 38.2 162.59 32.1 196c-.7 4.3-2.9 6-6.4 7.8-14.2 7-22.5 18.5-24.9 34L0 264.29v20.9c0 30.8 21 50.4 51.8 49 7.7-.3 11.7-4.3 12-11.5 2-77.5-2.4-95.4 3.7-125.8C92.1 72.39 234.3 5 345.3 65.39 411.4 102 445.7 159 447.6 234.79c.8 28.2 0 56.5 0 84.6 0 7 2.2 12.5 9.4 14.2 24.1 5 49.2-12 53.2-36.7 2.9-17.1 1-34.5 1-51.7zm-159.6 131.5c36.5 2.8 59.3-28.5 58.4-60.5-2.1-45.2-66.2-16.5-87.8-8-73.2 28.1-45 54.9-22.2 60.8z"],
"telegram": [496, 512, [], "f2c6", "M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm121.8 169.9l-40.7 191.8c-3 13.6-11.1 16.9-22.4 10.5l-62-45.7-29.9 28.8c-3.3 3.3-6.1 6.1-12.5 6.1l4.4-63.1 114.9-103.8c5-4.4-1.1-6.9-7.7-2.5l-142 89.4-61.2-19.1c-13.3-4.2-13.6-13.3 2.8-19.7l239.1-92.2c11.1-4 20.8 2.7 17.2 19.5z"],
"telegram-plane": [448, 512, [], "f3fe", "M446.7 98.6l-67.6 318.8c-5.1 22.5-18.4 28.1-37.3 17.5l-103-75.9-49.7 47.8c-5.5 5.5-10.1 10.1-20.7 10.1l7.4-104.9 190.9-172.5c8.3-7.4-1.8-11.5-12.9-4.1L117.8 284 16.2 252.2c-22.1-6.9-22.5-22.1 4.6-32.7L418.2 66.4c18.4-6.9 34.5 4.1 28.5 32.2z"],
"tencent-weibo": [384, 512, [], "f1d5", "M72.3 495.8c1.4 19.9-27.6 22.2-29.7 2.9C31 368.8 73.7 259.2 144 185.5c-15.6-34 9.2-77.1 50.6-77.1 30.3 0 55.1 24.6 55.1 55.1 0 44-49.5 70.8-86.9 45.1-65.7 71.3-101.4 169.8-90.5 287.2zM192 .1C66.1.1-12.3 134.3 43.7 242.4 52.4 259.8 79 246.9 70 229 23.7 136.4 91 29.8 192 29.8c75.4 0 136.9 61.4 136.9 136.9 0 90.8-86.9 153.9-167.7 133.1-19.1-4.1-25.6 24.4-6.6 29.1 110.7 23.2 204-60 204-162.3C358.6 74.7 284 .1 192 .1z"],
"the-red-yeti": [512, 512, [], "f69d", "M488.23 241.7l20.7 7.1c-9.6-23.9-23.9-37-31.7-44.8l7.1-18.2c.2 0 12.3-27.8-2.5-30.7-.6-11.3-6.6-27-18.4-27-7.6-10.6-17.7-12.3-30.7-5.9a122.2 122.2 0 0 0-25.3 16.5c-5.3-6.4-3 .4-3-29.8-37.1-24.3-45.4-11.7-74.8 3l.5.5a239.36 239.36 0 0 0-68.4-13.3c-5.5-8.7-18.6-19.1-25.1-25.1l24.8 7.1c-5.5-5.5-26.8-12.9-34.2-15.2 18.2-4.1 29.8-20.8 42.5-33-34.9-10.1-67.9-5.9-97.9 11.8l12-44.2L182 0c-31.6 24.2-33 41.9-33.7 45.5-.9-2.4-6.3-19.6-15.2-27a35.12 35.12 0 0 0-.5 25.3c3 8.4 5.9 14.8 8.4 18.9-16-3.3-28.3-4.9-49.2 0h-3.7l33 14.3a194.26 194.26 0 0 0-46.7 67.4l-1.7 8.4 1.7 1.7 7.6-4.7c-3.3 11.6-5.3 19.4-6.6 25.8a200.18 200.18 0 0 0-27.8 40.3c-15 1-31.8 10.8-40.3 14.3l3 3.4 28.8 1c-.5 1-.7 2.2-1.2 3.2-7.3 6.4-39.8 37.7-33 80.7l20.2-22.4c.5 1.7.7 3.4 1.2 5.2 0 25.5.4 89.6 64.9 150.5 43.6 40 96 60.2 157.5 60.2 121.7 0 223-87.3 223-211.5 6.8-9.7-1.2 3 16.7-25.1l13 14.3 2.5-.5A181.84 181.84 0 0 0 495 255a44.74 44.74 0 0 0-6.8-13.3zM398 111.2l-.5 21.9c5.5 18.1 16.9 17.2 22.4 17.2l-3.4-4.7 22.4-5.4a242.44 242.44 0 0 1-27 0c12.8-2.1 33.3-29 43-11.3 3.4 7.6 6.4 17.2 9.3 27.8l1.7-5.9a56.38 56.38 0 0 1-1.7-15.2c5.4.5 8.8 3.4 9.3 10.1.5 6.4 1.7 14.8 3.4 25.3l4.7-11.3c4.6 0 4.5-3.6-2.5 20.7-20.9-8.7-35.1-8.4-46.5-8.4l18.2-16c-25.3 8.2-33 10.8-54.8 20.9-1.1-5.4-5-13.5-16-19.9-3.2 3.8-2.8.9-.7 14.8h-2.5a62.32 62.32 0 0 0-8.4-23.1l4.2-3.4c8.4-7.1 11.8-14.3 10.6-21.9-.5-6.4-5.4-13.5-13.5-20.7 5.6-3.4 15.2-.4 28.3 8.5zm-39.6-10.1c2.7 1.9 11.4 5.4 18.9 17.2 4.2 8.4 4 9.8 3.4 11.1-.5 2.4-.5 4.3-3 7.1-1.7 2.5-5.4 4.7-11.8 7.6-7.6-13-16.5-23.6-27.8-31.2zM91 143.1l1.2-1.7c1.2-2.9 4.2-7.6 9.3-15.2l2.5-3.4-13 12.3 5.4-4.7-10.1 9.3-4.2 1.2c12.3-24.1 23.1-41.3 32.5-50.2 9.3-9.3 16-16 20.2-19.4l-6.4 1.2c-11.3-4.2-19.4-7.1-24.8-8.4 2.5-.5 3.7-.5 3.2-.5 10.3 0 17.5.5 20.9 1.2a52.35 52.35 0 0 0 16 2.5l.5-1.7-8.4-35.8 13.5 29a42.89 42.89 0 0 0 5.9-14.3c1.7-6.4 5.4-13 10.1-19.4s7.6-10.6 9.3-11.3a234.68 234.68 0 0 0-6.4 25.3l-1.7 7.1-.5 4.7 2.5 2.5C190.4 39.9 214 34 239.8 34.5l21.1.5c-11.8 13.5-27.8 21.9-48.5 24.8a201.26 201.26 0 0 1-23.4 2.9l-.2-.5-2.5-1.2a20.75 20.75 0 0 0-14 2c-2.5-.2-4.9-.5-7.1-.7l-2.5 1.7.5 1.2c2 .2 3.9.5 6.2.7l-2 3.4 3.4-.5-10.6 11.3c-4.2 3-5.4 6.4-4.2 9.3l5.4-3.4h1.2a39.4 39.4 0 0 1 25.3-15.2v-3c6.4.5 13 1 19.4 1.2 6.4 0 8.4.5 5.4 1.2a189.6 189.6 0 0 1 20.7 13.5c13.5 10.1 23.6 21.9 30 35.4 8.8 18.2 13.5 37.1 13.5 56.6a141.13 141.13 0 0 1-3 28.3 209.91 209.91 0 0 1-16 46l2.5.5c18.2-19.7 41.9-16 49.2-16l-6.4 5.9 22.4 17.7-1.7 30.7c-5.4-12.3-16.5-21.1-33-27.8 16.5 14.8 23.6 21.1 21.9 20.2-4.8-2.8-3.5-1.9-10.8-3.7 4.1 4.1 17.5 18.8 18.2 20.7l.2.2-.2.2c0 1.8 1.6-1.2-14 22.9-75.2-15.3-106.27-42.7-141.2-63.2l11.8 1.2c-11.8-18.5-15.6-17.7-38.4-26.1L149 225c-8.8-3-18.2-3-28.3.5l7.6-10.6-1.2-1.7c-14.9 4.3-19.8 9.2-22.6 11.3-1.1-5.5-2.8-12.4-12.3-28.8l-1.2 27-13.2-5c1.5-25.2 5.4-50.5 13.2-74.6zm276.5 330c-49.9 25-56.1 22.4-59 23.9-29.8-11.8-50.9-31.7-63.5-58.8l30 16.5c-9.8-9.3-18.3-16.5-38.4-44.3l11.8 23.1-17.7-7.6c14.2 21.1 23.5 51.7 66.6 73.5-120.8 24.2-199-72.1-200.9-74.3a262.57 262.57 0 0 0 35.4 24.8c3.4 1.7 7.1 2.5 10.1 1.2l-16-20.7c9.2 4.2 9.5 4.5 69.1 29-42.5-20.7-73.8-40.8-93.2-60.2-.5 6.4-1.2 10.1-1.2 10.1a80.25 80.25 0 0 1 20.7 26.6c-39-18.9-57.6-47.6-71.3-82.6 49.9 55.1 118.9 37.5 120.5 37.1 34.8 16.4 69.9 23.6 113.9 10.6 3.3 0 20.3 17 25.3 39.1l4.2-3-2.5-23.6c9 9 24.9 22.6 34.4 13-15.6-5.3-23.5-9.5-29.5-31.7 4.6 4.2 7.6 9 27.8 15l1.2-1.2-10.5-14.2c11.7-4.8-3.5 1 32-10.8 4.3 34.3 9 49.2.7 89.5zm115.3-214.4l-2.5.5 3 9.3c-3.5 5.9-23.7 44.3-71.6 79.7-39.5 29.8-76.6 39.1-80.9 40.3l-7.6-7.1-1.2 3 14.3 16-7.1-4.7 3.4 4.2h-1.2l-21.9-13.5 9.3 26.6-19-27.9-1.2 2.5 7.6 29c-6.1-8.2-21-32.6-56.8-39.6l32.5 21.2a214.82 214.82 0 0 1-93.2-6.4c-4.2-1.2-8.9-2.5-13.5-4.2l1.2-3-44.8-22.4 26.1 22.4c-57.7 9.1-113-25.4-126.4-83.4l-2.5-16.4-22.27 22.3c19.5-57.5 25.6-57.9 51.4-70.1-9.1-5.3-1.6-3.3-38.4-9.3 15.8-5.8 33-15.4 73 5.2a18.5 18.5 0 0 1 3.7-1.7c.6-3.2.4-.8 1-11.8 3.9 10 3.6 8.7 3 9.3l1.7.5c12.7-6.5 8.9-4.5 17-8.9l-5.4 13.5 22.3-5.8-8.4 8.4 2.5 2.5c4.5-1.8 30.3 3.4 40.8 16l-23.6-2.5c39.4 23 51.5 54 55.8 69.6l1.7-1.2c-2.8-22.3-12.4-33.9-16-40.1 4.2 5 39.2 34.6 110.4 46-11.3-.5-23.1 5.4-34.9 18.9l46.7-20.2-9.3 21.9c7.6-10.1 14.8-23.6 21.2-39.6v-.5l1.2-3-1.2 16c13.5-41.8 25.3-78.5 35.4-109.7l13.5-27.8v-2l-5.4-4.2h10.1l5.9 4.2 2.5-1.2-3.4-16 12.3 18.9 41.8-20.2-14.8 13 .5 2.9 17.7-.5a184 184 0 0 1 33 4.2l-23.6 2.5-1.2 3 26.6 23.1a254.21 254.21 0 0 1 27 32c-11.2-3.3-10.3-3.4-21.2-3.4l12.3 32.5zm-6.1-71.3l-3.9 13-14.3-11.8zm-254.8 7.1c1.7 10.6 4.7 17.7 8.8 21.9-9.3 6.6-27.5 13.9-46.5 16l.5 1.2a50.22 50.22 0 0 0 24.8-2.5l-7.1 13c4.2-1.7 10.1-7.1 17.7-14.8 11.9-5.5 12.7-5.1 20.2-16-12.7-6.4-15.7-13.7-18.4-18.8zm3.7-102.3c-6.4-3.4-10.6 3-12.3 18.9s2.5 29.5 11.8 39.6 18.2 10.6 26.1 3 3.4-23.6-11.3-47.7a39.57 39.57 0 0 0-14.27-13.8zm-4.7 46.3c5.4 2.2 10.5 1.9 12.3-10.6v-4.7l-1.2.5c-4.3-3.1-2.5-4.5-1.7-6.2l.5-.5c-.9-1.2-5-8.1-12.5 4.7-.5-13.5.5-21.9 3-24.8 1.2-2.5 4.7-1.2 11.3 4.2 6.4 5.4 11.3 16 15.2 32.5 6.5 28-19.8 26.2-26.9 4.9zm-45-5.5c1.6.3 9.3-1.1 9.3-14.8h-.5c-5.4-1.1-2.2-5.5-.7-5.9-1.7-3-3.4-4.2-5.4-4.7-8.1 0-11.6 12.7-8.1 21.2a7.51 7.51 0 0 0 5.43 4.2zM216 82.9l-2.5.5.5 3a48.94 48.94 0 0 1 26.1 5.9c-2.5-5.5-10-14.3-28.3-14.3l.5 2.5zm-71.8 49.4c21.7 16.8 16.5 21.4 46.5 23.6l-2.9-4.7a42.67 42.67 0 0 0 14.8-28.3c1.7-16-1.2-29.5-8.8-41.3l13-7.6a2.26 2.26 0 0 0-.5-1.7 14.21 14.21 0 0 0-13.5 1.7c-12.7 6.7-28 20.9-29 22.4-1.7 1.7-3.4 5.9-5.4 13.5a99.61 99.61 0 0 0-2.9 23.6c-4.7-8-10.5-6.4-19.9-5.9l7.1 7.6c-16.5 0-23.3 15.4-23.6 16 6.8 0 4.6-7.6 30-12.3-4.3-6.3-3.3-5-4.9-6.6zm18.7-18.7c1.2-7.6 3.4-13 6.4-17.2 5.4-6.4 10.6-10.1 16-11.8 4.2-1.7 7.1 1.2 10.1 9.3a72.14 72.14 0 0 1 3 25.3c-.5 9.3-3.4 17.2-8.4 23.1-2.9 3.4-5.4 5.9-6.4 7.6a39.21 39.21 0 0 1-11.3-.5l-7.1-3.4-5.4-6.4c.8-10 1.3-18.8 3.1-26zm42 56.1c-34.8 14.4-34.7 14-36.1 14.3-20.8 4.7-19-24.4-18.9-24.8l5.9-1.2-.5-2.5c-20.2-2.6-31 4.2-32.5 4.9.5.5 3 3.4 5.9 9.3 4.2-6.4 8.8-10.1 15.2-10.6a83.47 83.47 0 0 0 1.7 33.7c.1.5 2.6 17.4 27.5 24.1 11.3 3 27 1.2 48.9-5.4l-9.2.5c-4.2-14.8-6.4-24.8-5.9-29.5 11.3-8.8 21.9-11.3 30.7-7.6h2.5l-11.8-7.6-7.1.5c-5.9 1.2-12.3 4.2-19.4 8.4z"],
"themeco": [448, 512, [], "f5c6", "M202.9 8.43c9.9-5.73 26-5.82 35.95-.21L430 115.85c10 5.6 18 19.44 18 30.86V364c0 11.44-8.06 25.29-18 31L238.81 503.74c-9.93 5.66-26 5.57-35.85-.21L17.86 395.12C8 389.34 0 375.38 0 364V146.71c0-11.44 8-25.36 17.91-31.08zm-77.4 199.83c-15.94 0-31.89.14-47.83.14v101.45H96.8V280h28.7c49.71 0 49.56-71.74 0-71.74zm140.14 100.29l-30.73-34.64c37-7.51 34.8-65.23-10.87-65.51-16.09 0-32.17-.14-48.26-.14v101.59h19.13v-33.91h18.41l29.56 33.91h22.76zm-41.59-82.32c23.34 0 23.26 32.46 0 32.46h-29.13v-32.46zm-95.56-1.6c21.18 0 21.11 38.85 0 38.85H96.18v-38.84zm192.65-18.25c-68.46 0-71 105.8 0 105.8 69.48-.01 69.41-105.8 0-105.8zm0 17.39c44.12 0 44.8 70.86 0 70.86s-44.43-70.86 0-70.86z"],
"themeisle": [512, 512, [], "f2b2", "M208 88.286c0-10 6.286-21.714 17.715-21.714 11.142 0 17.714 11.714 17.714 21.714 0 10.285-6.572 21.714-17.714 21.714C214.286 110 208 98.571 208 88.286zm304 160c0 36.001-11.429 102.286-36.286 129.714-22.858 24.858-87.428 61.143-120.857 70.572l-1.143.286v32.571c0 16.286-12.572 30.571-29.143 30.571-10 0-19.429-5.714-24.572-14.286-5.427 8.572-14.856 14.286-24.856 14.286-10 0-19.429-5.714-24.858-14.286-5.142 8.572-14.571 14.286-24.57 14.286-10.286 0-19.429-5.714-24.858-14.286-5.143 8.572-14.571 14.286-24.571 14.286-18.857 0-29.429-15.714-29.429-32.857-16.286 12.285-35.715 19.428-56.571 19.428-22 0-43.429-8.285-60.286-22.857 10.285-.286 20.571-2.286 30.285-5.714-20.857-5.714-39.428-18.857-52-36.286 21.37 4.645 46.209 1.673 67.143-11.143-22-22-56.571-58.857-68.572-87.428C1.143 321.714 0 303.714 0 289.429c0-49.714 20.286-160 86.286-160 10.571 0 18.857 4.858 23.143 14.857a158.792 158.792 0 0 1 12-15.428c2-2.572 5.714-5.429 7.143-8.286 7.999-12.571 11.714-21.142 21.714-34C182.571 45.428 232 17.143 285.143 17.143c6 0 12 .285 17.714 1.143C313.714 6.571 328.857 0 344.572 0c14.571 0 29.714 6 40 16.286.857.858 1.428 2.286 1.428 3.428 0 3.714-10.285 13.429-12.857 16.286 4.286 1.429 15.714 6.858 15.714 12 0 2.857-2.857 5.143-4.571 7.143 31.429 27.714 49.429 67.143 56.286 108 4.286-5.143 10.285-8.572 17.143-8.572 10.571 0 20.857 7.144 28.571 14.001C507.143 187.143 512 221.714 512 248.286zM188 89.428c0 18.286 12.571 37.143 32.286 37.143 19.714 0 32.285-18.857 32.285-37.143 0-18-12.571-36.857-32.285-36.857-19.715 0-32.286 18.858-32.286 36.857zM237.714 194c0-19.714 3.714-39.143 8.571-58.286-52.039 79.534-13.531 184.571 68.858 184.571 21.428 0 42.571-7.714 60-20 2-7.429 3.714-14.857 3.714-22.572 0-14.286-6.286-21.428-20.572-21.428-4.571 0-9.143.857-13.429 1.714-63.343 12.668-107.142 3.669-107.142-63.999zm-41.142 254.858c0-11.143-8.858-20.857-20.286-20.857-11.429 0-20 9.715-20 20.857v32.571c0 11.143 8.571 21.142 20 21.142 11.428 0 20.286-9.715 20.286-21.142v-32.571zm49.143 0c0-11.143-8.572-20.857-20-20.857-11.429 0-20.286 9.715-20.286 20.857v32.571c0 11.143 8.857 21.142 20.286 21.142 11.428 0 20-10 20-21.142v-32.571zm49.713 0c0-11.143-8.857-20.857-20.285-20.857-11.429 0-20.286 9.715-20.286 20.857v32.571c0 11.143 8.857 21.142 20.286 21.142 11.428 0 20.285-9.715 20.285-21.142v-32.571zm49.715 0c0-11.143-8.857-20.857-20.286-20.857-11.428 0-20.286 9.715-20.286 20.857v32.571c0 11.143 8.858 21.142 20.286 21.142 11.429 0 20.286-10 20.286-21.142v-32.571zM421.714 286c-30.857 59.142-90.285 102.572-158.571 102.572-96.571 0-160.571-84.572-160.571-176.572 0-16.857 2-33.429 6-49.714-20 33.715-29.714 72.572-29.714 111.429 0 60.286 24.857 121.715 71.429 160.857 5.143-9.714 14.857-16.286 26-16.286 10 0 19.428 5.714 24.571 14.286 5.429-8.571 14.571-14.286 24.858-14.286 10 0 19.428 5.714 24.571 14.286 5.429-8.571 14.857-14.286 24.858-14.286 10 0 19.428 5.714 24.857 14.286 5.143-8.571 14.571-14.286 24.572-14.286 10.857 0 20.857 6.572 25.714 16 43.427-36.286 68.569-92 71.426-148.286zm10.572-99.714c0-53.714-34.571-105.714-92.572-105.714-30.285 0-58.571 15.143-78.857 36.857C240.862 183.812 233.41 254 302.286 254c28.805 0 97.357-28.538 84.286 36.857 28.857-26 45.714-65.714 45.714-104.571z"],
"think-peaks": [576, 512, [], "f731", "M465.4 409.4l87.1-150.2-32-.3-55.1 95L259.2 0 23 407.4l32 .3L259.2 55.6zm-355.3-44.1h32.1l117.4-202.5L463 511.9l32.5.1-235.8-404.6z"],
"trade-federation": [496, 512, [], "f513", "M248 8.8c-137 0-248 111-248 248s111 248 248 248 248-111 248-248-111-248-248-248zm0 482.8c-129.7 0-234.8-105.1-234.8-234.8S118.3 22 248 22s234.8 105.1 234.8 234.8S377.7 491.6 248 491.6zm155.1-328.5v-46.8H209.3V198H54.2l36.7 46h117.7v196.8h48.8V245h83.3v-47h-83.3v-34.8h145.7zm-73.3 45.1v23.9h-82.9v197.4h-26.8V232.1H96.3l-20.1-23.9h143.9v-80.6h171.8V152h-145v56.2zm-161.3-69l-12.4-20.7 2.1 23.8-23.5 5.4 23.3 5.4-2.1 24 12.3-20.5 22.2 9.5-15.7-18.1 15.8-18.1zm-29.6-19.7l9.3-11.5-12.7 5.9-8-12.4 1.7 13.9-14.3 3.8 13.7 2.7-.8 14.7 6.8-12.2 13.8 5.3zm165.4 145.2l-13.1 5.6-7.3-12.2 1.3 14.2-13.9 3.2 13.9 3.2-1.2 14.2 7.3-12.2 13.1 5.5-9.4-10.7zm106.9-77.2l-20.9 9.1-12-19.6 2.2 22.7-22.3 5.4 22.2 4.9-1.8 22.9 11.5-19.6 21.2 8.8-15.1-17zM248 29.9c-125.3 0-226.9 101.6-226.9 226.9S122.7 483.7 248 483.7s226.9-101.6 226.9-226.9S373.3 29.9 248 29.9zM342.6 196v51h-83.3v195.7h-52.7V245.9H89.9l-40-49.9h157.4v-81.6h197.8v50.7H259.4V196zM248 43.2c60.3 0 114.8 25 153.6 65.2H202.5V190H45.1C73.1 104.8 153.4 43.2 248 43.2zm0 427.1c-117.9 0-213.6-95.6-213.6-213.5 0-21.2 3.1-41.8 8.9-61.1L87.1 252h114.7v196.8h64.6V253h83.3v-62.7h-83.2v-19.2h145.6v-50.8c30.8 37 49.3 84.6 49.3 136.5.1 117.9-95.5 213.5-213.4 213.5zM178.8 275l-11-21.4 1.7 24.5-23.7 3.9 23.8 5.9-3.7 23.8 13-20.9 21.5 10.8-15.8-18.8 16.9-17.1z"],
"trello": [448, 512, [], "f181", "M392.3 32H56.1C25.1 32 0 57.1 0 88c-.1 0 0-4 0 336 0 30.9 25.1 56 56 56h336.2c30.8-.2 55.7-25.2 55.7-56V88c.1-30.8-24.8-55.8-55.6-56zM197 371.3c-.2 14.7-12.1 26.6-26.9 26.6H87.4c-14.8.1-26.9-11.8-27-26.6V117.1c0-14.8 12-26.9 26.9-26.9h82.9c14.8 0 26.9 12 26.9 26.9v254.2zm193.1-112c0 14.8-12 26.9-26.9 26.9h-81c-14.8 0-26.9-12-26.9-26.9V117.2c0-14.8 12-26.9 26.8-26.9h81.1c14.8 0 26.9 12 26.9 26.9v142.1z"],
"tripadvisor": [576, 512, [], "f262", "M166.4 280.521c0 13.236-10.73 23.966-23.966 23.966s-23.966-10.73-23.966-23.966 10.73-23.966 23.966-23.966 23.966 10.729 23.966 23.966zm264.962-23.956c-13.23 0-23.956 10.725-23.956 23.956 0 13.23 10.725 23.956 23.956 23.956 13.23 0 23.956-10.725 23.956-23.956-.001-13.231-10.726-23.956-23.956-23.956zm89.388 139.49c-62.667 49.104-153.276 38.109-202.379-24.559l-30.979 46.325-30.683-45.939c-48.277 60.39-135.622 71.891-197.885 26.055-64.058-47.158-77.759-137.316-30.601-201.374A186.762 186.762 0 0 0 0 139.416l90.286-.05a358.48 358.48 0 0 1 197.065-54.03 350.382 350.382 0 0 1 192.181 53.349l96.218.074a185.713 185.713 0 0 0-28.352 57.649c46.793 62.747 34.964 151.37-26.648 199.647zM259.366 281.761c-.007-63.557-51.535-115.075-115.092-115.068C80.717 166.7 29.2 218.228 29.206 281.785c.007 63.557 51.535 115.075 115.092 115.068 63.513-.075 114.984-51.539 115.068-115.052v-.04zm28.591-10.455c5.433-73.44 65.51-130.884 139.12-133.022a339.146 339.146 0 0 0-139.727-27.812 356.31 356.31 0 0 0-140.164 27.253c74.344 1.582 135.299 59.424 140.771 133.581zm251.706-28.767c-21.992-59.634-88.162-90.148-147.795-68.157-59.634 21.992-90.148 88.162-68.157 147.795v.032c22.038 59.607 88.198 90.091 147.827 68.113 59.615-22.004 90.113-88.162 68.125-147.783zm-326.039 37.975v.115c-.057 39.328-31.986 71.163-71.314 71.106-39.328-.057-71.163-31.986-71.106-71.314.057-39.328 31.986-71.163 71.314-71.106 39.259.116 71.042 31.94 71.106 71.199zm-24.512 0v-.084c-.051-25.784-20.994-46.645-46.778-46.594-25.784.051-46.645 20.994-46.594 46.777.051 25.784 20.994 46.645 46.777 46.594 25.726-.113 46.537-20.968 46.595-46.693zm313.423 0v.048c-.02 39.328-31.918 71.194-71.247 71.173s-71.194-31.918-71.173-71.247c.02-39.328 31.918-71.194 71.247-71.173 39.29.066 71.121 31.909 71.173 71.199zm-24.504-.008c-.009-25.784-20.918-46.679-46.702-46.67-25.784.009-46.679 20.918-46.67 46.702.009 25.784 20.918 46.678 46.702 46.67 25.765-.046 46.636-20.928 46.67-46.693v-.009z"],
"tumblr": [320, 512, [], "f173", "M309.8 480.3c-13.6 14.5-50 31.7-97.4 31.7-120.8 0-147-88.8-147-140.6v-144H17.9c-5.5 0-10-4.5-10-10v-68c0-7.2 4.5-13.6 11.3-16 62-21.8 81.5-76 84.3-117.1.8-11 6.5-16.3 16.1-16.3h70.9c5.5 0 10 4.5 10 10v115.2h83c5.5 0 10 4.4 10 9.9v81.7c0 5.5-4.5 10-10 10h-83.4V360c0 34.2 23.7 53.6 68 35.8 4.8-1.9 9-3.2 12.7-2.2 3.5.9 5.8 3.4 7.4 7.9l22 64.3c1.8 5 3.3 10.6-.4 14.5z"],
"tumblr-square": [448, 512, [], "f174", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-82.3 364.2c-8.5 9.1-31.2 19.8-60.9 19.8-75.5 0-91.9-55.5-91.9-87.9v-90h-29.7c-3.4 0-6.2-2.8-6.2-6.2v-42.5c0-4.5 2.8-8.5 7.1-10 38.8-13.7 50.9-47.5 52.7-73.2.5-6.9 4.1-10.2 10-10.2h44.3c3.4 0 6.2 2.8 6.2 6.2v72h51.9c3.4 0 6.2 2.8 6.2 6.2v51.1c0 3.4-2.8 6.2-6.2 6.2h-52.1V321c0 21.4 14.8 33.5 42.5 22.4 3-1.2 5.6-2 8-1.4 2.2.5 3.6 2.1 4.6 4.9l13.8 40.2c1 3.2 2 6.7-.3 9.1z"],
"twitch": [448, 512, [], "f1e8", "M40.1 32L10 108.9v314.3h107V480h60.2l56.8-56.8h87l117-117V32H40.1zm357.8 254.1L331 353H224l-56.8 56.8V353H76.9V72.1h321v214zM331 149v116.9h-40.1V149H331zm-107 0v116.9h-40.1V149H224z"],
"twitter": [512, 512, [], "f099", "M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"],
"twitter-square": [448, 512, [], "f081", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-48.9 158.8c.2 2.8.2 5.7.2 8.5 0 86.7-66 186.6-186.6 186.6-37.2 0-71.7-10.8-100.7-29.4 5.3.6 10.4.8 15.8.8 30.7 0 58.9-10.4 81.4-28-28.8-.6-53-19.5-61.3-45.5 10.1 1.5 19.2 1.5 29.6-1.2-30-6.1-52.5-32.5-52.5-64.4v-.8c8.7 4.9 18.9 7.9 29.6 8.3a65.447 65.447 0 0 1-29.2-54.6c0-12.2 3.2-23.4 8.9-33.1 32.3 39.8 80.8 65.8 135.2 68.6-9.3-44.5 24-80.6 64-80.6 18.9 0 35.9 7.9 47.9 20.7 14.8-2.8 29-8.3 41.6-15.8-4.9 15.2-15.2 28-28.8 36.1 13.2-1.4 26-5.1 37.8-10.2-8.9 13.1-20.1 24.7-32.9 34z"],
"typo3": [448, 512, [], "f42b", "M178.7 78.4c0-24.7 5.4-32.4 13.9-39.4-69.5 8.5-149.3 34-176.3 66.4-5.4 7.7-9.3 20.8-9.3 37.1C7 246 113.8 480 191.1 480c36.3 0 97.3-59.5 146.7-139-7 2.3-11.6 2.3-18.5 2.3-57.2 0-140.6-198.5-140.6-264.9zM301.5 32c-30.1 0-41.7 5.4-41.7 36.3 0 66.4 53.8 198.5 101.7 198.5 26.3 0 78.8-99.7 78.8-182.3 0-40.9-67-52.5-138.8-52.5z"],
"uber": [448, 512, [], "f402", "M414.1 32H33.9C15.2 32 0 47.2 0 65.9V446c0 18.8 15.2 34 33.9 34H414c18.7 0 33.9-15.2 33.9-33.9V65.9C448 47.2 432.8 32 414.1 32zM237.6 391.1C163 398.6 96.4 344.2 88.9 269.6h94.4V290c0 3.7 3 6.8 6.8 6.8H258c3.7 0 6.8-3 6.8-6.8v-67.9c0-3.7-3-6.8-6.8-6.8h-67.9c-3.7 0-6.8 3-6.8 6.8v20.4H88.9c7-69.4 65.4-122.2 135.1-122.2 69.7 0 128.1 52.8 135.1 122.2 7.5 74.5-46.9 141.1-121.5 148.6z"],
"ubuntu": [496, 512, [], "f7df", "M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm52.7 93c8.8-15.2 28.3-20.5 43.5-11.7 15.3 8.8 20.5 28.3 11.7 43.6-8.8 15.2-28.3 20.5-43.5 11.7-15.3-8.9-20.5-28.4-11.7-43.6zM87.4 287.9c-17.6 0-31.9-14.3-31.9-31.9 0-17.6 14.3-31.9 31.9-31.9 17.6 0 31.9 14.3 31.9 31.9 0 17.6-14.3 31.9-31.9 31.9zm28.1 3.1c22.3-17.9 22.4-51.9 0-69.9 8.6-32.8 29.1-60.7 56.5-79.1l23.7 39.6c-51.5 36.3-51.5 112.5 0 148.8L172 370c-27.4-18.3-47.8-46.3-56.5-79zm228.7 131.7c-15.3 8.8-34.7 3.6-43.5-11.7-8.8-15.3-3.6-34.8 11.7-43.6 15.2-8.8 34.7-3.6 43.5 11.7 8.8 15.3 3.6 34.8-11.7 43.6zm.3-69.5c-26.7-10.3-56.1 6.6-60.5 35-5.2 1.4-48.9 14.3-96.7-9.4l22.5-40.3c57 26.5 123.4-11.7 128.9-74.4l46.1.7c-2.3 34.5-17.3 65.5-40.3 88.4zm-5.9-105.3c-5.4-62-71.3-101.2-128.9-74.4l-22.5-40.3c47.9-23.7 91.5-10.8 96.7-9.4 4.4 28.3 33.8 45.3 60.5 35 23.1 22.9 38 53.9 40.2 88.5l-46 .6z"],
"uikit": [448, 512, [], "f403", "M443.9 128v256L218 512 0 384V169.7l87.6 45.1v117l133.5 75.5 135.8-75.5v-151l-101.1-57.6 87.6-53.1L443.9 128zM308.6 49.1L223.8 0l-88.6 54.8 86 47.3 87.4-53z"],
"uniregistry": [384, 512, [], "f404", "M192 480c39.5 0 76.2-11.8 106.8-32.2H85.3C115.8 468.2 152.5 480 192 480zm-89.1-193.1v-12.4H0v12.4c0 2.5 0 5 .1 7.4h103.1c-.2-2.4-.3-4.9-.3-7.4zm20.5 57H8.5c2.6 8.5 5.8 16.8 9.6 24.8h138.3c-12.9-5.7-24.1-14.2-33-24.8zm-17.7-34.7H1.3c.9 7.6 2.2 15 3.9 22.3h109.7c-4-6.9-7.2-14.4-9.2-22.3zm-2.8-69.3H0v17.3h102.9zm0-173.2H0v4.9h102.9zm0-34.7H0v2.5h102.9zm0 69.3H0v7.4h102.9zm0 104H0v14.8h102.9zm0-69.3H0v9.9h102.9zm0 34.6H0V183h102.9zm166.2 160.9h109.7c1.8-7.3 3.1-14.7 3.9-22.3H278.3c-2.1 7.9-5.2 15.4-9.2 22.3zm12-185.7H384V136H281.1zm0 37.2H384v-12.4H281.1zm0-74.3H384v-7.4H281.1zm0-76.7v2.5H384V32zm-203 410.9h227.7c11.8-8.7 22.7-18.6 32.2-29.7H44.9c9.6 11 21.4 21 33.2 29.7zm203-371.3H384v-4.9H281.1zm0 148.5H384v-14.8H281.1zM38.8 405.7h305.3c6.7-8.5 12.6-17.6 17.8-27.2H23c5.2 9.6 9.2 18.7 15.8 27.2zm188.8-37.1H367c3.7-8 5.8-16.2 8.5-24.8h-115c-8.8 10.7-20.1 19.2-32.9 24.8zm53.5-81.7c0 2.5-.1 5-.4 7.4h103.1c.1-2.5.2-4.9.2-7.4v-12.4H281.1zm0-29.7H384v-17.3H281.1z"],
"untappd": [640, 512, [], "f405", "M401.3 49.9c-79.8 160.1-84.6 152.5-87.9 173.2l-5.2 32.8c-1.9 12-6.6 23.5-13.7 33.4L145.6 497.1c-7.6 10.6-20.4 16.2-33.4 14.6-40.3-5-77.8-32.2-95.3-68.5-5.7-11.8-4.5-25.8 3.1-36.4l148.9-207.9c7.1-9.9 16.4-18 27.2-23.7l29.3-15.5c18.5-9.8 9.7-11.9 135.6-138.9 1-4.8 1-7.3 3.6-8 3-.7 6.6-1 6.3-4.6l-.4-4.6c-.2-1.9 1.3-3.6 3.2-3.6 4.5-.1 13.2 1.2 25.6 10 12.3 8.9 16.4 16.8 17.7 21.1.6 1.8-.6 3.7-2.4 4.2l-4.5 1.1c-3.4.9-2.5 4.4-2.3 7.4.1 2.8-2.3 3.6-6.5 6.1zM230.1 36.4c3.4.9 2.5 4.4 2.3 7.4-.2 2.7 2.1 3.5 6.4 6 7.9 15.9 15.3 30.5 22.2 44 .7 1.3 2.3 1.5 3.3.5 11.2-12 24.6-26.2 40.5-42.6 1.3-1.4 1.4-3.5.1-4.9-8-8.2-16.5-16.9-25.6-26.1-1-4.7-1-7.3-3.6-8-3-.8-6.6-1-6.3-4.6.3-3.3 1.4-8.1-2.8-8.2-4.5-.1-13.2 1.1-25.6 10-12.3 8.9-16.4 16.8-17.7 21.1-1.4 4.2 3.6 4.6 6.8 5.4zM620 406.7L471.2 198.8c-13.2-18.5-26.6-23.4-56.4-39.1-11.2-5.9-14.2-10.9-30.5-28.9-1-1.1-2.9-.9-3.6.5-46.3 88.8-47.1 82.8-49 94.8-1.7 10.7-1.3 20 .3 29.8 1.9 12 6.6 23.5 13.7 33.4l148.9 207.9c7.6 10.6 20.2 16.2 33.1 14.7 40.3-4.9 78-32 95.7-68.6 5.4-11.9 4.3-25.9-3.4-36.6z"],
"ups": [384, 512, [], "f7e0", "M103.2 303c-5.2 3.6-32.6 13.1-32.6-19V180H37.9v102.6c0 74.9 80.2 51.1 97.9 39V180h-32.6zM4 74.82v220.9c0 103.7 74.9 135.2 187.7 184.1 112.4-48.9 187.7-80.2 187.7-184.1V74.82c-116.3-61.6-281.8-49.6-375.4 0zm358.1 220.9c0 86.6-53.2 113.6-170.4 165.3-117.5-51.8-170.5-78.7-170.5-165.3v-126.4c102.3-93.8 231.6-100 340.9-89.8zm-209.6-107.4v212.8h32.7v-68.7c24.4 7.3 71.7-2.6 71.7-78.5 0-97.4-80.7-80.92-104.4-65.6zm32.7 117.3v-100.3c8.4-4.2 38.4-12.7 38.4 49.3 0 67.9-36.4 51.8-38.4 51zm79.1-86.4c.1 47.3 51.6 42.5 52.2 70.4.6 23.5-30.4 23-50.8 4.9v30.1c36.2 21.5 81.9 8.1 83.2-33.5 1.7-51.5-54.1-46.6-53.4-73.2.6-20.3 30.6-20.5 48.5-2.2v-28.4c-28.5-22-79.9-9.2-79.7 31.9z"],
"usb": [640, 512, [], "f287", "M641.5 256c0 3.1-1.7 6.1-4.5 7.5L547.9 317c-1.4.8-2.8 1.4-4.5 1.4-1.4 0-3.1-.3-4.5-1.1-2.8-1.7-4.5-4.5-4.5-7.8v-35.6H295.7c25.3 39.6 40.5 106.9 69.6 106.9H392V354c0-5 3.9-8.9 8.9-8.9H490c5 0 8.9 3.9 8.9 8.9v89.1c0 5-3.9 8.9-8.9 8.9h-89.1c-5 0-8.9-3.9-8.9-8.9v-26.7h-26.7c-75.4 0-81.1-142.5-124.7-142.5H140.3c-8.1 30.6-35.9 53.5-69 53.5C32 327.3 0 295.3 0 256s32-71.3 71.3-71.3c33.1 0 61 22.8 69 53.5 39.1 0 43.9 9.5 74.6-60.4C255 88.7 273 95.7 323.8 95.7c7.5-20.9 27-35.6 50.4-35.6 29.5 0 53.5 23.9 53.5 53.5s-23.9 53.5-53.5 53.5c-23.4 0-42.9-14.8-50.4-35.6H294c-29.1 0-44.3 67.4-69.6 106.9h310.1v-35.6c0-3.3 1.7-6.1 4.5-7.8 2.8-1.7 6.4-1.4 8.9.3l89.1 53.5c2.8 1.1 4.5 4.1 4.5 7.2z"],
"usps": [576, 512, [], "f7e1", "M460.3 241.7c25.8-41.3 15.2-48.8-11.7-48.8h-27c-.1 0-1.5-1.4-10.9 8-11.2 5.6-37.9 6.3-37.9 8.7 0 4.5 70.3-3.1 88.1 0 9.5 1.5-1.5 20.4-4.4 32-.5 4.5 2.4 2.3 3.8.1zm-112.1 22.6c64-21.3 97.3-23.9 102-26.2 4.4-2.9-4.4-6.6-26.2-5.8-51.7 2.2-137.6 37.1-172.6 53.9l-30.7-93.3h196.6c-2.7-28.2-152.9-22.6-337.9-22.6L27 415.8c196.4-97.3 258.9-130.3 321.2-151.5zM94.7 96c253.3 53.7 330 65.7 332.1 85.2 36.4 0 45.9 0 52.4 6.6 21.1 19.7-14.6 67.7-14.6 67.7-4.4 2.9-406.4 160.2-406.4 160.2h423.1L549 96z"],
"ussunnah": [512, 512, [], "f407", "M156.8 285.1l5.7 14.4h-8.2c-1.3-3.2-3.1-7.7-3.8-9.5-2.5-6.3-1.1-8.4 0-10 1.9-2.7 3.2-4.4 3.6-5.2 0 2.2.8 5.7 2.7 10.3zm297.3 18.8c-2.1 13.8-5.7 27.1-10.5 39.7l43 23.4-44.8-18.8c-5.3 13.2-12 25.6-19.9 37.2l34.2 30.2-36.8-26.4c-8.4 11.8-18 22.6-28.7 32.3l24.9 34.7-28.1-31.8c-11 9.6-23.1 18-36.1 25.1l15.7 37.2-19.3-35.3c-13.1 6.8-27 12.1-41.6 15.9l6.7 38.4-10.5-37.4c-14.3 3.4-29.2 5.3-44.5 5.4L256 512l-1.9-38.4c-15.3-.1-30.2-2-44.5-5.3L199 505.6l6.7-38.2c-14.6-3.7-28.6-9.1-41.7-15.8l-19.2 35.1 15.6-37c-13-7-25.2-15.4-36.2-25.1l-27.9 31.6 24.7-34.4c-10.7-9.7-20.4-20.5-28.8-32.3l-36.5 26.2 33.9-29.9c-7.9-11.6-14.6-24.1-20-37.3l-44.4 18.7L67.8 344c-4.8-12.7-8.4-26.1-10.5-39.9l-51 9 50.3-14.2c-1.1-8.5-1.7-17.1-1.7-25.9 0-4.7.2-9.4.5-14.1L0 256l56-2.8c1.3-13.1 3.8-25.8 7.5-38.1L6.4 199l58.9 10.4c4-12 9.1-23.5 15.2-34.4l-55.1-30 58.3 24.6C90 159 97.2 149.2 105.3 140L55.8 96.4l53.9 38.7c8.1-8.6 17-16.5 26.6-23.6l-40-55.6 45.6 51.6c9.5-6.6 19.7-12.3 30.3-17.2l-27.3-64.9 33.8 62.1c10.5-4.4 21.4-7.9 32.7-10.4L199 6.4l19.5 69.2c11-2.1 22.3-3.2 33.8-3.4L256 0l3.6 72.2c11.5.2 22.8 1.4 33.8 3.5L313 6.4l-12.4 70.7c11.3 2.6 22.2 6.1 32.6 10.5l33.9-62.2-27.4 65.1c10.6 4.9 20.7 10.7 30.2 17.2l45.8-51.8-40.1 55.9c9.5 7.1 18.4 15 26.5 23.6l54.2-38.9-49.7 43.9c8 9.1 15.2 18.9 21.5 29.4l58.7-24.7-55.5 30.2c6.1 10.9 11.1 22.3 15.1 34.3l59.3-10.4-57.5 16.2c3.7 12.2 6.2 24.9 7.5 37.9L512 256l-56 2.8c.3 4.6.5 9.3.5 14.1 0 8.7-.6 17.3-1.6 25.8l50.7 14.3-51.5-9.1zm-21.8-31c0-97.5-79-176.5-176.5-176.5s-176.5 79-176.5 176.5 79 176.5 176.5 176.5 176.5-79 176.5-176.5zm-24 0c0 84.3-68.3 152.6-152.6 152.6s-152.6-68.3-152.6-152.6 68.3-152.6 152.6-152.6 152.6 68.3 152.6 152.6zM195 241c0 2.1 1.3 3.8 3.6 5.1 3.3 1.9 6.2 4.6 8.2 8.2 2.8-5.7 4.3-9.5 4.3-11.2 0-2.2-1.1-4.4-3.2-7-2.1-2.5-3.2-5.2-3.3-7.7-6.5 6.8-9.6 10.9-9.6 12.6zm-40.7-19c0 2.1 1.3 3.8 3.6 5.1 3.5 1.9 6.2 4.6 8.2 8.2 2.8-5.7 4.3-9.5 4.3-11.2 0-2.2-1.1-4.4-3.2-7-2.1-2.5-3.2-5.2-3.3-7.7-6.5 6.8-9.6 10.9-9.6 12.6zm-19 0c0 2.1 1.3 3.8 3.6 5.1 3.3 1.9 6.2 4.6 8.2 8.2 2.8-5.7 4.3-9.5 4.3-11.2 0-2.2-1.1-4.4-3.2-7-2.1-2.5-3.2-5.2-3.3-7.7-6.4 6.8-9.6 10.9-9.6 12.6zm204.9 87.9c-8.4-3-8.7-6.8-8.7-15.6V182c-8.2 12.5-14.2 18.6-18 18.6 6.3 14.4 9.5 23.9 9.5 28.3v64.3c0 2.2-2.2 6.5-4.7 6.5h-18c-2.8-7.5-10.2-26.9-15.3-40.3-2 2.5-7.2 9.2-10.7 13.7 2.4 1.6 4.1 3.6 5.2 6.3 2.6 6.7 6.4 16.5 7.9 20.2h-9.2c-3.9-10.4-9.6-25.4-11.8-31.1-2 2.5-7.2 9.2-10.7 13.7 2.4 1.6 4.1 3.6 5.2 6.3.8 2 2.8 7.3 4.3 10.9H256c-1.5-4.1-5.6-14.6-8.4-22-2 2.5-7.2 9.2-10.7 13.7 2.5 1.6 4.3 3.6 5.2 6.3.2.6.5 1.4.6 1.7H225c-4.6-13.9-11.4-27.7-11.4-34.1 0-2.2.3-5.1 1.1-8.2-8.8 10.8-14 15.9-14 25 0 7.5 10.4 28.3 10.4 33.3 0 1.7-.5 3.3-1.4 4.9-9.6-12.7-15.5-20.7-18.8-20.7h-12l-11.2-28c-3.8-9.6-5.7-16-5.7-18.8 0-3.8.5-7.7 1.7-12.2-1 1.3-3.7 4.7-5.5 7.1-.8-2.1-3.1-7.7-4.6-11.5-2.1 2.5-7.5 9.1-11.2 13.6.9 2.3 3.3 8.1 4.9 12.2-2.5 3.3-9.1 11.8-13.6 17.7-4 5.3-5.8 13.3-2.7 21.8 2.5 6.7 2 7.9-1.7 14.1H191c5.5 0 14.3 14 15.5 22 13.2-16 15.4-19.6 16.8-21.6h107c3.9 0 7.2-1.9 9.9-5.8zm20.1-26.6V181.7c-9 12.5-15.9 18.6-20.7 18.6 7.1 14.4 10.7 23.9 10.7 28.3v66.3c0 17.5 8.6 20.4 24 20.4 8.1 0 12.5-.8 13.7-2.7-4.3-1.6-7.6-2.5-9.9-3.3-8.1-3.2-17.8-7.4-17.8-26z"],
"vaadin": [448, 512, [], "f408", "M224.5 140.7c1.5-17.6 4.9-52.7 49.8-52.7h98.6c20.7 0 32.1-7.8 32.1-21.6V54.1c0-12.2 9.3-22.1 21.5-22.1S448 41.9 448 54.1v36.5c0 42.9-21.5 62-66.8 62H280.7c-30.1 0-33 14.7-33 27.1 0 1.3-.1 2.5-.2 3.7-.7 12.3-10.9 22.2-23.4 22.2s-22.7-9.8-23.4-22.2c-.1-1.2-.2-2.4-.2-3.7 0-12.3-3-27.1-33-27.1H66.8c-45.3 0-66.8-19.1-66.8-62V54.1C0 41.9 9.4 32 21.6 32s21.5 9.9 21.5 22.1v12.3C43.1 80.2 54.5 88 75.2 88h98.6c44.8 0 48.3 35.1 49.8 52.7h.9zM224 456c11.5 0 21.4-7 25.7-16.3 1.1-1.8 97.1-169.6 98.2-171.4 11.9-19.6-3.2-44.3-27.2-44.3-13.9 0-23.3 6.4-29.8 20.3L224 362l-66.9-117.7c-6.4-13.9-15.9-20.3-29.8-20.3-24 0-39.1 24.6-27.2 44.3 1.1 1.9 97.1 169.6 98.2 171.4 4.3 9.3 14.2 16.3 25.7 16.3z"],
"viacoin": [384, 512, [], "f237", "M384 32h-64l-80.7 192h-94.5L64 32H0l48 112H0v48h68.5l13.8 32H0v48h102.8L192 480l89.2-208H384v-48h-82.3l13.8-32H384v-48h-48l48-112zM192 336l-27-64h54l-27 64z"],
"viadeo": [448, 512, [], "f2a9", "M276.2 150.5v.7C258.3 98.6 233.6 47.8 205.4 0c43.3 29.2 67 100 70.8 150.5zm32.7 121.7c7.6 18.2 11 37.5 11 57 0 77.7-57.8 141-137.8 139.4l3.8-.3c74.2-46.7 109.3-118.6 109.3-205.1 0-38.1-6.5-75.9-18.9-112 1 11.7 1 23.7 1 35.4 0 91.8-18.1 241.6-116.6 280C95 455.2 49.4 398 49.4 329.2c0-75.6 57.4-142.3 135.4-142.3 16.8 0 33.7 3.1 49.1 9.6 1.7-15.1 6.5-29.9 13.4-43.3-19.9-7.2-41.2-10.7-62.5-10.7-161.5 0-238.7 195.9-129.9 313.7 67.9 74.6 192 73.9 259.8 0 56.6-61.3 60.9-142.4 36.4-201-12.7 8-27.1 13.9-42.2 17zM418.1 11.7c-31 66.5-81.3 47.2-115.8 80.1-12.4 12-20.6 34-20.6 50.5 0 14.1 4.5 27.1 12 38.8 47.4-11 98.3-46 118.2-90.7-.7 5.5-4.8 14.4-7.2 19.2-20.3 35.7-64.6 65.6-99.7 84.9 14.8 14.4 33.7 25.8 55 25.8 79 0 110.1-134.6 58.1-208.6z"],
"viadeo-square": [448, 512, [], "f2aa", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM280.7 381.2c-42.4 46.2-120 46.6-162.4 0-68-73.6-19.8-196.1 81.2-196.1 13.3 0 26.6 2.1 39.1 6.7-4.3 8.4-7.3 17.6-8.4 27.1-9.7-4.1-20.2-6-30.7-6-48.8 0-84.6 41.7-84.6 88.9 0 43 28.5 78.7 69.5 85.9 61.5-24 72.9-117.6 72.9-175 0-7.3 0-14.8-.6-22.1-11.2-32.9-26.6-64.6-44.2-94.5 27.1 18.3 41.9 62.5 44.2 94.1v.4c7.7 22.5 11.8 46.2 11.8 70 0 54.1-21.9 99-68.3 128.2l-2.4.2c50 1 86.2-38.6 86.2-87.2 0-12.2-2.1-24.3-6.9-35.7 9.5-1.9 18.5-5.6 26.4-10.5 15.3 36.6 12.6 87.3-22.8 125.6zM309 233.7c-13.3 0-25.1-7.1-34.4-16.1 21.9-12 49.6-30.7 62.3-53 1.5-3 4.1-8.6 4.5-12-12.5 27.9-44.2 49.8-73.9 56.7-4.7-7.3-7.5-15.5-7.5-24.3 0-10.3 5.2-24.1 12.9-31.6 21.6-20.5 53-8.5 72.4-50 32.5 46.2 13.1 130.3-36.3 130.3z"],
"viber": [512, 512, [], "f409", "M444 49.9C431.3 38.2 379.9.9 265.3.4c0 0-135.1-8.1-200.9 52.3C27.8 89.3 14.9 143 13.5 209.5c-1.4 66.5-3.1 191.1 117 224.9h.1l-.1 51.6s-.8 20.9 13 25.1c16.6 5.2 26.4-10.7 42.3-27.8 8.7-9.4 20.7-23.2 29.8-33.7 82.2 6.9 145.3-8.9 152.5-11.2 16.6-5.4 110.5-17.4 125.7-142 15.8-128.6-7.6-209.8-49.8-246.5zM457.9 287c-12.9 104-89 110.6-103 115.1-6 1.9-61.5 15.7-131.2 11.2 0 0-52 62.7-68.2 79-5.3 5.3-11.1 4.8-11-5.7 0-6.9.4-85.7.4-85.7-.1 0-.1 0 0 0-101.8-28.2-95.8-134.3-94.7-189.8 1.1-55.5 11.6-101 42.6-131.6 55.7-50.5 170.4-43 170.4-43 96.9.4 143.3 29.6 154.1 39.4 35.7 30.6 53.9 103.8 40.6 211.1zm-139-80.8c.4 8.6-12.5 9.2-12.9.6-1.1-22-11.4-32.7-32.6-33.9-8.6-.5-7.8-13.4.7-12.9 27.9 1.5 43.4 17.5 44.8 46.2zm20.3 11.3c1-42.4-25.5-75.6-75.8-79.3-8.5-.6-7.6-13.5.9-12.9 58 4.2 88.9 44.1 87.8 92.5-.1 8.6-13.1 8.2-12.9-.3zm47 13.4c.1 8.6-12.9 8.7-12.9.1-.6-81.5-54.9-125.9-120.8-126.4-8.5-.1-8.5-12.9 0-12.9 73.7.5 133 51.4 133.7 139.2zM374.9 329v.2c-10.8 19-31 40-51.8 33.3l-.2-.3c-21.1-5.9-70.8-31.5-102.2-56.5-16.2-12.8-31-27.9-42.4-42.4-10.3-12.9-20.7-28.2-30.8-46.6-21.3-38.5-26-55.7-26-55.7-6.7-20.8 14.2-41 33.3-51.8h.2c9.2-4.8 18-3.2 23.9 3.9 0 0 12.4 14.8 17.7 22.1 5 6.8 11.7 17.7 15.2 23.8 6.1 10.9 2.3 22-3.7 26.6l-12 9.6c-6.1 4.9-5.3 14-5.3 14s17.8 67.3 84.3 84.3c0 0 9.1.8 14-5.3l9.6-12c4.6-6 15.7-9.8 26.6-3.7 14.7 8.3 33.4 21.2 45.8 32.9 7 5.7 8.6 14.4 3.8 23.6z"],
"vimeo": [448, 512, [], "f40a", "M403.2 32H44.8C20.1 32 0 52.1 0 76.8v358.4C0 459.9 20.1 480 44.8 480h358.4c24.7 0 44.8-20.1 44.8-44.8V76.8c0-24.7-20.1-44.8-44.8-44.8zM377 180.8c-1.4 31.5-23.4 74.7-66 129.4-44 57.2-81.3 85.8-111.7 85.8-18.9 0-34.8-17.4-47.9-52.3-25.5-93.3-36.4-148-57.4-148-2.4 0-10.9 5.1-25.4 15.2l-15.2-19.6c37.3-32.8 72.9-69.2 95.2-71.2 25.2-2.4 40.7 14.8 46.5 51.7 20.7 131.2 29.9 151 67.6 91.6 13.5-21.4 20.8-37.7 21.8-48.9 3.5-33.2-25.9-30.9-45.8-22.4 15.9-52.1 46.3-77.4 91.2-76 33.3.9 49 22.5 47.1 64.7z"],
"vimeo-square": [448, 512, [], "f194", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-16.2 149.6c-1.4 31.1-23.2 73.8-65.3 127.9-43.5 56.5-80.3 84.8-110.4 84.8-18.7 0-34.4-17.2-47.3-51.6-25.2-92.3-35.9-146.4-56.7-146.4-2.4 0-10.8 5-25.1 15.1L64 192c36.9-32.4 72.1-68.4 94.1-70.4 24.9-2.4 40.2 14.6 46 51.1 20.5 129.6 29.6 149.2 66.8 90.5 13.4-21.2 20.6-37.2 21.5-48.3 3.4-32.8-25.6-30.6-45.2-22.2 15.7-51.5 45.8-76.5 90.1-75.1 32.9 1 48.4 22.4 46.5 64z"],
"vimeo-v": [448, 512, [], "f27d", "M447.8 153.6c-2 43.6-32.4 103.3-91.4 179.1-60.9 79.2-112.4 118.8-154.6 118.8-26.1 0-48.2-24.1-66.3-72.3C100.3 250 85.3 174.3 56.2 174.3c-3.4 0-15.1 7.1-35.2 21.1L0 168.2c51.6-45.3 100.9-95.7 131.8-98.5 34.9-3.4 56.3 20.5 64.4 71.5 28.7 181.5 41.4 208.9 93.6 126.7 18.7-29.6 28.8-52.1 30.2-67.6 4.8-45.9-35.8-42.8-63.3-31 22-72.1 64.1-107.1 126.2-105.1 45.8 1.2 67.5 31.1 64.9 89.4z"],
"vine": [384, 512, [], "f1ca", "M384 254.7v52.1c-18.4 4.2-36.9 6.1-52.1 6.1-36.9 77.4-103 143.8-125.1 156.2-14 7.9-27.1 8.4-42.7-.8C137 452 34.2 367.7 0 102.7h74.5C93.2 261.8 139 343.4 189.3 404.5c27.9-27.9 54.8-65.1 75.6-106.9-49.8-25.3-80.1-80.9-80.1-145.6 0-65.6 37.7-115.1 102.2-115.1 114.9 0 106.2 127.9 81.6 181.5 0 0-46.4 9.2-63.5-20.5 3.4-11.3 8.2-30.8 8.2-48.5 0-31.3-11.3-46.6-28.4-46.6-18.2 0-30.8 17.1-30.8 50 .1 79.2 59.4 118.7 129.9 101.9z"],
"vk": [576, 512, [], "f189", "M545 117.7c3.7-12.5 0-21.7-17.8-21.7h-58.9c-15 0-21.9 7.9-25.6 16.7 0 0-30 73.1-72.4 120.5-13.7 13.7-20 18.1-27.5 18.1-3.7 0-9.4-4.4-9.4-16.9V117.7c0-15-4.2-21.7-16.6-21.7h-92.6c-9.4 0-15 7-15 13.5 0 14.2 21.2 17.5 23.4 57.5v86.8c0 19-3.4 22.5-10.9 22.5-20 0-68.6-73.4-97.4-157.4-5.8-16.3-11.5-22.9-26.6-22.9H38.8c-16.8 0-20.2 7.9-20.2 16.7 0 15.6 20 93.1 93.1 195.5C160.4 378.1 229 416 291.4 416c37.5 0 42.1-8.4 42.1-22.9 0-66.8-3.4-73.1 15.4-73.1 8.7 0 23.7 4.4 58.7 38.1 40 40 46.6 57.9 69 57.9h58.9c16.8 0 25.3-8.4 20.4-25-11.2-34.9-86.9-106.7-90.3-111.5-8.7-11.2-6.2-16.2 0-26.2.1-.1 72-101.3 79.4-135.6z"],
"vnv": [640, 512, [], "f40b", "M104.9 352c-34.1 0-46.4-30.4-46.4-30.4L2.6 210.1S-7.8 192 13 192h32.8c10.4 0 13.2 8.7 18.8 18.1l36.7 74.5s5.2 13.1 21.1 13.1 21.1-13.1 21.1-13.1l36.7-74.5c5.6-9.5 8.4-18.1 18.8-18.1h32.8c20.8 0 10.4 18.1 10.4 18.1l-55.8 111.5S174.2 352 140 352h-35.1zm395 0c-34.1 0-46.4-30.4-46.4-30.4l-55.9-111.5S387.2 192 408 192h32.8c10.4 0 13.2 8.7 18.8 18.1l36.7 74.5s5.2 13.1 21.1 13.1 21.1-13.1 21.1-13.1l36.8-74.5c5.6-9.5 8.4-18.1 18.8-18.1H627c20.8 0 10.4 18.1 10.4 18.1l-55.9 111.5S569.3 352 535.1 352h-35.2zM337.6 192c34.1 0 46.4 30.4 46.4 30.4l55.9 111.5s10.4 18.1-10.4 18.1h-32.8c-10.4 0-13.2-8.7-18.8-18.1l-36.7-74.5s-5.2-13.1-21.1-13.1c-15.9 0-21.1 13.1-21.1 13.1l-36.7 74.5c-5.6 9.4-8.4 18.1-18.8 18.1h-32.9c-20.8 0-10.4-18.1-10.4-18.1l55.9-111.5s12.2-30.4 46.4-30.4h35.1z"],
"vuejs": [448, 512, [], "f41f", "M356.9 64.3H280l-56 88.6-48-88.6H0L224 448 448 64.3h-91.1zm-301.2 32h53.8L224 294.5 338.4 96.3h53.8L224 384.5 55.7 96.3z"],
"waze": [512, 512, [], "f83f", "M502.17 201.67C516.69 287.53 471.23 369.59 389 409.8c13 34.1-12.4 70.2-48.32 70.2a51.68 51.68 0 0 1-51.57-49c-6.44.19-64.2 0-76.33-.64A51.69 51.69 0 0 1 159 479.92c-33.86-1.36-57.95-34.84-47-67.92-37.21-13.11-72.54-34.87-99.62-70.8-13-17.28-.48-41.8 20.84-41.8 46.31 0 32.22-54.17 43.15-110.26C94.8 95.2 193.12 32 288.09 32c102.48 0 197.15 70.67 214.08 169.67zM373.51 388.28c42-19.18 81.33-56.71 96.29-102.14 40.48-123.09-64.15-228-181.71-228-83.45 0-170.32 55.42-186.07 136-9.53 48.91 5 131.35-68.75 131.35C58.21 358.6 91.6 378.11 127 389.54c24.66-21.8 63.87-15.47 79.83 14.34 14.22 1 79.19 1.18 87.9.82a51.69 51.69 0 0 1 78.78-16.42zM205.12 187.13c0-34.74 50.84-34.75 50.84 0s-50.84 34.74-50.84 0zm116.57 0c0-34.74 50.86-34.75 50.86 0s-50.86 34.75-50.86 0zm-122.61 70.69c-3.44-16.94 22.18-22.18 25.62-5.21l.06.28c4.14 21.42 29.85 44 64.12 43.07 35.68-.94 59.25-22.21 64.11-42.77 4.46-16.05 28.6-10.36 25.47 6-5.23 22.18-31.21 62-91.46 62.9-42.55 0-80.88-27.84-87.9-64.25z"],
"weebly": [512, 512, [], "f5cc", "M425.09 65.83c-39.88 0-73.28 25.73-83.66 64.33-18.16-58.06-65.5-64.33-84.95-64.33-19.78 0-66.8 6.28-85.28 64.33-10.38-38.6-43.45-64.33-83.66-64.33C38.59 65.83 0 99.72 0 143.03c0 28.96 4.18 33.27 77.17 233.48 22.37 60.57 67.77 69.35 92.74 69.35 39.23 0 70.04-19.46 85.93-53.98 15.89 34.83 46.69 54.29 85.93 54.29 24.97 0 70.36-9.1 92.74-69.67 76.55-208.65 77.5-205.58 77.5-227.2.63-48.32-36.01-83.47-86.92-83.47zm26.34 114.81l-65.57 176.44c-7.92 21.49-21.22 37.22-46.24 37.22-23.44 0-37.38-12.41-44.03-33.9l-39.28-117.42h-.95L216.08 360.4c-6.96 21.5-20.9 33.6-44.02 33.6-25.02 0-38.33-15.74-46.24-37.22L60.88 181.55c-5.38-14.83-7.92-23.91-7.92-34.5 0-16.34 15.84-29.36 38.33-29.36 18.69 0 31.99 11.8 36.11 29.05l44.03 139.82h.95l44.66-136.79c6.02-19.67 16.47-32.08 38.96-32.08s32.94 12.11 38.96 32.08l44.66 136.79h.95l44.03-139.82c4.12-17.25 17.42-29.05 36.11-29.05 22.17 0 38.33 13.32 38.33 35.71-.32 7.87-4.12 16.04-7.61 27.24z"],
"weibo": [512, 512, [], "f18a", "M407 177.6c7.6-24-13.4-46.8-37.4-41.7-22 4.8-28.8-28.1-7.1-32.8 50.1-10.9 92.3 37.1 76.5 84.8-6.8 21.2-38.8 10.8-32-10.3zM214.8 446.7C108.5 446.7 0 395.3 0 310.4c0-44.3 28-95.4 76.3-143.7C176 67 279.5 65.8 249.9 161c-4 13.1 12.3 5.7 12.3 6 79.5-33.6 140.5-16.8 114 51.4-3.7 9.4 1.1 10.9 8.3 13.1 135.7 42.3 34.8 215.2-169.7 215.2zm143.7-146.3c-5.4-55.7-78.5-94-163.4-85.7-84.8 8.6-148.8 60.3-143.4 116s78.5 94 163.4 85.7c84.8-8.6 148.8-60.3 143.4-116zM347.9 35.1c-25.9 5.6-16.8 43.7 8.3 38.3 72.3-15.2 134.8 52.8 111.7 124-7.4 24.2 29.1 37 37.4 12 31.9-99.8-55.1-195.9-157.4-174.3zm-78.5 311c-17.1 38.8-66.8 60-109.1 46.3-40.8-13.1-58-53.4-40.3-89.7 17.7-35.4 63.1-55.4 103.4-45.1 42 10.8 63.1 50.2 46 88.5zm-86.3-30c-12.9-5.4-30 .3-38 12.9-8.3 12.9-4.3 28 8.6 34 13.1 6 30.8.3 39.1-12.9 8-13.1 3.7-28.3-9.7-34zm32.6-13.4c-5.1-1.7-11.4.6-14.3 5.4-2.9 5.1-1.4 10.6 3.7 12.9 5.1 2 11.7-.3 14.6-5.4 2.8-5.2 1.1-10.9-4-12.9z"],
"weixin": [576, 512, [], "f1d7", "M385.2 167.6c6.4 0 12.6.3 18.8 1.1C387.4 90.3 303.3 32 207.7 32 100.5 32 13 104.8 13 197.4c0 53.4 29.3 97.5 77.9 131.6l-19.3 58.6 68-34.1c24.4 4.8 43.8 9.7 68.2 9.7 6.2 0 12.1-.3 18.3-.8-4-12.9-6.2-26.6-6.2-40.8-.1-84.9 72.9-154 165.3-154zm-104.5-52.9c14.5 0 24.2 9.7 24.2 24.4 0 14.5-9.7 24.2-24.2 24.2-14.8 0-29.3-9.7-29.3-24.2.1-14.7 14.6-24.4 29.3-24.4zm-136.4 48.6c-14.5 0-29.3-9.7-29.3-24.2 0-14.8 14.8-24.4 29.3-24.4 14.8 0 24.4 9.7 24.4 24.4 0 14.6-9.6 24.2-24.4 24.2zM563 319.4c0-77.9-77.9-141.3-165.4-141.3-92.7 0-165.4 63.4-165.4 141.3S305 460.7 397.6 460.7c19.3 0 38.9-5.1 58.6-9.9l53.4 29.3-14.8-48.6C534 402.1 563 363.2 563 319.4zm-219.1-24.5c-9.7 0-19.3-9.7-19.3-19.6 0-9.7 9.7-19.3 19.3-19.3 14.8 0 24.4 9.7 24.4 19.3 0 10-9.7 19.6-24.4 19.6zm107.1 0c-9.7 0-19.3-9.7-19.3-19.6 0-9.7 9.7-19.3 19.3-19.3 14.5 0 24.4 9.7 24.4 19.3.1 10-9.9 19.6-24.4 19.6z"],
"whatsapp": [448, 512, [], "f232", "M380.9 97.1C339 55.1 283.2 32 223.9 32c-122.4 0-222 99.6-222 222 0 39.1 10.2 77.3 29.6 111L0 480l117.7-30.9c32.4 17.7 68.9 27 106.1 27h.1c122.3 0 224.1-99.6 224.1-222 0-59.3-25.2-115-67.1-157zm-157 341.6c-33.2 0-65.7-8.9-94-25.7l-6.7-4-69.8 18.3L72 359.2l-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.6 19.2 130.4 54.1 34.8 34.9 56.2 81.2 56.1 130.5 0 101.8-84.9 184.6-186.6 184.6zm101.2-138.2c-5.5-2.8-32.8-16.2-37.9-18-5.1-1.9-8.8-2.8-12.5 2.8-3.7 5.6-14.3 18-17.6 21.8-3.2 3.7-6.5 4.2-12 1.4-32.6-16.3-54-29.1-75.5-66-5.7-9.8 5.7-9.1 16.3-30.3 1.8-3.7.9-6.9-.5-9.7-1.4-2.8-12.5-30.1-17.1-41.2-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2-3.7 0-9.7 1.4-14.8 6.9-5.1 5.6-19.4 19-19.4 46.3 0 27.3 19.9 53.7 22.6 57.4 2.8 3.7 39.1 59.7 94.8 83.8 35.2 15.2 49 16.5 66.6 13.9 10.7-1.6 32.8-13.4 37.4-26.4 4.6-13 4.6-24.1 3.2-26.4-1.3-2.5-5-3.9-10.5-6.6z"],
"whatsapp-square": [448, 512, [], "f40c", "M224 122.8c-72.7 0-131.8 59.1-131.9 131.8 0 24.9 7 49.2 20.2 70.1l3.1 5-13.3 48.6 49.9-13.1 4.8 2.9c20.2 12 43.4 18.4 67.1 18.4h.1c72.6 0 133.3-59.1 133.3-131.8 0-35.2-15.2-68.3-40.1-93.2-25-25-58-38.7-93.2-38.7zm77.5 188.4c-3.3 9.3-19.1 17.7-26.7 18.8-12.6 1.9-22.4.9-47.5-9.9-39.7-17.2-65.7-57.2-67.7-59.8-2-2.6-16.2-21.5-16.2-41s10.2-29.1 13.9-33.1c3.6-4 7.9-5 10.6-5 2.6 0 5.3 0 7.6.1 2.4.1 5.7-.9 8.9 6.8 3.3 7.9 11.2 27.4 12.2 29.4s1.7 4.3.3 6.9c-7.6 15.2-15.7 14.6-11.6 21.6 15.3 26.3 30.6 35.4 53.9 47.1 4 2 6.3 1.7 8.6-1 2.3-2.6 9.9-11.6 12.5-15.5 2.6-4 5.3-3.3 8.9-2 3.6 1.3 23.1 10.9 27.1 12.9s6.6 3 7.6 4.6c.9 1.9.9 9.9-2.4 19.1zM400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM223.9 413.2c-26.6 0-52.7-6.7-75.8-19.3L64 416l22.5-82.2c-13.9-24-21.2-51.3-21.2-79.3C65.4 167.1 136.5 96 223.9 96c42.4 0 82.2 16.5 112.2 46.5 29.9 30 47.9 69.8 47.9 112.2 0 87.4-72.7 158.5-160.1 158.5z"],
"whmcs": [448, 512, [], "f40d", "M448 161v-21.3l-28.5-8.8-2.2-10.4 20.1-20.7L427 80.4l-29 7.5-7.2-7.5 7.5-28.2-19.1-11.6-21.3 21-10.7-3.2-7-26.4h-22.6l-6.2 26.4-12.1 3.2-19.7-21-19.4 11 8.1 27.7-8.1 8.4-28.5-7.5-11 19.1 20.7 21-2.9 10.4-28.5 7.8-.3 21.7 28.8 7.5 2.4 12.1-20.1 19.9 10.4 18.5 29.6-7.5 7.2 8.6-8.1 26.9 19.9 11.6 19.4-20.4 11.6 2.9 6.7 28.5 22.6.3 6.7-28.8 11.6-3.5 20.7 21.6 20.4-12.1-8.8-28 7.8-8.1 28.8 8.8 10.3-20.1-20.9-18.8 2.2-12.1 29.1-7zm-119.2 45.2c-31.3 0-56.8-25.4-56.8-56.8s25.4-56.8 56.8-56.8 56.8 25.4 56.8 56.8c0 31.5-25.4 56.8-56.8 56.8zm72.3 16.4l46.9 14.5V277l-55.1 13.4-4.1 22.7 38.9 35.3-19.2 37.9-54-16.7-14.6 15.2 16.7 52.5-38.3 22.7-38.9-40.5-21.7 6.6-12.6 54-42.4-.5-12.6-53.6-21.7-5.6-36.4 38.4-37.4-21.7 15.2-50.5-13.7-16.1-55.5 14.1-19.7-34.8 37.9-37.4-4.8-22.8-54-14.1.5-40.9L54 219.9l5.7-19.7-38.9-39.4L41.5 125l53.6 14.1 15.2-15.7-15.2-52 36.4-20.7 36.8 39.4L191 84l11.6-52H245l11.6 45.9L234 72l-6.3-1.7-3.3 5.7-11 19.1-3.3 5.6 4.6 4.6 17.2 17.4-.3 1-23.8 6.5-6.2 1.7-.1 6.4-.2 12.9C153.8 161.6 118 204 118 254.7c0 58.3 47.3 105.7 105.7 105.7 50.5 0 92.7-35.4 103.2-82.8l13.2.2 6.9.1 1.6-6.7 5.6-24 1.9-.6 17.1 17.8 4.7 4.9 5.8-3.4 20.4-12.1 5.8-3.5-2-6.5-6.8-21.2z"],
"wikipedia-w": [640, 512, [], "f266", "M640 51.2l-.3 12.2c-28.1.8-45 15.8-55.8 40.3-25 57.8-103.3 240-155.3 358.6H415l-81.9-193.1c-32.5 63.6-68.3 130-99.2 193.1-.3.3-15 0-15-.3C172 352.3 122.8 243.4 75.8 133.4 64.4 106.7 26.4 63.4.2 63.7c0-3.1-.3-10-.3-14.2h161.9v13.9c-19.2 1.1-52.8 13.3-43.3 34.2 21.9 49.7 103.6 240.3 125.6 288.6 15-29.7 57.8-109.2 75.3-142.8-13.9-28.3-58.6-133.9-72.8-160-9.7-17.8-36.1-19.4-55.8-19.7V49.8l142.5.3v13.1c-19.4.6-38.1 7.8-29.4 26.1 18.9 40 30.6 68.1 48.1 104.7 5.6-10.8 34.7-69.4 48.1-100.8 8.9-20.6-3.9-28.6-38.6-29.4.3-3.6 0-10.3.3-13.6 44.4-.3 111.1-.3 123.1-.6v13.6c-22.5.8-45.8 12.8-58.1 31.7l-59.2 122.8c6.4 16.1 63.3 142.8 69.2 156.7L559.2 91.8c-8.6-23.1-36.4-28.1-47.2-28.3V49.6l127.8 1.1.2.5z"],
"windows": [448, 512, [], "f17a", "M0 93.7l183.6-25.3v177.4H0V93.7zm0 324.6l183.6 25.3V268.4H0v149.9zm203.8 28L448 480V268.4H203.8v177.9zm0-380.6v180.1H448V32L203.8 65.7z"],
"wix": [640, 512, [], "f5cf", "M393.38 131.69c0 13.03 2.08 32.69-28.68 43.83-9.52 3.45-15.95 9.66-15.95 9.66 0-31 4.72-42.22 17.4-48.86 9.75-5.11 27.23-4.63 27.23-4.63zm-115.8 35.54l-34.24 132.66-28.48-108.57c-7.69-31.99-20.81-48.53-48.43-48.53-27.37 0-40.66 16.18-48.43 48.53L89.52 299.89 55.28 167.23C49.73 140.51 23.86 128.96 0 131.96l65.57 247.93s21.63 1.56 32.46-3.96c14.22-7.25 20.98-12.84 29.59-46.57 7.67-30.07 29.11-118.41 31.12-124.7 4.76-14.94 11.09-13.81 15.4 0 1.97 6.3 23.45 94.63 31.12 124.7 8.6 33.73 15.37 39.32 29.59 46.57 10.82 5.52 32.46 3.96 32.46 3.96l65.57-247.93c-24.42-3.07-49.82 8.93-55.3 35.27zm115.78 5.21s-4.1 6.34-13.46 11.57c-6.01 3.36-11.78 5.64-17.97 8.61-15.14 7.26-13.18 13.95-13.18 35.2v152.07s16.55 2.09 27.37-3.43c13.93-7.1 17.13-13.95 17.26-44.78V181.41l-.02.01v-8.98zm163.44 84.08L640 132.78s-35.11-5.98-52.5 9.85c-13.3 12.1-24.41 29.55-54.18 72.47-.47.73-6.25 10.54-13.07 0-29.29-42.23-40.8-60.29-54.18-72.47-17.39-15.83-52.5-9.85-52.5-9.85l83.2 123.74-82.97 123.36s36.57 4.62 53.95-11.21c11.49-10.46 17.58-20.37 52.51-70.72 6.81-10.52 12.57-.77 13.07 0 29.4 42.38 39.23 58.06 53.14 70.72 17.39 15.83 53.32 11.21 53.32 11.21L556.8 256.52z"],
"wizards-of-the-coast": [640, 512, [], "f730", "M219.19 345.69c-1.9 1.38-11.07 8.44-.26 23.57 4.64 6.42 14.11 12.79 21.73 6.55 6.5-4.88 7.35-12.92.26-23.04-5.47-7.76-14.28-12.88-21.73-7.08zm336.75 75.94c-.34 1.7-.55 1.67.79 0 2.09-4.19 4.19-10.21 4.98-19.9 3.14-38.49-40.33-71.49-101.34-78.03-54.73-6.02-124.38 9.17-188.8 60.49l-.26 1.57c2.62 4.98 4.98 10.74 3.4 21.21l.79.26c63.89-58.4 131.19-77.25 184.35-73.85 58.4 3.67 100.03 34.04 100.03 68.08-.01 9.96-2.63 15.72-3.94 20.17zM392.28 240.42c.79 7.07 4.19 10.21 9.17 10.47 5.5.26 9.43-2.62 10.47-6.55.79-3.4 2.09-29.85 2.09-29.85s-11.26 6.55-14.93 10.47c-3.66 3.68-7.33 8.39-6.8 15.46zm-50.02-151.1C137.75 89.32 13.1 226.8.79 241.2c-1.05.52-1.31.79.79 1.31 60.49 16.5 155.81 81.18 196.13 202.16l1.05.26c55.25-69.92 140.88-128.05 236.99-128.05 80.92 0 130.15 42.16 130.15 80.39 0 18.33-6.55 33.52-22.26 46.35 0 .96-.2.79.79.79 14.66-10.74 27.5-28.8 27.5-48.18 0-22.78-12.05-38.23-12.05-38.23 7.07 7.07 10.74 16.24 10.74 16.24 5.76-40.85 26.97-62.32 26.97-62.32-2.36-9.69-6.81-17.81-6.81-17.81 7.59 8.12 14.4 27.5 14.4 41.37 0 10.47-3.4 22.78-12.57 31.95l.26.52c8.12-4.98 16.5-16.76 16.5-37.97 0-15.71-4.71-25.92-4.71-25.92 5.76-5.24 11.26-9.17 15.97-11.78.79 3.4 2.09 9.69 2.36 14.93 0 1.05.79 1.83 1.05 0 .79-5.76-.26-16.24-.26-16.5 6.02-3.14 9.69-4.45 9.69-4.45C617.74 176 489.43 89.32 342.26 89.32zm-99.24 289.62c-11.06 8.99-24.2 4.08-30.64-4.19-7.45-9.58-6.76-24.09 4.19-32.47 14.85-11.35 27.08-.49 31.16 5.5.28.39 12.13 16.57-4.71 31.16zm2.09-136.43l9.43-17.81 11.78 70.96-12.57 6.02-24.62-28.8 14.14-26.71 3.67 4.45-1.83-8.11zm18.59 117.58l-.26-.26c2.05-4.1-2.5-6.61-17.54-31.69-1.31-2.36-3.14-2.88-4.45-2.62l-.26-.52c7.86-5.76 15.45-10.21 25.4-15.71l.52.26c1.31 1.83 2.09 2.88 3.4 4.71l-.26.52c-1.05-.26-2.36-.79-5.24.26-2.09.79-7.86 3.67-12.31 7.59v1.31c1.57 2.36 3.93 6.55 5.76 9.69h.26c10.05-6.28 7.56-4.55 11.52-7.86h.26c.52 1.83.52 1.83 1.83 5.5l-.26.26c-3.06.61-4.65.34-11.52 5.5v.26c9.46 17.02 11.01 16.75 12.57 15.97l.26.26c-2.34 1.59-6.27 4.21-9.68 6.57zm55.26-32.47c-3.14 1.57-6.02 2.88-9.95 4.98l-.26-.26c1.29-2.59 1.16-2.71-11.78-32.47l-.26-.26c-.15 0-8.9 3.65-9.95 7.33h-.52l-1.05-5.76.26-.52c7.29-4.56 25.53-11.64 27.76-12.57l.52.26 3.14 4.98-.26.52c-3.53-1.76-7.35.76-12.31 2.62v.26c12.31 32.01 12.67 30.64 14.66 30.64v.25zm44.77-16.5c-4.19 1.05-5.24 1.31-9.69 2.88l-.26-.26.52-4.45c-1.05-3.4-3.14-11.52-3.67-13.62l-.26-.26c-3.4.79-8.9 2.62-12.83 3.93l-.26.26c.79 2.62 3.14 9.95 4.19 13.88.79 2.36 1.83 2.88 2.88 3.14v.52c-3.67 1.05-7.07 2.62-10.21 3.93l-.26-.26c1.05-1.31 1.05-2.88.26-4.98-1.05-3.14-8.12-23.83-9.17-27.23-.52-1.83-1.57-3.14-2.62-3.14v-.52c3.14-1.05 6.02-2.09 10.74-3.4l.26.26-.26 4.71c1.31 3.93 2.36 7.59 3.14 9.69h.26c3.93-1.31 9.43-2.88 12.83-3.93l.26-.26-2.62-9.43c-.52-1.83-1.05-3.4-2.62-3.93v-.26c4.45-1.05 7.33-1.83 10.74-2.36l.26.26c-1.05 1.31-1.05 2.88-.52 4.45 1.57 6.28 4.71 20.43 6.28 26.45.54 2.62 1.85 3.41 2.63 3.93zm32.21-6.81l-.26.26c-4.71.52-14.14 2.36-22.52 4.19l-.26-.26.79-4.19c-1.57-7.86-3.4-18.59-4.98-26.19-.26-1.83-.79-2.88-2.62-3.67l.79-.52c9.17-1.57 20.16-2.36 24.88-2.62l.26.26c.52 2.36.79 3.14 1.57 5.5l-.26.26c-1.14-1.14-3.34-3.2-16.24-.79l-.26.26c.26 1.57 1.05 6.55 1.57 9.95l.26.26c9.52-1.68 4.76-.06 10.74-2.36h.26c0 1.57-.26 1.83-.26 5.24h-.26c-4.81-1.03-2.15-.9-10.21 0l-.26.26c.26 2.09 1.57 9.43 2.09 12.57l.26.26c1.15.38 14.21-.65 16.24-4.71h.26c-.53 2.38-1.05 4.21-1.58 6.04zm10.74-44.51c-4.45 2.36-8.12 2.88-11 2.88-.25.02-11.41 1.09-17.54-9.95-6.74-10.79-.98-25.2 5.5-31.69 8.8-8.12 23.35-10.1 28.54-17.02 8.03-10.33-13.04-22.31-29.59-5.76l-2.62-2.88 5.24-16.24c25.59-1.57 45.2-3.04 50.02 16.24.79 3.14 0 9.43-.26 12.05 0 2.62-1.83 18.85-2.09 23.04-.52 4.19-.79 18.33-.79 20.69.26 2.36.52 4.19 1.57 5.5 1.57 1.83 5.76 1.83 5.76 1.83l-.79 4.71c-11.82-1.07-10.28-.59-20.43-1.05-3.22-5.15-2.23-3.28-4.19-7.86 0 .01-4.19 3.94-7.33 5.51zm37.18 21.21c-6.35-10.58-19.82-7.16-21.73 5.5-2.63 17.08 14.3 19.79 20.69 10.21l.26.26c-.52 1.83-1.83 6.02-1.83 6.28l-.52.52c-10.3 6.87-28.5-2.5-25.66-18.59 1.94-10.87 14.44-18.93 28.8-9.95l.26.52c0 1.06-.27 3.41-.27 5.25zm5.77-87.73v-6.55c.69 0 19.65 3.28 27.76 7.33l-1.57 17.54s10.21-9.43 15.45-10.74c5.24-1.57 14.93 7.33 14.93 7.33l-11.26 11.26c-12.07-6.35-19.59-.08-20.69.79-5.29 38.72-8.6 42.17 4.45 46.09l-.52 4.71c-17.55-4.29-18.53-4.5-36.92-7.33l.79-4.71c7.25 0 7.48-5.32 7.59-6.81 0 0 4.98-53.16 4.98-55.25-.02-2.87-4.99-3.66-4.99-3.66zm10.99 114.44c-8.12-2.09-14.14-11-10.74-20.69 3.14-9.43 12.31-12.31 18.85-10.21 9.17 2.62 12.83 11.78 10.74 19.38-2.61 8.9-9.42 13.87-18.85 11.52zm42.16 9.69c-2.36-.52-7.07-2.36-8.64-2.88v-.26l1.57-1.83c.59-8.24.59-7.27.26-7.59-4.82-1.81-6.66-2.36-7.07-2.36-1.31 1.83-2.88 4.45-3.67 5.5l-.79 3.4v.26c-1.31-.26-3.93-1.31-6.02-1.57v-.26l2.62-1.83c3.4-4.71 9.95-14.14 13.88-20.16v-2.09l.52-.26c2.09.79 5.5 2.09 7.59 2.88.48.48.18-1.87-1.05 25.14-.24 1.81.02 2.6.8 3.91zm-4.71-89.82c11.25-18.27 30.76-16.19 34.04-3.4L539.7 198c2.34-6.25-2.82-9.9-4.45-11.26l1.83-3.67c12.22 10.37 16.38 13.97 22.52 20.43-25.91 73.07-30.76 80.81-24.62 84.32l-1.83 4.45c-6.37-3.35-8.9-4.42-17.81-8.64l2.09-6.81c-.26-.26-3.93 3.93-9.69 3.67-19.06-1.3-22.89-31.75-9.67-52.9zm29.33 79.34c0-5.71-6.34-7.89-7.86-5.24-1.31 2.09 1.05 4.98 2.88 8.38 1.57 2.62 2.62 6.28 1.05 9.43-2.64 6.34-12.4 5.31-15.45-.79 0-.7-.27.09 1.83-4.71l.79-.26c-.57 5.66 6.06 9.61 8.38 4.98 1.05-2.09-.52-5.5-2.09-8.38-1.57-2.62-3.67-6.28-1.83-9.69 2.72-5.06 11.25-4.47 14.66 2.36v.52l-2.36 3.4zm21.21 13.36c-1.96-3.27-.91-2.14-4.45-4.71h-.26c-2.36 4.19-5.76 10.47-8.64 16.24-1.31 2.36-1.05 3.4-.79 3.93l-.26.26-5.76-4.45.26-.26 2.09-1.31c3.14-5.76 6.55-12.05 9.17-17.02v-.26c-2.64-1.98-1.22-1.51-6.02-1.83v-.26l3.14-3.4h.26c3.67 2.36 9.95 6.81 12.31 8.9l.26.26-1.31 3.91zm27.23-44.26l-2.88-2.88c.79-2.36 1.83-4.98 2.09-7.59.75-9.74-11.52-11.84-11.52-4.98 0 4.98 7.86 19.38 7.86 27.76 0 10.21-5.76 15.71-13.88 16.5-8.38.79-20.16-10.47-20.16-10.47l4.98-14.4 2.88 2.09c-2.97 17.8 17.68 20.37 13.35 5.24-1.06-4.02-18.75-34.2 2.09-38.23 13.62-2.36 23.04 16.5 23.04 16.5l-7.85 10.46zm35.62-10.21c-11-30.38-60.49-127.53-191.95-129.62-53.42-1.05-94.27 15.45-132.76 37.97l85.63-9.17-91.39 20.69 25.14 19.64-3.93-16.5c7.5-1.71 39.15-8.45 66.77-8.9l-22.26 80.39c13.61-.7 18.97-8.98 19.64-22.78l4.98-1.05.26 26.71c-22.46 3.21-37.3 6.69-49.49 9.95l13.09-43.21-61.54-36.66 2.36 8.12 10.21 4.98c6.28 18.59 19.38 56.56 20.43 58.66 1.95 4.28 3.16 5.78 12.05 4.45l1.05 4.98c-16.08 4.86-23.66 7.61-39.02 14.4l-2.36-4.71c4.4-2.94 8.73-3.94 5.5-12.83-23.7-62.5-21.48-58.14-22.78-59.44l2.36-4.45 33.52 67.3c-3.84-11.87 1.68 1.69-32.99-78.82l-41.9 88.51 4.71-13.88-35.88-42.16 27.76 93.48-11.78 8.38C95 228.58 101.05 231.87 93.23 231.52c-5.5-.26-13.62 5.5-13.62 5.5L74.63 231c30.56-23.53 31.62-24.33 58.4-42.68l4.19 7.07s-5.76 4.19-7.86 7.07c-5.9 9.28 1.67 13.28 61.8 75.68l-18.85-58.92 39.8-10.21 25.66 30.64 4.45-12.31-4.98-24.62 13.09-3.4.52 3.14 3.67-10.47-94.27 29.33 11.26-4.98-13.62-42.42 17.28-9.17 30.11 36.14 28.54-13.09c-1.41-7.47-2.47-14.5-4.71-19.64l17.28 13.88 4.71-2.09-59.18-42.68 23.08 11.5c18.98-6.07 25.23-7.47 32.21-9.69l2.62 11c-12.55 12.55 1.43 16.82 6.55 19.38l-13.62-61.01 12.05 28.28c4.19-1.31 7.33-2.09 7.33-2.09l2.62 8.64s-3.14 1.05-6.28 2.09l8.9 20.95 33.78-65.73-20.69 61.01c42.42-24.09 81.44-36.66 131.98-35.88 67.04 1.05 167.33 40.85 199.8 139.83.78 2.1-.01 2.63-.79.27zM203.48 152.43s1.83-.52 4.19-1.31l9.43 7.59c-.4 0-3.44-.25-11.26 2.36l-2.36-8.64zm143.76 38.5c-1.57-.6-26.46-4.81-33.26 20.69l21.73 17.02 11.53-37.71zM318.43 67.07c-58.4 0-106.05 12.05-114.96 14.4v.79c8.38 2.09 14.4 4.19 21.21 11.78l1.57.26c6.55-1.83 48.97-13.88 110.24-13.88 180.16 0 301.67 116.79 301.67 223.37v9.95c0 1.31.79 2.62 1.05.52.52-2.09.79-8.64.79-19.64.26-83.79-96.63-227.55-321.57-227.55zm211.06 169.68c1.31-5.76 0-12.31-7.33-13.09-9.62-1.13-16.14 23.79-17.02 33.52-.79 5.5-1.31 14.93 6.02 14.93 4.68-.01 9.72-.91 18.33-35.36zm-61.53 42.95c-2.62-.79-9.43-.79-12.57 10.47-1.83 6.81.52 13.35 6.02 14.66 3.67 1.05 8.9.52 11.78-10.74 2.62-9.94-1.83-13.61-5.23-14.39zM491 300.65c1.83.52 3.14 1.05 5.76 1.83 0-1.83.52-8.38.79-12.05-1.05 1.31-5.5 8.12-6.55 9.95v.27z"],
"wolf-pack-battalion": [512, 512, [], "f514", "M267.73 471.53l10.56 15.84 5.28-12.32 5.28 7V512c21.06-7.92 21.11-66.86 25.51-97.21 4.62-31.89-.88-92.81 81.37-149.11-8.88-23.61-12-49.43-2.64-80.05C421 189 447 196.21 456.43 239.73l-30.35 8.36c11.15 23 17 46.76 13.2 72.14L412 313.18l-6.16 33.43-18.47-7-8.8 33.39-19.35-7 26.39 21.11 8.8-28.15L419 364.2l7-35.63 26.39 14.52c.25-20 7-58.06-8.8-84.45l26.39 5.28c4-22.07-2.38-39.21-7.92-56.74l22.43 9.68c-.44-25.07-29.94-56.79-61.58-58.5-20.22-1.09-56.74-25.17-54.1-51.9 2-19.87 17.45-42.62 43.11-49.7-44 36.51-9.68 67.3 5.28 73.46 4.4-11.44 17.54-69.08 0-130.2-40.39 22.87-89.65 65.1-93.2 147.79l-58 38.71-3.52 93.25L369.78 220l7 7-17.59 3.52-44 38.71-15.84-5.28-28.1 49.25-3.52 119.64 21.11 15.84-32.55 15.84-32.55-15.84 21.11-15.84-3.52-119.64-28.15-49.26-15.84 5.28-44-38.71-17.58-3.51 7-7 107.33 59.82-3.52-93.25-58.06-38.71C185 65.1 135.77 22.87 95.3 0c-17.54 61.12-4.4 118.76 0 130.2 15-6.16 49.26-36.95 5.28-73.46 25.66 7.08 41.15 29.83 43.11 49.7 2.63 26.74-33.88 50.81-54.1 51.9-31.65 1.72-61.15 33.44-61.59 58.51l22.43-9.68c-5.54 17.53-11.91 34.67-7.92 56.74l26.39-5.28c-15.76 26.39-9.05 64.43-8.8 84.45l26.39-14.52 7 35.63 24.63-5.28 8.8 28.15L153.35 366 134 373l-8.8-33.43-18.47 7-6.16-33.43-27.27 7c-3.82-25.38 2-49.1 13.2-72.14l-30.35-8.36c9.4-43.52 35.47-50.77 63.34-54.1 9.36 30.62 6.24 56.45-2.64 80.05 82.25 56.3 76.75 117.23 81.37 149.11 4.4 30.35 4.45 89.29 25.51 97.21v-29.83l5.28-7 5.28 12.32 10.56-15.84 11.44 21.11 11.43-21.1zm79.17-95L331.06 366c7.47-4.36 13.76-8.42 19.35-12.32-.6 7.22-.27 13.84-3.51 22.84zm28.15-49.26c-.4 10.94-.9 21.66-1.76 31.67-7.85-1.86-15.57-3.8-21.11-7 8.24-7.94 15.55-16.32 22.87-24.68zm24.63 5.28c0-13.43-2.05-24.21-5.28-33.43a235 235 0 0 1-18.47 27.27zm3.52-80.94c19.44 12.81 27.8 33.66 29.91 56.3-12.32-4.53-24.63-9.31-36.95-10.56 5.06-12 6.65-28.14 7-45.74zm-1.76-45.74c.81 14.3 1.84 28.82 1.76 42.23 19.22-8.11 29.78-9.72 44-14.08-10.61-18.96-27.2-25.53-45.76-28.16zM165.68 376.52L181.52 366c-7.47-4.36-13.76-8.42-19.35-12.32.6 7.26.27 13.88 3.51 22.88zm-28.15-49.26c.4 10.94.9 21.66 1.76 31.67 7.85-1.86 15.57-3.8 21.11-7-8.24-7.93-15.55-16.31-22.87-24.67zm-24.64 5.28c0-13.43 2-24.21 5.28-33.43a235 235 0 0 0 18.47 27.27zm-3.52-80.94c-19.44 12.81-27.8 33.66-29.91 56.3 12.32-4.53 24.63-9.31 37-10.56-5-12-6.65-28.14-7-45.74zm1.76-45.74c-.81 14.3-1.84 28.82-1.76 42.23-19.22-8.11-29.78-9.72-44-14.08 10.63-18.95 27.23-25.52 45.76-28.15z"],
"wordpress": [512, 512, [], "f19a", "M61.7 169.4l101.5 278C92.2 413 43.3 340.2 43.3 256c0-30.9 6.6-60.1 18.4-86.6zm337.9 75.9c0-26.3-9.4-44.5-17.5-58.7-10.8-17.5-20.9-32.4-20.9-49.9 0-19.6 14.8-37.8 35.7-37.8.9 0 1.8.1 2.8.2-37.9-34.7-88.3-55.9-143.7-55.9-74.3 0-139.7 38.1-177.8 95.9 5 .2 9.7.3 13.7.3 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l77.5 230.4L249.8 247l-33.1-90.8c-11.5-.7-22.3-2-22.3-2-11.5-.7-10.1-18.2 1.3-17.5 0 0 35.1 2.7 56 2.7 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l76.9 228.7 21.2-70.9c9-29.4 16-50.5 16-68.7zm-139.9 29.3l-63.8 185.5c19.1 5.6 39.2 8.7 60.1 8.7 24.8 0 48.5-4.3 70.6-12.1-.6-.9-1.1-1.9-1.5-2.9l-65.4-179.2zm183-120.7c.9 6.8 1.4 14 1.4 21.9 0 21.6-4 45.8-16.2 76.2l-65 187.9C426.2 403 468.7 334.5 468.7 256c0-37-9.4-71.8-26-102.1zM504 256c0 136.8-111.3 248-248 248C119.2 504 8 392.7 8 256 8 119.2 119.2 8 256 8c136.7 0 248 111.2 248 248zm-11.4 0c0-130.5-106.2-236.6-236.6-236.6C125.5 19.4 19.4 125.5 19.4 256S125.6 492.6 256 492.6c130.5 0 236.6-106.1 236.6-236.6z"],
"wordpress-simple": [512, 512, [], "f411", "M256 8C119.3 8 8 119.2 8 256c0 136.7 111.3 248 248 248s248-111.3 248-248C504 119.2 392.7 8 256 8zM33 256c0-32.3 6.9-63 19.3-90.7l106.4 291.4C84.3 420.5 33 344.2 33 256zm223 223c-21.9 0-43-3.2-63-9.1l66.9-194.4 68.5 187.8c.5 1.1 1 2.1 1.6 3.1-23.1 8.1-48 12.6-74 12.6zm30.7-327.5c13.4-.7 25.5-2.1 25.5-2.1 12-1.4 10.6-19.1-1.4-18.4 0 0-36.1 2.8-59.4 2.8-21.9 0-58.7-2.8-58.7-2.8-12-.7-13.4 17.7-1.4 18.4 0 0 11.4 1.4 23.4 2.1l34.7 95.2L200.6 393l-81.2-241.5c13.4-.7 25.5-2.1 25.5-2.1 12-1.4 10.6-19.1-1.4-18.4 0 0-36.1 2.8-59.4 2.8-4.2 0-9.1-.1-14.4-.3C109.6 73 178.1 33 256 33c58 0 110.9 22.2 150.6 58.5-1-.1-1.9-.2-2.9-.2-21.9 0-37.4 19.1-37.4 39.6 0 18.4 10.6 33.9 21.9 52.3 8.5 14.8 18.4 33.9 18.4 61.5 0 19.1-7.3 41.2-17 72.1l-22.2 74.3-80.7-239.6zm81.4 297.2l68.1-196.9c12.7-31.8 17-57.2 17-79.9 0-8.2-.5-15.8-1.5-22.9 17.4 31.8 27.3 68.2 27.3 107 0 82.3-44.6 154.1-110.9 192.7z"],
"wpbeginner": [512, 512, [], "f297", "M462.799 322.374C519.01 386.682 466.961 480 370.944 480c-39.602 0-78.824-17.687-100.142-50.04-6.887.356-22.702.356-29.59 0C219.848 462.381 180.588 480 141.069 480c-95.49 0-148.348-92.996-91.855-157.626C-29.925 190.523 80.479 32 256.006 32c175.632 0 285.87 158.626 206.793 290.374zm-339.647-82.972h41.529v-58.075h-41.529v58.075zm217.18 86.072v-23.839c-60.506 20.915-132.355 9.198-187.589-33.971l.246 24.897c51.101 46.367 131.746 57.875 187.343 32.913zm-150.753-86.072h166.058v-58.075H189.579v58.075z"],
"wpexplorer": [512, 512, [], "f2de", "M512 256c0 141.2-114.7 256-256 256C114.8 512 0 397.3 0 256S114.7 0 256 0s256 114.7 256 256zm-32 0c0-123.2-100.3-224-224-224C132.5 32 32 132.5 32 256s100.5 224 224 224 224-100.5 224-224zM160.9 124.6l86.9 37.1-37.1 86.9-86.9-37.1 37.1-86.9zm110 169.1l46.6 94h-14.6l-50-100-48.9 100h-14l51.1-106.9-22.3-9.4 6-14 68.6 29.1-6 14.3-16.5-7.1zm-11.8-116.3l68.6 29.4-29.4 68.3L230 246l29.1-68.6zm80.3 42.9l54.6 23.1-23.4 54.3-54.3-23.1 23.1-54.3z"],
"wpforms": [448, 512, [], "f298", "M448 75.2v361.7c0 24.3-19 43.2-43.2 43.2H43.2C19.3 480 0 461.4 0 436.8V75.2C0 51.1 18.8 32 43.2 32h361.7c24 0 43.1 18.8 43.1 43.2zm-37.3 361.6V75.2c0-3-2.6-5.8-5.8-5.8h-9.3L285.3 144 224 94.1 162.8 144 52.5 69.3h-9.3c-3.2 0-5.8 2.8-5.8 5.8v361.7c0 3 2.6 5.8 5.8 5.8h361.7c3.2.1 5.8-2.7 5.8-5.8zM150.2 186v37H76.7v-37h73.5zm0 74.4v37.3H76.7v-37.3h73.5zm11.1-147.3l54-43.7H96.8l64.5 43.7zm210 72.9v37h-196v-37h196zm0 74.4v37.3h-196v-37.3h196zm-84.6-147.3l64.5-43.7H232.8l53.9 43.7zM371.3 335v37.3h-99.4V335h99.4z"],
"wpressr": [496, 512, [], "f3e4", "M248 8C111.03 8 0 119.03 0 256s111.03 248 248 248 248-111.03 248-248S384.97 8 248 8zm171.33 158.6c-15.18 34.51-30.37 69.02-45.63 103.5-2.44 5.51-6.89 8.24-12.97 8.24-23.02-.01-46.03.06-69.05-.05-5.12-.03-8.25 1.89-10.34 6.72-10.19 23.56-20.63 47-30.95 70.5-1.54 3.51-4.06 5.29-7.92 5.29-45.94-.01-91.87-.02-137.81 0-3.13 0-5.63-1.15-7.72-3.45-11.21-12.33-22.46-24.63-33.68-36.94-2.69-2.95-2.79-6.18-1.21-9.73 8.66-19.54 17.27-39.1 25.89-58.66 12.93-29.35 25.89-58.69 38.75-88.08 1.7-3.88 4.28-5.68 8.54-5.65 14.24.1 28.48.02 42.72.05 6.24.01 9.2 4.84 6.66 10.59-13.6 30.77-27.17 61.55-40.74 92.33-5.72 12.99-11.42 25.99-17.09 39-3.91 8.95 7.08 11.97 10.95 5.6.23-.37-1.42 4.18 30.01-67.69 1.36-3.1 3.41-4.4 6.77-4.39 15.21.08 30.43.02 45.64.04 5.56.01 7.91 3.64 5.66 8.75-8.33 18.96-16.71 37.9-24.98 56.89-4.98 11.43 8.08 12.49 11.28 5.33.04-.08 27.89-63.33 32.19-73.16 2.02-4.61 5.44-6.51 10.35-6.5 26.43.05 52.86 0 79.29.05 12.44.02 13.93-13.65 3.9-13.64-25.26.03-50.52.02-75.78.02-6.27 0-7.84-2.47-5.27-8.27 5.78-13.06 11.59-26.11 17.3-39.21 1.73-3.96 4.52-5.79 8.84-5.78 23.09.06 25.98.02 130.78.03 6.08-.01 8.03 2.79 5.62 8.27z"],
"xbox": [512, 512, [], "f412", "M369.9 318.2c44.3 54.3 64.7 98.8 54.4 118.7-7.9 15.1-56.7 44.6-92.6 55.9-29.6 9.3-68.4 13.3-100.4 10.2-38.2-3.7-76.9-17.4-110.1-39C93.3 445.8 87 438.3 87 423.4c0-29.9 32.9-82.3 89.2-142.1 32-33.9 76.5-73.7 81.4-72.6 9.4 2.1 84.3 75.1 112.3 109.5zM188.6 143.8c-29.7-26.9-58.1-53.9-86.4-63.4-15.2-5.1-16.3-4.8-28.7 8.1-29.2 30.4-53.5 79.7-60.3 122.4-5.4 34.2-6.1 43.8-4.2 60.5 5.6 50.5 17.3 85.4 40.5 120.9 9.5 14.6 12.1 17.3 9.3 9.9-4.2-11-.3-37.5 9.5-64 14.3-39 53.9-112.9 120.3-194.4zm311.6 63.5C483.3 127.3 432.7 77 425.6 77c-7.3 0-24.2 6.5-36 13.9-23.3 14.5-41 31.4-64.3 52.8C367.7 197 427.5 283.1 448.2 346c6.8 20.7 9.7 41.1 7.4 52.3-1.7 8.5-1.7 8.5 1.4 4.6 6.1-7.7 19.9-31.3 25.4-43.5 7.4-16.2 15-40.2 18.6-58.7 4.3-22.5 3.9-70.8-.8-93.4zM141.3 43C189 40.5 251 77.5 255.6 78.4c.7.1 10.4-4.2 21.6-9.7 63.9-31.1 94-25.8 107.4-25.2-63.9-39.3-152.7-50-233.9-11.7-23.4 11.1-24 11.9-9.4 11.2z"],
"xing": [384, 512, [], "f168", "M162.7 210c-1.8 3.3-25.2 44.4-70.1 123.5-4.9 8.3-10.8 12.5-17.7 12.5H9.8c-7.7 0-12.1-7.5-8.5-14.4l69-121.3c.2 0 .2-.1 0-.3l-43.9-75.6c-4.3-7.8.3-14.1 8.5-14.1H100c7.3 0 13.3 4.1 18 12.2l44.7 77.5zM382.6 46.1l-144 253v.3L330.2 466c3.9 7.1.2 14.1-8.5 14.1h-65.2c-7.6 0-13.6-4-18-12.2l-92.4-168.5c3.3-5.8 51.5-90.8 144.8-255.2 4.6-8.1 10.4-12.2 17.5-12.2h65.7c8 0 12.3 6.7 8.5 14.1z"],
"xing-square": [448, 512, [], "f169", "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM140.4 320.2H93.8c-5.5 0-8.7-5.3-6-10.3l49.3-86.7c.1 0 .1-.1 0-.2l-31.4-54c-3-5.6.2-10.1 6-10.1h46.6c5.2 0 9.5 2.9 12.9 8.7l31.9 55.3c-1.3 2.3-18 31.7-50.1 88.2-3.5 6.2-7.7 9.1-12.6 9.1zm219.7-214.1L257.3 286.8v.2l65.5 119c2.8 5.1.1 10.1-6 10.1h-46.6c-5.5 0-9.7-2.9-12.9-8.7l-66-120.3c2.3-4.1 36.8-64.9 103.4-182.3 3.3-5.8 7.4-8.7 12.5-8.7h46.9c5.7-.1 8.8 4.7 6 10z"],
"y-combinator": [448, 512, [], "f23b", "M448 32v448H0V32h448zM236 287.5L313.5 142h-32.7L235 233c-4.7 9.3-9 18.3-12.8 26.8L210 233l-45.2-91h-35l76.7 143.8v94.5H236v-92.8z"],
"yahoo": [448, 512, [], "f19e", "M252 292l4 220c-12.7-2.2-23.5-3.9-32.3-3.9-8.4 0-19.2 1.7-32.3 3.9l4-220C140.4 197.2 85 95.2 21.4 0c11.9 3.1 23 3.9 33.2 3.9 9 0 20.4-.8 34.1-3.9 40.9 72.2 82.1 138.7 135 225.5C261 163.9 314.8 81.4 358.6 0c11.1 2.9 22 3.9 32.9 3.9 11.5 0 23.2-1 35-3.9C392.1 47.9 294.9 216.9 252 292z"],
"yammer": [512, 512, [], "f840", "M421.78 152.17A23.06 23.06 0 0 0 400.9 112c-.83.43-1.71.9-2.63 1.4-15.25 8.4-118.33 80.62-106.69 88.77s82.04-23.61 130.2-50zm0 217.17c-48.16-26.38-118.64-58.1-130.2-50s91.42 80.35 106.69 88.74c.92.51 1.8 1 2.63 1.41a23.07 23.07 0 0 0 20.88-40.15zM464.21 237c-.95 0-1.95-.06-3-.06-17.4 0-142.52 13.76-136.24 26.51s83.3 18.74 138.21 18.76a23 23 0 0 0 1-45.21zM31 96.65a24.88 24.88 0 0 1 46.14-18.4l81 205.06h1.21l77-203.53a23.52 23.52 0 0 1 44.45 15.27L171.2 368.44C152.65 415.66 134.08 448 77.91 448a139.67 139.67 0 0 1-23.81-1.95 21.31 21.31 0 0 1 6.9-41.77c.66.06 10.91.66 13.86.66 30.47 0 43.74-18.94 58.07-59.41z"],
"yandex": [256, 512, [], "f413", "M153.1 315.8L65.7 512H2l96-209.8c-45.1-22.9-75.2-64.4-75.2-141.1C22.7 53.7 90.8 0 171.7 0H254v512h-55.1V315.8h-45.8zm45.8-269.3h-29.4c-44.4 0-87.4 29.4-87.4 114.6 0 82.3 39.4 108.8 87.4 108.8h29.4V46.5z"],
"yandex-international": [320, 512, [], "f414", "M129.5 512V345.9L18.5 48h55.8l81.8 229.7L250.2 0h51.3L180.8 347.8V512h-51.3z"],
"yarn": [496, 512, [], "f7e3", "M393.9 345.2c-39 9.3-48.4 32.1-104 47.4 0 0-2.7 4-10.4 5.8-13.4 3.3-63.9 6-68.5 6.1-12.4.1-19.9-3.2-22-8.2-6.4-15.3 9.2-22 9.2-22-8.1-5-9-9.9-9.8-8.1-2.4 5.8-3.6 20.1-10.1 26.5-8.8 8.9-25.5 5.9-35.3.8-10.8-5.7.8-19.2.8-19.2s-5.8 3.4-10.5-3.6c-6-9.3-17.1-37.3 11.5-62-1.3-10.1-4.6-53.7 40.6-85.6 0 0-20.6-22.8-12.9-43.3 5-13.4 7-13.3 8.6-13.9 5.7-2.2 11.3-4.6 15.4-9.1 20.6-22.2 46.8-18 46.8-18s12.4-37.8 23.9-30.4c3.5 2.3 16.3 30.6 16.3 30.6s13.6-7.9 15.1-5c8.2 16 9.2 46.5 5.6 65.1-6.1 30.6-21.4 47.1-27.6 57.5-1.4 2.4 16.5 10 27.8 41.3 10.4 28.6 1.1 52.7 2.8 55.3.8 1.4 13.7.8 36.4-13.2 12.8-7.9 28.1-16.9 45.4-17 16.7-.5 17.6 19.2 4.9 22.2zM496 256c0 136.9-111.1 248-248 248S0 392.9 0 256 111.1 8 248 8s248 111.1 248 248zm-79.3 75.2c-1.7-13.6-13.2-23-28-22.8-22 .3-40.5 11.7-52.8 19.2-4.8 3-8.9 5.2-12.4 6.8 3.1-44.5-22.5-73.1-28.7-79.4 7.8-11.3 18.4-27.8 23.4-53.2 4.3-21.7 3-55.5-6.9-74.5-1.6-3.1-7.4-11.2-21-7.4-9.7-20-13-22.1-15.6-23.8-1.1-.7-23.6-16.4-41.4 28-12.2.9-31.3 5.3-47.5 22.8-2 2.2-5.9 3.8-10.1 5.4h.1c-8.4 3-12.3 9.9-16.9 22.3-6.5 17.4.2 34.6 6.8 45.7-17.8 15.9-37 39.8-35.7 82.5-34 36-11.8 73-5.6 79.6-1.6 11.1 3.7 19.4 12 23.8 12.6 6.7 30.3 9.6 43.9 2.8 4.9 5.2 13.8 10.1 30 10.1 6.8 0 58-2.9 72.6-6.5 6.8-1.6 11.5-4.5 14.6-7.1 9.8-3.1 36.8-12.3 62.2-28.7 18-11.7 24.2-14.2 37.6-17.4 12.9-3.2 21-15.1 19.4-28.2z"],
"yelp": [384, 512, [], "f1e9", "M42.9 240.32l99.62 48.61c19.2 9.4 16.2 37.51-4.5 42.71L30.5 358.45a22.79 22.79 0 0 1-28.21-19.6 197.16 197.16 0 0 1 9-85.32 22.8 22.8 0 0 1 31.61-13.21zm44 239.25a199.45 199.45 0 0 0 79.42 32.11A22.78 22.78 0 0 0 192.94 490l3.9-110.82c.7-21.3-25.5-31.91-39.81-16.1l-74.21 82.4a22.82 22.82 0 0 0 4.09 34.09zm145.34-109.92l58.81 94a22.93 22.93 0 0 0 34 5.5 198.36 198.36 0 0 0 52.71-67.61A23 23 0 0 0 364.17 370l-105.42-34.26c-20.31-6.5-37.81 15.8-26.51 33.91zm148.33-132.23a197.44 197.44 0 0 0-50.41-69.31 22.85 22.85 0 0 0-34 4.4l-62 91.92c-11.9 17.7 4.7 40.61 25.2 34.71L366 268.63a23 23 0 0 0 14.61-31.21zM62.11 30.18a22.86 22.86 0 0 0-9.9 32l104.12 180.44c11.7 20.2 42.61 11.9 42.61-11.4V22.88a22.67 22.67 0 0 0-24.5-22.8 320.37 320.37 0 0 0-112.33 30.1z"],
"yoast": [448, 512, [], "f2b1", "M91.3 76h186l-7 18.9h-179c-39.7 0-71.9 31.6-71.9 70.3v205.4c0 35.4 24.9 70.3 84 70.3V460H91.3C41.2 460 0 419.8 0 370.5V165.2C0 115.9 40.7 76 91.3 76zm229.1-56h66.5C243.1 398.1 241.2 418.9 202.2 459.3c-20.8 21.6-49.3 31.7-78.3 32.7v-51.1c49.2-7.7 64.6-49.9 64.6-75.3 0-20.1.6-12.6-82.1-223.2h61.4L218.2 299 320.4 20zM448 161.5V460H234c6.6-9.6 10.7-16.3 12.1-19.4h182.5V161.5c0-32.5-17.1-51.9-48.2-62.9l6.7-17.6c41.7 13.6 60.9 43.1 60.9 80.5z"],
"youtube": [576, 512, [], "f167", "M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"],
"youtube-square": [448, 512, [], "f431", "M186.8 202.1l95.2 54.1-95.2 54.1V202.1zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-42 176.3s0-59.6-7.6-88.2c-4.2-15.8-16.5-28.2-32.2-32.4C337.9 128 224 128 224 128s-113.9 0-142.2 7.7c-15.7 4.2-28 16.6-32.2 32.4-7.6 28.5-7.6 88.2-7.6 88.2s0 59.6 7.6 88.2c4.2 15.8 16.5 27.7 32.2 31.9C110.1 384 224 384 224 384s113.9 0 142.2-7.7c15.7-4.2 28-16.1 32.2-31.9 7.6-28.5 7.6-88.1 7.6-88.1z"],
"zhihu": [640, 512, [], "f63f", "M170.54 148.13v217.54l23.43.01 7.71 26.37 42.01-26.37h49.53V148.13H170.54zm97.75 193.93h-27.94l-27.9 17.51-5.08-17.47-11.9-.04V171.75h72.82v170.31zm-118.46-94.39H97.5c1.74-27.1 2.2-51.59 2.2-73.46h51.16s1.97-22.56-8.58-22.31h-88.5c3.49-13.12 7.87-26.66 13.12-40.67 0 0-24.07 0-32.27 21.57-3.39 8.9-13.21 43.14-30.7 78.12 5.89-.64 25.37-1.18 36.84-22.21 2.11-5.89 2.51-6.66 5.14-14.53h28.87c0 10.5-1.2 66.88-1.68 73.44H20.83c-11.74 0-15.56 23.62-15.56 23.62h65.58C66.45 321.1 42.83 363.12 0 396.34c20.49 5.85 40.91-.93 51-9.9 0 0 22.98-20.9 35.59-69.25l53.96 64.94s7.91-26.89-1.24-39.99c-7.58-8.92-28.06-33.06-36.79-41.81L87.9 311.95c4.36-13.98 6.99-27.55 7.87-40.67h61.65s-.09-23.62-7.59-23.62v.01zm412.02-1.6c20.83-25.64 44.98-58.57 44.98-58.57s-18.65-14.8-27.38-4.06c-6 8.15-36.83 48.2-36.83 48.2l19.23 14.43zm-150.09-59.09c-9.01-8.25-25.91 2.13-25.91 2.13s39.52 55.04 41.12 57.45l19.46-13.73s-25.67-37.61-34.66-45.86h-.01zM640 258.35c-19.78 0-130.91.93-131.06.93v-101c4.81 0 12.42-.4 22.85-1.2 40.88-2.41 70.13-4 87.77-4.81 0 0 12.22-27.19-.59-33.44-3.07-1.18-23.17 4.58-23.17 4.58s-165.22 16.49-232.36 18.05c1.6 8.82 7.62 17.08 15.78 19.55 13.31 3.48 22.69 1.7 49.15.89 24.83-1.6 43.68-2.43 56.51-2.43v99.81H351.41s2.82 22.31 25.51 22.85h107.94v70.92c0 13.97-11.19 21.99-24.48 21.12-14.08.11-26.08-1.15-41.69-1.81 1.99 3.97 6.33 14.39 19.31 21.84 9.88 4.81 16.17 6.57 26.02 6.57 29.56 0 45.67-17.28 44.89-45.31v-73.32h122.36c9.68 0 8.7-23.78 8.7-23.78l.03-.01z"]
};
bunker(function () {
defineIcons('fab', icons);
});
}());
|
Emotion/Emotion.React-Native/Start/AzureEmotions/index.js | mkmann/techdays-hackathon | import React, { Component } from 'react';
import {AppRegistry, View, Text, StyleSheet } from 'react-native';
import Camera from 'react-native-camera'; //Camera component
import RNFetchBlob from 'react-native-fetch-blob'; //Library for fetching local files and sending bianry data
//variables for switching between back and fron camera
const cameraTypes = {
front: Camera.constants.Type.front,
back: Camera.constants.Type.back
};
export default class App extends Component {
constructor() {
super();
}
//Render return the UI
render() {
return(
<View style={styles.mainContainer}>
<Text>Hello World</Text>
</View>
);
}
}
const styles = StyleSheet.create({
mainContainer: {
flex: 1,
alignItems: 'center',
}
});
AppRegistry.registerComponent('AzureEmotions', () => App);
|
ajax/libs/mobx/4.3.1/mobx.umd.min.js | cdnjs/cdnjs | /** MobX - (c) Michel Weststrate 2015, 2016 - MIT Licensed */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.mobx=e()}}(function(){return function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var n=t[a][1][e];return o(n||e)},f,f.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){(function(e,t){"use strict";function r(e,t){function n(){this.constructor=e}un(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function i(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e}function a(e,t){var n=t?fn:ln;return n[e]||(n[e]={configurable:!0,enumerable:t,get:function(){return s(this),this[e]},set:function(t){s(this),this[e]=t}})}function s(e){if(!0!==e.__mobxDidRunLazyInitializers){var t=e.__mobxDecorators;if(t){Ke(e,"__mobxDidRunLazyInitializers",!0);for(var n in t){var r=t[n];r.propertyCreator(e,r.prop,r.descriptor,r.decoratorTarget,r.decoratorArguments)}}}}function u(e,t){return function(){var n,r=function(r,o,i,s){if(!0===s)return t(r,o,i,r,n),null;if(!Object.prototype.hasOwnProperty.call(r,"__mobxDecorators")){var u=r.__mobxDecorators;Ke(r,"__mobxDecorators",cn({},u))}return r.__mobxDecorators[o]={prop:o,propertyCreator:t,descriptor:i,decoratorTarget:r,decoratorArguments:n},a(o,e)};return c(arguments)?(n=Xn,r.apply(null,arguments)):(n=Array.prototype.slice.call(arguments),r)}}function c(e){return(2===e.length||3===e.length)&&"string"==typeof e[1]||4===e.length&&!0===e[3]}function f(){return!!tr.spyListeners.length}function l(e){if(tr.spyListeners.length)for(var t=tr.spyListeners,n=0,r=t.length;n<r;n++)t[n](e)}function p(e){l(cn({},e,{spyReportStart:!0}))}function h(e){l(e?cn({},e,{spyReportEnd:!0}):pn)}function d(e){return tr.spyListeners.push(e),$e(function(){tr.spyListeners=tr.spyListeners.filter(function(t){return t!==e})})}function v(e,t){var n=function(){return y(e,t,this,arguments)};return n.isMobxAction=!0,n}function y(e,t,n,r){var o=b(e,t,n,r);try{return t.apply(n,r)}finally{m(o)}}function b(e,t,n,r){var o=f()&&!!e,i=0;if(o){i=Date.now();var a=r&&r.length||0,s=new Array(a);if(a>0)for(var u=0;u<a;u++)s[u]=r[u];p({type:"action",name:e,object:n,arguments:s})}var c=Dt();return pt(),{prevDerivation:c,prevAllowStateChanges:w(!0),notifySpy:o,startTime:i}}function m(e){O(e.prevAllowStateChanges),ht(),jt(e.prevDerivation),e.notifySpy&&h({time:Date.now()-e.startTime})}function g(e,t){var n,r=w(e);try{n=t()}finally{O(r)}return n}function w(e){var t=tr.allowStateChanges;return tr.allowStateChanges=e,t}function O(e){tr.allowStateChanges=e}function _(){Re(!1)}function S(e){return function(t,n,r){if(r){if(r.value)return{value:v(e,r.value),enumerable:!1,configurable:!0,writable:!0};var o=r.initializer;return{enumerable:!1,configurable:!0,writable:!0,initializer:function(){return v(e,o.call(this))}}}return x(e).apply(this,arguments)}}function x(e){return function(t,n,r){Object.defineProperty(t,n,{configurable:!0,enumerable:!1,get:function(){},set:function(t){Ke(this,n,hn(e,t))}})}}function A(e,t,n,r){return!0===r?(D(e,t,n.value),null):n?{configurable:!0,enumerable:!1,get:function(){return D(this,t,n.value||n.initializer.call(this)),this[t]},set:_}:{enumerable:!1,configurable:!0,set:function(e){D(this,t,e)},get:function(){}}}function E(e,t){var n="string"==typeof e?e:e.name||"<unnamed action>",r="function"==typeof e?e:t;return y(n,r,this,void 0)}function T(e){return"function"==typeof e&&!0===e.isMobxAction}function D(e,t,n){Ke(e,t,v(t,n.bind(e)))}function j(e,t){return I(e,t)}function I(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!==e)return t!==t;var o=typeof e;return("function"===o||"object"===o||"object"==typeof t)&&k(e,t,n,r)}function k(e,t,n,r){e=V(e),t=V(t);var o=dn.call(e);if(o!==dn.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t)}var i="[object Array]"===o;if(!i){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,s=t.constructor;if(a!==s&&!("function"==typeof a&&a instanceof a&&"function"==typeof s&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}n=n||[],r=r||[];for(var u=n.length;u--;)if(n[u]===e)return r[u]===t;if(n.push(e),r.push(t),i){if((u=e.length)!==t.length)return!1;for(;u--;)if(!I(e[u],t[u],n,r))return!1}else{var c,f=Object.keys(e);if(u=f.length,Object.keys(t).length!==u)return!1;for(;u--;)if(c=f[u],!L(t,c)||!I(e[c],t[c],n,r))return!1}return n.pop(),r.pop(),!0}function V(e){return Le(e)?e.peek():Ye(e)||Un(e)?Fe(e.entries()):e}function L(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e,t){return e===t}function P(e,t){return j(e,t)}function R(e,t){return He(e,t)||C(e,t)}function N(e,t){function n(){e(r)}void 0===t&&(t=Fn);var r,o=t&&t.name||e.name||"Autorun@"+Pe(),i=!t.scheduler&&!t.delay;if(i)r=new ar(o,function(){this.track(n)},t.onError);else{var a=B(t),s=!1;r=new ar(o,function(){s||(s=!0,a(function(){s=!1,r.isDisposed||r.track(n)}))},t.onError)}return r.schedule(),r.getDisposer()}function B(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:yn}function $(e,t,n){function r(){if(f=!1,!p.isDisposed){var t=!1;p.track(function(){var n=e(p);t=c||!l(o,n),o=n}),c&&n.fireImmediately&&a(o,p),c||!0!==t||a(o,p),c&&(c=!1)}}void 0===n&&(n=Fn),"boolean"==typeof n&&(n={fireImmediately:n},Be("Using fireImmediately as argument is deprecated. Use '{ fireImmediately: true }' instead"));var o,i=n.name||"Reaction@"+Pe(),a=hn(i,n.onError?M(n.onError,t):t),s=!n.scheduler&&!n.delay,u=B(n),c=!0,f=!1,l=n.compareStructural?vn.structural:n.equals||vn.default,p=new ar(i,function(){c||s?r():f||(f=!0,u(r))},n.onError);return p.schedule(),p.getDisposer()}function M(e,t){return function(){try{return t.apply(this,arguments)}catch(t){e.call(this,t)}}}function U(e){return void 0!==e.interceptors&&e.interceptors.length>0}function G(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),$e(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function K(e,t){var n=Dt();try{var r=e.interceptors;if(r)for(var o=0,i=r.length;o<i&&(t=r[o](t),Ne(!t||t.type,"Intercept handlers should return nothing or a change object"),t);o++);return t}finally{jt(n)}}function W(e){return void 0!==e.changeListeners&&e.changeListeners.length>0}function q(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),$e(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function z(e,t){var n=Dt(),r=e.changeListeners;if(r){r=r.slice();for(var o=0,i=r.length;o<i;o++)r[o](t);jt(n)}}function H(e,t,n){void 0===t&&(t=""),void 0===n&&(n=de);var r=e.$mobx;return r||(Ge(e)||(t=(e.constructor.name||"ObservableObject")+"@"+Pe()),t||(t="ObservableObject@"+Pe()),r=new _n(e,t,n),We(e,"$mobx",r),r)}function J(e,t,n,r){var o=H(e);if(qe(e,t),U(o)){var i=K(o,{object:e,name:t,type:"add",newValue:n});if(!i)return;n=i.newValue}n=(o.values[t]=new wn(n,r,o.name+"."+t,!1)).value,Object.defineProperty(e,t,X(t)),o.keys&&o.keys.push(t),Z(o,e,t,n)}function Y(e,t,n){var r=H(e);n.name=r.name+"."+t,n.context=e,r.values[t]=new bn(n),Object.defineProperty(e,t,Q(t))}function X(e){return Sn[e]||(Sn[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.read(this,e)},set:function(t){this.$mobx.write(this,e,t)}})}function F(e){var t=e.$mobx;return t||(s(e),e.$mobx)}function Q(e){return xn[e]||(xn[e]={configurable:!0,enumerable:!1,get:function(){return F(this).read(this,e)},set:function(t){F(this).write(this,e,t)}})}function Z(e,t,n,r){var o=W(e),i=f(),a=o||i?{type:"add",object:t,name:n,newValue:r}:null;i&&p(cn({},a,{name:e.name,key:n})),o&&z(e,a),i&&h()}function ee(e){return!!Ue(e)&&(s(e),An(e.$mobx))}function te(t){var n=u(!0,function(e,n,r,o,i){J(e,n,r?r.initializer?r.initializer.call(e):r.value:void 0,t)}),r=(void 0!==e&&e.env,n);return r.enhancer=t,r}function ne(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(ee(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return ee(e)||!!e.$mobx||Mn(e)||cr(e)||mn(e)}function re(e){return 1!==arguments.length&&Re(!1),ne(e)}function oe(e,t){return"string"!=typeof t?Re(!1):ne(e,t)}function ie(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(!1===ee(e))return!1;if(!e.$mobx.values[t])return!1;var n=Se(e,t);return mn(n)}return mn(e)}function ae(e){return arguments.length>1?Re(!1):ie(e)}function se(e,t){return"string"!=typeof t?Re(!1):ie(e,t)}function ue(e,t,n){return Be("'extendShallowObservable' is deprecated, use 'extendObservable(target, props, { deep: false })' instead"),ce(e,t,n,In)}function ce(e,t,n,r){var o;r=fe(r);var i=r.defaultDecorator||(!1===r.deep?Ln:kn);H(e,r.name,i.enhancer),pt();try{for(var o in t){var a=Object.getOwnPropertyDescriptor(t,o),s=n&&o in n?n[o]:a.get?En:i,u=s(e,o,a,!0);u&&Object.defineProperty(e,o,u)}}finally{ht()}return e}function fe(e){return null===e||void 0===e?jn:"string"==typeof e?{name:e,deep:!0}:e}function le(e){return e.defaultDecorator?e.defaultDecorator.enhancer:!1===e.deep?ye:de}function pe(e,t,n){if("string"==typeof arguments[1])return kn.apply(null,arguments);if(re(e))return e;var r=Ge(e)?Rn.object(e,t,n):Array.isArray(e)?Rn.array(e,t):Ye(e)?Rn.map(e,t):e;if(r!==e)return r;Re(!1)}function he(e){Re("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function de(e,t,n){return re(e)?e:Array.isArray(e)?Rn.array(e,{name:n}):Ge(e)?Rn.object(e,void 0,{name:n}):Ye(e)?Rn.map(e,{name:n}):e}function ve(e,t,n){return void 0===e||null===e?e:ee(e)||Le(e)||Un(e)?e:Array.isArray(e)?Rn.array(e,{name:n,deep:!1}):Ge(e)?Rn.object(e,void 0,{name:n,deep:!1}):Ye(e)?Rn.map(e,{name:n,deep:!1}):Re(!1)}function ye(e){return e}function be(e,t,n){return j(e,t)?t:e}function me(){return"function"==typeof Symbol&&Symbol.iterator||"@@iterator"}function ge(e,t){We(e,me(),t)}function we(e){return e[me()]=Oe,e}function Oe(){return this}function _e(e,t){void 0===t&&(t=void 0),pt();try{return e.apply(t)}finally{ht()}}function Se(e,t){if("object"==typeof e&&null!==e){if(Le(e))return void 0!==t&&Re(!1),e.$mobx.atom;if(Un(e)){var n=e;if(void 0===t)return Se(n._keys);var r=n._data.get(t)||n._hasMap.get(t);return r||Re(!1),r}if(s(e),t&&!e.$mobx&&e[t],ee(e)){if(!t)return Re(!1);var r=e.$mobx.values[t];return r||Re(!1),r}if(Mn(e)||mn(e)||cr(e))return e}else if("function"==typeof e&&cr(e.$mobx))return e.$mobx;return Re(!1)}function xe(e,t){return e||Re("Expecting some object"),void 0!==t?xe(Se(e,t)):Mn(e)||mn(e)||cr(e)?e:Un(e)?e:(s(e),e.$mobx?e.$mobx:void Re(!1))}function Ae(e,t){var n;return n=void 0!==t?Se(e,t):ee(e)||Un(e)?xe(e):Se(e),n.name}function Ee(e,t,n){return De("onBecomeObserved",e,t,n)}function Te(e,t,n){return De("onBecomeUnobserved",e,t,n)}function De(e,t,n,r){var o="string"==typeof n?Se(t,n):Se(t),i="string"==typeof n?r:n,a=o[e];return"function"!=typeof a?Re(!1):(o[e]=function(){a.call(this),i.call(this)},function(){o[e]=a})}function je(e,t,n){void 0===t&&(t=Qn),void 0===n&&(n=Qn);var r=new $n(e);return Ee(r,t),Te(r,n),r}function Ie(e){return{enumerable:!1,configurable:!1,get:function(){return this.get(e)},set:function(t){this.set(e,t)}}}function ke(e){Object.defineProperty(zn.prototype,""+e,Ie(e))}function Ve(e){for(var t=Kn;t<e;t++)ke(t);Kn=e}function Le(e){return Ue(e)&&Jn(e.$mobx)}function Ce(){return"undefined"!=typeof window?window:t}function Pe(){return++tr.mobxGuid}function Re(e){throw Ne(!1,e),"X"}function Ne(e,t){if(!e)throw new Error("[mobx] "+(t||Yn))}function Be(e,t){return!1}function $e(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function Me(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function Ue(e){return null!==e&&"object"==typeof e}function Ge(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Ke(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function We(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function qe(e,t){}function ze(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return Ue(e)&&!0===e[n]}}function He(e,t){return"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}function Je(e){return Array.isArray(e)||Le(e)}function Ye(e){return void 0!==Ce().Map&&e instanceof Ce().Map}function Xe(e){return Ge(e)?Object.keys(e):Array.isArray(e)?e.map(function(e){return o(e,1)[0]}):Ye(e)||Un(e)?Fe(e.keys()):Re("Cannot get keys from '"+e+"'")}function Fe(e){for(var t=[];;){var n=e.next();if(n.done)break;t.push(n.value)}return t}function Qe(){return"function"==typeof Symbol&&Symbol.toPrimitive||"@@toPrimitive"}function Ze(e){return null===e?null:"object"==typeof e?""+e:e}function et(){nr=!0,Ce().__mobxInstanceCount--}function tt(){return tr}function nt(){var e=new er;for(var t in e)-1===Zn.indexOf(t)&&(tr[t]=e[t]);tr.allowStateChanges=!tr.enforceActions}function rt(e,t){return ot(Se(e,t))}function ot(e){var t={name:e.name};return e.observing&&e.observing.length>0&&(t.dependencies=Me(e.observing).map(ot)),t}function it(e,t){return at(Se(e,t))}function at(e){var t={name:e.name};return st(e)&&(t.observers=ut(e).map(at)),t}function st(e){return e.observers&&e.observers.length>0}function ut(e){return e.observers}function ct(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function ft(e,t){if(1===e.observers.length)e.observers.length=0,lt(e);else{var n=e.observers,r=e.observersIndexes,o=n.pop();if(o!==t){var i=r[t.__mapid]||0;i?r[o.__mapid]=i:delete r[o.__mapid],n[i]=o}delete r[t.__mapid]}}function lt(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,tr.pendingUnobservations.push(e))}function pt(){tr.inBatch++}function ht(){if(0==--tr.inBatch){Ct();for(var e=tr.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,0===n.observers.length&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBecomeUnobserved()),n instanceof bn&&n.suspend())}tr.pendingUnobservations=[]}}function dt(e){var t=tr.trackingDerivation;return null!==t?(t.runId!==e.lastAccessedBy&&(e.lastAccessedBy=t.runId,t.newObserving[t.unboundDepsCount++]=e,e.isBeingObserved||(e.isBeingObserved=!0,e.onBecomeObserved())),!0):(0===e.observers.length&&tr.inBatch>0&<(e),!1)}function vt(e){if(e.lowestObserverState!==n.IDerivationState.STALE){e.lowestObserverState=n.IDerivationState.STALE;for(var t=e.observers,r=t.length;r--;){var o=t[r];o.dependenciesState===n.IDerivationState.UP_TO_DATE&&(o.isTracing!==or.NONE&&mt(o,e),o.onBecomeStale()),o.dependenciesState=n.IDerivationState.STALE}}}function yt(e){if(e.lowestObserverState!==n.IDerivationState.STALE){e.lowestObserverState=n.IDerivationState.STALE;for(var t=e.observers,r=t.length;r--;){var o=t[r];o.dependenciesState===n.IDerivationState.POSSIBLY_STALE?o.dependenciesState=n.IDerivationState.STALE:o.dependenciesState===n.IDerivationState.UP_TO_DATE&&(e.lowestObserverState=n.IDerivationState.UP_TO_DATE)}}}function bt(e){if(e.lowestObserverState===n.IDerivationState.UP_TO_DATE){e.lowestObserverState=n.IDerivationState.POSSIBLY_STALE;for(var t=e.observers,r=t.length;r--;){var o=t[r];o.dependenciesState===n.IDerivationState.UP_TO_DATE&&(o.dependenciesState=n.IDerivationState.POSSIBLY_STALE,o.isTracing!==or.NONE&&mt(o,e),o.onBecomeStale())}}}function mt(e,t){if(console.log("[mobx.trace] '"+e.name+"' is invalidated due to a change in: '"+t.name+"'"),e.isTracing===or.BREAK){var n=[];gt(rt(e),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof bn?e.derivation.toString():"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}function gt(e,t,n){if(t.length>=1e3)return void t.push("(and many more)");t.push(""+new Array(n).join("\t")+e.name),e.dependencies&&e.dependencies.forEach(function(e){return gt(e,t,n+1)})}function wt(e){return e instanceof ir}function Ot(e){switch(e.dependenciesState){case n.IDerivationState.UP_TO_DATE:return!1;case n.IDerivationState.NOT_TRACKING:case n.IDerivationState.STALE:return!0;case n.IDerivationState.POSSIBLY_STALE:for(var t=Dt(),r=e.observing,o=r.length,i=0;i<o;i++){var a=r[i];if(mn(a)){if(tr.disableErrorBoundaries)a.get();else try{a.get()}catch(e){return jt(t),!0}if(e.dependenciesState===n.IDerivationState.STALE)return jt(t),!0}}return It(e),jt(t),!1}}function _t(){return null!==tr.trackingDerivation}function St(e){var t=e.observers.length>0;tr.computationDepth>0&&t&&Re(!1),tr.allowStateChanges||!t&&"strict"!==tr.enforceActions||Re(!1)}function xt(e,t,n){It(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++tr.runId;var r=tr.trackingDerivation;tr.trackingDerivation=e;var o;if(!0===tr.disableErrorBoundaries)o=t.call(n);else try{o=t.call(n)}catch(e){o=new ir(e)}return tr.trackingDerivation=r,At(e),o}function At(e){for(var t=e.observing,r=e.observing=e.newObserving,o=n.IDerivationState.UP_TO_DATE,i=0,a=e.unboundDepsCount,s=0;s<a;s++){var u=r[s];0===u.diffValue&&(u.diffValue=1,i!==s&&(r[i]=u),i++),u.dependenciesState>o&&(o=u.dependenciesState)}for(r.length=i,e.newObserving=null,a=t.length;a--;){var u=t[a];0===u.diffValue&&ft(u,e),u.diffValue=0}for(;i--;){var u=r[i];1===u.diffValue&&(u.diffValue=0,ct(u,e))}o!==n.IDerivationState.UP_TO_DATE&&(e.dependenciesState=o,e.onBecomeStale())}function Et(e){var t=e.observing;e.observing=[];for(var r=t.length;r--;)ft(t[r],e);e.dependenciesState=n.IDerivationState.NOT_TRACKING}function Tt(e){var t=Dt(),n=e();return jt(t),n}function Dt(){var e=tr.trackingDerivation;return tr.trackingDerivation=null,e}function jt(e){tr.trackingDerivation=e}function It(e){if(e.dependenciesState!==n.IDerivationState.UP_TO_DATE){e.dependenciesState=n.IDerivationState.UP_TO_DATE;for(var t=e.observing,r=t.length;r--;)t[r].lowestObserverState=n.IDerivationState.UP_TO_DATE}}function kt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=!1;"boolean"==typeof e[e.length-1]&&(n=e.pop());var r=Vt(e);if(!r)return Re(!1);r.isTracing===or.NONE&&console.log("[mobx.trace] '"+r.name+"' tracing enabled"),r.isTracing=n?or.BREAK:or.LOG}function Vt(e){switch(e.length){case 0:return tr.trackingDerivation;case 1:return Se(e[0]);case 2:return Se(e[0],e[1])}}function Lt(e){return tr.globalReactionErrorHandlers.push(e),function(){var t=tr.globalReactionErrorHandlers.indexOf(e);t>=0&&tr.globalReactionErrorHandlers.splice(t,1)}}function Ct(){tr.inBatch>0||tr.isRunningReactions||ur(Pt)}function Pt(){tr.isRunningReactions=!0;for(var e=tr.pendingReactions,t=0;e.length>0;){++t===sr&&(console.error("Reaction doesn't converge to a stable state after "+sr+" iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,o=n.length;r<o;r++)n[r].runReaction()}tr.isRunningReactions=!1}function Rt(e){var t=ur;ur=function(n){return e(function(){return t(n)})}}function Nt(e,t,n,r){return"function"==typeof n?$t(e,t,n,r):Bt(e,t,n)}function Bt(e,t,n){return xe(e).observe(t,n)}function $t(e,t,n,r){return xe(e,t).observe(n,r)}function Mt(e,t,n){return"function"==typeof n?Gt(e,t,n):Ut(e,t)}function Ut(e,t){return xe(e).intercept(t)}function Gt(e,t,n){return xe(e,t).intercept(n)}function Kt(e,t,n){return 1===arguments.length||t&&"object"==typeof t?qt(e,t):Wt(e,t,n||{})}function Wt(e,t,n){var r;"number"==typeof n.timeout&&(r=setTimeout(function(){if(!i.$mobx.isDisposed){i();var e=new Error("WHEN_TIMEOUT");if(!n.onError)throw e;n.onError(e)}},n.timeout)),n.name=n.name||"When@"+Pe();var o=v(n.name+"-effect",t),i=N(function(t){e()&&(t.dispose(),r&&clearTimeout(r),o())},n);return i}function qt(e,t){var n,r=new Promise(function(r,o){var i=Wt(e,r,cn({},t,{onError:o}));n=function(){i(),o("WHEN_CANCELLED")}});return r.cancel=n,r}function zt(e){return ee(e)?e.$mobx.getKeys():Un(e)?e._keys.slice():Re(!1)}function Ht(e){return ee(e)?zt(e).map(function(t){return e[t]}):Un(e)?zt(e).map(function(t){return e.get(t)}):Le(e)?e.slice():Re(!1)}function Jt(e){return ee(e)?zt(e).map(function(t){return[t,e[t]]}):Un(e)?zt(e).map(function(t){return[t,e.get(t)]}):Le(e)?e.map(function(e,t){return[t,e]}):Re(!1)}function Yt(e,t,n){if(2!==arguments.length)if(ee(e)){var r=e.$mobx,o=r.values[t];o?r.write(e,t,n):J(e,t,n,r.defaultEnhancer)}else if(Un(e))e.set(t,n);else{if(!Le(e))return Re(!1);"number"!=typeof t&&(t=parseInt(t,10)),Ne(t>=0,"Not a valid index: '"+t+"'"),pt(),t>=e.length&&(e.length=t+1),e[t]=n,ht()}else{pt();var i=t;try{for(var a in i)Yt(e,a,i[a])}finally{ht()}}}function Xt(e,t){if(ee(e))e.$mobx.remove(t);else if(Un(e))e.delete(t);else{if(!Le(e))return Re(!1);"number"!=typeof t&&(t=parseInt(t,10)),Ne(t>=0,"Not a valid index: '"+t+"'"),e.splice(t,1)}}function Ft(e,t){if(ee(e)){var n=xe(e);return n.getKeys(),n.values[t]instanceof wn}return Un(e)?e.has(t):Le(e)?t>=0&&t<e.length:Re(!1)}function Qt(e,t){if(Ft(e,t))return ee(e)?e[t]:Un(e)?e.get(t):Le(e)?e[t]:Re(!1)}function Zt(e,t){var n="function"==typeof e?e.prototype:e;for(var r in t){var o=t[r],i=Object.getOwnPropertyDescriptor(n,r),a=o(n,r,i);a&&Object.defineProperty(n,r,a)}return e}function en(e){var t=e.enforceActions,n=e.computedRequiresReaction,r=e.disableErrorBoundaries,o=e.arrayBuffer,i=e.reactionScheduler;if(void 0!==t){if("boolean"!=typeof t&&"strict"!==t)return fail("Invalid configuration for 'enforceActions': "+t);tr.enforceActions=t,tr.allowStateChanges=!0!==t&&"strict"!==t}void 0!==n&&(tr.computedRequiresReaction=!!n),!0===e.isolateGlobalState&&et(),void 0!==r&&(!0===r&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors if this is on."),tr.disableErrorBoundaries=!!r),"number"==typeof o&&Ve(o),i&&Rt(i)}function tn(e){1!==arguments.length&&Re("Flow expects one 1 argument and cannot be used as decorator");var t=e.name||"<unnamed flow>";return function(){var n,r=this,o=arguments,i=++fr,a=hn(t+" - runid: "+i+" - init",e).apply(r,o),s=void 0,u=new Promise(function(e,r){function o(e){s=void 0;var n;try{n=hn(t+" - runid: "+i+" - yield "+f++,a.next).call(a,e)}catch(e){return r(e)}c(n)}function u(e){s=void 0;var n;try{n=hn(t+" - runid: "+i+" - yield "+f++,a.throw).call(a,e)}catch(e){return r(e)}c(n)}function c(t){return t&&"function"==typeof t.then?void t.then(c,r):t.done?e(t.value):(s=Promise.resolve(t.value),s.then(o,u))}var f=0;n=r,o(void 0)});return u.cancel=hn(t+" - runid: "+i+" - cancel",function(){try{s&&nn(s);var e=a.return(),t=Promise.resolve(e.value);t.then(Qn,Qn),nn(t),n(new Error("FLOW_CANCELLED"))}catch(e){n(e)}}),u}}function nn(e){"function"==typeof e.cancel&&e.cancel()}function rn(e,t,n,r){return r.detectCycles&&e.set(t,n),n}function on(e,t,n){if(!re(e))return e;if(!0===t.detectCycles&&null!==e&&"object"==typeof e&&n.has(e))return n.get(e);if(Le(e)){var r=rn(n,e,[],t),o=e.map(function(e){return on(e,t,n)});r.length=o.length;for(var i=0,a=o.length;i<a;i++)r[i]=o[i];return r}if(ee(e)){var r=rn(n,e,{},t);zt(e);for(var s in e)r[s]=on(e[s],t,n);return r}if(Un(e)){if(!1===t.exportMapsAsObjects){var u=rn(n,e,new Map,t);return e.forEach(function(e,r){u.set(r,on(e,t,n))}),u}var c=rn(n,e,{},t);return e.forEach(function(e,r){c[r]=on(e,t,n)}),c}return On(e)?on(e.get(),t,n):e}function an(e,t){if(!re(e))return e;"boolean"==typeof t&&(t={detectCycles:t}),t||(t=lr);var n,r=!0===t.detectCycles;return r&&(n=new Map),on(e,t,n)}function sn(e,t,n){var r;if(Un(e)||Le(e)||On(e))r=xe(e);else{if(!ee(e))return Re(!1);if("string"!=typeof t)return Re(!1);r=xe(e,t)}return void 0!==r.dehancer?Re(!1):(r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0})}Object.defineProperty(n,"__esModule",{value:!0});var un=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},cn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},fn={},ln={},pn={spyReportEnd:!0},hn=function(e,t,n,r){return 1===arguments.length&&"function"==typeof e?v(e.name||"<unnamed action>",e):2===arguments.length&&"function"==typeof t?v(e,t):1===arguments.length&&"string"==typeof e?S(e):!0!==r?S(t).apply(null,arguments):void(e[t]=v(e.name||t,n.value))};hn.bound=A;var dn=Object.prototype.toString,vn={identity:C,structural:P,default:R},yn=function(e){return e()},bn=function(){function e(e){var t=this;this.dependenciesState=n.IDerivationState.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isBeingObserved=!1,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=n.IDerivationState.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+Pe(),this.value=new ir(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=or.NONE,this.derivation=e.get,this.name=e.name||"ComputedValue@"+Pe(),e.set&&(this.setter=v(this.name+"-setter",e.set)),this.equals=e.equals||(e.compareStructural||e.struct?vn.structural:vn.default),this.scope=e.context,this.requiresReaction=!!e.requiresReaction,!0===e.keepAlive&&N(function(){return t.get()})}return e.prototype.onBecomeStale=function(){bt(this)},e.prototype.onBecomeUnobserved=function(){},e.prototype.onBecomeObserved=function(){},e.prototype.get=function(){this.isComputing&&Re("Cycle detected in computation "+this.name+": "+this.derivation),0===tr.inBatch&&0===this.observers.length?Ot(this)&&(this.warnAboutUntrackedRead(),pt(),this.value=this.computeValue(!1),ht()):(dt(this),Ot(this)&&this.trackAndCompute()&&yt(this));var e=this.value;if(wt(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(wt(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){Ne(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else Ne(!1,!1)},e.prototype.trackAndCompute=function(){f()&&l({object:this.scope,type:"compute",name:this.name});var e=this.value,t=this.dependenciesState===n.IDerivationState.NOT_TRACKING,r=this.computeValue(!0),o=t||wt(e)||wt(r)||!this.equals(e,r);return o&&(this.value=r),o},e.prototype.computeValue=function(e){this.isComputing=!0,tr.computationDepth++;var t;if(e)t=xt(this,this.derivation,this.scope);else if(!0===tr.disableErrorBoundaries)t=this.derivation.call(this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new ir(e)}return tr.computationDepth--,this.isComputing=!1,t},e.prototype.suspend=function(){Et(this),this.value=void 0},e.prototype.observe=function(e,t){var n=this,r=!0,o=void 0;return N(function(){var i=n.get();if(!r||t){var a=Dt();e({type:"update",object:n,newValue:i,oldValue:o}),jt(a)}r=!1,o=i})},e.prototype.warnAboutUntrackedRead=function(){},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return Ze(this.get())},e}();bn.prototype[Qe()]=bn.prototype.valueOf;var mn=ze("ComputedValue",bn),gn={};!function(){$n||($n=function(){function e(e){void 0===e&&(e="Atom@"+Pe()),this.name=e,this.isPendingUnobservation=!1,this.isBeingObserved=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=n.IDerivationState.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.onBecomeObserved=function(){},e.prototype.reportObserved=function(){return dt(this)},e.prototype.reportChanged=function(){pt(),vt(this),ht()},e.prototype.toString=function(){return this.name},e}(),Mn=ze("Atom",$n))}();var wn=function(e){function t(t,n,r,o){void 0===r&&(r="ObservableValue@"+Pe()),void 0===o&&(o=!0);var i=e.call(this,r)||this;return i.enhancer=n,i.hasUnreportedChange=!1,i.value=n(t,void 0,r),o&&f()&&l({type:"create",name:i.name,newValue:""+i.value}),i}return r(t,e),t.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.prototype.set=function(e){var t=this.value;if((e=this.prepareNewValue(e))!==gn){var n=f();n&&p({type:"update",name:this.name,newValue:e,oldValue:t}),this.setNewValue(e),n&&h()}},t.prototype.prepareNewValue=function(e){if(St(this),U(this)){var t=K(this,{object:this,type:"update",newValue:e});if(!t)return gn;e=t.newValue}return e=this.enhancer(e,this.value,this.name),this.value!==e?e:gn},t.prototype.setNewValue=function(e){var t=this.value;this.value=e,this.reportChanged(),W(this)&&z(this,{type:"update",object:this,newValue:e,oldValue:t})},t.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},t.prototype.intercept=function(e){return G(this,e)},t.prototype.observe=function(e,t){return t&&e({object:this,type:"update",newValue:this.value,oldValue:void 0}),q(this,e)},t.prototype.toJSON=function(){return this.get()},t.prototype.toString=function(){return this.name+"["+this.value+"]"},t.prototype.valueOf=function(){return Ze(this.get())},t}($n);wn.prototype[Qe()]=wn.prototype.valueOf;var On=ze("ObservableValue",wn),_n=function(){function e(e,t,n){this.target=e,this.name=t,this.defaultEnhancer=n,this.values={}}return e.prototype.read=function(e,t){if(this.target===e||(this.illegalAccess(e,t),this.values[t]))return this.values[t].get()},e.prototype.write=function(e,t,n){var r=this.target;r!==e&&this.illegalAccess(e,t);var o=this.values[t];if(o instanceof bn)return void o.set(n);if(U(this)){var i=K(this,{type:"update",object:r,name:t,newValue:n});if(!i)return;n=i.newValue}if((n=o.prepareNewValue(n))!==gn){var a=W(this),s=f(),i=a||s?{type:"update",object:r,oldValue:o.value,name:t,newValue:n}:null;s&&p(cn({},i,{name:this.name,key:t})),o.setNewValue(n),a&&z(this,i),s&&h()}},e.prototype.remove=function(e){if(this.values[e]){var t=this.target;if(U(this)){var n=K(this,{object:t,name:e,type:"remove"});if(!n)return}try{pt();var r=W(this),o=f(),i=this.values[e].get();this.keys&&this.keys.remove(e),delete this.values[e],delete this.target[e];var n=r||o?{type:"remove",object:t,oldValue:i,name:e}:null;o&&p(cn({},n,{name:this.name,key:e})),r&&z(this,n),o&&h()}finally{ht()}}},e.prototype.illegalAccess=function(e,t){console.warn("Property '"+t+"' of '"+e+"' was accessed through the prototype chain. Use 'decorate' instead to declare the prop or access it statically through it's owner")},e.prototype.observe=function(e,t){return q(this,e)},e.prototype.intercept=function(e){return G(this,e)},e.prototype.getKeys=function(){var e=this;return void 0===this.keys&&(this.keys=new zn(Object.keys(this.values).filter(function(t){return e.values[t]instanceof wn}),ye,"keys("+this.name+")",!0)),this.keys.slice()},e
}(),Sn={},xn={},An=ze("ObservableObjectAdministration",_n),En=u(!1,function(e,t,n,r,o){var i=n.get,a=n.set,s=o[0]||{};Y(e,t,cn({get:i,set:a},s))}),Tn=En({equals:vn.structural}),Dn=function(e,t,n){if("string"==typeof t)return En.apply(null,arguments);if(null!==e&&"object"==typeof e&&1===arguments.length)return En.apply(null,arguments);var r="object"==typeof t?t:{};return r.get=e,r.set="function"==typeof t?t:r.set,r.name=r.name||e.name||"",new bn(r)};Dn.struct=Tn;var jn={deep:!0,name:void 0,defaultDecorator:void 0},In={deep:!1,name:void 0,defaultDecorator:void 0};Object.freeze(jn),Object.freeze(In);var kn=te(de),Vn=te(ve),Ln=te(ye),Cn=te(be),Pn={box:function(e,t){arguments.length>2&&he("box");var n=fe(t);return new wn(e,le(n),n.name)},shallowBox:function(e,t){return arguments.length>2&&he("shallowBox"),Be("observable.shallowBox","observable.box(value, { deep: false })"),Rn.box(e,{name:t,deep:!1})},array:function(e,t){arguments.length>2&&he("array");var n=fe(t);return new zn(e,le(n),n.name)},shallowArray:function(e,t){return arguments.length>2&&he("shallowArray"),Be("observable.shallowArray","observable.array(values, { deep: false })"),Rn.array(e,{name:t,deep:!1})},map:function(e,t){arguments.length>2&&he("map");var n=fe(t);return new Bn(e,le(n),n.name)},shallowMap:function(e,t){return arguments.length>2&&he("shallowMap"),Be("observable.shallowMap","observable.map(values, { deep: false })"),Rn.map(e,{name:t,deep:!1})},object:function(e,t,n){return"string"==typeof arguments[1]&&he("object"),ce({},e,t,fe(n))},shallowObject:function(e,t){return"string"==typeof arguments[1]&&he("shallowObject"),Be("observable.shallowObject","observable.object(values, {}, { deep: false })"),Rn.object(e,{},{name:t,deep:!1})},ref:Ln,shallow:Vn,deep:kn,struct:Cn},Rn=pe;Object.keys(Pn).forEach(function(e){return Rn[e]=Pn[e]});var Nn={},Bn=function(){function e(e,t,n){if(void 0===t&&(t=de),void 0===n&&(n="ObservableMap@"+Pe()),this.enhancer=t,this.name=n,this.$mobx=Nn,this._keys=new zn(void 0,ye,this.name+".keys()",!0),"function"!=typeof Map)throw new Error("mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js");this._data=new Map,this._hasMap=new Map,this.merge(e)}return e.prototype._has=function(e){return this._data.has(e)},e.prototype.has=function(e){return this._hasMap.has(e)?this._hasMap.get(e).get():this._updateHasMapEntry(e,!1).get()},e.prototype.set=function(e,t){var n=this._has(e);if(U(this)){var r=K(this,{type:n?"update":"add",object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this._updateValue(e,t):this._addValue(e,t),this},e.prototype.delete=function(e){var t=this;if(U(this)){var n=K(this,{type:"delete",object:this,name:e});if(!n)return!1}if(this._has(e)){var r=f(),o=W(this),n=o||r?{type:"delete",object:this,oldValue:this._data.get(e).value,name:e}:null;return r&&p(cn({},n,{name:this.name,key:e})),_e(function(){t._keys.remove(e),t._updateHasMapEntry(e,!1),t._data.get(e).setNewValue(void 0),t._data.delete(e)}),o&&z(this,n),r&&h(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap.get(e);return n?n.setNewValue(t):(n=new wn(t,ye,this.name+"."+e+"?",!1),this._hasMap.set(e,n)),n},e.prototype._updateValue=function(e,t){var n=this._data.get(e);if((t=n.prepareNewValue(t))!==gn){var r=f(),o=W(this),i=o||r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;r&&p(cn({},i,{name:this.name,key:e})),n.setNewValue(t),o&&z(this,i),r&&h()}},e.prototype._addValue=function(e,t){var n=this;_e(function(){var r=new wn(t,n.enhancer,n.name+"."+e,!1);n._data.set(e,r),t=r.value,n._updateHasMapEntry(e,!0),n._keys.push(e)});var r=f(),o=W(this),i=o||r?{type:"add",object:this,name:e,newValue:t}:null;r&&p(cn({},i,{name:this.name,key:e})),o&&z(this,i),r&&h()},e.prototype.get=function(e){return this.has(e)?this.dehanceValue(this._data.get(e).get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return this._keys[me()]()},e.prototype.values=function(){var e=this,t=0;return we({next:function(){return t<e._keys.length?{value:e.get(e._keys[t++]),done:!1}:{value:void 0,done:!0}}})},e.prototype.entries=function(){var e=this,t=0;return we({next:function(){if(t<e._keys.length){var n=e._keys[t++];return{value:[n,e.get(n)],done:!1}}return{done:!0}}})},e.prototype.forEach=function(e,t){var n=this;this._keys.forEach(function(r){return e.call(t,n.get(r),r,n)})},e.prototype.merge=function(e){var t=this;return Un(e)&&(e=e.toJS()),_e(function(){Ge(e)?Object.keys(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=o(e,2),r=n[0],i=n[1];return t.set(r,i)}):Ye(e)?e.forEach(function(e,n){return t.set(n,e)}):null!==e&&void 0!==e&&Re("Cannot initialize map from "+e)}),this},e.prototype.clear=function(){var e=this;_e(function(){Tt(function(){e._keys.slice().forEach(function(t){return e.delete(t)})})})},e.prototype.replace=function(e){var t=this;return _e(function(){var n=Xe(e);t._keys.filter(function(e){return-1===n.indexOf(e)}).forEach(function(e){return t.delete(e)}),t.merge(e)}),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.toPOJO=function(){var e=this,t={};return this._keys.forEach(function(n){return t[""+n]=e.get(n)}),t},e.prototype.toJS=function(){var e=this,t=new Map;return this._keys.forEach(function(n){return t.set(n,e.get(n))}),t},e.prototype.toJSON=function(){return this.toPOJO()},e.prototype.toString=function(){var e=this;return this.name+"[{ "+this._keys.map(function(t){return t+": "+e.get(t)}).join(", ")+" }]"},e.prototype.observe=function(e,t){return q(this,e)},e.prototype.intercept=function(e){return G(this,e)},e}();ge(Bn.prototype,function(){return this.entries()}),We(Bn.prototype,"undefined"!=typeof Symbol?Symbol.toStringTag:"@@toStringTag","Map");var $n,Mn,Un=ze("ObservableMap",Bn),Gn=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),Kn=0,Wn=function(){function e(){}return e}();!function(e,t){void 0!==Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):void 0!==e.prototype.__proto__?e.prototype.__proto__=t:e.prototype=t}(Wn,Array.prototype),Object.isFrozen(Array)&&["constructor","push","shift","concat","pop","unshift","replace","find","findIndex","splice","reverse","sort"].forEach(function(e){Object.defineProperty(Wn.prototype,e,{configurable:!0,writable:!0,value:Array.prototype[e]})});var qn=function(){function e(e,t,n,r){this.array=n,this.owned=r,this.values=[],this.lastKnownLength=0,this.atom=new $n(e||"ObservableArray@"+Pe()),this.enhancer=function(n,r){return t(n,r,e+"[..]")}}return e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.dehanceValues=function(e){return void 0!==this.dehancer&&this.values.length>0?e.map(this.dehancer):e},e.prototype.intercept=function(e){return G(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),q(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r<e-t;r++)n[r]=void 0;this.spliceWithArray(t,0,n)}else this.spliceWithArray(e,t-e)},e.prototype.updateArrayLength=function(e,t){if(e!==this.lastKnownLength)throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed. Did you use peek() to change it?");this.lastKnownLength+=t,t>0&&e+t+1>Kn&&Ve(e+t+1)},e.prototype.spliceWithArray=function(e,t,n){var r=this;St(this.atom);var o=this.values.length;if(void 0===e?e=0:e>o?e=o:e<0&&(e=Math.max(0,o+e)),t=1===arguments.length?o-e:void 0===t||null===t?0:Math.max(0,Math.min(t,o-e)),void 0===n&&(n=Xn),U(this)){var i=K(this,{object:this.array,type:"splice",index:e,removedCount:t,added:n});if(!i)return Xn;t=i.removedCount,n=i.added}n=0===n.length?n:n.map(function(e){return r.enhancer(e,void 0)});var a=n.length-t;this.updateArrayLength(o,a);var s=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,s),this.dehanceValues(s)},e.prototype.spliceItemsIntoValues=function(e,t,n){if(n.length<1e4)return(o=this.values).splice.apply(o,i([e,t],n));var r=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),r;var o},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&f(),o=W(this),i=o||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&p(cn({},i,{name:this.atom.name})),this.atom.reportChanged(),o&&z(this,i),r&&h()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&f(),o=W(this),i=o||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&p(cn({},i,{name:this.atom.name})),this.atom.reportChanged(),o&&z(this,i),r&&h()},e}(),zn=function(e){function t(t,n,r,o){void 0===r&&(r="ObservableArray@"+Pe()),void 0===o&&(o=!1);var i=e.call(this)||this,a=new qn(r,n,i,o);return We(i,"$mobx",a),t&&t.length&&i.spliceWithArray(0,0,t),Gn&&Object.defineProperty(a.array,"0",Hn),i}return r(t,e),t.prototype.intercept=function(e){return this.$mobx.intercept(e)},t.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},t.prototype.clear=function(){return this.splice(0)},t.prototype.concat=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.$mobx.atom.reportObserved(),Array.prototype.concat.apply(this.peek(),e.map(function(e){return Le(e)?e.peek():e}))},t.prototype.replace=function(e){return this.$mobx.spliceWithArray(0,this.$mobx.values.length,e)},t.prototype.toJS=function(){return this.slice()},t.prototype.toJSON=function(){return this.toJS()},t.prototype.peek=function(){return this.$mobx.atom.reportObserved(),this.$mobx.dehanceValues(this.$mobx.values)},t.prototype.find=function(e,t,n){void 0===n&&(n=0),3===arguments.length&&Be("The array.find fromIndex argument to find will not be supported anymore in the next major");var r=this.findIndex.apply(this,arguments);return-1===r?void 0:this.get(r)},t.prototype.findIndex=function(e,t,n){void 0===n&&(n=0),3===arguments.length&&Be("The array.findIndex fromIndex argument to find will not be supported anymore in the next major");for(var r=this.peek(),o=r.length,i=n;i<o;i++)if(e.call(t,r[i],i,this))return i;return-1},t.prototype.splice=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];switch(arguments.length){case 0:return[];case 1:return this.$mobx.spliceWithArray(e);case 2:return this.$mobx.spliceWithArray(e,t)}return this.$mobx.spliceWithArray(e,t,n)},t.prototype.spliceWithArray=function(e,t,n){return this.$mobx.spliceWithArray(e,t,n)},t.prototype.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.$mobx;return n.spliceWithArray(n.values.length,0,e),n.values.length},t.prototype.pop=function(){return this.splice(Math.max(this.$mobx.values.length-1,0),1)[0]},t.prototype.shift=function(){return this.splice(0,1)[0]},t.prototype.unshift=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.$mobx;return n.spliceWithArray(0,0,e),n.values.length},t.prototype.reverse=function(){var e=this.slice();return e.reverse.apply(e,arguments)},t.prototype.sort=function(e){var t=this.slice();return t.sort.apply(t,arguments)},t.prototype.remove=function(e){var t=this.$mobx.dehanceValues(this.$mobx.values).indexOf(e);return t>-1&&(this.splice(t,1),!0)},t.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(Be("observableArray.move is deprecated, use .slice() & .replace() instead"),n.call(this,e),n.call(this,t),e!==t){var r,o=this.$mobx.values;r=e<t?i(o.slice(0,e),o.slice(e+1,t+1),[o[e]],o.slice(t+1)):i(o.slice(0,t),[o[e]],o.slice(t,e),o.slice(e+1)),this.replace(r)}},t.prototype.get=function(e){var t=this.$mobx;if(t){if(e<t.values.length)return t.atom.reportObserved(),t.dehanceValue(t.values[e]);console.warn("[mobx.array] Attempt to read an array index ("+e+") that is out of bounds ("+t.values.length+"). Please check length first. Out of bound indices will not be tracked by MobX")}},t.prototype.set=function(e,t){var n=this.$mobx,r=n.values;if(e<r.length){St(n.atom);var o=r[e];if(U(n)){var i=K(n,{type:"update",object:this,index:e,newValue:t});if(!i)return;t=i.newValue}t=n.enhancer(t,o);t!==o&&(r[e]=t,n.notifyArrayChildUpdate(e,t,o))}else{if(e!==r.length)throw new Error("[mobx.array] Index out of bounds, "+e+" is larger than "+r.length);n.spliceWithArray(e,0,[t])}},t}(Wn);ge(zn.prototype,function(){this.$mobx.atom.reportObserved();var e=this,t=0;return we({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})}),Object.defineProperty(zn.prototype,"length",{enumerable:!1,configurable:!0,get:function(){return this.$mobx.getArrayLength()},set:function(e){this.$mobx.setArrayLength(e)}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&Ke(zn.prototype,"undefined"!=typeof Symbol?Symbol.toStringTag:"@@toStringTag","Array"),["every","filter","forEach","indexOf","join","lastIndexOf","map","reduce","reduceRight","slice","some","toString","toLocaleString"].forEach(function(e){var t=Array.prototype[e];Ne("function"==typeof t,"Base function not defined on Array prototype: '"+e+"'"),Ke(zn.prototype,e,function(){return t.apply(this.peek(),arguments)})}),function(e,t){for(var n=0;n<t.length;n++)Ke(e,t[n],e[t[n]])}(zn.prototype,["constructor","intercept","observe","clear","concat","get","replace","toJS","toJSON","peek","find","findIndex","splice","spliceWithArray","push","pop","set","shift","unshift","reverse","sort","remove","move","toString","toLocaleString"]);var Hn=Ie(0);Ve(1e3);var Jn=ze("ObservableArrayAdministration",qn),Yn="An invariant failed, however the error is obfuscated because this is an production build.",Xn=[];Object.freeze(Xn);var Fn={};Object.freeze(Fn);var Qn=function(){},Zn=["mobxGuid","spyListeners","enforceActions","computedRequiresReaction","disableErrorBoundaries","runId"],er=function(){function e(){this.version=5,this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.enforceActions=!1,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.disableErrorBoundaries=!1}return e}(),tr=new er,nr=!1,rr=Ce();rr.__mobxInstanceCount?(rr.__mobxInstanceCount++,setTimeout(function(){nr||Re(!1)},1)):rr.__mobxInstanceCount=1,function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(n.IDerivationState||(n.IDerivationState={}));var or;!function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(or||(or={}));var ir=function(){function e(e){this.cause=e}return e}(),ar=function(){function e(e,t,r){void 0===e&&(e="Reaction@"+Pe()),this.name=e,this.onInvalidate=t,this.errorHandler=r,this.observing=[],this.newObserving=[],this.dependenciesState=n.IDerivationState.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+Pe(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=or.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,tr.pendingReactions.push(this),Ct())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){if(!this.isDisposed){if(pt(),this._isScheduled=!1,Ot(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending&&f()&&l({name:this.name,type:"scheduled-reaction"})}catch(e){this.reportExceptionInDerivation(e)}}ht()}},e.prototype.track=function(e){pt();var t,n=f();n&&(t=Date.now(),p({name:this.name,type:"reaction"})),this._isRunning=!0;var r=xt(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&Et(this),wt(r)&&this.reportExceptionInDerivation(r.cause),n&&h({time:Date.now()-t}),ht()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)return void this.errorHandler(e,this);if(tr.disableErrorBoundaries)throw e;var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this;console.error(n,e),f()&&l({type:"error",name:this.name,message:n,error:""+e}),tr.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(pt(),Et(this),ht()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.trace=function(e){void 0===e&&(e=!1),kt(this,e)},e}(),sr=100,ur=function(e){return e()},cr=ze("Reaction",ar),fr=0,lr={detectCycles:!0,exportMapsAsObjects:!0};!function(){function e(){}e.name}(),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:d,extras:{getDebugName:Ae}});n.$mobx="$mobx",n.Reaction=ar,n.untracked=Tt,n.createAtom=je,n.spy=d,n.comparer=vn,n.isObservableObject=ee,n.isBoxedObservable=On,n.isObservableArray=Le,n.ObservableMap=Bn,n.isObservableMap=Un,n.transaction=_e,n.observable=Rn,n.computed=Dn,n.isObservable=re,n.isObservableProp=oe,n.isComputed=ae,n.isComputedProp=se,n.extendObservable=ce,n.extendShallowObservable=ue,n.observe=Nt,n.intercept=Mt,n.autorun=N,n.reaction=$,n.when=Kt,n.action=hn,n.isAction=T,n.runInAction=E,n.keys=zt,n.values=Ht,n.entries=Jt,n.set=Yt,n.remove=Xt,n.has=Ft,n.get=Qt,n.decorate=Zt,n.configure=en,n.onBecomeObserved=Ee,n.onBecomeUnobserved=Te,n.flow=tn,n.toJS=an,n.trace=kt,n.getDependencyTree=rt,n.getObserverTree=it,n._resetGlobalState=nt,n._getGlobalState=tt,n.getDebugName=Ae,n.getAtom=Se,n._getAdministration=xe,n._allowStateChanges=g,n.isArrayLike=Je,n._isComputingDerivation=_t,n.onReactionError=Lt,n._interceptReads=sn}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:2}],2:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===r||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function a(e){if(p===clearTimeout)return clearTimeout(e);if((p===o||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function s(){y&&d&&(y=!1,d.length?v=d.concat(v):b=-1,v.length&&u())}function u(){if(!y){var e=i(s);y=!0;for(var t=v.length;t;){for(d=v,v=[];++b<t;)d&&d[b].run();b=-1,t=v.length}d=null,y=!1,a(e)}}function c(e,t){this.fun=e,this.array=t}function f(){}var l,p,h=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:r}catch(e){l=r}try{p="function"==typeof clearTimeout?clearTimeout:o}catch(e){p=o}}();var d,v=[],y=!1,b=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];v.push(new c(e,t)),1!==v.length||y||i(u)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=f,h.addListener=f,h.once=f,h.off=f,h.removeListener=f,h.removeAllListeners=f,h.emit=f,h.prependListener=f,h.prependOnceListener=f,h.listeners=function(e){return[]},h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}]},{},[1])(1)});
//# sourceMappingURL=lib/mobx.umd.min.js.map |
packages/material-ui-icons/src/MobileFriendlyOutlined.js | allanalexandre/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><g><path d="M19 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-2zM7.01 13.47l-2.55-2.55-1.27 1.27L7 16l7.19-7.19-1.27-1.27-5.91 5.93z" /></g></React.Fragment>
, 'MobileFriendlyOutlined');
|
app/components/Login/index.js | rahsheen/scalable-react-app | /**
*
* Login
*
*/
import React from 'react';
import styles from './styles.css';
import validator from 'email-validator';
import TextInput from '../TextInput';
class Login extends React.Component { // eslint-disable-line react/prefer-stateless-function
static propTypes = {
login: React.PropTypes.func.isRequired,
cancelLogin: React.PropTypes.func.isRequired,
};
state = {};
login = () => {
const email = this.emailField.value();
if (!validator.validate(email)) {
this.setState({
errorText: 'Please provide a valid email',
});
return;
}
this.setState({
errorText: null,
});
this.props.login(email);
}
render() {
return (
<div className={styles.login}>
<div className={styles.headin}>
Login with your email
</div>
<TextInput
placeholder="Your email"
ref={(f) => { this.emailField = f; }}
errorText={this.state.errorText}
/>
<div className={styles.actionContainer}>
<div
className={styles.button}
onClick={this.props.cancelLogin}
>
cancel
</div>
<div
className={styles.button}
onClick={this.login}
>
log in
</div>
</div>
</div>
);
}
}
export default Login;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.