path
stringlengths 5
300
| repo_name
stringlengths 6
76
| content
stringlengths 26
1.05M
|
|---|---|---|
entry_types/scrolled/package/spec/contentElements/externalLinkList/frontend/ExternalLink-spec.js
|
codevise/pageflow
|
import {ExternalLink} from 'contentElements/externalLinkList/frontend/ExternalLink';
import React from 'react';
import {renderInEntry} from 'support';
import '@testing-library/jest-dom/extend-expect';
describe('ExternalLink', () => {
it('does not render url without protocol', () => {
const {getByRole} = renderInEntry(<ExternalLink url="example.com" />)
expect(getByRole('link')).toHaveAttribute('href', 'http://example.com');
});
it('preserves http url protocol', () => {
const {getByRole} = renderInEntry(<ExternalLink url="http://example.com" />)
expect(getByRole('link')).toHaveAttribute('href', 'http://example.com');
});
it('preserves protocol relative urls', () => {
const {getByRole} = renderInEntry(<ExternalLink url="//example.com" />)
expect(getByRole('link')).toHaveAttribute('href', '//example.com');
});
it('preserves https url protocol', () => {
const {getByRole} = renderInEntry(<ExternalLink url="https://example.com" />)
expect(getByRole('link')).toHaveAttribute('href', 'https://example.com');
});
});
|
src/-/Counter/components/Counter.js
|
yangbin1994/react-redux-starter-kit
|
import React from 'react'
export const Counter = (props) => (
<div style={{ margin: '0 auto' }} >
<h2>Counter: {props.counter}</h2>
<button className='btn btn-default' onClick={props.increment}>
Increment
</button>
{' '}
<button className='btn btn-default' onClick={props.doubleAsync}>
Double (Async)
</button>
</div>
)
Counter.propTypes = {
counter : React.PropTypes.number.isRequired,
doubleAsync : React.PropTypes.func.isRequired,
increment : React.PropTypes.func.isRequired
}
export default Counter
|
src/views/CodeGen/index.js
|
chad-ding/koala
|
/**
*@Author: chad.ding
*@Copyright: 2017-2018 DMF
*@Date: 2017-05-19 11:35:00
*/
import React, { Component } from 'react';
import { Tabs } from 'antd';
import { connect } from 'react-redux';
import Params from './params';
import Template from './template';
import './style.less';
class CodeGen extends Component {
constructor(props) {
super(props);
}
render() {
let TabPane = Tabs.TabPane;
return (
<div>
<Tabs defaultActiveKey="params" onChange={this.tabChange} type="card">
<TabPane tab="参数" key="params">
<Params></Params>
</TabPane>
<TabPane tab="模板" key="template">
<Template></Template>
</TabPane>
</Tabs>
</div>
);
}
};
function mapStateToProps(state) {
return {
...state
};
}
export default connect(mapStateToProps)(CodeGen);
|
ajax/libs/react/0.14.0-alpha3/react.min.js
|
kellyselden/cdnjs
|
/**
* React v0.14.0-alpha3
*
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();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.React=e()}}(function(){return function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return o(n?n:e)},c,c.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){"use strict";var r=e(41),o=e(51),i=e(67),a=e(26),u={};a(u,i),a(u,r),a(u,o),u.version="0.14.0-alpha3",t.exports=u},{26:26,41:41,51:51,67:67}],2:[function(e,t,n){"use strict";var r=e(116),o=e(118),i={componentDidMount:function(){this.props.autoFocus&&o(r(this))}};t.exports=i},{116:116,118:118}],3:[function(e,t,n){"use strict";function r(){var e=window.opera;return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function o(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function i(e){switch(e){case T.topCompositionStart:return R.compositionStart;case T.topCompositionEnd:return R.compositionEnd;case T.topCompositionUpdate:return R.compositionUpdate}}function a(e,t){return e===T.topKeyDown&&t.keyCode===b}function u(e,t){switch(e){case T.topKeyUp:return-1!==E.indexOf(t.keyCode);case T.topKeyDown:return t.keyCode!==b;case T.topKeyPress:case T.topMouseDown:case T.topBlur:return!0;default:return!1}}function s(e){var t=e.detail;return"object"==typeof t&&"data"in t?t.data:null}function l(e,t,n,r){var o,l;if(_?o=i(e):w?u(e,r)&&(o=R.compositionEnd):a(e,r)&&(o=R.compositionStart),!o)return null;M&&(w||o!==R.compositionStart?o===R.compositionEnd&&w&&(l=w.getData()):w=m.getPooled(t));var c=g.getPooled(o,n,r);if(l)c.data=l;else{var p=s(r);null!==p&&(c.data=p)}return h.accumulateTwoPhaseDispatches(c),c}function c(e,t){switch(e){case T.topCompositionEnd:return s(t);case T.topKeyPress:var n=t.which;return n!==I?null:(P=!0,N);case T.topTextInput:var r=t.data;return r===N&&P?null:r;default:return null}}function p(e,t){if(w){if(e===T.topCompositionEnd||u(e,t)){var n=w.getData();return m.release(w),w=null,n}return null}switch(e){case T.topPaste:return null;case T.topKeyPress:return t.which&&!o(t)?String.fromCharCode(t.which):null;case T.topCompositionEnd:return M?null:t.data;default:return null}}function d(e,t,n,r){var o;if(o=D?c(e,r):p(e,r),!o)return null;var i=y.getPooled(R.beforeInput,n,r);return i.data=o,h.accumulateTwoPhaseDispatches(i),i}var f=e(15),h=e(20),v=e(21),m=e(22),g=e(92),y=e(96),C=e(139),E=[9,13,27,32],b=229,_=v.canUseDOM&&"CompositionEvent"in window,x=null;v.canUseDOM&&"documentMode"in document&&(x=document.documentMode);var D=v.canUseDOM&&"TextEvent"in window&&!x&&!r(),M=v.canUseDOM&&(!_||x&&x>8&&11>=x),I=32,N=String.fromCharCode(I),T=f.topLevelTypes,R={beforeInput:{phasedRegistrationNames:{bubbled:C({onBeforeInput:null}),captured:C({onBeforeInputCapture:null})},dependencies:[T.topCompositionEnd,T.topKeyPress,T.topTextInput,T.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:C({onCompositionEnd:null}),captured:C({onCompositionEndCapture:null})},dependencies:[T.topBlur,T.topCompositionEnd,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:C({onCompositionStart:null}),captured:C({onCompositionStartCapture:null})},dependencies:[T.topBlur,T.topCompositionStart,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:C({onCompositionUpdate:null}),captured:C({onCompositionUpdateCapture:null})},dependencies:[T.topBlur,T.topCompositionUpdate,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]}},P=!1,w=null,O={eventTypes:R,extractEvents:function(e,t,n,r){return[l(e,t,n,r),d(e,t,n,r)]}};t.exports=O},{139:139,15:15,20:20,21:21,22:22,92:92,96:96}],4:[function(e,t,n){"use strict";function r(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var o={boxFlex:!0,boxFlexGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},i=["Webkit","ms","Moz","O"];Object.keys(o).forEach(function(e){i.forEach(function(t){o[r(t,e)]=o[e]})});var a={background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}},u={isUnitlessNumber:o,shorthandPropertyExpansions:a};t.exports=u},{}],5:[function(e,t,n){"use strict";var r=e(4),o=e(21),i=(e(107),e(112)),a=e(131),u=e(141),s=(e(151),u(function(e){return a(e)})),l="cssFloat";o.canUseDOM&&void 0===document.documentElement.style.cssFloat&&(l="styleFloat");var c={createMarkupForStyles:function(e){var t="";for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];null!=r&&(t+=s(n)+":",t+=i(n,r)+";")}return t||null},setValueForStyles:function(e,t){var n=e.style;for(var o in t)if(t.hasOwnProperty(o)){var a=i(o,t[o]);if("float"===o&&(o=l),a)n[o]=a;else{var u=r.shorthandPropertyExpansions[o];if(u)for(var s in u)n[s]="";else n[o]=""}}}};t.exports=c},{107:107,112:112,131:131,141:141,151:151,21:21,4:4}],6:[function(e,t,n){"use strict";function r(){this._callbacks=null,this._contexts=null}var o=e(27),i=e(26),a=e(133);i(r.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){e.length!==t.length?a(!1):void 0,this._callbacks=null,this._contexts=null;for(var n=0;n<e.length;n++)e[n].call(t[n]);e.length=0,t.length=0}},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),o.addPoolingTo(r),t.exports=r},{133:133,26:26,27:27}],7:[function(e,t,n){"use strict";function r(e){return"SELECT"===e.nodeName||"INPUT"===e.nodeName&&"file"===e.type}function o(e){var t=x.getPooled(T.change,P,e);E.accumulateTwoPhaseDispatches(t),_.batchedUpdates(i,t)}function i(e){C.enqueueEvents(e),C.processEventQueue()}function a(e,t){R=e,P=t,R.attachEvent("onchange",o)}function u(){R&&(R.detachEvent("onchange",o),R=null,P=null)}function s(e,t,n){return e===N.topChange?n:void 0}function l(e,t,n){e===N.topFocus?(u(),a(t,n)):e===N.topBlur&&u()}function c(e,t){R=e,P=t,w=e.value,O=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(R,"value",A),R.attachEvent("onpropertychange",d)}function p(){R&&(delete R.value,R.detachEvent("onpropertychange",d),R=null,P=null,w=null,O=null)}function d(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==w&&(w=t,o(e))}}function f(e,t,n){return e===N.topInput?n:void 0}function h(e,t,n){e===N.topFocus?(p(),c(t,n)):e===N.topBlur&&p()}function v(e,t,n){return e!==N.topSelectionChange&&e!==N.topKeyUp&&e!==N.topKeyDown||!R||R.value===w?void 0:(w=R.value,P)}function m(e){return"INPUT"===e.nodeName&&("checkbox"===e.type||"radio"===e.type)}function g(e,t,n){return e===N.topClick?n:void 0}var y=e(15),C=e(17),E=e(20),b=e(21),_=e(86),x=e(94),D=e(134),M=e(136),I=e(139),N=y.topLevelTypes,T={change:{phasedRegistrationNames:{bubbled:I({onChange:null}),captured:I({onChangeCapture:null})},dependencies:[N.topBlur,N.topChange,N.topClick,N.topFocus,N.topInput,N.topKeyDown,N.topKeyUp,N.topSelectionChange]}},R=null,P=null,w=null,O=null,S=!1;b.canUseDOM&&(S=D("change")&&(!("documentMode"in document)||document.documentMode>8));var k=!1;b.canUseDOM&&(k=D("input")&&(!("documentMode"in document)||document.documentMode>9));var A={get:function(){return O.get.call(this)},set:function(e){w=""+e,O.set.call(this,e)}},U={eventTypes:T,extractEvents:function(e,t,n,o){var i,a;if(r(t)?S?i=s:a=l:M(t)?k?i=f:(i=v,a=h):m(t)&&(i=g),i){var u=i(e,t,n);if(u){var c=x.getPooled(T.change,u,o);return E.accumulateTwoPhaseDispatches(c),c}}a&&a(e,t,n)}};t.exports=U},{134:134,136:136,139:139,15:15,17:17,20:20,21:21,86:86,94:94}],8:[function(e,t,n){"use strict";var r=0,o={createReactRootIndex:function(){return r++}};t.exports=o},{}],9:[function(e,t,n){"use strict";function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var o=e(12),i=e(72),a=e(145),u=e(133),s={dangerouslyReplaceNodeWithMarkup:o.dangerouslyReplaceNodeWithMarkup,updateTextContent:a,processUpdates:function(e,t){for(var n,s=null,l=null,c=0;c<e.length;c++)if(n=e[c],n.type===i.MOVE_EXISTING||n.type===i.REMOVE_NODE){var p=n.fromIndex,d=n.parentNode.childNodes[p],f=n.parentID;d?void 0:u(!1),s=s||{},s[f]=s[f]||[],s[f][p]=d,l=l||[],l.push(d)}var h=o.dangerouslyRenderMarkup(t);if(l)for(var v=0;v<l.length;v++)l[v].parentNode.removeChild(l[v]);for(var m=0;m<e.length;m++)switch(n=e[m],n.type){case i.INSERT_MARKUP:r(n.parentNode,h[n.markupIndex],n.toIndex);break;case i.MOVE_EXISTING:r(n.parentNode,s[n.parentID][n.fromIndex],n.toIndex);break;case i.TEXT_CONTENT:a(n.parentNode,n.textContent);break;case i.REMOVE_NODE:}}};t.exports=s},{12:12,133:133,145:145,72:72}],10:[function(e,t,n){"use strict";function r(e,t){return(e&t)===t}var o=e(133),i={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var t=e.Properties||{},n=e.DOMAttributeNamespaces||{},a=e.DOMAttributeNames||{},s=e.DOMPropertyNames||{},l=e.DOMMutationMethods||{};e.isCustomAttribute&&u._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var c in t){u.isStandardName.hasOwnProperty(c)?o(!1):void 0,u.isStandardName[c]=!0;var p=c.toLowerCase();if(u.getPossibleStandardName[p]=c,a.hasOwnProperty(c)){var d=a[c];u.getPossibleStandardName[d]=c,u.getAttributeName[c]=d}else u.getAttributeName[c]=p;n.hasOwnProperty(c)?u.getAttributeNamespace[c]=n[c]:u.getAttributeNamespace[c]=null,u.getPropertyName[c]=s.hasOwnProperty(c)?s[c]:c,l.hasOwnProperty(c)?u.getMutationMethod[c]=l[c]:u.getMutationMethod[c]=null;var f=t[c];u.mustUseAttribute[c]=r(f,i.MUST_USE_ATTRIBUTE),u.mustUseProperty[c]=r(f,i.MUST_USE_PROPERTY),u.hasSideEffects[c]=r(f,i.HAS_SIDE_EFFECTS),u.hasBooleanValue[c]=r(f,i.HAS_BOOLEAN_VALUE),u.hasNumericValue[c]=r(f,i.HAS_NUMERIC_VALUE),u.hasPositiveNumericValue[c]=r(f,i.HAS_POSITIVE_NUMERIC_VALUE),u.hasOverloadedBooleanValue[c]=r(f,i.HAS_OVERLOADED_BOOLEAN_VALUE),u.mustUseAttribute[c]&&u.mustUseProperty[c]?o(!1):void 0,!u.mustUseProperty[c]&&u.hasSideEffects[c]?o(!1):void 0,!!u.hasBooleanValue[c]+!!u.hasNumericValue[c]+!!u.hasOverloadedBooleanValue[c]<=1?void 0:o(!1)}}},a={},u={ID_ATTRIBUTE_NAME:"data-reactid",isStandardName:{},getPossibleStandardName:{},getAttributeName:{},getAttributeNamespace:{},getPropertyName:{},getMutationMethod:{},mustUseAttribute:{},mustUseProperty:{},hasSideEffects:{},hasBooleanValue:{},hasNumericValue:{},hasPositiveNumericValue:{},hasOverloadedBooleanValue:{},_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<u._isCustomAttributeFunctions.length;t++){var n=u._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},getDefaultValueForProperty:function(e,t){var n,r=a[e];return r||(a[e]=r={}),t in r||(n=document.createElement(e),r[t]=n[t]),r[t]},injection:i};t.exports=u},{133:133}],11:[function(e,t,n){"use strict";function r(e,t){return null==t||o.hasBooleanValue[e]&&!t||o.hasNumericValue[e]&&isNaN(t)||o.hasPositiveNumericValue[e]&&1>t||o.hasOverloadedBooleanValue[e]&&t===!1}var o=e(10),i=e(143),a=(e(151),{createMarkupForID:function(e){return o.ID_ATTRIBUTE_NAME+"="+i(e)},createMarkupForProperty:function(e,t){if(o.isStandardName.hasOwnProperty(e)&&o.isStandardName[e]){if(r(e,t))return"";var n=o.getAttributeName[e];return o.hasBooleanValue[e]||o.hasOverloadedBooleanValue[e]&&t===!0?n+'=""':n+"="+i(t)}return o.isCustomAttribute(e)?null==t?"":e+"="+i(t):null},setValueForProperty:function(e,t,n){if(o.isStandardName.hasOwnProperty(t)&&o.isStandardName[t]){var i=o.getMutationMethod[t];if(i)i(e,n);else if(r(t,n))this.deleteValueForProperty(e,t);else if(o.mustUseAttribute[t]){var a=o.getAttributeName[t],u=o.getAttributeNamespace[t];u?e.setAttributeNS(u,a,""+n):e.setAttribute(a,""+n)}else{var s=o.getPropertyName[t];o.hasSideEffects[t]&&""+e[s]==""+n||(e[s]=n)}}else o.isCustomAttribute(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,t){if(o.isStandardName.hasOwnProperty(t)&&o.isStandardName[t]){var n=o.getMutationMethod[t];if(n)n(e,void 0);else if(o.mustUseAttribute[t])e.removeAttribute(o.getAttributeName[t]);else{var r=o.getPropertyName[t],i=o.getDefaultValueForProperty(e.nodeName,r);o.hasSideEffects[t]&&""+e[r]===i||(e[r]=i)}}else o.isCustomAttribute(t)&&e.removeAttribute(t)}});t.exports=a},{10:10,143:143,151:151}],12:[function(e,t,n){"use strict";function r(e){return e.substring(1,e.indexOf(" "))}var o=e(21),i=e(111),a=e(113),u=e(126),s=e(133),l=/^(<[^ \/>]+)/,c="data-danger-index",p={dangerouslyRenderMarkup:function(e){o.canUseDOM?void 0:s(!1);for(var t,n={},p=0;p<e.length;p++)e[p]?void 0:s(!1),t=r(e[p]),t=u(t)?t:"*",n[t]=n[t]||[],n[t][p]=e[p];var d=[],f=0;for(t in n)if(n.hasOwnProperty(t)){var h,v=n[t];for(h in v)if(v.hasOwnProperty(h)){var m=v[h];v[h]=m.replace(l,"$1 "+c+'="'+h+'" ')}for(var g=i(v.join(""),a),y=0;y<g.length;++y){var C=g[y];C.hasAttribute&&C.hasAttribute(c)&&(h=+C.getAttribute(c),C.removeAttribute(c),d.hasOwnProperty(h)?s(!1):void 0,d[h]=C,f+=1)}}return f!==d.length?s(!1):void 0,d.length!==e.length?s(!1):void 0,d},dangerouslyReplaceNodeWithMarkup:function(e,t){o.canUseDOM?void 0:s(!1),t?void 0:s(!1),"html"===e.tagName.toLowerCase()?s(!1):void 0;var n=i(t,a)[0];e.parentNode.replaceChild(n,e)}};t.exports=p},{111:111,113:113,126:126,133:133,21:21}],13:[function(e,t,n){"use strict";var r=e(139),o=[r({ResponderEventPlugin:null}),r({SimpleEventPlugin:null}),r({TapEventPlugin:null}),r({EnterLeaveEventPlugin:null}),r({ChangeEventPlugin:null}),r({SelectEventPlugin:null}),r({BeforeInputEventPlugin:null}),r({AnalyticsEventPlugin:null})];t.exports=o},{139:139}],14:[function(e,t,n){"use strict";var r=e(15),o=e(20),i=e(98),a=e(70),u=e(139),s=r.topLevelTypes,l=a.getFirstReactDOM,c={mouseEnter:{registrationName:u({onMouseEnter:null}),dependencies:[s.topMouseOut,s.topMouseOver]},mouseLeave:{registrationName:u({onMouseLeave:null}),dependencies:[s.topMouseOut,s.topMouseOver]}},p=[null,null],d={eventTypes:c,extractEvents:function(e,t,n,r){if(e===s.topMouseOver&&(r.relatedTarget||r.fromElement))return null;if(e!==s.topMouseOut&&e!==s.topMouseOver)return null;var u;if(t.window===t)u=t;else{var d=t.ownerDocument;u=d?d.defaultView||d.parentWindow:window}var f,h;if(e===s.topMouseOut?(f=t,h=l(r.relatedTarget||r.toElement)||u):(f=u,h=t),f===h)return null;var v=f?a.getID(f):"",m=h?a.getID(h):"",g=i.getPooled(c.mouseLeave,v,r);g.type="mouseleave",g.target=f,g.relatedTarget=h;var y=i.getPooled(c.mouseEnter,m,r);return y.type="mouseenter",y.target=h,y.relatedTarget=f,o.accumulateEnterLeaveDispatches(g,y,v,m),p[0]=g,p[1]=y,p}};t.exports=d},{139:139,15:15,20:20,70:70,98:98}],15:[function(e,t,n){"use strict";var r=e(138),o=r({bubbled:null,captured:null}),i=r({topBlur:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topError:null,topFocus:null,topInput:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topReset:null,topScroll:null,topSelectionChange:null,topSubmit:null,topTextInput:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topWheel:null}),a={topLevelTypes:i,PropagationPhases:o};t.exports=a},{138:138}],16:[function(e,t,n){"use strict";var r=e(113),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};t.exports=o},{113:113}],17:[function(e,t,n){"use strict";var r=e(18),o=e(19),i=e(104),a=e(119),u=e(133),s=(e(151),{}),l=null,c=function(e){if(e){var t=o.executeDispatch,n=r.getPluginModuleForEvent(e);n&&n.executeDispatch&&(t=n.executeDispatch),o.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e)}},p=null,d={injection:{injectMount:o.injection.injectMount,injectInstanceHandle:function(e){p=e},getInstanceHandle:function(){return p},injectEventPluginOrder:r.injectEventPluginOrder,injectEventPluginsByName:r.injectEventPluginsByName},eventNameDispatchConfigs:r.eventNameDispatchConfigs,registrationNameModules:r.registrationNameModules,putListener:function(e,t,n){"function"!=typeof n?u(!1):void 0;var o=s[t]||(s[t]={});o[e]=n;var i=r.registrationNameModules[t];i&&i.didPutListener&&i.didPutListener(e,t,n)},getListener:function(e,t){var n=s[t];return n&&n[e]},deleteListener:function(e,t){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var o=s[t];o&&delete o[e]},deleteAllListeners:function(e){for(var t in s)if(s[t][e]){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t),delete s[t][e]}},extractEvents:function(e,t,n,o){for(var a,u=r.plugins,s=0;s<u.length;s++){var l=u[s];if(l){var c=l.extractEvents(e,t,n,o);c&&(a=i(a,c))}}return a},enqueueEvents:function(e){e&&(l=i(l,e))},processEventQueue:function(){var e=l;l=null,a(e,c),l?u(!1):void 0},__purge:function(){s={}},__getListenerBank:function(){return s}};t.exports=d},{104:104,119:119,133:133,151:151,18:18,19:19}],18:[function(e,t,n){"use strict";function r(){if(u)for(var e in s){var t=s[e],n=u.indexOf(e);if(n>-1?void 0:a(!1),!l.plugins[n]){t.extractEvents?void 0:a(!1),l.plugins[n]=t;var r=t.eventTypes;for(var i in r)o(r[i],t,i)?void 0:a(!1)}}}function o(e,t,n){l.eventNameDispatchConfigs.hasOwnProperty(n)?a(!1):void 0,l.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var o in r)if(r.hasOwnProperty(o)){var u=r[o];i(u,t,n)}return!0}return e.registrationName?(i(e.registrationName,t,n),!0):!1}function i(e,t,n){l.registrationNameModules[e]?a(!1):void 0,l.registrationNameModules[e]=t,l.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var a=e(133),u=null,s={},l={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){u?a(!1):void 0,u=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];s.hasOwnProperty(n)&&s[n]===o||(s[n]?a(!1):void 0,s[n]=o,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=l.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){u=null;for(var e in s)s.hasOwnProperty(e)&&delete s[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=l.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};t.exports=l},{133:133}],19:[function(e,t,n){"use strict";function r(e){return e===m.topMouseUp||e===m.topTouchEnd||e===m.topTouchCancel}function o(e){return e===m.topMouseMove||e===m.topTouchMove}function i(e){return e===m.topMouseDown||e===m.topTouchStart}function a(e,t){var n=e._dispatchListeners,r=e._dispatchIDs;if(Array.isArray(n))for(var o=0;o<n.length&&!e.isPropagationStopped();o++)t(e,n[o],r[o]);else n&&t(e,n,r)}function u(e,t,n){e.currentTarget=v.Mount.getNode(n);var r=t(e,n);return e.currentTarget=null,r}function s(e,t){a(e,t),e._dispatchListeners=null,e._dispatchIDs=null}function l(e){var t=e._dispatchListeners,n=e._dispatchIDs;if(Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,n[r]))return n[r]}else if(t&&t(e,n))return n;return null}function c(e){var t=l(e);return e._dispatchIDs=null,e._dispatchListeners=null,t}function p(e){var t=e._dispatchListeners,n=e._dispatchIDs;Array.isArray(t)?h(!1):void 0;var r=t?t(e,n):null;return e._dispatchListeners=null,e._dispatchIDs=null,r}function d(e){return!!e._dispatchListeners}var f=e(15),h=e(133),v=(e(151),{Mount:null,injectMount:function(e){v.Mount=e}}),m=f.topLevelTypes,g={isEndish:r,isMoveish:o,isStartish:i,executeDirectDispatch:p,executeDispatch:u,executeDispatchesInOrder:s,executeDispatchesInOrderStopAtTrue:c,hasDispatches:d,getNode:function(e){return v.Mount.getNode(e)},getID:function(e){return v.Mount.getID(e)},injection:v};t.exports=g},{133:133,15:15,151:151}],20:[function(e,t,n){"use strict";function r(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return y(e,r)}function o(e,t,n){var o=t?g.bubbled:g.captured,i=r(e,n,o);i&&(n._dispatchListeners=v(n._dispatchListeners,i),n._dispatchIDs=v(n._dispatchIDs,e))}function i(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.injection.getInstanceHandle().traverseTwoPhase(e.dispatchMarker,o,e)}function a(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(e.dispatchMarker,o,e)}function u(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,o=y(e,r);o&&(n._dispatchListeners=v(n._dispatchListeners,o),n._dispatchIDs=v(n._dispatchIDs,e))}}function s(e){e&&e.dispatchConfig.registrationName&&u(e.dispatchMarker,null,e)}function l(e){m(e,i)}function c(e){m(e,a)}function p(e,t,n,r){h.injection.getInstanceHandle().traverseEnterLeave(n,r,u,e,t)}function d(e){m(e,s)}var f=e(15),h=e(17),v=(e(151),e(104)),m=e(119),g=f.PropagationPhases,y=h.getListener,C={accumulateTwoPhaseDispatches:l,accumulateTwoPhaseDispatchesSkipTarget:c,accumulateDirectDispatches:d,accumulateEnterLeaveDispatches:p};t.exports=C},{104:104,119:119,15:15,151:151,17:17}],21:[function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};t.exports=o},{}],22:[function(e,t,n){"use strict";function r(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var o=e(27),i=e(26),a=e(128);i(r.prototype,{getText:function(){return"value"in this._root?this._root.value:this._root[a()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,r=n.length,o=this.getText(),i=o.length;for(e=0;r>e&&n[e]===o[e];e++);var a=r-e;for(t=1;a>=t&&n[r-t]===o[i-t];t++);var u=t>1?1-t:void 0;return this._fallbackText=o.slice(e,u),this._fallbackText}}),o.addPoolingTo(r),t.exports=r},{128:128,26:26,27:27}],23:[function(e,t,n){"use strict";var r,o=e(10),i=e(21),a=o.injection.MUST_USE_ATTRIBUTE,u=o.injection.MUST_USE_PROPERTY,s=o.injection.HAS_BOOLEAN_VALUE,l=o.injection.HAS_SIDE_EFFECTS,c=o.injection.HAS_NUMERIC_VALUE,p=o.injection.HAS_POSITIVE_NUMERIC_VALUE,d=o.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(i.canUseDOM){var f=document.implementation;r=f&&f.hasFeature&&f.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var h={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:a|s,allowTransparency:a,alt:null,async:s,autoComplete:null,autoPlay:s,capture:a|s,cellPadding:null,cellSpacing:null,charSet:a,checked:u|s,classID:a,className:r?a:u,cols:a|p,colSpan:null,content:null,contentEditable:null,contextMenu:a,controls:u|s,coords:null,crossOrigin:null,data:null,dateTime:a,defer:s,dir:null,disabled:a|s,download:d,draggable:null,encType:null,form:a,formAction:a,formEncType:a,formMethod:a,formNoValidate:s,formTarget:a,frameBorder:a,headers:null,height:a,hidden:a|s,high:null,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:u,label:null,lang:null,list:a,loop:u|s,low:null,manifest:a,marginHeight:null,marginWidth:null,max:null,maxLength:a,media:a,mediaGroup:null,method:null,min:null,minLength:a,multiple:u|s,muted:u|s,name:null,noValidate:s,open:s,optimum:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:u|s,rel:null,required:s,role:a,rows:a|p,rowSpan:null,sandbox:null,scope:null,scoped:s,scrolling:null,seamless:a|s,selected:u|s,shape:null,size:a|p,sizes:a,span:p,spellCheck:null,src:null,srcDoc:u,srcSet:a,start:c,step:null,style:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:u|l,width:a,wmode:a,autoCapitalize:null,autoCorrect:null,itemProp:a,itemScope:a|s,itemType:a,itemID:a,itemRef:a,property:null,unselectable:a},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoCapitalize:"autocapitalize",autoComplete:"autocomplete",autoCorrect:"autocorrect",autoFocus:"autofocus",autoPlay:"autoplay",encType:"encoding",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};t.exports=h},{10:10,21:21}],24:[function(e,t,n){"use strict";function r(e){null!=e.checkedLink&&null!=e.valueLink?l(!1):void 0}function o(e){r(e),null!=e.value||null!=e.onChange?l(!1):void 0}function i(e){r(e),null!=e.checked||null!=e.onChange?l(!1):void 0}function a(e){this.props.valueLink.requestChange(e.target.value)}function u(e){this.props.checkedLink.requestChange(e.target.checked)}var s=e(78),l=e(133),c={button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0},p={Mixin:{propTypes:{value:function(e,t,n){return!e[t]||c[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t,n){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:s.func}},getValue:function(e){return e.valueLink?(o(e),e.valueLink.value):e.value},getChecked:function(e){return e.checkedLink?(i(e),e.checkedLink.value):e.checked},getOnChange:function(e){return e.valueLink?(o(e),a):e.checkedLink?(i(e),u):e.onChange}};t.exports=p},{133:133,78:78}],25:[function(e,t,n){"use strict";function r(e){e.remove()}var o=e(29),i=e(104),a=e(116),u=e(119),s=e(133),l={trapBubbledEvent:function(e,t){this.isMounted()?void 0:s(!1);var n=a(this);n?void 0:s(!1);var r=o.trapBubbledEvent(e,t,n);this._localEventListeners=i(this._localEventListeners,r)},componentWillUnmount:function(){this._localEventListeners&&u(this._localEventListeners,r)}};t.exports=l},{104:104,116:116,119:119,133:133,29:29}],26:[function(e,t,n){"use strict";function r(e,t){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var n=Object(e),r=Object.prototype.hasOwnProperty,o=1;o<arguments.length;o++){var i=arguments[o];if(null!=i){var a=Object(i);for(var u in a)r.call(a,u)&&(n[u]=a[u])}}return n}t.exports=r},{}],27:[function(e,t,n){"use strict";var r=e(133),o=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},i=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},a=function(e,t,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,e,t,n),o}return new r(e,t,n)},u=function(e,t,n,r,o){var i=this;if(i.instancePool.length){var a=i.instancePool.pop();return i.call(a,e,t,n,r,o),a}return new i(e,t,n,r,o)},s=function(e){var t=this;e instanceof t?void 0:r(!1),e.destructor&&e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},l=10,c=o,p=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||c,n.poolSize||(n.poolSize=l),n.release=s,n},d={addPoolingTo:p,oneArgumentPooler:o,twoArgumentPooler:i,threeArgumentPooler:a,fiveArgumentPooler:u};t.exports=d},{133:133}],28:[function(e,t,n){"use strict";var r=(e(66),e(116)),o=(e(151),"_getDOMNodeDidWarn"),i={getDOMNode:function(){return this.constructor[o]=!0,r(this)}};t.exports=i},{116:116,151:151,66:66}],29:[function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,v)||(e[v]=f++,p[e[v]]={}),p[e[v]]}var o=e(15),i=e(17),a=e(18),u=e(60),s=e(103),l=e(26),c=e(134),p={},d=!1,f=0,h={topBlur:"blur",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topScroll:"scroll",topSelectionChange:"selectionchange",topTextInput:"textInput",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topWheel:"wheel"},v="_reactListenersID"+String(Math.random()).slice(2),m=l({},u,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(m.handleTopLevel),m.ReactEventListener=e}},setEnabled:function(e){m.ReactEventListener&&m.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!m.ReactEventListener||!m.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,i=r(n),u=a.registrationNameDependencies[e],s=o.topLevelTypes,l=0;l<u.length;l++){var p=u[l];i.hasOwnProperty(p)&&i[p]||(p===s.topWheel?c("wheel")?m.ReactEventListener.trapBubbledEvent(s.topWheel,"wheel",n):c("mousewheel")?m.ReactEventListener.trapBubbledEvent(s.topWheel,"mousewheel",n):m.ReactEventListener.trapBubbledEvent(s.topWheel,"DOMMouseScroll",n):p===s.topScroll?c("scroll",!0)?m.ReactEventListener.trapCapturedEvent(s.topScroll,"scroll",n):m.ReactEventListener.trapBubbledEvent(s.topScroll,"scroll",m.ReactEventListener.WINDOW_HANDLE):p===s.topFocus||p===s.topBlur?(c("focus",!0)?(m.ReactEventListener.trapCapturedEvent(s.topFocus,"focus",n),m.ReactEventListener.trapCapturedEvent(s.topBlur,"blur",n)):c("focusin")&&(m.ReactEventListener.trapBubbledEvent(s.topFocus,"focusin",n),m.ReactEventListener.trapBubbledEvent(s.topBlur,"focusout",n)),i[s.topBlur]=!0,i[s.topFocus]=!0):h.hasOwnProperty(p)&&m.ReactEventListener.trapBubbledEvent(p,h[p],n),i[p]=!0)}},trapBubbledEvent:function(e,t,n){return m.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return m.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(!d){var e=s.refreshScrollValues;
m.ReactEventListener.monitorScrollValue(e),d=!0}},eventNameDispatchConfigs:i.eventNameDispatchConfigs,registrationNameModules:i.registrationNameModules,putListener:i.putListener,getListener:i.getListener,deleteListener:i.deleteListener,deleteAllListeners:i.deleteAllListeners});t.exports=m},{103:103,134:134,15:15,17:17,18:18,26:26,60:60}],30:[function(e,t,n){"use strict";var r=e(80),o=e(117),i=e(132),a=e(147),u={instantiateChildren:function(e,t,n){var r=o(e);for(var a in r)if(r.hasOwnProperty(a)){var u=r[a],s=i(u,null);r[a]=s}return r},updateChildren:function(e,t,n,u){var s=o(t);if(!s&&!e)return null;var l;for(l in s)if(s.hasOwnProperty(l)){var c=e&&e[l],p=c&&c._currentElement,d=s[l];if(a(p,d))r.receiveComponent(c,d,n,u),s[l]=c;else{c&&r.unmountComponent(c,l);var f=i(d,null);s[l]=f}}for(l in e)!e.hasOwnProperty(l)||s&&s.hasOwnProperty(l)||r.unmountComponent(e[l]);return s},unmountChildren:function(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];r.unmountComponent(n)}}};t.exports=u},{117:117,132:132,147:147,80:80}],31:[function(e,t,n){"use strict";function r(e,t){this.func=e,this.context=t,this.count=0}function o(e,t,n){var r=e;r.func.call(r.context,t,r.count++)}function i(e,t,n){if(null==e)return e;var i=r.getPooled(t,n);f(e,o,i),r.release(i)}function a(e,t,n){this.result=e,this.func=t,this.context=n,this.count=0}function u(e,t,n){var r=e,o=r.result,i=void 0===o[n];if(i){var a=r.func.call(r.context,t,r.count++);o[n]=a}}function s(e,t,n){if(null==e)return e;var r={},o=a.getPooled(r,t,n);return f(e,u,o),a.release(o),d.create(r)}function l(e,t,n){return null}function c(e,t){return f(e,l,null)}var p=e(27),d=e(62),f=e(149),h=(e(151),p.twoArgumentPooler),v=p.threeArgumentPooler;p.addPoolingTo(r,h),p.addPoolingTo(a,v);var m={forEach:i,map:s,count:c};t.exports=m},{149:149,151:151,27:27,62:62}],32:[function(e,t,n){"use strict";function r(e,t){var n=D.hasOwnProperty(t)?D[t]:null;I.hasOwnProperty(t)&&(n!==_.OVERRIDE_BASE?y(!1):void 0),e.hasOwnProperty(t)&&(n!==_.DEFINE_MANY&&n!==_.DEFINE_MANY_MERGED?y(!1):void 0)}function o(e,t){if(t){"function"==typeof t?y(!1):void 0,d.isValidElement(t)?y(!1):void 0;var n=e.prototype;t.hasOwnProperty(b)&&M.mixins(e,t.mixins);for(var o in t)if(t.hasOwnProperty(o)&&o!==b){var i=t[o];if(r(n,o),M.hasOwnProperty(o))M[o](e,i);else{var a=D.hasOwnProperty(o),l=n.hasOwnProperty(o),c="function"==typeof i,p=c&&!a&&!l;if(p)n.__reactAutoBindMap||(n.__reactAutoBindMap={}),n.__reactAutoBindMap[o]=i,n[o]=i;else if(l){var f=D[o];!a||f!==_.DEFINE_MANY_MERGED&&f!==_.DEFINE_MANY?y(!1):void 0,f===_.DEFINE_MANY_MERGED?n[o]=u(n[o],i):f===_.DEFINE_MANY&&(n[o]=s(n[o],i))}else n[o]=i}}}}function i(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var o=n in M;o?y(!1):void 0;var i=n in e;i?y(!1):void 0,e[n]=r}}}function a(e,t){e&&t&&"object"==typeof e&&"object"==typeof t?void 0:y(!1);for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?y(!1):void 0,e[n]=t[n]);return e}function u(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return a(o,n),a(o,r),o}}function s(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function l(e,t){var n=t.bind(e);return n}function c(e){for(var t in e.__reactAutoBindMap)if(e.__reactAutoBindMap.hasOwnProperty(t)){var n=e.__reactAutoBindMap[t];e[t]=l(e,f.guard(n,e.constructor.displayName+"."+t))}}var p=e(33),d=(e(38),e(56)),f=e(59),h=e(66),v=e(68),m=(e(77),e(76),e(85)),g=e(26),y=e(133),C=e(138),E=e(139),b=(e(151),E({mixins:null})),_=C({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),x=[],D={mixins:_.DEFINE_MANY,statics:_.DEFINE_MANY,propTypes:_.DEFINE_MANY,contextTypes:_.DEFINE_MANY,childContextTypes:_.DEFINE_MANY,getDefaultProps:_.DEFINE_MANY_MERGED,getInitialState:_.DEFINE_MANY_MERGED,getChildContext:_.DEFINE_MANY_MERGED,render:_.DEFINE_ONCE,componentWillMount:_.DEFINE_MANY,componentDidMount:_.DEFINE_MANY,componentWillReceiveProps:_.DEFINE_MANY,shouldComponentUpdate:_.DEFINE_ONCE,componentWillUpdate:_.DEFINE_MANY,componentDidUpdate:_.DEFINE_MANY,componentWillUnmount:_.DEFINE_MANY,updateComponent:_.OVERRIDE_BASE},M={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)o(e,t[n])},childContextTypes:function(e,t){e.childContextTypes=g({},e.childContextTypes,t)},contextTypes:function(e,t){e.contextTypes=g({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=u(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){e.propTypes=g({},e.propTypes,t)},statics:function(e,t){i(e,t)}},I={replaceState:function(e,t){m.enqueueReplaceState(this,e),t&&m.enqueueCallback(this,t)},isMounted:function(){var e=h.get(this);return e?e!==v.currentlyMountingInstance:!1},setProps:function(e,t){m.enqueueSetProps(this,e),t&&m.enqueueCallback(this,t)},replaceProps:function(e,t){m.enqueueReplaceProps(this,e),t&&m.enqueueCallback(this,t)}},N=function(){};g(N.prototype,p.prototype,I);var T={createClass:function(e){var t=function(e,t){this.__reactAutoBindMap&&c(this),this.props=e,this.context=t,this.state=null;var n=this.getInitialState?this.getInitialState():null;"object"!=typeof n||Array.isArray(n)?y(!1):void 0,this.state=n};t.prototype=new N,t.prototype.constructor=t,x.forEach(o.bind(null,t)),o(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),t.prototype.render?void 0:y(!1);for(var n in D)t.prototype[n]||(t.prototype[n]=null);return t.type=t,t},injection:{injectMixin:function(e){x.push(e)}}};t.exports=T},{133:133,138:138,139:139,151:151,26:26,33:33,38:38,56:56,59:59,66:66,68:68,76:76,77:77,85:85}],33:[function(e,t,n){"use strict";function r(e,t){this.props=e,this.context=t}var o=e(85),i=e(133);e(151);r.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e?i(!1):void 0,o.enqueueSetState(this,e),t&&o.enqueueCallback(this,t)},r.prototype.forceUpdate=function(e){o.enqueueForceUpdate(this),e&&o.enqueueCallback(this,e)};t.exports=r},{133:133,151:151,85:85}],34:[function(e,t,n){"use strict";var r=e(44),o=e(70),i={processChildrenUpdates:r.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkupByID:r.dangerouslyReplaceNodeWithMarkupByID,unmountIDFromEnvironment:function(e){o.purgeID(e)}};t.exports=i},{44:44,70:70}],35:[function(e,t,n){"use strict";var r=e(133),o=!1,i={unmountIDFromEnvironment:null,replaceNodeWithMarkupByID:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){o?r(!1):void 0,i.unmountIDFromEnvironment=e.unmountIDFromEnvironment,i.replaceNodeWithMarkupByID=e.replaceNodeWithMarkupByID,i.processChildrenUpdates=e.processChildrenUpdates,o=!0}}};t.exports=i},{133:133}],36:[function(e,t,n){"use strict";function r(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" Check the render method of `"+n+"`."}return""}var o=e(35),i=e(37),a=e(38),u=e(56),s=(e(57),e(66)),l=e(68),c=e(73),p=e(75),d=e(77),f=(e(76),e(80)),h=e(86),v=e(26),m=e(114),g=e(133),y=e(147),C=(e(151),1),E={construct:function(e){this._currentElement=e,this._rootNodeID=null,this._instance=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._isTopLevel=!1,this._pendingCallbacks=null},mountComponent:function(e,t,n){this._context=n,this._mountOrder=C++,this._rootNodeID=e;var r=this._processProps(this._currentElement.props),o=this._processContext(n),i=c.getComponentClassForElement(this._currentElement),a=new i(r,o);a.props=r,a.context=o,a.refs=m,this._instance=a,s.set(a,this);var u=a.state;void 0===u&&(a.state=u=null),"object"!=typeof u||Array.isArray(u)?g(!1):void 0,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1;var p,d=l.currentlyMountingInstance;l.currentlyMountingInstance=this;try{a.componentWillMount&&(a.componentWillMount(),this._pendingStateQueue&&(a.state=this._processPendingState(a.props,a.context))),p=this._renderValidatedComponent()}finally{l.currentlyMountingInstance=d}this._renderedComponent=this._instantiateReactComponent(p,this._currentElement.type);var h=f.mountComponent(this._renderedComponent,e,t,this._processChildContext(n));return a.componentDidMount&&t.getReactMountReady().enqueue(a.componentDidMount,a),h},unmountComponent:function(){var e=this._instance;if(e.componentWillUnmount){var t=l.currentlyUnmountingInstance;l.currentlyUnmountingInstance=this;try{e.componentWillUnmount()}finally{l.currentlyUnmountingInstance=t}}f.unmountComponent(this._renderedComponent),this._renderedComponent=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,this._context=null,this._rootNodeID=null,s.remove(e)},_setPropsInternal:function(e,t){var n=this._pendingElement||this._currentElement;this._pendingElement=u.cloneAndReplaceProps(n,v({},n.props,e)),h.enqueueUpdate(this,t)},_maskContext:function(e){var t=null,n=c.getComponentClassForElement(this._currentElement),r=n.contextTypes;if(!r)return m;t={};for(var o in r)t[o]=e[o];return t},_processContext:function(e){var t=this._maskContext(e);return t},_processChildContext:function(e){var t=this._instance,n=t.getChildContext&&t.getChildContext();if(n){"object"!=typeof t.constructor.childContextTypes?g(!1):void 0;for(var r in n)r in t.constructor.childContextTypes?void 0:g(!1);return v({},e,n)}return e},_processProps:function(e){return e},_checkPropTypes:function(e,t,n){var o=this.getName();for(var i in e)if(e.hasOwnProperty(i)){var a;try{"function"!=typeof e[i]?g(!1):void 0,a=e[i](t,i,o,n)}catch(u){a=u}a instanceof Error&&(r(this),n===d.prop)}},receiveComponent:function(e,t,n){var r=this._currentElement,o=this._context;this._pendingElement=null,this.updateComponent(t,r,e,o,n)},performUpdateIfNecessary:function(e){null!=this._pendingElement&&f.receiveComponent(this,this._pendingElement||this._currentElement,e,this._context),(null!==this._pendingStateQueue||this._pendingForceUpdate)&&this.updateComponent(e,this._currentElement,this._currentElement,this._context,this._context)},updateComponent:function(e,t,n,r,o){var i=this._instance,a=i.context,u=i.props;t!==n&&(a=this._processContext(o),u=this._processProps(n.props),i.componentWillReceiveProps&&i.componentWillReceiveProps(u,a));var s=this._processPendingState(u,a),l=this._pendingForceUpdate||!i.shouldComponentUpdate||i.shouldComponentUpdate(u,s,a);l?(this._pendingForceUpdate=!1,this._performComponentUpdate(n,u,s,a,e,o)):(this._currentElement=n,this._context=o,i.props=u,i.state=s,i.context=a)},_processPendingState:function(e,t){var n=this._instance,r=this._pendingStateQueue,o=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!r)return n.state;if(o&&1===r.length)return r[0];for(var i=v({},o?r[0]:n.state),a=o?1:0;a<r.length;a++){var u=r[a];v(i,"function"==typeof u?u.call(n,i,e,t):u)}return i},_performComponentUpdate:function(e,t,n,r,o,i){var a=this._instance,u=a.props,s=a.state,l=a.context;a.componentWillUpdate&&a.componentWillUpdate(t,n,r),this._currentElement=e,this._context=i,a.props=t,a.state=n,a.context=r,this._updateRenderedComponent(o,i),a.componentDidUpdate&&o.getReactMountReady().enqueue(a.componentDidUpdate.bind(a,u,s,l),a)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,r=n._currentElement,o=this._renderValidatedComponent();if(y(r,o))f.receiveComponent(n,o,e,this._processChildContext(t));else{var i=this._rootNodeID,a=n._rootNodeID;f.unmountComponent(n),this._renderedComponent=this._instantiateReactComponent(o,this._currentElement.type);var u=f.mountComponent(this._renderedComponent,i,e,this._processChildContext(t));this._replaceNodeWithMarkupByID(a,u)}},_replaceNodeWithMarkupByID:function(e,t){o.replaceNodeWithMarkupByID(e,t)},_renderValidatedComponentWithoutOwnerOrContext:function(){var e=this._instance,t=e.render();return t},_renderValidatedComponent:function(){var e,t=i.current;i.current=this._processChildContext(this._currentElement._context),a.current=this;try{e=this._renderValidatedComponentWithoutOwnerOrContext()}finally{i.current=t,a.current=null}return null===e||e===!1||u.isValidElement(e)?void 0:g(!1),e},attachRef:function(e,t){var n=this.getPublicInstance(),r=n.refs===m?n.refs={}:n.refs;r[e]=t.getPublicInstance()},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[e]},getName:function(){var e=this._currentElement.type,t=this._instance&&this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){return this._instance},_instantiateReactComponent:null};p.measureMethods(E,"ReactCompositeComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent",_renderValidatedComponent:"_renderValidatedComponent"});var b={Mixin:E};t.exports=b},{114:114,133:133,147:147,151:151,26:26,35:35,37:37,38:38,56:56,57:57,66:66,68:68,73:73,75:75,76:76,77:77,80:80,86:86}],37:[function(e,t,n){"use strict";var r=e(114),o={current:r};t.exports=o},{114:114}],38:[function(e,t,n){"use strict";var r={current:null};t.exports=r},{}],39:[function(e,t,n){"use strict";function r(e){return o.createFactory(e)}var o=e(56),i=(e(57),e(140)),a=i({a:"a",abbr:"abbr",address:"address",area:"area",article:"article",aside:"aside",audio:"audio",b:"b",base:"base",bdi:"bdi",bdo:"bdo",big:"big",blockquote:"blockquote",body:"body",br:"br",button:"button",canvas:"canvas",caption:"caption",cite:"cite",code:"code",col:"col",colgroup:"colgroup",data:"data",datalist:"datalist",dd:"dd",del:"del",details:"details",dfn:"dfn",dialog:"dialog",div:"div",dl:"dl",dt:"dt",em:"em",embed:"embed",fieldset:"fieldset",figcaption:"figcaption",figure:"figure",footer:"footer",form:"form",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",head:"head",header:"header",hgroup:"hgroup",hr:"hr",html:"html",i:"i",iframe:"iframe",img:"img",input:"input",ins:"ins",kbd:"kbd",keygen:"keygen",label:"label",legend:"legend",li:"li",link:"link",main:"main",map:"map",mark:"mark",menu:"menu",menuitem:"menuitem",meta:"meta",meter:"meter",nav:"nav",noscript:"noscript",object:"object",ol:"ol",optgroup:"optgroup",option:"option",output:"output",p:"p",param:"param",picture:"picture",pre:"pre",progress:"progress",q:"q",rp:"rp",rt:"rt",ruby:"ruby",s:"s",samp:"samp",script:"script",section:"section",select:"select",small:"small",source:"source",span:"span",strong:"strong",style:"style",sub:"sub",summary:"summary",sup:"sup",table:"table",tbody:"tbody",td:"td",textarea:"textarea",tfoot:"tfoot",th:"th",thead:"thead",time:"time",title:"title",tr:"tr",track:"track",u:"u",ul:"ul","var":"var",video:"video",wbr:"wbr",circle:"circle",clipPath:"clipPath",defs:"defs",ellipse:"ellipse",g:"g",line:"line",linearGradient:"linearGradient",mask:"mask",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",radialGradient:"radialGradient",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan"},r);t.exports=a},{140:140,56:56,57:57}],40:[function(e,t,n){"use strict";var r=e(2),o=e(28),i=e(32),a=e(56),u=e(138),s=a.createFactory("button"),l=u({onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0}),c=i.createClass({displayName:"ReactDOMButton",tagName:"BUTTON",mixins:[r,o],render:function(){var e={};for(var t in this.props)!this.props.hasOwnProperty(t)||this.props.disabled&&l[t]||(e[t]=this.props[t]);return s(e,this.props.children)}});t.exports=c},{138:138,2:2,28:28,32:32,56:56}],41:[function(e,t,n){"use strict";var r=e(38),o=e(52),i=e(55),a=e(65),u=e(70),s=e(75),l=e(80),c=e(116);e(151);i.inject();var p=s.measure("React","render",u.render),d={constructAndRenderComponent:u.constructAndRenderComponent,constructAndRenderComponentByID:u.constructAndRenderComponentByID,findDOMNode:c,render:p,unmountComponentAtNode:u.unmountComponentAtNode};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:r,InstanceHandles:a,Mount:u,Reconciler:l,TextComponent:o});t.exports=d},{116:116,151:151,38:38,52:52,55:55,65:65,70:70,75:75,80:80}],42:[function(e,t,n){"use strict";function r(e,t){t&&(null!=t.dangerouslySetInnerHTML&&(null!=t.children?C(!1):void 0,"object"==typeof t.dangerouslySetInnerHTML&&"__html"in t.dangerouslySetInnerHTML?void 0:C(!1)),null!=t.style&&"object"!=typeof t.style?C(!1):void 0)}function o(e,t,n,r){var o=h.findReactContainerForID(e);if(o){var a=o.nodeType===I?o.ownerDocument:o;_(t,a)}r.getReactMountReady().enqueue(i,{id:e,registrationName:t,listener:n})}function i(){var e=this;d.putListener(e.id,e.registrationName,e.listener)}function a(e){O.call(w,e)||(P.test(e)?void 0:C(!1),w[e]=!0)}function u(e,t){return e}function s(e){a(e),this._tag=e,this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._rootNodeID=null}var l=e(5),c=e(10),p=e(11),d=e(29),f=e(34),h=e(70),v=e(71),m=e(75),g=e(26),y=e(115),C=e(133),E=(e(134),e(139)),b=(e(146),e(150),e(151),d.deleteListener),_=d.listenTo,x=d.registrationNameModules,D={string:!0,number:!0},M=E({style:null}),I=1,N=null,T={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},R={listing:!0,pre:!0,textarea:!0},P=(g({menuitem:!0},T),/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/),w={},O={}.hasOwnProperty;s.displayName="ReactDOMComponent",s.Mixin={construct:function(e){this._currentElement=e},mountComponent:function(e,t,n){this._rootNodeID=e,r(this,this._currentElement.props);var o=this._createOpenTagMarkupAndPutListeners(t),i=this._createContentMarkup(t,n);return!i&&T[this._tag]?o+"/>":o+">"+i+"</"+this._tag+">"},_createOpenTagMarkupAndPutListeners:function(e){var t=this._currentElement.props,n="<"+this._tag;for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];if(null!=i)if(x.hasOwnProperty(r))o(this._rootNodeID,r,i,e);else{r===M&&(i&&(i=this._previousStyleCopy=g({},t.style)),i=l.createMarkupForStyles(i));var a=p.createMarkupForProperty(r,i);a&&(n+=" "+a)}}if(e.renderToStaticMarkup)return n;var u=p.createMarkupForID(this._rootNodeID);return n+" "+u},_createContentMarkup:function(e,t){var n="",r=this._currentElement.props,o=r.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&(n=o.__html);else{var i=D[typeof r.children]?r.children:null,a=null!=i?null:r.children;if(null!=i)n=y(i);else if(null!=a){var s=this.mountChildren(a,e,u(t,this));n=s.join("")}}return R[this._tag]&&"\n"===n.charAt(0)?"\n"+n:n},receiveComponent:function(e,t,n){var r=this._currentElement;this._currentElement=e,this.updateComponent(t,r,e,n)},updateComponent:function(e,t,n,o){r(this,this._currentElement.props),this._updateDOMProperties(t.props,e),this._updateDOMChildren(t.props,e,u(o,this))},_updateDOMProperties:function(e,t){var n,r,i,a=this._currentElement.props;for(n in e)if(!a.hasOwnProperty(n)&&e.hasOwnProperty(n))if(n===M){var u=this._previousStyleCopy;for(r in u)u.hasOwnProperty(r)&&(i=i||{},i[r]="");this._previousStyleCopy=null}else x.hasOwnProperty(n)?e[n]&&b(this._rootNodeID,n):(c.isStandardName[n]||c.isCustomAttribute(n))&&N.deletePropertyByID(this._rootNodeID,n);for(n in a){var s=a[n],l=n===M?this._previousStyleCopy:e[n];if(a.hasOwnProperty(n)&&s!==l)if(n===M)if(s?s=this._previousStyleCopy=g({},s):this._previousStyleCopy=null,l){for(r in l)!l.hasOwnProperty(r)||s&&s.hasOwnProperty(r)||(i=i||{},i[r]="");for(r in s)s.hasOwnProperty(r)&&l[r]!==s[r]&&(i=i||{},i[r]=s[r])}else i=s;else x.hasOwnProperty(n)?s?o(this._rootNodeID,n,s,t):l&&b(this._rootNodeID,n):(c.isStandardName[n]||c.isCustomAttribute(n))&&N.updatePropertyByID(this._rootNodeID,n,s)}i&&N.updateStylesByID(this._rootNodeID,i)},_updateDOMChildren:function(e,t,n){var r=this._currentElement.props,o=D[typeof e.children]?e.children:null,i=D[typeof r.children]?r.children:null,a=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,u=r.dangerouslySetInnerHTML&&r.dangerouslySetInnerHTML.__html,s=null!=o?null:e.children,l=null!=i?null:r.children,c=null!=o||null!=a,p=null!=i||null!=u;null!=s&&null==l?this.updateChildren(null,t,n):c&&!p&&this.updateTextContent(""),null!=i?o!==i&&this.updateTextContent(""+i):null!=u?a!==u&&N.updateInnerHTMLByID(this._rootNodeID,u):null!=l&&this.updateChildren(l,t,n)},unmountComponent:function(){this.unmountChildren(),d.deleteAllListeners(this._rootNodeID),f.unmountIDFromEnvironment(this._rootNodeID),this._rootNodeID=null}},m.measureMethods(s,"ReactDOMComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent"}),g(s.prototype,s.Mixin,v.Mixin),s.injection={injectIDOperations:function(e){s.BackendIDOperations=N=e}},t.exports=s},{10:10,11:11,115:115,133:133,134:134,139:139,146:146,150:150,151:151,26:26,29:29,34:34,5:5,70:70,71:71,75:75}],43:[function(e,t,n){"use strict";var r=e(15),o=e(25),i=e(28),a=e(32),u=e(56),s=u.createFactory("form"),l=a.createClass({displayName:"ReactDOMForm",tagName:"FORM",mixins:[i,o],render:function(){return s(this.props)},componentDidMount:function(){this.trapBubbledEvent(r.topLevelTypes.topReset,"reset"),this.trapBubbledEvent(r.topLevelTypes.topSubmit,"submit")}});t.exports=l},{15:15,25:25,28:28,32:32,56:56}],44:[function(e,t,n){"use strict";var r=e(5),o=e(9),i=e(11),a=e(70),u=e(75),s=e(133),l=e(144),c={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},p={updatePropertyByID:function(e,t,n){var r=a.getNode(e);c.hasOwnProperty(t)?s(!1):void 0,null!=n?i.setValueForProperty(r,t,n):i.deleteValueForProperty(r,t)},deletePropertyByID:function(e,t,n){var r=a.getNode(e);c.hasOwnProperty(t)?s(!1):void 0,i.deleteValueForProperty(r,t,n)},updateStylesByID:function(e,t){var n=a.getNode(e);r.setValueForStyles(n,t)},updateInnerHTMLByID:function(e,t){var n=a.getNode(e);l(n,t)},updateTextContentByID:function(e,t){var n=a.getNode(e);o.updateTextContent(n,t)},dangerouslyReplaceNodeWithMarkupByID:function(e,t){var n=a.getNode(e);o.dangerouslyReplaceNodeWithMarkup(n,t)},dangerouslyProcessChildrenUpdates:function(e,t){for(var n=0;n<e.length;n++)e[n].parentNode=a.getNode(e[n].parentID);o.processUpdates(e,t)}};u.measureMethods(p,"ReactDOMIDOperations",{updatePropertyByID:"updatePropertyByID",deletePropertyByID:"deletePropertyByID",updateStylesByID:"updateStylesByID",updateInnerHTMLByID:"updateInnerHTMLByID",updateTextContentByID:"updateTextContentByID",dangerouslyReplaceNodeWithMarkupByID:"dangerouslyReplaceNodeWithMarkupByID",dangerouslyProcessChildrenUpdates:"dangerouslyProcessChildrenUpdates"}),t.exports=p},{11:11,133:133,144:144,5:5,70:70,75:75,9:9}],45:[function(e,t,n){"use strict";var r=e(15),o=e(25),i=e(28),a=e(32),u=e(56),s=u.createFactory("iframe"),l=a.createClass({displayName:"ReactDOMIframe",tagName:"IFRAME",mixins:[i,o],render:function(){return s(this.props)},componentDidMount:function(){this.trapBubbledEvent(r.topLevelTypes.topLoad,"load")}});t.exports=l},{15:15,25:25,28:28,32:32,56:56}],46:[function(e,t,n){"use strict";var r=e(15),o=e(25),i=e(28),a=e(32),u=e(56),s=u.createFactory("img"),l=a.createClass({displayName:"ReactDOMImg",tagName:"IMG",mixins:[i,o],render:function(){return s(this.props)},componentDidMount:function(){this.trapBubbledEvent(r.topLevelTypes.topLoad,"load"),this.trapBubbledEvent(r.topLevelTypes.topError,"error")}});t.exports=l},{15:15,25:25,28:28,32:32,56:56}],47:[function(e,t,n){"use strict";function r(){this.isMounted()&&this.forceUpdate()}var o=e(2),i=e(11),a=e(24),u=e(28),s=e(32),l=e(56),c=e(70),p=e(86),d=e(26),f=e(116),h=e(133),v=l.createFactory("input"),m={},g=s.createClass({displayName:"ReactDOMInput",tagName:"INPUT",mixins:[o,a.Mixin,u],getInitialState:function(){var e=this.props.defaultValue;return{initialChecked:this.props.defaultChecked||!1,initialValue:null!=e?e:null}},render:function(){var e=d({},this.props);e.defaultChecked=null,e.defaultValue=null;var t=a.getValue(this.props);e.value=null!=t?t:this.state.initialValue;var n=a.getChecked(this.props);return e.checked=null!=n?n:this.state.initialChecked,e.onChange=this._handleChange,v(e,this.props.children)},componentDidMount:function(){var e=c.getID(f(this));m[e]=this},componentWillUnmount:function(){var e=f(this),t=c.getID(e);delete m[t]},componentDidUpdate:function(e,t,n){var r=f(this);null!=this.props.checked&&i.setValueForProperty(r,"checked",this.props.checked||!1);var o=a.getValue(this.props);null!=o&&i.setValueForProperty(r,"value",""+o)},_handleChange:function(e){var t,n=a.getOnChange(this.props);n&&(t=n.call(this,e)),p.asap(r,this);var o=this.props.name;if("radio"===this.props.type&&null!=o){for(var i=f(this),u=i;u.parentNode;)u=u.parentNode;for(var s=u.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),l=0;l<s.length;l++){var d=s[l];if(d!==i&&d.form===i.form){var v=c.getID(d);v?void 0:h(!1);var g=m[v];g?void 0:h(!1),p.asap(r,g)}}}return t}});t.exports=g},{11:11,116:116,133:133,2:2,24:24,26:26,28:28,32:32,56:56,70:70,86:86}],48:[function(e,t,n){"use strict";var r=e(28),o=e(31),i=e(32),a=e(49),u=e(56),s=e(78),l=e(26),c=(e(151),u.createFactory("option")),p=a.valueContextKey,d=i.createClass({displayName:"ReactDOMOption",tagName:"OPTION",mixins:[r],getInitialState:function(){return{selected:null}},contextTypes:function(){var e={};return e[p]=s.any,e}(),componentWillMount:function(){var e=this.context,t=e[p];if(null!=t){var n=!1;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(""+t[r]==""+this.props.value){n=!0;break}}else n=""+t==""+this.props.value;this.setState({selected:n})}},render:function(){var e=this.props;null!=this.state.selected&&(e=l({},e,{selected:this.state.selected}));var t="";return o.forEach(this.props.children,function(e){null!=e&&("string"==typeof e||"number"==typeof e)&&(t+=e)}),c(e,t)}});t.exports=d},{151:151,26:26,28:28,31:31,32:32,49:49,56:56,78:78}],49:[function(e,t,n){"use strict";function r(){if(this._pendingUpdate){this._pendingUpdate=!1;var e=u.getValue(this.props);null!=e&&this.isMounted()&&i(this,e)}}function o(e,t,n){if(null==e[t])return null;if(e.multiple){if(!Array.isArray(e[t]))return new Error("The `"+t+"` prop supplied to <select> must be an array if `multiple` is true.")}else if(Array.isArray(e[t]))return new Error("The `"+t+"` prop supplied to <select> must be a scalar value if `multiple` is false.")}function i(e,t){var n,r,o=h(e).options;if(e.props.multiple){for(n={},r=0;r<t.length;r++)n[""+t[r]]=!0;for(r=0;r<o.length;r++){var i=n.hasOwnProperty(o[r].value);o[r].selected!==i&&(o[r].selected=i)}}else{for(n=""+t,r=0;r<o.length;r++)if(o[r].value===n)return void(o[r].selected=!0);o.length&&(o[0].selected=!0)}}var a=e(2),u=e(24),s=e(28),l=e(32),c=e(56),p=e(86),d=e(78),f=e(26),h=e(116),v=c.createFactory("select"),m="__ReactDOMSelect_value$"+Math.random().toString(36).slice(2),g=l.createClass({displayName:"ReactDOMSelect",tagName:"SELECT",mixins:[a,u.Mixin,s],statics:{valueContextKey:m},propTypes:{defaultValue:o,value:o},getInitialState:function(){var e=u.getValue(this.props);return null!=e?{initialValue:e}:{initialValue:this.props.defaultValue}},childContextTypes:function(){var e={};return e[m]=d.any,e}(),getChildContext:function(){var e={};return e[m]=this.state.initialValue,e},render:function(){var e=f({},this.props);return e.onChange=this._handleChange,e.value=null,v(e,this.props.children)},componentWillMount:function(){this._pendingUpdate=!1},componentWillReceiveProps:function(e){this.setState({initialValue:null})},componentDidUpdate:function(e){var t=u.getValue(this.props);null!=t?(this._pendingUpdate=!1,i(this,t)):!e.multiple!=!this.props.multiple&&(null!=this.props.defaultValue?i(this,this.props.defaultValue):i(this,this.props.multiple?[]:""))},_handleChange:function(e){var t,n=u.getOnChange(this.props);return n&&(t=n.call(this,e)),this._pendingUpdate=!0,p.asap(r,this),t}});t.exports=g},{116:116,2:2,24:24,26:26,28:28,32:32,56:56,78:78,86:86}],50:[function(e,t,n){"use strict";function r(e,t,n,r){return e===n&&t===r}function o(e){var t=document.selection,n=t.createRange(),r=n.text.length,o=n.duplicate();o.moveToElementText(e),o.setEndPoint("EndToStart",n);var i=o.text.length,a=i+r;return{start:i,end:a}}function i(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var n=t.anchorNode,o=t.anchorOffset,i=t.focusNode,a=t.focusOffset,u=t.getRangeAt(0),s=r(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),l=s?0:u.toString().length,c=u.cloneRange();c.selectNodeContents(e),c.setEnd(u.startContainer,u.startOffset);var p=r(c.startContainer,c.startOffset,c.endContainer,c.endOffset),d=p?0:c.toString().length,f=d+l,h=document.createRange();h.setStart(n,o),h.setEnd(i,a);var v=h.collapsed;return{start:v?f:d,end:v?d:f}}function a(e,t){var n,r,o=document.selection.createRange().duplicate();"undefined"==typeof t.end?(n=t.start,r=n):t.start>t.end?(n=t.end,r=t.start):(n=t.start,r=t.end),o.moveToElementText(e),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}function u(e,t){if(window.getSelection){var n=window.getSelection(),r=e[c()].length,o=Math.min(t.start,r),i="undefined"==typeof t.end?o:Math.min(t.end,r);if(!n.extend&&o>i){var a=i;i=o,o=a}var u=l(e,o),s=l(e,i);if(u&&s){var p=document.createRange();p.setStart(u.node,u.offset),n.removeAllRanges(),o>i?(n.addRange(p),n.extend(s.node,s.offset)):(p.setEnd(s.node,s.offset),n.addRange(p))}}}var s=e(21),l=e(127),c=e(128),p=s.canUseDOM&&"selection"in document&&!("getSelection"in window),d={getOffsets:p?o:i,setOffsets:p?a:u};t.exports=d},{127:127,128:128,21:21}],51:[function(e,t,n){"use strict";var r=e(55),o=e(83);r.inject();var i={renderToString:o.renderToString,renderToStaticMarkup:o.renderToStaticMarkup};t.exports=i},{55:55,83:83}],52:[function(e,t,n){"use strict";var r=e(11),o=e(34),i=e(42),a=e(26),u=e(115),s=(e(150),function(e){});a(s.prototype,{construct:function(e){this._currentElement=e,this._stringText=""+e,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(e,t,n){this._rootNodeID=e;var o=u(this._stringText);return t.renderToStaticMarkup?o:"<span "+r.createMarkupForID(e)+">"+o+"</span>"},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;n!==this._stringText&&(this._stringText=n,i.BackendIDOperations.updateTextContentByID(this._rootNodeID,n))}},unmountComponent:function(){o.unmountIDFromEnvironment(this._rootNodeID)}}),t.exports=s},{11:11,115:115,150:150,26:26,34:34,42:42}],53:[function(e,t,n){"use strict";function r(){this.isMounted()&&this.forceUpdate()}var o=e(2),i=e(11),a=e(24),u=e(28),s=e(32),l=e(56),c=e(86),p=e(26),d=e(116),f=e(133),h=(e(151),l.createFactory("textarea")),v=s.createClass({displayName:"ReactDOMTextarea",tagName:"TEXTAREA",mixins:[o,a.Mixin,u],getInitialState:function(){var e=this.props.defaultValue,t=this.props.children;null!=t&&(null!=e?f(!1):void 0,Array.isArray(t)&&(t.length<=1?void 0:f(!1),t=t[0]),e=""+t),null==e&&(e="");var n=a.getValue(this.props);return{initialValue:""+(null!=n?n:e)}},render:function(){var e=p({},this.props);return null!=e.dangerouslySetInnerHTML?f(!1):void 0,e.defaultValue=null,e.value=null,e.onChange=this._handleChange,h(e,this.state.initialValue)},componentDidUpdate:function(e,t,n){var r=a.getValue(this.props);if(null!=r){var o=d(this);i.setValueForProperty(o,"value",""+r)}},_handleChange:function(e){var t,n=a.getOnChange(this.props);return n&&(t=n.call(this,e)),c.asap(r,this),t}});t.exports=v},{11:11,116:116,133:133,151:151,2:2,24:24,26:26,28:28,32:32,56:56,86:86}],54:[function(e,t,n){"use strict";function r(){this.reinitializeTransaction()}var o=e(86),i=e(102),a=e(26),u=e(113),s={initialize:u,close:function(){d.isBatchingUpdates=!1}},l={initialize:u,close:o.flushBatchedUpdates.bind(o)},c=[l,s];a(r.prototype,i.Mixin,{getTransactionWrappers:function(){return c}});var p=new r,d={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,o,i){var a=d.isBatchingUpdates;d.isBatchingUpdates=!0,a?e(t,n,r,o,i):p.perform(e,null,t,n,r,o,i);
}};t.exports=d},{102:102,113:113,26:26,86:86}],55:[function(e,t,n){"use strict";function r(e){return f.createClass({tagName:e.toUpperCase(),render:function(){var t=w.get(this);return new N(e,null,null,t._currentElement._owner,null,this.props)}})}function o(){B||(B=!0,R.EventEmitter.injectReactEventListener(T),R.EventPluginHub.injectEventPluginOrder(s),R.EventPluginHub.injectInstanceHandle(P),R.EventPluginHub.injectMount(O),R.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:U,EnterLeaveEventPlugin:l,ChangeEventPlugin:a,SelectEventPlugin:k,BeforeInputEventPlugin:i}),R.NativeComponent.injectGenericComponentClass(m),R.NativeComponent.injectTextComponentClass(I),R.NativeComponent.injectAutoWrapper(r),R.Class.injectMixin(d),R.NativeComponent.injectComponentClasses({button:g,form:y,iframe:b,img:C,input:_,option:x,select:D,textarea:M,html:F("html"),head:F("head"),body:F("body")}),R.DOMProperty.injectDOMPropertyConfig(p),R.DOMProperty.injectDOMPropertyConfig(L),R.EmptyComponent.injectEmptyComponent("noscript"),R.Updates.injectReconcileTransaction(S),R.Updates.injectBatchingStrategy(v),R.RootIndex.injectCreateReactRootIndex(c.canUseDOM?u.createReactRootIndex:A.createReactRootIndex),R.Component.injectEnvironment(h),R.DOMComponent.injectIDOperations(E))}var i=e(3),a=e(7),u=e(8),s=e(13),l=e(14),c=e(21),p=e(23),d=e(28),f=e(32),h=e(34),v=e(54),m=e(42),g=e(40),y=e(43),C=e(46),E=e(44),b=e(45),_=e(47),x=e(48),D=e(49),M=e(53),I=e(52),N=e(56),T=e(61),R=e(63),P=e(65),w=e(66),O=e(70),S=e(79),k=e(88),A=e(89),U=e(90),L=e(87),F=e(110),B=!1;t.exports={inject:o}},{110:110,13:13,14:14,21:21,23:23,28:28,3:3,32:32,34:34,40:40,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,52:52,53:53,54:54,56:56,61:61,63:63,65:65,66:66,7:7,70:70,79:79,8:8,87:87,88:88,89:89,90:90}],56:[function(e,t,n){"use strict";var r=e(37),o=e(38),i=e(26),a=(e(151),{key:!0,ref:!0}),u=function(e,t,n,r,o,i){this.type=e,this.key=t,this.ref=n,this._owner=r,this.props=i};u.prototype={_isReactElement:!0},u.createElement=function(e,t,n){var i,s={},l=null,c=null;if(null!=t){c=void 0===t.ref?null:t.ref,l=void 0===t.key?null:""+t.key;for(i in t)t.hasOwnProperty(i)&&!a.hasOwnProperty(i)&&(s[i]=t[i])}var p=arguments.length-2;if(1===p)s.children=n;else if(p>1){for(var d=Array(p),f=0;p>f;f++)d[f]=arguments[f+2];s.children=d}if(e&&e.defaultProps){var h=e.defaultProps;for(i in h)"undefined"==typeof s[i]&&(s[i]=h[i])}return new u(e,l,c,o.current,r.current,s)},u.createFactory=function(e){var t=u.createElement.bind(null,e);return t.type=e,t},u.cloneAndReplaceProps=function(e,t){var n=new u(e.type,e.key,e.ref,e._owner,e._context,t);return n},u.cloneElement=function(e,t,n){var r,s=i({},e.props),l=e.key,c=e.ref,p=e._owner;if(null!=t){void 0!==t.ref&&(c=t.ref,p=o.current),void 0!==t.key&&(l=""+t.key);for(r in t)t.hasOwnProperty(r)&&!a.hasOwnProperty(r)&&(s[r]=t[r])}var d=arguments.length-2;if(1===d)s.children=n;else if(d>1){for(var f=Array(d),h=0;d>h;h++)f[h]=arguments[h+2];s.children=f}return new u(e.type,l,c,p,e._context,s)},u.isValidElement=function(e){var t=!(!e||!e._isReactElement);return t},t.exports=u},{151:151,26:26,37:37,38:38}],57:[function(e,t,n){"use strict";function r(){if(y.current){var e=y.current.getName();if(e)return" Check the render method of `"+e+"`."}return""}function o(e){var t=e&&e.getPublicInstance();if(!t)return void 0;var n=t.constructor;return n?n.displayName||n.name||void 0:void 0}function i(){var e=y.current;return e&&o(e)||void 0}function a(e,t){e._store.validated||null!=e.key||(e._store.validated=!0,s('Each child in an array or iterator should have a unique "key" prop.',e,t))}function u(e,t,n){D.test(e)&&s("Child objects should have non-numeric keys so ordering is preserved.",t,n)}function s(e,t,n){var r=i(),a="string"==typeof n?n:n.displayName||n.name,u=r||a,s=_[e]||(_[e]={});if(!s.hasOwnProperty(u)){s[u]=!0;var l="";if(t&&t._owner&&t._owner!==y.current){var c=o(t._owner);l=" It was passed a child from "+c+"."}}}function l(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];v.isValidElement(r)&&a(r,t)}else if(v.isValidElement(e))e._store.validated=!0;else if(e){var o=E(e);if(o){if(o!==e.entries)for(var i,s=o.call(e);!(i=s.next()).done;)v.isValidElement(i.value)&&a(i.value,t)}else if("object"==typeof e){var l=m.extractIfFragment(e);for(var c in l)l.hasOwnProperty(c)&&u(c,l[c],t)}}}function c(e,t,n,o){for(var i in t)if(t.hasOwnProperty(i)){var a;try{"function"!=typeof t[i]?b(!1):void 0,a=t[i](n,i,e,o)}catch(u){a=u}a instanceof Error&&!(a.message in x)&&(x[a.message]=!0,r())}}function p(e,t){var n=t.type,r="string"==typeof n?n:n.displayName,o=t._owner?t._owner.getPublicInstance().constructor.displayName:null,i=e+"|"+r+"|"+o;if(!M.hasOwnProperty(i)){M[i]=!0;var a="";r&&(a=" <"+r+" />");var u="";o&&(u=" The element was created by "+o+".")}}function d(e,t){return e!==e?t!==t:0===e&&0===t?1/e===1/t:e===t}function f(e){if(e._store){var t=e._store.originalProps,n=e.props;for(var r in n)n.hasOwnProperty(r)&&(t.hasOwnProperty(r)&&d(t[r],n[r])||(p(r,e),t[r]=n[r]))}}function h(e){if("string"==typeof e.type||"function"==typeof e.type){var t=C.getComponentClassForElement(e),n=t.displayName||t.name;t.propTypes&&c(n,t.propTypes,e.props,g.prop),"function"==typeof t.getDefaultProps}}var v=e(56),m=e(62),g=e(77),y=(e(76),e(38)),C=e(73),E=e(125),b=e(133),_=(e(151),{}),x={},D=/^\d+$/,M={},I={checkAndWarnForMutatedProps:f,createElement:function(e,t,n){var r=v.createElement.apply(this,arguments);if(null==r)return r;for(var o=2;o<arguments.length;o++)l(arguments[o],e);return h(r),r},createFactory:function(e){var t=I.createElement.bind(null,e);return t.type=e,t},cloneElement:function(e,t,n){for(var r=v.cloneElement.apply(this,arguments),o=2;o<arguments.length;o++)l(arguments[o],r.type);return h(r),r}};t.exports=I},{125:125,133:133,151:151,38:38,56:56,62:62,73:73,76:76,77:77}],58:[function(e,t,n){"use strict";function r(e){c[e]=!0}function o(e){delete c[e]}function i(e){return!!c[e]}var a,u=e(56),s=e(66),l=e(133),c={},p={injectEmptyComponent:function(e){a=u.createFactory(e)}},d=function(){};d.prototype.componentDidMount=function(){var e=s.get(this);e&&r(e._rootNodeID)},d.prototype.componentWillUnmount=function(){var e=s.get(this);e&&o(e._rootNodeID)},d.prototype.render=function(){return a?void 0:l(!1),a()};var f=u.createElement(d),h={emptyElement:f,injection:p,isNullComponentID:i};t.exports=h},{133:133,56:56,66:66}],59:[function(e,t,n){"use strict";var r={guard:function(e,t){return e}};t.exports=r},{}],60:[function(e,t,n){"use strict";function r(e){o.enqueueEvents(e),o.processEventQueue()}var o=e(17),i={handleTopLevel:function(e,t,n,i){var a=o.extractEvents(e,t,n,i);r(a)}};t.exports=i},{17:17}],61:[function(e,t,n){"use strict";function r(e){var t=p.getID(e),n=c.getReactRootIDFromNodeID(t),r=p.findReactContainerForID(n),o=p.getFirstReactDOM(r);return o}function o(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function i(e){for(var t=p.getFirstReactDOM(h(e.nativeEvent))||window,n=t;n;)e.ancestors.push(n),n=r(n);for(var o=0;o<e.ancestors.length;o++){t=e.ancestors[o];var i=p.getID(t)||"";m._handleTopLevel(e.topLevelType,t,i,e.nativeEvent)}}function a(e){var t=v(window);e(t)}var u=e(16),s=e(21),l=e(27),c=e(65),p=e(70),d=e(86),f=e(26),h=e(124),v=e(129);f(o.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),l.addPoolingTo(o,l.twoArgumentPooler);var m={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:s.canUseDOM?window:null,setHandleTopLevel:function(e){m._handleTopLevel=e},setEnabled:function(e){m._enabled=!!e},isEnabled:function(){return m._enabled},trapBubbledEvent:function(e,t,n){var r=n;return r?u.listen(r,t,m.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){var r=n;return r?u.capture(r,t,m.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=a.bind(null,e);u.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(m._enabled){var n=o.getPooled(e,t);try{d.batchedUpdates(i,n)}finally{o.release(n)}}}};t.exports=m},{124:124,129:129,16:16,21:21,26:26,27:27,65:65,70:70,86:86}],62:[function(e,t,n){"use strict";var r=(e(56),e(151),{create:function(e){return e},extract:function(e){return e},extractIfFragment:function(e){return e}});t.exports=r},{151:151,56:56}],63:[function(e,t,n){"use strict";var r=e(10),o=e(17),i=e(35),a=e(32),u=e(58),s=e(29),l=e(73),c=e(42),p=e(75),d=e(82),f=e(86),h={Component:i.injection,Class:a.injection,DOMComponent:c.injection,DOMProperty:r.injection,EmptyComponent:u.injection,EventPluginHub:o.injection,EventEmitter:s.injection,NativeComponent:l.injection,Perf:p.injection,RootIndex:d.injection,Updates:f.injection};t.exports=h},{10:10,17:17,29:29,32:32,35:35,42:42,58:58,73:73,75:75,82:82,86:86}],64:[function(e,t,n){"use strict";function r(e){return i(document.documentElement,e)}var o=e(50),i=e(108),a=e(118),u=e(120),s={hasSelectionCapabilities:function(e){return e&&("INPUT"===e.nodeName&&"text"===e.type||"TEXTAREA"===e.nodeName||"true"===e.contentEditable)},getSelectionInformation:function(){var e=u();return{focusedElem:e,selectionRange:s.hasSelectionCapabilities(e)?s.getSelection(e):null}},restoreSelection:function(e){var t=u(),n=e.focusedElem,o=e.selectionRange;t!==n&&r(n)&&(s.hasSelectionCapabilities(n)&&s.setSelection(n,o),a(n))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&"INPUT"===e.nodeName){var n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=o.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,r=t.end;if("undefined"==typeof r&&(r=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(r,e.value.length);else if(document.selection&&"INPUT"===e.nodeName){var i=e.createTextRange();i.collapse(!0),i.moveStart("character",n),i.moveEnd("character",r-n),i.select()}else o.setOffsets(e,t)}};t.exports=s},{108:108,118:118,120:120,50:50}],65:[function(e,t,n){"use strict";function r(e){return f+e.toString(36)}function o(e,t){return e.charAt(t)===f||t===e.length}function i(e){return""===e||e.charAt(0)===f&&e.charAt(e.length-1)!==f}function a(e,t){return 0===t.indexOf(e)&&o(t,e.length)}function u(e){return e?e.substr(0,e.lastIndexOf(f)):""}function s(e,t){if(i(e)&&i(t)?void 0:d(!1),a(e,t)?void 0:d(!1),e===t)return e;var n,r=e.length+h;for(n=r;n<t.length&&!o(t,n);n++);return t.substr(0,n)}function l(e,t){var n=Math.min(e.length,t.length);if(0===n)return"";for(var r=0,a=0;n>=a;a++)if(o(e,a)&&o(t,a))r=a;else if(e.charAt(a)!==t.charAt(a))break;var u=e.substr(0,r);return i(u)?void 0:d(!1),u}function c(e,t,n,r,o,i){e=e||"",t=t||"",e===t?d(!1):void 0;var l=a(t,e);l||a(e,t)?void 0:d(!1);for(var c=0,p=l?u:s,f=e;;f=p(f,t)){var h;if(o&&f===e||i&&f===t||(h=n(f,l,r)),h===!1||f===t)break;c++<v?void 0:d(!1)}}var p=e(82),d=e(133),f=".",h=f.length,v=100,m={createReactRootID:function(){return r(p.createReactRootIndex())},createReactID:function(e,t){return e+t},getReactRootIDFromNodeID:function(e){if(e&&e.charAt(0)===f&&e.length>1){var t=e.indexOf(f,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,r,o){var i=l(e,t);i!==e&&c(e,i,n,r,!1,!0),i!==t&&c(i,t,n,o,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(c("",e,t,n,!0,!1),c(e,"",t,n,!1,!0))},traverseTwoPhaseSkipTarget:function(e,t,n){e&&(c("",e,t,n,!0,!0),c(e,"",t,n,!0,!0))},traverseAncestors:function(e,t,n){c("",e,t,n,!0,!1)},getFirstCommonAncestorID:l,_getNextDescendantID:s,isAncestorIDOf:a,SEPARATOR:f};t.exports=m},{133:133,82:82}],66:[function(e,t,n){"use strict";var r={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};t.exports=r},{}],67:[function(e,t,n){"use strict";var r=e(31),o=e(33),i=e(32),a=e(39),u=e(56),s=(e(57),e(78)),l=e(26),c=e(142),p=u.createElement,d=u.createFactory,f=u.cloneElement,h={Children:{map:r.map,forEach:r.forEach,count:r.count,only:c},Component:o,createElement:p,cloneElement:f,isValidElement:u.isValidElement,PropTypes:s,createClass:i.createClass,createFactory:d,createMixin:function(e){return e},DOM:a,__spread:l};t.exports=h},{142:142,26:26,31:31,32:32,33:33,39:39,56:56,57:57,78:78}],68:[function(e,t,n){"use strict";var r={currentlyMountingInstance:null,currentlyUnmountingInstance:null};t.exports=r},{}],69:[function(e,t,n){"use strict";var r=e(105),o={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return e.replace(">"," "+o.CHECKSUM_ATTR_NAME+'="'+t+'">')},canReuseMarkup:function(e,t){var n=t.getAttribute(o.CHECKSUM_ATTR_NAME);n=n&&parseInt(n,10);var i=r(e);return i===n}};t.exports=o},{105:105}],70:[function(e,t,n){"use strict";function r(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function o(e){return e?e.nodeType===B?e.documentElement:e.firstChild:null}function i(e){var t=o(e);return t&&q.getID(t)}function a(e){var t=u(e);if(t)if(L.hasOwnProperty(t)){var n=L[t];n!==e&&(p(n,t)?O(!1):void 0,L[t]=e)}else L[t]=e;return t}function u(e){return e&&e.getAttribute&&e.getAttribute(U)||""}function s(e,t){var n=u(e);n!==t&&delete L[n],e.setAttribute(U,t),L[t]=e}function l(e){return L.hasOwnProperty(e)&&p(L[e],e)||(L[e]=q.findReactNodeByID(e)),L[e]}function c(e){var t=x.get(e)._rootNodeID;return b.isNullComponentID(t)?null:(L.hasOwnProperty(t)&&p(L[t],t)||(L[t]=q.findReactNodeByID(t)),L[t])}function p(e,t){if(e){u(e)!==t?O(!1):void 0;var n=q.findReactContainerForID(t);if(n&&P(n,e))return!0}return!1}function d(e){delete L[e]}function f(e){var t=L[e];return t&&p(t,e)?void(H=t):!1}function h(e){H=null,_.traverseAncestors(e,f);var t=H;return H=null,t}function v(e,t,n,r,o,i){var a=I.mountComponent(e,t,r,i);e._isTopLevel=!0,q._mountImageIntoNode(a,n,o)}function m(e,t,n,r,o){var i=T.ReactReconcileTransaction.getPooled();i.perform(v,null,e,t,n,i,r,o),T.ReactReconcileTransaction.release(i)}function g(e,t){for(I.unmountComponent(e),t.nodeType===B&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)}var y=e(10),C=e(29),E=(e(38),e(56)),b=(e(57),e(58)),_=e(65),x=e(66),D=e(69),M=e(75),I=e(80),N=e(85),T=e(86),R=e(114),P=e(108),w=e(132),O=e(133),S=e(144),k=e(147),A=(e(150),e(151),_.SEPARATOR),U=y.ID_ATTRIBUTE_NAME,L={},F=1,B=9,j=11,V={},W={},K=[],H=null,q={_instancesByReactRootID:V,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){return q.scrollMonitor(n,function(){N.enqueueElementInternal(e,t),r&&N.enqueueCallbackInternal(e,r)}),e},_registerComponent:function(e,t){!t||t.nodeType!==F&&t.nodeType!==B&&t.nodeType!==j?O(!1):void 0,C.ensureScrollValueMonitoring();var n=q.registerContainer(t);return V[n]=e,n},_renderNewRootComponent:function(e,t,n,r){var o=w(e,null),i=q._registerComponent(o,t);return T.batchedUpdates(m,o,i,t,n,r),o},renderSubtreeIntoContainer:function(e,t,n,r){return null==e||null==e._reactInternalInstance?O(!1):void 0,q._renderSubtreeIntoContainer(e,t,n,r)},_renderSubtreeIntoContainer:function(e,t,n,r){E.isValidElement(t)?void 0:O(!1);var a=V[i(n)];if(a){var u=a._currentElement;if(k(u,t))return q._updateRootComponent(a,t,n,r).getPublicInstance();q.unmountComponentAtNode(n)}var s=o(n),l=s&&q.isRenderedByReact(s),c=l&&!a,p=q._renderNewRootComponent(t,n,c,null!=e?e._reactInternalInstance._processChildContext(e._reactInternalInstance._context):R).getPublicInstance();return r&&r.call(p),p},render:function(e,t,n){return q._renderSubtreeIntoContainer(null,e,t,n)},constructAndRenderComponent:function(e,t,n){var r=E.createElement(e,t);return q.render(r,n)},constructAndRenderComponentByID:function(e,t,n){var r=document.getElementById(n);return r?void 0:O(!1),q.constructAndRenderComponent(e,t,r)},registerContainer:function(e){var t=i(e);return t&&(t=_.getReactRootIDFromNodeID(t)),t||(t=_.createReactRootID()),W[t]=e,t},unmountComponentAtNode:function(e){!e||e.nodeType!==F&&e.nodeType!==B&&e.nodeType!==j?O(!1):void 0;var t=i(e),n=V[t];return n?(T.batchedUpdates(g,n,e),delete V[t],delete W[t],!0):!1},findReactContainerForID:function(e){var t=_.getReactRootIDFromNodeID(e),n=W[t];return n},findReactNodeByID:function(e){var t=q.findReactContainerForID(e);return q.findComponentRoot(t,e)},isRenderedByReact:function(e){if(1!==e.nodeType)return!1;var t=q.getID(e);return t?t.charAt(0)===A:!1},getFirstReactDOM:function(e){for(var t=e;t&&t.parentNode!==t;){if(q.isRenderedByReact(t))return t;t=t.parentNode}return null},findComponentRoot:function(e,t){var n=K,r=0,o=h(t)||e;for(n[0]=o.firstChild,n.length=1;r<n.length;){for(var i,a=n[r++];a;){var u=q.getID(a);u?t===u?i=a:_.isAncestorIDOf(u,t)&&(n.length=r=0,n.push(a.firstChild)):n.push(a.firstChild),a=a.nextSibling}if(i)return n.length=0,i}n.length=0,O(!1)},_mountImageIntoNode:function(e,t,n){if(!t||t.nodeType!==F&&t.nodeType!==B&&t.nodeType!==j?O(!1):void 0,n){var i=o(t);if(D.canReuseMarkup(e,i))return;var a=i.getAttribute(D.CHECKSUM_ATTR_NAME);i.removeAttribute(D.CHECKSUM_ATTR_NAME);var u=i.outerHTML;i.setAttribute(D.CHECKSUM_ATTR_NAME,a);var s=r(e,u);" (client) "+e.substring(s-20,s+20)+"\n (server) "+u.substring(s-20,s+20),t.nodeType===B?O(!1):void 0}t.nodeType===B?O(!1):void 0,S(t,e)},getReactRootID:i,getID:a,setID:s,getNode:l,getNodeFromInstance:c,purgeID:d};M.measureMethods(q,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),t.exports=q},{10:10,108:108,114:114,132:132,133:133,144:144,147:147,150:150,151:151,29:29,38:38,56:56,57:57,58:58,65:65,66:66,69:69,75:75,80:80,85:85,86:86}],71:[function(e,t,n){"use strict";function r(e,t,n){h.push({parentID:e,parentNode:null,type:c.INSERT_MARKUP,markupIndex:v.push(t)-1,textContent:null,fromIndex:null,toIndex:n})}function o(e,t,n){h.push({parentID:e,parentNode:null,type:c.MOVE_EXISTING,markupIndex:null,textContent:null,fromIndex:t,toIndex:n})}function i(e,t){h.push({parentID:e,parentNode:null,type:c.REMOVE_NODE,markupIndex:null,textContent:null,fromIndex:t,toIndex:null})}function a(e,t){h.push({parentID:e,parentNode:null,type:c.TEXT_CONTENT,markupIndex:null,textContent:t,fromIndex:null,toIndex:null})}function u(){h.length&&(l.processChildrenUpdates(h,v),s())}function s(){h.length=0,v.length=0}var l=e(35),c=e(72),p=e(80),d=e(30),f=0,h=[],v=[],m={Mixin:{mountChildren:function(e,t,n){var r=d.instantiateChildren(e,t,n);this._renderedChildren=r;var o=[],i=0;for(var a in r)if(r.hasOwnProperty(a)){var u=r[a],s=this._rootNodeID+a,l=p.mountComponent(u,s,t,n);u._mountIndex=i,o.push(l),i++}return o},updateTextContent:function(e){f++;var t=!0;try{var n=this._renderedChildren;d.unmountChildren(n);for(var r in n)n.hasOwnProperty(r)&&this._unmountChildByName(n[r],r);this.setTextContent(e),t=!1}finally{f--,f||(t?s():u())}},updateChildren:function(e,t,n){f++;var r=!0;try{this._updateChildren(e,t,n),r=!1}finally{f--,f||(r?s():u())}},_updateChildren:function(e,t,n){var r=this._renderedChildren,o=d.updateChildren(r,e,t,n);if(this._renderedChildren=o,o||r){var i,a=0,u=0;for(i in o)if(o.hasOwnProperty(i)){var s=r&&r[i],l=o[i];s===l?(this.moveChild(s,u,a),a=Math.max(s._mountIndex,a),s._mountIndex=u):(s&&(a=Math.max(s._mountIndex,a),this._unmountChildByName(s,i)),this._mountChildByNameAtIndex(l,i,u,t,n)),u++}for(i in r)!r.hasOwnProperty(i)||o&&o.hasOwnProperty(i)||this._unmountChildByName(r[i],i)}},unmountChildren:function(){var e=this._renderedChildren;d.unmountChildren(e),this._renderedChildren=null},moveChild:function(e,t,n){e._mountIndex<n&&o(this._rootNodeID,e._mountIndex,t)},createChild:function(e,t){r(this._rootNodeID,t,e._mountIndex)},removeChild:function(e){i(this._rootNodeID,e._mountIndex)},setTextContent:function(e){a(this._rootNodeID,e)},_mountChildByNameAtIndex:function(e,t,n,r,o){var i=this._rootNodeID+t,a=p.mountComponent(e,i,r,o);e._mountIndex=n,this.createChild(e,a)},_unmountChildByName:function(e,t){this.removeChild(e),e._mountIndex=null}}};t.exports=m},{30:30,35:35,72:72,80:80}],72:[function(e,t,n){"use strict";var r=e(138),o=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,TEXT_CONTENT:null});t.exports=o},{138:138}],73:[function(e,t,n){"use strict";function r(e){if("function"==typeof e.type)return e.type;var t=e.type,n=p[t];return null==n&&(p[t]=n=l(t)),n}function o(e){return c?void 0:s(!1),new c(e.type,e.props)}function i(e){return new d(e)}function a(e){return e instanceof d}var u=e(26),s=e(133),l=null,c=null,p={},d=null,f={injectGenericComponentClass:function(e){c=e},injectTextComponentClass:function(e){d=e},injectComponentClasses:function(e){u(p,e)},injectAutoWrapper:function(e){l=e}},h={getComponentClassForElement:r,createInternalComponent:o,createInstanceForText:i,isTextComponent:a,injection:f};t.exports=h},{133:133,26:26}],74:[function(e,t,n){"use strict";var r=e(133),o={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,n){o.isValidOwner(n)?void 0:r(!1),n.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,n){o.isValidOwner(n)?void 0:r(!1),n.getPublicInstance().refs[t]===e.getPublicInstance()&&n.detachRef(t)}};t.exports=o},{133:133}],75:[function(e,t,n){"use strict";function r(e,t,n){return n}var o={enableMeasure:!1,storedMeasure:r,measureMethods:function(e,t,n){},measure:function(e,t,n){return n},injection:{injectMeasure:function(e){o.storedMeasure=e}}};t.exports=o},{}],76:[function(e,t,n){"use strict";var r={};t.exports=r},{}],77:[function(e,t,n){"use strict";var r=e(138),o=r({prop:null,context:null,childContext:null});t.exports=o},{138:138}],78:[function(e,t,n){"use strict";function r(e){function t(t,n,r,o,i,a){if(o=o||b,a=a||r,null==n[r]){var u=C[i];return t?new Error("Required "+u+" `"+a+"` was not specified in "+("`"+o+"`.")):null}return e(n,r,o,i,a)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function o(e){function t(t,n,r,o,i){var a=t[n],u=v(a);if(u!==e){var s=C[o],l=m(a);return new Error("Invalid "+s+" `"+i+"` of type "+("`"+l+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return r(t)}function i(){return r(E.thatReturns(null))}function a(e){function t(t,n,r,o,i){var a=t[n];if(!Array.isArray(a)){var u=C[o],s=v(a);return new Error("Invalid "+u+" `"+i+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<a.length;l++){var c=e(a,l,r,o,""+i+"["+l+"]");if(c instanceof Error)return c}return null}return r(t)}function u(){function e(e,t,n,r,o){if(!g.isValidElement(e[t])){var i=C[r];return new Error("Invalid "+i+" `"+o+"` supplied to "+("`"+n+"`, expected a single ReactElement."))}return null}return r(e)}function s(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var a=C[o],u=e.name||b;return new Error("Invalid "+a+" `"+i+"` supplied to "+("`"+r+"`, expected instance of `"+u+"`."))}return null}return r(t)}function l(e){function t(t,n,r,o,i){for(var a=t[n],u=0;u<e.length;u++)if(a===e[u])return null;var s=C[o],l=JSON.stringify(e);return new Error("Invalid "+s+" `"+i+"` 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,o,i){var a=t[n],u=v(a);if("object"!==u){var s=C[o];return new Error("Invalid "+s+" `"+i+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an object."))}for(var l in a)if(a.hasOwnProperty(l)){var c=e(a,l,r,o,""+i+"."+l);if(c instanceof Error)return c}return null}return r(t)}function p(e){function t(t,n,r,o,i){for(var a=0;a<e.length;a++){var u=e[a];if(null==u(t,n,r,o,i))return null}var s=C[o];return new Error("Invalid "+s+" `"+i+"` supplied to "+("`"+r+"`."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOfType, expected an instance of array.")})}function d(){function e(e,t,n,r,o){if(!h(e[t])){var i=C[r];return new Error("Invalid "+i+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return r(e)}function f(e){function t(t,n,r,o,i){var a=t[n],u=v(a);if("object"!==u){var s=C[o];return new Error("Invalid "+s+" `"+i+"` of type `"+u+"` "+("supplied to `"+r+"`, expected `object`."))}for(var l in e){var c=e[l];if(c){var p=c(a,l,r,o,""+i+"."+l);if(p)return p}}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||g.isValidElement(e))return!0;e=y.extractIfFragment(e);for(var t in e)if(!h(e[t]))return!1;return!0;default:return!1}}function v(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function m(e){var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}var g=e(56),y=e(62),C=e(76),E=e(113),b="<<anonymous>>",_={array:o("array"),bool:o("boolean"),func:o("function"),number:o("number"),object:o("object"),string:o("string"),any:i(),arrayOf:a,element:u(),instanceOf:s,node:d(),objectOf:c,oneOf:l,oneOfType:p,shape:f};t.exports=_},{113:113,56:56,62:62,76:76}],79:[function(e,t,n){"use strict";function r(){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=o.getPooled(null)}var o=e(6),i=e(27),a=e(29),u=e(64),s=e(102),l=e(26),c={initialize:u.getSelectionInformation,close:u.restoreSelection},p={initialize:function(){var e=a.isEnabled();return a.setEnabled(!1),e},close:function(e){a.setEnabled(e)}},d={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},f=[c,p,d],h={getTransactionWrappers:function(){return f},getReactMountReady:function(){return this.reactMountReady},destructor:function(){o.release(this.reactMountReady),this.reactMountReady=null}};l(r.prototype,s.Mixin,h),i.addPoolingTo(r),t.exports=r},{102:102,26:26,27:27,29:29,6:6,64:64}],80:[function(e,t,n){"use strict";function r(){o.attachRefs(this,this._currentElement)}var o=e(81),i=(e(57),{mountComponent:function(e,t,n,o){var i=e.mountComponent(t,n,o);return n.getReactMountReady().enqueue(r,e),i},unmountComponent:function(e){o.detachRefs(e,e._currentElement),e.unmountComponent()},receiveComponent:function(e,t,n,i){var a=e._currentElement;if(t!==a||null==t._owner){var u=o.shouldUpdateRefs(a,t);u&&o.detachRefs(e,a),e.receiveComponent(t,n,i),u&&n.getReactMountReady().enqueue(r,e)}},performUpdateIfNecessary:function(e,t){e.performUpdateIfNecessary(t)}});t.exports=i},{57:57,81:81}],81:[function(e,t,n){"use strict";function r(e,t,n){"function"==typeof e?e(t.getPublicInstance()):i.addComponentAsRefTo(t,e,n)}function o(e,t,n){"function"==typeof e?e(null):i.removeComponentAsRefFrom(t,e,n)}var i=e(74),a={};a.attachRefs=function(e,t){var n=t.ref;null!=n&&r(n,e,t._owner)},a.shouldUpdateRefs=function(e,t){return t._owner!==e._owner||t.ref!==e.ref},a.detachRefs=function(e,t){var n=t.ref;null!=n&&o(n,e,t._owner)},t.exports=a},{74:74}],82:[function(e,t,n){"use strict";var r={injectCreateReactRootIndex:function(e){o.createReactRootIndex=e}},o={createReactRootIndex:null,injection:r};t.exports=o},{}],83:[function(e,t,n){"use strict";function r(e){i.isValidElement(e)?void 0:p(!1);var t;try{var n=a.createReactRootID();return t=s.getPooled(!1),t.perform(function(){var r=c(e,null),o=r.mountComponent(n,t,l);return u.addChecksumToMarkup(o)},null)}finally{s.release(t)}}function o(e){i.isValidElement(e)?void 0:p(!1);var t;try{var n=a.createReactRootID();return t=s.getPooled(!0),t.perform(function(){var r=c(e,null);return r.mountComponent(n,t,l)},null)}finally{s.release(t)}}var i=e(56),a=e(65),u=e(69),s=e(84),l=e(114),c=e(132),p=e(133);t.exports={renderToString:r,renderToStaticMarkup:o}},{114:114,132:132,133:133,56:56,65:65,69:69,84:84}],84:[function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.reactMountReady=i.getPooled(null)}var o=e(27),i=e(6),a=e(102),u=e(26),s=e(113),l={initialize:function(){this.reactMountReady.reset()},close:s},c=[l],p={getTransactionWrappers:function(){return c},getReactMountReady:function(){return this.reactMountReady},destructor:function(){i.release(this.reactMountReady),this.reactMountReady=null}};u(r.prototype,a.Mixin,p),o.addPoolingTo(r),t.exports=r},{102:102,113:113,26:26,27:27,6:6}],85:[function(e,t,n){"use strict";function r(e){e!==i.currentlyMountingInstance&&l.enqueueUpdate(e)}function o(e,t){null!=a.current?p(!1):void 0;var n=s.get(e);return n?n===i.currentlyUnmountingInstance?null:n:null}var i=e(68),a=e(38),u=e(56),s=e(66),l=e(86),c=e(26),p=e(133),d=(e(151),{enqueueCallback:function(e,t){"function"!=typeof t?p(!1):void 0;var n=o(e);return n&&n!==i.currentlyMountingInstance?(n._pendingCallbacks?n._pendingCallbacks.push(t):n._pendingCallbacks=[t],void r(n)):null},enqueueCallbackInternal:function(e,t){"function"!=typeof t?p(!1):void 0,e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],r(e)},enqueueForceUpdate:function(e){var t=o(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,r(t))},enqueueReplaceState:function(e,t){var n=o(e,"replaceState");n&&(n._pendingStateQueue=[t],n._pendingReplaceState=!0,r(n))},enqueueSetState:function(e,t){var n=o(e,"setState");if(n){var i=n._pendingStateQueue||(n._pendingStateQueue=[]);i.push(t),r(n)}},enqueueSetProps:function(e,t){var n=o(e,"setProps");if(n){n._isTopLevel?void 0:p(!1);var i=n._pendingElement||n._currentElement,a=c({},i.props,t);n._pendingElement=u.cloneAndReplaceProps(i,a),r(n)}},enqueueReplaceProps:function(e,t){var n=o(e,"replaceProps");if(n){n._isTopLevel?void 0:p(!1);var i=n._pendingElement||n._currentElement;n._pendingElement=u.cloneAndReplaceProps(i,t),r(n)}},enqueueElementInternal:function(e,t){e._pendingElement=t,r(e)}});t.exports=d},{133:133,151:151,26:26,38:38,56:56,66:66,68:68,86:86}],86:[function(e,t,n){"use strict";function r(){I.ReactReconcileTransaction&&E?void 0:m(!1)}function o(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=c.getPooled(),this.reconcileTransaction=I.ReactReconcileTransaction.getPooled()}function i(e,t,n,o,i,a){r(),E.batchedUpdates(e,t,n,o,i,a)}function a(e,t){return e._mountOrder-t._mountOrder}function u(e){var t=e.dirtyComponentsLength;t!==g.length?m(!1):void 0,g.sort(a);for(var n=0;t>n;n++){var r=g[n],o=r._pendingCallbacks;if(r._pendingCallbacks=null,f.performUpdateIfNecessary(r,e.reconcileTransaction),o)for(var i=0;i<o.length;i++)e.callbackQueue.enqueue(o[i],r.getPublicInstance())}}function s(e){return r(),E.isBatchingUpdates?void g.push(e):void E.batchedUpdates(s,e)}function l(e,t){E.isBatchingUpdates?void 0:m(!1),y.enqueue(e,t),C=!0}var c=e(6),p=e(27),d=(e(38),e(75)),f=e(80),h=e(102),v=e(26),m=e(133),g=(e(151),[]),y=c.getPooled(),C=!1,E=null,b={initialize:function(){this.dirtyComponentsLength=g.length},close:function(){this.dirtyComponentsLength!==g.length?(g.splice(0,this.dirtyComponentsLength),D()):g.length=0}},_={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},x=[b,_];v(o.prototype,h.Mixin,{getTransactionWrappers:function(){return x},destructor:function(){this.dirtyComponentsLength=null,c.release(this.callbackQueue),this.callbackQueue=null,I.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return h.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),p.addPoolingTo(o);var D=function(){for(;g.length||C;){if(g.length){var e=o.getPooled();e.perform(u,null,e),o.release(e)}if(C){C=!1;var t=y;y=c.getPooled(),t.notifyAll(),c.release(t)}}};D=d.measure("ReactUpdates","flushBatchedUpdates",D);var M={injectReconcileTransaction:function(e){e?void 0:m(!1),I.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){e?void 0:m(!1),"function"!=typeof e.batchedUpdates?m(!1):void 0,"boolean"!=typeof e.isBatchingUpdates?m(!1):void 0,E=e}},I={ReactReconcileTransaction:null,batchedUpdates:i,enqueueUpdate:s,flushBatchedUpdates:D,
injection:M,asap:l};t.exports=I},{102:102,133:133,151:151,26:26,27:27,38:38,6:6,75:75,80:80}],87:[function(e,t,n){"use strict";var r=e(10),o=r.injection.MUST_USE_ATTRIBUTE,i={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},a={Properties:{clipPath:o,cx:o,cy:o,d:o,dx:o,dy:o,fill:o,fillOpacity:o,fontFamily:o,fontSize:o,fx:o,fy:o,gradientTransform:o,gradientUnits:o,markerEnd:o,markerMid:o,markerStart:o,offset:o,opacity:o,patternContentUnits:o,patternUnits:o,points:o,preserveAspectRatio:o,r:o,rx:o,ry:o,spreadMethod:o,stopColor:o,stopOpacity:o,stroke:o,strokeDasharray:o,strokeLinecap:o,strokeOpacity:o,strokeWidth:o,textAnchor:o,transform:o,version:o,viewBox:o,x1:o,x2:o,x:o,xlinkActuate:o,xlinkArcrole:o,xlinkHref:o,xlinkRole:o,xlinkShow:o,xlinkTitle:o,xlinkType:o,xmlBase:o,xmlLang:o,xmlSpace:o,y1:o,y2:o,y:o},DOMAttributeNamespaces:{xlinkActuate:i.xlink,xlinkArcrole:i.xlink,xlinkHref:i.xlink,xlinkRole:i.xlink,xlinkShow:i.xlink,xlinkTitle:i.xlink,xlinkType:i.xlink,xmlBase:i.xml,xmlLang:i.xml,xmlSpace:i.xml},DOMAttributeNames:{clipPath:"clip-path",fillOpacity:"fill-opacity",fontFamily:"font-family",fontSize:"font-size",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",patternContentUnits:"patternContentUnits",patternUnits:"patternUnits",preserveAspectRatio:"preserveAspectRatio",spreadMethod:"spreadMethod",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeLinecap:"stroke-linecap",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",viewBox:"viewBox",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlLang:"xml:lang",xmlSpace:"xml:space"}};t.exports=a},{10:10}],88:[function(e,t,n){"use strict";function r(e){if("selectionStart"in e&&u.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function o(e){if(y||null==v||v!==l())return null;var t=r(v);if(!g||!d(g,t)){g=t;var n=s.getPooled(h.select,m,e);return n.type="select",n.target=v,a.accumulateTwoPhaseDispatches(n),n}return null}var i=e(15),a=e(20),u=e(64),s=e(94),l=e(120),c=e(136),p=e(139),d=e(146),f=i.topLevelTypes,h={select:{phasedRegistrationNames:{bubbled:p({onSelect:null}),captured:p({onSelectCapture:null})},dependencies:[f.topBlur,f.topContextMenu,f.topFocus,f.topKeyDown,f.topMouseDown,f.topMouseUp,f.topSelectionChange]}},v=null,m=null,g=null,y=!1,C=!1,E=p({onSelect:null}),b={eventTypes:h,extractEvents:function(e,t,n,r){if(!C)return null;switch(e){case f.topFocus:(c(t)||"true"===t.contentEditable)&&(v=t,m=n,g=null);break;case f.topBlur:v=null,m=null,g=null;break;case f.topMouseDown:y=!0;break;case f.topContextMenu:case f.topMouseUp:return y=!1,o(r);case f.topSelectionChange:case f.topKeyDown:case f.topKeyUp:return o(r)}return null},didPutListener:function(e,t,n){t===E&&(C=!0)}};t.exports=b},{120:120,136:136,139:139,146:146,15:15,20:20,64:64,94:94}],89:[function(e,t,n){"use strict";var r=Math.pow(2,53),o={createReactRootIndex:function(){return Math.ceil(Math.random()*r)}};t.exports=o},{}],90:[function(e,t,n){"use strict";var r=e(15),o=e(16),i=e(19),a=e(20),u=e(70),s=e(91),l=e(94),c=e(95),p=e(97),d=e(98),f=e(93),h=e(99),v=e(100),m=e(101),g=e(113),y=e(121),C=e(133),E=e(139),b=(e(151),r.topLevelTypes),_={blur:{phasedRegistrationNames:{bubbled:E({onBlur:!0}),captured:E({onBlurCapture:!0})}},click:{phasedRegistrationNames:{bubbled:E({onClick:!0}),captured:E({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:E({onContextMenu:!0}),captured:E({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:E({onCopy:!0}),captured:E({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:E({onCut:!0}),captured:E({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:E({onDoubleClick:!0}),captured:E({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:E({onDrag:!0}),captured:E({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:E({onDragEnd:!0}),captured:E({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:E({onDragEnter:!0}),captured:E({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:E({onDragExit:!0}),captured:E({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:E({onDragLeave:!0}),captured:E({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:E({onDragOver:!0}),captured:E({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:E({onDragStart:!0}),captured:E({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:E({onDrop:!0}),captured:E({onDropCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:E({onFocus:!0}),captured:E({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:E({onInput:!0}),captured:E({onInputCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:E({onKeyDown:!0}),captured:E({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:E({onKeyPress:!0}),captured:E({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:E({onKeyUp:!0}),captured:E({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:E({onLoad:!0}),captured:E({onLoadCapture:!0})}},error:{phasedRegistrationNames:{bubbled:E({onError:!0}),captured:E({onErrorCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:E({onMouseDown:!0}),captured:E({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:E({onMouseMove:!0}),captured:E({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:E({onMouseOut:!0}),captured:E({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:E({onMouseOver:!0}),captured:E({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:E({onMouseUp:!0}),captured:E({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:E({onPaste:!0}),captured:E({onPasteCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:E({onReset:!0}),captured:E({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:E({onScroll:!0}),captured:E({onScrollCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:E({onSubmit:!0}),captured:E({onSubmitCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:E({onTouchCancel:!0}),captured:E({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:E({onTouchEnd:!0}),captured:E({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:E({onTouchMove:!0}),captured:E({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:E({onTouchStart:!0}),captured:E({onTouchStartCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:E({onWheel:!0}),captured:E({onWheelCapture:!0})}}},x={topBlur:_.blur,topClick:_.click,topContextMenu:_.contextMenu,topCopy:_.copy,topCut:_.cut,topDoubleClick:_.doubleClick,topDrag:_.drag,topDragEnd:_.dragEnd,topDragEnter:_.dragEnter,topDragExit:_.dragExit,topDragLeave:_.dragLeave,topDragOver:_.dragOver,topDragStart:_.dragStart,topDrop:_.drop,topError:_.error,topFocus:_.focus,topInput:_.input,topKeyDown:_.keyDown,topKeyPress:_.keyPress,topKeyUp:_.keyUp,topLoad:_.load,topMouseDown:_.mouseDown,topMouseMove:_.mouseMove,topMouseOut:_.mouseOut,topMouseOver:_.mouseOver,topMouseUp:_.mouseUp,topPaste:_.paste,topReset:_.reset,topScroll:_.scroll,topSubmit:_.submit,topTouchCancel:_.touchCancel,topTouchEnd:_.touchEnd,topTouchMove:_.touchMove,topTouchStart:_.touchStart,topWheel:_.wheel};for(var D in x)x[D].dependencies=[D];var M=E({onClick:null}),I={},N={eventTypes:_,executeDispatch:function(e,t,n){var r=i.executeDispatch(e,t,n);r===!1&&(e.stopPropagation(),e.preventDefault())},extractEvents:function(e,t,n,r){var o=x[e];if(!o)return null;var i;switch(e){case b.topInput:case b.topLoad:case b.topError:case b.topReset:case b.topSubmit:i=l;break;case b.topKeyPress:if(0===y(r))return null;case b.topKeyDown:case b.topKeyUp:i=p;break;case b.topBlur:case b.topFocus:i=c;break;case b.topClick:if(2===r.button)return null;case b.topContextMenu:case b.topDoubleClick:case b.topMouseDown:case b.topMouseMove:case b.topMouseOut:case b.topMouseOver:case b.topMouseUp:i=d;break;case b.topDrag:case b.topDragEnd:case b.topDragEnter:case b.topDragExit:case b.topDragLeave:case b.topDragOver:case b.topDragStart:case b.topDrop:i=f;break;case b.topTouchCancel:case b.topTouchEnd:case b.topTouchMove:case b.topTouchStart:i=h;break;case b.topScroll:i=v;break;case b.topWheel:i=m;break;case b.topCopy:case b.topCut:case b.topPaste:i=s}i?void 0:C(!1);var u=i.getPooled(o,n,r);return a.accumulateTwoPhaseDispatches(u),u},didPutListener:function(e,t,n){if(t===M){var r=u.getNode(e);I[e]||(I[e]=o.listen(r,"click",g))}},willDeleteListener:function(e,t){t===M&&(I[e].remove(),delete I[e])}};t.exports=N},{100:100,101:101,113:113,121:121,133:133,139:139,15:15,151:151,16:16,19:19,20:20,70:70,91:91,93:93,94:94,95:95,97:97,98:98,99:99}],91:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(94),i={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};o.augmentClass(r,i),t.exports=r},{94:94}],92:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(94),i={data:null};o.augmentClass(r,i),t.exports=r},{94:94}],93:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(98),i={dataTransfer:null};o.augmentClass(r,i),t.exports=r},{98:98}],94:[function(e,t,n){"use strict";function r(e,t,n){this.dispatchConfig=e,this.dispatchMarker=t,this.nativeEvent=n;var r=this.constructor.Interface;for(var o in r)if(r.hasOwnProperty(o)){var i=r[o];i?this[o]=i(n):this[o]=n[o]}var u=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;u?this.isDefaultPrevented=a.thatReturnsTrue:this.isDefaultPrevented=a.thatReturnsFalse,this.isPropagationStopped=a.thatReturnsFalse}var o=e(27),i=e(26),a=e(113),u=e(124),s={type:null,target:u,currentTarget:a.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};i(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=a.thatReturnsTrue},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=a.thatReturnsTrue},persist:function(){this.isPersistent=a.thatReturnsTrue},isPersistent:a.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;this.dispatchConfig=null,this.dispatchMarker=null,this.nativeEvent=null}}),r.Interface=s,r.augmentClass=function(e,t){var n=this,r=Object.create(n.prototype);i(r,e.prototype),e.prototype=r,e.prototype.constructor=e,e.Interface=i({},n.Interface,t),e.augmentClass=n.augmentClass,o.addPoolingTo(e,o.threeArgumentPooler)},o.addPoolingTo(r,o.threeArgumentPooler),t.exports=r},{113:113,124:124,26:26,27:27}],95:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(100),i={relatedTarget:null};o.augmentClass(r,i),t.exports=r},{100:100}],96:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(94),i={data:null};o.augmentClass(r,i),t.exports=r},{94:94}],97:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(100),i=e(121),a=e(122),u=e(123),s={key:a,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:u,charCode:function(e){return"keypress"===e.type?i(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?i(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};o.augmentClass(r,s),t.exports=r},{100:100,121:121,122:122,123:123}],98:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(100),i=e(103),a=e(123),u={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:a,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+i.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+i.currentScrollTop}};o.augmentClass(r,u),t.exports=r},{100:100,103:103,123:123}],99:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(100),i=e(123),a={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:i};o.augmentClass(r,a),t.exports=r},{100:100,123:123}],100:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(94),i=e(124),a={view:function(e){if(e.view)return e.view;var t=i(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};o.augmentClass(r,a),t.exports=r},{124:124,94:94}],101:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(98),i={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};o.augmentClass(r,i),t.exports=r},{98:98}],102:[function(e,t,n){"use strict";var r=e(133),o={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,n,o,i,a,u,s){this.isInTransaction()?r(!1):void 0;var l,c;try{this._isInTransaction=!0,l=!0,this.initializeAll(0),c=e.call(t,n,o,i,a,u,s),l=!1}finally{try{if(l)try{this.closeAll(0)}catch(p){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return c},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var r=t[n];try{this.wrapperInitData[n]=i.OBSERVED_ERROR,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===i.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(o){}}}},closeAll:function(e){this.isInTransaction()?void 0:r(!1);for(var t=this.transactionWrappers,n=e;n<t.length;n++){var o,a=t[n],u=this.wrapperInitData[n];try{o=!0,u!==i.OBSERVED_ERROR&&a.close&&a.close.call(this,u),o=!1}finally{if(o)try{this.closeAll(n+1)}catch(s){}}}this.wrapperInitData.length=0}},i={Mixin:o,OBSERVED_ERROR:{}};t.exports=i},{133:133}],103:[function(e,t,n){"use strict";var r={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){r.currentScrollLeft=e.x,r.currentScrollTop=e.y}};t.exports=r},{}],104:[function(e,t,n){"use strict";function r(e,t){if(null==t?o(!1):void 0,null==e)return t;var n=Array.isArray(e),r=Array.isArray(t);return n&&r?(e.push.apply(e,t),e):n?(e.push(t),e):r?[e].concat(t):[e,t]}var o=e(133);t.exports=r},{133:133}],105:[function(e,t,n){"use strict";function r(e){for(var t=1,n=0,r=0;r<e.length;r++)t=(t+e.charCodeAt(r))%o,n=(n+t)%o;return t|n<<16}var o=65521;t.exports=r},{}],106:[function(e,t,n){"use strict";function r(e){return e.replace(o,function(e,t){return t.toUpperCase()})}var o=/-(.)/g;t.exports=r},{}],107:[function(e,t,n){"use strict";function r(e){return o(e.replace(i,"ms-"))}var o=e(106),i=/^-ms-/;t.exports=r},{106:106}],108:[function(e,t,n){"use strict";function r(e,t){var n=!0;e:for(;n;){var r=e,i=t;if(n=!1,r&&i){if(r===i)return!0;if(o(r))return!1;if(o(i)){e=r,t=i.parentNode,n=!0;continue e}return r.contains?r.contains(i):r.compareDocumentPosition?!!(16&r.compareDocumentPosition(i)):!1}return!1}}var o=e(137);t.exports=r},{137:137}],109:[function(e,t,n){"use strict";function r(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function o(e){return r(e)?Array.isArray(e)?e.slice():i(e):[e]}var i=e(148);t.exports=o},{148:148}],110:[function(e,t,n){"use strict";function r(e){var t=i.createFactory(e),n=o.createClass({tagName:e.toUpperCase(),displayName:"ReactFullPageComponent"+e,componentWillUnmount:function(){a(!1)},render:function(){return t(this.props)}});return n}var o=e(32),i=e(56),a=e(133);t.exports=r},{133:133,32:32,56:56}],111:[function(e,t,n){"use strict";function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}function o(e,t){var n=l;l?void 0:s(!1);var o=r(e),i=o&&u(o);if(i){n.innerHTML=i[1]+e+i[2];for(var c=i[0];c--;)n=n.lastChild}else n.innerHTML=e;var p=n.getElementsByTagName("script");p.length&&(t?void 0:s(!1),a(p).forEach(t));for(var d=a(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return d}var i=e(21),a=e(109),u=e(126),s=e(133),l=i.canUseDOM?document.createElement("div"):null,c=/^\s*<(\w+)/;t.exports=o},{109:109,126:126,133:133,21:21}],112:[function(e,t,n){"use strict";function r(e,t){var n=null==t||"boolean"==typeof t||""===t;if(n)return"";var r=isNaN(t);return r||0===t||i.hasOwnProperty(e)&&i[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var o=e(4),i=o.isUnitlessNumber;t.exports=r},{4:4}],113:[function(e,t,n){"use strict";function r(e){return function(){return e}}function o(){}o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],114:[function(e,t,n){"use strict";var r={};t.exports=r},{}],115:[function(e,t,n){"use strict";function r(e){return i[e]}function o(e){return(""+e).replace(a,r)}var i={"&":"&",">":">","<":"<",'"':""","'":"'"},a=/[&><"']/g;t.exports=o},{}],116:[function(e,t,n){"use strict";function r(e){return null==e?null:u(e)?e:o.has(e)?i.getNodeFromInstance(e):(null!=e.render&&"function"==typeof e.render?a(!1):void 0,void a(!1))}var o=(e(38),e(66)),i=e(70),a=e(133),u=e(135);e(151);t.exports=r},{133:133,135:135,151:151,38:38,66:66,70:70}],117:[function(e,t,n){"use strict";function r(e,t,n){var r=e,o=void 0===r[n];o&&null!=t&&(r[n]=t)}function o(e){if(null==e)return e;var t={};return i(e,r,t),t}var i=e(149);e(151);t.exports=o},{149:149,151:151}],118:[function(e,t,n){"use strict";function r(e){try{e.focus()}catch(t){}}t.exports=r},{}],119:[function(e,t,n){"use strict";var r=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};t.exports=r},{}],120:[function(e,t,n){"use strict";function r(){try{return document.activeElement||document.body}catch(e){return document.body}}t.exports=r},{}],121:[function(e,t,n){"use strict";function r(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}t.exports=r},{}],122:[function(e,t,n){"use strict";function r(e){if(e.key){var t=i[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=o(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?a[e.keyCode]||"Unidentified":""}var o=e(121),i={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},a={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};t.exports=r},{121:121}],123:[function(e,t,n){"use strict";function r(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=i[e];return r?!!n[r]:!1}function o(e){return r}var i={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=o},{}],124:[function(e,t,n){"use strict";function r(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}t.exports=r},{}],125:[function(e,t,n){"use strict";function r(e){var t=e&&(o&&e[o]||e[i]);return"function"==typeof t?t:void 0}var o="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";t.exports=r},{}],126:[function(e,t,n){"use strict";function r(e){return a?void 0:i(!1),d.hasOwnProperty(e)||(e="*"),u.hasOwnProperty(e)||("*"===e?a.innerHTML="<link />":a.innerHTML="<"+e+"></"+e+">",u[e]=!a.firstChild),u[e]?d[e]:null}var o=e(21),i=e(133),a=o.canUseDOM?document.createElement("div"):null,u={circle:!0,clipPath:!0,defs:!0,ellipse:!0,g:!0,line:!0,linearGradient:!0,path:!0,polygon:!0,polyline:!0,radialGradient:!0,rect:!0,stop:!0,text:!0},s=[1,'<select multiple="true">',"</select>"],l=[1,"<table>","</table>"],c=[3,"<table><tbody><tr>","</tr></tbody></table>"],p=[1,"<svg>","</svg>"],d={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:s,option:s,caption:l,colgroup:l,tbody:l,tfoot:l,thead:l,td:c,th:c,circle:p,clipPath:p,defs:p,ellipse:p,g:p,line:p,linearGradient:p,path:p,polygon:p,polyline:p,radialGradient:p,rect:p,stop:p,text:p};t.exports=r},{133:133,21:21}],127:[function(e,t,n){"use strict";function r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function o(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function i(e,t){for(var n=r(e),i=0,a=0;n;){if(3===n.nodeType){if(a=i+n.textContent.length,t>=i&&a>=t)return{node:n,offset:t-i};i=a}n=r(o(n))}}t.exports=i},{}],128:[function(e,t,n){"use strict";function r(){return!i&&o.canUseDOM&&(i="textContent"in document.documentElement?"textContent":"innerText"),i}var o=e(21),i=null;t.exports=r},{21:21}],129:[function(e,t,n){"use strict";function r(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}t.exports=r},{}],130:[function(e,t,n){"use strict";function r(e){return e.replace(o,"-$1").toLowerCase()}var o=/([A-Z])/g;t.exports=r},{}],131:[function(e,t,n){"use strict";function r(e){return o(e).replace(i,"-ms-")}var o=e(130),i=/^ms-/;t.exports=r},{130:130}],132:[function(e,t,n){"use strict";function r(e){return"function"==typeof e&&"undefined"!=typeof e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function o(e,t){var n;if((null===e||e===!1)&&(e=a.emptyElement),"object"==typeof e){var o=e;n=t===o.type&&"string"==typeof o.type?u.createInternalComponent(o):r(o.type)?new o.type(o):new c}else"string"==typeof e||"number"==typeof e?n=u.createInstanceForText(e):l(!1);return n.construct(e),n._mountIndex=0,n._mountImage=null,n}var i=e(36),a=e(58),u=e(73),s=e(26),l=e(133),c=(e(151),function(){});s(c.prototype,i.Mixin,{_instantiateReactComponent:o}),t.exports=o},{133:133,151:151,26:26,36:36,58:58,73:73}],133:[function(e,t,n){"use strict";var r=function(e,t,n,r,o,i,a,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,i,a,u],c=0;s=new Error("Invariant Violation: "+t.replace(/%s/g,function(){return l[c++]}))}throw s.framesToPop=1,s}};t.exports=r},{}],134:[function(e,t,n){"use strict";function r(e,t){if(!i.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var a=document.createElement("div");a.setAttribute(n,"return;"),r="function"==typeof a[n]}return!r&&o&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var o,i=e(21);i.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),t.exports=r},{21:21}],135:[function(e,t,n){"use strict";function r(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}t.exports=r},{}],136:[function(e,t,n){"use strict";function r(e){return e&&("INPUT"===e.nodeName&&o[e.type]||"TEXTAREA"===e.nodeName)}var o={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};t.exports=r},{}],137:[function(e,t,n){"use strict";function r(e){return o(e)&&3==e.nodeType}var o=e(135);t.exports=r},{135:135}],138:[function(e,t,n){"use strict";var r=e(133),o=function(e){var t,n={};e instanceof Object&&!Array.isArray(e)?void 0:r(!1);for(t in e)e.hasOwnProperty(t)&&(n[t]=t);return n};t.exports=o},{133:133}],139:[function(e,t,n){"use strict";var r=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};t.exports=r},{}],140:[function(e,t,n){"use strict";function r(e,t,n){if(!e)return null;var r={};for(var i in e)o.call(e,i)&&(r[i]=t.call(n,e[i],i,e));return r}var o=Object.prototype.hasOwnProperty;t.exports=r},{}],141:[function(e,t,n){"use strict";function r(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}t.exports=r},{}],142:[function(e,t,n){"use strict";function r(e){return o.isValidElement(e)?void 0:i(!1),e}var o=e(56),i=e(133);t.exports=r},{133:133,56:56}],143:[function(e,t,n){"use strict";function r(e){return'"'+o(e)+'"'}var o=e(115);t.exports=r},{115:115}],144:[function(e,t,n){"use strict";var r=e(21),o=/^[ \r\n\t\f]/,i=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(a=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var u=document.createElement("div");u.innerHTML=" ",""===u.innerHTML&&(a=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&i.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}t.exports=a},{21:21}],145:[function(e,t,n){"use strict";var r=e(21),o=e(115),i=e(144),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){i(e,o(t))})),t.exports=a},{115:115,144:144,21:21}],146:[function(e,t,n){"use strict";function r(e,t){if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=Object.prototype.hasOwnProperty.bind(t),i=0;i<n.length;i++)if(!o(n[i])||e[n[i]]!==t[n[i]])return!1;return!0}t.exports=r},{}],147:[function(e,t,n){"use strict";function r(e,t){if(null!=e&&null!=t){var n=typeof e,r=typeof t;return"string"===n||"number"===n?"string"===r||"number"===r:"object"===r&&e.type===t.type&&e.key===t.key}return!1}t.exports=r},{}],148:[function(e,t,n){"use strict";function r(e){var t=e.length;if(Array.isArray(e)||"object"!=typeof e&&"function"!=typeof e?o(!1):void 0,"number"!=typeof t?o(!1):void 0,0===t||t-1 in e?void 0:o(!1),e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(n){}for(var r=Array(t),i=0;t>i;i++)r[i]=e[i];return r}var o=e(133);t.exports=r},{133:133}],149:[function(e,t,n){"use strict";function r(e){return m[e]}function o(e,t){return e&&null!=e.key?a(e.key):t.toString(36)}function i(e){return(""+e).replace(g,r)}function a(e){return"$"+i(e)}function u(e,t,n,r){var i=typeof e;if(("undefined"===i||"boolean"===i)&&(e=null),null===e||"string"===i||"number"===i||l.isValidElement(e))return n(r,e,""===t?h+o(e,0):t),1;var s,p,m=0;if(Array.isArray(e))for(var g=0;g<e.length;g++)s=e[g],p=(""!==t?t+v:h)+o(s,g),m+=u(s,p,n,r);else{var y=d(e);if(y){var C,E=y.call(e);if(y!==e.entries)for(var b=0;!(C=E.next()).done;)s=C.value,p=(""!==t?t+v:h)+o(s,b++),m+=u(s,p,n,r);else for(;!(C=E.next()).done;){var _=C.value;_&&(s=_[1],p=(""!==t?t+v:h)+a(_[0])+v+o(s,0),m+=u(s,p,n,r))}}else if("object"===i){1===e.nodeType?f(!1):void 0;var x=c.extract(e);for(var D in x)x.hasOwnProperty(D)&&(s=x[D],p=(""!==t?t+v:h)+a(D)+v+o(s,0),m+=u(s,p,n,r))}}return m}function s(e,t,n){return null==e?0:u(e,"",t,n)}var l=e(56),c=e(62),p=e(65),d=e(125),f=e(133),h=(e(151),p.SEPARATOR),v=":",m={"=":"=0",".":"=1",":":"=2"},g=/[=.:]/g;t.exports=s},{125:125,133:133,151:151,56:56,62:62,65:65}],150:[function(e,t,n){"use strict";var r=(e(26),e(113)),o=(e(151),r);t.exports=o},{113:113,151:151,26:26}],151:[function(e,t,n){"use strict";var r=e(113),o=r;t.exports=o},{113:113}]},{},[1])(1)});
|
src/user/components/nav_bar.js
|
foundersandcoders/sail-back
|
import React from 'react'
import ReactDOM from 'react-dom'
import { map, zip } from 'ramda'
import { Navbar, Nav, NavItem } from 'react-bootstrap'
class NavigationBar extends React.Component {
componentDidMount () {
const navBar = ReactDOM.findDOMNode(this.refs.navigation_bar)
const collapsibleNav = navBar.querySelector('div.navbar-collapse')
const btnToggle = navBar.querySelector('button.navbar-toggle')
navBar.addEventListener('click', (e) => {
if (e.target.tagName !== 'A' ||
e.target.classList.contains('dropdown-toggle') ||
! collapsibleNav.classList.contains('in')) return
btnToggle.click()
}, false)
}
render () {
return (
<Navbar ref='navigation_bar'>
<Navbar.Toggle />
<Navbar.Collapse>
<Nav>
{map(item)(zip(routes, text))}
</Nav>
</Navbar.Collapse>
</Navbar>
)
}
}
const item = ([route, text]) =>
<NavItem key={route} href={route}>{text}</NavItem>
const routes = [ '#', '#membership', '#statements', '#make-payment', '#change-password', '/member-signout' ]
const text = [ 'Contact Details', 'Membership', 'My Account', 'Make a Payment', 'Change Password', 'Sign Out' ]
export default NavigationBar
|
src/components/Header.js
|
vitorgomateus/NotifyMe
|
/**
* Created by VitorMaGo on 15/12/2016.
*/
import React from 'react';
import {Component} from 'react';
import {browserHistory} from 'react-router';
import { MenuItem } from 'react-bootstrap/lib/MenuItem';
import { Link } from 'react-router';
import Back from '../../public/img/left_arrow.png';
import '../css/header.css';
class Header extends Component {
constructor(props){
super(props);
this.Logout = this.Logout.bind(this);
}
Logout(){
window.localStorage.removeItem("userToken");
window.localStorage.removeItem("userName");
browserHistory.push('/login');
}
render (){
return(
<nav className="navbar navbar-inverse altura">
<div className="container-fluid">
<div className="navbar-header floater">
<a className="navbar-brand" href="/home"><b id="title">Notify Me!</b></a>
<button type="button" className="navbar-toggle botao" data-toggle="collapse" data-target="#myNavbar">
<span className="icon-bar"></span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
</button>
</div>
<div className="collapse navbar-collapse cima" id="myNavbar">
<ul className="nav navbar-nav navbar-right">
<li><Link to = "/home" id="links">Home</Link></li>
<li><Link to = "/prefs" id="links">Prefs</Link></li>
<li onClick={() => this.Logout()}><a id="links" className="glyphicon glyphicon-log-out" href="#">Logout</a></li>
</ul>
</div>
</div>
</nav>
);
}
}
/*
<nav role="navigation" className="navbar navbar-inverse">
<div className="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" className="navbar-toggle">
<span className="sr-only">Toggle navigation</span>
<span className="icon-bar"> </span>
<span className="icon-bar"> </span>
<span className="icon-bar"> </span>
</button>
<Link to="/home">
<img className="backarrow" alt="Go back" src={Back}/>
</Link>
<h1 className="headerLogo"><b>Notify Me!</b></h1>
</div>
<div id="navbarCollapse" className="collapse navbar-collapse navbar-right">
<ul className="nav navbar-nav navbar-left">
<li><Link to="/home">Home</Link></li>
{/!*<li><Link to="/defs">Definições</Link></li>*!/}
{/!*Deviam sair daqui*!/}
{/!*<li><Link to="/info">Login</Link></li>*!/}
<li><Link to="/prefs">Preferências</Link></li>
<li onClick={() => this.Logout()}><a href="#"><span className="glyphicon glyphicon-log-out"></span> Logout</a></li>
</ul>
<ul className="nav navbar-nav">
</ul>
</div>
</nav>*/
export default Header
|
src/component/login-container/index.js
|
SpenGietz/dictate-it
|
import React from 'react';
import {connect} from 'react-redux';
import * as util from '../../lib/util';
import * as auth from '../../action/auth-actions.js';
import * as querystring from 'querystring';
import {Redirect, Link} from 'react-router-dom';
import {Card, CardActions} from 'material-ui/Card';
import RaisedButton from 'material-ui/RaisedButton';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import lightBaseTheme from 'material-ui/styles/baseThemes/lightBaseTheme';
import {cyan500} from 'material-ui/styles/colors';
import TextField from 'material-ui/TextField';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import IconButton from 'material-ui/IconButton';
import googleSVG from '../../assets/google.svg';
export class LoginContainer extends React.Component {
constructor(props) {
super(props);
this.state = {
username: '',
password: '',
};
this.handleSubmit = this.handleSubmit.bind(this);
this.handleChange = this.handleChange.bind(this);
}
handleSubmit(event) {
event.preventDefault();
return this.props.login(this.state)
.then(() => {
util.log(this.props.history);
util.log(this.props.match);
util.log();
this.props.history.push('/landing');
})
.catch(console.error);
}
handleChange(event) {
let {name, value} = event.target;
this.setState({ [name]: value });
}
render(){
let googleLoginBaseURL='https://accounts.google.com/o/oauth2/v2/auth';
let googleLoginQuery = querystring.stringify({
client_id: __GOOGLE_CLIENT_ID__,
response_type: 'code',
redirect_uri: `${__API_URL__}/oauth/google/code`,
scope: 'openid profile email',
prompt: __DEBUG__ ? 'consent' : undefined,
});
const style ={
card: {
height: '350px',
width: '275px',
margin: '0 auto',
textAlign: 'center',
marginTop: '75px',
},
inputs: {
width: '50%',
margin: '0 auto',
},
button: {
margin: 15,
},
};
let googleLoginURL = `${googleLoginBaseURL}?${googleLoginQuery}`;
return(
<Card style={style.card} id="login-card">
<div className='login-container'>
<header>
{util.renderIf(!this.props.token,
<div className='login'>
<RaisedButton
href={googleLoginURL}
label="Login with "
labelPosition="before"
primary={true}
fullWidth={false}
backgroundColor={'#29B6F6'}
style={style.button}
icon={<img src={googleSVG} width={25} height={25}/>}
/>
<br />
OR
<br />
<RaisedButton label="Sign Up"
style={style.button}
containerElement={<Link to="/signup" />}
// linkButton={true}
/>
<br />
OR
<br />
</div>
)}
</header>
{util.renderIf(this.props.token,
<Redirect to='/landing' />
)}
<form className='login-form' onSubmit={this.handleSubmit}>
<TextField
style={style.inputs}
name='username'
hintText='username'
fullWidth={false}
value={this.state.username}
onChange={this.handleChange}
/>
<br />
<TextField
style={style.inputs}
name='password'
hintText='password'
fullWidth={false}
value={this.state.password}
onChange={this.handleChange}
/>
<br />
<div className='login-submit'>
<RaisedButton type='submit' label="Submit" fullWidth={false} />
</div>
</form>
</div>
</Card>
);
}
}
export const mapStateToProps = (state) => ({
token: state.token,
});
export const mapDispatchToProps = (dispatch) => ({
login: user => dispatch(auth.loginRequest(user)),
});
export default connect(mapStateToProps, mapDispatchToProps)(LoginContainer);
|
test/js/lightIntensityTest.js
|
viromedia/viro
|
/**
* Copyright (c) 2017-present, Viro Media, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import {
ViroScene,
ViroBox,
ViroMaterials,
ViroNode,
ViroOrbitCamera,
ViroImage,
ViroVideo,
ViroSkyBox,
Viro360Video,
ViroText,
ViroQuad,
ViroAmbientLight
} from 'react-viro';
import TimerMixin from 'react-timer-mixin';
var createReactClass = require('create-react-class');
var testARScene = createReactClass({
mixins: [TimerMixin],
getInitialState: function() {
return {
intensity : 1000.0,
}
},
render: function() {
return (
<ViroScene ref="arscene">
<ViroAmbientLight color={"#ff0000"} intensity={this.state.intensity} />
<ViroBox position={[0,0,-2]} scale={[1,1,1]} materials={"box"} onClick={this._onClick}/>
</ViroScene>
);
},
_onClick() {
if (this.state.intensity >= 1200) {
this.setState({
intensity : 300
})
} else {
this.setState({
intensity : this.state.intensity + 100
})
}
}
});
ViroMaterials.createMaterials({
transparent: {
shininess: 2.0,
lightingModel: "Constant",
diffuseColor: "#00000055"
},
box :{
shininess: 2.0,
lightingModel: "Blinn",
diffuseColor: "#ffffff"
}
});
module.exports = testARScene;
|
frontend/modules/list/components/NewList.js
|
rustymyers/OpenEats
|
"use strict";
import React from 'react'
import PropTypes from 'prop-types'
import { injectIntl, defineMessages } from 'react-intl'
import { ENTER_KEY } from '../constants/ListStatus'
class NewList extends React.Component {
constructor(props) {
super(props);
this.state = {
title: this.props.title || '',
};
}
handleChange = (event) => {
this.setState({title: event.target.value});
};
handleKeyDown = (event) => {
if (event.which === ENTER_KEY) {
this.handleSubmit(event);
}
};
handleSubmit = () => {
let val = this.state.title.trim();
if (val) {
this.props.addList(val);
}
};
render() {
const { formatMessage } = this.props.intl;
const messages = defineMessages({
header: {
id: 'new_list.header',
description: 'Create a New List',
defaultMessage: 'Create a New List',
},
placeholder: {
id: 'new_list.placeholder',
description: 'Enter your list name.',
defaultMessage: 'Enter your list name.',
},
button: {
id: 'new_list.button',
description: 'Create my List!',
defaultMessage: 'Create my List!',
},
});
return (
<div className="new-list">
<h2 className="new-list-heading">
{ formatMessage(messages.header) }
</h2>
<input
type="text"
autoFocus="true"
className="form-control"
placeholder={ formatMessage(messages.placeholder) }
value={ this.state.title }
onChange={ this.handleChange }
onKeyDown={ this.handleKeyDown }
/>
<button
type="button"
className="btn btn-lg btn-primary btn-block"
onClick={ this.handleSubmit }
>{ formatMessage(messages.button) }</button>
</div>
)
};
}
NewList.propTypes = {
title: PropTypes.string,
intl: PropTypes.object.isRequired,
addList: PropTypes.func.isRequired,
};
export default injectIntl(NewList)
|
src/components/generics/navbar.js
|
bombe-software/demos
|
import React, { Component } from 'react';
import { Link } from "react-router-dom";
import { connect } from "react-redux";
class Navbar extends Component {
constructor(props) {
super(props);
this.state = {
isToggleOn: false,
isUserSelected: false
};
this.handleClick = this.handleClick.bind(this);
this.renderNavEnd = this.renderNavEnd.bind(this);
}
handleClick() {
this.setState(prevState => ({
isToggleOn: !prevState.isToggleOn
}));
}
handleClickUser(){
this.setState(prevState => ({
isUserSelected: !prevState.isUserSelected
}));
}
renderNavEnd(){
if(JSON.stringify(this.props.user) == '{}'){
return(
<div>
<div className="navbar-item">
<Link to="/login" className="navbar-item is-light" onClick={this.handleClick}>
Iniciar sesión
</Link>
<Link to="/signup" className="navbar-item" onClick={this.handleClick}>
Registro
</Link >
</div>
</div>
);
}else{
return(
<div>
<div className="navbar-item">
<div className="field is-grouped">
<div className="navbar-item is-light has-dropdown is-hoverable" onClick={this.handleClick}>
<a className="navbar-item">@{this.props.user.nombre_usuario}</a>
<div className="navbar-dropdown is-right">
<Link to="/config_cuenta" className="navbar-item">Configuración de la cuenta</Link>
<a className="navbar-item" href="/">Cerrar sesión</a>
</div>
</div>
<div className="navbar-item">
<img src={"../../assets/img/"+this.props.user.avatar+".png"} height="28" width="28"/>
</div>
</div>
</div>
</div>
);
}
}
renderModerador(){
if(JSON.stringify(this.props.user) != '{}'){
if(this.props.user.id_tipo_usuario == '2'){
return(
<Link to="/moderador" className="navbar-item">
Moderador
</Link>
);
}
}
}
/**
* Es una forma de capturar cualquier error en la clase
* y que este no crashe el programa, ayuda con la depuracion
* de errores
* @method componentDidCatch
* @const info Es más informacion acerca del error
* @const error Es el titulo del error
*/
componentDidCatch(error, info) {
console.log("Error: " + error);
console.log("Info: " + info);
}
render() {
return (
//Logo de la navbar
<div>
<nav className="navbar is-transparent">
<div className="navbar-brand">
<Link className="navbar-item" to="/">
<img src="../../assets/img/demos_logo_21.png" alt="Demos" width="112" height="28"/>
</Link>
<div className={this.state.isToggleOn ? 'navbar-burger burger is-active' : 'navbar-burger burger'} data-target="nav-demos-menu" onClick={this.handleClick}>
<span></span>
<span></span>
<span></span>
</div>
</div>
<div id="nav-demos-menu" className={this.state.isToggleOn ? 'navbar-menu is-active' : 'navbar-menu'}>
<div className="navbar-start">
<div className="navbar-item">
<Link to="/elecciones" className="navbar-item" onClick={this.handleClick}>
Elecciones
</Link>
<Link to="/politicos" className="navbar-item" onClick={this.handleClick}>
Politicos
</Link>
<Link to="/acerca-de" className="navbar-item" onClick={this.handleClick}>
Ayuda
</Link>
<Link to="/soporte" className="navbar-item" onClick={this.handleClick}>
Soporte
</Link>
{this.renderModerador()}
</div>
</div>
<div className="navbar-end">
{this.renderNavEnd()}
</div>
</div>
</nav>
</div>
);
}
}
function mapStateToProps(state) {
return { user: state.user };
}
export default connect(mapStateToProps, null )(Navbar);
|
ajax/libs/6to5/2.3.1/browser-polyfill.js
|
sullivanmatt/cdnjs
|
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){require("core-js/shim");require("regenerator/runtime")},{"core-js/shim":2,"regenerator/runtime":3}],2:[function(require,module,exports){!function(returnThis,framework,undefined){"use strict";var global=returnThis(),OBJECT="Object",FUNCTION="Function",ARRAY="Array",STRING="String",NUMBER="Number",REGEXP="RegExp",DATE="Date",MAP="Map",SET="Set",WEAKMAP="WeakMap",WEAKSET="WeakSet",SYMBOL="Symbol",PROMISE="Promise",MATH="Math",ARGUMENTS="Arguments",PROTOTYPE="prototype",CONSTRUCTOR="constructor",TO_STRING="toString",TO_STRING_TAG=TO_STRING+"Tag",TO_LOCALE="toLocaleString",HAS_OWN="hasOwnProperty",FOR_EACH="forEach",ITERATOR="iterator",FF_ITERATOR="@@"+ITERATOR,PROCESS="process",CREATE_ELEMENT="createElement",Function=global[FUNCTION],Object=global[OBJECT],Array=global[ARRAY],String=global[STRING],Number=global[NUMBER],RegExp=global[REGEXP],Date=global[DATE],Map=global[MAP],Set=global[SET],WeakMap=global[WEAKMAP],WeakSet=global[WEAKSET],Symbol=global[SYMBOL],Math=global[MATH],TypeError=global.TypeError,setTimeout=global.setTimeout,setImmediate=global.setImmediate,clearImmediate=global.clearImmediate,process=global[PROCESS],nextTick=process&&process.nextTick,document=global.document,html=document&&document.documentElement,navigator=global.navigator,define=global.define,ArrayProto=Array[PROTOTYPE],ObjectProto=Object[PROTOTYPE],FunctionProto=Function[PROTOTYPE],Infinity=1/0,DOT=".";function isObject(it){return it!=null&&(typeof it=="object"||typeof it=="function")}function isFunction(it){return typeof it=="function"}var isNative=ctx(/./.test,/\[native code\]\s*\}\s*$/,1);var buildIn={Undefined:1,Null:1,Array:1,String:1,Arguments:1,Function:1,Error:1,Boolean:1,Number:1,Date:1,RegExp:1},toString=ObjectProto[TO_STRING];function setToStringTag(it,tag,stat){if(it)has(it=stat?it:it[PROTOTYPE],SYMBOL_TAG)||hidden(it,SYMBOL_TAG,tag)}function cof(it){return it==undefined?it===undefined?"Undefined":"Null":toString.call(it).slice(8,-1)}function classof(it){var klass=cof(it),tag;return klass==OBJECT&&(tag=it[SYMBOL_TAG])?has(buildIn,tag)?"~"+tag:tag:klass}var call=FunctionProto.call,REFERENCE_GET;function part(){var length=arguments.length,args=Array(length),i=0,_=path._,holder=false;while(length>i)if((args[i]=arguments[i++])===_)holder=true;return partial(this,args,length,holder,_,false)}function partial(fn,argsPart,lengthPart,holder,_,bind,context){assertFunction(fn);return function(){var that=bind?context:this,length=arguments.length,i=0,j=0,args;if(!holder&&!length)return invoke(fn,argsPart,that);args=argsPart.slice();if(holder)for(;lengthPart>i;i++)if(args[i]===_)args[i]=arguments[j++];while(length>j)args.push(arguments[j++]);return invoke(fn,args,that)}}function ctx(fn,that,length){assertFunction(fn);if(~length&&that===undefined)return fn;switch(length){case 1:return function(a){return fn.call(that,a)};case 2:return function(a,b){return fn.call(that,a,b)};case 3:return function(a,b,c){return fn.call(that,a,b,c)}}return function(){return fn.apply(that,arguments)}}function invoke(fn,args,that){var un=that===undefined;switch(args.length|0){case 0:return un?fn():fn.call(that);case 1:return un?fn(args[0]):fn.call(that,args[0]);case 2:return un?fn(args[0],args[1]):fn.call(that,args[0],args[1]);case 3:return un?fn(args[0],args[1],args[2]):fn.call(that,args[0],args[1],args[2]);case 4:return un?fn(args[0],args[1],args[2],args[3]):fn.call(that,args[0],args[1],args[2],args[3]);case 5:return un?fn(args[0],args[1],args[2],args[3],args[4]):fn.call(that,args[0],args[1],args[2],args[3],args[4])}return fn.apply(that,args)}var create=Object.create,getPrototypeOf=Object.getPrototypeOf,defineProperty=Object.defineProperty,defineProperties=Object.defineProperties,getOwnDescriptor=Object.getOwnPropertyDescriptor,getKeys=Object.keys,getNames=Object.getOwnPropertyNames,getSymbols=Object.getOwnPropertySymbols,has=ctx(call,ObjectProto[HAS_OWN],2),ES5Object=Object;function get(object,key){if(has(object,key))return object[key]}function ownKeys(it){return getSymbols?getNames(it).concat(getSymbols(it)):getNames(it)}var assign=Object.assign||function(target,source){var T=Object(assertDefined(target)),l=arguments.length,i=1;while(l>i){var S=ES5Object(arguments[i++]),keys=getKeys(S),length=keys.length,j=0,key;while(length>j)T[key=keys[j++]]=S[key]}return T};function keyOf(object,el){var O=ES5Object(object),keys=getKeys(O),length=keys.length,index=0,key;while(length>index)if(O[key=keys[index++]]===el)return key}function array(it){return String(it).split(",")}var push=ArrayProto.push,unshift=ArrayProto.unshift,slice=ArrayProto.slice,splice=ArrayProto.splice,indexOf=ArrayProto.indexOf,forEach=ArrayProto[FOR_EACH];function createArrayMethod(type){var isMap=type==1,isFilter=type==2,isSome=type==3,isEvery=type==4,isFindIndex=type==6,noholes=type==5||isFindIndex;return function(callbackfn,that){var O=Object(assertDefined(this)),self=ES5Object(O),f=ctx(callbackfn,that,3),length=toLength(self.length),index=0,result=isMap?Array(length):isFilter?[]:undefined,val,res;for(;length>index;index++)if(noholes||index in self){val=self[index];res=f(val,index,O);if(type){if(isMap)result[index]=res;else if(res)switch(type){case 3:return true;case 5:return val;case 6:return index;case 2:result.push(val)}else if(isEvery)return false}}return isFindIndex?-1:isSome||isEvery?isEvery:result}}function createArrayContains(isContains){return function(el,fromIndex){var O=ES5Object(assertDefined(this)),length=toLength(O.length),index=toIndex(fromIndex,length);if(isContains&&el!=el){for(;length>index;index++)if(sameNaN(O[index]))return isContains||index}else for(;length>index;index++)if(isContains||index in O){if(O[index]===el)return isContains||index}return!isContains&&-1}}function turn(mapfn,target){assertFunction(mapfn);var memo=target==undefined?[]:Object(target),O=ES5Object(this),length=toLength(O.length),index=0;for(;length>index;index++){if(mapfn(memo,O[index],index,this)===false)break}return memo}function generic(A,B){return typeof A=="function"?A:B}var MAX_SAFE_INTEGER=9007199254740991,ceil=Math.ceil,floor=Math.floor,max=Math.max,min=Math.min,random=Math.random,trunc=Math.trunc||function(it){return(it>0?floor:ceil)(it)};function sameNaN(number){return number!=number}function toInteger(it){return isNaN(it)?0:trunc(it)}function toLength(it){return it>0?min(toInteger(it),MAX_SAFE_INTEGER):0}function toIndex(index,length){var index=toInteger(index);return index<0?max(index+length,0):min(index,length)}function createReplacer(regExp,replace,isStatic){var replacer=isObject(replace)?function(part){return replace[part]}:replace;return function(it){return String(isStatic?it:this).replace(regExp,replacer)}}function createPointAt(toString){return function(pos){var s=String(assertDefined(this)),i=toInteger(pos),l=s.length,a,b;if(i<0||i>=l)return toString?"":undefined;a=s.charCodeAt(i);return a<55296||a>56319||i+1===l||(b=s.charCodeAt(i+1))<56320||b>57343?toString?s.charAt(i):a:toString?s.slice(i,i+2):(a-55296<<10)+(b-56320)+65536}}var REDUCE_ERROR="Reduce of empty object with no initial value";function assert(condition,msg1,msg2){if(!condition)throw TypeError(msg2?msg1+msg2:msg1)}function assertDefined(it){if(it==undefined)throw TypeError("Function called on null or undefined");return it}function assertFunction(it){assert(isFunction(it),it," is not a function!");return it}function assertObject(it){assert(isObject(it),it," is not an object!");return it}function assertInstance(it,Constructor,name){assert(it instanceof Constructor,name,": use the 'new' operator!")}function descriptor(bitmap,value){return{enumerable:!(bitmap&1),configurable:!(bitmap&2),writable:!(bitmap&4),value:value}}function simpleSet(object,key,value){object[key]=value;return object}function createDefiner(bitmap){return DESC?function(object,key,value){return defineProperty(object,key,descriptor(bitmap,value))}:simpleSet}function uid(key){return SYMBOL+"("+key+")_"+(++sid+random())[TO_STRING](36)}function getWellKnownSymbol(name,setter){return Symbol&&Symbol[name]||(setter?Symbol:safeSymbol)(SYMBOL+DOT+name)}var DESC=!!function(){try{return defineProperty({},0,ObjectProto)}catch(e){}}(),sid=0,hidden=createDefiner(1),set=Symbol?simpleSet:hidden,safeSymbol=Symbol||uid;function assignHidden(target,src){for(var key in src)hidden(target,key,src[key]);return target}var SYMBOL_ITERATOR=getWellKnownSymbol(ITERATOR),SYMBOL_TAG=getWellKnownSymbol(TO_STRING_TAG),SUPPORT_FF_ITER=FF_ITERATOR in ArrayProto,ITER=safeSymbol("iter"),KEY=1,VALUE=2,Iterators={},IteratorPrototype={},NATIVE_ITERATORS=SYMBOL_ITERATOR in ArrayProto,BUGGY_ITERATORS="keys"in ArrayProto&&!("next"in[].keys());setIterator(IteratorPrototype,returnThis);function setIterator(O,value){hidden(O,SYMBOL_ITERATOR,value);SUPPORT_FF_ITER&&hidden(O,FF_ITERATOR,value)}function createIterator(Constructor,NAME,next,proto){Constructor[PROTOTYPE]=create(proto||IteratorPrototype,{next:descriptor(1,next)});setToStringTag(Constructor,NAME+" Iterator")}function defineIterator(Constructor,NAME,value,DEFAULT){var proto=Constructor[PROTOTYPE],iter=get(proto,SYMBOL_ITERATOR)||get(proto,FF_ITERATOR)||DEFAULT&&get(proto,DEFAULT)||value;if(framework){setIterator(proto,iter);if(iter!==value){var iterProto=getPrototypeOf(iter.call(new Constructor));setToStringTag(iterProto,NAME+" Iterator",true);has(proto,FF_ITERATOR)&&setIterator(iterProto,returnThis)}}Iterators[NAME]=iter;Iterators[NAME+" Iterator"]=returnThis}function defineStdIterators(Base,NAME,Constructor,next,DEFAULT){function createIter(kind){return function(){return new Constructor(this,kind)}}createIterator(Constructor,NAME,next);defineIterator(Base,NAME,createIter(DEFAULT),DEFAULT==VALUE?"values":"entries");DEFAULT&&$define(PROTO+FORCED*BUGGY_ITERATORS,NAME,{entries:createIter(KEY+VALUE),keys:createIter(KEY),values:createIter(VALUE)})}function iterResult(done,value){return{value:value,done:!!done}}function isIterable(it){var O=Object(it);return SYMBOL_ITERATOR in O||has(Iterators,classof(O))}function getIterator(it){return assertObject((it[SYMBOL_ITERATOR]||Iterators[classof(it)]).call(it))}function stepCall(fn,value,entries){return entries?invoke(fn,value):fn(value)}function forOf(iterable,entries,fn,that){var iterator=getIterator(iterable),f=ctx(fn,that,entries?2:1),step;while(!(step=iterator.next()).done)if(stepCall(f,step.value,entries)===false)return}var NODE=cof(process)==PROCESS,core={},path=framework?global:core,old=global.core,FORCED=1,GLOBAL=2,STATIC=4,PROTO=8,BIND=16,WRAP=32;function $define(type,name,source){var key,own,out,exp,isGlobal=type&GLOBAL,target=isGlobal?global:type&STATIC?global[name]:(global[name]||ObjectProto)[PROTOTYPE],exports=isGlobal?core:core[name]||(core[name]={});if(isGlobal)source=name;for(key in source){own=!(type&FORCED)&&target&&key in target&&(!isFunction(target[key])||isNative(target[key]));out=(own?target:source)[key];if(type&BIND&&own)exp=ctx(out,global);else if(type&WRAP&&!framework&&target[key]==out){exp=function(param){return this instanceof out?new out(param):out(param)};exp[PROTOTYPE]=out[PROTOTYPE]}else exp=type&PROTO&&isFunction(out)?ctx(call,out):out;if(exports[key]!=out)hidden(exports,key,exp);if(framework&&target&&!own){if(isGlobal)target[key]=out;else delete target[key]&&hidden(target,key,out)}}}if(NODE)module.exports=core;if(isFunction(define)&&define.amd)define(function(){return core});if(!NODE||framework){core.noConflict=function(){global.core=old;return core};global.core=core}$define(GLOBAL+FORCED,{global:global});!function(TAG,SymbolRegistry,setter){if(!isNative(Symbol)){Symbol=function(description){assert(!(this instanceof Symbol),SYMBOL+" is not a "+CONSTRUCTOR);var tag=uid(description);setter&&defineProperty(ObjectProto,tag,{configurable:true,set:function(value){hidden(this,tag,value)}});return set(create(Symbol[PROTOTYPE]),TAG,tag)};hidden(Symbol[PROTOTYPE],TO_STRING,function(){return this[TAG]})}$define(GLOBAL+WRAP,{Symbol:Symbol});var symbolStatics={"for":function(key){return has(SymbolRegistry,key+="")?SymbolRegistry[key]:SymbolRegistry[key]=Symbol(key)},iterator:SYMBOL_ITERATOR,keyFor:part.call(keyOf,SymbolRegistry),toStringTag:SYMBOL_TAG=getWellKnownSymbol(TO_STRING_TAG,true),pure:safeSymbol,set:set,useSetter:function(){setter=true},useSimple:function(){setter=false}};forEach.call(array("hasInstance,isConcatSpreadable,match,replace,search,"+"species,split,toPrimitive,unscopables"),function(it){symbolStatics[it]=getWellKnownSymbol(it)});$define(STATIC,SYMBOL,symbolStatics);setToStringTag(Symbol,SYMBOL);$define(GLOBAL,{Reflect:{ownKeys:ownKeys}})}(safeSymbol("tag"),{},true);!function(isFinite,tmp){var RangeError=global.RangeError,isInteger=Number.isInteger||function(it){return!isObject(it)&&isFinite(it)&&floor(it)===it},sign=Math.sign||function sign(it){return(it=+it)==0||it!=it?it:it<0?-1:1},pow=Math.pow,abs=Math.abs,exp=Math.exp,log=Math.log,sqrt=Math.sqrt,fcc=String.fromCharCode,at=createPointAt(true);var objectStatic={assign:assign,is:function(x,y){return x===y?x!==0||1/x===1/y:x!=x&&y!=y}};"__proto__"in ObjectProto&&function(buggy,set){try{set=ctx(call,getOwnDescriptor(ObjectProto,"__proto__").set,2);set({},ArrayProto)}catch(e){buggy=true}objectStatic.setPrototypeOf=function(O,proto){assertObject(O);assert(proto===null||isObject(proto),proto,": can't set as prototype!");if(buggy)O.__proto__=proto;else set(O,proto);return O}}();$define(STATIC,OBJECT,objectStatic);function asinh(x){return!isFinite(x=+x)||x==0?x:x<0?-asinh(-x):log(x+sqrt(x*x+1))}$define(STATIC,NUMBER,{EPSILON:pow(2,-52),isFinite:function(it){return typeof it=="number"&&isFinite(it)},isInteger:isInteger,isNaN:sameNaN,isSafeInteger:function(number){return isInteger(number)&&abs(number)<=MAX_SAFE_INTEGER},MAX_SAFE_INTEGER:MAX_SAFE_INTEGER,MIN_SAFE_INTEGER:-MAX_SAFE_INTEGER,parseFloat:parseFloat,parseInt:parseInt});$define(STATIC,MATH,{acosh:function(x){return x<1?NaN:log(x+sqrt(x*x-1))},asinh:asinh,atanh:function(x){return x==0?+x:log((1+ +x)/(1-x))/2},cbrt:function(x){return sign(x)*pow(abs(x),1/3)},clz32:function(x){return(x>>>=0)?32-x[TO_STRING](2).length:32},cosh:function(x){return(exp(x)+exp(-x))/2},expm1:function(x){return x==0?+x:x>-1e-6&&x<1e-6?+x+x*x/2:exp(x)-1},fround:function(x){return new Float32Array([x])[0]},hypot:function(value1,value2){var sum=0,length=arguments.length,value;while(length--){value=+arguments[length];if(value==Infinity||value==-Infinity)return Infinity;sum+=value*value}return sqrt(sum)},imul:function(x,y){var UInt16=65535,xl=UInt16&x,yl=UInt16&y;return 0|xl*yl+((UInt16&x>>>16)*yl+xl*(UInt16&y>>>16)<<16>>>0)},log1p:function(x){return x>-1e-8&&x<1e-8?x-x*x/2:log(1+ +x)},log10:function(x){return log(x)/Math.LN10},log2:function(x){return log(x)/Math.LN2},sign:sign,sinh:function(x){return x==0?+x:(exp(x)-exp(-x))/2},tanh:function(x){return isFinite(x)?x==0?+x:(exp(x)-exp(-x))/(exp(x)+exp(-x)):sign(x)},trunc:trunc});setToStringTag(Math,MATH,true);function assertNotRegExp(it){if(isObject(it)&&it instanceof RegExp)throw TypeError()}$define(STATIC,STRING,{fromCodePoint:function(){var res=[],len=arguments.length,i=0,code;while(len>i){code=+arguments[i++];if(toIndex(code,1114111)!==code)throw RangeError(code+" is not a valid code point");res.push(code<65536?fcc(code):fcc(((code-=65536)>>10)+55296,code%1024+56320))}return res.join("")},raw:function(callSite){var raw=ES5Object(assertDefined(callSite.raw)),len=toLength(raw.length),sln=arguments.length,res=[],i=0;while(len>i){res.push(String(raw[i++]));if(i<sln)res.push(String(arguments[i]))}return res.join("")}});$define(PROTO,STRING,{codePointAt:createPointAt(false),endsWith:function(searchString,endPosition){assertNotRegExp(searchString);var len=this.length,end=endPosition===undefined?len:min(toLength(endPosition),len);searchString+="";return String(this).slice(end-searchString.length,end)===searchString},includes:function(searchString,position){return!!~String(assertDefined(this)).indexOf(searchString,position)},repeat:function(count){var str=String(assertDefined(this)),res="",n=toInteger(count);if(0>n||n==Infinity)throw RangeError("Count can't be negative");for(;n>0;(n>>>=1)&&(str+=str))if(n&1)res+=str;return res},startsWith:function(searchString,position){assertNotRegExp(searchString);var index=toLength(min(position,this.length));searchString+="";return String(this).slice(index,index+searchString.length)===searchString}});defineStdIterators(String,STRING,function(iterated){set(this,ITER,{o:String(iterated),i:0})},function(){var iter=this[ITER],O=iter.o,index=iter.i,point;if(index>=O.length)return iterResult(1);point=at.call(O,index);iter.i+=point.length;return iterResult(0,point)});$define(STATIC,ARRAY,{from:function(arrayLike,mapfn,that){var O=Object(assertDefined(arrayLike)),result=new(generic(this,Array)),mapping=mapfn!==undefined,f=mapping?ctx(mapfn,that,2):undefined,index=0,length;if(isIterable(O))for(var iter=getIterator(O),step;!(step=iter.next()).done;index++){result[index]=mapping?f(step.value,index):step.value}else for(length=toLength(O.length);length>index;index++){result[index]=mapping?f(O[index],index):O[index]}result.length=index;return result},of:function(){var index=0,length=arguments.length,result=new(generic(this,Array))(length);while(length>index)result[index]=arguments[index++];result.length=length;return result}});$define(PROTO,ARRAY,{copyWithin:function(target,start,end){var O=Object(assertDefined(this)),len=toLength(O.length),to=toIndex(target,len),from=toIndex(start,len),fin=end===undefined?len:toIndex(end,len),count=min(fin-from,len-to),inc=1;if(from<to&&to<from+count){inc=-1;from=from+count-1;to=to+count-1}while(count-->0){if(from in O)O[to]=O[from];else delete O[to];to+=inc;from+=inc}return O},fill:function(value,start,end){var O=Object(assertDefined(this)),length=toLength(O.length),index=toIndex(start,length),endPos=end===undefined?length:toIndex(end,length);while(endPos>index)O[index++]=value;return O},find:createArrayMethod(5),findIndex:createArrayMethod(6)});defineStdIterators(Array,ARRAY,function(iterated,kind){set(this,ITER,{o:ES5Object(iterated),i:0,k:kind})},function(){var iter=this[ITER],O=iter.o,kind=iter.k,index=iter.i++;if(!O||index>=O.length)return iter.o=undefined,iterResult(1);if(kind==KEY)return iterResult(0,index);if(kind==VALUE)return iterResult(0,O[index]);return iterResult(0,[index,O[index]])},VALUE);Iterators[ARGUMENTS]=Iterators[ARRAY];setToStringTag(global.JSON,"JSON",true);if(framework){tmp[SYMBOL_TAG]=DOT;if(cof(tmp)!=DOT)hidden(ObjectProto,TO_STRING,function(){return"[object "+classof(this)+"]"});if(/./g.flags!="g")defineProperty(RegExp[PROTOTYPE],"flags",{configurable:true,get:createReplacer(/^.*\/(\w*)$/,"$1")})}}(isFinite,{});isFunction(setImmediate)&&isFunction(clearImmediate)||function(ONREADYSTATECHANGE){var postMessage=global.postMessage,addEventListener=global.addEventListener,MessageChannel=global.MessageChannel,counter=0,queue={},defer,channel,port;setImmediate=function(fn){var args=[],i=1;while(arguments.length>i)args.push(arguments[i++]);queue[++counter]=function(){invoke(isFunction(fn)?fn:Function(fn),args)};defer(counter);return counter};clearImmediate=function(id){delete queue[id]};function run(id){if(has(queue,id)){var fn=queue[id];delete queue[id];fn()}}function listner(event){run(event.data)}if(NODE){defer=function(id){nextTick(part.call(run,id))}}else if(addEventListener&&isFunction(postMessage)&&!global.importScripts){defer=function(id){postMessage(id,"*")};addEventListener("message",listner,false)}else if(isFunction(MessageChannel)){channel=new MessageChannel;port=channel.port2;channel.port1.onmessage=listner;defer=ctx(port.postMessage,port,1)}else if(document&&ONREADYSTATECHANGE in document[CREATE_ELEMENT]("script")){defer=function(id){html.appendChild(document[CREATE_ELEMENT]("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this);run(id)}}}else{defer=function(id){setTimeout(part.call(run,id),0)}}}("onreadystatechange");$define(GLOBAL+BIND,{setImmediate:setImmediate,clearImmediate:clearImmediate});!function(Promise,test){isFunction(Promise)&&isFunction(Promise.resolve)&&Promise.resolve(test=new Promise(Function()))==test||function(asap,DEF){function isThenable(o){var then;if(isObject(o))then=o.then;return isFunction(then)?then:false}function notify(def){var chain=def.chain;chain.length&&asap(function(){var msg=def.msg,ok=def.state==1,i=0;while(chain.length>i)!function(react){var cb=ok?react.ok:react.fail,ret,then;try{if(cb){ret=cb===true?msg:cb(msg);if(ret===react.P){react.rej(TypeError(PROMISE+"-chain cycle"))}else if(then=isThenable(ret)){then.call(ret,react.res,react.rej)}else react.res(ret)}else react.rej(msg)}catch(err){react.rej(err)}}(chain[i++]);chain.length=0})}function resolve(msg){var def=this,then,wrapper;if(def.done)return;def.done=true;def=def.def||def;try{if(then=isThenable(msg)){wrapper={def:def,done:false};then.call(msg,ctx(resolve,wrapper,1),ctx(reject,wrapper,1))}else{def.msg=msg;def.state=1;notify(def)}}catch(err){reject.call(wrapper||{def:def,done:false},err)}}function reject(msg){var def=this;if(def.done)return;def.done=true;def=def.def||def;def.msg=msg;def.state=2;notify(def)}Promise=function(executor){assertFunction(executor);assertInstance(this,Promise,PROMISE);var def={chain:[],state:0,done:false,msg:undefined};hidden(this,DEF,def);try{executor(ctx(resolve,def,1),ctx(reject,def,1))}catch(err){reject.call(def,err)}};assignHidden(Promise[PROTOTYPE],{then:function(onFulfilled,onRejected){var react={ok:isFunction(onFulfilled)?onFulfilled:true,fail:isFunction(onRejected)?onRejected:false},P=react.P=new this[CONSTRUCTOR](function(resolve,reject){react.res=assertFunction(resolve);react.rej=assertFunction(reject)}),def=this[DEF];def.chain.push(react);def.state&¬ify(def);return P},"catch":function(onRejected){return this.then(undefined,onRejected)}});assignHidden(Promise,{all:function(iterable){var Promise=this,values=[];return new Promise(function(resolve,reject){forOf(iterable,false,push,values);var remaining=values.length,results=Array(remaining);if(remaining)forEach.call(values,function(promise,index){Promise.resolve(promise).then(function(value){results[index]=value;--remaining||resolve(results)},reject)});else resolve(results)})},race:function(iterable){var Promise=this;return new Promise(function(resolve,reject){forOf(iterable,false,function(promise){Promise.resolve(promise).then(resolve,reject)})})},reject:function(r){return new this(function(resolve,reject){reject(r)})},resolve:function(x){return isObject(x)&&getPrototypeOf(x)===this[PROTOTYPE]?x:new this(function(resolve,reject){resolve(x)})}})}(nextTick||setImmediate,safeSymbol("def"));setToStringTag(Promise,PROMISE);$define(GLOBAL+FORCED*!isNative(Promise),{Promise:Promise})}(global[PROMISE]);!function(){var UID=safeSymbol("uid"),DATA=safeSymbol("data"),WEAK=safeSymbol("weak"),LAST=safeSymbol("last"),FIRST=safeSymbol("first"),SIZE=DESC?safeSymbol("size"):"size",uid=0;function getCollection(C,NAME,methods,commonMethods,isMap,isWeak){var ADDER=isMap?"set":"add",proto=C&&C[PROTOTYPE],O={};function initFromIterable(that,iterable){if(iterable!=undefined)forOf(iterable,isMap,that[ADDER],that);return that}function fixSVZ(key,chain){var method=proto[key];framework&&hidden(proto,key,function(a,b){var result=method.call(this,a===0?0:a,b);return chain?this:result})}if(!isNative(C)||!(isWeak||!BUGGY_ITERATORS&&has(proto,"entries"))){C=isWeak?function(iterable){assertInstance(this,C,NAME);set(this,UID,uid++);initFromIterable(this,iterable)}:function(iterable){var that=this;assertInstance(that,C,NAME);set(that,DATA,create(null));set(that,SIZE,0);set(that,LAST,undefined);set(that,FIRST,undefined);initFromIterable(that,iterable)};assignHidden(assignHidden(C[PROTOTYPE],methods),commonMethods);isWeak||defineProperty(C[PROTOTYPE],"size",{get:function(){return assertDefined(this[SIZE])}})}else{var Native=C,inst=new C,chain=inst[ADDER](isWeak?{}:-0,1),buggyZero;if(!NATIVE_ITERATORS||!C.length){C=function(iterable){assertInstance(this,C,NAME);return initFromIterable(new Native,iterable)};C[PROTOTYPE]=proto}isWeak||inst[FOR_EACH](function(val,key){buggyZero=1/key===-Infinity});if(buggyZero){fixSVZ("delete");fixSVZ("has");isMap&&fixSVZ("get")}if(buggyZero||chain!==inst)fixSVZ(ADDER,true)}setToStringTag(C,NAME);O[NAME]=C;$define(GLOBAL+WRAP+FORCED*!isNative(C),O);isWeak||defineStdIterators(C,NAME,function(iterated,kind){set(this,ITER,{o:iterated,k:kind})},function(){var iter=this[ITER],O=iter.o,kind=iter.k,entry=iter.l;while(entry&&entry.r)entry=entry.p;if(!O||!(iter.l=entry=entry?entry.n:O[FIRST]))return iter.o=undefined,iterResult(1);if(kind==KEY)return iterResult(0,entry.k);if(kind==VALUE)return iterResult(0,entry.v);return iterResult(0,[entry.k,entry.v])},isMap?KEY+VALUE:VALUE);return C}function fastKey(it,create){if(!isObject(it))return(typeof it=="string"?"S":"P")+it;if(!has(it,UID)){if(create)hidden(it,UID,++uid);else return""}return"O"+it[UID]}function def(that,key,value){var index=fastKey(key,true),data=that[DATA],last=that[LAST],entry;if(index in data)data[index].v=value;else{entry=data[index]={k:key,v:value,p:last};if(!that[FIRST])that[FIRST]=entry;if(last)last.n=entry;that[LAST]=entry;that[SIZE]++}return that}function del(that,index){var data=that[DATA],entry=data[index],next=entry.n,prev=entry.p;delete data[index];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]--}var collectionMethods={clear:function(){for(var index in this[DATA])del(this,index)},"delete":function(key){var index=fastKey(key),contains=index in this[DATA];if(contains)del(this,index);return contains},forEach:function(callbackfn,that){var f=ctx(callbackfn,that,3),entry;while(entry=entry?entry.n:this[FIRST]){f(entry.v,entry.k,this);while(entry&&entry.r)entry=entry.p}},has:function(key){return fastKey(key)in this[DATA]}};Map=getCollection(Map,MAP,{get:function(key){var entry=this[DATA][fastKey(key)];return entry&&entry.v},set:function(key,value){return def(this,key===0?0:key,value)}},collectionMethods,true);Set=getCollection(Set,SET,{add:function(value){return def(this,value=value===0?0:value,value)}},collectionMethods);function setWeak(that,key,value){has(assertObject(key),WEAK)||hidden(key,WEAK,{});key[WEAK][that[UID]]=value;return that}function hasWeak(key){return isObject(key)&&has(key,WEAK)&&has(key[WEAK],this[UID])}var weakMethods={"delete":function(key){return hasWeak.call(this,key)&&delete key[WEAK][this[UID]]},has:hasWeak};WeakMap=getCollection(WeakMap,WEAKMAP,{get:function(key){if(isObject(key)&&has(key,WEAK))return key[WEAK][this[UID]]},set:function(key,value){return setWeak(this,key,value)}},weakMethods,true,true);WeakSet=getCollection(WeakSet,WEAKSET,{add:function(value){return setWeak(this,value,true)}},weakMethods,false,true)}();!function(){$define(PROTO,ARRAY,{includes:createArrayContains(true)});$define(PROTO,STRING,{at:createPointAt(true)});function createObjectToArray(isEntries){return function(object){var O=ES5Object(object),keys=getKeys(object),length=keys.length,i=0,result=Array(length),key;if(isEntries)while(length>i)result[i]=[key=keys[i++],O[key]];else while(length>i)result[i]=O[keys[i++]];return result}}$define(STATIC,OBJECT,{values:createObjectToArray(false),entries:createObjectToArray(true)});$define(STATIC,REGEXP,{escape:createReplacer(/([\\\-[\]{}()*+?.,^$|])/g,"\\$1",true)})}();!function(REFERENCE){REFERENCE_GET=getWellKnownSymbol(REFERENCE+"Get",true);var REFERENCE_SET=getWellKnownSymbol(REFERENCE+SET,true),REFERENCE_DELETE=getWellKnownSymbol(REFERENCE+"Delete",true);$define(STATIC,SYMBOL,{referenceGet:REFERENCE_GET,referenceSet:REFERENCE_SET,referenceDelete:REFERENCE_DELETE});hidden(FunctionProto,REFERENCE_GET,returnThis);function setMapMethods(Constructor){if(Constructor){var MapProto=Constructor[PROTOTYPE];hidden(MapProto,REFERENCE_GET,MapProto.get);hidden(MapProto,REFERENCE_SET,MapProto.set);hidden(MapProto,REFERENCE_DELETE,MapProto["delete"])}}setMapMethods(Map);setMapMethods(WeakMap)}("reference");!function(){function setArrayStatics(keys,length){$define(STATIC,ARRAY,turn.call(array(keys),function(memo,key){if(key in ArrayProto)memo[key]=ctx(call,ArrayProto[key],length)},{}))}setArrayStatics("pop,reverse,shift,keys,values,entries",1);setArrayStatics("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3);setArrayStatics("join,slice,concat,push,splice,unshift,sort,lastIndexOf,"+"reduce,reduceRight,copyWithin,fill,turn")}()}(Function("return this"),true)},{}],3:[function(require,module,exports){!function(){var hasOwn=Object.prototype.hasOwnProperty;var undefined;var iteratorSymbol=typeof Symbol==="function"&&Symbol.iterator||"@@iterator";if(typeof regeneratorRuntime==="object"){return}var runtime=regeneratorRuntime=typeof exports==="undefined"?{}:exports;function wrap(innerFn,outerFn,self,tryList){return new Generator(innerFn,outerFn,self||null,tryList||[])}runtime.wrap=wrap;var GenStateSuspendedStart="suspendedStart";var GenStateSuspendedYield="suspendedYield";var GenStateExecuting="executing";var GenStateCompleted="completed";var ContinueSentinel={};function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype;GeneratorFunction.prototype=Gp.constructor=GeneratorFunctionPrototype;GeneratorFunctionPrototype.constructor=GeneratorFunction;GeneratorFunction.displayName="GeneratorFunction";runtime.isGeneratorFunction=function(genFun){var ctor=typeof genFun==="function"&&genFun.constructor;return ctor?ctor===GeneratorFunction||(ctor.displayName||ctor.name)==="GeneratorFunction":false};runtime.mark=function(genFun){genFun.__proto__=GeneratorFunctionPrototype;genFun.prototype=Object.create(Gp);return genFun};runtime.async=function(innerFn,outerFn,self,tryList){return new Promise(function(resolve,reject){var generator=wrap(innerFn,outerFn,self,tryList);var callNext=step.bind(generator.next);var callThrow=step.bind(generator["throw"]);function step(arg){try{var info=this(arg);var value=info.value}catch(error){return reject(error)}if(info.done){resolve(value)}else{Promise.resolve(value).then(callNext,callThrow)}}callNext()})};function Generator(innerFn,outerFn,self,tryList){var generator=outerFn?Object.create(outerFn.prototype):this;var context=new Context(tryList);var state=GenStateSuspendedStart;function invoke(method,arg){if(state===GenStateExecuting){throw new Error("Generator is already running")}if(state===GenStateCompleted){return doneResult()}while(true){var delegate=context.delegate;if(delegate){try{var info=delegate.iterator[method](arg);method="next";arg=undefined}catch(uncaught){context.delegate=null;method="throw";arg=uncaught;continue}if(info.done){context[delegate.resultName]=info.value;context.next=delegate.nextLoc}else{state=GenStateSuspendedYield;return info}context.delegate=null}if(method==="next"){if(state===GenStateSuspendedStart&&typeof arg!=="undefined"){throw new TypeError("attempt to send "+JSON.stringify(arg)+" to newborn generator")}if(state===GenStateSuspendedYield){context.sent=arg}else{delete context.sent}}else if(method==="throw"){if(state===GenStateSuspendedStart){state=GenStateCompleted;throw arg}if(context.dispatchException(arg)){method="next";arg=undefined}}else if(method==="return"){context.abrupt("return",arg)}state=GenStateExecuting;try{var value=innerFn.call(self,context);state=context.done?GenStateCompleted:GenStateSuspendedYield;var info={value:value,done:context.done};if(value===ContinueSentinel){if(context.delegate&&method==="next"){arg=undefined}}else{return info}}catch(thrown){state=GenStateCompleted;
if(method==="next"){context.dispatchException(thrown)}else{arg=thrown}}}}generator.next=invoke.bind(generator,"next");generator["throw"]=invoke.bind(generator,"throw");generator["return"]=invoke.bind(generator,"return");return generator}Gp[iteratorSymbol]=function(){return this};Gp.toString=function(){return"[object Generator]"};function pushTryEntry(triple){var entry={tryLoc:triple[0]};if(1 in triple){entry.catchLoc=triple[1]}if(2 in triple){entry.finallyLoc=triple[2]}this.tryEntries.push(entry)}function resetTryEntry(entry,i){var record=entry.completion||{};record.type=i===0?"normal":"return";delete record.arg;entry.completion=record}function Context(tryList){this.tryEntries=[{tryLoc:"root"}];tryList.forEach(pushTryEntry,this);this.reset()}runtime.keys=function(object){var keys=[];for(var key in object){keys.push(key)}keys.reverse();return function next(){while(keys.length){var key=keys.pop();if(key in object){next.value=key;next.done=false;return next}}next.done=true;return next}};function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod){return iteratorMethod.call(iterable)}if(typeof iterable.next==="function"){return iterable}if(!isNaN(iterable.length)){var i=-1;function next(){while(++i<iterable.length){if(hasOwn.call(iterable,i)){next.value=iterable[i];next.done=false;return next}}next.value=undefined;next.done=true;return next}return next.next=next}}return{next:doneResult}}runtime.values=values;function doneResult(){return{value:undefined,done:true}}Context.prototype={constructor:Context,reset:function(){this.prev=0;this.next=0;this.sent=undefined;this.done=false;this.delegate=null;this.tryEntries.forEach(resetTryEntry);for(var tempIndex=0,tempName;hasOwn.call(this,tempName="t"+tempIndex)||tempIndex<20;++tempIndex){this[tempName]=null}},stop:function(){this.done=true;var rootEntry=this.tryEntries[0];var rootRecord=rootEntry.completion;if(rootRecord.type==="throw"){throw rootRecord.arg}return this.rval},dispatchException:function(exception){if(this.done){throw exception}var context=this;function handle(loc,caught){record.type="throw";record.arg=exception;context.next=loc;return!!caught}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];var record=entry.completion;if(entry.tryLoc==="root"){return handle("end")}if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc");var hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true)}else if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc)}}else if(hasCatch){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true)}}else if(hasFinally){if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc)}}else{throw new Error("try statement without catch or finally")}}}},_findFinallyEntry:function(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&(entry.finallyLoc===finallyLoc||this.prev<entry.finallyLoc)){return entry}}},abrupt:function(type,arg){var entry=this._findFinallyEntry();var record=entry?entry.completion:{};record.type=type;record.arg=arg;if(entry){this.next=entry.finallyLoc}else{this.complete(record)}return ContinueSentinel},complete:function(record){if(record.type==="throw"){throw record.arg}if(record.type==="break"||record.type==="continue"){this.next=record.arg}else if(record.type==="return"){this.rval=record.arg;this.next="end"}return ContinueSentinel},finish:function(finallyLoc){var entry=this._findFinallyEntry(finallyLoc);return this.complete(entry.completion)},"catch":function(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if(record.type==="throw"){var thrown=record.arg;resetTryEntry(entry,i)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};return ContinueSentinel}}}()},{}]},{},[1]);
|
ajax/libs/angular.js/2.0.0-alpha.40/angular2.min.js
|
maruilian11/cdnjs
|
!function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[a]={exports:{}};t[a][0].call(l.exports,function(e){var r=t[a][1][e];return i(r?r:e)},l,l.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(e,t,r){(function(t){"use strict";var r=e("../core"),n=e("../microtask"),i=e("../patch/browser"),o=e("es6-promise");t.Zone&&console.warn("Zone already exported on window the object!"),t.Zone=n.addMicrotaskSupport(r.Zone),t.zone=new t.Zone,t.Promise=o.Promise,i.apply()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../core":2,"../microtask":4,"../patch/browser":5,"es6-promise":17}],2:[function(e,t,r){(function(r){"use strict";function n(e,t){var r=arguments.length?Object.create(e):this;return r.parent=e||null,Object.keys(t||{}).forEach(function(n){var i=n.substr(1);"$"===n[0]?r[i]=t[n](e[i]||function(){}):"+"===n[0]?r[i]=e[i]?function(){var r=e[i].apply(this,arguments);return t[n].apply(this,arguments),r}:t[n]:"-"===n[0]?r[i]=e[i]?function(){return t[n].apply(this,arguments),e[i].apply(this,arguments)}:t[n]:r[n]="object"==typeof t[n]?JSON.parse(JSON.stringify(t[n])):t[n]}),r.$id=n.nextId++,r}var i=e("./keys");n.prototype={constructor:n,fork:function(e){return this.onZoneCreated(),new n(this,e)},bind:function(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);t||this.enqueueTask(e);var r=this.isRootZone()?this:this.fork();return function(){return r.run(e,this,arguments)}},bindOnce:function(e){var t=this;return this.bind(function(){var r=e.apply(this,arguments);return t.dequeueTask(e),r})},isRootZone:function(){return null===this.parent},run:function(e,t,n){n=n||[];var i=r.zone;r.zone=this;try{return this.beforeTask(),e.apply(t,n)}catch(o){if(!this.onError)throw o;this.onError(o)}finally{this.afterTask(),r.zone=i}},onError:null,beforeTask:function(){},onZoneCreated:function(){},afterTask:function(){},enqueueTask:function(){},dequeueTask:function(){},addEventListener:function(){return this[i.common.addEventListener].apply(this,arguments)},removeEventListener:function(){return this[i.common.removeEventListener].apply(this,arguments)}},n.nextId=1,n.bindPromiseFn=e("./patch/promise").bindPromiseFn,t.exports={Zone:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./keys":3,"./patch/promise":12}],3:[function(e,t,r){function n(e){return Symbol(e)}function n(e){return"_zone$"+e}"undefined"!=typeof Symbol;var i={addEventListener:n("addEventListener"),removeEventListener:n("removeEventListener")};t.exports={create:n,common:i}},{}],4:[function(e,t,r){(function(r){"use strict";function n(e){o._asap(this.bind(e))}function i(e){return e.prototype.scheduleMicrotask=n,e}var o=e("es6-promise").Promise;o._setAsap(function(e,t){r.zone.scheduleMicrotask(function(){e(t)})}),t.exports={addMicrotaskSupport:i};var a="undefined"!=typeof Promise&&-1!==Promise.toString().indexOf("[native code]"),s=r.navigator&&r.navigator.userAgent.toLowerCase().indexOf("firefox")>-1;if(a&&!s){var c=Promise.resolve();o._setScheduler(function(e){c.then(e)})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"es6-promise":17}],5:[function(e,t,r){(function(r){"use strict";function n(){i.patchSetClearFunction(r,["timeout","interval","immediate"]),i.patchRequestAnimationFrame(r,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame"]),i.patchFunction(r,["alert","prompt"]),u.apply(),l.apply(),o.apply(),a.patchClass("MutationObserver"),a.patchClass("WebKitMutationObserver"),s.apply(),c.apply(),p.apply(),d.apply()}var i=e("./functions"),o=e("./promise"),a=e("./mutation-observer"),s=e("./define-property"),c=e("./register-element"),u=(e("./websocket"),e("./event-target")),l=e("./property-descriptor"),p=e("./geolocation"),d=e("./file-reader");t.exports={apply:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./define-property":6,"./event-target":7,"./file-reader":8,"./functions":9,"./geolocation":10,"./mutation-observer":11,"./promise":12,"./property-descriptor":13,"./register-element":14,"./websocket":15}],6:[function(e,t,r){"use strict";function n(){Object.defineProperty=function(e,t,r){if(o(e,t))throw new TypeError("Cannot assign to read only property '"+t+"' of "+e);return"prototype"!==t&&(r=a(e,t,r)),c(e,t,r)},Object.defineProperties=function(e,t){return Object.keys(t).forEach(function(r){Object.defineProperty(e,r,t[r])}),e},Object.create=function(e,t){return"object"==typeof t&&Object.keys(t).forEach(function(r){t[r]=a(e,r,t[r])}),l(e,t)},Object.getOwnPropertyDescriptor=function(e,t){var r=u(e,t);return o(e,t)&&(r.configurable=!1),r}}function i(e,t,r){return r=a(e,t,r),c(e,t,r)}function o(e,t){return e&&e[p]&&e[p][t]}function a(e,t,r){return r.configurable=!0,r.configurable||(e[p]||c(e,p,{writable:!0,value:{}}),e[p][t]=!0),r}var s=e("../keys"),c=Object.defineProperty,u=Object.getOwnPropertyDescriptor,l=Object.create,p=s.create("unconfigurables");t.exports={apply:n,_redefineProperty:i}},{"../keys":3}],7:[function(e,t,r){(function(r){"use strict";function n(){if(r.EventTarget)i.patchEventTargetMethods(r.EventTarget.prototype);else{var e=["ApplicationCache","EventSource","FileReader","InputMethodContext","MediaController","MessagePort","Node","Performance","SVGElementInstance","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebKitNamedFlow","Worker","WorkerGlobalScope","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];e.forEach(function(e){var t=r[e]&&r[e].prototype;t&&t.addEventListener&&i.patchEventTargetMethods(t)}),"undefined"!=typeof window&&i.patchEventTargetMethods(window)}}var i=e("../utils");t.exports={apply:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":16}],8:[function(e,t,r){"use strict";function n(){i.patchClass("FileReader")}var i=e("../utils");t.exports={apply:n}},{"../utils":16}],9:[function(e,t,r){(function(r){"use strict";function n(e,t){t.map(function(e){return e[0].toUpperCase()+e.substr(1)}).forEach(function(t){var n="set"+t,i=e[n];if(i){var o="clear"+t,a={},c="setInterval"===n?s.bindArguments:s.bindArgumentsOnce;r.zone[n]=function(t){var r,n=t;arguments[0]=function(){return delete a[r],n.apply(this,arguments)};var o=c(arguments);return r=i.apply(e,o),a[r]=!0,r},e[n]=function(){return r.zone[n].apply(this,arguments)};var u=e[o];r.zone[o]=function(e){return a[e]&&(delete a[e],r.zone.dequeueTask()),u.apply(this,arguments)},e[o]=function(){return r.zone[o].apply(this,arguments)}}})}function i(e,t){t.forEach(function(t){var n=e[t];n&&(r.zone[t]=function(t){var i=r.zone.isRootZone()?r.zone.fork():r.zone;return t&&(arguments[0]=function(){return i.run(t,this,arguments)}),n.apply(e,arguments)},e[t]=function(){return r.zone[t].apply(this,arguments)})})}function o(e,t){t.forEach(function(t){var n=e[t];n&&(r.zone[t]=function(t){arguments[0]=function(){return t.apply(this,arguments)};var r=s.bindArgumentsOnce(arguments);return n.apply(e,r)},e[t]=function(){return zone[t].apply(this,arguments)})})}function a(e,t){t.forEach(function(t){var n=e[t];r.zone[t]=function(){return n.apply(e,arguments)},e[t]=function(){return r.zone[t].apply(this,arguments)}})}var s=e("../utils");t.exports={patchSetClearFunction:n,patchSetFunction:o,patchRequestAnimationFrame:i,patchFunction:a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":16}],10:[function(e,t,r){(function(r){"use strict";function n(){r.navigator&&r.navigator.geolocation&&i.patchPrototype(r.navigator.geolocation,["getCurrentPosition","watchPosition"])}var i=e("../utils");t.exports={apply:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":16}],11:[function(e,t,r){(function(r){"use strict";function n(e){var t=r[e];if(t){r[e]=function(e){this[o]=new t(r.zone.bind(e,!0)),this[a]=r.zone};var n=new t(function(){});r[e].prototype.disconnect=function(){var e=this[o].disconnect.apply(this[o],arguments);return this[s]&&(this[a].dequeueTask(),this[s]=!1),e},r[e].prototype.observe=function(){return this[s]||(this[a].enqueueTask(),this[s]=!0),this[o].observe.apply(this[o],arguments)};var i;for(i in n)!function(t){void 0===typeof r[e].prototype&&("function"==typeof n[t]?r[e].prototype[t]=function(){return this[o][t].apply(this[o],arguments)}:Object.defineProperty(r[e].prototype,t,{set:function(e){this[o][t]="function"==typeof e?r.zone.bind(e):e},get:function(){return this[o][t]}}))}(i)}}var i=e("../keys"),o=i.create("originalInstance"),a=i.create("creationZone"),s=i.create("isActive");t.exports={patchClass:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../keys":3}],12:[function(e,t,r){(function(r){"use strict";function n(e,t){var n=r,i=e.every(function(e){return n=n[e]});i&&t.forEach(function(e){var t=n[e];t&&(n[e]=a(t))})}function i(e){var t=e.then;e.then=function(){var r=s.bindArguments(arguments),n=t.apply(e,r);return i(n)};var r=e["catch"];return e["catch"]=function(){var t=s.bindArguments(arguments),n=r.apply(e,t);return i(n)},e}function o(){if(r.Promise){s.patchPrototype(Promise.prototype,["then","catch"]);var e=[[[],["fetch"]],[["Response","prototype"],["arrayBuffer","blob","json","text"]]];e.forEach(function(e){n(e[0],e[1])})}}var a,s=e("../utils");a=r.Promise?function(e){return function(){var t=e.apply(this,arguments);return t instanceof Promise?t:new Promise(function(e,r){t.then(e,r)})}}:function(e){return function(){return i(e.apply(this,arguments))}},t.exports={apply:o,bindPromiseFn:a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":16}],13:[function(e,t,r){(function(r){"use strict";function n(){if(!s.isWebWorker()){var e="undefined"!=typeof WebSocket;if(i()){var t=u.map(function(e){return"on"+e});s.patchProperties(HTMLElement.prototype,t),s.patchProperties(XMLHttpRequest.prototype),e&&s.patchProperties(WebSocket.prototype)}else o(),s.patchClass("XMLHttpRequest"),e&&a.apply()}}function i(){if(!Object.getOwnPropertyDescriptor(HTMLElement.prototype,"onclick")&&"undefined"!=typeof Element){var e=Object.getOwnPropertyDescriptor(Element.prototype,"onclick");if(e&&!e.configurable)return!1}Object.defineProperty(HTMLElement.prototype,"onclick",{get:function(){return!0}});var t=document.createElement("div"),r=!!t.onclick;return Object.defineProperty(HTMLElement.prototype,"onclick",{}),r}function o(){u.forEach(function(e){var t="on"+e;document.addEventListener(e,function(e){for(var n,i=e.target;i;)i[t]&&!i[t][l]&&(n=r.zone.bind(i[t]),n[l]=i[t],i[t]=n),i=i.parentElement},!0)})}var a=e("./websocket"),s=e("../utils"),c=e("../keys"),u="copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror".split(" "),l=c.create("unbound");t.exports={apply:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../keys":3,"../utils":16,"./websocket":15}],14:[function(e,t,r){(function(r){"use strict";function n(){if(!o.isWebWorker()&&"registerElement"in r.document){var e=document.registerElement,t=["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"];document.registerElement=function(n,o){return o&&o.prototype&&t.forEach(function(e){if(o.prototype.hasOwnProperty(e)){var t=Object.getOwnPropertyDescriptor(o.prototype,e);t&&t.value?(t.value=r.zone.bind(t.value),i(o.prototype,e,t)):o.prototype[e]=r.zone.bind(o.prototype[e])}else o.prototype[e]&&(o.prototype[e]=r.zone.bind(o.prototype[e]))}),e.apply(document,[n,o])}}}var i=e("./define-property")._redefineProperty,o=e("../utils");t.exports={apply:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":16,"./define-property":6}],15:[function(e,t,r){(function(r){"use strict";function n(){var e=r.WebSocket;i.patchEventTargetMethods(e.prototype),r.WebSocket=function(t,r){var n,o=arguments.length>1?new e(t,r):new e(t),a=Object.getOwnPropertyDescriptor(o,"onmessage");return a&&a.configurable===!1?(n=Object.create(o),["addEventListener","removeEventListener","send","close"].forEach(function(e){n[e]=function(){return o[e].apply(o,arguments)}})):n=o,i.patchProperties(n,["onclose","onerror","onmessage","onopen"]),n}}var i=e("../utils");t.exports={apply:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":16}],16:[function(e,t,r){(function(r){"use strict";function n(e){for(var t=e.length-1;t>=0;t--)"function"==typeof e[t]&&(e[t]=r.zone.bind(e[t]));return e}function i(e){for(var t=e.length-1;t>=0;t--)"function"==typeof e[t]&&(e[t]=r.zone.bindOnce(e[t]));return e}function o(e,t){t.forEach(function(t){var r=e[t];r&&(e[t]=function(){return r.apply(this,n(arguments))})})}function a(){return"undefined"==typeof document}function s(e,t){var r=Object.getOwnPropertyDescriptor(e,t)||{enumerable:!0,configurable:!0};delete r.writable,delete r.value;var n=t.substr(2),i="_"+t;r.set=function(e){this[i]&&this.removeEventListener(n,this[i]),"function"==typeof e?(this[i]=e,this.addEventListener(n,e,!1)):this[i]=null},r.get=function(){return this[i]},Object.defineProperty(e,t,r)}function c(e,t){(t||function(){var t=[];for(var r in e)t.push(r);return t}().filter(function(e){return"on"===e.substr(0,2)})).forEach(function(t){s(e,t)})}function u(e){e[p.common.addEventListener]=e.addEventListener,e.addEventListener=function(e,t,n){var i,o=e+(n?"$capturing":"$bubbling");"[object FunctionWrapper]"!==t.toString()&&(i=t.handleEvent?function(e){return function(){e.handleEvent.apply(e,arguments)}}(t):t,t[d]=i,t[f]=t[f]||{},t[f][o]=t[f][o]||zone.bind(i),arguments[1]=t[f][o]);var a=this||r;return r.zone.addEventListener.apply(a,arguments)},e[p.common.removeEventListener]=e.removeEventListener,e.removeEventListener=function(e,t,n){var i=e+(n?"$capturing":"$bubbling");if(t[f]&&t[f][i]){var o=t[f];arguments[1]=o[i],delete o[i]}var a=this||r,s=r.zone.removeEventListener.apply(a,arguments);return r.zone.dequeueTask(t[d]),s}}function l(e){var t=r[e];if(t){r[e]=function(){var e=n(arguments);switch(e.length){case 0:this[h]=new t;break;case 1:this[h]=new t(e[0]);break;case 2:this[h]=new t(e[0],e[1]);break;case 3:this[h]=new t(e[0],e[1],e[2]);break;case 4:this[h]=new t(e[0],e[1],e[2],e[3]);break;default:throw new Error("what are you even doing?")}};var i,o=new t;for(i in o)!function(t){"function"==typeof o[t]?r[e].prototype[t]=function(){return this[h][t].apply(this[h],arguments)}:Object.defineProperty(r[e].prototype,t,{set:function(e){this[h][t]="function"==typeof e?r.zone.bind(e):e},get:function(){return this[h][t]}})}(i);for(i in t)"prototype"!==i&&t.hasOwnProperty(i)&&(r[e][i]=t[i])}}var p=e("./keys"),d=p.create("originalFn"),f=p.create("boundFns"),h=p.create("originalInstance");t.exports={bindArguments:n,bindArgumentsOnce:i,patchPrototype:o,patchProperty:s,patchProperties:c,patchEventTargetMethods:u,patchClass:l,isWebWorker:a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./keys":3}],17:[function(e,t,r){(function(r,n){(function(){"use strict";function i(e){return"function"==typeof e||"object"==typeof e&&null!==e}function o(e){return"function"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){z=e}function c(e){Q=e}function u(){return function(){r.nextTick(h)}}function l(){return function(){q(h)}}function p(){var e=0,t=new J(h),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}function d(){var e=new MessageChannel;return e.port1.onmessage=h,function(){e.port2.postMessage(0)}}function f(){return function(){setTimeout(h,1)}}function h(){for(var e=0;$>e;e+=2){var t=te[e],r=te[e+1];t(r),te[e]=void 0,te[e+1]=void 0}$=0}function g(){try{var t=e,r=t("vertx");return q=r.runOnLoop||r.runOnContext,l()}catch(n){return f()}}function m(){}function y(){return new TypeError("You cannot resolve a promise with itself")}function v(){return new TypeError("A promises callback cannot return that same promise.")}function _(e){try{return e.then}catch(t){return oe.error=t,oe}}function b(e,t,r,n){try{e.call(t,r,n)}catch(i){return i}}function w(e,t,r){Q(function(e){var n=!1,i=b(r,t,function(r){n||(n=!0,t!==r?R(e,r):x(e,r))},function(t){n||(n=!0,P(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&i&&(n=!0,P(e,i))},e)}function C(e,t){t._state===ne?x(e,t._result):t._state===ie?P(e,t._result):D(t,void 0,function(t){R(e,t)},function(t){P(e,t)})}function E(e,t){if(t.constructor===e.constructor)C(e,t);else{var r=_(t);r===oe?P(e,oe.error):void 0===r?x(e,t):o(r)?w(e,t,r):x(e,t)}}function R(e,t){e===t?P(e,y()):i(t)?E(e,t):x(e,t)}function S(e){e._onerror&&e._onerror(e._result),I(e)}function x(e,t){e._state===re&&(e._result=t,e._state=ne,0!==e._subscribers.length&&Q(I,e))}function P(e,t){e._state===re&&(e._state=ie,e._result=t,Q(S,e))}function D(e,t,r,n){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+ne]=r,i[o+ie]=n,0===o&&e._state&&Q(I,e)}function I(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n,i,o=e._result,a=0;a<t.length;a+=3)n=t[a],i=t[a+r],n?A(r,n,i,o):i(o);e._subscribers.length=0}}function O(){this.error=null}function k(e,t){try{return e(t)}catch(r){return ae.error=r,ae}}function A(e,t,r,n){var i,a,s,c,u=o(r);if(u){if(i=k(r,n),i===ae?(c=!0,a=i.error,i=null):s=!0,t===i)return void P(t,v())}else i=n,s=!0;t._state!==re||(u&&s?R(t,i):c?P(t,a):e===ne?x(t,i):e===ie&&P(t,i))}function T(e,t){try{t(function(t){R(e,t)},function(t){P(e,t)})}catch(r){P(e,r)}}function N(e,t){var r=this;r._instanceConstructor=e,r.promise=new e(m),r._validateInput(t)?(r._input=t,r.length=t.length,r._remaining=t.length,r._init(),0===r.length?x(r.promise,r._result):(r.length=r.length||0,r._enumerate(),0===r._remaining&&x(r.promise,r._result))):P(r.promise,r._validationError())}function j(e){return new se(this,e).promise}function M(e){function t(e){R(i,e)}function r(e){P(i,e)}var n=this,i=new n(m);if(!G(e))return P(i,new TypeError("You must pass an array to race.")),i;for(var o=e.length,a=0;i._state===re&&o>a;a++)D(n.resolve(e[a]),void 0,t,r);return i}function V(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(m);return R(r,e),r}function B(e){var t=this,r=new t(m);return P(r,e),r}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function F(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function W(e){this._id=de++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==e&&(o(e)||L(),this instanceof W||F(),T(this,e))}function U(){var e;if("undefined"!=typeof n)e=n;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;(!r||"[object Promise]"!==Object.prototype.toString.call(r.resolve())||r.cast)&&(e.Promise=fe)}var H;H=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var q,z,K,G=H,$=0,Q=({}.toString,function(e,t){te[$]=e,te[$+1]=t,$+=2,2===$&&(z?z(h):K())}),X="undefined"!=typeof window?window:void 0,Z=X||{},J=Z.MutationObserver||Z.WebKitMutationObserver,Y="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),ee="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,te=new Array(1e3);K=Y?u():J?p():ee?d():void 0===X&&"function"==typeof e?g():f();var re=void 0,ne=1,ie=2,oe=new O,ae=new O;N.prototype._validateInput=function(e){return G(e)},N.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},N.prototype._init=function(){this._result=new Array(this.length)};var se=N;N.prototype._enumerate=function(){for(var e=this,t=e.length,r=e.promise,n=e._input,i=0;r._state===re&&t>i;i++)e._eachEntry(n[i],i)},N.prototype._eachEntry=function(e,t){var r=this,n=r._instanceConstructor;a(e)?e.constructor===n&&e._state!==re?(e._onerror=null,r._settledAt(e._state,t,e._result)):r._willSettleAt(n.resolve(e),t):(r._remaining--,r._result[t]=e)},N.prototype._settledAt=function(e,t,r){var n=this,i=n.promise;i._state===re&&(n._remaining--,e===ie?P(i,r):n._result[t]=r),0===n._remaining&&x(i,n._result)},N.prototype._willSettleAt=function(e,t){var r=this;D(e,void 0,function(e){r._settledAt(ne,t,e)},function(e){r._settledAt(ie,t,e)})};var ce=j,ue=M,le=V,pe=B,de=0,fe=W;W.all=ce,W.race=ue,W.resolve=le,W.reject=pe,W._setScheduler=s,W._setAsap=c,W._asap=Q,W.prototype={constructor:W,then:function(e,t){var r=this,n=r._state;if(n===ne&&!e||n===ie&&!t)return this;var i=new this.constructor(m),o=r._result;if(n){var a=arguments[n-1];Q(function(){A(n,i,a,o)})}else D(r,i,e,t);return i},"catch":function(e){return this.then(null,e)}};var he=U,ge={Promise:fe,polyfill:he};"function"==typeof define&&define.amd?define(function(){return ge}):"undefined"!=typeof t&&t.exports?t.exports=ge:"undefined"!=typeof this&&(this.ES6Promise=ge),he()}).call(this)}).call(this,{},"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);var Reflect;!function(e){function t(e,t,r,n){if(C(n)){if(C(r)){if(!E(e))throw new TypeError;if(!S(t))throw new TypeError;return p(e,t)}if(!E(e))throw new TypeError;if(!R(t))throw new TypeError;return r=P(r),f(e,t,r)}if(!E(e))throw new TypeError;if(!R(t))throw new TypeError;if(C(r))throw new TypeError;if(!R(n))throw new TypeError;return r=P(r),d(e,t,r,n)}function r(e,t){function r(r,n){if(C(n)){if(!S(r))throw new TypeError;_(e,t,r,void 0)}else{if(!R(r))throw new TypeError;n=P(n),_(e,t,r,n)}}return r}function n(e,t,r,n){if(!R(r))throw new TypeError;return C(n)||(n=P(n)),_(e,t,r,n)}function i(e,t,r){if(!R(t))throw new TypeError;return C(r)||(r=P(r)),g(e,t,r)}function o(e,t,r){if(!R(t))throw new TypeError;return C(r)||(r=P(r)),m(e,t,r)}function a(e,t,r){if(!R(t))throw new TypeError;return C(r)||(r=P(r)),y(e,t,r)}function s(e,t,r){if(!R(t))throw new TypeError;return C(r)||(r=P(r)),v(e,t,r)}function c(e,t){if(!R(e))throw new TypeError;return C(t)||(t=P(t)),b(e,t)}function u(e,t){if(!R(e))throw new TypeError;return C(t)||(t=P(t)),w(e,t)}function l(e,t,r){if(!R(t))throw new TypeError;C(r)||(r=P(r));var n=h(t,r,!1);if(C(n))return!1;if(!n["delete"](e))return!1;if(n.size>0)return!0;var i=M.get(t);return i["delete"](r),i.size>0?!0:(M["delete"](t),!0)}function p(e,t){for(var r=e.length-1;r>=0;--r){var n=e[r],i=n(t);if(!C(i)){if(!S(i))throw new TypeError;t=i}}return t}function d(e,t,r,n){for(var i=e.length-1;i>=0;--i){var o=e[i],a=o(t,r,n);if(!C(a)){if(!R(a))throw new TypeError;n=a}}return n}function f(e,t,r){for(var n=e.length-1;n>=0;--n){var i=e[n];i(t,r)}}function h(e,t,r){var n=M.get(e);if(!n){if(!r)return void 0;n=new T,M.set(e,n)}var i=n.get(t);if(!i){if(!r)return void 0;i=new T,n.set(t,i)}return i}function g(e,t,r){var n=m(e,t,r);if(n)return!0;var i=D(t);return null!==i?g(e,i,r):!1}function m(e,t,r){var n=h(t,r,!1);return void 0===n?!1:Boolean(n.has(e))}function y(e,t,r){var n=m(e,t,r);if(n)return v(e,t,r);var i=D(t);return null!==i?y(e,i,r):void 0}function v(e,t,r){var n=h(t,r,!1);return void 0===n?void 0:n.get(e)}function _(e,t,r,n){var i=h(r,n,!0);i.set(e,t)}function b(e,t){var r=w(e,t),n=D(e);if(null===n)return r;var i=b(n,t);if(i.length<=0)return r;if(r.length<=0)return i;for(var o=new N,a=[],s=0;s<r.length;s++){var c=r[s],u=o.has(c);u||(o.add(c),a.push(c))}for(var l=0;l<i.length;l++){var c=i[l],u=o.has(c);u||(o.add(c),a.push(c))}return a}function w(e,t){var r=h(e,t,!1),n=[];return r&&r.forEach(function(e,t){return n.push(t)}),n}function C(e){return void 0===e}function E(e){return Array.isArray(e)}function R(e){return"object"==typeof e?null!==e:"function"==typeof e}function S(e){return"function"==typeof e}function x(e){return"symbol"==typeof e}function P(e){return x(e)?e:String(e)}function D(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===A)return t;if(t!==A)return t;var r=e.prototype,n=Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return t;var i=n.constructor;return"function"!=typeof i?t:i===e?t:i}function I(){function e(){this._keys=[],this._values=[],this._cache=t}var t={};return e.prototype={get size(){return this._keys.length},has:function(e){return e===this._cache?!0:this._find(e)>=0?(this._cache=e,!0):!1},get:function(e){var t=this._find(e);return t>=0?(this._cache=e,this._values[t]):void 0},set:function(e,t){return this["delete"](e),this._keys.push(e),this._values.push(t),this._cache=e,this},"delete":function(e){var r=this._find(e);return r>=0?(this._keys.splice(r,1),this._values.splice(r,1),this._cache=t,!0):!1},clear:function(){this._keys.length=0,this._values.length=0,this._cache=t},forEach:function(e,t){for(var r=this.size,n=0;r>n;++n){var i=this._keys[n],o=this._values[n];this._cache=i,e.call(this,o,i,this)}},_find:function(e){for(var t=this._keys,r=t.length,n=0;r>n;++n)if(t[n]===e)return n;return-1}},e}function O(){function e(){this._map=new T}return e.prototype={get size(){return this._map.length},has:function(e){return this._map.has(e)},add:function(e){return this._map.set(e,e),this},"delete":function(e){return this._map["delete"](e)},clear:function(){this._map.clear()},forEach:function(e,t){this._map.forEach(e,t)}},e}function k(){function e(){this._key=i()}function t(e,t){for(var r=0;t>r;++r)e[r]=255*Math.random()|0}function r(e){if(c){var r=c.randomBytes(e);return r}if("function"==typeof Uint8Array){var r=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(r):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(r):t(r,e),r}var r=new Array(e);return t(r,e),r}function n(){var e=r(a);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var t="",n=0;a>n;++n){var i=e[n];(4===n||6===n||8===n)&&(t+="-"),16>i&&(t+="0"),t+=i.toString(16).toLowerCase()}return t}function i(){var e;do e="@@WeakMap@@"+n();while(u.call(l,e));return l[e]=!0,e}function o(e,t){if(!u.call(e,p)){if(!t)return void 0;Object.defineProperty(e,p,{value:Object.create(null)})}return e[p]}var a=16,s="undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process),c=s&&require("crypto"),u=Object.prototype.hasOwnProperty,l={},p=i();return e.prototype={has:function(e){var t=o(e,!1);return t?this._key in t:!1},get:function(e){var t=o(e,!1);return t?t[this._key]:void 0},set:function(e,t){var r=o(e,!0);return r[this._key]=t,this},"delete":function(e){var t=o(e,!1);return t&&this._key in t?delete t[this._key]:!1},clear:function(){this._key=i()}},e}var A=Object.getPrototypeOf(Function),T="function"==typeof Map?Map:I(),N="function"==typeof Set?Set:O(),j="function"==typeof WeakMap?WeakMap:k(),M=new j;e.decorate=t,e.metadata=r,e.defineMetadata=n,e.hasMetadata=i,e.hasOwnMetadata=o,e.getMetadata=a,e.getOwnMetadata=s,e.getMetadataKeys=c,e.getOwnMetadataKeys=u,e.deleteMetadata=l,function(t){if("undefined"!=typeof t.Reflect){if(t.Reflect!==e)for(var r in e)t.Reflect[r]=e[r]}else t.Reflect=e}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:"undefined"!=typeof global?global:Function("return this;")())}(Reflect||(Reflect={})),System.register("angular2/src/core/facade/lang",[],!0,function(e,t,r){function n(e){return e.name}function i(){return T}function o(e){return e}function a(){return function(e){return e}}function s(e){return void 0!==e&&null!==e}function c(e){return void 0===e||null===e}function u(e){return"string"==typeof e}function l(e){return"function"==typeof e}function p(e){return l(e)}function d(e){return"object"==typeof e&&null!==e}function f(e){return e instanceof A.Promise}function h(e){return Array.isArray(e)}function g(e){return"number"==typeof e}function m(e){return e instanceof t.Date&&!isNaN(e.valueOf())}function y(e){if("string"==typeof e)return e;if(void 0===e||null===e)return""+e;if(e.name)return e.name;var t=e.toString(),r=t.indexOf("\n");return-1===r?t:t.substring(0,r)}function v(e){return e}function _(e,t){return e}function b(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}function w(e){return e}function C(e){return c(e)?null:e}function E(e){return c(e)?!1:e}function R(e){return null!==e&&("function"==typeof e||"object"==typeof e)}function S(e){console.log(e)}function x(e,t,r){for(var n=t.split("."),i=e;n.length>1;){var o=n.shift();i=i.hasOwnProperty(o)?i[o]:i[o]={}}(void 0===i||null===i)&&(i={}),i[n.shift()]=r}function P(){if(c(H))if(s(Symbol)&&s(Symbol.iterator))H=Symbol.iterator;else for(var e=Object.getOwnPropertyNames(Map.prototype),t=0;t<e.length;++t){var r=e[t];"entries"!==r&&"size"!==r&&Map.prototype[r]===Map.prototype.entries&&(H=r)}return H}var D=System.global,I=D.define;D.define=void 0;var O,k=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)};O="undefined"==typeof window?"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:D:window;var A=O;t.global=A,t.Type=Function,t.getTypeNameForDebugging=n,t.Math=A.Math,t.Date=A.Date;var T="undefined"!=typeof A.assert;t.assertionsEnabled=i,A.assert=function(e){T&&A.assert.call(e)},t.CONST_EXPR=o,t.CONST=a,t.isPresent=s,t.isBlank=c,t.isString=u,t.isFunction=l,t.isType=p,t.isStringMap=d,t.isPromise=f,t.isArray=h,t.isNumber=g,t.isDate=m,t.stringify=y,t.serializeEnum=v,t.deserializeEnum=_;var N=function(){function e(){}return e.fromCharCode=function(e){return String.fromCharCode(e)},e.charCodeAt=function(e,t){return e.charCodeAt(t)},e.split=function(e,t){return e.split(t)},e.equals=function(e,t){return e===t},e.replace=function(e,t,r){return e.replace(t,r)},e.replaceAll=function(e,t,r){return e.replace(t,r)},e.slice=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=null),e.slice(t,null===r?void 0:r)},e.toUpperCase=function(e){return e.toUpperCase()},e.toLowerCase=function(e){return e.toLowerCase()},e.startsWith=function(e,t){return e.startsWith(t)},e.substring=function(e,t,r){return void 0===r&&(r=null),e.substring(t,null===r?void 0:r)},e.replaceAllMapped=function(e,t,r){return e.replace(t,function(){for(var e=[],t=0;t<arguments.length;t++)e[t-0]=arguments[t];return e.splice(-2,2),r(e)})},e.contains=function(e,t){return-1!=e.indexOf(t)},e.compare=function(e,t){return t>e?-1:e>t?1:0},e}();t.StringWrapper=N;var j=function(){function e(e){void 0===e&&(e=[]),this.parts=e}return e.prototype.add=function(e){this.parts.push(e)},e.prototype.toString=function(){return this.parts.join("")},e}();t.StringJoiner=j;var M=function(e){function t(t){e.call(this,t),this.message=t}return k(t,e),t.prototype.toString=function(){return this.message},t}(Error);t.NumberParseError=M;var V=function(){function e(){}return e.toFixed=function(e,t){return e.toFixed(t);
},e.equal=function(e,t){return e===t},e.parseIntAutoRadix=function(e){var t=parseInt(e);if(isNaN(t))throw new M("Invalid integer literal when parsing "+e);return t},e.parseInt=function(e,t){if(10==t){if(/^(\-|\+)?[0-9]+$/.test(e))return parseInt(e,t)}else if(16==t){if(/^(\-|\+)?[0-9ABCDEFabcdef]+$/.test(e))return parseInt(e,t)}else{var r=parseInt(e,t);if(!isNaN(r))return r}throw new M("Invalid integer literal when parsing "+e+" in base "+t)},e.parseFloat=function(e){return parseFloat(e)},Object.defineProperty(e,"NaN",{get:function(){return 0/0},enumerable:!0,configurable:!0}),e.isNaN=function(e){return isNaN(e)},e.isInteger=function(e){return Number.isInteger(e)},e}();t.NumberWrapper=V,t.RegExp=A.RegExp;var B=function(){function e(){}return e.create=function(e,t){return void 0===t&&(t=""),t=t.replace(/g/g,""),new A.RegExp(e,t+"g")},e.firstMatch=function(e,t){return e.lastIndex=0,e.exec(t)},e.test=function(e,t){return e.lastIndex=0,e.test(t)},e.matcher=function(e,t){return e.lastIndex=0,{re:e,input:t}},e}();t.RegExpWrapper=B;var L=function(){function e(){}return e.next=function(e){return e.re.exec(e.input)},e}();t.RegExpMatcherWrapper=L;var F=function(){function e(){}return e.apply=function(e,t){return e.apply(null,t)},e}();t.FunctionWrapper=F,t.looseIdentical=b,t.getMapKey=w,t.normalizeBlank=C,t.normalizeBool=E,t.isJsObject=R,t.print=S;var W=function(){function e(){}return e.parse=function(e){return A.JSON.parse(e)},e.stringify=function(e){return A.JSON.stringify(e,null,2)},e}();t.Json=W;var U=function(){function e(){}return e.create=function(e,r,n,i,o,a,s){return void 0===r&&(r=1),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),new t.Date(e,r-1,n,i,o,a,s)},e.fromMillis=function(e){return new t.Date(e)},e.toMillis=function(e){return e.getTime()},e.now=function(){return new t.Date},e.toJson=function(e){return e.toJSON()},e}();t.DateWrapper=U,t.setValueOnPath=x;var H=null;return t.getSymbolIterator=P,D.define=I,r.exports}),System.register("angular2/src/core/di/metadata",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=function(){function e(e){this.token=e}return e.prototype.toString=function(){return"@Inject("+s.stringify(this.token)+")"},e=o([s.CONST(),a("design:paramtypes",[Object])],e)}();t.InjectMetadata=c;var u=function(){function e(){}return e.prototype.toString=function(){return"@Optional()"},e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.OptionalMetadata=u;var l=function(){function e(){}return Object.defineProperty(e.prototype,"token",{get:function(){return null},enumerable:!0,configurable:!0}),e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.DependencyMetadata=l;var p=function(){function e(){}return e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.InjectableMetadata=p;var d=function(){function e(){}return e.prototype.toString=function(){return"@Self()"},e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.SelfMetadata=d;var f=function(){function e(){}return e.prototype.toString=function(){return"@SkipSelf()"},e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.SkipSelfMetadata=f;var h=function(){function e(){}return e.prototype.toString=function(){return"@Host()"},e=o([s.CONST(),a("design:paramtypes",[])],e)}();return t.HostMetadata=h,n.define=i,r.exports}),System.register("angular2/src/core/util/decorators",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return p.isFunction(e)&&e.hasOwnProperty("annotation")&&(e=e.annotation),e}function i(e,t){if(e===Object||e===String||e===Function||e===Number||e===Array)throw new Error("Can not use native "+p.stringify(e)+" as constructor");if(p.isFunction(e))return e;if(e instanceof Array){var r=e,i=e[e.length-1];if(!p.isFunction(i))throw new Error("Last position of Class method array must be Function in key "+t+" was '"+p.stringify(i)+"'");var o=r.length-1;if(o!=i.length)throw new Error("Number of annotations ("+o+") does not match number of arguments ("+i.length+") in the function: "+p.stringify(i));for(var a=[],s=0,c=r.length-1;c>s;s++){var u=[];a.push(u);var l=r[s];if(l instanceof Array)for(var f=0;f<l.length;f++)u.push(n(l[f]));else u.push(p.isFunction(l)?n(l):l)}return d.defineMetadata("parameters",a,i),i}throw new Error("Only Function or Array is supported in Class definition for key '"+t+"' is '"+p.stringify(e)+"'")}function o(e){var t=i(e.hasOwnProperty("constructor")?e.constructor:void 0,"constructor"),r=t.prototype;if(e.hasOwnProperty("extends")){if(!p.isFunction(e["extends"]))throw new Error("Class definition 'extends' property must be a constructor function was: "+p.stringify(e["extends"]));t.prototype=r=Object.create(e["extends"].prototype)}for(var n in e)"extends"!=n&&"prototype"!=n&&e.hasOwnProperty(n)&&(r[n]=i(e[n],n));return this&&this.annotations instanceof Array&&d.defineMetadata("annotations",this.annotations,t),t}function a(e,t){function r(r){var n=new e(r);if(this instanceof e)return n;var i=p.isFunction(this)&&this.annotations instanceof Array?this.annotations:[];i.push(n);var a=function(e){var t=d.getOwnMetadata("annotations",e);return t=t||[],t.push(n),d.defineMetadata("annotations",t,e),e};return a.annotations=i,a.Class=o,t&&t(a),a}return void 0===t&&(t=null),r.prototype=Object.create(e.prototype),r}function s(e){function t(){function t(e,t,r){var n=d.getMetadata("parameters",e);for(n=n||[];n.length<=r;)n.push(null);n[r]=n[r]||[];var o=n[r];return o.push(i),d.defineMetadata("parameters",n,e),e}for(var r=[],n=0;n<arguments.length;n++)r[n-0]=arguments[n];var i=Object.create(e.prototype);return e.apply(i,r),this instanceof e?i:(t.annotation=i,t)}return t.prototype=Object.create(e.prototype),t}function c(e){function t(){for(var t=[],r=0;r<arguments.length;r++)t[r-0]=arguments[r];var n=Object.create(e.prototype);return e.apply(n,t),this instanceof e?n:function(e,t){var r=d.getOwnMetadata("propMetadata",e.constructor);r=r||{},r[t]=r[t]||[],r[t].unshift(n),d.defineMetadata("propMetadata",r,e.constructor)}}return t.prototype=Object.create(e.prototype),t}var u=System.global,l=u.define;u.define=void 0;var p=e("angular2/src/core/facade/lang");t.Class=o;var d=p.global.Reflect;if(!d||!d.getMetadata)throw"reflect-metadata shim is required when using class decorators";return t.makeDecorator=a,t.makeParamDecorator=s,t.makePropDecorator=c,u.define=l,r.exports}),System.register("angular2/src/core/di/forward_ref",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return e.__forward_ref__=n,e.toString=function(){return s.stringify(this())},e}function i(e){return s.isFunction(e)&&e.hasOwnProperty("__forward_ref__")&&e.__forward_ref__===n?e():e}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/facade/lang");return t.forwardRef=n,t.resolveForwardRef=i,o.define=a,r.exports}),System.register("angular2/src/core/facade/collection",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return s.isJsObject(e)?s.isArray(e)||!(e instanceof t.Map)&&s.getSymbolIterator()in e:!1}function i(e,t){if(s.isArray(e))for(var r=0;r<e.length;r++)t(e[r]);else for(var n,i=e[s.getSymbolIterator()]();!(n=i.next()).done;)t(n.value)}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/facade/lang");t.Map=s.global.Map,t.Set=s.global.Set;var c=function(){try{if(1===new t.Map([[1,2]]).size)return function(e){return new t.Map(e)}}catch(e){}return function(e){for(var r=new t.Map,n=0;n<e.length;n++){var i=e[n];r.set(i[0],i[1])}return r}}(),u=function(){try{if(new t.Map(new t.Map))return function(e){return new t.Map(e)}}catch(e){}return function(e){var r=new t.Map;return e.forEach(function(e,t){r.set(t,e)}),r}}(),l=function(){return(new t.Map).keys().next?function(e){for(var t,r=e.keys();!(t=r.next()).done;)e.set(t.value,null)}:function(e){e.forEach(function(t,r){e.set(r,null)})}}(),p=function(){try{if((new t.Map).values().next)return function(e,t){return Array.from(t?e.values():e.keys())}}catch(e){}return function(e,t){var r=h.createFixedSize(e.size),n=0;return e.forEach(function(e,i){r[n]=t?e:i,n++}),r}}(),d=function(){function e(){}return e.clone=function(e){return u(e)},e.createFromStringMap=function(e){var r=new t.Map;for(var n in e)r.set(n,e[n]);return r},e.toStringMap=function(e){var t={};return e.forEach(function(e,r){return t[r]=e}),t},e.createFromPairs=function(e){return c(e)},e.forEach=function(e,t){e.forEach(t)},e.get=function(e,t){return e.get(t)},e.size=function(e){return e.size},e["delete"]=function(e,t){e["delete"](t)},e.clearValues=function(e){l(e)},e.iterable=function(e){return e},e.keys=function(e){return p(e,!1)},e.values=function(e){return p(e,!0)},e}();t.MapWrapper=d;var f=function(){function e(){}return e.create=function(){return{}},e.contains=function(e,t){return e.hasOwnProperty(t)},e.get=function(e,t){return e.hasOwnProperty(t)?e[t]:void 0},e.set=function(e,t,r){e[t]=r},e.keys=function(e){return Object.keys(e)},e.isEmpty=function(e){for(var t in e)return!1;return!0},e["delete"]=function(e,t){delete e[t]},e.forEach=function(e,t){for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)},e.merge=function(e,t){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return r},e.equals=function(e,t){var r=Object.keys(e),n=Object.keys(t);if(r.length!=n.length)return!1;for(var i,o=0;o<r.length;o++)if(i=r[o],e[i]!==t[i])return!1;return!0},e}();t.StringMapWrapper=f;var h=function(){function e(){}return e.createFixedSize=function(e){return new Array(e)},e.createGrowableSize=function(e){return new Array(e)},e.clone=function(e){return e.slice(0)},e.forEachWithIndex=function(e,t){for(var r=0;r<e.length;r++)t(e[r],r)},e.first=function(e){return e?e[0]:null},e.last=function(e){return e&&0!=e.length?e[e.length-1]:null},e.find=function(e,t){for(var r=0;r<e.length;++r)if(t(e[r]))return e[r];return null},e.indexOf=function(e,t,r){return void 0===r&&(r=0),e.indexOf(t,r)},e.reduce=function(e,t,r){return e.reduce(t,r)},e.filter=function(e,t){return e.filter(t)},e.any=function(e,t){for(var r=0;r<e.length;++r)if(t(e[r]))return!0;return!1},e.contains=function(e,t){return-1!==e.indexOf(t)},e.reversed=function(t){var r=e.clone(t);return r.reverse()},e.concat=function(e,t){return e.concat(t)},e.insert=function(e,t,r){e.splice(t,0,r)},e.removeAt=function(e,t){var r=e[t];return e.splice(t,1),r},e.removeAll=function(e,t){for(var r=0;r<t.length;++r){var n=e.indexOf(t[r]);e.splice(n,1)}},e.remove=function(e,t){var r=e.indexOf(t);return r>-1?(e.splice(r,1),!0):!1},e.clear=function(e){e.length=0},e.isEmpty=function(e){return 0==e.length},e.fill=function(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=null),e.fill(t,r,null===n?e.length:n)},e.equals=function(e,t){if(e.length!=t.length)return!1;for(var r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0},e.slice=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=null),e.slice(t,null===r?void 0:r)},e.splice=function(e,t,r){return e.splice(t,r)},e.sort=function(e,t){s.isPresent(t)?e.sort(t):e.sort()},e.toString=function(e){return e.toString()},e.toJSON=function(e){return JSON.stringify(e)},e.maximum=function(e,t){if(0==e.length)return null;for(var r=null,n=-(1/0),i=0;i<e.length;i++){var o=e[i];if(!s.isBlank(o)){var a=t(o);a>n&&(r=o,n=a)}}return r},e}();t.ListWrapper=h,t.isListLikeIterable=n,t.iterateListLike=i;var g=function(){var e=new t.Set([1,2,3]);return 3===e.size?function(e){return new t.Set(e)}:function(e){var r=new t.Set(e);if(r.size!==e.length)for(var n=0;n<e.length;n++)r.add(e[n]);return r}}(),m=function(){function e(){}return e.createFromList=function(e){return g(e)},e.has=function(e,t){return e.has(t)},e["delete"]=function(e,t){e["delete"](t)},e}();return t.SetWrapper=m,o.define=a,r.exports}),System.register("angular2/src/core/facade/exception_handler",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/facade/collection"),c=function(){function e(){this.res=[]}return e.prototype.log=function(e){this.res.push(e)},e.prototype.logError=function(e){this.res.push(e)},e.prototype.logGroup=function(e){this.res.push(e)},e.prototype.logGroupEnd=function(){},e}(),u=function(){function e(e,t){void 0===t&&(t=!0),this._logger=e,this._rethrowException=t}return e.exceptionToString=function(t,r,n){void 0===r&&(r=null),void 0===n&&(n=null);var i=new c,o=new e(i,!1);return o.call(t,r,n),i.res.join("\n")},e.prototype.call=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=null);var n=this._findOriginalException(e),i=this._findOriginalStack(e),a=this._findContext(e);if(this._logger.logGroup("EXCEPTION: "+this._extractMessage(e)),o.isPresent(t)&&o.isBlank(i)&&(this._logger.logError("STACKTRACE:"),this._logger.logError(this._longStackTrace(t))),o.isPresent(r)&&this._logger.logError("REASON: "+r),o.isPresent(n)&&this._logger.logError("ORIGINAL EXCEPTION: "+this._extractMessage(n)),o.isPresent(i)&&(this._logger.logError("ORIGINAL STACKTRACE:"),this._logger.logError(this._longStackTrace(i))),o.isPresent(a)&&(this._logger.logError("ERROR CONTEXT:"),this._logger.logError(a)),this._logger.logGroupEnd(),this._rethrowException)throw e},e.prototype._extractMessage=function(e){return e instanceof a.WrappedException?e.wrapperMessage:e.toString()},e.prototype._longStackTrace=function(e){return s.isListLikeIterable(e)?e.join("\n\n-----async gap-----\n"):e.toString()},e.prototype._findContext=function(e){try{return e instanceof a.WrappedException?o.isPresent(e.context)?e.context:this._findContext(e.originalException):null}catch(t){return null}},e.prototype._findOriginalException=function(e){if(!(e instanceof a.WrappedException))return null;for(var t=e.originalException;t instanceof a.WrappedException&&o.isPresent(t.originalException);)t=t.originalException;return t},e.prototype._findOriginalStack=function(e){if(!(e instanceof a.WrappedException))return null;for(var t=e,r=e.originalStack;t instanceof a.WrappedException&&o.isPresent(t.originalException);)t=t.originalException,t instanceof a.WrappedException&&o.isPresent(t.originalException)&&(r=t.originalStack);return r},e}();return t.ExceptionHandler=u,n.define=i,r.exports}),System.register("angular2/src/core/reflection/reflector",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection"],!0,function(e,t,r){function n(e,t){c.StringMapWrapper.forEach(t,function(t,r){return e.set(r,t)})}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/exceptions"),c=e("angular2/src/core/facade/collection"),u=function(){function e(e,t,r,n,i){this.annotations=e,this.parameters=t,this.factory=r,this.interfaces=n,this.propMetadata=i}return e}();t.ReflectionInfo=u;var l=function(){function e(e){this._injectableInfo=new c.Map,this._getters=new c.Map,this._setters=new c.Map,this._methods=new c.Map,this._usedKeys=null,this.reflectionCapabilities=e}return e.prototype.isReflectionEnabled=function(){return this.reflectionCapabilities.isReflectionEnabled()},e.prototype.trackUsage=function(){this._usedKeys=new c.Set},e.prototype.listUnusedKeys=function(){var e=this;if(null==this._usedKeys)throw new s.BaseException("Usage tracking is disabled");var t=c.MapWrapper.keys(this._injectableInfo);return c.ListWrapper.filter(t,function(t){return!c.SetWrapper.has(e._usedKeys,t)})},e.prototype.registerFunction=function(e,t){this._injectableInfo.set(e,t)},e.prototype.registerType=function(e,t){this._injectableInfo.set(e,t)},e.prototype.registerGetters=function(e){n(this._getters,e)},e.prototype.registerSetters=function(e){n(this._setters,e)},e.prototype.registerMethods=function(e){n(this._methods,e)},e.prototype.factory=function(e){if(this._containsReflectionInfo(e)){var t=this._getReflectionInfo(e).factory;return a.isPresent(t)?t:null}return this.reflectionCapabilities.factory(e)},e.prototype.parameters=function(e){if(this._injectableInfo.has(e)){var t=this._getReflectionInfo(e).parameters;return a.isPresent(t)?t:[]}return this.reflectionCapabilities.parameters(e)},e.prototype.annotations=function(e){if(this._injectableInfo.has(e)){var t=this._getReflectionInfo(e).annotations;return a.isPresent(t)?t:[]}return this.reflectionCapabilities.annotations(e)},e.prototype.propMetadata=function(e){if(this._injectableInfo.has(e)){var t=this._getReflectionInfo(e).propMetadata;return a.isPresent(t)?t:{}}return this.reflectionCapabilities.propMetadata(e)},e.prototype.interfaces=function(e){if(this._injectableInfo.has(e)){var t=this._getReflectionInfo(e).interfaces;return a.isPresent(t)?t:[]}return this.reflectionCapabilities.interfaces(e)},e.prototype.getter=function(e){return this._getters.has(e)?this._getters.get(e):this.reflectionCapabilities.getter(e)},e.prototype.setter=function(e){return this._setters.has(e)?this._setters.get(e):this.reflectionCapabilities.setter(e)},e.prototype.method=function(e){return this._methods.has(e)?this._methods.get(e):this.reflectionCapabilities.method(e)},e.prototype._getReflectionInfo=function(e){return a.isPresent(this._usedKeys)&&this._usedKeys.add(e),this._injectableInfo.get(e)},e.prototype._containsReflectionInfo=function(e){return this._injectableInfo.has(e)},e.prototype.importUri=function(e){return this.reflectionCapabilities.importUri(e)},e}();return t.Reflector=l,i.define=o,r.exports}),System.register("angular2/src/core/reflection/reflection_capabilities",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/facade/collection"),c=function(){function e(e){this._reflect=o.isPresent(e)?e:o.global.Reflect}return e.prototype.isReflectionEnabled=function(){return!0},e.prototype.factory=function(e){switch(e.length){case 0:return function(){return new e};case 1:return function(t){return new e(t)};case 2:return function(t,r){return new e(t,r)};case 3:return function(t,r,n){return new e(t,r,n)};case 4:return function(t,r,n,i){return new e(t,r,n,i)};case 5:return function(t,r,n,i,o){return new e(t,r,n,i,o)};case 6:return function(t,r,n,i,o,a){return new e(t,r,n,i,o,a)};case 7:return function(t,r,n,i,o,a,s){return new e(t,r,n,i,o,a,s)};case 8:return function(t,r,n,i,o,a,s,c){return new e(t,r,n,i,o,a,s,c)};case 9:return function(t,r,n,i,o,a,s,c,u){return new e(t,r,n,i,o,a,s,c,u)};case 10:return function(t,r,n,i,o,a,s,c,u,l){return new e(t,r,n,i,o,a,s,c,u,l)};case 11:return function(t,r,n,i,o,a,s,c,u,l,p){return new e(t,r,n,i,o,a,s,c,u,l,p)};case 12:return function(t,r,n,i,o,a,s,c,u,l,p,d){return new e(t,r,n,i,o,a,s,c,u,l,p,d)};case 13:return function(t,r,n,i,o,a,s,c,u,l,p,d,f){return new e(t,r,n,i,o,a,s,c,u,l,p,d,f)};case 14:return function(t,r,n,i,o,a,s,c,u,l,p,d,f,h){return new e(t,r,n,i,o,a,s,c,u,l,p,d,f,h)};case 15:return function(t,r,n,i,o,a,s,c,u,l,p,d,f,h,g){return new e(t,r,n,i,o,a,s,c,u,l,p,d,f,h,g)};case 16:return function(t,r,n,i,o,a,s,c,u,l,p,d,f,h,g,m){return new e(t,r,n,i,o,a,s,c,u,l,p,d,f,h,g,m)};case 17:return function(t,r,n,i,o,a,s,c,u,l,p,d,f,h,g,m,y){return new e(t,r,n,i,o,a,s,c,u,l,p,d,f,h,g,m,y)};case 18:return function(t,r,n,i,o,a,s,c,u,l,p,d,f,h,g,m,y,v){return new e(t,r,n,i,o,a,s,c,u,l,p,d,f,h,g,m,y,v)};case 19:return function(t,r,n,i,o,a,s,c,u,l,p,d,f,h,g,m,y,v,_){return new e(t,r,n,i,o,a,s,c,u,l,p,d,f,h,g,m,y,v,_)};case 20:return function(t,r,n,i,o,a,s,c,u,l,p,d,f,h,g,m,y,v,_,b){return new e(t,r,n,i,o,a,s,c,u,l,p,d,f,h,g,m,y,v,_,b)}}throw new Error("Cannot create a factory for '"+o.stringify(e)+"' because its constructor has more than 20 arguments")},e.prototype._zipTypesAndAnnotaions=function(e,t){var r;r=s.ListWrapper.createFixedSize("undefined"==typeof e?t.length:e.length);for(var n=0;n<r.length;n++)r[n]="undefined"==typeof e?[]:e[n]!=Object?[e[n]]:[],o.isPresent(t)&&o.isPresent(t[n])&&(r[n]=r[n].concat(t[n]));return r},e.prototype.parameters=function(e){if(o.isPresent(e.parameters))return e.parameters;if(o.isPresent(this._reflect)&&o.isPresent(this._reflect.getMetadata)){var t=this._reflect.getMetadata("parameters",e),r=this._reflect.getMetadata("design:paramtypes",e);if(o.isPresent(r)||o.isPresent(t))return this._zipTypesAndAnnotaions(r,t)}return s.ListWrapper.createFixedSize(e.length)},e.prototype.annotations=function(e){if(o.isPresent(e.annotations)){var t=e.annotations;return o.isFunction(t)&&t.annotations&&(t=t.annotations),t}if(o.isPresent(this._reflect)&&o.isPresent(this._reflect.getMetadata)){var t=this._reflect.getMetadata("annotations",e);if(o.isPresent(t))return t}return[]},e.prototype.propMetadata=function(e){if(o.isPresent(e.propMetadata)){var t=e.propMetadata;return o.isFunction(t)&&t.propMetadata&&(t=t.propMetadata),t}if(o.isPresent(this._reflect)&&o.isPresent(this._reflect.getMetadata)){var t=this._reflect.getMetadata("propMetadata",e);if(o.isPresent(t))return t}return{}},e.prototype.interfaces=function(e){throw new a.BaseException("JavaScript does not support interfaces")},e.prototype.getter=function(e){return new Function("o","return o."+e+";")},e.prototype.setter=function(e){return new Function("o","v","return o."+e+" = v;")},e.prototype.method=function(e){var t="if (!o."+e+") throw new Error('\""+e+"\" is undefined');\n return o."+e+".apply(o, args);";return new Function("o","args",t)},e.prototype.importUri=function(e){return"./"},e}();return t.ReflectionCapabilities=c,n.define=i,r.exports}),System.register("angular2/src/core/di/type_literal",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){}return Object.defineProperty(e.prototype,"type",{get:function(){throw new Error("Type literals are only supported in Dart")},enumerable:!0,configurable:!0}),e}();return t.TypeLiteral=o,n.define=i,r.exports}),System.register("angular2/src/core/di/exceptions",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions"],!0,function(e,t,r){function n(e){for(var t=[],r=0;r<e.length;++r){if(c.ListWrapper.contains(t,e[r]))return t.push(e[r]),t;t.push(e[r])}return t}function i(e){if(e.length>1){var t=n(c.ListWrapper.reversed(e)),r=t.map(function(e){return u.stringify(e.token)});return" ("+r.join(" -> ")+")"}return""}var o=System.global,a=o.define;o.define=void 0;var s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},c=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),p=function(e){function t(t,r,n){e.call(this,"DI Exception"),this.keys=[r],this.injectors=[t],this.constructResolvingMessage=n,this.message=this.constructResolvingMessage(this.keys)}return s(t,e),t.prototype.addKey=function(e,t){this.injectors.push(e),this.keys.push(t),this.message=this.constructResolvingMessage(this.keys)},Object.defineProperty(t.prototype,"context",{get:function(){return this.injectors[this.injectors.length-1].debugContext()},enumerable:!0,configurable:!0}),t}(l.BaseException);t.AbstractBindingError=p;var d=function(e){function t(t,r){e.call(this,t,r,function(e){var t=u.stringify(c.ListWrapper.first(e).token);return"No provider for "+t+"!"+i(e)})}return s(t,e),t}(p);t.NoBindingError=d;var f=function(e){function t(t,r){e.call(this,t,r,function(e){return"Cannot instantiate cyclic dependency!"+i(e)})}return s(t,e),t}(p);t.CyclicDependencyError=f;var h=function(e){function t(t,r,n,i){e.call(this,"DI Exception",r,n,null),this.keys=[i],this.injectors=[t]}return s(t,e),t.prototype.addKey=function(e,t){this.injectors.push(e),this.keys.push(t)},Object.defineProperty(t.prototype,"wrapperMessage",{get:function(){var e=u.stringify(c.ListWrapper.first(this.keys).token);return"Error during instantiation of "+e+"!"+i(this.keys)+"."},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"causeKey",{get:function(){return this.keys[0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"context",{get:function(){return this.injectors[this.injectors.length-1].debugContext()},enumerable:!0,configurable:!0}),t}(l.WrappedException);t.InstantiationError=h;var g=function(e){function t(t){e.call(this,"Invalid binding - only instances of Binding and Type are allowed, got: "+t.toString())}return s(t,e),t}(l.BaseException);t.InvalidBindingError=g;var m=function(e){function t(r,n){e.call(this,t._genMessage(r,n))}return s(t,e),t._genMessage=function(e,t){for(var r=[],n=0,i=t.length;i>n;n++){var o=t[n];r.push(u.isBlank(o)||0==o.length?"?":o.map(u.stringify).join(" "))}return"Cannot resolve all parameters for "+u.stringify(e)+"("+r.join(", ")+"). Make sure they all have valid type or annotations."},t}(l.BaseException);t.NoAnnotationError=m;var y=function(e){function t(t){e.call(this,"Index "+t+" is out-of-bounds.")}return s(t,e),t}(l.BaseException);t.OutOfBoundsError=y;var v=function(e){function t(t,r){e.call(this,"Cannot mix multi bindings and regular bindings, got: "+t.toString()+" "+r.toString())}return s(t,e),t}(l.BaseException);return t.MixingMultiBindingsWithRegularBindings=v,o.define=a,r.exports}),System.register("angular2/src/core/di/opaque_token",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=function(){function e(e){this._desc=e}return e.prototype.toString=function(){return"Token "+this._desc},e=o([s.CONST(),a("design:paramtypes",[String])],e)}();return t.OpaqueToken=c,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/differs/iterable_differs",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/di"),p=function(){function e(e){this.factories=e}return e.create=function(t,r){if(s.isPresent(r)){var n=u.ListWrapper.clone(r.factories);return t=t.concat(n),new e(t)}return new e(t)},e.extend=function(t){return new l.Binding(e,{toFactory:function(r){if(s.isBlank(r))throw new c.BaseException("Cannot extend IterableDiffers without a parent injector");return e.create(t,r)},deps:[[e,new l.SkipSelfMetadata,new l.OptionalMetadata]]})},e.prototype.find=function(e){var t=u.ListWrapper.find(this.factories,function(t){return t.supports(e)});if(s.isPresent(t))return t;throw new c.BaseException("Cannot find a differ supporting object '"+e+"'")},e=o([l.Injectable(),s.CONST(),a("design:paramtypes",[Array])],e)}();return t.IterableDiffers=p,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/differs/default_iterable_differ",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/facade/lang"),p=function(){function e(){}return e.prototype.supports=function(e){return u.isListLikeIterable(e)},e.prototype.create=function(e){return new d},e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.DefaultIterableDifferFactory=p;var d=function(){function e(){this._collection=null,this._length=null,this._linkedRecords=null,this._unlinkedRecords=null,this._previousItHead=null,this._itHead=null,this._itTail=null,this._additionsHead=null,this._additionsTail=null,this._movesHead=null,this._movesTail=null,this._removalsHead=null,this._removalsTail=null}return Object.defineProperty(e.prototype,"collection",{get:function(){return this._collection},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._length},enumerable:!0,configurable:!0}),e.prototype.forEachItem=function(e){var t;for(t=this._itHead;null!==t;t=t._next)e(t)},e.prototype.forEachPreviousItem=function(e){var t;for(t=this._previousItHead;null!==t;t=t._nextPrevious)e(t)},e.prototype.forEachAddedItem=function(e){var t;for(t=this._additionsHead;null!==t;t=t._nextAdded)e(t)},e.prototype.forEachMovedItem=function(e){var t;for(t=this._movesHead;null!==t;t=t._nextMoved)e(t)},e.prototype.forEachRemovedItem=function(e){var t;for(t=this._removalsHead;null!==t;t=t._nextRemoved)e(t)},e.prototype.diff=function(e){if(l.isBlank(e)&&(e=[]),!u.isListLikeIterable(e))throw new c.BaseException("Error trying to diff '"+e+"'");return this.check(e)?this:null},e.prototype.onDestroy=function(){},e.prototype.check=function(e){var t=this;this._reset();var r,n,i=this._itHead,o=!1;if(l.isArray(e)){var a=e;for(this._length=e.length,r=0;r<this._length;r++)n=a[r],null!==i&&l.looseIdentical(i.item,n)?o&&(i=this._verifyReinsertion(i,n,r)):(i=this._mismatch(i,n,r),o=!0),i=i._next}else r=0,u.iterateListLike(e,function(e){null!==i&&l.looseIdentical(i.item,e)?o&&(i=t._verifyReinsertion(i,e,r)):(i=t._mismatch(i,e,r),o=!0),i=i._next,r++}),this._length=r;return this._truncate(i),this._collection=e,this.isDirty},Object.defineProperty(e.prototype,"isDirty",{get:function(){return null!==this._additionsHead||null!==this._movesHead||null!==this._removalsHead},enumerable:!0,configurable:!0}),e.prototype._reset=function(){if(this.isDirty){var e,t;for(e=this._previousItHead=this._itHead;null!==e;e=e._next)e._nextPrevious=e._next;for(e=this._additionsHead;null!==e;e=e._nextAdded)e.previousIndex=e.currentIndex;for(this._additionsHead=this._additionsTail=null,e=this._movesHead;null!==e;e=t)e.previousIndex=e.currentIndex,t=e._nextMoved;
this._movesHead=this._movesTail=null,this._removalsHead=this._removalsTail=null}},e.prototype._mismatch=function(e,t,r){var n;return null===e?n=this._itTail:(n=e._prev,this._remove(e)),e=null===this._linkedRecords?null:this._linkedRecords.get(t,r),null!==e?this._moveAfter(e,n,r):(e=null===this._unlinkedRecords?null:this._unlinkedRecords.get(t),null!==e?this._reinsertAfter(e,n,r):e=this._addAfter(new f(t),n,r)),e},e.prototype._verifyReinsertion=function(e,t,r){var n=null===this._unlinkedRecords?null:this._unlinkedRecords.get(t);return null!==n?e=this._reinsertAfter(n,e._prev,r):e.currentIndex!=r&&(e.currentIndex=r,this._addToMoves(e,r)),e},e.prototype._truncate=function(e){for(;null!==e;){var t=e._next;this._addToRemovals(this._unlink(e)),e=t}null!==this._unlinkedRecords&&this._unlinkedRecords.clear(),null!==this._additionsTail&&(this._additionsTail._nextAdded=null),null!==this._movesTail&&(this._movesTail._nextMoved=null),null!==this._itTail&&(this._itTail._next=null),null!==this._removalsTail&&(this._removalsTail._nextRemoved=null)},e.prototype._reinsertAfter=function(e,t,r){null!==this._unlinkedRecords&&this._unlinkedRecords.remove(e);var n=e._prevRemoved,i=e._nextRemoved;return null===n?this._removalsHead=i:n._nextRemoved=i,null===i?this._removalsTail=n:i._prevRemoved=n,this._insertAfter(e,t,r),this._addToMoves(e,r),e},e.prototype._moveAfter=function(e,t,r){return this._unlink(e),this._insertAfter(e,t,r),this._addToMoves(e,r),e},e.prototype._addAfter=function(e,t,r){return this._insertAfter(e,t,r),this._additionsTail=null===this._additionsTail?this._additionsHead=e:this._additionsTail._nextAdded=e,e},e.prototype._insertAfter=function(e,t,r){var n=null===t?this._itHead:t._next;return e._next=n,e._prev=t,null===n?this._itTail=e:n._prev=e,null===t?this._itHead=e:t._next=e,null===this._linkedRecords&&(this._linkedRecords=new g),this._linkedRecords.put(e),e.currentIndex=r,e},e.prototype._remove=function(e){return this._addToRemovals(this._unlink(e))},e.prototype._unlink=function(e){null!==this._linkedRecords&&this._linkedRecords.remove(e);var t=e._prev,r=e._next;return null===t?this._itHead=r:t._next=r,null===r?this._itTail=t:r._prev=t,e},e.prototype._addToMoves=function(e,t){return e.previousIndex===t?e:(this._movesTail=null===this._movesTail?this._movesHead=e:this._movesTail._nextMoved=e,e)},e.prototype._addToRemovals=function(e){return null===this._unlinkedRecords&&(this._unlinkedRecords=new g),this._unlinkedRecords.put(e),e.currentIndex=null,e._nextRemoved=null,null===this._removalsTail?(this._removalsTail=this._removalsHead=e,e._prevRemoved=null):(e._prevRemoved=this._removalsTail,this._removalsTail=this._removalsTail._nextRemoved=e),e},e.prototype.toString=function(){var e,t=[];for(e=this._itHead;null!==e;e=e._next)t.push(e);var r=[];for(e=this._previousItHead;null!==e;e=e._nextPrevious)r.push(e);var n=[];for(e=this._additionsHead;null!==e;e=e._nextAdded)n.push(e);var i=[];for(e=this._movesHead;null!==e;e=e._nextMoved)i.push(e);var o=[];for(e=this._removalsHead;null!==e;e=e._nextRemoved)o.push(e);return"collection: "+t.join(", ")+"\nprevious: "+r.join(", ")+"\nadditions: "+n.join(", ")+"\nmoves: "+i.join(", ")+"\nremovals: "+o.join(", ")+"\n"},e}();t.DefaultIterableDiffer=d;var f=function(){function e(e){this.item=e,this.currentIndex=null,this.previousIndex=null,this._nextPrevious=null,this._prev=null,this._next=null,this._prevDup=null,this._nextDup=null,this._prevRemoved=null,this._nextRemoved=null,this._nextAdded=null,this._nextMoved=null}return e.prototype.toString=function(){return this.previousIndex===this.currentIndex?l.stringify(this.item):l.stringify(this.item)+"["+l.stringify(this.previousIndex)+"->"+l.stringify(this.currentIndex)+"]"},e}();t.CollectionChangeRecord=f;var h=function(){function e(){this._head=null,this._tail=null}return e.prototype.add=function(e){null===this._head?(this._head=this._tail=e,e._nextDup=null,e._prevDup=null):(this._tail._nextDup=e,e._prevDup=this._tail,e._nextDup=null,this._tail=e)},e.prototype.get=function(e,t){var r;for(r=this._head;null!==r;r=r._nextDup)if((null===t||t<r.currentIndex)&&l.looseIdentical(r.item,e))return r;return null},e.prototype.remove=function(e){var t=e._prevDup,r=e._nextDup;return null===t?this._head=r:t._nextDup=r,null===r?this._tail=t:r._prevDup=t,null===this._head},e}(),g=function(){function e(){this.map=new Map}return e.prototype.put=function(e){var t=l.getMapKey(e.item),r=this.map.get(t);l.isPresent(r)||(r=new h,this.map.set(t,r)),r.add(e)},e.prototype.get=function(e,t){void 0===t&&(t=null);var r=l.getMapKey(e),n=this.map.get(r);return l.isBlank(n)?null:n.get(e,t)},e.prototype.remove=function(e){var t=l.getMapKey(e.item),r=this.map.get(t);return r.remove(e)&&u.MapWrapper["delete"](this.map,t),e},Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===u.MapWrapper.size(this.map)},enumerable:!0,configurable:!0}),e.prototype.clear=function(){this.map.clear()},e.prototype.toString=function(){return"_DuplicateMap("+l.stringify(this.map)+")"},e}();return n.define=i,r.exports}),System.register("angular2/src/core/change_detection/differs/keyvalue_differs",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/di"),p=function(){function e(e){this.factories=e}return e.create=function(t,r){if(s.isPresent(r)){var n=u.ListWrapper.clone(r.factories);return t=t.concat(n),new e(t)}return new e(t)},e.extend=function(t){return new l.Binding(e,{toFactory:function(r){if(s.isBlank(r))throw new c.BaseException("Cannot extend KeyValueDiffers without a parent injector");return e.create(t,r)},deps:[[e,new l.SkipSelfMetadata,new l.OptionalMetadata]]})},e.prototype.find=function(e){var t=u.ListWrapper.find(this.factories,function(t){return t.supports(e)});if(s.isPresent(t))return t;throw new c.BaseException("Cannot find a differ supporting object '"+e+"'")},e=o([l.Injectable(),s.CONST(),a("design:paramtypes",[Array])],e)}();return t.KeyValueDiffers=p,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/differs/default_keyvalue_differ",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),l=function(){function e(){}return e.prototype.supports=function(e){return e instanceof Map||c.isJsObject(e)},e.prototype.create=function(e){return new p},e=o([c.CONST(),a("design:paramtypes",[])],e)}();t.DefaultKeyValueDifferFactory=l;var p=function(){function e(){this._records=new Map,this._mapHead=null,this._previousMapHead=null,this._changesHead=null,this._changesTail=null,this._additionsHead=null,this._additionsTail=null,this._removalsHead=null,this._removalsTail=null}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return null!==this._additionsHead||null!==this._changesHead||null!==this._removalsHead},enumerable:!0,configurable:!0}),e.prototype.forEachItem=function(e){var t;for(t=this._mapHead;null!==t;t=t._next)e(t)},e.prototype.forEachPreviousItem=function(e){var t;for(t=this._previousMapHead;null!==t;t=t._nextPrevious)e(t)},e.prototype.forEachChangedItem=function(e){var t;for(t=this._changesHead;null!==t;t=t._nextChanged)e(t)},e.prototype.forEachAddedItem=function(e){var t;for(t=this._additionsHead;null!==t;t=t._nextAdded)e(t)},e.prototype.forEachRemovedItem=function(e){var t;for(t=this._removalsHead;null!==t;t=t._nextRemoved)e(t)},e.prototype.diff=function(e){if(c.isBlank(e)&&(e=s.MapWrapper.createFromPairs([])),!(e instanceof Map||c.isJsObject(e)))throw new u.BaseException("Error trying to diff '"+e+"'");return this.check(e)?this:null},e.prototype.onDestroy=function(){},e.prototype.check=function(e){var t=this;this._reset();var r=this._records,n=this._mapHead,i=null,o=null,a=!1;return this._forEach(e,function(e,s){var u;null!==n&&s===n.key?(u=n,c.looseIdentical(e,n.currentValue)||(n.previousValue=n.currentValue,n.currentValue=e,t._addToChanges(n))):(a=!0,null!==n&&(n._next=null,t._removeFromSeq(i,n),t._addToRemovals(n)),r.has(s)?u=r.get(s):(u=new d(s),r.set(s,u),u.currentValue=e,t._addToAdditions(u))),a&&(t._isInRemovals(u)&&t._removeFromRemovals(u),null==o?t._mapHead=u:o._next=u),i=n,o=u,n=null===n?null:n._next}),this._truncate(i,n),this.isDirty},e.prototype._reset=function(){if(this.isDirty){var e;for(e=this._previousMapHead=this._mapHead;null!==e;e=e._next)e._nextPrevious=e._next;for(e=this._changesHead;null!==e;e=e._nextChanged)e.previousValue=e.currentValue;for(e=this._additionsHead;null!=e;e=e._nextAdded)e.previousValue=e.currentValue;this._changesHead=this._changesTail=null,this._additionsHead=this._additionsTail=null,this._removalsHead=this._removalsTail=null}},e.prototype._truncate=function(e,t){for(;null!==t;){null===e?this._mapHead=null:e._next=null;var r=t._next;this._addToRemovals(t),e=t,t=r}for(var n=this._removalsHead;null!==n;n=n._nextRemoved)n.previousValue=n.currentValue,n.currentValue=null,s.MapWrapper["delete"](this._records,n.key)},e.prototype._isInRemovals=function(e){return e===this._removalsHead||null!==e._nextRemoved||null!==e._prevRemoved},e.prototype._addToRemovals=function(e){null===this._removalsHead?this._removalsHead=this._removalsTail=e:(this._removalsTail._nextRemoved=e,e._prevRemoved=this._removalsTail,this._removalsTail=e)},e.prototype._removeFromSeq=function(e,t){var r=t._next;null===e?this._mapHead=r:e._next=r},e.prototype._removeFromRemovals=function(e){var t=e._prevRemoved,r=e._nextRemoved;null===t?this._removalsHead=r:t._nextRemoved=r,null===r?this._removalsTail=t:r._prevRemoved=t,e._prevRemoved=e._nextRemoved=null},e.prototype._addToAdditions=function(e){null===this._additionsHead?this._additionsHead=this._additionsTail=e:(this._additionsTail._nextAdded=e,this._additionsTail=e)},e.prototype._addToChanges=function(e){null===this._changesHead?this._changesHead=this._changesTail=e:(this._changesTail._nextChanged=e,this._changesTail=e)},e.prototype.toString=function(){var e,t=[],r=[],n=[],i=[],o=[];for(e=this._mapHead;null!==e;e=e._next)t.push(c.stringify(e));for(e=this._previousMapHead;null!==e;e=e._nextPrevious)r.push(c.stringify(e));for(e=this._changesHead;null!==e;e=e._nextChanged)n.push(c.stringify(e));for(e=this._additionsHead;null!==e;e=e._nextAdded)i.push(c.stringify(e));for(e=this._removalsHead;null!==e;e=e._nextRemoved)o.push(c.stringify(e));return"map: "+t.join(", ")+"\nprevious: "+r.join(", ")+"\nadditions: "+i.join(", ")+"\nchanges: "+n.join(", ")+"\nremovals: "+o.join(", ")+"\n"},e.prototype._forEach=function(e,t){e instanceof Map?s.MapWrapper.forEach(e,t):s.StringMapWrapper.forEach(e,t)},e}();t.DefaultKeyValueDiffer=p;var d=function(){function e(e){this.key=e,this.previousValue=null,this.currentValue=null,this._nextPrevious=null,this._next=null,this._nextAdded=null,this._nextRemoved=null,this._prevRemoved=null,this._nextChanged=null}return e.prototype.toString=function(){return c.looseIdentical(this.previousValue,this.currentValue)?c.stringify(this.key):c.stringify(this.key)+"["+c.stringify(this.previousValue)+"->"+c.stringify(this.currentValue)+"]"},e}();return t.KVChangeRecord=d,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/parser/ast",["angular2/src/core/facade/lang","angular2/src/core/facade/collection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection"),c=function(){function e(){}return e.prototype.visit=function(e){return null},e.prototype.toString=function(){return"AST"},e}();t.AST=c;var u=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.visit=function(e){},t}(c);t.EmptyExpr=u;var l=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.visit=function(e){return e.visitImplicitReceiver(this)},t}(c);t.ImplicitReceiver=l;var p=function(e){function t(t){e.call(this),this.expressions=t}return o(t,e),t.prototype.visit=function(e){return e.visitChain(this)},t}(c);t.Chain=p;var d=function(e){function t(t,r,n){e.call(this),this.condition=t,this.trueExp=r,this.falseExp=n}return o(t,e),t.prototype.visit=function(e){return e.visitConditional(this)},t}(c);t.Conditional=d;var f=function(e){function t(t,r,n){e.call(this),this.condition=t,this.trueExp=r,this.falseExp=n}return o(t,e),t.prototype.visit=function(e){return e.visitIf(this)},t}(c);t.If=f;var h=function(e){function t(t,r,n){e.call(this),this.receiver=t,this.name=r,this.getter=n}return o(t,e),t.prototype.visit=function(e){return e.visitPropertyRead(this)},t}(c);t.PropertyRead=h;var g=function(e){function t(t,r,n,i){e.call(this),this.receiver=t,this.name=r,this.setter=n,this.value=i}return o(t,e),t.prototype.visit=function(e){return e.visitPropertyWrite(this)},t}(c);t.PropertyWrite=g;var m=function(e){function t(t,r,n){e.call(this),this.receiver=t,this.name=r,this.getter=n}return o(t,e),t.prototype.visit=function(e){return e.visitSafePropertyRead(this)},t}(c);t.SafePropertyRead=m;var y=function(e){function t(t,r){e.call(this),this.obj=t,this.key=r}return o(t,e),t.prototype.visit=function(e){return e.visitKeyedRead(this)},t}(c);t.KeyedRead=y;var v=function(e){function t(t,r,n){e.call(this),this.obj=t,this.key=r,this.value=n}return o(t,e),t.prototype.visit=function(e){return e.visitKeyedWrite(this)},t}(c);t.KeyedWrite=v;var _=function(e){function t(t,r,n){e.call(this),this.exp=t,this.name=r,this.args=n}return o(t,e),t.prototype.visit=function(e){return e.visitPipe(this)},t}(c);t.BindingPipe=_;var b=function(e){function t(t){e.call(this),this.value=t}return o(t,e),t.prototype.visit=function(e){return e.visitLiteralPrimitive(this)},t}(c);t.LiteralPrimitive=b;var w=function(e){function t(t){e.call(this),this.expressions=t}return o(t,e),t.prototype.visit=function(e){return e.visitLiteralArray(this)},t}(c);t.LiteralArray=w;var C=function(e){function t(t,r){e.call(this),this.keys=t,this.values=r}return o(t,e),t.prototype.visit=function(e){return e.visitLiteralMap(this)},t}(c);t.LiteralMap=C;var E=function(e){function t(t,r){e.call(this),this.strings=t,this.expressions=r}return o(t,e),t.prototype.visit=function(e){e.visitInterpolation(this)},t}(c);t.Interpolation=E;var R=function(e){function t(t,r,n){e.call(this),this.operation=t,this.left=r,this.right=n}return o(t,e),t.prototype.visit=function(e){return e.visitBinary(this)},t}(c);t.Binary=R;var S=function(e){function t(t){e.call(this),this.expression=t}return o(t,e),t.prototype.visit=function(e){return e.visitPrefixNot(this)},t}(c);t.PrefixNot=S;var x=function(e){function t(t,r,n,i){e.call(this),this.receiver=t,this.name=r,this.fn=n,this.args=i}return o(t,e),t.prototype.visit=function(e){return e.visitMethodCall(this)},t}(c);t.MethodCall=x;var P=function(e){function t(t,r,n,i){e.call(this),this.receiver=t,this.name=r,this.fn=n,this.args=i}return o(t,e),t.prototype.visit=function(e){return e.visitSafeMethodCall(this)},t}(c);t.SafeMethodCall=P;var D=function(e){function t(t,r){e.call(this),this.target=t,this.args=r}return o(t,e),t.prototype.visit=function(e){return e.visitFunctionCall(this)},t}(c);t.FunctionCall=D;var I=function(e){function t(t,r,n){e.call(this),this.ast=t,this.source=r,this.location=n}return o(t,e),t.prototype.visit=function(e){return this.ast.visit(e)},t.prototype.toString=function(){return this.source+" in "+this.location},t}(c);t.ASTWithSource=I;var O=function(){function e(e,t,r,n){this.key=e,this.keyIsVar=t,this.name=r,this.expression=n}return e}();t.TemplateBinding=O;var k=function(){function e(){}return e.prototype.visitBinary=function(e){return e.left.visit(this),e.right.visit(this),null},e.prototype.visitChain=function(e){return this.visitAll(e.expressions)},e.prototype.visitConditional=function(e){return e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this),null},e.prototype.visitIf=function(e){return e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this),null},e.prototype.visitPipe=function(e){return e.exp.visit(this),this.visitAll(e.args),null},e.prototype.visitFunctionCall=function(e){return e.target.visit(this),this.visitAll(e.args),null},e.prototype.visitImplicitReceiver=function(e){return null},e.prototype.visitInterpolation=function(e){return this.visitAll(e.expressions)},e.prototype.visitKeyedRead=function(e){return e.obj.visit(this),e.key.visit(this),null},e.prototype.visitKeyedWrite=function(e){return e.obj.visit(this),e.key.visit(this),e.value.visit(this),null},e.prototype.visitLiteralArray=function(e){return this.visitAll(e.expressions)},e.prototype.visitLiteralMap=function(e){return this.visitAll(e.values)},e.prototype.visitLiteralPrimitive=function(e){return null},e.prototype.visitMethodCall=function(e){return e.receiver.visit(this),this.visitAll(e.args)},e.prototype.visitPrefixNot=function(e){return e.expression.visit(this),null},e.prototype.visitPropertyRead=function(e){return e.receiver.visit(this),null},e.prototype.visitPropertyWrite=function(e){return e.receiver.visit(this),e.value.visit(this),null},e.prototype.visitSafePropertyRead=function(e){return e.receiver.visit(this),null},e.prototype.visitSafeMethodCall=function(e){return e.receiver.visit(this),this.visitAll(e.args)},e.prototype.visitAll=function(e){var t=this;return e.forEach(function(e){return e.visit(t)}),null},e}();t.RecursiveAstVisitor=k;var A=function(){function e(){}return e.prototype.visitImplicitReceiver=function(e){return e},e.prototype.visitInterpolation=function(e){return new E(e.strings,this.visitAll(e.expressions))},e.prototype.visitLiteralPrimitive=function(e){return new b(e.value)},e.prototype.visitPropertyRead=function(e){return new h(e.receiver.visit(this),e.name,e.getter)},e.prototype.visitPropertyWrite=function(e){return new g(e.receiver.visit(this),e.name,e.setter,e.value)},e.prototype.visitSafePropertyRead=function(e){return new m(e.receiver.visit(this),e.name,e.getter)},e.prototype.visitMethodCall=function(e){return new x(e.receiver.visit(this),e.name,e.fn,this.visitAll(e.args))},e.prototype.visitSafeMethodCall=function(e){return new P(e.receiver.visit(this),e.name,e.fn,this.visitAll(e.args))},e.prototype.visitFunctionCall=function(e){return new D(e.target.visit(this),this.visitAll(e.args))},e.prototype.visitLiteralArray=function(e){return new w(this.visitAll(e.expressions))},e.prototype.visitLiteralMap=function(e){return new C(e.keys,this.visitAll(e.values))},e.prototype.visitBinary=function(e){return new R(e.operation,e.left.visit(this),e.right.visit(this))},e.prototype.visitPrefixNot=function(e){return new S(e.expression.visit(this))},e.prototype.visitConditional=function(e){return new d(e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this))},e.prototype.visitPipe=function(e){return new _(e.exp.visit(this),e.name,this.visitAll(e.args))},e.prototype.visitKeyedRead=function(e){return new y(e.obj.visit(this),e.key.visit(this))},e.prototype.visitKeyedWrite=function(e){return new v(e.obj.visit(this),e.key.visit(this),e.value.visit(this))},e.prototype.visitAll=function(e){for(var t=s.ListWrapper.createFixedSize(e.length),r=0;r<e.length;++r)t[r]=e[r].visit(this);return t},e.prototype.visitChain=function(e){return new p(this.visitAll(e.expressions))},e.prototype.visitIf=function(e){var t=a.isPresent(e.falseExp)?e.falseExp.visit(this):null;return new f(e.condition.visit(this),e.trueExp.visit(this),t)},e}();return t.AstTransformer=A,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/parser/lexer",["angular2/src/core/di/decorators","angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions"],!0,function(e,t,r){function n(e,t){return new P(e,S.Character,t,E.StringWrapper.fromCharCode(t))}function i(e,t){return new P(e,S.Identifier,0,t)}function o(e,t){return new P(e,S.Keyword,0,t)}function a(e,t){return new P(e,S.Operator,0,t)}function s(e,t){return new P(e,S.String,0,t)}function c(e,t){return new P(e,S.Number,t,"")}function u(e){return e>=t.$TAB&&e<=t.$SPACE||e==q}function l(e){return e>=j&&H>=e||e>=O&&A>=e||e==N||e==t.$$}function p(e){return e>=j&&H>=e||e>=O&&A>=e||e>=D&&I>=e||e==N||e==t.$$}function d(e){return e>=D&&I>=e}function f(e){return e==M||e==k}function h(e){return e==t.$MINUS||e==t.$PLUS}function g(e){switch(e){case B:return t.$LF;case V:return t.$FF;case L:return t.$CR;case F:return t.$TAB;case U:return t.$VTAB;default:return e}}var m=System.global,y=m.define;m.define=void 0;var v=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},_=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},b=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},w=e("angular2/src/core/di/decorators"),C=e("angular2/src/core/facade/collection"),E=e("angular2/src/core/facade/lang"),R=e("angular2/src/core/facade/exceptions");!function(e){e[e.Character=0]="Character",e[e.Identifier=1]="Identifier",e[e.Keyword=2]="Keyword",e[e.String=3]="String",e[e.Operator=4]="Operator",e[e.Number=5]="Number"}(t.TokenType||(t.TokenType={}));var S=t.TokenType,x=function(){function e(){}return e.prototype.tokenize=function(e){for(var t=new K(e),r=[],n=t.scanToken();null!=n;)r.push(n),n=t.scanToken();return r},e=_([w.Injectable(),b("design:paramtypes",[])],e)}();t.Lexer=x;var P=function(){function e(e,t,r,n){this.index=e,this.type=t,this.numValue=r,this.strValue=n}return e.prototype.isCharacter=function(e){return this.type==S.Character&&this.numValue==e},e.prototype.isNumber=function(){return this.type==S.Number},e.prototype.isString=function(){return this.type==S.String},e.prototype.isOperator=function(e){return this.type==S.Operator&&this.strValue==e},e.prototype.isIdentifier=function(){return this.type==S.Identifier},e.prototype.isKeyword=function(){return this.type==S.Keyword},e.prototype.isKeywordVar=function(){return this.type==S.Keyword&&"var"==this.strValue},e.prototype.isKeywordNull=function(){return this.type==S.Keyword&&"null"==this.strValue},e.prototype.isKeywordUndefined=function(){return this.type==S.Keyword&&"undefined"==this.strValue},e.prototype.isKeywordTrue=function(){return this.type==S.Keyword&&"true"==this.strValue},e.prototype.isKeywordIf=function(){return this.type==S.Keyword&&"if"==this.strValue},e.prototype.isKeywordElse=function(){return this.type==S.Keyword&&"else"==this.strValue},e.prototype.isKeywordFalse=function(){return this.type==S.Keyword&&"false"==this.strValue},e.prototype.toNumber=function(){return this.type==S.Number?this.numValue:-1},e.prototype.toString=function(){switch(this.type){case S.Character:case S.Identifier:case S.Keyword:case S.Operator:case S.String:return this.strValue;case S.Number:return this.numValue.toString();default:return null}},e}();t.Token=P,t.EOF=new P(-1,S.Character,0,""),t.$EOF=0,t.$TAB=9,t.$LF=10,t.$VTAB=11,t.$FF=12,t.$CR=13,t.$SPACE=32,t.$BANG=33,t.$DQ=34,t.$HASH=35,t.$$=36,t.$PERCENT=37,t.$AMPERSAND=38,t.$SQ=39,t.$LPAREN=40,t.$RPAREN=41,t.$STAR=42,t.$PLUS=43,t.$COMMA=44,t.$MINUS=45,t.$PERIOD=46,t.$SLASH=47,t.$COLON=58,t.$SEMICOLON=59,t.$LT=60,t.$EQ=61,t.$GT=62,t.$QUESTION=63;var D=48,I=57,O=65,k=69,A=90;t.$LBRACKET=91,t.$BACKSLASH=92,t.$RBRACKET=93;var T=94,N=95,j=97,M=101,V=102,B=110,L=114,F=116,W=117,U=118,H=122;t.$LBRACE=123,t.$BAR=124,t.$RBRACE=125;var q=160,z=function(e){function t(t){e.call(this),this.message=t}return v(t,e),t.prototype.toString=function(){return this.message},t}(R.BaseException);t.ScannerError=z;var K=function(){function e(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}return e.prototype.advance=function(){this.peek=++this.index>=this.length?t.$EOF:E.StringWrapper.charCodeAt(this.input,this.index)},e.prototype.scanToken=function(){for(var e=this.input,r=this.length,i=this.peek,o=this.index;i<=t.$SPACE;){if(++o>=r){i=t.$EOF;break}i=E.StringWrapper.charCodeAt(e,o)}if(this.peek=i,this.index=o,o>=r)return null;if(l(i))return this.scanIdentifier();if(d(i))return this.scanNumber(o);var a=o;switch(i){case t.$PERIOD:return this.advance(),d(this.peek)?this.scanNumber(a):n(a,t.$PERIOD);case t.$LPAREN:case t.$RPAREN:case t.$LBRACE:case t.$RBRACE:case t.$LBRACKET:case t.$RBRACKET:case t.$COMMA:case t.$COLON:case t.$SEMICOLON:return this.scanCharacter(a,i);case t.$SQ:case t.$DQ:return this.scanString();case t.$HASH:case t.$PLUS:case t.$MINUS:case t.$STAR:case t.$SLASH:case t.$PERCENT:case T:return this.scanOperator(a,E.StringWrapper.fromCharCode(i));case t.$QUESTION:return this.scanComplexOperator(a,"?",t.$PERIOD,".");case t.$LT:case t.$GT:return this.scanComplexOperator(a,E.StringWrapper.fromCharCode(i),t.$EQ,"=");case t.$BANG:case t.$EQ:return this.scanComplexOperator(a,E.StringWrapper.fromCharCode(i),t.$EQ,"=",t.$EQ,"=");case t.$AMPERSAND:return this.scanComplexOperator(a,"&",t.$AMPERSAND,"&");case t.$BAR:return this.scanComplexOperator(a,"|",t.$BAR,"|");case q:for(;u(this.peek);)this.advance();return this.scanToken()}return this.error("Unexpected character ["+E.StringWrapper.fromCharCode(i)+"]",0),null},e.prototype.scanCharacter=function(e,t){return assert(this.peek==t),this.advance(),n(e,t)},e.prototype.scanOperator=function(e,t){return assert(this.peek==E.StringWrapper.charCodeAt(t,0)),assert(C.SetWrapper.has(G,t)),this.advance(),a(e,t)},e.prototype.scanComplexOperator=function(e,t,r,n,i,o){assert(this.peek==E.StringWrapper.charCodeAt(t,0)),this.advance();var s=t;return this.peek==r&&(this.advance(),s+=n),E.isPresent(i)&&this.peek==i&&(this.advance(),s+=o),assert(C.SetWrapper.has(G,s)),a(e,s)},e.prototype.scanIdentifier=function(){assert(l(this.peek));var e=this.index;for(this.advance();p(this.peek);)this.advance();var t=this.input.substring(e,this.index);return C.SetWrapper.has($,t)?o(e,t):i(e,t)},e.prototype.scanNumber=function(e){assert(d(this.peek));var r=this.index===e;for(this.advance();;){if(d(this.peek));else if(this.peek==t.$PERIOD)r=!1;else{if(!f(this.peek))break;this.advance(),h(this.peek)&&this.advance(),d(this.peek)||this.error("Invalid exponent",-1),r=!1}this.advance()}var n=this.input.substring(e,this.index),i=r?E.NumberWrapper.parseIntAutoRadix(n):E.NumberWrapper.parseFloat(n);return c(e,i)},e.prototype.scanString=function(){assert(this.peek==t.$SQ||this.peek==t.$DQ);var e=this.index,r=this.peek;this.advance();for(var n,i=this.index,o=this.input;this.peek!=r;)if(this.peek==t.$BACKSLASH){null==n&&(n=new E.StringJoiner),n.add(o.substring(i,this.index)),this.advance();var a;if(this.peek==W){var c=o.substring(this.index+1,this.index+5);try{a=E.NumberWrapper.parseInt(c,16)}catch(u){this.error("Invalid unicode escape [\\u"+c+"]",0)}for(var l=0;5>l;l++)this.advance()}else a=g(this.peek),this.advance();n.add(E.StringWrapper.fromCharCode(a)),i=this.index}else this.peek==t.$EOF?this.error("Unterminated quote",0):this.advance();var p=o.substring(i,this.index);this.advance();var d=p;return null!=n&&(n.add(p),d=n.toString()),s(e,d)},e.prototype.error=function(e,t){var r=this.index+t;throw new z("Lexer Error: "+e+" at column "+r+" in expression ["+this.input+"]")},e}(),G=C.SetWrapper.createFromList(["+","-","*","/","%","^","=","==","!=","===","!==","<",">","<=",">=","&&","||","&","|","!","?","#","?."]),$=C.SetWrapper.createFromList(["var","null","undefined","true","false","if","else"]);return m.define=y,r.exports}),System.register("angular2/src/core/change_detection/parser/parser",["angular2/src/core/di/decorators","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/change_detection/parser/lexer","angular2/src/core/reflection/reflection","angular2/src/core/change_detection/parser/ast"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/di/decorators"),u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/change_detection/parser/lexer"),f=e("angular2/src/core/reflection/reflection"),h=e("angular2/src/core/change_detection/parser/ast"),g=new h.ImplicitReceiver,m=/\{\{(.*?)\}\}/g,y=function(e){function t(t,r,n,i){e.call(this,"Parser Error: "+t+" "+n+" ["+r+"] in "+i)}return o(t,e),t}(l.BaseException),v=function(){function e(e,t){void 0===t&&(t=null),this._lexer=e,this._reflector=u.isPresent(t)?t:f.reflector}return e.prototype.parseAction=function(e,t){this._checkNoInterpolation(e,t);var r=this._lexer.tokenize(e),n=new _(e,t,r,this._reflector,!0).parseChain();return new h.ASTWithSource(n,e,t)},e.prototype.parseBinding=function(e,t){this._checkNoInterpolation(e,t);var r=this._lexer.tokenize(e),n=new _(e,t,r,this._reflector,!1).parseChain();return new h.ASTWithSource(n,e,t)},e.prototype.parseSimpleBinding=function(e,t){this._checkNoInterpolation(e,t);var r=this._lexer.tokenize(e),n=new _(e,t,r,this._reflector,!1).parseSimpleBinding();return new h.ASTWithSource(n,e,t)},e.prototype.parseTemplateBindings=function(e,t){var r=this._lexer.tokenize(e);return new _(e,t,r,this._reflector,!1).parseTemplateBindings()},e.prototype.parseInterpolation=function(e,t){var r=u.StringWrapper.split(e,m);if(r.length<=1)return null;for(var n=[],i=[],o=0;o<r.length;o++){var a=r[o];if(o%2===0)n.push(a);else{if(!(a.trim().length>0))throw new y("Blank expressions are not allowed in interpolated strings",e,"at column "+this._findInterpolationErrorColumn(r,o)+" in",t);
var s=this._lexer.tokenize(a),c=new _(e,t,s,this._reflector,!1).parseChain();i.push(c)}}return new h.ASTWithSource(new h.Interpolation(n,i),e,t)},e.prototype.wrapLiteralPrimitive=function(e,t){return new h.ASTWithSource(new h.LiteralPrimitive(e),e,t)},e.prototype._checkNoInterpolation=function(e,t){var r=u.StringWrapper.split(e,m);if(r.length>1)throw new y("Got interpolation ({{}}) where expression was expected",e,"at column "+this._findInterpolationErrorColumn(r,1)+" in",t)},e.prototype._findInterpolationErrorColumn=function(e,t){for(var r="",n=0;t>n;n++)r+=n%2===0?e[n]:"{{"+e[n]+"}}";return r.length},e=a([c.Injectable(),s("design:paramtypes",[d.Lexer,f.Reflector])],e)}();t.Parser=v;var _=function(){function e(e,t,r,n,i){this.input=e,this.location=t,this.tokens=r,this.reflector=n,this.parseAction=i,this.index=0}return e.prototype.peek=function(e){var t=this.index+e;return t<this.tokens.length?this.tokens[t]:d.EOF},Object.defineProperty(e.prototype,"next",{get:function(){return this.peek(0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputIndex",{get:function(){return this.index<this.tokens.length?this.next.index:this.input.length},enumerable:!0,configurable:!0}),e.prototype.advance=function(){this.index++},e.prototype.optionalCharacter=function(e){return this.next.isCharacter(e)?(this.advance(),!0):!1},e.prototype.optionalKeywordVar=function(){return this.peekKeywordVar()?(this.advance(),!0):!1},e.prototype.peekKeywordVar=function(){return this.next.isKeywordVar()||this.next.isOperator("#")},e.prototype.expectCharacter=function(e){this.optionalCharacter(e)||this.error("Missing expected "+u.StringWrapper.fromCharCode(e))},e.prototype.optionalOperator=function(e){return this.next.isOperator(e)?(this.advance(),!0):!1},e.prototype.expectOperator=function(e){this.optionalOperator(e)||this.error("Missing expected operator "+e)},e.prototype.expectIdentifierOrKeyword=function(){var e=this.next;return e.isIdentifier()||e.isKeyword()||this.error("Unexpected token "+e+", expected identifier or keyword"),this.advance(),e.toString()},e.prototype.expectIdentifierOrKeywordOrString=function(){var e=this.next;return e.isIdentifier()||e.isKeyword()||e.isString()||this.error("Unexpected token "+e+", expected identifier, keyword, or string"),this.advance(),e.toString()},e.prototype.parseChain=function(){for(var e=[];this.index<this.tokens.length;){var t=this.parsePipe();if(e.push(t),this.optionalCharacter(d.$SEMICOLON))for(this.parseAction||this.error("Binding expression cannot contain chained expression");this.optionalCharacter(d.$SEMICOLON););else this.index<this.tokens.length&&this.error("Unexpected token '"+this.next+"'")}return 0==e.length?new h.EmptyExpr:1==e.length?e[0]:new h.Chain(e)},e.prototype.parseSimpleBinding=function(){var e=this.parseChain();return b.check(e)||this.error("Simple binding expression can only contain field access and constants'"),e},e.prototype.parsePipe=function(){var e=this.parseExpression();if(this.optionalOperator("|")){this.parseAction&&this.error("Cannot have a pipe in an action expression");do{for(var t=this.expectIdentifierOrKeyword(),r=[];this.optionalCharacter(d.$COLON);)r.push(this.parsePipe());e=new h.BindingPipe(e,t,r)}while(this.optionalOperator("|"))}return e},e.prototype.parseExpression=function(){return this.parseConditional()},e.prototype.parseConditional=function(){var e=this.inputIndex,t=this.parseLogicalOr();if(this.optionalOperator("?")){var r=this.parsePipe();if(!this.optionalCharacter(d.$COLON)){var n=this.inputIndex,i=this.input.substring(e,n);this.error("Conditional expression "+i+" requires all 3 expressions")}var o=this.parsePipe();return new h.Conditional(t,r,o)}return t},e.prototype.parseLogicalOr=function(){for(var e=this.parseLogicalAnd();this.optionalOperator("||");)e=new h.Binary("||",e,this.parseLogicalAnd());return e},e.prototype.parseLogicalAnd=function(){for(var e=this.parseEquality();this.optionalOperator("&&");)e=new h.Binary("&&",e,this.parseEquality());return e},e.prototype.parseEquality=function(){for(var e=this.parseRelational();;)if(this.optionalOperator("=="))e=new h.Binary("==",e,this.parseRelational());else if(this.optionalOperator("==="))e=new h.Binary("===",e,this.parseRelational());else if(this.optionalOperator("!="))e=new h.Binary("!=",e,this.parseRelational());else{if(!this.optionalOperator("!=="))return e;e=new h.Binary("!==",e,this.parseRelational())}},e.prototype.parseRelational=function(){for(var e=this.parseAdditive();;)if(this.optionalOperator("<"))e=new h.Binary("<",e,this.parseAdditive());else if(this.optionalOperator(">"))e=new h.Binary(">",e,this.parseAdditive());else if(this.optionalOperator("<="))e=new h.Binary("<=",e,this.parseAdditive());else{if(!this.optionalOperator(">="))return e;e=new h.Binary(">=",e,this.parseAdditive())}},e.prototype.parseAdditive=function(){for(var e=this.parseMultiplicative();;)if(this.optionalOperator("+"))e=new h.Binary("+",e,this.parseMultiplicative());else{if(!this.optionalOperator("-"))return e;e=new h.Binary("-",e,this.parseMultiplicative())}},e.prototype.parseMultiplicative=function(){for(var e=this.parsePrefix();;)if(this.optionalOperator("*"))e=new h.Binary("*",e,this.parsePrefix());else if(this.optionalOperator("%"))e=new h.Binary("%",e,this.parsePrefix());else{if(!this.optionalOperator("/"))return e;e=new h.Binary("/",e,this.parsePrefix())}},e.prototype.parsePrefix=function(){return this.optionalOperator("+")?this.parsePrefix():this.optionalOperator("-")?new h.Binary("-",new h.LiteralPrimitive(0),this.parsePrefix()):this.optionalOperator("!")?new h.PrefixNot(this.parsePrefix()):this.parseCallChain()},e.prototype.parseCallChain=function(){for(var e=this.parsePrimary();;)if(this.optionalCharacter(d.$PERIOD))e=this.parseAccessMemberOrMethodCall(e,!1);else if(this.optionalOperator("?."))e=this.parseAccessMemberOrMethodCall(e,!0);else if(this.optionalCharacter(d.$LBRACKET)){var t=this.parsePipe();if(this.expectCharacter(d.$RBRACKET),this.optionalOperator("=")){var r=this.parseConditional();e=new h.KeyedWrite(e,t,r)}else e=new h.KeyedRead(e,t)}else{if(!this.optionalCharacter(d.$LPAREN))return e;var n=this.parseCallArguments();this.expectCharacter(d.$RPAREN),e=new h.FunctionCall(e,n)}},e.prototype.parsePrimary=function(){if(this.optionalCharacter(d.$LPAREN)){var e=this.parsePipe();return this.expectCharacter(d.$RPAREN),e}if(this.next.isKeywordNull()||this.next.isKeywordUndefined())return this.advance(),new h.LiteralPrimitive(null);if(this.next.isKeywordTrue())return this.advance(),new h.LiteralPrimitive(!0);if(this.next.isKeywordFalse())return this.advance(),new h.LiteralPrimitive(!1);if(this.parseAction&&this.next.isKeywordIf()){this.advance(),this.expectCharacter(d.$LPAREN);var t=this.parseExpression();this.expectCharacter(d.$RPAREN);var r,n=this.parseExpressionOrBlock();return this.next.isKeywordElse()&&(this.advance(),r=this.parseExpressionOrBlock()),new h.If(t,n,r)}if(this.optionalCharacter(d.$LBRACKET)){var i=this.parseExpressionList(d.$RBRACKET);return this.expectCharacter(d.$RBRACKET),new h.LiteralArray(i)}if(this.next.isCharacter(d.$LBRACE))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMemberOrMethodCall(g,!1);if(this.next.isNumber()){var o=this.next.toNumber();return this.advance(),new h.LiteralPrimitive(o)}if(this.next.isString()){var a=this.next.toString();return this.advance(),new h.LiteralPrimitive(a)}throw this.error(this.index>=this.tokens.length?"Unexpected end of expression: "+this.input:"Unexpected token "+this.next),new l.BaseException("Fell through all cases in parsePrimary")},e.prototype.parseExpressionList=function(e){var t=[];if(!this.next.isCharacter(e))do t.push(this.parsePipe());while(this.optionalCharacter(d.$COMMA));return t},e.prototype.parseLiteralMap=function(){var e=[],t=[];if(this.expectCharacter(d.$LBRACE),!this.optionalCharacter(d.$RBRACE)){do{var r=this.expectIdentifierOrKeywordOrString();e.push(r),this.expectCharacter(d.$COLON),t.push(this.parsePipe())}while(this.optionalCharacter(d.$COMMA));this.expectCharacter(d.$RBRACE)}return new h.LiteralMap(e,t)},e.prototype.parseAccessMemberOrMethodCall=function(e,t){void 0===t&&(t=!1);var r=this.expectIdentifierOrKeyword();if(this.optionalCharacter(d.$LPAREN)){var n=this.parseCallArguments();this.expectCharacter(d.$RPAREN);var i=this.reflector.method(r);return t?new h.SafeMethodCall(e,r,i,n):new h.MethodCall(e,r,i,n)}if(!t){if(this.optionalOperator("=")){this.parseAction||this.error("Bindings cannot contain assignments");var o=this.parseConditional();return new h.PropertyWrite(e,r,this.reflector.setter(r),o)}return new h.PropertyRead(e,r,this.reflector.getter(r))}return this.optionalOperator("=")?(this.error("The '?.' operator cannot be used in the assignment"),null):new h.SafePropertyRead(e,r,this.reflector.getter(r))},e.prototype.parseCallArguments=function(){if(this.next.isCharacter(d.$RPAREN))return[];var e=[];do e.push(this.parsePipe());while(this.optionalCharacter(d.$COMMA));return e},e.prototype.parseExpressionOrBlock=function(){if(this.optionalCharacter(d.$LBRACE)){var e=this.parseBlockContent();return this.expectCharacter(d.$RBRACE),e}return this.parseExpression()},e.prototype.parseBlockContent=function(){this.parseAction||this.error("Binding expression cannot contain chained expression");for(var e=[];this.index<this.tokens.length&&!this.next.isCharacter(d.$RBRACE);){var t=this.parseExpression();if(e.push(t),this.optionalCharacter(d.$SEMICOLON))for(;this.optionalCharacter(d.$SEMICOLON););}return 0==e.length?new h.EmptyExpr:1==e.length?e[0]:new h.Chain(e)},e.prototype.expectTemplateBindingKey=function(){var e="",t=!1;do e+=this.expectIdentifierOrKeywordOrString(),t=this.optionalOperator("-"),t&&(e+="-");while(t);return e.toString()},e.prototype.parseTemplateBindings=function(){for(var e=[],t=null;this.index<this.tokens.length;){var r=this.optionalKeywordVar(),n=this.expectTemplateBindingKey();r||(null==t?t=n:n=t+"-"+n),this.optionalCharacter(d.$COLON);var i=null,o=null;if(r)i=this.optionalOperator("=")?this.expectTemplateBindingKey():"$implicit";else if(this.next!==d.EOF&&!this.peekKeywordVar()){var a=this.inputIndex,s=this.parsePipe(),c=this.input.substring(a,this.inputIndex);o=new h.ASTWithSource(s,c,this.location)}e.push(new h.TemplateBinding(n,r,i,o)),this.optionalCharacter(d.$SEMICOLON)||this.optionalCharacter(d.$COMMA)}return e},e.prototype.error=function(e,t){void 0===t&&(t=null),u.isBlank(t)&&(t=this.index);var r=t<this.tokens.length?"at column "+(this.tokens[t].index+1)+" in":"at the end of the expression";throw new y(e,this.input,r,this.location)},e}();t._ParseAST=_;var b=function(){function e(){this.simple=!0}return e.check=function(t){var r=new e;return t.visit(r),r.simple},e.prototype.visitImplicitReceiver=function(e){},e.prototype.visitInterpolation=function(e){this.simple=!1},e.prototype.visitLiteralPrimitive=function(e){},e.prototype.visitPropertyRead=function(e){},e.prototype.visitPropertyWrite=function(e){this.simple=!1},e.prototype.visitSafePropertyRead=function(e){this.simple=!1},e.prototype.visitMethodCall=function(e){this.simple=!1},e.prototype.visitSafeMethodCall=function(e){this.simple=!1},e.prototype.visitFunctionCall=function(e){this.simple=!1},e.prototype.visitLiteralArray=function(e){this.visitAll(e.expressions)},e.prototype.visitLiteralMap=function(e){this.visitAll(e.values)},e.prototype.visitBinary=function(e){this.simple=!1},e.prototype.visitPrefixNot=function(e){this.simple=!1},e.prototype.visitConditional=function(e){this.simple=!1},e.prototype.visitPipe=function(e){this.simple=!1},e.prototype.visitKeyedRead=function(e){this.simple=!1},e.prototype.visitKeyedWrite=function(e){this.simple=!1},e.prototype.visitAll=function(e){for(var t=p.ListWrapper.createFixedSize(e.length),r=0;r<e.length;++r)t[r]=e[r].visit(this);return t},e.prototype.visitChain=function(e){this.simple=!1},e.prototype.visitIf=function(e){this.simple=!1},e}();return n.define=i,r.exports}),System.register("angular2/src/core/change_detection/parser/locals",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/facade/collection"),c=function(){function e(e,t){this.parent=e,this.current=t}return e.prototype.contains=function(e){return this.current.has(e)?!0:o.isPresent(this.parent)?this.parent.contains(e):!1},e.prototype.get=function(e){if(this.current.has(e))return this.current.get(e);if(o.isPresent(this.parent))return this.parent.get(e);throw new a.BaseException("Cannot find '"+e+"'")},e.prototype.set=function(e,t){if(!this.current.has(e))throw new a.BaseException("Setting of new keys post-construction is not supported. Key: "+e+".");this.current.set(e,t)},e.prototype.clearValues=function(){s.MapWrapper.clearValues(this.current)},e}();return t.Locals=c,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/exceptions",["angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/facade/exceptions"),s=function(e){function t(t,r,n,i){e.call(this,"Expression '"+t+"' has changed after it was checked. "+("Previous value: '"+r+"'. Current value: '"+n+"'"))}return o(t,e),t}(a.BaseException);t.ExpressionChangedAfterItHasBeenCheckedException=s;var c=function(e){function t(t,r,n,i){e.call(this,r+" in ["+t+"]",r,n,i),this.location=t}return o(t,e),t}(a.WrappedException);t.ChangeDetectionError=c;var u=function(e){function t(){e.call(this,"Attempt to detect changes on a dehydrated detector.")}return o(t,e),t}(a.BaseException);return t.DehydratedException=u,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/interfaces",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(e,t,r,n,i,o){this.element=e,this.componentElement=t,this.directive=r,this.context=n,this.locals=i,this.injector=o}return e}();t.DebugContext=o;var a=function(){function e(e,t,r,n){this.genCheckNoChanges=e,this.genDebugInfo=t,this.logBindingUpdate=r,this.useJit=n}return e}();t.ChangeDetectorGenConfig=a;var s=function(){function e(e,t,r,n,i,o,a){this.id=e,this.strategy=t,this.variableNames=r,this.bindingRecords=n,this.eventRecords=i,this.directiveRecords=o,this.genConfig=a}return e}();return t.ChangeDetectorDefinition=s,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/constants",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return a.isBlank(e)||e===s.Default}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang");!function(e){e[e.CheckOnce=0]="CheckOnce",e[e.Checked=1]="Checked",e[e.CheckAlways=2]="CheckAlways",e[e.Detached=3]="Detached",e[e.OnPush=4]="OnPush",e[e.Default=5]="Default",e[e.OnPushObserve=6]="OnPushObserve"}(t.ChangeDetectionStrategy||(t.ChangeDetectionStrategy={}));var s=t.ChangeDetectionStrategy;return t.CHANGE_DECTION_STRATEGY_VALUES=[s.CheckOnce,s.Checked,s.CheckAlways,s.Detached,s.OnPush,s.Default,s.OnPushObserve],t.isDefaultChangeDetectionStrategy=n,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/pipe_lifecycle_reflector",[],!0,function(e,t,r){function n(e){return e.constructor.prototype.onDestroy}var i=System.global,o=i.define;return i.define=void 0,t.implementsOnDestroy=n,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/binding_record",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a="directiveLifecycle",s="native",c="directive",u="elementProperty",l="elementAttribute",p="elementClass",d="elementStyle",f="textNode",h="event",g="hostEvent",m=function(){function e(e,t,r,n,i){this.mode=e,this.elementIndex=t,this.name=r,this.unit=n,this.debug=i}return e.prototype.isDirective=function(){return this.mode===c},e.prototype.isElementProperty=function(){return this.mode===u},e.prototype.isElementAttribute=function(){return this.mode===l},e.prototype.isElementClass=function(){return this.mode===p},e.prototype.isElementStyle=function(){return this.mode===d},e.prototype.isTextNode=function(){return this.mode===f},e}();t.BindingTarget=m;var y=function(){function e(e,t,r,n,i,o,a){this.mode=e,this.target=t,this.implicitReceiver=r,this.ast=n,this.setter=i,this.lifecycleEvent=o,this.directiveRecord=a}return e.prototype.isDirectiveLifecycle=function(){return this.mode===a},e.prototype.callOnChanges=function(){return o.isPresent(this.directiveRecord)&&this.directiveRecord.callOnChanges},e.prototype.isDefaultChangeDetection=function(){return o.isBlank(this.directiveRecord)||this.directiveRecord.isDefaultChangeDetection()},e.createDirectiveDoCheck=function(t){return new e(a,null,0,null,null,"DoCheck",t)},e.createDirectiveOnInit=function(t){return new e(a,null,0,null,null,"OnInit",t)},e.createDirectiveOnChanges=function(t){return new e(a,null,0,null,null,"OnChanges",t)},e.createForDirective=function(t,r,n,i){var o=i.directiveIndex.elementIndex,a=new m(c,o,r,null,t.toString());return new e(c,a,0,t,n,null,i)},e.createForElementProperty=function(t,r,n){var i=new m(u,r,n,null,t.toString());return new e(s,i,0,t,null,null,null)},e.createForElementAttribute=function(t,r,n){var i=new m(l,r,n,null,t.toString());return new e(s,i,0,t,null,null,null)},e.createForElementClass=function(t,r,n){var i=new m(p,r,n,null,t.toString());return new e(s,i,0,t,null,null,null)},e.createForElementStyle=function(t,r,n,i){var o=new m(d,r,n,i,t.toString());return new e(s,o,0,t,null,null,null)},e.createForHostProperty=function(t,r,n){var i=new m(u,t.elementIndex,n,null,r.toString());return new e(s,i,t,r,null,null,null)},e.createForHostAttribute=function(t,r,n){var i=new m(l,t.elementIndex,n,null,r.toString());return new e(s,i,t,r,null,null,null)},e.createForHostClass=function(t,r,n){var i=new m(p,t.elementIndex,n,null,r.toString());return new e(s,i,t,r,null,null,null)},e.createForHostStyle=function(t,r,n,i){var o=new m(d,t.elementIndex,n,i,r.toString());return new e(s,o,t,r,null,null,null)},e.createForTextNode=function(t,r){var n=new m(f,r,null,null,t.toString());return new e(s,n,0,t,null,null,null)},e.createForEvent=function(t,r,n){var i=new m(h,n,r,null,t.toString());return new e(h,i,0,t,null,null,null)},e.createForHostEvent=function(t,r,n){var i=n.directiveIndex,o=new m(g,i.elementIndex,r,null,t.toString());return new e(g,o,i,t,null,null,n)},e}();return t.BindingRecord=y,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/directive_record",["angular2/src/core/facade/lang","angular2/src/core/change_detection/constants"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/change_detection/constants"),s=function(){function e(e,t){this.elementIndex=e,this.directiveIndex=t}return Object.defineProperty(e.prototype,"name",{get:function(){return this.elementIndex+"_"+this.directiveIndex},enumerable:!0,configurable:!0}),e}();t.DirectiveIndex=s;var c=function(){function e(e){var t=void 0===e?{}:e,r=t.directiveIndex,n=t.callAfterContentInit,i=t.callAfterContentChecked,a=t.callAfterViewInit,s=t.callAfterViewChecked,c=t.callOnChanges,u=t.callDoCheck,l=t.callOnInit,p=t.changeDetection;this.directiveIndex=r,this.callAfterContentInit=o.normalizeBool(n),this.callAfterContentChecked=o.normalizeBool(i),this.callOnChanges=o.normalizeBool(c),this.callAfterViewInit=o.normalizeBool(a),this.callAfterViewChecked=o.normalizeBool(s),this.callDoCheck=o.normalizeBool(u),this.callOnInit=o.normalizeBool(l),this.changeDetection=p}return e.prototype.isDefaultChangeDetection=function(){return a.isDefaultChangeDetectionStrategy(this.changeDetection)},e}();return t.DirectiveRecord=c,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/change_detector_ref",["angular2/src/core/change_detection/constants"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/change_detection/constants"),s=function(){function e(){}return e}();t.ChangeDetectorRef=s;var c=function(e){function t(t){e.call(this),this._cd=t}return o(t,e),t.prototype.markForCheck=function(){this._cd.markPathToRootAsCheckOnce()},t.prototype.detach=function(){this._cd.mode=a.ChangeDetectionStrategy.Detached},t.prototype.detectChanges=function(){this._cd.detectChanges()},t.prototype.reattach=function(){this._cd.mode=a.ChangeDetectionStrategy.CheckAlways,this.markForCheck()},t}(s);return t.ChangeDetectorRef_=c,n.define=i,r.exports}),System.register("angular2/src/core/profile/wtf_impl",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(){var e=d.global.wtf;return e&&(l=e.trace)?(p=l.events,!0):!1}function i(e,t){return void 0===t&&(t=null),p.createScope(e,t)}function o(e,t){return l.leaveScope(e,t),t}function a(e,t){return l.beginTimeRange(e,t)}function s(e){l.endTimeRange(e)}var c=System.global,u=c.define;c.define=void 0;var l,p,d=e("angular2/src/core/facade/lang");return t.detectWTF=n,t.createScope=i,t.leave=o,t.startTimeRange=a,t.endTimeRange=s,c.define=u,r.exports}),System.register("angular2/src/core/change_detection/observable_facade",[],!0,function(e,t,r){function n(e){return!1}var i=System.global,o=i.define;return i.define=void 0,t.isObservable=n,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/proto_record",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0,function(e){e[e.Self=0]="Self",e[e.Const=1]="Const",e[e.PrimitiveOp=2]="PrimitiveOp",e[e.PropertyRead=3]="PropertyRead",e[e.PropertyWrite=4]="PropertyWrite",e[e.Local=5]="Local",e[e.InvokeMethod=6]="InvokeMethod",e[e.InvokeClosure=7]="InvokeClosure",e[e.KeyedRead=8]="KeyedRead",e[e.KeyedWrite=9]="KeyedWrite",e[e.Pipe=10]="Pipe",e[e.Interpolate=11]="Interpolate",e[e.SafeProperty=12]="SafeProperty",e[e.CollectionLiteral=13]="CollectionLiteral",e[e.SafeMethodInvoke=14]="SafeMethodInvoke",e[e.DirectiveLifecycle=15]="DirectiveLifecycle",e[e.Chain=16]="Chain"}(t.RecordType||(t.RecordType={}));var o=t.RecordType,a=function(){function e(e,t,r,n,i,o,a,s,c,u,l,p,d,f){this.mode=e,this.name=t,this.funcOrValue=r,this.args=n,this.fixedArgs=i,this.contextIndex=o,this.directiveIndex=a,this.selfIndex=s,this.bindingRecord=c,this.lastInBinding=u,this.lastInDirective=l,this.argumentToPureFunction=p,this.referencedBySelf=d,this.propertyBindingIndex=f}return e.prototype.isPureFunction=function(){return this.mode===o.Interpolate||this.mode===o.CollectionLiteral},e.prototype.isUsedByOtherRecord=function(){return!this.lastInBinding||this.referencedBySelf},e.prototype.shouldBeChecked=function(){return this.argumentToPureFunction||this.lastInBinding||this.isPureFunction()||this.isPipeRecord()},e.prototype.isPipeRecord=function(){return this.mode===o.Pipe},e.prototype.isLifeCycleRecord=function(){return this.mode===o.DirectiveLifecycle},e}();return t.ProtoRecord=a,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/event_binding",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(e,t,r,n){this.eventName=e,this.elIndex=t,this.dirIndex=r,this.records=n}return e}();return t.EventBinding=o,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/coalesce",["angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/change_detection/proto_record"],!0,function(e,t,r){function n(e){for(var t=[],r=new d.Map,n=0;n<e.length;++n){var a=e[n],c=s(a,t.length+1,r),u=o(c,t);p.isPresent(u)&&c.lastInBinding?(t.push(i(c,u.selfIndex,t.length+1)),r.set(a.selfIndex,u.selfIndex),u.referencedBySelf=!0):p.isPresent(u)&&!c.lastInBinding?(c.argumentToPureFunction&&(u.argumentToPureFunction=!0),r.set(a.selfIndex,u.selfIndex)):(t.push(c),r.set(a.selfIndex,c.selfIndex))}return t}function i(e,t,r){return new f.ProtoRecord(f.RecordType.Self,"self",null,[],e.fixedArgs,t,e.directiveIndex,r,e.bindingRecord,e.lastInBinding,e.lastInDirective,!1,!1,e.propertyBindingIndex)}function o(e,t){return d.ListWrapper.find(t,function(t){return t.mode!==f.RecordType.DirectiveLifecycle&&a(t,e)&&t.mode===e.mode&&p.looseIdentical(t.funcOrValue,e.funcOrValue)&&t.contextIndex===e.contextIndex&&p.looseIdentical(t.name,e.name)&&d.ListWrapper.equals(t.args,e.args)})}function a(e,t){var r=p.isBlank(e.directiveIndex)?null:e.directiveIndex.directiveIndex,n=p.isBlank(e.directiveIndex)?null:e.directiveIndex.elementIndex,i=p.isBlank(t.directiveIndex)?null:t.directiveIndex.directiveIndex,o=p.isBlank(t.directiveIndex)?null:t.directiveIndex.elementIndex;return r===i&&n===o}function s(e,t,r){var n=e.args.map(function(e){return c(r,e)}),i=c(r,e.contextIndex);return new f.ProtoRecord(e.mode,e.name,e.funcOrValue,n,e.fixedArgs,i,e.directiveIndex,t,e.bindingRecord,e.lastInBinding,e.lastInDirective,e.argumentToPureFunction,e.referencedBySelf,e.propertyBindingIndex)}function c(e,t){var r=e.get(t);return p.isPresent(r)?r:t}var u=System.global,l=u.define;u.define=void 0;var p=e("angular2/src/core/facade/lang"),d=e("angular2/src/core/facade/collection"),f=e("angular2/src/core/change_detection/proto_record");return t.coalesce=n,u.define=l,r.exports}),System.register("angular2/src/core/change_detection/codegen_name_util",["angular2/src/core/facade/lang","angular2/src/core/facade/collection"],!0,function(e,t,r){function n(e){return a.StringWrapper.replaceAll(e,v,"")}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection"),c="alreadyChecked",u="context",l="propertyBindingIndex",p="directiveIndices",d="dispatcher",f="locals",h="mode",g="pipes",m="protos";t.CONTEXT_INDEX=0;var y="this.",v=a.RegExpWrapper.create("\\W","g");t.sanitizeName=n;var _=function(){function e(e,r,i,o){this._records=e,this._eventBindings=r,this._directiveRecords=i,this._utilName=o,this._sanitizedEventNames=new s.Map,this._sanitizedNames=s.ListWrapper.createFixedSize(this._records.length+1),this._sanitizedNames[t.CONTEXT_INDEX]=u;for(var a=0,c=this._records.length;c>a;++a)this._sanitizedNames[a+1]=n(""+this._records[a].name+a);for(var l=0;l<r.length;++l){for(var p=r[l],d=[u],a=0,c=p.records.length;c>a;++a)d.push(n(""+p.records[a].name+a+"_"+l));this._sanitizedEventNames.set(p,d)}}return e.prototype._addFieldPrefix=function(e){return""+y+e},e.prototype.getDispatcherName=function(){return this._addFieldPrefix(d)},e.prototype.getPipesAccessorName=function(){return this._addFieldPrefix(g)},e.prototype.getProtosName=function(){return this._addFieldPrefix(m)},e.prototype.getDirectivesAccessorName=function(){return this._addFieldPrefix(p)},e.prototype.getLocalsAccessorName=function(){return this._addFieldPrefix(f)},e.prototype.getAlreadyCheckedName=function(){return this._addFieldPrefix(c)},e.prototype.getModeName=function(){return this._addFieldPrefix(h)},e.prototype.getPropertyBindingIndex=function(){return this._addFieldPrefix(l)},e.prototype.getLocalName=function(e){return"l_"+this._sanitizedNames[e]},e.prototype.getEventLocalName=function(e,t){return"l_"+s.MapWrapper.get(this._sanitizedEventNames,e)[t]},e.prototype.getChangeName=function(e){return"c_"+this._sanitizedNames[e]},e.prototype.genInitLocals=function(){for(var e=[],r=[],n=0,i=this.getFieldCount();i>n;++n)if(n==t.CONTEXT_INDEX)e.push(this.getLocalName(n)+" = "+this.getFieldName(n));else{var o=this._records[n-1];if(o.argumentToPureFunction){var a=this.getChangeName(n);e.push(this.getLocalName(n)+","+a),r.push(a)}else e.push(""+this.getLocalName(n))}var c=s.ListWrapper.isEmpty(r)?"":r.join("=")+" = false;";return"var "+e.join(",")+";"+c},e.prototype.genInitEventLocals=function(){var e=this,r=[this.getLocalName(t.CONTEXT_INDEX)+" = "+this.getFieldName(t.CONTEXT_INDEX)];return s.MapWrapper.forEach(this._sanitizedEventNames,function(n,i){for(var o=0;o<n.length;++o)o!==t.CONTEXT_INDEX&&r.push(""+e.getEventLocalName(i,o))}),r.length>1?"var "+r.join(",")+";":""},e.prototype.getPreventDefaultAccesor=function(){return"preventDefault"},e.prototype.getFieldCount=function(){return this._sanitizedNames.length},e.prototype.getFieldName=function(e){return this._addFieldPrefix(this._sanitizedNames[e])},e.prototype.getAllFieldNames=function(){for(var e=[],t=0,r=this.getFieldCount();r>t;++t)(0===t||this._records[t-1].shouldBeChecked())&&e.push(this.getFieldName(t));for(var n=0,i=this._records.length;i>n;++n){var o=this._records[n];o.isPipeRecord()&&e.push(this.getPipeName(o.selfIndex))}for(var a=0,s=this._directiveRecords.length;s>a;++a){var c=this._directiveRecords[a];e.push(this.getDirectiveName(c.directiveIndex)),c.isDefaultChangeDetection()||e.push(this.getDetectorName(c.directiveIndex))}return e},e.prototype.genDehydrateFields=function(){var e=this.getAllFieldNames();return s.ListWrapper.removeAt(e,t.CONTEXT_INDEX),s.ListWrapper.isEmpty(e)?"":(e.push(this._utilName+".uninitialized;"),e.join(" = "))},e.prototype.genPipeOnDestroy=function(){var e=this;return s.ListWrapper.filter(this._records,function(e){return e.isPipeRecord()}).map(function(t){return e._utilName+".callPipeOnDestroy("+e.getPipeName(t.selfIndex)+");"}).join("\n")},e.prototype.getPipeName=function(e){return this._addFieldPrefix(this._sanitizedNames[e]+"_pipe")},e.prototype.getDirectiveName=function(e){return this._addFieldPrefix("directive_"+e.name)},e.prototype.getDetectorName=function(e){return this._addFieldPrefix("detector_"+e.name)},e}();return t.CodegenNameUtil=_,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/codegen_facade",[],!0,function(e,t,r){function n(e){return JSON.stringify(e)}function i(e){return"'"+e+"'"}function o(e){return e.join(" + ")}var a=System.global,s=a.define;return a.define=void 0,t.codify=n,t.rawString=i,t.combineGeneratedStrings=o,a.define=s,r.exports}),System.register("angular2/src/core/metadata/view",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang");!function(e){e[e.Emulated=0]="Emulated",e[e.Native=1]="Native",e[e.None=2]="None"}(t.ViewEncapsulation||(t.ViewEncapsulation={}));var c=t.ViewEncapsulation;t.VIEW_ENCAPSULATION_VALUES=[c.Emulated,c.Native,c.None];var u=function(){function e(e){var t=void 0===e?{}:e,r=t.templateUrl,n=t.template,i=t.directives,o=t.pipes,a=t.encapsulation,s=t.styles,c=t.styleUrls;this.templateUrl=r,this.template=n,this.styleUrls=c,this.styles=s,this.directives=i,this.pipes=o,this.encapsulation=a}return e=o([s.CONST(),a("design:paramtypes",[Object])],e)}();return t.ViewMetadata=u,n.define=i,r.exports}),System.register("angular2/src/core/util",["angular2/src/core/util/decorators"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/util/decorators");return t.Class=o.Class,n.define=i,r.exports}),System.register("@reactivex/rxjs/dist/cjs/util/noop",[],!0,function(e,t,r){function n(){}var i=System.global,o=i.define;return i.define=void 0,t.__esModule=!0,t["default"]=n,r.exports=t["default"],
i.define=o,r.exports}),System.register("@reactivex/rxjs/dist/cjs/util/throwError",[],!0,function(e,t,r){function n(e){throw e}var i=System.global,o=i.define;return i.define=void 0,t.__esModule=!0,t["default"]=n,r.exports=t["default"],i.define=o,r.exports}),System.register("@reactivex/rxjs/dist/cjs/util/tryOrOnError",[],!0,function(e,t,r){function n(e){function t(){try{t.target.apply(this,arguments)}catch(e){this.error(e)}}return t.target=e,t}var i=System.global,o=i.define;return i.define=void 0,t.__esModule=!0,t["default"]=n,r.exports=t["default"],i.define=o,r.exports}),System.register("@reactivex/rxjs/dist/cjs/Subscription",[],!0,function(e,t,r){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=System.global,o=i.define;i.define=void 0,t.__esModule=!0;var a=function(){function e(t){n(this,e),this.isUnsubscribed=!1,t&&(this._unsubscribe=t)}return e.prototype._unsubscribe=function(){},e.prototype.unsubscribe=function t(){if(!this.isUnsubscribed){this.isUnsubscribed=!0;var t=this._unsubscribe,e=this._subscriptions;if(this._subscriptions=void 0,t&&t.call(this),null!=e)for(var r=-1,n=e.length;++r<n;)e[r].unsubscribe()}},e.prototype.add=function(t){if(t&&t!==this&&t!==e.EMPTY){var r=t;switch(typeof t){case"function":r=new e(t);case"object":if(r.isUnsubscribed||"function"!=typeof r.unsubscribe)break;if(this.isUnsubscribed)r.unsubscribe();else{var n=this._subscriptions||(this._subscriptions=[]);n.push(r)}break;default:throw new Error("Unrecognized subscription "+t+" added to Subscription.")}}},e.prototype.remove=function(t){if(null!=t&&t!==this&&t!==e.EMPTY){var r=this._subscriptions;if(r){var n=r.indexOf(t);-1!==n&&r.splice(n,1)}}},e}();return t["default"]=a,a.EMPTY=function(e){return e.isUnsubscribed=!0,e}(new a),r.exports=t["default"],i.define=o,r.exports}),System.register("@reactivex/rxjs/dist/cjs/util/root",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0,t.__esModule=!0;var o={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},a=o[typeof self]&&self||o[typeof window]&&window;t.root=a;var s=(o[typeof t]&&t&&!t.nodeType&&t,o[typeof r]&&r&&!r.nodeType&&r,o[typeof n]&&n);return!s||s.global!==s&&s.window!==s||(t.root=a=s),n.define=i,r.exports}),System.register("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription",["@reactivex/rxjs/dist/cjs/Subscription"],!0,function(e,t,r){function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function 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=System.global,s=a.define;a.define=void 0,t.__esModule=!0;var c=e("@reactivex/rxjs/dist/cjs/Subscription"),u=n(c),l=function(e){function t(r,n){i(this,t),e.call(this),this.subject=r,this.observer=n,this.isUnsubscribed=!1}return o(t,e),t.prototype.unsubscribe=function(){if(!this.isUnsubscribed){this.isUnsubscribed=!0;var e=this.subject,t=e.observers;if(this.subject=void 0,t&&0!==t.length&&!e.isUnsubscribed){var r=t.indexOf(this.observer);-1!==r&&t.splice(r,1)}}},t}(u["default"]);return t["default"]=l,r.exports=t["default"],a.define=s,r.exports}),System.register("angular2/src/core/pipes/invalid_pipe_argument_exception",["angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/facade/exceptions"),s=function(e){function t(t,r){e.call(this,"Invalid argument '"+r+"' for pipe '"+t+"'")}return o(t,e),t}(a.BaseException);return t.InvalidPipeArgumentException=s,n.define=i,r.exports}),System.register("angular2/src/core/facade/intl",[],!0,function(e,t,r){function n(e){return 2==e?"2-digit":"numeric"}function i(e){return 4>e?"short":"long"}function o(e){for(var t,r={},o=0;o<e.length;){for(t=o;t<e.length&&e[t]==e[o];)t++;var a=t-o;switch(e[o]){case"G":r.era=i(a);break;case"y":r.year=n(a);break;case"M":r.month=a>=3?i(a):n(a);break;case"d":r.day=n(a);break;case"E":r.weekday=i(a);break;case"j":r.hour=n(a);break;case"h":r.hour=n(a),r.hour12=!0;break;case"H":r.hour=n(a),r.hour12=!1;break;case"m":r.minute=n(a);break;case"s":r.second=n(a);break;case"z":r.timeZoneName="long";break;case"Z":r.timeZoneName="short"}o=t}return r}var a=System.global,s=a.define;a.define=void 0,function(e){e[e.Decimal=0]="Decimal",e[e.Percent=1]="Percent",e[e.Currency=2]="Currency"}(t.NumberFormatStyle||(t.NumberFormatStyle={}));var c=t.NumberFormatStyle,u=function(){function e(){}return e.format=function(e,t,r,n){var i=void 0===n?{}:n,o=i.minimumIntegerDigits,a=void 0===o?1:o,s=i.minimumFractionDigits,u=void 0===s?0:s,l=i.maximumFractionDigits,p=void 0===l?3:l,d=i.currency,f=i.currencyAsSymbol,h=void 0===f?!1:f,g={minimumIntegerDigits:a,minimumFractionDigits:u,maximumFractionDigits:p};return g.style=c[r].toLowerCase(),r==c.Currency&&(g.currency=d,g.currencyDisplay=h?"symbol":"code"),new Intl.NumberFormat(t,g).format(e)},e}();t.NumberFormatter=u;var l=new Map,p=function(){function e(){}return e.format=function(e,t,r){var n=t+r;if(l.has(n))return l.get(n).format(e);var i=new Intl.DateTimeFormat(t,o(r));return l.set(n,i),i.format(e)},e}();return t.DateFormatter=p,a.define=s,r.exports}),System.register("angular2/src/core/pipes/uppercase_pipe",["angular2/src/core/facade/lang","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/pipes/invalid_pipe_argument_exception"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/metadata"),u=e("angular2/src/core/di"),l=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),p=function(){function e(){}return e.prototype.transform=function(t,r){if(void 0===r&&(r=null),s.isBlank(t))return t;if(!s.isString(t))throw new l.InvalidPipeArgumentException(e,t);return s.StringWrapper.toUpperCase(t)},e=o([s.CONST(),c.Pipe({name:"uppercase"}),u.Injectable(),a("design:paramtypes",[])],e)}();return t.UpperCasePipe=p,n.define=i,r.exports}),System.register("angular2/src/core/pipes/lowercase_pipe",["angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/metadata","angular2/src/core/pipes/invalid_pipe_argument_exception"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/di"),u=e("angular2/src/core/metadata"),l=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),p=function(){function e(){}return e.prototype.transform=function(t,r){if(void 0===r&&(r=null),s.isBlank(t))return t;if(!s.isString(t))throw new l.InvalidPipeArgumentException(e,t);return s.StringWrapper.toLowerCase(t)},e=o([s.CONST(),u.Pipe({name:"lowercase"}),c.Injectable(),a("design:paramtypes",[])],e)}();return t.LowerCasePipe=p,n.define=i,r.exports}),System.register("angular2/src/core/pipes/json_pipe",["angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/metadata"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/di"),u=e("angular2/src/core/metadata"),l=function(){function e(){}return e.prototype.transform=function(e,t){return void 0===t&&(t=null),s.Json.stringify(e)},e=o([s.CONST(),u.Pipe({name:"json"}),c.Injectable(),a("design:paramtypes",[])],e)}();return t.JsonPipe=l,n.define=i,r.exports}),System.register("angular2/src/core/pipes/slice_pipe",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/di","angular2/src/core/pipes/invalid_pipe_argument_exception","angular2/src/core/metadata"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/di"),p=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),d=e("angular2/src/core/metadata"),f=function(){function e(){}return e.prototype.transform=function(t,r){if(void 0===r&&(r=null),s.isBlank(r)||0==r.length)throw new c.BaseException("Slice pipe requires one argument");if(!this.supports(t))throw new p.InvalidPipeArgumentException(e,t);if(s.isBlank(t))return t;var n=r[0],i=r.length>1?r[1]:null;return s.isString(t)?s.StringWrapper.slice(t,n,i):u.ListWrapper.slice(t,n,i)},e.prototype.supports=function(e){return s.isString(e)||s.isArray(e)},e=o([d.Pipe({name:"slice"}),l.Injectable(),a("design:paramtypes",[])],e)}();return t.SlicePipe=f,n.define=i,r.exports}),System.register("angular2/src/core/pipes/number_pipe",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/intl","angular2/src/core/di","angular2/src/core/metadata","angular2/src/core/facade/collection","angular2/src/core/pipes/invalid_pipe_argument_exception"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),l=e("angular2/src/core/facade/intl"),p=e("angular2/src/core/di"),d=e("angular2/src/core/metadata"),f=e("angular2/src/core/facade/collection"),h=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),g="en-US",m=c.RegExpWrapper.create("^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$"),y=function(){function e(){}return e._format=function(t,r,n,i,o){if(void 0===i&&(i=null),void 0===o&&(o=!1),c.isBlank(t))return null;if(!c.isNumber(t))throw new h.InvalidPipeArgumentException(e,t);var a=1,s=0,p=3;if(c.isPresent(n)){var d=c.RegExpWrapper.firstMatch(m,n);if(c.isBlank(d))throw new u.BaseException(n+" is not a valid digit info for number pipes");c.isPresent(d[1])&&(a=c.NumberWrapper.parseIntAutoRadix(d[1])),c.isPresent(d[3])&&(s=c.NumberWrapper.parseIntAutoRadix(d[3])),c.isPresent(d[5])&&(p=c.NumberWrapper.parseIntAutoRadix(d[5]))}return l.NumberFormatter.format(t,g,r,{minimumIntegerDigits:a,minimumFractionDigits:s,maximumFractionDigits:p,currency:i,currencyAsSymbol:o})},e=a([c.CONST(),p.Injectable(),s("design:paramtypes",[])],e)}();t.NumberPipe=y;var v=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.transform=function(e,t){var r=f.ListWrapper.first(t);return y._format(e,l.NumberFormatStyle.Decimal,r)},t=a([c.CONST(),d.Pipe({name:"number"}),p.Injectable(),s("design:paramtypes",[])],t)}(y);t.DecimalPipe=v;var _=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.transform=function(e,t){var r=f.ListWrapper.first(t);return y._format(e,l.NumberFormatStyle.Percent,r)},t=a([c.CONST(),d.Pipe({name:"percent"}),p.Injectable(),s("design:paramtypes",[])],t)}(y);t.PercentPipe=_;var b=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.transform=function(e,t){var r=c.isPresent(t)&&t.length>0?t[0]:"USD",n=c.isPresent(t)&&t.length>1?t[1]:!1,i=c.isPresent(t)&&t.length>2?t[2]:null;return y._format(e,l.NumberFormatStyle.Currency,i,r,n)},t=a([c.CONST(),d.Pipe({name:"currency"}),p.Injectable(),s("design:paramtypes",[])],t)}(y);return t.CurrencyPipe=b,n.define=i,r.exports}),System.register("angular2/src/core/facade",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang");t.Type=o.Type;var a=e("angular2/src/core/facade/async");t.Observable=a.Observable,t.EventEmitter=a.EventEmitter;var s=e("angular2/src/core/facade/exceptions");return t.WrappedException=s.WrappedException,n.define=i,r.exports}),System.register("angular2/src/core/pipes/pipe_binding",["angular2/src/core/di/binding","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/di/binding"),s=e("angular2/src/core/di"),c=function(e){function t(t,r,n,i,o){e.call(this,n,i,o),this.name=t,this.pure=r}return o(t,e),t.createFromType=function(e,r){var n=new s.Binding(e,{toClass:e}),i=a.resolveBinding(n);return new t(r.name,r.pure,i.key,i.resolvedFactories,i.multiBinding)},t}(a.ResolvedBinding_);return t.PipeBinding=c,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/pipes",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(e,t){this.pipe=e,this.pure=t}return e}();return t.SelectedPipe=o,n.define=i,r.exports}),System.register("angular2/src/core/linker/view_ref",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions"],!0,function(e,t,r){function n(e){return e._view}function i(e){return c.isPresent(e)?e._protoView:null}var o=System.global,a=o.define;o.define=void 0;var s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions");t.internalView=n,t.internalProtoView=i;var l=function(){function e(){}return Object.defineProperty(e.prototype,"changeDetectorRef",{get:function(){return u.unimplemented()},set:function(e){u.unimplemented()},enumerable:!0,configurable:!0}),e}();t.ViewRef=l;var p=function(e){function t(t){e.call(this),this._view=t,this._changeDetectorRef=null}return s(t,e),Object.defineProperty(t.prototype,"render",{get:function(){return this._view.render},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"renderFragment",{get:function(){return this._view.renderFragment},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"changeDetectorRef",{get:function(){return null===this._changeDetectorRef&&(this._changeDetectorRef=this._view.changeDetector.ref),this._changeDetectorRef},enumerable:!0,configurable:!0}),t.prototype.setLocal=function(e,t){this._view.setLocal(e,t)},t}(l);t.ViewRef_=p;var d=function(){function e(){}return e}();t.ProtoViewRef=d;var f=function(e){function t(t){e.call(this),this._protoView=t}return s(t,e),t}(d);return t.ProtoViewRef_=f,o.define=a,r.exports}),System.register("angular2/src/core/render/dom/util",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return s.StringWrapper.replaceAllMapped(e,c,function(e){return"-"+e[1].toLowerCase()})}function i(e){return s.StringWrapper.replaceAllMapped(e,u,function(e){return e[1].toUpperCase()})}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/facade/lang"),c=/([A-Z])/g,u=/-([a-z])/g;return t.camelCaseToDashCase=n,t.dashCaseToCamelCase=i,o.define=a,r.exports}),System.register("angular2/src/core/linker/element_binder",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/exceptions"),s=function(){function e(e,t,r,n,i,s){if(this.index=e,this.parent=t,this.distanceToParent=r,this.protoElementInjector=n,this.componentDirective=i,this.nestedProtoView=s,o.isBlank(e))throw new a.BaseException("null index not allowed.")}return e}();return t.ElementBinder=s,n.define=i,r.exports}),System.register("angular2/src/core/render/api",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){}return e}();t.RenderProtoViewRef=o;var a=function(){function e(){}return e}();t.RenderFragmentRef=a;var s=function(){function e(){}return e}();t.RenderViewRef=s;var c=function(){function e(e,t){this.viewRef=e,this.fragmentRefs=t}return e}();t.RenderViewWithFragments=c;var u=function(){function e(){}return e}();return t.Renderer=u,n.define=i,r.exports}),System.register("angular2/src/core/linker/element_ref",["angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/facade/exceptions"),s=function(){function e(){}return Object.defineProperty(e.prototype,"nativeElement",{get:function(){return a.unimplemented()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderView",{get:function(){return a.unimplemented()},enumerable:!0,configurable:!0}),e}();t.ElementRef=s;var c=function(e){function t(t,r,n){e.call(this),this.parentView=t,this.boundElementIndex=r,this._renderer=n}return o(t,e),Object.defineProperty(t.prototype,"renderView",{get:function(){return this.parentView.render},set:function(e){a.unimplemented()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nativeElement",{get:function(){return this._renderer.getNativeElementSync(this)},enumerable:!0,configurable:!0}),t}(s);return t.ElementRef_=c,n.define=i,r.exports}),System.register("angular2/src/core/linker/template_ref",["angular2/src/core/linker/view_ref"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/linker/view_ref"),s=function(){function e(){}return e}();t.TemplateRef=s;var c=function(e){function t(t){e.call(this),this.elementRef=t}return o(t,e),t.prototype._getProtoView=function(){var e=this.elementRef,t=a.internalView(e.parentView);return t.proto.elementBinders[e.boundElementIndex-t.elementOffset].nestedProtoView},Object.defineProperty(t.prototype,"protoViewRef",{get:function(){return this._getProtoView().ref},enumerable:!0,configurable:!0}),t.prototype.hasLocal=function(e){return this._getProtoView().templateVariableBindings.has(e)},t}(s);return t.TemplateRef_=c,n.define=i,r.exports}),System.register("angular2/src/core/linker/view_pool",["angular2/src/core/di","angular2/src/core/facade/collection","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},c=e("angular2/src/core/di"),u=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/facade/lang");t.APP_VIEW_POOL_CAPACITY=l.CONST_EXPR(new c.OpaqueToken("AppViewPool.viewPoolCapacity"));var p=function(){function e(e){this._pooledViewsPerProtoView=new u.Map,this._poolCapacityPerProtoView=e}return e.prototype.getView=function(e){var t=this._pooledViewsPerProtoView.get(e);return l.isPresent(t)&&t.length>0?t.pop():null},e.prototype.returnView=function(e){var t=e.proto,r=this._pooledViewsPerProtoView.get(t);l.isBlank(r)&&(r=[],this._pooledViewsPerProtoView.set(t,r));var n=r.length<this._poolCapacityPerProtoView;return n&&r.push(e),n},e=o([c.Injectable(),s(0,c.Inject(t.APP_VIEW_POOL_CAPACITY)),a("design:paramtypes",[Object])],e)}();return t.AppViewPool=p,n.define=i,r.exports}),System.register("angular2/src/core/linker/view_listener",["angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=function(){function e(){}return e.prototype.viewCreated=function(e){},e.prototype.viewDestroyed=function(e){},e=o([s.Injectable(),a("design:paramtypes",[])],e)}();return t.AppViewListener=c,n.define=i,r.exports}),System.register("angular2/src/core/linker/view_container_ref",["angular2/src/core/facade/collection","angular2/src/core/facade/exceptions","angular2/src/core/facade/lang","angular2/src/core/linker/view_ref"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/facade/collection"),s=e("angular2/src/core/facade/exceptions"),c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/linker/view_ref"),l=function(){function e(){}return e.prototype.clear=function(){for(var e=this.length-1;e>=0;e--)this.remove(e)},Object.defineProperty(e.prototype,"length",{get:function(){return s.unimplemented()},enumerable:!0,configurable:!0}),e}();t.ViewContainerRef=l;var p=function(e){function t(t,r){e.call(this),this.viewManager=t,this.element=r}return o(t,e),t.prototype._getViews=function(){var e=this.element,t=u.internalView(e.parentView).viewContainers[e.boundElementIndex];return c.isPresent(t)?t.views:[]},t.prototype.get=function(e){return this._getViews()[e].ref},Object.defineProperty(t.prototype,"length",{get:function(){return this._getViews().length},enumerable:!0,configurable:!0}),t.prototype.createEmbeddedView=function(e,t){return void 0===t&&(t=-1),-1==t&&(t=this.length),this.viewManager.createEmbeddedViewInContainer(this.element,t,e)},t.prototype.createHostView=function(e,t,r){return void 0===e&&(e=null),void 0===t&&(t=-1),void 0===r&&(r=null),-1==t&&(t=this.length),this.viewManager.createHostViewInContainer(this.element,t,e,r)},t.prototype.insert=function(e,t){return void 0===t&&(t=-1),-1==t&&(t=this.length),this.viewManager.attachViewInContainer(this.element,t,e)},t.prototype.indexOf=function(e){return a.ListWrapper.indexOf(this._getViews(),u.internalView(e))},t.prototype.remove=function(e){void 0===e&&(e=-1),-1==e&&(e=this.length-1),this.viewManager.destroyViewInContainer(this.element,e)},t.prototype.detach=function(e){return void 0===e&&(e=-1),-1==e&&(e=this.length-1),this.viewManager.detachViewInContainer(this.element,e)},t}(l);return t.ViewContainerRef_=p,n.define=i,r.exports}),System.register("angular2/src/core/linker/interfaces",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0,function(e){e[e.OnInit=0]="OnInit",e[e.OnDestroy=1]="OnDestroy",e[e.DoCheck=2]="DoCheck",e[e.OnChanges=3]="OnChanges",e[e.AfterContentInit=4]="AfterContentInit",e[e.AfterContentChecked=5]="AfterContentChecked",e[e.AfterViewInit=6]="AfterViewInit",e[e.AfterViewChecked=7]="AfterViewChecked"}(t.LifecycleHooks||(t.LifecycleHooks={}));var o=t.LifecycleHooks;return t.LIFECYCLE_HOOKS_VALUES=[o.OnInit,o.OnDestroy,o.DoCheck,o.OnChanges,o.AfterContentInit,o.AfterContentChecked,o.AfterViewInit,o.AfterViewChecked],n.define=i,r.exports}),System.register("angular2/src/core/linker/query_list",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/async"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/collection"),a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/async"),c=function(){function e(){this._results=[],this._emitter=new s.EventEmitter}return Object.defineProperty(e.prototype,"changes",{get:function(){return this._emitter},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._results.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"first",{get:function(){return o.ListWrapper.first(this._results)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"last",{get:function(){return o.ListWrapper.last(this._results)},enumerable:!0,configurable:!0}),e.prototype.map=function(e){return this._results.map(e)},e.prototype[a.getSymbolIterator()]=function(){return this._results[a.getSymbolIterator()]()},e.prototype.toString=function(){return this._results.toString()},e.prototype.reset=function(e){this._results=e},e.prototype.notifyOnChanges=function(){this._emitter.next(this)},e}();return t.QueryList=c,n.define=i,r.exports}),System.register("angular2/src/core/linker/event_config",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang");t.EVENT_TARGET_SEPARATOR=":";var a=function(){function e(e,t,r){this.fieldName=e,this.eventName=t,this.isLongForm=r}return e.parse=function(r){var n=r,i=r,a=!1,s=r.indexOf(t.EVENT_TARGET_SEPARATOR);return s>-1&&(n=o.StringWrapper.substring(r,0,s).trim(),i=o.StringWrapper.substring(r,s+1).trim(),a=!0),new e(n,i,a)},e.prototype.getFullName=function(){return this.isLongForm?""+this.fieldName+t.EVENT_TARGET_SEPARATOR+this.eventName:this.eventName},e}();return t.EventConfig=a,n.define=i,r.exports}),System.register("angular2/src/core/linker/directive_resolver",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/metadata","angular2/src/core/reflection/reflection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),l=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/reflection/reflection"),f=function(){function e(){}return e.prototype.resolve=function(e){var t=d.reflector.annotations(s.resolveForwardRef(e));if(c.isPresent(t))for(var r=0;r<t.length;r++){var n=t[r];if(n instanceof p.DirectiveMetadata){var i=d.reflector.propMetadata(e);return this._mergeWithPropertyMetadata(n,i)}}throw new u.BaseException("No Directive annotation found on "+c.stringify(e))},e.prototype._mergeWithPropertyMetadata=function(e,t){var r=[],n=[],i={},o={};return l.StringMapWrapper.forEach(t,function(e,t){e.forEach(function(e){if(e instanceof p.InputMetadata&&r.push(c.isPresent(e.bindingPropertyName)?t+": "+e.bindingPropertyName:t),e instanceof p.OutputMetadata&&n.push(c.isPresent(e.bindingPropertyName)?t+": "+e.bindingPropertyName:t),e instanceof p.HostBindingMetadata&&(c.isPresent(e.hostPropertyName)?i["["+e.hostPropertyName+"]"]=t:i["["+t+"]"]=t),e instanceof p.HostListenerMetadata){var a=c.isPresent(e.args)?e.args.join(", "):"";i["("+e.eventName+")"]=t+"("+a+")"}e instanceof p.ContentChildrenMetadata&&(o[t]=e),e instanceof p.ViewChildrenMetadata&&(o[t]=e),e instanceof p.ContentChildMetadata&&(o[t]=e),e instanceof p.ViewChildMetadata&&(o[t]=e)})}),this._merge(e,r,n,i,o)},e.prototype._merge=function(e,t,r,n,i){var o=c.isPresent(e.inputs)?l.ListWrapper.concat(e.inputs,t):t,a=c.isPresent(e.outputs)?l.ListWrapper.concat(e.outputs,r):r,s=c.isPresent(e.host)?l.StringMapWrapper.merge(e.host,n):n,u=c.isPresent(e.queries)?l.StringMapWrapper.merge(e.queries,i):i;return 0==o.length&&c.isPresent(e.properties)&&(o=e.properties),0==a.length&&c.isPresent(e.events)&&(a=e.events),e instanceof p.ComponentMetadata?new p.ComponentMetadata({selector:e.selector,inputs:o,outputs:a,host:s,bindings:e.bindings,exportAs:e.exportAs,moduleId:e.moduleId,queries:u,changeDetection:e.changeDetection,viewBindings:e.viewBindings}):new p.DirectiveMetadata({selector:e.selector,inputs:o,outputs:a,host:s,bindings:e.bindings,exportAs:e.exportAs,moduleId:e.moduleId,queries:u})},e=o([s.Injectable(),a("design:paramtypes",[])],e)}();return t.DirectiveResolver=f,n.define=i,r.exports}),System.register("angular2/src/core/linker/view_resolver",["angular2/src/core/di","angular2/src/core/metadata/view","angular2/src/core/metadata/directives","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/reflection/reflection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);
switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/metadata/view"),u=e("angular2/src/core/metadata/directives"),l=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/facade/exceptions"),d=e("angular2/src/core/facade/collection"),f=e("angular2/src/core/reflection/reflection"),h=function(){function e(){this._cache=new d.Map}return e.prototype.resolve=function(e){var t=this._cache.get(e);return l.isBlank(t)&&(t=this._resolve(e),this._cache.set(e,t)),t},e.prototype._resolve=function(e){var t,r;if(f.reflector.annotations(e).forEach(function(e){e instanceof c.ViewMetadata&&(r=e),e instanceof u.ComponentMetadata&&(t=e)}),!l.isPresent(t)){if(l.isBlank(r))throw new p.BaseException("No View decorator found on component '"+l.stringify(e)+"'");return r}if(l.isBlank(t.template)&&l.isBlank(t.templateUrl)&&l.isBlank(r))throw new p.BaseException("Component '"+l.stringify(e)+"' must have either 'template', 'templateUrl', or '@View' set.");if(l.isPresent(t.template)&&l.isPresent(r))this._throwMixingViewAndComponent("template",e);else if(l.isPresent(t.templateUrl)&&l.isPresent(r))this._throwMixingViewAndComponent("templateUrl",e);else if(l.isPresent(t.directives)&&l.isPresent(r))this._throwMixingViewAndComponent("directives",e);else if(l.isPresent(t.pipes)&&l.isPresent(r))this._throwMixingViewAndComponent("pipes",e);else if(l.isPresent(t.encapsulation)&&l.isPresent(r))this._throwMixingViewAndComponent("encapsulation",e);else if(l.isPresent(t.styles)&&l.isPresent(r))this._throwMixingViewAndComponent("styles",e);else{if(!l.isPresent(t.styleUrls)||!l.isPresent(r))return l.isPresent(r)?r:new c.ViewMetadata({templateUrl:t.templateUrl,template:t.template,directives:t.directives,pipes:t.pipes,encapsulation:t.encapsulation,styles:t.styles,styleUrls:t.styleUrls});this._throwMixingViewAndComponent("styleUrls",e)}return null},e.prototype._throwMixingViewAndComponent=function(e,t){throw new p.BaseException("Component '"+l.stringify(t)+"' cannot have both '"+e+"' and '@View' set at the same time\"")},e=o([s.Injectable(),a("design:paramtypes",[])],e)}();return t.ViewResolver=h,n.define=i,r.exports}),System.register("angular2/src/core/linker/pipe_resolver",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/metadata","angular2/src/core/reflection/reflection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),l=e("angular2/src/core/metadata"),p=e("angular2/src/core/reflection/reflection"),d=function(){function e(){}return e.prototype.resolve=function(e){var t=p.reflector.annotations(s.resolveForwardRef(e));if(c.isPresent(t))for(var r=0;r<t.length;r++){var n=t[r];if(n instanceof l.PipeMetadata)return n}throw new u.BaseException("No Pipe decorator found on "+c.stringify(e))},e=o([s.Injectable(),a("design:paramtypes",[])],e)}();return t.PipeResolver=d,n.define=i,r.exports}),System.register("angular2/src/core/linker/template_commands",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(){return y++}function i(e,t,r){return new C(e,t,r)}function o(e,t){return new E(e,t)}function a(e,t,r,n,i,o,a){return new R(e,t,r,n,i,o,a)}function s(){return new S}function c(e,t,r,n,i,o,a,s){return new x(e,t,r,n,i,o,a,s)}function u(){return new P}function l(e,t,r,n,i,o,a){return new D(e,t,r,n,i,o,a)}function p(e,t,r){void 0===r&&(r=null);for(var n=0;n<t.length;n++)t[n].visit(e,r)}var d=System.global,f=d.define;d.define=void 0;var h=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},g=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},m=e("angular2/src/core/facade/lang"),y=0;t.nextTemplateId=n;var v=function(){function e(e){this._templateGetter=e}return e.prototype.getTemplate=function(){return this._templateGetter()},e=h([m.CONST(),g("design:paramtypes",[Function])],e)}();t.CompiledHostTemplate=v;var _=function(){function e(e,t){this.id=e,this._dataGetter=t}return e.prototype.getData=function(e){var t=this._dataGetter(e,this.id);return new b(t[0],t[1],t[2])},e}();t.CompiledTemplate=_;var b=function(){function e(e,t,r){this.changeDetectorFactory=e,this.commands=t,this.styles=r}return e}();t.CompiledTemplateData=b;var w=m.CONST_EXPR([]),C=function(){function e(e,t,r){this.value=e,this.isBound=t,this.ngContentIndex=r}return e.prototype.visit=function(e,t){return e.visitText(this,t)},e}();t.TextCmd=C,t.text=i;var E=function(){function e(e,t){this.index=e,this.ngContentIndex=t,this.isBound=!1}return e.prototype.visit=function(e,t){return e.visitNgContent(this,t)},e}();t.NgContentCmd=E,t.ngContent=o;var R=function(){function e(e,t,r,n,i,o,a){this.name=e,this.attrNameAndValues=t,this.eventTargetAndNames=r,this.variableNameAndValues=n,this.directives=i,this.isBound=o,this.ngContentIndex=a}return e.prototype.visit=function(e,t){return e.visitBeginElement(this,t)},e}();t.BeginElementCmd=R,t.beginElement=a;var S=function(){function e(){}return e.prototype.visit=function(e,t){return e.visitEndElement(t)},e}();t.EndElementCmd=S,t.endElement=s;var x=function(){function e(e,t,r,n,i,o,a,s){this.name=e,this.attrNameAndValues=t,this.eventTargetAndNames=r,this.variableNameAndValues=n,this.directives=i,this.nativeShadow=o,this.ngContentIndex=a,this.template=s,this.isBound=!0,this.templateId=s.id}return e.prototype.visit=function(e,t){return e.visitBeginComponent(this,t)},e}();t.BeginComponentCmd=x,t.beginComponent=c;var P=function(){function e(){}return e.prototype.visit=function(e,t){return e.visitEndComponent(t)},e}();t.EndComponentCmd=P,t.endComponent=u;var D=function(){function e(e,t,r,n,i,o,a){this.attrNameAndValues=e,this.variableNameAndValues=t,this.directives=r,this.isMerged=n,this.ngContentIndex=i,this.changeDetectorFactory=o,this.children=a,this.isBound=!0,this.name=null,this.eventTargetAndNames=w}return e.prototype.visit=function(e,t){return e.visitEmbeddedTemplate(this,t)},e}();return t.EmbeddedTemplateCmd=D,t.embeddedTemplate=l,t.visitAllCommands=p,d.define=f,r.exports}),System.register("angular2/src/core/dom/dom_adapter",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){a.isBlank(t.DOM)&&(t.DOM=e)}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang");t.setRootDomAdapter=n;var s=function(){function e(){}return e}();return t.DomAdapter=s,i.define=o,r.exports}),System.register("angular2/src/core/render/dom/dom_tokens",["angular2/src/core/di","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/di"),a=e("angular2/src/core/facade/lang");return t.DOCUMENT=a.CONST_EXPR(new o.OpaqueToken("DocumentToken")),n.define=i,r.exports}),System.register("angular2/src/animate/css_animation_options",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){this.classesToAdd=[],this.classesToRemove=[],this.animationClasses=[]}return e}();return t.CssAnimationOptions=o,n.define=i,r.exports}),System.register("angular2/src/core/facade/math",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang");return t.Math=o.global.Math,t.NaN=typeof t.NaN,n.define=i,r.exports}),System.register("angular2/src/animate/browser_details",["angular2/src/core/di","angular2/src/core/facade/math","angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/math"),u=e("angular2/src/core/dom/dom_adapter"),l=function(){function e(){this.elapsedTimeIncludesDelay=!1,this.doesElapsedTimeIncludesDelay()}return e.prototype.doesElapsedTimeIncludesDelay=function(){var e=this,t=u.DOM.createElement("div");u.DOM.setAttribute(t,"style","position: absolute; top: -9999px; left: -9999px; width: 1px;\n height: 1px; transition: all 1ms linear 1ms;"),this.raf(function(r){u.DOM.on(t,"transitionend",function(r){var n=c.Math.round(1e3*r.elapsedTime);e.elapsedTimeIncludesDelay=2==n,u.DOM.remove(t)}),u.DOM.setStyle(t,"width","2px")},2)},e.prototype.raf=function(e,t){void 0===t&&(t=1);var r=new p(e,t);return function(){return r.cancel()}},e=o([s.Injectable(),a("design:paramtypes",[])],e)}();t.BrowserDetails=l;var p=function(){function e(e,t){this.callback=e,this.frames=t,this._raf()}return e.prototype._raf=function(){var e=this;this.currentFrameId=u.DOM.requestAnimationFrame(function(t){return e._nextFrame(t)})},e.prototype._nextFrame=function(e){this.frames--,this.frames>0?this._raf():this.callback(e)},e.prototype.cancel=function(){u.DOM.cancelAnimationFrame(this.currentFrameId),this.currentFrameId=null},e}();return n.define=i,r.exports}),System.register("angular2/src/core/zone/ng_zone",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/profile/profile"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/collection"),a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/profile/profile"),c=function(){function e(e){var t=e.enableLongStackTrace;this._runScope=s.wtfCreateScope("NgZone#run()"),this._microtaskScope=s.wtfCreateScope("NgZone#microtask()"),this._inVmTurnDone=!1,this._pendingTimeouts=[],this._onTurnStart=null,this._onTurnDone=null,this._onEventDone=null,this._onErrorHandler=null,this._pendingMicrotasks=0,this._hasExecutedCodeInInnerZone=!1,this._nestedRun=0,a.global.zone?(this._disabled=!1,this._mountZone=a.global.zone,this._innerZone=this._createInnerZone(this._mountZone,t)):(this._disabled=!0,this._mountZone=null)}return e.prototype.overrideOnTurnStart=function(e){this._onTurnStart=a.normalizeBlank(e)},e.prototype.overrideOnTurnDone=function(e){this._onTurnDone=a.normalizeBlank(e)},e.prototype.overrideOnEventDone=function(e,t){var r=this;void 0===t&&(t=!1);var n=a.normalizeBlank(e);this._onEventDone=t?function(){r._pendingTimeouts.length||n()}:n},e.prototype.overrideOnErrorHandler=function(e){this._onErrorHandler=a.normalizeBlank(e)},e.prototype.run=function(e){if(this._disabled)return e();var t=this._runScope();try{return this._innerZone.run(e)}finally{s.wtfLeave(t)}},e.prototype.runOutsideAngular=function(e){return this._disabled?e():this._mountZone.run(e)},e.prototype._createInnerZone=function(e,t){var r,n=this._microtaskScope,i=this;return r=t?o.StringMapWrapper.merge(Zone.longStackTraceZone,{onError:function(e){i._onError(this,e)}}):{onError:function(e){i._onError(this,e)}},e.fork(r).fork({$run:function(e){return function(){try{return i._nestedRun++,i._hasExecutedCodeInInnerZone||(i._hasExecutedCodeInInnerZone=!0,i._onTurnStart&&e.call(i._innerZone,i._onTurnStart)),e.apply(this,arguments)}finally{if(i._nestedRun--,0==i._pendingMicrotasks&&0==i._nestedRun&&!this._inVmTurnDone){if(i._onTurnDone&&i._hasExecutedCodeInInnerZone)try{this._inVmTurnDone=!0,e.call(i._innerZone,i._onTurnDone)}finally{this._inVmTurnDone=!1,i._hasExecutedCodeInInnerZone=!1}0===i._pendingMicrotasks&&a.isPresent(i._onEventDone)&&i.runOutsideAngular(i._onEventDone)}}}},$scheduleMicrotask:function(e){return function(t){i._pendingMicrotasks++;var r=function(){var e=n();try{t()}finally{i._pendingMicrotasks--,s.wtfLeave(e)}};e.call(this,r)}},$setTimeout:function(e){return function(t,r){for(var n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];var s,c=function(){t(),o.ListWrapper.remove(i._pendingTimeouts,s)};return s=e(c,r,n),i._pendingTimeouts.push(s),s}},$clearTimeout:function(e){return function(t){e(t),o.ListWrapper.remove(i._pendingTimeouts,t)}},_innerZone:!0})},e.prototype._onError=function(e,t){if(!a.isPresent(this._onErrorHandler))throw console.log("## _onError ##"),console.log(t.stack),t;for(var r=[a.normalizeBlank(t.stack)];e&&e.constructedAtException;)r.push(e.constructedAtException.get()),e=e.parent;this._onErrorHandler(t,r)},e}();return t.NgZone=c,n.define=i,r.exports}),System.register("angular2/src/core/render/view",["angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/render/api"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/render/api"),l=function(e){function t(t){e.call(this),this.cmds=t}return o(t,e),t}(u.RenderProtoViewRef);t.DefaultProtoViewRef=l;var p=function(e){function t(t){e.call(this),this.nodes=t}return o(t,e),t}(u.RenderFragmentRef);t.DefaultRenderFragmentRef=p;var d=function(e){function t(t,r,n,i,o){e.call(this),this.fragments=t,this.boundTextNodes=r,this.boundElements=n,this.nativeShadowRoots=i,this.globalEventAdders=o,this.hydrated=!1,this.eventDispatcher=null,this.globalEventRemovers=null}return o(t,e),t.prototype.hydrate=function(){if(this.hydrated)throw new a.BaseException("The view is already hydrated.");this.hydrated=!0,this.globalEventRemovers=s.ListWrapper.createFixedSize(this.globalEventAdders.length);for(var e=0;e<this.globalEventAdders.length;e++)this.globalEventRemovers[e]=this.globalEventAdders[e]()},t.prototype.dehydrate=function(){if(!this.hydrated)throw new a.BaseException("The view is already dehydrated.");for(var e=0;e<this.globalEventRemovers.length;e++)this.globalEventRemovers[e]();this.globalEventRemovers=null,this.hydrated=!1},t.prototype.setEventDispatcher=function(e){this.eventDispatcher=e},t.prototype.dispatchRenderEvent=function(e,t,r){var n=!0;if(c.isPresent(this.eventDispatcher)){var i=new s.Map;i.set("$event",r),n=this.eventDispatcher.dispatchRenderEvent(e,t,i)}return n},t}(u.RenderViewRef);return t.DefaultRenderView=d,n.define=i,r.exports}),System.register("angular2/src/core/application_tokens",["angular2/src/core/di","angular2/src/core/facade/lang"],!0,function(e,t,r){function n(){return""+i()+i()+i()}function i(){return c.StringWrapper.fromCharCode(97+c.Math.floor(25*c.Math.random()))}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/lang");return t.APP_COMPONENT_REF_PROMISE=c.CONST_EXPR(new s.OpaqueToken("Promise<ComponentRef>")),t.APP_COMPONENT=c.CONST_EXPR(new s.OpaqueToken("AppComponent")),t.APP_ID=c.CONST_EXPR(new s.OpaqueToken("AppId")),t.APP_ID_RANDOM_BINDING=c.CONST_EXPR(new s.Binding(t.APP_ID,{toFactory:n,deps:[]})),o.define=a,r.exports}),System.register("angular2/src/core/compiler/selector",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/collection"),a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/exceptions"),c="",u=a.RegExpWrapper.create("(\\:not\\()|([-\\w]+)|(?:\\.([-\\w]+))|(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|(\\))|(\\s*,\\s*)"),l=function(){function e(){this.element=null,this.classNames=[],this.attrs=[],this.notSelectors=[]}return e.parse=function(t){for(var r,n=[],i=function(e,t){t.notSelectors.length>0&&a.isBlank(t.element)&&o.ListWrapper.isEmpty(t.classNames)&&o.ListWrapper.isEmpty(t.attrs)&&(t.element="*"),e.push(t)},c=new e,l=a.RegExpWrapper.matcher(u,t),p=c,d=!1;a.isPresent(r=a.RegExpMatcherWrapper.next(l));){if(a.isPresent(r[1])){if(d)throw new s.BaseException("Nesting :not is not allowed in a selector");d=!0,p=new e,c.notSelectors.push(p)}if(a.isPresent(r[2])&&p.setElement(r[2]),a.isPresent(r[3])&&p.addClassName(r[3]),a.isPresent(r[4])&&p.addAttribute(r[4],r[5]),a.isPresent(r[6])&&(d=!1,p=c),a.isPresent(r[7])){if(d)throw new s.BaseException("Multiple selectors in :not are not supported");i(n,c),c=p=new e}}return i(n,c),n},e.prototype.isElementSelector=function(){return a.isPresent(this.element)&&o.ListWrapper.isEmpty(this.classNames)&&o.ListWrapper.isEmpty(this.attrs)&&0===this.notSelectors.length},e.prototype.setElement=function(e){void 0===e&&(e=null),a.isPresent(e)&&(e=e.toLowerCase()),this.element=e},e.prototype.getMatchingElementTemplate=function(){for(var e=a.isPresent(this.element)?this.element:"div",t=this.classNames.length>0?' class="'+this.classNames.join(" ")+'"':"",r="",n=0;n<this.attrs.length;n+=2){var i=this.attrs[n],o=""!==this.attrs[n+1]?'="'+this.attrs[n+1]+'"':"";r+=" "+i+o}return"<"+e+t+r+"></"+e+">"},e.prototype.addAttribute=function(e,t){void 0===t&&(t=c),this.attrs.push(e.toLowerCase()),t=a.isPresent(t)?t.toLowerCase():c,this.attrs.push(t)},e.prototype.addClassName=function(e){this.classNames.push(e.toLowerCase())},e.prototype.toString=function(){var e="";if(a.isPresent(this.element)&&(e+=this.element),a.isPresent(this.classNames))for(var t=0;t<this.classNames.length;t++)e+="."+this.classNames[t];if(a.isPresent(this.attrs))for(var t=0;t<this.attrs.length;){var r=this.attrs[t++],n=this.attrs[t++];e+="["+r,n.length>0&&(e+="="+n),e+="]"}return this.notSelectors.forEach(function(t){return e+=":not("+t+")"}),e},e}();t.CssSelector=l;var p=function(){function e(){this._elementMap=new o.Map,this._elementPartialMap=new o.Map,this._classMap=new o.Map,this._classPartialMap=new o.Map,this._attrValueMap=new o.Map,this._attrValuePartialMap=new o.Map,this._listContexts=[]}return e.createNotMatcher=function(t){var r=new e;return r.addSelectables(t,null),r},e.prototype.addSelectables=function(e,t){var r=null;e.length>1&&(r=new d(e),this._listContexts.push(r));for(var n=0;n<e.length;n++)this._addSelectable(e[n],t,r)},e.prototype._addSelectable=function(e,t,r){var n=this,i=e.element,s=e.classNames,c=e.attrs,u=new f(e,t,r);if(a.isPresent(i)){var l=0===c.length&&0===s.length;l?this._addTerminal(n._elementMap,i,u):n=this._addPartial(n._elementPartialMap,i)}if(a.isPresent(s))for(var p=0;p<s.length;p++){var l=0===c.length&&p===s.length-1,d=s[p];l?this._addTerminal(n._classMap,d,u):n=this._addPartial(n._classPartialMap,d)}if(a.isPresent(c))for(var p=0;p<c.length;){var l=p===c.length-2,h=c[p++],g=c[p++];if(l){var m=n._attrValueMap,y=m.get(h);a.isBlank(y)&&(y=new o.Map,m.set(h,y)),this._addTerminal(y,g,u)}else{var v=n._attrValuePartialMap,_=v.get(h);a.isBlank(_)&&(_=new o.Map,v.set(h,_)),n=this._addPartial(_,g)}}},e.prototype._addTerminal=function(e,t,r){var n=e.get(t);a.isBlank(n)&&(n=[],e.set(t,n)),n.push(r)},e.prototype._addPartial=function(t,r){var n=t.get(r);return a.isBlank(n)&&(n=new e,t.set(r,n)),n},e.prototype.match=function(e,t){for(var r=!1,n=e.element,i=e.classNames,o=e.attrs,s=0;s<this._listContexts.length;s++)this._listContexts[s].alreadyMatched=!1;if(r=this._matchTerminal(this._elementMap,n,e,t)||r,r=this._matchPartial(this._elementPartialMap,n,e,t)||r,a.isPresent(i))for(var u=0;u<i.length;u++){var l=i[u];r=this._matchTerminal(this._classMap,l,e,t)||r,r=this._matchPartial(this._classPartialMap,l,e,t)||r}if(a.isPresent(o))for(var u=0;u<o.length;){var p=o[u++],d=o[u++],f=this._attrValueMap.get(p);a.StringWrapper.equals(d,c)||(r=this._matchTerminal(f,c,e,t)||r),r=this._matchTerminal(f,d,e,t)||r;var h=this._attrValuePartialMap.get(p);a.StringWrapper.equals(d,c)||(r=this._matchPartial(h,c,e,t)||r),r=this._matchPartial(h,d,e,t)||r}return r},e.prototype._matchTerminal=function(e,t,r,n){if(a.isBlank(e)||a.isBlank(t))return!1;var i=e.get(t),o=e.get("*");if(a.isPresent(o)&&(i=i.concat(o)),a.isBlank(i))return!1;for(var s,c=!1,u=0;u<i.length;u++)s=i[u],c=s.finalize(r,n)||c;return c},e.prototype._matchPartial=function(e,t,r,n){if(a.isBlank(e)||a.isBlank(t))return!1;var i=e.get(t);return a.isBlank(i)?!1:i.match(r,n)},e}();t.SelectorMatcher=p;var d=function(){function e(e){this.selectors=e,this.alreadyMatched=!1}return e}();t.SelectorListContext=d;var f=function(){function e(e,t,r){this.selector=e,this.cbContext=t,this.listContext=r,this.notSelectors=e.notSelectors}return e.prototype.finalize=function(e,t){var r=!0;if(this.notSelectors.length>0&&(a.isBlank(this.listContext)||!this.listContext.alreadyMatched)){var n=p.createNotMatcher(this.notSelectors);r=!n.match(e,null)}return r&&a.isPresent(t)&&(a.isBlank(this.listContext)||!this.listContext.alreadyMatched)&&(a.isPresent(this.listContext)&&(this.listContext.alreadyMatched=!0),t(this.selector,this.cbContext)),r},e}();return t.SelectorContext=f,n.define=i,r.exports}),System.register("angular2/src/core/compiler/util",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return y.StringWrapper.replaceAllMapped(e,v,function(e){return"-"+e[1].toLowerCase()})}function i(e){return y.StringWrapper.replaceAllMapped(e,_,function(e){return e[1].toUpperCase()})}function o(e){return y.isBlank(e)?null:"'"+s(e,b)+"'"}function a(e){return y.isBlank(e)?null:'"'+s(e,w)+'"'}function s(e,r){return y.StringWrapper.replaceAllMapped(e,r,function(e){return"$"==e[0]?t.IS_DART?"\\$":"$":"\n"==e[0]?"\\n":"\\"+e[0]})}function c(e,r){void 0===r&&(r=!1);var n=t.IS_DART&&r?"const "+e:"var "+e;return t.IS_DART?n+" = ":n+" = exports['"+e+"'] = "}function u(e){return(t.IS_DART?"..addAll":".concat")+"("+e+")"}function l(e,r){return t.IS_DART?".map( ("+e.join(",")+") => "+r+" ).toList()":".map(function("+e.join(",")+") { return "+r+"; })"}function p(e,r){return t.IS_DART?".replaceAll('"+e+"', "+r+")":".replace(/"+e+"/g, "+r+")"}function d(e,r,n){return void 0===n&&(n=""),t.IS_DART?n+"("+e.join(",")+") => "+r:"function "+n+"("+e.join(",")+") { return "+r+"; }"}function f(e){return t.IS_DART?"'${"+e+"}'":e}function h(e,t){var r=y.StringWrapper.split(e.trim(),/\s*:\s*/g);return r.length>1?r:t}var g=System.global,m=g.define;g.define=void 0;var y=e("angular2/src/core/facade/lang"),v=/([A-Z])/g,_=/-([a-z])/g,b=/'|\\|\n|\$/g,w=/"|\\|\n|\$/g;return t.IS_DART=!y.isJsObject({}),t.MODULE_SUFFIX=t.IS_DART?".dart":".js",t.camelCaseToDashCase=n,t.dashCaseToCamelCase=i,t.escapeSingleQuoteString=o,t.escapeDoubleQuoteString=a,t.codeGenExportVariable=c,t.codeGenConcatArray=u,t.codeGenMapArray=l,t.codeGenReplaceAll=p,t.codeGenValueFn=d,t.codeGenToString=f,t.splitAtColon=h,g.define=m,r.exports}),System.register("angular2/src/core/compiler/source_module",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return"#MODULE["+e+"]"}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=/#MODULE\[([^\]]*)\]/g;t.moduleRef=n;var c=function(){function e(e,t){this.moduleUrl=e,this.sourceWithModuleRefs=t}return e.prototype.getSourceWithImports=function(){var e=this,t={},r=[],n=a.StringWrapper.replaceAllMapped(this.sourceWithModuleRefs,s,function(n){var i=n[1],o=t[i];return a.isBlank(o)&&(i==e.moduleUrl?o="":(o="import"+r.length,r.push([i,o])),t[i]=o),o.length>0?o+".":""});return new p(n,r)},e}();t.SourceModule=c;var u=function(){function e(e,t){this.declarations=e,this.expression=t}return e}();t.SourceExpression=u;var l=function(){function e(e,t){this.declarations=e,this.expressions=t}return e}();t.SourceExpressions=l;var p=function(){function e(e,t){this.source=e,this.imports=t}return e}();return t.SourceWithImports=p,i.define=o,r.exports}),System.register("angular2/src/core/compiler/template_ast",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e,t,r){void 0===r&&(r=null);var n=[];return t.forEach(function(t){var i=t.visit(e,r);a.isPresent(i)&&n.push(i)}),n}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=function(){function e(e,t,r){this.value=e,this.ngContentIndex=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitText(this,t)},e}();t.TextAst=s;var c=function(){function e(e,t,r){this.value=e,this.ngContentIndex=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitBoundText(this,t)},e}();t.BoundTextAst=c;var u=function(){function e(e,t,r){this.name=e,this.value=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitAttr(this,t)},e}();t.AttrAst=u;var l=function(){function e(e,t,r,n,i){this.name=e,this.type=t,this.value=r,this.unit=n,this.sourceInfo=i}return e.prototype.visit=function(e,t){return e.visitElementProperty(this,t)},e}();t.BoundElementPropertyAst=l;var p=function(){function e(e,t,r,n){this.name=e,this.target=t,this.handler=r,this.sourceInfo=n}return e.prototype.visit=function(e,t){return e.visitEvent(this,t)},Object.defineProperty(e.prototype,"fullName",{get:function(){return a.isPresent(this.target)?this.target+":"+this.name:this.name},enumerable:!0,configurable:!0}),e}();t.BoundEventAst=p;var d=function(){function e(e,t,r){this.name=e,this.value=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitVariable(this,t)},e}();t.VariableAst=d;var f=function(){function e(e,t,r,n,i,o,a,s,c){this.name=e,this.attrs=t,this.inputs=r,this.outputs=n,this.exportAsVars=i,this.directives=o,this.children=a,this.ngContentIndex=s,this.sourceInfo=c}return e.prototype.visit=function(e,t){return e.visitElement(this,t)},e.prototype.isBound=function(){return this.inputs.length>0||this.outputs.length>0||this.exportAsVars.length>0||this.directives.length>0},e.prototype.getComponent=function(){return this.directives.length>0&&this.directives[0].directive.isComponent?this.directives[0].directive:null},e}();t.ElementAst=f;var h=function(){function e(e,t,r,n,i,o){this.attrs=e,this.vars=t,this.directives=r,this.children=n,this.ngContentIndex=i,this.sourceInfo=o}return e.prototype.visit=function(e,t){return e.visitEmbeddedTemplate(this,t)},e}();t.EmbeddedTemplateAst=h;var g=function(){function e(e,t,r,n){this.directiveName=e,this.templateName=t,this.value=r,this.sourceInfo=n}return e.prototype.visit=function(e,t){return e.visitDirectiveProperty(this,t)},e}();t.BoundDirectivePropertyAst=g;var m=function(){function e(e,t,r,n,i,o){this.directive=e,this.inputs=t,this.hostProperties=r,this.hostEvents=n,this.exportAsVars=i,this.sourceInfo=o}return e.prototype.visit=function(e,t){return e.visitDirective(this,t)},e}();t.DirectiveAst=m;var y=function(){function e(e,t,r){this.index=e,this.ngContentIndex=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitNgContent(this,t)},e}();return t.NgContentAst=y,function(e){e[e.Property=0]="Property",e[e.Attribute=1]="Attribute",e[e.Class=2]="Class",e[e.Style=3]="Style"}(t.PropertyBindingType||(t.PropertyBindingType={})),t.PropertyBindingType,t.templateVisitAll=n,i.define=o,r.exports}),System.register("angular2/src/transform/template_compiler/change_detector_codegen",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(e){}return e.prototype.generate=function(e,t,r){throw"Not implemented in JS"},e.prototype.toString=function(){throw"Not implemented in JS"},e}();return t.Codegen=o,n.define=i,r.exports}),System.register("angular2/src/core/compiler/xhr",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){}return e.prototype.get=function(e){return null},e}();return t.XHR=o,n.define=i,r.exports}),System.register("angular2/src/core/compiler/shadow_css",["angular2/src/core/dom/dom_adapter","angular2/src/core/facade/collection","angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return s.DOM.cssToRules(e)}function i(e,t){if(!u.isBlank(t)){var r=n(e);t(r)}}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/dom/dom_adapter"),c=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/facade/lang"),l=function(){function e(){this.strictStyling=!0}return e.prototype.shimStyle=function(e,t,r){void 0===r&&(r="");var n=s.DOM.getText(e);return this.shimCssText(n,t,r)},e.prototype.shimCssText=function(e,t,r){return void 0===r&&(r=""),e=this._insertDirectives(e),this._scopeCssText(e,t,r)},e.prototype._insertDirectives=function(e){return e=this._insertPolyfillDirectivesInCssText(e),this._insertPolyfillRulesInCssText(e)},e.prototype._insertPolyfillDirectivesInCssText=function(e){return u.StringWrapper.replaceAllMapped(e,p,function(e){return e[1]+"{"})},e.prototype._insertPolyfillRulesInCssText=function(e){return u.StringWrapper.replaceAllMapped(e,d,function(e){var t=e[0];return t=u.StringWrapper.replace(t,e[1],""),t=u.StringWrapper.replace(t,e[2],""),e[3]+t})},e.prototype._scopeCssText=function(e,t,r){var n=this,o=this._extractUnscopedRulesFromCssText(e);return e=this._insertPolyfillHostInCssText(e),e=this._convertColonHost(e),e=this._convertColonHostContext(e),e=this._convertShadowDOMSelectors(e),u.isPresent(t)&&i(e,function(i){e=n._scopeRules(i,t,r)}),e=e+"\n"+o,e.trim()},e.prototype._extractUnscopedRulesFromCssText=function(e){for(var t,r="",n=u.RegExpWrapper.matcher(f,e);u.isPresent(t=u.RegExpMatcherWrapper.next(n));){var i=t[0];i=u.StringWrapper.replace(i,t[2],""),i=u.StringWrapper.replace(i,t[1],t[3]),r+=i+"\n\n"}return r},e.prototype._convertColonHost=function(e){return this._convertColonRule(e,y,this._colonHostPartReplacer)},e.prototype._convertColonHostContext=function(e){return this._convertColonRule(e,v,this._colonHostContextPartReplacer)},e.prototype._convertColonRule=function(e,t,r){return u.StringWrapper.replaceAllMapped(e,t,function(e){if(u.isPresent(e[2])){for(var t=e[2].split(","),n=[],i=0;i<t.length;i++){var o=t[i];if(u.isBlank(o))break;o=o.trim(),n.push(r(_,o,e[3]))}return n.join(",")}return _+e[3]})},e.prototype._colonHostContextPartReplacer=function(e,t,r){return u.StringWrapper.contains(t,h)?this._colonHostPartReplacer(e,t,r):e+t+r+", "+t+" "+e+r},e.prototype._colonHostPartReplacer=function(e,t,r){return e+u.StringWrapper.replace(t,h,"")+r},e.prototype._convertShadowDOMSelectors=function(e){for(var t=0;t<b.length;t++)e=u.StringWrapper.replaceAll(e,b[t]," ");return e},e.prototype._scopeRules=function(e,t,r){var n="";if(u.isPresent(e))for(var i=0;i<e.length;i++){var o=e[i];if(s.DOM.isStyleRule(o)||s.DOM.isPageRule(o))n+=this._scopeSelector(o.selectorText,t,r,this.strictStyling)+" {\n",n+=this._propertiesFromRule(o)+"\n}\n\n";else if(s.DOM.isMediaRule(o))n+="@media "+o.media.mediaText+" {\n",n+=this._scopeRules(o.cssRules,t,r),n+="\n}\n\n";else try{u.isPresent(o.cssText)&&(n+=o.cssText+"\n\n")}catch(a){s.DOM.isKeyframesRule(o)&&u.isPresent(o.cssRules)&&(n+=this._ieSafeCssTextFromKeyFrameRule(o))}}return n},e.prototype._ieSafeCssTextFromKeyFrameRule=function(e){
for(var t="@keyframes "+e.name+" {",r=0;r<e.cssRules.length;r++){var n=e.cssRules[r];t+=" "+n.keyText+" {"+n.style.cssText+"}"}return t+=" }"},e.prototype._scopeSelector=function(e,t,r,n){for(var i=[],o=e.split(","),a=0;a<o.length;a++){var s=o[a];s=s.trim(),this._selectorNeedsScoping(s,t)&&(s=n&&!u.StringWrapper.contains(s,_)?this._applyStrictSelectorScope(s,t):this._applySelectorScope(s,t,r)),i.push(s)}return i.join(", ")},e.prototype._selectorNeedsScoping=function(e,t){var r=this._makeScopeMatcher(t);return!u.isPresent(u.RegExpWrapper.firstMatch(r,e))},e.prototype._makeScopeMatcher=function(e){var t=/\[/g,r=/\]/g;return e=u.StringWrapper.replaceAll(e,t,"\\["),e=u.StringWrapper.replaceAll(e,r,"\\]"),u.RegExpWrapper.create("^("+e+")"+w,"m")},e.prototype._applySelectorScope=function(e,t,r){return this._applySimpleSelectorScope(e,t,r)},e.prototype._applySimpleSelectorScope=function(e,t,r){if(u.isPresent(u.RegExpWrapper.firstMatch(C,e))){var n=this.strictStyling?"["+r+"]":t;return e=u.StringWrapper.replace(e,_,n),u.StringWrapper.replaceAll(e,C,n+" ")}return t+" "+e},e.prototype._applyStrictSelectorScope=function(e,t){var r=/\[is=([^\]]*)\]/g;t=u.StringWrapper.replaceAllMapped(t,r,function(e){return e[1]});for(var n=[" ",">","+","~"],i=e,o="["+t+"]",a=0;a<n.length;a++){var s=n[a],l=i.split(s);i=l.map(function(e){var t=u.StringWrapper.replaceAll(e.trim(),C,"");if(t.length>0&&!c.ListWrapper.contains(n,t)&&!u.StringWrapper.contains(t,o)){var r=/([^:]*)(:*)(.*)/g,i=u.RegExpWrapper.firstMatch(r,t);u.isPresent(i)&&(e=i[1]+o+i[2]+i[3])}return e}).join(s)}return i},e.prototype._insertPolyfillHostInCssText=function(e){return e=u.StringWrapper.replaceAll(e,R,g),e=u.StringWrapper.replaceAll(e,E,h)},e.prototype._propertiesFromRule=function(e){var t=e.style.cssText,r=/['"]+|attr/g;if(e.style.content.length>0&&!u.isPresent(u.RegExpWrapper.firstMatch(r,e.style.content))){var n=/content:[^;]*;/g;t=u.StringWrapper.replaceAll(t,n,"content: '"+e.style.content+"';")}return t},e}();t.ShadowCss=l;var p=/polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim,d=/(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,f=/(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,h="-shadowcsshost",g="-shadowcsscontext",m=")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)",y=u.RegExpWrapper.create("("+h+m,"im"),v=u.RegExpWrapper.create("("+g+m,"im"),_=h+"-no-combinator",b=[/>>>/g,/::shadow/g,/::content/g,/\/deep\//g,/\/shadow-deep\//g,/\/shadow\//g],w="([>\\s~+[.,{:][\\s\\S]*)?$",C=u.RegExpWrapper.create(h,"im"),E=/:host/gim,R=/:host-context/gim;return o.define=a,r.exports}),System.register("angular2/src/core/compiler/url_resolver",["angular2/src/core/di","angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e,t,r,n,i,o,a){var s=[];return f.isPresent(e)&&s.push(e+":"),f.isPresent(r)&&(s.push("//"),f.isPresent(t)&&s.push(t+"@"),s.push(r),f.isPresent(n)&&s.push(":"+n)),f.isPresent(i)&&s.push(i),f.isPresent(o)&&s.push("?"+o),f.isPresent(a)&&s.push("#"+a),s.join("")}function i(e){return f.RegExpWrapper.firstMatch(m,e)}function o(e){if("/"==e)return"/";for(var t="/"==e[0]?"/":"",r="/"===e[e.length-1]?"/":"",n=e.split("/"),i=[],o=0,a=0;a<n.length;a++){var s=n[a];switch(s){case"":case".":break;case"..":i.length>0?i.pop():o++;break;default:i.push(s)}}if(""==t){for(;o-->0;)i.unshift("..");0===i.length&&i.push(".")}return t+i.join("/")+r}function a(e){var t=e[g.Path];return t=f.isBlank(t)?"":o(t),e[g.Path]=t,n(e[g.Scheme],e[g.UserInfo],e[g.Domain],e[g.Port],t,e[g.QueryData],e[g.Fragment])}function s(e,t){var r=i(encodeURI(t)),n=i(e);if(f.isPresent(r[g.Scheme]))return a(r);r[g.Scheme]=n[g.Scheme];for(var o=g.Scheme;o<=g.Port;o++)f.isBlank(r[o])&&(r[o]=n[o]);if("/"==r[g.Path][0])return a(r);var s=n[g.Path];f.isBlank(s)&&(s="/");var c=s.lastIndexOf("/");return s=s.substring(0,c+1)+r[g.Path],r[g.Path]=s,a(r)}var c=System.global,u=c.define;c.define=void 0;var l=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},p=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},d=e("angular2/src/core/di"),f=e("angular2/src/core/facade/lang"),h=function(){function e(){}return e.prototype.resolve=function(e,t){return s(e,t)},e=l([d.Injectable(),p("design:paramtypes",[])],e)}();t.UrlResolver=h;var g,m=f.RegExpWrapper.create("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([\\w\\d\\-\\u0100-\\uffff.%]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$");return function(e){e[e.Scheme=1]="Scheme",e[e.UserInfo=2]="UserInfo",e[e.Domain=3]="Domain",e[e.Port=4]="Port",e[e.Path=5]="Path",e[e.QueryData=6]="QueryData",e[e.Fragment=7]="Fragment"}(g||(g={})),c.define=u,r.exports}),System.register("angular2/src/core/compiler/style_url_resolver",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e,t,r){var n=[];return r=i(e,t,r,n),r=o(e,t,r),new u(r,n)}function i(e,t,r,n){return c.StringWrapper.replaceAllMapped(r,p,function(r){var i=c.isPresent(r[1])?r[1]:r[2],o=c.RegExpWrapper.firstMatch(h,i);return c.isPresent(o)&&"package"!=o[1]?r[0]:(n.push(e.resolve(t,i)),"")})}function o(e,t,r){return c.StringWrapper.replaceAllMapped(r,l,function(r){var n=r[1],i=r[2];if(c.RegExpWrapper.test(f,i))return r[0];var o=c.StringWrapper.replaceAll(i,d,""),a=r[3],s=e.resolve(t,o);return n+"'"+s+"'"+a})}var a=System.global,s=a.define;a.define=void 0;var c=e("angular2/src/core/facade/lang");t.resolveStyleUrls=n;var u=function(){function e(e,t){this.style=e,this.styleUrls=t}return e}();t.StyleWithImports=u;var l=/(url\()([^)]*)(\))/g,p=/@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g,d=/['"]/g,f=/^['"]?data:/g,h=/^['"]?([a-zA-Z\-\+\.]+):/g;return a.define=s,r.exports}),System.register("angular2/src/core/compiler/command_compiler",["angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/linker/template_commands","angular2/src/core/compiler/template_ast","angular2/src/core/compiler/source_module","angular2/src/core/metadata/view","angular2/src/core/compiler/style_compiler","angular2/src/core/compiler/util","angular2/src/core/di"],!0,function(e,t,r){function n(e,t,r){return g.templateVisitAll(e,t,r),r}function i(e){for(var t=new Set,r=[],n=0;n<e.length;n+=2){var i=e[n],o=e[n+1],a=i+":"+o;f.SetWrapper.has(t,a)||(r.push(i),r.push(o),t.add(a))}return r}function o(e){return e instanceof P?e.value:d.isString(e)?_.escapeSingleQuoteString(e):d.isBlank(e)?"null":""+e}function a(e){return"["+e.map(o).join(",")+"]"}function s(e){var t=e.map(function(e){return""+m.moduleRef(e.type.moduleUrl)+e.type.name});return"["+t.join(",")+"]"}var c=System.global,u=c.define;c.define=void 0;var l=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},p=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},d=e("angular2/src/core/facade/lang"),f=e("angular2/src/core/facade/collection"),h=e("angular2/src/core/linker/template_commands"),g=e("angular2/src/core/compiler/template_ast"),m=e("angular2/src/core/compiler/source_module"),y=e("angular2/src/core/metadata/view"),v=e("angular2/src/core/compiler/style_compiler"),_=e("angular2/src/core/compiler/util"),b=e("angular2/src/core/di");t.TEMPLATE_COMMANDS_MODULE_REF=m.moduleRef("package:angular2/src/core/linker/template_commands"+_.MODULE_SUFFIX);var w="$implicit",C=function(){function e(){}return e.prototype.compileComponentRuntime=function(e,t,r,n,i,o){var a=new S(new E(e,t,r,o,i),0);return g.templateVisitAll(a,n),a.result},e.prototype.compileComponentCodeGen=function(e,t,r,n,i,o){var a=new S(new R(e,t,r,o,i),0);g.templateVisitAll(a,n);var s="["+a.result.join(",")+"]";return new m.SourceExpression([],s)},e=l([b.Injectable(),p("design:paramtypes",[])],e)}();t.CommandCompiler=C;var E=function(){function e(e,t,r,n,i){this.component=e,this.appId=t,this.templateId=r,this.componentTemplateFactory=n,this.changeDetectorFactories=i}return e.prototype._mapDirectives=function(e){return e.map(function(e){return e.type.runtime})},e.prototype._addStyleShimAttributes=function(e,t,r){var n=[];return d.isPresent(t)&&t.template.encapsulation===y.ViewEncapsulation.Emulated&&(n.push(v.shimHostAttribute(this.appId,r)),n.push("")),this.component.template.encapsulation===y.ViewEncapsulation.Emulated&&(n.push(v.shimContentAttribute(this.appId,this.templateId)),n.push("")),n.concat(e)},e.prototype.createText=function(e,t,r){return h.text(e,t,r)},e.prototype.createNgContent=function(e,t){return h.ngContent(e,t)},e.prototype.createBeginElement=function(e,t,r,n,i,o,a){return h.beginElement(e,this._addStyleShimAttributes(t,null,null),r,n,this._mapDirectives(i),o,a)},e.prototype.createEndElement=function(){return h.endElement()},e.prototype.createBeginComponent=function(e,t,r,n,i,o,a){var s=this.componentTemplateFactory(i[0]);return h.beginComponent(e,this._addStyleShimAttributes(t,i[0],s.id),r,n,this._mapDirectives(i),o,a,s)},e.prototype.createEndComponent=function(){return h.endComponent()},e.prototype.createEmbeddedTemplate=function(e,t,r,n,i,o,a){return h.embeddedTemplate(t,r,this._mapDirectives(n),i,o,this.changeDetectorFactories[e],a)},e}(),R=function(){function e(e,t,r,n,i){this.component=e,this.appIdExpr=t,this.templateIdExpr=r,this.componentTemplateFactory=n,this.changeDetectorFactoryExpressions=i}return e.prototype._addStyleShimAttributes=function(e,t,r){var n=[];return d.isPresent(t)&&t.template.encapsulation===y.ViewEncapsulation.Emulated&&(n.push(new P(v.shimHostAttributeExpr(this.appIdExpr,r))),n.push("")),this.component.template.encapsulation===y.ViewEncapsulation.Emulated&&(n.push(new P(v.shimContentAttributeExpr(this.appIdExpr,this.templateIdExpr))),n.push("")),n.concat(e)},e.prototype.createText=function(e,r,n){return t.TEMPLATE_COMMANDS_MODULE_REF+"text("+_.escapeSingleQuoteString(e)+", "+r+", "+n+")"},e.prototype.createNgContent=function(e,r){return t.TEMPLATE_COMMANDS_MODULE_REF+"ngContent("+e+", "+r+")"},e.prototype.createBeginElement=function(e,r,n,i,o,c,u){var l=a(this._addStyleShimAttributes(r,null,null));return t.TEMPLATE_COMMANDS_MODULE_REF+"beginElement("+_.escapeSingleQuoteString(e)+", "+l+", "+a(n)+", "+a(i)+", "+s(o)+", "+c+", "+u+")"},e.prototype.createEndElement=function(){return t.TEMPLATE_COMMANDS_MODULE_REF+"endElement()"},e.prototype.createBeginComponent=function(e,r,n,i,o,c,u){var l=this.componentTemplateFactory(o[0]),p=a(this._addStyleShimAttributes(r,o[0],l+".id"));return t.TEMPLATE_COMMANDS_MODULE_REF+"beginComponent("+_.escapeSingleQuoteString(e)+", "+p+", "+a(n)+", "+a(i)+", "+s(o)+", "+c+", "+u+", "+l+")"},e.prototype.createEndComponent=function(){return t.TEMPLATE_COMMANDS_MODULE_REF+"endComponent()"},e.prototype.createEmbeddedTemplate=function(e,r,n,i,o,c,u){return t.TEMPLATE_COMMANDS_MODULE_REF+"embeddedTemplate("+a(r)+", "+a(n)+", "+(s(i)+", "+o+", "+c+", "+this.changeDetectorFactoryExpressions[e]+", ["+u.join(",")+"])")},e}(),S=function(){function e(e,t){this.commandFactory=e,this.embeddedTemplateIndex=t,this.result=[],this.transitiveNgContentCount=0}return e.prototype._readAttrNameAndValues=function(e,t){var r=n(this,t,[]);return e.forEach(function(e){f.StringMapWrapper.forEach(e.hostAttributes,function(e,t){r.push(t),r.push(e)})}),i(r)},e.prototype.visitNgContent=function(e,t){return this.transitiveNgContentCount++,this.result.push(this.commandFactory.createNgContent(e.index,e.ngContentIndex)),null},e.prototype.visitEmbeddedTemplate=function(t,r){var n=this;this.embeddedTemplateIndex++;var i=new e(this.commandFactory,this.embeddedTemplateIndex);g.templateVisitAll(i,t.children);var o=i.transitiveNgContentCount>0,a=[];t.vars.forEach(function(e){a.push(e.name),a.push(e.value.length>0?e.value:w)});var s=[];return f.ListWrapper.forEachWithIndex(t.directives,function(e,t){e.visit(n,new x(t,[],[],s))}),this.result.push(this.commandFactory.createEmbeddedTemplate(this.embeddedTemplateIndex,this._readAttrNameAndValues(s,t.attrs),a,s,o,t.ngContentIndex,i.result)),this.transitiveNgContentCount+=i.transitiveNgContentCount,this.embeddedTemplateIndex=i.embeddedTemplateIndex,null},e.prototype.visitElement=function(e,t){var r=this,o=e.getComponent(),a=n(this,e.outputs,[]),s=[];d.isBlank(o)&&e.exportAsVars.forEach(function(e){s.push(e.name),s.push(null)});var c=[];f.ListWrapper.forEachWithIndex(e.directives,function(e,t){e.visit(r,new x(t,a,s,c))}),a=i(a);var u=this._readAttrNameAndValues(c,e.attrs);return d.isPresent(o)?(this.result.push(this.commandFactory.createBeginComponent(e.name,u,a,s,c,o.template.encapsulation===y.ViewEncapsulation.Native,e.ngContentIndex)),g.templateVisitAll(this,e.children),this.result.push(this.commandFactory.createEndComponent())):(this.result.push(this.commandFactory.createBeginElement(e.name,u,a,s,c,e.isBound(),e.ngContentIndex)),g.templateVisitAll(this,e.children),this.result.push(this.commandFactory.createEndElement())),null},e.prototype.visitVariable=function(e,t){return null},e.prototype.visitAttr=function(e,t){return t.push(e.name),t.push(e.value),null},e.prototype.visitBoundText=function(e,t){return this.result.push(this.commandFactory.createText(null,!0,e.ngContentIndex)),null},e.prototype.visitText=function(e,t){return this.result.push(this.commandFactory.createText(e.value,!1,e.ngContentIndex)),null},e.prototype.visitDirective=function(e,t){return t.targetDirectives.push(e.directive),g.templateVisitAll(this,e.hostEvents,t.eventTargetAndNames),e.exportAsVars.forEach(function(e){t.targetVariableNameAndValues.push(e.name),t.targetVariableNameAndValues.push(t.index)}),null},e.prototype.visitEvent=function(e,t){return t.push(e.target),t.push(e.name),null},e.prototype.visitDirectiveProperty=function(e,t){return null},e.prototype.visitElementProperty=function(e,t){return null},e}(),x=function(){function e(e,t,r,n){this.index=e,this.eventTargetAndNames=t,this.targetVariableNameAndValues=r,this.targetDirectives=n}return e}(),P=function(){function e(e){this.value=e}return e}();return c.define=u,r.exports}),System.register("angular2/src/core/compiler/html_ast",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e,t,r){void 0===r&&(r=null);var n=[];return t.forEach(function(t){var i=t.visit(e,r);a.isPresent(i)&&n.push(i)}),n}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=function(){function e(e,t){this.value=e,this.sourceInfo=t}return e.prototype.visit=function(e,t){return e.visitText(this,t)},e}();t.HtmlTextAst=s;var c=function(){function e(e,t,r){this.name=e,this.value=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitAttr(this,t)},e}();t.HtmlAttrAst=c;var u=function(){function e(e,t,r,n){this.name=e,this.attrs=t,this.children=r,this.sourceInfo=n}return e.prototype.visit=function(e,t){return e.visitElement(this,t)},e}();return t.HtmlElementAst=u,t.htmlVisitAll=n,i.define=o,r.exports}),System.register("angular2/src/core/compiler/schema/element_schema_registry",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){}return e.prototype.hasProperty=function(e,t){return!0},e.prototype.getMappedPropName=function(e){return e},e}();return t.ElementSchemaRegistry=o,n.define=i,r.exports}),System.register("angular2/src/core/compiler/template_preparser",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){var t=null,r=null,n=null,o=!1;e.attrs.forEach(function(e){e.name==c?t=e.value:e.name==d?r=e.value:e.name==p?n=e.value:e.name==m&&(o=!0)}),t=i(t);var a=e.name,s=y.OTHER;return a==u?s=y.NG_CONTENT:a==h?s=y.STYLE:a==g?s=y.SCRIPT:a==l&&n==f&&(s=y.STYLESHEET),new v(s,t,r,o)}function i(e){return s.isBlank(e)||0===e.length?"*":e}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/facade/lang"),c="select",u="ng-content",l="link",p="rel",d="href",f="stylesheet",h="style",g="script",m="ng-non-bindable";t.preparseElement=n,function(e){e[e.NG_CONTENT=0]="NG_CONTENT",e[e.STYLE=1]="STYLE",e[e.STYLESHEET=2]="STYLESHEET",e[e.SCRIPT=3]="SCRIPT",e[e.OTHER=4]="OTHER"}(t.PreparsedElementType||(t.PreparsedElementType={}));var y=t.PreparsedElementType,v=function(){function e(e,t,r,n){this.type=e,this.selectAttr=t,this.hrefAttr=r,this.nonBindable=n}return e}();return t.PreparsedElement=v,o.define=a,r.exports}),System.register("angular2/src/core/compiler/template_normalizer",["angular2/src/core/compiler/directive_metadata","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/async","angular2/src/core/compiler/xhr","angular2/src/core/compiler/url_resolver","angular2/src/core/compiler/style_url_resolver","angular2/src/core/di","angular2/src/core/metadata/view","angular2/src/core/compiler/html_ast","angular2/src/core/compiler/html_parser","angular2/src/core/compiler/template_preparser"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/compiler/directive_metadata"),c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),l=e("angular2/src/core/facade/async"),p=e("angular2/src/core/compiler/xhr"),d=e("angular2/src/core/compiler/url_resolver"),f=e("angular2/src/core/compiler/style_url_resolver"),h=e("angular2/src/core/di"),g=e("angular2/src/core/metadata/view"),m=e("angular2/src/core/compiler/html_ast"),y=e("angular2/src/core/compiler/html_parser"),v=e("angular2/src/core/compiler/template_preparser"),_=function(){function e(e,t,r){this._xhr=e,this._urlResolver=t,this._domParser=r}return e.prototype.normalizeTemplate=function(e,t){var r=this;if(c.isPresent(t.template))return l.PromiseWrapper.resolve(this.normalizeLoadedTemplate(e,t,t.template,e.moduleUrl));if(c.isPresent(t.templateUrl)){var n=this._urlResolver.resolve(e.moduleUrl,t.templateUrl);return this._xhr.get(n).then(function(i){return r.normalizeLoadedTemplate(e,t,i,n)})}throw new u.BaseException("No template specified for component "+e.name)},e.prototype.normalizeLoadedTemplate=function(e,t,r,n){var i=this,o=this._domParser.parse(r,e.name),a=new b;m.htmlVisitAll(a,o);var c=t.styles.concat(a.styles),u=a.styleUrls.map(function(e){return i._urlResolver.resolve(n,e)}).concat(t.styleUrls.map(function(t){return i._urlResolver.resolve(e.moduleUrl,t)})),l=c.map(function(e){var t=f.resolveStyleUrls(i._urlResolver,n,e);return t.styleUrls.forEach(function(e){return u.push(e)}),t.style}),p=t.encapsulation;return p===g.ViewEncapsulation.Emulated&&0===l.length&&0===u.length&&(p=g.ViewEncapsulation.None),new s.CompileTemplateMetadata({encapsulation:p,template:r,templateUrl:n,styles:l,styleUrls:u,ngContentSelectors:a.ngContentSelectors})},e=o([h.Injectable(),a("design:paramtypes",[p.XHR,d.UrlResolver,y.HtmlParser])],e)}();t.TemplateNormalizer=_;var b=function(){function e(){this.ngContentSelectors=[],this.styles=[],this.styleUrls=[],this.ngNonBindableStackCount=0}return e.prototype.visitElement=function(e,t){var r=v.preparseElement(e);switch(r.type){case v.PreparsedElementType.NG_CONTENT:0===this.ngNonBindableStackCount&&this.ngContentSelectors.push(r.selectAttr);break;case v.PreparsedElementType.STYLE:var n="";e.children.forEach(function(e){e instanceof m.HtmlTextAst&&(n+=e.value)}),this.styles.push(n);break;case v.PreparsedElementType.STYLESHEET:this.styleUrls.push(r.hrefAttr)}return r.nonBindable&&this.ngNonBindableStackCount++,m.htmlVisitAll(this,e.children),r.nonBindable&&this.ngNonBindableStackCount--,null},e.prototype.visitAttr=function(e,t){return null},e.prototype.visitText=function(e,t){return null},e}();return n.define=i,r.exports}),System.register("angular2/src/core/compiler/runtime_metadata",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/compiler/directive_metadata","angular2/src/core/metadata/directives","angular2/src/core/linker/directive_resolver","angular2/src/core/linker/view_resolver","angular2/src/core/linker/directive_lifecycle_reflector","angular2/src/core/linker/interfaces","angular2/src/core/reflection/reflection","angular2/src/core/di","angular2/src/core/compiler/util"],!0,function(e,t,r){function n(e){var t=new Map;return e.forEach(function(e){t.set(e.type.runtime,e)}),g.MapWrapper.values(t)}function i(e){if(f.isBlank(e.directives))return[];var t=[];return o(e.directives,t),t}function o(e,t){for(var r=0;r<e.length;r++){var n=d.resolveForwardRef(e[r]);f.isArray(n)?o(n,t):t.push(n)}}function a(e){return f.isPresent(e)&&e instanceof f.Type}function s(e,t){return f.isPresent(t.moduleId)?"package:"+t.moduleId+R.MODULE_SUFFIX:C.reflector.importUri(e)}var c=System.global,u=c.define;c.define=void 0;var l=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},p=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},d=e("angular2/src/core/di"),f=e("angular2/src/core/facade/lang"),h=e("angular2/src/core/facade/exceptions"),g=e("angular2/src/core/facade/collection"),m=e("angular2/src/core/compiler/directive_metadata"),y=e("angular2/src/core/metadata/directives"),v=e("angular2/src/core/linker/directive_resolver"),_=e("angular2/src/core/linker/view_resolver"),b=e("angular2/src/core/linker/directive_lifecycle_reflector"),w=e("angular2/src/core/linker/interfaces"),C=e("angular2/src/core/reflection/reflection"),E=e("angular2/src/core/di"),R=e("angular2/src/core/compiler/util"),S=function(){function e(e,t){this._directiveResolver=e,this._viewResolver=t,this._cache=new Map}return e.prototype.getMetadata=function(e){var t=this._cache.get(e);if(f.isBlank(t)){var r=this._directiveResolver.resolve(e),n=s(e,r),i=null,o=null;if(r instanceof y.ComponentMetadata){var a=r,c=this._viewResolver.resolve(e);i=new m.CompileTemplateMetadata({encapsulation:c.encapsulation,template:c.template,templateUrl:c.templateUrl,styles:c.styles,styleUrls:c.styleUrls}),o=a.changeDetection}t=m.CompileDirectiveMetadata.create({selector:r.selector,exportAs:r.exportAs,isComponent:f.isPresent(i),dynamicLoadable:!0,type:new m.CompileTypeMetadata({name:f.stringify(e),moduleUrl:n,runtime:e}),template:i,changeDetection:o,inputs:r.inputs,outputs:r.outputs,host:r.host,lifecycleHooks:g.ListWrapper.filter(w.LIFECYCLE_HOOKS_VALUES,function(t){return b.hasLifecycleHook(t,e)})}),this._cache.set(e,t)}return t},e.prototype.getViewDirectivesMetadata=function(e){for(var t=this,r=this._viewResolver.resolve(e),o=i(r),s=0;s<o.length;s++)if(!a(o[s]))throw new h.BaseException("Unexpected directive value '"+f.stringify(o[s])+"' on the View of component '"+f.stringify(e)+"'");return n(o.map(function(e){return t.getMetadata(e)}))},e=l([E.Injectable(),p("design:paramtypes",[v.DirectiveResolver,_.ViewResolver])],e)}();return t.RuntimeMetadataResolver=S,c.define=u,r.exports}),System.register("angular2/src/core/compiler/schema/dom_element_schema_registry",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/dom/dom_adapter","angular2/src/core/compiler/schema/element_schema_registry"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/di"),u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/dom/dom_adapter"),d=e("angular2/src/core/compiler/schema/element_schema_registry"),f=function(e){function t(){e.apply(this,arguments),this._protoElements=new Map}return o(t,e),t.prototype._getProtoElement=function(e){var t=this._protoElements.get(e);return u.isBlank(t)&&(t=p.DOM.createElement(e),this._protoElements.set(e,t)),t},t.prototype.hasProperty=function(e,t){if(-1!==e.indexOf("-"))return!0;var r=this._getProtoElement(e);return p.DOM.hasProperty(r,t)},t.prototype.getMappedPropName=function(e){var t=l.StringMapWrapper.get(p.DOM.attrToPropMap,e);return u.isPresent(t)?t:e},t=a([c.Injectable(),s("design:paramtypes",[])],t)}(d.ElementSchemaRegistry);return t.DomElementSchemaRegistry=f,n.define=i,r.exports}),System.register("angular2/src/core/compiler/app_root_url",["angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=function(){function e(e){this.value=e}return e=o([s.Injectable(),a("design:paramtypes",[String])],e)}();return t.AppRootUrl=c,n.define=i,r.exports}),System.register("angular2/src/core/compiler/anchor_based_app_root_url",["angular2/src/core/compiler/app_root_url","angular2/src/core/dom/dom_adapter","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/compiler/app_root_url"),u=e("angular2/src/core/dom/dom_adapter"),l=e("angular2/src/core/di"),p=function(e){function t(){e.call(this,"");var t=u.DOM.createElement("a");u.DOM.resolveAndSetHref(t,"./",null),this.value=u.DOM.getHref(t)}return o(t,e),t=a([l.Injectable(),s("design:paramtypes",[])],t)}(c.AppRootUrl);return t.AnchorBasedAppRootUrl=p,n.define=i,r.exports}),System.register("angular2/src/core/forms/validators",["angular2/src/core/facade/lang","angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/di");t.NG_VALIDATORS=a.CONST_EXPR(new c.OpaqueToken("NgValidators"));var u=function(){function e(){}return e.required=function(e){return o.isBlank(e.value)||""==e.value?{required:!0}:null},e.nullValidator=function(e){return null},e.compose=function(t){return o.isBlank(t)?e.nullValidator:function(e){var r=s.ListWrapper.reduce(t,function(t,r){var n=r(e);return o.isPresent(n)?s.StringMapWrapper.merge(t,n):t},{});return s.StringMapWrapper.isEmpty(r)?null:r}},e.group=function(t){var r={};return s.StringMapWrapper.forEach(t.controls,function(n,i){t.contains(i)&&o.isPresent(n.errors)&&e._mergeErrors(n,r)}),s.StringMapWrapper.isEmpty(r)?null:r},e.array=function(t){var r={};return t.controls.forEach(function(t){o.isPresent(t.errors)&&e._mergeErrors(t,r)}),s.StringMapWrapper.isEmpty(r)?null:r},e._mergeErrors=function(e,t){s.StringMapWrapper.forEach(e.errors,function(r,n){s.StringMapWrapper.contains(t,n)||(t[n]=[]);var i=t[n];i.push(e)})},e}();return t.Validators=u,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/abstract_control_directive",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=function(){function e(){}return Object.defineProperty(e.prototype,"control",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return o.isPresent(this.control)?this.control.value:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valid",{get:function(){return o.isPresent(this.control)?this.control.valid:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errors",{get:function(){return o.isPresent(this.control)?this.control.errors:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pristine",{get:function(){return o.isPresent(this.control)?this.control.pristine:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dirty",{get:function(){return o.isPresent(this.control)?this.control.dirty:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touched",{get:function(){return o.isPresent(this.control)?this.control.touched:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"untouched",{get:function(){return o.isPresent(this.control)?this.control.untouched:null},enumerable:!0,configurable:!0}),e}();return t.AbstractControlDirective=a,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/control_container",["angular2/src/core/forms/directives/abstract_control_directive"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/forms/directives/abstract_control_directive"),s=function(e){function t(){e.apply(this,arguments)}return o(t,e),Object.defineProperty(t.prototype,"formDirective",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return null},enumerable:!0,configurable:!0}),t}(a.AbstractControlDirective);return t.ControlContainer=s,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_control",["angular2/src/core/forms/directives/abstract_control_directive"],!0,function(e,t,r){
var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/forms/directives/abstract_control_directive"),s=function(e){function t(){e.apply(this,arguments),this.name=null,this.valueAccessor=null}return o(t,e),Object.defineProperty(t.prototype,"validator",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return null},enumerable:!0,configurable:!0}),t.prototype.viewToModelUpdate=function(e){},t}(a.AbstractControlDirective);return t.NgControl=s,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/control_value_accessor",["angular2/src/core/facade/lang","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/di");return t.NG_VALUE_ACCESSOR=o.CONST_EXPR(new a.OpaqueToken("NgValueAccessor")),n.define=i,r.exports}),System.register("angular2/src/core/linker/dynamic_component_loader",["angular2/src/core/di","angular2/src/core/linker/compiler","angular2/src/core/facade/lang","angular2/src/core/linker/view_manager"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/di"),u=e("angular2/src/core/linker/compiler"),l=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/linker/view_manager"),d=function(){function e(){}return Object.defineProperty(e.prototype,"hostView",{get:function(){return this.location.parentView},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hostComponent",{get:function(){return this.instance},enumerable:!0,configurable:!0}),e}();t.ComponentRef=d;var f=function(e){function t(t,r,n,i,o){e.call(this),this._dispose=o,this.location=t,this.instance=r,this.componentType=n,this.injector=i}return o(t,e),Object.defineProperty(t.prototype,"hostComponentType",{get:function(){return this.componentType},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._dispose()},t}(d);t.ComponentRef_=f;var h=function(){function e(){}return e}();t.DynamicComponentLoader=h;var g=function(e){function t(t,r){e.call(this),this._compiler=t,this._viewManager=r}return o(t,e),t.prototype.loadAsRoot=function(e,t,r,n){var i=this;return this._compiler.compileInHost(e).then(function(o){var a=i._viewManager.createRootHostView(o,t,r),s=i._viewManager.getHostElement(a),c=i._viewManager.getComponent(s),u=function(){i._viewManager.destroyRootHostView(a),l.isPresent(n)&&n()};return new f(s,c,e,r,u)})},t.prototype.loadIntoLocation=function(e,t,r,n){return void 0===n&&(n=null),this.loadNextToLocation(e,this._viewManager.getNamedElementInComponentView(t,r),n)},t.prototype.loadNextToLocation=function(e,t,r){var n=this;return void 0===r&&(r=null),this._compiler.compileInHost(e).then(function(i){var o=n._viewManager.getViewContainer(t),a=o.createHostView(i,o.length,r),s=n._viewManager.getHostElement(a),c=n._viewManager.getComponent(s),u=function(){var e=o.indexOf(a);-1!==e&&o.remove(e)};return new f(s,c,e,null,u)})},t=a([c.Injectable(),s("design:paramtypes",[u.Compiler,p.AppViewManager])],t)}(h);return t.DynamicComponentLoader_=g,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/checkbox_value_accessor",["angular2/src/core/metadata","angular2/src/core/render","angular2/src/core/linker","angular2/src/core/di","angular2/src/core/forms/directives/control_value_accessor","angular2/src/core/facade/lang","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/metadata"),c=e("angular2/src/core/render"),u=e("angular2/src/core/linker"),l=e("angular2/src/core/di"),p=e("angular2/src/core/forms/directives/control_value_accessor"),d=e("angular2/src/core/facade/lang"),f=e("angular2/src/core/forms/directives/shared"),h=d.CONST_EXPR(new l.Binding(p.NG_VALUE_ACCESSOR,{toAlias:l.forwardRef(function(){return g}),multi:!0})),g=function(){function e(e,t){this._renderer=e,this._elementRef=t,this.onChange=function(e){},this.onTouched=function(){}}return e.prototype.writeValue=function(e){f.setProperty(this._renderer,this._elementRef,"checked",e)},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e=o([s.Directive({selector:"input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]",host:{"(change)":"onChange($event.target.checked)","(blur)":"onTouched()"},bindings:[h]}),a("design:paramtypes",[c.Renderer,u.ElementRef])],e)}();return t.CheckboxControlValueAccessor=g,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/select_control_value_accessor",["angular2/src/core/di","angular2/src/core/render","angular2/src/core/linker","angular2/src/core/metadata","angular2/src/core/facade/async","angular2/src/core/forms/directives/control_value_accessor","angular2/src/core/facade/lang","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},c=e("angular2/src/core/di"),u=e("angular2/src/core/render"),l=e("angular2/src/core/linker"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/facade/async"),f=e("angular2/src/core/forms/directives/control_value_accessor"),h=e("angular2/src/core/facade/lang"),g=e("angular2/src/core/forms/directives/shared"),m=h.CONST_EXPR(new c.Binding(f.NG_VALUE_ACCESSOR,{toAlias:c.forwardRef(function(){return v}),multi:!0})),y=function(){function e(){}return e=o([p.Directive({selector:"option"}),a("design:paramtypes",[])],e)}();t.NgSelectOption=y;var v=function(){function e(e,t,r){this._renderer=e,this._elementRef=t,this.onChange=function(e){},this.onTouched=function(){},this._updateValueWhenListOfOptionsChanges(r)}return e.prototype.writeValue=function(e){this.value=e,g.setProperty(this._renderer,this._elementRef,"value",e)},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype._updateValueWhenListOfOptionsChanges=function(e){var t=this;d.ObservableWrapper.subscribe(e.changes,function(e){return t.writeValue(t.value)})},e=o([p.Directive({selector:"select[ng-control],select[ng-form-control],select[ng-model]",host:{"(change)":"onChange($event.target.value)","(input)":"onChange($event.target.value)","(blur)":"onTouched()"},bindings:[m]}),s(2,p.Query(y,{descendants:!0})),a("design:paramtypes",[u.Renderer,l.ElementRef,l.QueryList])],e)}();return t.SelectControlValueAccessor=v,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_form_control",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/ng_control","angular2/src/core/forms/validators","angular2/src/core/forms/directives/control_value_accessor","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/async"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/ng_control"),h=e("angular2/src/core/forms/validators"),g=e("angular2/src/core/forms/directives/control_value_accessor"),m=e("angular2/src/core/forms/directives/shared"),y=u.CONST_EXPR(new d.Binding(f.NgControl,{toAlias:d.forwardRef(function(){return v})})),v=function(e){function t(t,r){e.call(this),this.update=new l.EventEmitter,this._added=!1,this.validators=t,this.valueAccessor=m.selectValueAccessor(this,r)}return o(t,e),t.prototype.onChanges=function(e){this._added||(m.setUpControl(this.form,this),this.form.updateValidity(),this._added=!0),m.isPropertyUpdated(e,this.viewModel)&&(this.form.updateValue(this.model),this.viewModel=this.model)},Object.defineProperty(t.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this.form},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"validator",{get:function(){return h.Validators.compose(this.validators)},enumerable:!0,configurable:!0}),t.prototype.viewToModelUpdate=function(e){this.viewModel=e,l.ObservableWrapper.callNext(this.update,e)},t=a([p.Directive({selector:"[ng-form-control]",bindings:[y],inputs:["form: ngFormControl","model: ngModel"],outputs:["update: ngModel"],exportAs:"form"}),c(0,d.Optional()),c(0,d.Inject(h.NG_VALIDATORS)),c(1,d.Optional()),c(1,d.Inject(g.NG_VALUE_ACCESSOR)),s("design:paramtypes",[Array,Array])],t)}(f.NgControl);return t.NgFormControl=v,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_model",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/control_value_accessor","angular2/src/core/forms/directives/ng_control","angular2/src/core/forms/model","angular2/src/core/forms/validators","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/async"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/control_value_accessor"),h=e("angular2/src/core/forms/directives/ng_control"),g=e("angular2/src/core/forms/model"),m=e("angular2/src/core/forms/validators"),y=e("angular2/src/core/forms/directives/shared"),v=u.CONST_EXPR(new d.Binding(h.NgControl,{toAlias:d.forwardRef(function(){return _})})),_=function(e){function t(t,r){e.call(this),this._control=new g.Control,this._added=!1,this.update=new l.EventEmitter,this.validators=t,this.valueAccessor=y.selectValueAccessor(this,r)}return o(t,e),t.prototype.onChanges=function(e){this._added||(y.setUpControl(this._control,this),this._control.updateValidity(),this._added=!0),y.isPropertyUpdated(e,this.viewModel)&&(this._control.updateValue(this.model),this.viewModel=this.model)},Object.defineProperty(t.prototype,"control",{get:function(){return this._control},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"validator",{get:function(){return m.Validators.compose(this.validators)},enumerable:!0,configurable:!0}),t.prototype.viewToModelUpdate=function(e){this.viewModel=e,l.ObservableWrapper.callNext(this.update,e)},t=a([p.Directive({selector:"[ng-model]:not([ng-control]):not([ng-form-control])",bindings:[v],inputs:["model: ngModel"],outputs:["update: ngModel"],exportAs:"form"}),c(0,d.Optional()),c(0,d.Inject(m.NG_VALIDATORS)),c(1,d.Optional()),c(1,d.Inject(f.NG_VALUE_ACCESSOR)),s("design:paramtypes",[Array,Array])],t)}(h.NgControl);return t.NgModel=_,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_control_group",["angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},u=e("angular2/src/core/metadata"),l=e("angular2/src/core/di"),p=e("angular2/src/core/facade/lang"),d=e("angular2/src/core/forms/directives/control_container"),f=e("angular2/src/core/forms/directives/shared"),h=p.CONST_EXPR(new l.Binding(d.ControlContainer,{toAlias:l.forwardRef(function(){return g})})),g=function(e){function t(t){e.call(this),this._parent=t}return o(t,e),t.prototype.onInit=function(){this.formDirective.addControlGroup(this)},t.prototype.onDestroy=function(){this.formDirective.removeControlGroup(this)},Object.defineProperty(t.prototype,"control",{get:function(){return this.formDirective.getControlGroup(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return f.controlPath(this.name,this._parent)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"formDirective",{get:function(){return this._parent.formDirective},enumerable:!0,configurable:!0}),t=a([u.Directive({selector:"[ng-control-group]",bindings:[h],inputs:["name: ng-control-group"],exportAs:"form"}),c(0,l.Host()),c(0,l.SkipSelf()),s("design:paramtypes",[d.ControlContainer])],t)}(d.ControlContainer);return t.NgControlGroup=g,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_form_model",["angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/facade/async"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/control_container"),h=e("angular2/src/core/forms/directives/shared"),g=c.CONST_EXPR(new d.Binding(f.ControlContainer,{toAlias:d.forwardRef(function(){return m})})),m=function(e){function t(){e.apply(this,arguments),this.form=null,this.directives=[],this.ngSubmit=new l.EventEmitter}return o(t,e),t.prototype.onChanges=function(e){this._updateDomValue()},Object.defineProperty(t.prototype,"formDirective",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this.form},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),t.prototype.addControl=function(e){var t=this.form.find(e.path);h.setUpControl(t,e),t.updateValidity(),this.directives.push(e)},t.prototype.getControl=function(e){return this.form.find(e.path)},t.prototype.removeControl=function(e){u.ListWrapper.remove(this.directives,e)},t.prototype.addControlGroup=function(e){},t.prototype.removeControlGroup=function(e){},t.prototype.getControlGroup=function(e){return this.form.find(e.path)},t.prototype.updateModel=function(e,t){var r=this.form.find(e.path);r.updateValue(t)},t.prototype.onSubmit=function(){return l.ObservableWrapper.callNext(this.ngSubmit,null),!1},t.prototype._updateDomValue=function(){var e=this;this.directives.forEach(function(t){var r=e.form.find(t.path);t.valueAccessor.writeValue(r.value)})},t=a([p.Directive({selector:"[ng-form-model]",bindings:[g],inputs:["form: ng-form-model"],host:{"(submit)":"onSubmit()"},outputs:["ngSubmit"],exportAs:"form"}),s("design:paramtypes",[])],t)}(f.ControlContainer);return t.NgFormModel=m,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_form",["angular2/src/core/facade/async","angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/model","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/facade/async"),u=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/control_container"),h=e("angular2/src/core/forms/model"),g=e("angular2/src/core/forms/directives/shared"),m=l.CONST_EXPR(new d.Binding(f.ControlContainer,{toAlias:d.forwardRef(function(){return y})})),y=function(e){function t(){e.apply(this,arguments),this.form=new h.ControlGroup({}),this.ngSubmit=new c.EventEmitter}return o(t,e),Object.defineProperty(t.prototype,"formDirective",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this.form},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controls",{get:function(){return this.form.controls},enumerable:!0,configurable:!0}),t.prototype.addControl=function(e){var t=this;this._later(function(r){var n=t._findContainer(e.path),i=new h.Control;g.setUpControl(i,e),n.addControl(e.name,i),i.updateValidity()})},t.prototype.getControl=function(e){return this.form.find(e.path)},t.prototype.removeControl=function(e){var t=this;this._later(function(r){var n=t._findContainer(e.path);l.isPresent(n)&&(n.removeControl(e.name),n.updateValidity())})},t.prototype.addControlGroup=function(e){var t=this;this._later(function(r){var n=t._findContainer(e.path),i=new h.ControlGroup({});n.addControl(e.name,i),i.updateValidity()})},t.prototype.removeControlGroup=function(e){var t=this;this._later(function(r){var n=t._findContainer(e.path);l.isPresent(n)&&(n.removeControl(e.name),n.updateValidity())})},t.prototype.getControlGroup=function(e){return this.form.find(e.path)},t.prototype.updateModel=function(e,t){var r=this;this._later(function(n){var i=r.form.find(e.path);i.updateValue(t)})},t.prototype.onSubmit=function(){return c.ObservableWrapper.callNext(this.ngSubmit,null),!1},t.prototype._findContainer=function(e){return e.pop(),u.ListWrapper.isEmpty(e)?this.form:this.form.find(e)},t.prototype._later=function(e){c.PromiseWrapper.then(c.PromiseWrapper.resolve(null),e,function(e){})},t=a([p.Directive({selector:"form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]",bindings:[m],host:{"(submit)":"onSubmit()"},outputs:["ngSubmit"],exportAs:"form"}),s("design:paramtypes",[])],t)}(f.ControlContainer);return t.NgForm=y,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_control_status",["angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/ng_control","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},c=e("angular2/src/core/metadata"),u=e("angular2/src/core/di"),l=e("angular2/src/core/forms/directives/ng_control"),p=e("angular2/src/core/facade/lang"),d=function(){function e(e){this._cd=e}return Object.defineProperty(e.prototype,"ngClassUntouched",{get:function(){return p.isPresent(this._cd.control)?this._cd.control.untouched:!1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ngClassTouched",{get:function(){return p.isPresent(this._cd.control)?this._cd.control.touched:!1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ngClassPristine",{get:function(){return p.isPresent(this._cd.control)?this._cd.control.pristine:!1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ngClassDirty",{get:function(){return p.isPresent(this._cd.control)?this._cd.control.dirty:!1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ngClassValid",{get:function(){return p.isPresent(this._cd.control)?this._cd.control.valid:!1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ngClassInvalid",{get:function(){return p.isPresent(this._cd.control)?!this._cd.control.valid:!1},enumerable:!0,configurable:!0}),e=o([c.Directive({selector:"[ng-control],[ng-model],[ng-form-control]",host:{"[class.ng-untouched]":"ngClassUntouched","[class.ng-touched]":"ngClassTouched","[class.ng-pristine]":"ngClassPristine","[class.ng-dirty]":"ngClassDirty","[class.ng-valid]":"ngClassValid","[class.ng-invalid]":"ngClassInvalid"}}),s(0,u.Self()),a("design:paramtypes",[l.NgControl])],e)}();return t.NgControlStatus=d,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/validators",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/metadata","angular2/src/core/forms/validators"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/metadata"),l=e("angular2/src/core/forms/validators"),p=c.CONST_EXPR(new s.Binding(l.NG_VALIDATORS,{toValue:l.Validators.required,multi:!0})),d=function(){function e(){}return e=o([u.Directive({selector:"[required][ng-control],[required][ng-form-control],[required][ng-model]",bindings:[p]}),a("design:paramtypes",[])],e)}();return t.DefaultValidators=d,n.define=i,r.exports}),System.register("angular2/src/core/forms/form_builder",["angular2/src/core/di","angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/forms/model"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/forms/model"),p=function(){function e(){}return e.prototype.group=function(e,t){void 0===t&&(t=null);var r=this._reduceControls(e),n=u.isPresent(t)?c.StringMapWrapper.get(t,"optionals"):null,i=u.isPresent(t)?c.StringMapWrapper.get(t,"validator"):null;return u.isPresent(i)?new l.ControlGroup(r,n,i):new l.ControlGroup(r,n)},e.prototype.control=function(e,t){return void 0===t&&(t=null),u.isPresent(t)?new l.Control(e,t):new l.Control(e)},e.prototype.array=function(e,t){var r=this;void 0===t&&(t=null);var n=e.map(function(e){return r._createControl(e)});return u.isPresent(t)?new l.ControlArray(n,t):new l.ControlArray(n)},e.prototype._reduceControls=function(e){var t=this,r={};return c.StringMapWrapper.forEach(e,function(e,n){r[n]=t._createControl(e)}),r},e.prototype._createControl=function(e){if(e instanceof l.Control||e instanceof l.ControlGroup||e instanceof l.ControlArray)return e;if(u.isArray(e)){var t=e[0],r=e.length>1?e[1]:null;return this.control(t,r)}return this.control(e)},e=o([s.Injectable(),a("design:paramtypes",[])],e)}();return t.FormBuilder=p,n.define=i,r.exports}),System.register("angular2/src/core/dom/generic_browser_adapter",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/facade/collection"),s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/dom/dom_adapter"),u=function(e){function t(){var t=this;e.call(this),this._animationPrefix=null,this._transitionEnd=null;try{var r=this.createElement("div",this.defaultDoc());if(s.isPresent(this.getStyle(r,"animationName")))this._animationPrefix="";else for(var n=["Webkit","Moz","O","ms"],i=0;i<n.length;i++)if(s.isPresent(this.getStyle(r,n[i]+"AnimationName"))){this._animationPrefix="-"+s.StringWrapper.toLowerCase(n[i])+"-";break}var o={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};a.StringMapWrapper.forEach(o,function(e,n){s.isPresent(t.getStyle(r,n))&&(t._transitionEnd=e)})}catch(c){this._animationPrefix=null,this._transitionEnd=null}}return o(t,e),t.prototype.getDistributedNodes=function(e){return e.getDistributedNodes()},t.prototype.resolveAndSetHref=function(e,t,r){e.href=null==r?t:t+"/../"+r},t.prototype.cssToRules=function(e){var t=this.createStyleElement(e);this.appendChild(this.defaultDoc().head,t);var r=[];if(s.isPresent(t.sheet))try{var n=t.sheet.cssRules;r=a.ListWrapper.createFixedSize(n.length);for(var i=0;i<n.length;i++)r[i]=n[i]}catch(o){}return this.remove(t),r},t.prototype.supportsDOMEvents=function(){return!0},t.prototype.supportsNativeShadowDOM=function(){return s.isFunction(this.defaultDoc().body.createShadowRoot)},t.prototype.supportsUnprefixedCssAnimation=function(){return s.isPresent(this.defaultDoc().body.style)&&s.isPresent(this.defaultDoc().body.style.animationName)},t.prototype.getAnimationPrefix=function(){return s.isPresent(this._animationPrefix)?this._animationPrefix:""},t.prototype.getTransitionEnd=function(){return s.isPresent(this._transitionEnd)?this._transitionEnd:""},t.prototype.supportsAnimation=function(){return s.isPresent(this._animationPrefix)&&s.isPresent(this._transitionEnd)},t}(c.DomAdapter);return t.GenericBrowserDomAdapter=u,n.define=i,r.exports}),System.register("angular2/src/core/testability/testability",["angular2/src/core/di","angular2/src/core/dom/dom_adapter","angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/zone/ng_zone","angular2/src/core/facade/async"],!0,function(e,t,r){function n(e){v=e}var i=System.global,o=i.define;i.define=void 0;var a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){
return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/di"),u=e("angular2/src/core/dom/dom_adapter"),l=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/facade/lang"),d=e("angular2/src/core/facade/exceptions"),f=e("angular2/src/core/zone/ng_zone"),h=e("angular2/src/core/facade/async"),g=function(){function e(e){this._ngZone=e,this._pendingCount=0,this._callbacks=[],this._isAngularEventPending=!1,this._watchAngularEvents(e)}return e.prototype._watchAngularEvents=function(e){var t=this;e.overrideOnTurnStart(function(){t._isAngularEventPending=!0}),e.overrideOnEventDone(function(){t._isAngularEventPending=!1,t._runCallbacksIfReady()},!0)},e.prototype.increasePendingRequestCount=function(){return this._pendingCount+=1,this._pendingCount},e.prototype.decreasePendingRequestCount=function(){if(this._pendingCount-=1,this._pendingCount<0)throw new d.BaseException("pending async requests below zero");return this._runCallbacksIfReady(),this._pendingCount},e.prototype.isStable=function(){return 0==this._pendingCount&&!this._isAngularEventPending},e.prototype._runCallbacksIfReady=function(){var e=this;this.isStable()&&h.PromiseWrapper.resolve(null).then(function(t){for(;0!==e._callbacks.length;)e._callbacks.pop()()})},e.prototype.whenStable=function(e){this._callbacks.push(e),this._runCallbacksIfReady()},e.prototype.getPendingRequestCount=function(){return this._pendingCount},e.prototype.isAngularEventPending=function(){return this._isAngularEventPending},e.prototype.findBindings=function(e,t,r){return[]},e=a([c.Injectable(),s("design:paramtypes",[f.NgZone])],e)}();t.Testability=g;var m=function(){function e(){this._applications=new l.Map,v.addToWindow(this)}return e.prototype.registerApplication=function(e,t){this._applications.set(e,t)},e.prototype.getAllTestabilities=function(){return l.MapWrapper.values(this._applications)},e.prototype.findTestabilityInTree=function(e,t){return void 0===t&&(t=!0),null==e?null:this._applications.has(e)?this._applications.get(e):t?this.findTestabilityInTree(u.DOM.isShadowRoot(e)?u.DOM.getHost(e):u.DOM.parentElement(e)):null},e=a([c.Injectable(),s("design:paramtypes",[])],e)}();t.TestabilityRegistry=m;var y=function(){function e(){}return e.prototype.addToWindow=function(e){},e=a([p.CONST(),s("design:paramtypes",[])],e)}();t.setTestabilityGetter=n;var v=p.CONST_EXPR(new y);return i.define=o,r.exports}),System.register("angular2/src/core/compiler/xhr_impl",["angular2/src/core/di","angular2/src/core/facade/async","angular2/src/core/facade/lang","angular2/src/core/compiler/xhr"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/di"),u=e("angular2/src/core/facade/async"),l=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/compiler/xhr"),d=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.get=function(e){var t=u.PromiseWrapper.completer(),r=new XMLHttpRequest;return r.open("GET",e,!0),r.responseType="text",r.onload=function(){var n=l.isPresent(r.response)?r.response:r.responseText,i=1223===r.status?204:r.status;0===i&&(i=n?200:0),i>=200&&300>=i?t.resolve(n):t.reject("Failed to load "+e,null)},r.onerror=function(){t.reject("Failed to load "+e,null)},r.send(),t.promise},t=a([c.Injectable(),s("design:paramtypes",[])],t)}(p.XHR);return t.XHRImpl=d,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/events/key_events",["angular2/src/core/dom/dom_adapter","angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/render/dom/events/event_manager","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/dom/dom_adapter"),u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/render/dom/events/event_manager"),d=e("angular2/src/core/di"),f=["alt","control","meta","shift"],h={alt:function(e){return e.altKey},control:function(e){return e.ctrlKey},meta:function(e){return e.metaKey},shift:function(e){return e.shiftKey}},g=function(e){function t(){e.call(this)}return o(t,e),t.prototype.supports=function(e){return u.isPresent(t.parseEventName(e))},t.prototype.addEventListener=function(e,r,n){var i=t.parseEventName(r),o=t.eventCallback(e,l.StringMapWrapper.get(i,"fullKey"),n,this.manager.getZone());this.manager.getZone().runOutsideAngular(function(){c.DOM.on(e,l.StringMapWrapper.get(i,"domEventName"),o)})},t.parseEventName=function(e){var r=e.toLowerCase().split("."),n=r.shift();if(0===r.length||!u.StringWrapper.equals(n,"keydown")&&!u.StringWrapper.equals(n,"keyup"))return null;var i=t._normalizeKey(r.pop()),o="";if(f.forEach(function(e){l.ListWrapper.contains(r,e)&&(l.ListWrapper.remove(r,e),o+=e+".")}),o+=i,0!=r.length||0===i.length)return null;var a=l.StringMapWrapper.create();return l.StringMapWrapper.set(a,"domEventName",n),l.StringMapWrapper.set(a,"fullKey",o),a},t.getEventFullKey=function(e){var t="",r=c.DOM.getEventKey(e);return r=r.toLowerCase(),u.StringWrapper.equals(r," ")?r="space":u.StringWrapper.equals(r,".")&&(r="dot"),f.forEach(function(n){if(n!=r){var i=l.StringMapWrapper.get(h,n);i(e)&&(t+=n+".")}}),t+=r},t.eventCallback=function(e,r,n,i){return function(e){u.StringWrapper.equals(t.getEventFullKey(e),r)&&i.run(function(){return n(e)})}},t._normalizeKey=function(e){switch(e){case"esc":return"escape";default:return e}},t=a([d.Injectable(),s("design:paramtypes",[])],t)}(p.EventManagerPlugin);return t.KeyEventsPlugin=g,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/events/hammer_common",["angular2/src/core/render/dom/events/event_manager","angular2/src/core/facade/collection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/render/dom/events/event_manager"),s=e("angular2/src/core/facade/collection"),c={pan:!0,panstart:!0,panmove:!0,panend:!0,pancancel:!0,panleft:!0,panright:!0,panup:!0,pandown:!0,pinch:!0,pinchstart:!0,pinchmove:!0,pinchend:!0,pinchcancel:!0,pinchin:!0,pinchout:!0,press:!0,pressup:!0,rotate:!0,rotatestart:!0,rotatemove:!0,rotateend:!0,rotatecancel:!0,swipe:!0,swipeleft:!0,swiperight:!0,swipeup:!0,swipedown:!0,tap:!0},u=function(e){function t(){e.call(this)}return o(t,e),t.prototype.supports=function(e){return e=e.toLowerCase(),s.StringMapWrapper.contains(c,e)},t}(a.EventManagerPlugin);return t.HammerGesturesPluginCommon=u,n.define=i,r.exports}),System.register("angular2/src/core/platform_bindings",["angular2/src/core/di","angular2/src/core/facade/exceptions","angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/di"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/dom/dom_adapter");return t.EXCEPTION_BINDING=o.bind(a.ExceptionHandler).toFactory(function(){return new a.ExceptionHandler(s.DOM,!1)},[]),n.define=i,r.exports}),System.register("angular2/src/core/profile/wtf_init",[],!0,function(e,t,r){function n(){}var i=System.global,o=i.define;return i.define=void 0,t.wtfInit=n,i.define=o,r.exports}),System.register("angular2/src/core/life_cycle/life_cycle",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/profile/profile"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/di"),u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/profile/profile"),d=function(){function e(){}return e}();t.LifeCycle=d;var f=function(e){function t(t,r){void 0===t&&(t=null),void 0===r&&(r=!1),e.call(this),this._runningTick=!1,this._changeDetectors=[],u.isPresent(t)&&this._changeDetectors.push(t),this._enforceNoNewChanges=r}return o(t,e),t.prototype.registerWith=function(e,t){var r=this;void 0===t&&(t=null),u.isPresent(t)&&this._changeDetectors.push(t),e.overrideOnTurnDone(function(){return r.tick()})},t.prototype.tick=function(){if(this._runningTick)throw new l.BaseException("LifeCycle.tick is called recursively");var e=t._tickScope();try{this._runningTick=!0,this._changeDetectors.forEach(function(e){return e.detectChanges()}),this._enforceNoNewChanges&&this._changeDetectors.forEach(function(e){return e.checkNoChanges()})}finally{this._runningTick=!1,p.wtfLeave(e)}},t._tickScope=p.wtfCreateScope("LifeCycle#tick()"),t=a([c.Injectable(),s("design:paramtypes",[Object,Boolean])],t)}(d);return t.LifeCycle_=f,n.define=i,r.exports}),System.register("angular2/src/core/bootstrap",["angular2/src/core/application"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/application");return t.bootstrap=o.bootstrap,n.define=i,r.exports}),System.register("angular2/src/core/services/title",["angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/dom/dom_adapter"),a=function(){function e(){}return e.prototype.getTitle=function(){return o.DOM.getTitle()},e.prototype.setTitle=function(e){o.DOM.setTitle(e)},e}();return t.Title=a,n.define=i,r.exports}),System.register("angular2/src/core/lifecycle",["angular2/src/core/life_cycle/life_cycle"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/life_cycle/life_cycle");return t.LifeCycle=o.LifeCycle,n.define=i,r.exports}),System.register("angular2/src/core/zone",["angular2/src/core/zone/ng_zone"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/zone/ng_zone");return t.NgZone=o.NgZone,n.define=i,r.exports}),System.register("angular2/src/core/directives/ng_class",["angular2/src/core/facade/lang","angular2/src/core/metadata","angular2/src/core/linker","angular2/src/core/change_detection","angular2/src/core/render","angular2/src/core/facade/collection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/metadata"),u=e("angular2/src/core/linker"),l=e("angular2/src/core/change_detection"),p=e("angular2/src/core/render"),d=e("angular2/src/core/facade/collection"),f=function(){function e(e,t,r,n){this._iterableDiffers=e,this._keyValueDiffers=t,this._ngEl=r,this._renderer=n,this._initialClasses=[]}return Object.defineProperty(e.prototype,"initialClasses",{set:function(e){this._applyInitialClasses(!0),this._initialClasses=s.isPresent(e)&&s.isString(e)?e.split(" "):[],this._applyInitialClasses(!1),this._applyClasses(this._rawClass,!1)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rawClass",{set:function(e){this._cleanupClasses(this._rawClass),s.isString(e)&&(e=e.split(" ")),this._rawClass=e,s.isPresent(e)?d.isListLikeIterable(e)?(this._differ=this._iterableDiffers.find(e).create(null),this._mode="iterable"):(this._differ=this._keyValueDiffers.find(e).create(null),this._mode="keyValue"):this._differ=null},enumerable:!0,configurable:!0}),e.prototype.doCheck=function(){if(s.isPresent(this._differ)){var e=this._differ.diff(this._rawClass);s.isPresent(e)&&("iterable"==this._mode?this._applyIterableChanges(e):this._applyKeyValueChanges(e))}},e.prototype.onDestroy=function(){this._cleanupClasses(this._rawClass)},e.prototype._cleanupClasses=function(e){this._applyClasses(e,!0),this._applyInitialClasses(!1)},e.prototype._applyKeyValueChanges=function(e){var t=this;e.forEachAddedItem(function(e){t._toggleClass(e.key,e.currentValue)}),e.forEachChangedItem(function(e){t._toggleClass(e.key,e.currentValue)}),e.forEachRemovedItem(function(e){e.previousValue&&t._toggleClass(e.key,!1)})},e.prototype._applyIterableChanges=function(e){var t=this;e.forEachAddedItem(function(e){t._toggleClass(e.item,!0)}),e.forEachRemovedItem(function(e){t._toggleClass(e.item,!1)})},e.prototype._applyInitialClasses=function(e){var t=this;this._initialClasses.forEach(function(r){return t._toggleClass(r,!e)})},e.prototype._applyClasses=function(e,t){var r=this;s.isPresent(e)&&(d.isListLikeIterable(e)?e.forEach(function(e){return r._toggleClass(e,!t)}):d.StringMapWrapper.forEach(e,function(e,n){e&&r._toggleClass(n,!t)}))},e.prototype._toggleClass=function(e,t){e=e.trim(),e.length>0&&this._renderer.setElementClass(this._ngEl,e,t)},e=o([c.Directive({selector:"[ng-class]",inputs:["rawClass: ng-class","initialClasses: class"]}),a("design:paramtypes",[l.IterableDiffers,l.KeyValueDiffers,u.ElementRef,p.Renderer])],e)}();return t.NgClass=f,n.define=i,r.exports}),System.register("angular2/src/core/directives/ng_for",["angular2/src/core/metadata","angular2/src/core/change_detection","angular2/src/core/linker","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/metadata"),c=e("angular2/src/core/change_detection"),u=e("angular2/src/core/linker"),l=e("angular2/src/core/facade/lang"),p=function(){function e(e,t,r,n){this._viewContainer=e,this._templateRef=t,this._iterableDiffers=r,this._cdr=n}return Object.defineProperty(e.prototype,"ngForOf",{set:function(e){this._ngForOf=e,l.isBlank(this._differ)&&l.isPresent(e)&&(this._differ=this._iterableDiffers.find(e).create(this._cdr))},enumerable:!0,configurable:!0}),e.prototype.doCheck=function(){if(l.isPresent(this._differ)){var e=this._differ.diff(this._ngForOf);l.isPresent(e)&&this._applyChanges(e)}},e.prototype._applyChanges=function(e){var t=[];e.forEachRemovedItem(function(e){return t.push(new d(e,null))}),e.forEachMovedItem(function(e){return t.push(new d(e,null))});var r=this._bulkRemove(t);e.forEachAddedItem(function(e){return r.push(new d(e,null))}),this._bulkInsert(r);for(var n=0;n<r.length;n++)this._perViewChange(r[n].view,r[n].record);for(var n=0,i=this._viewContainer.length;i>n;n++)this._viewContainer.get(n).setLocal("last",n===i-1)},e.prototype._perViewChange=function(e,t){e.setLocal("$implicit",t.item),e.setLocal("index",t.currentIndex),e.setLocal("even",t.currentIndex%2==0),e.setLocal("odd",t.currentIndex%2==1)},e.prototype._bulkRemove=function(e){e.sort(function(e,t){return e.record.previousIndex-t.record.previousIndex});for(var t=[],r=e.length-1;r>=0;r--){var n=e[r];l.isPresent(n.record.currentIndex)?(n.view=this._viewContainer.detach(n.record.previousIndex),t.push(n)):this._viewContainer.remove(n.record.previousIndex)}return t},e.prototype._bulkInsert=function(e){e.sort(function(e,t){return e.record.currentIndex-t.record.currentIndex});for(var t=0;t<e.length;t++){var r=e[t];l.isPresent(r.view)?this._viewContainer.insert(r.view,r.record.currentIndex):r.view=this._viewContainer.createEmbeddedView(this._templateRef,r.record.currentIndex)}return e},e=o([s.Directive({selector:"[ng-for][ng-for-of]",inputs:["ngForOf"]}),a("design:paramtypes",[u.ViewContainerRef,u.TemplateRef,c.IterableDiffers,c.ChangeDetectorRef])],e)}();t.NgFor=p;var d=function(){function e(e,t){this.record=e,this.view=t}return e}();return n.define=i,r.exports}),System.register("angular2/src/core/directives/ng_if",["angular2/src/core/metadata","angular2/src/core/linker","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/metadata"),c=e("angular2/src/core/linker"),u=e("angular2/src/core/facade/lang"),l=function(){function e(e,t){this._viewContainer=e,this._templateRef=t,this._prevCondition=null}return Object.defineProperty(e.prototype,"ngIf",{set:function(e){!e||!u.isBlank(this._prevCondition)&&this._prevCondition?e||!u.isBlank(this._prevCondition)&&!this._prevCondition||(this._prevCondition=!1,this._viewContainer.clear()):(this._prevCondition=!0,this._viewContainer.createEmbeddedView(this._templateRef))},enumerable:!0,configurable:!0}),e=o([s.Directive({selector:"[ng-if]",inputs:["ngIf"]}),a("design:paramtypes",[c.ViewContainerRef,c.TemplateRef])],e)}();return t.NgIf=l,n.define=i,r.exports}),System.register("angular2/src/core/directives/ng_style",["angular2/src/core/change_detection","angular2/src/core/linker","angular2/src/core/metadata","angular2/src/core/render","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/change_detection"),c=e("angular2/src/core/linker"),u=e("angular2/src/core/metadata"),l=e("angular2/src/core/render"),p=e("angular2/src/core/facade/lang"),d=function(){function e(e,t,r){this._differs=e,this._ngEl=t,this._renderer=r}return Object.defineProperty(e.prototype,"rawStyle",{set:function(e){this._rawStyle=e,p.isBlank(this._differ)&&p.isPresent(e)&&(this._differ=this._differs.find(this._rawStyle).create(null))},enumerable:!0,configurable:!0}),e.prototype.doCheck=function(){if(p.isPresent(this._differ)){var e=this._differ.diff(this._rawStyle);p.isPresent(e)&&this._applyChanges(e)}},e.prototype._applyChanges=function(e){var t=this;e.forEachAddedItem(function(e){t._setStyle(e.key,e.currentValue)}),e.forEachChangedItem(function(e){t._setStyle(e.key,e.currentValue)}),e.forEachRemovedItem(function(e){t._setStyle(e.key,null)})},e.prototype._setStyle=function(e,t){this._renderer.setElementStyle(this._ngEl,e,t)},e=o([u.Directive({selector:"[ng-style]",inputs:["rawStyle: ng-style"]}),a("design:paramtypes",[s.KeyValueDiffers,c.ElementRef,l.Renderer])],e)}();return t.NgStyle=d,n.define=i,r.exports}),System.register("angular2/src/core/directives/ng_switch",["angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/linker","angular2/src/core/facade/lang","angular2/src/core/facade/collection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},c=e("angular2/src/core/metadata"),u=e("angular2/src/core/di"),l=e("angular2/src/core/linker"),p=e("angular2/src/core/facade/lang"),d=e("angular2/src/core/facade/collection"),f=p.CONST_EXPR(new Object),h=function(){function e(e,t){this._viewContainerRef=e,this._templateRef=t}return e.prototype.create=function(){this._viewContainerRef.createEmbeddedView(this._templateRef)},e.prototype.destroy=function(){this._viewContainerRef.clear()},e}();t.SwitchView=h;var g=function(){function e(){this._useDefault=!1,this._valueViews=new d.Map,this._activeViews=[]}return Object.defineProperty(e.prototype,"ngSwitch",{set:function(e){this._emptyAllActiveViews(),this._useDefault=!1;var t=this._valueViews.get(e);p.isBlank(t)&&(this._useDefault=!0,t=p.normalizeBlank(this._valueViews.get(f))),this._activateViews(t),this._switchValue=e},enumerable:!0,configurable:!0}),e.prototype._onWhenValueChanged=function(e,t,r){this._deregisterView(e,r),this._registerView(t,r),e===this._switchValue?(r.destroy(),d.ListWrapper.remove(this._activeViews,r)):t===this._switchValue&&(this._useDefault&&(this._useDefault=!1,this._emptyAllActiveViews()),r.create(),this._activeViews.push(r)),0!==this._activeViews.length||this._useDefault||(this._useDefault=!0,this._activateViews(this._valueViews.get(f)))},e.prototype._emptyAllActiveViews=function(){for(var e=this._activeViews,t=0;t<e.length;t++)e[t].destroy();this._activeViews=[]},e.prototype._activateViews=function(e){if(p.isPresent(e)){for(var t=0;t<e.length;t++)e[t].create();this._activeViews=e}},e.prototype._registerView=function(e,t){var r=this._valueViews.get(e);p.isBlank(r)&&(r=[],this._valueViews.set(e,r)),r.push(t)},e.prototype._deregisterView=function(e,t){if(e!==f){var r=this._valueViews.get(e);1==r.length?this._valueViews["delete"](e):d.ListWrapper.remove(r,t)}},e=o([c.Directive({selector:"[ng-switch]",inputs:["ngSwitch"]}),a("design:paramtypes",[])],e)}();t.NgSwitch=g;var m=function(){function e(e,t,r){this._switch=r,this._value=f,this._view=new h(e,t)}return Object.defineProperty(e.prototype,"ngSwitchWhen",{set:function(e){this._switch._onWhenValueChanged(this._value,e,this._view),this._value=e},enumerable:!0,configurable:!0}),e=o([c.Directive({selector:"[ng-switch-when]",inputs:["ngSwitchWhen"]}),s(2,u.Host()),a("design:paramtypes",[l.ViewContainerRef,l.TemplateRef,g])],e)}();t.NgSwitchWhen=m;var y=function(){function e(e,t,r){r._registerView(f,new h(e,t))}return e=o([c.Directive({selector:"[ng-switch-default]"}),s(2,u.Host()),a("design:paramtypes",[l.ViewContainerRef,l.TemplateRef,g])],e)}();return t.NgSwitchDefault=y,n.define=i,r.exports}),System.register("angular2/src/core/directives/observable_list_diff",[],!0,function(e,t,r){var n=System.global,i=n.define;return n.define=void 0,n.define=i,r.exports}),System.register("angular2/src/core/debug/debug_element",["angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/facade/exceptions","angular2/src/core/dom/dom_adapter","angular2/src/core/linker/view_ref"],!0,function(e,t,r){function n(e){return new h(d.internalView(e.parentView),e.boundElementIndex)}function i(e){return e.map(function(e){return e.nativeElement})}var o=System.global,a=o.define;o.define=void 0;var s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/dom/dom_adapter"),d=e("angular2/src/core/linker/view_ref"),f=function(){function e(){}return Object.defineProperty(e.prototype,"componentInstance",{get:function(){return l.unimplemented()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nativeElement",{get:function(){return l.unimplemented()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"elementRef",{get:function(){return l.unimplemented()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return l.unimplemented()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"componentViewChildren",{get:function(){return l.unimplemented()},enumerable:!0,configurable:!0}),e.prototype.query=function(e,t){void 0===t&&(t=g.all);var r=this.queryAll(e,t);return r.length>0?r[0]:null},e.prototype.queryAll=function(e,t){void 0===t&&(t=g.all);var r=t(this);return u.ListWrapper.filter(r,e)},e}();t.DebugElement=f;var h=function(e){function t(t,r){e.call(this),this._parentView=t,this._boundElementIndex=r,this._elementInjector=this._parentView.elementInjectors[this._boundElementIndex]}return s(t,e),Object.defineProperty(t.prototype,"componentInstance",{get:function(){return c.isPresent(this._elementInjector)?this._elementInjector.getComponent():null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"nativeElement",{get:function(){return this.elementRef.nativeElement},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"elementRef",{get:function(){return this._parentView.elementRefs[this._boundElementIndex]},enumerable:!0,configurable:!0}),t.prototype.getDirectiveInstance=function(e){return this._elementInjector.getDirectiveAtIndex(e)},Object.defineProperty(t.prototype,"children",{get:function(){return this._getChildElements(this._parentView,this._boundElementIndex)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"componentViewChildren",{get:function(){var e=this._parentView.getNestedView(this._boundElementIndex);return c.isPresent(e)?this._getChildElements(e,null):[]},enumerable:!0,configurable:!0}),t.prototype.triggerEventHandler=function(e,t){this._parentView.triggerEventHandlers(e,t,this._boundElementIndex)},t.prototype.hasDirective=function(e){return c.isPresent(this._elementInjector)?this._elementInjector.hasDirective(e):!1},t.prototype.inject=function(e){return c.isPresent(this._elementInjector)?this._elementInjector.get(e):null},t.prototype.getLocal=function(e){return this._parentView.locals.get(e)},t.prototype._getChildElements=function(e,r){var n=this,i=[],o=null;c.isPresent(r)&&(o=e.proto.elementBinders[r-e.elementOffset]);for(var a=0;a<e.proto.elementBinders.length;++a){var s=e.proto.elementBinders[a];if(s.parent==o){i.push(new t(e,e.elementOffset+a));var u=e.viewContainers[e.elementOffset+a];c.isPresent(u)&&u.views.forEach(function(e){i=i.concat(n._getChildElements(e,null))})}}return i},t}(f);t.DebugElement_=h,t.inspectElement=n,t.asNativeElements=i;var g=function(){function e(){}return e.all=function(t){var r=[];return r.push(t),t.children.forEach(function(t){return r=r.concat(e.all(t))}),t.componentViewChildren.forEach(function(t){return r=r.concat(e.all(t))}),r},e.light=function(t){var r=[];return t.children.forEach(function(t){r.push(t),r=r.concat(e.light(t))}),r},e.view=function(t){var r=[];return t.componentViewChildren.forEach(function(t){r.push(t),r=r.concat(e.light(t))}),r},e}();t.Scope=g;var m=function(){function e(){}return e.all=function(){return function(e){return!0}},e.css=function(e){return function(t){return c.isPresent(t.nativeElement)?p.DOM.elementMatches(t.nativeElement,e):!1}},e.directive=function(e){return function(t){return t.hasDirective(e)}},e}();return t.By=m,o.define=a,r.exports}),System.register("angular2/src/core/debug/debug_element_view_listener",["angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/di","angular2/src/core/linker/view_listener","angular2/src/core/dom/dom_adapter","angular2/src/core/render/api","angular2/src/core/debug/debug_element"],!0,function(e,t,r){function n(e,t){l.isPresent(e)&&h.DOM.setData(e,y,t.join(_))}function i(e){var t=h.DOM.getData(e,y);return l.isPresent(t)?t.split(_).map(function(e){return l.NumberWrapper.parseInt(e,10)}):null}function o(e){var t=i(e);if(l.isPresent(t)){var r=w.get(t[0]);if(l.isPresent(r))return new m.DebugElement_(r,t[1])}return null}var a=System.global,s=a.define;a.define=void 0;var c=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},u=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},l=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/di"),f=e("angular2/src/core/linker/view_listener"),h=e("angular2/src/core/dom/dom_adapter"),g=e("angular2/src/core/render/api"),m=e("angular2/src/core/debug/debug_element"),y="ngid",v="ng.probe",_="#",b=new p.Map,w=new p.Map,C=0;t.inspectNativeElement=o;var E=function(){function e(e){this._renderer=e,h.DOM.setGlobalVar(v,o)}return e.prototype.viewCreated=function(e){var t=C++;w.set(t,e),b.set(e,t);for(var r=0;r<e.elementRefs.length;r++){var i=e.elementRefs[r];n(this._renderer.getNativeElementSync(i),[t,r])}},e.prototype.viewDestroyed=function(e){var t=b.get(e);p.MapWrapper["delete"](b,e),p.MapWrapper["delete"](w,t)},e=c([d.Injectable(),u("design:paramtypes",[g.Renderer])],e)}();return t.DebugElementViewListener=E,t.ELEMENT_PROBE_BINDINGS=l.CONST_EXPR([E,l.CONST_EXPR(new d.Binding(f.AppViewListener,{
toAlias:E}))]),a.define=s,r.exports}),System.register("angular2/profile",["angular2/src/core/profile/profile"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/profile/profile");return t.wtfCreateScope=o.wtfCreateScope,t.wtfLeave=o.wtfLeave,t.wtfStartTimeRange=o.wtfStartTimeRange,t.wtfEndTimeRange=o.wtfEndTimeRange,n.define=i,r.exports}),System.register("angular2/lifecycle_hooks",[],!0,function(e,t,r){var n=System.global,i=n.define;return n.define=void 0,n.define=i,r.exports}),System.register("angular2/bootstrap",["angular2/src/core/bootstrap"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/bootstrap");return t.bootstrap=o.bootstrap,n.define=i,r.exports}),System.register("angular2/src/core/di/decorators",["angular2/src/core/di/metadata","angular2/src/core/util/decorators"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/di/metadata"),a=e("angular2/src/core/util/decorators");return t.Inject=a.makeParamDecorator(o.InjectMetadata),t.Optional=a.makeParamDecorator(o.OptionalMetadata),t.Injectable=a.makeDecorator(o.InjectableMetadata),t.Self=a.makeParamDecorator(o.SelfMetadata),t.Host=a.makeParamDecorator(o.HostMetadata),t.SkipSelf=a.makeParamDecorator(o.SkipSelfMetadata),n.define=i,r.exports}),System.register("angular2/src/core/facade/exceptions",["angular2/src/core/facade/exception_handler","angular2/src/core/facade/exception_handler"],!0,function(e,t,r){function n(e){return new TypeError(e)}function i(){throw new l("unimplemented")}var o=System.global,a=o.define;o.define=void 0;var s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},c=e("angular2/src/core/facade/exception_handler"),u=e("angular2/src/core/facade/exception_handler");t.ExceptionHandler=u.ExceptionHandler;var l=function(e){function t(t){void 0===t&&(t="--"),e.call(this,t),this.message=t,this.stack=new Error(t).stack}return s(t,e),t.prototype.toString=function(){return this.message},t}(Error);t.BaseException=l;var p=function(e){function t(t,r,n,i){e.call(this,t),this._wrapperMessage=t,this._originalException=r,this._originalStack=n,this._context=i,this._wrapperStack=new Error(t).stack}return s(t,e),Object.defineProperty(t.prototype,"wrapperMessage",{get:function(){return this._wrapperMessage},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"wrapperStack",{get:function(){return this._wrapperStack},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalException",{get:function(){return this._originalException},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalStack",{get:function(){return this._originalStack},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"context",{get:function(){return this._context},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"message",{get:function(){return c.ExceptionHandler.exceptionToString(this)},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return this.message},t}(Error);return t.WrappedException=p,t.makeTypeError=n,t.unimplemented=i,o.define=a,r.exports}),System.register("angular2/src/core/reflection/reflection",["angular2/src/core/reflection/reflector","angular2/src/core/reflection/reflector","angular2/src/core/reflection/reflection_capabilities"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/reflection/reflector"),a=e("angular2/src/core/reflection/reflector");t.Reflector=a.Reflector,t.ReflectionInfo=a.ReflectionInfo;var s=e("angular2/src/core/reflection/reflection_capabilities");return t.reflector=new o.Reflector(new s.ReflectionCapabilities),n.define=i,r.exports}),System.register("angular2/src/core/di/key",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/di/type_literal","angular2/src/core/di/forward_ref","angular2/src/core/di/type_literal"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/collection"),a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/exceptions"),c=e("angular2/src/core/di/type_literal"),u=e("angular2/src/core/di/forward_ref"),l=e("angular2/src/core/di/type_literal");t.TypeLiteral=l.TypeLiteral;var p=function(){function e(e,t){if(this.token=e,this.id=t,a.isBlank(e))throw new s.BaseException("Token must be defined!")}return Object.defineProperty(e.prototype,"displayName",{get:function(){return a.stringify(this.token)},enumerable:!0,configurable:!0}),e.get=function(e){return f.get(u.resolveForwardRef(e))},Object.defineProperty(e,"numberOfKeys",{get:function(){return f.numberOfKeys},enumerable:!0,configurable:!0}),e}();t.Key=p;var d=function(){function e(){this._allKeys=new Map}return e.prototype.get=function(e){if(e instanceof p)return e;var t=e;if(e instanceof c.TypeLiteral&&(t=e.type),e=t,this._allKeys.has(e))return this._allKeys.get(e);var r=new p(e,p.numberOfKeys);return this._allKeys.set(e,r),r},Object.defineProperty(e.prototype,"numberOfKeys",{get:function(){return o.MapWrapper.size(this._allKeys)},enumerable:!0,configurable:!0}),e}();t.KeyRegistry=d;var f=new d;return n.define=i,r.exports}),System.register("angular2/src/core/change_detection/change_detection_util",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/change_detection/constants","angular2/src/core/change_detection/pipe_lifecycle_reflector","angular2/src/core/change_detection/binding_record","angular2/src/core/change_detection/directive_record"],!0,function(e,t,r){function n(e,t){var r=y++%20,n=v[r];return n.previousValue=e,n.currentValue=t,n}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/exceptions"),c=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/change_detection/constants"),l=e("angular2/src/core/change_detection/pipe_lifecycle_reflector"),p=e("angular2/src/core/change_detection/binding_record"),d=e("angular2/src/core/change_detection/directive_record"),f=function(){function e(e){this.wrapped=e}return e.wrap=function(e){var t=h[g++%5];return t.wrapped=e,t},e}();t.WrappedValue=f;var h=[new f(null),new f(null),new f(null),new f(null),new f(null)],g=0,m=function(){function e(e,t){this.previousValue=e,this.currentValue=t}return e.prototype.isFirstChange=function(){return this.previousValue===_.uninitialized},e}();t.SimpleChange=m;var y=0,v=[new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null)],_=function(){function e(){}return e.arrayFn0=function(){return[]},e.arrayFn1=function(e){return[e]},e.arrayFn2=function(e,t){return[e,t]},e.arrayFn3=function(e,t,r){return[e,t,r]},e.arrayFn4=function(e,t,r,n){return[e,t,r,n]},e.arrayFn5=function(e,t,r,n,i){return[e,t,r,n,i]},e.arrayFn6=function(e,t,r,n,i,o){return[e,t,r,n,i,o]},e.arrayFn7=function(e,t,r,n,i,o,a){return[e,t,r,n,i,o,a]},e.arrayFn8=function(e,t,r,n,i,o,a,s){return[e,t,r,n,i,o,a,s]},e.arrayFn9=function(e,t,r,n,i,o,a,s,c){return[e,t,r,n,i,o,a,s,c]},e.operation_negate=function(e){return!e},e.operation_add=function(e,t){return e+t},e.operation_subtract=function(e,t){return e-t},e.operation_multiply=function(e,t){return e*t},e.operation_divide=function(e,t){return e/t},e.operation_remainder=function(e,t){return e%t},e.operation_equals=function(e,t){return e==t},e.operation_not_equals=function(e,t){return e!=t},e.operation_identical=function(e,t){return e===t},e.operation_not_identical=function(e,t){return e!==t},e.operation_less_then=function(e,t){return t>e},e.operation_greater_then=function(e,t){return e>t},e.operation_less_or_equals_then=function(e,t){return t>=e},e.operation_greater_or_equals_then=function(e,t){return e>=t},e.operation_logical_and=function(e,t){return e&&t},e.operation_logical_or=function(e,t){return e||t},e.cond=function(e,t,r){return e?t:r},e.mapFn=function(e){function t(t){for(var r=c.StringMapWrapper.create(),n=0;n<e.length;++n)c.StringMapWrapper.set(r,e[n],t[n]);return r}switch(e.length){case 0:return function(){return[]};case 1:return function(e){return t([e])};case 2:return function(e,r){return t([e,r])};case 3:return function(e,r,n){return t([e,r,n])};case 4:return function(e,r,n,i){return t([e,r,n,i])};case 5:return function(e,r,n,i,o){return t([e,r,n,i,o])};case 6:return function(e,r,n,i,o,a){return t([e,r,n,i,o,a])};case 7:return function(e,r,n,i,o,a,s){return t([e,r,n,i,o,a,s])};case 8:return function(e,r,n,i,o,a,s,c){return t([e,r,n,i,o,a,s,c])};case 9:return function(e,r,n,i,o,a,s,c,u){return t([e,r,n,i,o,a,s,c,u])};default:throw new s.BaseException("Does not support literal maps with more than 9 elements")}},e.keyedAccess=function(e,t){return e[t[0]]},e.unwrapValue=function(e){return e instanceof f?e.wrapped:e},e.changeDetectionMode=function(e){return u.isDefaultChangeDetectionStrategy(e)?u.ChangeDetectionStrategy.CheckAlways:u.ChangeDetectionStrategy.CheckOnce},e.simpleChange=function(e,t){return n(e,t)},e.isValueBlank=function(e){return a.isBlank(e)},e.s=function(e){return a.isPresent(e)?""+e:""},e.protoByIndex=function(e,t){return 1>t?null:e[t-1]},e.callPipeOnDestroy=function(e){l.implementsOnDestroy(e.pipe)&&e.pipe.onDestroy()},e.bindingTarget=function(e,t,r,n,i){return new p.BindingTarget(e,t,r,n,i)},e.directiveIndex=function(e,t){return new d.DirectiveIndex(e,t)},e.uninitialized=a.CONST_EXPR(new Object),e}();return t.ChangeDetectionUtil=_,i.define=o,r.exports}),System.register("angular2/src/core/profile/profile",["angular2/src/core/profile/wtf_impl"],!0,function(e,t,r){function n(e,t){return null}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/profile/wtf_impl");return t.wtfEnabled=a.detectWTF(),t.wtfCreateScope=t.wtfEnabled?a.createScope:function(e,t){return n},t.wtfLeave=t.wtfEnabled?a.leave:function(e,t){return t},t.wtfStartTimeRange=t.wtfEnabled?a.startTimeRange:function(e,t){return null},t.wtfEndTimeRange=t.wtfEnabled?a.endTimeRange:function(e){return null},i.define=o,r.exports}),System.register("angular2/src/core/change_detection/codegen_logic_util",["angular2/src/core/facade/lang","angular2/src/core/change_detection/codegen_facade","angular2/src/core/change_detection/proto_record","angular2/src/core/change_detection/constants","angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/change_detection/codegen_facade"),s=e("angular2/src/core/change_detection/proto_record"),c=e("angular2/src/core/change_detection/constants"),u=e("angular2/src/core/facade/exceptions"),l=function(){function e(e,t,r){this._names=e,this._utilName=t,this._changeDetection=r}return e.prototype.genPropertyBindingEvalValue=function(e){var t=this;return this._genEvalValue(e,function(e){return t._names.getLocalName(e)},this._names.getLocalsAccessorName())},e.prototype.genEventBindingEvalValue=function(e,t){var r=this;return this._genEvalValue(t,function(t){return r._names.getEventLocalName(e,t)},"locals")},e.prototype._genEvalValue=function(e,t,r){var n,i=-1==e.contextIndex?this._names.getDirectiveName(e.directiveIndex):t(e.contextIndex),o=e.args.map(function(e){return t(e)}).join(", ");switch(e.mode){case s.RecordType.Self:n=i;break;case s.RecordType.Const:n=a.codify(e.funcOrValue);break;case s.RecordType.PropertyRead:n=this._observe(i+"."+e.name,e);break;case s.RecordType.SafeProperty:var c=this._observe(i+"."+e.name,e);n=this._utilName+".isValueBlank("+i+") ? null : "+this._observe(c,e);break;case s.RecordType.PropertyWrite:n=i+"."+e.name+" = "+t(e.args[0]);break;case s.RecordType.Local:n=this._observe(r+".get("+a.rawString(e.name)+")",e);break;case s.RecordType.InvokeMethod:n=this._observe(i+"."+e.name+"("+o+")",e);break;case s.RecordType.SafeMethodInvoke:var l=i+"."+e.name+"("+o+")";n=this._utilName+".isValueBlank("+i+") ? null : "+this._observe(l,e);break;case s.RecordType.InvokeClosure:n=i+"("+o+")";break;case s.RecordType.PrimitiveOp:n=this._utilName+"."+e.name+"("+o+")";break;case s.RecordType.CollectionLiteral:n=this._utilName+"."+e.name+"("+o+")";break;case s.RecordType.Interpolate:n=this._genInterpolation(e);break;case s.RecordType.KeyedRead:n=this._observe(i+"["+t(e.args[0])+"]",e);break;case s.RecordType.KeyedWrite:n=i+"["+t(e.args[0])+"] = "+t(e.args[1]);break;case s.RecordType.Chain:n="null";break;default:throw new u.BaseException("Unknown operation "+e.mode)}return t(e.selfIndex)+" = "+n+";"},e.prototype._observe=function(e,t){return this._changeDetection===c.ChangeDetectionStrategy.OnPushObserve?"this.observeValue("+e+", "+t.selfIndex+")":e},e.prototype.genPropertyBindingTargets=function(e,t){var r=this,n=e.map(function(e){if(o.isBlank(e))return"null";var n=t?a.codify(e.debug):"null";return r._utilName+".bindingTarget("+a.codify(e.mode)+", "+e.elementIndex+", "+a.codify(e.name)+", "+a.codify(e.unit)+", "+n+")"});return"["+n.join(", ")+"]"},e.prototype.genDirectiveIndices=function(e){var t=this,r=e.map(function(e){return t._utilName+".directiveIndex("+e.directiveIndex.elementIndex+", "+e.directiveIndex.directiveIndex+")"});return"["+r.join(", ")+"]"},e.prototype._genInterpolation=function(e){for(var t=[],r=0;r<e.args.length;++r)t.push(a.codify(e.fixedArgs[r])),t.push(this._utilName+".s("+this._names.getLocalName(e.args[r])+")");return t.push(a.codify(e.fixedArgs[e.args.length])),a.combineGeneratedStrings(t)},e.prototype.genHydrateDirectives=function(e){for(var t=[],r=0;r<e.length;++r){var n=e[r];t.push(this._names.getDirectiveName(n.directiveIndex)+" = "+this._genReadDirective(r)+";")}return t.join("\n")},e.prototype._genReadDirective=function(e){return this._changeDetection===c.ChangeDetectionStrategy.OnPushObserve?"this.observeDirective(this.getDirectiveFor(directives, "+e+"), "+e+")":"this.getDirectiveFor(directives, "+e+")"},e.prototype.genHydrateDetectors=function(e){for(var t=[],r=0;r<e.length;++r){var n=e[r];n.isDefaultChangeDetection()||t.push(this._names.getDetectorName(n.directiveIndex)+" = this.getDetectorFor(directives, "+r+");")}return t.join("\n")},e.prototype.genContentLifecycleCallbacks=function(e){for(var t=[],r=e.length-1;r>=0;--r){var n=e[r];n.callAfterContentInit&&t.push("if(! "+this._names.getAlreadyCheckedName()+") "+this._names.getDirectiveName(n.directiveIndex)+".afterContentInit();"),n.callAfterContentChecked&&t.push(this._names.getDirectiveName(n.directiveIndex)+".afterContentChecked();")}return t},e.prototype.genViewLifecycleCallbacks=function(e){for(var t=[],r=e.length-1;r>=0;--r){var n=e[r];n.callAfterViewInit&&t.push("if(! "+this._names.getAlreadyCheckedName()+") "+this._names.getDirectiveName(n.directiveIndex)+".afterViewInit();"),n.callAfterViewChecked&&t.push(this._names.getDirectiveName(n.directiveIndex)+".afterViewChecked();")}return t},e}();return t.CodegenLogicUtil=l,n.define=i,r.exports}),System.register("@reactivex/rxjs/dist/cjs/Subscriber",["@reactivex/rxjs/dist/cjs/util/noop","@reactivex/rxjs/dist/cjs/util/throwError","@reactivex/rxjs/dist/cjs/util/tryOrOnError","@reactivex/rxjs/dist/cjs/Subscription"],!0,function(e,t,r){function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function 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=System.global,s=a.define;a.define=void 0,t.__esModule=!0;var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("@reactivex/rxjs/dist/cjs/util/noop"),l=n(u),p=e("@reactivex/rxjs/dist/cjs/util/throwError"),d=n(p),f=e("@reactivex/rxjs/dist/cjs/util/tryOrOnError"),h=n(f),g=e("@reactivex/rxjs/dist/cjs/Subscription"),m=n(g),y=function(e){function t(r){if(i(this,t),e.call(this),this._isUnsubscribed=!1,this.destination=r,r){var n=r._subscription;n?this._subscription=n:r instanceof t&&(this._subscription=r)}}return o(t,e),t.create=function(e,r,n){var i=new t;return i._next="function"==typeof e&&h["default"](e)||l["default"],i._error="function"==typeof r&&r||d["default"],i._complete="function"==typeof n&&n||l["default"],i},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){this.destination.error(e)},t.prototype._complete=function(){this.destination.complete()},t.prototype.add=function(t){var r=this._subscription;r?r.add(t):e.prototype.add.call(this,t)},t.prototype.remove=function(t){this._subscription?this._subscription.remove(t):e.prototype.remove.call(this,t)},t.prototype.unsubscribe=function(){this._isUnsubscribed||(this._subscription?this._isUnsubscribed=!0:e.prototype.unsubscribe.call(this))},t.prototype.next=function(e){this.isUnsubscribed||this._next(e)},t.prototype.error=function(e){this.isUnsubscribed||(this._error(e),this.unsubscribe())},t.prototype.complete=function(){this.isUnsubscribed||(this._complete(),this.unsubscribe())},c(t,[{key:"isUnsubscribed",get:function(){var e=this._subscription;return e?this._isUnsubscribed||e.isUnsubscribed:this._isUnsubscribed},set:function(e){var t=this._subscription;t?t.isUnsubscribed=Boolean(e):this._isUnsubscribed=Boolean(e)}}]),t}(m["default"]);return t["default"]=y,r.exports=t["default"],a.define=s,r.exports}),System.register("@reactivex/rxjs/dist/cjs/util/Symbol_observable",["@reactivex/rxjs/dist/cjs/util/root"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0,t.__esModule=!0;var o=e("@reactivex/rxjs/dist/cjs/util/root");return o.root.Symbol||(o.root.Symbol={}),o.root.Symbol.observable||(o.root.Symbol.observable="function"==typeof o.root.Symbol["for"]?o.root.Symbol["for"]("observable"):"@@observable"),t["default"]=o.root.Symbol.observable,r.exports=t["default"],n.define=i,r.exports}),System.register("angular2/src/core/pipes/date_pipe",["angular2/src/core/facade/lang","angular2/src/core/facade/intl","angular2/src/core/di","angular2/src/core/metadata","angular2/src/core/facade/collection","angular2/src/core/pipes/invalid_pipe_argument_exception"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/facade/intl"),u=e("angular2/src/core/di"),l=e("angular2/src/core/metadata"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),f="en-US",h=function(){function e(){}return e.prototype.transform=function(t,r){if(s.isBlank(t))return null;if(!this.supports(t))throw new d.InvalidPipeArgumentException(e,t);var n=s.isPresent(r)&&r.length>0?r[0]:"mediumDate";return s.isNumber(t)&&(t=s.DateWrapper.fromMillis(t)),p.StringMapWrapper.contains(e._ALIASES,n)&&(n=p.StringMapWrapper.get(e._ALIASES,n)),c.DateFormatter.format(t,f,n)},e.prototype.supports=function(e){return s.isDate(e)||s.isNumber(e)},e._ALIASES={medium:"yMMMdjms","short":"yMdjm",fullDate:"yMMMMEEEEd",longDate:"yMMMMd",mediumDate:"yMMMd",shortDate:"yMd",mediumTime:"jms",shortTime:"jm"},e=o([s.CONST(),l.Pipe({name:"date"}),u.Injectable(),a("design:paramtypes",[])],e)}();return t.DatePipe=h,n.define=i,r.exports}),System.register("angular2/src/core/pipes/default_pipes",["angular2/src/core/pipes/async_pipe","angular2/src/core/pipes/uppercase_pipe","angular2/src/core/pipes/lowercase_pipe","angular2/src/core/pipes/json_pipe","angular2/src/core/pipes/slice_pipe","angular2/src/core/pipes/date_pipe","angular2/src/core/pipes/number_pipe","angular2/src/core/facade/lang","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/pipes/async_pipe"),a=e("angular2/src/core/pipes/uppercase_pipe"),s=e("angular2/src/core/pipes/lowercase_pipe"),c=e("angular2/src/core/pipes/json_pipe"),u=e("angular2/src/core/pipes/slice_pipe"),l=e("angular2/src/core/pipes/date_pipe"),p=e("angular2/src/core/pipes/number_pipe"),d=e("angular2/src/core/facade/lang"),f=e("angular2/src/core/di"),h=d.CONST_EXPR([o.AsyncPipe,a.UpperCasePipe,s.LowerCasePipe,c.JsonPipe,u.SlicePipe,p.DecimalPipe,p.PercentPipe,p.CurrencyPipe,l.DatePipe]);return t.DEFAULT_PIPES_TOKEN=d.CONST_EXPR(new f.OpaqueToken("Default Pipes")),t.DEFAULT_PIPES=d.CONST_EXPR(new f.Binding(t.DEFAULT_PIPES_TOKEN,{toValue:h})),n.define=i,r.exports}),System.register("angular2/src/core/pipes/pipes",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/change_detection/pipes"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/change_detection/pipes"),u=function(){function e(e){this.config=e,this.config=e}return e.fromBindings=function(t){var r={};return t.forEach(function(e){return r[e.name]=e}),new e(r)},e.prototype.get=function(e){var t=this.config[e];if(o.isBlank(t))throw new a.BaseException("Cannot find pipe '"+e+"'.");return t},e}();t.ProtoPipes=u;var l=function(){function e(e,t){this.proto=e,this.injector=t,this._config={}}return e.prototype.get=function(e){var t=s.StringMapWrapper.get(this._config,e);if(o.isPresent(t))return t;var r=this.proto.get(e),n=this.injector.instantiateResolved(r),i=new c.SelectedPipe(n,r.pure);return r.pure&&s.StringMapWrapper.set(this._config,e,i),i},e}();return t.Pipes=l,n.define=i,r.exports}),System.register("angular2/src/core/linker/view",["angular2/src/core/facade/collection","angular2/src/core/change_detection/change_detection","angular2/src/core/change_detection/interfaces","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/linker/view_ref","angular2/src/core/render/dom/util","angular2/src/core/linker/view_ref","angular2/src/core/change_detection/interfaces"],!0,function(e,t,r){function n(e){for(var t={},r=e;l.isPresent(r);)t=s.StringMapWrapper.merge(t,s.MapWrapper.toStringMap(r.current)),r=r.parent;return t}var i=System.global,o=i.define;i.define=void 0;var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/change_detection/change_detection"),u=e("angular2/src/core/change_detection/interfaces"),l=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/facade/exceptions"),d=e("angular2/src/core/linker/view_ref"),f=e("angular2/src/core/render/dom/util"),h=e("angular2/src/core/linker/view_ref"),g=e("angular2/src/core/change_detection/interfaces");t.DebugContext=g.DebugContext;var m="ng-reflect-";!function(e){e[e.HOST=0]="HOST",e[e.COMPONENT=1]="COMPONENT",e[e.EMBEDDED=2]="EMBEDDED"}(t.ViewType||(t.ViewType={}));var y=(t.ViewType,function(){function e(){this.views=[]}return e}());t.AppViewContainer=y;var v=function(){function e(e,t,r,n,i,o,a,u,l){this.renderer=e,this.proto=t,this.viewOffset=r,this.elementOffset=n,this.textOffset=i,this.render=a,this.renderFragment=u,this.containerElementInjector=l,this.views=null,this.elementInjectors=null,this.viewContainers=null,this.preBuiltObjects=null,this.changeDetector=null,this.context=null,this.ref=new h.ViewRef_(this),this.locals=new c.Locals(null,s.MapWrapper.clone(o))}return e.prototype.init=function(e,t,r,n,i,o,a){this.changeDetector=e,this.elementInjectors=t,this.rootElementInjectors=r,this.preBuiltObjects=n,this.views=i,this.elementRefs=o,this.viewContainers=a},e.prototype.setLocal=function(e,t){if(!this.hydrated())throw new p.BaseException("Cannot set locals on dehydrated view.");if(this.proto.templateVariableBindings.has(e)){var r=this.proto.templateVariableBindings.get(e);this.locals.set(r,t)}},e.prototype.hydrated=function(){return l.isPresent(this.context)},e.prototype.triggerEventHandlers=function(e,t,r){var n=new s.Map;n.set("$event",t),this.dispatchEvent(r,e,n)},e.prototype.notifyOnBinding=function(e,t){if(e.isTextNode())this.renderer.setText(this.render,e.elementIndex+this.textOffset,t);else{var r=this.elementRefs[this.elementOffset+e.elementIndex];if(e.isElementProperty())this.renderer.setElementProperty(r,e.name,t);else if(e.isElementAttribute())this.renderer.setElementAttribute(r,e.name,l.isPresent(t)?""+t:null);else if(e.isElementClass())this.renderer.setElementClass(r,e.name,t);else{if(!e.isElementStyle())throw new p.BaseException("Unsupported directive record");var n=l.isPresent(e.unit)?e.unit:"";this.renderer.setElementStyle(r,e.name,""+t+n)}}},e.prototype.logBindingUpdate=function(e,t){if(e.isDirective()||e.isElementProperty()){var r=this.elementRefs[this.elementOffset+e.elementIndex];this.renderer.setElementAttribute(r,""+m+f.camelCaseToDashCase(e.name),""+t)}},e.prototype.notifyAfterContentChecked=function(){for(var e=this.proto.elementBinders.length,t=this.elementInjectors,r=e-1;r>=0;r--)l.isPresent(t[r+this.elementOffset])&&t[r+this.elementOffset].afterContentChecked()},e.prototype.notifyAfterViewChecked=function(){for(var e=this.proto.elementBinders.length,t=this.elementInjectors,r=e-1;r>=0;r--)l.isPresent(t[r+this.elementOffset])&&t[r+this.elementOffset].afterViewChecked()},e.prototype.getDirectiveFor=function(e){var t=this.elementInjectors[this.elementOffset+e.elementIndex];return t.getDirectiveAtIndex(e.directiveIndex)},e.prototype.getNestedView=function(e){var t=this.elementInjectors[e];return l.isPresent(t)?t.getNestedView():null},e.prototype.getContainerElement=function(){return l.isPresent(this.containerElementInjector)?this.containerElementInjector.getElementRef():null},e.prototype.getDebugContext=function(e,t){try{var r=this.elementOffset+e,i=r<this.elementRefs.length,o=i?this.elementRefs[this.elementOffset+e]:null,a=this.getContainerElement(),s=i?this.elementInjectors[this.elementOffset+e]:null,c=l.isPresent(o)?o.nativeElement:null,p=l.isPresent(a)?a.nativeElement:null,d=l.isPresent(t)?this.getDirectiveFor(t):null,f=l.isPresent(s)?s.getInjector():null;return new u.DebugContext(c,p,d,this.context,n(this.locals),f)}catch(h){return null}},e.prototype.getDetectorFor=function(e){var t=this.getNestedView(this.elementOffset+e.elementIndex);return l.isPresent(t)?t.changeDetector:null},e.prototype.invokeElementMethod=function(e,t,r){this.renderer.invokeElementMethod(this.elementRefs[e],t,r)},e.prototype.dispatchRenderEvent=function(e,t,r){var n=this.elementRefs[e],i=d.internalView(n.parentView);return i.dispatchEvent(n.boundElementIndex,t,r)},e.prototype.dispatchEvent=function(e,t,r){try{return this.hydrated()?!this.changeDetector.handleEvent(t,e-this.elementOffset,new c.Locals(this.locals,r)):!0}catch(n){var i=this.getDebugContext(e-this.elementOffset,null),o=l.isPresent(i)?new _(i.element,i.componentElement,i.context,i.locals,i.injector):null;throw new b(t,n,n.stack,o)}},Object.defineProperty(e.prototype,"ownBindersCount",{get:function(){return this.proto.elementBinders.length},enumerable:!0,configurable:!0}),e}();t.AppView=v;var _=function(){function e(e,t,r,n,i){this.element=e,this.componentElement=t,this.context=r,this.locals=n,this.injector=i}return e}(),b=function(e){function t(t,r,n,i){e.call(this,'Error during evaluation of "'+t+'"',r,n,i)}return a(t,e),t}(p.WrappedException),w=function(){function e(e,t,r){this.embeddedViewCount=e,this.elementCount=t,this.viewCount=r}return e}();t.AppProtoViewMergeInfo=w;var C=function(){function e(e,t,r,n,i,o){this.templateCmds=e,this.type=t,this.isMergable=r,this.changeDetectorFactory=n,this.templateVariableBindings=i,this.pipes=o,this.elementBinders=null,this.mergeInfo=null,this.variableLocations=null,this.textBindingCount=null,this.render=null,this.ref=new h.ProtoViewRef_(this)}return e.prototype.init=function(e,t,r,n,i){var o=this;this.render=e,this.elementBinders=t,this.textBindingCount=r,this.mergeInfo=n,this.variableLocations=i,this.protoLocals=new s.Map,l.isPresent(this.templateVariableBindings)&&s.MapWrapper.forEach(this.templateVariableBindings,function(e,t){o.protoLocals.set(e,null)}),l.isPresent(i)&&s.MapWrapper.forEach(i,function(e,t){o.protoLocals.set(t,null)})},e.prototype.isInitialized=function(){return l.isPresent(this.elementBinders)},e}();return t.AppProtoView=C,i.define=o,r.exports}),System.register("angular2/src/core/linker/view_manager_utils",["angular2/src/core/di","angular2/src/core/facade/collection","angular2/src/core/linker/element_injector","angular2/src/core/facade/lang","angular2/src/core/linker/view","angular2/src/core/linker/element_ref","angular2/src/core/linker/template_ref","angular2/src/core/pipes/pipes"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/linker/element_injector"),l=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/linker/view"),d=e("angular2/src/core/linker/element_ref"),f=e("angular2/src/core/linker/template_ref"),h=e("angular2/src/core/pipes/pipes"),g=function(){function e(){}return e.prototype.getComponentInstance=function(e,t){var r=e.elementInjectors[t];return r.getComponent()},e.prototype.createView=function(e,t,r,n){for(var i=t.fragmentRefs,o=t.viewRef,a=e.mergeInfo.elementCount,s=e.mergeInfo.viewCount,h=c.ListWrapper.createFixedSize(a),g=c.ListWrapper.createFixedSize(a),m=c.ListWrapper.createFixedSize(a),y=c.ListWrapper.createFixedSize(a),v=c.ListWrapper.createFixedSize(s),_=0,b=0,w=0,C=c.ListWrapper.createFixedSize(s),E=0;s>E;E++){var R=C[E],S=l.isPresent(R)?y[R]:null,x=l.isPresent(S)?m[R].view:null,P=l.isPresent(R)?x.proto.elementBinders[R-x.elementOffset].nestedProtoView:e,D=null;(0===E||P.type===p.ViewType.EMBEDDED)&&(D=i[w++]);var I=new p.AppView(n,P,E,_,b,P.protoLocals,o,D,S);v[E]=I,l.isPresent(R)&&(m[R].nestedView=I);for(var O=[],k=E+1,A=0;A<P.elementBinders.length;A++){var T=P.elementBinders[A],N=_+A,j=null;l.isPresent(T.nestedProtoView)&&T.nestedProtoView.isMergable&&(C[k]=N,k+=T.nestedProtoView.mergeInfo.viewCount);var M=T.protoElementInjector;if(l.isPresent(M))if(l.isPresent(M.parent)){var V=y[_+M.parent.index];j=M.instantiate(V)}else j=M.instantiate(null),O.push(j);y[N]=j;var B=new d.ElementRef_(I.ref,N,n);if(h[B.boundElementIndex]=B,l.isPresent(j)){var L=l.isPresent(T.nestedProtoView)&&T.nestedProtoView.type===p.ViewType.EMBEDDED?new f.TemplateRef_(B):null;
m[N]=new u.PreBuiltObjects(r,I,B,L)}}I.init(P.changeDetectorFactory(I),y,O,m,v,h,g),l.isPresent(x)&&P.type===p.ViewType.COMPONENT&&x.changeDetector.addShadowDomChild(I.changeDetector),_+=P.elementBinders.length,b+=P.textBindingCount}return v[0]},e.prototype.hydrateRootHostView=function(e,t){this._hydrateView(e,t,null,new Object,null)},e.prototype.attachViewInContainer=function(e,t,r,n,i,o){l.isBlank(r)&&(r=e,n=t),e.changeDetector.addChild(o.changeDetector);var a=e.viewContainers[t];l.isBlank(a)&&(a=new p.AppViewContainer,e.viewContainers[t]=a),c.ListWrapper.insert(a.views,i,o);for(var s=r.elementInjectors[n],u=o.rootElementInjectors.length-1;u>=0;u--)l.isPresent(s.parent)&&o.rootElementInjectors[u].link(s.parent);s.traverseAndSetQueriesAsDirty()},e.prototype.detachViewInContainer=function(e,t,r){var n=e.viewContainers[t],i=n.views[r];e.elementInjectors[t].traverseAndSetQueriesAsDirty(),i.changeDetector.remove(),c.ListWrapper.removeAt(n.views,r);for(var o=0;o<i.rootElementInjectors.length;++o){var a=i.rootElementInjectors[o];a.unlink()}},e.prototype.hydrateViewInContainer=function(e,t,r,n,i,o){l.isBlank(r)&&(r=e,n=t);var a=e.viewContainers[t],c=a.views[i],u=r.elementInjectors[n],p=l.isPresent(o)?s.Injector.fromResolvedBindings(o):null;this._hydrateView(c,p,u.getHost(),r.context,r.locals)},e.prototype._hydrateView=function(e,t,r,n,i){for(var o=e.viewOffset,a=o+e.proto.mergeInfo.viewCount-1;a>=o;){var s=e.views[o],c=s.proto;if(s!==e&&s.proto.type===p.ViewType.EMBEDDED)o+=s.proto.mergeInfo.viewCount;else{s!==e&&(t=null,i=null,r=s.containerElementInjector,n=r.getComponent()),s.context=n,s.locals.parent=i;for(var u=c.elementBinders,d=0;d<u.length;d++){var f=d+s.elementOffset,g=e.elementInjectors[f];l.isPresent(g)&&(g.hydrate(t,r,s.preBuiltObjects[f]),this._populateViewLocals(s,g,f),this._setUpEventEmitters(s,g,f))}var m=l.isPresent(r)?new h.Pipes(s.proto.pipes,r.getInjector()):null;s.changeDetector.hydrate(s.context,s.locals,s,m),o++}}},e.prototype._populateViewLocals=function(e,t,r){l.isPresent(t.getDirectiveVariableBindings())&&c.MapWrapper.forEach(t.getDirectiveVariableBindings(),function(n,i){l.isBlank(n)?e.locals.set(i,e.elementRefs[r].nativeElement):e.locals.set(i,t.getDirectiveAtIndex(n))})},e.prototype._setUpEventEmitters=function(e,t,r){for(var n=t.getEventEmitterAccessors(),i=0;i<n.length;++i)for(var o=n[i],a=t.getDirectiveAtIndex(i),s=0;s<o.length;++s){var c=o[s];c.subscribe(e,r,a)}},e.prototype.dehydrateView=function(e){for(var t=e.viewOffset+e.proto.mergeInfo.viewCount-1,r=e.viewOffset;t>=r;r++){var n=e.views[r];if(n.hydrated()){l.isPresent(n.locals)&&n.locals.clearValues(),n.context=null,n.changeDetector.dehydrate();for(var i=n.proto.elementBinders,o=0;o<i.length;o++){var a=e.elementInjectors[n.elementOffset+o];l.isPresent(a)&&a.dehydrate()}}}},e=o([s.Injectable(),a("design:paramtypes",[])],e)}();return t.AppViewManagerUtils=g,n.define=i,r.exports}),System.register("angular2/src/core/linker/directive_lifecycle_reflector",["angular2/src/core/facade/lang","angular2/src/core/linker/interfaces"],!0,function(e,t,r){function n(e,t){if(!(t instanceof a.Type))return!1;var r=t.prototype;switch(e){case s.LifecycleHooks.AfterContentInit:return!!r.afterContentInit;case s.LifecycleHooks.AfterContentChecked:return!!r.afterContentChecked;case s.LifecycleHooks.AfterViewInit:return!!r.afterViewInit;case s.LifecycleHooks.AfterViewChecked:return!!r.afterViewChecked;case s.LifecycleHooks.OnChanges:return!!r.onChanges;case s.LifecycleHooks.DoCheck:return!!r.doCheck;case s.LifecycleHooks.OnDestroy:return!!r.onDestroy;case s.LifecycleHooks.OnInit:return!!r.onInit;default:return!1}}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/linker/interfaces");return t.hasLifecycleHook=n,i.define=o,r.exports}),System.register("angular2/src/core/render/dom/shared_styles_host",["angular2/src/core/dom/dom_adapter","angular2/src/core/di","angular2/src/core/facade/collection","angular2/src/core/render/dom/dom_tokens"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},u=e("angular2/src/core/dom/dom_adapter"),l=e("angular2/src/core/di"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/render/dom/dom_tokens"),f=function(){function e(){this._styles=[],this._stylesSet=new Set}return e.prototype.addStyles=function(e){var t=this,r=[];e.forEach(function(e){p.SetWrapper.has(t._stylesSet,e)||(t._stylesSet.add(e),t._styles.push(e),r.push(e))}),this.onStylesAdded(r)},e.prototype.onStylesAdded=function(e){},e.prototype.getAllStyles=function(){return this._styles},e=a([l.Injectable(),s("design:paramtypes",[])],e)}();t.SharedStylesHost=f;var h=function(e){function t(t){e.call(this),this._hostNodes=new Set,this._hostNodes.add(t.head)}return o(t,e),t.prototype._addStylesToHost=function(e,t){for(var r=0;r<e.length;r++){var n=e[r];u.DOM.appendChild(t,u.DOM.createStyleElement(n))}},t.prototype.addHost=function(e){this._addStylesToHost(this._styles,e),this._hostNodes.add(e)},t.prototype.removeHost=function(e){p.SetWrapper["delete"](this._hostNodes,e)},t.prototype.onStylesAdded=function(e){var t=this;this._hostNodes.forEach(function(r){t._addStylesToHost(e,r)})},t=a([l.Injectable(),c(0,l.Inject(d.DOCUMENT)),s("design:paramtypes",[Object])],t)}(f);return t.DomSharedStylesHost=h,n.define=i,r.exports}),System.register("angular2/src/animate/animation",["angular2/src/core/facade/lang","angular2/src/core/facade/math","angular2/src/core/render/dom/util","angular2/src/core/facade/collection","angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/math"),s=e("angular2/src/core/render/dom/util"),c=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/dom/dom_adapter"),l=function(){function e(e,t,r){var n=this;this.element=e,this.data=t,this.browserDetails=r,this.callbacks=[],this.eventClearFunctions=[],this.completed=!1,this._stringPrefix="",this.startTime=o.DateWrapper.toMillis(o.DateWrapper.now()),this._stringPrefix=u.DOM.getAnimationPrefix(),this.setup(),this.wait(function(e){return n.start()})}return Object.defineProperty(e.prototype,"totalTime",{get:function(){var e=null!=this.computedDelay?this.computedDelay:0,t=null!=this.computedDuration?this.computedDuration:0;return e+t},enumerable:!0,configurable:!0}),e.prototype.wait=function(e){this.browserDetails.raf(e,2)},e.prototype.setup=function(){null!=this.data.fromStyles&&this.applyStyles(this.data.fromStyles),null!=this.data.duration&&this.applyStyles({transitionDuration:this.data.duration.toString()+"ms"}),null!=this.data.delay&&this.applyStyles({transitionDelay:this.data.delay.toString()+"ms"})},e.prototype.start=function(){this.addClasses(this.data.classesToAdd),this.addClasses(this.data.animationClasses),this.removeClasses(this.data.classesToRemove),null!=this.data.toStyles&&this.applyStyles(this.data.toStyles);var e=u.DOM.getComputedStyle(this.element);this.computedDelay=a.Math.max(this.parseDurationString(e.getPropertyValue(this._stringPrefix+"transition-delay")),this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix+"transition-delay"))),this.computedDuration=a.Math.max(this.parseDurationString(e.getPropertyValue(this._stringPrefix+"transition-duration")),this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix+"transition-duration"))),this.addEvents()},e.prototype.applyStyles=function(e){var t=this;c.StringMapWrapper.forEach(e,function(e,r){var n=s.camelCaseToDashCase(r);o.isPresent(u.DOM.getStyle(t.element,n))?u.DOM.setStyle(t.element,n,e.toString()):u.DOM.setStyle(t.element,t._stringPrefix+n,e.toString())})},e.prototype.addClasses=function(e){for(var t=0,r=e.length;r>t;t++)u.DOM.addClass(this.element,e[t])},e.prototype.removeClasses=function(e){for(var t=0,r=e.length;r>t;t++)u.DOM.removeClass(this.element,e[t])},e.prototype.addEvents=function(){var e=this;this.totalTime>0?this.eventClearFunctions.push(u.DOM.onAndCancel(this.element,u.DOM.getTransitionEnd(),function(t){return e.handleAnimationEvent(t)})):this.handleAnimationCompleted()},e.prototype.handleAnimationEvent=function(e){var t=a.Math.round(1e3*e.elapsedTime);this.browserDetails.elapsedTimeIncludesDelay||(t+=this.computedDelay),e.stopPropagation(),t>=this.totalTime&&this.handleAnimationCompleted()},e.prototype.handleAnimationCompleted=function(){this.removeClasses(this.data.animationClasses),this.callbacks.forEach(function(e){return e()}),this.callbacks=[],this.eventClearFunctions.forEach(function(e){return e()}),this.eventClearFunctions=[],this.completed=!0},e.prototype.onComplete=function(e){return this.completed?e():this.callbacks.push(e),this},e.prototype.parseDurationString=function(e){var t=0;if(null==e||e.length<2)return t;if("ms"==e.substring(e.length-2)){var r=o.NumberWrapper.parseInt(this.stripLetters(e),10);r>t&&(t=r)}else if("s"==e.substring(e.length-1)){var n=1e3*o.NumberWrapper.parseFloat(this.stripLetters(e)),r=a.Math.floor(n);r>t&&(t=r)}return t},e.prototype.stripLetters=function(e){return o.StringWrapper.replaceAll(e,o.RegExpWrapper.create("[^0-9]+$",""),"")},e}();return t.Animation=l,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/events/event_manager",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/dom/dom_adapter","angular2/src/core/zone/ng_zone","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/dom/dom_adapter"),f=e("angular2/src/core/zone/ng_zone"),h=e("angular2/src/core/di");t.EVENT_MANAGER_PLUGINS=u.CONST_EXPR(new h.OpaqueToken("EventManagerPlugins"));var g=function(){function e(e,t){var r=this;this._zone=t,e.forEach(function(e){return e.manager=r}),this._plugins=p.ListWrapper.reversed(e)}return e.prototype.addEventListener=function(e,t,r){var n=this._findPluginFor(t);n.addEventListener(e,t,r)},e.prototype.addGlobalEventListener=function(e,t,r){var n=this._findPluginFor(t);return n.addGlobalEventListener(e,t,r)},e.prototype.getZone=function(){return this._zone},e.prototype._findPluginFor=function(e){for(var t=this._plugins,r=0;r<t.length;r++){var n=t[r];if(n.supports(e))return n}throw new l.BaseException("No event manager plugin found for event "+e)},e=a([h.Injectable(),c(0,h.Inject(t.EVENT_MANAGER_PLUGINS)),s("design:paramtypes",[Array,f.NgZone])],e)}();t.EventManager=g;var m=function(){function e(){}return e.prototype.supports=function(e){return!1},e.prototype.addEventListener=function(e,t,r){throw"not implemented"},e.prototype.addGlobalEventListener=function(e,t,r){throw"not implemented"},e}();t.EventManagerPlugin=m;var y=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.supports=function(e){return!0},t.prototype.addEventListener=function(e,t,r){var n=this.manager.getZone(),i=function(e){return n.run(function(){return r(e)})};this.manager.getZone().runOutsideAngular(function(){d.DOM.on(e,t,i)})},t.prototype.addGlobalEventListener=function(e,t,r){var n=d.DOM.getGlobalEventTarget(e),i=this.manager.getZone(),o=function(e){return i.run(function(){return r(e)})};return this.manager.getZone().runOutsideAngular(function(){return d.DOM.onAndCancel(n,t,o)})},t=a([h.Injectable(),s("design:paramtypes",[])],t)}(m);return t.DomEventsPlugin=y,n.define=i,r.exports}),System.register("angular2/src/core/render/view_factory",["angular2/src/core/facade/lang","angular2/src/core/render/view"],!0,function(e,t,r){function n(e,t,r){var n,i=function(e,t,r){return n.dispatchRenderEvent(e,t,r)},o=new l(i,r,t);o.build(e);for(var a=[],s=0;s<o.fragments.length;s++)a.push(new u.DefaultRenderFragmentRef(o.fragments[s]));return n=new u.DefaultRenderView(a,o.boundTextNodes,o.boundElements,o.nativeShadowRoots,o.globalEventAdders)}function i(e,t,r){return function(n){return r(e,t,n)}}function o(e,t,r,n){return function(){return n.globalOn(e,t,r)}}var a=System.global,s=a.define;a.define=void 0;var c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/render/view");t.createRenderView=n;var l=function(){function e(e,t,r){this._eventDispatcher=e,this.factory=t,this._inplaceElement=r,this._builders=[],this.globalEventAdders=[],this.boundElements=[],this.boundTextNodes=[],this.nativeShadowRoots=[],this.fragments=[]}return e.prototype.build=function(e){this.enqueueFragmentBuilder(null,e),this._build(this._builders[0])},e.prototype._build=function(e){this._builders=[],e.build(this);for(var t=this._builders,r=0;r<t.length;r++)this._build(t[r])},e.prototype.enqueueComponentBuilder=function(e){this._builders.push(new p(e,null,this.factory.resolveComponentTemplate(e.cmd.templateId)))},e.prototype.enqueueFragmentBuilder=function(e,t){var r=[];this.fragments.push(r),this._builders.push(new p(e,r,t))},e.prototype.consumeInplaceElement=function(){var e=this._inplaceElement;return this._inplaceElement=null,e},e.prototype.addEventListener=function(e,t,r){if(c.isPresent(t)){var n=i(e,t+":"+r,this._eventDispatcher);this.globalEventAdders.push(o(t,r,n,this.factory))}else{var n=i(e,r,this._eventDispatcher);this.factory.on(this.boundElements[e],r,n)}},e}(),p=function(){function e(e,t,r){this.parentComponent=e,this.fragmentRootNodes=t,this.commands=r;var n=c.isPresent(t)?null:e.shadowRoot;this.parentStack=[n]}return e.prototype.build=function(e){for(var t=0;t<this.commands.length;t++)this.commands[t].visit(this,e)},Object.defineProperty(e.prototype,"parent",{get:function(){return this.parentStack[this.parentStack.length-1]},enumerable:!0,configurable:!0}),e.prototype.visitText=function(e,t){var r=t.factory.createText(e.value);return this._addChild(r,e.ngContentIndex,t),e.isBound&&t.boundTextNodes.push(r),null},e.prototype.visitNgContent=function(e,t){if(c.isPresent(this.parentComponent))for(var r=this.parentComponent.project(e.index),n=0;n<r.length;n++){var i=r[n];this._addChild(i,e.ngContentIndex,t)}return null},e.prototype.visitBeginElement=function(e,t){return this.parentStack.push(this._beginElement(e,t)),null},e.prototype.visitEndElement=function(e){return this._endElement(),null},e.prototype.visitBeginComponent=function(e,t){var r=this._beginElement(e,t),n=r;e.nativeShadow&&(n=t.factory.createShadowRoot(r,e.templateId),t.nativeShadowRoots.push(n));var i=new d(r,n,e);return t.enqueueComponentBuilder(i),this.parentStack.push(i),null},e.prototype.visitEndComponent=function(e){return this._endElement(),null},e.prototype.visitEmbeddedTemplate=function(e,t){var r=t.factory.createTemplateAnchor(e.attrNameAndValues);return this._addChild(r,e.ngContentIndex,t),t.boundElements.push(r),e.isMerged&&t.enqueueFragmentBuilder(this.parentComponent,e.children),null},e.prototype._beginElement=function(e,t){var r=t.consumeInplaceElement();if(c.isPresent(r)?(t.factory.mergeElement(r,e.attrNameAndValues),this.fragmentRootNodes.push(r)):(r=t.factory.createElement(e.name,e.attrNameAndValues),this._addChild(r,e.ngContentIndex,t)),e.isBound){var n=t.boundElements.length;t.boundElements.push(r);for(var i=0;i<e.eventTargetAndNames.length;i+=2){var o=e.eventTargetAndNames[i],a=e.eventTargetAndNames[i+1];t.addEventListener(n,o,a)}}return r},e.prototype._endElement=function(){this.parentStack.pop()},e.prototype._addChild=function(e,t,r){var n=this.parent;c.isPresent(n)?n instanceof d?n.addContentNode(t,e,r):r.factory.appendChild(n,e):this.fragmentRootNodes.push(e)},e}(),d=function(){function e(e,t,r){this.hostElement=e,this.shadowRoot=t,this.cmd=r,this.contentNodesByNgContentIndex=[]}return e.prototype.addContentNode=function(e,t,r){if(c.isBlank(e))this.cmd.nativeShadow&&r.factory.appendChild(this.hostElement,t);else{for(;this.contentNodesByNgContentIndex.length<=e;)this.contentNodesByNgContentIndex.push([]);this.contentNodesByNgContentIndex[e].push(t)}},e.prototype.project=function(e){return e<this.contentNodesByNgContentIndex.length?this.contentNodesByNgContentIndex[e]:[]},e}();return a.define=s,r.exports}),System.register("angular2/src/core/compiler/directive_metadata",["angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/change_detection/change_detection","angular2/src/core/metadata/view","angular2/src/core/compiler/selector","angular2/src/core/compiler/util","angular2/src/core/linker/interfaces"],!0,function(e,t,r){function n(e,t){var r=l.CssSelector.parse(t)[0].getMatchingElementTemplate();return m.create({type:new h({runtime:Object,name:"Host"+e.name,moduleUrl:e.moduleUrl,isHost:!0}),template:new g({template:r,templateUrl:"",styles:[],styleUrls:[],ngContentSelectors:[]}),changeDetection:c.ChangeDetectionStrategy.Default,inputs:[],outputs:[],host:{},lifecycleHooks:[],isComponent:!0,dynamicLoadable:!1,selector:"*"})}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/change_detection/change_detection"),u=e("angular2/src/core/metadata/view"),l=e("angular2/src/core/compiler/selector"),p=e("angular2/src/core/compiler/util"),d=e("angular2/src/core/linker/interfaces"),f=/^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g,h=function(){function e(e){var t=void 0===e?{}:e,r=t.runtime,n=t.name,i=t.moduleUrl,o=t.isHost;this.runtime=r,this.name=n,this.moduleUrl=i,this.isHost=a.normalizeBool(o)}return e.fromJson=function(t){return new e({name:t.name,moduleUrl:t.moduleUrl,isHost:t.isHost})},e.prototype.toJson=function(){return{name:this.name,moduleUrl:this.moduleUrl,isHost:this.isHost}},e}();t.CompileTypeMetadata=h;var g=function(){function e(e){var t=void 0===e?{}:e,r=t.encapsulation,n=t.template,i=t.templateUrl,o=t.styles,s=t.styleUrls,c=t.ngContentSelectors;this.encapsulation=a.isPresent(r)?r:u.ViewEncapsulation.Emulated,this.template=n,this.templateUrl=i,this.styles=a.isPresent(o)?o:[],this.styleUrls=a.isPresent(s)?s:[],this.ngContentSelectors=a.isPresent(c)?c:[]}return e.fromJson=function(t){return new e({encapsulation:a.isPresent(t.encapsulation)?u.VIEW_ENCAPSULATION_VALUES[t.encapsulation]:t.encapsulation,template:t.template,templateUrl:t.templateUrl,styles:t.styles,styleUrls:t.styleUrls,ngContentSelectors:t.ngContentSelectors})},e.prototype.toJson=function(){return{encapsulation:a.isPresent(this.encapsulation)?a.serializeEnum(this.encapsulation):this.encapsulation,template:this.template,templateUrl:this.templateUrl,styles:this.styles,styleUrls:this.styleUrls,ngContentSelectors:this.ngContentSelectors}},e}();t.CompileTemplateMetadata=g;var m=function(){function e(e){var t=void 0===e?{}:e,r=t.type,n=t.isComponent,i=t.dynamicLoadable,o=t.selector,a=t.exportAs,s=t.changeDetection,c=t.inputs,u=t.outputs,l=t.hostListeners,p=t.hostProperties,d=t.hostAttributes,f=t.lifecycleHooks,h=t.template;this.type=r,this.isComponent=n,this.dynamicLoadable=i,this.selector=o,this.exportAs=a,this.changeDetection=s,this.inputs=c,this.outputs=u,this.hostListeners=l,this.hostProperties=p,this.hostAttributes=d,this.lifecycleHooks=f,this.template=h}return e.create=function(t){var r=void 0===t?{}:t,n=r.type,i=r.isComponent,o=r.dynamicLoadable,c=r.selector,u=r.exportAs,l=r.changeDetection,d=r.inputs,h=r.outputs,g=r.host,m=r.lifecycleHooks,y=r.template,v={},_={},b={};a.isPresent(g)&&s.StringMapWrapper.forEach(g,function(e,t){var r=a.RegExpWrapper.firstMatch(f,t);a.isBlank(r)?b[t]=e:a.isPresent(r[1])?_[r[1]]=e:a.isPresent(r[2])&&(v[r[2]]=e)});var w={};a.isPresent(d)&&d.forEach(function(e){var t=p.splitAtColon(e,[e,e]);w[t[0]]=t[1]});var C={};return a.isPresent(h)&&h.forEach(function(e){var t=p.splitAtColon(e,[e,e]);C[t[0]]=t[1]}),new e({type:n,isComponent:a.normalizeBool(i),dynamicLoadable:a.normalizeBool(o),selector:c,exportAs:u,changeDetection:l,inputs:w,outputs:C,hostListeners:v,hostProperties:_,hostAttributes:b,lifecycleHooks:a.isPresent(m)?m:[],template:y})},e.fromJson=function(t){return new e({isComponent:t.isComponent,dynamicLoadable:t.dynamicLoadable,selector:t.selector,exportAs:t.exportAs,type:a.isPresent(t.type)?h.fromJson(t.type):t.type,changeDetection:a.isPresent(t.changeDetection)?c.CHANGE_DECTION_STRATEGY_VALUES[t.changeDetection]:t.changeDetection,inputs:t.inputs,outputs:t.outputs,hostListeners:t.hostListeners,hostProperties:t.hostProperties,hostAttributes:t.hostAttributes,lifecycleHooks:t.lifecycleHooks.map(function(e){return d.LIFECYCLE_HOOKS_VALUES[e]}),template:a.isPresent(t.template)?g.fromJson(t.template):t.template})},e.prototype.toJson=function(){return{isComponent:this.isComponent,dynamicLoadable:this.dynamicLoadable,selector:this.selector,exportAs:this.exportAs,type:a.isPresent(this.type)?this.type.toJson():this.type,changeDetection:a.isPresent(this.changeDetection)?a.serializeEnum(this.changeDetection):this.changeDetection,inputs:this.inputs,outputs:this.outputs,hostListeners:this.hostListeners,hostProperties:this.hostProperties,hostAttributes:this.hostAttributes,lifecycleHooks:this.lifecycleHooks.map(function(e){return a.serializeEnum(e)}),template:a.isPresent(this.template)?this.template.toJson():this.template}},e}();return t.CompileDirectiveMetadata=m,t.createHostComponentMeta=n,i.define=o,r.exports}),System.register("angular2/src/core/compiler/change_definition_factory",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/reflection/reflection","angular2/src/core/change_detection/change_detection","angular2/src/core/compiler/template_ast","angular2/src/core/linker/interfaces"],!0,function(e,t,r){function n(e,t,r,n){var o=[],a=new h(null,o,t);return d.templateVisitAll(a,n),i(o,e,r)}function i(e,t,r){var n=o(e);return e.map(function(e){var i=t.name+"_"+e.viewIndex;return new p.ChangeDetectorDefinition(i,e.strategy,n[e.viewIndex],e.bindingRecords,e.eventRecords,e.directiveRecords,r)})}function o(e){var t=c.ListWrapper.createFixedSize(e.length);return e.forEach(function(e){var r=u.isPresent(e.parent)?t[e.parent.viewIndex]:[];t[e.viewIndex]=r.concat(e.variableNames)}),t}var a=System.global,s=a.define;a.define=void 0;var c=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/reflection/reflection"),p=e("angular2/src/core/change_detection/change_detection"),d=e("angular2/src/core/compiler/template_ast"),f=e("angular2/src/core/linker/interfaces");t.createChangeDetectorDefinitions=n;var h=function(){function e(e,t,r){this.parent=e,this.allVisitors=t,this.strategy=r,this.boundTextCount=0,this.boundElementCount=0,this.variableNames=[],this.bindingRecords=[],this.eventRecords=[],this.directiveRecords=[],this.viewIndex=t.length,t.push(this)}return e.prototype.visitEmbeddedTemplate=function(t,r){this.boundElementCount++;for(var n=0;n<t.directives.length;n++)t.directives[n].visit(this,n);var i=new e(this,this.allVisitors,p.ChangeDetectionStrategy.Default);return d.templateVisitAll(i,t.vars),d.templateVisitAll(i,t.children),null},e.prototype.visitElement=function(e,t){e.isBound()&&this.boundElementCount++,d.templateVisitAll(this,e.inputs,null),d.templateVisitAll(this,e.outputs),d.templateVisitAll(this,e.exportAsVars);for(var r=0;r<e.directives.length;r++)e.directives[r].visit(this,r);return d.templateVisitAll(this,e.children),null},e.prototype.visitNgContent=function(e,t){return null},e.prototype.visitVariable=function(e,t){return this.variableNames.push(e.name),null},e.prototype.visitEvent=function(e,t){var r=u.isPresent(t)?p.BindingRecord.createForHostEvent(e.handler,e.fullName,t):p.BindingRecord.createForEvent(e.handler,e.fullName,this.boundElementCount-1);return this.eventRecords.push(r),null},e.prototype.visitElementProperty=function(e,t){var r,n=this.boundElementCount-1,i=u.isPresent(t)?t.directiveIndex:null;return e.type===d.PropertyBindingType.Property?r=u.isPresent(i)?p.BindingRecord.createForHostProperty(i,e.value,e.name):p.BindingRecord.createForElementProperty(e.value,n,e.name):e.type===d.PropertyBindingType.Attribute?r=u.isPresent(i)?p.BindingRecord.createForHostAttribute(i,e.value,e.name):p.BindingRecord.createForElementAttribute(e.value,n,e.name):e.type===d.PropertyBindingType.Class?r=u.isPresent(i)?p.BindingRecord.createForHostClass(i,e.value,e.name):p.BindingRecord.createForElementClass(e.value,n,e.name):e.type===d.PropertyBindingType.Style&&(r=u.isPresent(i)?p.BindingRecord.createForHostStyle(i,e.value,e.name,e.unit):p.BindingRecord.createForElementStyle(e.value,n,e.name,e.unit)),this.bindingRecords.push(r),null},e.prototype.visitAttr=function(e,t){return null},e.prototype.visitBoundText=function(e,t){var r=this.boundTextCount++;return this.bindingRecords.push(p.BindingRecord.createForTextNode(e.value,r)),null},e.prototype.visitText=function(e,t){return null},e.prototype.visitDirective=function(e,t){var r=new p.DirectiveIndex(this.boundElementCount-1,t),n=e.directive,i=new p.DirectiveRecord({directiveIndex:r,callAfterContentInit:-1!==n.lifecycleHooks.indexOf(f.LifecycleHooks.AfterContentInit),callAfterContentChecked:-1!==n.lifecycleHooks.indexOf(f.LifecycleHooks.AfterContentChecked),callAfterViewInit:-1!==n.lifecycleHooks.indexOf(f.LifecycleHooks.AfterViewInit),callAfterViewChecked:-1!==n.lifecycleHooks.indexOf(f.LifecycleHooks.AfterViewChecked),callOnChanges:-1!==n.lifecycleHooks.indexOf(f.LifecycleHooks.OnChanges),callDoCheck:-1!==n.lifecycleHooks.indexOf(f.LifecycleHooks.DoCheck),callOnInit:-1!==n.lifecycleHooks.indexOf(f.LifecycleHooks.OnInit),changeDetection:n.changeDetection});this.directiveRecords.push(i),d.templateVisitAll(this,e.inputs,i);var o=this.bindingRecords;return i.callOnChanges&&o.push(p.BindingRecord.createDirectiveOnChanges(i)),i.callOnInit&&o.push(p.BindingRecord.createDirectiveOnInit(i)),i.callDoCheck&&o.push(p.BindingRecord.createDirectiveDoCheck(i)),d.templateVisitAll(this,e.hostProperties,i),d.templateVisitAll(this,e.hostEvents,i),d.templateVisitAll(this,e.exportAsVars),null},e.prototype.visitDirectiveProperty=function(e,t){var r=l.reflector.setter(e.directiveName);return this.bindingRecords.push(p.BindingRecord.createForDirective(e.value,e.directiveName,r,t)),null},e}();return a.define=s,r.exports}),System.register("angular2/src/core/compiler/style_compiler",["angular2/src/core/compiler/source_module","angular2/src/core/metadata/view","angular2/src/core/compiler/xhr","angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/compiler/shadow_css","angular2/src/core/compiler/url_resolver","angular2/src/core/compiler/style_url_resolver","angular2/src/core/compiler/util","angular2/src/core/di"],!0,function(e,t,r){function n(e,t){return m.StringWrapper.replaceAll(P,R,s(e,t))}function i(e,t){return m.StringWrapper.replaceAll(D,R,c(e,t))}function o(e,t){return m.StringWrapper.replaceAll(S,R,s(e,t))}function a(e,t){return m.StringWrapper.replaceAll(x,R,c(e,t))}function s(e,t){return e+"-"+t}function c(e,t){return e+"+'-'+"+w.codeGenToString(t)}var u=System.global,l=u.define;u.define=void 0;var p=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},d=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},f=e("angular2/src/core/compiler/source_module"),h=e("angular2/src/core/metadata/view"),g=e("angular2/src/core/compiler/xhr"),m=e("angular2/src/core/facade/lang"),y=e("angular2/src/core/facade/async"),v=e("angular2/src/core/compiler/shadow_css"),_=e("angular2/src/core/compiler/url_resolver"),b=e("angular2/src/core/compiler/style_url_resolver"),w=e("angular2/src/core/compiler/util"),C=e("angular2/src/core/di"),E="%COMP%",R=/%COMP%/g,S="_nghost-"+E,x="'_nghost-'+"+E,P="_ngcontent-"+E,D="'_ngcontent-'+"+E,I=function(){function e(e,t){this._xhr=e,this._urlResolver=t,this._styleCache=new Map,this._shadowCss=new v.ShadowCss}return e.prototype.compileComponentRuntime=function(e,t,r){var n=r.styles,i=r.styleUrls;return this._loadStyles(n,i,r.encapsulation===h.ViewEncapsulation.Emulated).then(function(r){return r.map(function(r){return m.StringWrapper.replaceAll(r,R,s(e,t))})})},e.prototype.compileComponentCodeGen=function(e,t,r){var n,i=r.encapsulation===h.ViewEncapsulation.Emulated;return n=i?w.codeGenMapArray(["style"],"style"+w.codeGenReplaceAll(E,c(e,t))):"",this._styleCodeGen(r.styles,r.styleUrls,i,n)},e.prototype.compileStylesheetCodeGen=function(e,t){var r=b.resolveStyleUrls(this._urlResolver,e,t);return[this._styleModule(e,!1,this._styleCodeGen([r.style],r.styleUrls,!1,"")),this._styleModule(e,!0,this._styleCodeGen([r.style],r.styleUrls,!0,""))]},e.prototype.clearCache=function(){this._styleCache.clear()},e.prototype._loadStyles=function(e,t,r){var n=this,i=t.map(function(e){var t=""+e+(r?".shim":""),i=n._styleCache.get(t);return m.isBlank(i)&&(i=n._xhr.get(e).then(function(t){var i=b.resolveStyleUrls(n._urlResolver,e,t);return n._loadStyles([i.style],i.styleUrls,r)}),n._styleCache.set(t,i)),i});return y.PromiseWrapper.all(i).then(function(t){var i=e.map(function(e){return n._shimIfNeeded(e,r)});return t.forEach(function(e){return e.forEach(function(e){return i.push(e)})}),i})},e.prototype._styleCodeGen=function(e,t,r,n){var i=this,o="(";o+="["+e.map(function(e){return w.escapeSingleQuoteString(i._shimIfNeeded(e,r))}).join(",")+"]";for(var a=0;a<t.length;a++){var s=this._createModuleUrl(t[a],r);o+=w.codeGenConcatArray(f.moduleRef(s)+"STYLES")}return o+=")"+n,new f.SourceExpression([],o)},e.prototype._styleModule=function(e,t,r){var n="\n "+r.declarations.join("\n")+"\n "+w.codeGenExportVariable("STYLES")+r.expression+";\n ";return new f.SourceModule(this._createModuleUrl(e,t),n)},e.prototype._shimIfNeeded=function(e,t){return t?this._shadowCss.shimCssText(e,P,S):e},e.prototype._createModuleUrl=function(e,t){return t?e+".shim"+w.MODULE_SUFFIX:""+e+w.MODULE_SUFFIX},e=p([C.Injectable(),d("design:paramtypes",[g.XHR,_.UrlResolver])],e)}();return t.StyleCompiler=I,t.shimContentAttribute=n,t.shimContentAttributeExpr=i,t.shimHostAttribute=o,t.shimHostAttributeExpr=a,u.define=l,r.exports}),System.register("angular2/src/core/compiler/html_parser",["angular2/src/core/facade/lang","angular2/src/core/dom/dom_adapter","angular2/src/core/compiler/html_ast","angular2/src/core/compiler/util","angular2/src/core/di"],!0,function(e,t,r){
function n(e,t,r){var n=f.DOM.getText(e);return new h.HtmlTextAst(n,r+" > #text("+n+"):nth-child("+t+")")}function i(e,t,r,n){return new h.HtmlAttrAst(r,n,t+"["+r+"="+n+"]")}function o(e,t,r){var n=f.DOM.nodeName(e).toLowerCase(),i=r+" > "+n+":nth-child("+t+")",o=a(e,i),c=s(e,i);return new h.HtmlElementAst(n,o,c,i)}function a(e,t){var r=f.DOM.attributeMap(e),n=[];return r.forEach(function(e,t){return n.push([t,e])}),n.sort(function(e,t){return d.StringWrapper.compare(e[0],t[0])}),n.map(function(r){return i(e,t,r[0],r[1])})}function s(e,t){var r=f.DOM.templateAwareRoot(e),i=f.DOM.childNodesAsList(r),a=[],s=0;return i.forEach(function(e){var r=null;if(f.DOM.isTextNode(e)){var i=e;r=n(i,s,t)}else if(f.DOM.isElementNode(e)){var c=e;r=o(c,s,t)}d.isPresent(r)&&a.push(r),s++}),a}var c=System.global,u=c.define;c.define=void 0;var l=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},p=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},d=e("angular2/src/core/facade/lang"),f=e("angular2/src/core/dom/dom_adapter"),h=e("angular2/src/core/compiler/html_ast"),g=e("angular2/src/core/compiler/util"),m=e("angular2/src/core/di"),y=function(){function e(){}return e.prototype.parse=function(e,t){var r=f.DOM.createTemplate(e);return s(r,t)},e.prototype.unparse=function(e){var t=new v,r=[];return h.htmlVisitAll(t,e,r),r.join("")},e=l([m.Injectable(),p("design:paramtypes",[])],e)}();t.HtmlParser=y;var v=function(){function e(){}return e.prototype.visitElement=function(e,t){t.push("<"+e.name);var r=[];return h.htmlVisitAll(this,e.attrs,r),e.attrs.length>0&&(t.push(" "),t.push(r.join(" "))),t.push(">"),h.htmlVisitAll(this,e.children,t),t.push("</"+e.name+">"),null},e.prototype.visitAttr=function(e,t){return t.push(e.name+"="+g.escapeDoubleQuoteString(e.value)),null},e.prototype.visitText=function(e,t){return t.push(e.value),null},e}();return c.define=u,r.exports}),System.register("angular2/src/core/forms/model",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/facade/collection","angular2/src/core/forms/validators"],!0,function(e,t,r){function n(e){return e instanceof d}function i(e,t){return c.isBlank(t)?null:(t instanceof Array||(t=t.split("/")),t instanceof Array&&l.ListWrapper.isEmpty(t)?null:l.ListWrapper.reduce(t,function(e,t){if(e instanceof h)return c.isPresent(e.controls[t])?e.controls[t]:null;if(e instanceof g){var r=t;return c.isPresent(e.at(r))?e.at(r):null}return null},e))}var o=System.global,a=o.define;o.define=void 0;var s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/async"),l=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/forms/validators");t.VALID="VALID",t.INVALID="INVALID",t.isControl=n;var d=function(){function e(e){this.validator=e,this._pristine=!0,this._touched=!1}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._status},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valid",{get:function(){return this._status===t.VALID},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errors",{get:function(){return this._errors},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pristine",{get:function(){return this._pristine},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dirty",{get:function(){return!this.pristine},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touched",{get:function(){return this._touched},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"untouched",{get:function(){return!this._touched},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valueChanges",{get:function(){return this._valueChanges},enumerable:!0,configurable:!0}),e.prototype.markAsTouched=function(){this._touched=!0},e.prototype.markAsDirty=function(e){var t=(void 0===e?{}:e).onlySelf;t=c.normalizeBool(t),this._pristine=!1,c.isPresent(this._parent)&&!t&&this._parent.markAsDirty({onlySelf:t})},e.prototype.setParent=function(e){this._parent=e},e.prototype.updateValidity=function(e){var r=(void 0===e?{}:e).onlySelf;r=c.normalizeBool(r),this._errors=this.validator(this),this._status=c.isPresent(this._errors)?t.INVALID:t.VALID,c.isPresent(this._parent)&&!r&&this._parent.updateValidity({onlySelf:r})},e.prototype.updateValueAndValidity=function(e){var r=void 0===e?{}:e,n=r.onlySelf,i=r.emitEvent;n=c.normalizeBool(n),i=c.isPresent(i)?i:!0,this._updateValue(),i&&u.ObservableWrapper.callNext(this._valueChanges,this._value),this._errors=this.validator(this),this._status=c.isPresent(this._errors)?t.INVALID:t.VALID,c.isPresent(this._parent)&&!n&&this._parent.updateValueAndValidity({onlySelf:n,emitEvent:i})},e.prototype.find=function(e){return i(this,e)},e.prototype.getError=function(e,t){void 0===t&&(t=null);var r=c.isPresent(t)&&!l.ListWrapper.isEmpty(t)?this.find(t):this;return c.isPresent(r)&&c.isPresent(r._errors)?l.StringMapWrapper.get(r._errors,e):null},e.prototype.hasError=function(e,t){return void 0===t&&(t=null),c.isPresent(this.getError(e,t))},e.prototype._updateValue=function(){},e}();t.AbstractControl=d;var f=function(e){function t(t,r){void 0===t&&(t=null),void 0===r&&(r=p.Validators.nullValidator),e.call(this,r),this._value=t,this.updateValidity({onlySelf:!0}),this._valueChanges=new u.EventEmitter}return s(t,e),t.prototype.updateValue=function(e,t){var r=void 0===t?{}:t,n=r.onlySelf,i=r.emitEvent,o=r.emitModelToViewChange;o=c.isPresent(o)?o:!0,this._value=e,c.isPresent(this._onChange)&&o&&this._onChange(this._value),this.updateValueAndValidity({onlySelf:n,emitEvent:i})},t.prototype.registerOnChange=function(e){this._onChange=e},t}(d);t.Control=f;var h=function(e){function t(t,r,n){void 0===r&&(r=null),void 0===n&&(n=p.Validators.group),e.call(this,n),this.controls=t,this._optionals=c.isPresent(r)?r:{},this._valueChanges=new u.EventEmitter,this._setParentForControls(),this._value=this._reduceValue(),this.updateValidity({onlySelf:!0})}return s(t,e),t.prototype.addControl=function(e,t){this.controls[e]=t,t.setParent(this)},t.prototype.removeControl=function(e){l.StringMapWrapper["delete"](this.controls,e)},t.prototype.include=function(e){l.StringMapWrapper.set(this._optionals,e,!0),this.updateValueAndValidity()},t.prototype.exclude=function(e){l.StringMapWrapper.set(this._optionals,e,!1),this.updateValueAndValidity()},t.prototype.contains=function(e){var t=l.StringMapWrapper.contains(this.controls,e);return t&&this._included(e)},t.prototype._setParentForControls=function(){var e=this;l.StringMapWrapper.forEach(this.controls,function(t,r){t.setParent(e)})},t.prototype._updateValue=function(){this._value=this._reduceValue()},t.prototype._reduceValue=function(){return this._reduceChildren({},function(e,t,r){return e[r]=t.value,e})},t.prototype._reduceChildren=function(e,t){var r=this,n=e;return l.StringMapWrapper.forEach(this.controls,function(e,i){r._included(i)&&(n=t(n,e,i))}),n},t.prototype._included=function(e){var t=l.StringMapWrapper.contains(this._optionals,e);return!t||l.StringMapWrapper.get(this._optionals,e)},t}(d);t.ControlGroup=h;var g=function(e){function t(t,r){void 0===r&&(r=p.Validators.array),e.call(this,r),this.controls=t,this._valueChanges=new u.EventEmitter,this._setParentForControls(),this._updateValue(),this.updateValidity({onlySelf:!0})}return s(t,e),t.prototype.at=function(e){return this.controls[e]},t.prototype.push=function(e){this.controls.push(e),e.setParent(this),this.updateValueAndValidity()},t.prototype.insert=function(e,t){l.ListWrapper.insert(this.controls,e,t),t.setParent(this),this.updateValueAndValidity()},t.prototype.removeAt=function(e){l.ListWrapper.removeAt(this.controls,e),this.updateValueAndValidity()},Object.defineProperty(t.prototype,"length",{get:function(){return this.controls.length},enumerable:!0,configurable:!0}),t.prototype._updateValue=function(){this._value=this.controls.map(function(e){return e.value})},t.prototype._setParentForControls=function(){var e=this;this.controls.forEach(function(t){t.setParent(e)})},t}(d);return t.ControlArray=g,o.define=a,r.exports}),System.register("angular2/src/core/linker",["angular2/src/core/linker/directive_resolver","angular2/src/core/linker/compiler","angular2/src/core/linker/view_manager","angular2/src/core/linker/query_list","angular2/src/core/linker/dynamic_component_loader","angular2/src/core/linker/element_ref","angular2/src/core/linker/template_ref","angular2/src/core/linker/view_ref","angular2/src/core/linker/view_container_ref","angular2/src/core/linker/dynamic_component_loader"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/linker/directive_resolver");t.DirectiveResolver=o.DirectiveResolver;var a=e("angular2/src/core/linker/compiler");t.Compiler=a.Compiler;var s=e("angular2/src/core/linker/view_manager");t.AppViewManager=s.AppViewManager;var c=e("angular2/src/core/linker/query_list");t.QueryList=c.QueryList;var u=e("angular2/src/core/linker/dynamic_component_loader");t.DynamicComponentLoader=u.DynamicComponentLoader;var l=e("angular2/src/core/linker/element_ref");t.ElementRef=l.ElementRef;var p=e("angular2/src/core/linker/template_ref");t.TemplateRef=p.TemplateRef;var d=e("angular2/src/core/linker/view_ref");t.ViewRef=d.ViewRef,t.ProtoViewRef=d.ProtoViewRef;var f=e("angular2/src/core/linker/view_container_ref");t.ViewContainerRef=f.ViewContainerRef;var h=e("angular2/src/core/linker/dynamic_component_loader");return t.ComponentRef=h.ComponentRef,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives",["angular2/src/core/facade/lang","angular2/src/core/forms/directives/ng_control_name","angular2/src/core/forms/directives/ng_form_control","angular2/src/core/forms/directives/ng_model","angular2/src/core/forms/directives/ng_control_group","angular2/src/core/forms/directives/ng_form_model","angular2/src/core/forms/directives/ng_form","angular2/src/core/forms/directives/default_value_accessor","angular2/src/core/forms/directives/checkbox_value_accessor","angular2/src/core/forms/directives/ng_control_status","angular2/src/core/forms/directives/select_control_value_accessor","angular2/src/core/forms/directives/validators","angular2/src/core/forms/directives/ng_control_name","angular2/src/core/forms/directives/ng_form_control","angular2/src/core/forms/directives/ng_model","angular2/src/core/forms/directives/ng_control","angular2/src/core/forms/directives/ng_control_group","angular2/src/core/forms/directives/ng_form_model","angular2/src/core/forms/directives/ng_form","angular2/src/core/forms/directives/default_value_accessor","angular2/src/core/forms/directives/checkbox_value_accessor","angular2/src/core/forms/directives/select_control_value_accessor","angular2/src/core/forms/directives/validators","angular2/src/core/forms/directives/ng_control_status"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/forms/directives/ng_control_name"),s=e("angular2/src/core/forms/directives/ng_form_control"),c=e("angular2/src/core/forms/directives/ng_model"),u=e("angular2/src/core/forms/directives/ng_control_group"),l=e("angular2/src/core/forms/directives/ng_form_model"),p=e("angular2/src/core/forms/directives/ng_form"),d=e("angular2/src/core/forms/directives/default_value_accessor"),f=e("angular2/src/core/forms/directives/checkbox_value_accessor"),h=e("angular2/src/core/forms/directives/ng_control_status"),g=e("angular2/src/core/forms/directives/select_control_value_accessor"),m=e("angular2/src/core/forms/directives/validators"),y=e("angular2/src/core/forms/directives/ng_control_name");t.NgControlName=y.NgControlName;var v=e("angular2/src/core/forms/directives/ng_form_control");t.NgFormControl=v.NgFormControl;var _=e("angular2/src/core/forms/directives/ng_model");t.NgModel=_.NgModel;var b=e("angular2/src/core/forms/directives/ng_control");t.NgControl=b.NgControl;var w=e("angular2/src/core/forms/directives/ng_control_group");t.NgControlGroup=w.NgControlGroup;var C=e("angular2/src/core/forms/directives/ng_form_model");t.NgFormModel=C.NgFormModel;var E=e("angular2/src/core/forms/directives/ng_form");t.NgForm=E.NgForm;var R=e("angular2/src/core/forms/directives/default_value_accessor");t.DefaultValueAccessor=R.DefaultValueAccessor;var S=e("angular2/src/core/forms/directives/checkbox_value_accessor");t.CheckboxControlValueAccessor=S.CheckboxControlValueAccessor;var x=e("angular2/src/core/forms/directives/select_control_value_accessor");t.SelectControlValueAccessor=x.SelectControlValueAccessor,t.NgSelectOption=x.NgSelectOption;var P=e("angular2/src/core/forms/directives/validators");t.DefaultValidators=P.DefaultValidators;var D=e("angular2/src/core/forms/directives/ng_control_status");return t.NgControlStatus=D.NgControlStatus,t.FORM_DIRECTIVES=o.CONST_EXPR([a.NgControlName,u.NgControlGroup,s.NgFormControl,c.NgModel,l.NgFormModel,p.NgForm,g.NgSelectOption,d.DefaultValueAccessor,f.CheckboxControlValueAccessor,g.SelectControlValueAccessor,h.NgControlStatus,m.DefaultValidators]),n.define=i,r.exports}),System.register("angular2/src/core/dom/browser_adapter",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/dom/dom_adapter","angular2/src/core/dom/generic_browser_adapter"],!0,function(e,t,r){function n(){return u.isBlank(y)&&(y=document.querySelector("base"),u.isBlank(y))?null:y.getAttribute("href")}function i(e){return u.isBlank(v)&&(v=document.createElement("a")),v.setAttribute("href",e),"/"===v.pathname.charAt(0)?v.pathname:"/"+v.pathname}var o=System.global,a=o.define;o.define=void 0;var s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},c=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/dom/dom_adapter"),p=e("angular2/src/core/dom/generic_browser_adapter"),d={"class":"className",innerHtml:"innerHTML",readonly:"readOnly",tabindex:"tabIndex"},f=3,h={"\b":"Backspace"," ":"Tab","":"Delete","":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},g={A:"1",B:"2",C:"3",D:"4",E:"5",F:"6",G:"7",H:"8",I:"9",J:"*",K:"+",M:"-",N:".",O:"/","`":"0","":"NumLock"},m=function(e){function t(){e.apply(this,arguments)}return s(t,e),t.prototype.parse=function(e){throw new Error("parse not implemented")},t.makeCurrent=function(){l.setRootDomAdapter(new t)},t.prototype.hasProperty=function(e,t){return t in e},t.prototype.setProperty=function(e,t,r){e[t]=r},t.prototype.getProperty=function(e,t){return e[t]},t.prototype.invoke=function(e,t,r){e[t].apply(e,r)},t.prototype.logError=function(e){window.console.error?window.console.error(e):window.console.log(e)},t.prototype.log=function(e){window.console.log(e)},t.prototype.logGroup=function(e){window.console.group?(window.console.group(e),this.logError(e)):window.console.log(e)},t.prototype.logGroupEnd=function(){window.console.groupEnd&&window.console.groupEnd()},Object.defineProperty(t.prototype,"attrToPropMap",{get:function(){return d},enumerable:!0,configurable:!0}),t.prototype.query=function(e){return document.querySelector(e)},t.prototype.querySelector=function(e,t){return e.querySelector(t)},t.prototype.querySelectorAll=function(e,t){return e.querySelectorAll(t)},t.prototype.on=function(e,t,r){e.addEventListener(t,r,!1)},t.prototype.onAndCancel=function(e,t,r){return e.addEventListener(t,r,!1),function(){e.removeEventListener(t,r,!1)}},t.prototype.dispatchEvent=function(e,t){e.dispatchEvent(t)},t.prototype.createMouseEvent=function(e){var t=document.createEvent("MouseEvent");return t.initEvent(e,!0,!0),t},t.prototype.createEvent=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t},t.prototype.preventDefault=function(e){e.preventDefault(),e.returnValue=!1},t.prototype.isPrevented=function(e){return e.defaultPrevented||u.isPresent(e.returnValue)&&!e.returnValue},t.prototype.getInnerHTML=function(e){return e.innerHTML},t.prototype.getOuterHTML=function(e){return e.outerHTML},t.prototype.nodeName=function(e){return e.nodeName},t.prototype.nodeValue=function(e){return e.nodeValue},t.prototype.type=function(e){return e.type},t.prototype.content=function(e){return this.hasProperty(e,"content")?e.content:e},t.prototype.firstChild=function(e){return e.firstChild},t.prototype.nextSibling=function(e){return e.nextSibling},t.prototype.parentElement=function(e){return e.parentNode},t.prototype.childNodes=function(e){return e.childNodes},t.prototype.childNodesAsList=function(e){for(var t=e.childNodes,r=c.ListWrapper.createFixedSize(t.length),n=0;n<t.length;n++)r[n]=t[n];return r},t.prototype.clearNodes=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},t.prototype.appendChild=function(e,t){e.appendChild(t)},t.prototype.removeChild=function(e,t){e.removeChild(t)},t.prototype.replaceChild=function(e,t,r){e.replaceChild(t,r)},t.prototype.remove=function(e){return e.parentNode&&e.parentNode.removeChild(e),e},t.prototype.insertBefore=function(e,t){e.parentNode.insertBefore(t,e)},t.prototype.insertAllBefore=function(e,t){t.forEach(function(t){return e.parentNode.insertBefore(t,e)})},t.prototype.insertAfter=function(e,t){e.parentNode.insertBefore(t,e.nextSibling)},t.prototype.setInnerHTML=function(e,t){e.innerHTML=t},t.prototype.getText=function(e){return e.textContent},t.prototype.setText=function(e,t){e.textContent=t},t.prototype.getValue=function(e){return e.value},t.prototype.setValue=function(e,t){e.value=t},t.prototype.getChecked=function(e){return e.checked},t.prototype.setChecked=function(e,t){e.checked=t},t.prototype.createComment=function(e){return document.createComment(e)},t.prototype.createTemplate=function(e){var t=document.createElement("template");return t.innerHTML=e,t},t.prototype.createElement=function(e,t){return void 0===t&&(t=document),t.createElement(e)},t.prototype.createTextNode=function(e,t){return void 0===t&&(t=document),t.createTextNode(e)},t.prototype.createScriptTag=function(e,t,r){void 0===r&&(r=document);var n=r.createElement("SCRIPT");return n.setAttribute(e,t),n},t.prototype.createStyleElement=function(e,t){void 0===t&&(t=document);var r=t.createElement("style");return this.appendChild(r,this.createTextNode(e)),r},t.prototype.createShadowRoot=function(e){return e.createShadowRoot()},t.prototype.getShadowRoot=function(e){return e.shadowRoot},t.prototype.getHost=function(e){return e.host},t.prototype.clone=function(e){return e.cloneNode(!0)},t.prototype.getElementsByClassName=function(e,t){return e.getElementsByClassName(t)},t.prototype.getElementsByTagName=function(e,t){return e.getElementsByTagName(t)},t.prototype.classList=function(e){return Array.prototype.slice.call(e.classList,0)},t.prototype.addClass=function(e,t){e.classList.add(t)},t.prototype.removeClass=function(e,t){e.classList.remove(t)},t.prototype.hasClass=function(e,t){return e.classList.contains(t)},t.prototype.setStyle=function(e,t,r){e.style[t]=r},t.prototype.removeStyle=function(e,t){e.style[t]=null},t.prototype.getStyle=function(e,t){return e.style[t]},t.prototype.tagName=function(e){return e.tagName},t.prototype.attributeMap=function(e){for(var t=new Map,r=e.attributes,n=0;n<r.length;n++){var i=r[n];t.set(i.name,i.value)}return t},t.prototype.hasAttribute=function(e,t){return e.hasAttribute(t)},t.prototype.getAttribute=function(e,t){return e.getAttribute(t)},t.prototype.setAttribute=function(e,t,r){e.setAttribute(t,r)},t.prototype.removeAttribute=function(e,t){e.removeAttribute(t)},t.prototype.templateAwareRoot=function(e){return this.isTemplateElement(e)?this.content(e):e},t.prototype.createHtmlDocument=function(){return document.implementation.createHTMLDocument("fakeTitle")},t.prototype.defaultDoc=function(){return document},t.prototype.getBoundingClientRect=function(e){try{return e.getBoundingClientRect()}catch(t){return{top:0,bottom:0,left:0,right:0,width:0,height:0}}},t.prototype.getTitle=function(){return document.title},t.prototype.setTitle=function(e){document.title=e||""},t.prototype.elementMatches=function(e,t){var r=!1;return e instanceof HTMLElement&&(e.matches?r=e.matches(t):e.msMatchesSelector?r=e.msMatchesSelector(t):e.webkitMatchesSelector&&(r=e.webkitMatchesSelector(t))),r},t.prototype.isTemplateElement=function(e){return e instanceof HTMLElement&&"TEMPLATE"==e.nodeName},t.prototype.isTextNode=function(e){return e.nodeType===Node.TEXT_NODE},t.prototype.isCommentNode=function(e){return e.nodeType===Node.COMMENT_NODE},t.prototype.isElementNode=function(e){return e.nodeType===Node.ELEMENT_NODE},t.prototype.hasShadowRoot=function(e){return e instanceof HTMLElement&&u.isPresent(e.shadowRoot)},t.prototype.isShadowRoot=function(e){return e instanceof DocumentFragment},t.prototype.importIntoDoc=function(e){var t=e;return this.isTemplateElement(e)&&(t=this.content(e)),document.importNode(t,!0)},t.prototype.adoptNode=function(e){return document.adoptNode(e)},t.prototype.isPageRule=function(e){return e.type===CSSRule.PAGE_RULE},t.prototype.isStyleRule=function(e){return e.type===CSSRule.STYLE_RULE},t.prototype.isMediaRule=function(e){return e.type===CSSRule.MEDIA_RULE},t.prototype.isKeyframesRule=function(e){return e.type===CSSRule.KEYFRAMES_RULE},t.prototype.getHref=function(e){return e.href},t.prototype.getEventKey=function(e){var t=e.key;if(u.isBlank(t)){if(t=e.keyIdentifier,u.isBlank(t))return"Unidentified";t.startsWith("U+")&&(t=String.fromCharCode(parseInt(t.substring(2),16)),e.location===f&&g.hasOwnProperty(t)&&(t=g[t]))}return h.hasOwnProperty(t)&&(t=h[t]),t},t.prototype.getGlobalEventTarget=function(e){return"window"==e?window:"document"==e?document:"body"==e?document.body:void 0},t.prototype.getHistory=function(){return window.history},t.prototype.getLocation=function(){return window.location},t.prototype.getBaseHref=function(){var e=n();return u.isBlank(e)?null:i(e)},t.prototype.resetBaseElement=function(){y=null},t.prototype.getUserAgent=function(){return window.navigator.userAgent},t.prototype.setData=function(e,t,r){this.setAttribute(e,"data-"+t,r)},t.prototype.getData=function(e,t){return this.getAttribute(e,"data-"+t)},t.prototype.getComputedStyle=function(e){return getComputedStyle(e)},t.prototype.setGlobalVar=function(e,t){u.setValueOnPath(u.global,e,t)},t.prototype.requestAnimationFrame=function(e){return window.requestAnimationFrame(e)},t.prototype.cancelAnimationFrame=function(e){window.cancelAnimationFrame(e)},t.prototype.performanceNow=function(){return u.isPresent(window.performance)&&u.isPresent(window.performance.now)?window.performance.now():u.DateWrapper.toMillis(u.DateWrapper.now())},t}(p.GenericBrowserDomAdapter);t.BrowserDomAdapter=m;var y=null,v=null;return o.define=a,r.exports}),System.register("angular2/src/core/testability/browser_testability",["angular2/src/core/testability/testability","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/testability/testability"),a=e("angular2/src/core/facade/lang"),s=function(){function e(e){this._testability=e}return e.prototype.isStable=function(){return this._testability.isStable()},e.prototype.whenStable=function(e){this._testability.whenStable(e)},e.prototype.findBindings=function(e,t,r){return this._testability.findBindings(e,t,r)},e}(),c=function(){function e(){}return e.init=function(){o.setTestabilityGetter(new e)},e.prototype.addToWindow=function(e){a.global.getAngularTestability=function(t,r){void 0===r&&(r=!0);var n=e.findTestabilityInTree(t,r);if(null==n)throw new Error("Could not find testability for element.");return new s(n)},a.global.getAllAngularTestabilities=function(){var t=e.getAllTestabilities();return t.map(function(e){return new s(e)})}},e}();return t.BrowserGetTestability=c,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/events/hammer_gestures",["angular2/src/core/render/dom/events/hammer_common","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/render/dom/events/hammer_common"),u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/di"),d=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.supports=function(t){if(!e.prototype.supports.call(this,t))return!1;if(!u.isPresent(window.Hammer))throw new l.BaseException("Hammer.js is not loaded, can not bind "+t+" event");return!0},t.prototype.addEventListener=function(e,t,r){var n=this.manager.getZone();t=t.toLowerCase(),n.runOutsideAngular(function(){var i=new Hammer(e);i.get("pinch").set({enable:!0}),i.get("rotate").set({enable:!0}),i.on(t,function(e){n.run(function(){r(e)})})})},t=a([p.Injectable(),s("design:paramtypes",[])],t)}(c.HammerGesturesPluginCommon);return t.HammerGesturesPlugin=d,n.define=i,r.exports}),System.register("angular2/src/core/application_ref",["angular2/src/core/zone/ng_zone","angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/application_tokens","angular2/src/core/facade/async","angular2/src/core/facade/collection","angular2/src/core/reflection/reflection","angular2/src/core/testability/testability","angular2/src/core/linker/dynamic_component_loader","angular2/src/core/facade/exceptions","angular2/src/core/dom/dom_adapter","angular2/src/core/linker/view_ref","angular2/src/core/life_cycle/life_cycle","angular2/src/core/change_detection/change_detection","angular2/src/core/linker/view_pool","angular2/src/core/linker/view_manager","angular2/src/core/linker/view_manager_utils","angular2/src/core/linker/view_listener","angular2/src/core/linker/proto_view_factory","angular2/src/core/pipes","angular2/src/core/linker/view_resolver","angular2/src/core/linker/directive_resolver","angular2/src/core/linker/pipe_resolver","angular2/src/core/linker/compiler","angular2/src/core/linker/dynamic_component_loader","angular2/src/core/linker/view_manager","angular2/src/core/linker/compiler"],!0,function(e,t,r){function n(){return[f.bind(y.Reflector).toValue(y.reflector),v.TestabilityRegistry]}function i(e){return[f.bind(h.APP_COMPONENT).toValue(e),f.bind(h.APP_COMPONENT_REF_PROMISE).toFactory(function(t,r){return t.loadAsRoot(e,null,r).then(function(e){return d.isPresent(e.location.nativeElement)&&r.get(v.TestabilityRegistry).registerApplication(e.location.nativeElement,r.get(v.Testability)),e})},[_.DynamicComponentLoader,f.Injector]),f.bind(e).toFactory(function(e){return e.then(function(e){return e.instance})},[h.APP_COMPONENT_REF_PROMISE])]}function o(){return[f.bind(N.Compiler).toClass(V.Compiler_),h.APP_ID_RANDOM_BINDING,S.AppViewPool,f.bind(S.APP_VIEW_POOL_CAPACITY).toValue(1e4),f.bind(x.AppViewManager).toClass(M.AppViewManager_),P.AppViewManagerUtils,D.AppViewListener,I.ProtoViewFactory,k.ViewResolver,O.DEFAULT_PIPES,f.bind(R.IterableDiffers).toValue(R.defaultIterableDiffers),f.bind(R.KeyValueDiffers).toValue(R.defaultKeyValueDiffers),A.DirectiveResolver,T.PipeResolver,f.bind(_.DynamicComponentLoader).toClass(j.DynamicComponentLoader_),f.bind(E.LifeCycle).toFactory(function(e){return new E.LifeCycle_(null,d.assertionsEnabled())},[b.ExceptionHandler])]}function a(){return new p.NgZone({enableLongStackTrace:d.assertionsEnabled()})}function s(e,t){if(d.isPresent(B)){if(d.isBlank(e))return B;throw"platform() can only be called once per page"}return d.isPresent(t)&&t(),d.isBlank(e)&&(e=n()),B=new F(f.Injector.resolveAndCreate(e),function(){B=null})}var c=System.global,u=c.define;c.define=void 0;var l=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},p=e("angular2/src/core/zone/ng_zone"),d=e("angular2/src/core/facade/lang"),f=e("angular2/src/core/di"),h=e("angular2/src/core/application_tokens"),g=e("angular2/src/core/facade/async"),m=e("angular2/src/core/facade/collection"),y=e("angular2/src/core/reflection/reflection"),v=e("angular2/src/core/testability/testability"),_=e("angular2/src/core/linker/dynamic_component_loader"),b=e("angular2/src/core/facade/exceptions"),w=e("angular2/src/core/dom/dom_adapter"),C=e("angular2/src/core/linker/view_ref"),E=e("angular2/src/core/life_cycle/life_cycle"),R=e("angular2/src/core/change_detection/change_detection"),S=e("angular2/src/core/linker/view_pool"),x=e("angular2/src/core/linker/view_manager"),P=e("angular2/src/core/linker/view_manager_utils"),D=e("angular2/src/core/linker/view_listener"),I=e("angular2/src/core/linker/proto_view_factory"),O=e("angular2/src/core/pipes"),k=e("angular2/src/core/linker/view_resolver"),A=e("angular2/src/core/linker/directive_resolver"),T=e("angular2/src/core/linker/pipe_resolver"),N=e("angular2/src/core/linker/compiler"),j=e("angular2/src/core/linker/dynamic_component_loader"),M=e("angular2/src/core/linker/view_manager"),V=e("angular2/src/core/linker/compiler");t.platformBindings=n,t.applicationCommonBindings=o,t.createNgZone=a;var B;t.platformCommon=s;var L=function(){function e(){}return Object.defineProperty(e.prototype,"injector",{get:function(){return b.unimplemented()},enumerable:!0,configurable:!0}),e}();t.PlatformRef=L;var F=function(e){function t(t,r){e.call(this),this._injector=t,this._dispose=r,this._applications=[]}return l(t,e),Object.defineProperty(t.prototype,"injector",{get:function(){return this._injector},enumerable:!0,configurable:!0}),t.prototype.application=function(e){var t=this._initApp(a(),e);return t},t.prototype.asyncApplication=function(e){var t=this,r=a(),n=g.PromiseWrapper.completer();return r.run(function(){g.PromiseWrapper.then(e(r),function(e){n.resolve(t._initApp(r,e))})}),n.promise},t.prototype._initApp=function(e,t){var r,n=this;e.run(function(){t.push(f.bind(p.NgZone).toValue(e)),t.push(f.bind(W).toValue(n));var i;try{r=n.injector.resolveAndCreateChild(t),i=r.get(b.ExceptionHandler),e.overrideOnErrorHandler(function(e,t){return i.call(e,t)})}catch(o){d.isPresent(i)?i.call(o,o.stack):w.DOM.logError(o)}});var i=new U(this,e,r);return this._applications.push(i),i},t.prototype.dispose=function(){this._applications.forEach(function(e){return e.dispose()}),this._dispose()},t.prototype._applicationDisposed=function(e){m.ListWrapper.remove(this._applications,e)},t}(L);t.PlatformRef_=F;var W=function(){function e(){}return Object.defineProperty(e.prototype,"injector",{get:function(){return b.unimplemented()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"zone",{
get:function(){return b.unimplemented()},enumerable:!0,configurable:!0}),e}();t.ApplicationRef=W;var U=function(e){function t(t,r,n){e.call(this),this._platform=t,this._zone=r,this._injector=n,this._bootstrapListeners=[],this._rootComponents=[]}return l(t,e),t.prototype.registerBootstrapListener=function(e){this._bootstrapListeners.push(e)},t.prototype.bootstrap=function(e,t){var r=this,n=g.PromiseWrapper.completer();return this._zone.run(function(){var o=i(e);d.isPresent(t)&&o.push(t);var a=r._injector.get(b.ExceptionHandler);try{var s=r._injector.resolveAndCreateChild(o),c=s.get(h.APP_COMPONENT_REF_PROMISE),u=function(e){var t=C.internalView(e.hostView).changeDetector,i=s.get(E.LifeCycle);i.registerWith(r._zone,t),i.tick(),n.resolve(e),r._rootComponents.push(e),r._bootstrapListeners.forEach(function(t){return t(e)})},l=g.PromiseWrapper.then(c,u);g.PromiseWrapper.then(l,function(e){}),g.PromiseWrapper.then(l,null,function(e,t){return n.reject(e,t)})}catch(p){a.call(p,p.stack),n.reject(p,p.stack)}}),n.promise},Object.defineProperty(t.prototype,"injector",{get:function(){return this._injector},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"zone",{get:function(){return this._zone},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._rootComponents.forEach(function(e){return e.dispose()}),this._platform._applicationDisposed(this)},t}(W);return t.ApplicationRef_=U,c.define=u,r.exports}),System.register("angular2/src/core/services",["angular2/src/core/compiler/app_root_url","angular2/src/core/compiler/url_resolver","angular2/src/core/services/title"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/compiler/app_root_url");t.AppRootUrl=o.AppRootUrl;var a=e("angular2/src/core/compiler/url_resolver");t.UrlResolver=a.UrlResolver;var s=e("angular2/src/core/services/title");return t.Title=s.Title,n.define=i,r.exports}),System.register("angular2/src/core/directives",["angular2/src/core/facade/lang","angular2/src/core/directives/ng_class","angular2/src/core/directives/ng_for","angular2/src/core/directives/ng_if","angular2/src/core/directives/ng_style","angular2/src/core/directives/ng_switch","angular2/src/core/directives/ng_class","angular2/src/core/directives/ng_for","angular2/src/core/directives/ng_if","angular2/src/core/directives/ng_style","angular2/src/core/directives/ng_switch","angular2/src/core/directives/observable_list_diff"],!0,function(e,t,r){function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/directives/ng_class"),c=e("angular2/src/core/directives/ng_for"),u=e("angular2/src/core/directives/ng_if"),l=e("angular2/src/core/directives/ng_style"),p=e("angular2/src/core/directives/ng_switch"),d=e("angular2/src/core/directives/ng_class");t.NgClass=d.NgClass;var f=e("angular2/src/core/directives/ng_for");t.NgFor=f.NgFor;var h=e("angular2/src/core/directives/ng_if");t.NgIf=h.NgIf;var g=e("angular2/src/core/directives/ng_style");t.NgStyle=g.NgStyle;var m=e("angular2/src/core/directives/ng_switch");return t.NgSwitch=m.NgSwitch,t.NgSwitchWhen=m.NgSwitchWhen,t.NgSwitchDefault=m.NgSwitchDefault,n(e("angular2/src/core/directives/observable_list_diff")),t.CORE_DIRECTIVES=a.CONST_EXPR([s.NgClass,c.NgFor,u.NgIf,l.NgStyle,p.NgSwitch,p.NgSwitchWhen,p.NgSwitchDefault]),i.define=o,r.exports}),System.register("angular2/src/core/debug",["angular2/src/core/debug/debug_element","angular2/src/core/debug/debug_element_view_listener"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/debug/debug_element");t.DebugElement=o.DebugElement,t.asNativeElements=o.asNativeElements,t.By=o.By,t.Scope=o.Scope,t.inspectElement=o.inspectElement;var a=e("angular2/src/core/debug/debug_element_view_listener");return t.inspectNativeElement=a.inspectNativeElement,t.ELEMENT_PROBE_BINDINGS=a.ELEMENT_PROBE_BINDINGS,n.define=i,r.exports}),System.register("angular2/src/core/di/binding",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/reflection/reflection","angular2/src/core/di/key","angular2/src/core/di/metadata","angular2/src/core/di/exceptions","angular2/src/core/di/forward_ref"],!0,function(e,t,r){function n(e){return new k(e)}function i(e){var t,r;if(v.isPresent(e.toClass)){var n=S.resolveForwardRef(e.toClass);t=w.reflector.factory(n),r=p(n)}else v.isPresent(e.toAlias)?(t=function(e){return e},r=[x.fromKey(C.Key.get(e.toAlias))]):v.isPresent(e.toFactory)?(t=e.toFactory,r=l(e.toFactory,e.dependencies)):(t=function(){return e.toValue},r=P);return new O(t,r)}function o(e){return new I(C.Key.get(e.token),[i(e)],!1)}function a(e){var t=s(c(e,new Map));return t.map(function(e){if(e instanceof A)return new I(e.key,[e.resolvedFactory],!1);var t=e;return new I(t[0].key,t.map(function(e){return e.resolvedFactory}),!0)})}function s(e){return b.MapWrapper.values(e)}function c(e,t){return e.forEach(function(e){if(e instanceof v.Type)u(n(e).toClass(e),t);else if(e instanceof D)u(e,t);else{if(!(e instanceof Array))throw new R.InvalidBindingError(e instanceof k?e.token:e);c(e,t)}}),t}function u(e,t){var r=C.Key.get(e.token),n=i(e),o=new A(r,n);if(e.multi){var a=t.get(r.id);if(a instanceof Array)a.push(o);else{if(!v.isBlank(a))throw new R.MixingMultiBindingsWithRegularBindings(a,e);t.set(r.id,[o])}}else{var a=t.get(r.id);if(a instanceof Array)throw new R.MixingMultiBindingsWithRegularBindings(a,e);t.set(r.id,o)}}function l(e,t){if(v.isBlank(t))return p(e);var r=t.map(function(e){return[e]});return t.map(function(t){return d(e,t,r)})}function p(e){var t=w.reflector.parameters(e);if(v.isBlank(t))return[];if(b.ListWrapper.any(t,function(e){return v.isBlank(e)}))throw new R.NoAnnotationError(e,t);return t.map(function(r){return d(e,r,t)})}function d(e,t,r){var n=[],i=null,o=!1;if(!v.isArray(t))return f(t,o,null,null,n);for(var a=null,s=null,c=0;c<t.length;++c){var u=t[c];u instanceof v.Type?i=u:u instanceof E.InjectMetadata?i=u.token:u instanceof E.OptionalMetadata?o=!0:u instanceof E.SelfMetadata?s=u:u instanceof E.HostMetadata?s=u:u instanceof E.SkipSelfMetadata?a=u:u instanceof E.DependencyMetadata&&(v.isPresent(u.token)&&(i=u.token),n.push(u))}if(i=S.resolveForwardRef(i),v.isPresent(i))return f(i,o,a,s,n);throw new R.NoAnnotationError(e,r)}function f(e,t,r,n,i){return new x(C.Key.get(e),t,r,n,i)}var h=System.global,g=h.define;h.define=void 0;var m=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},y=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},v=e("angular2/src/core/facade/lang"),_=e("angular2/src/core/facade/exceptions"),b=e("angular2/src/core/facade/collection"),w=e("angular2/src/core/reflection/reflection"),C=e("angular2/src/core/di/key"),E=e("angular2/src/core/di/metadata"),R=e("angular2/src/core/di/exceptions"),S=e("angular2/src/core/di/forward_ref"),x=function(){function e(e,t,r,n,i){this.key=e,this.optional=t,this.lowerBoundVisibility=r,this.upperBoundVisibility=n,this.properties=i}return e.fromKey=function(t){return new e(t,!1,null,null,[])},e}();t.Dependency=x;var P=v.CONST_EXPR([]),D=function(){function e(e,t){var r=t.toClass,n=t.toValue,i=t.toAlias,o=t.toFactory,a=t.deps,s=t.multi;this.token=e,this.toClass=r,this.toValue=n,this.toAlias=i,this.toFactory=o,this.dependencies=a,this._multi=s}return Object.defineProperty(e.prototype,"multi",{get:function(){return v.normalizeBool(this._multi)},enumerable:!0,configurable:!0}),e=m([v.CONST(),y("design:paramtypes",[Object,Object])],e)}();t.Binding=D;var I=function(){function e(e,t,r){this.key=e,this.resolvedFactories=t,this.multiBinding=r}return Object.defineProperty(e.prototype,"resolvedFactory",{get:function(){return this.resolvedFactories[0]},enumerable:!0,configurable:!0}),e}();t.ResolvedBinding_=I;var O=function(){function e(e,t){this.factory=e,this.dependencies=t}return e}();t.ResolvedFactory=O,t.bind=n;var k=function(){function e(e){this.token=e}return e.prototype.toClass=function(e){if(!v.isType(e))throw new _.BaseException('Trying to create a class binding but "'+v.stringify(e)+'" is not a class!');return new D(this.token,{toClass:e})},e.prototype.toValue=function(e){return new D(this.token,{toValue:e})},e.prototype.toAlias=function(e){if(v.isBlank(e))throw new _.BaseException("Can not alias "+v.stringify(this.token)+" to a blank value!");return new D(this.token,{toAlias:e})},e.prototype.toFactory=function(e,t){if(!v.isFunction(e))throw new _.BaseException('Trying to create a factory binding but "'+v.stringify(e)+'" is not a function!');return new D(this.token,{toFactory:e,deps:t})},e}();t.BindingBuilder=k,t.resolveFactory=i,t.resolveBinding=o,t.resolveBindings=a;var A=function(){function e(e,t){this.key=e,this.resolvedFactory=t}return e}();return h.define=g,r.exports}),System.register("angular2/src/core/change_detection/abstract_change_detector",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/change_detection/change_detection_util","angular2/src/core/change_detection/change_detector_ref","angular2/src/core/change_detection/exceptions","angular2/src/core/change_detection/constants","angular2/src/core/profile/profile","angular2/src/core/change_detection/observable_facade"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/change_detection/change_detection_util"),u=e("angular2/src/core/change_detection/change_detector_ref"),l=e("angular2/src/core/change_detection/exceptions"),p=e("angular2/src/core/change_detection/constants"),d=e("angular2/src/core/profile/profile"),f=e("angular2/src/core/change_detection/observable_facade"),h=d.wtfCreateScope("ChangeDetector#check(ascii id, bool throwOnChange)"),g=function(){function e(e,t,r,n,i,o){this.element=e,this.componentElement=t,this.context=r,this.locals=n,this.injector=i,this.expression=o}return e}(),m=function(){function e(e,t,r,n,i,o){this.id=e,this.dispatcher=t,this.numberOfPropertyProtoRecords=r,this.bindingTargets=n,this.directiveIndices=i,this.strategy=o,this.lightDomChildren=[],this.shadowDomChildren=[],this.alreadyChecked=!1,this.locals=null,this.mode=null,this.pipes=null,this.ref=new u.ChangeDetectorRef_(this)}return e.prototype.addChild=function(e){this.lightDomChildren.push(e),e.parent=this},e.prototype.removeChild=function(e){s.ListWrapper.remove(this.lightDomChildren,e)},e.prototype.addShadowDomChild=function(e){this.shadowDomChildren.push(e),e.parent=this},e.prototype.removeShadowDomChild=function(e){s.ListWrapper.remove(this.shadowDomChildren,e)},e.prototype.remove=function(){this.parent.removeChild(this)},e.prototype.handleEvent=function(e,t,r){var n=this.handleEventInternal(e,t,r);return this.markPathToRootAsCheckOnce(),n},e.prototype.handleEventInternal=function(e,t,r){return!1},e.prototype.detectChanges=function(){this.runDetectChanges(!1)},e.prototype.checkNoChanges=function(){throw new a.BaseException("Not implemented")},e.prototype.runDetectChanges=function(e){if(this.mode!==p.ChangeDetectionStrategy.Detached&&this.mode!==p.ChangeDetectionStrategy.Checked){var t=h(this.id,e);this.detectChangesInRecords(e),this._detectChangesInLightDomChildren(e),e||this.afterContentLifecycleCallbacks(),this._detectChangesInShadowDomChildren(e),e||this.afterViewLifecycleCallbacks(),this.mode===p.ChangeDetectionStrategy.CheckOnce&&(this.mode=p.ChangeDetectionStrategy.Checked),this.alreadyChecked=!0,d.wtfLeave(t)}},e.prototype.detectChangesInRecords=function(e){this.hydrated()||this.throwDehydratedError();try{this.detectChangesInRecordsInternal(e)}catch(t){this._throwError(t,t.stack)}},e.prototype.detectChangesInRecordsInternal=function(e){},e.prototype.hydrate=function(e,t,r,n){this.mode=c.ChangeDetectionUtil.changeDetectionMode(this.strategy),this.context=e,this.strategy===p.ChangeDetectionStrategy.OnPushObserve&&this.observeComponent(e),this.locals=t,this.pipes=n,this.hydrateDirectives(r),this.alreadyChecked=!1},e.prototype.hydrateDirectives=function(e){},e.prototype.dehydrate=function(){this.dehydrateDirectives(!0),this.strategy===p.ChangeDetectionStrategy.OnPushObserve&&this._unsubsribeFromObservables(),this.context=null,this.locals=null,this.pipes=null},e.prototype.dehydrateDirectives=function(e){},e.prototype.hydrated=function(){return null!==this.context},e.prototype.afterContentLifecycleCallbacks=function(){this.dispatcher.notifyAfterContentChecked(),this.afterContentLifecycleCallbacksInternal()},e.prototype.afterContentLifecycleCallbacksInternal=function(){},e.prototype.afterViewLifecycleCallbacks=function(){this.dispatcher.notifyAfterViewChecked(),this.afterViewLifecycleCallbacksInternal()},e.prototype.afterViewLifecycleCallbacksInternal=function(){},e.prototype._detectChangesInLightDomChildren=function(e){for(var t=this.lightDomChildren,r=0;r<t.length;++r)t[r].runDetectChanges(e)},e.prototype._detectChangesInShadowDomChildren=function(e){for(var t=this.shadowDomChildren,r=0;r<t.length;++r)t[r].runDetectChanges(e)},e.prototype.markAsCheckOnce=function(){this.mode=p.ChangeDetectionStrategy.CheckOnce},e.prototype.markPathToRootAsCheckOnce=function(){for(var e=this;o.isPresent(e)&&e.mode!==p.ChangeDetectionStrategy.Detached;)e.mode===p.ChangeDetectionStrategy.Checked&&(e.mode=p.ChangeDetectionStrategy.CheckOnce),e=e.parent},e.prototype._unsubsribeFromObservables=function(){if(o.isPresent(this.subscriptions))for(var e=0;e<this.subscriptions.length;++e){var t=this.subscriptions[e];o.isPresent(this.subscriptions[e])&&(t.cancel(),this.subscriptions[e]=null)}},e.prototype.observeValue=function(e,t){var r=this;return f.isObservable(e)&&(this._createArrayToStoreObservables(),o.isBlank(this.subscriptions[t])?(this.streams[t]=e.changes,this.subscriptions[t]=e.changes.listen(function(e){return r.ref.markForCheck()})):this.streams[t]!==e.changes&&(this.subscriptions[t].cancel(),this.streams[t]=e.changes,this.subscriptions[t]=e.changes.listen(function(e){return r.ref.markForCheck()}))),e},e.prototype.observeDirective=function(e,t){var r=this;if(f.isObservable(e)){this._createArrayToStoreObservables();var n=this.numberOfPropertyProtoRecords+t+2;this.streams[n]=e.changes,this.subscriptions[n]=e.changes.listen(function(e){return r.ref.markForCheck()})}return e},e.prototype.observeComponent=function(e){var t=this;if(f.isObservable(e)){this._createArrayToStoreObservables();var r=this.numberOfPropertyProtoRecords+1;this.streams[r]=e.changes,this.subscriptions[r]=e.changes.listen(function(e){return t.ref.markForCheck()})}return e},e.prototype._createArrayToStoreObservables=function(){o.isBlank(this.subscriptions)&&(this.subscriptions=s.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords+this.directiveIndices.length+2),this.streams=s.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords+this.directiveIndices.length+2))},e.prototype.getDirectiveFor=function(e,t){return e.getDirectiveFor(this.directiveIndices[t])},e.prototype.getDetectorFor=function(e,t){return e.getDetectorFor(this.directiveIndices[t])},e.prototype.notifyDispatcher=function(e){this.dispatcher.notifyOnBinding(this._currentBinding(),e)},e.prototype.logBindingUpdate=function(e){this.dispatcher.logBindingUpdate(this._currentBinding(),e)},e.prototype.addChange=function(e,t,r){return o.isBlank(e)&&(e={}),e[this._currentBinding().name]=c.ChangeDetectionUtil.simpleChange(t,r),e},e.prototype._throwError=function(e,t){var r;try{var n=this.dispatcher.getDebugContext(this._currentBinding().elementIndex,null),i=o.isPresent(n)?new g(n.element,n.componentElement,n.context,n.locals,n.injector,this._currentBinding().debug):null;r=new l.ChangeDetectionError(this._currentBinding().debug,e,t,i)}catch(a){r=new l.ChangeDetectionError(null,e,t,null)}throw r},e.prototype.throwOnChangeError=function(e,t){throw new l.ExpressionChangedAfterItHasBeenCheckedException(this._currentBinding().debug,e,t,null)},e.prototype.throwDehydratedError=function(){throw new l.DehydratedException},e.prototype._currentBinding=function(){return this.bindingTargets[this.propertyBindingIndex]},e}();return t.AbstractChangeDetector=m,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/change_detection_jit_generator",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/change_detection/abstract_change_detector","angular2/src/core/change_detection/change_detection_util","angular2/src/core/change_detection/codegen_name_util","angular2/src/core/change_detection/codegen_logic_util","angular2/src/core/change_detection/codegen_facade","angular2/src/core/change_detection/proto_change_detector"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/change_detection/abstract_change_detector"),c=e("angular2/src/core/change_detection/change_detection_util"),u=e("angular2/src/core/change_detection/codegen_name_util"),l=e("angular2/src/core/change_detection/codegen_logic_util"),p=e("angular2/src/core/change_detection/codegen_facade"),d=e("angular2/src/core/change_detection/proto_change_detector"),f="isChanged",h="changes",g=function(){function e(e,t,r){this.changeDetectionUtilVarName=t,this.abstractChangeDetectorVarName=r;var n=d.createPropertyRecords(e),i=d.createEventRecords(e),o=e.bindingRecords.map(function(e){return e.target});this.id=e.id,this.changeDetectionStrategy=e.strategy,this.genConfig=e.genConfig,this.records=n,this.propertyBindingTargets=o,this.eventBindings=i,this.directiveRecords=e.directiveRecords,this._names=new u.CodegenNameUtil(this.records,this.eventBindings,this.directiveRecords,this.changeDetectionUtilVarName),this._logic=new l.CodegenLogicUtil(this._names,this.changeDetectionUtilVarName,this.changeDetectionStrategy),this.typeName=u.sanitizeName("ChangeDetector_"+this.id)}return e.prototype.generate=function(){var e="\n "+this.generateSource()+"\n return function(dispatcher) {\n return new "+this.typeName+"(dispatcher);\n }\n ";return new Function(this.abstractChangeDetectorVarName,this.changeDetectionUtilVarName,e)(s.AbstractChangeDetector,c.ChangeDetectionUtil)},e.prototype.generateSource=function(){var e=this;return"\n var "+this.typeName+" = function "+this.typeName+"(dispatcher) {\n "+this.abstractChangeDetectorVarName+".call(\n this, "+JSON.stringify(this.id)+", dispatcher, "+this.records.length+",\n "+this.typeName+".gen_propertyBindingTargets, "+this.typeName+".gen_directiveIndices,\n "+p.codify(this.changeDetectionStrategy)+");\n this.dehydrateDirectives(false);\n }\n\n "+this.typeName+".prototype = Object.create("+this.abstractChangeDetectorVarName+".prototype);\n\n "+this.typeName+".prototype.detectChangesInRecordsInternal = function(throwOnChange) {\n "+this._names.genInitLocals()+"\n var "+f+" = false;\n var "+h+" = null;\n\n "+this.records.map(function(t){return e._genRecord(t)}).join("\n")+"\n }\n\n "+this._maybeGenHandleEventInternal()+"\n\n "+this._genCheckNoChanges()+"\n\n "+this._maybeGenAfterContentLifecycleCallbacks()+"\n\n "+this._maybeGenAfterViewLifecycleCallbacks()+"\n\n "+this._maybeGenHydrateDirectives()+"\n\n "+this._maybeGenDehydrateDirectives()+"\n\n "+this._genPropertyBindingTargets()+"\n\n "+this._genDirectiveIndices()+"\n "},e.prototype._genPropertyBindingTargets=function(){var e=this._logic.genPropertyBindingTargets(this.propertyBindingTargets,this.genConfig.genDebugInfo);return this.typeName+".gen_propertyBindingTargets = "+e+";"},e.prototype._genDirectiveIndices=function(){var e=this._logic.genDirectiveIndices(this.directiveRecords);return this.typeName+".gen_directiveIndices = "+e+";"},e.prototype._maybeGenHandleEventInternal=function(){var e=this;if(this.eventBindings.length>0){var t=this.eventBindings.map(function(t){return e._genEventBinding(t)}).join("\n");return"\n "+this.typeName+".prototype.handleEventInternal = function(eventName, elIndex, locals) {\n var "+this._names.getPreventDefaultAccesor()+" = false;\n "+this._names.genInitEventLocals()+"\n "+t+"\n return "+this._names.getPreventDefaultAccesor()+";\n }\n "}return""},e.prototype._genEventBinding=function(e){var t=this,r=e.records.map(function(r){return t._genEventBindingEval(e,r)}).join("\n");return'\n if (eventName === "'+e.eventName+'" && elIndex === '+e.elIndex+") {\n "+r+"\n }"},e.prototype._genEventBindingEval=function(e,t){if(t.lastInBinding){var r=this._logic.genEventBindingEvalValue(e,t),n=this._genMarkPathToRootAsCheckOnce(t),i=this._genUpdatePreventDefault(e,t);return r+"\n"+n+"\n"+i}return this._logic.genEventBindingEvalValue(e,t)},e.prototype._genMarkPathToRootAsCheckOnce=function(e){var t=e.bindingRecord;return t.isDefaultChangeDetection()?"":this._names.getDetectorName(t.directiveRecord.directiveIndex)+".markPathToRootAsCheckOnce();"},e.prototype._genUpdatePreventDefault=function(e,t){var r=this._names.getEventLocalName(e,t.selfIndex);return"if ("+r+" === false) { "+this._names.getPreventDefaultAccesor()+" = true};"},e.prototype._maybeGenDehydrateDirectives=function(){var e=this._names.genPipeOnDestroy();e&&(e="if (destroyPipes) { "+e+" }");var t=this._names.genDehydrateFields();return e||t?this.typeName+".prototype.dehydrateDirectives = function(destroyPipes) {\n "+e+"\n "+t+"\n }":""},e.prototype._maybeGenHydrateDirectives=function(){var e=this._logic.genHydrateDirectives(this.directiveRecords),t=this._logic.genHydrateDetectors(this.directiveRecords);return e||t?this.typeName+".prototype.hydrateDirectives = function(directives) {\n "+e+"\n "+t+"\n }":""},e.prototype._maybeGenAfterContentLifecycleCallbacks=function(){var e=this._logic.genContentLifecycleCallbacks(this.directiveRecords);if(e.length>0){var t=e.join("\n");return"\n "+this.typeName+".prototype.afterContentLifecycleCallbacksInternal = function() {\n "+t+"\n }\n "}return""},e.prototype._maybeGenAfterViewLifecycleCallbacks=function(){var e=this._logic.genViewLifecycleCallbacks(this.directiveRecords);if(e.length>0){var t=e.join("\n");return"\n "+this.typeName+".prototype.afterViewLifecycleCallbacksInternal = function() {\n "+t+"\n }\n "}return""},e.prototype._genRecord=function(e){var t;return t=e.isLifeCycleRecord()?this._genDirectiveLifecycle(e):e.isPipeRecord()?this._genPipeCheck(e):this._genReferenceCheck(e),"\n "+this._maybeFirstInBinding(e)+"\n "+t+"\n "+this._maybeGenLastInDirective(e)+"\n "},e.prototype._genDirectiveLifecycle=function(e){if("DoCheck"===e.name)return this._genOnCheck(e);if("OnInit"===e.name)return this._genOnInit(e);if("OnChanges"===e.name)return this._genOnChange(e);throw new a.BaseException("Unknown lifecycle event '"+e.name+"'")},e.prototype._genPipeCheck=function(e){var t=this,r=this._names.getLocalName(e.contextIndex),n=e.args.map(function(e){return t._names.getLocalName(e)}).join(", "),i=this._names.getFieldName(e.selfIndex),o=this._names.getLocalName(e.selfIndex),a=this._names.getPipeName(e.selfIndex),s=e.name,c="\n if ("+a+" === "+this.changeDetectionUtilVarName+".uninitialized) {\n "+a+" = "+this._names.getPipesAccessorName()+".get('"+s+"');\n }\n ",u=o+" = "+a+".pipe.transform("+r+", ["+n+"]);",l=e.args.map(function(e){return t._names.getChangeName(e)});l.push(this._names.getChangeName(e.contextIndex));var p="!"+a+".pure || ("+l.join(" || ")+")",d="\n if ("+i+" !== "+o+") {\n "+o+" = "+this.changeDetectionUtilVarName+".unwrapValue("+o+")\n "+this._genChangeMarker(e)+"\n "+this._genUpdateDirectiveOrElement(e)+"\n "+this._genAddToChanges(e)+"\n "+i+" = "+o+";\n }\n ",f=e.shouldBeChecked()?""+u+d:u;return e.isUsedByOtherRecord()?c+" if ("+p+") { "+f+" } else { "+o+" = "+i+"; }":c+" if ("+p+") { "+f+" }"},e.prototype._genReferenceCheck=function(e){var t=this,r=this._names.getFieldName(e.selfIndex),n=this._names.getLocalName(e.selfIndex),i="\n "+this._logic.genPropertyBindingEvalValue(e)+"\n ",o="\n if ("+n+" !== "+r+") {\n "+this._genChangeMarker(e)+"\n "+this._genUpdateDirectiveOrElement(e)+"\n "+this._genAddToChanges(e)+"\n "+r+" = "+n+";\n }\n ",a=e.shouldBeChecked()?""+i+o:i;if(e.isPureFunction()){var s=e.args.map(function(e){return t._names.getChangeName(e)}).join(" || ");return e.isUsedByOtherRecord()?"if ("+s+") { "+a+" } else { "+n+" = "+r+"; }":"if ("+s+") { "+a+" }"}return a},e.prototype._genChangeMarker=function(e){return e.argumentToPureFunction?this._names.getChangeName(e.selfIndex)+" = true":""},e.prototype._genUpdateDirectiveOrElement=function(e){if(!e.lastInBinding)return"";var t=this._names.getLocalName(e.selfIndex),r=this._names.getFieldName(e.selfIndex),n=this.genConfig.logBindingUpdate?"this.logBindingUpdate("+t+");":"",i=e.bindingRecord;if(i.target.isDirective()){var o=this._names.getDirectiveName(i.directiveRecord.directiveIndex)+"."+i.target.name;return"\n "+this._genThrowOnChangeCheck(r,t)+"\n "+o+" = "+t+";\n "+n+"\n "+f+" = true;\n "}return"\n "+this._genThrowOnChangeCheck(r,t)+"\n this.notifyDispatcher("+t+");\n "+n+"\n "},e.prototype._genThrowOnChangeCheck=function(e,t){return this.genConfig.genCheckNoChanges?"\n if(throwOnChange) {\n this.throwOnChangeError("+e+", "+t+");\n }\n ":""},e.prototype._genCheckNoChanges=function(){return this.genConfig.genCheckNoChanges?this.typeName+".prototype.checkNoChanges = function() { this.runDetectChanges(true); }":""},e.prototype._genAddToChanges=function(e){var t=this._names.getLocalName(e.selfIndex),r=this._names.getFieldName(e.selfIndex);return e.bindingRecord.callOnChanges()?h+" = this.addChange("+h+", "+r+", "+t+");":""},e.prototype._maybeFirstInBinding=function(e){var t=c.ChangeDetectionUtil.protoByIndex(this.records,e.selfIndex-1),r=o.isBlank(t)||t.bindingRecord!==e.bindingRecord;return r&&!e.bindingRecord.isDirectiveLifecycle()?this._names.getPropertyBindingIndex()+" = "+e.propertyBindingIndex+";":""},e.prototype._maybeGenLastInDirective=function(e){return e.lastInDirective?"\n "+h+" = null;\n "+this._genNotifyOnPushDetectors(e)+"\n "+f+" = false;\n ":""},e.prototype._genOnCheck=function(e){var t=e.bindingRecord;return"if (!throwOnChange) "+this._names.getDirectiveName(t.directiveRecord.directiveIndex)+".doCheck();"},e.prototype._genOnInit=function(e){var t=e.bindingRecord;return"if (!throwOnChange && !"+this._names.getAlreadyCheckedName()+") "+this._names.getDirectiveName(t.directiveRecord.directiveIndex)+".onInit();"},e.prototype._genOnChange=function(e){var t=e.bindingRecord;return"if (!throwOnChange && "+h+") "+this._names.getDirectiveName(t.directiveRecord.directiveIndex)+".onChanges("+h+");"},e.prototype._genNotifyOnPushDetectors=function(e){var t=e.bindingRecord;if(!e.lastInDirective||t.isDefaultChangeDetection())return"";var r="\n if("+f+") {\n "+this._names.getDetectorName(t.directiveRecord.directiveIndex)+".markAsCheckOnce();\n }\n ";return r},e}();return t.ChangeDetectorJITGenerator=g,n.define=i,r.exports}),System.register("@reactivex/rxjs/dist/cjs/Observable",["@reactivex/rxjs/dist/cjs/Subscriber","@reactivex/rxjs/dist/cjs/util/Symbol_observable"],!0,function(e,t,r){function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=System.global,a=o.define;o.define=void 0,t.__esModule=!0;var s=e("@reactivex/rxjs/dist/cjs/Subscriber"),c=n(s),u=e("@reactivex/rxjs/dist/cjs/util/Symbol_observable"),l=n(u),p=function(){function e(t){i(this,e),this._isScalar=!1,t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype[l["default"]]=function(){return this},e.prototype.subscribe=function(e,t,r){var n=void 0;if(e&&"object"==typeof e)n=e instanceof c["default"]?e:new c["default"](e);else{var i=e;n=c["default"].create(i,t,r)}return n.add(this._subscribe(n)),n},e.prototype.forEach=function(e){var t=this;return new Promise(function(r,n){t.subscribe(e,n,r)})},e.prototype._subscribe=function(e){return this.source._subscribe(this.operator.call(e))},e}();return t["default"]=p,p.create=function(e){return new p(e)},r.exports=t["default"],o.define=a,r.exports}),System.register("angular2/src/core/linker/view_manager",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/linker/view","angular2/src/core/linker/view_ref","angular2/src/core/render/api","angular2/src/core/linker/view_manager_utils","angular2/src/core/linker/view_pool","angular2/src/core/linker/view_listener","angular2/src/core/profile/profile","angular2/src/core/linker/proto_view_factory"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},u=e("angular2/src/core/di"),l=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/facade/exceptions"),d=e("angular2/src/core/linker/view"),f=e("angular2/src/core/linker/view_ref"),h=e("angular2/src/core/render/api"),g=e("angular2/src/core/linker/view_manager_utils"),m=e("angular2/src/core/linker/view_pool"),y=e("angular2/src/core/linker/view_listener"),v=e("angular2/src/core/profile/profile"),_=e("angular2/src/core/linker/proto_view_factory"),b=function(){function e(){}return e.prototype.getHostElement=function(e){var t=f.internalView(e);if(t.proto.type!==d.ViewType.HOST)throw new p.BaseException("This operation is only allowed on host views");return t.elementRefs[t.elementOffset]},e}();t.AppViewManager=b;var w=function(e){function t(t,r,n,i,o){e.call(this),this._viewPool=t,this._viewListener=r,this._utils=n,this._renderer=i,this._createRootHostViewScope=v.wtfCreateScope("AppViewManager#createRootHostView()"),this._destroyRootHostViewScope=v.wtfCreateScope("AppViewManager#destroyRootHostView()"),this._createEmbeddedViewInContainerScope=v.wtfCreateScope("AppViewManager#createEmbeddedViewInContainer()"),this._createHostViewInContainerScope=v.wtfCreateScope("AppViewManager#createHostViewInContainer()"),this._destroyViewInContainerScope=v.wtfCreateScope("AppViewMananger#destroyViewInContainer()"),this._attachViewInContainerScope=v.wtfCreateScope("AppViewMananger#attachViewInContainer()"),this._detachViewInContainerScope=v.wtfCreateScope("AppViewMananger#detachViewInContainer()"),this._protoViewFactory=o}return o(t,e),t.prototype.getViewContainer=function(e){var t=f.internalView(e.parentView);
return t.elementInjectors[e.boundElementIndex].getViewContainerRef()},t.prototype.getNamedElementInComponentView=function(e,t){var r=f.internalView(e.parentView),n=e.boundElementIndex,i=r.getNestedView(n);if(l.isBlank(i))throw new p.BaseException("There is no component directive at element "+n);var o=i.proto.variableLocations.get(t);if(l.isBlank(o))throw new p.BaseException("Could not find variable "+t);return i.elementRefs[i.elementOffset+o]},t.prototype.getComponent=function(e){var t=f.internalView(e.parentView),r=e.boundElementIndex;return this._utils.getComponentInstance(t,r)},t.prototype.createRootHostView=function(e,t,r){var n=this._createRootHostViewScope(),i=f.internalProtoView(e);this._protoViewFactory.initializeProtoViewIfNeeded(i);var o=t;l.isBlank(o)&&(o=i.elementBinders[0].componentDirective.metadata.selector);var a=this._renderer.createRootHostView(i.render,i.mergeInfo.embeddedViewCount+1,o),s=this._createMainView(i,a);return this._renderer.hydrateView(s.render),this._utils.hydrateRootHostView(s,r),v.wtfLeave(n,s.ref)},t.prototype.destroyRootHostView=function(e){var t=this._destroyRootHostViewScope(),r=f.internalView(e);this._renderer.detachFragment(r.renderFragment),this._renderer.dehydrateView(r.render),this._viewDehydrateRecurse(r),this._viewListener.viewDestroyed(r),this._renderer.destroyView(r.render),v.wtfLeave(t)},t.prototype.createEmbeddedViewInContainer=function(e,t,r){var n=this._createEmbeddedViewInContainerScope(),i=f.internalProtoView(r.protoViewRef);if(i.type!==d.ViewType.EMBEDDED)throw new p.BaseException("This method can only be called with embedded ProtoViews!");return this._protoViewFactory.initializeProtoViewIfNeeded(i),v.wtfLeave(n,this._createViewInContainer(e,t,i,r.elementRef,null))},t.prototype.createHostViewInContainer=function(e,t,r,n){var i=this._createHostViewInContainerScope(),o=f.internalProtoView(r);if(o.type!==d.ViewType.HOST)throw new p.BaseException("This method can only be called with host ProtoViews!");return this._protoViewFactory.initializeProtoViewIfNeeded(o),v.wtfLeave(i,this._createViewInContainer(e,t,o,e,n))},t.prototype._createViewInContainer=function(e,t,r,n,i){var o,a=f.internalView(e.parentView),s=e.boundElementIndex,c=f.internalView(n.parentView),u=n.boundElementIndex,p=c.getNestedView(u);return r.type===d.ViewType.EMBEDDED&&l.isPresent(p)&&!p.hydrated()?(o=p,this._attachRenderView(a,s,t,o)):(o=this._createPooledView(r),this._attachRenderView(a,s,t,o),this._renderer.hydrateView(o.render)),this._utils.attachViewInContainer(a,s,c,u,t,o),this._utils.hydrateViewInContainer(a,s,c,u,t,i),o.ref},t.prototype._attachRenderView=function(e,t,r,n){var i=e.elementRefs[t];if(0===r)this._renderer.attachFragmentAfterElement(i,n.renderFragment);else{var o=e.viewContainers[t].views[r-1];this._renderer.attachFragmentAfterFragment(o.renderFragment,n.renderFragment)}},t.prototype.destroyViewInContainer=function(e,t){var r=this._destroyViewInContainerScope(),n=f.internalView(e.parentView),i=e.boundElementIndex;this._destroyViewInContainer(n,i,t),v.wtfLeave(r)},t.prototype.attachViewInContainer=function(e,t,r){var n=this._attachViewInContainerScope(),i=f.internalView(r),o=f.internalView(e.parentView),a=e.boundElementIndex;return this._utils.attachViewInContainer(o,a,null,null,t,i),this._attachRenderView(o,a,t,i),v.wtfLeave(n,r)},t.prototype.detachViewInContainer=function(e,t){var r=this._detachViewInContainerScope(),n=f.internalView(e.parentView),i=e.boundElementIndex,o=n.viewContainers[i],a=o.views[t];return this._utils.detachViewInContainer(n,i,t),this._renderer.detachFragment(a.renderFragment),v.wtfLeave(r,a.ref)},t.prototype._createMainView=function(e,t){var r=this._utils.createView(e,t,this,this._renderer);return this._renderer.setEventDispatcher(r.render,r),this._viewListener.viewCreated(r),r},t.prototype._createPooledView=function(e){var t=this._viewPool.getView(e);return l.isBlank(t)&&(t=this._createMainView(e,this._renderer.createView(e.render,e.mergeInfo.embeddedViewCount+1))),t},t.prototype._destroyPooledView=function(e){var t=this._viewPool.returnView(e);t||(this._viewListener.viewDestroyed(e),this._renderer.destroyView(e.render))},t.prototype._destroyViewInContainer=function(e,t,r){var n=e.viewContainers[t],i=n.views[r];this._viewDehydrateRecurse(i),this._utils.detachViewInContainer(e,t,r),i.viewOffset>0?this._renderer.detachFragment(i.renderFragment):(this._renderer.dehydrateView(i.render),this._renderer.detachFragment(i.renderFragment),this._destroyPooledView(i))},t.prototype._viewDehydrateRecurse=function(e){e.hydrated()&&this._utils.dehydrateView(e);for(var t=e.viewContainers,r=e.viewOffset,n=e.viewOffset+e.proto.mergeInfo.viewCount-1,i=e.elementOffset,o=r;n>=o;o++)for(var a=e.views[o],s=0;s<a.proto.elementBinders.length;s++,i++){var c=t[i];if(l.isPresent(c))for(var u=c.views.length-1;u>=0;u--)this._destroyViewInContainer(a,i,u)}},t=a([u.Injectable(),c(4,u.Inject(u.forwardRef(function(){return _.ProtoViewFactory}))),s("design:paramtypes",[m.AppViewPool,y.AppViewListener,g.AppViewManagerUtils,h.Renderer,Object])],t)}(b);return t.AppViewManager_=w,n.define=i,r.exports}),System.register("angular2/src/animate/css_animation_builder",["angular2/src/animate/css_animation_options","angular2/src/animate/animation"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/animate/css_animation_options"),a=e("angular2/src/animate/animation"),s=function(){function e(e){this.browserDetails=e,this.data=new o.CssAnimationOptions}return e.prototype.addAnimationClass=function(e){return this.data.animationClasses.push(e),this},e.prototype.addClass=function(e){return this.data.classesToAdd.push(e),this},e.prototype.removeClass=function(e){return this.data.classesToRemove.push(e),this},e.prototype.setDuration=function(e){return this.data.duration=e,this},e.prototype.setDelay=function(e){return this.data.delay=e,this},e.prototype.setStyles=function(e,t){return this.setFromStyles(e).setToStyles(t)},e.prototype.setFromStyles=function(e){return this.data.fromStyles=e,this},e.prototype.setToStyles=function(e){return this.data.toStyles=e,this},e.prototype.start=function(e){return new a.Animation(e,this.data,this.browserDetails)},e}();return t.CssAnimationBuilder=s,n.define=i,r.exports}),System.register("angular2/src/core/compiler/change_detector_compiler",["angular2/src/core/compiler/source_module","angular2/src/core/change_detection/change_detection_jit_generator","angular2/src/core/compiler/change_definition_factory","angular2/src/core/change_detection/change_detection","angular2/src/transform/template_compiler/change_detector_codegen","angular2/src/core/compiler/util","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/compiler/source_module"),c=e("angular2/src/core/change_detection/change_detection_jit_generator"),u=e("angular2/src/core/compiler/change_definition_factory"),l=e("angular2/src/core/change_detection/change_detection"),p=e("angular2/src/transform/template_compiler/change_detector_codegen"),d=e("angular2/src/core/compiler/util"),f=e("angular2/src/core/di"),h="AbstractChangeDetector",g="ChangeDetectionUtil",m=s.moduleRef("package:angular2/src/core/change_detection/abstract_change_detector"+d.MODULE_SUFFIX),y=s.moduleRef("package:angular2/src/core/change_detection/change_detection_util"+d.MODULE_SUFFIX),v=s.moduleRef("package:angular2/src/core/change_detection/pregen_proto_change_detector"+d.MODULE_SUFFIX),_=function(){function e(e){this._genConfig=e}return e.prototype.compileComponentRuntime=function(e,t,r){var n=this,i=u.createChangeDetectorDefinitions(e,t,this._genConfig,r);return i.map(function(e){return n._createChangeDetectorFactory(e)})},e.prototype._createChangeDetectorFactory=function(e){if(d.IS_DART||!this._genConfig.useJit){var t=new l.DynamicProtoChangeDetector(e);return function(e){return t.instantiate(e)}}return new c.ChangeDetectorJITGenerator(e,g,h).generate()},e.prototype.compileComponentCodeGen=function(e,t,r){var n=u.createChangeDetectorDefinitions(e,t,this._genConfig,r),i=[],o=0,a=n.map(function(t){var r,n;if(d.IS_DART){r=new p.Codegen(v);var a=t.id,u=0===o&&e.isHost?"dynamic":""+s.moduleRef(e.moduleUrl)+e.name;r.generate(u,a,t),i.push("(dispatcher) => new "+a+"(dispatcher)"),n=r.toString()}else r=new c.ChangeDetectorJITGenerator(t,""+y+g,""+m+h),i.push("function(dispatcher) { return new "+r.typeName+"(dispatcher); }"),n=r.generateSource();return o++,n});return new s.SourceExpressions(a,i)},e=o([f.Injectable(),a("design:paramtypes",[l.ChangeDetectorGenConfig])],e)}();return t.ChangeDetectionCompiler=_,n.define=i,r.exports}),System.register("angular2/src/core/compiler/template_parser",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/facade/exceptions","angular2/src/core/change_detection/change_detection","angular2/src/core/compiler/html_parser","angular2/src/core/compiler/template_ast","angular2/src/core/compiler/selector","angular2/src/core/compiler/schema/element_schema_registry","angular2/src/core/compiler/template_preparser","angular2/src/core/compiler/html_ast","angular2/src/core/compiler/util"],!0,function(e,t,r){function n(e){return l.StringWrapper.split(e.trim(),/\s+/g)}function i(e,t){var r=new m.CssSelector;r.setElement(e);for(var i=0;i<t.length;i++){var o=t[i][0].toLowerCase(),a=t[i][1];if(r.addAttribute(o,a),o==S){var s=n(a);s.forEach(function(e){return r.addClassName(e)})}}return r}var o=System.global,a=o.define;o.define=void 0;var s=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},c=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},u=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/di"),d=e("angular2/src/core/facade/exceptions"),f=e("angular2/src/core/change_detection/change_detection"),h=e("angular2/src/core/compiler/html_parser"),g=e("angular2/src/core/compiler/template_ast"),m=e("angular2/src/core/compiler/selector"),y=e("angular2/src/core/compiler/schema/element_schema_registry"),v=e("angular2/src/core/compiler/template_preparser"),_=e("angular2/src/core/compiler/html_ast"),b=e("angular2/src/core/compiler/util"),w=/^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g,C="template",E="template",R="*",S="class",x=new RegExp("\\."),P="attr",D="class",I="style",O=m.CssSelector.parse("*")[0],k=function(){function e(e,t,r){this._exprParser=e,this._schemaRegistry=t,this._htmlParser=r}return e.prototype.parse=function(e,t,r){var n=new A(t,this._exprParser,this._schemaRegistry),i=_.htmlVisitAll(n,this._htmlParser.parse(e,r),M);if(n.errors.length>0){var o=n.errors.join("\n");throw new d.BaseException("Template parse errors:\n"+o)}return i},e=s([p.Injectable(),c("design:paramtypes",[f.Parser,y.ElementSchemaRegistry,h.HtmlParser])],e)}();t.TemplateParser=k;var A=function(){function e(e,t,r){var n=this;this._exprParser=t,this._schemaRegistry=r,this.errors=[],this.directivesIndex=new Map,this.ngContentCount=0,this.selectorMatcher=new m.SelectorMatcher,u.ListWrapper.forEachWithIndex(e,function(e,t){var r=m.CssSelector.parse(e.selector);n.selectorMatcher.addSelectables(r,e),n.directivesIndex.set(e,t)})}return e.prototype._reportError=function(e){this.errors.push(e)},e.prototype._parseInterpolation=function(e,t){try{return this._exprParser.parseInterpolation(e,t)}catch(r){return this._reportError(""+r),this._exprParser.wrapLiteralPrimitive("ERROR",t)}},e.prototype._parseAction=function(e,t){try{return this._exprParser.parseAction(e,t)}catch(r){return this._reportError(""+r),this._exprParser.wrapLiteralPrimitive("ERROR",t)}},e.prototype._parseBinding=function(e,t){try{return this._exprParser.parseBinding(e,t)}catch(r){return this._reportError(""+r),this._exprParser.wrapLiteralPrimitive("ERROR",t)}},e.prototype._parseTemplateBindings=function(e,t){try{return this._exprParser.parseTemplateBindings(e,t)}catch(r){return this._reportError(""+r),[]}},e.prototype.visitText=function(e,t){var r=t.findNgContentIndex(O),n=this._parseInterpolation(e.value,e.sourceInfo);return l.isPresent(n)?new g.BoundTextAst(n,r,e.sourceInfo):new g.TextAst(e.value,r,e.sourceInfo)},e.prototype.visitAttr=function(e,t){return new g.AttrAst(e.name,e.value,e.sourceInfo)},e.prototype.visitElement=function(e,t){var r=this,n=e.name,o=v.preparseElement(e);if(o.type===v.PreparsedElementType.SCRIPT||o.type===v.PreparsedElementType.STYLE||o.type===v.PreparsedElementType.STYLESHEET)return null;var a=[],s=[],c=[],l=[],p=[],d=[],f=[],h=!1,m=[];e.attrs.forEach(function(e){a.push([e.name,e.value]);var t=r._parseAttr(e,a,s,l,c),n=r._parseInlineTemplateBinding(e,f,p,d);t||n||m.push(r.visitAttr(e,null)),n&&(h=!0)});var y,b=n==C,w=i(n,a),E=this._createDirectiveAsts(e.name,this._parseDirectives(this.selectorMatcher,w),s,b?[]:c,e.sourceInfo),R=this._createElementPropertyAsts(e.name,s,E),S=_.htmlVisitAll(o.nonBindable?V:this,e.children,j.create(E)),x=h?null:t.findNgContentIndex(w);if(o.type===v.PreparsedElementType.NG_CONTENT)y=new g.NgContentAst(this.ngContentCount++,x,e.sourceInfo);else if(b)this._assertNoComponentsNorElementBindingsOnTemplate(E,R,l,e.sourceInfo),y=new g.EmbeddedTemplateAst(m,c,E,S,x,e.sourceInfo);else{this._assertOnlyOneComponent(E,e.sourceInfo);var P=u.ListWrapper.filter(c,function(e){return 0===e.value.length});y=new g.ElementAst(n,m,R,l,P,E,S,x,e.sourceInfo)}if(h){var D=i(C,f),I=this._createDirectiveAsts(e.name,this._parseDirectives(this.selectorMatcher,D),p,[],e.sourceInfo),O=this._createElementPropertyAsts(e.name,p,I);this._assertNoComponentsNorElementBindingsOnTemplate(I,O,[],e.sourceInfo),y=new g.EmbeddedTemplateAst([],d,I,[y],t.findNgContentIndex(D),e.sourceInfo)}return y},e.prototype._parseInlineTemplateBinding=function(e,t,r,n){var i=null;if(e.name==E)i=e.value;else if(l.StringWrapper.startsWith(e.name,R)){var o=l.StringWrapper.substring(e.name,R.length);i=0==e.value.length?o:o+" "+e.value}if(l.isPresent(i)){for(var a=this._parseTemplateBindings(i,e.sourceInfo),s=0;s<a.length;s++){var c=a[s],u=b.camelCaseToDashCase(c.key);c.keyIsVar?(n.push(new g.VariableAst(b.dashCaseToCamelCase(c.key),c.name,e.sourceInfo)),t.push([u,c.name])):l.isPresent(c.expression)?this._parsePropertyAst(u,c.expression,e.sourceInfo,t,r):t.push([u,""])}return!0}return!1},e.prototype._parseAttr=function(e,t,r,n,i){var o=this._normalizeAttributeName(e.name),a=e.value,s=l.RegExpWrapper.firstMatch(w,o),c=!1;if(l.isPresent(s))if(c=!0,l.isPresent(s[1]))this._parseProperty(s[5],a,e.sourceInfo,t,r);else if(l.isPresent(s[2])){var u=s[5];this._parseVariable(u,a,e.sourceInfo,t,i)}else l.isPresent(s[3])?this._parseEvent(s[5],a,e.sourceInfo,t,n):l.isPresent(s[4])?(this._parseProperty(s[5],a,e.sourceInfo,t,r),this._parseAssignmentEvent(s[5],a,e.sourceInfo,t,n)):l.isPresent(s[6])?(this._parseProperty(s[6],a,e.sourceInfo,t,r),this._parseAssignmentEvent(s[6],a,e.sourceInfo,t,n)):l.isPresent(s[7])?this._parseProperty(s[7],a,e.sourceInfo,t,r):l.isPresent(s[8])&&this._parseEvent(s[8],a,e.sourceInfo,t,n);else c=this._parsePropertyInterpolation(o,a,e.sourceInfo,t,r);return c||this._parseLiteralAttr(o,a,e.sourceInfo,r),c},e.prototype._normalizeAttributeName=function(e){return l.StringWrapper.startsWith(e,"data-")?l.StringWrapper.substring(e,5):e},e.prototype._parseVariable=function(e,t,r,n,i){i.push(new g.VariableAst(b.dashCaseToCamelCase(e),t,r)),n.push([e,t])},e.prototype._parseProperty=function(e,t,r,n,i){this._parsePropertyAst(e,this._parseBinding(t,r),r,n,i)},e.prototype._parsePropertyInterpolation=function(e,t,r,n,i){var o=this._parseInterpolation(t,r);return l.isPresent(o)?(this._parsePropertyAst(e,o,r,n,i),!0):!1},e.prototype._parsePropertyAst=function(e,t,r,n,i){n.push([e,t.source]),i.push(new N(e,t,!1,r))},e.prototype._parseAssignmentEvent=function(e,t,r,n,i){this._parseEvent(e,t+"=$event",r,n,i)},e.prototype._parseEvent=function(e,t,r,n,i){var o=b.splitAtColon(e,[null,e]),a=o[0],s=o[1];i.push(new g.BoundEventAst(b.dashCaseToCamelCase(s),a,this._parseAction(t,r),r))},e.prototype._parseLiteralAttr=function(e,t,r,n){n.push(new N(b.dashCaseToCamelCase(e),this._exprParser.wrapLiteralPrimitive(t,r),!0,r))},e.prototype._parseDirectives=function(e,t){var r=this,n=[];return e.match(t,function(e,t){n.push(t)}),u.ListWrapper.sort(n,function(e,t){var n=e.isComponent,i=t.isComponent;return n&&!i?-1:!n&&i?1:r.directivesIndex.get(e)-r.directivesIndex.get(t)}),n},e.prototype._createDirectiveAsts=function(e,t,r,n,i){var o=this,a=new Set,s=t.map(function(t){var s=[],c=[],u=[];o._createDirectiveHostPropertyAsts(e,t.hostProperties,i,s),o._createDirectiveHostEventAsts(t.hostListeners,i,c),o._createDirectivePropertyAsts(t.inputs,r,u);var l=[];return n.forEach(function(e){(0===e.value.length&&t.isComponent||t.exportAs==e.value)&&(l.push(e),a.add(e.name))}),new g.DirectiveAst(t,u,s,c,l,i)});return n.forEach(function(e){e.value.length>0&&!u.SetWrapper.has(a,e.name)&&o._reportError('There is no directive with "exportAs" set to "'+e.value+'" at '+e.sourceInfo)}),s},e.prototype._createDirectiveHostPropertyAsts=function(e,t,r,n){var i=this;l.isPresent(t)&&u.StringMapWrapper.forEach(t,function(t,o){var a=i._parseBinding(t,r);n.push(i._createElementPropertyAst(e,o,a,r))})},e.prototype._createDirectiveHostEventAsts=function(e,t,r){var n=this;l.isPresent(e)&&u.StringMapWrapper.forEach(e,function(e,i){n._parseEvent(i,e,t,[],r)})},e.prototype._createDirectivePropertyAsts=function(e,t,r){if(l.isPresent(e)){var n=new Map;t.forEach(function(e){var t=b.dashCaseToCamelCase(e.name),r=n.get(e.name);(l.isBlank(r)||r.isLiteral)&&n.set(t,e)}),u.StringMapWrapper.forEach(e,function(e,t){e=b.dashCaseToCamelCase(e);var i=n.get(e);l.isPresent(i)&&r.push(new g.BoundDirectivePropertyAst(t,i.name,i.expression,i.sourceInfo))})}},e.prototype._createElementPropertyAsts=function(e,t,r){var n=this,i=[],o=new Map;return r.forEach(function(e){e.inputs.forEach(function(e){o.set(e.templateName,e)})}),t.forEach(function(t){!t.isLiteral&&l.isBlank(o.get(t.name))&&i.push(n._createElementPropertyAst(e,t.name,t.expression,t.sourceInfo))}),i},e.prototype._createElementPropertyAst=function(e,t,r,n){var i,o,a=null,s=l.StringWrapper.split(t,x);return 1===s.length?(o=this._schemaRegistry.getMappedPropName(b.dashCaseToCamelCase(s[0])),i=g.PropertyBindingType.Property,this._schemaRegistry.hasProperty(e,o)||this._reportError("Can't bind to '"+o+"' since it isn't a known native property in "+n)):s[0]==P?(o=b.dashCaseToCamelCase(s[1]),i=g.PropertyBindingType.Attribute):s[0]==D?(o=s[1],i=g.PropertyBindingType.Class):s[0]==I?(a=s.length>2?s[2]:null,o=b.dashCaseToCamelCase(s[1]),i=g.PropertyBindingType.Style):(this._reportError("Invalid property name "+t+" in "+n),i=null),new g.BoundElementPropertyAst(o,i,r,a,n)},e.prototype._findComponentDirectiveNames=function(e){var t=[];return e.forEach(function(e){var r=e.directive.type.name;e.directive.isComponent&&t.push(r)}),t},e.prototype._assertOnlyOneComponent=function(e,t){var r=this._findComponentDirectiveNames(e);r.length>1&&this._reportError("More than one component: "+r.join(",")+" in "+t)},e.prototype._assertNoComponentsNorElementBindingsOnTemplate=function(e,t,r,n){var i=this,o=this._findComponentDirectiveNames(e);o.length>0&&this._reportError("Components on an embedded template: "+o.join(",")+" in "+n),t.forEach(function(e){i._reportError("Property binding "+e.name+" not used by any directive on an embedded template in "+e.sourceInfo)}),r.forEach(function(e){i._reportError("Event binding "+e.name+" on an embedded template in "+e.sourceInfo)})},e}(),T=function(){function e(){}return e.prototype.visitElement=function(e,t){var r=v.preparseElement(e);if(r.type===v.PreparsedElementType.SCRIPT||r.type===v.PreparsedElementType.STYLE||r.type===v.PreparsedElementType.STYLESHEET)return null;var n=e.attrs.map(function(e){return[e.name,e.value]}),o=i(e.name,n),a=t.findNgContentIndex(o),s=_.htmlVisitAll(this,e.children,M);return new g.ElementAst(e.name,_.htmlVisitAll(this,e.attrs),[],[],[],[],s,a,e.sourceInfo)},e.prototype.visitAttr=function(e,t){return new g.AttrAst(e.name,e.value,e.sourceInfo)},e.prototype.visitText=function(e,t){var r=t.findNgContentIndex(O);return new g.TextAst(e.value,r,e.sourceInfo)},e}(),N=function(){function e(e,t,r,n){this.name=e,this.expression=t,this.isLiteral=r,this.sourceInfo=n}return e}();!function(){function e(e,t){this.message=e,this.sourceInfo=t}return e}(),t.splitClasses=n;var j=function(){function e(e,t){this.ngContentIndexMatcher=e,this.wildcardNgContentIndex=t}return e.create=function(t){if(0===t.length||!t[0].directive.isComponent)return M;for(var r=new m.SelectorMatcher,n=t[0].directive.template.ngContentSelectors,i=null,o=0;o<n.length;o++){var a=n[o];l.StringWrapper.equals(a,"*")?i=o:r.addSelectables(m.CssSelector.parse(n[o]),o)}return new e(r,i)},e.prototype.findNgContentIndex=function(e){var t=[];return l.isPresent(this.wildcardNgContentIndex)&&t.push(this.wildcardNgContentIndex),this.ngContentIndexMatcher.match(e,function(e,r){t.push(r)}),u.ListWrapper.sort(t),t.length>0?t[0]:null},e}(),M=new j(new m.SelectorMatcher,null),V=new T;return o.define=a,r.exports}),System.register("angular2/src/core/forms/directives/default_value_accessor",["angular2/src/core/metadata","angular2/src/core/linker","angular2/src/core/render","angular2/src/core/di","angular2/src/core/forms/directives/control_value_accessor","angular2/src/core/facade/lang","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/metadata"),c=e("angular2/src/core/linker"),u=e("angular2/src/core/render"),l=e("angular2/src/core/di"),p=e("angular2/src/core/forms/directives/control_value_accessor"),d=e("angular2/src/core/facade/lang"),f=e("angular2/src/core/forms/directives/shared"),h=d.CONST_EXPR(new l.Binding(p.NG_VALUE_ACCESSOR,{toAlias:l.forwardRef(function(){return g}),multi:!0})),g=function(){function e(e,t){this._renderer=e,this._elementRef=t,this.onChange=function(e){},this.onTouched=function(){}}return e.prototype.writeValue=function(e){var t=d.isBlank(e)?"":e;f.setProperty(this._renderer,this._elementRef,"value",t)},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e=o([s.Directive({selector:"[ng-control],[ng-model],[ng-form-control]",host:{"(change)":"onChange($event.target.value)","(input)":"onChange($event.target.value)","(blur)":"onTouched()"},bindings:[h]}),a("design:paramtypes",[u.Renderer,c.ElementRef])],e)}();return t.DefaultValueAccessor=g,n.define=i,r.exports}),System.register("angular2/src/core/di/injector",["angular2/src/core/facade/collection","angular2/src/core/di/binding","angular2/src/core/di/exceptions","angular2/src/core/facade/lang","angular2/src/core/di/key","angular2/src/core/di/metadata"],!0,function(e,t,r){function n(e,t){return e===t||t===h.PublicAndPrivate||e===h.PublicAndPrivate}function i(e,t){for(var r=[],n=0;n<e._proto.numberOfBindings;++n)r.push(t(e._proto.getBindingAtIndex(n)));return r}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/di/binding"),u=e("angular2/src/core/di/exceptions"),l=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/di/key"),d=e("angular2/src/core/di/metadata"),f=10;t.UNDEFINED=l.CONST_EXPR(new Object),function(e){e[e.Public=0]="Public",e[e.Private=1]="Private",e[e.PublicAndPrivate=2]="PublicAndPrivate"}(t.Visibility||(t.Visibility={}));var h=t.Visibility,g=function(){function e(e,t){this.binding0=null,this.binding1=null,this.binding2=null,this.binding3=null,this.binding4=null,this.binding5=null,this.binding6=null,this.binding7=null,this.binding8=null,this.binding9=null,this.keyId0=null,this.keyId1=null,this.keyId2=null,this.keyId3=null,this.keyId4=null,this.keyId5=null,this.keyId6=null,this.keyId7=null,this.keyId8=null,this.keyId9=null,this.visibility0=null,this.visibility1=null,this.visibility2=null,this.visibility3=null,this.visibility4=null,this.visibility5=null,this.visibility6=null,this.visibility7=null,this.visibility8=null,this.visibility9=null;var r=t.length;r>0&&(this.binding0=t[0].binding,this.keyId0=t[0].getKeyId(),this.visibility0=t[0].visibility),r>1&&(this.binding1=t[1].binding,this.keyId1=t[1].getKeyId(),this.visibility1=t[1].visibility),r>2&&(this.binding2=t[2].binding,this.keyId2=t[2].getKeyId(),this.visibility2=t[2].visibility),r>3&&(this.binding3=t[3].binding,this.keyId3=t[3].getKeyId(),this.visibility3=t[3].visibility),r>4&&(this.binding4=t[4].binding,this.keyId4=t[4].getKeyId(),this.visibility4=t[4].visibility),r>5&&(this.binding5=t[5].binding,this.keyId5=t[5].getKeyId(),this.visibility5=t[5].visibility),r>6&&(this.binding6=t[6].binding,this.keyId6=t[6].getKeyId(),this.visibility6=t[6].visibility),r>7&&(this.binding7=t[7].binding,this.keyId7=t[7].getKeyId(),this.visibility7=t[7].visibility),r>8&&(this.binding8=t[8].binding,this.keyId8=t[8].getKeyId(),this.visibility8=t[8].visibility),r>9&&(this.binding9=t[9].binding,this.keyId9=t[9].getKeyId(),this.visibility9=t[9].visibility)}return e.prototype.getBindingAtIndex=function(e){if(0==e)return this.binding0;if(1==e)return this.binding1;if(2==e)return this.binding2;if(3==e)return this.binding3;if(4==e)return this.binding4;if(5==e)return this.binding5;if(6==e)return this.binding6;if(7==e)return this.binding7;if(8==e)return this.binding8;if(9==e)return this.binding9;throw new u.OutOfBoundsError(e)},e.prototype.createInjectorStrategy=function(e){return new v(e,this)},e}();t.ProtoInjectorInlineStrategy=g;var m=function(){function e(e,t){var r=t.length;this.bindings=s.ListWrapper.createFixedSize(r),this.keyIds=s.ListWrapper.createFixedSize(r),this.visibilities=s.ListWrapper.createFixedSize(r);for(var n=0;r>n;n++)this.bindings[n]=t[n].binding,this.keyIds[n]=t[n].getKeyId(),this.visibilities[n]=t[n].visibility}return e.prototype.getBindingAtIndex=function(e){if(0>e||e>=this.bindings.length)throw new u.OutOfBoundsError(e);return this.bindings[e]},e.prototype.createInjectorStrategy=function(e){return new _(this,e)},e}();t.ProtoInjectorDynamicStrategy=m;var y=function(){function e(e){this.numberOfBindings=e.length,this._strategy=e.length>f?new m(this,e):new g(this,e)}return e.prototype.getBindingAtIndex=function(e){return this._strategy.getBindingAtIndex(e)},e}();t.ProtoInjector=y;var v=function(){function e(e,r){this.injector=e,this.protoStrategy=r,this.obj0=t.UNDEFINED,this.obj1=t.UNDEFINED,this.obj2=t.UNDEFINED,this.obj3=t.UNDEFINED,this.obj4=t.UNDEFINED,this.obj5=t.UNDEFINED,this.obj6=t.UNDEFINED,this.obj7=t.UNDEFINED,this.obj8=t.UNDEFINED,this.obj9=t.UNDEFINED}return e.prototype.resetConstructionCounter=function(){this.injector._constructionCounter=0},e.prototype.instantiateBinding=function(e,t){return this.injector._new(e,t)},e.prototype.attach=function(e,t){var r=this.injector;r._parent=e,r._isHost=t},e.prototype.getObjByKeyId=function(e,r){var i=this.protoStrategy,o=this.injector;return i.keyId0===e&&n(i.visibility0,r)?(this.obj0===t.UNDEFINED&&(this.obj0=o._new(i.binding0,i.visibility0)),this.obj0):i.keyId1===e&&n(i.visibility1,r)?(this.obj1===t.UNDEFINED&&(this.obj1=o._new(i.binding1,i.visibility1)),this.obj1):i.keyId2===e&&n(i.visibility2,r)?(this.obj2===t.UNDEFINED&&(this.obj2=o._new(i.binding2,i.visibility2)),this.obj2):i.keyId3===e&&n(i.visibility3,r)?(this.obj3===t.UNDEFINED&&(this.obj3=o._new(i.binding3,i.visibility3)),this.obj3):i.keyId4===e&&n(i.visibility4,r)?(this.obj4===t.UNDEFINED&&(this.obj4=o._new(i.binding4,i.visibility4)),this.obj4):i.keyId5===e&&n(i.visibility5,r)?(this.obj5===t.UNDEFINED&&(this.obj5=o._new(i.binding5,i.visibility5)),this.obj5):i.keyId6===e&&n(i.visibility6,r)?(this.obj6===t.UNDEFINED&&(this.obj6=o._new(i.binding6,i.visibility6)),this.obj6):i.keyId7===e&&n(i.visibility7,r)?(this.obj7===t.UNDEFINED&&(this.obj7=o._new(i.binding7,i.visibility7)),this.obj7):i.keyId8===e&&n(i.visibility8,r)?(this.obj8===t.UNDEFINED&&(this.obj8=o._new(i.binding8,i.visibility8)),this.obj8):i.keyId9===e&&n(i.visibility9,r)?(this.obj9===t.UNDEFINED&&(this.obj9=o._new(i.binding9,i.visibility9)),this.obj9):t.UNDEFINED},e.prototype.getObjAtIndex=function(e){if(0==e)return this.obj0;if(1==e)return this.obj1;if(2==e)return this.obj2;if(3==e)return this.obj3;if(4==e)return this.obj4;if(5==e)return this.obj5;if(6==e)return this.obj6;if(7==e)return this.obj7;if(8==e)return this.obj8;if(9==e)return this.obj9;throw new u.OutOfBoundsError(e)},e.prototype.getMaxNumberOfObjects=function(){return f},e}();t.InjectorInlineStrategy=v;var _=function(){function e(e,r){this.protoStrategy=e,this.injector=r,this.objs=s.ListWrapper.createFixedSize(e.bindings.length),s.ListWrapper.fill(this.objs,t.UNDEFINED)}return e.prototype.resetConstructionCounter=function(){this.injector._constructionCounter=0},e.prototype.instantiateBinding=function(e,t){return this.injector._new(e,t)},e.prototype.attach=function(e,t){var r=this.injector;r._parent=e,r._isHost=t},e.prototype.getObjByKeyId=function(e,r){for(var i=this.protoStrategy,o=0;o<i.keyIds.length;o++)if(i.keyIds[o]===e&&n(i.visibilities[o],r))return this.objs[o]===t.UNDEFINED&&(this.objs[o]=this.injector._new(i.bindings[o],i.visibilities[o])),this.objs[o];return t.UNDEFINED},e.prototype.getObjAtIndex=function(e){if(0>e||e>=this.objs.length)throw new u.OutOfBoundsError(e);return this.objs[e]},e.prototype.getMaxNumberOfObjects=function(){return this.objs.length},e}();t.InjectorDynamicStrategy=_;var b=function(){function e(e,t){this.binding=e,this.visibility=t}return e.prototype.getKeyId=function(){return this.binding.key.id},e}();t.BindingWithVisibility=b;var w=function(){function e(e,t,r,n){void 0===t&&(t=null),void 0===r&&(r=null),void 0===n&&(n=null),this._proto=e,this._parent=t,this._depProvider=r,this._debugContext=n,this._isHost=!1,this._constructionCounter=0,this._strategy=e._strategy.createInjectorStrategy(this)}return e.resolve=function(e){return c.resolveBindings(e)},e.resolveAndCreate=function(t){var r=e.resolve(t);return e.fromResolvedBindings(r)},e.fromResolvedBindings=function(t){var r=t.map(function(e){return new b(e,h.Public)}),n=new y(r);return new e(n,null,null)},e.prototype.debugContext=function(){return this._debugContext()},e.prototype.get=function(e){return this._getByKey(p.Key.get(e),null,null,!1,h.PublicAndPrivate)},e.prototype.getOptional=function(e){return this._getByKey(p.Key.get(e),null,null,!0,h.PublicAndPrivate)},e.prototype.getAt=function(e){return this._strategy.getObjAtIndex(e)},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!0,
configurable:!0}),Object.defineProperty(e.prototype,"internalStrategy",{get:function(){return this._strategy},enumerable:!0,configurable:!0}),e.prototype.resolveAndCreateChild=function(t){var r=e.resolve(t);return this.createChildFromResolved(r)},e.prototype.createChildFromResolved=function(t){var r=t.map(function(e){return new b(e,h.Public)}),n=new y(r),i=new e(n,null,null);return i._parent=this,i},e.prototype.resolveAndInstantiate=function(t){return this.instantiateResolved(e.resolve([t])[0])},e.prototype.instantiateResolved=function(e){return this._instantiateBinding(e,h.PublicAndPrivate)},e.prototype._new=function(e,t){if(this._constructionCounter++>this._strategy.getMaxNumberOfObjects())throw new u.CyclicDependencyError(this,e.key);return this._instantiateBinding(e,t)},e.prototype._instantiateBinding=function(e,t){if(e.multiBinding){for(var r=s.ListWrapper.createFixedSize(e.resolvedFactories.length),n=0;n<e.resolvedFactories.length;++n)r[n]=this._instantiate(e,e.resolvedFactories[n],t);return r}return this._instantiate(e,e.resolvedFactories[0],t)},e.prototype._instantiate=function(e,t,r){var n,i,o,a,s,c,l,p,d,f,h,g,m,y,v,_,b,w,C,E,R=t.factory,S=t.dependencies,x=S.length;try{n=x>0?this._getByDependency(e,S[0],r):null,i=x>1?this._getByDependency(e,S[1],r):null,o=x>2?this._getByDependency(e,S[2],r):null,a=x>3?this._getByDependency(e,S[3],r):null,s=x>4?this._getByDependency(e,S[4],r):null,c=x>5?this._getByDependency(e,S[5],r):null,l=x>6?this._getByDependency(e,S[6],r):null,p=x>7?this._getByDependency(e,S[7],r):null,d=x>8?this._getByDependency(e,S[8],r):null,f=x>9?this._getByDependency(e,S[9],r):null,h=x>10?this._getByDependency(e,S[10],r):null,g=x>11?this._getByDependency(e,S[11],r):null,m=x>12?this._getByDependency(e,S[12],r):null,y=x>13?this._getByDependency(e,S[13],r):null,v=x>14?this._getByDependency(e,S[14],r):null,_=x>15?this._getByDependency(e,S[15],r):null,b=x>16?this._getByDependency(e,S[16],r):null,w=x>17?this._getByDependency(e,S[17],r):null,C=x>18?this._getByDependency(e,S[18],r):null,E=x>19?this._getByDependency(e,S[19],r):null}catch(P){throw(P instanceof u.AbstractBindingError||P instanceof u.InstantiationError)&&P.addKey(this,e.key),P}var D;try{switch(x){case 0:D=R();break;case 1:D=R(n);break;case 2:D=R(n,i);break;case 3:D=R(n,i,o);break;case 4:D=R(n,i,o,a);break;case 5:D=R(n,i,o,a,s);break;case 6:D=R(n,i,o,a,s,c);break;case 7:D=R(n,i,o,a,s,c,l);break;case 8:D=R(n,i,o,a,s,c,l,p);break;case 9:D=R(n,i,o,a,s,c,l,p,d);break;case 10:D=R(n,i,o,a,s,c,l,p,d,f);break;case 11:D=R(n,i,o,a,s,c,l,p,d,f,h);break;case 12:D=R(n,i,o,a,s,c,l,p,d,f,h,g);break;case 13:D=R(n,i,o,a,s,c,l,p,d,f,h,g,m);break;case 14:D=R(n,i,o,a,s,c,l,p,d,f,h,g,m,y);break;case 15:D=R(n,i,o,a,s,c,l,p,d,f,h,g,m,y,v);break;case 16:D=R(n,i,o,a,s,c,l,p,d,f,h,g,m,y,v,_);break;case 17:D=R(n,i,o,a,s,c,l,p,d,f,h,g,m,y,v,_,b);break;case 18:D=R(n,i,o,a,s,c,l,p,d,f,h,g,m,y,v,_,b,w);break;case 19:D=R(n,i,o,a,s,c,l,p,d,f,h,g,m,y,v,_,b,w,C);break;case 20:D=R(n,i,o,a,s,c,l,p,d,f,h,g,m,y,v,_,b,w,C,E)}}catch(P){throw new u.InstantiationError(this,P,P.stack,e.key)}return D},e.prototype._getByDependency=function(e,r,n){var i=l.isPresent(this._depProvider)?this._depProvider.getDependency(this,e,r):t.UNDEFINED;return i!==t.UNDEFINED?i:this._getByKey(r.key,r.lowerBoundVisibility,r.upperBoundVisibility,r.optional,n)},e.prototype._getByKey=function(e,t,r,n,i){return e===C?this:r instanceof d.SelfMetadata?this._getByKeySelf(e,n,i):r instanceof d.HostMetadata?this._getByKeyHost(e,n,i,t):this._getByKeyDefault(e,n,i,t)},e.prototype._throwOrNull=function(e,t){if(t)return null;throw new u.NoBindingError(this,e)},e.prototype._getByKeySelf=function(e,r,n){var i=this._strategy.getObjByKeyId(e.id,n);return i!==t.UNDEFINED?i:this._throwOrNull(e,r)},e.prototype._getByKeyHost=function(e,r,n,i){var o=this;if(i instanceof d.SkipSelfMetadata){if(o._isHost)return this._getPrivateDependency(e,r,o);o=o._parent}for(;null!=o;){var a=o._strategy.getObjByKeyId(e.id,n);if(a!==t.UNDEFINED)return a;if(l.isPresent(o._parent)&&o._isHost)return this._getPrivateDependency(e,r,o);o=o._parent}return this._throwOrNull(e,r)},e.prototype._getPrivateDependency=function(e,r,n){var i=n._parent._strategy.getObjByKeyId(e.id,h.Private);return i!==t.UNDEFINED?i:this._throwOrNull(e,r)},e.prototype._getByKeyDefault=function(e,r,n,i){var o=this;for(i instanceof d.SkipSelfMetadata&&(n=o._isHost?h.PublicAndPrivate:h.Public,o=o._parent);null!=o;){var a=o._strategy.getObjByKeyId(e.id,n);if(a!==t.UNDEFINED)return a;n=o._isHost?h.PublicAndPrivate:h.Public,o=o._parent}return this._throwOrNull(e,r)},Object.defineProperty(e.prototype,"displayName",{get:function(){return"Injector(bindings: ["+i(this,function(e){return' "'+e.key.displayName+'" '}).join(", ")+"])"},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return this.displayName},e}();t.Injector=w;var C=p.Key.get(w);return o.define=a,r.exports}),System.register("angular2/src/core/change_detection/dynamic_change_detector",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/change_detection/abstract_change_detector","angular2/src/core/change_detection/change_detection_util","angular2/src/core/change_detection/constants","angular2/src/core/change_detection/proto_record"],!0,function(e,t,r){function n(e,t){return e===t?!0:e instanceof String&&t instanceof String&&e==t?!0:e!==e&&t!==t?!0:!1}var i=System.global,o=i.define;i.define=void 0;var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/change_detection/abstract_change_detector"),p=e("angular2/src/core/change_detection/change_detection_util"),d=e("angular2/src/core/change_detection/constants"),f=e("angular2/src/core/change_detection/proto_record"),h=function(e){function t(t,r,n,i,o,a,s,c,l,p){e.call(this,t,r,n,i,o,a),this._records=s,this._eventBindings=c,this._directiveRecords=l,this._genConfig=p,this.directives=null;var d=s.length+1;this.values=u.ListWrapper.createFixedSize(d),this.localPipes=u.ListWrapper.createFixedSize(d),this.prevContexts=u.ListWrapper.createFixedSize(d),this.changes=u.ListWrapper.createFixedSize(d),this.dehydrateDirectives(!1)}return a(t,e),t.prototype.handleEventInternal=function(e,t,r){var n=this,i=!1;return this._matchingEventBindings(e,t).forEach(function(e){var t=n._processEventBinding(e,r);t===!1&&(i=!0)}),i},t.prototype._processEventBinding=function(e,t){var r=u.ListWrapper.createFixedSize(e.records.length);r[0]=this.values[0];for(var n=0;n<e.records.length;++n){var i=e.records[n],o=this._calculateCurrValue(i,r,t);if(i.lastInBinding)return this._markPathAsCheckOnce(i),o;this._writeSelf(i,o,r)}throw new c.BaseException("Cannot be reached")},t.prototype._markPathAsCheckOnce=function(e){if(!e.bindingRecord.isDefaultChangeDetection()){var t=e.bindingRecord.directiveRecord;this._getDetectorFor(t.directiveIndex).markPathToRootAsCheckOnce()}},t.prototype._matchingEventBindings=function(e,t){return u.ListWrapper.filter(this._eventBindings,function(r){return r.eventName==e&&r.elIndex===t})},t.prototype.hydrateDirectives=function(t){if(this.values[0]=this.context,this.directives=t,this.strategy===d.ChangeDetectionStrategy.OnPushObserve)for(var r=0;r<this.directiveIndices.length;++r){var n=this.directiveIndices[r];e.prototype.observeDirective.call(this,t.getDirectiveFor(n),r)}},t.prototype.dehydrateDirectives=function(e){e&&this._destroyPipes(),this.values[0]=null,this.directives=null,u.ListWrapper.fill(this.values,p.ChangeDetectionUtil.uninitialized,1),u.ListWrapper.fill(this.changes,!1),u.ListWrapper.fill(this.localPipes,null),u.ListWrapper.fill(this.prevContexts,p.ChangeDetectionUtil.uninitialized)},t.prototype._destroyPipes=function(){for(var e=0;e<this.localPipes.length;++e)s.isPresent(this.localPipes[e])&&p.ChangeDetectionUtil.callPipeOnDestroy(this.localPipes[e])},t.prototype.checkNoChanges=function(){this.runDetectChanges(!0)},t.prototype.detectChangesInRecordsInternal=function(e){for(var t=this._records,r=null,n=!1,i=0;i<t.length;++i){var o=t[i],a=o.bindingRecord,c=a.directiveRecord;if(this._firstInBinding(o)&&(this.propertyBindingIndex=o.propertyBindingIndex),o.isLifeCycleRecord())"DoCheck"!==o.name||e?"OnInit"!==o.name||e||this.alreadyChecked?"OnChanges"===o.name&&s.isPresent(r)&&!e&&this._getDirectiveFor(c.directiveIndex).onChanges(r):this._getDirectiveFor(c.directiveIndex).onInit():this._getDirectiveFor(c.directiveIndex).doCheck();else{var u=this._check(o,e,this.values,this.locals);s.isPresent(u)&&(this._updateDirectiveOrElement(u,a),n=!0,r=this._addChange(a,u,r))}o.lastInDirective&&(r=null,n&&!a.isDefaultChangeDetection()&&this._getDetectorFor(c.directiveIndex).markAsCheckOnce(),n=!1)}},t.prototype._firstInBinding=function(e){var t=p.ChangeDetectionUtil.protoByIndex(this._records,e.selfIndex-1);return s.isBlank(t)||t.bindingRecord!==e.bindingRecord},t.prototype.afterContentLifecycleCallbacksInternal=function(){for(var e=this._directiveRecords,t=e.length-1;t>=0;--t){var r=e[t];r.callAfterContentInit&&!this.alreadyChecked&&this._getDirectiveFor(r.directiveIndex).afterContentInit(),r.callAfterContentChecked&&this._getDirectiveFor(r.directiveIndex).afterContentChecked()}},t.prototype.afterViewLifecycleCallbacksInternal=function(){for(var e=this._directiveRecords,t=e.length-1;t>=0;--t){var r=e[t];r.callAfterViewInit&&!this.alreadyChecked&&this._getDirectiveFor(r.directiveIndex).afterViewInit(),r.callAfterViewChecked&&this._getDirectiveFor(r.directiveIndex).afterViewChecked()}},t.prototype._updateDirectiveOrElement=function(t,r){if(s.isBlank(r.directiveRecord))e.prototype.notifyDispatcher.call(this,t.currentValue);else{var n=r.directiveRecord.directiveIndex;r.setter(this._getDirectiveFor(n),t.currentValue)}this._genConfig.logBindingUpdate&&e.prototype.logBindingUpdate.call(this,t.currentValue)},t.prototype._addChange=function(t,r,n){return t.callOnChanges()?e.prototype.addChange.call(this,n,r.previousValue,r.currentValue):n},t.prototype._getDirectiveFor=function(e){return this.directives.getDirectiveFor(e)},t.prototype._getDetectorFor=function(e){return this.directives.getDetectorFor(e)},t.prototype._check=function(e,t,r,n){return e.isPipeRecord()?this._pipeCheck(e,t,r):this._referenceCheck(e,t,r,n)},t.prototype._referenceCheck=function(t,r,i,o){if(this._pureFuncAndArgsDidNotChange(t))return this._setChanged(t,!1),null;var a=this._calculateCurrValue(t,i,o);if(this.strategy===d.ChangeDetectionStrategy.OnPushObserve&&e.prototype.observeValue.call(this,a,t.selfIndex),t.shouldBeChecked()){var s=this._readSelf(t,i);if(n(s,a))return this._setChanged(t,!1),null;if(t.lastInBinding){var c=p.ChangeDetectionUtil.simpleChange(s,a);return r&&this.throwOnChangeError(s,a),this._writeSelf(t,a,i),this._setChanged(t,!0),c}return this._writeSelf(t,a,i),this._setChanged(t,!0),null}return this._writeSelf(t,a,i),this._setChanged(t,!0),null},t.prototype._calculateCurrValue=function(e,t,r){switch(e.mode){case f.RecordType.Self:return this._readContext(e,t);case f.RecordType.Const:return e.funcOrValue;case f.RecordType.PropertyRead:var n=this._readContext(e,t);return e.funcOrValue(n);case f.RecordType.SafeProperty:var n=this._readContext(e,t);return s.isBlank(n)?null:e.funcOrValue(n);case f.RecordType.PropertyWrite:var n=this._readContext(e,t),i=this._readArgs(e,t)[0];return e.funcOrValue(n,i),i;case f.RecordType.KeyedWrite:var n=this._readContext(e,t),o=this._readArgs(e,t)[0],i=this._readArgs(e,t)[1];return n[o]=i,i;case f.RecordType.Local:return r.get(e.name);case f.RecordType.InvokeMethod:var n=this._readContext(e,t),a=this._readArgs(e,t);return e.funcOrValue(n,a);case f.RecordType.SafeMethodInvoke:var n=this._readContext(e,t);if(s.isBlank(n))return null;var a=this._readArgs(e,t);return e.funcOrValue(n,a);case f.RecordType.KeyedRead:var u=this._readArgs(e,t)[0];return this._readContext(e,t)[u];case f.RecordType.Chain:var a=this._readArgs(e,t);return a[a.length-1];case f.RecordType.InvokeClosure:return s.FunctionWrapper.apply(this._readContext(e,t),this._readArgs(e,t));case f.RecordType.Interpolate:case f.RecordType.PrimitiveOp:case f.RecordType.CollectionLiteral:return s.FunctionWrapper.apply(e.funcOrValue,this._readArgs(e,t));default:throw new c.BaseException("Unknown operation "+e.mode)}},t.prototype._pipeCheck=function(e,t,r){var i=this._readContext(e,r),o=this._pipeFor(e,i);if(!o.pure||this._argsOrContextChanged(e)){var a=this._readArgs(e,r),s=o.pipe.transform(i,a);if(e.shouldBeChecked()){var c=this._readSelf(e,r);if(n(c,s))return this._setChanged(e,!1),null;if(s=p.ChangeDetectionUtil.unwrapValue(s),e.lastInBinding){var u=p.ChangeDetectionUtil.simpleChange(c,s);return t&&this.throwOnChangeError(c,s),this._writeSelf(e,s,r),this._setChanged(e,!0),u}return this._writeSelf(e,s,r),this._setChanged(e,!0),null}return this._writeSelf(e,s,r),this._setChanged(e,!0),null}},t.prototype._pipeFor=function(e,t){var r=this._readPipe(e);if(s.isPresent(r))return r;var n=this.pipes.get(e.name);return this._writePipe(e,n),n},t.prototype._readContext=function(e,t){return-1==e.contextIndex?this._getDirectiveFor(e.directiveIndex):t[e.contextIndex]},t.prototype._readSelf=function(e,t){return t[e.selfIndex]},t.prototype._writeSelf=function(e,t,r){r[e.selfIndex]=t},t.prototype._readPipe=function(e){return this.localPipes[e.selfIndex]},t.prototype._writePipe=function(e,t){this.localPipes[e.selfIndex]=t},t.prototype._setChanged=function(e,t){e.argumentToPureFunction&&(this.changes[e.selfIndex]=t)},t.prototype._pureFuncAndArgsDidNotChange=function(e){return e.isPureFunction()&&!this._argsChanged(e)},t.prototype._argsChanged=function(e){for(var t=e.args,r=0;r<t.length;++r)if(this.changes[t[r]])return!0;return!1},t.prototype._argsOrContextChanged=function(e){return this._argsChanged(e)||this.changes[e.contextIndex]},t.prototype._readArgs=function(e,t){for(var r=u.ListWrapper.createFixedSize(e.args.length),n=e.args,i=0;i<n.length;++i)r[i]=t[n[i]];return r},t}(l.AbstractChangeDetector);return t.DynamicChangeDetector=h,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/jit_proto_change_detector",["angular2/src/core/change_detection/change_detection_jit_generator"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/change_detection/change_detection_jit_generator"),a=function(){function e(e){this.definition=e,this._factory=this._createFactory(e)}return e.isSupported=function(){return!0},e.prototype.instantiate=function(e){return this._factory(e)},e.prototype._createFactory=function(e){return new o.ChangeDetectorJITGenerator(e,"util","AbstractChangeDetector").generate()},e}();return t.JitProtoChangeDetector=a,n.define=i,r.exports}),System.register("@reactivex/rxjs/dist/cjs/Subject",["@reactivex/rxjs/dist/cjs/Observable","@reactivex/rxjs/dist/cjs/Subscriber","@reactivex/rxjs/dist/cjs/Subscription","@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"],!0,function(e,t,r){function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function 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=System.global,s=a.define;a.define=void 0,t.__esModule=!0;var c=e("@reactivex/rxjs/dist/cjs/Observable"),u=n(c),l=e("@reactivex/rxjs/dist/cjs/Subscriber"),p=n(l),d=e("@reactivex/rxjs/dist/cjs/Subscription"),f=n(d),h=e("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"),g=n(h),m=f["default"].prototype.add,y=f["default"].prototype.remove,v=f["default"].prototype.unsubscribe,_=p["default"].prototype.next,b=p["default"].prototype.error,w=p["default"].prototype.complete,C=p["default"].prototype._next,E=p["default"].prototype._error,R=p["default"].prototype._complete,S=u["default"].prototype._subscribe,x=function(e){function t(){i(this,t);for(var r=arguments.length,n=Array(r),o=0;r>o;o++)n[o]=arguments[o];e.call.apply(e,[this].concat(n)),this.observers=[],this.isUnsubscribed=!1,this.dispatching=!1,this.errorSignal=!1,this.completeSignal=!1}return o(t,e),t.create=function(e,t){return new P(e,t)},t.prototype.lift=function(e){var t=new P(this,this.destination||this);return t.operator=e,t},t.prototype._subscribe=function(e){if(!e.isUnsubscribed){if(this.errorSignal)return void e.error(this.errorInstance);if(this.completeSignal)return void e.complete();if(this.isUnsubscribed)throw new Error("Cannot subscribe to a disposed Subject.");return this.observers.push(e),new g["default"](this,e)}},t.prototype.add=function(e){m.call(this,e)},t.prototype.remove=function(e){y.call(this,e)},t.prototype.unsubscribe=function(){this.observers=void 0,v.call(this)},t.prototype.next=function(e){this.isUnsubscribed||(this.dispatching=!0,this._next(e),this.dispatching=!1,this.errorSignal?this.error(this.errorInstance):this.completeSignal&&this.complete())},t.prototype.error=function(e){this.isUnsubscribed||this.completeSignal||(this.errorSignal=!0,this.errorInstance=e,this.dispatching||(this._error(e),this.unsubscribe()))},t.prototype.complete=function(){this.isUnsubscribed||this.errorSignal||(this.completeSignal=!0,this.dispatching||(this._complete(),this.unsubscribe()))},t.prototype._next=function(e){for(var t=-1,r=this.observers.slice(0),n=r.length;++t<n;)r[t].next(e)},t.prototype._error=function(e){var t=-1,r=this.observers,n=r.length;for(this.observers=void 0,this.isUnsubscribed=!0;++t<n;)r[t].error(e);this.isUnsubscribed=!1},t.prototype._complete=function(){var e=-1,t=this.observers,r=t.length;for(this.observers=void 0,this.isUnsubscribed=!0;++e<r;)t[e].complete();this.isUnsubscribed=!1},t}(u["default"]);t["default"]=x;var P=function(e){function t(r,n){i(this,t),e.call(this),this.source=r,this.destination=n}return o(t,e),t.prototype._subscribe=function(e){return S.call(this,e)},t.prototype.next=function(e){_.call(this,e)},t.prototype.error=function(e){b.call(this,e)},t.prototype.complete=function(){w.call(this)},t.prototype._next=function(e){C.call(this,e)},t.prototype._error=function(e){E.call(this,e)},t.prototype._complete=function(){R.call(this)},t}(x);return r.exports=t["default"],a.define=s,r.exports}),System.register("angular2/src/core/linker/element_injector",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/async","angular2/src/core/facade/collection","angular2/src/core/di","angular2/src/core/di/injector","angular2/src/core/di/binding","angular2/src/core/metadata/di","angular2/src/core/linker/view_manager","angular2/src/core/linker/view_container_ref","angular2/src/core/linker/element_ref","angular2/src/core/linker/template_ref","angular2/src/core/metadata/directives","angular2/src/core/linker/directive_lifecycle_reflector","angular2/src/core/change_detection/change_detection","angular2/src/core/linker/query_list","angular2/src/core/reflection/reflection","angular2/src/core/linker/event_config","angular2/src/core/pipes/pipe_binding","angular2/src/core/linker/interfaces","angular2/src/core/linker/view_container_ref"],!0,function(e,t,r){function n(e){var t=e.binding;if(!(t instanceof T))return[];var r=t;return r.eventEmitters.map(function(e){var t=x.EventConfig.parse(e);return new M(t.eventName,S.reflector.getter(t.fieldName))})}function i(e){var t=[];return d.ListWrapper.forEachWithIndex(e,function(e,r){if(e.binding instanceof T){var n=e.binding.queries;n.forEach(function(e){return t.push(new K(r,e.setter,e.metadata))});var i=e.binding.resolvedFactories[0].dependencies;i.forEach(function(e){u.isPresent(e.queryDecorator)&&t.push(new K(r,null,e.queryDecorator))})}}),t}var o=System.global,a=o.define;o.define=void 0;var s,c=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/facade/async"),d=e("angular2/src/core/facade/collection"),f=e("angular2/src/core/di"),h=e("angular2/src/core/di/injector"),g=e("angular2/src/core/di/binding"),m=e("angular2/src/core/metadata/di"),y=e("angular2/src/core/linker/view_manager"),v=e("angular2/src/core/linker/view_container_ref"),_=e("angular2/src/core/linker/element_ref"),b=e("angular2/src/core/linker/template_ref"),w=e("angular2/src/core/metadata/directives"),C=e("angular2/src/core/linker/directive_lifecycle_reflector"),E=e("angular2/src/core/change_detection/change_detection"),R=e("angular2/src/core/linker/query_list"),S=e("angular2/src/core/reflection/reflection"),x=e("angular2/src/core/linker/event_config"),P=e("angular2/src/core/pipes/pipe_binding"),D=e("angular2/src/core/linker/interfaces"),I=e("angular2/src/core/linker/view_container_ref"),O=function(){function e(){this.viewManagerId=f.Key.get(y.AppViewManager).id,this.templateRefId=f.Key.get(b.TemplateRef).id,this.viewContainerId=f.Key.get(v.ViewContainerRef).id,this.changeDetectorRefId=f.Key.get(E.ChangeDetectorRef).id,this.elementRefId=f.Key.get(_.ElementRef).id}return e.instance=function(){return u.isBlank(s)&&(s=new e),s},e}();t.StaticKeys=O;var k=function(){function e(e){u.isPresent(e)?e.addChild(this):this._parent=null}return e.prototype.addChild=function(e){e._parent=this},e.prototype.remove=function(){this._parent=null},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),e}();t.TreeNode=k;var A=function(e){function t(t,r,n,i,o,a,s){e.call(this,t,r,n,i,o),this.attributeName=a,this.queryDecorator=s,this._verify()}return c(t,e),t.prototype._verify=function(){var e=0;if(u.isPresent(this.queryDecorator)&&e++,u.isPresent(this.attributeName)&&e++,e>1)throw new l.BaseException("A directive injectable can contain only one of the following @Attribute or @Query.")},t.createFrom=function(e){return new t(e.key,e.optional,e.lowerBoundVisibility,e.upperBoundVisibility,e.properties,t._attributeName(e.properties),t._query(e.properties))},t._attributeName=function(e){var t=d.ListWrapper.find(e,function(e){return e instanceof m.AttributeMetadata});return u.isPresent(t)?t.attributeName:null},t._query=function(e){return d.ListWrapper.find(e,function(e){return e instanceof m.QueryMetadata})},t}(f.Dependency);t.DirectiveDependency=A;var T=function(e){function t(t,r,n,i,o,a){e.call(this,t,[new g.ResolvedFactory(r,n)],!1),this.metadata=i,this.bindings=o,this.viewBindings=a,this.callOnDestroy=C.hasLifecycleHook(D.LifecycleHooks.OnDestroy,t.token)}return c(t,e),Object.defineProperty(t.prototype,"displayName",{get:function(){return this.key.displayName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"queries",{get:function(){if(u.isBlank(this.metadata.queries))return[];var e=[];return d.StringMapWrapper.forEach(this.metadata.queries,function(t,r){var n=S.reflector.setter(r);e.push(new j(n,t))}),e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"eventEmitters",{get:function(){return u.isPresent(this.metadata)&&u.isPresent(this.metadata.outputs)?this.metadata.outputs:[]},enumerable:!0,configurable:!0}),t.createFromBinding=function(e,r){u.isBlank(r)&&(r=new w.DirectiveMetadata);var n=g.resolveBinding(e),i=n.resolvedFactories[0],o=i.dependencies.map(A.createFrom),a=u.isPresent(r.bindings)?r.bindings:[],s=r instanceof w.ComponentMetadata&&u.isPresent(r.viewBindings)?r.viewBindings:[];return new t(n.key,i.factory,o,r,a,s)},t.createFromType=function(e,r){var n=new f.Binding(e,{toClass:e});return t.createFromBinding(n,r)},t}(g.ResolvedBinding_);t.DirectiveBinding=T;var N=function(){function e(e,t,r,n){this.viewManager=e,this.view=t,this.elementRef=r,this.templateRef=n,this.nestedView=null}return e}();t.PreBuiltObjects=N;var j=function(){function e(e,t){this.setter=e,this.metadata=t}return e}();t.QueryMetadataWithSetter=j;var M=function(){function e(e,t){this.eventName=e,this.getter=t}return e.prototype.subscribe=function(e,t,r){var n=this,i=this.getter(r);return p.ObservableWrapper.subscribe(i,function(r){return e.triggerEventHandlers(n.eventName,r,t)})},e}();t.EventEmitterAccessor=M;var V=function(){function e(e,t,r,o,a,s){this.parent=e,this.index=t,this.distanceToParent=o,this._firstBindingIsComponent=a,this.directiveVariableBindings=s;var c=r.length;this.protoInjector=new h.ProtoInjector(r),this.eventEmitterAccessors=d.ListWrapper.createFixedSize(c);for(var u=0;c>u;++u)this.eventEmitterAccessors[u]=n(r[u]);this.protoQueryRefs=i(r)}return e.create=function(t,r,n,i,o,a){var s=[];return e._createDirectiveBindingWithVisibility(n,s,i),i&&e._createViewBindingsWithVisibility(n,s),e._createBindingsWithVisibility(n,s),new e(t,r,s,o,i,a)},e._createDirectiveBindingWithVisibility=function(t,r,n){t.forEach(function(i){r.push(e._createBindingWithVisibility(n,i,t,i))})},e._createBindingsWithVisibility=function(e,t){var r=[];e.forEach(function(e){r=d.ListWrapper.concat(r,e.bindings)});var n=f.Injector.resolve(r);n.forEach(function(e){return t.push(new h.BindingWithVisibility(e,h.Visibility.Public))})},e._createBindingWithVisibility=function(e,t,r,n){var i=e&&r[0]===t;return new h.BindingWithVisibility(n,i?h.Visibility.PublicAndPrivate:h.Visibility.Public)},e._createViewBindingsWithVisibility=function(e,t){var r=f.Injector.resolve(e[0].viewBindings);r.forEach(function(e){return t.push(new h.BindingWithVisibility(e,h.Visibility.Private))})},e.prototype.instantiate=function(e){return new L(this,e)},e.prototype.directParent=function(){return this.distanceToParent<2?this.parent:null},Object.defineProperty(e.prototype,"hasBindings",{get:function(){return this.eventEmitterAccessors.length>0},enumerable:!0,configurable:!0}),e.prototype.getBindingAtIndex=function(e){return this.protoInjector.getBindingAtIndex(e)},e}();t.ProtoElementInjector=V;var B=function(){function e(e,t,r){this.element=e,this.componentElement=t,this.injector=r}return e}(),L=function(e){function t(t,r){var n=this;e.call(this,r),this._proto=t,this._preBuiltObjects=null,this._injector=new f.Injector(this._proto.protoInjector,null,this,function(){return n._debugContext()});var i=this._injector.internalStrategy;this._strategy=i instanceof h.InjectorInlineStrategy?new q(i,this):new z(i,this),this.hydrated=!1,this._queryStrategy=this._buildQueryStrategy()}return c(t,e),t.prototype.dehydrate=function(){this.hydrated=!1,this._host=null,this._preBuiltObjects=null,this._strategy.callOnDestroy(),this._strategy.dehydrate(),this._queryStrategy.dehydrate()},t.prototype.hydrate=function(e,t,r){this._host=t,this._preBuiltObjects=r,this._reattachInjectors(e),this._queryStrategy.hydrate(),this._strategy.hydrate(),this.hydrated=!0},t.prototype._debugContext=function(){var e=this._preBuiltObjects,t=e.elementRef.boundElementIndex-e.view.elementOffset,r=this._preBuiltObjects.view.getDebugContext(t,null);return u.isPresent(r)?new B(r.element,r.componentElement,r.injector):null},t.prototype._reattachInjectors=function(e){u.isPresent(this._parent)?u.isPresent(e)?(this._reattachInjector(this._injector,e,!1),this._reattachInjector(e,this._parent._injector,!1)):this._reattachInjector(this._injector,this._parent._injector,!1):u.isPresent(this._host)?u.isPresent(e)?(this._reattachInjector(this._injector,e,!1),this._reattachInjector(e,this._host._injector,!0)):this._reattachInjector(this._injector,this._host._injector,!0):u.isPresent(e)&&this._reattachInjector(this._injector,e,!0)},t.prototype._reattachInjector=function(e,t,r){e.internalStrategy.attach(t,r)},t.prototype.hasVariableBinding=function(e){var t=this._proto.directiveVariableBindings;return u.isPresent(t)&&t.has(e)},t.prototype.getVariableBinding=function(e){var t=this._proto.directiveVariableBindings.get(e);return u.isPresent(t)?this.getDirectiveAtIndex(t):this.getElementRef()},t.prototype.get=function(e){return this._injector.get(e)},t.prototype.hasDirective=function(e){return u.isPresent(this._injector.getOptional(e))},t.prototype.getEventEmitterAccessors=function(){return this._proto.eventEmitterAccessors},t.prototype.getDirectiveVariableBindings=function(){return this._proto.directiveVariableBindings},t.prototype.getComponent=function(){return this._strategy.getComponent()},t.prototype.getInjector=function(){return this._injector},t.prototype.getElementRef=function(){return this._preBuiltObjects.elementRef},t.prototype.getViewContainerRef=function(){return new I.ViewContainerRef_(this._preBuiltObjects.viewManager,this.getElementRef())},t.prototype.getNestedView=function(){return this._preBuiltObjects.nestedView},t.prototype.getView=function(){return this._preBuiltObjects.view},t.prototype.directParent=function(){return this._proto.distanceToParent<2?this.parent:null},t.prototype.isComponentKey=function(e){return this._strategy.isComponentKey(e)},t.prototype.getDependency=function(e,t,r){var n=r.key;if(t instanceof T){var i=r,o=t,a=O.instance();if(n.id===a.viewManagerId)return this._preBuiltObjects.viewManager;if(u.isPresent(i.attributeName))return this._buildAttribute(i);if(u.isPresent(i.queryDecorator))return this._queryStrategy.findQuery(i.queryDecorator).list;if(i.key.id===O.instance().changeDetectorRefId){if(o.metadata instanceof w.ComponentMetadata){var s=this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex);return s.changeDetector.ref}return this._preBuiltObjects.view.changeDetector.ref}if(i.key.id===O.instance().elementRefId)return this.getElementRef();if(i.key.id===O.instance().viewContainerId)return this.getViewContainerRef();if(i.key.id===O.instance().templateRefId){if(u.isBlank(this._preBuiltObjects.templateRef)){if(i.optional)return null;throw new f.NoBindingError(null,i.key)}return this._preBuiltObjects.templateRef}}else if(t instanceof P.PipeBinding&&r.key.id===O.instance().changeDetectorRefId){var s=this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex);return s.changeDetector.ref}return h.UNDEFINED},t.prototype._buildAttribute=function(e){var t=this._proto.attributes;return u.isPresent(t)&&t.has(e.attributeName)?t.get(e.attributeName):null},t.prototype.addDirectivesMatchingQuery=function(e,t){var r=u.isBlank(this._preBuiltObjects)?null:this._preBuiltObjects.templateRef;e.selector===b.TemplateRef&&u.isPresent(r)&&t.push(r),this._strategy.addDirectivesMatchingQuery(e,t)},t.prototype._buildQueryStrategy=function(){return 0===this._proto.protoQueryRefs.length?W:this._proto.protoQueryRefs.length<=U.NUMBER_OF_SUPPORTED_QUERIES?new U(this):new H(this)},t.prototype.link=function(e){e.addChild(this)},t.prototype.unlink=function(){this.remove()},t.prototype.getDirectiveAtIndex=function(e){return this._injector.getAt(e)},t.prototype.hasInstances=function(){return this._proto.hasBindings&&this.hydrated},t.prototype.getHost=function(){return this._host},t.prototype.getBoundElementIndex=function(){return this._proto.index},t.prototype.getRootViewInjectors=function(){if(!this.hydrated)return[];var e=this._preBuiltObjects.view,t=e.getNestedView(e.elementOffset+this.getBoundElementIndex());return u.isPresent(t)?t.rootElementInjectors:[]},t.prototype.afterViewChecked=function(){this._queryStrategy.updateViewQueries()},t.prototype.afterContentChecked=function(){this._queryStrategy.updateContentQueries()},t.prototype.traverseAndSetQueriesAsDirty=function(){for(var e=this;u.isPresent(e);)e._setQueriesAsDirty(),e=e.parent},t.prototype._setQueriesAsDirty=function(){this._queryStrategy.setContentQueriesAsDirty(),u.isPresent(this._host)&&this._host._queryStrategy.setViewQueriesAsDirty()},t}(k);t.ElementInjector=L;var F=function(){function e(){}return e.prototype.setContentQueriesAsDirty=function(){},
e.prototype.setViewQueriesAsDirty=function(){},e.prototype.hydrate=function(){},e.prototype.dehydrate=function(){},e.prototype.updateContentQueries=function(){},e.prototype.updateViewQueries=function(){},e.prototype.findQuery=function(e){throw new l.BaseException("Cannot find query for directive "+e+".")},e}(),W=new F,U=function(){function e(e){var t=e._proto.protoQueryRefs;t.length>0&&(this.query0=new G(t[0],e)),t.length>1&&(this.query1=new G(t[1],e)),t.length>2&&(this.query2=new G(t[2],e))}return e.prototype.setContentQueriesAsDirty=function(){u.isPresent(this.query0)&&!this.query0.isViewQuery&&(this.query0.dirty=!0),u.isPresent(this.query1)&&!this.query1.isViewQuery&&(this.query1.dirty=!0),u.isPresent(this.query2)&&!this.query2.isViewQuery&&(this.query2.dirty=!0)},e.prototype.setViewQueriesAsDirty=function(){u.isPresent(this.query0)&&this.query0.isViewQuery&&(this.query0.dirty=!0),u.isPresent(this.query1)&&this.query1.isViewQuery&&(this.query1.dirty=!0),u.isPresent(this.query2)&&this.query2.isViewQuery&&(this.query2.dirty=!0)},e.prototype.hydrate=function(){u.isPresent(this.query0)&&this.query0.hydrate(),u.isPresent(this.query1)&&this.query1.hydrate(),u.isPresent(this.query2)&&this.query2.hydrate()},e.prototype.dehydrate=function(){u.isPresent(this.query0)&&this.query0.dehydrate(),u.isPresent(this.query1)&&this.query1.dehydrate(),u.isPresent(this.query2)&&this.query2.dehydrate()},e.prototype.updateContentQueries=function(){u.isPresent(this.query0)&&!this.query0.isViewQuery&&this.query0.update(),u.isPresent(this.query1)&&!this.query1.isViewQuery&&this.query1.update(),u.isPresent(this.query2)&&!this.query2.isViewQuery&&this.query2.update()},e.prototype.updateViewQueries=function(){u.isPresent(this.query0)&&this.query0.isViewQuery&&this.query0.update(),u.isPresent(this.query1)&&this.query1.isViewQuery&&this.query1.update(),u.isPresent(this.query2)&&this.query2.isViewQuery&&this.query2.update()},e.prototype.findQuery=function(e){if(u.isPresent(this.query0)&&this.query0.protoQueryRef.query===e)return this.query0;if(u.isPresent(this.query1)&&this.query1.protoQueryRef.query===e)return this.query1;if(u.isPresent(this.query2)&&this.query2.protoQueryRef.query===e)return this.query2;throw new l.BaseException("Cannot find query for directive "+e+".")},e.NUMBER_OF_SUPPORTED_QUERIES=3,e}(),H=function(){function e(e){this.queries=e._proto.protoQueryRefs.map(function(t){return new G(t,e)})}return e.prototype.setContentQueriesAsDirty=function(){for(var e=0;e<this.queries.length;++e){var t=this.queries[e];t.isViewQuery||(t.dirty=!0)}},e.prototype.setViewQueriesAsDirty=function(){for(var e=0;e<this.queries.length;++e){var t=this.queries[e];t.isViewQuery&&(t.dirty=!0)}},e.prototype.hydrate=function(){for(var e=0;e<this.queries.length;++e){var t=this.queries[e];t.hydrate()}},e.prototype.dehydrate=function(){for(var e=0;e<this.queries.length;++e){var t=this.queries[e];t.dehydrate()}},e.prototype.updateContentQueries=function(){for(var e=0;e<this.queries.length;++e){var t=this.queries[e];t.isViewQuery||t.update()}},e.prototype.updateViewQueries=function(){for(var e=0;e<this.queries.length;++e){var t=this.queries[e];t.isViewQuery&&t.update()}},e.prototype.findQuery=function(e){for(var t=0;t<this.queries.length;++t){var r=this.queries[t];if(r.protoQueryRef.query===e)return r}throw new l.BaseException("Cannot find query for directive "+e+".")},e}(),q=function(){function e(e,t){this.injectorStrategy=e,this._ei=t}return e.prototype.hydrate=function(){var e=this.injectorStrategy,t=e.protoStrategy;e.resetConstructionCounter(),t.binding0 instanceof T&&u.isPresent(t.keyId0)&&e.obj0===h.UNDEFINED&&(e.obj0=e.instantiateBinding(t.binding0,t.visibility0)),t.binding1 instanceof T&&u.isPresent(t.keyId1)&&e.obj1===h.UNDEFINED&&(e.obj1=e.instantiateBinding(t.binding1,t.visibility1)),t.binding2 instanceof T&&u.isPresent(t.keyId2)&&e.obj2===h.UNDEFINED&&(e.obj2=e.instantiateBinding(t.binding2,t.visibility2)),t.binding3 instanceof T&&u.isPresent(t.keyId3)&&e.obj3===h.UNDEFINED&&(e.obj3=e.instantiateBinding(t.binding3,t.visibility3)),t.binding4 instanceof T&&u.isPresent(t.keyId4)&&e.obj4===h.UNDEFINED&&(e.obj4=e.instantiateBinding(t.binding4,t.visibility4)),t.binding5 instanceof T&&u.isPresent(t.keyId5)&&e.obj5===h.UNDEFINED&&(e.obj5=e.instantiateBinding(t.binding5,t.visibility5)),t.binding6 instanceof T&&u.isPresent(t.keyId6)&&e.obj6===h.UNDEFINED&&(e.obj6=e.instantiateBinding(t.binding6,t.visibility6)),t.binding7 instanceof T&&u.isPresent(t.keyId7)&&e.obj7===h.UNDEFINED&&(e.obj7=e.instantiateBinding(t.binding7,t.visibility7)),t.binding8 instanceof T&&u.isPresent(t.keyId8)&&e.obj8===h.UNDEFINED&&(e.obj8=e.instantiateBinding(t.binding8,t.visibility8)),t.binding9 instanceof T&&u.isPresent(t.keyId9)&&e.obj9===h.UNDEFINED&&(e.obj9=e.instantiateBinding(t.binding9,t.visibility9))},e.prototype.dehydrate=function(){var e=this.injectorStrategy;e.obj0=h.UNDEFINED,e.obj1=h.UNDEFINED,e.obj2=h.UNDEFINED,e.obj3=h.UNDEFINED,e.obj4=h.UNDEFINED,e.obj5=h.UNDEFINED,e.obj6=h.UNDEFINED,e.obj7=h.UNDEFINED,e.obj8=h.UNDEFINED,e.obj9=h.UNDEFINED},e.prototype.callOnDestroy=function(){var e=this.injectorStrategy,t=e.protoStrategy;t.binding0 instanceof T&&t.binding0.callOnDestroy&&e.obj0.onDestroy(),t.binding1 instanceof T&&t.binding1.callOnDestroy&&e.obj1.onDestroy(),t.binding2 instanceof T&&t.binding2.callOnDestroy&&e.obj2.onDestroy(),t.binding3 instanceof T&&t.binding3.callOnDestroy&&e.obj3.onDestroy(),t.binding4 instanceof T&&t.binding4.callOnDestroy&&e.obj4.onDestroy(),t.binding5 instanceof T&&t.binding5.callOnDestroy&&e.obj5.onDestroy(),t.binding6 instanceof T&&t.binding6.callOnDestroy&&e.obj6.onDestroy(),t.binding7 instanceof T&&t.binding7.callOnDestroy&&e.obj7.onDestroy(),t.binding8 instanceof T&&t.binding8.callOnDestroy&&e.obj8.onDestroy(),t.binding9 instanceof T&&t.binding9.callOnDestroy&&e.obj9.onDestroy()},e.prototype.getComponent=function(){return this.injectorStrategy.obj0},e.prototype.isComponentKey=function(e){return this._ei._proto._firstBindingIsComponent&&u.isPresent(e)&&e.id===this.injectorStrategy.protoStrategy.keyId0},e.prototype.addDirectivesMatchingQuery=function(e,t){var r=this.injectorStrategy,n=r.protoStrategy;u.isPresent(n.binding0)&&n.binding0.key.token===e.selector&&(r.obj0===h.UNDEFINED&&(r.obj0=r.instantiateBinding(n.binding0,n.visibility0)),t.push(r.obj0)),u.isPresent(n.binding1)&&n.binding1.key.token===e.selector&&(r.obj1===h.UNDEFINED&&(r.obj1=r.instantiateBinding(n.binding1,n.visibility1)),t.push(r.obj1)),u.isPresent(n.binding2)&&n.binding2.key.token===e.selector&&(r.obj2===h.UNDEFINED&&(r.obj2=r.instantiateBinding(n.binding2,n.visibility2)),t.push(r.obj2)),u.isPresent(n.binding3)&&n.binding3.key.token===e.selector&&(r.obj3===h.UNDEFINED&&(r.obj3=r.instantiateBinding(n.binding3,n.visibility3)),t.push(r.obj3)),u.isPresent(n.binding4)&&n.binding4.key.token===e.selector&&(r.obj4===h.UNDEFINED&&(r.obj4=r.instantiateBinding(n.binding4,n.visibility4)),t.push(r.obj4)),u.isPresent(n.binding5)&&n.binding5.key.token===e.selector&&(r.obj5===h.UNDEFINED&&(r.obj5=r.instantiateBinding(n.binding5,n.visibility5)),t.push(r.obj5)),u.isPresent(n.binding6)&&n.binding6.key.token===e.selector&&(r.obj6===h.UNDEFINED&&(r.obj6=r.instantiateBinding(n.binding6,n.visibility6)),t.push(r.obj6)),u.isPresent(n.binding7)&&n.binding7.key.token===e.selector&&(r.obj7===h.UNDEFINED&&(r.obj7=r.instantiateBinding(n.binding7,n.visibility7)),t.push(r.obj7)),u.isPresent(n.binding8)&&n.binding8.key.token===e.selector&&(r.obj8===h.UNDEFINED&&(r.obj8=r.instantiateBinding(n.binding8,n.visibility8)),t.push(r.obj8)),u.isPresent(n.binding9)&&n.binding9.key.token===e.selector&&(r.obj9===h.UNDEFINED&&(r.obj9=r.instantiateBinding(n.binding9,n.visibility9)),t.push(r.obj9))},e}(),z=function(){function e(e,t){this.injectorStrategy=e,this._ei=t}return e.prototype.hydrate=function(){var e=this.injectorStrategy,t=e.protoStrategy;e.resetConstructionCounter();for(var r=0;r<t.keyIds.length;r++)t.bindings[r]instanceof T&&u.isPresent(t.keyIds[r])&&e.objs[r]===h.UNDEFINED&&(e.objs[r]=e.instantiateBinding(t.bindings[r],t.visibilities[r]))},e.prototype.dehydrate=function(){var e=this.injectorStrategy;d.ListWrapper.fill(e.objs,h.UNDEFINED)},e.prototype.callOnDestroy=function(){for(var e=this.injectorStrategy,t=e.protoStrategy,r=0;r<t.bindings.length;r++)t.bindings[r]instanceof T&&t.bindings[r].callOnDestroy&&e.objs[r].onDestroy()},e.prototype.getComponent=function(){return this.injectorStrategy.objs[0]},e.prototype.isComponentKey=function(e){var t=this.injectorStrategy.protoStrategy;return this._ei._proto._firstBindingIsComponent&&u.isPresent(e)&&e.id===t.keyIds[0]},e.prototype.addDirectivesMatchingQuery=function(e,t){for(var r=this.injectorStrategy,n=r.protoStrategy,i=0;i<n.bindings.length;i++)n.bindings[i].key.token===e.selector&&(r.objs[i]===h.UNDEFINED&&(r.objs[i]=r.instantiateBinding(n.bindings[i],n.visibilities[i])),t.push(r.objs[i]))},e}(),K=function(){function e(e,t,r){this.dirIndex=e,this.setter=t,this.query=r}return Object.defineProperty(e.prototype,"usesPropertySyntax",{get:function(){return u.isPresent(this.setter)},enumerable:!0,configurable:!0}),e}();t.ProtoQueryRef=K;var G=function(){function e(e,t){this.protoQueryRef=e,this.originator=t}return Object.defineProperty(e.prototype,"isViewQuery",{get:function(){return this.protoQueryRef.query.isViewQuery},enumerable:!0,configurable:!0}),e.prototype.update=function(){if(this.dirty){if(this._update(),this.dirty=!1,this.protoQueryRef.usesPropertySyntax){var e=this.originator.getDirectiveAtIndex(this.protoQueryRef.dirIndex);this.protoQueryRef.query.first?this.protoQueryRef.setter(e,this.list.length>0?this.list.first:null):this.protoQueryRef.setter(e,this.list)}this.list.notifyOnChanges()}},e.prototype._update=function(){var e=[];if(this.protoQueryRef.query.isViewQuery){var t=this.originator.getView(),r=t.getNestedView(t.elementOffset+this.originator.getBoundElementIndex());u.isPresent(r)&&this._visitView(r,e)}else this._visit(this.originator,e);this.list.reset(e)},e.prototype._visit=function(e,t){for(var r=e.getView(),n=r.elementOffset+e._proto.index,i=n;i<r.elementOffset+r.ownBindersCount;i++){var o=r.elementInjectors[i];if(!u.isBlank(o)){if(i>n&&(u.isBlank(o)||u.isBlank(o.parent)||r.elementOffset+o.parent._proto.index<n))break;if(this.protoQueryRef.query.descendants||o.parent==this.originator||o==this.originator){this._visitInjector(o,t);var a=r.viewContainers[i];u.isPresent(a)&&this._visitViewContainer(a,t)}}}},e.prototype._visitInjector=function(e,t){this.protoQueryRef.query.isVarBindingQuery?this._aggregateVariableBindings(e,t):this._aggregateDirective(e,t)},e.prototype._visitViewContainer=function(e,t){for(var r=0;r<e.views.length;r++)this._visitView(e.views[r],t)},e.prototype._visitView=function(e,t){for(var r=e.elementOffset;r<e.elementOffset+e.ownBindersCount;r++){var n=e.elementInjectors[r];if(!u.isBlank(n)){this._visitInjector(n,t);var i=e.viewContainers[r];u.isPresent(i)&&this._visitViewContainer(i,t)}}},e.prototype._aggregateVariableBindings=function(e,t){for(var r=this.protoQueryRef.query.varBindings,n=0;n<r.length;++n)e.hasVariableBinding(r[n])&&t.push(e.getVariableBinding(r[n]))},e.prototype._aggregateDirective=function(e,t){e.addDirectivesMatchingQuery(this.protoQueryRef.query,t)},e.prototype.dehydrate=function(){this.list=null},e.prototype.hydrate=function(){this.list=new R.QueryList,this.dirty=!0},e}();return t.QueryRef=G,o.define=a,r.exports}),System.register("angular2/src/animate/animation_builder",["angular2/src/core/di","angular2/src/animate/css_animation_builder","angular2/src/animate/browser_details"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/animate/css_animation_builder"),u=e("angular2/src/animate/browser_details"),l=function(){function e(e){this.browserDetails=e}return e.prototype.css=function(){return new c.CssAnimationBuilder(this.browserDetails)},e=o([s.Injectable(),a("design:paramtypes",[u.BrowserDetails])],e)}();return t.AnimationBuilder=l,n.define=i,r.exports}),System.register("angular2/src/core/compiler/template_compiler",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/facade/async","angular2/src/core/linker/template_commands","angular2/src/core/compiler/directive_metadata","angular2/src/core/di","angular2/src/core/compiler/source_module","angular2/src/core/compiler/change_detector_compiler","angular2/src/core/compiler/style_compiler","angular2/src/core/compiler/command_compiler","angular2/src/core/compiler/template_parser","angular2/src/core/compiler/template_normalizer","angular2/src/core/compiler/runtime_metadata","angular2/src/core/application_tokens","angular2/src/core/compiler/command_compiler","angular2/src/core/compiler/util","angular2/src/core/di"],!0,function(e,t,r){function n(e){if(!e.isComponent)throw new h.BaseException("Could not compile '"+e.type.name+"' because it is not a component.")}function i(e){return e.name+"Template"}function o(e){var t=e.substring(0,e.length-I.MODULE_SUFFIX.length);return t+".template"+I.MODULE_SUFFIX}function a(e,t){for(var r=0;r<e.length;r++)t.push(e[r])}function s(e){return""+b.moduleRef(o(e.type.moduleUrl))+i(e.type)}var c=System.global,u=c.define;c.define=void 0;var l=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},p=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},d=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},f=e("angular2/src/core/facade/lang"),h=e("angular2/src/core/facade/exceptions"),g=e("angular2/src/core/facade/collection"),m=e("angular2/src/core/facade/async"),y=e("angular2/src/core/linker/template_commands"),v=e("angular2/src/core/compiler/directive_metadata"),_=e("angular2/src/core/di"),b=e("angular2/src/core/compiler/source_module"),w=e("angular2/src/core/compiler/change_detector_compiler"),C=e("angular2/src/core/compiler/style_compiler"),E=e("angular2/src/core/compiler/command_compiler"),R=e("angular2/src/core/compiler/template_parser"),S=e("angular2/src/core/compiler/template_normalizer"),x=e("angular2/src/core/compiler/runtime_metadata"),P=e("angular2/src/core/application_tokens"),D=e("angular2/src/core/compiler/command_compiler"),I=e("angular2/src/core/compiler/util"),O=e("angular2/src/core/di"),k=function(){function e(e,t,r,n,i,o,a){this._runtimeMetadataResolver=e,this._templateNormalizer=t,this._templateParser=r,this._styleCompiler=n,this._commandCompiler=i,this._cdCompiler=o,this._hostCacheKeys=new Map,this._compiledTemplateCache=new Map,this._compiledTemplateDone=new Map,this._appId=a}return e.prototype.normalizeDirectiveMetadata=function(e){if(!e.isComponent)return m.PromiseWrapper.resolve(e);var t;return t=e.isComponent?this._templateNormalizer.normalizeTemplate(e.type,e.template):m.PromiseWrapper.resolve(null),t.then(function(t){return new v.CompileDirectiveMetadata({type:e.type,isComponent:e.isComponent,dynamicLoadable:e.dynamicLoadable,selector:e.selector,exportAs:e.exportAs,changeDetection:e.changeDetection,inputs:e.inputs,outputs:e.outputs,hostListeners:e.hostListeners,hostProperties:e.hostProperties,hostAttributes:e.hostAttributes,lifecycleHooks:e.lifecycleHooks,template:t})})},e.prototype.compileHostComponentRuntime=function(e){var t=this._hostCacheKeys.get(e);if(f.isBlank(t)){t=new Object,this._hostCacheKeys.set(e,t);var r=this._runtimeMetadataResolver.getMetadata(e);n(r);var i=v.createHostComponentMeta(r.type,r.selector);this._compileComponentRuntime(t,i,[r],new Set)}return this._compiledTemplateDone.get(t).then(function(e){return new y.CompiledHostTemplate(function(){return e})})},e.prototype.clearCache=function(){this._hostCacheKeys.clear(),this._styleCompiler.clearCache(),this._compiledTemplateCache.clear(),this._compiledTemplateDone.clear()},e.prototype._compileComponentRuntime=function(e,t,r,n){var i=this,o=this._compiledTemplateCache.get(e),a=this._compiledTemplateDone.get(e);if(f.isBlank(o)){var s,c,u,l=y.nextTemplateId();o=new y.CompiledTemplate(l,function(e,t){return[c,u,s]}),this._compiledTemplateCache.set(e,o),n.add(e),a=m.PromiseWrapper.all([this._styleCompiler.compileComponentRuntime(this._appId,l,t.template)].concat(r.map(function(e){return i.normalizeDirectiveMetadata(e)}))).then(function(e){var r=[],o=e.slice(1),a=i._templateParser.parse(t.template.template,o,t.type.name),p=i._cdCompiler.compileComponentRuntime(t.type,t.changeDetection,a);return c=p[0],s=e[0],u=i._compileCommandsRuntime(t,l,a,p,n,r),m.PromiseWrapper.all(r)}).then(function(t){return g.SetWrapper["delete"](n,e),o}),this._compiledTemplateDone.set(e,a)}return o},e.prototype._compileCommandsRuntime=function(e,t,r,n,i,o){var a=this;return this._commandCompiler.compileComponentRuntime(e,this._appId,t,r,n,function(e){var t=e.type.runtime,r=a._runtimeMetadataResolver.getViewDirectivesMetadata(e.type.runtime),n=g.SetWrapper.has(i,t),s=a._compileComponentRuntime(t,e,r,i);return n||o.push(a._compiledTemplateDone.get(t)),s})},e.prototype.compileTemplatesCodeGen=function(e){var t=this;if(0===e.length)throw new h.BaseException("No components given");var r=[],a=[],s=[],c="templateId",u="appId";e.forEach(function(e){var i=e.component;if(n(i),s.push(i),t._processTemplateCodeGen(i,u,c,e.directives,r,a),i.dynamicLoadable){var o=v.createHostComponentMeta(i.type,i.selector);s.push(o),t._processTemplateCodeGen(o,u,c,[i],r,a)}}),g.ListWrapper.forEachWithIndex(s,function(e,t){var n,o=I.codeGenValueFn([u,c],"["+a[t].join(",")+"]"),s="new "+D.TEMPLATE_COMMANDS_MODULE_REF+"CompiledTemplate("+D.TEMPLATE_COMMANDS_MODULE_REF+"nextTemplateId(),"+o+")";if(e.type.isHost){var l="_hostTemplateFactory"+t;r.push(I.codeGenValueFn([],s,l)+";");var p=I.IS_DART?"const":"new";n=p+" "+D.TEMPLATE_COMMANDS_MODULE_REF+"CompiledHostTemplate("+l+")"}else n=s;r.push(""+I.codeGenExportVariable(i(e.type),e.type.isHost)+n+";")});var l=e[0].component.type.moduleUrl;return new b.SourceModule(""+o(l),r.join("\n"))},e.prototype.compileStylesheetCodeGen=function(e,t){return this._styleCompiler.compileStylesheetCodeGen(e,t)},e.prototype._processTemplateCodeGen=function(e,t,r,n,i,o){var c=this._styleCompiler.compileComponentCodeGen(t,r,e.template),u=this._templateParser.parse(e.template.template,n,e.type.name),l=this._cdCompiler.compileComponentCodeGen(e.type,e.changeDetection,u),p=this._commandCompiler.compileComponentCodeGen(e,t,r,u,l.expressions,s);a(c.declarations,i),a(l.declarations,i),a(p.declarations,i),o.push([l.expressions[0],p.expression,c.expression])},e=l([_.Injectable(),d(6,O.Inject(P.APP_ID)),p("design:paramtypes",[x.RuntimeMetadataResolver,S.TemplateNormalizer,R.TemplateParser,C.StyleCompiler,E.CommandCompiler,w.ChangeDetectionCompiler,String])],e)}();t.TemplateCompiler=k;var A=function(){function e(e,t){this.component=e,this.directives=t}return e}();return t.NormalizedComponentWithViewDirectives=A,c.define=u,r.exports}),System.register("angular2/src/core/forms/directives/shared",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/forms/validators","angular2/src/core/forms/directives/default_value_accessor","angular2/src/core/forms/directives/checkbox_value_accessor","angular2/src/core/forms/directives/select_control_value_accessor"],!0,function(e,t,r){function n(e,t){var r=p.ListWrapper.clone(t.path);return r.push(e),r}function i(e,t){d.isBlank(e)&&o(t,"Cannot find control"),d.isBlank(t.valueAccessor)&&o(t,"No value accessor for"),e.validator=h.Validators.compose([e.validator,t.validator]),t.valueAccessor.writeValue(e.value),t.valueAccessor.registerOnChange(function(r){t.viewToModelUpdate(r),e.updateValue(r,{emitModelToViewChange:!1}),e.markAsDirty()}),e.registerOnChange(function(e){return t.valueAccessor.writeValue(e)}),t.valueAccessor.registerOnTouched(function(){return e.markAsTouched()})}function o(e,t){var r=e.path.join(" -> ");throw new f.BaseException(t+" '"+r+"'")}function a(e,t,r,n){e.setElementProperty(t,r,n)}function s(e,t){if(!p.StringMapWrapper.contains(e,"model"))return!1;var r=e.model;return r.isFirstChange()?!0:!d.looseIdentical(t,r.currentValue)}function c(e,t){if(d.isBlank(t))return null;var r,n,i;return t.forEach(function(t){t instanceof g.DefaultValueAccessor?r=t:t instanceof m.CheckboxControlValueAccessor||t instanceof y.SelectControlValueAccessor?(d.isPresent(n)&&o(e,"More than one built-in value accessor matches"),n=t):(d.isPresent(i)&&o(e,"More than one custom value accessor matches"),i=t)}),d.isPresent(i)?i:d.isPresent(n)?n:d.isPresent(r)?r:(o(e,"No valid value accessor for"),null)}var u=System.global,l=u.define;u.define=void 0;var p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/facade/lang"),f=e("angular2/src/core/facade/exceptions"),h=e("angular2/src/core/forms/validators"),g=e("angular2/src/core/forms/directives/default_value_accessor"),m=e("angular2/src/core/forms/directives/checkbox_value_accessor"),y=e("angular2/src/core/forms/directives/select_control_value_accessor");return t.controlPath=n,t.setUpControl=i,t.setProperty=a,t.isPropertyUpdated=s,t.selectValueAccessor=c,u.define=l,r.exports}),System.register("angular2/src/core/di",["angular2/src/core/di/metadata","angular2/src/core/di/decorators","angular2/src/core/di/forward_ref","angular2/src/core/di/injector","angular2/src/core/di/binding","angular2/src/core/di/key","angular2/src/core/di/exceptions","angular2/src/core/di/opaque_token"],!0,function(e,t,r){function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/di/metadata");t.InjectMetadata=a.InjectMetadata,t.OptionalMetadata=a.OptionalMetadata,t.InjectableMetadata=a.InjectableMetadata,t.SelfMetadata=a.SelfMetadata,t.HostMetadata=a.HostMetadata,t.SkipSelfMetadata=a.SkipSelfMetadata,t.DependencyMetadata=a.DependencyMetadata,n(e("angular2/src/core/di/decorators"));var s=e("angular2/src/core/di/forward_ref");t.forwardRef=s.forwardRef,t.resolveForwardRef=s.resolveForwardRef;var c=e("angular2/src/core/di/injector");t.Injector=c.Injector;var u=e("angular2/src/core/di/binding");t.Binding=u.Binding,t.BindingBuilder=u.BindingBuilder,t.ResolvedFactory=u.ResolvedFactory,t.Dependency=u.Dependency,t.bind=u.bind;var l=e("angular2/src/core/di/key");t.Key=l.Key,t.TypeLiteral=l.TypeLiteral;var p=e("angular2/src/core/di/exceptions");t.NoBindingError=p.NoBindingError,t.AbstractBindingError=p.AbstractBindingError,t.CyclicDependencyError=p.CyclicDependencyError,t.InstantiationError=p.InstantiationError,t.InvalidBindingError=p.InvalidBindingError,t.NoAnnotationError=p.NoAnnotationError,t.OutOfBoundsError=p.OutOfBoundsError;var d=e("angular2/src/core/di/opaque_token");return t.OpaqueToken=d.OpaqueToken,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/proto_change_detector",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/change_detection/parser/ast","angular2/src/core/change_detection/change_detection_util","angular2/src/core/change_detection/dynamic_change_detector","angular2/src/core/change_detection/directive_record","angular2/src/core/change_detection/event_binding","angular2/src/core/change_detection/coalesce","angular2/src/core/change_detection/proto_record"],!0,function(e,t,r){function n(e){var t=new R;return g.ListWrapper.forEachWithIndex(e.bindingRecords,function(r,n){return t.add(r,e.variableNames,n)}),w.coalesce(t.records)}function i(e){var t=g.ListWrapper.concat(["$event"],e.variableNames);return e.eventRecords.map(function(e){var r=S.create(e,t),n=e.implicitReceiver instanceof _.DirectiveIndex?e.implicitReceiver:null;return new b.EventBinding(e.target.name,e.target.elementIndex,n,r)})}function o(e){switch(e){case 0:return y.ChangeDetectionUtil.arrayFn0;case 1:return y.ChangeDetectionUtil.arrayFn1;case 2:return y.ChangeDetectionUtil.arrayFn2;case 3:return y.ChangeDetectionUtil.arrayFn3;case 4:return y.ChangeDetectionUtil.arrayFn4;case 5:return y.ChangeDetectionUtil.arrayFn5;case 6:return y.ChangeDetectionUtil.arrayFn6;case 7:return y.ChangeDetectionUtil.arrayFn7;case 8:return y.ChangeDetectionUtil.arrayFn8;case 9:return y.ChangeDetectionUtil.arrayFn9;default:throw new h.BaseException("Does not support literal maps with more than 9 elements")}}function a(e){var t=e.map(function(e){return f.isString(e)?'"'+e+'"':""+e}).join(", ");return"mapFn(["+t+"])"}function s(e){switch(e){case"+":return"operation_add";case"-":return"operation_subtract";case"*":return"operation_multiply";case"/":return"operation_divide";case"%":return"operation_remainder";case"==":return"operation_equals";case"!=":return"operation_not_equals";case"===":return"operation_identical";case"!==":return"operation_not_identical";case"<":return"operation_less_then";case">":return"operation_greater_then";case"<=":return"operation_less_or_equals_then";case">=":return"operation_greater_or_equals_then";case"&&":return"operation_logical_and";case"||":return"operation_logical_or";default:throw new h.BaseException("Unsupported operation "+e)}}function c(e){switch(e){case"+":return y.ChangeDetectionUtil.operation_add;case"-":return y.ChangeDetectionUtil.operation_subtract;case"*":return y.ChangeDetectionUtil.operation_multiply;case"/":return y.ChangeDetectionUtil.operation_divide;case"%":return y.ChangeDetectionUtil.operation_remainder;case"==":return y.ChangeDetectionUtil.operation_equals;case"!=":return y.ChangeDetectionUtil.operation_not_equals;case"===":return y.ChangeDetectionUtil.operation_identical;case"!==":return y.ChangeDetectionUtil.operation_not_identical;case"<":return y.ChangeDetectionUtil.operation_less_then;case">":return y.ChangeDetectionUtil.operation_greater_then;case"<=":return y.ChangeDetectionUtil.operation_less_or_equals_then;case">=":return y.ChangeDetectionUtil.operation_greater_or_equals_then;case"&&":return y.ChangeDetectionUtil.operation_logical_and;case"||":return y.ChangeDetectionUtil.operation_logical_or;default:throw new h.BaseException("Unsupported operation "+e)}}function u(e){return f.isPresent(e)?""+e:""}function l(e){var t=e.length,r=t>0?e[0]:null,n=t>1?e[1]:null,i=t>2?e[2]:null,o=t>3?e[3]:null,a=t>4?e[4]:null,s=t>5?e[5]:null,c=t>6?e[6]:null,l=t>7?e[7]:null,p=t>8?e[8]:null,d=t>9?e[9]:null;switch(t-1){case 1:return function(e){return r+u(e)+n};case 2:return function(e,t){return r+u(e)+n+u(t)+i};case 3:return function(e,t,a){return r+u(e)+n+u(t)+i+u(a)+o};case 4:return function(e,t,s,c){return r+u(e)+n+u(t)+i+u(s)+o+u(c)+a};case 5:return function(e,t,c,l,p){return r+u(e)+n+u(t)+i+u(c)+o+u(l)+a+u(p)+s};case 6:return function(e,t,l,p,d,f){return r+u(e)+n+u(t)+i+u(l)+o+u(p)+a+u(d)+s+u(f)+c};case 7:return function(e,t,p,d,f,h,g){return r+u(e)+n+u(t)+i+u(p)+o+u(d)+a+u(f)+s+u(h)+c+u(g)+l};case 8:return function(e,t,d,f,h,g,m,y){return r+u(e)+n+u(t)+i+u(d)+o+u(f)+a+u(h)+s+u(g)+c+u(m)+l+u(y)+p};case 9:return function(e,t,f,h,g,m,y,v,_){return r+u(e)+n+u(t)+i+u(f)+o+u(h)+a+u(g)+s+u(m)+c+u(y)+l+u(v)+p+u(_)+d};default:throw new h.BaseException("Does not support more than 9 expressions")}}var p=System.global,d=p.define;p.define=void 0;var f=e("angular2/src/core/facade/lang"),h=e("angular2/src/core/facade/exceptions"),g=e("angular2/src/core/facade/collection"),m=e("angular2/src/core/change_detection/parser/ast"),y=e("angular2/src/core/change_detection/change_detection_util"),v=e("angular2/src/core/change_detection/dynamic_change_detector"),_=e("angular2/src/core/change_detection/directive_record"),b=e("angular2/src/core/change_detection/event_binding"),w=e("angular2/src/core/change_detection/coalesce"),C=e("angular2/src/core/change_detection/proto_record"),E=function(){function e(e){this._definition=e,this._propertyBindingRecords=n(e),this._eventBindingRecords=i(e),this._propertyBindingTargets=this._definition.bindingRecords.map(function(e){return e.target}),this._directiveIndices=this._definition.directiveRecords.map(function(e){return e.directiveIndex})}return e.prototype.instantiate=function(e){return new v.DynamicChangeDetector(this._definition.id,e,this._propertyBindingRecords.length,this._propertyBindingTargets,this._directiveIndices,this._definition.strategy,this._propertyBindingRecords,this._eventBindingRecords,this._definition.directiveRecords,this._definition.genConfig)},e}();t.DynamicProtoChangeDetector=E,t.createPropertyRecords=n,t.createEventRecords=i;var R=function(){function e(){this.records=[]}return e.prototype.add=function(e,t,r){var n=g.ListWrapper.last(this.records);f.isPresent(n)&&n.bindingRecord.directiveRecord==e.directiveRecord&&(n.lastInDirective=!1);var i=this.records.length;this._appendRecords(e,t,r);var o=g.ListWrapper.last(this.records);f.isPresent(o)&&o!==n&&(o.lastInBinding=!0,o.lastInDirective=!0,this._setArgumentToPureFunction(i))},e.prototype._setArgumentToPureFunction=function(e){for(var t=this,r=e;r<this.records.length;++r){var n=this.records[r];n.isPureFunction()&&n.args.forEach(function(e){return t.records[e-1].argumentToPureFunction=!0}),n.mode===C.RecordType.Pipe&&(n.args.forEach(function(e){return t.records[e-1].argumentToPureFunction=!0}),this.records[n.contextIndex-1].argumentToPureFunction=!0)}},e.prototype._appendRecords=function(e,t,r){e.isDirectiveLifecycle()?this.records.push(new C.ProtoRecord(C.RecordType.DirectiveLifecycle,e.lifecycleEvent,null,[],[],-1,null,this.records.length+1,e,!1,!1,!1,!1,null)):S.append(this.records,e,t,r)},e}();t.ProtoRecordBuilder=R;var S=function(){function e(e,t,r,n){this._records=e,this._bindingRecord=t,this._variableNames=r,this._bindingIndex=n}return e.append=function(t,r,n,i){var o=new e(t,r,n,i);r.ast.visit(o)},e.create=function(t,r){var n=[];return e.append(n,t,r,null),n[n.length-1].lastInBinding=!0,n},e.prototype.visitImplicitReceiver=function(e){return this._bindingRecord.implicitReceiver},e.prototype.visitInterpolation=function(e){var t=this._visitAll(e.expressions);return this._addRecord(C.RecordType.Interpolate,"interpolate",l(e.strings),t,e.strings,0)},e.prototype.visitLiteralPrimitive=function(e){return this._addRecord(C.RecordType.Const,"literal",e.value,[],null,0)},e.prototype.visitPropertyRead=function(e){var t=e.receiver.visit(this);return f.isPresent(this._variableNames)&&g.ListWrapper.contains(this._variableNames,e.name)&&e.receiver instanceof m.ImplicitReceiver?this._addRecord(C.RecordType.Local,e.name,e.name,[],null,t):this._addRecord(C.RecordType.PropertyRead,e.name,e.getter,[],null,t)},e.prototype.visitPropertyWrite=function(e){if(f.isPresent(this._variableNames)&&g.ListWrapper.contains(this._variableNames,e.name)&&e.receiver instanceof m.ImplicitReceiver)throw new h.BaseException("Cannot reassign a variable binding "+e.name);var t=e.receiver.visit(this),r=e.value.visit(this);return this._addRecord(C.RecordType.PropertyWrite,e.name,e.setter,[r],null,t)},e.prototype.visitKeyedWrite=function(e){var t=e.obj.visit(this),r=e.key.visit(this),n=e.value.visit(this);return this._addRecord(C.RecordType.KeyedWrite,null,null,[r,n],null,t)},e.prototype.visitSafePropertyRead=function(e){var t=e.receiver.visit(this);return this._addRecord(C.RecordType.SafeProperty,e.name,e.getter,[],null,t);
},e.prototype.visitMethodCall=function(e){var t=e.receiver.visit(this),r=this._visitAll(e.args);if(f.isPresent(this._variableNames)&&g.ListWrapper.contains(this._variableNames,e.name)){var n=this._addRecord(C.RecordType.Local,e.name,e.name,[],null,t);return this._addRecord(C.RecordType.InvokeClosure,"closure",null,r,null,n)}return this._addRecord(C.RecordType.InvokeMethod,e.name,e.fn,r,null,t)},e.prototype.visitSafeMethodCall=function(e){var t=e.receiver.visit(this),r=this._visitAll(e.args);return this._addRecord(C.RecordType.SafeMethodInvoke,e.name,e.fn,r,null,t)},e.prototype.visitFunctionCall=function(e){var t=e.target.visit(this),r=this._visitAll(e.args);return this._addRecord(C.RecordType.InvokeClosure,"closure",null,r,null,t)},e.prototype.visitLiteralArray=function(e){var t="arrayFn"+e.expressions.length;return this._addRecord(C.RecordType.CollectionLiteral,t,o(e.expressions.length),this._visitAll(e.expressions),null,0)},e.prototype.visitLiteralMap=function(e){return this._addRecord(C.RecordType.CollectionLiteral,a(e.keys),y.ChangeDetectionUtil.mapFn(e.keys),this._visitAll(e.values),null,0)},e.prototype.visitBinary=function(e){var t=e.left.visit(this),r=e.right.visit(this);return this._addRecord(C.RecordType.PrimitiveOp,s(e.operation),c(e.operation),[t,r],null,0)},e.prototype.visitPrefixNot=function(e){var t=e.expression.visit(this);return this._addRecord(C.RecordType.PrimitiveOp,"operation_negate",y.ChangeDetectionUtil.operation_negate,[t],null,0)},e.prototype.visitConditional=function(e){var t=e.condition.visit(this),r=e.trueExp.visit(this),n=e.falseExp.visit(this);return this._addRecord(C.RecordType.PrimitiveOp,"cond",y.ChangeDetectionUtil.cond,[t,r,n],null,0)},e.prototype.visitPipe=function(e){var t=e.exp.visit(this),r=this._visitAll(e.args);return this._addRecord(C.RecordType.Pipe,e.name,e.name,r,null,t)},e.prototype.visitKeyedRead=function(e){var t=e.obj.visit(this),r=e.key.visit(this);return this._addRecord(C.RecordType.KeyedRead,"keyedAccess",y.ChangeDetectionUtil.keyedAccess,[r],null,t)},e.prototype.visitChain=function(e){var t=this,r=e.expressions.map(function(e){return e.visit(t)});return this._addRecord(C.RecordType.Chain,"chain",null,r,null,0)},e.prototype.visitIf=function(e){throw new h.BaseException("Not supported")},e.prototype._visitAll=function(e){for(var t=g.ListWrapper.createFixedSize(e.length),r=0;r<e.length;++r)t[r]=e[r].visit(this);return t},e.prototype._addRecord=function(e,t,r,n,i,o){var a=this._records.length+1;return this._records.push(o instanceof _.DirectiveIndex?new C.ProtoRecord(e,t,r,n,i,-1,o,a,this._bindingRecord,!1,!1,!1,!1,this._bindingIndex):new C.ProtoRecord(e,t,r,n,i,o,null,a,this._bindingRecord,!1,!1,!1,!1,this._bindingIndex)),a},e}();return p.define=d,r.exports}),System.register("angular2/src/core/facade/async",["angular2/src/core/facade/lang","@reactivex/rxjs/dist/cjs/Subject"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=e("angular2/src/core/facade/lang"),s=e("@reactivex/rxjs/dist/cjs/Subject"),c=function(){function e(){}return e.resolve=function(e){return Promise.resolve(e)},e.reject=function(e,t){return Promise.reject(e)},e.catchError=function(e,t){return e["catch"](t)},e.all=function(e){return 0==e.length?Promise.resolve([]):Promise.all(e)},e.then=function(e,t,r){return e.then(t,r)},e.wrap=function(e){return new Promise(function(t,r){try{t(e())}catch(n){r(n)}})},e.completer=function(){var e,t,r=new Promise(function(r,n){e=r,t=n});return{promise:r,resolve:e,reject:t}},e}();t.PromiseWrapper=c;var u=function(){function e(){}return e.setTimeout=function(e,t){return a.global.setTimeout(e,t)},e.clearTimeout=function(e){a.global.clearTimeout(e)},e.setInterval=function(e,t){return a.global.setInterval(e,t)},e.clearInterval=function(e){a.global.clearInterval(e)},e}();t.TimerWrapper=u;var l=function(){function e(){}return e.subscribe=function(e,t,r,n){return void 0===r&&(r=null),void 0===n&&(n=null),e.observer({next:t,"throw":r,"return":n})},e.isObservable=function(e){return e instanceof p},e.dispose=function(e){e.unsubscribe()},e.callNext=function(e,t){e.next(t)},e.callThrow=function(e,t){e["throw"](t)},e.callReturn=function(e){e["return"](null)},e}();t.ObservableWrapper=l;var p=function(){function e(){}return e.prototype.observer=function(e){return null},e}();t.Observable=p;var d=function(e){function t(){e.apply(this,arguments),this._subject=new s}return o(t,e),t.prototype.observer=function(e){return this._subject.subscribe(function(t){setTimeout(function(){return e.next(t)})},function(t){return e["throw"]?e["throw"](t):null},function(){return e["return"]?e["return"]():null})},t.prototype.toRx=function(){return this._subject},t.prototype.next=function(e){this._subject.next(e)},t.prototype["throw"]=function(e){this._subject.error(e)},t.prototype["return"]=function(e){this._subject.complete()},t}(p);return t.EventEmitter=d,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/dom_renderer",["angular2/src/core/di","angular2/src/animate/animation_builder","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/dom/dom_adapter","angular2/src/core/render/dom/events/event_manager","angular2/src/core/render/dom/shared_styles_host","angular2/src/core/profile/profile","angular2/src/core/render/api","angular2/src/core/render/dom/dom_tokens","angular2/src/core/render/view_factory","angular2/src/core/render/view","angular2/src/core/render/dom/util"],!0,function(e,t,r){function n(e){return e}function i(e){return e.nodes}function o(e,t){if(t.length>0&&g.isPresent(y.DOM.parentElement(e))){for(var r=0;r<t.length;r++)y.DOM.insertBefore(e,t[r]);y.DOM.insertBefore(t[0],e)}}function a(e){return function(t){var r=e(t);r||y.DOM.preventDefault(t)}}var s=System.global,c=s.define;s.define=void 0;var u=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},l=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},p=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},d=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},f=e("angular2/src/core/di"),h=e("angular2/src/animate/animation_builder"),g=e("angular2/src/core/facade/lang"),m=e("angular2/src/core/facade/exceptions"),y=e("angular2/src/core/dom/dom_adapter"),v=e("angular2/src/core/render/dom/events/event_manager"),_=e("angular2/src/core/render/dom/shared_styles_host"),b=e("angular2/src/core/profile/profile"),w=e("angular2/src/core/render/api"),C=e("angular2/src/core/render/dom/dom_tokens"),E=e("angular2/src/core/render/view_factory"),R=e("angular2/src/core/render/view"),S=e("angular2/src/core/render/dom/util"),x=function(e){function t(){e.apply(this,arguments)}return u(t,e),t.prototype.createProtoView=function(e){return new R.DefaultProtoViewRef(e)},t.prototype.getNativeElementSync=function(e){return n(e.renderView).boundElements[e.boundElementIndex]},t.prototype.getRootNodes=function(e){return i(e)},t.prototype.attachFragmentAfterFragment=function(e,t){var r=i(e);if(r.length>0){var n=r[r.length-1],a=i(t);o(n,a),this.animateNodesEnter(a)}},t.prototype.animateNodesEnter=function(e){for(var t=0;t<e.length;t++)this.animateNodeEnter(e[t])},t.prototype.attachFragmentAfterElement=function(e,t){var r=n(e.renderView),a=r.boundElements[e.boundElementIndex],s=i(t);o(a,s),this.animateNodesEnter(s)},t.prototype.hydrateView=function(e){n(e).hydrate()},t.prototype.dehydrateView=function(e){n(e).dehydrate()},t.prototype.createTemplateAnchor=function(e){return this.createElement("script",e)},t.prototype.createText=function(e){return y.DOM.createTextNode(g.isPresent(e)?e:"")},t.prototype.appendChild=function(e,t){y.DOM.appendChild(e,t)},t.prototype.setElementProperty=function(e,t,r){var i=n(e.renderView);y.DOM.setProperty(i.boundElements[e.boundElementIndex],t,r)},t.prototype.setElementAttribute=function(e,t,r){var i=n(e.renderView),o=i.boundElements[e.boundElementIndex],a=S.camelCaseToDashCase(t);g.isPresent(r)?y.DOM.setAttribute(o,a,g.stringify(r)):y.DOM.removeAttribute(o,a)},t.prototype.setElementClass=function(e,t,r){var i=n(e.renderView),o=i.boundElements[e.boundElementIndex];r?y.DOM.addClass(o,t):y.DOM.removeClass(o,t)},t.prototype.setElementStyle=function(e,t,r){var i=n(e.renderView),o=i.boundElements[e.boundElementIndex],a=S.camelCaseToDashCase(t);g.isPresent(r)?y.DOM.setStyle(o,a,g.stringify(r)):y.DOM.removeStyle(o,a)},t.prototype.invokeElementMethod=function(e,t,r){var i=n(e.renderView),o=i.boundElements[e.boundElementIndex];y.DOM.invoke(o,t,r)},t.prototype.setText=function(e,t,r){var i=n(e);y.DOM.setText(i.boundTextNodes[t],r)},t.prototype.setEventDispatcher=function(e,t){n(e).setEventDispatcher(t)},t}(w.Renderer);t.DomRenderer=x;var P=function(e){function t(t,r,n,i){e.call(this),this._eventManager=t,this._domSharedStylesHost=r,this._animate=n,this._componentCmds=new Map,this._nativeShadowStyles=new Map,this._createRootHostViewScope=b.wtfCreateScope("DomRenderer#createRootHostView()"),this._createViewScope=b.wtfCreateScope("DomRenderer#createView()"),this._detachFragmentScope=b.wtfCreateScope("DomRenderer#detachFragment()"),this._document=i}return u(t,e),t.prototype.registerComponentTemplate=function(e,t,r,n){this._componentCmds.set(e,t),n?this._nativeShadowStyles.set(e,r):this._domSharedStylesHost.addStyles(r)},t.prototype.resolveComponentTemplate=function(e){return this._componentCmds.get(e)},t.prototype.createRootHostView=function(e,t,r){var n=this._createRootHostViewScope(),i=y.DOM.querySelector(this._document,r);if(g.isBlank(i))throw b.wtfLeave(n),new m.BaseException('The selector "'+r+'" did not match any elements');return b.wtfLeave(n,this._createView(e,i))},t.prototype.createView=function(e,t){var r=this._createViewScope();return b.wtfLeave(r,this._createView(e,null))},t.prototype._createView=function(e,t){for(var r=E.createRenderView(e.cmds,t,this),n=r.nativeShadowRoots,i=0;i<n.length;i++)this._domSharedStylesHost.addHost(n[i]);return new w.RenderViewWithFragments(r,r.fragments)},t.prototype.destroyView=function(e){for(var t=e,r=t.nativeShadowRoots,n=0;n<r.length;n++)this._domSharedStylesHost.removeHost(r[n])},t.prototype.animateNodeEnter=function(e){y.DOM.isElementNode(e)&&y.DOM.hasClass(e,"ng-animate")&&(y.DOM.addClass(e,"ng-enter"),this._animate.css().addAnimationClass("ng-enter-active").start(e).onComplete(function(){y.DOM.removeClass(e,"ng-enter")}))},t.prototype.animateNodeLeave=function(e){y.DOM.isElementNode(e)&&y.DOM.hasClass(e,"ng-animate")?(y.DOM.addClass(e,"ng-leave"),this._animate.css().addAnimationClass("ng-leave-active").start(e).onComplete(function(){y.DOM.removeClass(e,"ng-leave"),y.DOM.remove(e)})):y.DOM.remove(e)},t.prototype.detachFragment=function(e){for(var t=this._detachFragmentScope(),r=i(e),n=0;n<r.length;n++)this.animateNodeLeave(r[n]);b.wtfLeave(t)},t.prototype.createElement=function(e,t){var r=y.DOM.createElement(e);return this._setAttributes(r,t),r},t.prototype.mergeElement=function(e,t){y.DOM.clearNodes(e),this._setAttributes(e,t)},t.prototype._setAttributes=function(e,t){for(var r=0;r<t.length;r+=2)y.DOM.setAttribute(e,t[r],t[r+1])},t.prototype.createShadowRoot=function(e,t){for(var r=y.DOM.createShadowRoot(e),n=this._nativeShadowStyles.get(t),i=0;i<n.length;i++)y.DOM.appendChild(r,y.DOM.createStyleElement(n[i]));return r},t.prototype.on=function(e,t,r){this._eventManager.addEventListener(e,t,a(r))},t.prototype.globalOn=function(e,t,r){return this._eventManager.addGlobalEventListener(e,t,a(r))},t=l([f.Injectable(),d(3,f.Inject(C.DOCUMENT)),p("design:paramtypes",[v.EventManager,_.DomSharedStylesHost,h.AnimationBuilder,Object])],t)}(x);return t.DomRenderer_=P,s.define=c,r.exports}),System.register("angular2/src/core/forms/directives/ng_control_name",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/directives/ng_control","angular2/src/core/forms/directives/control_value_accessor","angular2/src/core/forms/directives/shared","angular2/src/core/forms/validators"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/async"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/control_container"),h=e("angular2/src/core/forms/directives/ng_control"),g=e("angular2/src/core/forms/directives/control_value_accessor"),m=e("angular2/src/core/forms/directives/shared"),y=e("angular2/src/core/forms/validators"),v=u.CONST_EXPR(new d.Binding(h.NgControl,{toAlias:d.forwardRef(function(){return _})})),_=function(e){function t(t,r,n){e.call(this),this.update=new l.EventEmitter,this._added=!1,this._parent=t,this.validators=r,this.valueAccessor=m.selectValueAccessor(this,n)}return o(t,e),t.prototype.onChanges=function(e){this._added||(this.formDirective.addControl(this),this._added=!0),m.isPropertyUpdated(e,this.viewModel)&&(this.viewModel=this.model,this.formDirective.updateModel(this,this.model))},t.prototype.onDestroy=function(){this.formDirective.removeControl(this)},t.prototype.viewToModelUpdate=function(e){this.viewModel=e,l.ObservableWrapper.callNext(this.update,e)},Object.defineProperty(t.prototype,"path",{get:function(){return m.controlPath(this.name,this._parent)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"formDirective",{get:function(){return this._parent.formDirective},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this.formDirective.getControl(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"validator",{get:function(){return y.Validators.compose(this.validators)},enumerable:!0,configurable:!0}),t=a([p.Directive({selector:"[ng-control]",bindings:[v],inputs:["name: ngControl","model: ngModel"],outputs:["update: ngModel"],exportAs:"form"}),c(0,d.Host()),c(0,d.SkipSelf()),c(1,d.Optional()),c(1,d.Inject(y.NG_VALIDATORS)),c(2,d.Optional()),c(2,d.Inject(g.NG_VALUE_ACCESSOR)),s("design:paramtypes",[f.ControlContainer,Array,Array])],t)}(h.NgControl);return t.NgControlName=_,n.define=i,r.exports}),System.register("angular2/src/core/metadata/di",["angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/di/metadata"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/di"),l=e("angular2/src/core/di/metadata"),p=function(e){function t(t){e.call(this),this.attributeName=t}return o(t,e),Object.defineProperty(t.prototype,"token",{get:function(){return this},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return"@Attribute("+c.stringify(this.attributeName)+")"},t=a([c.CONST(),s("design:paramtypes",[String])],t)}(l.DependencyMetadata);t.AttributeMetadata=p;var d=function(e){function t(t,r){var n=void 0===r?{}:r,i=n.descendants,o=void 0===i?!1:i,a=n.first,s=void 0===a?!1:a;e.call(this),this._selector=t,this.descendants=o,this.first=s}return o(t,e),Object.defineProperty(t.prototype,"isViewQuery",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selector",{get:function(){return u.resolveForwardRef(this._selector)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVarBindingQuery",{get:function(){return c.isString(this.selector)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"varBindings",{get:function(){return c.StringWrapper.split(this.selector,new RegExp(","))},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return"@Query("+c.stringify(this.selector)+")"},t=a([c.CONST(),s("design:paramtypes",[Object,Object])],t)}(l.DependencyMetadata);t.QueryMetadata=d;var f=function(e){function t(t,r){var n=(void 0===r?{}:r).descendants,i=void 0===n?!1:n;e.call(this,t,{descendants:i})}return o(t,e),t=a([c.CONST(),s("design:paramtypes",[Object,Object])],t)}(d);t.ContentChildrenMetadata=f;var h=function(e){function t(t){e.call(this,t,{descendants:!0,first:!0})}return o(t,e),t=a([c.CONST(),s("design:paramtypes",[Object])],t)}(d);t.ContentChildMetadata=h;var g=function(e){function t(t,r){var n=void 0===r?{}:r,i=n.descendants,o=void 0===i?!1:i,a=n.first,s=void 0===a?!1:a;e.call(this,t,{descendants:o,first:s})}return o(t,e),Object.defineProperty(t.prototype,"isViewQuery",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return"@ViewQuery("+c.stringify(this.selector)+")"},t=a([c.CONST(),s("design:paramtypes",[Object,Object])],t)}(d);t.ViewQueryMetadata=g;var m=function(e){function t(t){e.call(this,t,{descendants:!0})}return o(t,e),t=a([c.CONST(),s("design:paramtypes",[Object])],t)}(g);t.ViewChildrenMetadata=m;var y=function(e){function t(t){e.call(this,t,{descendants:!0,first:!0})}return o(t,e),t=a([c.CONST(),s("design:paramtypes",[Object])],t)}(g);return t.ViewChildMetadata=y,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/change_detection",["angular2/src/core/change_detection/differs/iterable_differs","angular2/src/core/change_detection/differs/default_iterable_differ","angular2/src/core/change_detection/differs/keyvalue_differs","angular2/src/core/change_detection/differs/default_keyvalue_differ","angular2/src/core/facade/lang","angular2/src/core/change_detection/parser/ast","angular2/src/core/change_detection/parser/lexer","angular2/src/core/change_detection/parser/parser","angular2/src/core/change_detection/parser/locals","angular2/src/core/change_detection/exceptions","angular2/src/core/change_detection/interfaces","angular2/src/core/change_detection/constants","angular2/src/core/change_detection/proto_change_detector","angular2/src/core/change_detection/jit_proto_change_detector","angular2/src/core/change_detection/binding_record","angular2/src/core/change_detection/directive_record","angular2/src/core/change_detection/dynamic_change_detector","angular2/src/core/change_detection/change_detector_ref","angular2/src/core/change_detection/differs/iterable_differs","angular2/src/core/change_detection/differs/keyvalue_differs","angular2/src/core/change_detection/change_detection_util"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/change_detection/differs/iterable_differs"),a=e("angular2/src/core/change_detection/differs/default_iterable_differ"),s=e("angular2/src/core/change_detection/differs/keyvalue_differs"),c=e("angular2/src/core/change_detection/differs/default_keyvalue_differ"),u=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/change_detection/parser/ast");t.ASTWithSource=l.ASTWithSource,t.AST=l.AST,t.AstTransformer=l.AstTransformer,t.PropertyRead=l.PropertyRead,t.LiteralArray=l.LiteralArray,t.ImplicitReceiver=l.ImplicitReceiver;var p=e("angular2/src/core/change_detection/parser/lexer");t.Lexer=p.Lexer;var d=e("angular2/src/core/change_detection/parser/parser");t.Parser=d.Parser;var f=e("angular2/src/core/change_detection/parser/locals");t.Locals=f.Locals;var h=e("angular2/src/core/change_detection/exceptions");t.DehydratedException=h.DehydratedException,t.ExpressionChangedAfterItHasBeenCheckedException=h.ExpressionChangedAfterItHasBeenCheckedException,t.ChangeDetectionError=h.ChangeDetectionError;var g=e("angular2/src/core/change_detection/interfaces");t.ChangeDetectorDefinition=g.ChangeDetectorDefinition,t.DebugContext=g.DebugContext,t.ChangeDetectorGenConfig=g.ChangeDetectorGenConfig;var m=e("angular2/src/core/change_detection/constants");t.ChangeDetectionStrategy=m.ChangeDetectionStrategy,t.CHANGE_DECTION_STRATEGY_VALUES=m.CHANGE_DECTION_STRATEGY_VALUES;var y=e("angular2/src/core/change_detection/proto_change_detector");t.DynamicProtoChangeDetector=y.DynamicProtoChangeDetector;var v=e("angular2/src/core/change_detection/jit_proto_change_detector");t.JitProtoChangeDetector=v.JitProtoChangeDetector;var _=e("angular2/src/core/change_detection/binding_record");t.BindingRecord=_.BindingRecord,t.BindingTarget=_.BindingTarget;var b=e("angular2/src/core/change_detection/directive_record");t.DirectiveIndex=b.DirectiveIndex,t.DirectiveRecord=b.DirectiveRecord;var w=e("angular2/src/core/change_detection/dynamic_change_detector");t.DynamicChangeDetector=w.DynamicChangeDetector;var C=e("angular2/src/core/change_detection/change_detector_ref");t.ChangeDetectorRef=C.ChangeDetectorRef;var E=e("angular2/src/core/change_detection/differs/iterable_differs");t.IterableDiffers=E.IterableDiffers;var R=e("angular2/src/core/change_detection/differs/keyvalue_differs");t.KeyValueDiffers=R.KeyValueDiffers;var S=e("angular2/src/core/change_detection/change_detection_util");return t.WrappedValue=S.WrappedValue,t.SimpleChange=S.SimpleChange,t.keyValDiff=u.CONST_EXPR([u.CONST_EXPR(new c.DefaultKeyValueDifferFactory)]),t.iterableDiff=u.CONST_EXPR([u.CONST_EXPR(new a.DefaultIterableDifferFactory)]),t.defaultIterableDiffers=u.CONST_EXPR(new o.IterableDiffers(t.iterableDiff)),t.defaultKeyValueDiffers=u.CONST_EXPR(new s.KeyValueDiffers(t.keyValDiff)),n.define=i,r.exports}),System.register("angular2/src/core/pipes/async_pipe",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/change_detection","angular2/src/core/pipes/invalid_pipe_argument_exception"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/facade/async"),u=e("angular2/src/core/metadata"),l=e("angular2/src/core/di"),p=e("angular2/src/core/change_detection"),d=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),f=function(){function e(){}return e.prototype.createSubscription=function(e,t){return c.ObservableWrapper.subscribe(e,t,function(e){throw e})},e.prototype.dispose=function(e){c.ObservableWrapper.dispose(e)},e.prototype.onDestroy=function(e){c.ObservableWrapper.dispose(e)},e}(),h=function(){function e(){}return e.prototype.createSubscription=function(e,t){return e.then(t)},e.prototype.dispose=function(e){},e.prototype.onDestroy=function(e){},e}(),g=new h,m=new f,y=function(){function e(e){this._ref=e,this._latestValue=null,this._latestReturnedValue=null,this._subscription=null,this._obj=null,this._strategy=null}return e.prototype.onDestroy=function(){s.isPresent(this._subscription)&&this._dispose()},e.prototype.transform=function(e,t){return s.isBlank(this._obj)?(s.isPresent(e)&&this._subscribe(e),null):e!==this._obj?(this._dispose(),this.transform(e)):this._latestValue===this._latestReturnedValue?this._latestReturnedValue:(this._latestReturnedValue=this._latestValue,p.WrappedValue.wrap(this._latestValue))},e.prototype._subscribe=function(e){var t=this;this._obj=e,this._strategy=this._selectStrategy(e),this._subscription=this._strategy.createSubscription(e,function(r){return t._updateLatestValue(e,r)})},e.prototype._selectStrategy=function(t){if(s.isPromise(t))return g;if(c.ObservableWrapper.isObservable(t))return m;throw new d.InvalidPipeArgumentException(e,t)},e.prototype._dispose=function(){this._strategy.dispose(this._subscription),this._latestValue=null,this._latestReturnedValue=null,this._subscription=null,this._obj=null},e.prototype._updateLatestValue=function(e,t){e===this._obj&&(this._latestValue=t,this._ref.markForCheck())},e=o([u.Pipe({name:"async",pure:!1}),l.Injectable(),a("design:paramtypes",[p.ChangeDetectorRef])],e)}();return t.AsyncPipe=y,n.define=i,r.exports}),System.register("angular2/src/core/render/render",["angular2/src/core/render/dom/shared_styles_host","angular2/src/core/render/dom/dom_renderer","angular2/src/core/render/dom/dom_tokens","angular2/src/core/render/api"],!0,function(e,t,r){function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var i=System.global,o=i.define;return i.define=void 0,n(e("angular2/src/core/render/dom/shared_styles_host")),n(e("angular2/src/core/render/dom/dom_renderer")),n(e("angular2/src/core/render/dom/dom_tokens")),n(e("angular2/src/core/render/api")),i.define=o,r.exports}),System.register("angular2/src/core/forms",["angular2/src/core/forms/model","angular2/src/core/forms/directives/abstract_control_directive","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/directives/ng_control_name","angular2/src/core/forms/directives/ng_form_control","angular2/src/core/forms/directives/ng_model","angular2/src/core/forms/directives/ng_control","angular2/src/core/forms/directives/ng_control_group","angular2/src/core/forms/directives/ng_form_model","angular2/src/core/forms/directives/ng_form","angular2/src/core/forms/directives/default_value_accessor","angular2/src/core/forms/directives/ng_control_status","angular2/src/core/forms/directives/checkbox_value_accessor","angular2/src/core/forms/directives/select_control_value_accessor","angular2/src/core/forms/directives","angular2/src/core/forms/validators","angular2/src/core/forms/directives/validators","angular2/src/core/forms/form_builder","angular2/src/core/forms/form_builder","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/forms/model");t.AbstractControl=o.AbstractControl,t.Control=o.Control,t.ControlGroup=o.ControlGroup,t.ControlArray=o.ControlArray;var a=e("angular2/src/core/forms/directives/abstract_control_directive");t.AbstractControlDirective=a.AbstractControlDirective;var s=e("angular2/src/core/forms/directives/control_container");t.ControlContainer=s.ControlContainer;var c=e("angular2/src/core/forms/directives/ng_control_name");t.NgControlName=c.NgControlName;var u=e("angular2/src/core/forms/directives/ng_form_control");t.NgFormControl=u.NgFormControl;var l=e("angular2/src/core/forms/directives/ng_model");t.NgModel=l.NgModel;var p=e("angular2/src/core/forms/directives/ng_control");t.NgControl=p.NgControl;var d=e("angular2/src/core/forms/directives/ng_control_group");t.NgControlGroup=d.NgControlGroup;var f=e("angular2/src/core/forms/directives/ng_form_model");t.NgFormModel=f.NgFormModel;var h=e("angular2/src/core/forms/directives/ng_form");t.NgForm=h.NgForm;var g=e("angular2/src/core/forms/directives/default_value_accessor");t.DefaultValueAccessor=g.DefaultValueAccessor;var m=e("angular2/src/core/forms/directives/ng_control_status");t.NgControlStatus=m.NgControlStatus;var y=e("angular2/src/core/forms/directives/checkbox_value_accessor");t.CheckboxControlValueAccessor=y.CheckboxControlValueAccessor;var v=e("angular2/src/core/forms/directives/select_control_value_accessor");t.NgSelectOption=v.NgSelectOption,t.SelectControlValueAccessor=v.SelectControlValueAccessor;var _=e("angular2/src/core/forms/directives");t.FORM_DIRECTIVES=_.FORM_DIRECTIVES;var b=e("angular2/src/core/forms/validators");t.NG_VALIDATORS=b.NG_VALIDATORS,t.Validators=b.Validators;var w=e("angular2/src/core/forms/directives/validators");t.DefaultValidators=w.DefaultValidators;var C=e("angular2/src/core/forms/form_builder");t.FormBuilder=C.FormBuilder;var E=e("angular2/src/core/forms/form_builder"),R=e("angular2/src/core/facade/lang");return t.FORM_BINDINGS=R.CONST_EXPR([E.FormBuilder]),n.define=i,r.exports}),System.register("angular2/src/core/change_detection",["angular2/src/core/change_detection/change_detection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/change_detection/change_detection");return t.ChangeDetectionStrategy=o.ChangeDetectionStrategy,t.ExpressionChangedAfterItHasBeenCheckedException=o.ExpressionChangedAfterItHasBeenCheckedException,t.ChangeDetectionError=o.ChangeDetectionError,t.ChangeDetectorRef=o.ChangeDetectorRef,t.WrappedValue=o.WrappedValue,t.SimpleChange=o.SimpleChange,t.IterableDiffers=o.IterableDiffers,t.KeyValueDiffers=o.KeyValueDiffers,n.define=i,r.exports}),System.register("angular2/src/core/pipes",["angular2/src/core/pipes/async_pipe","angular2/src/core/pipes/date_pipe","angular2/src/core/pipes/default_pipes","angular2/src/core/pipes/json_pipe","angular2/src/core/pipes/slice_pipe","angular2/src/core/pipes/lowercase_pipe","angular2/src/core/pipes/number_pipe","angular2/src/core/pipes/uppercase_pipe"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/pipes/async_pipe");t.AsyncPipe=o.AsyncPipe;var a=e("angular2/src/core/pipes/date_pipe");t.DatePipe=a.DatePipe;var s=e("angular2/src/core/pipes/default_pipes");t.DEFAULT_PIPES=s.DEFAULT_PIPES,t.DEFAULT_PIPES_TOKEN=s.DEFAULT_PIPES_TOKEN;var c=e("angular2/src/core/pipes/json_pipe");t.JsonPipe=c.JsonPipe;var u=e("angular2/src/core/pipes/slice_pipe");t.SlicePipe=u.SlicePipe;var l=e("angular2/src/core/pipes/lowercase_pipe");t.LowerCasePipe=l.LowerCasePipe;var p=e("angular2/src/core/pipes/number_pipe");t.NumberPipe=p.NumberPipe,t.DecimalPipe=p.DecimalPipe,t.PercentPipe=p.PercentPipe,t.CurrencyPipe=p.CurrencyPipe;var d=e("angular2/src/core/pipes/uppercase_pipe");return t.UpperCasePipe=d.UpperCasePipe,n.define=i,r.exports}),System.register("angular2/src/core/render",["angular2/src/core/render/render"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/render/render");return t.Renderer=o.Renderer,t.RenderViewRef=o.RenderViewRef,t.RenderProtoViewRef=o.RenderProtoViewRef,t.RenderFragmentRef=o.RenderFragmentRef,t.RenderViewWithFragments=o.RenderViewWithFragments,t.DOCUMENT=o.DOCUMENT,n.define=i,r.exports}),System.register("angular2/src/core/application_common",["angular2/src/core/forms","angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/dom/browser_adapter","angular2/src/core/testability/browser_testability","angular2/src/core/dom/dom_adapter","angular2/src/core/compiler/xhr","angular2/src/core/compiler/xhr_impl","angular2/src/core/render/dom/events/event_manager","angular2/src/core/render/dom/events/key_events","angular2/src/core/render/dom/events/hammer_gestures","angular2/src/core/testability/testability","angular2/src/core/render/api","angular2/src/core/render/render","angular2/src/core/render/dom/shared_styles_host","angular2/src/core/platform_bindings","angular2/src/animate/animation_builder","angular2/src/animate/browser_details","angular2/src/core/profile/wtf_init","angular2/src/core/application_ref"],!0,function(e,t,r){
function n(){if(l.isBlank(f.DOM))throw"Must set a root DOM adapter first.";return[u.bind(w.DOCUMENT).toValue(f.DOM.defaultDoc()),m.EventManager,new u.Binding(m.EVENT_MANAGER_PLUGINS,{toClass:m.DomEventsPlugin,multi:!0}),new u.Binding(m.EVENT_MANAGER_PLUGINS,{toClass:y.KeyEventsPlugin,multi:!0}),new u.Binding(m.EVENT_MANAGER_PLUGINS,{toClass:v.HammerGesturesPlugin,multi:!0}),u.bind(w.DomRenderer).toClass(w.DomRenderer_),u.bind(b.Renderer).toAlias(w.DomRenderer),C.DomSharedStylesHost,u.bind(C.SharedStylesHost).toAlias(C.DomSharedStylesHost),E.EXCEPTION_BINDING,u.bind(h.XHR).toValue(new g.XHRImpl),_.Testability,S.BrowserDetails,R.AnimationBuilder,c.FORM_BINDINGS]}function i(e){return P.platformCommon(e,function(){p.BrowserDomAdapter.makeCurrent(),x.wtfInit(),d.BrowserGetTestability.init()})}function o(e,t){void 0===t&&(t=null);var r=i(),o=[P.applicationCommonBindings(),n()];return l.isPresent(t)&&o.push(t),r.application(o).bootstrap(e)}var a=System.global,s=a.define;a.define=void 0;var c=e("angular2/src/core/forms"),u=e("angular2/src/core/di"),l=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/dom/browser_adapter"),d=e("angular2/src/core/testability/browser_testability"),f=e("angular2/src/core/dom/dom_adapter"),h=e("angular2/src/core/compiler/xhr"),g=e("angular2/src/core/compiler/xhr_impl"),m=e("angular2/src/core/render/dom/events/event_manager"),y=e("angular2/src/core/render/dom/events/key_events"),v=e("angular2/src/core/render/dom/events/hammer_gestures"),_=e("angular2/src/core/testability/testability"),b=e("angular2/src/core/render/api"),w=e("angular2/src/core/render/render"),C=e("angular2/src/core/render/dom/shared_styles_host"),E=e("angular2/src/core/platform_bindings"),R=e("angular2/src/animate/animation_builder"),S=e("angular2/src/animate/browser_details"),x=e("angular2/src/core/profile/wtf_init"),P=e("angular2/src/core/application_ref");return t.applicationDomBindings=n,t.platform=i,t.commonBootstrap=o,a.define=s,r.exports}),System.register("angular2/src/core/metadata/directives",["angular2/src/core/facade/lang","angular2/src/core/di/metadata","angular2/src/core/change_detection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/di/metadata"),l=e("angular2/src/core/change_detection"),p=function(e){function t(t){var r=void 0===t?{}:t,n=r.selector,i=r.inputs,o=r.outputs,a=r.properties,s=r.events,c=r.host,u=r.bindings,l=r.exportAs,p=r.moduleId,d=r.queries;e.call(this),this.selector=n,this.inputs=i,this.outputs=o,this.host=c,this.properties=a,this.events=s,this.exportAs=l,this.moduleId=p,this.queries=d,this.bindings=u}return o(t,e),t=a([c.CONST(),s("design:paramtypes",[Object])],t)}(u.InjectableMetadata);t.DirectiveMetadata=p;var d=function(e){function t(t){var r=void 0===t?{}:t,n=r.selector,i=r.inputs,o=r.outputs,a=r.properties,s=r.events,c=r.host,u=r.exportAs,p=r.moduleId,d=r.bindings,f=r.viewBindings,h=r.changeDetection,g=void 0===h?l.ChangeDetectionStrategy.Default:h,m=r.queries,y=r.templateUrl,v=r.template,_=r.styleUrls,b=r.styles,w=r.directives,C=r.pipes,E=r.encapsulation;e.call(this,{selector:n,inputs:i,outputs:o,properties:a,events:s,host:c,exportAs:u,moduleId:p,bindings:d,queries:m}),this.changeDetection=g,this.viewBindings=f,this.templateUrl=y,this.template=v,this.styleUrls=_,this.styles=b,this.directives=w,this.pipes=C,this.encapsulation=E}return o(t,e),t=a([c.CONST(),s("design:paramtypes",[Object])],t)}(p);t.ComponentMetadata=d;var f=function(e){function t(t){var r=t.name,n=t.pure;e.call(this),this.name=r,this._pure=n}return o(t,e),Object.defineProperty(t.prototype,"pure",{get:function(){return c.isPresent(this._pure)?this._pure:!0},enumerable:!0,configurable:!0}),t=a([c.CONST(),s("design:paramtypes",[Object])],t)}(u.InjectableMetadata);t.PipeMetadata=f;var h=function(){function e(e){this.bindingPropertyName=e}return e=a([c.CONST(),s("design:paramtypes",[String])],e)}();t.InputMetadata=h;var g=function(){function e(e){this.bindingPropertyName=e}return e=a([c.CONST(),s("design:paramtypes",[String])],e)}();t.OutputMetadata=g;var m=function(){function e(e){this.hostPropertyName=e}return e=a([c.CONST(),s("design:paramtypes",[String])],e)}();t.HostBindingMetadata=m;var y=function(){function e(e,t){this.eventName=e,this.args=t}return e=a([c.CONST(),s("design:paramtypes",[String,Array])],e)}();return t.HostListenerMetadata=y,n.define=i,r.exports}),System.register("angular2/render",["angular2/src/core/render"],!0,function(e,t,r){function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var i=System.global,o=i.define;return i.define=void 0,n(e("angular2/src/core/render")),i.define=o,r.exports}),System.register("angular2/src/core/metadata",["angular2/src/core/metadata/di","angular2/src/core/metadata/directives","angular2/src/core/metadata/view","angular2/src/core/metadata/di","angular2/src/core/metadata/directives","angular2/src/core/metadata/view","angular2/src/core/util/decorators"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/metadata/di");t.QueryMetadata=o.QueryMetadata,t.ContentChildrenMetadata=o.ContentChildrenMetadata,t.ContentChildMetadata=o.ContentChildMetadata,t.ViewChildrenMetadata=o.ViewChildrenMetadata,t.ViewQueryMetadata=o.ViewQueryMetadata,t.ViewChildMetadata=o.ViewChildMetadata,t.AttributeMetadata=o.AttributeMetadata;var a=e("angular2/src/core/metadata/directives");t.ComponentMetadata=a.ComponentMetadata,t.DirectiveMetadata=a.DirectiveMetadata,t.PipeMetadata=a.PipeMetadata,t.InputMetadata=a.InputMetadata,t.OutputMetadata=a.OutputMetadata,t.HostBindingMetadata=a.HostBindingMetadata,t.HostListenerMetadata=a.HostListenerMetadata;var s=e("angular2/src/core/metadata/view");t.ViewMetadata=s.ViewMetadata,t.ViewEncapsulation=s.ViewEncapsulation;var c=e("angular2/src/core/metadata/di"),u=e("angular2/src/core/metadata/directives"),l=e("angular2/src/core/metadata/view"),p=e("angular2/src/core/util/decorators");return t.Component=p.makeDecorator(u.ComponentMetadata,function(e){return e.View=t.View}),t.Directive=p.makeDecorator(u.DirectiveMetadata),t.View=p.makeDecorator(l.ViewMetadata,function(e){return e.View=t.View}),t.Attribute=p.makeParamDecorator(c.AttributeMetadata),t.Query=p.makeParamDecorator(c.QueryMetadata),t.ContentChildren=p.makePropDecorator(c.ContentChildrenMetadata),t.ContentChild=p.makePropDecorator(c.ContentChildMetadata),t.ViewChildren=p.makePropDecorator(c.ViewChildrenMetadata),t.ViewChild=p.makePropDecorator(c.ViewChildMetadata),t.ViewQuery=p.makeParamDecorator(c.ViewQueryMetadata),t.Pipe=p.makeDecorator(u.PipeMetadata),t.Input=p.makePropDecorator(u.InputMetadata),t.Output=p.makePropDecorator(u.OutputMetadata),t.HostBinding=p.makePropDecorator(u.HostBindingMetadata),t.HostListener=p.makePropDecorator(u.HostListenerMetadata),n.define=i,r.exports}),System.register("angular2/src/core/linker/proto_view_factory",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/pipes/pipe_binding","angular2/src/core/pipes/pipes","angular2/src/core/linker/view","angular2/src/core/linker/element_binder","angular2/src/core/linker/element_injector","angular2/src/core/linker/directive_resolver","angular2/src/core/linker/view_resolver","angular2/src/core/linker/pipe_resolver","angular2/src/core/pipes","angular2/src/core/linker/template_commands","angular2/render","angular2/src/core/application_tokens"],!0,function(e,t,r){function n(e,t){return e._createComponent(t)}function i(e,t,r){return e._createEmbeddedTemplate(t,r)}function o(e,t,r,n,i,o,u){var l=null,p=null;if(i>0&&(l=r[r.length-i]),m.isBlank(l)&&(i=-1),o>0){var d=r[r.length-o];m.isPresent(d)&&(p=d.protoElementInjector)}m.isBlank(p)&&(o=-1);var f=null,h=!1,g=u.directives.map(function(t){return a(e,t)});u instanceof P.BeginComponentCmd?f=g[0]:u instanceof P.EmbeddedTemplateCmd&&(h=!0);var y=null,v=u.variableNameAndValues.length>0;if(g.length>0||v||h){var _=new Map;h||(_=s(u.variableNameAndValues,g)),y=C.ProtoElementInjector.create(p,n,g,m.isPresent(f),o,_),y.attributes=c(u.attrNameAndValues,!1)}return new w.ElementBinder(n,l,i,y,f,t)}function a(e,t){var r=e.resolve(t);return C.DirectiveBinding.createFromType(t,r)}function s(e,t){for(var r=new Map,n=0;n<e.length;n+=2){var i=e[n],o=e[n+1];m.isNumber(o)?r.set(i,o):r.set(i,null)}return r}function c(e,t){for(var r=new Map,n=0;n<e.length;n+=2)t?r.set(e[n+1],e[n]):r.set(e[n],e[n+1]);return r}function u(e,t){for(var r=0;r<e.length;r++){var n=y.resolveForwardRef(e[r]);m.isArray(n)?u(n,t):t.push(n)}}var l=System.global,p=l.define;l.define=void 0;var d=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},f=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},h=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},g=e("angular2/src/core/facade/collection"),m=e("angular2/src/core/facade/lang"),y=e("angular2/src/core/di"),v=e("angular2/src/core/pipes/pipe_binding"),_=e("angular2/src/core/pipes/pipes"),b=e("angular2/src/core/linker/view"),w=e("angular2/src/core/linker/element_binder"),C=e("angular2/src/core/linker/element_injector"),E=e("angular2/src/core/linker/directive_resolver"),R=e("angular2/src/core/linker/view_resolver"),S=e("angular2/src/core/linker/pipe_resolver"),x=e("angular2/src/core/pipes"),P=e("angular2/src/core/linker/template_commands"),D=e("angular2/render"),I=e("angular2/src/core/application_tokens"),O=function(){function e(e,t,r,n,i,o){this._renderer=e,this._directiveResolver=r,this._viewResolver=n,this._pipeResolver=i,this._cache=new Map,this._defaultPipes=t,this._appId=o}return e.prototype.clearCache=function(){this._cache.clear()},e.prototype.createHost=function(e){var t=e.getTemplate(),r=this._cache.get(t.id);if(m.isBlank(r)){var n=t.getData(this._appId),i={};r=new b.AppProtoView(n.commands,b.ViewType.HOST,!0,n.changeDetectorFactory,null,new _.ProtoPipes(i)),this._cache.set(t.id,r)}return r},e.prototype._createComponent=function(e){var t=this,r=this._cache.get(e.templateId);if(m.isBlank(r)){var n=e.directives[0],i=this._viewResolver.resolve(n),o=e.template.getData(this._appId);this._renderer.registerComponentTemplate(e.templateId,o.commands,o.styles,e.nativeShadow);var a=this._flattenPipes(i).map(function(e){return t._bindPipe(e)});r=new b.AppProtoView(o.commands,b.ViewType.COMPONENT,!0,o.changeDetectorFactory,null,_.ProtoPipes.fromBindings(a)),this._cache.set(e.template.id,r),this._initializeProtoView(r,null)}return r},e.prototype._createEmbeddedTemplate=function(e,t){var r=new b.AppProtoView(e.children,b.ViewType.EMBEDDED,e.isMerged,e.changeDetectorFactory,c(e.variableNameAndValues,!0),new _.ProtoPipes(t.pipes.config));return e.isMerged&&this.initializeProtoViewIfNeeded(r),r},e.prototype.initializeProtoViewIfNeeded=function(e){if(!e.isInitialized()){var t=this._renderer.createProtoView(e.templateCmds);this._initializeProtoView(e,t)}},e.prototype._initializeProtoView=function(e,t){var r=new k(e,this._directiveResolver,this);P.visitAllCommands(r,e.templateCmds);var n=new b.AppProtoViewMergeInfo(r.mergeEmbeddedViewCount,r.mergeElementCount,r.mergeViewCount);e.init(t,r.elementBinders,r.boundTextCount,n,r.variableLocations)},e.prototype._bindPipe=function(e){var t=this._pipeResolver.resolve(e);return v.PipeBinding.createFromType(e,t)},e.prototype._flattenPipes=function(e){if(m.isBlank(e.pipes))return this._defaultPipes;var t=g.ListWrapper.clone(this._defaultPipes);return u(e.pipes,t),t},e=d([y.Injectable(),h(1,y.Inject(x.DEFAULT_PIPES_TOKEN)),h(5,y.Inject(I.APP_ID)),f("design:paramtypes",[D.Renderer,Array,E.DirectiveResolver,R.ViewResolver,S.PipeResolver,String])],e)}();t.ProtoViewFactory=O;var k=function(){function e(e,t,r){this._protoView=e,this._directiveResolver=t,this._protoViewFactory=r,this.variableLocations=new Map,this.boundTextCount=0,this.boundElementIndex=0,this.elementBinderStack=[],this.distanceToParentElementBinder=0,this.distanceToParentProtoElementInjector=0,this.elementBinders=[],this.mergeEmbeddedViewCount=0,this.mergeElementCount=0,this.mergeViewCount=1}return e.prototype.visitText=function(e,t){return e.isBound&&this.boundTextCount++,null},e.prototype.visitNgContent=function(e,t){return null},e.prototype.visitBeginElement=function(e,t){return e.isBound?this._visitBeginBoundElement(e,null):this._visitBeginElement(e,null,null),null},e.prototype.visitEndElement=function(e){return this._visitEndElement()},e.prototype.visitBeginComponent=function(e,t){var r=n(this._protoViewFactory,e);return this._visitBeginBoundElement(e,r)},e.prototype.visitEndComponent=function(e){return this._visitEndElement()},e.prototype.visitEmbeddedTemplate=function(e,t){var r=i(this._protoViewFactory,e,this._protoView);return e.isMerged&&this.mergeEmbeddedViewCount++,this._visitBeginBoundElement(e,r),this._visitEndElement()},e.prototype._visitBeginBoundElement=function(e,t){m.isPresent(t)&&t.isMergable&&(this.mergeElementCount+=t.mergeInfo.elementCount,this.mergeViewCount+=t.mergeInfo.viewCount,this.mergeEmbeddedViewCount+=t.mergeInfo.embeddedViewCount);var r=o(this._directiveResolver,t,this.elementBinderStack,this.boundElementIndex,this.distanceToParentElementBinder,this.distanceToParentProtoElementInjector,e);this.elementBinders.push(r);for(var n=r.protoElementInjector,i=0;i<e.variableNameAndValues.length;i+=2)this.variableLocations.set(e.variableNameAndValues[i],this.boundElementIndex);return this.boundElementIndex++,this.mergeElementCount++,this._visitBeginElement(e,r,n)},e.prototype._visitBeginElement=function(e,t,r){return this.distanceToParentElementBinder=m.isPresent(t)?1:this.distanceToParentElementBinder+1,this.distanceToParentProtoElementInjector=m.isPresent(r)?1:this.distanceToParentProtoElementInjector+1,this.elementBinderStack.push(t),null},e.prototype._visitEndElement=function(){var e=this.elementBinderStack.pop(),t=m.isPresent(e)?e.protoElementInjector:null;return this.distanceToParentElementBinder=m.isPresent(e)?e.distanceToParent:this.distanceToParentElementBinder-1,this.distanceToParentProtoElementInjector=m.isPresent(t)?t.distanceToParent:this.distanceToParentProtoElementInjector-1,null},e}();return t.createDirectiveVariableBindings=s,l.define=p,r.exports}),System.register("angular2/src/core/linker/compiler",["angular2/src/core/linker/proto_view_factory","angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/async","angular2/src/core/reflection/reflection","angular2/src/core/linker/template_commands"],!0,function(e,t,r){function n(e,t){return e._createProtoView(t)}var i=System.global,o=i.define;i.define=void 0;var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},s=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},c=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},u=e("angular2/src/core/linker/proto_view_factory"),l=e("angular2/src/core/di"),p=e("angular2/src/core/facade/lang"),d=e("angular2/src/core/facade/exceptions"),f=e("angular2/src/core/facade/async"),h=e("angular2/src/core/reflection/reflection"),g=e("angular2/src/core/linker/template_commands"),m=function(){function e(){}return e}();t.Compiler=m;var y=function(e){function t(t){e.call(this),this._protoViewFactory=t}return a(t,e),t.prototype.compileInHost=function(e){for(var t=h.reflector.annotations(e),r=null,n=0;n<t.length;n++){var i=t[n];if(i instanceof g.CompiledHostTemplate){r=i;break}}if(p.isBlank(r))throw new d.BaseException("No precompiled template for component "+p.stringify(e)+" found");return f.PromiseWrapper.resolve(this._createProtoView(r))},t.prototype._createProtoView=function(e){return this._protoViewFactory.createHost(e).ref},t.prototype.clearCache=function(){this._protoViewFactory.clearCache()},t=s([l.Injectable(),c("design:paramtypes",[u.ProtoViewFactory])],t)}(m);return t.Compiler_=y,t.internalCreateProtoView=n,i.define=o,r.exports}),System.register("angular2/src/core/compiler/runtime_compiler",["angular2/src/core/linker/compiler","angular2/src/core/linker/proto_view_factory","angular2/src/core/compiler/template_compiler","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/linker/compiler"),u=e("angular2/src/core/linker/proto_view_factory"),l=e("angular2/src/core/compiler/template_compiler"),p=e("angular2/src/core/di"),d=function(e){function t(){e.apply(this,arguments)}return o(t,e),t}(c.Compiler);t.RuntimeCompiler=d;var f=function(e){function t(t,r){e.call(this,t),this._templateCompiler=r}return o(t,e),t.prototype.compileInHost=function(e){var t=this;return this._templateCompiler.compileHostComponentRuntime(e).then(function(e){return c.internalCreateProtoView(t,e)})},t.prototype.clearCache=function(){e.prototype.clearCache.call(this),this._templateCompiler.clearCache()},t=a([p.Injectable(),s("design:paramtypes",[u.ProtoViewFactory,l.TemplateCompiler])],t)}(c.Compiler_);return t.RuntimeCompiler_=f,n.define=i,r.exports}),System.register("angular2/src/core/compiler/compiler",["angular2/src/core/compiler/runtime_compiler","angular2/src/core/compiler/template_compiler","angular2/src/core/compiler/directive_metadata","angular2/src/core/compiler/source_module","angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/compiler/template_parser","angular2/src/core/compiler/html_parser","angular2/src/core/compiler/template_normalizer","angular2/src/core/compiler/runtime_metadata","angular2/src/core/compiler/change_detector_compiler","angular2/src/core/compiler/style_compiler","angular2/src/core/compiler/command_compiler","angular2/src/core/compiler/template_compiler","angular2/src/core/change_detection/change_detection","angular2/src/core/linker/compiler","angular2/src/core/compiler/runtime_compiler","angular2/src/core/compiler/schema/element_schema_registry","angular2/src/core/compiler/schema/dom_element_schema_registry","angular2/src/core/compiler/url_resolver","angular2/src/core/compiler/app_root_url","angular2/src/core/compiler/anchor_based_app_root_url","angular2/src/core/change_detection/change_detection"],!0,function(e,t,r){function n(){return[D.Lexer,D.Parser,f.HtmlParser,d.TemplateParser,h.TemplateNormalizer,g.RuntimeMetadataResolver,y.StyleCompiler,v.CommandCompiler,m.ChangeDetectionCompiler,p.bind(b.ChangeDetectorGenConfig).toValue(new b.ChangeDetectorGenConfig(l.assertionsEnabled(),l.assertionsEnabled(),!1,!0)),_.TemplateCompiler,p.bind(C.RuntimeCompiler).toClass(a.RuntimeCompiler_),p.bind(w.Compiler).toAlias(C.RuntimeCompiler),R.DomElementSchemaRegistry,p.bind(E.ElementSchemaRegistry).toAlias(R.DomElementSchemaRegistry),P.AnchorBasedAppRootUrl,p.bind(x.AppRootUrl).toAlias(P.AnchorBasedAppRootUrl),S.UrlResolver]}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/compiler/runtime_compiler"),s=e("angular2/src/core/compiler/template_compiler");t.TemplateCompiler=s.TemplateCompiler;var c=e("angular2/src/core/compiler/directive_metadata");t.CompileDirectiveMetadata=c.CompileDirectiveMetadata,t.CompileTypeMetadata=c.CompileTypeMetadata,t.CompileTemplateMetadata=c.CompileTemplateMetadata;var u=e("angular2/src/core/compiler/source_module");t.SourceModule=u.SourceModule,t.SourceWithImports=u.SourceWithImports;var l=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/di"),d=e("angular2/src/core/compiler/template_parser"),f=e("angular2/src/core/compiler/html_parser"),h=e("angular2/src/core/compiler/template_normalizer"),g=e("angular2/src/core/compiler/runtime_metadata"),m=e("angular2/src/core/compiler/change_detector_compiler"),y=e("angular2/src/core/compiler/style_compiler"),v=e("angular2/src/core/compiler/command_compiler"),_=e("angular2/src/core/compiler/template_compiler"),b=e("angular2/src/core/change_detection/change_detection"),w=e("angular2/src/core/linker/compiler"),C=e("angular2/src/core/compiler/runtime_compiler"),E=e("angular2/src/core/compiler/schema/element_schema_registry"),R=e("angular2/src/core/compiler/schema/dom_element_schema_registry"),S=e("angular2/src/core/compiler/url_resolver"),x=e("angular2/src/core/compiler/app_root_url"),P=e("angular2/src/core/compiler/anchor_based_app_root_url"),D=e("angular2/src/core/change_detection/change_detection");return t.compilerBindings=n,i.define=o,r.exports}),System.register("angular2/src/core/application",["angular2/src/core/facade/lang","angular2/src/core/compiler/compiler","angular2/src/core/application_common","angular2/src/core/application_tokens","angular2/src/core/application_common","angular2/src/core/application_ref"],!0,function(e,t,r){function n(e,t){void 0===t&&(t=null);var r=[s.compilerBindings()];return a.isPresent(t)&&r.push(t),c.commonBootstrap(e,r)}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/compiler/compiler"),c=e("angular2/src/core/application_common"),u=e("angular2/src/core/application_tokens");t.APP_COMPONENT=u.APP_COMPONENT,t.APP_ID=u.APP_ID;var l=e("angular2/src/core/application_common");t.platform=l.platform;var p=e("angular2/src/core/application_ref");return t.PlatformRef=p.PlatformRef,t.ApplicationRef=p.ApplicationRef,t.applicationCommonBindings=p.applicationCommonBindings,t.createNgZone=p.createNgZone,t.platformCommon=p.platformCommon,t.platformBindings=p.platformBindings,t.bootstrap=n,i.define=o,r.exports}),System.register("angular2/core",["angular2/src/core/metadata","angular2/src/core/util","angular2/src/core/di","angular2/src/core/pipes","angular2/src/core/facade","angular2/src/core/application","angular2/src/core/bootstrap","angular2/src/core/services","angular2/src/core/linker","angular2/src/core/lifecycle","angular2/src/core/zone","angular2/src/core/render","angular2/src/core/directives","angular2/src/core/forms","angular2/src/core/debug","angular2/src/core/change_detection"],!0,function(e,t,r){function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var i=System.global,o=i.define;return i.define=void 0,n(e("angular2/src/core/metadata")),n(e("angular2/src/core/util")),n(e("angular2/src/core/di")),n(e("angular2/src/core/pipes")),n(e("angular2/src/core/facade")),n(e("angular2/src/core/application")),n(e("angular2/src/core/bootstrap")),n(e("angular2/src/core/services")),n(e("angular2/src/core/linker")),n(e("angular2/src/core/lifecycle")),n(e("angular2/src/core/zone")),n(e("angular2/src/core/render")),n(e("angular2/src/core/directives")),n(e("angular2/src/core/forms")),n(e("angular2/src/core/debug")),n(e("angular2/src/core/change_detection")),i.define=o,r.exports}),System.register("angular2/angular2",["angular2/core","angular2/profile","angular2/lifecycle_hooks","angular2/bootstrap"],!0,function(e,t,r){function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var i=System.global,o=i.define;return i.define=void 0,n(e("angular2/core")),n(e("angular2/profile")),n(e("angular2/lifecycle_hooks")),n(e("angular2/bootstrap")),i.define=o,r.exports});
|
app/components/FoodCell.js
|
EleTeam/Shop-React-Native
|
/**
* ShopReactNative
*
* @author Tony Wong
* @date 2016-08-13
* @email 908601756@qq.com
* @copyright Copyright © 2016 EleTeam
* @license The MIT License (MIT)
*/
import React from 'react';
import {
StyleSheet,
TouchableOpacity,
View,
Text,
Image,
} from 'react-native';
import Common from '../common/constants';
export default class FoodCell extends React.Component {
constructor(props) {
super(props);
}
render() {
let lightStyle = [styles.healthLight];
if (food.health_light == 2) {
lightStyle.push({backgroundColor: 'orange'})
} else if (food.health_light == 3) {
lightStyle.push({backgroundColor: 'red'})
}
return <View style={{width: 300, height: 20, marginTop: 10, backgroundColor: 'red'}}/>
// return (
// <TouchableOpacity
// style={styles.foodsCell}
// >
// <View style={{flexDirection: 'row'}}>
// <Image style={styles.foodIcon} source={{uri: food.thumb_image_url}}/>
// <View style={styles.titleContainer}>
// <Text style={styles.foodName} numberOfLines={1}>{food.name}</Text>
// <Text style={styles.calory}>
// {food.calory}
// <Text style={styles.unit}> 千卡/{food.weight}克</Text>
// </Text>
// </View>
// </View>
// <View style={lightStyle}/>
// </TouchableOpacity>
// )
}
}
const styles = StyleSheet.create({
foodsCell: {
flexDirection: 'row',
paddingLeft: 15,
paddingRight: 15,
paddingTop: 10,
paddingBottom: 10,
borderBottomColor: '#ccc',
borderBottomWidth: 0.5,
alignItems: 'center',
justifyContent: 'space-between',
},
foodIcon: {
width: 40,
height: 40,
borderRadius: 20,
},
titleContainer: {
height: 40,
marginLeft: 15,
justifyContent: 'space-between',
},
foodName: {
width: Common.window.width - 15 - 15 - 40 - 15 - 10,
},
calory: {
fontSize: 13,
color: 'red',
},
unit: {
fontSize: 13,
color: 'black'
},
healthLight: {
width: 10,
height: 10,
borderRadius: 5,
backgroundColor: 'green',
marginRight: 0,
},
})
|
app/containers/User/UserEditForm.js
|
danielmoraes/invoices-web-client
|
import React from 'react'
import { Form } from 'components'
import { User } from 'api/entity-schema'
const formLayout = [
[ 'name' ],
[ 'email' ]
]
const formOptions = {
focus: 'name',
fieldOptions: {
'name': { size: 8 },
'email': { size: 8, inputType: 'email' }
}
}
// inject schema to field options
Object.keys(formOptions.fieldOptions).forEach((field) => {
formOptions.fieldOptions[field].schema = User[field]
})
const UserEditForm = (props) => (
<Form layout={formLayout} options={formOptions} {...props} />
)
export default UserEditForm
|
ajax/libs/flocks.js/0.16.17/flocks.min.js
|
SirenHound/cdnjs
|
if("undefined"===typeof React)var React=require("react");
(function(){function f(a){return"[object Array]"===Object.prototype.toString.call(a)}function k(a){return"undefined"===typeof a}function u(a){return"object"!==typeof a||"[object Array]"===Object.prototype.toString.call(a)?!1:!0}function c(a,b){if("string"===typeof a)if(~"warn debug error log info exception assert".split(" ").indexOf(a,0))console[a]("Flocks2 ["+a+"] "+b.toString());else console.log("Flocks2 [Unknown level] "+b.toString());else k(d.flocks2Config)?console.log("Flocks2 pre-config ["+
a.toString()+"] "+b.toString()):d.flocks2Config.log_level>=a&&console.log("Flocks2 ["+a.toString()+"] "+b.toString())}function l(){c(3," - Flocks2 attempting update");if(!v)return c(1," x Flocks2 skipped update: root is not initialized"),null;if(m)return c(1," x Flocks2 skipped update: lock count updateBlocks is non-zero"),null;if(!w(d))return c(0," ! Flocks2 rolling back update: handler rejected propset"),d=x,null;x=d;c(3," - Flocks2 update passed");React.render(React.createFactory(p)({flocks2context:d}),
document.body);c(3," - Flocks2 update complete; finalizing");y();return!0}function z(a,b){if("string"!==typeof a)throw b||"Argument must be a string";}function A(a,b){if(!f(a))throw b||"Argument must be an array";}function B(a,b){if(!u(a))throw b||"Argument must be a non-array object";}function C(a,b,c){var d;if(!f(a))throw"Path must be an array!";if(0===a.length)return b;if(1===a.length)return d=b[a[0]],b[a[0]]=c,d;if(-1!==["string","number"].indexOf(typeof a[0]))return d=a.splice(1,Number.MAX_VALUE),
C(d,b[a[0]],c)}function D(a,b){A(a,"Flocks2 setByPathh/2 must take an array for its key");c(1,' - Flocks2 setByPath "'+a.join("|")+'"');C(a,d,b);l()}function q(a,b){c(3," - Flocks2 multi-set");if("string"===typeof a)z(a,"Flocks2 set/2 must take a string for its key"),d[a]=b,c(1,' - Flocks2 setByKey "'+a+'"'),l();else if(f(a))D(a,b);else throw"Flocks2 set/1,2 key must be a string or an array";}function r(a,b){var c;if(!f(a))throw"path must be an array!";if(0===a.length)return b;if(1===a.length)return b[a[0]];
if(-1!==["string","number"].indexOf(typeof a[0]))return c=a.splice(1,Number.MAX_VALUE),r(c,b[a[0]])}function E(a){console.log("ERROR: stub called!");B(a,"Flocks2 update/1 must take a plain object")}function H(){++m}function F(){if(0>=m)throw"unlock()ed with no lock!";--m;l()}function t(a){var b=a.constructor(),c;if(null===a||"object"!==typeof a)return a;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function G(a){if(k(a))return[n];if(f(a)){if(~a.indexOf(n,0))return a;a=t(a);a.push(n);return a}throw"Original mixin list must be an array or undefined!";
}var n,h,v=!1,m=0,p,w=function(a){return!0},y=function(){return!0},x={},d={};h={flocks2context:React.PropTypes.object};n={contextTypes:h,childContextTypes:h,componentWillMount:function(){c(1," - Flocks2 component will mount: "+this.constructor.displayName);c(3,k(this.props.flocks2context)?" - No F2 Context Prop":" - F2 Context Prop found");c(3,k(this.context.flocks2context)?" - No F2 Context":" - F2 Context found");this.props.flocks2context&&(this.context.flocks2context=this.props.flocks2context);
this.fupdate=function(a){return E(a)};this.fgetpath=function(a,b){return r(a,b)};this.fset=function(a,b){return q(a,b)};this.fsetpath=function(a,b){return q(a,b)};this.flock=function(){++m};this.funlock=function(){return F()};this.fctx=this.context.flocks2context},getChildContext:function(){return this.context}};h={version:"0.16.16",plumbing:n,createClass:function(a){a.mixins=G(a.mixins);return React.createClass(a)},mount:function(a,b){var g=a||{},f=b||{},e=function(){console.log("ERROR: stub called!");
l()},e={get:e,override:e,clear:e,get_path:r,set:q,set_path:D,update:E,lock:H,unlock:F};g.log_level=g.log_level||-1;p=g.control;f.flocks2Config=g;d=f;c(1,"Flocks2 root creation begins");if(!p)throw"Flocks2 fatal error: must provide a control in create/2 FlocksConfig";g.handler&&(w=g.handler,c(3," - Flocks2 handler assigned"));g.finalizer&&(y=g.finalizer,c(3," - Flocks2 finalizer assigned"));g.preventAutoContext?c(2," - Flocks2 skipping auto-context"):(c(2," - Flocks2 engaging auto-context"),this.fctx=
t(d));c(3,"Flocks2 creation finished; initializing");v=!0;l();c(3,"Flocks2 expose updater");this.fupd=e;this.fset=e.set;this.fgetpath=e.get_path;this.flock=e.lock;this.funlock=e.unlock;this.fupdate=e.update;c(3,"Flocks2 initialization finished");return e},clone:t,isArray:f,isUndefined:k,isNonArrayObject:u,enforceString:z,enforceArray:A,enforceNonArrayObject:B,atLeastFlocks:G};"undefined"!==typeof module?module.exports=h:window.flocks=h})();
|
src/Survey/Default/Location.js
|
NERC-CEH/irecord-app
|
import React from 'react';
import PropTypes from 'prop-types';
import { observer } from 'mobx-react';
import { IonPage } from '@ionic/react';
import Log from 'helpers/log';
import Header from 'Components/Location/Header';
import Main from 'Components/Location/Main';
import {
onManualGridrefChange,
onLocationNameChange,
onGPSClick,
} from 'Components/Location/utils';
@observer
class Container extends React.Component {
static propTypes = {
savedSamples: PropTypes.array.isRequired,
match: PropTypes.object,
history: PropTypes.object,
appModel: PropTypes.object.isRequired,
};
constructor(props) {
super(props);
this.state = {
sample: this.props.savedSamples.find(
({ cid }) => cid === this.props.match.params.id
),
};
this.onManualGridrefChange = onManualGridrefChange.bind(this);
this.onGPSClick = onGPSClick.bind(this);
}
onLocationNameChange = (...args) => {
const { appModel } = this.props;
onLocationNameChange.apply(this, args);
const { location } = this.state.sample.attrs;
if (!location.latitude) {
return;
}
appModel.setLocation(location);
};
updateLocationLock = (location, locationWasLocked) => {
const { appModel } = this.props;
const currentLock = appModel.getAttrLock('smp:location');
// location
if (location.source !== 'gps' && location.latitude) {
const clonedLocation = JSON.parse(JSON.stringify(location));
// remove location name as it is locked separately
delete clonedLocation.name;
// we can lock location and name on their own
// don't lock GPS though, because it varies more than a map or gridref
if (currentLock && (currentLock === true || locationWasLocked)) {
// update locked value if attr is locked
// check if previously the value was locked and we are updating
Log('Updating lock.');
appModel.setAttrLock('smp:location', clonedLocation);
}
} else if (currentLock === true) {
// reset if no location or location name selected but locked is clicked
appModel.unsetAttrLock('smp', 'location');
}
};
onPastLocationsClick = () =>
this.props.history.push(
`/survey/default/${this.state.sample.cid}/edit/location/past`
);
onLocationLockClick = () => {
Log('Location:Controller: executing onLocationLockClick.');
const { appModel } = this.props;
const { sample } = this.state;
const isLocked = appModel.getAttrLock('smp', 'location');
if (isLocked) {
appModel.unsetAttrLock('smp', 'location');
return;
}
const { name, ...location } = sample.attrs.location;
if (!location) {
return;
}
appModel.setAttrLock('smp', 'location', location);
};
onNameLockClick = () => {
Log('Location:Controller: executing onNameLockClick.');
const { appModel } = this.props;
const { sample } = this.state;
const isLocked = appModel.getAttrLock('smp', 'locationName');
if (isLocked) {
appModel.unsetAttrLock('smp', 'locationName');
return;
}
const locationName = sample.attrs.location.name;
if (!locationName) {
return;
}
appModel.setAttrLock('smp', 'locationName', locationName);
};
setLocation = async loc => {
const { appModel } = this.props;
const { sample } = this.state;
if (typeof loc !== 'object') {
// jQuery event object bug fix
// todo clean up if not needed anymore
Log('Location:Controller:setLocation: loc is not an object.', 'e');
return Promise.reject(new Error('Invalid location'));
}
// // check if we need custom location setting functionality
// if (locationSetFunc) {
// return locationSetFunc(sample, loc);
// }
const oldLocation = sample.attrs.location || {};
const location = { ...loc, ...{ name: oldLocation.name } };
// we don't need the GPS running and overwriting the selected location
if (sample.isGPSRunning()) {
sample.stopGPS();
}
if (location.latitude) {
await appModel.setLocation(location);
}
sample.attrs.location = location;
return sample.save().catch(error => {
Log(error, 'e');
// radio.trigger('app:dialog:error', error);
});
};
render() {
const { appModel } = this.props;
const { sample } = this.state;
const location = sample.attrs.location || {};
return (
<IonPage id="survey-default-edit-location">
<Header
location={location}
sample={sample}
appModel={appModel}
onNameLockClick={this.onNameLockClick}
onLocationLockClick={this.onLocationLockClick}
onManualGridrefChange={this.onManualGridrefChange}
onLocationNameChange={this.onLocationNameChange}
/>
<Main
onPastLocationsClick={this.onPastLocationsClick}
location={location}
sample={sample}
appModel={appModel}
onGPSClick={this.onGPSClick}
setLocation={this.setLocation}
/>
</IonPage>
);
}
}
export default Container;
|
js/components/NavBar/DropDownMenu/DropDownMenu.js
|
xuorig/form-check-app
|
/* @flow */
import React from 'react'
import Relay from 'react-relay';
import ReactDOM from 'react-dom';
import 'babel/polyfill';
import styles from './DropDownMenu.css';
class DropDownMenu extends React.Component {
constructor(props) {
super(props);
this.state = {
visible: false
};
}
onMenuClick(e) {
e.preventDefault();
console.log("click");
const currentState = this.state.visible;
this.setState({visible: !currentState});
}
componentDidMount() {
document.addEventListener("click", this.documentClickHandler.bind(this));
}
componentWillUnmount() {
document.removeEventListener("click", this.documentClickHandler.bind(this));
}
documentClickHandler(e) {
var localNode = ReactDOM.findDOMNode(this);
var source = e.target;
var found = false;
// if source=local then this event came from "somewhere" inside and should be ignored.
while(source.parentNode) {
found = (source === localNode);
if(found) return;
source = source.parentNode;
}
this.setState({visible: false});
}
render() {
let dropdownClass = styles['drop-down-menu__menu']
if (this.state.visible) {
dropdownClass = dropdownClass + ' ' + styles['drop-down-menu__menu--visible']
}
return (
<div className={styles['drop-down-menu']}>
<a href="#" className={styles['drop-down-menu__button']} onClick={this.onMenuClick.bind(this)}>
<span>{this.props.viewer.currentUser.username}</span>
</a>
<div className={dropdownClass}>
<ul className={styles['drop-down-menu__menu__list']}>
<li className={styles['drop-down-menu__menu__list__item']}>
<a href="#/profile" className={styles['drop-down-menu__menu__link']}>
My Profile
</a>
</li>
<li className={styles['drop-down-menu__menu__list__item']}>
<a href="#/settings" className={styles['drop-down-menu__menu__link']}>
Settings
</a>
</li>
<li className={styles['drop-down-menu__menu__list__item']}>
<a href="#/create-team" className={styles['drop-down-menu__menu__link']}>
Create a Team
</a>
</li>
<li className={styles['drop-down-menu__menu__list__item'] + ' ' + styles['drop-down-menu__menu__list__item--main']}>
<a href="#/new-form-check" className={styles['drop-down-menu__menu__link--main']}>
Upload FormCheck
</a>
</li>
</ul>
</div>
</div>
);
}
}
export default DropDownMenu;
|
app/frontend/components/RegisterForm/RegisterForm.js
|
mpakus/sinum
|
import React from 'react';
import PropTypes from 'prop-types';
import axios from 'axios';
class RegisterForm extends React.Component {
state = { submitBtnEnabled: true };
handleSubmit = (e) => {
e.preventDefault();
this.setState({ submitBtnEnabled: false });
console.log(this.props.registration_url);
axios.post(this.props.registration_url, {
'user[email]': e.target.elements.user_email,
'user[password]': e.target.elements.user_password
}).then((response) => {
console.log('res', response);
this.setState({ submitBtnEnabled: true });
}).catch((error) => {
console.log('error', error);
this.setState({ submitBtnEnabled: true });
});
};
render () {
return (
<section className="imageblock switchable feature-large height-100 bg--primary">
<div className="imageblock__content col-lg-6 col-md-4 pos-right">
<div className="background-image-holder">
<img alt="image" src="/theme/img/inner-7.jpg"/>
</div>
</div>
<div className="container pos-vertical-center">
<div className="row">
<div className="col-lg-5 col-md-7">
<h2>
Create a Sinum account
</h2>
<p className="lead">
Get started a free — cancel at any time.
</p>
<div className="row">
<form className="new_user" acceptCharset="UTF-8" onSubmit={this.handleSubmit}>
<div className="col-12 type--fine-print">
<input className="form-control" placeholder="Email Address" type="email" name="user_email" />
</div>
<div className="col-12 type--fine-print">
<br/>
<input autoComplete="off" className="form-control" placeholder="Password" type="password" name="user_password" />
</div>
<div className="col-12">
<button className="btn btn--primary type--uppercase" type="submit" disabled={!this.state.submitBtnEnabled}>Create Account</button>
</div>
<div className="col-12">
<span className="type--fine-print">By signing up, you agree to the <a href="#">Terms of Service</a></span>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
);
}
}
RegisterForm.propTypes = {
name: PropTypes.string
};
export default RegisterForm;
|
src/components/Root.js
|
kjirou/react-animation-solutions
|
import React from 'react';
import { Motion, spring } from 'react-motion';
class Gauge extends React.Component {
render() {
return (
<Motion defaultStyle={ { x: 0 } } style={ { x: spring(100, [1, 1]) } } >
{ value => <div>{ value.x }</div> }
</Motion>
);
}
}
export default class Root extends React.Component {
constructor() {
super();
this.state = {
isFooShowing: false,
};
}
render() {
return (
<div className="root">
<h2>Foo</h2>
<div>
<div><input type="button" value="BB" onClick={ e => this.setState({ isFooShowing: true }) } /></div>
{ this.state.isFooShowing ? <Gauge /> : null }
</div>
</div>
);
}
}
|
node_modules/react-native/Libraries/Modal/Modal.js
|
jasonlarue/react-native-flashcards
|
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Modal
* @flow
*/
'use strict';
const AppContainer = require('AppContainer');
const I18nManager = require('I18nManager');
const Platform = require('Platform');
const React = require('React');
const PropTypes = require('prop-types');
const StyleSheet = require('StyleSheet');
const View = require('View');
const deprecatedPropType = require('deprecatedPropType');
const requireNativeComponent = require('requireNativeComponent');
const RCTModalHostView = requireNativeComponent('RCTModalHostView', null);
/**
* The Modal component is a simple way to present content above an enclosing view.
*
* _Note: If you need more control over how to present modals over the rest of your app,
* then consider using a top-level Navigator._
*
* ```javascript
* import React, { Component } from 'react';
* import { Modal, Text, TouchableHighlight, View } from 'react-native';
*
* class ModalExample extends Component {
*
* state = {
* modalVisible: false,
* }
*
* setModalVisible(visible) {
* this.setState({modalVisible: visible});
* }
*
* render() {
* return (
* <View style={{marginTop: 22}}>
* <Modal
* animationType={"slide"}
* transparent={false}
* visible={this.state.modalVisible}
* onRequestClose={() => {alert("Modal has been closed.")}}
* >
* <View style={{marginTop: 22}}>
* <View>
* <Text>Hello World!</Text>
*
* <TouchableHighlight onPress={() => {
* this.setModalVisible(!this.state.modalVisible)
* }}>
* <Text>Hide Modal</Text>
* </TouchableHighlight>
*
* </View>
* </View>
* </Modal>
*
* <TouchableHighlight onPress={() => {
* this.setModalVisible(true)
* }}>
* <Text>Show Modal</Text>
* </TouchableHighlight>
*
* </View>
* );
* }
* }
* ```
*/
class Modal extends React.Component {
static propTypes = {
/**
* The `animationType` prop controls how the modal animates.
*
* - `slide` slides in from the bottom
* - `fade` fades into view
* - `none` appears without an animation
*
* Default is set to `none`.
*/
animationType: PropTypes.oneOf(['none', 'slide', 'fade']),
/**
* The `transparent` prop determines whether your modal will fill the entire view. Setting this to `true` will render the modal over a transparent background.
*/
transparent: PropTypes.bool,
/**
* The `hardwareAccelerated` prop controls whether to force hardware acceleration for the underlying window.
* @platform android
*/
hardwareAccelerated: PropTypes.bool,
/**
* The `visible` prop determines whether your modal is visible.
*/
visible: PropTypes.bool,
/**
* The `onRequestClose` callback is called when the user taps the hardware back button.
* @platform android
*/
onRequestClose: Platform.OS === 'android' ? PropTypes.func.isRequired : PropTypes.func,
/**
* The `onShow` prop allows passing a function that will be called once the modal has been shown.
*/
onShow: PropTypes.func,
animated: deprecatedPropType(
PropTypes.bool,
'Use the `animationType` prop instead.'
),
/**
* The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations.
* On iOS, the modal is still restricted by what's specified in your app's Info.plist's UISupportedInterfaceOrientations field.
* @platform ios
*/
supportedOrientations: PropTypes.arrayOf(PropTypes.oneOf(['portrait', 'portrait-upside-down', 'landscape', 'landscape-left', 'landscape-right'])),
/**
* The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed.
* The orientation provided is only 'portrait' or 'landscape'. This callback is also called on initial render, regardless of the current orientation.
* @platform ios
*/
onOrientationChange: PropTypes.func,
};
static defaultProps = {
visible: true,
hardwareAccelerated: false,
};
static contextTypes = {
rootTag: PropTypes.number,
};
render(): ?React.Element<any> {
if (this.props.visible === false) {
return null;
}
const containerStyles = {
backgroundColor: this.props.transparent ? 'transparent' : 'white',
};
let animationType = this.props.animationType;
if (!animationType) {
// manually setting default prop here to keep support for the deprecated 'animated' prop
animationType = 'none';
if (this.props.animated) {
animationType = 'slide';
}
}
const innerChildren = __DEV__ ?
( <AppContainer rootTag={this.context.rootTag}>
{this.props.children}
</AppContainer>) :
this.props.children;
return (
<RCTModalHostView
animationType={animationType}
transparent={this.props.transparent}
hardwareAccelerated={this.props.hardwareAccelerated}
onRequestClose={this.props.onRequestClose}
onShow={this.props.onShow}
style={styles.modal}
onStartShouldSetResponder={this._shouldSetResponder}
supportedOrientations={this.props.supportedOrientations}
onOrientationChange={this.props.onOrientationChange}
>
<View style={[styles.container, containerStyles]}>
{innerChildren}
</View>
</RCTModalHostView>
);
}
// We don't want any responder events bubbling out of the modal.
_shouldSetResponder(): boolean {
return true;
}
}
const side = I18nManager.isRTL ? 'right' : 'left';
const styles = StyleSheet.create({
modal: {
position: 'absolute',
},
container: {
position: 'absolute',
[side] : 0,
top: 0,
}
});
module.exports = Modal;
|
src/site/components/grid/GridItem.js
|
tscok/home
|
import React from 'react';
import purebem from 'purebem';
const block = purebem.of('grid');
const GridItem = React.createClass({
render() {
return (
<div className={ block('item') }>
{ this.props.children }
</div>
);
}
});
export default GridItem;
|
frontend/src/components/icons/Play.js
|
webrecorder/webrecorder
|
import React from 'react';
function Play() {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
<path d="M0 0h48v48H0z" fill="none" />
<path d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z" />
</svg>
);
}
export default Play;
|
src/components/sizerangebar/Sizerangebar.js
|
Convicted202/PixelShape
|
import './sizerangebar.styl';
import React, { Component } from 'react';
import classNames from 'classnames';
class Sizerangebar extends Component {
constructor (...args) {
super(...args);
this.state = {
isActive: false,
};
}
onChange (ev) {
this.props.setSize(ev.target.value);
}
onMouseDown () {
this.setState({ isActive: true });
}
onMouseUp (ev) {
this.setState({ isActive: false });
/* UNFORTUNATELY IE11 DOESN'T HANDLE ONCHANGE EVENT, SO NEED TO SUBSCRIBE TO ONMOUSEUP AS WELL */
this.onChange(ev);
}
render () {
const classes = classNames(
'sizerangebar__value',
{
'active': this.state.isActive
});
return (
<div className="sizerangebar">
<div className="sizerangebar__label">Size</div>
<input
className="sizerangebar__input"
type="range"
step="1"
min="1"
max="10"
value={this.props.currentSize}
onChange={this.onChange.bind(this)}
onMouseDown={this.onMouseDown.bind(this)}
onMouseUp={this.onMouseUp.bind(this)} />
<div
className={classes}>
{this.props.currentSize}
</div>
</div>
);
}
}
export default Sizerangebar;
|
ajax/libs/webshim/1.14.6-RC1/dev/shims/moxie/js/moxie.js
|
DaAwesomeP/cdnjs
|
/**
* mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
* v1.2.1
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*
* Date: 2014-05-14
*/
/**
* Compiled inline version. (Library mode)
*/
/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
/*globals $code */
(function(exports, undefined) {
"use strict";
var modules = {};
function require(ids, callback) {
var module, defs = [];
for (var i = 0; i < ids.length; ++i) {
module = modules[ids[i]] || resolve(ids[i]);
if (!module) {
throw 'module definition dependecy not found: ' + ids[i];
}
defs.push(module);
}
callback.apply(null, defs);
}
function define(id, dependencies, definition) {
if (typeof id !== 'string') {
throw 'invalid module definition, module id must be defined and be a string';
}
if (dependencies === undefined) {
throw 'invalid module definition, dependencies must be specified';
}
if (definition === undefined) {
throw 'invalid module definition, definition function must be specified';
}
require(dependencies, function() {
modules[id] = definition.apply(null, arguments);
});
}
function defined(id) {
return !!modules[id];
}
function resolve(id) {
var target = exports;
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length; ++fi) {
if (!target[fragments[fi]]) {
return;
}
target = target[fragments[fi]];
}
return target;
}
function expose(ids) {
for (var i = 0; i < ids.length; i++) {
var target = exports;
var id = ids[i];
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length - 1; ++fi) {
if (target[fragments[fi]] === undefined) {
target[fragments[fi]] = {};
}
target = target[fragments[fi]];
}
target[fragments[fragments.length - 1]] = modules[id];
}
}
// Included from: src/javascript/core/utils/Basic.js
/**
* Basic.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Basic', [], function() {
/**
Gets the true type of the built-in object (better version of typeof).
@author Angus Croll (http://javascriptweblog.wordpress.com/)
@method typeOf
@for Utils
@static
@param {Object} o Object to check.
@return {String} Object [[Class]]
*/
var typeOf = function(o) {
var undef;
if (o === undef) {
return 'undefined';
} else if (o === null) {
return 'null';
} else if (o.nodeType) {
return 'node';
}
// the snippet below is awesome, however it fails to detect null, undefined and arguments types in IE lte 8
return ({}).toString.call(o).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
};
/**
Extends the specified object with another object.
@method extend
@static
@param {Object} target Object to extend.
@param {Object} [obj]* Multiple objects to extend with.
@return {Object} Same as target, the extended object.
*/
var extend = function(target) {
var undef;
each(arguments, function(arg, i) {
if (i > 0) {
each(arg, function(value, key) {
if (value !== undef) {
if (typeOf(target[key]) === typeOf(value) && !!~inArray(typeOf(value), ['array', 'object'])) {
extend(target[key], value);
} else {
target[key] = value;
}
}
});
}
});
return target;
};
/**
Executes the callback function for each item in array/object. If you return false in the
callback it will break the loop.
@method each
@static
@param {Object} obj Object to iterate.
@param {function} callback Callback function to execute for each item.
*/
var each = function(obj, callback) {
var length, key, i, undef;
if (obj) {
try {
length = obj.length;
} catch(ex) {
length = undef;
}
if (length === undef) {
// Loop object items
for (key in obj) {
if (obj.hasOwnProperty(key)) {
if (callback(obj[key], key) === false) {
return;
}
}
}
} else {
// Loop array items
for (i = 0; i < length; i++) {
if (callback(obj[i], i) === false) {
return;
}
}
}
}
};
/**
Checks if object is empty.
@method isEmptyObj
@static
@param {Object} o Object to check.
@return {Boolean}
*/
var isEmptyObj = function(obj) {
var prop;
if (!obj || typeOf(obj) !== 'object') {
return true;
}
for (prop in obj) {
return false;
}
return true;
};
/**
Recieve an array of functions (usually async) to call in sequence, each function
receives a callback as first argument that it should call, when it completes. Finally,
after everything is complete, main callback is called. Passing truthy value to the
callback as a first argument will interrupt the sequence and invoke main callback
immediately.
@method inSeries
@static
@param {Array} queue Array of functions to call in sequence
@param {Function} cb Main callback that is called in the end, or in case of error
*/
var inSeries = function(queue, cb) {
var i = 0, length = queue.length;
if (typeOf(cb) !== 'function') {
cb = function() {};
}
if (!queue || !queue.length) {
cb();
}
function callNext(i) {
if (typeOf(queue[i]) === 'function') {
queue[i](function(error) {
/*jshint expr:true */
++i < length && !error ? callNext(i) : cb(error);
});
}
}
callNext(i);
};
/**
Recieve an array of functions (usually async) to call in parallel, each function
receives a callback as first argument that it should call, when it completes. After
everything is complete, main callback is called. Passing truthy value to the
callback as a first argument will interrupt the process and invoke main callback
immediately.
@method inParallel
@static
@param {Array} queue Array of functions to call in sequence
@param {Function} cb Main callback that is called in the end, or in case of erro
*/
var inParallel = function(queue, cb) {
var count = 0, num = queue.length, cbArgs = new Array(num);
each(queue, function(fn, i) {
fn(function(error) {
if (error) {
return cb(error);
}
var args = [].slice.call(arguments);
args.shift(); // strip error - undefined or not
cbArgs[i] = args;
count++;
if (count === num) {
cbArgs.unshift(null);
cb.apply(this, cbArgs);
}
});
});
};
/**
Find an element in array and return it's index if present, otherwise return -1.
@method inArray
@static
@param {Mixed} needle Element to find
@param {Array} array
@return {Int} Index of the element, or -1 if not found
*/
var inArray = function(needle, array) {
if (array) {
if (Array.prototype.indexOf) {
return Array.prototype.indexOf.call(array, needle);
}
for (var i = 0, length = array.length; i < length; i++) {
if (array[i] === needle) {
return i;
}
}
}
return -1;
};
/**
Returns elements of first array if they are not present in second. And false - otherwise.
@private
@method arrayDiff
@param {Array} needles
@param {Array} array
@return {Array|Boolean}
*/
var arrayDiff = function(needles, array) {
var diff = [];
if (typeOf(needles) !== 'array') {
needles = [needles];
}
if (typeOf(array) !== 'array') {
array = [array];
}
for (var i in needles) {
if (inArray(needles[i], array) === -1) {
diff.push(needles[i]);
}
}
return diff.length ? diff : false;
};
/**
Find intersection of two arrays.
@private
@method arrayIntersect
@param {Array} array1
@param {Array} array2
@return {Array} Intersection of two arrays or null if there is none
*/
var arrayIntersect = function(array1, array2) {
var result = [];
each(array1, function(item) {
if (inArray(item, array2) !== -1) {
result.push(item);
}
});
return result.length ? result : null;
};
/**
Forces anything into an array.
@method toArray
@static
@param {Object} obj Object with length field.
@return {Array} Array object containing all items.
*/
var toArray = function(obj) {
var i, arr = [];
for (i = 0; i < obj.length; i++) {
arr[i] = obj[i];
}
return arr;
};
/**
Generates an unique ID. This is 99.99% unique since it takes the current time and 5 random numbers.
The only way a user would be able to get the same ID is if the two persons at the same exact milisecond manages
to get 5 the same random numbers between 0-65535 it also uses a counter so each call will be guaranteed to be page unique.
It's more probable for the earth to be hit with an ansteriod. Y
@method guid
@static
@param {String} prefix to prepend (by default 'o' will be prepended).
@method guid
@return {String} Virtually unique id.
*/
var guid = (function() {
var counter = 0;
return function(prefix) {
var guid = new Date().getTime().toString(32), i;
for (i = 0; i < 5; i++) {
guid += Math.floor(Math.random() * 65535).toString(32);
}
return (prefix || 'o_') + guid + (counter++).toString(32);
};
}());
/**
Trims white spaces around the string
@method trim
@static
@param {String} str
@return {String}
*/
var trim = function(str) {
if (!str) {
return str;
}
return String.prototype.trim ? String.prototype.trim.call(str) : str.toString().replace(/^\s*/, '').replace(/\s*$/, '');
};
/**
Parses the specified size string into a byte value. For example 10kb becomes 10240.
@method parseSizeStr
@static
@param {String/Number} size String to parse or number to just pass through.
@return {Number} Size in bytes.
*/
var parseSizeStr = function(size) {
if (typeof(size) !== 'string') {
return size;
}
var muls = {
t: 1099511627776,
g: 1073741824,
m: 1048576,
k: 1024
},
mul;
size = /^([0-9]+)([mgk]?)$/.exec(size.toLowerCase().replace(/[^0-9mkg]/g, ''));
mul = size[2];
size = +size[1];
if (muls.hasOwnProperty(mul)) {
size *= muls[mul];
}
return size;
};
return {
guid: guid,
typeOf: typeOf,
extend: extend,
each: each,
isEmptyObj: isEmptyObj,
inSeries: inSeries,
inParallel: inParallel,
inArray: inArray,
arrayDiff: arrayDiff,
arrayIntersect: arrayIntersect,
toArray: toArray,
trim: trim,
parseSizeStr: parseSizeStr
};
});
// Included from: src/javascript/core/I18n.js
/**
* I18n.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/I18n", [
"moxie/core/utils/Basic"
], function(Basic) {
var i18n = {};
return {
/**
* Extends the language pack object with new items.
*
* @param {Object} pack Language pack items to add.
* @return {Object} Extended language pack object.
*/
addI18n: function(pack) {
return Basic.extend(i18n, pack);
},
/**
* Translates the specified string by checking for the english string in the language pack lookup.
*
* @param {String} str String to look for.
* @return {String} Translated string or the input string if it wasn't found.
*/
translate: function(str) {
return i18n[str] || str;
},
/**
* Shortcut for translate function
*
* @param {String} str String to look for.
* @return {String} Translated string or the input string if it wasn't found.
*/
_: function(str) {
return this.translate(str);
},
/**
* Pseudo sprintf implementation - simple way to replace tokens with specified values.
*
* @param {String} str String with tokens
* @return {String} String with replaced tokens
*/
sprintf: function(str) {
var args = [].slice.call(arguments, 1);
return str.replace(/%[a-z]/g, function() {
var value = args.shift();
return Basic.typeOf(value) !== 'undefined' ? value : '';
});
}
};
});
// Included from: src/javascript/core/utils/Mime.js
/**
* Mime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/utils/Mime", [
"moxie/core/utils/Basic",
"moxie/core/I18n"
], function(Basic, I18n) {
var mimeData = "" +
"application/msword,doc dot," +
"application/pdf,pdf," +
"application/pgp-signature,pgp," +
"application/postscript,ps ai eps," +
"application/rtf,rtf," +
"application/vnd.ms-excel,xls xlb," +
"application/vnd.ms-powerpoint,ppt pps pot," +
"application/zip,zip," +
"application/x-shockwave-flash,swf swfl," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx," +
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx," +
"application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx," +
"application/vnd.openxmlformats-officedocument.presentationml.template,potx," +
"application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx," +
"application/x-javascript,js," +
"application/json,json," +
"audio/mpeg,mp3 mpga mpega mp2," +
"audio/x-wav,wav," +
"audio/x-m4a,m4a," +
"audio/ogg,oga ogg," +
"audio/aiff,aiff aif," +
"audio/flac,flac," +
"audio/aac,aac," +
"audio/ac3,ac3," +
"audio/x-ms-wma,wma," +
"image/bmp,bmp," +
"image/gif,gif," +
"image/jpeg,jpg jpeg jpe," +
"image/photoshop,psd," +
"image/png,png," +
"image/svg+xml,svg svgz," +
"image/tiff,tiff tif," +
"text/plain,asc txt text diff log," +
"text/html,htm html xhtml," +
"text/css,css," +
"text/csv,csv," +
"text/rtf,rtf," +
"video/mpeg,mpeg mpg mpe m2v," +
"video/quicktime,qt mov," +
"video/mp4,mp4," +
"video/x-m4v,m4v," +
"video/x-flv,flv," +
"video/x-ms-wmv,wmv," +
"video/avi,avi," +
"video/webm,webm," +
"video/3gpp,3gpp 3gp," +
"video/3gpp2,3g2," +
"video/vnd.rn-realvideo,rv," +
"video/ogg,ogv," +
"video/x-matroska,mkv," +
"application/vnd.oasis.opendocument.formula-template,otf," +
"application/octet-stream,exe";
var Mime = {
mimes: {},
extensions: {},
// Parses the default mime types string into a mimes and extensions lookup maps
addMimeType: function (mimeData) {
var items = mimeData.split(/,/), i, ii, ext;
for (i = 0; i < items.length; i += 2) {
ext = items[i + 1].split(/ /);
// extension to mime lookup
for (ii = 0; ii < ext.length; ii++) {
this.mimes[ext[ii]] = items[i];
}
// mime to extension lookup
this.extensions[items[i]] = ext;
}
},
extList2mimes: function (filters, addMissingExtensions) {
var self = this, ext, i, ii, type, mimes = [];
// convert extensions to mime types list
for (i = 0; i < filters.length; i++) {
ext = filters[i].extensions.split(/\s*,\s*/);
for (ii = 0; ii < ext.length; ii++) {
// if there's an asterisk in the list, then accept attribute is not required
if (ext[ii] === '*') {
return [];
}
type = self.mimes[ext[ii]];
if (!type) {
if (addMissingExtensions && /^\w+$/.test(ext[ii])) {
mimes.push('.' + ext[ii]);
} else {
return []; // accept all
}
} else if (Basic.inArray(type, mimes) === -1) {
mimes.push(type);
}
}
}
return mimes;
},
mimes2exts: function(mimes) {
var self = this, exts = [];
Basic.each(mimes, function(mime) {
if (mime === '*') {
exts = [];
return false;
}
// check if this thing looks like mime type
var m = mime.match(/^(\w+)\/(\*|\w+)$/);
if (m) {
if (m[2] === '*') {
// wildcard mime type detected
Basic.each(self.extensions, function(arr, mime) {
if ((new RegExp('^' + m[1] + '/')).test(mime)) {
[].push.apply(exts, self.extensions[mime]);
}
});
} else if (self.extensions[mime]) {
[].push.apply(exts, self.extensions[mime]);
}
}
});
return exts;
},
mimes2extList: function(mimes) {
var accept = [], exts = [];
if (Basic.typeOf(mimes) === 'string') {
mimes = Basic.trim(mimes).split(/\s*,\s*/);
}
exts = this.mimes2exts(mimes);
accept.push({
title: I18n.translate('Files'),
extensions: exts.length ? exts.join(',') : '*'
});
// save original mimes string
accept.mimes = mimes;
return accept;
},
getFileExtension: function(fileName) {
var matches = fileName && fileName.match(/\.([^.]+)$/);
if (matches) {
return matches[1].toLowerCase();
}
return '';
},
getFileMime: function(fileName) {
return this.mimes[this.getFileExtension(fileName)] || '';
}
};
Mime.addMimeType(mimeData);
return Mime;
});
// Included from: src/javascript/core/utils/Env.js
/**
* Env.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/utils/Env", [
"moxie/core/utils/Basic"
], function(Basic) {
// UAParser.js v0.6.2
// Lightweight JavaScript-based User-Agent string parser
// https://github.com/faisalman/ua-parser-js
//
// Copyright © 2012-2013 Faisalman <fyzlman@gmail.com>
// Dual licensed under GPLv2 & MIT
var UAParser = (function (undefined) {
//////////////
// Constants
/////////////
var EMPTY = '',
UNKNOWN = '?',
FUNC_TYPE = 'function',
UNDEF_TYPE = 'undefined',
OBJ_TYPE = 'object',
MAJOR = 'major',
MODEL = 'model',
NAME = 'name',
TYPE = 'type',
VENDOR = 'vendor',
VERSION = 'version',
ARCHITECTURE= 'architecture',
CONSOLE = 'console',
MOBILE = 'mobile',
TABLET = 'tablet';
///////////
// Helper
//////////
var util = {
has : function (str1, str2) {
return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
},
lowerize : function (str) {
return str.toLowerCase();
}
};
///////////////
// Map helper
//////////////
var mapper = {
rgx : function () {
// loop through all regexes maps
for (var result, i = 0, j, k, p, q, matches, match, args = arguments; i < args.length; i += 2) {
var regex = args[i], // even sequence (0,2,4,..)
props = args[i + 1]; // odd sequence (1,3,5,..)
// construct object barebones
if (typeof(result) === UNDEF_TYPE) {
result = {};
for (p in props) {
q = props[p];
if (typeof(q) === OBJ_TYPE) {
result[q[0]] = undefined;
} else {
result[q] = undefined;
}
}
}
// try matching uastring with regexes
for (j = k = 0; j < regex.length; j++) {
matches = regex[j].exec(this.getUA());
if (!!matches) {
for (p = 0; p < props.length; p++) {
match = matches[++k];
q = props[p];
// check if given property is actually array
if (typeof(q) === OBJ_TYPE && q.length > 0) {
if (q.length == 2) {
if (typeof(q[1]) == FUNC_TYPE) {
// assign modified match
result[q[0]] = q[1].call(this, match);
} else {
// assign given value, ignore regex match
result[q[0]] = q[1];
}
} else if (q.length == 3) {
// check whether function or regex
if (typeof(q[1]) === FUNC_TYPE && !(q[1].exec && q[1].test)) {
// call function (usually string mapper)
result[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
} else {
// sanitize match using given regex
result[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
}
} else if (q.length == 4) {
result[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
}
} else {
result[q] = match ? match : undefined;
}
}
break;
}
}
if(!!matches) break; // break the loop immediately if match found
}
return result;
},
str : function (str, map) {
for (var i in map) {
// check if array
if (typeof(map[i]) === OBJ_TYPE && map[i].length > 0) {
for (var j = 0; j < map[i].length; j++) {
if (util.has(map[i][j], str)) {
return (i === UNKNOWN) ? undefined : i;
}
}
} else if (util.has(map[i], str)) {
return (i === UNKNOWN) ? undefined : i;
}
}
return str;
}
};
///////////////
// String map
//////////////
var maps = {
browser : {
oldsafari : {
major : {
'1' : ['/8', '/1', '/3'],
'2' : '/4',
'?' : '/'
},
version : {
'1.0' : '/8',
'1.2' : '/1',
'1.3' : '/3',
'2.0' : '/412',
'2.0.2' : '/416',
'2.0.3' : '/417',
'2.0.4' : '/419',
'?' : '/'
}
}
},
device : {
sprint : {
model : {
'Evo Shift 4G' : '7373KT'
},
vendor : {
'HTC' : 'APA',
'Sprint' : 'Sprint'
}
}
},
os : {
windows : {
version : {
'ME' : '4.90',
'NT 3.11' : 'NT3.51',
'NT 4.0' : 'NT4.0',
'2000' : 'NT 5.0',
'XP' : ['NT 5.1', 'NT 5.2'],
'Vista' : 'NT 6.0',
'7' : 'NT 6.1',
'8' : 'NT 6.2',
'8.1' : 'NT 6.3',
'RT' : 'ARM'
}
}
}
};
//////////////
// Regex map
/////////////
var regexes = {
browser : [[
// Presto based
/(opera\smini)\/((\d+)?[\w\.-]+)/i, // Opera Mini
/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobi/Tablet
/(opera).+version\/((\d+)?[\w\.]+)/i, // Opera > 9.80
/(opera)[\/\s]+((\d+)?[\w\.]+)/i // Opera < 9.80
], [NAME, VERSION, MAJOR], [
/\s(opr)\/((\d+)?[\w\.]+)/i // Opera Webkit
], [[NAME, 'Opera'], VERSION, MAJOR], [
// Mixed
/(kindle)\/((\d+)?[\w\.]+)/i, // Kindle
/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,
// Lunascape/Maxthon/Netfront/Jasmine/Blazer
// Trident based
/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,
// Avant/IEMobile/SlimBrowser/Baidu
/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i, // Internet Explorer
// Webkit/KHTML based
/(rekonq)((?:\/)[\w\.]+)*/i, // Rekonq
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron
], [NAME, VERSION, MAJOR], [
/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i // IE11
], [[NAME, 'IE'], VERSION, MAJOR], [
/(yabrowser)\/((\d+)?[\w\.]+)/i // Yandex
], [[NAME, 'Yandex'], VERSION, MAJOR], [
/(comodo_dragon)\/((\d+)?[\w\.]+)/i // Comodo Dragon
], [[NAME, /_/g, ' '], VERSION, MAJOR], [
/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i
// Chrome/OmniWeb/Arora/Tizen/Nokia
], [NAME, VERSION, MAJOR], [
/(dolfin)\/((\d+)?[\w\.]+)/i // Dolphin
], [[NAME, 'Dolphin'], VERSION, MAJOR], [
/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i // Chrome for Android/iOS
], [[NAME, 'Chrome'], VERSION, MAJOR], [
/((?:android.+))version\/((\d+)?[\w\.]+)\smobile\ssafari/i // Android Browser
], [[NAME, 'Android Browser'], VERSION, MAJOR], [
/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari
], [VERSION, MAJOR, [NAME, 'Mobile Safari']], [
/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile
], [VERSION, MAJOR, NAME], [
/webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i // Safari < 3.0
], [NAME, [MAJOR, mapper.str, maps.browser.oldsafari.major], [VERSION, mapper.str, maps.browser.oldsafari.version]], [
/(konqueror)\/((\d+)?[\w\.]+)/i, // Konqueror
/(webkit|khtml)\/((\d+)?[\w\.]+)/i
], [NAME, VERSION, MAJOR], [
// Gecko based
/(navigator|netscape)\/((\d+)?[\w\.-]+)/i // Netscape
], [[NAME, 'Netscape'], VERSION, MAJOR], [
/(swiftfox)/i, // Swiftfox
/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla
// Other
/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i,
// UCBrowser/Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/QQBrowser
/(links)\s\(((\d+)?[\w\.]+)/i, // Links
/(gobrowser)\/?((\d+)?[\w\.]+)*/i, // GoBrowser
/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i, // ICE Browser
/(mosaic)[\/\s]((\d+)?[\w\.]+)/i // Mosaic
], [NAME, VERSION, MAJOR]
],
engine : [[
/(presto)\/([\w\.]+)/i, // Presto
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m
/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links
/(icab)[\/\s]([23]\.[\d\.]+)/i // iCab
], [NAME, VERSION], [
/rv\:([\w\.]+).*(gecko)/i // Gecko
], [VERSION, NAME]
],
os : [[
// Windows based
/(windows)\snt\s6\.2;\s(arm)/i, // Windows RT
/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i
], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [
/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i
], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [
// Mobile/Embedded OS
/\((bb)(10);/i // BlackBerry 10
], [[NAME, 'BlackBerry'], VERSION], [
/(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry
/(tizen)\/([\w\.]+)/i, // Tizen
/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i
// Android/WebOS/Palm/QNX/Bada/RIM/MeeGo
], [NAME, VERSION], [
/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian
], [[NAME, 'Symbian'], VERSION],[
/mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS
], [[NAME, 'Firefox OS'], VERSION], [
// Console
/(nintendo|playstation)\s([wids3portablevu]+)/i, // Nintendo/Playstation
// GNU/Linux based
/(mint)[\/\s\(]?(\w+)*/i, // Mint
/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,
// Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware
// Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk
/(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux
/(gnu)\s?([\w\.]+)*/i // GNU
], [NAME, VERSION], [
/(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS
], [[NAME, 'Chromium OS'], VERSION],[
// Solaris
/(sunos)\s?([\w\.]+\d)*/i // Solaris
], [[NAME, 'Solaris'], VERSION], [
// BSD based
/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly
], [NAME, VERSION],[
/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS
], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [
/(mac\sos\sx)\s?([\w\s\.]+\w)*/i // Mac OS
], [NAME, [VERSION, /_/g, '.']], [
// Other
/(haiku)\s(\w+)/i, // Haiku
/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX
/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i,
// Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS
/(unix)\s?([\w\.]+)*/i // UNIX
], [NAME, VERSION]
]
};
/////////////////
// Constructor
////////////////
var UAParser = function (uastring) {
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
this.getBrowser = function () {
return mapper.rgx.apply(this, regexes.browser);
};
this.getEngine = function () {
return mapper.rgx.apply(this, regexes.engine);
};
this.getOS = function () {
return mapper.rgx.apply(this, regexes.os);
};
this.getResult = function() {
return {
ua : this.getUA(),
browser : this.getBrowser(),
engine : this.getEngine(),
os : this.getOS()
};
};
this.getUA = function () {
return ua;
};
this.setUA = function (uastring) {
ua = uastring;
return this;
};
this.setUA(ua);
};
return new UAParser().getResult();
})();
function version_compare(v1, v2, operator) {
// From: http://phpjs.org/functions
// + original by: Philippe Jausions (http://pear.php.net/user/jausions)
// + original by: Aidan Lister (http://aidanlister.com/)
// + reimplemented by: Kankrelune (http://www.webfaktory.info/)
// + improved by: Brett Zamir (http://brett-zamir.me)
// + improved by: Scott Baker
// + improved by: Theriault
// * example 1: version_compare('8.2.5rc', '8.2.5a');
// * returns 1: 1
// * example 2: version_compare('8.2.50', '8.2.52', '<');
// * returns 2: true
// * example 3: version_compare('5.3.0-dev', '5.3.0');
// * returns 3: -1
// * example 4: version_compare('4.1.0.52','4.01.0.51');
// * returns 4: 1
// Important: compare must be initialized at 0.
var i = 0,
x = 0,
compare = 0,
// vm maps textual PHP versions to negatives so they're less than 0.
// PHP currently defines these as CASE-SENSITIVE. It is important to
// leave these as negatives so that they can come before numerical versions
// and as if no letters were there to begin with.
// (1alpha is < 1 and < 1.1 but > 1dev1)
// If a non-numerical value can't be mapped to this table, it receives
// -7 as its value.
vm = {
'dev': -6,
'alpha': -5,
'a': -5,
'beta': -4,
'b': -4,
'RC': -3,
'rc': -3,
'#': -2,
'p': 1,
'pl': 1
},
// This function will be called to prepare each version argument.
// It replaces every _, -, and + with a dot.
// It surrounds any nonsequence of numbers/dots with dots.
// It replaces sequences of dots with a single dot.
// version_compare('4..0', '4.0') == 0
// Important: A string of 0 length needs to be converted into a value
// even less than an unexisting value in vm (-7), hence [-8].
// It's also important to not strip spaces because of this.
// version_compare('', ' ') == 1
prepVersion = function (v) {
v = ('' + v).replace(/[_\-+]/g, '.');
v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
return (!v.length ? [-8] : v.split('.'));
},
// This converts a version component to a number.
// Empty component becomes 0.
// Non-numerical component becomes a negative number.
// Numerical component becomes itself as an integer.
numVersion = function (v) {
return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
};
v1 = prepVersion(v1);
v2 = prepVersion(v2);
x = Math.max(v1.length, v2.length);
for (i = 0; i < x; i++) {
if (v1[i] == v2[i]) {
continue;
}
v1[i] = numVersion(v1[i]);
v2[i] = numVersion(v2[i]);
if (v1[i] < v2[i]) {
compare = -1;
break;
} else if (v1[i] > v2[i]) {
compare = 1;
break;
}
}
if (!operator) {
return compare;
}
// Important: operator is CASE-SENSITIVE.
// "No operator" seems to be treated as "<."
// Any other values seem to make the function return null.
switch (operator) {
case '>':
case 'gt':
return (compare > 0);
case '>=':
case 'ge':
return (compare >= 0);
case '<=':
case 'le':
return (compare <= 0);
case '==':
case '=':
case 'eq':
return (compare === 0);
case '<>':
case '!=':
case 'ne':
return (compare !== 0);
case '':
case '<':
case 'lt':
return (compare < 0);
default:
return null;
}
}
var can = (function() {
var caps = {
define_property: (function() {
/* // currently too much extra code required, not exactly worth it
try { // as of IE8, getters/setters are supported only on DOM elements
var obj = {};
if (Object.defineProperty) {
Object.defineProperty(obj, 'prop', {
enumerable: true,
configurable: true
});
return true;
}
} catch(ex) {}
if (Object.prototype.__defineGetter__ && Object.prototype.__defineSetter__) {
return true;
}*/
return false;
}()),
create_canvas: (function() {
// On the S60 and BB Storm, getContext exists, but always returns undefined
// so we actually have to call getContext() to verify
// github.com/Modernizr/Modernizr/issues/issue/97/
var el = document.createElement('canvas');
return !!(el.getContext && el.getContext('2d'));
}()),
return_response_type: function(responseType) {
try {
if (Basic.inArray(responseType, ['', 'text', 'document']) !== -1) {
return true;
} else if (window.XMLHttpRequest) {
var xhr = new XMLHttpRequest();
xhr.open('get', '/'); // otherwise Gecko throws an exception
if ('responseType' in xhr) {
xhr.responseType = responseType;
// as of 23.0.1271.64, Chrome switched from throwing exception to merely logging it to the console (why? o why?)
if (xhr.responseType !== responseType) {
return false;
}
return true;
}
}
} catch (ex) {}
return false;
},
// ideas for this heavily come from Modernizr (http://modernizr.com/)
use_data_uri: (function() {
var du = new Image();
du.onload = function() {
caps.use_data_uri = (du.width === 1 && du.height === 1);
};
setTimeout(function() {
du.src = "data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";
}, 1);
return false;
}()),
use_data_uri_over32kb: function() { // IE8
return caps.use_data_uri && (Env.browser !== 'IE' || Env.version >= 9);
},
use_data_uri_of: function(bytes) {
return (caps.use_data_uri && bytes < 33000 || caps.use_data_uri_over32kb());
},
use_fileinput: function() {
var el = document.createElement('input');
el.setAttribute('type', 'file');
return !el.disabled;
}
};
return function(cap) {
var args = [].slice.call(arguments);
args.shift(); // shift of cap
return Basic.typeOf(caps[cap]) === 'function' ? caps[cap].apply(this, args) : !!caps[cap];
};
}());
var Env = {
can: can,
browser: UAParser.browser.name,
version: parseFloat(UAParser.browser.major),
os: UAParser.os.name, // everybody intuitively types it in a lowercase for some reason
osVersion: UAParser.os.version,
verComp: version_compare,
swf_url: "../flash/Moxie.swf",
xap_url: "../silverlight/Moxie.xap",
global_event_dispatcher: "moxie.core.EventTarget.instance.dispatchEvent"
};
// for backward compatibility
// @deprecated Use `Env.os` instead
Env.OS = Env.os;
return Env;
});
// Included from: src/javascript/core/utils/Dom.js
/**
* Dom.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Dom', ['moxie/core/utils/Env'], function(Env) {
/**
Get DOM Element by it's id.
@method get
@for Utils
@param {String} id Identifier of the DOM Element
@return {DOMElement}
*/
var get = function(id) {
if (typeof id !== 'string') {
return id;
}
return document.getElementById(id);
};
/**
Checks if specified DOM element has specified class.
@method hasClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var hasClass = function(obj, name) {
if (!obj.className) {
return false;
}
var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)");
return regExp.test(obj.className);
};
/**
Adds specified className to specified DOM element.
@method addClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var addClass = function(obj, name) {
if (!hasClass(obj, name)) {
obj.className = !obj.className ? name : obj.className.replace(/\s+$/, '') + ' ' + name;
}
};
/**
Removes specified className from specified DOM element.
@method removeClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var removeClass = function(obj, name) {
if (obj.className) {
var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)");
obj.className = obj.className.replace(regExp, function($0, $1, $2) {
return $1 === ' ' && $2 === ' ' ? ' ' : '';
});
}
};
/**
Returns a given computed style of a DOM element.
@method getStyle
@static
@param {Object} obj DOM element like object.
@param {String} name Style you want to get from the DOM element
*/
var getStyle = function(obj, name) {
if (obj.currentStyle) {
return obj.currentStyle[name];
} else if (window.getComputedStyle) {
return window.getComputedStyle(obj, null)[name];
}
};
/**
Returns the absolute x, y position of an Element. The position will be returned in a object with x, y fields.
@method getPos
@static
@param {Element} node HTML element or element id to get x, y position from.
@param {Element} root Optional root element to stop calculations at.
@return {object} Absolute position of the specified element object with x, y fields.
*/
var getPos = function(node, root) {
var x = 0, y = 0, parent, doc = document, nodeRect, rootRect;
node = node;
root = root || doc.body;
// Returns the x, y cordinate for an element on IE 6 and IE 7
function getIEPos(node) {
var bodyElm, rect, x = 0, y = 0;
if (node) {
rect = node.getBoundingClientRect();
bodyElm = doc.compatMode === "CSS1Compat" ? doc.documentElement : doc.body;
x = rect.left + bodyElm.scrollLeft;
y = rect.top + bodyElm.scrollTop;
}
return {
x : x,
y : y
};
}
// Use getBoundingClientRect on IE 6 and IE 7 but not on IE 8 in standards mode
if (node && node.getBoundingClientRect && Env.browser === 'IE' && (!doc.documentMode || doc.documentMode < 8)) {
nodeRect = getIEPos(node);
rootRect = getIEPos(root);
return {
x : nodeRect.x - rootRect.x,
y : nodeRect.y - rootRect.y
};
}
parent = node;
while (parent && parent != root && parent.nodeType) {
x += parent.offsetLeft || 0;
y += parent.offsetTop || 0;
parent = parent.offsetParent;
}
parent = node.parentNode;
while (parent && parent != root && parent.nodeType) {
x -= parent.scrollLeft || 0;
y -= parent.scrollTop || 0;
parent = parent.parentNode;
}
return {
x : x,
y : y
};
};
/**
Returns the size of the specified node in pixels.
@method getSize
@static
@param {Node} node Node to get the size of.
@return {Object} Object with a w and h property.
*/
var getSize = function(node) {
return {
w : node.offsetWidth || node.clientWidth,
h : node.offsetHeight || node.clientHeight
};
};
return {
get: get,
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
getStyle: getStyle,
getPos: getPos,
getSize: getSize
};
});
// Included from: src/javascript/core/Exceptions.js
/**
* Exceptions.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/Exceptions', [
'moxie/core/utils/Basic'
], function(Basic) {
function _findKey(obj, value) {
var key;
for (key in obj) {
if (obj[key] === value) {
return key;
}
}
return null;
}
return {
RuntimeError: (function() {
var namecodes = {
NOT_INIT_ERR: 1,
NOT_SUPPORTED_ERR: 9,
JS_ERR: 4
};
function RuntimeError(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": RuntimeError " + this.code;
}
Basic.extend(RuntimeError, namecodes);
RuntimeError.prototype = Error.prototype;
return RuntimeError;
}()),
OperationNotAllowedException: (function() {
function OperationNotAllowedException(code) {
this.code = code;
this.name = 'OperationNotAllowedException';
}
Basic.extend(OperationNotAllowedException, {
NOT_ALLOWED_ERR: 1
});
OperationNotAllowedException.prototype = Error.prototype;
return OperationNotAllowedException;
}()),
ImageError: (function() {
var namecodes = {
WRONG_FORMAT: 1,
MAX_RESOLUTION_ERR: 2
};
function ImageError(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": ImageError " + this.code;
}
Basic.extend(ImageError, namecodes);
ImageError.prototype = Error.prototype;
return ImageError;
}()),
FileException: (function() {
var namecodes = {
NOT_FOUND_ERR: 1,
SECURITY_ERR: 2,
ABORT_ERR: 3,
NOT_READABLE_ERR: 4,
ENCODING_ERR: 5,
NO_MODIFICATION_ALLOWED_ERR: 6,
INVALID_STATE_ERR: 7,
SYNTAX_ERR: 8
};
function FileException(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": FileException " + this.code;
}
Basic.extend(FileException, namecodes);
FileException.prototype = Error.prototype;
return FileException;
}()),
DOMException: (function() {
var namecodes = {
INDEX_SIZE_ERR: 1,
DOMSTRING_SIZE_ERR: 2,
HIERARCHY_REQUEST_ERR: 3,
WRONG_DOCUMENT_ERR: 4,
INVALID_CHARACTER_ERR: 5,
NO_DATA_ALLOWED_ERR: 6,
NO_MODIFICATION_ALLOWED_ERR: 7,
NOT_FOUND_ERR: 8,
NOT_SUPPORTED_ERR: 9,
INUSE_ATTRIBUTE_ERR: 10,
INVALID_STATE_ERR: 11,
SYNTAX_ERR: 12,
INVALID_MODIFICATION_ERR: 13,
NAMESPACE_ERR: 14,
INVALID_ACCESS_ERR: 15,
VALIDATION_ERR: 16,
TYPE_MISMATCH_ERR: 17,
SECURITY_ERR: 18,
NETWORK_ERR: 19,
ABORT_ERR: 20,
URL_MISMATCH_ERR: 21,
QUOTA_EXCEEDED_ERR: 22,
TIMEOUT_ERR: 23,
INVALID_NODE_TYPE_ERR: 24,
DATA_CLONE_ERR: 25
};
function DOMException(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": DOMException " + this.code;
}
Basic.extend(DOMException, namecodes);
DOMException.prototype = Error.prototype;
return DOMException;
}()),
EventException: (function() {
function EventException(code) {
this.code = code;
this.name = 'EventException';
}
Basic.extend(EventException, {
UNSPECIFIED_EVENT_TYPE_ERR: 0
});
EventException.prototype = Error.prototype;
return EventException;
}())
};
});
// Included from: src/javascript/core/EventTarget.js
/**
* EventTarget.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/EventTarget', [
'moxie/core/Exceptions',
'moxie/core/utils/Basic'
], function(x, Basic) {
/**
Parent object for all event dispatching components and objects
@class EventTarget
@constructor EventTarget
*/
function EventTarget() {
// hash of event listeners by object uid
var eventpool = {};
Basic.extend(this, {
/**
Unique id of the event dispatcher, usually overriden by children
@property uid
@type String
*/
uid: null,
/**
Can be called from within a child in order to acquire uniqie id in automated manner
@method init
*/
init: function() {
if (!this.uid) {
this.uid = Basic.guid('uid_');
}
},
/**
Register a handler to a specific event dispatched by the object
@method addEventListener
@param {String} type Type or basically a name of the event to subscribe to
@param {Function} fn Callback function that will be called when event happens
@param {Number} [priority=0] Priority of the event handler - handlers with higher priorities will be called first
@param {Object} [scope=this] A scope to invoke event handler in
*/
addEventListener: function(type, fn, priority, scope) {
var self = this, list;
type = Basic.trim(type);
if (/\s/.test(type)) {
// multiple event types were passed for one handler
Basic.each(type.split(/\s+/), function(type) {
self.addEventListener(type, fn, priority, scope);
});
return;
}
type = type.toLowerCase();
priority = parseInt(priority, 10) || 0;
list = eventpool[this.uid] && eventpool[this.uid][type] || [];
list.push({fn : fn, priority : priority, scope : scope || this});
if (!eventpool[this.uid]) {
eventpool[this.uid] = {};
}
eventpool[this.uid][type] = list;
},
/**
Check if any handlers were registered to the specified event
@method hasEventListener
@param {String} type Type or basically a name of the event to check
@return {Mixed} Returns a handler if it was found and false, if - not
*/
hasEventListener: function(type) {
return type ? !!(eventpool[this.uid] && eventpool[this.uid][type]) : !!eventpool[this.uid];
},
/**
Unregister the handler from the event, or if former was not specified - unregister all handlers
@method removeEventListener
@param {String} type Type or basically a name of the event
@param {Function} [fn] Handler to unregister
*/
removeEventListener: function(type, fn) {
type = type.toLowerCase();
var list = eventpool[this.uid] && eventpool[this.uid][type], i;
if (list) {
if (fn) {
for (i = list.length - 1; i >= 0; i--) {
if (list[i].fn === fn) {
list.splice(i, 1);
break;
}
}
} else {
list = [];
}
// delete event list if it has become empty
if (!list.length) {
delete eventpool[this.uid][type];
// and object specific entry in a hash if it has no more listeners attached
if (Basic.isEmptyObj(eventpool[this.uid])) {
delete eventpool[this.uid];
}
}
}
},
/**
Remove all event handlers from the object
@method removeAllEventListeners
*/
removeAllEventListeners: function() {
if (eventpool[this.uid]) {
delete eventpool[this.uid];
}
},
/**
Dispatch the event
@method dispatchEvent
@param {String/Object} Type of event or event object to dispatch
@param {Mixed} [...] Variable number of arguments to be passed to a handlers
@return {Boolean} true by default and false if any handler returned false
*/
dispatchEvent: function(type) {
var uid, list, args, tmpEvt, evt = {}, result = true, undef;
if (Basic.typeOf(type) !== 'string') {
// we can't use original object directly (because of Silverlight)
tmpEvt = type;
if (Basic.typeOf(tmpEvt.type) === 'string') {
type = tmpEvt.type;
if (tmpEvt.total !== undef && tmpEvt.loaded !== undef) { // progress event
evt.total = tmpEvt.total;
evt.loaded = tmpEvt.loaded;
}
evt.async = tmpEvt.async || false;
} else {
throw new x.EventException(x.EventException.UNSPECIFIED_EVENT_TYPE_ERR);
}
}
// check if event is meant to be dispatched on an object having specific uid
if (type.indexOf('::') !== -1) {
(function(arr) {
uid = arr[0];
type = arr[1];
}(type.split('::')));
} else {
uid = this.uid;
}
type = type.toLowerCase();
list = eventpool[uid] && eventpool[uid][type];
if (list) {
// sort event list by prority
list.sort(function(a, b) { return b.priority - a.priority; });
args = [].slice.call(arguments);
// first argument will be pseudo-event object
args.shift();
evt.type = type;
args.unshift(evt);
// Dispatch event to all listeners
var queue = [];
Basic.each(list, function(handler) {
// explicitly set the target, otherwise events fired from shims do not get it
args[0].target = handler.scope;
// if event is marked as async, detach the handler
if (evt.async) {
queue.push(function(cb) {
setTimeout(function() {
cb(handler.fn.apply(handler.scope, args) === false);
}, 1);
});
} else {
queue.push(function(cb) {
cb(handler.fn.apply(handler.scope, args) === false); // if handler returns false stop propagation
});
}
});
if (queue.length) {
Basic.inSeries(queue, function(err) {
result = !err;
});
}
}
return result;
},
/**
Alias for addEventListener
@method bind
@protected
*/
bind: function() {
this.addEventListener.apply(this, arguments);
},
/**
Alias for removeEventListener
@method unbind
@protected
*/
unbind: function() {
this.removeEventListener.apply(this, arguments);
},
/**
Alias for removeAllEventListeners
@method unbindAll
@protected
*/
unbindAll: function() {
this.removeAllEventListeners.apply(this, arguments);
},
/**
Alias for dispatchEvent
@method trigger
@protected
*/
trigger: function() {
return this.dispatchEvent.apply(this, arguments);
},
/**
Converts properties of on[event] type to corresponding event handlers,
is used to avoid extra hassle around the process of calling them back
@method convertEventPropsToHandlers
@private
*/
convertEventPropsToHandlers: function(handlers) {
var h;
if (Basic.typeOf(handlers) !== 'array') {
handlers = [handlers];
}
for (var i = 0; i < handlers.length; i++) {
h = 'on' + handlers[i];
if (Basic.typeOf(this[h]) === 'function') {
this.addEventListener(handlers[i], this[h]);
} else if (Basic.typeOf(this[h]) === 'undefined') {
this[h] = null; // object must have defined event properties, even if it doesn't make use of them
}
}
}
});
}
EventTarget.instance = new EventTarget();
return EventTarget;
});
// Included from: src/javascript/core/utils/Encode.js
/**
* Encode.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Encode', [], function() {
/**
Encode string with UTF-8
@method utf8_encode
@for Utils
@static
@param {String} str String to encode
@return {String} UTF-8 encoded string
*/
var utf8_encode = function(str) {
return unescape(encodeURIComponent(str));
};
/**
Decode UTF-8 encoded string
@method utf8_decode
@static
@param {String} str String to decode
@return {String} Decoded string
*/
var utf8_decode = function(str_data) {
return decodeURIComponent(escape(str_data));
};
/**
Decode Base64 encoded string (uses browser's default method if available),
from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_decode.js
@method atob
@static
@param {String} data String to decode
@return {String} Decoded string
*/
var atob = function(data, utf8) {
if (typeof(window.atob) === 'function') {
return utf8 ? utf8_decode(window.atob(data)) : window.atob(data);
}
// http://kevin.vanzonneveld.net
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Thunder.m
// + input by: Aman Gupta
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// * example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA==');
// * returns 1: 'Kevin van Zonneveld'
// mozilla has this native
// - but breaks in 2.0.0.12!
//if (typeof this.window.atob == 'function') {
// return atob(data);
//}
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
dec = "",
tmp_arr = [];
if (!data) {
return data;
}
data += '';
do { // unpack four hexets into three octets using index points in b64
h1 = b64.indexOf(data.charAt(i++));
h2 = b64.indexOf(data.charAt(i++));
h3 = b64.indexOf(data.charAt(i++));
h4 = b64.indexOf(data.charAt(i++));
bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;
o1 = bits >> 16 & 0xff;
o2 = bits >> 8 & 0xff;
o3 = bits & 0xff;
if (h3 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1);
} else if (h4 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1, o2);
} else {
tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
}
} while (i < data.length);
dec = tmp_arr.join('');
return utf8 ? utf8_decode(dec) : dec;
};
/**
Base64 encode string (uses browser's default method if available),
from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_encode.js
@method btoa
@static
@param {String} data String to encode
@return {String} Base64 encoded string
*/
var btoa = function(data, utf8) {
if (utf8) {
utf8_encode(data);
}
if (typeof(window.btoa) === 'function') {
return window.btoa(data);
}
// http://kevin.vanzonneveld.net
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Bayron Guevara
// + improved by: Thunder.m
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Rafał Kukawski (http://kukawski.pl)
// * example 1: base64_encode('Kevin van Zonneveld');
// * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='
// mozilla has this native
// - but breaks in 2.0.0.12!
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
enc = "",
tmp_arr = [];
if (!data) {
return data;
}
do { // pack three octets into four hexets
o1 = data.charCodeAt(i++);
o2 = data.charCodeAt(i++);
o3 = data.charCodeAt(i++);
bits = o1 << 16 | o2 << 8 | o3;
h1 = bits >> 18 & 0x3f;
h2 = bits >> 12 & 0x3f;
h3 = bits >> 6 & 0x3f;
h4 = bits & 0x3f;
// use hexets to index into b64, and append result to encoded string
tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
} while (i < data.length);
enc = tmp_arr.join('');
var r = data.length % 3;
return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
};
return {
utf8_encode: utf8_encode,
utf8_decode: utf8_decode,
atob: atob,
btoa: btoa
};
});
// Included from: src/javascript/runtime/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/Runtime', [
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/EventTarget"
], function(Basic, Dom, EventTarget) {
var runtimeConstructors = {}, runtimes = {};
/**
Common set of methods and properties for every runtime instance
@class Runtime
@param {Object} options
@param {String} type Sanitized name of the runtime
@param {Object} [caps] Set of capabilities that differentiate specified runtime
@param {Object} [modeCaps] Set of capabilities that do require specific operational mode
@param {String} [preferredMode='browser'] Preferred operational mode to choose if no required capabilities were requested
*/
function Runtime(options, type, caps, modeCaps, preferredMode) {
/**
Dispatched when runtime is initialized and ready.
Results in RuntimeInit on a connected component.
@event Init
*/
/**
Dispatched when runtime fails to initialize.
Results in RuntimeError on a connected component.
@event Error
*/
var self = this
, _shim
, _uid = Basic.guid(type + '_')
, defaultMode = preferredMode || 'browser'
;
options = options || {};
// register runtime in private hash
runtimes[_uid] = this;
/**
Default set of capabilities, which can be redifined later by specific runtime
@private
@property caps
@type Object
*/
caps = Basic.extend({
// Runtime can:
// provide access to raw binary data of the file
access_binary: false,
// provide access to raw binary data of the image (image extension is optional)
access_image_binary: false,
// display binary data as thumbs for example
display_media: false,
// make cross-domain requests
do_cors: false,
// accept files dragged and dropped from the desktop
drag_and_drop: false,
// filter files in selection dialog by their extensions
filter_by_extension: true,
// resize image (and manipulate it raw data of any file in general)
resize_image: false,
// periodically report how many bytes of total in the file were uploaded (loaded)
report_upload_progress: false,
// provide access to the headers of http response
return_response_headers: false,
// support response of specific type, which should be passed as an argument
// e.g. runtime.can('return_response_type', 'blob')
return_response_type: false,
// return http status code of the response
return_status_code: true,
// send custom http header with the request
send_custom_headers: false,
// pick up the files from a dialog
select_file: false,
// select whole folder in file browse dialog
select_folder: false,
// select multiple files at once in file browse dialog
select_multiple: true,
// send raw binary data, that is generated after image resizing or manipulation of other kind
send_binary_string: false,
// send cookies with http request and therefore retain session
send_browser_cookies: true,
// send data formatted as multipart/form-data
send_multipart: true,
// slice the file or blob to smaller parts
slice_blob: false,
// upload file without preloading it to memory, stream it out directly from disk
stream_upload: false,
// programmatically trigger file browse dialog
summon_file_dialog: false,
// upload file of specific size, size should be passed as argument
// e.g. runtime.can('upload_filesize', '500mb')
upload_filesize: true,
// initiate http request with specific http method, method should be passed as argument
// e.g. runtime.can('use_http_method', 'put')
use_http_method: true
}, caps);
// default to the mode that is compatible with preferred caps
if (options.preferred_caps) {
defaultMode = Runtime.getMode(modeCaps, options.preferred_caps, defaultMode);
}
// small extension factory here (is meant to be extended with actual extensions constructors)
_shim = (function() {
var objpool = {};
return {
exec: function(uid, comp, fn, args) {
if (_shim[comp]) {
if (!objpool[uid]) {
objpool[uid] = {
context: this,
instance: new _shim[comp]()
};
}
if (objpool[uid].instance[fn]) {
return objpool[uid].instance[fn].apply(this, args);
}
}
},
removeInstance: function(uid) {
delete objpool[uid];
},
removeAllInstances: function() {
var self = this;
Basic.each(objpool, function(obj, uid) {
if (Basic.typeOf(obj.instance.destroy) === 'function') {
obj.instance.destroy.call(obj.context);
}
self.removeInstance(uid);
});
}
};
}());
// public methods
Basic.extend(this, {
/**
Specifies whether runtime instance was initialized or not
@property initialized
@type {Boolean}
@default false
*/
initialized: false, // shims require this flag to stop initialization retries
/**
Unique ID of the runtime
@property uid
@type {String}
*/
uid: _uid,
/**
Runtime type (e.g. flash, html5, etc)
@property type
@type {String}
*/
type: type,
/**
Runtime (not native one) may operate in browser or client mode.
@property mode
@private
@type {String|Boolean} current mode or false, if none possible
*/
mode: Runtime.getMode(modeCaps, (options.required_caps), defaultMode),
/**
id of the DOM container for the runtime (if available)
@property shimid
@type {String}
*/
shimid: _uid + '_container',
/**
Number of connected clients. If equal to zero, runtime can be destroyed
@property clients
@type {Number}
*/
clients: 0,
/**
Runtime initialization options
@property options
@type {Object}
*/
options: options,
/**
Checks if the runtime has specific capability
@method can
@param {String} cap Name of capability to check
@param {Mixed} [value] If passed, capability should somehow correlate to the value
@param {Object} [refCaps] Set of capabilities to check the specified cap against (defaults to internal set)
@return {Boolean} true if runtime has such capability and false, if - not
*/
can: function(cap, value) {
var refCaps = arguments[2] || caps;
// if cap var is a comma-separated list of caps, convert it to object (key/value)
if (Basic.typeOf(cap) === 'string' && Basic.typeOf(value) === 'undefined') {
cap = Runtime.parseCaps(cap);
}
if (Basic.typeOf(cap) === 'object') {
for (var key in cap) {
if (!this.can(key, cap[key], refCaps)) {
return false;
}
}
return true;
}
// check the individual cap
if (Basic.typeOf(refCaps[cap]) === 'function') {
return refCaps[cap].call(this, value);
} else {
return (value === refCaps[cap]);
}
},
/**
Returns container for the runtime as DOM element
@method getShimContainer
@return {DOMElement}
*/
getShimContainer: function() {
var container, shimContainer = Dom.get(this.shimid);
// if no container for shim, create one
if (!shimContainer) {
container = this.options.container ? Dom.get(this.options.container) : document.body;
// create shim container and insert it at an absolute position into the outer container
shimContainer = document.createElement('div');
shimContainer.id = this.shimid;
shimContainer.className = 'moxie-shim moxie-shim-' + this.type;
Basic.extend(shimContainer.style, {
position: 'absolute',
top: '0px',
left: '0px',
width: '1px',
height: '1px',
overflow: 'hidden'
});
container.appendChild(shimContainer);
container = null;
}
return shimContainer;
},
/**
Returns runtime as DOM element (if appropriate)
@method getShim
@return {DOMElement}
*/
getShim: function() {
return _shim;
},
/**
Invokes a method within the runtime itself (might differ across the runtimes)
@method shimExec
@param {Mixed} []
@protected
@return {Mixed} Depends on the action and component
*/
shimExec: function(component, action) {
var args = [].slice.call(arguments, 2);
return self.getShim().exec.call(this, this.uid, component, action, args);
},
/**
Operaional interface that is used by components to invoke specific actions on the runtime
(is invoked in the scope of component)
@method exec
@param {Mixed} []*
@protected
@return {Mixed} Depends on the action and component
*/
exec: function(component, action) { // this is called in the context of component, not runtime
var args = [].slice.call(arguments, 2);
if (self[component] && self[component][action]) {
return self[component][action].apply(this, args);
}
return self.shimExec.apply(this, arguments);
},
/**
Destroys the runtime (removes all events and deletes DOM structures)
@method destroy
*/
destroy: function() {
if (!self) {
return; // obviously already destroyed
}
var shimContainer = Dom.get(this.shimid);
if (shimContainer) {
shimContainer.parentNode.removeChild(shimContainer);
}
if (_shim) {
_shim.removeAllInstances();
}
this.unbindAll();
delete runtimes[this.uid];
this.uid = null; // mark this runtime as destroyed
_uid = self = _shim = shimContainer = null;
}
});
// once we got the mode, test against all caps
if (this.mode && options.required_caps && !this.can(options.required_caps)) {
this.mode = false;
}
}
/**
Default order to try different runtime types
@property order
@type String
@static
*/
Runtime.order = 'html5,flash,silverlight,html4';
/**
Retrieves runtime from private hash by it's uid
@method getRuntime
@private
@static
@param {String} uid Unique identifier of the runtime
@return {Runtime|Boolean} Returns runtime, if it exists and false, if - not
*/
Runtime.getRuntime = function(uid) {
return runtimes[uid] ? runtimes[uid] : false;
};
/**
Register constructor for the Runtime of new (or perhaps modified) type
@method addConstructor
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@param {Function} construct Constructor for the Runtime type
*/
Runtime.addConstructor = function(type, constructor) {
constructor.prototype = EventTarget.instance;
runtimeConstructors[type] = constructor;
};
/**
Get the constructor for the specified type.
method getConstructor
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@return {Function} Constructor for the Runtime type
*/
Runtime.getConstructor = function(type) {
return runtimeConstructors[type] || null;
};
/**
Get info about the runtime (uid, type, capabilities)
@method getInfo
@static
@param {String} uid Unique identifier of the runtime
@return {Mixed} Info object or null if runtime doesn't exist
*/
Runtime.getInfo = function(uid) {
var runtime = Runtime.getRuntime(uid);
if (runtime) {
return {
uid: runtime.uid,
type: runtime.type,
mode: runtime.mode,
can: function() {
return runtime.can.apply(runtime, arguments);
}
};
}
return null;
};
/**
Convert caps represented by a comma-separated string to the object representation.
@method parseCaps
@static
@param {String} capStr Comma-separated list of capabilities
@return {Object}
*/
Runtime.parseCaps = function(capStr) {
var capObj = {};
if (Basic.typeOf(capStr) !== 'string') {
return capStr || {};
}
Basic.each(capStr.split(','), function(key) {
capObj[key] = true; // we assume it to be - true
});
return capObj;
};
/**
Test the specified runtime for specific capabilities.
@method can
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@param {String|Object} caps Set of capabilities to check
@return {Boolean} Result of the test
*/
Runtime.can = function(type, caps) {
var runtime
, constructor = Runtime.getConstructor(type)
, mode
;
if (constructor) {
runtime = new constructor({
required_caps: caps
});
mode = runtime.mode;
runtime.destroy();
return !!mode;
}
return false;
};
/**
Figure out a runtime that supports specified capabilities.
@method thatCan
@static
@param {String|Object} caps Set of capabilities to check
@param {String} [runtimeOrder] Comma-separated list of runtimes to check against
@return {String} Usable runtime identifier or null
*/
Runtime.thatCan = function(caps, runtimeOrder) {
var types = (runtimeOrder || Runtime.order).split(/\s*,\s*/);
for (var i in types) {
if (Runtime.can(types[i], caps)) {
return types[i];
}
}
return null;
};
/**
Figure out an operational mode for the specified set of capabilities.
@method getMode
@static
@param {Object} modeCaps Set of capabilities that depend on particular runtime mode
@param {Object} [requiredCaps] Supplied set of capabilities to find operational mode for
@param {String|Boolean} [defaultMode='browser'] Default mode to use
@return {String|Boolean} Compatible operational mode
*/
Runtime.getMode = function(modeCaps, requiredCaps, defaultMode) {
var mode = null;
if (Basic.typeOf(defaultMode) === 'undefined') { // only if not specified
defaultMode = 'browser';
}
if (requiredCaps && !Basic.isEmptyObj(modeCaps)) {
// loop over required caps and check if they do require the same mode
Basic.each(requiredCaps, function(value, cap) {
if (modeCaps.hasOwnProperty(cap)) {
var capMode = modeCaps[cap](value);
// make sure we always have an array
if (typeof(capMode) === 'string') {
capMode = [capMode];
}
if (!mode) {
mode = capMode;
} else if (!(mode = Basic.arrayIntersect(mode, capMode))) {
// if cap requires conflicting mode - runtime cannot fulfill required caps
return (mode = false);
}
}
});
if (mode) {
return Basic.inArray(defaultMode, mode) !== -1 ? defaultMode : mode[0];
} else if (mode === false) {
return false;
}
}
return defaultMode;
};
/**
Capability check that always returns true
@private
@static
@return {True}
*/
Runtime.capTrue = function() {
return true;
};
/**
Capability check that always returns false
@private
@static
@return {False}
*/
Runtime.capFalse = function() {
return false;
};
/**
Evaluate the expression to boolean value and create a function that always returns it.
@private
@static
@param {Mixed} expr Expression to evaluate
@return {Function} Function returning the result of evaluation
*/
Runtime.capTest = function(expr) {
return function() {
return !!expr;
};
};
return Runtime;
});
// Included from: src/javascript/runtime/RuntimeClient.js
/**
* RuntimeClient.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/RuntimeClient', [
'moxie/core/Exceptions',
'moxie/core/utils/Basic',
'moxie/runtime/Runtime'
], function(x, Basic, Runtime) {
/**
Set of methods and properties, required by a component to acquire ability to connect to a runtime
@class RuntimeClient
*/
return function RuntimeClient() {
var runtime;
Basic.extend(this, {
/**
Connects to the runtime specified by the options. Will either connect to existing runtime or create a new one.
Increments number of clients connected to the specified runtime.
@method connectRuntime
@param {Mixed} options Can be a runtme uid or a set of key-value pairs defining requirements and pre-requisites
*/
connectRuntime: function(options) {
var comp = this, ruid;
function initialize(items) {
var type, constructor;
// if we ran out of runtimes
if (!items.length) {
comp.trigger('RuntimeError', new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
runtime = null;
return;
}
type = items.shift();
constructor = Runtime.getConstructor(type);
if (!constructor) {
initialize(items);
return;
}
// try initializing the runtime
runtime = new constructor(options);
runtime.bind('Init', function() {
// mark runtime as initialized
runtime.initialized = true;
// jailbreak ...
setTimeout(function() {
runtime.clients++;
// this will be triggered on component
comp.trigger('RuntimeInit', runtime);
}, 1);
});
runtime.bind('Error', function() {
runtime.destroy(); // runtime cannot destroy itself from inside at a right moment, thus we do it here
initialize(items);
});
/*runtime.bind('Exception', function() { });*/
// check if runtime managed to pick-up operational mode
if (!runtime.mode) {
runtime.trigger('Error');
return;
}
runtime.init();
}
// check if a particular runtime was requested
if (Basic.typeOf(options) === 'string') {
ruid = options;
} else if (Basic.typeOf(options.ruid) === 'string') {
ruid = options.ruid;
}
if (ruid) {
runtime = Runtime.getRuntime(ruid);
if (runtime) {
runtime.clients++;
return runtime;
} else {
// there should be a runtime and there's none - weird case
throw new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR);
}
}
// initialize a fresh one, that fits runtime list and required features best
initialize((options.runtime_order || Runtime.order).split(/\s*,\s*/));
},
/**
Returns the runtime to which the client is currently connected.
@method getRuntime
@return {Runtime} Runtime or null if client is not connected
*/
getRuntime: function() {
if (runtime && runtime.uid) {
return runtime;
}
runtime = null; // make sure we do not leave zombies rambling around
return null;
},
/**
Disconnects from the runtime. Decrements number of clients connected to the specified runtime.
@method disconnectRuntime
*/
disconnectRuntime: function() {
if (runtime && --runtime.clients <= 0) {
runtime.destroy();
runtime = null;
}
}
});
};
});
// Included from: src/javascript/file/Blob.js
/**
* Blob.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/Blob', [
'moxie/core/utils/Basic',
'moxie/core/utils/Encode',
'moxie/runtime/RuntimeClient'
], function(Basic, Encode, RuntimeClient) {
var blobpool = {};
/**
@class Blob
@constructor
@param {String} ruid Unique id of the runtime, to which this blob belongs to
@param {Object} blob Object "Native" blob object, as it is represented in the runtime
*/
function Blob(ruid, blob) {
function _sliceDetached(start, end, type) {
var blob, data = blobpool[this.uid];
if (Basic.typeOf(data) !== 'string' || !data.length) {
return null; // or throw exception
}
blob = new Blob(null, {
type: type,
size: end - start
});
blob.detach(data.substr(start, blob.size));
return blob;
}
RuntimeClient.call(this);
if (ruid) {
this.connectRuntime(ruid);
}
if (!blob) {
blob = {};
} else if (Basic.typeOf(blob) === 'string') { // dataUrl or binary string
blob = { data: blob };
}
Basic.extend(this, {
/**
Unique id of the component
@property uid
@type {String}
*/
uid: blob.uid || Basic.guid('uid_'),
/**
Unique id of the connected runtime, if falsy, then runtime will have to be initialized
before this Blob can be used, modified or sent
@property ruid
@type {String}
*/
ruid: ruid,
/**
Size of blob
@property size
@type {Number}
@default 0
*/
size: blob.size || 0,
/**
Mime type of blob
@property type
@type {String}
@default ''
*/
type: blob.type || '',
/**
@method slice
@param {Number} [start=0]
*/
slice: function(start, end, type) {
if (this.isDetached()) {
return _sliceDetached.apply(this, arguments);
}
return this.getRuntime().exec.call(this, 'Blob', 'slice', this.getSource(), start, end, type);
},
/**
Returns "native" blob object (as it is represented in connected runtime) or null if not found
@method getSource
@return {Blob} Returns "native" blob object or null if not found
*/
getSource: function() {
if (!blobpool[this.uid]) {
return null;
}
return blobpool[this.uid];
},
/**
Detaches blob from any runtime that it depends on and initialize with standalone value
@method detach
@protected
@param {DOMString} [data=''] Standalone value
*/
detach: function(data) {
if (this.ruid) {
this.getRuntime().exec.call(this, 'Blob', 'destroy');
this.disconnectRuntime();
this.ruid = null;
}
data = data || '';
// if dataUrl, convert to binary string
var matches = data.match(/^data:([^;]*);base64,/);
if (matches) {
this.type = matches[1];
data = Encode.atob(data.substring(data.indexOf('base64,') + 7));
}
this.size = data.length;
blobpool[this.uid] = data;
},
/**
Checks if blob is standalone (detached of any runtime)
@method isDetached
@protected
@return {Boolean}
*/
isDetached: function() {
return !this.ruid && Basic.typeOf(blobpool[this.uid]) === 'string';
},
/**
Destroy Blob and free any resources it was using
@method destroy
*/
destroy: function() {
this.detach();
delete blobpool[this.uid];
}
});
if (blob.data) {
this.detach(blob.data); // auto-detach if payload has been passed
} else {
blobpool[this.uid] = blob;
}
}
return Blob;
});
// Included from: src/javascript/file/File.js
/**
* File.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/File', [
'moxie/core/utils/Basic',
'moxie/core/utils/Mime',
'moxie/file/Blob'
], function(Basic, Mime, Blob) {
/**
@class File
@extends Blob
@constructor
@param {String} ruid Unique id of the runtime, to which this blob belongs to
@param {Object} file Object "Native" file object, as it is represented in the runtime
*/
function File(ruid, file) {
var name, type;
if (!file) { // avoid extra errors in case we overlooked something
file = {};
}
// figure out the type
if (file.type && file.type !== '') {
type = file.type;
} else {
type = Mime.getFileMime(file.name);
}
// sanitize file name or generate new one
if (file.name) {
name = file.name.replace(/\\/g, '/');
name = name.substr(name.lastIndexOf('/') + 1);
} else {
var prefix = type.split('/')[0];
name = Basic.guid((prefix !== '' ? prefix : 'file') + '_');
if (Mime.extensions[type]) {
name += '.' + Mime.extensions[type][0]; // append proper extension if possible
}
}
Blob.apply(this, arguments);
Basic.extend(this, {
/**
File mime type
@property type
@type {String}
@default ''
*/
type: type || '',
/**
File name
@property name
@type {String}
@default UID
*/
name: name || Basic.guid('file_'),
/**
Relative path to the file inside a directory
@property relativePath
@type {String}
@default ''
*/
relativePath: '',
/**
Date of last modification
@property lastModifiedDate
@type {String}
@default now
*/
lastModifiedDate: file.lastModifiedDate || (new Date()).toLocaleString() // Thu Aug 23 2012 19:40:00 GMT+0400 (GET)
});
}
File.prototype = Blob.prototype;
return File;
});
// Included from: src/javascript/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileInput', [
'moxie/core/utils/Basic',
'moxie/core/utils/Mime',
'moxie/core/utils/Dom',
'moxie/core/Exceptions',
'moxie/core/EventTarget',
'moxie/core/I18n',
'moxie/file/File',
'moxie/runtime/Runtime',
'moxie/runtime/RuntimeClient'
], function(Basic, Mime, Dom, x, EventTarget, I18n, File, Runtime, RuntimeClient) {
/**
Provides a convenient way to create cross-browser file-picker. Generates file selection dialog on click,
converts selected files to _File_ objects, to be used in conjunction with _Image_, preloaded in memory
with _FileReader_ or uploaded to a server through _XMLHttpRequest_.
@class FileInput
@constructor
@extends EventTarget
@uses RuntimeClient
@param {Object|String|DOMElement} options If options is string or node, argument is considered as _browse\_button_.
@param {String|DOMElement} options.browse_button DOM Element to turn into file picker.
@param {Array} [options.accept] Array of mime types to accept. By default accepts all.
@param {String} [options.file='file'] Name of the file field (not the filename).
@param {Boolean} [options.multiple=false] Enable selection of multiple files.
@param {Boolean} [options.directory=false] Turn file input into the folder input (cannot be both at the same time).
@param {String|DOMElement} [options.container] DOM Element to use as a container for file-picker. Defaults to parentNode
for _browse\_button_.
@param {Object|String} [options.required_caps] Set of required capabilities, that chosen runtime must support.
@example
<div id="container">
<a id="file-picker" href="javascript:;">Browse...</a>
</div>
<script>
var fileInput = new mOxie.FileInput({
browse_button: 'file-picker', // or document.getElementById('file-picker')
container: 'container',
accept: [
{title: "Image files", extensions: "jpg,gif,png"} // accept only images
],
multiple: true // allow multiple file selection
});
fileInput.onchange = function(e) {
// do something to files array
console.info(e.target.files); // or this.files or fileInput.files
};
fileInput.init(); // initialize
</script>
*/
var dispatches = [
/**
Dispatched when runtime is connected and file-picker is ready to be used.
@event ready
@param {Object} event
*/
'ready',
/**
Dispatched right after [ready](#event_ready) event, and whenever [refresh()](#method_refresh) is invoked.
Check [corresponding documentation entry](#method_refresh) for more info.
@event refresh
@param {Object} event
*/
/**
Dispatched when selection of files in the dialog is complete.
@event change
@param {Object} event
*/
'change',
'cancel', // TODO: might be useful
/**
Dispatched when mouse cursor enters file-picker area. Can be used to style element
accordingly.
@event mouseenter
@param {Object} event
*/
'mouseenter',
/**
Dispatched when mouse cursor leaves file-picker area. Can be used to style element
accordingly.
@event mouseleave
@param {Object} event
*/
'mouseleave',
/**
Dispatched when functional mouse button is pressed on top of file-picker area.
@event mousedown
@param {Object} event
*/
'mousedown',
/**
Dispatched when functional mouse button is released on top of file-picker area.
@event mouseup
@param {Object} event
*/
'mouseup'
];
function FileInput(options) {
var self = this,
container, browseButton, defaults;
// if flat argument passed it should be browse_button id
if (Basic.inArray(Basic.typeOf(options), ['string', 'node']) !== -1) {
options = { browse_button : options };
}
// this will help us to find proper default container
browseButton = Dom.get(options.browse_button);
if (!browseButton) {
// browse button is required
throw new x.DOMException(x.DOMException.NOT_FOUND_ERR);
}
// figure out the options
defaults = {
accept: [{
title: I18n.translate('All Files'),
extensions: '*'
}],
name: 'file',
multiple: false,
required_caps: false,
container: browseButton.parentNode || document.body
};
options = Basic.extend({}, defaults, options);
// convert to object representation
if (typeof(options.required_caps) === 'string') {
options.required_caps = Runtime.parseCaps(options.required_caps);
}
// normalize accept option (could be list of mime types or array of title/extensions pairs)
if (typeof(options.accept) === 'string') {
options.accept = Mime.mimes2extList(options.accept);
}
container = Dom.get(options.container);
// make sure we have container
if (!container) {
container = document.body;
}
// make container relative, if it's not
if (Dom.getStyle(container, 'position') === 'static') {
container.style.position = 'relative';
}
container = browseButton = null; // IE
RuntimeClient.call(self);
Basic.extend(self, {
/**
Unique id of the component
@property uid
@protected
@readOnly
@type {String}
@default UID
*/
uid: Basic.guid('uid_'),
/**
Unique id of the connected runtime, if any.
@property ruid
@protected
@type {String}
*/
ruid: null,
/**
Unique id of the runtime container. Useful to get hold of it for various manipulations.
@property shimid
@protected
@type {String}
*/
shimid: null,
/**
Array of selected mOxie.File objects
@property files
@type {Array}
@default null
*/
files: null,
/**
Initializes the file-picker, connects it to runtime and dispatches event ready when done.
@method init
*/
init: function() {
self.convertEventPropsToHandlers(dispatches);
self.bind('RuntimeInit', function(e, runtime) {
self.ruid = runtime.uid;
self.shimid = runtime.shimid;
self.bind("Ready", function() {
self.trigger("Refresh");
}, 999);
self.bind("Change", function() {
var files = runtime.exec.call(self, 'FileInput', 'getFiles');
self.files = [];
Basic.each(files, function(file) {
// ignore empty files (IE10 for example hangs if you try to send them via XHR)
if (file.size === 0) {
return true;
}
self.files.push(new File(self.ruid, file));
});
}, 999);
// re-position and resize shim container
self.bind('Refresh', function() {
var pos, size, browseButton, shimContainer;
browseButton = Dom.get(options.browse_button);
shimContainer = Dom.get(runtime.shimid); // do not use runtime.getShimContainer(), since it will create container if it doesn't exist
if (browseButton) {
pos = Dom.getPos(browseButton, Dom.get(options.container));
size = Dom.getSize(browseButton);
if (shimContainer) {
Basic.extend(shimContainer.style, {
top : pos.y + 'px',
left : pos.x + 'px',
width : size.w + 'px',
height : size.h + 'px'
});
}
}
shimContainer = browseButton = null;
});
runtime.exec.call(self, 'FileInput', 'init', options);
});
// runtime needs: options.required_features, options.runtime_order and options.container
self.connectRuntime(Basic.extend({}, options, {
required_caps: {
select_file: true
}
}));
},
/**
Disables file-picker element, so that it doesn't react to mouse clicks.
@method disable
@param {Boolean} [state=true] Disable component if - true, enable if - false
*/
disable: function(state) {
var runtime = this.getRuntime();
if (runtime) {
runtime.exec.call(this, 'FileInput', 'disable', Basic.typeOf(state) === 'undefined' ? true : state);
}
},
/**
Reposition and resize dialog trigger to match the position and size of browse_button element.
@method refresh
*/
refresh: function() {
self.trigger("Refresh");
},
/**
Destroy component.
@method destroy
*/
destroy: function() {
var runtime = this.getRuntime();
if (runtime) {
runtime.exec.call(this, 'FileInput', 'destroy');
this.disconnectRuntime();
}
if (Basic.typeOf(this.files) === 'array') {
// no sense in leaving associated files behind
Basic.each(this.files, function(file) {
file.destroy();
});
}
this.files = null;
}
});
}
FileInput.prototype = EventTarget.instance;
return FileInput;
});
// Included from: src/javascript/runtime/RuntimeTarget.js
/**
* RuntimeTarget.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/RuntimeTarget', [
'moxie/core/utils/Basic',
'moxie/runtime/RuntimeClient',
"moxie/core/EventTarget"
], function(Basic, RuntimeClient, EventTarget) {
/**
Instance of this class can be used as a target for the events dispatched by shims,
when allowing them onto components is for either reason inappropriate
@class RuntimeTarget
@constructor
@protected
@extends EventTarget
*/
function RuntimeTarget() {
this.uid = Basic.guid('uid_');
RuntimeClient.call(this);
this.destroy = function() {
this.disconnectRuntime();
this.unbindAll();
};
}
RuntimeTarget.prototype = EventTarget.instance;
return RuntimeTarget;
});
// Included from: src/javascript/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileReader', [
'moxie/core/utils/Basic',
'moxie/core/utils/Encode',
'moxie/core/Exceptions',
'moxie/core/EventTarget',
'moxie/file/Blob',
'moxie/file/File',
'moxie/runtime/RuntimeTarget'
], function(Basic, Encode, x, EventTarget, Blob, File, RuntimeTarget) {
/**
Utility for preloading o.Blob/o.File objects in memory. By design closely follows [W3C FileReader](http://www.w3.org/TR/FileAPI/#dfn-filereader)
interface. Where possible uses native FileReader, where - not falls back to shims.
@class FileReader
@constructor FileReader
@extends EventTarget
@uses RuntimeClient
*/
var dispatches = [
/**
Dispatched when the read starts.
@event loadstart
@param {Object} event
*/
'loadstart',
/**
Dispatched while reading (and decoding) blob, and reporting partial Blob data (progess.loaded/progress.total).
@event progress
@param {Object} event
*/
'progress',
/**
Dispatched when the read has successfully completed.
@event load
@param {Object} event
*/
'load',
/**
Dispatched when the read has been aborted. For instance, by invoking the abort() method.
@event abort
@param {Object} event
*/
'abort',
/**
Dispatched when the read has failed.
@event error
@param {Object} event
*/
'error',
/**
Dispatched when the request has completed (either in success or failure).
@event loadend
@param {Object} event
*/
'loadend'
];
function FileReader() {
var self = this, _fr;
Basic.extend(this, {
/**
UID of the component instance.
@property uid
@type {String}
*/
uid: Basic.guid('uid_'),
/**
Contains current state of FileReader object. Can take values of FileReader.EMPTY, FileReader.LOADING
and FileReader.DONE.
@property readyState
@type {Number}
@default FileReader.EMPTY
*/
readyState: FileReader.EMPTY,
/**
Result of the successful read operation.
@property result
@type {String}
*/
result: null,
/**
Stores the error of failed asynchronous read operation.
@property error
@type {DOMError}
*/
error: null,
/**
Initiates reading of File/Blob object contents to binary string.
@method readAsBinaryString
@param {Blob|File} blob Object to preload
*/
readAsBinaryString: function(blob) {
_read.call(this, 'readAsBinaryString', blob);
},
/**
Initiates reading of File/Blob object contents to dataURL string.
@method readAsDataURL
@param {Blob|File} blob Object to preload
*/
readAsDataURL: function(blob) {
_read.call(this, 'readAsDataURL', blob);
},
/**
Initiates reading of File/Blob object contents to string.
@method readAsText
@param {Blob|File} blob Object to preload
*/
readAsText: function(blob) {
_read.call(this, 'readAsText', blob);
},
/**
Aborts preloading process.
@method abort
*/
abort: function() {
this.result = null;
if (Basic.inArray(this.readyState, [FileReader.EMPTY, FileReader.DONE]) !== -1) {
return;
} else if (this.readyState === FileReader.LOADING) {
this.readyState = FileReader.DONE;
}
if (_fr) {
_fr.getRuntime().exec.call(this, 'FileReader', 'abort');
}
this.trigger('abort');
this.trigger('loadend');
},
/**
Destroy component and release resources.
@method destroy
*/
destroy: function() {
this.abort();
if (_fr) {
_fr.getRuntime().exec.call(this, 'FileReader', 'destroy');
_fr.disconnectRuntime();
}
self = _fr = null;
}
});
function _read(op, blob) {
_fr = new RuntimeTarget();
function error(err) {
self.readyState = FileReader.DONE;
self.error = err;
self.trigger('error');
loadEnd();
}
function loadEnd() {
_fr.destroy();
_fr = null;
self.trigger('loadend');
}
function exec(runtime) {
_fr.bind('Error', function(e, err) {
error(err);
});
_fr.bind('Progress', function(e) {
self.result = runtime.exec.call(_fr, 'FileReader', 'getResult');
self.trigger(e);
});
_fr.bind('Load', function(e) {
self.readyState = FileReader.DONE;
self.result = runtime.exec.call(_fr, 'FileReader', 'getResult');
self.trigger(e);
loadEnd();
});
runtime.exec.call(_fr, 'FileReader', 'read', op, blob);
}
this.convertEventPropsToHandlers(dispatches);
if (this.readyState === FileReader.LOADING) {
return error(new x.DOMException(x.DOMException.INVALID_STATE_ERR));
}
this.readyState = FileReader.LOADING;
this.trigger('loadstart');
// if source is o.Blob/o.File
if (blob instanceof Blob) {
if (blob.isDetached()) {
var src = blob.getSource();
switch (op) {
case 'readAsText':
case 'readAsBinaryString':
this.result = src;
break;
case 'readAsDataURL':
this.result = 'data:' + blob.type + ';base64,' + Encode.btoa(src);
break;
}
this.readyState = FileReader.DONE;
this.trigger('load');
loadEnd();
} else {
exec(_fr.connectRuntime(blob.ruid));
}
} else {
error(new x.DOMException(x.DOMException.NOT_FOUND_ERR));
}
}
}
/**
Initial FileReader state
@property EMPTY
@type {Number}
@final
@static
@default 0
*/
FileReader.EMPTY = 0;
/**
FileReader switches to this state when it is preloading the source
@property LOADING
@type {Number}
@final
@static
@default 1
*/
FileReader.LOADING = 1;
/**
Preloading is complete, this is a final state
@property DONE
@type {Number}
@final
@static
@default 2
*/
FileReader.DONE = 2;
FileReader.prototype = EventTarget.instance;
return FileReader;
});
// Included from: src/javascript/core/utils/Url.js
/**
* Url.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Url', [], function() {
/**
Parse url into separate components and fill in absent parts with parts from current url,
based on https://raw.github.com/kvz/phpjs/master/functions/url/parse_url.js
@method parseUrl
@for Utils
@static
@param {String} url Url to parse (defaults to empty string if undefined)
@return {Object} Hash containing extracted uri components
*/
var parseUrl = function(url, currentUrl) {
var key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'fragment']
, i = key.length
, ports = {
http: 80,
https: 443
}
, uri = {}
, regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/
, m = regex.exec(url || '')
;
while (i--) {
if (m[i]) {
uri[key[i]] = m[i];
}
}
// when url is relative, we set the origin and the path ourselves
if (!uri.scheme) {
// come up with defaults
if (!currentUrl || typeof(currentUrl) === 'string') {
currentUrl = parseUrl(currentUrl || document.location.href);
}
uri.scheme = currentUrl.scheme;
uri.host = currentUrl.host;
uri.port = currentUrl.port;
var path = '';
// for urls without trailing slash we need to figure out the path
if (/^[^\/]/.test(uri.path)) {
path = currentUrl.path;
// if path ends with a filename, strip it
if (!/(\/|\/[^\.]+)$/.test(path)) {
path = path.replace(/\/[^\/]+$/, '/');
} else {
path += '/';
}
}
uri.path = path + (uri.path || ''); // site may reside at domain.com or domain.com/subdir
}
if (!uri.port) {
uri.port = ports[uri.scheme] || 80;
}
uri.port = parseInt(uri.port, 10);
if (!uri.path) {
uri.path = "/";
}
delete uri.source;
return uri;
};
/**
Resolve url - among other things will turn relative url to absolute
@method resolveUrl
@static
@param {String} url Either absolute or relative
@return {String} Resolved, absolute url
*/
var resolveUrl = function(url) {
var ports = { // we ignore default ports
http: 80,
https: 443
}
, urlp = parseUrl(url)
;
return urlp.scheme + '://' + urlp.host + (urlp.port !== ports[urlp.scheme] ? ':' + urlp.port : '') + urlp.path + (urlp.query ? urlp.query : '');
};
/**
Check if specified url has the same origin as the current document
@method hasSameOrigin
@param {String|Object} url
@return {Boolean}
*/
var hasSameOrigin = function(url) {
function origin(url) {
return [url.scheme, url.host, url.port].join('/');
}
if (typeof url === 'string') {
url = parseUrl(url);
}
return origin(parseUrl()) === origin(url);
};
return {
parseUrl: parseUrl,
resolveUrl: resolveUrl,
hasSameOrigin: hasSameOrigin
};
});
// Included from: src/javascript/file/FileReaderSync.js
/**
* FileReaderSync.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileReaderSync', [
'moxie/core/utils/Basic',
'moxie/runtime/RuntimeClient',
'moxie/core/utils/Encode'
], function(Basic, RuntimeClient, Encode) {
/**
Synchronous FileReader implementation. Something like this is available in WebWorkers environment, here
it can be used to read only preloaded blobs/files and only below certain size (not yet sure what that'd be,
but probably < 1mb). Not meant to be used directly by user.
@class FileReaderSync
@private
@constructor
*/
return function() {
RuntimeClient.call(this);
Basic.extend(this, {
uid: Basic.guid('uid_'),
readAsBinaryString: function(blob) {
return _read.call(this, 'readAsBinaryString', blob);
},
readAsDataURL: function(blob) {
return _read.call(this, 'readAsDataURL', blob);
},
/*readAsArrayBuffer: function(blob) {
return _read.call(this, 'readAsArrayBuffer', blob);
},*/
readAsText: function(blob) {
return _read.call(this, 'readAsText', blob);
}
});
function _read(op, blob) {
if (blob.isDetached()) {
var src = blob.getSource();
switch (op) {
case 'readAsBinaryString':
return src;
case 'readAsDataURL':
return 'data:' + blob.type + ';base64,' + Encode.btoa(src);
case 'readAsText':
var txt = '';
for (var i = 0, length = src.length; i < length; i++) {
txt += String.fromCharCode(src[i]);
}
return txt;
}
} else {
var result = this.connectRuntime(blob.ruid).exec.call(this, 'FileReaderSync', 'read', op, blob);
this.disconnectRuntime();
return result;
}
}
};
});
// Included from: src/javascript/xhr/FormData.js
/**
* FormData.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/xhr/FormData", [
"moxie/core/Exceptions",
"moxie/core/utils/Basic",
"moxie/file/Blob"
], function(x, Basic, Blob) {
/**
FormData
@class FormData
@constructor
*/
function FormData() {
var _blob, _fields = [];
Basic.extend(this, {
/**
Append another key-value pair to the FormData object
@method append
@param {String} name Name for the new field
@param {String|Blob|Array|Object} value Value for the field
*/
append: function(name, value) {
var self = this, valueType = Basic.typeOf(value);
// according to specs value might be either Blob or String
if (value instanceof Blob) {
_blob = {
name: name,
value: value // unfortunately we can only send single Blob in one FormData
};
} else if ('array' === valueType) {
name += '[]';
Basic.each(value, function(value) {
self.append(name, value);
});
} else if ('object' === valueType) {
Basic.each(value, function(value, key) {
self.append(name + '[' + key + ']', value);
});
} else if ('null' === valueType || 'undefined' === valueType || 'number' === valueType && isNaN(value)) {
self.append(name, "false");
} else {
_fields.push({
name: name,
value: value.toString()
});
}
},
/**
Checks if FormData contains Blob.
@method hasBlob
@return {Boolean}
*/
hasBlob: function() {
return !!this.getBlob();
},
/**
Retrieves blob.
@method getBlob
@return {Object} Either Blob if found or null
*/
getBlob: function() {
return _blob && _blob.value || null;
},
/**
Retrieves blob field name.
@method getBlobName
@return {String} Either Blob field name or null
*/
getBlobName: function() {
return _blob && _blob.name || null;
},
/**
Loop over the fields in FormData and invoke the callback for each of them.
@method each
@param {Function} cb Callback to call for each field
*/
each: function(cb) {
Basic.each(_fields, function(field) {
cb(field.value, field.name);
});
if (_blob) {
cb(_blob.value, _blob.name);
}
},
destroy: function() {
_blob = null;
_fields = [];
}
});
}
return FormData;
});
// Included from: src/javascript/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/xhr/XMLHttpRequest", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/core/EventTarget",
"moxie/core/utils/Encode",
"moxie/core/utils/Url",
"moxie/runtime/Runtime",
"moxie/runtime/RuntimeTarget",
"moxie/file/Blob",
"moxie/file/FileReaderSync",
"moxie/xhr/FormData",
"moxie/core/utils/Env",
"moxie/core/utils/Mime"
], function(Basic, x, EventTarget, Encode, Url, Runtime, RuntimeTarget, Blob, FileReaderSync, FormData, Env, Mime) {
var httpCode = {
100: 'Continue',
101: 'Switching Protocols',
102: 'Processing',
200: 'OK',
201: 'Created',
202: 'Accepted',
203: 'Non-Authoritative Information',
204: 'No Content',
205: 'Reset Content',
206: 'Partial Content',
207: 'Multi-Status',
226: 'IM Used',
300: 'Multiple Choices',
301: 'Moved Permanently',
302: 'Found',
303: 'See Other',
304: 'Not Modified',
305: 'Use Proxy',
306: 'Reserved',
307: 'Temporary Redirect',
400: 'Bad Request',
401: 'Unauthorized',
402: 'Payment Required',
403: 'Forbidden',
404: 'Not Found',
405: 'Method Not Allowed',
406: 'Not Acceptable',
407: 'Proxy Authentication Required',
408: 'Request Timeout',
409: 'Conflict',
410: 'Gone',
411: 'Length Required',
412: 'Precondition Failed',
413: 'Request Entity Too Large',
414: 'Request-URI Too Long',
415: 'Unsupported Media Type',
416: 'Requested Range Not Satisfiable',
417: 'Expectation Failed',
422: 'Unprocessable Entity',
423: 'Locked',
424: 'Failed Dependency',
426: 'Upgrade Required',
500: 'Internal Server Error',
501: 'Not Implemented',
502: 'Bad Gateway',
503: 'Service Unavailable',
504: 'Gateway Timeout',
505: 'HTTP Version Not Supported',
506: 'Variant Also Negotiates',
507: 'Insufficient Storage',
510: 'Not Extended'
};
function XMLHttpRequestUpload() {
this.uid = Basic.guid('uid_');
}
XMLHttpRequestUpload.prototype = EventTarget.instance;
/**
Implementation of XMLHttpRequest
@class XMLHttpRequest
@constructor
@uses RuntimeClient
@extends EventTarget
*/
var dispatches = ['loadstart', 'progress', 'abort', 'error', 'load', 'timeout', 'loadend']; // & readystatechange (for historical reasons)
var NATIVE = 1, RUNTIME = 2;
function XMLHttpRequest() {
var self = this,
// this (together with _p() @see below) is here to gracefully upgrade to setter/getter syntax where possible
props = {
/**
The amount of milliseconds a request can take before being terminated. Initially zero. Zero means there is no timeout.
@property timeout
@type Number
@default 0
*/
timeout: 0,
/**
Current state, can take following values:
UNSENT (numeric value 0)
The object has been constructed.
OPENED (numeric value 1)
The open() method has been successfully invoked. During this state request headers can be set using setRequestHeader() and the request can be made using the send() method.
HEADERS_RECEIVED (numeric value 2)
All redirects (if any) have been followed and all HTTP headers of the final response have been received. Several response members of the object are now available.
LOADING (numeric value 3)
The response entity body is being received.
DONE (numeric value 4)
@property readyState
@type Number
@default 0 (UNSENT)
*/
readyState: XMLHttpRequest.UNSENT,
/**
True when user credentials are to be included in a cross-origin request. False when they are to be excluded
in a cross-origin request and when cookies are to be ignored in its response. Initially false.
@property withCredentials
@type Boolean
@default false
*/
withCredentials: false,
/**
Returns the HTTP status code.
@property status
@type Number
@default 0
*/
status: 0,
/**
Returns the HTTP status text.
@property statusText
@type String
*/
statusText: "",
/**
Returns the response type. Can be set to change the response type. Values are:
the empty string (default), "arraybuffer", "blob", "document", "json", and "text".
@property responseType
@type String
*/
responseType: "",
/**
Returns the document response entity body.
Throws an "InvalidStateError" exception if responseType is not the empty string or "document".
@property responseXML
@type Document
*/
responseXML: null,
/**
Returns the text response entity body.
Throws an "InvalidStateError" exception if responseType is not the empty string or "text".
@property responseText
@type String
*/
responseText: null,
/**
Returns the response entity body (http://www.w3.org/TR/XMLHttpRequest/#response-entity-body).
Can become: ArrayBuffer, Blob, Document, JSON, Text
@property response
@type Mixed
*/
response: null
},
_async = true,
_url,
_method,
_headers = {},
_user,
_password,
_encoding = null,
_mimeType = null,
// flags
_sync_flag = false,
_send_flag = false,
_upload_events_flag = false,
_upload_complete_flag = false,
_error_flag = false,
_same_origin_flag = false,
// times
_start_time,
_timeoutset_time,
_finalMime = null,
_finalCharset = null,
_options = {},
_xhr,
_responseHeaders = '',
_responseHeadersBag
;
Basic.extend(this, props, {
/**
Unique id of the component
@property uid
@type String
*/
uid: Basic.guid('uid_'),
/**
Target for Upload events
@property upload
@type XMLHttpRequestUpload
*/
upload: new XMLHttpRequestUpload(),
/**
Sets the request method, request URL, synchronous flag, request username, and request password.
Throws a "SyntaxError" exception if one of the following is true:
method is not a valid HTTP method.
url cannot be resolved.
url contains the "user:password" format in the userinfo production.
Throws a "SecurityError" exception if method is a case-insensitive match for CONNECT, TRACE or TRACK.
Throws an "InvalidAccessError" exception if one of the following is true:
Either user or password is passed as argument and the origin of url does not match the XMLHttpRequest origin.
There is an associated XMLHttpRequest document and either the timeout attribute is not zero,
the withCredentials attribute is true, or the responseType attribute is not the empty string.
@method open
@param {String} method HTTP method to use on request
@param {String} url URL to request
@param {Boolean} [async=true] If false request will be done in synchronous manner. Asynchronous by default.
@param {String} [user] Username to use in HTTP authentication process on server-side
@param {String} [password] Password to use in HTTP authentication process on server-side
*/
open: function(method, url, async, user, password) {
var urlp;
// first two arguments are required
if (!method || !url) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 2 - check if any code point in method is higher than U+00FF or after deflating method it does not match the method
if (/[\u0100-\uffff]/.test(method) || Encode.utf8_encode(method) !== method) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 3
if (!!~Basic.inArray(method.toUpperCase(), ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'TRACE', 'TRACK'])) {
_method = method.toUpperCase();
}
// 4 - allowing these methods poses a security risk
if (!!~Basic.inArray(_method, ['CONNECT', 'TRACE', 'TRACK'])) {
throw new x.DOMException(x.DOMException.SECURITY_ERR);
}
// 5
url = Encode.utf8_encode(url);
// 6 - Resolve url relative to the XMLHttpRequest base URL. If the algorithm returns an error, throw a "SyntaxError".
urlp = Url.parseUrl(url);
_same_origin_flag = Url.hasSameOrigin(urlp);
// 7 - manually build up absolute url
_url = Url.resolveUrl(url);
// 9-10, 12-13
if ((user || password) && !_same_origin_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
_user = user || urlp.user;
_password = password || urlp.pass;
// 11
_async = async || true;
if (_async === false && (_p('timeout') || _p('withCredentials') || _p('responseType') !== "")) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 14 - terminate abort()
// 15 - terminate send()
// 18
_sync_flag = !_async;
_send_flag = false;
_headers = {};
_reset.call(this);
// 19
_p('readyState', XMLHttpRequest.OPENED);
// 20
this.convertEventPropsToHandlers(['readystatechange']); // unify event handlers
this.dispatchEvent('readystatechange');
},
/**
Appends an header to the list of author request headers, or if header is already
in the list of author request headers, combines its value with value.
Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set.
Throws a "SyntaxError" exception if header is not a valid HTTP header field name or if value
is not a valid HTTP header field value.
@method setRequestHeader
@param {String} header
@param {String|Number} value
*/
setRequestHeader: function(header, value) {
var uaHeaders = [ // these headers are controlled by the user agent
"accept-charset",
"accept-encoding",
"access-control-request-headers",
"access-control-request-method",
"connection",
"content-length",
"cookie",
"cookie2",
"content-transfer-encoding",
"date",
"expect",
"host",
"keep-alive",
"origin",
"referer",
"te",
"trailer",
"transfer-encoding",
"upgrade",
"user-agent",
"via"
];
// 1-2
if (_p('readyState') !== XMLHttpRequest.OPENED || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3
if (/[\u0100-\uffff]/.test(header) || Encode.utf8_encode(header) !== header) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 4
/* this step is seemingly bypassed in browsers, probably to allow various unicode characters in header values
if (/[\u0100-\uffff]/.test(value) || Encode.utf8_encode(value) !== value) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}*/
header = Basic.trim(header).toLowerCase();
// setting of proxy-* and sec-* headers is prohibited by spec
if (!!~Basic.inArray(header, uaHeaders) || /^(proxy\-|sec\-)/.test(header)) {
return false;
}
// camelize
// browsers lowercase header names (at least for custom ones)
// header = header.replace(/\b\w/g, function($1) { return $1.toUpperCase(); });
if (!_headers[header]) {
_headers[header] = value;
} else {
// http://tools.ietf.org/html/rfc2616#section-4.2 (last paragraph)
_headers[header] += ', ' + value;
}
return true;
},
/**
Returns all headers from the response, with the exception of those whose field name is Set-Cookie or Set-Cookie2.
@method getAllResponseHeaders
@return {String} reponse headers or empty string
*/
getAllResponseHeaders: function() {
return _responseHeaders || '';
},
/**
Returns the header field value from the response of which the field name matches header,
unless the field name is Set-Cookie or Set-Cookie2.
@method getResponseHeader
@param {String} header
@return {String} value(s) for the specified header or null
*/
getResponseHeader: function(header) {
header = header.toLowerCase();
if (_error_flag || !!~Basic.inArray(header, ['set-cookie', 'set-cookie2'])) {
return null;
}
if (_responseHeaders && _responseHeaders !== '') {
// if we didn't parse response headers until now, do it and keep for later
if (!_responseHeadersBag) {
_responseHeadersBag = {};
Basic.each(_responseHeaders.split(/\r\n/), function(line) {
var pair = line.split(/:\s+/);
if (pair.length === 2) { // last line might be empty, omit
pair[0] = Basic.trim(pair[0]); // just in case
_responseHeadersBag[pair[0].toLowerCase()] = { // simply to retain header name in original form
header: pair[0],
value: Basic.trim(pair[1])
};
}
});
}
if (_responseHeadersBag.hasOwnProperty(header)) {
return _responseHeadersBag[header].header + ': ' + _responseHeadersBag[header].value;
}
}
return null;
},
/**
Sets the Content-Type header for the response to mime.
Throws an "InvalidStateError" exception if the state is LOADING or DONE.
Throws a "SyntaxError" exception if mime is not a valid media type.
@method overrideMimeType
@param String mime Mime type to set
*/
overrideMimeType: function(mime) {
var matches, charset;
// 1
if (!!~Basic.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2
mime = Basic.trim(mime.toLowerCase());
if (/;/.test(mime) && (matches = mime.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))) {
mime = matches[1];
if (matches[2]) {
charset = matches[2];
}
}
if (!Mime.mimes[mime]) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 3-4
_finalMime = mime;
_finalCharset = charset;
},
/**
Initiates the request. The optional argument provides the request entity body.
The argument is ignored if request method is GET or HEAD.
Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set.
@method send
@param {Blob|Document|String|FormData} [data] Request entity body
@param {Object} [options] Set of requirements and pre-requisities for runtime initialization
*/
send: function(data, options) {
if (Basic.typeOf(options) === 'string') {
_options = { ruid: options };
} else if (!options) {
_options = {};
} else {
_options = options;
}
this.convertEventPropsToHandlers(dispatches);
this.upload.convertEventPropsToHandlers(dispatches);
// 1-2
if (this.readyState !== XMLHttpRequest.OPENED || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3
// sending Blob
if (data instanceof Blob) {
_options.ruid = data.ruid;
_mimeType = data.type || 'application/octet-stream';
}
// FormData
else if (data instanceof FormData) {
if (data.hasBlob()) {
var blob = data.getBlob();
_options.ruid = blob.ruid;
_mimeType = blob.type || 'application/octet-stream';
}
}
// DOMString
else if (typeof data === 'string') {
_encoding = 'UTF-8';
_mimeType = 'text/plain;charset=UTF-8';
// data should be converted to Unicode and encoded as UTF-8
data = Encode.utf8_encode(data);
}
// if withCredentials not set, but requested, set it automatically
if (!this.withCredentials) {
this.withCredentials = (_options.required_caps && _options.required_caps.send_browser_cookies) && !_same_origin_flag;
}
// 4 - storage mutex
// 5
_upload_events_flag = (!_sync_flag && this.upload.hasEventListener()); // DSAP
// 6
_error_flag = false;
// 7
_upload_complete_flag = !data;
// 8 - Asynchronous steps
if (!_sync_flag) {
// 8.1
_send_flag = true;
// 8.2
// this.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr
// 8.3
//if (!_upload_complete_flag) {
// this.upload.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr
//}
}
// 8.5 - Return the send() method call, but continue running the steps in this algorithm.
_doXHR.call(this, data);
},
/**
Cancels any network activity.
@method abort
*/
abort: function() {
_error_flag = true;
_sync_flag = false;
if (!~Basic.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED, XMLHttpRequest.DONE])) {
_p('readyState', XMLHttpRequest.DONE);
_send_flag = false;
if (_xhr) {
_xhr.getRuntime().exec.call(_xhr, 'XMLHttpRequest', 'abort', _upload_complete_flag);
} else {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
_upload_complete_flag = true;
} else {
_p('readyState', XMLHttpRequest.UNSENT);
}
},
destroy: function() {
if (_xhr) {
if (Basic.typeOf(_xhr.destroy) === 'function') {
_xhr.destroy();
}
_xhr = null;
}
this.unbindAll();
if (this.upload) {
this.upload.unbindAll();
this.upload = null;
}
}
});
/* this is nice, but maybe too lengthy
// if supported by JS version, set getters/setters for specific properties
o.defineProperty(this, 'readyState', {
configurable: false,
get: function() {
return _p('readyState');
}
});
o.defineProperty(this, 'timeout', {
configurable: false,
get: function() {
return _p('timeout');
},
set: function(value) {
if (_sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// timeout still should be measured relative to the start time of request
_timeoutset_time = (new Date).getTime();
_p('timeout', value);
}
});
// the withCredentials attribute has no effect when fetching same-origin resources
o.defineProperty(this, 'withCredentials', {
configurable: false,
get: function() {
return _p('withCredentials');
},
set: function(value) {
// 1-2
if (!~o.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED]) || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3-4
if (_anonymous_flag || _sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 5
_p('withCredentials', value);
}
});
o.defineProperty(this, 'status', {
configurable: false,
get: function() {
return _p('status');
}
});
o.defineProperty(this, 'statusText', {
configurable: false,
get: function() {
return _p('statusText');
}
});
o.defineProperty(this, 'responseType', {
configurable: false,
get: function() {
return _p('responseType');
},
set: function(value) {
// 1
if (!!~o.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2
if (_sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 3
_p('responseType', value.toLowerCase());
}
});
o.defineProperty(this, 'responseText', {
configurable: false,
get: function() {
// 1
if (!~o.inArray(_p('responseType'), ['', 'text'])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2-3
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return _p('responseText');
}
});
o.defineProperty(this, 'responseXML', {
configurable: false,
get: function() {
// 1
if (!~o.inArray(_p('responseType'), ['', 'document'])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2-3
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return _p('responseXML');
}
});
o.defineProperty(this, 'response', {
configurable: false,
get: function() {
if (!!~o.inArray(_p('responseType'), ['', 'text'])) {
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
return '';
}
}
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
return null;
}
return _p('response');
}
});
*/
function _p(prop, value) {
if (!props.hasOwnProperty(prop)) {
return;
}
if (arguments.length === 1) { // get
return Env.can('define_property') ? props[prop] : self[prop];
} else { // set
if (Env.can('define_property')) {
props[prop] = value;
} else {
self[prop] = value;
}
}
}
/*
function _toASCII(str, AllowUnassigned, UseSTD3ASCIIRules) {
// TODO: http://tools.ietf.org/html/rfc3490#section-4.1
return str.toLowerCase();
}
*/
function _doXHR(data) {
var self = this;
_start_time = new Date().getTime();
_xhr = new RuntimeTarget();
function loadEnd() {
if (_xhr) { // it could have been destroyed by now
_xhr.destroy();
_xhr = null;
}
self.dispatchEvent('loadend');
self = null;
}
function exec(runtime) {
_xhr.bind('LoadStart', function(e) {
_p('readyState', XMLHttpRequest.LOADING);
self.dispatchEvent('readystatechange');
self.dispatchEvent(e);
if (_upload_events_flag) {
self.upload.dispatchEvent(e);
}
});
_xhr.bind('Progress', function(e) {
if (_p('readyState') !== XMLHttpRequest.LOADING) {
_p('readyState', XMLHttpRequest.LOADING); // LoadStart unreliable (in Flash for example)
self.dispatchEvent('readystatechange');
}
self.dispatchEvent(e);
});
_xhr.bind('UploadProgress', function(e) {
if (_upload_events_flag) {
self.upload.dispatchEvent({
type: 'progress',
lengthComputable: false,
total: e.total,
loaded: e.loaded
});
}
});
_xhr.bind('Load', function(e) {
_p('readyState', XMLHttpRequest.DONE);
_p('status', Number(runtime.exec.call(_xhr, 'XMLHttpRequest', 'getStatus') || 0));
_p('statusText', httpCode[_p('status')] || "");
_p('response', runtime.exec.call(_xhr, 'XMLHttpRequest', 'getResponse', _p('responseType')));
if (!!~Basic.inArray(_p('responseType'), ['text', ''])) {
_p('responseText', _p('response'));
} else if (_p('responseType') === 'document') {
_p('responseXML', _p('response'));
}
_responseHeaders = runtime.exec.call(_xhr, 'XMLHttpRequest', 'getAllResponseHeaders');
self.dispatchEvent('readystatechange');
if (_p('status') > 0) { // status 0 usually means that server is unreachable
if (_upload_events_flag) {
self.upload.dispatchEvent(e);
}
self.dispatchEvent(e);
} else {
_error_flag = true;
self.dispatchEvent('error');
}
loadEnd();
});
_xhr.bind('Abort', function(e) {
self.dispatchEvent(e);
loadEnd();
});
_xhr.bind('Error', function(e) {
_error_flag = true;
_p('readyState', XMLHttpRequest.DONE);
self.dispatchEvent('readystatechange');
_upload_complete_flag = true;
self.dispatchEvent(e);
loadEnd();
});
runtime.exec.call(_xhr, 'XMLHttpRequest', 'send', {
url: _url,
method: _method,
async: _async,
user: _user,
password: _password,
headers: _headers,
mimeType: _mimeType,
encoding: _encoding,
responseType: self.responseType,
withCredentials: self.withCredentials,
options: _options
}, data);
}
// clarify our requirements
if (typeof(_options.required_caps) === 'string') {
_options.required_caps = Runtime.parseCaps(_options.required_caps);
}
_options.required_caps = Basic.extend({}, _options.required_caps, {
return_response_type: self.responseType
});
if (data instanceof FormData) {
_options.required_caps.send_multipart = true;
}
if (!_same_origin_flag) {
_options.required_caps.do_cors = true;
}
if (_options.ruid) { // we do not need to wait if we can connect directly
exec(_xhr.connectRuntime(_options));
} else {
_xhr.bind('RuntimeInit', function(e, runtime) {
exec(runtime);
});
_xhr.bind('RuntimeError', function(e, err) {
self.dispatchEvent('RuntimeError', err);
});
_xhr.connectRuntime(_options);
}
}
function _reset() {
_p('responseText', "");
_p('responseXML', null);
_p('response', null);
_p('status', 0);
_p('statusText', "");
_start_time = _timeoutset_time = null;
}
}
XMLHttpRequest.UNSENT = 0;
XMLHttpRequest.OPENED = 1;
XMLHttpRequest.HEADERS_RECEIVED = 2;
XMLHttpRequest.LOADING = 3;
XMLHttpRequest.DONE = 4;
XMLHttpRequest.prototype = EventTarget.instance;
return XMLHttpRequest;
});
// Included from: src/javascript/runtime/flash/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global ActiveXObject:true */
/**
Defines constructor for Flash runtime.
@class moxie/runtime/flash/Runtime
@private
*/
define("moxie/runtime/flash/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/utils/Env",
"moxie/core/utils/Dom",
"moxie/core/Exceptions",
"moxie/runtime/Runtime"
], function(Basic, Env, Dom, x, Runtime) {
var type = 'flash', extensions = {};
/**
Get the version of the Flash Player
@method getShimVersion
@private
@return {Number} Flash Player version
*/
function getShimVersion() {
var version;
try {
version = navigator.plugins['Shockwave Flash'];
version = version.description;
} catch (e1) {
try {
version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
} catch (e2) {
version = '0.0';
}
}
version = version.match(/\d+/g);
return parseFloat(version[0] + '.' + version[1]);
}
/**
Constructor for the Flash Runtime
@class FlashRuntime
@extends Runtime
*/
function FlashRuntime(options) {
var I = this, initTimer;
options = Basic.extend({ swf_url: Env.swf_url }, options);
Runtime.call(this, options, type, {
access_binary: function(value) {
return value && I.mode === 'browser';
},
access_image_binary: function(value) {
return value && I.mode === 'browser';
},
display_media: Runtime.capTrue,
do_cors: Runtime.capTrue,
drag_and_drop: false,
report_upload_progress: function() {
return I.mode === 'client';
},
resize_image: Runtime.capTrue,
return_response_headers: false,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) {
return true;
}
return !Basic.arrayDiff(responseType, ['', 'text', 'document']) || I.mode === 'browser';
},
return_status_code: function(code) {
return I.mode === 'browser' || !Basic.arrayDiff(code, [200, 404]);
},
select_file: Runtime.capTrue,
select_multiple: Runtime.capTrue,
send_binary_string: function(value) {
return value && I.mode === 'browser';
},
send_browser_cookies: function(value) {
return value && I.mode === 'browser';
},
send_custom_headers: function(value) {
return value && I.mode === 'browser';
},
send_multipart: Runtime.capTrue,
slice_blob: function(value) {
return value && I.mode === 'browser';
},
stream_upload: function(value) {
return value && I.mode === 'browser';
},
summon_file_dialog: false,
upload_filesize: function(size) {
return Basic.parseSizeStr(size) <= 2097152 || I.mode === 'client';
},
use_http_method: function(methods) {
return !Basic.arrayDiff(methods, ['GET', 'POST']);
}
}, {
// capabilities that require specific mode
access_binary: function(value) {
return value ? 'browser' : 'client';
},
access_image_binary: function(value) {
return value ? 'browser' : 'client';
},
report_upload_progress: function(value) {
return value ? 'browser' : 'client';
},
return_response_type: function(responseType) {
return Basic.arrayDiff(responseType, ['', 'text', 'json', 'document']) ? 'browser' : ['client', 'browser'];
},
return_status_code: function(code) {
return Basic.arrayDiff(code, [200, 404]) ? 'browser' : ['client', 'browser'];
},
send_binary_string: function(value) {
return value ? 'browser' : 'client';
},
send_browser_cookies: function(value) {
return value ? 'browser' : 'client';
},
send_custom_headers: function(value) {
return value ? 'browser' : 'client';
},
stream_upload: function(value) {
return value ? 'client' : 'browser';
},
upload_filesize: function(size) {
return Basic.parseSizeStr(size) >= 2097152 ? 'client' : 'browser';
}
}, 'client');
// minimal requirement for Flash Player version
if (getShimVersion() < 10) {
this.mode = false; // with falsy mode, runtime won't operable, no matter what the mode was before
}
Basic.extend(this, {
getShim: function() {
return Dom.get(this.uid);
},
shimExec: function(component, action) {
var args = [].slice.call(arguments, 2);
return I.getShim().exec(this.uid, component, action, args);
},
init: function() {
var html, el, container;
container = this.getShimContainer();
// if not the minimal height, shims are not initialized in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc)
Basic.extend(container.style, {
position: 'absolute',
top: '-8px',
left: '-8px',
width: '9px',
height: '9px',
overflow: 'hidden'
});
// insert flash object
html = '<object id="' + this.uid + '" type="application/x-shockwave-flash" data="' + options.swf_url + '" ';
if (Env.browser === 'IE') {
html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
}
html += 'width="100%" height="100%" style="outline:0">' +
'<param name="movie" value="' + options.swf_url + '" />' +
'<param name="flashvars" value="uid=' + escape(this.uid) + '&target=' + Env.global_event_dispatcher + '" />' +
'<param name="wmode" value="transparent" />' +
'<param name="allowscriptaccess" value="always" />' +
'</object>';
if (Env.browser === 'IE') {
el = document.createElement('div');
container.appendChild(el);
el.outerHTML = html;
el = container = null; // just in case
} else {
container.innerHTML = html;
}
// Init is dispatched by the shim
initTimer = setTimeout(function() {
if (I && !I.initialized) { // runtime might be already destroyed by this moment
I.trigger("Error", new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
}
}, 5000);
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
clearTimeout(initTimer); // initialization check might be still onwait
options = initTimer = destroy = I = null;
};
}(this.destroy))
}, extensions);
}
Runtime.addConstructor(type, FlashRuntime);
return extensions;
});
// Included from: src/javascript/runtime/flash/file/Blob.js
/**
* Blob.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/file/Blob
@private
*/
define("moxie/runtime/flash/file/Blob", [
"moxie/runtime/flash/Runtime",
"moxie/file/Blob"
], function(extensions, Blob) {
var FlashBlob = {
slice: function(blob, start, end, type) {
var self = this.getRuntime();
if (start < 0) {
start = Math.max(blob.size + start, 0);
} else if (start > 0) {
start = Math.min(start, blob.size);
}
if (end < 0) {
end = Math.max(blob.size + end, 0);
} else if (end > 0) {
end = Math.min(end, blob.size);
}
blob = self.shimExec.call(this, 'Blob', 'slice', start, end, type || '');
if (blob) {
blob = new Blob(self.uid, blob);
}
return blob;
}
};
return (extensions.Blob = FlashBlob);
});
// Included from: src/javascript/runtime/flash/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/file/FileInput
@private
*/
define("moxie/runtime/flash/file/FileInput", [
"moxie/runtime/flash/Runtime"
], function(extensions) {
var FileInput = {
init: function(options) {
this.getRuntime().shimExec.call(this, 'FileInput', 'init', {
name: options.name,
accept: options.accept,
multiple: options.multiple
});
this.trigger('ready');
}
};
return (extensions.FileInput = FileInput);
});
// Included from: src/javascript/runtime/flash/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/file/FileReader
@private
*/
define("moxie/runtime/flash/file/FileReader", [
"moxie/runtime/flash/Runtime",
"moxie/core/utils/Encode"
], function(extensions, Encode) {
var _result = '';
function _formatData(data, op) {
switch (op) {
case 'readAsText':
return Encode.atob(data, 'utf8');
case 'readAsBinaryString':
return Encode.atob(data);
case 'readAsDataURL':
return data;
}
return null;
}
var FileReader = {
read: function(op, blob) {
var target = this, self = target.getRuntime();
// special prefix for DataURL read mode
if (op === 'readAsDataURL') {
_result = 'data:' + (blob.type || '') + ';base64,';
}
target.bind('Progress', function(e, data) {
if (data) {
_result += _formatData(data, op);
}
});
return self.shimExec.call(this, 'FileReader', 'readAsBase64', blob.uid);
},
getResult: function() {
return _result;
},
destroy: function() {
_result = null;
}
};
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/flash/file/FileReaderSync.js
/**
* FileReaderSync.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/file/FileReaderSync
@private
*/
define("moxie/runtime/flash/file/FileReaderSync", [
"moxie/runtime/flash/Runtime",
"moxie/core/utils/Encode"
], function(extensions, Encode) {
function _formatData(data, op) {
switch (op) {
case 'readAsText':
return Encode.atob(data, 'utf8');
case 'readAsBinaryString':
return Encode.atob(data);
case 'readAsDataURL':
return data;
}
return null;
}
var FileReaderSync = {
read: function(op, blob) {
var result, self = this.getRuntime();
result = self.shimExec.call(this, 'FileReaderSync', 'readAsBase64', blob.uid);
if (!result) {
return null; // or throw ex
}
// special prefix for DataURL read mode
if (op === 'readAsDataURL') {
result = 'data:' + (blob.type || '') + ';base64,' + result;
}
return _formatData(result, op, blob.type);
}
};
return (extensions.FileReaderSync = FileReaderSync);
});
// Included from: src/javascript/runtime/Transporter.js
/**
* Transporter.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/runtime/Transporter", [
"moxie/core/utils/Basic",
"moxie/core/utils/Encode",
"moxie/runtime/RuntimeClient",
"moxie/core/EventTarget"
], function(Basic, Encode, RuntimeClient, EventTarget) {
function Transporter() {
var mod, _runtime, _data, _size, _pos, _chunk_size;
RuntimeClient.call(this);
Basic.extend(this, {
uid: Basic.guid('uid_'),
state: Transporter.IDLE,
result: null,
transport: function(data, type, options) {
var self = this;
options = Basic.extend({
chunk_size: 204798
}, options);
// should divide by three, base64 requires this
if ((mod = options.chunk_size % 3)) {
options.chunk_size += 3 - mod;
}
_chunk_size = options.chunk_size;
_reset.call(this);
_data = data;
_size = data.length;
if (Basic.typeOf(options) === 'string' || options.ruid) {
_run.call(self, type, this.connectRuntime(options));
} else {
// we require this to run only once
var cb = function(e, runtime) {
self.unbind("RuntimeInit", cb);
_run.call(self, type, runtime);
};
this.bind("RuntimeInit", cb);
this.connectRuntime(options);
}
},
abort: function() {
var self = this;
self.state = Transporter.IDLE;
if (_runtime) {
_runtime.exec.call(self, 'Transporter', 'clear');
self.trigger("TransportingAborted");
}
_reset.call(self);
},
destroy: function() {
this.unbindAll();
_runtime = null;
this.disconnectRuntime();
_reset.call(this);
}
});
function _reset() {
_size = _pos = 0;
_data = this.result = null;
}
function _run(type, runtime) {
var self = this;
_runtime = runtime;
//self.unbind("RuntimeInit");
self.bind("TransportingProgress", function(e) {
_pos = e.loaded;
if (_pos < _size && Basic.inArray(self.state, [Transporter.IDLE, Transporter.DONE]) === -1) {
_transport.call(self);
}
}, 999);
self.bind("TransportingComplete", function() {
_pos = _size;
self.state = Transporter.DONE;
_data = null; // clean a bit
self.result = _runtime.exec.call(self, 'Transporter', 'getAsBlob', type || '');
}, 999);
self.state = Transporter.BUSY;
self.trigger("TransportingStarted");
_transport.call(self);
}
function _transport() {
var self = this,
chunk,
bytesLeft = _size - _pos;
if (_chunk_size > bytesLeft) {
_chunk_size = bytesLeft;
}
chunk = Encode.btoa(_data.substr(_pos, _chunk_size));
_runtime.exec.call(self, 'Transporter', 'receive', chunk, _size);
}
}
Transporter.IDLE = 0;
Transporter.BUSY = 1;
Transporter.DONE = 2;
Transporter.prototype = EventTarget.instance;
return Transporter;
});
// Included from: src/javascript/runtime/flash/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/xhr/XMLHttpRequest
@private
*/
define("moxie/runtime/flash/xhr/XMLHttpRequest", [
"moxie/runtime/flash/Runtime",
"moxie/core/utils/Basic",
"moxie/file/Blob",
"moxie/file/File",
"moxie/file/FileReaderSync",
"moxie/xhr/FormData",
"moxie/runtime/Transporter"
], function(extensions, Basic, Blob, File, FileReaderSync, FormData, Transporter) {
var XMLHttpRequest = {
send: function(meta, data) {
var target = this, self = target.getRuntime();
function send() {
meta.transport = self.mode;
self.shimExec.call(target, 'XMLHttpRequest', 'send', meta, data);
}
function appendBlob(name, blob) {
self.shimExec.call(target, 'XMLHttpRequest', 'appendBlob', name, blob.uid);
data = null;
send();
}
function attachBlob(blob, cb) {
var tr = new Transporter();
tr.bind("TransportingComplete", function() {
cb(this.result);
});
tr.transport(blob.getSource(), blob.type, {
ruid: self.uid
});
}
// copy over the headers if any
if (!Basic.isEmptyObj(meta.headers)) {
Basic.each(meta.headers, function(value, header) {
self.shimExec.call(target, 'XMLHttpRequest', 'setRequestHeader', header, value.toString()); // Silverlight doesn't accept integers into the arguments of type object
});
}
// transfer over multipart params and blob itself
if (data instanceof FormData) {
var blobField;
data.each(function(value, name) {
if (value instanceof Blob) {
blobField = name;
} else {
self.shimExec.call(target, 'XMLHttpRequest', 'append', name, value);
}
});
if (!data.hasBlob()) {
data = null;
send();
} else {
var blob = data.getBlob();
if (blob.isDetached()) {
attachBlob(blob, function(attachedBlob) {
blob.destroy();
appendBlob(blobField, attachedBlob);
});
} else {
appendBlob(blobField, blob);
}
}
} else if (data instanceof Blob) {
if (data.isDetached()) {
attachBlob(data, function(attachedBlob) {
data.destroy();
data = attachedBlob.uid;
send();
});
} else {
data = data.uid;
send();
}
} else {
send();
}
},
getResponse: function(responseType) {
var frs, blob, self = this.getRuntime();
blob = self.shimExec.call(this, 'XMLHttpRequest', 'getResponseAsBlob');
if (blob) {
blob = new File(self.uid, blob);
if ('blob' === responseType) {
return blob;
}
try {
frs = new FileReaderSync();
if (!!~Basic.inArray(responseType, ["", "text"])) {
return frs.readAsText(blob);
} else if ('json' === responseType && !!window.JSON) {
return JSON.parse(frs.readAsText(blob));
}
} finally {
blob.destroy();
}
}
return null;
},
abort: function(upload_complete_flag) {
var self = this.getRuntime();
self.shimExec.call(this, 'XMLHttpRequest', 'abort');
this.dispatchEvent('readystatechange');
// this.dispatchEvent('progress');
this.dispatchEvent('abort');
//if (!upload_complete_flag) {
// this.dispatchEvent('uploadprogress');
//}
}
};
return (extensions.XMLHttpRequest = XMLHttpRequest);
});
// Included from: src/javascript/runtime/html4/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global File:true */
/**
Defines constructor for HTML4 runtime.
@class moxie/runtime/html4/Runtime
@private
*/
define("moxie/runtime/html4/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/Runtime",
"moxie/core/utils/Env"
], function(Basic, x, Runtime, Env) {
var type = 'html4', extensions = {};
function Html4Runtime(options) {
var I = this
, Test = Runtime.capTest
, True = Runtime.capTrue
;
Runtime.call(this, options, type, {
access_binary: Test(window.FileReader || window.File && File.getAsDataURL),
access_image_binary: false,
display_media: Test(extensions.Image && (Env.can('create_canvas') || Env.can('use_data_uri_over32kb'))),
do_cors: false,
drag_and_drop: false,
filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest
return (Env.browser === 'Chrome' && Env.version >= 28) || (Env.browser === 'IE' && Env.version >= 10);
}()),
resize_image: function() {
return extensions.Image && I.can('access_binary') && Env.can('create_canvas');
},
report_upload_progress: false,
return_response_headers: false,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) {
return true;
}
return !!~Basic.inArray(responseType, ['text', 'document', '']);
},
return_status_code: function(code) {
return !Basic.arrayDiff(code, [200, 404]);
},
select_file: function() {
return Env.can('use_fileinput');
},
select_multiple: false,
send_binary_string: false,
send_custom_headers: false,
send_multipart: true,
slice_blob: false,
stream_upload: function() {
return I.can('select_file');
},
summon_file_dialog: Test(function() { // yeah... some dirty sniffing here...
return (Env.browser === 'Firefox' && Env.version >= 4) ||
(Env.browser === 'Opera' && Env.version >= 12) ||
!!~Basic.inArray(Env.browser, ['Chrome', 'Safari']);
}()),
upload_filesize: True,
use_http_method: function(methods) {
return !Basic.arrayDiff(methods, ['GET', 'POST']);
}
});
Basic.extend(this, {
init : function() {
this.trigger("Init");
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
destroy = I = null;
};
}(this.destroy))
});
Basic.extend(this.getShim(), extensions);
}
Runtime.addConstructor(type, Html4Runtime);
return extensions;
});
// Included from: src/javascript/core/utils/Events.js
/**
* Events.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Events', [
'moxie/core/utils/Basic'
], function(Basic) {
var eventhash = {}, uid = 'moxie_' + Basic.guid();
// IE W3C like event funcs
function preventDefault() {
this.returnValue = false;
}
function stopPropagation() {
this.cancelBubble = true;
}
/**
Adds an event handler to the specified object and store reference to the handler
in objects internal Plupload registry (@see removeEvent).
@method addEvent
@for Utils
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Name to add event listener to.
@param {Function} callback Function to call when event occurs.
@param {String} [key] that might be used to add specifity to the event record.
*/
var addEvent = function(obj, name, callback, key) {
var func, events;
name = name.toLowerCase();
// Add event listener
if (obj.addEventListener) {
func = callback;
obj.addEventListener(name, func, false);
} else if (obj.attachEvent) {
func = function() {
var evt = window.event;
if (!evt.target) {
evt.target = evt.srcElement;
}
evt.preventDefault = preventDefault;
evt.stopPropagation = stopPropagation;
callback(evt);
};
obj.attachEvent('on' + name, func);
}
// Log event handler to objects internal mOxie registry
if (!obj[uid]) {
obj[uid] = Basic.guid();
}
if (!eventhash.hasOwnProperty(obj[uid])) {
eventhash[obj[uid]] = {};
}
events = eventhash[obj[uid]];
if (!events.hasOwnProperty(name)) {
events[name] = [];
}
events[name].push({
func: func,
orig: callback, // store original callback for IE
key: key
});
};
/**
Remove event handler from the specified object. If third argument (callback)
is not specified remove all events with the specified name.
@method removeEvent
@static
@param {Object} obj DOM element to remove event listener(s) from.
@param {String} name Name of event listener to remove.
@param {Function|String} [callback] might be a callback or unique key to match.
*/
var removeEvent = function(obj, name, callback) {
var type, undef;
name = name.toLowerCase();
if (obj[uid] && eventhash[obj[uid]] && eventhash[obj[uid]][name]) {
type = eventhash[obj[uid]][name];
} else {
return;
}
for (var i = type.length - 1; i >= 0; i--) {
// undefined or not, key should match
if (type[i].orig === callback || type[i].key === callback) {
if (obj.removeEventListener) {
obj.removeEventListener(name, type[i].func, false);
} else if (obj.detachEvent) {
obj.detachEvent('on'+name, type[i].func);
}
type[i].orig = null;
type[i].func = null;
type.splice(i, 1);
// If callback was passed we are done here, otherwise proceed
if (callback !== undef) {
break;
}
}
}
// If event array got empty, remove it
if (!type.length) {
delete eventhash[obj[uid]][name];
}
// If mOxie registry has become empty, remove it
if (Basic.isEmptyObj(eventhash[obj[uid]])) {
delete eventhash[obj[uid]];
// IE doesn't let you remove DOM object property with - delete
try {
delete obj[uid];
} catch(e) {
obj[uid] = undef;
}
}
};
/**
Remove all kind of events from the specified object
@method removeAllEvents
@static
@param {Object} obj DOM element to remove event listeners from.
@param {String} [key] unique key to match, when removing events.
*/
var removeAllEvents = function(obj, key) {
if (!obj || !obj[uid]) {
return;
}
Basic.each(eventhash[obj[uid]], function(events, name) {
removeEvent(obj, name, key);
});
};
return {
addEvent: addEvent,
removeEvent: removeEvent,
removeAllEvents: removeAllEvents
};
});
// Included from: src/javascript/runtime/html4/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/file/FileInput
@private
*/
define("moxie/runtime/html4/file/FileInput", [
"moxie/runtime/html4/Runtime",
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/utils/Events",
"moxie/core/utils/Mime",
"moxie/core/utils/Env"
], function(extensions, Basic, Dom, Events, Mime, Env) {
function FileInput() {
var _uid, _files = [], _mimes = [], _options;
function addInput() {
var comp = this, I = comp.getRuntime(), shimContainer, browseButton, currForm, form, input, uid;
uid = Basic.guid('uid_');
shimContainer = I.getShimContainer(); // we get new ref everytime to avoid memory leaks in IE
if (_uid) { // move previous form out of the view
currForm = Dom.get(_uid + '_form');
if (currForm) {
Basic.extend(currForm.style, { top: '100%' });
}
}
// build form in DOM, since innerHTML version not able to submit file for some reason
form = document.createElement('form');
form.setAttribute('id', uid + '_form');
form.setAttribute('method', 'post');
form.setAttribute('enctype', 'multipart/form-data');
form.setAttribute('encoding', 'multipart/form-data');
Basic.extend(form.style, {
overflow: 'hidden',
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%'
});
input = document.createElement('input');
input.setAttribute('id', uid);
input.setAttribute('type', 'file');
input.setAttribute('name', _options.name || 'Filedata');
input.setAttribute('accept', _mimes.join(','));
Basic.extend(input.style, {
fontSize: '999px',
opacity: 0
});
form.appendChild(input);
shimContainer.appendChild(form);
// prepare file input to be placed underneath the browse_button element
Basic.extend(input.style, {
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%'
});
if (Env.browser === 'IE' && Env.version < 10) {
Basic.extend(input.style, {
filter : "progid:DXImageTransform.Microsoft.Alpha(opacity=0)"
});
}
input.onchange = function() { // there should be only one handler for this
var file;
if (!this.value) {
return;
}
if (this.files) {
file = this.files[0];
} else {
file = {
name: this.value
};
}
_files = [file];
this.onchange = function() {}; // clear event handler
addInput.call(comp);
// after file is initialized as o.File, we need to update form and input ids
comp.bind('change', function onChange() {
var input = Dom.get(uid), form = Dom.get(uid + '_form'), file;
comp.unbind('change', onChange);
if (comp.files.length && input && form) {
file = comp.files[0];
input.setAttribute('id', file.uid);
form.setAttribute('id', file.uid + '_form');
// set upload target
form.setAttribute('target', file.uid + '_iframe');
}
input = form = null;
}, 998);
input = form = null;
comp.trigger('change');
};
// route click event to the input
if (I.can('summon_file_dialog')) {
browseButton = Dom.get(_options.browse_button);
Events.removeEvent(browseButton, 'click', comp.uid);
Events.addEvent(browseButton, 'click', function(e) {
if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file]
input.click();
}
e.preventDefault();
}, comp.uid);
}
_uid = uid;
shimContainer = currForm = browseButton = null;
}
Basic.extend(this, {
init: function(options) {
var comp = this, I = comp.getRuntime(), shimContainer;
// figure out accept string
_options = options;
_mimes = options.accept.mimes || Mime.extList2mimes(options.accept, I.can('filter_by_extension'));
shimContainer = I.getShimContainer();
(function() {
var browseButton, zIndex, top;
browseButton = Dom.get(options.browse_button);
// Route click event to the input[type=file] element for browsers that support such behavior
if (I.can('summon_file_dialog')) {
if (Dom.getStyle(browseButton, 'position') === 'static') {
browseButton.style.position = 'relative';
}
zIndex = parseInt(Dom.getStyle(browseButton, 'z-index'), 10) || 1;
browseButton.style.zIndex = zIndex;
shimContainer.style.zIndex = zIndex - 1;
}
/* Since we have to place input[type=file] on top of the browse_button for some browsers,
browse_button loses interactivity, so we restore it here */
top = I.can('summon_file_dialog') ? browseButton : shimContainer;
Events.addEvent(top, 'mouseover', function() {
comp.trigger('mouseenter');
}, comp.uid);
Events.addEvent(top, 'mouseout', function() {
comp.trigger('mouseleave');
}, comp.uid);
Events.addEvent(top, 'mousedown', function() {
comp.trigger('mousedown');
}, comp.uid);
Events.addEvent(Dom.get(options.container), 'mouseup', function() {
comp.trigger('mouseup');
}, comp.uid);
browseButton = null;
}());
addInput.call(this);
shimContainer = null;
// trigger ready event asynchronously
comp.trigger({
type: 'ready',
async: true
});
},
getFiles: function() {
return _files;
},
disable: function(state) {
var input;
if ((input = Dom.get(_uid))) {
input.disabled = !!state;
}
},
destroy: function() {
var I = this.getRuntime()
, shim = I.getShim()
, shimContainer = I.getShimContainer()
;
Events.removeAllEvents(shimContainer, this.uid);
Events.removeAllEvents(_options && Dom.get(_options.container), this.uid);
Events.removeAllEvents(_options && Dom.get(_options.browse_button), this.uid);
if (shimContainer) {
shimContainer.innerHTML = '';
}
shim.removeInstance(this.uid);
_uid = _files = _mimes = _options = shimContainer = shim = null;
}
});
}
return (extensions.FileInput = FileInput);
});
// Included from: src/javascript/runtime/html5/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global File:true */
/**
Defines constructor for HTML5 runtime.
@class moxie/runtime/html5/Runtime
@private
*/
define("moxie/runtime/html5/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/Runtime",
"moxie/core/utils/Env"
], function(Basic, x, Runtime, Env) {
var type = "html5", extensions = {};
function Html5Runtime(options) {
var I = this
, Test = Runtime.capTest
, True = Runtime.capTrue
;
var caps = Basic.extend({
access_binary: Test(window.FileReader || window.File && window.File.getAsDataURL),
access_image_binary: function() {
return I.can('access_binary') && !!extensions.Image;
},
display_media: Test(Env.can('create_canvas') || Env.can('use_data_uri_over32kb')),
do_cors: Test(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),
drag_and_drop: Test(function() {
// this comes directly from Modernizr: http://www.modernizr.com/
var div = document.createElement('div');
// IE has support for drag and drop since version 5, but doesn't support dropping files from desktop
return (('draggable' in div) || ('ondragstart' in div && 'ondrop' in div)) && (Env.browser !== 'IE' || Env.version > 9);
}()),
filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest
return (Env.browser === 'Chrome' && Env.version >= 28) || (Env.browser === 'IE' && Env.version >= 10);
}()),
return_response_headers: True,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) { // we can fake this one even if it's not supported
return true;
}
return Env.can('return_response_type', responseType);
},
return_status_code: True,
report_upload_progress: Test(window.XMLHttpRequest && new XMLHttpRequest().upload),
resize_image: function() {
return I.can('access_binary') && Env.can('create_canvas');
},
select_file: function() {
return Env.can('use_fileinput') && window.File;
},
select_folder: function() {
return I.can('select_file') && Env.browser === 'Chrome' && Env.version >= 21;
},
select_multiple: function() {
// it is buggy on Safari Windows and iOS
return I.can('select_file') &&
!(Env.browser === 'Safari' && Env.os === 'Windows') &&
!(Env.os === 'iOS' && Env.verComp(Env.osVersion, "7.0.4", '<'));
},
send_binary_string: Test(window.XMLHttpRequest && (new XMLHttpRequest().sendAsBinary || (window.Uint8Array && window.ArrayBuffer))),
send_custom_headers: Test(window.XMLHttpRequest),
send_multipart: function() {
return !!(window.XMLHttpRequest && new XMLHttpRequest().upload && window.FormData) || I.can('send_binary_string');
},
slice_blob: Test(window.File && (File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice)),
stream_upload: function(){
return I.can('slice_blob') && I.can('send_multipart');
},
summon_file_dialog: Test(function() { // yeah... some dirty sniffing here...
return (Env.browser === 'Firefox' && Env.version >= 4) ||
(Env.browser === 'Opera' && Env.version >= 12) ||
(Env.browser === 'IE' && Env.version >= 10) ||
!!~Basic.inArray(Env.browser, ['Chrome', 'Safari']);
}()),
upload_filesize: True
},
arguments[2]
);
Runtime.call(this, options, (arguments[1] || type), caps);
Basic.extend(this, {
init : function() {
this.trigger("Init");
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
destroy = I = null;
};
}(this.destroy))
});
Basic.extend(this.getShim(), extensions);
}
Runtime.addConstructor(type, Html5Runtime);
return extensions;
});
// Included from: src/javascript/runtime/html5/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/file/FileReader
@private
*/
define("moxie/runtime/html5/file/FileReader", [
"moxie/runtime/html5/Runtime",
"moxie/core/utils/Encode",
"moxie/core/utils/Basic"
], function(extensions, Encode, Basic) {
function FileReader() {
var _fr, _convertToBinary = false;
Basic.extend(this, {
read: function(op, blob) {
var target = this;
_fr = new window.FileReader();
_fr.addEventListener('progress', function(e) {
target.trigger(e);
});
_fr.addEventListener('load', function(e) {
target.trigger(e);
});
_fr.addEventListener('error', function(e) {
target.trigger(e, _fr.error);
});
_fr.addEventListener('loadend', function() {
_fr = null;
});
if (Basic.typeOf(_fr[op]) === 'function') {
_convertToBinary = false;
_fr[op](blob.getSource());
} else if (op === 'readAsBinaryString') { // readAsBinaryString is depricated in general and never existed in IE10+
_convertToBinary = true;
_fr.readAsDataURL(blob.getSource());
}
},
getResult: function() {
return _fr && _fr.result ? (_convertToBinary ? _toBinary(_fr.result) : _fr.result) : null;
},
abort: function() {
if (_fr) {
_fr.abort();
}
},
destroy: function() {
_fr = null;
}
});
function _toBinary(str) {
return Encode.atob(str.substring(str.indexOf('base64,') + 7));
}
}
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/html4/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/file/FileReader
@private
*/
define("moxie/runtime/html4/file/FileReader", [
"moxie/runtime/html4/Runtime",
"moxie/runtime/html5/file/FileReader"
], function(extensions, FileReader) {
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/html4/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/xhr/XMLHttpRequest
@private
*/
define("moxie/runtime/html4/xhr/XMLHttpRequest", [
"moxie/runtime/html4/Runtime",
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/utils/Url",
"moxie/core/Exceptions",
"moxie/core/utils/Events",
"moxie/file/Blob",
"moxie/xhr/FormData"
], function(extensions, Basic, Dom, Url, x, Events, Blob, FormData) {
function XMLHttpRequest() {
var _status, _response, _iframe;
function cleanup(cb) {
var target = this, uid, form, inputs, i, hasFile = false;
if (!_iframe) {
return;
}
uid = _iframe.id.replace(/_iframe$/, '');
form = Dom.get(uid + '_form');
if (form) {
inputs = form.getElementsByTagName('input');
i = inputs.length;
while (i--) {
switch (inputs[i].getAttribute('type')) {
case 'hidden':
inputs[i].parentNode.removeChild(inputs[i]);
break;
case 'file':
hasFile = true; // flag the case for later
break;
}
}
inputs = [];
if (!hasFile) { // we need to keep the form for sake of possible retries
form.parentNode.removeChild(form);
}
form = null;
}
// without timeout, request is marked as canceled (in console)
setTimeout(function() {
Events.removeEvent(_iframe, 'load', target.uid);
if (_iframe.parentNode) { // #382
_iframe.parentNode.removeChild(_iframe);
}
// check if shim container has any other children, if - not, remove it as well
var shimContainer = target.getRuntime().getShimContainer();
if (!shimContainer.children.length) {
shimContainer.parentNode.removeChild(shimContainer);
}
shimContainer = _iframe = null;
cb();
}, 1);
}
Basic.extend(this, {
send: function(meta, data) {
var target = this, I = target.getRuntime(), uid, form, input, blob;
_status = _response = null;
function createIframe() {
var container = I.getShimContainer() || document.body
, temp = document.createElement('div')
;
// IE 6 won't be able to set the name using setAttribute or iframe.name
temp.innerHTML = '<iframe id="' + uid + '_iframe" name="' + uid + '_iframe" src="javascript:""" style="display:none"></iframe>';
_iframe = temp.firstChild;
container.appendChild(_iframe);
/* _iframe.onreadystatechange = function() {
console.info(_iframe.readyState);
};*/
Events.addEvent(_iframe, 'load', function() { // _iframe.onload doesn't work in IE lte 8
var el;
try {
el = _iframe.contentWindow.document || _iframe.contentDocument || window.frames[_iframe.id].document;
// try to detect some standard error pages
if (/^4(0[0-9]|1[0-7]|2[2346])\s/.test(el.title)) { // test if title starts with 4xx HTTP error
_status = el.title.replace(/^(\d+).*$/, '$1');
} else {
_status = 200;
// get result
_response = Basic.trim(el.body.innerHTML);
// we need to fire these at least once
target.trigger({
type: 'progress',
loaded: _response.length,
total: _response.length
});
if (blob) { // if we were uploading a file
target.trigger({
type: 'uploadprogress',
loaded: blob.size || 1025,
total: blob.size || 1025
});
}
}
} catch (ex) {
if (Url.hasSameOrigin(meta.url)) {
// if response is sent with error code, iframe in IE gets redirected to res://ieframe.dll/http_x.htm
// which obviously results to cross domain error (wtf?)
_status = 404;
} else {
cleanup.call(target, function() {
target.trigger('error');
});
return;
}
}
cleanup.call(target, function() {
target.trigger('load');
});
}, target.uid);
} // end createIframe
// prepare data to be sent and convert if required
if (data instanceof FormData && data.hasBlob()) {
blob = data.getBlob();
uid = blob.uid;
input = Dom.get(uid);
form = Dom.get(uid + '_form');
if (!form) {
throw new x.DOMException(x.DOMException.NOT_FOUND_ERR);
}
} else {
uid = Basic.guid('uid_');
form = document.createElement('form');
form.setAttribute('id', uid + '_form');
form.setAttribute('method', meta.method);
form.setAttribute('enctype', 'multipart/form-data');
form.setAttribute('encoding', 'multipart/form-data');
form.setAttribute('target', uid + '_iframe');
I.getShimContainer().appendChild(form);
}
if (data instanceof FormData) {
data.each(function(value, name) {
if (value instanceof Blob) {
if (input) {
input.setAttribute('name', name);
}
} else {
var hidden = document.createElement('input');
Basic.extend(hidden, {
type : 'hidden',
name : name,
value : value
});
// make sure that input[type="file"], if it's there, comes last
if (input) {
form.insertBefore(hidden, input);
} else {
form.appendChild(hidden);
}
}
});
}
// set destination url
form.setAttribute("action", meta.url);
createIframe();
form.submit();
target.trigger('loadstart');
},
getStatus: function() {
return _status;
},
getResponse: function(responseType) {
if ('json' === responseType) {
// strip off <pre>..</pre> tags that might be enclosing the response
if (Basic.typeOf(_response) === 'string' && !!window.JSON) {
try {
return JSON.parse(_response.replace(/^\s*<pre[^>]*>/, '').replace(/<\/pre>\s*$/, ''));
} catch (ex) {
return null;
}
}
} else if ('document' === responseType) {
}
return _response;
},
abort: function() {
var target = this;
if (_iframe && _iframe.contentWindow) {
if (_iframe.contentWindow.stop) { // FireFox/Safari/Chrome
_iframe.contentWindow.stop();
} else if (_iframe.contentWindow.document.execCommand) { // IE
_iframe.contentWindow.document.execCommand('Stop');
} else {
_iframe.src = "about:blank";
}
}
cleanup.call(this, function() {
// target.dispatchEvent('readystatechange');
target.dispatchEvent('abort');
});
}
});
}
return (extensions.XMLHttpRequest = XMLHttpRequest);
});
// Included from: src/javascript/runtime/silverlight/Runtime.js
/**
* RunTime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global ActiveXObject:true */
/**
Defines constructor for Silverlight runtime.
@class moxie/runtime/silverlight/Runtime
@private
*/
define("moxie/runtime/silverlight/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/utils/Env",
"moxie/core/utils/Dom",
"moxie/core/Exceptions",
"moxie/runtime/Runtime"
], function(Basic, Env, Dom, x, Runtime) {
var type = "silverlight", extensions = {};
function isInstalled(version) {
var isVersionSupported = false, control = null, actualVer,
actualVerArray, reqVerArray, requiredVersionPart, actualVersionPart, index = 0;
try {
try {
control = new ActiveXObject('AgControl.AgControl');
if (control.IsVersionSupported(version)) {
isVersionSupported = true;
}
control = null;
} catch (e) {
var plugin = navigator.plugins["Silverlight Plug-In"];
if (plugin) {
actualVer = plugin.description;
if (actualVer === "1.0.30226.2") {
actualVer = "2.0.30226.2";
}
actualVerArray = actualVer.split(".");
while (actualVerArray.length > 3) {
actualVerArray.pop();
}
while ( actualVerArray.length < 4) {
actualVerArray.push(0);
}
reqVerArray = version.split(".");
while (reqVerArray.length > 4) {
reqVerArray.pop();
}
do {
requiredVersionPart = parseInt(reqVerArray[index], 10);
actualVersionPart = parseInt(actualVerArray[index], 10);
index++;
} while (index < reqVerArray.length && requiredVersionPart === actualVersionPart);
if (requiredVersionPart <= actualVersionPart && !isNaN(requiredVersionPart)) {
isVersionSupported = true;
}
}
}
} catch (e2) {
isVersionSupported = false;
}
return isVersionSupported;
}
/**
Constructor for the Silverlight Runtime
@class SilverlightRuntime
@extends Runtime
*/
function SilverlightRuntime(options) {
var I = this, initTimer;
options = Basic.extend({ xap_url: Env.xap_url }, options);
Runtime.call(this, options, type, {
access_binary: Runtime.capTrue,
access_image_binary: Runtime.capTrue,
display_media: Runtime.capTrue,
do_cors: Runtime.capTrue,
drag_and_drop: false,
report_upload_progress: Runtime.capTrue,
resize_image: Runtime.capTrue,
return_response_headers: function(value) {
return value && I.mode === 'client';
},
return_response_type: function(responseType) {
if (responseType !== 'json') {
return true;
} else {
return !!window.JSON;
}
},
return_status_code: function(code) {
return I.mode === 'client' || !Basic.arrayDiff(code, [200, 404]);
},
select_file: Runtime.capTrue,
select_multiple: Runtime.capTrue,
send_binary_string: Runtime.capTrue,
send_browser_cookies: function(value) {
return value && I.mode === 'browser';
},
send_custom_headers: function(value) {
return value && I.mode === 'client';
},
send_multipart: Runtime.capTrue,
slice_blob: Runtime.capTrue,
stream_upload: true,
summon_file_dialog: false,
upload_filesize: Runtime.capTrue,
use_http_method: function(methods) {
return I.mode === 'client' || !Basic.arrayDiff(methods, ['GET', 'POST']);
}
}, {
// capabilities that require specific mode
return_response_headers: function(value) {
return value ? 'client' : 'browser';
},
return_status_code: function(code) {
return Basic.arrayDiff(code, [200, 404]) ? 'client' : ['client', 'browser'];
},
send_browser_cookies: function(value) {
return value ? 'browser' : 'client';
},
send_custom_headers: function(value) {
return value ? 'client' : 'browser';
},
use_http_method: function(methods) {
return Basic.arrayDiff(methods, ['GET', 'POST']) ? 'client' : ['client', 'browser'];
}
});
// minimal requirement
if (!isInstalled('2.0.31005.0') || Env.browser === 'Opera') {
this.mode = false;
}
Basic.extend(this, {
getShim: function() {
return Dom.get(this.uid).content.Moxie;
},
shimExec: function(component, action) {
var args = [].slice.call(arguments, 2);
return I.getShim().exec(this.uid, component, action, args);
},
init : function() {
var container;
container = this.getShimContainer();
container.innerHTML = '<object id="' + this.uid + '" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">' +
'<param name="source" value="' + options.xap_url + '"/>' +
'<param name="background" value="Transparent"/>' +
'<param name="windowless" value="true"/>' +
'<param name="enablehtmlaccess" value="true"/>' +
'<param name="initParams" value="uid=' + this.uid + ',target=' + Env.global_event_dispatcher + '"/>' +
'</object>';
// Init is dispatched by the shim
initTimer = setTimeout(function() {
if (I && !I.initialized) { // runtime might be already destroyed by this moment
I.trigger("Error", new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
}
}, Env.OS !== 'Windows'? 10000 : 5000); // give it more time to initialize in non Windows OS (like Mac)
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
clearTimeout(initTimer); // initialization check might be still onwait
options = initTimer = destroy = I = null;
};
}(this.destroy))
}, extensions);
}
Runtime.addConstructor(type, SilverlightRuntime);
return extensions;
});
// Included from: src/javascript/runtime/silverlight/file/Blob.js
/**
* Blob.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/file/Blob
@private
*/
define("moxie/runtime/silverlight/file/Blob", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/file/Blob"
], function(extensions, Basic, Blob) {
return (extensions.Blob = Basic.extend({}, Blob));
});
// Included from: src/javascript/runtime/silverlight/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/file/FileInput
@private
*/
define("moxie/runtime/silverlight/file/FileInput", [
"moxie/runtime/silverlight/Runtime"
], function(extensions) {
var FileInput = {
init: function(options) {
function toFilters(accept) {
var filter = '';
for (var i = 0; i < accept.length; i++) {
filter += (filter !== '' ? '|' : '') + accept[i].title + " | *." + accept[i].extensions.replace(/,/g, ';*.');
}
return filter;
}
this.getRuntime().shimExec.call(this, 'FileInput', 'init', toFilters(options.accept), options.name, options.multiple);
this.trigger('ready');
}
};
return (extensions.FileInput = FileInput);
});
// Included from: src/javascript/runtime/silverlight/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/file/FileReader
@private
*/
define("moxie/runtime/silverlight/file/FileReader", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/file/FileReader"
], function(extensions, Basic, FileReader) {
return (extensions.FileReader = Basic.extend({}, FileReader));
});
// Included from: src/javascript/runtime/silverlight/file/FileReaderSync.js
/**
* FileReaderSync.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/file/FileReaderSync
@private
*/
define("moxie/runtime/silverlight/file/FileReaderSync", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/file/FileReaderSync"
], function(extensions, Basic, FileReaderSync) {
return (extensions.FileReaderSync = Basic.extend({}, FileReaderSync));
});
// Included from: src/javascript/runtime/silverlight/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/xhr/XMLHttpRequest
@private
*/
define("moxie/runtime/silverlight/xhr/XMLHttpRequest", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/xhr/XMLHttpRequest"
], function(extensions, Basic, XMLHttpRequest) {
return (extensions.XMLHttpRequest = Basic.extend({}, XMLHttpRequest));
});
expose(["moxie/core/utils/Basic","moxie/core/I18n","moxie/core/utils/Mime","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/file/File","moxie/file/FileInput","moxie/runtime/RuntimeTarget","moxie/file/FileReader","moxie/core/utils/Url","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/core/utils/Events"]);
})(this);/**
* o.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global moxie:true */
/**
Globally exposed namespace with the most frequently used public classes and handy methods.
@class o
@static
@private
*/
(function(exports) {
"use strict";
var o = {}, inArray = exports.moxie.core.utils.Basic.inArray;
// directly add some public classes
// (we do it dynamically here, since for custom builds we cannot know beforehand what modules were included)
(function addAlias(ns) {
var name, itemType;
for (name in ns) {
itemType = typeof(ns[name]);
if (itemType === 'object' && !~inArray(name, ['Exceptions', 'Env', 'Mime'])) {
addAlias(ns[name]);
} else if (itemType === 'function') {
o[name] = ns[name];
}
}
})(exports.moxie);
// add some manually
o.Env = exports.moxie.core.utils.Env;
o.Mime = exports.moxie.core.utils.Mime;
o.Exceptions = exports.moxie.core.Exceptions;
// expose globally
exports.mOxie = o;
if (!exports.o) {
exports.o = o;
}
return o;
})(this);
|
blueocean-material-icons/src/js/components/svg-icons/action/supervisor-account.js
|
jenkinsci/blueocean-plugin
|
import React from 'react';
import SvgIcon from '../../SvgIcon';
const ActionSupervisorAccount = (props) => (
<SvgIcon {...props}>
<path d="M16.5 12c1.38 0 2.49-1.12 2.49-2.5S17.88 7 16.5 7C15.12 7 14 8.12 14 9.5s1.12 2.5 2.5 2.5zM9 11c1.66 0 2.99-1.34 2.99-3S10.66 5 9 5C7.34 5 6 6.34 6 8s1.34 3 3 3zm7.5 3c-1.83 0-5.5.92-5.5 2.75V19h11v-2.25c0-1.83-3.67-2.75-5.5-2.75zM9 13c-2.33 0-7 1.17-7 3.5V19h7v-2.25c0-.85.33-2.34 2.37-3.47C10.5 13.1 9.66 13 9 13z"/>
</SvgIcon>
);
ActionSupervisorAccount.displayName = 'ActionSupervisorAccount';
ActionSupervisorAccount.muiName = 'SvgIcon';
export default ActionSupervisorAccount;
|
src/svg-icons/communication/screen-share.js
|
kittyjumbalaya/material-components-web
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let CommunicationScreenShare = (props) => (
<SvgIcon {...props}>
<path d="M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.11-.9-2-2-2H4c-1.11 0-2 .89-2 2v10c0 1.1.89 2 2 2H0v2h24v-2h-4zm-7-3.53v-2.19c-2.78 0-4.61.85-6 2.72.56-2.67 2.11-5.33 6-5.87V7l4 3.73-4 3.74z"/>
</SvgIcon>
);
CommunicationScreenShare = pure(CommunicationScreenShare);
CommunicationScreenShare.displayName = 'CommunicationScreenShare';
CommunicationScreenShare.muiName = 'SvgIcon';
export default CommunicationScreenShare;
|
Example/fadetoogle/__tests__/index.ios.js
|
franfran/react-native-fade-toogle
|
import 'react-native';
import React from 'react';
import Index from '../index.ios.js';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
const tree = renderer.create(
<Index />
);
});
|
public/search_react.js
|
viktorkh/elastickit_express
|
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { extend } from 'lodash';
import './index.css';
import {
SearchkitManager, SearchkitProvider, Searchkit,
SearchBox, RefinementListFilter, Pagination, Hits,
HierarchicalMenuFilter, HitsStats, SortingSelector, NoHits,
ResetFilters, RangeFilter, NumericRefinementListFilter,
ViewSwitcherHits, ViewSwitcherToggle, DynamicRangeFilter,
InputFilter, GroupedSelectedFilters, SelectedFilters,
InitialLoader, PaginationSelect, CheckboxFilter, TermQuery,
Panel, ImmutableQuery, QueryString, Layout, TopBar, LayoutBody, LayoutResults,
ActionBar, ActionBarRow, SideBar
} from 'searchkit';
const host = "https://vm-amelastic.clicksoftware.com:9200/ent_index,tfs_index,documentation_v8_3_patch010_index,attach_index,domino_index/";
const searchkit = new SearchkitManager(host);
//import BurgerMenu from 'react-burger-menu';
var Menu = require('react-burger-menu').slide;
//var Menu = BurgerMenu.slide;
const customQueryBuilder = (query, options) => {
return {
"bool": {
"should": [
{
"query_string": {
"query": query,
"fields": ["id", "body", "replies.records.body", "repro_Steps", "description", "title^2", "wikiId", "casenumber", "comments.body", "wikiTags.product"]
}
}
]
}
}
}
class MovieHitsTable extends React.Component {
render() {
const { hits } = this.props;
const _hits = this.props.hits;
var count = this.props.hits.filter(function (v) { return v._score === 1 });
var isQueryEmpty = false;
var _wikiSpaceKey = "";
if (count.length == this.props.hits.length) {
isQueryEmpty = true;
document.getElementsByClassName('sk-action-bar-row')[0].style.display = "none";
document.getElementsByClassName('sk-pagination-navigation')[0].style.display = "none";
}
else {
document.getElementsByClassName('sk-action-bar-row')[0].style.display = "block";
document.getElementsByClassName('sk-pagination-navigation')[0].style.display = "block";
}
var wikiNumber = "";
return (
<div className="divResultList">
{isQueryEmpty ? <span> </span> : (
<span>
{this.props.hits.map(function (hit, i) {
var _isAttach = false;
var _isCase = false;
var _downloads = false;
var _caseId = "https://cases.clicksoftware.com/casesview/case?id=";
var _attachUrl = "https://cksw.my.salesforce.com/";
var _desc = "";
if (hit._source.caseNumber && hit._source.type == 'case') {
wikiNumber = hit._source.caseNumber;
_caseId = _caseId + hit._id;
_isCase = true;
} else
if (hit._source.caseNumber && hit._source.type == 'case_attachments') {
wikiNumber = hit._source.caseNumber;
_caseId = _caseId + hit._source.parentId;
_isAttach = true;
_attachUrl = "https://cksw.my.salesforce.com/" + hit._id;
}
else
if (hit._source.type == 'downloads') {
_downloads = true;
wikiNumber = "";
}
else {
wikiNumber = hit._id;
}
if (hit._source.wikiSpaceKey && (hit._source.wikiSpaceKey == 'PUBC9D' || hit._source.wikiSpaceKey == 'PUBSSUD')) {
_desc = "(SE Documentation)";
} else if (hit._source.caseNumber && hit._source.type == 'case_attachments') {
_desc = "";
}
else if (hit._source.type == 'downloads') {
_desc = "(Clicksoftware " + hit._source.type + ")";
}
else if (hit._source.type == 'implementation_forum') {
_desc = "(Implementation forum)";
}
else {
_desc = "(" + hit._source.type + ") - " + wikiNumber
}
return <div key={i}>
<span>
{hit._source.caseNumber && _isAttach ? (
<a href={hit._source.url} target="_blank" key={i}>
<h3 key={i}>Attachment in Case: {hit._source.caseNumber}
<br />
{hit.highlight && hit.highlight.title ? (
<span>
{hit.highlight.title.map(function (_highlight, j) {
return <div key={j}><span key={j} dangerouslySetInnerHTML={{ __html: _highlight }} /></div>
})}
</span>)
: <span>{hit._source.title}</span>}
</h3>
({hit._source.name})
<span className="spanTypeResult">{_desc}</span>
</a>
) : (
<a href={hit._source.url} target="_blank" key={i}>
<h3 key={i}>
{hit.highlight && hit.highlight.title ? (
<span>
{hit.highlight.title.map(function (_highlight, j) {
return <div key={j}><span key={j} dangerouslySetInnerHTML={{ __html: _highlight }} /></div>
})}
</span>)
: <span>{hit._source.title}</span>}
</h3>
<span className="spanTypeResult">{_desc}</span>
</a>
)}
</span>
<div>
{hit.highlight && hit.highlight.body ? (
<span>
{hit.highlight.body.map(function (_highlight, j) {
return <div key={j}><span key={j} dangerouslySetInnerHTML={{ __html: _highlight }} /></div>
})}
</span>)
: (<span> </span>)}
</div>
<div>
{hit.highlight && hit.highlight.repro_Steps ? (
<span>
{hit.highlight.repro_Steps.map(function (_highlight, j) {
return <div key={j}><span key={j} dangerouslySetInnerHTML={{ __html: _highlight }} /></div>
})}
</span>)
: (<span> </span>)}
</div>
<div>
{hit.highlight && hit.highlight['comments.body'] ? (
<span>
{hit.highlight['comments.body'].map(function (_highlight1, d) {
return <div key={d}><span key={d} dangerouslySetInnerHTML={{ __html: _highlight1 }} /></div>
})}
</span>)
: (<span> </span>)}
</div>
<div>
{hit.highlight && hit.highlight['replies.records.body'] ? (
<span>
{hit.highlight['replies.records.body'].map(function (_highlight1, d) {
return <div key={d}><span key={d} dangerouslySetInnerHTML={{ __html: _highlight1 }} /></div>
})}
</span>)
: (<span> </span>)}
</div>
<div>
{hit.highlight && hit.highlight['name'] ? (
<span>
{hit.highlight['name'].map(function (_highlight1, d) {
return <div key={d}><span key={d} dangerouslySetInnerHTML={{ __html: _highlight1 }} /></div>
})}
</span>)
: (<span> </span>)}
</div>
<span>
{hit._source.caseNumber && _isCase ? (
<div>
<span className="span_open_case"><a href={hit._source.url} target="_blank" key={i}>open case</a> </span>
<span className="span_open_portal"><a href={_caseId} target="_blank" >open in portal</a> </span>
</div>)
: (<span> </span>)}
</span>
<span>
{hit._source.caseNumber && _isAttach ? (
<div>
<span className="span_open_case"><a href={hit._source.url} target="_blank" key={i}>open case in sfdc</a> </span>
<span className="span_open_portal"><a href={_attachUrl} target="_blank" >open attachment in sfdc</a> </span>
<span className="span_open_portal"><a href={_caseId} target="_blank" >open case in portal</a> </span>
</div>)
: (<span> </span>)}
</span>
<br />
</div>
;
})}
</span>
)}
</div>
);
}
}
class App extends Component {
render() {
return (
<SearchkitProvider searchkit={searchkit}>
<Layout>
<TopBar>
<SearchBox
placeholder="Search here ..."
autofocus={true} queryBuilder={customQueryBuilder}
searchOnChange={false}
prefixQueryFields={["id^1", "body", "title^2", "repro_Steps", "name", "replies.records.body",
"repro_steps", "description", "comments", "wikiId", "comments.commentId^1",
"caseNumber^1", "comments.body"]} />
</TopBar>
<LayoutBody>
<Menu left isOpen={false} >
<a className="helpLink" target="_blank" href="https://wiki.clicksoftware.com/display/IWI/Elastic+Search+Syntax+Help">Help</a>
<br />
<RefinementListFilter
id="typeId"
title="Types"
field="type"
operator="OR"
size={10} />
<InputFilter
id="Id_unique_search"
title="ID Search "
placeholder="Search by ID"
searchOnChange={true}
prefixQueryFields={["wikiId^1", "id", "caseNumber"]}
queryFields={["wikiId", "id", "caseNumber"]} />
<RefinementListFilter
field="tag_product_not_an"
title="Product"
operator="OR"
size={5}
id="productTagsId" />
<RefinementListFilter
field="tag_hub_not_an"
title="Hub"
operator="OR"
size={5}
id="hubTagsId" />
<RefinementListFilter
field="tag_version_not_an"
title="Version"
operator="OR"
size={5}
id="versionTagsId" />
<Panel title="TFS refinement" collapsable={true} defaultCollapsed={true}>
<HierarchicalMenuFilter size={999}
fields={["product_not_an", "area_path_not_an", "state_not_an"]} title=" " id="area_Path_id"
/>
</Panel>
</Menu>
<LayoutResults>
<div className="divLogoClass"><img id="logo" src="logo.png" /></div>
<ActionBar>
<ActionBarRow>
<HitsStats />
</ActionBarRow>
<ActionBarRow>
<GroupedSelectedFilters />
<ResetFilters />
</ActionBarRow>
</ActionBar>
<Pagination className={"testClass"} showNumbers={true} />
<div>
<Hits hitsPerPage={10} highlightFields={["title", "body", "repro_Steps", "repro_steps", "description", "comments.body", "name", "replies.records.body"]}
sourceFilter={["title", "application_name", "name", "extension_type", "url", "comments.body",
"comments", "id", "repro_Steps", "repro_steps", "wikiSpaceKey", "parentId", "replies.records.body",
"wikiSpace", "comments.commentId", "type", "casenumber", "caseNumber"]}
listComponent={MovieHitsTable}
/>
</div>
<NoHits />
</LayoutResults>
</LayoutBody>
</Layout>
</SearchkitProvider>
);
}
}
export default App;
|
src/server/render.js
|
HarelDavid/AdFriendCoupon
|
import React from 'react'
import ReactDOMServer from 'react-dom/server'
import { match, RouterContext } from 'react-router'
import { Provider } from 'mobx-react'
import fetchData from './helpers/fetchData'
import Html from '../client/containers/shared/Html.jsx'
import {createServerState} from '../client/state'
import createRoutes from '../client/routes'
// Get actions object
import actions from '../client/actions'
import admin from 'firebase-admin';
// Handles page rendering ( for isomorphic / server-side-rendering too )
//----------------------
export default (req, res) => {
var urlOnly = req.originalUrl.split("?")[0];
var couponId = urlOnly.split("coupon/")[1];
return admin.database().ref(`/coupons/${couponId}`).once('value').then((snapshot) => {
var coupon = snapshot.val();
return coupon;
})
.then((coupon) => {
var state = {};
state.host = req.headers.host
// Prepare for routing
let matchRoutes = {
routes : createRoutes(),
location: req.originalUrl
}
// Route
match(matchRoutes, (error, redirectLocation, renderProps) => {
if (error) return res.status(500).send(error.message)
if (redirectLocation) return res.redirect(302, redirectLocation.pathname + redirectLocation.handleInput)
if (!renderProps) return res.status(404).send('404 Not found')
let statusCode = renderProps.routes[1].path !== '*' ? 200 : 404 // Check for "Not Found" page ( in this case we have path "*" ) and use code 404 if that's the case
return fetchData(renderProps, coupon, actions).then(() => {
const content = ReactDOMServer.renderToStaticMarkup(<Provider state={state} coupon={coupon} actions={actions} ><Html><RouterContext {...renderProps}/></Html></Provider>)
return res.status(statusCode).send('<!DOCTYPE html>\n' + content)
}).catch((err) => {
res.status(400).send('400: An error has occured : ' + err)
})
})
})
}
|
src/components/Layout/SearchDrawer/SearchBox/presenter.js
|
ndlib/usurper
|
import React from 'react'
import PropTypes from 'prop-types'
import SearchOptionList from '../SearchOptionList'
import 'static/css/global.css'
import 'static/css/search.css'
const SearchBox = (props) => {
return (
<span
className='uSearchBox'
style={{ display: props.visible ? 'grid' : 'none' }}
>
<label>
<ul id='searchAction'>
<li
id='selected-search'
onClick={props.onClick}
onKeyDown={props.dropdownOnKeyDown}
tabIndex='0'
role='listbox'
aria-expanded={props.search.searchBoxOpen}
>
<span
className='screen-reader-only'
id='label-for-current-search-selector'
>Select a search option. Your current search option is
</span>
<p
className='current-search'
aria-labelledby='label-for-current-search-selector'
>{props.currentSearch.title}
</p>
</li>
<SearchOptionList {...props} />
</ul>
</label>
<div className='input'>
<span
className='screen-reader-only'
id={`label-for-${props.id}`}
>Search in {props.currentSearch.title}
</span>
<input
id={props.id}
type='search'
role='searchbox'
name='q'
defaultValue={props.defaultSearch}
onBlur={props.onBlur}
onKeyDown={props.inputOnKeyDown}
aria-labelledby={`label-for-${props.id}`}
autoComplete='off'
data-lpignore
/>
</div>
<button onClick={props.onSubmit}>Search</button>
</span>
)
}
SearchBox.propTypes = {
currentSearch: PropTypes.object.isRequired,
defaultSearch: PropTypes.string,
onClick: PropTypes.func,
dropdownOnKeyDown: PropTypes.func,
inputOnKeyDown: PropTypes.func,
onBlur: PropTypes.func,
onSubmit: PropTypes.func.isRequired,
search: PropTypes.shape({
searchBoxOpen: PropTypes.bool,
}),
visible: PropTypes.bool,
id: PropTypes.string.isRequired,
}
export default SearchBox
|
pages/api/icon.js
|
Kagami/material-ui
|
import 'docs/src/modules/components/bootstrap';
// --- Post bootstrap -----
import React from 'react';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import markdown from './icon.md';
function Page() {
return <MarkdownDocs markdown={markdown} />;
}
export default Page;
|
src/ZulipMobile.js
|
kunall17/zulip-mobile
|
/* @flow */
import React from 'react';
import { Sentry } from 'react-native-sentry';
import '../vendor/intl/intl';
import config from './config';
import StoreProvider from './boot/StoreProvider';
import TranslationProvider from './boot/TranslationProvider';
import StylesProvider from './boot/StylesProvider';
import CompatibilityChecker from './boot/CompatibilityChecker';
import AppEventHandlers from './boot/AppEventHandlers';
import AppDataFetcher from './boot/AppDataFetcher';
import AppWithNavigationState from './nav/AppWithNavigationState';
require('./i18n/locale');
// console.disableYellowBox = true; // eslint-disable-line
if (config.enableSentry) {
Sentry.config(config.sentryKey, { deactivateStacktraceMerging: true }).install();
}
export default () => (
<CompatibilityChecker>
<StoreProvider>
<AppEventHandlers>
<AppDataFetcher>
<TranslationProvider>
<StylesProvider>
<AppWithNavigationState />
</StylesProvider>
</TranslationProvider>
</AppDataFetcher>
</AppEventHandlers>
</StoreProvider>
</CompatibilityChecker>
);
|
ajax/libs/angular.js/0.9.3/angular-scenario.min.js
|
bspaulding/cdnjs
|
/*!
* jQuery JavaScript Library v1.4.2
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2010, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Sat Feb 13 22:33:48 2010 -0500
*/
(function(aM,C){var a=function(aY,aZ){return new a.fn.init(aY,aZ)},n=aM.jQuery,R=aM.$,ab=aM.document,X,P=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,aW=/^.[^:#\[\.,]*$/,ax=/\S/,M=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,e=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,b=navigator.userAgent,u,K=false,ad=[],aG,at=Object.prototype.toString,ap=Object.prototype.hasOwnProperty,g=Array.prototype.push,F=Array.prototype.slice,s=Array.prototype.indexOf;a.fn=a.prototype={init:function(aY,a1){var a0,a2,aZ,a3;if(!aY){return this}if(aY.nodeType){this.context=this[0]=aY;this.length=1;return this}if(aY==="body"&&!a1){this.context=ab;this[0]=ab.body;this.selector="body";this.length=1;return this}if(typeof aY==="string"){a0=P.exec(aY);if(a0&&(a0[1]||!a1)){if(a0[1]){a3=(a1?a1.ownerDocument||a1:ab);aZ=e.exec(aY);if(aZ){if(a.isPlainObject(a1)){aY=[ab.createElement(aZ[1])];a.fn.attr.call(aY,a1,true)}else{aY=[a3.createElement(aZ[1])]}}else{aZ=J([a0[1]],[a3]);aY=(aZ.cacheable?aZ.fragment.cloneNode(true):aZ.fragment).childNodes}return a.merge(this,aY)}else{a2=ab.getElementById(a0[2]);if(a2){if(a2.id!==a0[2]){return X.find(aY)}this.length=1;this[0]=a2}this.context=ab;this.selector=aY;return this}}else{if(!a1&&/^\w+$/.test(aY)){this.selector=aY;this.context=ab;aY=ab.getElementsByTagName(aY);return a.merge(this,aY)}else{if(!a1||a1.jquery){return(a1||X).find(aY)}else{return a(a1).find(aY)}}}}else{if(a.isFunction(aY)){return X.ready(aY)}}if(aY.selector!==C){this.selector=aY.selector;this.context=aY.context}return a.makeArray(aY,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(aY){return aY==null?this.toArray():(aY<0?this.slice(aY)[0]:this[aY])},pushStack:function(aZ,a1,aY){var a0=a();if(a.isArray(aZ)){g.apply(a0,aZ)}else{a.merge(a0,aZ)}a0.prevObject=this;a0.context=this.context;if(a1==="find"){a0.selector=this.selector+(this.selector?" ":"")+aY}else{if(a1){a0.selector=this.selector+"."+a1+"("+aY+")"}}return a0},each:function(aZ,aY){return a.each(this,aZ,aY)},ready:function(aY){a.bindReady();if(a.isReady){aY.call(ab,a)}else{if(ad){ad.push(aY)}}return this},eq:function(aY){return aY===-1?this.slice(aY):this.slice(aY,+aY+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(aY){return this.pushStack(a.map(this,function(a0,aZ){return aY.call(a0,aZ,a0)}))},end:function(){return this.prevObject||a(null)},push:g,sort:[].sort,splice:[].splice};a.fn.init.prototype=a.fn;a.extend=a.fn.extend=function(){var a3=arguments[0]||{},a2=1,a1=arguments.length,a5=false,a6,a0,aY,aZ;if(typeof a3==="boolean"){a5=a3;a3=arguments[1]||{};a2=2}if(typeof a3!=="object"&&!a.isFunction(a3)){a3={}}if(a1===a2){a3=this;--a2}for(;a2<a1;a2++){if((a6=arguments[a2])!=null){for(a0 in a6){aY=a3[a0];aZ=a6[a0];if(a3===aZ){continue}if(a5&&aZ&&(a.isPlainObject(aZ)||a.isArray(aZ))){var a4=aY&&(a.isPlainObject(aY)||a.isArray(aY))?aY:a.isArray(aZ)?[]:{};a3[a0]=a.extend(a5,a4,aZ)}else{if(aZ!==C){a3[a0]=aZ}}}}}return a3};a.extend({noConflict:function(aY){aM.$=R;if(aY){aM.jQuery=n}return a},isReady:false,ready:function(){if(!a.isReady){if(!ab.body){return setTimeout(a.ready,13)}a.isReady=true;if(ad){var aZ,aY=0;while((aZ=ad[aY++])){aZ.call(ab,a)}ad=null}if(a.fn.triggerHandler){a(ab).triggerHandler("ready")}}},bindReady:function(){if(K){return}K=true;if(ab.readyState==="complete"){return a.ready()}if(ab.addEventListener){ab.addEventListener("DOMContentLoaded",aG,false);aM.addEventListener("load",a.ready,false)}else{if(ab.attachEvent){ab.attachEvent("onreadystatechange",aG);aM.attachEvent("onload",a.ready);var aY=false;try{aY=aM.frameElement==null}catch(aZ){}if(ab.documentElement.doScroll&&aY){x()}}}},isFunction:function(aY){return at.call(aY)==="[object Function]"},isArray:function(aY){return at.call(aY)==="[object Array]"},isPlainObject:function(aZ){if(!aZ||at.call(aZ)!=="[object Object]"||aZ.nodeType||aZ.setInterval){return false}if(aZ.constructor&&!ap.call(aZ,"constructor")&&!ap.call(aZ.constructor.prototype,"isPrototypeOf")){return false}var aY;for(aY in aZ){}return aY===C||ap.call(aZ,aY)},isEmptyObject:function(aZ){for(var aY in aZ){return false}return true},error:function(aY){throw aY},parseJSON:function(aY){if(typeof aY!=="string"||!aY){return null}aY=a.trim(aY);if(/^[\],:{}\s]*$/.test(aY.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return aM.JSON&&aM.JSON.parse?aM.JSON.parse(aY):(new Function("return "+aY))()}else{a.error("Invalid JSON: "+aY)}},noop:function(){},globalEval:function(a0){if(a0&&ax.test(a0)){var aZ=ab.getElementsByTagName("head")[0]||ab.documentElement,aY=ab.createElement("script");aY.type="text/javascript";if(a.support.scriptEval){aY.appendChild(ab.createTextNode(a0))}else{aY.text=a0}aZ.insertBefore(aY,aZ.firstChild);aZ.removeChild(aY)}},nodeName:function(aZ,aY){return aZ.nodeName&&aZ.nodeName.toUpperCase()===aY.toUpperCase()},each:function(a1,a5,a0){var aZ,a2=0,a3=a1.length,aY=a3===C||a.isFunction(a1);if(a0){if(aY){for(aZ in a1){if(a5.apply(a1[aZ],a0)===false){break}}}else{for(;a2<a3;){if(a5.apply(a1[a2++],a0)===false){break}}}}else{if(aY){for(aZ in a1){if(a5.call(a1[aZ],aZ,a1[aZ])===false){break}}}else{for(var a4=a1[0];a2<a3&&a5.call(a4,a2,a4)!==false;a4=a1[++a2]){}}}return a1},trim:function(aY){return(aY||"").replace(M,"")},makeArray:function(a0,aZ){var aY=aZ||[];if(a0!=null){if(a0.length==null||typeof a0==="string"||a.isFunction(a0)||(typeof a0!=="function"&&a0.setInterval)){g.call(aY,a0)}else{a.merge(aY,a0)}}return aY},inArray:function(a0,a1){if(a1.indexOf){return a1.indexOf(a0)}for(var aY=0,aZ=a1.length;aY<aZ;aY++){if(a1[aY]===a0){return aY}}return -1},merge:function(a2,a0){var a1=a2.length,aZ=0;if(typeof a0.length==="number"){for(var aY=a0.length;aZ<aY;aZ++){a2[a1++]=a0[aZ]}}else{while(a0[aZ]!==C){a2[a1++]=a0[aZ++]}}a2.length=a1;return a2},grep:function(aZ,a3,aY){var a0=[];for(var a1=0,a2=aZ.length;a1<a2;a1++){if(!aY!==!a3(aZ[a1],a1)){a0.push(aZ[a1])}}return a0},map:function(aZ,a4,aY){var a0=[],a3;for(var a1=0,a2=aZ.length;a1<a2;a1++){a3=a4(aZ[a1],a1,aY);if(a3!=null){a0[a0.length]=a3}}return a0.concat.apply([],a0)},guid:1,proxy:function(a0,aZ,aY){if(arguments.length===2){if(typeof aZ==="string"){aY=a0;a0=aY[aZ];aZ=C}else{if(aZ&&!a.isFunction(aZ)){aY=aZ;aZ=C}}}if(!aZ&&a0){aZ=function(){return a0.apply(aY||this,arguments)}}if(a0){aZ.guid=a0.guid=a0.guid||aZ.guid||a.guid++}return aZ},uaMatch:function(aZ){aZ=aZ.toLowerCase();var aY=/(webkit)[ \/]([\w.]+)/.exec(aZ)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(aZ)||/(msie) ([\w.]+)/.exec(aZ)||!/compatible/.test(aZ)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(aZ)||[];return{browser:aY[1]||"",version:aY[2]||"0"}},browser:{}});u=a.uaMatch(b);if(u.browser){a.browser[u.browser]=true;a.browser.version=u.version}if(a.browser.webkit){a.browser.safari=true}if(s){a.inArray=function(aY,aZ){return s.call(aZ,aY)}}X=a(ab);if(ab.addEventListener){aG=function(){ab.removeEventListener("DOMContentLoaded",aG,false);a.ready()}}else{if(ab.attachEvent){aG=function(){if(ab.readyState==="complete"){ab.detachEvent("onreadystatechange",aG);a.ready()}}}}function x(){if(a.isReady){return}try{ab.documentElement.doScroll("left")}catch(aY){setTimeout(x,1);return}a.ready()}function aV(aY,aZ){if(aZ.src){a.ajax({url:aZ.src,async:false,dataType:"script"})}else{a.globalEval(aZ.text||aZ.textContent||aZ.innerHTML||"")}if(aZ.parentNode){aZ.parentNode.removeChild(aZ)}}function an(aY,a6,a4,a0,a3,a5){var aZ=aY.length;if(typeof a6==="object"){for(var a1 in a6){an(aY,a1,a6[a1],a0,a3,a4)}return aY}if(a4!==C){a0=!a5&&a0&&a.isFunction(a4);for(var a2=0;a2<aZ;a2++){a3(aY[a2],a6,a0?a4.call(aY[a2],a2,a3(aY[a2],a6)):a4,a5)}return aY}return aZ?a3(aY[0],a6):C}function aP(){return(new Date).getTime()}(function(){a.support={};var a4=ab.documentElement,a3=ab.createElement("script"),aY=ab.createElement("div"),aZ="script"+aP();aY.style.display="none";aY.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var a6=aY.getElementsByTagName("*"),a5=aY.getElementsByTagName("a")[0];if(!a6||!a6.length||!a5){return}a.support={leadingWhitespace:aY.firstChild.nodeType===3,tbody:!aY.getElementsByTagName("tbody").length,htmlSerialize:!!aY.getElementsByTagName("link").length,style:/red/.test(a5.getAttribute("style")),hrefNormalized:a5.getAttribute("href")==="/a",opacity:/^0.55$/.test(a5.style.opacity),cssFloat:!!a5.style.cssFloat,checkOn:aY.getElementsByTagName("input")[0].value==="on",optSelected:ab.createElement("select").appendChild(ab.createElement("option")).selected,parentNode:aY.removeChild(aY.appendChild(ab.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};a3.type="text/javascript";try{a3.appendChild(ab.createTextNode("window."+aZ+"=1;"))}catch(a1){}a4.insertBefore(a3,a4.firstChild);if(aM[aZ]){a.support.scriptEval=true;delete aM[aZ]}try{delete a3.test}catch(a1){a.support.deleteExpando=false}a4.removeChild(a3);if(aY.attachEvent&&aY.fireEvent){aY.attachEvent("onclick",function a7(){a.support.noCloneEvent=false;aY.detachEvent("onclick",a7)});aY.cloneNode(true).fireEvent("onclick")}aY=ab.createElement("div");aY.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var a0=ab.createDocumentFragment();a0.appendChild(aY.firstChild);a.support.checkClone=a0.cloneNode(true).cloneNode(true).lastChild.checked;a(function(){var a8=ab.createElement("div");a8.style.width=a8.style.paddingLeft="1px";ab.body.appendChild(a8);a.boxModel=a.support.boxModel=a8.offsetWidth===2;ab.body.removeChild(a8).style.display="none";a8=null});var a2=function(a8){var ba=ab.createElement("div");a8="on"+a8;var a9=(a8 in ba);if(!a9){ba.setAttribute(a8,"return;");a9=typeof ba[a8]==="function"}ba=null;return a9};a.support.submitBubbles=a2("submit");a.support.changeBubbles=a2("change");a4=a3=aY=a6=a5=null})();a.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var aI="jQuery"+aP(),aH=0,aT={};a.extend({cache:{},expando:aI,noData:{embed:true,object:true,applet:true},data:function(a0,aZ,a2){if(a0.nodeName&&a.noData[a0.nodeName.toLowerCase()]){return}a0=a0==aM?aT:a0;var a3=a0[aI],aY=a.cache,a1;if(!a3&&typeof aZ==="string"&&a2===C){return null}if(!a3){a3=++aH}if(typeof aZ==="object"){a0[aI]=a3;a1=aY[a3]=a.extend(true,{},aZ)}else{if(!aY[a3]){a0[aI]=a3;aY[a3]={}}}a1=aY[a3];if(a2!==C){a1[aZ]=a2}return typeof aZ==="string"?a1[aZ]:a1},removeData:function(a0,aZ){if(a0.nodeName&&a.noData[a0.nodeName.toLowerCase()]){return}a0=a0==aM?aT:a0;var a2=a0[aI],aY=a.cache,a1=aY[a2];if(aZ){if(a1){delete a1[aZ];if(a.isEmptyObject(a1)){a.removeData(a0)}}}else{if(a.support.deleteExpando){delete a0[a.expando]}else{if(a0.removeAttribute){a0.removeAttribute(a.expando)}}delete aY[a2]}}});a.fn.extend({data:function(aY,a0){if(typeof aY==="undefined"&&this.length){return a.data(this[0])}else{if(typeof aY==="object"){return this.each(function(){a.data(this,aY)})}}var a1=aY.split(".");a1[1]=a1[1]?"."+a1[1]:"";if(a0===C){var aZ=this.triggerHandler("getData"+a1[1]+"!",[a1[0]]);if(aZ===C&&this.length){aZ=a.data(this[0],aY)}return aZ===C&&a1[1]?this.data(a1[0]):aZ}else{return this.trigger("setData"+a1[1]+"!",[a1[0],a0]).each(function(){a.data(this,aY,a0)})}},removeData:function(aY){return this.each(function(){a.removeData(this,aY)})}});a.extend({queue:function(aZ,aY,a1){if(!aZ){return}aY=(aY||"fx")+"queue";var a0=a.data(aZ,aY);if(!a1){return a0||[]}if(!a0||a.isArray(a1)){a0=a.data(aZ,aY,a.makeArray(a1))}else{a0.push(a1)}return a0},dequeue:function(a1,a0){a0=a0||"fx";var aY=a.queue(a1,a0),aZ=aY.shift();if(aZ==="inprogress"){aZ=aY.shift()}if(aZ){if(a0==="fx"){aY.unshift("inprogress")}aZ.call(a1,function(){a.dequeue(a1,a0)})}}});a.fn.extend({queue:function(aY,aZ){if(typeof aY!=="string"){aZ=aY;aY="fx"}if(aZ===C){return a.queue(this[0],aY)}return this.each(function(a1,a2){var a0=a.queue(this,aY,aZ);if(aY==="fx"&&a0[0]!=="inprogress"){a.dequeue(this,aY)}})},dequeue:function(aY){return this.each(function(){a.dequeue(this,aY)})},delay:function(aZ,aY){aZ=a.fx?a.fx.speeds[aZ]||aZ:aZ;aY=aY||"fx";return this.queue(aY,function(){var a0=this;setTimeout(function(){a.dequeue(a0,aY)},aZ)})},clearQueue:function(aY){return this.queue(aY||"fx",[])}});var ao=/[\n\t]/g,S=/\s+/,av=/\r/g,aQ=/href|src|style/,d=/(button|input)/i,z=/(button|input|object|select|textarea)/i,j=/^(a|area)$/i,I=/radio|checkbox/;a.fn.extend({attr:function(aY,aZ){return an(this,aY,aZ,true,a.attr)},removeAttr:function(aY,aZ){return this.each(function(){a.attr(this,aY,"");if(this.nodeType===1){this.removeAttribute(aY)}})},addClass:function(a5){if(a.isFunction(a5)){return this.each(function(a8){var a7=a(this);a7.addClass(a5.call(this,a8,a7.attr("class")))})}if(a5&&typeof a5==="string"){var aY=(a5||"").split(S);for(var a1=0,a0=this.length;a1<a0;a1++){var aZ=this[a1];if(aZ.nodeType===1){if(!aZ.className){aZ.className=a5}else{var a2=" "+aZ.className+" ",a4=aZ.className;for(var a3=0,a6=aY.length;a3<a6;a3++){if(a2.indexOf(" "+aY[a3]+" ")<0){a4+=" "+aY[a3]}}aZ.className=a.trim(a4)}}}}return this},removeClass:function(a3){if(a.isFunction(a3)){return this.each(function(a7){var a6=a(this);a6.removeClass(a3.call(this,a7,a6.attr("class")))})}if((a3&&typeof a3==="string")||a3===C){var a4=(a3||"").split(S);for(var a0=0,aZ=this.length;a0<aZ;a0++){var a2=this[a0];if(a2.nodeType===1&&a2.className){if(a3){var a1=(" "+a2.className+" ").replace(ao," ");for(var a5=0,aY=a4.length;a5<aY;a5++){a1=a1.replace(" "+a4[a5]+" "," ")}a2.className=a.trim(a1)}else{a2.className=""}}}}return this},toggleClass:function(a1,aZ){var a0=typeof a1,aY=typeof aZ==="boolean";if(a.isFunction(a1)){return this.each(function(a3){var a2=a(this);a2.toggleClass(a1.call(this,a3,a2.attr("class"),aZ),aZ)})}return this.each(function(){if(a0==="string"){var a4,a3=0,a2=a(this),a5=aZ,a6=a1.split(S);while((a4=a6[a3++])){a5=aY?a5:!a2.hasClass(a4);a2[a5?"addClass":"removeClass"](a4)}}else{if(a0==="undefined"||a0==="boolean"){if(this.className){a.data(this,"__className__",this.className)}this.className=this.className||a1===false?"":a.data(this,"__className__")||""}}})},hasClass:function(aY){var a1=" "+aY+" ";for(var a0=0,aZ=this.length;a0<aZ;a0++){if((" "+this[a0].className+" ").replace(ao," ").indexOf(a1)>-1){return true}}return false},val:function(a5){if(a5===C){var aZ=this[0];if(aZ){if(a.nodeName(aZ,"option")){return(aZ.attributes.value||{}).specified?aZ.value:aZ.text}if(a.nodeName(aZ,"select")){var a3=aZ.selectedIndex,a6=[],a7=aZ.options,a2=aZ.type==="select-one";if(a3<0){return null}for(var a0=a2?a3:0,a4=a2?a3+1:a7.length;a0<a4;a0++){var a1=a7[a0];if(a1.selected){a5=a(a1).val();if(a2){return a5}a6.push(a5)}}return a6}if(I.test(aZ.type)&&!a.support.checkOn){return aZ.getAttribute("value")===null?"on":aZ.value}return(aZ.value||"").replace(av,"")}return C}var aY=a.isFunction(a5);return this.each(function(ba){var a9=a(this),bb=a5;if(this.nodeType!==1){return}if(aY){bb=a5.call(this,ba,a9.val())}if(typeof bb==="number"){bb+=""}if(a.isArray(bb)&&I.test(this.type)){this.checked=a.inArray(a9.val(),bb)>=0}else{if(a.nodeName(this,"select")){var a8=a.makeArray(bb);a("option",this).each(function(){this.selected=a.inArray(a(this).val(),a8)>=0});if(!a8.length){this.selectedIndex=-1}}else{this.value=bb}}})}});a.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(aZ,aY,a4,a7){if(!aZ||aZ.nodeType===3||aZ.nodeType===8){return C}if(a7&&aY in a.attrFn){return a(aZ)[aY](a4)}var a0=aZ.nodeType!==1||!a.isXMLDoc(aZ),a3=a4!==C;aY=a0&&a.props[aY]||aY;if(aZ.nodeType===1){var a2=aQ.test(aY);if(aY==="selected"&&!a.support.optSelected){var a5=aZ.parentNode;if(a5){a5.selectedIndex;if(a5.parentNode){a5.parentNode.selectedIndex}}}if(aY in aZ&&a0&&!a2){if(a3){if(aY==="type"&&d.test(aZ.nodeName)&&aZ.parentNode){a.error("type property can't be changed")}aZ[aY]=a4}if(a.nodeName(aZ,"form")&&aZ.getAttributeNode(aY)){return aZ.getAttributeNode(aY).nodeValue}if(aY==="tabIndex"){var a6=aZ.getAttributeNode("tabIndex");return a6&&a6.specified?a6.value:z.test(aZ.nodeName)||j.test(aZ.nodeName)&&aZ.href?0:C}return aZ[aY]}if(!a.support.style&&a0&&aY==="style"){if(a3){aZ.style.cssText=""+a4}return aZ.style.cssText}if(a3){aZ.setAttribute(aY,""+a4)}var a1=!a.support.hrefNormalized&&a0&&a2?aZ.getAttribute(aY,2):aZ.getAttribute(aY);return a1===null?C:a1}return a.style(aZ,aY,a4)}});var aC=/\.(.*)$/,A=function(aY){return aY.replace(/[^\w\s\.\|`]/g,function(aZ){return"\\"+aZ})};a.event={add:function(a1,a5,ba,a3){if(a1.nodeType===3||a1.nodeType===8){return}if(a1.setInterval&&(a1!==aM&&!a1.frameElement)){a1=aM}var aZ,a9;if(ba.handler){aZ=ba;ba=aZ.handler}if(!ba.guid){ba.guid=a.guid++}var a6=a.data(a1);if(!a6){return}var bb=a6.events=a6.events||{},a4=a6.handle,a4;if(!a4){a6.handle=a4=function(){return typeof a!=="undefined"&&!a.event.triggered?a.event.handle.apply(a4.elem,arguments):C}}a4.elem=a1;a5=a5.split(" ");var a8,a2=0,aY;while((a8=a5[a2++])){a9=aZ?a.extend({},aZ):{handler:ba,data:a3};if(a8.indexOf(".")>-1){aY=a8.split(".");a8=aY.shift();a9.namespace=aY.slice(0).sort().join(".")}else{aY=[];a9.namespace=""}a9.type=a8;a9.guid=ba.guid;var a0=bb[a8],a7=a.event.special[a8]||{};if(!a0){a0=bb[a8]=[];if(!a7.setup||a7.setup.call(a1,a3,aY,a4)===false){if(a1.addEventListener){a1.addEventListener(a8,a4,false)}else{if(a1.attachEvent){a1.attachEvent("on"+a8,a4)}}}}if(a7.add){a7.add.call(a1,a9);if(!a9.handler.guid){a9.handler.guid=ba.guid}}a0.push(a9);a.event.global[a8]=true}a1=null},global:{},remove:function(bd,a8,aZ,a4){if(bd.nodeType===3||bd.nodeType===8){return}var bg,a3,a5,bb=0,a1,a6,a9,a2,a7,aY,bf,bc=a.data(bd),a0=bc&&bc.events;if(!bc||!a0){return}if(a8&&a8.type){aZ=a8.handler;a8=a8.type}if(!a8||typeof a8==="string"&&a8.charAt(0)==="."){a8=a8||"";for(a3 in a0){a.event.remove(bd,a3+a8)}return}a8=a8.split(" ");while((a3=a8[bb++])){bf=a3;aY=null;a1=a3.indexOf(".")<0;a6=[];if(!a1){a6=a3.split(".");a3=a6.shift();a9=new RegExp("(^|\\.)"+a.map(a6.slice(0).sort(),A).join("\\.(?:.*\\.)?")+"(\\.|$)")}a7=a0[a3];if(!a7){continue}if(!aZ){for(var ba=0;ba<a7.length;ba++){aY=a7[ba];if(a1||a9.test(aY.namespace)){a.event.remove(bd,bf,aY.handler,ba);a7.splice(ba--,1)}}continue}a2=a.event.special[a3]||{};for(var ba=a4||0;ba<a7.length;ba++){aY=a7[ba];if(aZ.guid===aY.guid){if(a1||a9.test(aY.namespace)){if(a4==null){a7.splice(ba--,1)}if(a2.remove){a2.remove.call(bd,aY)}}if(a4!=null){break}}}if(a7.length===0||a4!=null&&a7.length===1){if(!a2.teardown||a2.teardown.call(bd,a6)===false){ag(bd,a3,bc.handle)}bg=null;delete a0[a3]}}if(a.isEmptyObject(a0)){var be=bc.handle;if(be){be.elem=null}delete bc.events;delete bc.handle;if(a.isEmptyObject(bc)){a.removeData(bd)}}},trigger:function(aY,a2,a0){var a7=aY.type||aY,a1=arguments[3];if(!a1){aY=typeof aY==="object"?aY[aI]?aY:a.extend(a.Event(a7),aY):a.Event(a7);if(a7.indexOf("!")>=0){aY.type=a7=a7.slice(0,-1);aY.exclusive=true}if(!a0){aY.stopPropagation();if(a.event.global[a7]){a.each(a.cache,function(){if(this.events&&this.events[a7]){a.event.trigger(aY,a2,this.handle.elem)}})}}if(!a0||a0.nodeType===3||a0.nodeType===8){return C}aY.result=C;aY.target=a0;a2=a.makeArray(a2);a2.unshift(aY)}aY.currentTarget=a0;var a3=a.data(a0,"handle");if(a3){a3.apply(a0,a2)}var a8=a0.parentNode||a0.ownerDocument;try{if(!(a0&&a0.nodeName&&a.noData[a0.nodeName.toLowerCase()])){if(a0["on"+a7]&&a0["on"+a7].apply(a0,a2)===false){aY.result=false}}}catch(a5){}if(!aY.isPropagationStopped()&&a8){a.event.trigger(aY,a2,a8,true)}else{if(!aY.isDefaultPrevented()){var a4=aY.target,aZ,a9=a.nodeName(a4,"a")&&a7==="click",a6=a.event.special[a7]||{};if((!a6._default||a6._default.call(a0,aY)===false)&&!a9&&!(a4&&a4.nodeName&&a.noData[a4.nodeName.toLowerCase()])){try{if(a4[a7]){aZ=a4["on"+a7];if(aZ){a4["on"+a7]=null}a.event.triggered=true;a4[a7]()}}catch(a5){}if(aZ){a4["on"+a7]=aZ}a.event.triggered=false}}}},handle:function(aY){var a6,a0,aZ,a1,a7;aY=arguments[0]=a.event.fix(aY||aM.event);aY.currentTarget=this;a6=aY.type.indexOf(".")<0&&!aY.exclusive;if(!a6){aZ=aY.type.split(".");aY.type=aZ.shift();a1=new RegExp("(^|\\.)"+aZ.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}var a7=a.data(this,"events"),a0=a7[aY.type];if(a7&&a0){a0=a0.slice(0);for(var a3=0,a2=a0.length;a3<a2;a3++){var a5=a0[a3];if(a6||a1.test(a5.namespace)){aY.handler=a5.handler;aY.data=a5.data;aY.handleObj=a5;var a4=a5.handler.apply(this,arguments);if(a4!==C){aY.result=a4;if(a4===false){aY.preventDefault();aY.stopPropagation()}}if(aY.isImmediatePropagationStopped()){break}}}}return aY.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a1){if(a1[aI]){return a1}var aZ=a1;a1=a.Event(aZ);for(var a0=this.props.length,a3;a0;){a3=this.props[--a0];a1[a3]=aZ[a3]}if(!a1.target){a1.target=a1.srcElement||ab}if(a1.target.nodeType===3){a1.target=a1.target.parentNode}if(!a1.relatedTarget&&a1.fromElement){a1.relatedTarget=a1.fromElement===a1.target?a1.toElement:a1.fromElement}if(a1.pageX==null&&a1.clientX!=null){var a2=ab.documentElement,aY=ab.body;a1.pageX=a1.clientX+(a2&&a2.scrollLeft||aY&&aY.scrollLeft||0)-(a2&&a2.clientLeft||aY&&aY.clientLeft||0);a1.pageY=a1.clientY+(a2&&a2.scrollTop||aY&&aY.scrollTop||0)-(a2&&a2.clientTop||aY&&aY.clientTop||0)}if(!a1.which&&((a1.charCode||a1.charCode===0)?a1.charCode:a1.keyCode)){a1.which=a1.charCode||a1.keyCode}if(!a1.metaKey&&a1.ctrlKey){a1.metaKey=a1.ctrlKey}if(!a1.which&&a1.button!==C){a1.which=(a1.button&1?1:(a1.button&2?3:(a1.button&4?2:0)))}return a1},guid:100000000,proxy:a.proxy,special:{ready:{setup:a.bindReady,teardown:a.noop},live:{add:function(aY){a.event.add(this,aY.origType,a.extend({},aY,{handler:V}))},remove:function(aZ){var aY=true,a0=aZ.origType.replace(aC,"");a.each(a.data(this,"events").live||[],function(){if(a0===this.origType.replace(aC,"")){aY=false;return false}});if(aY){a.event.remove(this,aZ.origType,V)}}},beforeunload:{setup:function(a0,aZ,aY){if(this.setInterval){this.onbeforeunload=aY}return false},teardown:function(aZ,aY){if(this.onbeforeunload===aY){this.onbeforeunload=null}}}}};var ag=ab.removeEventListener?function(aZ,aY,a0){aZ.removeEventListener(aY,a0,false)}:function(aZ,aY,a0){aZ.detachEvent("on"+aY,a0)};a.Event=function(aY){if(!this.preventDefault){return new a.Event(aY)}if(aY&&aY.type){this.originalEvent=aY;this.type=aY.type}else{this.type=aY}this.timeStamp=aP();this[aI]=true};function aR(){return false}function f(){return true}a.Event.prototype={preventDefault:function(){this.isDefaultPrevented=f;var aY=this.originalEvent;if(!aY){return}if(aY.preventDefault){aY.preventDefault()}aY.returnValue=false},stopPropagation:function(){this.isPropagationStopped=f;var aY=this.originalEvent;if(!aY){return}if(aY.stopPropagation){aY.stopPropagation()}aY.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=f;this.stopPropagation()},isDefaultPrevented:aR,isPropagationStopped:aR,isImmediatePropagationStopped:aR};var Q=function(aZ){var aY=aZ.relatedTarget;try{while(aY&&aY!==this){aY=aY.parentNode}if(aY!==this){aZ.type=aZ.data;a.event.handle.apply(this,arguments)}}catch(a0){}},ay=function(aY){aY.type=aY.data;a.event.handle.apply(this,arguments)};a.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(aZ,aY){a.event.special[aZ]={setup:function(a0){a.event.add(this,aY,a0&&a0.selector?ay:Q,aZ)},teardown:function(a0){a.event.remove(this,aY,a0&&a0.selector?ay:Q)}}});if(!a.support.submitBubbles){a.event.special.submit={setup:function(aZ,aY){if(this.nodeName.toLowerCase()!=="form"){a.event.add(this,"click.specialSubmit",function(a2){var a1=a2.target,a0=a1.type;if((a0==="submit"||a0==="image")&&a(a1).closest("form").length){return aA("submit",this,arguments)}});a.event.add(this,"keypress.specialSubmit",function(a2){var a1=a2.target,a0=a1.type;if((a0==="text"||a0==="password")&&a(a1).closest("form").length&&a2.keyCode===13){return aA("submit",this,arguments)}})}else{return false}},teardown:function(aY){a.event.remove(this,".specialSubmit")}}}if(!a.support.changeBubbles){var aq=/textarea|input|select/i,aS,i=function(aZ){var aY=aZ.type,a0=aZ.value;if(aY==="radio"||aY==="checkbox"){a0=aZ.checked}else{if(aY==="select-multiple"){a0=aZ.selectedIndex>-1?a.map(aZ.options,function(a1){return a1.selected}).join("-"):""}else{if(aZ.nodeName.toLowerCase()==="select"){a0=aZ.selectedIndex}}}return a0},O=function O(a0){var aY=a0.target,aZ,a1;if(!aq.test(aY.nodeName)||aY.readOnly){return}aZ=a.data(aY,"_change_data");a1=i(aY);if(a0.type!=="focusout"||aY.type!=="radio"){a.data(aY,"_change_data",a1)}if(aZ===C||a1===aZ){return}if(aZ!=null||a1){a0.type="change";return a.event.trigger(a0,arguments[1],aY)}};a.event.special.change={filters:{focusout:O,click:function(a0){var aZ=a0.target,aY=aZ.type;if(aY==="radio"||aY==="checkbox"||aZ.nodeName.toLowerCase()==="select"){return O.call(this,a0)}},keydown:function(a0){var aZ=a0.target,aY=aZ.type;if((a0.keyCode===13&&aZ.nodeName.toLowerCase()!=="textarea")||(a0.keyCode===32&&(aY==="checkbox"||aY==="radio"))||aY==="select-multiple"){return O.call(this,a0)}},beforeactivate:function(aZ){var aY=aZ.target;a.data(aY,"_change_data",i(aY))}},setup:function(a0,aZ){if(this.type==="file"){return false}for(var aY in aS){a.event.add(this,aY+".specialChange",aS[aY])}return aq.test(this.nodeName)},teardown:function(aY){a.event.remove(this,".specialChange");return aq.test(this.nodeName)}};aS=a.event.special.change.filters}function aA(aZ,a0,aY){aY[0].type=aZ;return a.event.handle.apply(a0,aY)}if(ab.addEventListener){a.each({focus:"focusin",blur:"focusout"},function(a0,aY){a.event.special[aY]={setup:function(){this.addEventListener(a0,aZ,true)},teardown:function(){this.removeEventListener(a0,aZ,true)}};function aZ(a1){a1=a.event.fix(a1);a1.type=aY;return a.event.handle.call(this,a1)}})}a.each(["bind","one"],function(aZ,aY){a.fn[aY]=function(a5,a6,a4){if(typeof a5==="object"){for(var a2 in a5){this[aY](a2,a6,a5[a2],a4)}return this}if(a.isFunction(a6)){a4=a6;a6=C}var a3=aY==="one"?a.proxy(a4,function(a7){a(this).unbind(a7,a3);return a4.apply(this,arguments)}):a4;if(a5==="unload"&&aY!=="one"){this.one(a5,a6,a4)}else{for(var a1=0,a0=this.length;a1<a0;a1++){a.event.add(this[a1],a5,a3,a6)}}return this}});a.fn.extend({unbind:function(a2,a1){if(typeof a2==="object"&&!a2.preventDefault){for(var a0 in a2){this.unbind(a0,a2[a0])}}else{for(var aZ=0,aY=this.length;aZ<aY;aZ++){a.event.remove(this[aZ],a2,a1)}}return this},delegate:function(aY,aZ,a1,a0){return this.live(aZ,a1,a0,aY)},undelegate:function(aY,aZ,a0){if(arguments.length===0){return this.unbind("live")}else{return this.die(aZ,null,a0,aY)}},trigger:function(aY,aZ){return this.each(function(){a.event.trigger(aY,aZ,this)})},triggerHandler:function(aY,a0){if(this[0]){var aZ=a.Event(aY);aZ.preventDefault();aZ.stopPropagation();a.event.trigger(aZ,a0,this[0]);return aZ.result}},toggle:function(a0){var aY=arguments,aZ=1;while(aZ<aY.length){a.proxy(a0,aY[aZ++])}return this.click(a.proxy(a0,function(a1){var a2=(a.data(this,"lastToggle"+a0.guid)||0)%aZ;a.data(this,"lastToggle"+a0.guid,a2+1);a1.preventDefault();return aY[a2].apply(this,arguments)||false}))},hover:function(aY,aZ){return this.mouseenter(aY).mouseleave(aZ||aY)}});var aw={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};a.each(["live","die"],function(aZ,aY){a.fn[aY]=function(a7,a4,a9,a2){var a8,a5=0,a6,a1,ba,a3=a2||this.selector,a0=a2?this:a(this.context);if(a.isFunction(a4)){a9=a4;a4=C}a7=(a7||"").split(" ");while((a8=a7[a5++])!=null){a6=aC.exec(a8);a1="";if(a6){a1=a6[0];a8=a8.replace(aC,"")}if(a8==="hover"){a7.push("mouseenter"+a1,"mouseleave"+a1);continue}ba=a8;if(a8==="focus"||a8==="blur"){a7.push(aw[a8]+a1);a8=a8+a1}else{a8=(aw[a8]||a8)+a1}if(aY==="live"){a0.each(function(){a.event.add(this,m(a8,a3),{data:a4,selector:a3,handler:a9,origType:a8,origHandler:a9,preType:ba})})}else{a0.unbind(m(a8,a3),a9)}}return this}});function V(aY){var a8,aZ=[],bb=[],a7=arguments,ba,a6,a9,a1,a3,a5,a2,a4,bc=a.data(this,"events");if(aY.liveFired===this||!bc||!bc.live||aY.button&&aY.type==="click"){return}aY.liveFired=this;var a0=bc.live.slice(0);for(a3=0;a3<a0.length;a3++){a9=a0[a3];if(a9.origType.replace(aC,"")===aY.type){bb.push(a9.selector)}else{a0.splice(a3--,1)}}a6=a(aY.target).closest(bb,aY.currentTarget);for(a5=0,a2=a6.length;a5<a2;a5++){for(a3=0;a3<a0.length;a3++){a9=a0[a3];if(a6[a5].selector===a9.selector){a1=a6[a5].elem;ba=null;if(a9.preType==="mouseenter"||a9.preType==="mouseleave"){ba=a(aY.relatedTarget).closest(a9.selector)[0]}if(!ba||ba!==a1){aZ.push({elem:a1,handleObj:a9})}}}}for(a5=0,a2=aZ.length;a5<a2;a5++){a6=aZ[a5];aY.currentTarget=a6.elem;aY.data=a6.handleObj.data;aY.handleObj=a6.handleObj;if(a6.handleObj.origHandler.apply(a6.elem,a7)===false){a8=false;break}}return a8}function m(aZ,aY){return"live."+(aZ&&aZ!=="*"?aZ+".":"")+aY.replace(/\./g,"`").replace(/ /g,"&")}a.each(("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error").split(" "),function(aZ,aY){a.fn[aY]=function(a0){return a0?this.bind(aY,a0):this.trigger(aY)};if(a.attrFn){a.attrFn[aY]=true}});if(aM.attachEvent&&!aM.addEventListener){aM.attachEvent("onunload",function(){for(var aZ in a.cache){if(a.cache[aZ].handle){try{a.event.remove(a.cache[aZ].handle.elem)}catch(aY){}}}});
/*!
* Sizzle CSS Selector Engine - v1.0
* Copyright 2009, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
}(function(){var a9=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,ba=0,bc=Object.prototype.toString,a4=false,a3=true;[0,0].sort(function(){a3=false;return 0});var a0=function(bl,bg,bo,bp){bo=bo||[];var br=bg=bg||ab;if(bg.nodeType!==1&&bg.nodeType!==9){return[]}if(!bl||typeof bl!=="string"){return bo}var bm=[],bi,bt,bw,bh,bk=true,bj=a1(bg),bq=bl;while((a9.exec(""),bi=a9.exec(bq))!==null){bq=bi[3];bm.push(bi[1]);if(bi[2]){bh=bi[3];break}}if(bm.length>1&&a5.exec(bl)){if(bm.length===2&&a6.relative[bm[0]]){bt=bd(bm[0]+bm[1],bg)}else{bt=a6.relative[bm[0]]?[bg]:a0(bm.shift(),bg);while(bm.length){bl=bm.shift();if(a6.relative[bl]){bl+=bm.shift()}bt=bd(bl,bt)}}}else{if(!bp&&bm.length>1&&bg.nodeType===9&&!bj&&a6.match.ID.test(bm[0])&&!a6.match.ID.test(bm[bm.length-1])){var bs=a0.find(bm.shift(),bg,bj);bg=bs.expr?a0.filter(bs.expr,bs.set)[0]:bs.set[0]}if(bg){var bs=bp?{expr:bm.pop(),set:a8(bp)}:a0.find(bm.pop(),bm.length===1&&(bm[0]==="~"||bm[0]==="+")&&bg.parentNode?bg.parentNode:bg,bj);bt=bs.expr?a0.filter(bs.expr,bs.set):bs.set;if(bm.length>0){bw=a8(bt)}else{bk=false}while(bm.length){var bv=bm.pop(),bu=bv;if(!a6.relative[bv]){bv=""}else{bu=bm.pop()}if(bu==null){bu=bg}a6.relative[bv](bw,bu,bj)}}else{bw=bm=[]}}if(!bw){bw=bt}if(!bw){a0.error(bv||bl)}if(bc.call(bw)==="[object Array]"){if(!bk){bo.push.apply(bo,bw)}else{if(bg&&bg.nodeType===1){for(var bn=0;bw[bn]!=null;bn++){if(bw[bn]&&(bw[bn]===true||bw[bn].nodeType===1&&a7(bg,bw[bn]))){bo.push(bt[bn])}}}else{for(var bn=0;bw[bn]!=null;bn++){if(bw[bn]&&bw[bn].nodeType===1){bo.push(bt[bn])}}}}}else{a8(bw,bo)}if(bh){a0(bh,br,bo,bp);a0.uniqueSort(bo)}return bo};a0.uniqueSort=function(bh){if(bb){a4=a3;bh.sort(bb);if(a4){for(var bg=1;bg<bh.length;bg++){if(bh[bg]===bh[bg-1]){bh.splice(bg--,1)}}}}return bh};a0.matches=function(bg,bh){return a0(bg,null,null,bh)};a0.find=function(bn,bg,bo){var bm,bk;if(!bn){return[]}for(var bj=0,bi=a6.order.length;bj<bi;bj++){var bl=a6.order[bj],bk;if((bk=a6.leftMatch[bl].exec(bn))){var bh=bk[1];bk.splice(1,1);if(bh.substr(bh.length-1)!=="\\"){bk[1]=(bk[1]||"").replace(/\\/g,"");bm=a6.find[bl](bk,bg,bo);if(bm!=null){bn=bn.replace(a6.match[bl],"");break}}}}if(!bm){bm=bg.getElementsByTagName("*")}return{set:bm,expr:bn}};a0.filter=function(br,bq,bu,bk){var bi=br,bw=[],bo=bq,bm,bg,bn=bq&&bq[0]&&a1(bq[0]);while(br&&bq.length){for(var bp in a6.filter){if((bm=a6.leftMatch[bp].exec(br))!=null&&bm[2]){var bh=a6.filter[bp],bv,bt,bj=bm[1];bg=false;bm.splice(1,1);if(bj.substr(bj.length-1)==="\\"){continue}if(bo===bw){bw=[]}if(a6.preFilter[bp]){bm=a6.preFilter[bp](bm,bo,bu,bw,bk,bn);if(!bm){bg=bv=true}else{if(bm===true){continue}}}if(bm){for(var bl=0;(bt=bo[bl])!=null;bl++){if(bt){bv=bh(bt,bm,bl,bo);var bs=bk^!!bv;if(bu&&bv!=null){if(bs){bg=true}else{bo[bl]=false}}else{if(bs){bw.push(bt);bg=true}}}}}if(bv!==C){if(!bu){bo=bw}br=br.replace(a6.match[bp],"");if(!bg){return[]}break}}}if(br===bi){if(bg==null){a0.error(br)}else{break}}bi=br}return bo};a0.error=function(bg){throw"Syntax error, unrecognized expression: "+bg};var a6=a0.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(bg){return bg.getAttribute("href")}},relative:{"+":function(bm,bh){var bj=typeof bh==="string",bl=bj&&!/\W/.test(bh),bn=bj&&!bl;if(bl){bh=bh.toLowerCase()}for(var bi=0,bg=bm.length,bk;bi<bg;bi++){if((bk=bm[bi])){while((bk=bk.previousSibling)&&bk.nodeType!==1){}bm[bi]=bn||bk&&bk.nodeName.toLowerCase()===bh?bk||false:bk===bh}}if(bn){a0.filter(bh,bm,true)}},">":function(bm,bh){var bk=typeof bh==="string";if(bk&&!/\W/.test(bh)){bh=bh.toLowerCase();for(var bi=0,bg=bm.length;bi<bg;bi++){var bl=bm[bi];if(bl){var bj=bl.parentNode;bm[bi]=bj.nodeName.toLowerCase()===bh?bj:false}}}else{for(var bi=0,bg=bm.length;bi<bg;bi++){var bl=bm[bi];if(bl){bm[bi]=bk?bl.parentNode:bl.parentNode===bh}}if(bk){a0.filter(bh,bm,true)}}},"":function(bj,bh,bl){var bi=ba++,bg=be;if(typeof bh==="string"&&!/\W/.test(bh)){var bk=bh=bh.toLowerCase();bg=aY}bg("parentNode",bh,bi,bj,bk,bl)},"~":function(bj,bh,bl){var bi=ba++,bg=be;if(typeof bh==="string"&&!/\W/.test(bh)){var bk=bh=bh.toLowerCase();bg=aY}bg("previousSibling",bh,bi,bj,bk,bl)}},find:{ID:function(bh,bi,bj){if(typeof bi.getElementById!=="undefined"&&!bj){var bg=bi.getElementById(bh[1]);return bg?[bg]:[]}},NAME:function(bi,bl){if(typeof bl.getElementsByName!=="undefined"){var bh=[],bk=bl.getElementsByName(bi[1]);for(var bj=0,bg=bk.length;bj<bg;bj++){if(bk[bj].getAttribute("name")===bi[1]){bh.push(bk[bj])}}return bh.length===0?null:bh}},TAG:function(bg,bh){return bh.getElementsByTagName(bg[1])}},preFilter:{CLASS:function(bj,bh,bi,bg,bm,bn){bj=" "+bj[1].replace(/\\/g,"")+" ";if(bn){return bj}for(var bk=0,bl;(bl=bh[bk])!=null;bk++){if(bl){if(bm^(bl.className&&(" "+bl.className+" ").replace(/[\t\n]/g," ").indexOf(bj)>=0)){if(!bi){bg.push(bl)}}else{if(bi){bh[bk]=false}}}}return false},ID:function(bg){return bg[1].replace(/\\/g,"")},TAG:function(bh,bg){return bh[1].toLowerCase()},CHILD:function(bg){if(bg[1]==="nth"){var bh=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(bg[2]==="even"&&"2n"||bg[2]==="odd"&&"2n+1"||!/\D/.test(bg[2])&&"0n+"+bg[2]||bg[2]);bg[2]=(bh[1]+(bh[2]||1))-0;bg[3]=bh[3]-0}bg[0]=ba++;return bg},ATTR:function(bk,bh,bi,bg,bl,bm){var bj=bk[1].replace(/\\/g,"");if(!bm&&a6.attrMap[bj]){bk[1]=a6.attrMap[bj]}if(bk[2]==="~="){bk[4]=" "+bk[4]+" "}return bk},PSEUDO:function(bk,bh,bi,bg,bl){if(bk[1]==="not"){if((a9.exec(bk[3])||"").length>1||/^\w/.test(bk[3])){bk[3]=a0(bk[3],null,null,bh)}else{var bj=a0.filter(bk[3],bh,bi,true^bl);if(!bi){bg.push.apply(bg,bj)}return false}}else{if(a6.match.POS.test(bk[0])||a6.match.CHILD.test(bk[0])){return true}}return bk},POS:function(bg){bg.unshift(true);return bg}},filters:{enabled:function(bg){return bg.disabled===false&&bg.type!=="hidden"},disabled:function(bg){return bg.disabled===true},checked:function(bg){return bg.checked===true},selected:function(bg){bg.parentNode.selectedIndex;return bg.selected===true},parent:function(bg){return !!bg.firstChild},empty:function(bg){return !bg.firstChild},has:function(bi,bh,bg){return !!a0(bg[3],bi).length},header:function(bg){return/h\d/i.test(bg.nodeName)},text:function(bg){return"text"===bg.type},radio:function(bg){return"radio"===bg.type},checkbox:function(bg){return"checkbox"===bg.type},file:function(bg){return"file"===bg.type},password:function(bg){return"password"===bg.type},submit:function(bg){return"submit"===bg.type},image:function(bg){return"image"===bg.type},reset:function(bg){return"reset"===bg.type},button:function(bg){return"button"===bg.type||bg.nodeName.toLowerCase()==="button"},input:function(bg){return/input|select|textarea|button/i.test(bg.nodeName)}},setFilters:{first:function(bh,bg){return bg===0},last:function(bi,bh,bg,bj){return bh===bj.length-1},even:function(bh,bg){return bg%2===0},odd:function(bh,bg){return bg%2===1},lt:function(bi,bh,bg){return bh<bg[3]-0},gt:function(bi,bh,bg){return bh>bg[3]-0},nth:function(bi,bh,bg){return bg[3]-0===bh},eq:function(bi,bh,bg){return bg[3]-0===bh}},filter:{PSEUDO:function(bm,bi,bj,bn){var bh=bi[1],bk=a6.filters[bh];if(bk){return bk(bm,bj,bi,bn)}else{if(bh==="contains"){return(bm.textContent||bm.innerText||aZ([bm])||"").indexOf(bi[3])>=0}else{if(bh==="not"){var bl=bi[3];for(var bj=0,bg=bl.length;bj<bg;bj++){if(bl[bj]===bm){return false}}return true}else{a0.error("Syntax error, unrecognized expression: "+bh)}}}},CHILD:function(bg,bj){var bm=bj[1],bh=bg;switch(bm){case"only":case"first":while((bh=bh.previousSibling)){if(bh.nodeType===1){return false}}if(bm==="first"){return true}bh=bg;case"last":while((bh=bh.nextSibling)){if(bh.nodeType===1){return false}}return true;case"nth":var bi=bj[2],bp=bj[3];if(bi===1&&bp===0){return true}var bl=bj[0],bo=bg.parentNode;if(bo&&(bo.sizcache!==bl||!bg.nodeIndex)){var bk=0;for(bh=bo.firstChild;bh;bh=bh.nextSibling){if(bh.nodeType===1){bh.nodeIndex=++bk}}bo.sizcache=bl}var bn=bg.nodeIndex-bp;if(bi===0){return bn===0}else{return(bn%bi===0&&bn/bi>=0)}}},ID:function(bh,bg){return bh.nodeType===1&&bh.getAttribute("id")===bg},TAG:function(bh,bg){return(bg==="*"&&bh.nodeType===1)||bh.nodeName.toLowerCase()===bg},CLASS:function(bh,bg){return(" "+(bh.className||bh.getAttribute("class"))+" ").indexOf(bg)>-1},ATTR:function(bl,bj){var bi=bj[1],bg=a6.attrHandle[bi]?a6.attrHandle[bi](bl):bl[bi]!=null?bl[bi]:bl.getAttribute(bi),bm=bg+"",bk=bj[2],bh=bj[4];return bg==null?bk==="!=":bk==="="?bm===bh:bk==="*="?bm.indexOf(bh)>=0:bk==="~="?(" "+bm+" ").indexOf(bh)>=0:!bh?bm&&bg!==false:bk==="!="?bm!==bh:bk==="^="?bm.indexOf(bh)===0:bk==="$="?bm.substr(bm.length-bh.length)===bh:bk==="|="?bm===bh||bm.substr(0,bh.length+1)===bh+"-":false},POS:function(bk,bh,bi,bl){var bg=bh[2],bj=a6.setFilters[bg];if(bj){return bj(bk,bi,bh,bl)}}}};var a5=a6.match.POS;for(var a2 in a6.match){a6.match[a2]=new RegExp(a6.match[a2].source+/(?![^\[]*\])(?![^\(]*\))/.source);a6.leftMatch[a2]=new RegExp(/(^(?:.|\r|\n)*?)/.source+a6.match[a2].source.replace(/\\(\d+)/g,function(bh,bg){return"\\"+(bg-0+1)}))}var a8=function(bh,bg){bh=Array.prototype.slice.call(bh,0);if(bg){bg.push.apply(bg,bh);return bg}return bh};try{Array.prototype.slice.call(ab.documentElement.childNodes,0)[0].nodeType}catch(bf){a8=function(bk,bj){var bh=bj||[];if(bc.call(bk)==="[object Array]"){Array.prototype.push.apply(bh,bk)}else{if(typeof bk.length==="number"){for(var bi=0,bg=bk.length;bi<bg;bi++){bh.push(bk[bi])}}else{for(var bi=0;bk[bi];bi++){bh.push(bk[bi])}}}return bh}}var bb;if(ab.documentElement.compareDocumentPosition){bb=function(bh,bg){if(!bh.compareDocumentPosition||!bg.compareDocumentPosition){if(bh==bg){a4=true}return bh.compareDocumentPosition?-1:1}var bi=bh.compareDocumentPosition(bg)&4?-1:bh===bg?0:1;if(bi===0){a4=true}return bi}}else{if("sourceIndex" in ab.documentElement){bb=function(bh,bg){if(!bh.sourceIndex||!bg.sourceIndex){if(bh==bg){a4=true}return bh.sourceIndex?-1:1}var bi=bh.sourceIndex-bg.sourceIndex;if(bi===0){a4=true}return bi}}else{if(ab.createRange){bb=function(bj,bh){if(!bj.ownerDocument||!bh.ownerDocument){if(bj==bh){a4=true}return bj.ownerDocument?-1:1}var bi=bj.ownerDocument.createRange(),bg=bh.ownerDocument.createRange();bi.setStart(bj,0);bi.setEnd(bj,0);bg.setStart(bh,0);bg.setEnd(bh,0);var bk=bi.compareBoundaryPoints(Range.START_TO_END,bg);if(bk===0){a4=true}return bk}}}}function aZ(bg){var bh="",bj;for(var bi=0;bg[bi];bi++){bj=bg[bi];if(bj.nodeType===3||bj.nodeType===4){bh+=bj.nodeValue}else{if(bj.nodeType!==8){bh+=aZ(bj.childNodes)}}}return bh}(function(){var bh=ab.createElement("div"),bi="script"+(new Date).getTime();bh.innerHTML="<a name='"+bi+"'/>";var bg=ab.documentElement;bg.insertBefore(bh,bg.firstChild);if(ab.getElementById(bi)){a6.find.ID=function(bk,bl,bm){if(typeof bl.getElementById!=="undefined"&&!bm){var bj=bl.getElementById(bk[1]);return bj?bj.id===bk[1]||typeof bj.getAttributeNode!=="undefined"&&bj.getAttributeNode("id").nodeValue===bk[1]?[bj]:C:[]}};a6.filter.ID=function(bl,bj){var bk=typeof bl.getAttributeNode!=="undefined"&&bl.getAttributeNode("id");return bl.nodeType===1&&bk&&bk.nodeValue===bj}}bg.removeChild(bh);bg=bh=null})();(function(){var bg=ab.createElement("div");bg.appendChild(ab.createComment(""));if(bg.getElementsByTagName("*").length>0){a6.find.TAG=function(bh,bl){var bk=bl.getElementsByTagName(bh[1]);if(bh[1]==="*"){var bj=[];for(var bi=0;bk[bi];bi++){if(bk[bi].nodeType===1){bj.push(bk[bi])}}bk=bj}return bk}}bg.innerHTML="<a href='#'></a>";if(bg.firstChild&&typeof bg.firstChild.getAttribute!=="undefined"&&bg.firstChild.getAttribute("href")!=="#"){a6.attrHandle.href=function(bh){return bh.getAttribute("href",2)}}bg=null})();if(ab.querySelectorAll){(function(){var bg=a0,bi=ab.createElement("div");bi.innerHTML="<p class='TEST'></p>";if(bi.querySelectorAll&&bi.querySelectorAll(".TEST").length===0){return}a0=function(bm,bl,bj,bk){bl=bl||ab;if(!bk&&bl.nodeType===9&&!a1(bl)){try{return a8(bl.querySelectorAll(bm),bj)}catch(bn){}}return bg(bm,bl,bj,bk)};for(var bh in bg){a0[bh]=bg[bh]}bi=null})()}(function(){var bg=ab.createElement("div");bg.innerHTML="<div class='test e'></div><div class='test'></div>";if(!bg.getElementsByClassName||bg.getElementsByClassName("e").length===0){return}bg.lastChild.className="e";if(bg.getElementsByClassName("e").length===1){return}a6.order.splice(1,0,"CLASS");a6.find.CLASS=function(bh,bi,bj){if(typeof bi.getElementsByClassName!=="undefined"&&!bj){return bi.getElementsByClassName(bh[1])}};bg=null})();function aY(bh,bm,bl,bp,bn,bo){for(var bj=0,bi=bp.length;bj<bi;bj++){var bg=bp[bj];if(bg){bg=bg[bh];var bk=false;while(bg){if(bg.sizcache===bl){bk=bp[bg.sizset];break}if(bg.nodeType===1&&!bo){bg.sizcache=bl;bg.sizset=bj}if(bg.nodeName.toLowerCase()===bm){bk=bg;break}bg=bg[bh]}bp[bj]=bk}}}function be(bh,bm,bl,bp,bn,bo){for(var bj=0,bi=bp.length;bj<bi;bj++){var bg=bp[bj];if(bg){bg=bg[bh];var bk=false;while(bg){if(bg.sizcache===bl){bk=bp[bg.sizset];break}if(bg.nodeType===1){if(!bo){bg.sizcache=bl;bg.sizset=bj}if(typeof bm!=="string"){if(bg===bm){bk=true;break}}else{if(a0.filter(bm,[bg]).length>0){bk=bg;break}}}bg=bg[bh]}bp[bj]=bk}}}var a7=ab.compareDocumentPosition?function(bh,bg){return !!(bh.compareDocumentPosition(bg)&16)}:function(bh,bg){return bh!==bg&&(bh.contains?bh.contains(bg):true)};var a1=function(bg){var bh=(bg?bg.ownerDocument||bg:0).documentElement;return bh?bh.nodeName!=="HTML":false};var bd=function(bg,bn){var bj=[],bk="",bl,bi=bn.nodeType?[bn]:bn;while((bl=a6.match.PSEUDO.exec(bg))){bk+=bl[0];bg=bg.replace(a6.match.PSEUDO,"")}bg=a6.relative[bg]?bg+"*":bg;for(var bm=0,bh=bi.length;bm<bh;bm++){a0(bg,bi[bm],bj)}return a0.filter(bk,bj)};a.find=a0;a.expr=a0.selectors;a.expr[":"]=a.expr.filters;a.unique=a0.uniqueSort;a.text=aZ;a.isXMLDoc=a1;a.contains=a7;return;aM.Sizzle=a0})();var N=/Until$/,Y=/^(?:parents|prevUntil|prevAll)/,aL=/,/,F=Array.prototype.slice;var ai=function(a1,a0,aY){if(a.isFunction(a0)){return a.grep(a1,function(a3,a2){return !!a0.call(a3,a2,a3)===aY})}else{if(a0.nodeType){return a.grep(a1,function(a3,a2){return(a3===a0)===aY})}else{if(typeof a0==="string"){var aZ=a.grep(a1,function(a2){return a2.nodeType===1});if(aW.test(a0)){return a.filter(a0,aZ,!aY)}else{a0=a.filter(a0,aZ)}}}}return a.grep(a1,function(a3,a2){return(a.inArray(a3,a0)>=0)===aY})};a.fn.extend({find:function(aY){var a0=this.pushStack("","find",aY),a3=0;for(var a1=0,aZ=this.length;a1<aZ;a1++){a3=a0.length;a.find(aY,this[a1],a0);if(a1>0){for(var a4=a3;a4<a0.length;a4++){for(var a2=0;a2<a3;a2++){if(a0[a2]===a0[a4]){a0.splice(a4--,1);break}}}}}return a0},has:function(aZ){var aY=a(aZ);return this.filter(function(){for(var a1=0,a0=aY.length;a1<a0;a1++){if(a.contains(this,aY[a1])){return true}}})},not:function(aY){return this.pushStack(ai(this,aY,false),"not",aY)},filter:function(aY){return this.pushStack(ai(this,aY,true),"filter",aY)},is:function(aY){return !!aY&&a.filter(aY,this).length>0},closest:function(a7,aY){if(a.isArray(a7)){var a4=[],a6=this[0],a3,a2={},a0;if(a6&&a7.length){for(var a1=0,aZ=a7.length;a1<aZ;a1++){a0=a7[a1];if(!a2[a0]){a2[a0]=a.expr.match.POS.test(a0)?a(a0,aY||this.context):a0}}while(a6&&a6.ownerDocument&&a6!==aY){for(a0 in a2){a3=a2[a0];if(a3.jquery?a3.index(a6)>-1:a(a6).is(a3)){a4.push({selector:a0,elem:a6});delete a2[a0]}}a6=a6.parentNode}}return a4}var a5=a.expr.match.POS.test(a7)?a(a7,aY||this.context):null;return this.map(function(a8,a9){while(a9&&a9.ownerDocument&&a9!==aY){if(a5?a5.index(a9)>-1:a(a9).is(a7)){return a9}a9=a9.parentNode}return null})},index:function(aY){if(!aY||typeof aY==="string"){return a.inArray(this[0],aY?a(aY):this.parent().children())}return a.inArray(aY.jquery?aY[0]:aY,this)},add:function(aY,aZ){var a1=typeof aY==="string"?a(aY,aZ||this.context):a.makeArray(aY),a0=a.merge(this.get(),a1);return this.pushStack(y(a1[0])||y(a0[0])?a0:a.unique(a0))},andSelf:function(){return this.add(this.prevObject)}});function y(aY){return !aY||!aY.parentNode||aY.parentNode.nodeType===11}a.each({parent:function(aZ){var aY=aZ.parentNode;return aY&&aY.nodeType!==11?aY:null},parents:function(aY){return a.dir(aY,"parentNode")},parentsUntil:function(aZ,aY,a0){return a.dir(aZ,"parentNode",a0)},next:function(aY){return a.nth(aY,2,"nextSibling")},prev:function(aY){return a.nth(aY,2,"previousSibling")},nextAll:function(aY){return a.dir(aY,"nextSibling")},prevAll:function(aY){return a.dir(aY,"previousSibling")},nextUntil:function(aZ,aY,a0){return a.dir(aZ,"nextSibling",a0)},prevUntil:function(aZ,aY,a0){return a.dir(aZ,"previousSibling",a0)},siblings:function(aY){return a.sibling(aY.parentNode.firstChild,aY)},children:function(aY){return a.sibling(aY.firstChild)},contents:function(aY){return a.nodeName(aY,"iframe")?aY.contentDocument||aY.contentWindow.document:a.makeArray(aY.childNodes)}},function(aY,aZ){a.fn[aY]=function(a2,a0){var a1=a.map(this,aZ,a2);if(!N.test(aY)){a0=a2}if(a0&&typeof a0==="string"){a1=a.filter(a0,a1)}a1=this.length>1?a.unique(a1):a1;if((this.length>1||aL.test(a0))&&Y.test(aY)){a1=a1.reverse()}return this.pushStack(a1,aY,F.call(arguments).join(","))}});a.extend({filter:function(a0,aY,aZ){if(aZ){a0=":not("+a0+")"}return a.find.matches(a0,aY)},dir:function(a0,aZ,a2){var aY=[],a1=a0[aZ];while(a1&&a1.nodeType!==9&&(a2===C||a1.nodeType!==1||!a(a1).is(a2))){if(a1.nodeType===1){aY.push(a1)}a1=a1[aZ]}return aY},nth:function(a2,aY,a0,a1){aY=aY||1;var aZ=0;for(;a2;a2=a2[a0]){if(a2.nodeType===1&&++aZ===aY){break}}return a2},sibling:function(a0,aZ){var aY=[];for(;a0;a0=a0.nextSibling){if(a0.nodeType===1&&a0!==aZ){aY.push(a0)}}return aY}});var T=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,H=/(<([\w:]+)[^>]*?)\/>/g,al=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,c=/<([\w:]+)/,t=/<tbody/i,L=/<|&#?\w+;/,E=/<script|<object|<embed|<option|<style/i,l=/checked\s*(?:[^=]|=\s*.checked.)/i,p=function(aZ,a0,aY){return al.test(aY)?aZ:a0+"></"+aY+">"},ac={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,"",""]};ac.optgroup=ac.option;ac.tbody=ac.tfoot=ac.colgroup=ac.caption=ac.thead;ac.th=ac.td;if(!a.support.htmlSerialize){ac._default=[1,"div<div>","</div>"]}a.fn.extend({text:function(aY){if(a.isFunction(aY)){return this.each(function(a0){var aZ=a(this);aZ.text(aY.call(this,a0,aZ.text()))})}if(typeof aY!=="object"&&aY!==C){return this.empty().append((this[0]&&this[0].ownerDocument||ab).createTextNode(aY))}return a.text(this)},wrapAll:function(aY){if(a.isFunction(aY)){return this.each(function(a0){a(this).wrapAll(aY.call(this,a0))})}if(this[0]){var aZ=a(aY,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){aZ.insertBefore(this[0])}aZ.map(function(){var a0=this;while(a0.firstChild&&a0.firstChild.nodeType===1){a0=a0.firstChild}return a0}).append(this)}return this},wrapInner:function(aY){if(a.isFunction(aY)){return this.each(function(aZ){a(this).wrapInner(aY.call(this,aZ))})}return this.each(function(){var aZ=a(this),a0=aZ.contents();if(a0.length){a0.wrapAll(aY)}else{aZ.append(aY)}})},wrap:function(aY){return this.each(function(){a(this).wrapAll(aY)})},unwrap:function(){return this.parent().each(function(){if(!a.nodeName(this,"body")){a(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(aY){if(this.nodeType===1){this.appendChild(aY)}})},prepend:function(){return this.domManip(arguments,true,function(aY){if(this.nodeType===1){this.insertBefore(aY,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(aZ){this.parentNode.insertBefore(aZ,this)})}else{if(arguments.length){var aY=a(arguments[0]);aY.push.apply(aY,this.toArray());return this.pushStack(aY,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(aZ){this.parentNode.insertBefore(aZ,this.nextSibling)})}else{if(arguments.length){var aY=this.pushStack(this,"after",arguments);aY.push.apply(aY,a(arguments[0]).toArray());return aY}}},remove:function(aY,a1){for(var aZ=0,a0;(a0=this[aZ])!=null;aZ++){if(!aY||a.filter(aY,[a0]).length){if(!a1&&a0.nodeType===1){a.cleanData(a0.getElementsByTagName("*"));a.cleanData([a0])}if(a0.parentNode){a0.parentNode.removeChild(a0)}}}return this},empty:function(){for(var aY=0,aZ;(aZ=this[aY])!=null;aY++){if(aZ.nodeType===1){a.cleanData(aZ.getElementsByTagName("*"))}while(aZ.firstChild){aZ.removeChild(aZ.firstChild)}}return this},clone:function(aZ){var aY=this.map(function(){if(!a.support.noCloneEvent&&!a.isXMLDoc(this)){var a1=this.outerHTML,a0=this.ownerDocument;if(!a1){var a2=a0.createElement("div");a2.appendChild(this.cloneNode(true));a1=a2.innerHTML}return a.clean([a1.replace(T,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(Z,"")],a0)[0]}else{return this.cloneNode(true)}});if(aZ===true){q(this,aY);q(this.find("*"),aY.find("*"))}return aY},html:function(a0){if(a0===C){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(T,""):null}else{if(typeof a0==="string"&&!E.test(a0)&&(a.support.leadingWhitespace||!Z.test(a0))&&!ac[(c.exec(a0)||["",""])[1].toLowerCase()]){a0=a0.replace(H,p);try{for(var aZ=0,aY=this.length;aZ<aY;aZ++){if(this[aZ].nodeType===1){a.cleanData(this[aZ].getElementsByTagName("*"));this[aZ].innerHTML=a0}}}catch(a1){this.empty().append(a0)}}else{if(a.isFunction(a0)){this.each(function(a4){var a3=a(this),a2=a3.html();a3.empty().append(function(){return a0.call(this,a4,a2)})})}else{this.empty().append(a0)}}}return this},replaceWith:function(aY){if(this[0]&&this[0].parentNode){if(a.isFunction(aY)){return this.each(function(a1){var a0=a(this),aZ=a0.html();a0.replaceWith(aY.call(this,a1,aZ))})}if(typeof aY!=="string"){aY=a(aY).detach()}return this.each(function(){var a0=this.nextSibling,aZ=this.parentNode;a(this).remove();if(a0){a(a0).before(aY)}else{a(aZ).append(aY)}})}else{return this.pushStack(a(a.isFunction(aY)?aY():aY),"replaceWith",aY)}},detach:function(aY){return this.remove(aY,true)},domManip:function(a4,a9,a8){var a1,a2,a7=a4[0],aZ=[],a3,a6;if(!a.support.checkClone&&arguments.length===3&&typeof a7==="string"&&l.test(a7)){return this.each(function(){a(this).domManip(a4,a9,a8,true)})}if(a.isFunction(a7)){return this.each(function(bb){var ba=a(this);a4[0]=a7.call(this,bb,a9?ba.html():C);ba.domManip(a4,a9,a8)})}if(this[0]){a6=a7&&a7.parentNode;if(a.support.parentNode&&a6&&a6.nodeType===11&&a6.childNodes.length===this.length){a1={fragment:a6}}else{a1=J(a4,this,aZ)}a3=a1.fragment;if(a3.childNodes.length===1){a2=a3=a3.firstChild}else{a2=a3.firstChild}if(a2){a9=a9&&a.nodeName(a2,"tr");for(var a0=0,aY=this.length;a0<aY;a0++){a8.call(a9?a5(this[a0],a2):this[a0],a0>0||a1.cacheable||this.length>1?a3.cloneNode(true):a3)}}if(aZ.length){a.each(aZ,aV)}}return this;function a5(ba,bb){return a.nodeName(ba,"table")?(ba.getElementsByTagName("tbody")[0]||ba.appendChild(ba.ownerDocument.createElement("tbody"))):ba}}});function q(a0,aY){var aZ=0;aY.each(function(){if(this.nodeName!==(a0[aZ]&&a0[aZ].nodeName)){return}var a5=a.data(a0[aZ++]),a4=a.data(this,a5),a1=a5&&a5.events;if(a1){delete a4.handle;a4.events={};for(var a3 in a1){for(var a2 in a1[a3]){a.event.add(this,a3,a1[a3][a2],a1[a3][a2].data)}}}})}function J(a3,a1,aZ){var a2,aY,a0,a4=(a1&&a1[0]?a1[0].ownerDocument||a1[0]:ab);if(a3.length===1&&typeof a3[0]==="string"&&a3[0].length<512&&a4===ab&&!E.test(a3[0])&&(a.support.checkClone||!l.test(a3[0]))){aY=true;a0=a.fragments[a3[0]];if(a0){if(a0!==1){a2=a0}}}if(!a2){a2=a4.createDocumentFragment();a.clean(a3,a4,a2,aZ)}if(aY){a.fragments[a3[0]]=a0?a2:1}return{fragment:a2,cacheable:aY}}a.fragments={};a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(aY,aZ){a.fn[aY]=function(a0){var a3=[],a6=a(a0),a5=this.length===1&&this[0].parentNode;if(a5&&a5.nodeType===11&&a5.childNodes.length===1&&a6.length===1){a6[aZ](this[0]);return this}else{for(var a4=0,a1=a6.length;a4<a1;a4++){var a2=(a4>0?this.clone(true):this).get();a.fn[aZ].apply(a(a6[a4]),a2);a3=a3.concat(a2)}return this.pushStack(a3,aY,a6.selector)}}});a.extend({clean:function(a0,a2,a9,a4){a2=a2||ab;if(typeof a2.createElement==="undefined"){a2=a2.ownerDocument||a2[0]&&a2[0].ownerDocument||ab}var ba=[];for(var a8=0,a3;(a3=a0[a8])!=null;a8++){if(typeof a3==="number"){a3+=""}if(!a3){continue}if(typeof a3==="string"&&!L.test(a3)){a3=a2.createTextNode(a3)}else{if(typeof a3==="string"){a3=a3.replace(H,p);var bb=(c.exec(a3)||["",""])[1].toLowerCase(),a1=ac[bb]||ac._default,a7=a1[0],aZ=a2.createElement("div");aZ.innerHTML=a1[1]+a3+a1[2];while(a7--){aZ=aZ.lastChild}if(!a.support.tbody){var aY=t.test(a3),a6=bb==="table"&&!aY?aZ.firstChild&&aZ.firstChild.childNodes:a1[1]==="<table>"&&!aY?aZ.childNodes:[];for(var a5=a6.length-1;a5>=0;--a5){if(a.nodeName(a6[a5],"tbody")&&!a6[a5].childNodes.length){a6[a5].parentNode.removeChild(a6[a5])}}}if(!a.support.leadingWhitespace&&Z.test(a3)){aZ.insertBefore(a2.createTextNode(Z.exec(a3)[0]),aZ.firstChild)}a3=aZ.childNodes}}if(a3.nodeType){ba.push(a3)}else{ba=a.merge(ba,a3)}}if(a9){for(var a8=0;ba[a8];a8++){if(a4&&a.nodeName(ba[a8],"script")&&(!ba[a8].type||ba[a8].type.toLowerCase()==="text/javascript")){a4.push(ba[a8].parentNode?ba[a8].parentNode.removeChild(ba[a8]):ba[a8])}else{if(ba[a8].nodeType===1){ba.splice.apply(ba,[a8+1,0].concat(a.makeArray(ba[a8].getElementsByTagName("script"))))}a9.appendChild(ba[a8])}}}return ba},cleanData:function(aZ){var a2,a0,aY=a.cache,a5=a.event.special,a4=a.support.deleteExpando;for(var a3=0,a1;(a1=aZ[a3])!=null;a3++){a0=a1[a.expando];if(a0){a2=aY[a0];if(a2.events){for(var a6 in a2.events){if(a5[a6]){a.event.remove(a1,a6)}else{ag(a1,a6,a2.handle)}}}if(a4){delete a1[a.expando]}else{if(a1.removeAttribute){a1.removeAttribute(a.expando)}}delete aY[a0]}}}});var ar=/z-?index|font-?weight|opacity|zoom|line-?height/i,U=/alpha\([^)]*\)/,aa=/opacity=([^)]*)/,ah=/float/i,az=/-([a-z])/ig,v=/([A-Z])/g,aO=/^-?\d+(?:px)?$/i,aU=/^-?\d/,aK={position:"absolute",visibility:"hidden",display:"block"},W=["Left","Right"],aE=["Top","Bottom"],ak=ab.defaultView&&ab.defaultView.getComputedStyle,aN=a.support.cssFloat?"cssFloat":"styleFloat",k=function(aY,aZ){return aZ.toUpperCase()};a.fn.css=function(aY,aZ){return an(this,aY,aZ,true,function(a1,a0,a2){if(a2===C){return a.curCSS(a1,a0)}if(typeof a2==="number"&&!ar.test(a0)){a2+="px"}a.style(a1,a0,a2)})};a.extend({style:function(a2,aZ,a3){if(!a2||a2.nodeType===3||a2.nodeType===8){return C}if((aZ==="width"||aZ==="height")&&parseFloat(a3)<0){a3=C}var a1=a2.style||a2,a4=a3!==C;if(!a.support.opacity&&aZ==="opacity"){if(a4){a1.zoom=1;var aY=parseInt(a3,10)+""==="NaN"?"":"alpha(opacity="+a3*100+")";var a0=a1.filter||a.curCSS(a2,"filter")||"";a1.filter=U.test(a0)?a0.replace(U,aY):aY}return a1.filter&&a1.filter.indexOf("opacity=")>=0?(parseFloat(aa.exec(a1.filter)[1])/100)+"":""}if(ah.test(aZ)){aZ=aN}aZ=aZ.replace(az,k);if(a4){a1[aZ]=a3}return a1[aZ]},css:function(a1,aZ,a3,aY){if(aZ==="width"||aZ==="height"){var a5,a0=aK,a4=aZ==="width"?W:aE;function a2(){a5=aZ==="width"?a1.offsetWidth:a1.offsetHeight;if(aY==="border"){return}a.each(a4,function(){if(!aY){a5-=parseFloat(a.curCSS(a1,"padding"+this,true))||0}if(aY==="margin"){a5+=parseFloat(a.curCSS(a1,"margin"+this,true))||0}else{a5-=parseFloat(a.curCSS(a1,"border"+this+"Width",true))||0}})}if(a1.offsetWidth!==0){a2()}else{a.swap(a1,a0,a2)}return Math.max(0,Math.round(a5))}return a.curCSS(a1,aZ,a3)},curCSS:function(a4,aZ,a0){var a7,aY=a4.style,a1;if(!a.support.opacity&&aZ==="opacity"&&a4.currentStyle){a7=aa.test(a4.currentStyle.filter||"")?(parseFloat(RegExp.$1)/100)+"":"";return a7===""?"1":a7}if(ah.test(aZ)){aZ=aN}if(!a0&&aY&&aY[aZ]){a7=aY[aZ]}else{if(ak){if(ah.test(aZ)){aZ="float"}aZ=aZ.replace(v,"-$1").toLowerCase();var a6=a4.ownerDocument.defaultView;if(!a6){return null}var a8=a6.getComputedStyle(a4,null);if(a8){a7=a8.getPropertyValue(aZ)}if(aZ==="opacity"&&a7===""){a7="1"}}else{if(a4.currentStyle){var a3=aZ.replace(az,k);a7=a4.currentStyle[aZ]||a4.currentStyle[a3];if(!aO.test(a7)&&aU.test(a7)){var a2=aY.left,a5=a4.runtimeStyle.left;a4.runtimeStyle.left=a4.currentStyle.left;aY.left=a3==="fontSize"?"1em":(a7||0);a7=aY.pixelLeft+"px";aY.left=a2;a4.runtimeStyle.left=a5}}}}return a7},swap:function(a1,a0,a2){var aY={};for(var aZ in a0){aY[aZ]=a1.style[aZ];a1.style[aZ]=a0[aZ]}a2.call(a1);for(var aZ in a0){a1.style[aZ]=aY[aZ]}}});if(a.expr&&a.expr.filters){a.expr.filters.hidden=function(a1){var aZ=a1.offsetWidth,aY=a1.offsetHeight,a0=a1.nodeName.toLowerCase()==="tr";return aZ===0&&aY===0&&!a0?true:aZ>0&&aY>0&&!a0?false:a.curCSS(a1,"display")==="none"};a.expr.filters.visible=function(aY){return !a.expr.filters.hidden(aY)}}var af=aP(),aJ=/<script(.|\s)*?\/script>/gi,o=/select|textarea/i,aB=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,r=/=\?(&|$)/,D=/\?/,aX=/(\?|&)_=.*?(&|$)/,B=/^(\w+:)?\/\/([^\/?#]+)/,h=/%20/g,w=a.fn.load;a.fn.extend({load:function(a0,a3,a4){if(typeof a0!=="string"){return w.call(this,a0)}else{if(!this.length){return this}}var a2=a0.indexOf(" ");if(a2>=0){var aY=a0.slice(a2,a0.length);a0=a0.slice(0,a2)}var a1="GET";if(a3){if(a.isFunction(a3)){a4=a3;a3=null}else{if(typeof a3==="object"){a3=a.param(a3,a.ajaxSettings.traditional);a1="POST"}}}var aZ=this;a.ajax({url:a0,type:a1,dataType:"html",data:a3,complete:function(a6,a5){if(a5==="success"||a5==="notmodified"){aZ.html(aY?a("<div />").append(a6.responseText.replace(aJ,"")).find(aY):a6.responseText)}if(a4){aZ.each(a4,[a6.responseText,a5,a6])}}});return this},serialize:function(){return a.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?a.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||o.test(this.nodeName)||aB.test(this.type))}).map(function(aY,aZ){var a0=a(this).val();return a0==null?null:a.isArray(a0)?a.map(a0,function(a2,a1){return{name:aZ.name,value:a2}}):{name:aZ.name,value:a0}}).get()}});a.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(aY,aZ){a.fn[aZ]=function(a0){return this.bind(aZ,a0)}});a.extend({get:function(aY,a0,a1,aZ){if(a.isFunction(a0)){aZ=aZ||a1;a1=a0;a0=null}return a.ajax({type:"GET",url:aY,data:a0,success:a1,dataType:aZ})},getScript:function(aY,aZ){return a.get(aY,null,aZ,"script")},getJSON:function(aY,aZ,a0){return a.get(aY,aZ,a0,"json")},post:function(aY,a0,a1,aZ){if(a.isFunction(a0)){aZ=aZ||a1;a1=a0;a0={}}return a.ajax({type:"POST",url:aY,data:a0,success:a1,dataType:aZ})},ajaxSetup:function(aY){a.extend(a.ajaxSettings,aY)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:aM.XMLHttpRequest&&(aM.location.protocol!=="file:"||!aM.ActiveXObject)?function(){return new aM.XMLHttpRequest()}:function(){try{return new aM.ActiveXObject("Microsoft.XMLHTTP")}catch(aY){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(bd){var a8=a.extend(true,{},a.ajaxSettings,bd);var bi,bc,bh,bj=bd&&bd.context||a8,a0=a8.type.toUpperCase();if(a8.data&&a8.processData&&typeof a8.data!=="string"){a8.data=a.param(a8.data,a8.traditional)}if(a8.dataType==="jsonp"){if(a0==="GET"){if(!r.test(a8.url)){a8.url+=(D.test(a8.url)?"&":"?")+(a8.jsonp||"callback")+"=?"}}else{if(!a8.data||!r.test(a8.data)){a8.data=(a8.data?a8.data+"&":"")+(a8.jsonp||"callback")+"=?"}}a8.dataType="json"}if(a8.dataType==="json"&&(a8.data&&r.test(a8.data)||r.test(a8.url))){bi=a8.jsonpCallback||("jsonp"+af++);if(a8.data){a8.data=(a8.data+"").replace(r,"="+bi+"$1")}a8.url=a8.url.replace(r,"="+bi+"$1");a8.dataType="script";aM[bi]=aM[bi]||function(bk){bh=bk;a3();a6();aM[bi]=C;try{delete aM[bi]}catch(bl){}if(a1){a1.removeChild(bf)}}}if(a8.dataType==="script"&&a8.cache===null){a8.cache=false}if(a8.cache===false&&a0==="GET"){var aY=aP();var bg=a8.url.replace(aX,"$1_="+aY+"$2");a8.url=bg+((bg===a8.url)?(D.test(a8.url)?"&":"?")+"_="+aY:"")}if(a8.data&&a0==="GET"){a8.url+=(D.test(a8.url)?"&":"?")+a8.data}if(a8.global&&!a.active++){a.event.trigger("ajaxStart")}var bb=B.exec(a8.url),a2=bb&&(bb[1]&&bb[1]!==location.protocol||bb[2]!==location.host);if(a8.dataType==="script"&&a0==="GET"&&a2){var a1=ab.getElementsByTagName("head")[0]||ab.documentElement;var bf=ab.createElement("script");bf.src=a8.url;if(a8.scriptCharset){bf.charset=a8.scriptCharset}if(!bi){var ba=false;bf.onload=bf.onreadystatechange=function(){if(!ba&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){ba=true;a3();a6();bf.onload=bf.onreadystatechange=null;if(a1&&bf.parentNode){a1.removeChild(bf)}}}}a1.insertBefore(bf,a1.firstChild);return C}var a5=false;var a4=a8.xhr();if(!a4){return}if(a8.username){a4.open(a0,a8.url,a8.async,a8.username,a8.password)}else{a4.open(a0,a8.url,a8.async)}try{if(a8.data||bd&&bd.contentType){a4.setRequestHeader("Content-Type",a8.contentType)}if(a8.ifModified){if(a.lastModified[a8.url]){a4.setRequestHeader("If-Modified-Since",a.lastModified[a8.url])}if(a.etag[a8.url]){a4.setRequestHeader("If-None-Match",a.etag[a8.url])}}if(!a2){a4.setRequestHeader("X-Requested-With","XMLHttpRequest")}a4.setRequestHeader("Accept",a8.dataType&&a8.accepts[a8.dataType]?a8.accepts[a8.dataType]+", */*":a8.accepts._default)}catch(be){}if(a8.beforeSend&&a8.beforeSend.call(bj,a4,a8)===false){if(a8.global&&!--a.active){a.event.trigger("ajaxStop")}a4.abort();return false}if(a8.global){a9("ajaxSend",[a4,a8])}var a7=a4.onreadystatechange=function(bk){if(!a4||a4.readyState===0||bk==="abort"){if(!a5){a6()}a5=true;if(a4){a4.onreadystatechange=a.noop}}else{if(!a5&&a4&&(a4.readyState===4||bk==="timeout")){a5=true;a4.onreadystatechange=a.noop;bc=bk==="timeout"?"timeout":!a.httpSuccess(a4)?"error":a8.ifModified&&a.httpNotModified(a4,a8.url)?"notmodified":"success";var bm;if(bc==="success"){try{bh=a.httpData(a4,a8.dataType,a8)}catch(bl){bc="parsererror";bm=bl}}if(bc==="success"||bc==="notmodified"){if(!bi){a3()}}else{a.handleError(a8,a4,bc,bm)}a6();if(bk==="timeout"){a4.abort()}if(a8.async){a4=null}}}};try{var aZ=a4.abort;a4.abort=function(){if(a4){aZ.call(a4)}a7("abort")}}catch(be){}if(a8.async&&a8.timeout>0){setTimeout(function(){if(a4&&!a5){a7("timeout")}},a8.timeout)}try{a4.send(a0==="POST"||a0==="PUT"||a0==="DELETE"?a8.data:null)}catch(be){a.handleError(a8,a4,null,be);a6()}if(!a8.async){a7()}function a3(){if(a8.success){a8.success.call(bj,bh,bc,a4)}if(a8.global){a9("ajaxSuccess",[a4,a8])}}function a6(){if(a8.complete){a8.complete.call(bj,a4,bc)}if(a8.global){a9("ajaxComplete",[a4,a8])}if(a8.global&&!--a.active){a.event.trigger("ajaxStop")}}function a9(bl,bk){(a8.context?a(a8.context):a.event).trigger(bl,bk)}return a4},handleError:function(aZ,a1,aY,a0){if(aZ.error){aZ.error.call(aZ.context||aZ,a1,aY,a0)}if(aZ.global){(aZ.context?a(aZ.context):a.event).trigger("ajaxError",[a1,aZ,a0])}},active:0,httpSuccess:function(aZ){try{return !aZ.status&&location.protocol==="file:"||(aZ.status>=200&&aZ.status<300)||aZ.status===304||aZ.status===1223||aZ.status===0}catch(aY){}return false},httpNotModified:function(a1,aY){var a0=a1.getResponseHeader("Last-Modified"),aZ=a1.getResponseHeader("Etag");if(a0){a.lastModified[aY]=a0}if(aZ){a.etag[aY]=aZ}return a1.status===304||a1.status===0},httpData:function(a3,a1,a0){var aZ=a3.getResponseHeader("content-type")||"",aY=a1==="xml"||!a1&&aZ.indexOf("xml")>=0,a2=aY?a3.responseXML:a3.responseText;if(aY&&a2.documentElement.nodeName==="parsererror"){a.error("parsererror")}if(a0&&a0.dataFilter){a2=a0.dataFilter(a2,a1)}if(typeof a2==="string"){if(a1==="json"||!a1&&aZ.indexOf("json")>=0){a2=a.parseJSON(a2)}else{if(a1==="script"||!a1&&aZ.indexOf("javascript")>=0){a.globalEval(a2)}}}return a2},param:function(aY,a1){var aZ=[];if(a1===C){a1=a.ajaxSettings.traditional}if(a.isArray(aY)||aY.jquery){a.each(aY,function(){a3(this.name,this.value)})}else{for(var a2 in aY){a0(a2,aY[a2])}}return aZ.join("&").replace(h,"+");function a0(a4,a5){if(a.isArray(a5)){a.each(a5,function(a7,a6){if(a1||/\[\]$/.test(a4)){a3(a4,a6)}else{a0(a4+"["+(typeof a6==="object"||a.isArray(a6)?a7:"")+"]",a6)}})}else{if(!a1&&a5!=null&&typeof a5==="object"){a.each(a5,function(a7,a6){a0(a4+"["+a7+"]",a6)})}else{a3(a4,a5)}}}function a3(a4,a5){a5=a.isFunction(a5)?a5():a5;aZ[aZ.length]=encodeURIComponent(a4)+"="+encodeURIComponent(a5)}}});var G={},ae=/toggle|show|hide/,au=/^([+-]=)?([\d+-.]+)(.*)$/,aF,aj=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];a.fn.extend({show:function(aZ,a7){if(aZ||aZ===0){return this.animate(aD("show",3),aZ,a7)}else{for(var a4=0,a1=this.length;a4<a1;a4++){var aY=a.data(this[a4],"olddisplay");this[a4].style.display=aY||"";if(a.css(this[a4],"display")==="none"){var a6=this[a4].nodeName,a5;if(G[a6]){a5=G[a6]}else{var a0=a("<"+a6+" />").appendTo("body");a5=a0.css("display");if(a5==="none"){a5="block"}a0.remove();G[a6]=a5}a.data(this[a4],"olddisplay",a5)}}for(var a3=0,a2=this.length;a3<a2;a3++){this[a3].style.display=a.data(this[a3],"olddisplay")||""}return this}},hide:function(a3,a4){if(a3||a3===0){return this.animate(aD("hide",3),a3,a4)}else{for(var a2=0,aZ=this.length;a2<aZ;a2++){var aY=a.data(this[a2],"olddisplay");if(!aY&&aY!=="none"){a.data(this[a2],"olddisplay",a.css(this[a2],"display"))}}for(var a1=0,a0=this.length;a1<a0;a1++){this[a1].style.display="none"}return this}},_toggle:a.fn.toggle,toggle:function(a0,aZ){var aY=typeof a0==="boolean";if(a.isFunction(a0)&&a.isFunction(aZ)){this._toggle.apply(this,arguments)}else{if(a0==null||aY){this.each(function(){var a1=aY?a0:a(this).is(":hidden");a(this)[a1?"show":"hide"]()})}else{this.animate(aD("toggle",3),a0,aZ)}}return this},fadeTo:function(aY,a0,aZ){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:a0},aY,aZ)},animate:function(a2,aZ,a1,a0){var aY=a.speed(aZ,a1,a0);if(a.isEmptyObject(a2)){return this.each(aY.complete)}return this[aY.queue===false?"each":"queue"](function(){var a5=a.extend({},aY),a7,a6=this.nodeType===1&&a(this).is(":hidden"),a3=this;for(a7 in a2){var a4=a7.replace(az,k);if(a7!==a4){a2[a4]=a2[a7];delete a2[a7];a7=a4}if(a2[a7]==="hide"&&a6||a2[a7]==="show"&&!a6){return a5.complete.call(this)}if((a7==="height"||a7==="width")&&this.style){a5.display=a.css(this,"display");a5.overflow=this.style.overflow}if(a.isArray(a2[a7])){(a5.specialEasing=a5.specialEasing||{})[a7]=a2[a7][1];a2[a7]=a2[a7][0]}}if(a5.overflow!=null){this.style.overflow="hidden"}a5.curAnim=a.extend({},a2);a.each(a2,function(a9,bd){var bc=new a.fx(a3,a5,a9);if(ae.test(bd)){bc[bd==="toggle"?a6?"show":"hide":bd](a2)}else{var bb=au.exec(bd),be=bc.cur(true)||0;if(bb){var a8=parseFloat(bb[2]),ba=bb[3]||"px";if(ba!=="px"){a3.style[a9]=(a8||1)+ba;be=((a8||1)/bc.cur(true))*be;a3.style[a9]=be+ba}if(bb[1]){a8=((bb[1]==="-="?-1:1)*a8)+be}bc.custom(be,a8,ba)}else{bc.custom(be,bd,"")}}});return true})},stop:function(aZ,aY){var a0=a.timers;if(aZ){this.queue([])}this.each(function(){for(var a1=a0.length-1;a1>=0;a1--){if(a0[a1].elem===this){if(aY){a0[a1](true)}a0.splice(a1,1)}}});if(!aY){this.dequeue()}return this}});a.each({slideDown:aD("show",1),slideUp:aD("hide",1),slideToggle:aD("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(aY,aZ){a.fn[aY]=function(a0,a1){return this.animate(aZ,a0,a1)}});a.extend({speed:function(a0,a1,aZ){var aY=a0&&typeof a0==="object"?a0:{complete:aZ||!aZ&&a1||a.isFunction(a0)&&a0,duration:a0,easing:aZ&&a1||a1&&!a.isFunction(a1)&&a1};aY.duration=a.fx.off?0:typeof aY.duration==="number"?aY.duration:a.fx.speeds[aY.duration]||a.fx.speeds._default;aY.old=aY.complete;aY.complete=function(){if(aY.queue!==false){a(this).dequeue()}if(a.isFunction(aY.old)){aY.old.call(this)}};return aY},easing:{linear:function(a0,a1,aY,aZ){return aY+aZ*a0},swing:function(a0,a1,aY,aZ){return((-Math.cos(a0*Math.PI)/2)+0.5)*aZ+aY}},timers:[],fx:function(aZ,aY,a0){this.options=aY;this.elem=aZ;this.prop=a0;if(!aY.orig){aY.orig={}}}});a.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(a.fx.step[this.prop]||a.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(aZ){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var aY=parseFloat(a.css(this.elem,this.prop,aZ));return aY&&aY>-10000?aY:parseFloat(a.curCSS(this.elem,this.prop))||0},custom:function(a2,a1,a0){this.startTime=aP();this.start=a2;this.end=a1;this.unit=a0||this.unit||"px";this.now=this.start;this.pos=this.state=0;var aY=this;function aZ(a3){return aY.step(a3)}aZ.elem=this.elem;if(aZ()&&a.timers.push(aZ)&&!aF){aF=setInterval(a.fx.tick,13)}},show:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());a(this.elem).show()},hide:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a1){var a6=aP(),a2=true;if(a1||a6>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var a3 in this.options.curAnim){if(this.options.curAnim[a3]!==true){a2=false}}if(a2){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;var a0=a.data(this.elem,"olddisplay");this.elem.style.display=a0?a0:this.options.display;if(a.css(this.elem,"display")==="none"){this.elem.style.display="block"}}if(this.options.hide){a(this.elem).hide()}if(this.options.hide||this.options.show){for(var aY in this.options.curAnim){a.style(this.elem,aY,this.options.orig[aY])}}this.options.complete.call(this.elem)}return false}else{var aZ=a6-this.startTime;this.state=aZ/this.options.duration;var a4=this.options.specialEasing&&this.options.specialEasing[this.prop];var a5=this.options.easing||(a.easing.swing?"swing":"linear");this.pos=a.easing[a4||a5](this.state,aZ,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};a.extend(a.fx,{tick:function(){var aZ=a.timers;for(var aY=0;aY<aZ.length;aY++){if(!aZ[aY]()){aZ.splice(aY--,1)}}if(!aZ.length){a.fx.stop()}},stop:function(){clearInterval(aF);aF=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(aY){a.style(aY.elem,"opacity",aY.now)},_default:function(aY){if(aY.elem.style&&aY.elem.style[aY.prop]!=null){aY.elem.style[aY.prop]=(aY.prop==="width"||aY.prop==="height"?Math.max(0,aY.now):aY.now)+aY.unit}else{aY.elem[aY.prop]=aY.now}}}});if(a.expr&&a.expr.filters){a.expr.filters.animated=function(aY){return a.grep(a.timers,function(aZ){return aY===aZ.elem}).length}}function aD(aZ,aY){var a0={};a.each(aj.concat.apply([],aj.slice(0,aY)),function(){a0[this]=aZ});return a0}if("getBoundingClientRect" in ab.documentElement){a.fn.offset=function(a7){var a0=this[0];if(a7){return this.each(function(a8){a.offset.setOffset(this,a7,a8)})}if(!a0||!a0.ownerDocument){return null}if(a0===a0.ownerDocument.body){return a.offset.bodyOffset(a0)}var a2=a0.getBoundingClientRect(),a6=a0.ownerDocument,a3=a6.body,aY=a6.documentElement,a1=aY.clientTop||a3.clientTop||0,a4=aY.clientLeft||a3.clientLeft||0,a5=a2.top+(self.pageYOffset||a.support.boxModel&&aY.scrollTop||a3.scrollTop)-a1,aZ=a2.left+(self.pageXOffset||a.support.boxModel&&aY.scrollLeft||a3.scrollLeft)-a4;return{top:a5,left:aZ}}}else{a.fn.offset=function(a9){var a3=this[0];if(a9){return this.each(function(ba){a.offset.setOffset(this,a9,ba)})}if(!a3||!a3.ownerDocument){return null}if(a3===a3.ownerDocument.body){return a.offset.bodyOffset(a3)}a.offset.initialize();var a0=a3.offsetParent,aZ=a3,a8=a3.ownerDocument,a6,a1=a8.documentElement,a4=a8.body,a5=a8.defaultView,aY=a5?a5.getComputedStyle(a3,null):a3.currentStyle,a7=a3.offsetTop,a2=a3.offsetLeft;while((a3=a3.parentNode)&&a3!==a4&&a3!==a1){if(a.offset.supportsFixedPosition&&aY.position==="fixed"){break}a6=a5?a5.getComputedStyle(a3,null):a3.currentStyle;a7-=a3.scrollTop;a2-=a3.scrollLeft;if(a3===a0){a7+=a3.offsetTop;a2+=a3.offsetLeft;if(a.offset.doesNotAddBorder&&!(a.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(a3.nodeName))){a7+=parseFloat(a6.borderTopWidth)||0;a2+=parseFloat(a6.borderLeftWidth)||0}aZ=a0,a0=a3.offsetParent}if(a.offset.subtractsBorderForOverflowNotVisible&&a6.overflow!=="visible"){a7+=parseFloat(a6.borderTopWidth)||0;a2+=parseFloat(a6.borderLeftWidth)||0}aY=a6}if(aY.position==="relative"||aY.position==="static"){a7+=a4.offsetTop;a2+=a4.offsetLeft}if(a.offset.supportsFixedPosition&&aY.position==="fixed"){a7+=Math.max(a1.scrollTop,a4.scrollTop);a2+=Math.max(a1.scrollLeft,a4.scrollLeft)}return{top:a7,left:a2}}}a.offset={initialize:function(){var aY=ab.body,aZ=ab.createElement("div"),a2,a4,a3,a5,a0=parseFloat(a.curCSS(aY,"marginTop",true))||0,a1="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.extend(aZ.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});aZ.innerHTML=a1;aY.insertBefore(aZ,aY.firstChild);a2=aZ.firstChild;a4=a2.firstChild;a5=a2.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(a4.offsetTop!==5);this.doesAddBorderForTableAndCells=(a5.offsetTop===5);a4.style.position="fixed",a4.style.top="20px";this.supportsFixedPosition=(a4.offsetTop===20||a4.offsetTop===15);a4.style.position=a4.style.top="";a2.style.overflow="hidden",a2.style.position="relative";this.subtractsBorderForOverflowNotVisible=(a4.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(aY.offsetTop!==a0);aY.removeChild(aZ);aY=aZ=a2=a4=a3=a5=null;a.offset.initialize=a.noop},bodyOffset:function(aY){var a0=aY.offsetTop,aZ=aY.offsetLeft;a.offset.initialize();if(a.offset.doesNotIncludeMarginInBodyOffset){a0+=parseFloat(a.curCSS(aY,"marginTop",true))||0;aZ+=parseFloat(a.curCSS(aY,"marginLeft",true))||0}return{top:a0,left:aZ}},setOffset:function(a3,aZ,a0){if(/static/.test(a.curCSS(a3,"position"))){a3.style.position="relative"}var a2=a(a3),a5=a2.offset(),aY=parseInt(a.curCSS(a3,"top",true),10)||0,a4=parseInt(a.curCSS(a3,"left",true),10)||0;if(a.isFunction(aZ)){aZ=aZ.call(a3,a0,a5)}var a1={top:(aZ.top-a5.top)+aY,left:(aZ.left-a5.left)+a4};if("using" in aZ){aZ.using.call(a3,a1)}else{a2.css(a1)}}};a.fn.extend({position:function(){if(!this[0]){return null}var a0=this[0],aZ=this.offsetParent(),a1=this.offset(),aY=/^body|html$/i.test(aZ[0].nodeName)?{top:0,left:0}:aZ.offset();a1.top-=parseFloat(a.curCSS(a0,"marginTop",true))||0;a1.left-=parseFloat(a.curCSS(a0,"marginLeft",true))||0;aY.top+=parseFloat(a.curCSS(aZ[0],"borderTopWidth",true))||0;aY.left+=parseFloat(a.curCSS(aZ[0],"borderLeftWidth",true))||0;return{top:a1.top-aY.top,left:a1.left-aY.left}},offsetParent:function(){return this.map(function(){var aY=this.offsetParent||ab.body;while(aY&&(!/^body|html$/i.test(aY.nodeName)&&a.css(aY,"position")==="static")){aY=aY.offsetParent}return aY})}});a.each(["Left","Top"],function(aZ,aY){var a0="scroll"+aY;a.fn[a0]=function(a3){var a1=this[0],a2;if(!a1){return null}if(a3!==C){return this.each(function(){a2=am(this);if(a2){a2.scrollTo(!aZ?a3:a(a2).scrollLeft(),aZ?a3:a(a2).scrollTop())}else{this[a0]=a3}})}else{a2=am(a1);return a2?("pageXOffset" in a2)?a2[aZ?"pageYOffset":"pageXOffset"]:a.support.boxModel&&a2.document.documentElement[a0]||a2.document.body[a0]:a1[a0]}}});function am(aY){return("scrollTo" in aY&&aY.document)?aY:aY.nodeType===9?aY.defaultView||aY.parentWindow:false}a.each(["Height","Width"],function(aZ,aY){var a0=aY.toLowerCase();a.fn["inner"+aY]=function(){return this[0]?a.css(this[0],a0,false,"padding"):null};a.fn["outer"+aY]=function(a1){return this[0]?a.css(this[0],a0,false,a1?"margin":"border"):null};a.fn[a0]=function(a1){var a2=this[0];if(!a2){return a1==null?null:this}if(a.isFunction(a1)){return this.each(function(a4){var a3=a(this);a3[a0](a1.call(this,a4,a3[a0]()))})}return("scrollTo" in a2&&a2.document)?a2.document.compatMode==="CSS1Compat"&&a2.document.documentElement["client"+aY]||a2.document.body["client"+aY]:(a2.nodeType===9)?Math.max(a2.documentElement["client"+aY],a2.body["scroll"+aY],a2.documentElement["scroll"+aY],a2.body["offset"+aY],a2.documentElement["offset"+aY]):a1===C?a.css(a2,a0):this.css(a0,typeof a1==="string"?a1:a1+"px")}});aM.jQuery=aM.$=a})(window);(function(bO,r,bb){var b2=bO.jQuery.noConflict(true);if(typeof r.getAttribute==q){r.getAttribute=function(){}}var al=function(cP){return cc(cP)?cP.toLowerCase():cP};var bA=function(cP){return cc(cP)?cP.toUpperCase():cP};var aB=function(cP){return cc(cP)?cP.replace(/[A-Z]/g,function(cQ){return H(cQ.charCodeAt(0)|32)}):cP};var b8=function(cP){return cc(cP)?cP.replace(/[a-z]/g,function(cQ){return H(cQ.charCodeAt(0)&~32)}):cP};if("i"!=="I".toLowerCase()){al=aB;bA=b8}function H(cP){return String.fromCharCode(cP)}var cL=undefined,a2=null,br="$element",S="angular",aZ="array",b3="boolean",bt="console",a7="date",aH="display",cw="element",bs="function",ah="length",Z="name",b="none",cy="noop",v="null",cb="number",aL="object",Q="string",q="undefined",a="ng-exception",k="ng-validation-error",o="noop",bi=-99999,am=-1000,ca=99999,aI={FIRST:bi,LAST:ca,WATCH:am},cr=bO.jQuery||bO["$"],b4=bO._,ar=parseInt((/msie (\d+)/.exec(al(navigator.userAgent))||[])[1],10),ce=cr||cE,ac=Array.prototype.slice,B=Array.prototype.push,cz=bO[bt]?bx(bO[bt],bO[bt]["error"]||j):j,ay=bO[S]||(bO[S]={}),ae=bh(ay,"markup"),s=bh(ay,"attrMarkup"),aa=bh(ay,"directive"),A=bh(ay,"widget",al),aG=bh(ay,"validator"),co=bh(ay,"filter"),l=bh(ay,"formatter"),bl=bh(ay,"service"),ba=bh(ay,"callbacks"),at,ab=/^(|.*\/)angular(-.*?)?(\.min)?.js(\?[^#]*)?(#(.*))?$/;function aO(cS,cR,cQ){var cP;if(cS){if(E(cS)){for(cP in cS){if(cP!="prototype"&&cP!=ah&&cP!=Z&&cS.hasOwnProperty(cP)){cR.call(cQ,cS[cP],cP)}}}else{if(cS.forEach){cS.forEach(cR,cQ)}else{if(cK(cS)&&aQ(cS.length)){for(cP=0;cP<cS.length;cP++){cR.call(cQ,cS[cP],cP)}}else{for(cP in cS){cR.call(cQ,cS[cP],cP)}}}}}return cS}function aq(cU,cS,cR){var cT=[];for(var cQ in cU){cT.push(cQ)}cT.sort();for(var cP=0;cP<cT.length;cP++){cS.call(cR,cU[cT[cP]],cT[cP])}return cT}function b1(cP){aO(arguments,function(cQ){if(cQ!==cP){aO(cQ,function(cS,cR){cP[cR]=cS})}});return cP}function bZ(cQ,cP){return b1(new (b1(function(){},{prototype:cQ}))(),cP)}function j(){}function aC(cP){return cP}function cl(cP){return function(){return cP}}function bh(cR,cQ,cP){var cS;return cR[cQ]||(cS=cR[cQ]=function(cT,cU,cV){cT=(cP||aC)(cT);if(cp(cU)){if(cp(cS[cT])){aO(cS[cT],function(cX,cW){if(cW.charAt(0)=="$"&&bu(cU[cW])){cU[cW]=cX}})}cS[cT]=b1(cU,cV||{})}return cS[cT]})}function cE(cP){if(cP){if(cc(cP)){var cQ=r.createElement("div");cQ.innerHTML=cP;cP=new bn(cQ.childNodes)}else{if(!(cP instanceof bn)&&bB(cP)){cP=new bn(cP)}}}return cP}function bu(cP){return typeof cP==q}function cp(cP){return typeof cP!=q}function cK(cP){return cP!=a2&&typeof cP==aL}function cc(cP){return typeof cP==Q}function aQ(cP){return typeof cP==cb}function aw(cP){return cP instanceof Date}function a5(cP){return cP instanceof Array}function E(cP){return typeof cP==bs}function a9(cP){return typeof cP==b3}function t(cP){return at(cP)=="#text"}function au(cP){return cc(cP)?cP.replace(/^\s*/,"").replace(/\s*$/,""):cP}function bB(cP){return cP&&(cP.nodeName||cP instanceof bn||(cr&&cP instanceof cr))}function aS(cQ,cR){this.html=cQ;this.get=al(cR)=="unsafe"?cl(cQ):function cP(){var cS=[];aN(cQ,a1(cS));return cS.join("")}}if(ar){at=function(cP){cP=cP.nodeName?cP:cP[0];return(cP.scopeName&&cP.scopeName!="HTML")?bA(cP.scopeName+":"+cP.nodeName):cP.nodeName}}else{at=function(cP){return cP.nodeName?cP.nodeName:cP[0].nodeName}}function z(cP){return ce(cP[0].cloneNode(true))}function aM(cQ){var cS=cQ[0].getBoundingClientRect(),cR=(cS.width||(cS.right||0-cS.left||0)),cP=(cS.height||(cS.bottom||0-cS.top||0));return cR>0&&cP>0}function aE(cS,cR,cQ){var cP=[];aO(cS,function(cV,cT,cU){cP.push(cR.call(cQ,cV,cT,cU))});return cP}function av(cQ){var cP=0;if(cQ){if(aQ(cQ.length)){return cQ.length}else{if(cK(cQ)){for(key in cQ){cP++}}}}return cP}function u(cR,cQ){for(var cP=0;cP<cR.length;cP++){if(cQ===cR[cP]){return true}}return false}function cH(cR,cQ){for(var cP=0;cP<cR.length;cP++){if(cQ===cR[cP]){return cP}}return -1}function bY(cP){if(cP){switch(cP.nodeName){case"OPTION":case"PRE":case"TITLE":return true}}return false}function bo(cS,cP){if(!cP){cP=cS;if(cS){if(a5(cS)){cP=bo(cS,[])}else{if(aw(cS)){cP=new Date(cS.getTime())}else{if(cK(cS)){cP=bo(cS,{})}}}}}else{if(a5(cS)){while(cP.length){cP.pop()}for(var cR=0;cR<cS.length;cR++){cP.push(bo(cS[cR]))}}else{aO(cP,function(cU,cT){delete cP[cT]});for(var cQ in cS){cP[cQ]=bo(cS[cQ])}}}return cP}function p(cV,cU){if(cV==cU){return true}var cT=typeof cV,cR=typeof cU,cS,cQ,cP;if(cT==cR&&cT=="object"){if(cV instanceof Array){if((cS=cV.length)==cU.length){for(cQ=0;cQ<cS;cQ++){if(!p(cV[cQ],cU[cQ])){return false}}return true}}else{cP={};for(cQ in cV){if(cQ.charAt(0)!=="$"&&!E(cV[cQ])&&!p(cV[cQ],cU[cQ])){return false}cP[cQ]=true}for(cQ in cU){if(!cP[cQ]&&cQ.charAt(0)!=="$"&&!E(cU[cQ])){return false}}return true}}return false}function V(cQ,cP){if(bY(cQ)){if(ar){cQ.innerText=cP}else{cQ.textContent=cP}}else{cQ.innerHTML=cP}}function bE(cQ){var cP=cQ&&cQ[0]&&cQ[0].nodeName;return cP&&cP.charAt(0)!="#"&&!u(["TR","COL","COLGROUP","TBODY","THEAD","TFOOT"],cP)}function bU(cQ,cR,cP){while(!bE(cQ)){cQ=cQ.parent()||ce(r.body)}if(cQ[0]["$NG_ERROR"]!==cP){cQ[0]["$NG_ERROR"]=cP;if(cP){cQ.addClass(cR);cQ.attr(cR,cP)}else{cQ.removeClass(cR);cQ.removeAttr(cR)}}}function a8(cR,cQ,cP){return cR.concat(ac.call(cQ,cP,cQ.length))}function bx(cQ,cR){var cP=arguments.length>2?ac.call(arguments,2,arguments.length):[];if(typeof cR==bs){return cP.length?function(){return arguments.length?cR.apply(cQ,cP.concat(ac.call(arguments,0,arguments.length))):cR.apply(cQ,cP)}:function(){return arguments.length?cR.apply(cQ,arguments):cR.call(cQ)}}else{return cR}}function cj(cQ){if(cQ&&cQ.length!==0){var cP=al(""+cQ);cQ=!(cP=="f"||cP=="0"||cP=="false"||cP=="no"||cP=="n"||cP=="[]")}else{cQ=false}return cQ}function bf(cS,cT){for(var cP in cS){var cR=cT[cP];var cQ=typeof cR;if(cQ==q){cT[cP]=R(cg(cS[cP]))}else{if(cQ=="object"&&cR.constructor!=G&&cP.substring(0,1)!="$"){bf(cS[cP],cR)}}}}function aY(cR,cQ){var cS=new a6(ae,s,aa,A),cP=ce(cR);return cS.compile(cP)(cP,cQ)}function af(cS){var cR={},cP,cQ;aO((cS||"").split("&"),function(cT){if(cT){cP=cT.split("=");cQ=unescape(cP[0]);cR[cQ]=cp(cP[1])?unescape(cP[1]):true}});return cR}function O(cQ){var cP=[];aO(cQ,function(cS,cR){cP.push(escape(cR)+(cS===true?"":"="+escape(cS)))});return cP.length?cP.join("&"):""}function bp(cQ){if(cQ.autobind){var cR=aY(bO.document,a2,{"$config":cQ}),cP=cR.$inject("$browser");if(cQ.css){cP.addCss(cQ.base_url+cQ.css)}else{if(ar<8){cP.addJs(cQ.base_url+cQ.ie_compat,cQ.ie_compat_id)}}cR.$init()}}function bz(cQ,cT){var cP=cQ.getElementsByTagName("script"),cS;cT=b1({ie_compat_id:"ng-ie-compat"},cT);for(var cR=0;cR<cP.length;cR++){cS=(cP[cR].src||"").match(ab);if(cS){cT.base_url=cS[1];cT.ie_compat=cS[1]+"angular-ie-compat"+(cS[2]||"")+".js";b1(cT,af(cS[6]));a0(ce(cP[cR]),function(cV,cU){if(/^ng:/.exec(cU)){cU=cU.substring(3).replace(/-/g,"_");if(cU=="autobind"){cV=true}cT[cU]=cV}})}}return cT}var G=[].constructor;function cg(cR,cQ){var cP=[];bL(cP,cR,cQ?"\n ":a2,[]);return cP.join("")}function R(cP){if(!cP){return cP}try{var cR=T(cP,true);var cS=cR.primary();cR.assertAllConsumed();return cS()}catch(cQ){cz("fromJson error: ",cP,cQ);throw cQ}}ay.toJson=cg;ay.fromJson=R;function bL(cQ,cS,cV,cW){if(cK(cS)){if(cS===bO){cQ.push("WINDOW");return}if(cS===r){cQ.push("DOCUMENT");return}if(u(cW,cS)){cQ.push("RECURSION");return}cW.push(cS)}if(cS===a2){cQ.push(v)}else{if(cS instanceof RegExp){cQ.push(ay.String["quoteUnicode"](cS.toString()))}else{if(E(cS)){return}else{if(a9(cS)){cQ.push(""+cS)}else{if(aQ(cS)){if(isNaN(cS)){cQ.push(v)}else{cQ.push(""+cS)}}else{if(cc(cS)){return cQ.push(ay.String["quoteUnicode"](cS))}else{if(cK(cS)){if(a5(cS)){cQ.push("[");var cU=cS.length;var c3=false;for(var cT=0;cT<cU;cT++){var c0=cS[cT];if(c3){cQ.push(",")}if(!(c0 instanceof RegExp)&&(E(c0)||bu(c0))){cQ.push(v)}else{bL(cQ,c0,cV,cW)}c3=true}cQ.push("]")}else{if(aw(cS)){cQ.push(ay.String["quoteUnicode"](ay.Date["toString"](cS)))}else{cQ.push("{");if(cV){cQ.push(cV)}var c2=false;var c1=cV?cV+" ":false;var cZ=[];for(var cR in cS){if(cS[cR]===cL){continue}cZ.push(cR)}cZ.sort();for(var cP=0;cP<cZ.length;cP++){var cY=cZ[cP];var cX=cS[cY];if(typeof cX!=bs){if(c2){cQ.push(",");if(cV){cQ.push(cV)}}cQ.push(ay.String["quote"](cY));cQ.push(":");bL(cQ,cX,c1,cW);c2=true}}cQ.push("}")}}}}}}}}}if(cK(cS)){cW.pop()}}function cq(cP){this.paths=[];this.children=[];this.inits=[];this.priority=cP;this.newScope=false}cq.prototype={init:function(cP,cQ){var cR={};this.collectInits(cP,cR,cQ);aq(cR,function(cS){aO(cS,function(cT){cT()})})},collectInits:function(cR,cU,cX){var cT=cU[this.priority],cV=cX;if(!cT){cU[this.priority]=cT=[]}cR=ce(cR);if(this.newScope){cV=bP(cX);cX.$onEval(cV.$eval)}aO(this.inits,function(cZ){cT.push(function(){cV.$tryEval(function(){return cV.$inject(cZ,cV,cR)},cR)})});var cS,cW=cR[0].childNodes,cQ=this.children,cY=this.paths,cP=cY.length;for(cS=0;cS<cP;cS++){cQ[cS].collectInits(cW[cY[cS]],cU,cV)}},addInit:function(cP){if(cP){this.inits.push(cP)}},addChild:function(cP,cQ){if(cQ){this.paths.push(cP);this.children.push(cQ)}},empty:function(){return this.inits.length===0&&this.paths.length===0}};function a6(cP,cQ,cS,cR){this.markup=cP;this.attrMarkup=cQ;this.directives=cS;this.widgets=cR}a6.prototype={compile:function(cT){cT=ce(cT);var cP=0,cS,cR=cT.parent();if(cR&&cR[0]){cR=cR[0];for(var cQ=0;cQ<cR.childNodes.length;cQ++){if(cR.childNodes[cQ]==cT[0]){cP=cQ}}}cS=this.templatize(cT,cP,0)||new cq();return function(cU,cW){cU=ce(cU);var cV=cW&&cW.$eval?cW:bP(cW);return b1(cV,{$element:cU,$init:function(){cS.init(cU,cV);cV.$eval();delete cV.$init;return cV}})}},templatize:function(cU,cQ,cZ){var c3=this,cV,cY,cR=c3.directives,cX=true,cS=true,c4=at(cU),c2,c1={compile:bx(c3,c3.compile),comment:function(c5){return ce(r.createComment(c5))},element:function(c5){return ce(r.createElement(c5))},text:function(c5){return ce(r.createTextNode(c5))},descend:function(c5){if(cp(c5)){cX=c5}return cX},directives:function(c5){if(cp(c5)){cS=c5}return cS},scope:function(c5){if(cp(c5)){c2.newScope=c2.newScope||c5}return c2.newScope}};try{cZ=cU.attr("ng:eval-order")||cZ||0}catch(cW){cZ=cZ||0}if(cc(cZ)){cZ=aI[bA(cZ)]||parseInt(cZ,10)}c2=new cq(cZ);a0(cU,function(c6,c5){if(!cV){if(cV=c3.widgets("@"+c5)){cU.addClass("ng-attr-widget");cV=bx(c1,cV,c6,cU)}}});if(!cV){if(cV=c3.widgets(c4)){if(c4.indexOf(":")>0){cU.addClass("ng-widget")}cV=bx(c1,cV,cU)}}if(cV){cX=false;cS=false;var c0=cU.parent();c2.addInit(cV.call(c1,cU));if(c0&&c0[0]){cU=ce(c0[0].childNodes[cQ])}}if(cX){for(var cT=0,cP=cU[0].childNodes;cT<cP.length;cT++){if(t(cP[cT])){aO(c3.markup,function(c5){if(cT<cP.length){var c6=ce(cP[cT]);c5.call(c1,c6.text(),c6,cU)}})}}}if(cS){a0(cU,function(c6,c5){aO(c3.attrMarkup,function(c7){c7.call(c1,c6,c5,cU)})});a0(cU,function(c6,c5){cY=cR[c5];if(cY){cU.addClass("ng-directive");c2.addInit((cR[c5]).call(c1,c6,cU))}})}if(cX){aT(cU,function(c6,c5){c2.addChild(c5,c3.templatize(c6,c5,cZ))})}return c2.empty()?a2:c2}};function aT(cQ,cR){var cP,cT=cQ[0].childNodes||[],cS;for(cP=0;cP<cT.length;cP++){if(!t(cS=cT[cP])){cR(ce(cS),cP)}}}function a0(cQ,cU){var cR,cX=cQ[0].attributes||[],cW,cT,cP,cV,cS={};for(cR=0;cR<cX.length;cR++){cT=cX[cR];cP=cT.name;cV=cT.value;if(ar&&cP=="href"){cV=decodeURIComponent(cQ[0].getAttribute(cP,2))}cS[cP]=cV}aq(cS,cU)}function bK(cX,cY,cV){if(!cY){return cX}var cQ=cY.split(".");var cW;var cP=cX;var cS=cQ.length;for(var cR=0;cR<cS;cR++){cW=cQ[cR];if(!cW.match(/^[\$\w][\$\w\d]*$/)){throw"Expression '"+cY+"' is not a valid expression for accesing variables."}if(cX){cP=cX;cX=cX[cW]}if(bu(cX)&&cW.charAt(0)=="$"){var cT=ay.Global["typeOf"](cP);cT=ay[cT.charAt(0).toUpperCase()+cT.substring(1)];var cU=cT?cT[[cW.substring(1)]]:cL;if(cU){cX=bx(cP,cU,cP);return cX}}}if(!cV&&E(cX)){return bx(cP,cX)}return cX}function b7(cP,cV,cU){var cT=cV.split(".");for(var cS=0;cT.length>1;cS++){var cR=cT.shift();var cQ=cP[cR];if(!cQ){cQ={};cP[cR]=cQ}cP=cQ}cP[cT.shift()]=cU;return cU}var ax=0,cx={},aJ={},cG={};aO(("abstract,boolean,break,byte,case,catch,char,class,const,continue,debugger,default,delete,do,double,else,enum,export,extends,false,final,finally,float,for,function,goto,if,implements,import,ininstanceof,intinterface,long,native,new,null,package,private,protected,public,return,short,static,super,switch,synchronized,this,throw,throws,transient,true,try,typeof,var,volatile,void,undefined,while,with").split(/,/),function(cP){cG[cP]=true});function ci(cR){var cP=cx[cR];if(cP){return cP}var cQ="var l, fn, t;\n";aO(cR.split("."),function(cT){cT=(cG[cT])?'["'+cT+'"]':"."+cT;cQ+="if(!s) return s;\nl=s;\ns=s"+cT+';\nif(typeof s=="function") s = function(){ return l'+cT+".apply(l, arguments); };\n";if(cT.charAt(1)=="$"){var cS=cT.substr(2);cQ+='if(!s) {\n t = angular.Global.typeOf(l);\n fn = (angular[t.charAt(0).toUpperCase() + t.substring(1)]||{})["'+cS+'"];\n if (fn) s = function(){ return fn.apply(l, [l].concat(Array.prototype.slice.call(arguments, 0, arguments.length))); };\n}\n'}});cQ+="return s;";cP=Function("s",cQ);cP.toString=function(){return cQ};return cx[cR]=cP}function bm(cS){if(typeof cS===bs){return cS}var cP=aJ[cS];if(!cP){var cQ=T(cS);var cR=cQ.statements();cQ.assertAllConsumed();cP=aJ[cS]=b1(function(){return cR(this)},{fnSelf:cR})}return cP}function an(cQ,cP){bU(cQ,a,cp(cP)?cg(cP):cP)}function bP(cW,cU,cS){function cP(){}cW=cP.prototype=(cW||{});var cX=new cP();var cY={sorted:[]};var cT=[],cQ={},cR=0;b1(cX,{"this":cX,$id:(ax++),$parent:cW,$bind:bx(cX,bx,cX),$get:bx(cX,bK,cX),$set:bx(cX,b7,cX),$eval:function cV(c5){var c4=typeof c5;var c2,c1;var c0,c6;var cZ;var c3;if(c4==q){for(c2=0,c1=cY.sorted.length;c2<c1;c2++){for(cZ=cY.sorted[c2],c6=cZ.length,c0=0;c0<c6;c0++){cX.$tryEval(cZ[c0].fn,cZ[c0].handler)}}while(cT.length){c3=cT.shift();delete cQ[c3.$postEvalId];cX.$tryEval(c3)}}else{if(c4===bs){return c5.call(cX)}else{if(c4==="string"){return bm(c5).call(cX)}}}},$tryEval:function(c2,cZ){var c0=typeof c2;try{if(c0==bs){return c2.call(cX)}else{if(c0=="string"){return bm(c2).call(cX)}}}catch(c1){(cX.$log||{error:cz}).error(c1);if(E(cZ)){cZ(c1)}else{if(cZ){an(cZ,c1)}else{if(E(cX.$exceptionHandler)){cX.$exceptionHandler(c1)}}}}},$watch:function(c3,c2,cZ){var c4=bm(c3),c1={};c2=bm(c2);function c0(){var c6=c4.call(cX),c5=c1;if(c1!==c6){c1=c6;cX.$tryEval(function(){return c2.call(cX,c6,c5)},cZ)}}cX.$onEval(am,c0);c0()},$onEval:function(c0,c2,cZ){if(!aQ(c0)){cZ=c2;c2=c0;c0=0}var c1=cY[c0];if(!c1){c1=cY[c0]=[];c1.priority=c0;cY.sorted.push(c1);cY.sorted.sort(function(c4,c3){return c4.priority-c3.priority})}c1.push({fn:bm(c2),handler:cZ})},$postEval:function(c0){if(c0){var cZ=bm(c0);var c1=cZ.$postEvalId;if(!c1){c1="$"+cX.$id+"_"+(cR++);cZ.$postEvalId=c1}if(!cQ[c1]){cT.push(cQ[c1]=cZ)}}},$become:function(cZ){if(E(cZ)){cX.constructor=cZ;aO(cZ.prototype,function(c1,c0){cX[c0]=bx(cX,c1)});cX.$inject.apply(cX,a8([cZ,cX],arguments,1));if(E(cZ.prototype.init)){cX.init()}}},$new:function(cZ){var c0=bP(cX);c0.$become.apply(cX,a8([cZ],arguments,1));cX.$onEval(c0.$eval);return c0}});if(!cW.$root){cX.$root=cX;cX.$parent=cX;(cX.$inject=bS(cX,cU,cS))()}return cX}function bS(cQ,cS,cP){cS=cS||bl;cP=cP||{};cQ=cQ||{};return function cR(cX,cW,cU){var cV,cY,cT;if(cc(cX)){if(!cP.hasOwnProperty(cX)){cY=cS[cX];if(!cY){throw"Unknown provider for '"+cX+"'."}cP[cX]=cR(cY,cQ)}cV=cP[cX]}else{if(a5(cX)){cV=[];aO(cX,function(cZ){cV.push(cR(cZ))})}else{if(E(cX)){cV=cR(cX.$inject||[]);cV=cX.apply(cW,a8(cV,arguments,2))}else{if(cK(cX)){aO(cS,function(c0,cZ){cT=c0.$creation;if(cT=="eager"){cR(cZ)}if(cT=="eager-published"){b7(cX,cZ,cR(cZ))}})}else{cV=cR(cQ)}}}}return cV}}var K={"null":function(cP){return a2},"true":function(cP){return true},"false":function(cP){return false},$undefined:j,"+":function(cR,cQ,cP){return(cp(cQ)?cQ:0)+(cp(cP)?cP:0)},"-":function(cR,cQ,cP){return(cp(cQ)?cQ:0)-(cp(cP)?cP:0)},"*":function(cR,cQ,cP){return cQ*cP},"/":function(cR,cQ,cP){return cQ/cP},"%":function(cR,cQ,cP){return cQ%cP},"^":function(cR,cQ,cP){return cQ^cP},"=":function(cR,cQ,cP){return b7(cR,cQ,cP)},"==":function(cR,cQ,cP){return cQ==cP},"!=":function(cR,cQ,cP){return cQ!=cP},"<":function(cR,cQ,cP){return cQ<cP},">":function(cR,cQ,cP){return cQ>cP},"<=":function(cR,cQ,cP){return cQ<=cP},">=":function(cR,cQ,cP){return cQ>=cP},"&&":function(cR,cQ,cP){return cQ&&cP},"||":function(cR,cQ,cP){return cQ||cP},"&":function(cR,cQ,cP){return cQ&cP},"|":function(cR,cQ,cP){return cP(cR,cQ)},"!":function(cQ,cP){return !cP}};var U={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'};function bj(c3,cT){var c8=cT?24:-1,c5=[],cY,cX=0,da=[],c1,db=":";while(cX<c3.length){c1=c3.charAt(cX);if(cW("\"'")){cR(c1)}else{if(c4(c1)||cW(".")&&c4(c7())){cS()}else{if(c0("({[:,;")&&cW("/")){cQ()}else{if(c6(c1)){c2();if(c0("{,")&&da[0]=="{"&&(cY=c5[c5.length-1])){cY.json=cY.text.indexOf(".")==-1}}else{if(cW("(){}[].,;:")){c5.push({index:cX,text:c1,json:cW("{}[]:,")});if(cW("{[")){da.unshift(c1)}if(cW("}]")){da.shift()}cX++}else{if(cV(c1)){cX++;continue}else{var cP=c1+c7(),cZ=K[c1],c9=K[cP];if(c9){c5.push({index:cX,text:cP,fn:c9});cX+=2}else{if(cZ){c5.push({index:cX,text:c1,fn:cZ,json:c0("[,:")&&cW("+-")});cX+=1}else{throw"Lexer Error: Unexpected next character ["+c3.substring(cX)+"] in expression '"+c3+"' at column '"+(cX+1)+"'."}}}}}}}}db=c1}return c5;function cW(dc){return dc.indexOf(c1)!=-1}function c0(dc){return dc.indexOf(db)!=-1}function c7(){return cX+1<c3.length?c3.charAt(cX+1):false}function c4(dc){return"0"<=dc&&dc<="9"}function cV(dc){return dc==" "||dc=="\r"||dc=="\t"||dc=="\n"||dc=="\v"||dc=="\u00A0"}function c6(dc){return"a"<=dc&&dc<="z"||"A"<=dc&&dc<="Z"||"_"==dc||dc=="$"}function cU(dc){return dc=="-"||dc=="+"||c4(dc)}function cS(){var de="";var df=cX;while(cX<c3.length){var dd=al(c3.charAt(cX));if(dd=="."||c4(dd)){de+=dd}else{var dc=c7();if(dd=="e"&&cU(dc)){de+=dd}else{if(cU(dd)&&dc&&c4(dc)&&de.charAt(de.length-1)=="e"){de+=dd}else{if(cU(dd)&&(!dc||!c4(dc))&&de.charAt(de.length-1)=="e"){throw'Lexer found invalid exponential value "'+c3+'"'}else{break}}}}cX++}de=1*de;c5.push({index:df,text:de,json:true,fn:function(){return de}})}function c2(){var de="";var df=cX;while(cX<c3.length){var dd=c3.charAt(cX);if(dd=="."||c6(dd)||c4(dd)){de+=dd}else{break}cX++}var dc=K[de];if(!dc){dc=ci(de);dc.isAssignable=de}c5.push({index:df,text:de,fn:dc,json:K[de]})}function cR(dc){var dj=cX;cX++;var dd="";var de=dc;var dh=false;while(cX<c3.length){var df=c3.charAt(cX);de+=df;if(dh){if(df=="u"){var dg=c3.substring(cX+1,cX+5);if(!dg.match(/[\da-f]{4}/i)){throw"Lexer Error: Invalid unicode escape [\\u"+dg+"] starting at column '"+dj+"' in expression '"+c3+"'."}cX+=4;dd+=String.fromCharCode(parseInt(dg,16))}else{var di=U[df];if(di){dd+=di}else{dd+=df}}dh=false}else{if(df=="\\"){dh=true}else{if(df==dc){cX++;c5.push({index:dj,text:de,string:dd,json:true,fn:function(){return(dd.length==c8)?ay.String["toDate"](dd):dd}});return}else{dd+=df}}}cX++}throw"Lexer Error: Unterminated quote ["+c3.substring(dj)+"] starting at column '"+(dj+1)+"' in expression '"+c3+"'."}function cQ(de){var di=cX;cX++;var dh="";var dg=false;while(cX<c3.length){var df=c3.charAt(cX);if(dg){dh+=df;dg=false}else{if(df==="\\"){dh+=df;dg=true}else{if(df==="/"){cX++;var dc="";if(c6(c3.charAt(cX))){c2();dc=c5.pop().text}var dd=new RegExp(dh,dc);c5.push({index:di,text:dh,flags:dc,fn:function(){return dd}});return}else{dh+=df}}}cX++}throw"Lexer Error: Unterminated RegExp ["+c3.substring(di)+"] starting at column '"+(di+1)+"' in expression '"+c3+"'."}}function T(de,dm){var c2=cl(0),dh=bj(de,dm);return{assertAllConsumed:c8,primary:c5,statements:cU,validator:dn,filter:di,watch:c6};function dd(ds,dr){throw"Token '"+dr.text+"' is "+ds+" at column='"+(dr.index+1)+"' of expression '"+de+"' starting at '"+de.substring(dr.index)+"'."}function cV(){if(dh.length===0){throw"Unexpected end of expression: "+de}return dh[0]}function cX(dw,dv,du,dt){if(dh.length>0){var ds=dh[0];var dr=ds.text;if(dr==dw||dr==dv||dr==du||dr==dt||(!dw&&!dv&&!du&&!dt)){return ds}}return false}function cR(dv,du,dt,ds){var dr=cX(dv,du,dt,ds);if(dr){if(dm&&!dr.json){index=dr.index;throw"Expression at column='"+dr.index+"' of expression '"+de+"' starting at '"+de.substring(dr.index)+"' is not valid json."}dh.shift();this.currentToken=dr;return dr}return false}function da(ds){if(!cR(ds)){var dr=cX();throw"Expecting '"+ds+"' at column '"+(dr.index+1)+"' in '"+de+"' got '"+de.substring(dr.index)+"'."}}function c1(ds,dr){return function(dt){return ds(dt,dr(dt))}}function dp(dt,ds,dr){return function(du){return ds(du,dt(du),dr(du))}}function c0(){return dh.length>0}function c8(){if(dh.length!==0){throw"Did not understand '"+de.substring(dh[0].index)+"' while evaluating '"+de+"'."}}function cU(){var dr=[];while(true){if(dh.length>0&&!cX("}",")",";","]")){dr.push(cY())}if(!cR(";")){return function(ds){var dv;for(var dt=0;dt<dr.length;dt++){var du=dr[dt];if(du){dv=du(ds)}}return dv}}}}function cY(){var ds=dc();var dr;while(true){if((dr=cR("|"))){ds=dp(ds,dr.fn,di())}else{return ds}}}function di(){return cP(co)}function dn(){return cP(aG)}function cP(dt){var du=cS(dt);var dr=[];var ds;while(true){if((ds=cR(":"))){dr.push(dc())}else{var dv=function(dx,dw){var dy=[dw];for(var dz=0;dz<dr.length;dz++){dy.push(dr[dz](dx))}return du.apply(dx,dy)};return function(){return dv}}}}function dc(){return c7()}function c7(){if(cR("throw")){var dr=c3();return function(ds){throw dr(ds)}}else{return c3()}}function c3(){var dt=dk();var dr;if(dr=cR("=")){if(!dt.isAssignable){throw"Left hand side '"+de.substring(0,dr.index)+"' of assignment '"+de.substring(dr.index)+"' is not assignable."}var ds=function(){return dt.isAssignable};return dp(ds,dr.fn,dk())}else{return dt}}function dk(){var ds=cZ();var dr;while(true){if((dr=cR("||"))){ds=dp(ds,dr.fn,cZ())}else{return ds}}}function cZ(){var ds=cT();var dr;if((dr=cR("&&"))){ds=dp(ds,dr.fn,cZ())}return ds}function cT(){var ds=df();var dr;if((dr=cR("==","!="))){ds=dp(ds,dr.fn,cT())}return ds}function df(){var ds=dg();var dr;if(dr=cR("<",">","<=",">=")){ds=dp(ds,dr.fn,df())}return ds}function dg(){var ds=cQ();var dr;while(dr=cR("+","-")){ds=dp(ds,dr.fn,cQ())}return ds}function cQ(){var ds=c9();var dr;while(dr=cR("*","/","%")){ds=dp(ds,dr.fn,c9())}return ds}function c9(){var dr;if(cR("+")){return c5()}else{if(dr=cR("-")){return dp(c2,dr.fn,c9())}else{if(dr=cR("!")){return c1(dr.fn,c9())}else{return c5()}}}}function cS(dw){var dv=cR();var du=dv.text.split(".");var dr=dw;var dt;for(var ds=0;ds<du.length;ds++){dt=du[ds];if(dr){dr=dr[dt]}}if(typeof dr!=bs){throw"Function '"+dv.text+"' at column '"+(dv.index+1)+"' in '"+de+"' is not defined."}return dr}function c5(){var dt;if(cR("(")){var du=cY();da(")");dt=du}else{if(cR("[")){dt=cW()}else{if(cR("{")){dt=dl()}else{var dr=cR();dt=dr.fn;if(!dt){dd("not a primary expression",dr)}}}}var ds;while(ds=cR("(","[",".")){if(ds.text==="("){dt=db(dt)}else{if(ds.text==="["){dt=c4(dt)}else{if(ds.text==="."){dt=dj(dt)}else{throw"IMPOSSIBLE"}}}}return dt}function dj(ds){var du=cR().text;var dr=ci(du);var dt=function(dv){return dr(ds(dv))};dt.isAssignable=du;return dt}function c4(ds){var dr=dc();da("]");if(cR("=")){var dt=dc();return function(du){return ds(du)[dr(du)]=dt(du)}}else{return function(du){var dw=ds(du);var dv=dr(du);return(dw)?dw[dv]:cL}}}function db(ds){var dr=[];if(cV().text!=")"){do{dr.push(dc())}while(cR(","))}da(")");return function(du){var dv=[];for(var dw=0;dw<dr.length;dw++){dv.push(dr[dw](du))}var dt=ds(du)||j;return dt.apply?dt.apply(du,dv):dt(dv[0],dv[1],dv[2],dv[3],dv[4])}}function cW(){var dr=[];if(cV().text!="]"){do{dr.push(dc())}while(cR(","))}da("]");return function(ds){var du=[];for(var dt=0;dt<dr.length;dt++){du.push(dr[dt](ds))}return du}}function dl(){var dr=[];if(cV().text!="}"){do{var dt=cR(),ds=dt.string||dt.text;da(":");var du=dc();dr.push({key:ds,value:du})}while(cR(","))}da("}");return function(dv){var dw={};for(var dx=0;dx<dr.length;dx++){var dz=dr[dx];var dy=dz.value(dv);dw[dz.key]=dy}return dw}}function c6(){var dr=[];while(c0()){dr.push(dq());if(!cR(";")){c8()}}c8();return function(ds){for(var dt=0;dt<dr.length;dt++){var du=dr[dt](ds);ds.addListener(du.name,du.fn)}}}function dq(){var dr=cR().text;da(":");var ds;if(cV().text=="{"){da("{");ds=cU();da("}")}else{ds=dc()}return function(dt){return{name:dr,fn:ds}}}}function bR(cQ,cR){this.template=cQ=cQ+"#";this.defaults=cR||{};var cP=this.urlParams={};aO(cQ.split(/\W/),function(cS){if(cS&&cQ.match(new RegExp(":"+cS+"\\W"))){cP[cS]=true}})}bR.prototype={url:function(cT){var cS=[];var cP=this;var cQ=this.template;cT=cT||{};aO(this.urlParams,function(cV,cU){var cW=cT[cU]||cP.defaults[cU]||"";cQ=cQ.replace(new RegExp(":"+cU+"(\\W)"),cW+"$1")});cQ=cQ.replace(/\/?#$/,"");var cR=[];aq(cT,function(cV,cU){if(!cP.urlParams[cU]){cR.push(encodeURI(cU)+"="+encodeURI(cV))}});cQ=cQ.replace(/\/*$/,"");return cQ+(cR.length?"?"+cR.join("&"):"")}};function bH(cP){this.xhr=cP}bH.DEFAULT_ACTIONS={get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:true},remove:{method:"DELETE"},"delete":{method:"DELETE"}};bH.prototype={route:function(cS,cT,cV){var cQ=this;var cP=new bR(cS);cV=b1({},bH.DEFAULT_ACTIONS,cV);function cR(cX){var cW={};aO(cT||{},function(cZ,cY){cW[cY]=cZ.charAt&&cZ.charAt(0)=="@"?bK(cX,cZ.substr(1)):cZ});return cW}function cU(cW){bo(cW||{},this)}aO(cV,function(cY,cX){var cW=cY.method=="POST"||cY.method=="PUT";cU[cX]=function(c0,cZ,c5){var c3={};var c2;var c4=j;switch(arguments.length){case 3:c4=c5;case 2:if(E(cZ)){c4=cZ}else{c3=c0;c2=cZ;break}case 1:if(E(c0)){c4=c0}else{if(cW){c2=c0}else{c3=c0}}break;case 0:break;default:throw"Expected between 0-3 arguments [params, data, callback], got "+arguments.length+" arguments."}var c1=this instanceof cU?this:(cY.isArray?[]:new cU(c2));cQ.xhr(cY.method,cP.url(b1({},cY.params||{},cR(c2),c3)),c2,function(c7,c8,c6){if(c7==200){if(cY.isArray){c1.length=0;aO(c8,function(c9){c1.push(new cU(c9))})}else{bo(c8,c1)}(c4||j)(c1)}else{throw {status:c7,response:c8,message:c7+": "+c8}}},cY.verifyCache);return c1};cU.bind=function(cZ){return cQ.route(cS,b1({},cT,cZ),cV)};cU.prototype["$"+cX]=function(c0,cZ){var c2=cR(this);var c3=j;switch(arguments.length){case 2:c2=c0;c3=cZ;case 1:if(typeof c0==bs){c3=c0}else{c2=c0}case 0:break;default:throw"Expected between 1-2 arguments [params, callback], got "+arguments.length+" arguments."}var c1=cW?this:cL;cU[cX].call(this,c2,c1,c3)}});return cU}};var M=bO.XMLHttpRequest||function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(cR){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(cQ){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(cP){}throw new Error("This browser does not support XMLHttpRequest.")};function aK(c0,cY,cZ,cW,c3){var c1=this;c1.isMock=false;var cT=0;var cV=0;var c2=[];c1.xhr=function(da,c5,c6,c9){if(E(c6)){c9=c6;c6=a2}if(al(da)=="json"){var c7="angular_"+Math.random()+"_"+(cT++);c7=c7.replace(/\d\./,"");var c4=cY[0].createElement("script");c4.type="text/javascript";c4.src=c5.replace("JSON_CALLBACK",c7);bO[c7]=function(db){bO[c7]=cL;c9(200,db)};cZ.append(c4)}else{var c8=new cW();c8.open(da,c5,true);c8.setRequestHeader("Content-Type","application/x-www-form-urlencoded");c8.setRequestHeader("Accept","application/json, text/plain, */*");c8.setRequestHeader("X-Requested-With","XMLHttpRequest");cV++;c8.onreadystatechange=function(){if(c8.readyState==4){try{c9(c8.status||200,c8.responseText)}finally{cV--;if(cV===0){while(c2.length){try{c2.pop()()}catch(db){}}}}}};c8.send(c6||"")}};c1.notifyWhenNoOutstandingRequests=function(c4){if(cV===0){c4()}else{c2.push(c4)}};var cS=[];function cX(){aO(cS,function(c4){c4()})}c1.poll=cX;c1.addPollFn=function(c4){cS.push(c4);return c4};c1.startPoller=function(c5,c6){(function c4(){cX();c6(c4,c5)})()};c1.setUrl=function(c5){var c4=c0.href;if(!c4.match(/#/)){c4+="#"}if(!c5.match(/#/)){c5+="#"}c0.href=c5};c1.getUrl=function(){return c0.href};var cP=cY[0];var cR={};var cQ="";c1.cookies=function(c5,c7){var c9,c4,c6,c8;if(c5){if(c7===cL){cP.cookie=escape(c5)+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT"}else{if(cc(c7)){cP.cookie=escape(c5)+"="+escape(c7);c9=c5.length+c7.length+1;if(c9>4096){c3.warn("Cookie '"+c5+"' possibly not set or overflowed because it was too large ("+c9+" > 4096 bytes)!")}if(cR.length>20){c3.warn("Cookie '"+c5+"' possibly not set or overflowed because too many cookies were already set ("+cR.length+" > 20 )")}}}}else{if(cP.cookie!==cQ){cQ=cP.cookie;c4=cQ.split("; ");cR={};for(c6=0;c6<c4.length;c6++){c8=c4[c6].split("=");if(c8.length===2){cR[unescape(c8[0])]=unescape(c8[1])}}}return cR}};var cU=j;c1.hover=function(c4){cU=c4};c1.bind=function(){cY.bind("mouseover",function(c4){cU(ce(ar?c4.srcElement:c4.target),true);return true});cY.bind("mouseleave mouseout click dblclick keypress keyup",function(c4){cU(ce(c4.target),false);return true})};c1.addCss=function(c4){var c5=ce(cP.createElement("link"));c5.attr("rel","stylesheet");c5.attr("type","text/css");c5.attr("href",c4);cZ.append(c5)};c1.addJs=function(c6,c5){var c4=ce(cP.createElement("script"));c4.attr("type","text/javascript");c4.attr("src",c6);if(c5){c4.attr("id",c5)}cZ.append(c4)}}var b0=/^<\s*([\w:]+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,n=/^<\s*\/\s*([\w:]+)[^>]*>/,cm=/(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,cs=/^</,g=/^<\s*\//,aA=/<!--(.*?)-->/g,bQ=/<!\[CDATA\[(.*?)]]>/g;var aR=cA("area,base,basefont,br,col,hr,img,input,isindex,link,param");var bW=cA("address,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,hr,ins,isindex,li,map,menu,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul");var ak=cA("a,abbr,acronym,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,img,input,ins,kbd,label,map,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");var L=cA("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");var aX=cA("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");var bI=cA("script,style");var bq=b1({},aR,bW,ak,L);var a4=b1({},aX,cA("abbr,align,alink,alt,archive,axis,background,bgcolor,border,cellpadding,cellspacing,cite,class,classid,clear,code,codebase,codetype,color,cols,colspan,content,coords,data,dir,face,for,headers,height,href,hreflang,hspace,id,label,lang,language,link,longdesc,marginheight,marginwidth,maxlength,media,method,name,nowrap,profile,prompt,rel,rev,rows,rowspan,rules,scheme,scope,scrolling,shape,size,span,src,standby,start,summary,tabindex,target,text,title,type,usemap,valign,value,valuetype,vlink,vspace,width"));var aN=function(cQ,cY){var cT,cU,cR,cV=[],cW=cQ;cV.last=function(){return cV[cV.length-1]};while(cQ){cU=true;if(!cV.last()||!bI[cV.last()]){if(cQ.indexOf("<!--")===0){cT=cQ.indexOf("-->");if(cT>=0){if(cY.comment){cY.comment(cQ.substring(4,cT))}cQ=cQ.substring(cT+3);cU=false}}else{if(g.test(cQ)){cR=cQ.match(n);if(cR){cQ=cQ.substring(cR[0].length);cR[0].replace(n,cS);cU=false}}else{if(cs.test(cQ)){cR=cQ.match(b0);if(cR){cQ=cQ.substring(cR[0].length);cR[0].replace(b0,cP);cU=false}}}}if(cU){cT=cQ.indexOf("<");var cX=cT<0?cQ:cQ.substring(0,cT);cQ=cT<0?"":cQ.substring(cT);if(cY.chars){cY.chars(cX)}}}else{cQ=cQ.replace(new RegExp("(.*)<\\s*\\/\\s*"+cV.last()+"[^>]*>","i"),function(cZ,c0){c0=c0.replace(aA,"$1").replace(bQ,"$1");if(cY.chars){cY.chars(c0)}return""});cS("",cV.last())}if(cQ==cW){throw"Parse Error: "+cQ}cW=cQ}cS();function cP(cZ,c2,c3,c0){c2=al(c2);if(bW[c2]){while(cV.last()&&ak[cV.last()]){cS("",cV.last())}}if(L[c2]&&cV.last()==c2){cS("",c2)}c0=aR[c2]||!!c0;if(!c0){cV.push(c2)}if(cY.start){var c1={};c3.replace(cm,function(c5,c4){var c6=arguments[2]?arguments[2]:arguments[3]?arguments[3]:arguments[4]?arguments[4]:aX[c4]?c4:"";c1[c4]=c6});if(cY.start){cY.start(c2,c1,c0)}}}function cS(cZ,c1){var c2=0,c0;c1=al(c1);if(c1){for(c2=cV.length-1;c2>=0;c2--){if(cV[c2]==c1){break}}}if(c2>=0){for(c0=cV.length-1;c0>=c2;c0--){if(cY.end){cY.end(cV[c0])}}cV.length=c2}}};function cA(cS){var cR={},cP=cS.split(","),cQ;for(cQ=0;cQ<cP.length;cQ++){cR[cP[cQ]]=true}return cR}var ag=/^javascript:/i,D=/ /gim,F=/&#x([\da-f]*);?/igm,cO=/&#(\d+);?/igm,bG=/[\w:]/gm,bN=function(cP,cQ){return H(parseInt(cQ,16))},cD=function(cP,cQ){return H(cQ)};function bJ(cP){var cQ=[];cP.replace(D,"").replace(F,bN).replace(cO,cD).replace(bG,function(cR){cQ.push(cR)});return ag.test(al(cQ.join("")))}function a1(cQ){var cR=false;var cP=bx(cQ,cQ.push);return{start:function(cS,cU,cT){cS=al(cS);if(!cR&&bI[cS]){cR=cS}if(!cR&&bq[cS]){cP("<");cP(cS);aO(cU,function(cW,cV){if(a4[al(cV)]&&!bJ(cW)){cP(" ");cP(cV);cP('="');cP(cW.replace(/</g,"<").replace(/>/g,">").replace(/\"/g,"""));cP('"')}});cP(cT?"/>":">")}},end:function(cS){cS=al(cS);if(!cR&&bq[cS]){cP("</");cP(cS);cP(">")}if(cS==cR){cR=false}},chars:function(cS){if(!cR){cP(cS.replace(/&(\w+[&;\W])?/g,function(cU,cT){return cT?cU:"&"}).replace(/</g,"<").replace(/>/g,">"))}}}}var b6={},cv="ng-"+new Date().getTime(),ai=1,az=(bO.document.attachEvent?function(cP,cR,cQ){cP.attachEvent("on"+cR,cQ)}:function(cP,cR,cQ){cP.addEventListener(cR,cQ,false)}),e=(bO.document.detachEvent?function(cP,cR,cQ){cP.detachEvent("on"+cR,cQ)}:function(cP,cR,cQ){cP.removeEventListener(cR,cQ,false)});function b9(){return(ai++)}function cN(cQ){var cR=cQ[cv],cP=b6[cR];if(cP){aO(cP.bind||{},function(cT,cS){e(cQ,cS,cT)});delete b6[cR];if(ar){cQ[cv]=""}else{delete cQ[cv]}}}function b5(cR){var cU={},cS=cR[0].style,cT,cP,cQ;if(typeof cS.length=="number"){for(cQ=0;cQ<cS.length;cQ++){cP=cS[cQ];cU[cP]=cS[cP]}}else{for(cP in cS){cT=cS[cP];if(1*cP!=cP&&cP!="cssText"&&cT&&typeof cT=="string"&&cT!="false"){cU[cP]=cT}}}return cU}function bn(cQ){if(bB(cQ)){this[0]=cQ;this.length=1}else{if(cp(cQ.length)&&cQ.item){for(var cP=0;cP<cQ.length;cP++){this[cP]=cQ[cP]}this.length=cQ.length}}}bn.prototype={data:function(cR,cS){var cQ=this[0],cT=cQ[cv],cP=b6[cT||-1];if(cp(cS)){if(!cP){cQ[cv]=cT=b9();cP=b6[cT]={}}cP[cR]=cS}else{return cP?cP[cR]:a2}},removeData:function(){cN(this[0])},dealoc:function(){(function cP(cS){cN(cS);for(var cR=0,cQ=cS.childNodes;cR<cQ.length;cR++){cP(cQ[cR])}})(this[0])},bind:function(cT,cS){var cP=this,cR=cP[0],cU=cP.data("bind"),cQ;if(!cU){this.data("bind",cU={})}aO(cT.split(" "),function(cV){cQ=cU[cV];if(!cQ){cU[cV]=cQ=function(cW){if(!cW.preventDefault){cW.preventDefault=function(){cW.returnValue=false}}if(!cW.stopPropagation){cW.stopPropagation=function(){cW.cancelBubble=true}}aO(cQ.fns,function(cX){cX.call(cP,cW)})};cQ.fns=[];az(cR,cV,cQ)}cQ.fns.push(cS)})},replaceWith:function(cP){this[0].parentNode.replaceChild(ce(cP)[0],this[0])},children:function(){return new bn(this[0].childNodes)},append:function(cQ){var cP=this[0];cQ=ce(cQ);aO(cQ,function(cR){cP.appendChild(cR)})},remove:function(){this.dealoc();var cP=this[0].parentNode;if(cP){cP.removeChild(this[0])}},removeAttr:function(cP){this[0].removeAttribute(cP)},after:function(cP){this[0].parentNode.insertBefore(ce(cP)[0],this[0].nextSibling)},hasClass:function(cP){var cQ=" "+cP+" ";if((" "+this[0].className+" ").replace(/[\n\t]/g," ").indexOf(cQ)>-1){return true}return false},removeClass:function(cP){this[0].className=au((" "+this[0].className+" ").replace(/[\n\t]/g," ").replace(" "+cP+" ",""))},toggleClass:function(cP,cR){var cQ=this;(cR?cQ.addClass:cQ.removeClass).call(cQ,cP)},addClass:function(cP){if(!this.hasClass(cP)){this[0].className=au(this[0].className+" "+cP)}},css:function(cP,cR){var cQ=this[0].style;if(cc(cP)){if(cp(cR)){cQ[cP]=cR}else{return cQ[cP]}}else{b1(cQ,cP)}},attr:function(cP,cQ){var cR=this[0];if(cK(cP)){aO(cP,function(cT,cS){cR.setAttribute(cS,cT)})}else{if(cp(cQ)){cR.setAttribute(cP,cQ)}else{return cR.getAttribute(cP,2)}}},text:function(cP){if(cp(cP)){this[0].textContent=cP}return this[0].textContent},val:function(cP){if(cp(cP)){this[0].value=cP}return this[0].value},html:function(cQ){if(cp(cQ)){var cP=0,cR=this[0].childNodes;for(;cP<cR.length;cP++){ce(cR[cP]).dealoc()}this[0].innerHTML=cQ}return this[0].innerHTML},parent:function(){return ce(this[0].parentNode)},clone:function(){return ce(this[0].cloneNode(true))}};if(ar){b1(bn.prototype,{text:function(cP){var cQ=this[0];if(cQ.nodeType==3){if(cp(cP)){cQ.nodeValue=cP}return cQ.nodeValue}else{if(cp(cP)){cQ.innerText=cP}return cQ.innerText}}})}var aU={typeOf:function(cQ){if(cQ===a2){return v}var cP=typeof cQ;if(cP==aL){if(cQ instanceof Array){return aZ}if(aw(cQ)){return a7}if(cQ.nodeType==1){return cw}}return cP}};var cJ={copy:bo,size:av,equals:p};var bd={extend:b1};var N={indexOf:cH,sum:function(cU,cT){var cR=ay.Function["compile"](cT);var cQ=0;for(var cP=0;cP<cU.length;cP++){var cS=1*cR(cU[cP]);if(!isNaN(cS)){cQ+=cS}}return cQ},remove:function(cR,cQ){var cP=cH(cR,cQ);if(cP>=0){cR.splice(cP,1)}return cQ},filter:function(cW,cV){var cR=[];cR.check=function(cY){for(var cX=0;cX<cR.length;cX++){if(!cR[cX](cY)){return false}}return true};var cT=function(cZ,c0){if(c0.charAt(0)==="!"){return !cT(cZ,c0.substr(1))}switch(typeof cZ){case"boolean":case"number":case"string":return(""+cZ).toLowerCase().indexOf(c0)>-1;case"object":for(var cY in cZ){if(cY.charAt(0)!=="$"&&cT(cZ[cY],c0)){return true}}return false;case"array":for(var cX=0;cX<cZ.length;cX++){if(cT(cZ[cX],c0)){return true}}return false;default:return false}};switch(typeof cV){case"boolean":case"number":case"string":cV={$:cV};case"object":for(var cS in cV){if(cS=="$"){(function(){var cX=(""+cV[cS]).toLowerCase();if(!cX){return}cR.push(function(cY){return cT(cY,cX)})})()}else{(function(){var cX=cS;var cY=(""+cV[cS]).toLowerCase();if(!cY){return}cR.push(function(cZ){return cT(bK(cZ,cX),cY)})})()}}break;case bs:cR.push(cV);break;default:return cW}var cQ=[];for(var cP=0;cP<cW.length;cP++){var cU=cW[cP];if(cR.check(cU)){cQ.push(cU)}}return cQ},add:function(cQ,cP){cQ.push(bu(cP)?{}:cP);return cQ},count:function(cS,cR){if(!cR){return cS.length}var cP=ay.Function["compile"](cR),cQ=0;aO(cS,function(cT){if(cP(cT)){cQ++}});return cQ},orderBy:function(cW,cV,cT){cV=a5(cV)?cV:[cV];cV=aE(cV,function(cY){var cZ=false,cX=cY||aC;if(cc(cY)){if((cY.charAt(0)=="+"||cY.charAt(0)=="-")){cZ=cY.charAt(0)=="-";cY=cY.substring(1)}cX=bm(cY).fnSelf}return cQ(function(c1,c0){return cU(cX(c1),cX(c0))},cZ)});var cS=[];for(var cR=0;cR<cW.length;cR++){cS.push(cW[cR])}return cS.sort(cQ(cP,cT));function cP(c0,cZ){for(var cY=0;cY<cV.length;cY++){var cX=cV[cY](c0,cZ);if(cX!==0){return cX}}return 0}function cQ(cX,cY){return cj(cY)?function(c0,cZ){return cX(cZ,c0)}:cX}function cU(c0,cZ){var cY=typeof c0;var cX=typeof cZ;if(cY==cX){if(cY=="string"){c0=c0.toLowerCase()}if(cY=="string"){cZ=cZ.toLowerCase()}if(c0===cZ){return 0}return c0<cZ?-1:1}else{return cY<cX?-1:1}}}};var a3=/^(\d{4})-(\d\d)-(\d\d)(?:T(\d\d)(?:\:(\d\d)(?:\:(\d\d)(?:\.(\d{3}))?)?)?Z)?$/;var ap={quote:function(cP){return'"'+cP.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v")+'"'},quoteUnicode:function(cP){var cU=ay.String["quote"](cP);var cT=[];for(var cQ=0;cQ<cU.length;cQ++){var cR=cU.charCodeAt(cQ);if(cR<128){cT.push(cU.charAt(cQ))}else{var cS="000"+cR.toString(16);cT.push("\\u"+cS.substring(cS.length-4))}}return cT.join("")},toDate:function(cR){var cQ;if(cc(cR)&&(cQ=cR.match(a3))){var cP=new Date(0);cP.setUTCFullYear(cQ[1],cQ[2]-1,cQ[3]);cP.setUTCHours(cQ[4]||0,cQ[5]||0,cQ[6]||0,cQ[7]||0);return cP}return cR}};var ad={toString:function(cP){return !cP?cP:cP.toISOString?cP.toISOString():ch(cP.getUTCFullYear(),4)+"-"+ch(cP.getUTCMonth()+1,2)+"-"+ch(cP.getUTCDate(),2)+"T"+ch(cP.getUTCHours(),2)+":"+ch(cP.getUTCMinutes(),2)+":"+ch(cP.getUTCSeconds(),2)+"."+ch(cP.getUTCMilliseconds(),3)+"Z"}};var w={compile:function(cP){if(E(cP)){return cP}else{if(cP){return bm(cP).fnSelf}else{return aC}}}};function J(cQ,cP){ay[cQ]=ay[cQ]||{};aO(cP,function(cR){b1(ay[cQ],cR)})}J("Global",[aU]);J("Collection",[aU,cJ]);J("Array",[aU,cJ,N]);J("Object",[aU,cJ,bd]);J("String",[aU,ap]);J("Date",[aU,ad]);ay.Date["toString"]=ad.toString;J("Function",[aU,cJ,w]);co.currency=function(cP){this.$element.toggleClass("ng-format-negative",cP<0);return"$"+co.number.apply(this,[cP,2])};co.number=function(cS,cP){if(isNaN(cS)||!isFinite(cS)){return""}cP=typeof cP==q?2:cP;var cQ=cS<0;cS=Math.abs(cS);var cV=Math.pow(10,cP);var cX=""+Math.round(cS*cV);var cW=cX.substring(0,cX.length-cP);cW=cW||"0";var cR=cX.substring(cX.length-cP);cX=cQ?"-":"";for(var cU=0;cU<cW.length;cU++){if((cW.length-cU)%3===0&&cU!==0){cX+=","}cX+=cW.charAt(cU)}if(cP>0){for(var cT=cR.length;cT<cP;cT++){cR+="0"}cX+="."+cR.substring(0,cP)}return cX};function ch(cQ,cR,cP){var cS="";if(cQ<0){cS="-";cQ=-cQ}cQ=""+cQ;while(cQ.length<cR){cQ="0"+cQ}if(cP){cQ=cQ.substr(cQ.length-cR)}return cS+cQ}function bk(cQ,cR,cS,cP){return function(cT){var cU=cT["get"+cQ]();if(cS>0||cU>-cS){cU+=cS}if(cU===0&&cS==-12){cU=12}return ch(cU,cR,cP)}}var by={yyyy:bk("FullYear",4),yy:bk("FullYear",2,0,true),MM:bk("Month",2,1),M:bk("Month",1,1),dd:bk("Date",2),d:bk("Date",1),HH:bk("Hours",2),H:bk("Hours",1),hh:bk("Hours",2,-12),h:bk("Hours",1,-12),mm:bk("Minutes",2),m:bk("Minutes",1),ss:bk("Seconds",2),s:bk("Seconds",1),a:function(cP){return cP.getHours()<12?"am":"pm"},Z:function(cP){var cQ=cP.getTimezoneOffset();return ch(cQ/60,2)+ch(Math.abs(cQ%60),2)}};var ao=/([^yMdHhmsaZ]*)(y+|M+|d+|H+|h+|m+|s+|a|Z)(.*)/;var ck=/^\d+$/;co.date=function(cP,cS){if(cc(cP)){if(ck.test(cP)){cP=parseInt(cP,10)}else{cP=ap.toDate(cP)}}if(aQ(cP)){cP=new Date(cP)}if(!aw(cP)){return cP}var cT=cP.toLocaleDateString(),cQ;if(cS&&cc(cS)){cT="";var cR=[];while(cS){cR=a8(cR,ao.exec(cS),1);cS=cR.pop()}aO(cR,function(cU){cQ=by[cU];cT+=cQ?cQ(cP):cU})}return cT};co.json=function(cP){this.$element.addClass("ng-monospace");return cg(cP,true)};co.lowercase=al;co.uppercase=bA;co.html=function(cP,cQ){return new aS(cP,cQ)};co.linky=function(cW){if(!cW){return cW}var cP=/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.\;\,\(\)\{\}\<\>]/;var cS;var cR=cW;var cU=[];var cV=a1(cU);var cQ;var cT;while(cS=cR.match(cP)){cQ=cS[0];if(cS[2]==cS[3]){cQ="mailto:"+cQ}cT=cS.index;cV.chars(cR.substr(0,cT));cV.start("a",{href:cQ});cV.chars(cS[0].replace(/^mailto:/,""));cV.end("a");cR=cR.substring(cT+cS[0].length)}cV.chars(cR);return new aS(cU.join(""))};function aW(cP,cQ){return{format:cP,parse:cQ||cP}}function C(cP){return(cp(cP)&&cP!==a2)?""+cP:cP}var aP=/^\s*[-+]?\d*(\.\d*)?\s*$/;l.noop=aW(aC,aC);l.json=aW(cg,R);l["boolean"]=aW(C,cj);l.number=aW(C,function(cP){if(cP==a2||aP.exec(cP)){return cP===a2||cP===""?a2:1*cP}else{throw"Not a number"}});l.list=aW(function(cP){return cP?cP.join(", "):cP},function(cQ){var cP=[];aO((cQ||"").split(","),function(cR){cR=au(cR);if(cR){cP.push(cR)}});return cP});l.trim=aW(function(cP){return cP?au(""+cP):""});b1(aG,{noop:function(){return a2},regexp:function(cQ,cP,cR){if(!cQ.match(cP)){return cR||"Value does not match expected format "+cP+"."}else{return a2}},number:function(cS,cR,cP){var cQ=1*cS;if(cQ==cS){if(typeof cR!=q&&cQ<cR){return"Value can not be less than "+cR+"."}if(typeof cR!=q&&cQ>cP){return"Value can not be greater than "+cP+"."}return a2}else{return"Not a number"}},integer:function(cS,cQ,cP){var cR=aG.number(cS,cQ,cP);if(cR){return cR}if(!(""+cS).match(/^\s*[\d+]*\s*$/)||cS!=Math.round(cS)){return"Not a whole number"}return a2},date:function(cR){var cP=/^(\d\d?)\/(\d\d?)\/(\d\d\d\d)$/.exec(cR);var cQ=cP?new Date(cP[3],cP[1]-1,cP[2]):0;return(cQ&&cQ.getFullYear()==cP[3]&&cQ.getMonth()==cP[1]-1&&cQ.getDate()==cP[2])?a2:"Value is not a date. (Expecting format: 12/31/2009)."},email:function(cP){if(cP.match(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/)){return a2}return"Email needs to be in username@host.com format."},phone:function(cP){if(cP.match(/^1\(\d\d\d\)\d\d\d-\d\d\d\d$/)){return a2}if(cP.match(/^\+\d{2,3} (\(\d{1,5}\))?[\d ]+\d$/)){return a2}return"Phone number needs to be in 1(987)654-3210 format in North America or +999 (123) 45678 906 internationaly."},url:function(cP){if(cP.match(/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/)){return a2}return"URL needs to be in http://server[:port]/path format."},json:function(cP){try{R(cP);return a2}catch(cQ){return cQ.toString()}},asynchronous:function(cS,cV,cQ){if(!cS){return}var cU=this;var cT=cU.$element;var cR=cT.data("$asyncValidator");if(!cR){cT.data("$asyncValidator",cR={inputs:{}})}cR.current=cS;var cP=cR.inputs[cS];if(!cP){cR.inputs[cS]=cP={inFlight:true};cU.$invalidWidgets.markInvalid(cU.$element);cT.addClass("ng-input-indicator-wait");cV(cS,function(cW,cX){cP.response=cX;cP.error=cW;cP.inFlight=false;if(cR.current==cS){cT.removeClass("ng-input-indicator-wait");cU.$invalidWidgets.markValid(cT)}cT.data("$validate")();cU.$root.$eval()})}else{if(cP.inFlight){cU.$invalidWidgets.markInvalid(cU.$element)}else{(cQ||j)(cP.response)}}return cP.error}});var I=/^(file|ftp|http|https):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,y=/^([^\?]*)?(\?([^\?]*))?$/,cu={http:80,https:443,ftp:21},bM="eager",bC=bM+"-published";function cf(cQ,cS,cR,cP){bl(cQ,cS,{$inject:cR,$creation:cP})}cf("$window",bx(bO,aC,bO),[],bC);cf("$document",function(cP){return ce(cP.document)},["$window"],bC);cf("$location",function(cW){var c4=this,c0={toString:cQ,update:cV,updateHash:cZ},cU=cW.getUrl(),cS,cX;cW.addPollFn(function(){if(cU!=cW.getUrl()){cV(cU=cW.getUrl());c3();c4.$eval()}});this.$onEval(bi,cY);this.$onEval(ca,cY);cV(cU);c3();return c0;function cV(c5){if(cc(c5)){b1(c0,c2(c5))}else{if(cp(c5.hash)){b1(c5,cT(c5.hash))}b1(c0,c5);if(cp(c5.hashPath||c5.hashSearch)){c0.hash=cR(c0)}c0.href=c1(c0)}}function cZ(c7,c5){var c6={};if(cc(c7)){c6.hashPath=c7;if(cp(c5)){c6.hashSearch=c5}}else{c6.hashSearch=c7}cV(c6)}function cQ(){cP();return c0.href}function cP(){if(c0.href==cS){if(c0.hash==cX){c0.hash=cR(c0)}c0.href=c1(c0)}cV(c0.href)}function c3(){cS=c0.href;cX=c0.hash}function cY(){cP();if(c0.href!=cS){cW.setUrl(cU=c0.href);c3()}}function c1(c7){var c6=O(c7.search);var c5=(c7.port==cu[c7.protocol]?a2:c7.port);return c7.protocol+"://"+c7.host+(c5?":"+c5:"")+c7.path+(c6?"?"+c6:"")+(c7.hash?"#"+c7.hash:"")}function cR(c6){var c5=O(c6.hashSearch);return escape(c6.hashPath)+(c5?"?"+c5:"")}function c2(c5){var c7={};var c6=I.exec(c5);if(c6){c7.href=c5.replace(/#$/,"");c7.protocol=c6[1];c7.host=c6[3]||"";c7.port=c6[5]||cu[c7.protocol]||a2;c7.path=c6[6]||"";c7.search=af(c6[8]);c7.hash=c6[10]||"";b1(c7,cT(c7.hash))}return c7}function cT(c7){var c6={};var c5=y.exec(c7);if(c5){c6.hash=c7;c6.hashPath=unescape(c5[1]||"");c6.hashSearch=af(c5[3])}return c6}},["$browser"],bC);cf("$log",function(cR){var cP=cR.console||{log:j,warn:j,info:j,error:j},cQ=cP.log||j;return{log:bx(cP,cQ),warn:bx(cP,cP.warn||cQ),info:bx(cP,cP.info||cQ),error:bx(cP,cP.error||cQ)}},["$window"],bC);cf("$exceptionHandler",function(cP){return function(cQ){cP.error(cQ)}},["$log"],bC);cf("$hover",function(cU,cQ){var cW,cS=this,cT,cV=300,cR=10,cP=ce(cQ[0].body);cU.hover(function(c0,cY){if(cY&&(cT=c0.attr(a)||c0.attr(k))){if(!cW){cW={callout:ce('<div id="ng-callout"></div>'),arrow:ce("<div></div>"),title:ce('<div class="ng-title"></div>'),content:ce('<div class="ng-content"></div>')};cW.callout.append(cW.arrow);cW.callout.append(cW.title);cW.callout.append(cW.content);cP.append(cW.callout)}var cX=cP[0].getBoundingClientRect(),cZ=c0[0].getBoundingClientRect(),c1=cX.right-cZ.right-cR;cW.title.text(c0.hasClass("ng-exception")?"EXCEPTION:":"Validation error...");cW.content.text(cT);if(c1<cV){cW.arrow.addClass("ng-arrow-right");cW.arrow.css({left:(cV+1)+"px"});cW.callout.css({position:"fixed",left:(cZ.left-cR-cV-4)+"px",top:(cZ.top-3)+"px",width:cV+"px"})}else{cW.arrow.addClass("ng-arrow-left");cW.callout.css({position:"fixed",left:(cZ.right+cR)+"px",top:(cZ.top-3)+"px",width:cV+"px"})}}else{if(cW){cW.callout.remove();cW=a2}}})},["$browser","$document"],bM);cf("$invalidWidgets",function(){var cQ=[];cQ.markValid=function(cS){var cR=cH(cQ,cS);if(cR!=-1){cQ.splice(cR,1)}};cQ.markInvalid=function(cS){var cR=cH(cQ,cS);if(cR===-1){cQ.push(cS)}};cQ.visible=function(){var cR=0;aO(cQ,function(cS){cR=cR+(aM(cS)?1:0)});return cR};this.$onEval(ca,function(){for(var cR=0;cR<cQ.length;){var cS=cQ[cR];if(cP(cS[0])){cQ.splice(cR,1);if(cS.dealoc){cS.dealoc()}}else{cR++}}});function cP(cS){if(cS==bO.document){return false}var cR=cS.parentNode;return !cR||cP(cR)}return cQ},[],bC);function bc(cQ,cP,cT){var cS="^"+cP.replace(/[\.\\\(\)\^\$]/g,"$1")+"$",cU=[],cV={};aO(cP.split(/\W/),function(cX){if(cX){var cW=new RegExp(":"+cX+"([\\W])");if(cS.match(cW)){cS=cS.replace(cW,"([^/]*)$1");cU.push(cX)}}});var cR=cQ.match(new RegExp(cS));if(cR){aO(cU,function(cX,cW){cV[cX]=cR[cW+1]});if(cT){this.$set(cT,cV)}}return cR?cV:a2}cf("$route",function(cQ){var cP={},cR=[],cV=bc,cT=this,cS=0,cW={routes:cP,onChange:bx(cR,cR.push),when:function(cY,cZ){if(ay.isUndefined(cY)){return cP}var cX=cP[cY];if(!cX){cX=cP[cY]={}}if(cZ){ay.extend(cX,cZ)}cS++;return cX}};function cU(){var cX;cW.current=a2;ay.foreach(cP,function(cY,cZ){if(!cX){var c0=cV(cQ.hashPath,cZ);if(c0){cX=ay.scope(cT);cW.current=ay.extend({},cY,{scope:cX,params:ay.extend({},cQ.hashSearch,c0)})}}});ay.foreach(cR,cT.$tryEval);if(cX){cX.$become(cW.current.controller)}}this.$watch(function(){return cS+cQ.hash},cU);return cW},["$location"],bC);cf("$xhr",function(cQ,cP,cS){var cR=this;return function(cW,cT,cU,cV){if(E(cU)){cV=cU;cU=a2}if(cU&&cK(cU)){cU=cg(cU)}cQ.xhr(cW,cT,cU,function(cY,cX){try{if(cc(cX)&&/^\s*[\[\{]/.exec(cX)&&/[\}\]]\s*$/.exec(cX)){cX=R(cX)}if(cY==200){cV(cY,cX)}else{cP({method:cW,url:cT,data:cU,callback:cV},{status:cY,body:cX})}}catch(cZ){cS.error(cZ)}finally{cR.$eval()}})}},["$browser","$xhr.error","$log"]);cf("$xhr.error",function(cP){return function(cR,cQ){cP.error("ERROR: XHR: "+cR.url,cR,cQ)}},["$log"]);cf("$xhr.bulk",function(cQ,cP,cT){var cU=[],cS=this;function cR(cZ,cV,cW,cY){if(E(cW)){cY=cW;cW=a2}var cX;aO(cR.urls,function(c0){if(E(c0.match)?c0.match(cV):c0.match.exec(cV)){cX=c0}});if(cX){if(!cX.requests){cX.requests=[]}cX.requests.push({method:cZ,url:cV,data:cW,callback:cY})}else{cQ(cZ,cV,cW,cY)}}cR.urls={};cR.flush=function(cV){aO(cR.urls,function(cW,cX){var cY=cW.requests;if(cY&&cY.length){cW.requests=[];cW.callbacks=[];cQ("POST",cX,{requests:cY},function(c0,cZ){aO(cZ,function(c1,c2){try{if(c1.status==200){(cY[c2].callback||j)(c1.status,c1.response)}else{cP(cY[c2],c1)}}catch(c3){cT.error(c3)}});(cV||j)()});cS.$eval()}})};this.$onEval(ca,cR.flush);return cR},["$xhr","$xhr.error","$log"]);cf("$xhr.cache",function(cP){var cS={},cR=this;function cQ(cY,cT,cU,cX,cW){if(E(cU)){cX=cU;cU=a2}if(cY=="GET"){var cV;if(cV=cQ.data[cT]){cX(200,bo(cV.value));if(!cW){return}}if(cV=cS[cT]){cV.callbacks.push(cX)}else{cS[cT]={callbacks:[cX]};cQ.delegate(cY,cT,cU,function(cZ,c0){if(cZ==200){cQ.data[cT]={value:c0}}var c1=cS[cT].callbacks;delete cS[cT];aO(c1,function(c3){try{(c3||j)(cZ,bo(c0))}catch(c2){cR.$log.error(c2)}})})}}else{cQ.data={};cQ.delegate(cY,cT,cU,cX)}}cQ.data={};cQ.delegate=cP;return cQ},["$xhr.bulk"]);cf("$resource",function(cP){var cQ=new bH(cP);return bx(cQ,cQ.route)},["$xhr.cache"]);cf("$cookies",function(cQ){var cT=this,cU={},cR={},cP;cQ.addPollFn(function(){var cV=cQ.cookies();if(cP!=cV){cP=cV;bo(cV,cR);bo(cV,cU);cT.$eval()}})();this.$onEval(ca,cS);return cU;function cS(){var cW,cX,cV;for(cW in cR){if(bu(cU[cW])){cQ.cookies(cW,cL)}}for(cW in cU){if(cU[cW]!==cR[cW]){cQ.cookies(cW,cU[cW]);cV=true}}if(cV){cV=!cV;cX=cQ.cookies();for(cW in cU){if(cU[cW]!==cX[cW]){if(bu(cX[cW])){delete cU[cW]}else{cU[cW]=cX[cW]}cV=true}}if(cV){cT.$eval()}}}},["$browser"],bC);cf("$cookieStore",function(cP){return{get:function(cQ){return R(cP[cQ])},put:function(cQ,cR){cP[cQ]=cg(cR)},remove:function(cQ){delete cP[cQ]}}},["$cookies"]);aa("ng:init",function(cP){return function(cQ){this.$tryEval(cP,cQ)}});aa("ng:controller",function(cP){this.scope(true);return function(cR){var cQ=bK(bO,cP,true)||bK(this,cP,true);if(!cQ){throw"Can not find '"+cP+"' controller."}if(!E(cQ)){throw"Reference '"+cP+"' is not a class."}this.$become(cQ)}});aa("ng:eval",function(cP){return function(cQ){this.$onEval(cP,cQ)}});aa("ng:bind",function(cQ,cP){cP.addClass("ng-binding");return function(cS){var cR=j,cT=j;this.$onEval(function(){var cV,cZ,cW,cX,cY,cU=this.hasOwnProperty(br)?this.$element:cL;this.$element=cS;cZ=this.$tryEval(cQ,function(c0){cV=cg(c0)});this.$element=cU;if(cX=(cZ instanceof aS)){cZ=(cW=cZ).html}if(cR===cZ&&cT==cV){return}cY=bB(cZ);if(!cX&&!cY&&cK(cZ)){cZ=cg(cZ)}if(cZ!=cR||cV!=cT){cR=cZ;cT=cV;bU(cS,a,cV);if(cV){cZ=cV}if(cX){cS.html(cW.get())}else{if(cY){cS.html("");cS.append(cZ)}else{cS.text(cZ===cL?"":cZ)}}}},cS)}});var bv={};function cM(cQ){var cP=bv[cQ];if(!cP){var cR=[];aO(aV(cQ),function(cT){var cS=cC(cT);cR.push(cS?function(cV){var cU,cW=this.$tryEval(cS,function(cX){cU=cg(cX)});bU(cV,a,cU);return cU?cU:cW}:function(){return cT})});bv[cQ]=cP=function(cV){var cX=[],cS=this,cT=this.hasOwnProperty(br)?cS.$element:cL;cS.$element=cV;for(var cU=0;cU<cR.length;cU++){var cW=cR[cU].call(cS,cV);if(bB(cW)){cW=""}else{if(cK(cW)){cW=cg(cW,true)}}cX.push(cW)}cS.$element=cT;return cX.join("")}}return cP}aa("ng:bind-template",function(cQ,cP){cP.addClass("ng-binding");var cR=cM(cQ);return function(cT){var cS;this.$onEval(function(){var cU=cR.call(this,cT);if(cU!=cS){cT.text(cU);cS=cU}},cT)}});var f={disabled:"disabled",readonly:"readOnly",checked:"checked"};aa("ng:bind-attr",function(cP){return function(cS){var cR={};var cQ=cS.parent().data("$update");this.$onEval(function(){var cT=this.$eval(cP);for(var cU in cT){var cW=cM(cT[cU]).call(this,cS),cV=f[al(cU)];if(cR[cU]!==cW){cR[cU]=cW;if(cV){if(cS[cV]=cj(cW)){cS.attr(cV,cW)}else{cS.removeAttr(cU)}(cS.data("$validate")||j)()}else{cS.attr(cU,cW)}this.$postEval(cQ)}}},cS)}});A("@ng:non-bindable",j);A("@ng:repeat",function(cR,cP){cP.removeAttr("ng:repeat");cP.replaceWith(this.comment("ng:repeat: "+cR));var cQ=this.compile(cP);return function(cS){var cW=cR.match(/^\s*(.+)\s+in\s+(.*)\s*$/),cT,cZ,cU,cY;if(!cW){throw"Expected ng:repeat in form of 'item in collection' but got '"+cR+"'."}cT=cW[1];cZ=cW[2];cW=cT.match(/^([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\)$/);if(!cW){throw"'item' in 'item in collection' should be identifier or (key, value) but got '"+keyValue+"'."}cU=cW[3]||cW[1];cY=cW[2];var cX=[],cV=this;this.$onEval(function(){var c2=0,c1=cX.length,c7=cS,c6=this.$tryEval(cZ,cS),c4=a5(c6),c5=0,c0,c3;if(c4){c5=c6.length}else{for(c3 in c6){if(c6.hasOwnProperty(c3)){c5++}}}for(c3 in c6){if(!c4||c6.hasOwnProperty(c3)){if(c2<c1){c0=cX[c2];c0[cU]=c6[c3];if(cY){c0[cY]=c3}}else{c0=cQ(z(cP),bP(cV));c0[cU]=c6[c3];if(cY){c0[cY]=c3}c7.after(c0.$element);c0.$index=c2;c0.$position=c2==0?"first":(c2==c5-1?"last":"middle");c0.$element.attr("ng:repeat-index",c2);c0.$init();cX.push(c0)}c0.$eval();c7=c0.$element;c2++}}while(cX.length>c2){cX.pop().$element.remove()}},cS)}});aa("ng:click",function(cQ,cP){return function(cS){var cR=this;cS.bind("click",function(cT){cR.$tryEval(cQ,cS);cR.$root.$eval();cT.stopPropagation()})}});aa("ng:submit",function(cQ,cP){return function(cS){var cR=this;cS.bind("submit",function(cT){cR.$tryEval(cQ,cS);cR.$root.$eval();cT.preventDefault()})}});aa("ng:watch",function(cQ,cP){return function(cS){var cR=this;T(cQ).watch()({addListener:function(cT,cU){cR.$watch(cT,function(){return cU(cR)},cS)}})}});function bw(cP){return function(cS,cQ){var cR=cQ[0].className+" ";return function(cT){this.$onEval(function(){if(cP(this.$index)){var cU=this.$eval(cS);if(a5(cU)){cU=cU.join(" ")}cT[0].className=au(cR+cU)}},cT)}}}aa("ng:class",bw(function(){return true}));aa("ng:class-odd",bw(function(cP){return cP%2===0}));aa("ng:class-even",bw(function(cP){return cP%2===1}));aa("ng:show",function(cQ,cP){return function(cR){this.$onEval(function(){cR.css(aH,cj(this.$eval(cQ))?"":b)},cR)}});aa("ng:hide",function(cQ,cP){return function(cR){this.$onEval(function(){cR.css(aH,cj(this.$eval(cQ))?b:"")},cR)}});aa("ng:style",function(cQ,cP){return function(cR){var cS=b5(cR);this.$onEval(function(){var cU=this.$eval(cQ)||{},cT,cV={};for(cT in cU){if(cS[cT]===cL){cS[cT]=""}cV[cT]=cU[cT]}for(cT in cS){cV[cT]=cV[cT]||cS[cT]}cR.css(cV)},cR)}});function aV(cQ){var cR=[];var cS=0;var cP;while((cP=cQ.indexOf("{{",cS))>-1){if(cS<cP){cR.push(cQ.substr(cS,cP-cS))}cS=cP;cP=cQ.indexOf("}}",cP);cP=cP<0?cQ.length:cP+2;cR.push(cQ.substr(cS,cP-cS));cS=cP}if(cS!=cQ.length){cR.push(cQ.substr(cS,cQ.length-cS))}return cR.length===0?[cQ]:cR}function cC(cP){var cQ=cP.replace(/\n/gm," ").match(/^\{\{(.*)\}\}$/);return cQ?cQ[1]:a2}function cB(cP){return cP.length>1||cC(cP[0])!==a2}ae("{{}}",function(cT,cS,cP){var cV=aV(cT),cQ=this;if(cB(cV)){if(bY(cP[0])){cP.attr("ng:bind-template",cT)}else{var cR=cS,cU;aO(aV(cT),function(cY){var cX=cC(cY);if(cX){cU=cQ.element("span");cU.attr("ng:bind",cX)}else{cU=cQ.text(cY)}if(ar&&cY.charAt(0)==" "){cU=ce("<span> </span>");var cW=cU.html();cU.text(cY.substr(1));cU.html(cW+cU.html())}cR.after(cU);cR=cU});cS.remove()}}});ae("OPTION",function(cS,cR,cQ){if(at(cQ)=="OPTION"){var cP=r.createElement("select");cP.insertBefore(cQ[0].cloneNode(true),a2);if(!cP.innerHTML.match(/<option(\s.*\s|\s)value\s*=\s*.*>.*<\/\s*option\s*>/gi)){cQ.attr("value",cS)}}});var bD="ng:bind-attr";var aD={"ng:src":"src","ng:href":"href"};s("{{}}",function(cS,cQ,cR){if(aa(cQ)||aa("@"+cQ)){return}if(ar&&cQ=="src"){cS=decodeURI(cS)}var cT=aV(cS),cP;if(cB(cT)){cR.removeAttr(cQ);cP=R(cR.attr(bD)||"{}");cP[aD[cQ]||cQ]=cS;cR.attr(bD,cg(cP))}});function bF(cQ,cP){var cR=cP.attr("name");if(!cR){throw"Required field 'name' not found."}return{get:function(){return cQ.$eval(cR)},set:function(cS){if(cS!==cL){return cQ.$tryEval(cR+"="+cg(cS),cP)}}}}function bg(cS,cR){var cP=bF(cS,cR),cT=cR.attr("ng:format")||o,cQ=l(cT);if(!cQ){throw"Formatter named '"+cT+"' not found."}return{get:function(){return cQ.format(cP.get())},set:function(cU){return cP.set(cQ.parse(cU))}}}function d(cP){return T(cP).validator()()}function bV(c0,cT){var cR=cT.attr("ng:validate")||o,cQ=d(cR),cP=cT.attr("ng:required"),c1=cT.attr("ng:format")||o,cZ=l(c1),cY,cS,cV,cU,cX=c0.$invalidWidgets||{markValid:j,markInvalid:j};if(!cQ){throw"Validator named '"+cR+"' not found."}if(!cZ){throw"Formatter named '"+c1+"' not found."}cY=cZ.format;cS=cZ.parse;if(cP){c0.$watch(cP,function(c2){cU=c2;cW()})}else{cU=cP===""}cT.data("$validate",cW);return{get:function(){if(cV){bU(cT,k,a2)}try{var c2=cS(cT.val());cW();return c2}catch(c3){cV=c3;bU(cT,k,c3)}},set:function(c3){var c2=cT.val(),c4=cY(c3);if(c2!=c4){cT.val(c4||"")}cW()}};function cW(){var c4=au(cT.val());if(cT[0].disabled||cT[0].readOnly){bU(cT,k,a2);cX.markValid(cT)}else{var c3,c2=bZ(c0,{$element:cT});c3=cU&&!c4?"Required":(c4?cQ(c2,c4):a2);bU(cT,k,c3);cV=c3;if(c3){cX.markInvalid(cT)}else{cX.markValid(cT)}}}}function aF(cQ,cP){var cS=cP[0],cR=cS.value;return{get:function(){return !!cS.checked},set:function(cT){cS.checked=cj(cT)}}}function cI(cQ,cP){var cR=cP[0];return{get:function(){return cR.checked?cR.value:a2},set:function(cS){cR.checked=cS==cR.value}}}function ct(cR,cQ){var cP=cQ[0].options;return{get:function(){var cS=[];aO(cP,function(cT){if(cT.selected){cS.push(cT.value)}});return cS},set:function(cS){var cT={};aO(cS,function(cU){cT[cU]=true});aO(cP,function(cU){cU.selected=cT[cU.value]})}}}function P(){return{get:j,set:j}}var be=bT("keyup change",bF,bV,h()),bX=bT("click",P,P,j),cF={text:be,textarea:be,hidden:be,password:be,button:bX,submit:bX,reset:bX,image:bX,checkbox:bT("click",bg,aF,h(false)),radio:bT("click",bg,cI,cn),"select-one":bT("change",bg,bV,h(a2)),"select-multiple":bT("change",bg,ct,h([]))};function h(cP){return function(cR,cQ){var cS=cQ.get();if(!cS&&cp(cP)){cS=bo(cP)}if(bu(cR.get())&&cp(cS)){cR.set(cS)}}}function cn(cS,cP,cT){var cR=cS.get(),cU=cP.get(),cQ=cT[0];cQ.checked=false;cQ.name=this.$id+"@"+cQ.name;if(bu(cR)){cS.set(cR=a2)}if(cR==a2&&cU!==a2){cS.set(cU)}cP.set(cR)}function bT(cR,cQ,cP,cS){return function(cW){var cX=this,cV=cQ(cX,cW),cT=cP(cX,cW),cY=cW.attr("ng:change")||"",cU;cS.call(cX,cV,cT,cW);this.$eval(cW.attr("ng:init")||"");if(cY||cQ!==P){cW.bind(cR,function(c0){cV.set(cT.get());cU=cV.get();cX.$tryEval(cY,cW);cX.$root.$eval()})}function cZ(){cT.set(cU=cV.get())}cZ();cW.data("$update",cZ);cX.$watch(cV.get,function(c0){if(cU!==c0){cT.set(cU=c0)}})}}function Y(cP){this.directives(true);return cF[al(cP[0].type)]||j}A("input",Y);A("textarea",Y);A("button",Y);A("select",function(cP){this.descend(true);return Y.call(this,cP)});A("option",function(){this.descend(true);this.directives(true);return function(cP){this.$postEval(cP.parent().data("$update"))}});A("ng:include",function(cQ){var cR=this,cP=cQ.attr("src"),cS=cQ.attr("scope")||"";if(cQ[0]["ng:compiled"]){this.descend(true);this.directives(true)}else{cQ[0]["ng:compiled"]=true;return b1(function(cY,cV){var cX=this,cT;var cZ=0;var cW=false;function cU(){cZ++}this.$watch(cP,cU);this.$watch(cS,cU);cX.$onEval(function(){if(cT&&!cW){cW=true;try{cT.$eval()}finally{cW=false}}});this.$watch(function(){return cZ},function(){var c1=this.$eval(cP),c0=this.$eval(cS);if(c1){cY("GET",c1,function(c3,c2){cV.html(c2);cT=c0||bP(cX);cR.compile(cV)(cV,cT);cT.$init()})}else{cT=null;cV.html("")}})},{$inject:["$xhr.cache"]})}});var m=A("ng:switch",function(cT){var cU=this,cS=cT.attr("on"),cW=(cT.attr("using")||"equals"),cP=cW.split(":"),cQ=m[cP.shift()],cR=cT.attr("change")||"",cV=[];if(!cQ){throw"Using expression '"+cW+"' unknown."}if(!cS){throw"Missing 'on' attribute."}aT(cT,function(cZ){var cX=cZ.attr("ng:switch-when");var cY={change:cR,element:cZ,template:cU.compile(cZ)};if(cc(cX)){cY.when=function(c1,c2){var c0=[c2,cX];aO(cP,function(c3){c0.push(c3)});return cQ.apply(c1,c0)};cV.unshift(cY)}else{if(cc(cZ.attr("ng:switch-default"))){cY.when=cl(true);cV.push(cY)}}});aO(cV,function(cX){cX.element.remove()});cT.html("");return function(cY){var cZ=this,cX;this.$watch(cS,function(c1){var c0=false;cY.html("");cX=bP(cZ);aO(cV,function(c2){if(!c0&&c2.when(cX,c1)){c0=true;var c3=z(c2.element);cY.append(c3);cX.$tryEval(c2.change,cY);c2.template(c3,cX);cX.$init()}})});cZ.$onEval(function(){if(cX){cX.$eval()}})}},{equals:function(cQ,cP){return""+cQ==cP},route:bc});ay.widget("a",function(){this.descend(true);this.directives(true);return function(cP){if(cP.attr("href")===""){cP.bind("click",function(cQ){cQ.preventDefault()})}}});var cd;bl("$browser",function(cP){if(!cd){cd=new aK(bO.location,ce(bO.document),ce(bO.document.getElementsByTagName("head")[0]),M,cP);cd.startPoller(50,function(cQ,cR){setTimeout(cQ,cR)});cd.bind()}return cd},{inject:["$log"]});b1(ay,{element:ce,compile:aY,scope:bP,copy:bo,extend:b1,equals:p,foreach:aO,injector:bS,noop:j,bind:bx,toJson:cg,fromJson:R,identity:aC,isUndefined:bu,isDefined:cp,isString:cc,isFunction:E,isObject:cK,isNumber:aQ,isArray:a5});ay.scenario=ay.scenario||{};ay.scenario.output=ay.scenario.output||function(cP,cQ){ay.scenario.output[cP]=cQ};ay.scenario.dsl=ay.scenario.dsl||function(cP,cQ){ay.scenario.dsl[cP]=function(){function cR(cX,cV){var cT=cX.apply(this,cV);if(ay.isFunction(cT)||cT instanceof ay.scenario.Future){return cT}var cU=this;var cW=ay.extend({},cT);ay.foreach(cW,function(cZ,cY){if(ay.isFunction(cZ)){cW[cY]=function(){return cR.call(cU,cZ,arguments)}}else{cW[cY]=cZ}});return cW}var cS=cQ.apply(this,arguments);return function(){return cR.call(this,cS,arguments)}}};ay.scenario.matcher=ay.scenario.matcher||function(cP,cQ){ay.scenario.matcher[cP]=function(cS){var cT="expect "+this.future.name+" ";if(this.inverse){cT+="not "}var cR=this;this.addFuture(cT+cP+" "+ay.toJson(cS),function(cU){var cV;cR.actual=cR.future.value;if((cR.inverse&&cQ.call(cR,cS))||(!cR.inverse&&!cQ.call(cR,cS))){cV="expected "+ay.toJson(cS)+" but was "+ay.toJson(cR.actual)}cU(cV)})}};function i(cU,cT){var cR=bO.location.href;var cP=b2(r.body);var cQ=[];if(cT.scenario_output){cQ=cT.scenario_output.split(",")}ay.foreach(ay.scenario.output,function(cY,cW){if(!cQ.length||cH(cQ,cW)!=-1){var cX=cP.append("<div></div>").find("div:last");cX.attr("id",cW);cY.call({},cX,cU)}});if(!/^http/.test(cR)&&!/^https/.test(cR)){cP.append('<p id="system-error"></p>');cP.find("#system-error").text("Scenario runner must be run using http or https. The protocol "+cR.split(":")[0]+":// is not supported.");return}var cV=cP.append('<div id="application"></div>').find("#application");var cS=new ay.scenario.Application(cV);cU.on("RunnerEnd",function(){cV.css("display","none");cV.find("iframe").attr("src","about:blank")});cU.on("RunnerError",function(cW){if(bO.console){console.log(W(cW))}else{alert(cW)}});cU.run(cS)}function X(cT,cS,cQ){var cR=0;function cP(cV,cU){if(cU&&cU>cR){cR=cU}if(cV||cR>=cT.length){cQ(cV)}else{try{cS(cT[cR++],cP)}catch(cW){cQ(cW)}}}cP()}function W(cQ,cR){cR=cR||5;var cS=cQ.toString();if(cQ.stack){var cP=cQ.stack.split("\n");if(cP[0].indexOf(cS)===-1){cR++;cP.unshift(cQ.message)}cS=cP.slice(0,cR).join("\n")}return cS}function x(cQ){var cP=new Error();return function(){var cR=(cP.stack||"").split("\n")[cQ];if(cR){if(cR.indexOf("@")!==-1){cR=cR.substring(cR.indexOf("@")+1)}else{cR=cR.substring(cR.indexOf("(")+1).replace(")","")}}return cR||""}}function c(cP,cQ){if(cP&&!cP.nodeName){cP=cP[0]}if(!cP){return}if(!cQ){cQ={text:"change",textarea:"change",hidden:"change",password:"change",button:"click",submit:"click",reset:"click",image:"click",checkbox:"click",radio:"click","select-one":"change","select-multiple":"change"}[cP.type]||"click"}if(al(at(cP))=="option"){cP.parentNode.value=cP.value;cP=cP.parentNode;cQ="change"}if(ar){switch(cP.type){case"radio":case"checkbox":cP.checked=!cP.checked;break}cP.fireEvent("on"+cQ);if(al(cP.type)=="submit"){while(cP){if(al(cP.nodeName)=="form"){cP.fireEvent("onsubmit");break}cP=cP.parentNode}}}else{var cR=r.createEvent("MouseEvents");cR.initMouseEvent(cQ,true,true,bO,0,0,0,0,0,false,false,false,false,0,cP);cP.dispatchEvent(cR)}}(function(cQ){var cP=cQ.trigger;cQ.trigger=function(cR){if(/(click|change|keyup)/.test(cR)){return this.each(function(cS,cT){c(cT,cR)})}return cP.apply(this,arguments)}})(b2.fn);b2.fn.bindings=function(cQ){function cR(cT,cS){return cS instanceof RegExp?cS.test(cT):cT&&cT.indexOf(cS)>=0}var cP=[];this.find(".ng-binding:visible").each(function(){var cS=new b2(this);if(!ay.isDefined(cQ)||cR(cS.attr("ng:bind"),cQ)||cR(cS.attr("ng:bind-template"),cQ)){if(cS.is("input, textarea")){cP.push(cS.val())}else{cP.push(cS.html())}}});return cP};ay.scenario.Application=function(cP){this.context=cP;cP.append('<h2>Current URL: <a href="about:blank">None</a></h2><div id="test-frames"></div>')};ay.scenario.Application.prototype.getFrame_=function(){return this.context.find("#test-frames iframe:last")};ay.scenario.Application.prototype.getWindow_=function(){var cP=this.getFrame_().attr("contentWindow");if(!cP){throw"Frame window is not accessible."}return cP};ay.scenario.Application.prototype.checkUrlStatus_=function(cQ,cR){var cP=this;b2.ajax({url:cQ,type:"HEAD",complete:function(cS){if(cS.status<200||cS.status>=300){if(!cS.status){cR.call(cP,"Sandbox Error: Cannot access "+cQ)}else{cR.call(cP,cS.status+" "+cS.statusText)}}else{cR.call(cP)}}})};ay.scenario.Application.prototype.navigateTo=function(cQ,cR,cT){var cP=this;var cS=this.getFrame_();cT=cT||function(cU){throw cU};if(cQ==="about:blank"){cT("Sandbox Error: Navigating to about:blank is not allowed.")}else{if(cQ.charAt(0)==="#"){cQ=cS.attr("src").split("#")[0]+cQ;cS.attr("src",cQ);this.executeAction(cR)}else{cS.css("display","none").attr("src","about:blank");this.checkUrlStatus_(cQ,function(cU){if(cU){return cT(cU)}cP.context.find("#test-frames").append("<iframe>");cS=this.getFrame_();cS.load(function(){cS.unbind();try{cP.executeAction(cR)}catch(cV){cT(cV)}}).attr("src",cQ)})}}this.context.find("> h2 a").attr("href",cQ).text(cQ)};ay.scenario.Application.prototype.executeAction=function(cR){var cQ=this;var cS=this.getWindow_();if(!cS.document){throw"Sandbox Error: Application document not accessible."}if(!cS.angular){return cR.call(this,cS,b2(cS.document))}var cP=cS.angular.service.$browser();cP.poll();cP.notifyWhenNoOutstandingRequests(function(){cR.call(cQ,cS,b2(cS.document))})};ay.scenario.Describe=function(cQ,cS){this.only=cS&&cS.only;this.beforeEachFns=[];this.afterEachFns=[];this.its=[];this.children=[];this.name=cQ;this.parent=cS;this.id=ay.scenario.Describe.id++;var cP=this.beforeEachFns;this.setupBefore=function(){if(cS){cS.setupBefore.call(this)}ay.foreach(cP,function(cT){cT.call(this)},this)};var cR=this.afterEachFns;this.setupAfter=function(){ay.foreach(cR,function(cT){cT.call(this)},this);if(cS){cS.setupAfter.call(this)}}};ay.scenario.Describe.id=0;ay.scenario.Describe.prototype.beforeEach=function(cP){this.beforeEachFns.push(cP)};ay.scenario.Describe.prototype.afterEach=function(cP){this.afterEachFns.push(cP)};ay.scenario.Describe.prototype.describe=function(cQ,cP){var cR=new ay.scenario.Describe(cQ,this);this.children.push(cR);cP.call(cR)};ay.scenario.Describe.prototype.ddescribe=function(cQ,cP){var cR=new ay.scenario.Describe(cQ,this);cR.only=true;this.children.push(cR);cP.call(cR)};ay.scenario.Describe.prototype.xdescribe=ay.noop;ay.scenario.Describe.prototype.it=function(cQ,cP){this.its.push({definition:this,only:this.only,name:cQ,before:this.setupBefore,body:cP,after:this.setupAfter})};ay.scenario.Describe.prototype.iit=function(cQ,cP){this.it.apply(this,arguments);this.its[this.its.length-1].only=true};ay.scenario.Describe.prototype.xit=ay.noop;ay.scenario.Describe.prototype.getSpecs=function(){var cQ=arguments[0]||[];ay.foreach(this.children,function(cR){cR.getSpecs(cQ)});ay.foreach(this.its,function(cR){cQ.push(cR)});var cP=[];ay.foreach(cQ,function(cR){if(cR.only){cP.push(cR)}});return(cP.length&&cP)||cQ};ay.scenario.Future=function(cQ,cR,cP){this.name=cQ;this.behavior=cR;this.fulfilled=false;this.value=undefined;this.parser=ay.identity;this.line=cP||function(){return""}};ay.scenario.Future.prototype.execute=function(cQ){var cP=this;this.behavior(function(cS,cR){cP.fulfilled=true;if(cR){try{cR=cP.parser(cR)}catch(cT){cS=cT}}cP.value=cS||cR;cQ(cS,cR)})};ay.scenario.Future.prototype.parsedWith=function(cP){this.parser=cP;return this};ay.scenario.Future.prototype.fromJson=function(){return this.parsedWith(ay.fromJson)};ay.scenario.Future.prototype.toJson=function(){return this.parsedWith(ay.toJson)};ay.scenario.ObjectModel=function(cR){var cQ=this;this.specMap={};this.value={name:"",children:{}};cR.on("SpecBegin",function(cS){var cT=cQ.value;ay.foreach(cQ.getDefinitionPath(cS),function(cU){if(!cT.children[cU.name]){cT.children[cU.name]={id:cU.id,name:cU.name,children:{},specs:{}}}cT=cT.children[cU.name]});cQ.specMap[cS.id]=cT.specs[cS.name]=new ay.scenario.ObjectModel.Spec(cS.id,cS.name)});cR.on("SpecError",function(cS,cT){var cU=cQ.getSpec(cS.id);cU.status="error";cU.error=cT});cR.on("SpecEnd",function(cS){var cT=cQ.getSpec(cS.id);cP(cT)});cR.on("StepBegin",function(cS,cU){var cT=cQ.getSpec(cS.id);cT.steps.push(new ay.scenario.ObjectModel.Step(cU.name))});cR.on("StepEnd",function(cS,cU){var cT=cQ.getSpec(cS.id);if(cT.getLastStep().name!==cU.name){throw"Events fired in the wrong order. Step names don' match."}cP(cT.getLastStep())});cR.on("StepFailure",function(cS,cW,cT){var cU=cQ.getSpec(cS.id);var cV=cU.getLastStep();cV.error=cT;if(!cU.status){cU.status=cV.status="failure"}});cR.on("StepError",function(cS,cW,cT){var cU=cQ.getSpec(cS.id);var cV=cU.getLastStep();cU.status="error";cV.status="error";cV.error=cT});function cP(cS){cS.endTime=new Date().getTime();cS.duration=cS.endTime-cS.startTime;cS.status=cS.status||"success"}};ay.scenario.ObjectModel.prototype.getDefinitionPath=function(cP){var cR=[];var cQ=cP.definition;while(cQ&&cQ.name){cR.unshift(cQ);cQ=cQ.parent}return cR};ay.scenario.ObjectModel.prototype.getSpec=function(cP){return this.specMap[cP]};ay.scenario.ObjectModel.Spec=function(cQ,cP){this.id=cQ;this.name=cP;this.startTime=new Date().getTime();this.steps=[]};ay.scenario.ObjectModel.Spec.prototype.addStep=function(cP){var cQ=new ay.scenario.ObjectModel.Step(cP);this.steps.push(cQ);return cQ};ay.scenario.ObjectModel.Spec.prototype.getLastStep=function(){return this.steps[this.steps.length-1]};ay.scenario.ObjectModel.Step=function(cP){this.name=cP;this.startTime=new Date().getTime()};ay.scenario.Describe=function(cQ,cS){this.only=cS&&cS.only;this.beforeEachFns=[];this.afterEachFns=[];this.its=[];this.children=[];this.name=cQ;this.parent=cS;this.id=ay.scenario.Describe.id++;var cP=this.beforeEachFns;this.setupBefore=function(){if(cS){cS.setupBefore.call(this)}ay.foreach(cP,function(cT){cT.call(this)},this)};var cR=this.afterEachFns;this.setupAfter=function(){ay.foreach(cR,function(cT){cT.call(this)},this);if(cS){cS.setupAfter.call(this)}}};ay.scenario.Describe.id=0;ay.scenario.Describe.prototype.beforeEach=function(cP){this.beforeEachFns.push(cP)};ay.scenario.Describe.prototype.afterEach=function(cP){this.afterEachFns.push(cP)};ay.scenario.Describe.prototype.describe=function(cQ,cP){var cR=new ay.scenario.Describe(cQ,this);this.children.push(cR);cP.call(cR)};ay.scenario.Describe.prototype.ddescribe=function(cQ,cP){var cR=new ay.scenario.Describe(cQ,this);cR.only=true;this.children.push(cR);cP.call(cR)};ay.scenario.Describe.prototype.xdescribe=ay.noop;ay.scenario.Describe.prototype.it=function(cQ,cP){this.its.push({definition:this,only:this.only,name:cQ,before:this.setupBefore,body:cP,after:this.setupAfter})};ay.scenario.Describe.prototype.iit=function(cQ,cP){this.it.apply(this,arguments);this.its[this.its.length-1].only=true};ay.scenario.Describe.prototype.xit=ay.noop;ay.scenario.Describe.prototype.getSpecs=function(){var cQ=arguments[0]||[];ay.foreach(this.children,function(cR){cR.getSpecs(cQ)});ay.foreach(this.its,function(cR){cQ.push(cR)});var cP=[];ay.foreach(cQ,function(cR){if(cR.only){cP.push(cR)}});return(cP.length&&cP)||cQ};ay.scenario.Runner=function(cP){this.listeners=[];this.$window=cP;this.rootDescribe=new ay.scenario.Describe();this.currentDescribe=this.rootDescribe;this.api={it:this.it,iit:this.iit,xit:ay.noop,describe:this.describe,ddescribe:this.ddescribe,xdescribe:ay.noop,beforeEach:this.beforeEach,afterEach:this.afterEach};ay.foreach(this.api,ay.bind(this,function(cR,cQ){this.$window[cQ]=ay.bind(this,cR)}))};ay.scenario.Runner.prototype.emit=function(cQ){var cP=this;var cR=Array.prototype.slice.call(arguments,1);cQ=cQ.toLowerCase();if(!this.listeners[cQ]){return}ay.foreach(this.listeners[cQ],function(cS){cS.apply(cP,cR)})};ay.scenario.Runner.prototype.on=function(cP,cQ){cP=cP.toLowerCase();this.listeners[cP]=this.listeners[cP]||[];this.listeners[cP].push(cQ)};ay.scenario.Runner.prototype.describe=function(cR,cP){var cQ=this;this.currentDescribe.describe(cR,function(){var cS=cQ.currentDescribe;cQ.currentDescribe=this;try{cP.call(this)}finally{cQ.currentDescribe=cS}})};ay.scenario.Runner.prototype.ddescribe=function(cR,cP){var cQ=this;this.currentDescribe.ddescribe(cR,function(){var cS=cQ.currentDescribe;cQ.currentDescribe=this;try{cP.call(this)}finally{cQ.currentDescribe=cS}})};ay.scenario.Runner.prototype.it=function(cQ,cP){this.currentDescribe.it(cQ,cP)};ay.scenario.Runner.prototype.iit=function(cQ,cP){this.currentDescribe.iit(cQ,cP)};ay.scenario.Runner.prototype.beforeEach=function(cP){this.currentDescribe.beforeEach(cP)};ay.scenario.Runner.prototype.afterEach=function(cP){this.currentDescribe.afterEach(cP)};ay.scenario.Runner.prototype.createSpecRunner_=function(cP){return cP.$new(ay.scenario.SpecRunner)};ay.scenario.Runner.prototype.run=function(cQ){var cP=this;var cR=ay.scope(this);cR.application=cQ;this.emit("RunnerBegin");X(this.rootDescribe.getSpecs(),function(cS,cV){var cT={};var cU=cP.createSpecRunner_(cR);ay.foreach(ay.scenario.dsl,function(cX,cW){cT[cW]=cX.call(cR)});ay.foreach(ay.scenario.dsl,function(cX,cW){cP.$window[cW]=function(){var cY=x(3);var cZ=ay.scope(cU);cZ.dsl={};ay.foreach(cT,function(c1,c0){cZ.dsl[c0]=function(){return cT[c0].apply(cZ,arguments)}});cZ.addFuture=function(){Array.prototype.push.call(arguments,cY);return ay.scenario.SpecRunner.prototype.addFuture.apply(cZ,arguments)};cZ.addFutureAction=function(){Array.prototype.push.call(arguments,cY);return ay.scenario.SpecRunner.prototype.addFutureAction.apply(cZ,arguments)};return cZ.dsl[cW].apply(cZ,arguments)}});cU.run(cS,cV)},function(cS){if(cS){cP.emit("RunnerError",cS)}cP.emit("RunnerEnd")})};ay.scenario.SpecRunner=function(){this.futures=[];this.afterIndex=0};ay.scenario.SpecRunner.prototype.run=function(cQ,cS){var cP=this;this.spec=cQ;this.emit("SpecBegin",cQ);try{cQ.before.call(this);cQ.body.call(this);this.afterIndex=this.futures.length;cQ.after.call(this)}catch(cR){this.emit("SpecError",cQ,cR);this.emit("SpecEnd",cQ);cS();return}var cT=function(cV,cU){if(cP.error){return cU()}cP.error=true;cU(null,cP.afterIndex)};X(this.futures,function(cU,cV){cP.step=cU;cP.emit("StepBegin",cQ,cU);try{cU.execute(function(cX){if(cX){cP.emit("StepFailure",cQ,cU,cX);cP.emit("StepEnd",cQ,cU);return cT(cX,cV)}cP.emit("StepEnd",cQ,cU);cP.$window.setTimeout(function(){cV()},0)})}catch(cW){cP.emit("StepError",cQ,cU,cW);cP.emit("StepEnd",cQ,cU);cT(cW,cV)}},function(cU){if(cU){cP.emit("SpecError",cQ,cU)}cP.emit("SpecEnd",cQ);cP.$window.setTimeout(function(){cS()},0)})};ay.scenario.SpecRunner.prototype.addFuture=function(cR,cS,cQ){var cP=new ay.scenario.Future(cR,ay.bind(this,cS),cQ);this.futures.push(cP);return cP};ay.scenario.SpecRunner.prototype.addFutureAction=function(cR,cS,cP){var cQ=this;return this.addFuture(cR,function(cT){this.application.executeAction(function(cW,cV){cV.elements=function(cY){var cZ=Array.prototype.slice.call(arguments,1);cY=(cQ.selector||"")+" "+(cY||"");cY=b2.trim(cY)||"*";ay.foreach(cZ,function(c1,c0){cY=cY.replace("$"+(c0+1),c1)});var cX=cV.find(cY);if(!cX.length){throw {type:"selector",message:"Selector "+cY+" did not match any elements."}}return cX};try{cS.call(cQ,cW,cV,cT)}catch(cU){if(cU.type&&cU.type==="selector"){cT(cU.message)}else{throw cU}}})},cP)};ay.scenario.dsl("wait",function(){return function(){return this.addFuture("waiting for you to resume",function(cP){this.emit("InteractiveWait",this.spec,this.step);this.$window.resume=function(){cP()}})}});ay.scenario.dsl("pause",function(){return function(cP){return this.addFuture("pause for "+cP+" seconds",function(cQ){this.$window.setTimeout(function(){cQ(null,cP*1000)},cP*1000)})}});ay.scenario.dsl("browser",function(){var cP={};cP.navigateTo=function(cR,cS){var cQ=this.application;return this.addFuture("browser navigate to '"+cR+"'",function(cT){if(cS){cR=cS.call(this,cR)}cQ.navigateTo(cR,function(){cT(null,cR)},cT)})};cP.reload=function(){var cQ=this.application;return this.addFutureAction("browser reload",function(cU,cT,cR){var cS=cU.location.href;cQ.navigateTo(cS,function(){cR(null,cS)},cR)})};cP.location=function(){var cQ={};cQ.href=function(){return this.addFutureAction("browser url",function(cT,cS,cR){cR(null,cT.location.href)})};cQ.hash=function(){return this.addFutureAction("browser url hash",function(cT,cS,cR){cR(null,cT.location.hash.replace("#",""))})};cQ.path=function(){return this.addFutureAction("browser url path",function(cT,cS,cR){cR(null,cT.location.pathname)})};cQ.search=function(){return this.addFutureAction("browser url search",function(cT,cS,cR){cR(null,cT.angular.scope().$location.search)})};cQ.hashSearch=function(){return this.addFutureAction("browser url hash search",function(cT,cS,cR){cR(null,cT.angular.scope().$location.hashSearch)})};cQ.hashPath=function(){return this.addFutureAction("browser url hash path",function(cT,cS,cR){cR(null,cT.angular.scope().$location.hashPath)})};return cQ};return function(cQ){return cP}});ay.scenario.dsl("expect",function(){var cP=ay.extend({},ay.scenario.matcher);cP.not=function(){this.inverse=true;return cP};return function(cQ){this.future=cQ;return cP}});ay.scenario.dsl("using",function(){return function(cP,cQ){this.selector=b2.trim((this.selector||"")+" "+cP);if(ay.isString(cQ)&&cQ.length){this.label=cQ+" ( "+this.selector+" )"}else{this.label=this.selector}return this.dsl}});ay.scenario.dsl("binding",function(){return function(cP){return this.addFutureAction("select binding '"+cP+"'",function(cT,cS,cQ){var cR=cS.elements().bindings(cP);if(!cR.length){return cQ("Binding selector '"+cP+"' did not match.")}cQ(null,cR[0])})}});ay.scenario.dsl("input",function(){var cP={};cP.enter=function(cQ){return this.addFutureAction("input '"+this.name+"' enter '"+cQ+"'",function(cU,cT,cR){var cS=cT.elements(':input[name="$1"]',this.name);cS.val(cQ);cS.trigger("change");cR()})};cP.check=function(){return this.addFutureAction("checkbox '"+this.name+"' toggle",function(cT,cS,cQ){var cR=cS.elements(':checkbox[name="$1"]',this.name);cR.trigger("click");cQ()})};cP.select=function(cQ){return this.addFutureAction("radio button '"+this.name+"' toggle '"+cQ+"'",function(cU,cT,cR){var cS=cT.elements(':radio[name$="@$1"][value="$2"]',this.name,cQ);cS.trigger("click");cR()})};return function(cQ){this.name=cQ;return cP}});ay.scenario.dsl("repeater",function(){var cP={};cP.count=function(){return this.addFutureAction("repeater '"+this.label+"' count",function(cT,cS,cQ){try{cQ(null,cS.elements().length)}catch(cR){cQ(null,0)}})};cP.column=function(cQ){return this.addFutureAction("repeater '"+this.label+"' column '"+cQ+"'",function(cT,cS,cR){cR(null,cS.elements().bindings(cQ))})};cP.row=function(cQ){return this.addFutureAction("repeater '"+this.label+"' row '"+cQ+"'",function(cV,cU,cR){var cS=[];var cT=cU.elements().slice(cQ,cQ+1);if(!cT.length){return cR("row "+cQ+" out of bounds")}cR(null,cT.bindings())})};return function(cQ,cR){this.dsl.using(cQ,cR);return cP}});ay.scenario.dsl("select",function(){var cP={};cP.option=function(cQ){return this.addFutureAction("select '"+this.name+"' option '"+cQ+"'",function(cU,cT,cS){var cR=cT.elements('select[name="$1"]',this.name);cR.val(cQ);cR.trigger("change");cS()})};cP.options=function(){var cQ=arguments;return this.addFutureAction("select '"+this.name+"' options '"+cQ+"'",function(cU,cT,cS){var cR=cT.elements('select[multiple][name="$1"]',this.name);cR.val(cQ);cR.trigger("change");cS()})};return function(cQ){this.name=cQ;return cP}});ay.scenario.dsl("element",function(){var cP=["attr","css"];var cR=["val","text","html","height","innerHeight","outerHeight","width","innerWidth","outerWidth","position","scrollLeft","scrollTop","offset"];var cQ={};cQ.count=function(){return this.addFutureAction("element '"+this.label+"' count",function(cV,cU,cS){try{cS(null,cU.elements().length)}catch(cT){cS(null,0)}})};cQ.click=function(){return this.addFutureAction("element '"+this.label+"' click",function(cW,cV,cS){var cU=cV.elements();var cT=cU.attr("href");cU.trigger("click");if(cT&&cU[0].nodeName.toUpperCase()==="A"){this.application.navigateTo(cT,function(){cS()},cS)}else{cS()}})};cQ.query=function(cS){return this.addFutureAction("element "+this.label+" custom query",function(cV,cU,cT){cS.call(this,cU.elements(),cT)})};ay.foreach(cP,function(cS){cQ[cS]=function(cT,cV){var cU="element '"+this.label+"' get "+cS+" '"+cT+"'";if(ay.isDefined(cV)){cU="element '"+this.label+"' set "+cS+" '"+cT+"' to '"+cV+"'"}return this.addFutureAction(cU,function(cZ,cY,cW){var cX=cY.elements();cW(null,cX[cS].call(cX,cT,cV))})}});ay.foreach(cR,function(cS){cQ[cS]=function(cU){var cT="element '"+this.label+"' "+cS;if(ay.isDefined(cU)){cT="element '"+this.label+"' set "+cS+" to '"+cU+"'"}return this.addFutureAction(cT,function(cY,cX,cV){var cW=cX.elements();cV(null,cW[cS].call(cW,cU))})}});return function(cS,cT){this.dsl.using(cS,cT);return cQ}});ay.scenario.matcher("toEqual",function(cP){return ay.equals(this.actual,cP)});ay.scenario.matcher("toBe",function(cP){return this.actual===cP});ay.scenario.matcher("toBeDefined",function(){return ay.isDefined(this.actual)});ay.scenario.matcher("toBeTruthy",function(){return this.actual});ay.scenario.matcher("toBeFalsy",function(){return !this.actual});ay.scenario.matcher("toMatch",function(cP){return new RegExp(cP).test(this.actual)});ay.scenario.matcher("toBeNull",function(){return this.actual===null});ay.scenario.matcher("toContain",function(cP){return u(this.actual,cP)});ay.scenario.matcher("toBeLessThan",function(cP){return this.actual<cP});ay.scenario.matcher("toBeGreaterThan",function(cP){return this.actual>cP});ay.scenario.output("html",function(cS,cU){var cR=new ay.scenario.ObjectModel(cU);cS.append('<div id="header"> <h1><span class="angular"><angular/></span>: Scenario Test Runner</h1> <ul id="status-legend" class="status-display"> <li class="status-error">0 Errors</li> <li class="status-failure">0 Failures</li> <li class="status-success">0 Passed</li> </ul></div><div id="specs"> <div class="test-children"></div></div>');cU.on("InteractiveWait",function(cV,cW){var cX=cR.getSpec(cV.id).getLastStep().ui;cX.find(".test-title").html('waiting for you to <a href="javascript:resume()">resume</a>.')});cU.on("SpecBegin",function(cV){var cW=cT(cV);cW.find("> .tests").append('<li class="status-pending test-it"></li>');cW=cW.find("> .tests li:last");cW.append('<div class="test-info"> <p class="test-title"> <span class="timer-result"></span> <span class="test-name"></span> </p></div><div class="scrollpane"> <ol class="test-actions"></ol></div>');cW.find("> .test-info .test-name").text(cV.name);cW.find("> .test-info").click(function(){var cY=cW.find("> .scrollpane");var cZ=cY.find("> .test-actions");var cX=cS.find("> .test-info .test-name");if(cZ.find(":visible").length){cZ.hide();cX.removeClass("open").addClass("closed")}else{cZ.show();cY.attr("scrollTop",cY.attr("scrollHeight"));cX.removeClass("closed").addClass("open")}});cR.getSpec(cV.id).ui=cW});cU.on("SpecError",function(cV,cW){var cX=cR.getSpec(cV.id).ui;cX.append("<pre></pre>");cX.find("> pre").text(W(cW))});cU.on("SpecEnd",function(cV){cV=cR.getSpec(cV.id);cV.ui.removeClass("status-pending");cV.ui.addClass("status-"+cV.status);cV.ui.find("> .test-info .timer-result").text(cV.duration+"ms");if(cV.status==="success"){cV.ui.find("> .test-info .test-name").addClass("closed");cV.ui.find("> .scrollpane .test-actions").hide()}cQ(cV.status)});cU.on("StepBegin",function(cV,cX){cV=cR.getSpec(cV.id);cX=cV.getLastStep();cV.ui.find("> .scrollpane .test-actions").append('<li class="status-pending"></li>');cX.ui=cV.ui.find("> .scrollpane .test-actions li:last");cX.ui.append('<div class="timer-result"></div><div class="test-title"></div>');cX.ui.find("> .test-title").text(cX.name);var cW=cX.ui.parents(".scrollpane");cW.attr("scrollTop",cW.attr("scrollHeight"))});cU.on("StepFailure",function(cV,cX,cW){var cY=cR.getSpec(cV.id).getLastStep().ui;cP(cY,cX.line,cW)});cU.on("StepError",function(cV,cX,cW){var cY=cR.getSpec(cV.id).getLastStep().ui;cP(cY,cX.line,cW)});cU.on("StepEnd",function(cV,cX){cV=cR.getSpec(cV.id);cX=cV.getLastStep();cX.ui.find(".timer-result").text(cX.duration+"ms");cX.ui.removeClass("status-pending");cX.ui.addClass("status-"+cX.status);var cW=cV.ui.find("> .scrollpane");cW.attr("scrollTop",cW.attr("scrollHeight"))});function cT(cV){var cW=cS.find("#specs");ay.foreach(cR.getDefinitionPath(cV),function(cX){var cY="describe-"+cX.id;if(!cS.find("#"+cY).length){cW.find("> .test-children").append('<div class="test-describe" id="'+cY+'"> <h2></h2> <div class="test-children"></div> <ul class="tests"></ul></div>');cS.find("#"+cY).find("> h2").text("describe: "+cX.name)}cW=cS.find("#"+cY)});return cS.find("#describe-"+cV.definition.id)}function cQ(cV){var cW=cS.find("#status-legend .status-"+cV);var cY=cW.text().split(" ");var cX=(cY[0]*1)+1;cW.text(cX+" "+cY[1])}function cP(cX,cV,cW){cX.find(".test-title").append("<pre></pre>");var cY=b2.trim(cV()+"\n\n"+W(cW));cX.find(".test-title pre:last").text(cY)}});ay.scenario.output("json",function(cQ,cR){var cP=new ay.scenario.ObjectModel(cR);cR.on("RunnerEnd",function(){cQ.text(ay.toJson(cP.value))})});ay.scenario.output("xml",function(cQ,cS){var cP=new ay.scenario.ObjectModel(cS);var cT=function(cU){return new cQ.init(cU)};cS.on("RunnerEnd",function(){var cU=cT("<scenario></scenario>");cQ.append(cU);cR(cU,cP.value)});function cR(cW,cU){ay.foreach(cU.children,function(cY){var cX=cT("<describe></describe>");cX.attr("id",cY.id);cX.attr("name",cY.name);cW.append(cX);cR(cX,cY)});var cV=cT("<its></its>");cW.append(cV);ay.foreach(cU.specs,function(cX){var cY=cT("<it></it>");cY.attr("id",cX.id);cY.attr("name",cX.name);cY.attr("duration",cX.duration);cY.attr("status",cX.status);cV.append(cY);ay.foreach(cX.steps,function(c1){var c0=cT("<step></step>");c0.attr("name",c1.name);c0.attr("duration",c1.duration);c0.attr("status",c1.status);cY.append(c0);if(c1.error){var cZ=cT("<error></error");c0.append(cZ);cZ.text(W(c0.error))}})})}});ay.scenario.output("object",function(cP,cQ){cQ.$window.$result=new ay.scenario.ObjectModel(cQ).value});var aj=new ay.scenario.Runner(bO);bO.onload=function(){try{if(bb){bb()}}catch(cP){}i(aj,bz(r))}})(window,document,window.onload);document.write('<style type="text/css">@charset "UTF-8";\n\n.ng-format-negative {\n color: red;\n}\n\n.ng-exception {\n border: 2px solid #FF0000;\n font-family: "Courier New", Courier, monospace;\n font-size: smaller;\n}\n\n.ng-validation-error {\n border: 2px solid #FF0000;\n}\n\n\n/*****************\n * TIP\n *****************/\n#ng-callout {\n margin: 0;\n padding: 0;\n border: 0;\n outline: 0;\n font-size: 13px;\n font-weight: normal;\n font-family: Verdana, Arial, Helvetica, sans-serif;\n vertical-align: baseline;\n background: transparent;\n text-decoration: none;\n}\n\n#ng-callout .ng-arrow-left{\n background-image: url("data:image/gif;base64,R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrSLoc/AG8FeUUIN+sGebWAnbKSJodqqlsOxJtqYooU9vvk+vcJIcTkg+QAAA7");\n background-repeat: no-repeat;\n background-position: left top;\n position: absolute;\n z-index:101;\n left:-12px;\n height:23px;\n width:10px;\n top:-3px;\n}\n\n#ng-callout .ng-arrow-right{\n background-image: url("data:image/gif;base64,R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrCLTcoM29yN6k9socs91e5X3EyJloipYrO4ohTMqA0Fn2XVNswJe+H+SXAAA7");\n background-repeat: no-repeat;\n background-position: left top;\n position: absolute;\n z-index:101;\n height:23px;\n width:11px;\n top:-2px;\n}\n\n#ng-callout {\n position: absolute;\n z-index:100;\n border: 2px solid #CCCCCC;\n background-color: #fff;\n}\n\n#ng-callout .ng-content{\n padding:10px 10px 10px 10px;\n color:#333333;\n}\n\n#ng-callout .ng-title{\n background-color: #CCCCCC;\n text-align: left;\n padding-left: 8px;\n padding-bottom: 5px;\n padding-top: 2px;\n font-weight:bold;\n}\n\n\n/*****************\n * indicators\n *****************/\n.ng-input-indicator-wait {\n background-image: url("data:image/png;base64,R0lGODlhEAAQAPQAAP///wAAAPDw8IqKiuDg4EZGRnp6egAAAFhYWCQkJKysrL6+vhQUFJycnAQEBDY2NmhoaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAAFdyAgAgIJIeWoAkRCCMdBkKtIHIngyMKsErPBYbADpkSCwhDmQCBethRB6Vj4kFCkQPG4IlWDgrNRIwnO4UKBXDufzQvDMaoSDBgFb886MiQadgNABAokfCwzBA8LCg0Egl8jAggGAA1kBIA1BAYzlyILczULC2UhACH5BAkKAAAALAAAAAAQABAAAAV2ICACAmlAZTmOREEIyUEQjLKKxPHADhEvqxlgcGgkGI1DYSVAIAWMx+lwSKkICJ0QsHi9RgKBwnVTiRQQgwF4I4UFDQQEwi6/3YSGWRRmjhEETAJfIgMFCnAKM0KDV4EEEAQLiF18TAYNXDaSe3x6mjidN1s3IQAh+QQJCgAAACwAAAAAEAAQAAAFeCAgAgLZDGU5jgRECEUiCI+yioSDwDJyLKsXoHFQxBSHAoAAFBhqtMJg8DgQBgfrEsJAEAg4YhZIEiwgKtHiMBgtpg3wbUZXGO7kOb1MUKRFMysCChAoggJCIg0GC2aNe4gqQldfL4l/Ag1AXySJgn5LcoE3QXI3IQAh+QQJCgAAACwAAAAAEAAQAAAFdiAgAgLZNGU5joQhCEjxIssqEo8bC9BRjy9Ag7GILQ4QEoE0gBAEBcOpcBA0DoxSK/e8LRIHn+i1cK0IyKdg0VAoljYIg+GgnRrwVS/8IAkICyosBIQpBAMoKy9dImxPhS+GKkFrkX+TigtLlIyKXUF+NjagNiEAIfkECQoAAAAsAAAAABAAEAAABWwgIAICaRhlOY4EIgjH8R7LKhKHGwsMvb4AAy3WODBIBBKCsYA9TjuhDNDKEVSERezQEL0WrhXucRUQGuik7bFlngzqVW9LMl9XWvLdjFaJtDFqZ1cEZUB0dUgvL3dgP4WJZn4jkomWNpSTIyEAIfkECQoAAAAsAAAAABAAEAAABX4gIAICuSxlOY6CIgiD8RrEKgqGOwxwUrMlAoSwIzAGpJpgoSDAGifDY5kopBYDlEpAQBwevxfBtRIUGi8xwWkDNBCIwmC9Vq0aiQQDQuK+VgQPDXV9hCJjBwcFYU5pLwwHXQcMKSmNLQcIAExlbH8JBwttaX0ABAcNbWVbKyEAIfkECQoAAAAsAAAAABAAEAAABXkgIAICSRBlOY7CIghN8zbEKsKoIjdFzZaEgUBHKChMJtRwcWpAWoWnifm6ESAMhO8lQK0EEAV3rFopIBCEcGwDKAqPh4HUrY4ICHH1dSoTFgcHUiZjBhAJB2AHDykpKAwHAwdzf19KkASIPl9cDgcnDkdtNwiMJCshACH5BAkKAAAALAAAAAAQABAAAAV3ICACAkkQZTmOAiosiyAoxCq+KPxCNVsSMRgBsiClWrLTSWFoIQZHl6pleBh6suxKMIhlvzbAwkBWfFWrBQTxNLq2RG2yhSUkDs2b63AYDAoJXAcFRwADeAkJDX0AQCsEfAQMDAIPBz0rCgcxky0JRWE1AmwpKyEAIfkECQoAAAAsAAAAABAAEAAABXkgIAICKZzkqJ4nQZxLqZKv4NqNLKK2/Q4Ek4lFXChsg5ypJjs1II3gEDUSRInEGYAw6B6zM4JhrDAtEosVkLUtHA7RHaHAGJQEjsODcEg0FBAFVgkQJQ1pAwcDDw8KcFtSInwJAowCCA6RIwqZAgkPNgVpWndjdyohACH5BAkKAAAALAAAAAAQABAAAAV5ICACAimc5KieLEuUKvm2xAKLqDCfC2GaO9eL0LABWTiBYmA06W6kHgvCqEJiAIJiu3gcvgUsscHUERm+kaCxyxa+zRPk0SgJEgfIvbAdIAQLCAYlCj4DBw0IBQsMCjIqBAcPAooCBg9pKgsJLwUFOhCZKyQDA3YqIQAh+QQJCgAAACwAAAAAEAAQAAAFdSAgAgIpnOSonmxbqiThCrJKEHFbo8JxDDOZYFFb+A41E4H4OhkOipXwBElYITDAckFEOBgMQ3arkMkUBdxIUGZpEb7kaQBRlASPg0FQQHAbEEMGDSVEAA1QBhAED1E0NgwFAooCDWljaQIQCE5qMHcNhCkjIQAh+QQJCgAAACwAAAAAEAAQAAAFeSAgAgIpnOSoLgxxvqgKLEcCC65KEAByKK8cSpA4DAiHQ/DkKhGKh4ZCtCyZGo6F6iYYPAqFgYy02xkSaLEMV34tELyRYNEsCQyHlvWkGCzsPgMCEAY7Cg04Uk48LAsDhRA8MVQPEF0GAgqYYwSRlycNcWskCkApIyEAOwAAAAAAAAAAAA==");\n background-position: right;\n background-repeat: no-repeat;\n}\n</style>');document.write("<style type=\"text/css\">@charset \"UTF-8\";\n/* CSS Document */\n\n/** Structure */\nbody {\n font-family: Arial, sans-serif;\n margin: 0;\n font-size: 14px;\n}\n\n#system-error {\n font-size: 1.5em;\n text-align: center;\n}\n\n#json, #xml {\n display: none;\n}\n\n#header {\n position: fixed;\n width: 100%;\n}\n\n#specs {\n padding-top: 50px;\n}\n\n#header .angular {\n font-family: Courier New, monospace;\n font-weight: bold;\n}\n\n#header h1 {\n font-weight: normal;\n float: left;\n font-size: 30px;\n line-height: 30px;\n margin: 0;\n padding: 10px 10px;\n height: 30px;\n}\n\n#application h2,\n#specs h2 {\n margin: 0;\n padding: 0.5em;\n font-size: 1.1em;\n}\n\n#status-legend {\n margin-top: 10px;\n margin-right: 10px;\n}\n\n#header,\n#application,\n.test-info,\n.test-actions li {\n overflow: hidden;\n}\n\n#application {\n margin: 10px;\n}\n\n#application iframe {\n width: 100%;\n height: 758px;\n}\n\n#application .popout {\n float: right;\n}\n\n#application iframe {\n border: none;\n}\n\n.tests li,\n.test-actions li,\n.test-it li,\n.test-it ol,\n.status-display {\n list-style-type: none;\n}\n\n.tests,\n.test-it ol,\n.status-display {\n margin: 0;\n padding: 0;\n}\n\n.test-info {\n margin-left: 1em;\n margin-top: 0.5em;\n border-radius: 8px 0 0 8px;\n -webkit-border-radius: 8px 0 0 8px;\n -moz-border-radius: 8px 0 0 8px;\n cursor: pointer;\n}\n\n.test-info:hover .test-name {\n text-decoration: underline;\n}\n\n.test-info .closed:before {\n content: '\\25b8\\00A0';\n}\n\n.test-info .open:before {\n content: '\\25be\\00A0';\n font-weight: bold;\n}\n\n.test-it ol {\n margin-left: 2.5em;\n}\n\n.status-display,\n.status-display li {\n float: right;\n}\n\n.status-display li {\n padding: 5px 10px;\n}\n\n.timer-result,\n.test-title {\n display: inline-block;\n margin: 0;\n padding: 4px;\n}\n\n.test-actions .test-title,\n.test-actions .test-result {\n display: table-cell;\n padding-left: 0.5em;\n padding-right: 0.5em;\n}\n\n.test-actions {\n display: table;\n}\n\n.test-actions li {\n display: table-row;\n}\n\n.timer-result {\n width: 4em;\n padding: 0 10px;\n text-align: right;\n font-family: monospace;\n}\n\n.test-it pre,\n.test-actions pre {\n clear: left;\n color: black;\n margin-left: 6em;\n}\n\n.test-describe {\n padding-bottom: 0.5em;\n}\n\n.test-describe .test-describe {\n margin: 5px 5px 10px 2em;\n}\n\n.test-actions .status-pending .test-title:before {\n content: '\\00bb\\00A0';\n}\n\n.scrollpane {\n max-height: 20em;\n overflow: auto;\n}\n\n/** Colors */\n\n#header {\n background-color: #F2C200;\n}\n\n#specs h2 {\n border-top: 2px solid #BABAD1;\n}\n\n#specs h2,\n#application h2 {\n background-color: #efefef;\n}\n\n#application {\n border: 1px solid #BABAD1;\n}\n\n.test-describe .test-describe {\n border-left: 1px solid #BABAD1;\n border-right: 1px solid #BABAD1;\n border-bottom: 1px solid #BABAD1;\n}\n\n.status-display {\n border: 1px solid #777;\n}\n\n.status-display .status-pending,\n.status-pending .test-info {\n background-color: #F9EEBC;\n}\n\n.status-display .status-success,\n.status-success .test-info {\n background-color: #B1D7A1;\n}\n\n.status-display .status-failure,\n.status-failure .test-info {\n background-color: #FF8286;\n}\n\n.status-display .status-error,\n.status-error .test-info {\n background-color: black;\n color: white;\n}\n\n.test-actions .status-success .test-title {\n color: #30B30A;\n}\n\n.test-actions .status-failure .test-title {\n color: #DF0000;\n}\n\n.test-actions .status-error .test-title {\n color: black;\n}\n\n.test-actions .timer-result {\n color: #888;\n}\n</style>");
|
src/modules/Profile/components/ProfileForm.js
|
prjctrft/mantenuto
|
import React, { Component } from 'react';
import { connect } from 'react-redux';
import {
reduxForm,
Field,
propTypes,
startAsyncValidation,
stopAsyncValidation,
touch
} from 'redux-form';
import profileValidation from './profileValidation';
import { RefitInput } from 'components';
import { match, email } from 'utils/validation';
import { checkUsername } from 'modules/user/redux';
@connect(state => ({
profile: state.form.profile
}))
@reduxForm({
form: 'profile',
validate: profileValidation,
enableReinitialize: true
})
export default class ProfileForm extends Component {
static propTypes = {
...propTypes
}
checkbox = ({className}) => {
return <input className={className} />
}
validateUsername = (e) => {
const username = e.target.value;
if(username === this.props.profile.initial.username) {
return
};
this.props.dispatch(startAsyncValidation('register'));
return checkUsername(username).then(({ message }) => {
const errors = {};
this.props.dispatch(touch('profile', 'username'))
if(message) {
errors.username = message;
}
this.props.dispatch(stopAsyncValidation('profile', errors));
})
};
resetEmailField = () => {
this.props.profile.values.email = this.props.profile.initial.email;
}
renderConfirmEmail = () => {
const form = this.props.profile;
if(form && form.fields) {
if(form.fields.email) {
if(form.initial.email !== form.values.email) {
return (
<div>
<Field name='confirmEmail' validate={this.validateConfirm} type='text' component={RefitInput} label='Confirm Email' />
<p className='text-center'>
<button onClick={this.resetEmailField} className='btn btn-danger'>Cancel?</button>
</p>
</div>
)
}
}
}
return null;
}
validateConfirm = (value, allValues, props) => {
let error;
error = match('email')(value, allValues)
error = email(value);
if(!value) {
error = 'Confirm Email is required when changing your Email address.'
}
return error;
}
render() {
const { user, pristine, submitting, handleSubmit, error, initialValues } = this.props; //eslint-disable-line no-unused-vars
const styles = require('./ProfileForm.scss')
return (
<div className='row justify-content-center'>
<div className='col-md-8 col-12'>
<form className={styles.ProfileForm} onSubmit={handleSubmit}>
<Field name='first' type='text' component={RefitInput} label='First Name' />
<Field name='last' type='text' component={RefitInput} label='Last Name' />
<Field name='mos' type='text' component={RefitInput} label='MOS' />
<Field name='username' onChange={this.validateUsername} type='text' component={RefitInput} label='Username' />
<Field name='email' type='text' component={RefitInput} label='Email' />
{this.renderConfirmEmail()}
<div className={`${styles.checkbox} text-center`}>
<p>Injury <span>(optional)</span></p>
<div className='row justify-content-center'>
<div className='col-6 text-center'>
<label htmlFor='combat'>
<Field type='radio' name='injury' value='combat' className={styles.checkbox} component='input' />
Combat
</label>
</div>
<div className='col-6 text-center'>
<label htmlFor='noncombat'>
<Field type='radio' name='injury' value='nonCombat' className={styles.checkbox} component='input' />
Non-combat
</label>
</div>
</div>
</div>
{error && <p className="text-danger"><strong>{error}</strong></p>}
<p className='text-center'>
<button disabled={pristine || submitting} className="btn btn-secondary" type="submit">
Update Profile
</button>
</p>
</form>
</div>
</div>
);
}
}
|
ajax/libs/yui/3.0.0beta1m1/yui/yui.js
|
jessepollak/cdnjs
|
/**
* YUI core
* @module yui
*/
(function() {
var _instances = {}, _startTime = new Date().getTime(), Y, p, i,
// @TODO: this needs to be created at build time from module metadata
_APPLY_TO_WHITE_LIST = {
'io.xdrReady': 1,
'io.start': 1,
'io.success': 1,
'io.failure': 1,
'io.abort': 1
};
// reduce to one or the other
if (typeof YUI === 'undefined' || !YUI) {
/**
* The YUI global namespace object. If YUI is already defined, the
* existing YUI object will not be overwritten so that defined
* namespaces are preserved.
*
* @class YUI
* @constructor
* @global
* @uses Event.Target
* @param o Optional configuration object. Options:
* <ul>
* <li>------------------------------------------------------------------------</li>
* <li>Global:</li>
* <li>------------------------------------------------------------------------</li>
* <li>debug:
* Turn debug statements on or off</li>
* <li>useBrowserConsole:
* Log to the browser console if debug is on and the console is available</li>
* <li>logInclude:
* A hash of log sources that should be logged. If specified, only log messages from these sources will be logged.
*
* </li>
* <li>logExclude:
* A hash of log sources that should be not be logged. If specified, all sources are logged if not on this list.</li>
* <li>throwFail:
* If throwFail is set, Y.fail will generate or re-throw a JS error. Otherwise the failure is logged.
* <li>win:
* The target window/frame</li>
* <li>core:
* A list of modules that defines the YUI core (overrides the default)</li>
* <li>------------------------------------------------------------------------</li>
* <li>For event and get:</li>
* <li>------------------------------------------------------------------------</li>
* <li>pollInterval:
* The default poll interval</li>
* <li>-------------------------------------------------------------------------</li>
* <li>For loader:</li>
* <li>-------------------------------------------------------------------------</li>
* <li>base:
* The base dir</li>
* <li>secureBase:
* The secure base dir (not implemented)</li>
* <li>comboBase:
* The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?</li>
* <li>root:
* The root path to prepend to module names for the combo service. Ex: 2.5.2/build/</li>
* <li>filter:
*
* A filter to apply to result urls. This filter will modify the default
* path for all modules. The default path for the YUI library is the
* minified version of the files (e.g., event-min.js). The filter property
* can be a predefined filter or a custom filter. The valid predefined
* filters are:
* <dl>
* <dt>DEBUG</dt>
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
* This option will automatically include the Logger widget</dd>
* <dt>RAW</dt>
* <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
* </dl>
* You can also define a custom filter, which must be an object literal
* containing a search expression and a replace string:
* <pre>
* myFilter: {
* 'searchExp': "-min\\.js",
* 'replaceStr': "-debug.js"
* }
* </pre>
*
* </li>
* <li>combine:
* Use the YUI combo service to reduce the number of http connections required to load your dependencies</li>
* <li>ignore:
* A list of modules that should never be dynamically loaded</li>
* <li>force:
* A list of modules that should always be loaded when required, even if already present on the page</li>
* <li>insertBefore:
* Node or id for a node that should be used as the insertion point for new nodes</li>
* <li>charset:
* charset for dynamic nodes</li>
* <li>timeout:
* number of milliseconds before a timeout occurs when dynamically loading nodes. in not set, there is no timeout</li>
* <li>context:
* execution context for all callbacks</li>
* <li>onSuccess:
* callback for the 'success' event</li>
* <li>onFailure:
* callback for the 'failure' event</li>
* <li>onTimeout:
* callback for the 'timeout' event</li>
* <li>onProgress:
* callback executed each time a script or css file is loaded</li>
* <li>modules:
* A list of module definitions. See Loader.addModule for the supported module metadata</li>
* </ul>
*/
/*global YUI*/
// Make a function, disallow direct instantiation
YUI = function(o) {
var Y = this;
// Allow instantiation without the new operator
if (!(Y instanceof YUI)) {
return new YUI(o);
} else {
// set up the core environment
Y._init(o);
// bind the specified additional modules for this instance
Y._setup();
return Y;
}
};
}
// The prototype contains the functions that are required to allow the external
// modules to be registered and for the instance to be initialized.
YUI.prototype = {
/**
* Initialize this YUI instance
* @param o config options
* @private
*/
_init: function(o) {
o = o || {};
// find targeted window
// @TODO create facades
// @TODO resolve windowless environments
var w = (o.win) ? (o.win.contentWindow) : o.win || window,
v = '@VERSION@';
o.win = w;
o.doc = w.document;
o.debug = ('debug' in o) ? o.debug : true;
o.useBrowserConsole = ('useBrowserConsole' in o) ? o.useBrowserConsole : true;
o.throwFail = ('throwFail' in o) ? o.throwFail : true;
// add a reference to o for anything that needs it
// before _setup is called.
this.config = o;
this.Env = {
// @todo expand the new module metadata
mods: {},
_idx: 0,
_pre: 'yuid',
_used: {},
_attached: {},
_yidx: 0,
_uidx: 0
};
if (v.indexOf('@') > -1) {
v = 'test';
}
this.version = v;
if (YUI.Env) {
this.Env._yidx = ++YUI.Env._idx;
this.id = this.stamp(this);
_instances[this.id] = this;
}
this.constructor = YUI;
this.log(this.id + ') init ');
},
/**
* Finishes the instance setup. Attaches whatever modules were defined
* when the yui modules was registered.
* @method _setup
* @private
*/
_setup: function(o) {
this.use("yui-base");
// @TODO eval the need to copy the config
// this.config = this.merge(this.config);
},
/**
* Executes a method on a YUI instance with
* the specified id if the specified method is whitelisted.
* @method applyTo
* @param id {string} the YUI instance id
* @param method {string} the name of the method to exectute.
* Ex: 'Object.keys'
* @param args {Array} the arguments to apply to the method
* @return {object} the return value from the applied method or null
*/
applyTo: function(id, method, args) {
if (!(method in _APPLY_TO_WHITE_LIST)) {
this.error(method + ': applyTo not allowed');
return null;
}
var instance = _instances[id], nest, m, i;
if (instance) {
nest = method.split('.');
m = instance;
for (i=0; i<nest.length; i=i+1) {
m = m[nest[i]];
if (!m) {
this.error('applyTo not found: ' + method);
}
}
return m.apply(instance, args);
}
return null;
},
/**
* Register a module
* @method add
* @param name {string} module name
* @param fn {Function} entry point into the module that
* is used to bind module to the YUI instance
* @param version {string} version string
* @param details optional config data:
* requires - features that should be present before loading
* optional - optional features that should be present if load optional defined
* use - features that should be attached automatically
* skinnable -
* rollup
* omit - features that should not be loaded if this module is present
* @return {YUI} the YUI instance
*
*/
add: function(name, fn, version, details) {
// this.log('Adding a new component ' + name);
// @todo expand this to include version mapping
// @todo allow requires/supersedes
// @todo may want to restore the build property
// @todo fire moduleAvailable event
var m = {
name: name,
fn: fn,
version: version,
details: details || {}
};
YUI.Env.mods[name] = m;
return this; // chain support
},
_attach: function(r, fromLoader) {
var mods = YUI.Env.mods,
attached = this.Env._attached,
i, l = r.length, name, m, d, req, use;
for (i=0; i<l; i=i+1) {
name = r[i];
m = mods[name];
if (!attached[name] && m) {
attached[name] = true;
d = m.details;
req = d.requires;
use = d.use;
if (req) {
this._attach(this.Array(req));
}
this.log('attaching ' + name, 'info', 'YUI');
if (m.fn) {
m.fn(this);
}
if (use) {
this._attach(this.Array(use));
}
}
}
},
/**
* Bind a module to a YUI instance
* @param modules* {string} 1-n modules to bind (uses arguments array)
* @param *callback {function} callback function executed when
* the instance has the required functionality. If included, it
* must be the last parameter.
*
* @TODO
* Implement versioning? loader can load different versions?
* Should sub-modules/plugins be normal modules, or do
* we add syntax for specifying these?
*
* YUI().use('dragdrop')
* YUI().use('dragdrop:2.4.0'); // specific version
* YUI().use('dragdrop:2.4.0-'); // at least this version
* YUI().use('dragdrop:2.4.0-2.9999.9999'); // version range
* YUI().use('*'); // use all available modules
* YUI().use('lang+dump+substitute'); // use lang and some plugins
* YUI().use('lang+*'); // use lang and all known plugins
*
*
* @return {YUI} the YUI instance
*/
use: function() {
var Y = this,
a=Array.prototype.slice.call(arguments, 0),
mods = YUI.Env.mods,
used = Y.Env._used,
loader,
firstArg = a[0],
dynamic = false,
callback = a[a.length-1],
k, i, l, missing = [], r = [],
f = function(name) {
// only attach a module once
if (used[name]) {
return;
}
var m = mods[name], j, req, use;
if (m) {
used[name] = true;
req = m.details.requires;
use = m.details.use;
} else {
missing.push(name);
}
// make sure requirements are attached
if (req) {
if (Y.Lang.isString(req)) {
f(req);
} else {
for (j = 0; j < req.length; j = j + 1) {
f(req[j]);
}
}
}
// add this module to full list of things to attach
r.push(name);
},
onComplete = function(fromLoader) {
fromLoader = fromLoader || {
success: true,
msg: 'not dynamic'
};
if (Y.Env._callback) {
var cb = Y.Env._callback;
Y.Env._callback = null;
cb(Y, fromLoader);
}
if (Y.fire) {
Y.fire('yui:load', Y, fromLoader);
}
};
// The last argument supplied to use can be a load complete callback
if (typeof callback === 'function') {
a.pop();
Y.Env._callback = callback;
} else {
callback = null;
}
// YUI().use('*'); // bind everything available
if (firstArg === "*") {
a = [];
for (k in mods) {
if (mods.hasOwnProperty(k)) {
a.push(k);
}
}
return Y.use.apply(Y, a);
}
// use loader to expand dependencies and sort the
// requirements if it is available.
if (Y.Loader) {
dynamic = true;
loader = new Y.Loader(Y.config);
loader.require(a);
loader.ignoreRegistered = true;
loader.allowRollup = false;
loader.calculate();
a = loader.sorted;
}
l = a.length;
// process each requirement and any additional requirements
// the module metadata specifies
for (i=0; i<l; i=i+1) {
f(a[i]);
}
// dynamic load
if (Y.Loader && missing.length) {
loader = new Y.Loader(Y.config);
loader.onSuccess = onComplete;
loader.onFailure = onComplete;
loader.onTimeout = onComplete;
loader.attaching = a;
loader.require(missing);
loader.insert();
} else {
Y._attach(r);
onComplete();
}
return Y; // chain support var yui = YUI().use('dragdrop');
},
/**
* Returns the namespace specified and creates it if it doesn't exist
* <pre>
* YUI.namespace("property.package");
* YUI.namespace("YAHOO.property.package");
* </pre>
* Either of the above would create YUI.property, then
* YUI.property.package (YAHOO is scrubbed out, this is
* to remain compatible with YUI2)
*
* Be careful when naming packages. Reserved words may work in some browsers
* and not others. For instance, the following will fail in Safari:
* <pre>
* YUI.namespace("really.long.nested.namespace");
* </pre>
* This fails because "long" is a future reserved word in ECMAScript
*
* @method namespace
* @param {string*} arguments 1-n namespaces to create
* @return {object} A reference to the last namespace object created
*/
namespace: function() {
var a=arguments, o=null, i, j, d;
for (i=0; i<a.length; i=i+1) {
d = ("" + a[i]).split(".");
o = this;
for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; j=j+1) {
o[d[j]] = o[d[j]] || {};
o = o[d[j]];
}
}
return o;
},
// this is replaced if the log module is included
log: function() {
},
/**
* Report an error. The reporting mechanism is controled by
* the 'throwFail' configuration attribute. If throwFail is
* not specified, the message is written to the Logger, otherwise
* a JS error is thrown
* @method error
* @param msg {string} the error message
* @param e {Error} Optional JS error that was caught. If supplied
* and throwFail is specified, this error will be re-thrown.
* @return {YUI} this YUI instance
*/
error: function(msg, e) {
if (this.config.throwFail) {
throw (e || new Error(msg));
} else {
this.message(msg, "error"); // don't scrub this one
}
return this;
},
/**
* Generate an id that is unique among all YUI instances
* @method guid
* @param pre {string} optional guid prefix
* @return {string} the guid
*/
guid: function(pre) {
var e = this.Env, p = (pre) || e._pre,
id = p + '-' +
this.version + '-' +
e._yidx + '-' +
(e._uidx++) + '-' +
_startTime;
return id.replace(/\./g, '_');
},
/**
* Returns a guid associated with an object. If the object
* does not have one, a new one is created unless readOnly
* is specified.
* @method stamp
* @param o The object to stamp
* @param readOnly {boolean} if true, a valid guid will only
* be returned if the object has one assigned to it.
* @return {string} The object's guid or null
*/
stamp: function(o, readOnly) {
if (!o) {
return o;
}
var uid = (typeof o === 'string') ? o : o._yuid;
if (!uid) {
uid = this.guid();
if (!readOnly) {
try {
o._yuid = uid;
} catch(e) {
uid = null;
}
}
}
return uid;
}
};
// Give the YUI global the same properties as an instance.
// This makes it so that the YUI global can be used like the YAHOO
// global was used prior to 3.x. More importantly, the YUI global
// provides global metadata, so env needs to be configured.
// @TODO review
Y = YUI;
p = Y.prototype;
// inheritance utilities are not available yet
for (i in p) {
if (true) {
Y[i] = p[i];
}
}
// set up the environment
Y._init();
})();
YUI.add('yui-base', function(Y) {
/**
* YUI stub
* @module yui
* @submodule yui-base
*/
(function() {
var instance = Y;
/**
* If the 'debug' config is true, a 'yui:log' event will be
* dispatched, which the Logger widget and anything else
* can consume. If the 'useBrowserConsole' config is true, it will
* write to the browser console if available. YUI-specific log
* messages will only be present in the -debug versions of the
* JS files.
*
* @method log
* @for YUI
* @param {String} msg The message to log.
* @param {String} cat The log category for the message. Default
* categories are "info", "warn", "error", time".
* Custom categories can be used as well. (opt)
* @param {String} src The source of the the message (opt)
* @param {boolean} silent If true, the log event won't fire
* @return {YUI} YUI instance
*/
instance.log = function(msg, cat, src, silent) {
var Y = instance, c = Y.config, bail = false, exc, inc, m, f;
// suppress log message if the config is off or the event stack
// or the event call stack contains a consumer of the yui:log event
if (c.debug) {
// apply source filters
if (src) {
exc = c.logExclude;
inc = c.logInclude;
// console.log('checking src filter: ' + src + ', inc: ' + inc + ', exc: ' + exc);
if (inc && !(src in inc)) {
// console.log('bail: inc list found, but src is not in list: ' + src);
bail = true;
} else if (exc && (src in exc)) {
// console.log('bail: exc list found, and src is in it: ' + src);
bail = true;
}
}
if (!bail) {
if (c.useBrowserConsole) {
m = (src) ? src + ': ' + msg : msg;
if (typeof console != 'undefined') {
f = (cat && console[cat]) ? cat : 'log';
console[f](m);
} else if (typeof opera != 'undefined') {
opera.postError(m);
}
}
if (Y.fire && !bail && !silent) {
Y.fire('yui:log', msg, cat, src);
}
}
}
return Y;
};
/**
* Write a system message. This message will be preserved in the
* minified and raw versions of the YUI files.
* @method log
* @for YUI
* @param {String} msg The message to log.
* @param {String} cat The log category for the message. Default
* categories are "info", "warn", "error", time".
* Custom categories can be used as well. (opt)
* @param {String} src The source of the the message (opt)
* @param {boolean} silent If true, the log event won't fire
* @return {YUI} YUI instance
*/
instance.message = function() {
return instance.log.apply(instance, arguments);
};
})();
(function() {
/**
* Provides the language utilites and extensions used by the library
* @class Lang
* @static
*/
Y.Lang = Y.Lang || {};
var L = Y.Lang,
ARRAY = 'array',
BOOLEAN = 'boolean',
DATE = 'date',
ERROR = 'error',
FUNCTION = 'function',
NUMBER = 'number',
OBJECT = 'object',
REGEX = 'regexp',
STRING = 'string',
TOSTRING = Object.prototype.toString,
UNDEFINED = 'undefined',
TYPES = {
'undefined' : UNDEFINED,
'number' : NUMBER,
'boolean' : BOOLEAN,
'string' : STRING,
'[object Function]' : FUNCTION,
'[object RegExp]' : REGEX,
'[object Array]' : ARRAY,
'[object Date]' : DATE,
'[object Error]' : ERROR
};
/**
* Determines whether or not the provided item is an array.
* Returns false for array-like collections such as the
* function arguments collection or HTMLElement collection
* will return false. You can use @see Array.test if you
* want to
* @method isArray
* @static
* @param o The object to test
* @return {boolean} true if o is an array
*/
L.isArray = function(o) {
return L.type(o) === ARRAY;
};
/**
* Determines whether or not the provided item is a boolean
* @method isBoolean
* @static
* @param o The object to test
* @return {boolean} true if o is a boolean
*/
L.isBoolean = function(o) {
return typeof o === BOOLEAN;
};
/**
* Determines whether or not the provided item is a function
* Note: Internet Explorer thinks certain functions are objects:
*
* var obj = document.createElement("object");
* Y.Lang.isFunction(obj.getAttribute) // reports false in IE
*
* var input = document.createElement("input"); // append to body
* Y.Lang.isFunction(input.focus) // reports false in IE
*
* You will have to implement additional tests if these functions
* matter to you.
*
* @method isFunction
* @static
* @param o The object to test
* @return {boolean} true if o is a function
*/
L.isFunction = function(o) {
return L.type(o) === FUNCTION;
};
/**
* Determines whether or not the supplied item is a date instance
* @method isDate
* @static
* @param o The object to test
* @return {boolean} true if o is a date
*/
L.isDate = function(o) {
return o instanceof Date;
};
/**
* Determines whether or not the provided item is null
* @method isNull
* @static
* @param o The object to test
* @return {boolean} true if o is null
*/
L.isNull = function(o) {
return o === null;
};
/**
* Determines whether or not the provided item is a legal number
* @method isNumber
* @static
* @param o The object to test
* @return {boolean} true if o is a number
*/
L.isNumber = function(o) {
return typeof o === NUMBER && isFinite(o);
};
/**
* Determines whether or not the provided item is of type object
* or function
* @method isObject
* @static
* @param o The object to test
* @param failfn {boolean} fail if the input is a function
* @return {boolean} true if o is an object
*/
L.isObject = function(o, failfn) {
return (o && (typeof o === OBJECT || (!failfn && L.isFunction(o)))) || false;
};
/**
* Determines whether or not the provided item is a string
* @method isString
* @static
* @param o The object to test
* @return {boolean} true if o is a string
*/
L.isString = function(o) {
return typeof o === STRING;
};
/**
* Determines whether or not the provided item is undefined
* @method isUndefined
* @static
* @param o The object to test
* @return {boolean} true if o is undefined
*/
L.isUndefined = function(o) {
return typeof o === UNDEFINED;
};
/**
* Returns a string without any leading or trailing whitespace. If
* the input is not a string, the input will be returned untouched.
* @method trim
* @static
* @param s {string} the string to trim
* @return {string} the trimmed string
*/
L.trim = function(s){
try {
return s.replace(/^\s+|\s+$/g, "");
} catch(e) {
return s;
}
};
/**
* A convenience method for detecting a legitimate non-null value.
* Returns false for null/undefined/NaN, true for other values,
* including 0/false/''
* @method isValue
* @static
* @param o The item to test
* @return {boolean} true if it is not null/undefined/NaN || false
*/
L.isValue = function(o) {
var t = L.type(o);
return (t && t !== UNDEFINED) || false;
};
/**
* Returns a string representing the type of the item passed in.
* @method type
* @param o the item to test
* @return {string} the detected type
*/
L.type = function (o) {
return TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? 'object' : 'null');
};
})();
(function() {
/**
* YUI core
* @module yui
*/
var L = Y.Lang, Native = Array.prototype,
/**
* Adds the following array utilities to the YUI instance
* @class YUI~array
*/
/**
* Y.Array(o) returns an array:
* - Arrays are return unmodified unless the start position is specified.
* - "Array-like" collections (@see Array.test) are converted to arrays
* - For everything else, a new array is created with the input as the sole item
* - The start position is used if the input is or is like an array to return
* a subset of the collection.
*
* @TODO this will not automatically convert elements that are also collections
* such as forms and selects. Passing true as the third param will
* force a conversion.
*
* @method Array
* @static
* @param o the item to arrayify
* @param i {int} if an array or array-like, this is the start index
* @param al {boolean} if true, it forces the array-like fork. This
* can be used to avoid multiple array.test calls.
* @return {Array} the resulting array
*/
A = function(o, startIdx, al) {
var t = (al) ? 2 : Y.Array.test(o), i, l, a;
// switch (t) {
// case 1:
// // return (startIdx) ? o.slice(startIdx) : o;
// case 2:
// return Native.slice.call(o, startIdx || 0);
// default:
// return [o];
// }
if (t) {
try {
return Native.slice.call(o, startIdx || 0);
// IE errors when trying to slice element collections
} catch(e) {
a=[];
for (i=0, l=o.length; i<l; i=i+1) {
a.push(o[i]);
}
return a;
}
} else {
return [o];
}
};
Y.Array = A;
/**
* Evaluates the input to determine if it is an array, array-like, or
* something else. This is used to handle the arguments collection
* available within functions, and HTMLElement collections
*
* @method Array.test
* @static
*
* @todo current implementation (intenionally) will not implicitly
* handle html elements that are array-like (forms, selects, etc).
*
* @return {int} a number indicating the results:
* 0: Not an array or an array-like collection
* 1: A real array.
* 2: array-like collection.
*/
A.test = function(o) {
var r = 0;
if (L.isObject(o)) {
if (L.isArray(o)) {
r = 1;
} else {
try {
// indexed, but no tagName (element) or alert (window)
if ("length" in o && !("tagName" in o) && !("alert" in o) &&
(!Y.Lang.isFunction(o.size) || o.size() > 1)) {
r = 2;
}
} catch(e) {}
}
}
return r;
};
/**
* Executes the supplied function on each item in the array.
* @method Array.each
* @param a {Array} the array to iterate
* @param f {Function} the function to execute on each item
* @param o Optional context object
* @static
* @return {YUI} the YUI instance
*/
A.each = (Native.forEach) ?
function (a, f, o) {
Native.forEach.call(a, f, o || Y);
return Y;
} :
function (a, f, o) {
var l = a.length, i;
for (i = 0; i < l; i=i+1) {
f.call(o || Y, a[i], i, a);
}
return Y;
};
/**
* Returns an object using the first array as keys, and
* the second as values. If the second array is not
* provided the value is set to true for each.
* @method Array.hash
* @static
* @param k {Array} keyset
* @param v {Array} optional valueset
* @return {object} the hash
*/
A.hash = function(k, v) {
var o = {}, l = k.length, vl = v && v.length, i;
for (i=0; i<l; i=i+1) {
o[k[i]] = (vl && vl > i) ? v[i] : true;
}
return o;
};
/**
* Returns the index of the first item in the array
* that contains the specified value, -1 if the
* value isn't found.
* @method Array.indexOf
* @static
* @param a {Array} the array to search
* @param val the value to search for
* @return {int} the index of the item that contains the value or -1
*/
A.indexOf = (Native.indexOf) ?
function(a, val) {
return a.indexOf(val);
} :
function(a, val) {
for (var i=0; i<a.length; i=i+1) {
if (a[i] === val) {
return i;
}
}
return -1;
};
/**
* Numeric sort convenience function.
* Y.ArrayAssert.itemsAreEqual([1, 2, 3], [3, 1, 2].sort(Y.Array.numericSort));
* @method numericSort
*/
A.numericSort = function(a, b) {
return (a - b);
};
})();
(function() {
var L = Y.Lang,
A = Y.Array,
OP = Object.prototype,
IEF = ["toString", "valueOf"],
PROTO = 'prototype',
/**
* IE will not enumerate native functions in a derived object even if the
* function was overridden. This is a workaround for specific functions
* we care about on the Object prototype.
* @property _iefix
* @param {Function} r the object to receive the augmentation
* @param {Function} s the object that supplies the properties to augment
* @param w a whitelist object (the keys are the valid items to reference)
* @private
* @for YUI
*/
_iefix = (Y.UA && Y.UA.ie) ?
function(r, s, w) {
var i, a = IEF, n, f;
for (i=0; i<a.length; i=i+1) {
n = a[i];
f = s[n];
if (L.isFunction(f) && f != OP[n]) {
if (!w || (n in w)) {
r[n]=f;
}
}
}
} : function() {};
/**
* Returns a new object containing all of the properties of
* all the supplied objects. The properties from later objects
* will overwrite those in earlier objects. Passing in a
* single object will create a shallow copy of it. For a deep
* copy, use clone.
* @method merge
* @param arguments {Object*} the objects to merge
* @return {object} the new merged object
*/
Y.merge = function() {
var a = arguments, o = {}, i, l = a.length;
for (i=0; i<l; i=i+1) {
Y.mix(o, a[i], true);
}
return o;
};
/**
* Applies the supplier's properties to the receiver. By default
* all prototype and static propertes on the supplier are applied
* to the corresponding spot on the receiver. By default all
* properties are applied, and a property that is already on the
* reciever will not be overwritten. The default behavior can
* be modified by supplying the appropriate parameters.
*
* @TODO add constants for the modes
*
* @method mix
* @param {Function} r the object to receive the augmentation
* @param {Function} s the object that supplies the properties to augment
* @param ov {boolean} if true, properties already on the receiver
* will be overwritten if found on the supplier.
* @param wl {string[]} a whitelist. If supplied, only properties in
* this list will be applied to the receiver.
* @param {int} mode what should be copies, and to where
* default(0): object to object
* 1: prototype to prototype (old augment)
* 2: prototype to prototype and object props (new augment)
* 3: prototype to object
* 4: object to prototype
* @param merge {boolean} merge objects instead of overwriting/ignoring
* Used by Y.aggregate
* @return {object} the augmented object
* @TODO review for PR2
*/
Y.mix = function(r, s, ov, wl, mode, merge) {
if (!s||!r) {
return Y;
}
var w = (wl && wl.length) ? A.hash(wl) : null, m = merge,
f = function(fr, fs, proto, iwl) {
var arr = m && L.isArray(fr), i;
for (i in fs) {
if (fs.hasOwnProperty(i)) {
// We never want to overwrite the prototype
// if (PROTO === i) {
if (PROTO === i || '_yuid' === i) {
continue;
}
// @TODO deal with the hasownprop issue
// check white list if it was supplied
if (!w || iwl || (i in w)) {
// if the receiver has this property, it is an object,
// and merge is specified, merge the two objects.
if (m && L.isObject(fr[i], true)) {
// console.log('aggregate RECURSE: ' + i);
// @TODO recursive or no?
// Y.mix(fr[i], fs[i]); // not recursive
f(fr[i], fs[i], proto, true); // recursive
// otherwise apply the property only if overwrite
// is specified or the receiver doesn't have one.
// @TODO make sure the 'arr' check isn't desructive
} else if (!arr && (ov || !(i in fr))) {
// console.log('hash: ' + i);
fr[i] = fs[i];
// if merge is specified and the receiver is an array,
// append the array item
} else if (arr) {
// console.log('array: ' + i);
// @TODO probably will need to remove dups
fr.push(fs[i]);
}
}
}
}
_iefix(fr, fs, w);
},
rp = r.prototype,
sp = s.prototype;
switch (mode) {
case 1: // proto to proto
f(rp, sp, true);
break;
case 2: // object to object and proto to proto
f(r, s);
f(rp, sp, true);
break;
case 3: // proto to static
f(r, sp, true);
break;
case 4: // static to proto
f(rp, s);
break;
default: // object to object
f(r, s);
}
return r;
};
})();
(function() {
/**
* Adds the following Object utilities to the YUI instance
* @class YUI~object
*/
/**
* Y.Object(o) returns a new object based upon the supplied object.
* @TODO Use native Object.create() when available
* @method Object
* @static
* @param o the supplier object
* @return {object} the new object
*/
Y.Object = function(o) {
var F = function() {};
F.prototype = o;
return new F();
};
var O = Y.Object,
/**
* Extracts the keys, values, or size from an object
*
* @method _extract
* @param o the object
* @param what what to extract (0: keys, 1: values, 2: size)
* @return {boolean|Array} the extracted info
* @private
*/
_extract = function(o, what) {
var count = (what === 2), out = (count) ? 0 : [], i;
for (i in o) {
if (count) {
out++;
} else {
if (o.hasOwnProperty(i)) {
out.push((what) ? o[i] : i);
}
}
}
return out;
};
/**
* Returns an array containing the object's keys
* @TODO use native Object.keys() if available
* @method Object.keys
* @static
* @param o an object
* @return {string[]} the keys
*/
O.keys = function(o) {
return _extract(o);
};
/**
* Returns an array containing the object's values
* @TODO use native Object.values() if available
* @method Object.values
* @static
* @param o an object
* @return {Array} the values
*/
O.values = function(o) {
return _extract(o, 1);
};
/**
* Returns the size of an object
* @TODO use native Object.size() if available
* @method Object.size
* @static
* @param o an object
* @return {int} the size
*/
O.size = function(o) {
return _extract(o, 2);
};
/**
* Returns true if the object contains a given key
* @method Object.hasKey
* @static
* @param o an object
* @param k the key to query
* @return {boolean} true if the object contains the key
*/
O.hasKey = function(o, k) {
// return (o.hasOwnProperty(k));
return (k in o);
};
/**
* Returns true if the object contains a given value
* @method Object.hasValue
* @static
* @param o an object
* @param v the value to query
* @return {boolean} true if the object contains the value
*/
O.hasValue = function(o, v) {
return (Y.Array.indexOf(O.values(o), v) > -1);
};
/**
* Determines whether or not the property was added
* to the object instance. Returns false if the property is not present
* in the object, or was inherited from the prototype.
*
* @deprecated Safari 1.x support has been removed, so this is simply a
* wrapper for the native implementation. Use the native implementation
* directly instead.
*
* @TODO Remove in B1
*
* @method Object.owns
* @static
* @param o {any} The object being testing
* @param p {string} the property to look for
* @return {boolean} true if the object has the property on the instance
*/
O.owns = O.hasKey;
/**
* Executes a function on each item. The function
* receives the value, the key, and the object
* as paramters (in that order).
* @method Object.each
* @static
* @param o the object to iterate
* @param f {function} the function to execute
* @param c the execution context
* @param proto {boolean} include proto
* @return {YUI} the YUI instance
*/
O.each = function (o, f, c, proto) {
var s = c || Y, i;
for (i in o) {
if (proto || o.hasOwnProperty(i)) {
f.call(s, o[i], i, o);
}
}
return Y;
};
/**
* Retrieves the sub value at the provided path,
* from the value object provided.
*
* @method getValue
* @param o The object from which to extract the property value
* @param path {Array} A path array, specifying the object traversal path
* from which to obtain the sub value.
* @return {Any} The value stored in the path, undefined if not found.
* Returns the source object if an empty path is provided.
*/
O.getValue = function (o, path) {
var p=Y.Array(path), l=p.length, i;
for (i=0; o !== undefined && i < l; i=i+1) {
o = o[p[i]];
}
return o;
};
/**
* Sets the sub-attribute value at the provided path on the
* value object. Returns the modified value object, or
* undefined if the path is invalid.
*
* @method setValue
* @param o The object on which to set the sub value.
* @param path {Array} A path array, specifying the object traversal path
* at which to set the sub value.
* @param val {Any} The new value for the sub-attribute.
* @return {Object} The modified object, with the new sub value set, or
* undefined, if the path was invalid.
*/
O.setValue = function(o, path, val) {
var p=Y.Array(path), leafIdx=p.length-1, i, ref=o;
if (leafIdx >= 0) {
for (i=0; ref !== undefined && i < leafIdx; i=i+1) {
ref = ref[p[i]];
}
if (ref !== undefined) {
ref[p[i]] = val;
} else {
return undefined;
}
}
return o;
};
})();
/**
* YUI user agent detection.
* Do not fork for a browser if it can be avoided. Use feature detection when
* you can. Use the user agent as a last resort. UA stores a version
* number for the browser engine, 0 otherwise. This value may or may not map
* to the version number of the browser using the engine. The value is
* presented as a float so that it can easily be used for boolean evaluation
* as well as for looking for a particular range of versions. Because of this,
* some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9
* reports 1.8).
* @class UA
* @static
*/
Y.UA = function() {
var o={
/**
* Internet Explorer version number or 0. Example: 6
* @property ie
* @type float
* @static
*/
ie:0,
/**
* Opera version number or 0. Example: 9.2
* @property opera
* @type float
* @static
*/
opera:0,
/**
* Gecko engine revision number. Will evaluate to 1 if Gecko
* is detected but the revision could not be found. Other browsers
* will be 0. Example: 1.8
* <pre>
* Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7
* Firefox 1.5.0.9: 1.8.0.9 <-- Reports 1.8
* Firefox 2.0.0.3: 1.8.1.3 <-- Reports 1.8
* Firefox 3 alpha: 1.9a4 <-- Reports 1.9
* </pre>
* @property gecko
* @type float
* @static
*/
gecko:0,
/**
* AppleWebKit version. KHTML browsers that are not WebKit browsers
* will evaluate to 1, other browsers 0. Example: 418.9
* <pre>
* Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
* latest available for Mac OSX 10.3.
* Safari 2.0.2: 416 <-- hasOwnProperty introduced
* Safari 2.0.4: 418 <-- preventDefault fixed
* Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
* different versions of webkit
* Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been
* updated, but not updated
* to the latest patch.
* Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native SVG
* and many major issues fixed).
* Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic update
* from 2.x via the 10.4.11 OS patch
*
* </pre>
* http://en.wikipedia.org/wiki/Safari_(web_browser)#Version_history
* @property webkit
* @type float
* @static
*/
webkit:0,
/**
* The mobile property will be set to a string containing any relevant
* user agent information when a modern mobile browser is detected.
* Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
* devices with the WebKit-based browser, and Opera Mini.
* @property mobile
* @type string
* @static
*/
mobile: null
},
ua = navigator.userAgent, m;
// Modern KHTML browsers should qualify as Safari X-Grade
if ((/KHTML/).test(ua)) {
o.webkit=1;
}
// Modern WebKit browsers are at least X-Grade
m=ua.match(/AppleWebKit\/([^\s]*)/);
if (m&&m[1]) {
o.webkit=parseFloat(m[1]);
// Mobile browser check
if (/ Mobile\//.test(ua)) {
o.mobile = "Apple"; // iPhone or iPod Touch
} else {
m=ua.match(/NokiaN[^\/]*/);
if (m) {
o.mobile = m[0]; // Nokia N-series, ex: NokiaN95
}
}
}
if (!o.webkit) { // not webkit
// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
m=ua.match(/Opera[\s\/]([^\s]*)/);
if (m&&m[1]) {
o.opera=parseFloat(m[1]);
m=ua.match(/Opera Mini[^;]*/);
if (m) {
o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
}
} else { // not opera or webkit
m=ua.match(/MSIE\s([^;]*)/);
if (m&&m[1]) {
o.ie=parseFloat(m[1]);
} else { // not opera, webkit, or ie
m=ua.match(/Gecko\/([^\s]*)/);
if (m) {
o.gecko=1; // Gecko detected, look for revision
m=ua.match(/rv:([^\s\)]*)/);
if (m&&m[1]) {
o.gecko=parseFloat(m[1]);
}
}
}
}
}
return o;
}();
(function() {
var L = Y.Lang,
/**
* Executes the supplied function in the context of the supplied
* object 'when' milliseconds later. Executes the function a
* single time unless periodic is set to true.
* @method later
* @for YUI
* @param when {int} the number of milliseconds to wait until the fn
* is executed.
* @param o the context object.
* @param fn {Function|String} the function to execute or the name of
* the method in the 'o' object to execute.
* @param data [Array] data that is provided to the function. This accepts
* either a single item or an array. If an array is provided, the
* function is executed with one parameter for each array item. If
* you need to pass a single array parameter, it needs to be wrapped in
* an array [myarray].
* @param periodic {boolean} if true, executes continuously at supplied
* interval until canceled.
* @return {object} a timer object. Call the cancel() method on this object to
* stop the timer.
*/
later = function(when, o, fn, data, periodic) {
when = when || 0;
o = o || {};
var m=fn, d=data, f, r;
if (L.isString(fn)) {
m = o[fn];
}
if (!m) {
Y.error("method undefined");
}
if (!L.isArray(d)) {
d = [data];
}
f = function() {
m.apply(o, d);
};
r = (periodic) ? setInterval(f, when) : setTimeout(f, when);
return {
interval: periodic,
cancel: function() {
if (this.interval) {
clearInterval(r);
} else {
clearTimeout(r);
}
}
};
};
Y.later = later;
L.later = later;
})();
(function() {
// var min = ['yui-base', 'log', 'lang', 'array', 'core'], core, C = Y.config;
var min = ['yui-base'], core, C = Y.config;
// apply the minimal required functionality
Y.use.apply(Y, min);
if (C.core) {
core = C.core;
} else {
// core = ["object", "ua", "later"];
// core.push("get", "loader");
core = ["get", "loader"];
}
Y.use.apply(Y, core);
})();
}, '@VERSION@' );
YUI.add('get', function(Y) {
(function() {
/**
* Provides a mechanism to fetch remote resources and
* insert them into a document.
* @module yui
* @submodule get
*/
var ua=Y.UA,
L=Y.Lang,
PREFIX = Y.guid('yui_');
/**
* Fetches and inserts one or more script or link nodes into the document
* @class Get
* @static
*/
Y.Get = function() {
/**
* hash of queues to manage multiple requests
* @property queues
* @private
*/
var queues={},
/**
* queue index used to generate transaction ids
* @property qidx
* @type int
* @private
*/
qidx=0,
/**
* node index used to generate unique node ids
* @property nidx
* @type int
* @private
*/
nidx=0,
/**
* interal property used to prevent multiple simultaneous purge
* processes
* @property purging
* @type boolean
* @private
*/
purging=false,
/**
* Generates an HTML element, this is not appended to a document
* @method _node
* @param type {string} the type of element
* @param attr {string} the attributes
* @param win {Window} optional window to create the element in
* @return {HTMLElement} the generated node
* @private
*/
_node = function(type, attr, win) {
var w = win || Y.config.win, d=w.document, n=d.createElement(type),
i;
for (i in attr) {
if (attr[i] && attr.hasOwnProperty(i)) {
n.setAttribute(i, attr[i]);
}
}
return n;
},
/**
* Generates a link node
* @method _linkNode
* @param url {string} the url for the css file
* @param win {Window} optional window to create the node in
* @return {HTMLElement} the generated node
* @private
*/
_linkNode = function(url, win, charset) {
var c = charset || "utf-8";
return _node("link", {
"id": PREFIX + (nidx++),
"type": "text/css",
"charset": c,
"rel": "stylesheet",
"href": url
}, win);
},
/**
* Generates a script node
* @method _scriptNode
* @param url {string} the url for the script file
* @param win {Window} optional window to create the node in
* @return {HTMLElement} the generated node
* @private
*/
_scriptNode = function(url, win, charset) {
var c = charset || "utf-8";
return _node("script", {
"id": PREFIX + (nidx++),
"type": "text/javascript",
"charset": c,
"src": url
}, win);
},
/**
* Removes the nodes for the specified queue
* @method _purge
* @private
*/
_purge = function(tId) {
var q=queues[tId], n, l, d, h, s, i;
if (q) {
n = q.nodes;
l = n.length;
d = q.win.document;
h = d.getElementsByTagName("head")[0];
if (q.insertBefore) {
s = _get(q.insertBefore, tId);
if (s) {
h = s.parentNode;
}
}
for (i=0; i<l; i=i+1) {
h.removeChild(n[i]);
}
}
q.nodes = [];
},
/**
* Returns the data payload for callback functions
* @method _returnData
* @private
*/
_returnData = function(q, msg) {
return {
tId: q.tId,
win: q.win,
data: q.data,
nodes: q.nodes,
msg: msg,
purge: function() {
_purge(this.tId);
}
};
},
/*
* The request failed, execute fail handler with whatever
* was accomplished. There isn't a failure case at the
* moment unless you count aborted transactions
* @method _fail
* @param id {string} the id of the request
* @private
*/
_fail = function(id, msg) {
var q = queues[id], sc;
if (q.timer) {
q.timer.cancel();
}
// execute failure callback
if (q.onFailure) {
sc = q.context || q;
q.onFailure.call(sc, _returnData(q, msg));
}
},
_get = function(nId, tId) {
var q = queues[tId],
n = (L.isString(nId)) ? q.win.document.getElementById(nId) : nId;
if (!n) {
_fail(tId, "target node not found: " + nId);
}
return n;
},
/**
* The request is complete, so executing the requester's callback
* @method _finish
* @param id {string} the id of the request
* @private
*/
_finish = function(id) {
var q = queues[id], msg, sc;
if (q.timer) {
q.timer.cancel();
}
q.finished = true;
if (q.aborted) {
msg = "transaction " + id + " was aborted";
_fail(id, msg);
return;
}
// execute success callback
if (q.onSuccess) {
sc = q.context || q;
q.onSuccess.call(sc, _returnData(q));
}
},
/**
* Timeout detected
* @method _timeout
* @param id {string} the id of the request
* @private
*/
_timeout = function(id) {
var q = queues[id], sc;
if (q.onTimeout) {
sc = q.context || q;
q.onTimeout.call(sc, _returnData(q));
}
},
/**
* Loads the next item for a given request
* @method _next
* @param id {string} the id of the request
* @param loaded {string} the url that was just loaded, if any
* @private
*/
_next = function(id, loaded) {
var q = queues[id], msg, w, d, h, n, url, s;
if (q.timer) {
q.timer.cancel();
}
if (q.aborted) {
msg = "transaction " + id + " was aborted";
_fail(id, msg);
return;
}
if (loaded) {
q.url.shift();
if (q.varName) {
q.varName.shift();
}
} else {
// This is the first pass: make sure the url is an array
q.url = (L.isString(q.url)) ? [q.url] : q.url;
if (q.varName) {
q.varName = (L.isString(q.varName)) ? [q.varName] : q.varName;
}
}
w = q.win;
d = w.document;
h = d.getElementsByTagName("head")[0];
if (q.url.length === 0) {
_finish(id);
return;
}
url = q.url[0];
// if the url is undefined, this is probably a trailing comma problem in IE
if (!url) {
q.url.shift();
return _next(id);
}
if (q.timeout) {
q.timer = L.later(q.timeout, q, _timeout, id);
}
if (q.type === "script") {
n = _scriptNode(url, w, q.charset);
} else {
n = _linkNode(url, w, q.charset);
}
// track this node's load progress
_track(q.type, n, id, url, w, q.url.length);
// add the node to the queue so we can return it to the user supplied callback
q.nodes.push(n);
// add it to the head or insert it before 'insertBefore'
if (q.insertBefore) {
s = _get(q.insertBefore, id);
if (s) {
s.parentNode.insertBefore(n, s);
}
} else {
h.appendChild(n);
}
// FireFox does not support the onload event for link nodes, so there is
// no way to make the css requests synchronous. This means that the css
// rules in multiple files could be applied out of order in this browser
// if a later request returns before an earlier one. Safari too.
if ((ua.webkit || ua.gecko) && q.type === "css") {
_next(id, url);
}
},
/**
* Removes processed queues and corresponding nodes
* @method _autoPurge
* @private
*/
_autoPurge = function() {
if (purging) {
return;
}
purging = true;
var i, q;
for (i in queues) {
if (queues.hasOwnProperty(i)) {
q = queues[i];
if (q.autopurge && q.finished) {
_purge(q.tId);
delete queues[i];
}
}
}
purging = false;
},
/**
* Saves the state for the request and begins loading
* the requested urls
* @method queue
* @param type {string} the type of node to insert
* @param url {string} the url to load
* @param opts the hash of options for this request
* @private
*/
_queue = function(type, url, opts) {
opts = opts || {};
var id = "q" + (qidx++), q,
thresh = opts.purgethreshold || Y.Get.PURGE_THRESH;
if (qidx % thresh === 0) {
_autoPurge();
}
queues[id] = Y.merge(opts, {
tId: id,
type: type,
url: url,
finished: false,
nodes: []
});
q = queues[id];
q.win = q.win || Y.config.win;
q.context = q.context || q;
q.autopurge = ("autopurge" in q) ? q.autopurge :
(type === "script") ? true : false;
L.later(0, q, _next, id);
return {
tId: id
};
},
/**
* Detects when a node has been loaded. In the case of
* script nodes, this does not guarantee that contained
* script is ready to use.
* @method _track
* @param type {string} the type of node to track
* @param n {HTMLElement} the node to track
* @param id {string} the id of the request
* @param url {string} the url that is being loaded
* @param win {Window} the targeted window
* @param qlength the number of remaining items in the queue,
* including this one
* @param trackfn {Function} function to execute when finished
* the default is _next
* @private
*/
_track = function(type, n, id, url, win, qlength, trackfn) {
var f = trackfn || _next;
// IE supports the readystatechange event for script and css nodes
// Opera only for script nodes. Opera support onload for script
// nodes, but this doesn't fire when there is a load failure.
// The onreadystatechange appears to be a better way to respond
// to both success and failure.
if (ua.ie) {
n.onreadystatechange = function() {
var rs = this.readyState;
if ("loaded" === rs || "complete" === rs) {
n.onreadystatechange = null;
f(id, url);
}
};
// webkit prior to 3.x is no longer supported
} else if (ua.webkit) {
if (type === "script") {
// Safari 3.x supports the load event for script nodes (DOM2)
n.addEventListener("load", function() {
f(id, url);
});
}
// FireFox and Opera support onload (but not DOM2 in FF) handlers for
// script nodes. Opera, but not FF, supports the onload event for link
// nodes.
} else {
n.onload = function() {
f(id, url);
};
n.onerror = function(e) {
_fail(id, e + ": " + url);
};
}
};
return {
/**
* The number of request required before an automatic purge.
* property PURGE_THRESH
* @static
* @type int
* @default 20
*/
PURGE_THRESH: 20,
/**
* Called by the the helper for detecting script load in Safari
* @method _finalize
* @static
* @param id {string} the transaction id
* @private
*/
_finalize: function(id) {
L.later(0, null, _finish, id);
},
/**
* Abort a transaction
* @method abort
* @static
* @param o {string|object} Either the tId or the object returned from
* script() or css()
*/
abort: function(o) {
var id = (L.isString(o)) ? o : o.tId,
q = queues[id];
if (q) {
q.aborted = true;
}
},
/**
* Fetches and inserts one or more script nodes into the head
* of the current document or the document in a specified window.
*
* @method script
* @static
* @param url {string|string[]} the url or urls to the script(s)
* @param opts {object} Options:
* <dl>
* <dt>onSuccess</dt>
* <dd>
* callback to execute when the script(s) are finished loading
* The callback receives an object back with the following
* data:
* <dl>
* <dt>win</dt>
* <dd>the window the script(s) were inserted into</dd>
* <dt>data</dt>
* <dd>the data object passed in when the request was made</dd>
* <dt>nodes</dt>
* <dd>An array containing references to the nodes that were
* inserted</dd>
* <dt>purge</dt>
* <dd>A function that, when executed, will remove the nodes
* that were inserted</dd>
* <dt>
* </dl>
* </dd>
* <dt>onTimeout</dt>
* <dd>
* callback to execute when a timeout occurs.
* The callback receives an object back with the following
* data:
* <dl>
* <dt>win</dt>
* <dd>the window the script(s) were inserted into</dd>
* <dt>data</dt>
* <dd>the data object passed in when the request was made</dd>
* <dt>nodes</dt>
* <dd>An array containing references to the nodes that were
* inserted</dd>
* <dt>purge</dt>
* <dd>A function that, when executed, will remove the nodes
* that were inserted</dd>
* <dt>
* </dl>
* </dd>
* <dt>onFailure</dt>
* <dd>
* callback to execute when the script load operation fails
* The callback receives an object back with the following
* data:
* <dl>
* <dt>win</dt>
* <dd>the window the script(s) were inserted into</dd>
* <dt>data</dt>
* <dd>the data object passed in when the request was made</dd>
* <dt>nodes</dt>
* <dd>An array containing references to the nodes that were
* inserted successfully</dd>
* <dt>purge</dt>
* <dd>A function that, when executed, will remove any nodes
* that were inserted</dd>
* <dt>
* </dl>
* </dd>
* <dt>context</dt>
* <dd>the execution context for the callbacks</dd>
* <dt>win</dt>
* <dd>a window other than the one the utility occupies</dd>
* <dt>autopurge</dt>
* <dd>
* setting to true will let the utilities cleanup routine purge
* the script once loaded
* </dd>
* <dt>purgethreshold</dt>
* <dd>
* The number of transaction before autopurge should be initiated
* </dd>
* <dt>data</dt>
* <dd>
* data that is supplied to the callback when the script(s) are
* loaded.
* </dd>
* <dt>insertBefore</dt>
* <dd>node or node id that will become the new node's nextSibling</dd>
* </dl>
* <dt>charset</dt>
* <dd>Node charset, default utf-8</dd>
* <dt>timeout</dt>
* <dd>Number of milliseconds to wait before aborting and firing the timeout event</dd>
* <pre>
* Y.Get.script(
* ["http://yui.yahooapis.com/2.5.2/build/yahoo/yahoo-min.js",
* "http://yui.yahooapis.com/2.5.2/build/event/event-min.js"], {
* onSuccess: function(o) {
* this.log("won't cause error because Y is the context");
* },
* onFailure: function(o) {
* },
* onTimeout: function(o) {
* },
* data: "foo",
* timeout: 10000, // 10 second timeout
* context: Y, // make the YUI instance
* // win: otherframe // target another window/frame
* autopurge: true // allow the utility to choose when to remove the nodes
* purgetheshold: 1 // purge previous transaction before next transaction
* });
* </pre>
* @return {tId: string} an object containing info about the transaction
*/
script: function(url, opts) {
return _queue("script", url, opts);
},
/**
* Fetches and inserts one or more css link nodes into the
* head of the current document or the document in a specified
* window.
* @method css
* @static
* @param url {string} the url or urls to the css file(s)
* @param opts Options:
* <dl>
* <dt>onSuccess</dt>
* <dd>
* callback to execute when the css file(s) are finished loading
* The callback receives an object back with the following
* data:
* <dl>win</dl>
* <dd>the window the link nodes(s) were inserted into</dd>
* <dt>data</dt>
* <dd>the data object passed in when the request was made</dd>
* <dt>nodes</dt>
* <dd>An array containing references to the nodes that were
* inserted</dd>
* <dt>purge</dt>
* <dd>A function that, when executed, will remove the nodes
* that were inserted</dd>
* <dt>
* </dl>
* </dd>
* <dt>context</dt>
* <dd>the execution context for the callbacks</dd>
* <dt>win</dt>
* <dd>a window other than the one the utility occupies</dd>
* <dt>data</dt>
* <dd>
* data that is supplied to the callbacks when the nodes(s) are
* loaded.
* </dd>
* <dt>insertBefore</dt>
* <dd>node or node id that will become the new node's nextSibling</dd>
* <dt>charset</dt>
* <dd>Node charset, default utf-8</dd>
* </dl>
* <pre>
* Y.Get.css("http://yui.yahooapis.com/2.3.1/build/menu/assets/skins/sam/menu.css");
* </pre>
* <pre>
* Y.Get.css(
* ["http://yui.yahooapis.com/2.3.1/build/menu/assets/skins/sam/menu.css",
* insertBefore: 'custom-styles' // nodes will be inserted before the specified node
* });
* </pre>
* @return {tId: string} an object containing info about the transaction
*/
css: function(url, opts) {
return _queue("css", url, opts);
}
};
}();
})();
}, '@VERSION@' );
YUI.add('loader', function(Y) {
(function() {
/**
* Loader dynamically loads script and css files. It includes the dependency
* info for the version of the library in use, and will automatically pull in
* dependencies for the modules requested. It supports rollup files and will
* automatically use these when appropriate in order to minimize the number of
* http connections required to load all of the dependencies. It can load the
* files from the Yahoo! CDN, and it can utilize the combo service provided on
* this network to reduce the number of http connections required to download
* YUI files.
*
* @module yui
* @submodule loader
*/
/**
* Loader dynamically loads script and css files. It includes the dependency
* info for the version of the library in use, and will automatically pull in
* dependencies for the modules requested. It supports rollup files and will
* automatically use these when appropriate in order to minimize the number of
* http connections required to load all of the dependencies. It can load the
* files from the Yahoo! CDN, and it can utilize the combo service provided on
* this network to reduce the number of http connections required to download
* YUI files.
* @class Loader
* @constructor
* @param o an optional set of configuration options. Valid options:
* <ul>
* <li>base:
* The base dir</li>
* <li>secureBase:
* The secure base dir (not implemented)</li>
* <li>comboBase:
* The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?</li>
* <li>root:
* The root path to prepend to module names for the combo service. Ex: 2.5.2/build/</li>
* <li>filter:
*
* A filter to apply to result urls. This filter will modify the default
* path for all modules. The default path for the YUI library is the
* minified version of the files (e.g., event-min.js). The filter property
* can be a predefined filter or a custom filter. The valid predefined
* filters are:
* <dl>
* <dt>DEBUG</dt>
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
* This option will automatically include the Logger widget</dd>
* <dt>RAW</dt>
* <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
* </dl>
* You can also define a custom filter, which must be an object literal
* containing a search expression and a replace string:
* <pre>
* myFilter: {
* 'searchExp': "-min\\.js",
* 'replaceStr': "-debug.js"
* }
* </pre>
*
* </li>
* <li>combine:
* Use the YUI combo service to reduce the number of http connections required to load your dependencies</li>
* <li>ignore:
* A list of modules that should never be dynamically loaded</li>
* <li>force:
* A list of modules that should always be loaded when required, even if already present on the page</li>
* <li>insertBefore:
* Node or id for a node that should be used as the insertion point for new nodes</li>
* <li>charset:
* charset for dynamic nodes</li>
* <li>timeout:
* number of milliseconds before a timeout occurs when dynamically loading nodes. in not set, there is no timeout</li>
* <li>context:
* execution context for all callbacks</li>
* <li>onSuccess:
* callback for the 'success' event</li>
* <li>onFailure:
* callback for the 'failure' event</li>
* <li>onTimeout:
* callback for the 'timeout' event</li>
* <li>onProgress:
* callback executed each time a script or css file is loaded</li>
* <li>modules:
* A list of module definitions. See Loader.addModule for the supported module metadata</li>
* </ul>
*/
// @TODO backed out the custom event changes so that the event system
// isn't required in the seed build. If needed, we may want to
// add them back if the event system is detected.
/*
* Executed when the loader successfully completes an insert operation
* This can be subscribed to normally, or a listener can be passed
* as an onSuccess config option.
* @event success
*/
/*
* Executed when the loader fails to complete an insert operation.
* This can be subscribed to normally, or a listener can be passed
* as an onFailure config option.
*
* @event failure
*/
/*
* Executed when a Get operation times out.
* This can be subscribed to normally, or a listener can be passed
* as an onTimeout config option.
*
* @event timeout
*/
// http://yui.yahooapis.com/combo?2.5.2/build/yahoo/yahoo-min.js&2.5.2/build/dom/dom-min.js&2.5.2/build/event/event-min.js&2.5.2/build/autocomplete/autocomplete-min.js"
var BASE = 'base',
CSS = 'css',
JS = 'js',
CSSRESET = 'cssreset',
CSSFONTS = 'cssfonts',
CSSGRIDS = 'cssgrids',
CSSBASE = 'cssbase',
CSS_AFTER = [CSSRESET, CSSFONTS, CSSGRIDS, 'cssreset-context', 'cssfonts-context', 'cssgrids-context'],
YUI_CSS = ['reset', 'fonts', 'grids', 'base'],
VERSION = '@VERSION@',
ROOT = VERSION + '/build/',
CONTEXT = '-context',
META = {
version: VERSION,
root: ROOT,
base: 'http://yui.yahooapis.com/' + ROOT,
comboBase: 'http://yui.yahooapis.com/combo?',
skin: {
defaultSkin: 'sam',
base: 'assets/skins/',
path: 'skin.css',
after: ['reset', 'fonts', 'grids', 'base']
//rollup: 3
},
modules: {
dom: {
requires: ['event'],
submodules: {
'dom-base': {
requires: ['event']
},
'dom-style': {
requires: ['dom-base']
},
'dom-screen': {
requires: ['dom-base', 'dom-style']
},
selector: {
requires: ['dom-base']
},
'selector-native': {
requires: ['dom-base']
}
},
plugins: {
'selector-css3': {
requires: ['selector']
}
}
},
node: {
requires: ['dom', 'base'],
submodules: {
'node-base': {
requires: ['dom-base', 'base', 'selector']
},
'node-style': {
requires: ['dom-style', 'node-base']
},
'node-screen': {
requires: ['dom-screen', 'node-base']
}
},
plugins: {
'node-event-simulate': {
requires: ['node-base', 'event-simulate']
}
}
},
anim: {
requires: [BASE, 'node'],
submodules: {
'anim-base': {
requires: ['base', 'node-style']
},
'anim-color': {
requires: ['anim-base']
},
'anim-curve': {
requires: ['anim-xy']
},
'anim-easing': {
},
'anim-scroll': {
requires: ['anim-base']
},
'anim-xy': {
requires: ['anim-base', 'node-screen']
},
'anim-node-plugin': {
requires: ['node', 'anim-base']
}
}
},
attribute: {
requires: ['event-custom']
},
base: {
requires: ['attribute']
},
compat: {
requires: ['node', 'dump', 'substitute']
},
classnamemanager: { },
collection: { },
console: {
requires: ['widget', 'substitute'],
skinnable: true
},
cookie: { },
// Note: CSS attributes are modified programmatically to reduce metadata size
// cssbase: {
// after: CSS_AFTER
// },
// cssgrids: {
// requires: [CSSFONTS],
// optional: [CSSRESET]
// },
dd:{
submodules: {
'dd-ddm-base': {
requires: ['node', BASE]
},
'dd-ddm':{
requires: ['dd-ddm-base']
},
'dd-ddm-drop':{
requires: ['dd-ddm']
},
'dd-drag':{
requires: ['dd-ddm-base']
},
'dd-drop':{
requires: ['dd-ddm-drop']
},
'dd-proxy':{
requires: ['dd-drag']
},
'dd-constrain':{
requires: ['dd-drag', 'dd-proxy']
},
'dd-plugin':{
requires: ['dd-drag'],
optional: ['dd-constrain', 'dd-proxy']
},
'dd-drop-plugin':{
requires: ['dd-drop']
}
}
},
dump: { },
event: {
requires: ['event-custom']
},
'event-custom': {
requires: ['oop']
},
'event-simulate': {
requires: ['event']
},
get: {
requires: ['yui-base']
},
history: {
requires: ['node']
},
io:{
submodules: {
'io-base': {
requires: ['node']
},
'io-xdr': {
requires: ['io-base']
},
'io-form': {
requires: ['io-base']
},
'io-upload-iframe': {
requires: ['io-base']
},
'io-queue': {
requires: ['io-base']
}
}
},
json: {
submodules: {
'json-parse': {
},
'json-stringify': {
}
}
},
loader: {
requires: ['get']
},
'node-menunav': {
requires: ['node', 'classnamemanager'],
skinnable: true
},
oop: {
requires: ['yui-base']
},
overlay: {
requires: ['widget', 'widget-position', 'widget-position-ext', 'widget-stack', 'widget-stdmod'],
skinnable: true
},
plugin: {
requires: ['base']
},
profiler: { },
queue: {
submodules: {
'queue-base': {}
},
plugins: {
'queue-io': {
requires: ['io-base']
}
},
requires: ['event-custom']
},
slider: {
requires: ['widget', 'dd-constrain'],
skinnable: true
},
stylesheet: { },
substitute: {
optional: ['dump']
},
widget: {
requires: ['base', 'node', 'classnamemanager'],
plugins: {
'widget-position': { },
'widget-position-ext': {
requires: ['widget-position']
},
'widget-stack': {
skinnable: true
},
'widget-stdmod': { }
},
skinnable: true
},
// Since YUI is required for everything else, it should not be specified as
// a dependency.
yui: {
supersedes: ['yui-base', 'get', 'loader']
},
'yui-base': { },
test: {
requires: ['collection', 'substitute', 'node', 'json']
}
}
},
_path = function(dir, file, type) {
return dir + '/' + file + '-min.' + (type || CSS);
},
mods = META.modules, i, bname, mname, contextname,
L = Y.Lang,
PROV = "_provides",
SUPER = "_supersedes";
// Create the metadata for both the regular and context-aware
// versions of the YUI CSS foundation.
for (i=0; i<YUI_CSS.length; i=i+1) {
bname = YUI_CSS[i];
mname = CSS + bname;
mods[mname] = {
type: CSS,
path: _path(mname, bname)
};
// define -context module
contextname = mname + CONTEXT;
bname = bname + CONTEXT;
mods[contextname] = {
type: CSS,
path: _path(mname, bname)
};
if (mname == CSSGRIDS) {
mods[mname].requires = [CSSFONTS];
mods[mname].optional = [CSSRESET];
mods[contextname].requires = [CSSFONTS + CONTEXT];
mods[contextname].optional = [CSSRESET + CONTEXT];
} else if (mname == CSSBASE) {
mods[mname].after = CSS_AFTER;
mods[contextname].after = CSS_AFTER;
}
}
Y.Env.meta = META;
Y.Loader = function(o) {
/**
* Internal callback to handle multiple internal insert() calls
* so that css is inserted prior to js
* @property _internalCallback
* @private
*/
this._internalCallback = null;
/**
* Use the YUI environment listener to detect script load. This
* is only switched on for Safari 2.x and below.
* @property _useYahooListener
* @private
*/
this._useYahooListener = false;
/**
* Callback that will be executed when the loader is finished
* with an insert
* @method onSuccess
* @type function
*/
this.onSuccess = null;
/**
* Callback that will be executed if there is a failure
* @method onFailure
* @type function
*/
this.onFailure = null;
/**
* Callback executed each time a script or css file is loaded
* @method onProgress
* @type function
*/
this.onProgress = null;
/**
* Callback that will be executed if a timeout occurs
* @method onTimeout
* @type function
*/
this.onTimeout = null;
/**
* The execution context for all callbacks
* @property context
* @default {YUI} the YUI instance
*/
this.context = Y;
/**
* Data that is passed to all callbacks
* @property data
*/
this.data = null;
/**
* Node reference or id where new nodes should be inserted before
* @property insertBefore
* @type string|HTMLElement
*/
this.insertBefore = null;
/**
* The charset attribute for inserted nodes
* @property charset
* @type string
* @default utf-8
*/
this.charset = null;
/**
* The base directory.
* @property base
* @type string
* @default http://yui.yahooapis.com/[YUI VERSION]/build/
*/
this.base = Y.Env.meta.base;
/**
* Base path for the combo service
* @property comboBase
* @type string
* @default http://yui.yahooapis.com/combo?
*/
this.comboBase = Y.Env.meta.comboBase;
/**
* If configured, YUI JS resources will use the combo
* handler
* @property combine
* @type boolean
* @default true if a base dir isn't in the config
*/
this.combine = (!(BASE in o));
/**
* Ignore modules registered on the YUI global
* @property ignoreRegistered
* @default false
*/
this.ignoreRegistered = false;
/**
* Root path to prepend to module path for the combo
* service
* @property root
* @type string
* @default [YUI VERSION]/build/
*/
this.root = Y.Env.meta.root;
/**
* Timeout value in milliseconds. If set, this value will be used by
* the get utility. the timeout event will fire if
* a timeout occurs.
* @property timeout
* @type int
*/
this.timeout = 0;
/**
* A list of modules that should not be loaded, even if
* they turn up in the dependency tree
* @property ignore
* @type string[]
*/
this.ignore = null;
/**
* A list of modules that should always be loaded, even
* if they have already been inserted into the page.
* @property force
* @type string[]
*/
this.force = null;
/**
* Should we allow rollups
* @property allowRollup
* @type boolean
* @default true
*/
this.allowRollup = true;
/**
* A filter to apply to result urls. This filter will modify the default
* path for all modules. The default path for the YUI library is the
* minified version of the files (e.g., event-min.js). The filter property
* can be a predefined filter or a custom filter. The valid predefined
* filters are:
* <dl>
* <dt>DEBUG</dt>
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
* This option will automatically include the Logger widget</dd>
* <dt>RAW</dt>
* <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
* </dl>
* You can also define a custom filter, which must be an object literal
* containing a search expression and a replace string:
* <pre>
* myFilter: {
* 'searchExp': "-min\\.js",
* 'replaceStr': "-debug.js"
* }
* </pre>
* @property filter
* @type string|{searchExp: string, replaceStr: string}
*/
this.filter = null;
/**
* The list of requested modules
* @property required
* @type {string: boolean}
*/
this.required = {};
/**
* The library metadata
* @property moduleInfo
*/
// this.moduleInfo = Y.merge(Y.Env.meta.moduleInfo);
this.moduleInfo = {};
/**
* Provides the information used to skin the skinnable components.
* The following skin definition would result in 'skin1' and 'skin2'
* being loaded for calendar (if calendar was requested), and
* 'sam' for all other skinnable components:
*
* <code>
* skin: {
*
* // The default skin, which is automatically applied if not
* // overriden by a component-specific skin definition.
* // Change this in to apply a different skin globally
* defaultSkin: 'sam',
*
* // This is combined with the loader base property to get
* // the default root directory for a skin. ex:
* // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
* base: 'assets/skins/',
*
* // The name of the rollup css file for the skin
* path: 'skin.css',
*
* // The number of skinnable components requested that are
* // required before using the rollup file rather than the
* // individual component css files
* rollup: 3,
*
* // Any component-specific overrides can be specified here,
* // making it possible to load different skins for different
* // components. It is possible to load more than one skin
* // for a given component as well.
* overrides: {
* calendar: ['skin1', 'skin2']
* }
* }
* </code>
* @property skin
*/
this.skin = Y.merge(Y.Env.meta.skin);
var defaults = Y.Env.meta.modules, i;
for (i in defaults) {
if (defaults.hasOwnProperty(i)) {
this._internal = true;
this.addModule(defaults[i], i);
this._internal = false;
}
}
/**
* List of rollup files found in the library metadata
* @property rollups
*/
this.rollups = null;
/**
* Whether or not to load optional dependencies for
* the requested modules
* @property loadOptional
* @type boolean
* @default false
*/
this.loadOptional = false;
/**
* All of the derived dependencies in sorted order, which
* will be populated when either calculate() or insert()
* is called
* @property sorted
* @type string[]
*/
this.sorted = [];
/**
* Set when beginning to compute the dependency tree.
* Composed of what YUI reports to be loaded combined
* with what has been loaded by the tool
* @propery loaded
* @type {string: boolean}
*/
this.loaded = {};
/**
* A list of modules to attach to the YUI instance when complete.
* If not supplied, the sorted list of dependencies are applied.
* @property attaching
*/
this.attaching = null;
/**
* Flag to indicate the dependency tree needs to be recomputed
* if insert is called again.
* @property dirty
* @type boolean
* @default true
*/
this.dirty = true;
/**
* List of modules inserted by the utility
* @property inserted
* @type {string: boolean}
*/
this.inserted = {};
/**
* List of skipped modules during insert() because the module
* was not defined
* @property skipped
*/
this.skipped = {};
// Y.on('yui:load', this.loadNext, this);
this._config(o);
};
Y.Loader.prototype = {
FILTERS: {
RAW: {
'searchExp': "-min\\.js",
'replaceStr': ".js"
},
DEBUG: {
'searchExp': "-min\\.js",
'replaceStr': "-debug.js"
}
},
SKIN_PREFIX: "skin-",
_config: function(o) {
var i, j, val, f;
// apply config values
if (o) {
for (i in o) {
if (o.hasOwnProperty(i)) {
val = o[i];
if (i == 'require') {
this.require(val);
} else if (i == 'modules') {
// add a hash of module definitions
for (j in val) {
if (val.hasOwnProperty(j)) {
this.addModule(val[j], j);
}
}
} else {
this[i] = val;
}
}
}
}
// fix filter
f = this.filter;
if (L.isString(f)) {
f = f.toUpperCase();
this.filterName = f;
this.filter = this.FILTERS[f];
}
},
/**
* Returns the skin module name for the specified skin name. If a
* module name is supplied, the returned skin module name is
* specific to the module passed in.
* @method formatSkin
* @param skin {string} the name of the skin
* @param mod {string} optional: the name of a module to skin
* @return {string} the full skin module name
*/
formatSkin: function(skin, mod) {
var s = this.SKIN_PREFIX + skin;
if (mod) {
s = s + "-" + mod;
}
return s;
},
/**
* Reverses <code>formatSkin</code>, providing the skin name and
* module name if the string matches the pattern for skins.
* @method parseSkin
* @param mod {string} the module name to parse
* @return {skin: string, module: string} the parsed skin name
* and module name, or null if the supplied string does not match
* the skin pattern
*/
parseSkin: function(mod) {
if (mod.indexOf(this.SKIN_PREFIX) === 0) {
var a = mod.split("-");
return {skin: a[1], module: a[2]};
}
return null;
},
/**
* Adds the skin def to the module info
* @method _addSkin
* @param skin {string} the name of the skin
* @param mod {string} the name of the module
* @param parent {string} parent module if this is a skin of a
* submodule or plugin
* @return {string} the module name for the skin
* @private
*/
_addSkin: function(skin, mod, parent) {
var name = this.formatSkin(skin),
info = this.moduleInfo,
sinf = this.skin,
ext = info[mod] && info[mod].ext,
mdef, pkg;
/*
// Add a module definition for the skin rollup css
if (!info[name]) {
this.addModule({
'name': name,
'type': 'css',
'path': sinf.base + skin + '/' + sinf.path,
//'supersedes': '*',
'after': sinf.after,
'rollup': sinf.rollup,
'ext': ext
});
}
*/
// Add a module definition for the module-specific skin css
if (mod) {
name = this.formatSkin(skin, mod);
if (!info[name]) {
mdef = info[mod];
pkg = mdef.pkg || mod;
this.addModule({
'name': name,
'type': 'css',
'after': sinf.after,
'path': (parent || pkg) + '/' + sinf.base + skin + '/' + mod + '.css',
'ext': ext
});
}
}
return name;
},
/** Add a new module to the component metadata.
* <dl>
* <dt>name:</dt> <dd>required, the component name</dd>
* <dt>type:</dt> <dd>required, the component type (js or css)</dd>
* <dt>path:</dt> <dd>required, the path to the script from "base"</dd>
* <dt>requires:</dt> <dd>array of modules required by this component</dd>
* <dt>optional:</dt> <dd>array of optional modules for this component</dd>
* <dt>supersedes:</dt> <dd>array of the modules this component replaces</dd>
* <dt>after:</dt> <dd>array of modules the components which, if present, should be sorted above this one</dd>
* <dt>rollup:</dt> <dd>the number of superseded modules required for automatic rollup</dd>
* <dt>fullpath:</dt> <dd>If fullpath is specified, this is used instead of the configured base + path</dd>
* <dt>skinnable:</dt> <dd>flag to determine if skin assets should automatically be pulled in</dd>
* <dt>submodules:</dt> <dd>a has of submodules</dd>
* </dl>
* @method addModule
* @param o An object containing the module data
* @param name the module name (optional), required if not in the module data
* @return {boolean} true if the module was added, false if
* the object passed in did not provide all required attributes
*/
addModule: function(o, name) {
name = name || o.name;
o.name = name;
if (!o || !o.name) {
return false;
}
if (!o.type) {
o.type = JS;
}
if (!o.path && !o.fullpath) {
// o.path = name + "/" + name + "-min." + o.type;
o.path = _path(name, name, o.type);
}
o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true;
o.requires = o.requires || [];
this.moduleInfo[name] = o;
// Handle submodule logic
var subs = o.submodules, i, l, sup, s, smod, plugins, plug;
if (subs) {
sup = [];
l = 0;
for (i in subs) {
if (subs.hasOwnProperty(i)) {
s = subs[i];
s.path = _path(name, i, o.type);
this.addModule(s, i);
sup.push(i);
if (o.skinnable) {
smod = this._addSkin(this.skin.defaultSkin, i, name);
sup.push(smod.name);
}
l++;
}
}
o.supersedes = sup;
o.rollup = Math.min(l-1, 4);
}
plugins = o.plugins;
if (plugins) {
for (i in plugins) {
if (plugins.hasOwnProperty(i)) {
plug = plugins[i];
plug.path = _path(name, i, o.type);
plug.requires = plug.requires || [];
plug.requires.push(name);
this.addModule(plug, i);
if (o.skinnable) {
this._addSkin(this.skin.defaultSkin, i, name);
}
}
}
}
this.dirty = true;
return o;
},
/**
* Add a requirement for one or more module
* @method require
* @param what {string[] | string*} the modules to load
*/
require: function(what) {
var a = (typeof what === "string") ? arguments : what;
this.dirty = true;
Y.mix(this.required, Y.Array.hash(a));
},
/**
* Returns an object containing properties for all modules required
* in order to load the requested module
* @method getRequires
* @param mod The module definition from moduleInfo
*/
getRequires: function(mod) {
if (!mod) {
return [];
}
if (!this.dirty && mod.expanded) {
return mod.expanded;
}
var i, d=[], r=mod.requires, o=mod.optional,
info=this.moduleInfo, m, j, add;
for (i=0; i<r.length; i=i+1) {
d.push(r[i]);
m = this.getModule(r[i]);
add = this.getRequires(m);
for (j=0;j<add.length;j=j+1) {
d.push(add[j]);
}
}
// get the requirements from superseded modules, if any
r=mod.supersedes;
if (r) {
for (i=0; i<r.length; i=i+1) {
d.push(r[i]);
m = this.getModule(r[i]);
add = this.getRequires(m);
for (j=0;j<add.length;j=j+1) {
d.push(add[j]);
}
}
}
if (o && this.loadOptional) {
for (i=0; i<o.length; i=i+1) {
d.push(o[i]);
add = this.getRequires(info[o[i]]);
for (j=0;j<add.length;j=j+1) {
d.push(add[j]);
}
}
}
mod.expanded = Y.Object.keys(Y.Array.hash(d));
return mod.expanded;
},
/**
* Returns an object literal of the modules the supplied module satisfies
* @method getProvides
* @param name{string} The name of the module
* @param notMe {string} don't add this module name, only include superseded modules
* @return what this module provides
*/
getProvides: function(name, notMe) {
var addMe = !(notMe), ckey = (addMe) ? PROV : SUPER,
m = this.getModule(name), o = {},
s, done, me, i,
// use worker to break cycles
add = function(mm) {
if (!done[mm]) {
done[mm] = true;
// we always want the return value normal behavior
// (provides) for superseded modules.
Y.mix(o, me.getProvides(mm));
}
// else {
// }
};
if (!m) {
return o;
}
if (m[ckey]) {
return m[ckey];
}
s = m.supersedes;
done = {};
me = this;
// calculate superseded modules
if (s) {
for (i=0; i<s.length; i=i+1) {
add(s[i]);
}
}
// supersedes cache
m[SUPER] = o;
// provides cache
m[PROV] = Y.merge(o);
m[PROV][name] = true;
return m[ckey];
},
/**
* Calculates the dependency tree, the result is stored in the sorted
* property
* @method calculate
* @param o optional options object
*/
calculate: function(o) {
if (o || this.dirty) {
this._config(o);
this._setup();
this._explode();
if (this.allowRollup) {
this._rollup();
}
this._reduce();
this._sort();
this.dirty = false;
}
},
/**
* Investigates the current YUI configuration on the page. By default,
* modules already detected will not be loaded again unless a force
* option is encountered. Called by calculate()
* @method _setup
* @private
*/
_setup: function() {
var info = this.moduleInfo, name, i, j, m, o, l, smod;
// Create skin modules
for (name in info) {
if (info.hasOwnProperty(name)) {
m = info[name];
if (m && m.skinnable) {
o = this.skin.overrides;
if (o && o[name]) {
for (i=0; i<o[name].length; i=i+1) {
smod = this._addSkin(o[name][i], name);
}
} else {
smod = this._addSkin(this.skin.defaultSkin, name);
}
m.requires.push(smod);
}
}
}
l = Y.merge(this.inserted); // shallow clone
// available modules
if (!this.ignoreRegistered) {
Y.mix(l, YUI.Env.mods);
}
// add the ignore list to the list of loaded packages
if (this.ignore) {
// OU.appendArray(l, this.ignore);
Y.mix(l, Y.Array.hash(this.ignore));
}
// expand the list to include superseded modules
for (j in l) {
if (l.hasOwnProperty(j)) {
Y.mix(l, this.getProvides(j));
}
}
// remove modules on the force list from the loaded list
if (this.force) {
for (i=0; i<this.force.length; i=i+1) {
if (this.force[i] in l) {
delete l[this.force[i]];
}
}
}
this.loaded = l;
},
/**
* Inspects the required modules list looking for additional
* dependencies. Expands the required list to include all
* required modules. Called by calculate()
* @method _explode
* @private
*/
_explode: function() {
var r=this.required, i, mod, req;
for (i in r) {
if (r.hasOwnProperty(i)) {
mod = this.getModule(i);
req = this.getRequires(mod);
if (req) {
Y.mix(r, Y.Array.hash(req));
}
}
}
},
getModule: function(name) {
var m = this.moduleInfo[name];
// create the default module
// if (!m) {
// m = this.addModule({ext: false}, name);
// }
return m;
},
/**
* Look for rollup packages to determine if all of the modules a
* rollup supersedes are required. If so, include the rollup to
* help reduce the total number of connections required. Called
* by calculate()
* @method _rollup
* @private
*/
_rollup: function() {
var i, j, m, s, rollups={}, r=this.required, roll,
info = this.moduleInfo, rolled, c;
// find and cache rollup modules
if (this.dirty || !this.rollups) {
for (i in info) {
if (info.hasOwnProperty(i)) {
m = this.getModule(i);
// if (m && m.rollup && m.supersedes) {
if (m && m.rollup) {
rollups[i] = m;
}
}
}
this.rollups = rollups;
}
// make as many passes as needed to pick up rollup rollups
for (;;) {
rolled = false;
// go through the rollup candidates
for (i in rollups) {
if (rollups.hasOwnProperty(i)) {
// there can be only one
if (!r[i] && !this.loaded[i]) {
m = this.getModule(i);
s = m.supersedes || [];
roll = false;
// @TODO remove continue
if (!m.rollup) {
continue;
}
c = 0;
// check the threshold
for (j=0;j<s.length;j=j+1) {
// if the superseded module is loaded, we can't load the rollup
// if (this.loaded[s[j]] && (!_Y.dupsAllowed[s[j]])) {
if (this.loaded[s[j]]) {
roll = false;
break;
// increment the counter if this module is required. if we are
// beyond the rollup threshold, we will use the rollup module
} else if (r[s[j]]) {
c++;
roll = (c >= m.rollup);
if (roll) {
break;
}
}
}
if (roll) {
// add the rollup
r[i] = true;
rolled = true;
// expand the rollup's dependencies
this.getRequires(m);
}
}
}
}
// if we made it here w/o rolling up something, we are done
if (!rolled) {
break;
}
}
},
/**
* Remove superceded modules and loaded modules. Called by
* calculate() after we have the mega list of all dependencies
* @method _reduce
* @private
*/
_reduce: function() {
var i, j, s, m, r=this.required;
for (i in r) {
if (r.hasOwnProperty(i)) {
// remove if already loaded
if (i in this.loaded) {
delete r[i];
// remove anything this module supersedes
} else {
m = this.getModule(i);
s = m && m.supersedes;
if (s) {
for (j=0; j<s.length; j=j+1) {
if (s[j] in r) {
delete r[s[j]];
}
}
}
}
}
}
},
_attach: function() {
// this is the full list of items the YUI needs attached,
// which is needed if some dependencies are already on
// the page without their dependencies.
if (this.attaching) {
Y._attach(this.attaching);
} else {
Y._attach(this.sorted);
}
this._pushEvents();
},
_onSuccess: function() {
this._attach();
var skipped = this.skipped, i, f;
for (i in skipped) {
if (skipped.hasOwnProperty(i)) {
delete this.inserted[i];
}
}
this.skipped = {};
// this.fire('success', {
// data: this.data
// });
f = this.onSuccess;
if (f) {
f.call(this.context, {
msg: 'success',
data: this.data,
success: true
});
}
},
_onFailure: function(msg) {
this._attach();
// this.fire('failure', {
// msg: 'operation failed: ' + msg,
// data: this.data
// });
var f = this.onFailure;
if (f) {
f.call(this.context, {
msg: 'failure: ' + msg,
data: this.data,
success: false
});
}
},
_onTimeout: function() {
this._attach();
// this.fire('timeout', {
// data: this.data
// });
var f = this.onTimeout;
if (f) {
f.call(this.context, {
msg: 'timeout',
data: this.data,
success: false
});
}
},
/**
* Sorts the dependency tree. The last step of calculate()
* @method _sort
* @private
*/
_sort: function() {
// create an indexed list
var s=Y.Object.keys(this.required), info=this.moduleInfo, loaded=this.loaded,
p, l, a, b, j, k, moved,
// returns true if b is not loaded, and is required
// directly or by means of modules it supersedes.
requires = function(aa, bb) {
var mm = info[aa], ii, rr, after, other, ss;
if (loaded[bb] || !mm) {
return false;
}
rr = mm.expanded;
after = mm.after;
other = info[bb];
// check if this module requires the other directly
if (rr && Y.Array.indexOf(rr, bb) > -1) {
return true;
}
// check if this module should be sorted after the other
if (after && Y.Array.indexOf(after, bb) > -1) {
return true;
}
// check if this module requires one the other supersedes
ss = info[bb] && info[bb].supersedes;
if (ss) {
for (ii=0; ii<ss.length; ii=ii+1) {
if (requires(aa, ss[ii])) {
return true;
}
}
}
// external css files should be sorted below yui css
if (mm.ext && mm.type == CSS && !other.ext && other.type == CSS) {
return true;
}
return false;
};
// pointer to the first unsorted item
p = 0;
// keep going until we make a pass without moving anything
for (;;) {
l = s.length;
moved = false;
// start the loop after items that are already sorted
for (j=p; j<l; j=j+1) {
// check the next module on the list to see if its
// dependencies have been met
a = s[j];
// check everything below current item and move if we
// find a requirement for the current item
for (k=j+1; k<l; k=k+1) {
if (requires(a, s[k])) {
// extract the dependency so we can move it up
b = s.splice(k, 1);
// insert the dependency above the item that
// requires it
s.splice(j, 0, b[0]);
moved = true;
break;
}
}
// jump out of loop if we moved something
if (moved) {
break;
// this item is sorted, move our pointer and keep going
} else {
p = p + 1;
}
}
// when we make it here and moved is false, we are
// finished sorting
if (!moved) {
break;
}
}
this.sorted = s;
},
/**
* inserts the requested modules and their dependencies.
* <code>type</code> can be "js" or "css". Both script and
* css are inserted if type is not provided.
* @method insert
* @param o optional options object
* @param type {string} the type of dependency to insert
*/
insert: function(o, type) {
// build the dependency list
this.calculate(o);
if (!type) {
var self = this;
this._internalCallback = function() {
self._internalCallback = null;
self.insert(null, JS);
};
this.insert(null, CSS);
return;
}
// set a flag to indicate the load has started
this._loading = true;
// flag to indicate we are done with the combo service
// and any additional files will need to be loaded
// individually
this._combineComplete = {};
// keep the loadType (js, css or undefined) cached
this.loadType = type;
// start the load
this.loadNext();
},
/**
* Executed every time a module is loaded, and if we are in a load
* cycle, we attempt to load the next script. Public so that it
* is possible to call this if using a method other than
* Y.register to determine when scripts are fully loaded
* @method loadNext
* @param mname {string} optional the name of the module that has
* been loaded (which is usually why it is time to load the next
* one)
*/
loadNext: function(mname) {
// It is possible that this function is executed due to something
// else one the page loading a YUI module. Only react when we
// are actively loading something
if (!this._loading) {
return;
}
var s, len, i, m, url, self=this, type=this.loadType, fn, msg,
callback=function(o) {
this._combineComplete[type] = true;
var c=this._combining, len=c.length, i;
for (i=0; i<len; i=i+1) {
this.inserted[c[i]] = true;
}
this.loadNext(o.data);
},
onsuccess=function(o) {
self.loadNext(o.data);
};
// @TODO this will need to handle the two phase insert when
// CSS support is added
if (this.combine && (!this._combineComplete[type])) {
this._combining = [];
s=this.sorted;
len=s.length;
url=this.comboBase;
for (i=0; i<len; i=i+1) {
m = this.getModule(s[i]);
// @TODO we can't combine CSS yet until we deliver files with absolute paths to the assets
// Do not try to combine non-yui JS
if (m && m.type === this.loadType && !m.ext) {
url += this.root + m.path;
if (i < len-1) {
url += '&';
}
this._combining.push(s[i]);
}
}
if (this._combining.length) {
fn =(type === CSS) ? Y.Get.css : Y.Get.script;
// @TODO get rid of the redundant Get code
fn(this._filter(url), {
data: this._loading,
onSuccess: callback,
onFailure: this._onFailure,
onTimeout: this._onTimeout,
insertBefore: this.insertBefore,
charset: this.charset,
timeout: this.timeout,
context: self
});
return;
} else {
this._combineComplete[type] = true;
}
}
if (mname) {
// if the module that was just loaded isn't what we were expecting,
// continue to wait
if (mname !== this._loading) {
return;
}
// The global handler that is called when each module is loaded
// will pass that module name to this function. Storing this
// data to avoid loading the same module multiple times
this.inserted[mname] = true;
// this.fire('progress', {
// name: mname,
// data: this.data
// });
if (this.onProgress) {
this.onProgress.call(this.context, {
name: mname,
data: this.data
});
}
}
s=this.sorted;
len=s.length;
for (i=0; i<len; i=i+1) {
// this.inserted keeps track of what the loader has loaded.
// move on if this item is done.
if (s[i] in this.inserted) {
continue;
}
// Because rollups will cause multiple load notifications
// from Y, loadNext may be called multiple times for
// the same module when loading a rollup. We can safely
// skip the subsequent requests
if (s[i] === this._loading) {
return;
}
// log("inserting " + s[i]);
m = this.getModule(s[i]);
if (!m) {
msg = "Undefined module " + s[i] + " skipped";
this.inserted[s[i]] = true;
this.skipped[s[i]] = true;
continue;
// this.fire('failure', {
// msg: msg,
// data: this.data
// });
}
// The load type is stored to offer the possibility to load
// the css separately from the script.
if (!type || type === m.type) {
this._loading = s[i];
fn = (m.type === CSS) ? Y.Get.css : Y.Get.script;
url = (m.fullpath) ? this._filter(m.fullpath) : this._url(m.path, s[i]);
fn(url, {
data: s[i],
onSuccess: onsuccess,
insertBefore: this.insertBefore,
charset: this.charset,
onFailure: this._onFailure,
onTimeout: this._onTimeout,
timeout: this.timeout,
context: self
});
return;
}
}
// we are finished
this._loading = null;
fn = this._internalCallback;
// internal callback for loading css first
if (fn) {
this._internalCallback = null;
fn.call(this);
// } else if (this.onSuccess) {
} else {
// call Y.use passing this instance. Y will use the sorted
// dependency list.
this._onSuccess();
}
},
/**
* In IE, the onAvailable/onDOMReady events need help when Event is
* loaded dynamically
* @method _pushEvents
* @param {Function} optional function reference
* @private
*/
_pushEvents: function() {
if (Y.Event) {
Y.Event._load();
}
},
/**
* Apply filter defined for this instance to a url/path
* method _filter
* @param u {string} the string to filter
* @return {string} the filtered string
* @private
*/
_filter: function(u) {
var f = this.filter, useFilter, exc, inc;
if (u && f) {
useFilter = true;
if (this.filterName == "DEBUG") {
exc = this.logExclude;
inc = this.logInclude;
if (inc && !(name in inc)) {
useFilter = false;
} else if (exc && (name in exc)) {
useFilter = false;
}
}
if (useFilter) {
u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr);
}
}
return u;
},
/**
* Generates the full url for a module
* method _url
* @param path {string} the path fragment
* @return {string} the full url
* @private
*/
_url: function(path, name) {
return this._filter((this.base || "") + path);
}
};
// Y.augment(Y.Loader, Y.Event.Target);
})();
}, '@VERSION@' );
YUI.add('yui', function(Y){}, '@VERSION@' ,{use:['yui-base','get','loader']});
|
BackUp FIrebase/IQApp/components/Faixa.js
|
victorditadi/IQApp
|
import React, { Component } from 'react';
import { Header, Title } from 'native-base';
export default class Faixa extends Component {
constructor() {
super();
}
render() {
return (
<Header>
<Title>IQMail</Title>
</Header>
);
}
}
|
source/Link.js
|
jamesknelson/react-junctions
|
/**
This Component is based on the Link component from react-router:
https://github.com/ReactTraining/react-router/blob/21e4a1e95c4e9e8da534088b2d74157bf8f62ac4/modules/Link.js
The MIT License (MIT)
Copyright (c) 2015-present, Ryan Florence, Michael Jackson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import React from 'react'
import PropTypes from 'prop-types'
function isLeftClickEvent(event) {
return event.button === 0
}
function isModifiedEvent(event) {
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey)
}
export default class Link extends React.Component {
constructor(props) {
super()
this.handleClick = this.handleClick.bind(this)
}
handleClick(event) {
if (this.props.onClick) {
this.props.onClick(event)
}
if (event.defaultPrevented) {
return
}
var history = this.props.history || this.context.history
if (!history) {
throw new Error('<Link> requires a history object to be passed in, either via props or via context.')
}
if (isModifiedEvent(event) || !isLeftClickEvent(event)) {
return
}
// If target prop is set (e.g. to "_blank"), let browser handle link.
if (this.props.target) {
return
}
event.preventDefault()
history.push(this.props.to)
}
render() {
var props = {}
var keys = Object.keys(this.props)
var i, key
for (i = 0; i < keys.length; i++) {
key = keys[i]
if (key !== 'history' && key !== 'to') {
props[key] = this.props[key]
}
}
props.onClick = this.handleClick
props.href = this.props.to.pathname + (this.props.to.search || '')
return React.createElement('a', props)
}
}
Link.contextTypes = {
history: PropTypes.object
}
Link.propTypes = {
history: PropTypes.object,
to: PropTypes.object.isRequired,
onClick: PropTypes.func,
target: PropTypes.string
}
|
components/LocationOutput.js
|
Hardyng/weatherforecast-nextjs-redux-ssr
|
import React from 'react';
import { connect } from 'react-redux';
import styled from 'styled-components';
const Container = styled.div`
display:flex;
align-items:center;
justify-content: center;
`
const Title = styled.h4`
`
const Text = styled.p`
margin: 4px 0;
line-height:16px;
`
class LocationOutput extends React.Component {
render() {
const { city, region, country } = this.props.localisation;
return (
<Container className="mdl-card mdl-cell mdl-cell--4-col mdl-cell--8-col-tablet mdl-shadow--2dp">
<Title>{city}</Title>
<Text>{region}</Text>
<Text>{country}</Text>
</Container>
);
}
}
export default connect(({localisation}) => ({ localisation}), null)(
LocationOutput
);
|
src/Parser/Monk/Mistweaver/CombatLogParser.js
|
hasseboulen/WoWAnalyzer
|
import React from 'react';
import CoreCombatLogParser from 'Parser/Core/CombatLogParser';
import Tab from 'Main/Tab';
import Mana from 'Main/Mana';
import MonkSpreadsheet from 'Main/MonkSpreadsheet';
import LowHealthHealing from 'Parser/Core/Modules/LowHealthHealing';
import HealingDone from 'Parser/Core/Modules/HealingDone';
import GlobalCooldown from './Modules/Core/GlobalCooldown';
import Channeling from './Modules/Core/Channeling';
// Features
import Abilities from './Modules/Features/Abilities';
import CooldownThroughputTracker from './Modules/Features/CooldownThroughputTracker';
import AlwaysBeCasting from './Modules/Features/AlwaysBeCasting';
import EssenceFontMastery from './Modules/Features/EssenceFontMastery';
import Checklist from './Modules/Features/Checklist';
import StatValues from './Modules/Features/StatValues';
// Traits
import MistsOfSheilun from './Modules/Traits/MistsOfSheilun';
import CelestialBreath from './Modules/Traits/CelestialBreath';
import WhispersOfShaohao from './Modules/Traits/WhispersOfShaohao';
import CoalescingMists from './Modules/Traits/CoalescingMists';
import SoothingRemedies from './Modules/Traits/SoothingRemedies';
import EssenceOfTheMist from './Modules/Traits/EssenceOfTheMist';
import WayOfTheMistweaver from './Modules/Traits/WayOfTheMistweaver';
import InfusionOfLife from './Modules/Traits/InfusionOfLife';
import ProtectionOfShaohao from './Modules/Traits/ProtectionOfShaohao';
import ExtendedHealing from './Modules/Traits/ExtendedHealing';
import RelicTraits from './Modules/Traits/RelicTraits';
// Spells
import UpliftingTrance from './Modules/Spells/UpliftingTrance';
import ThunderFocusTea from './Modules/Spells/ThunderFocusTea';
import SheilunsGift from './Modules/Spells/SheilunsGift';
import RenewingMist from './Modules/Spells/RenewingMist';
import EssenceFont from './Modules/Spells/EssenceFont';
import EnvelopingMists from './Modules/Spells/EnvelopingMists';
import SoothingMist from './Modules/Spells/SoothingMist';
// Talents
import ChiJi from './Modules/Talents/ChiJi';
import ChiBurst from './Modules/Talents/ChiBurst';
import ManaTea from './Modules/Talents/ManaTea';
import RefreshingJadeWind from './Modules/Talents/RefreshingJadeWind';
import Lifecycles from './Modules/Talents/Lifecycles';
import SpiritOfTheCrane from './Modules/Talents/SpiritOfTheCrane';
// Items
import DrapeOfShame from './Modules/Items/DrapeOfShame';
import Eithas from './Modules/Items/Eithas';
import T20_4set from './Modules/Items/T20_4set';
import T20_2set from './Modules/Items/T20_2set';
import ShelterOfRin from './Modules/Items/ShelterOfRin';
import DoorwayToNowhere from './Modules/Items/DoorwayToNowhere';
import PetrichorLagniappe from './Modules/Items/PetrichorLagniappe';
import OvydsWinterWrap from './Modules/Items/OvydsWinterWrap';
import T21_2set from './Modules/Items/T21_2set';
import T21_4set from './Modules/Items/T21_4set';
import { ABILITIES_AFFECTED_BY_HEALING_INCREASES } from './Constants';
class CombatLogParser extends CoreCombatLogParser {
static abilitiesAffectedByHealingIncreases = ABILITIES_AFFECTED_BY_HEALING_INCREASES;
static specModules = {
// Core
lowHealthHealing: LowHealthHealing,
healingDone: [HealingDone, { showStatistic: true }],
channeling: Channeling,
globalCooldown: GlobalCooldown,
// Features
alwaysBeCasting: AlwaysBeCasting,
abilities: Abilities,
cooldownThroughputTracker: CooldownThroughputTracker,
essenceFontMastery: EssenceFontMastery,
checklist: Checklist,
statValues: StatValues,
// Traits
mistsOfSheilun: MistsOfSheilun,
celestialBreath: CelestialBreath,
whispersOfShaohao: WhispersOfShaohao,
coalescingMists: CoalescingMists,
soothingRemedies: SoothingRemedies,
essenceOfTheMist: EssenceOfTheMist,
wayOfTheMistweaver: WayOfTheMistweaver,
infusionOfLife: InfusionOfLife,
protectionOfShaohao: ProtectionOfShaohao,
extendedHealing: ExtendedHealing,
relicTraits: RelicTraits,
// Spells
essenceFont: EssenceFont,
renewingMist: RenewingMist,
sheilunsGift: SheilunsGift,
thunderFocusTea: ThunderFocusTea,
upliftingTrance: UpliftingTrance,
envelopingMists: EnvelopingMists,
soothingMist: SoothingMist,
// Talents
chiBurst: ChiBurst,
chiJi: ChiJi,
manaTea: ManaTea,
refreshingJadeWind: RefreshingJadeWind,
lifecycles: Lifecycles,
spiritOfTheCrane: SpiritOfTheCrane,
// Legendaries / Items:
drapeOfShame: DrapeOfShame,
eithas: Eithas,
t20_4set: T20_4set,
t20_2set: T20_2set,
shelterOfRin: ShelterOfRin,
doorwayToNowhere: DoorwayToNowhere,
petrichorLagniappe: PetrichorLagniappe,
ovydsWinterWrap: OvydsWinterWrap,
t21_2set: T21_2set,
t21_4set: T21_4set,
};
generateResults() {
const results = super.generateResults();
results.tabs = [
...results.tabs,
{
title: 'Mana',
url: 'mana',
render: () => (
<Tab title="Mana" style={{ padding: '15px 22px' }}>
<Mana parser={this} />
</Tab>
),
},
{
title: 'Player Log Data',
url: 'player-log-data',
render: () => (
<Tab title="Player Log Data" style={{ padding: '15px 22px 15px 15px' }}>
<MonkSpreadsheet parser={this} />
</Tab>
),
},
];
return results;
}
}
export default CombatLogParser;
|
app/components/sidebars/main/channels_list/unread_indicator/unread_indicator.android.js
|
mattermost/mattermost-mobile
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {View} from 'react-native';
import UnreadIndicatorBase, {getStyleSheet} from './unread_indicator.base';
export default class UnreadIndicatorAndroid extends UnreadIndicatorBase {
render() {
const {visible, theme} = this.props;
const style = getStyleSheet(theme);
if (!visible) {
return null;
}
return (
<View style={style.container}>
{this.renderContent()}
</View>
);
}
}
|
generators/advanced-base/templates/src/App.js
|
bamlab/generator-rn-toolbox
|
import React from 'react';
import Scenes from './Scenes';
const App = () => <Scenes />;
export default App;
|
node_modules/react-dom/lib/ReactCompositeComponent.js
|
swapnilabnave/swapnilabnave.github.io
|
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
'use strict';
var _prodInvariant = require('./reactProdInvariant'),
_assign = require('object-assign');
var React = require('react/lib/React');
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
var ReactCurrentOwner = require('react/lib/ReactCurrentOwner');
var ReactErrorUtils = require('./ReactErrorUtils');
var ReactInstanceMap = require('./ReactInstanceMap');
var ReactInstrumentation = require('./ReactInstrumentation');
var ReactNodeTypes = require('./ReactNodeTypes');
var ReactReconciler = require('./ReactReconciler');
if (process.env.NODE_ENV !== 'production') {
var checkReactTypeSpec = require('./checkReactTypeSpec');
}
var emptyObject = require('fbjs/lib/emptyObject');
var invariant = require('fbjs/lib/invariant');
var shallowEqual = require('fbjs/lib/shallowEqual');
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
var warning = require('fbjs/lib/warning');
var CompositeTypes = {
ImpureClass: 0,
PureClass: 1,
StatelessFunctional: 2
};
function StatelessComponent(Component) {}
StatelessComponent.prototype.render = function () {
var Component = ReactInstanceMap.get(this)._currentElement.type;
var element = Component(this.props, this.context, this.updater);
warnIfInvalidElement(Component, element);
return element;
};
function warnIfInvalidElement(Component, element) {
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(element === null || element === false || React.isValidElement(element), '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(!Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', Component.displayName || Component.name || 'Component') : void 0;
}
}
function shouldConstruct(Component) {
return !!(Component.prototype && Component.prototype.isReactComponent);
}
function isPureComponent(Component) {
return !!(Component.prototype && Component.prototype.isPureReactComponent);
}
// Separated into a function to contain deoptimizations caused by try/finally.
function measureLifeCyclePerf(fn, debugID, timerType) {
if (debugID === 0) {
// Top-level wrappers (see ReactMount) and empty components (see
// ReactDOMEmptyComponent) are invisible to hooks and devtools.
// Both are implementation details that should go away in the future.
return fn();
}
ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType);
try {
return fn();
} finally {
ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType);
}
}
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
* - constructor: Initialization of state. The instance is now retained.
* - componentWillMount
* - render
* - [children's constructors]
* - [children's componentWillMount and render]
* - [children's componentDidMount]
* - componentDidMount
*
* Update Phases:
* - componentWillReceiveProps (only called if parent updated)
* - shouldComponentUpdate
* - componentWillUpdate
* - render
* - [children's constructors or receive props phases]
* - componentDidUpdate
*
* - componentWillUnmount
* - [children's componentWillUnmount]
* - [children destroyed]
* - (destroyed): The instance is now blank, released by React and ready for GC.
*
* -----------------------------------------------------------------------------
*/
/**
* An incrementing ID assigned to each component when it is mounted. This is
* used to enforce the order in which `ReactUpdates` updates dirty components.
*
* @private
*/
var nextMountID = 1;
/**
* @lends {ReactCompositeComponent.prototype}
*/
var ReactCompositeComponent = {
/**
* Base constructor for all composite component.
*
* @param {ReactElement} element
* @final
* @internal
*/
construct: function (element) {
this._currentElement = element;
this._rootNodeID = 0;
this._compositeType = null;
this._instance = null;
this._hostParent = null;
this._hostContainerInfo = null;
// See ReactUpdateQueue
this._updateBatchNumber = null;
this._pendingElement = null;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._renderedNodeType = null;
this._renderedComponent = null;
this._context = null;
this._mountOrder = 0;
this._topLevelWrapper = null;
// See ReactUpdates and ReactUpdateQueue.
this._pendingCallbacks = null;
// ComponentWillUnmount shall only be called once
this._calledComponentWillUnmount = false;
if (process.env.NODE_ENV !== 'production') {
this._warnedAboutRefsInRender = false;
}
},
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {?object} hostParent
* @param {?object} hostContainerInfo
* @param {?object} context
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
var _this = this;
this._context = context;
this._mountOrder = nextMountID++;
this._hostParent = hostParent;
this._hostContainerInfo = hostContainerInfo;
var publicProps = this._currentElement.props;
var publicContext = this._processContext(context);
var Component = this._currentElement.type;
var updateQueue = transaction.getUpdateQueue();
// Initialize the public class
var doConstruct = shouldConstruct(Component);
var inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue);
var renderedElement;
// Support functional components
if (!doConstruct && (inst == null || inst.render == null)) {
renderedElement = inst;
warnIfInvalidElement(Component, renderedElement);
!(inst === null || inst === false || React.isValidElement(inst)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : _prodInvariant('105', Component.displayName || Component.name || 'Component') : void 0;
inst = new StatelessComponent(Component);
this._compositeType = CompositeTypes.StatelessFunctional;
} else {
if (isPureComponent(Component)) {
this._compositeType = CompositeTypes.PureClass;
} else {
this._compositeType = CompositeTypes.ImpureClass;
}
}
if (process.env.NODE_ENV !== 'production') {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
if (inst.render == null) {
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', Component.displayName || Component.name || 'Component') : void 0;
}
var propsMutated = inst.props !== publicProps;
var componentName = Component.displayName || Component.name || 'Component';
process.env.NODE_ENV !== 'production' ? warning(inst.props === undefined || !propsMutated, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", componentName, componentName) : void 0;
}
// These should be set up in the constructor, but as a convenience for
// simpler class abstractions, we set them up after the fact.
inst.props = publicProps;
inst.context = publicContext;
inst.refs = emptyObject;
inst.updater = updateQueue;
this._instance = inst;
// Store a reference from the instance back to the internal representation
ReactInstanceMap.set(inst, this);
if (process.env.NODE_ENV !== 'production') {
// Since plain JS classes are defined without any special initialization
// logic, we can not catch common errors early. Therefore, we have to
// catch them here, at initialization time, instead.
process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved || inst.state, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : void 0;
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : void 0;
}
var initialState = inst.state;
if (initialState === undefined) {
inst.state = initialState = null;
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : _prodInvariant('106', this.getName() || 'ReactCompositeComponent') : void 0;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
var markup;
if (inst.unstable_handleError) {
markup = this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context);
} else {
markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
}
if (inst.componentDidMount) {
if (process.env.NODE_ENV !== 'production') {
transaction.getReactMountReady().enqueue(function () {
measureLifeCyclePerf(function () {
return inst.componentDidMount();
}, _this._debugID, 'componentDidMount');
});
} else {
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
}
}
return markup;
},
_constructComponent: function (doConstruct, publicProps, publicContext, updateQueue) {
if (process.env.NODE_ENV !== 'production') {
ReactCurrentOwner.current = this;
try {
return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
} finally {
ReactCurrentOwner.current = null;
}
} else {
return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue);
}
},
_constructComponentWithoutOwner: function (doConstruct, publicProps, publicContext, updateQueue) {
var Component = this._currentElement.type;
if (doConstruct) {
if (process.env.NODE_ENV !== 'production') {
return measureLifeCyclePerf(function () {
return new Component(publicProps, publicContext, updateQueue);
}, this._debugID, 'ctor');
} else {
return new Component(publicProps, publicContext, updateQueue);
}
}
// This can still be an instance in case of factory components
// but we'll count this as time spent rendering as the more common case.
if (process.env.NODE_ENV !== 'production') {
return measureLifeCyclePerf(function () {
return Component(publicProps, publicContext, updateQueue);
}, this._debugID, 'render');
} else {
return Component(publicProps, publicContext, updateQueue);
}
},
performInitialMountWithErrorHandling: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
var markup;
var checkpoint = transaction.checkpoint();
try {
markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
} catch (e) {
// Roll back to checkpoint, handle error (which may add items to the transaction), and take a new checkpoint
transaction.rollback(checkpoint);
this._instance.unstable_handleError(e);
if (this._pendingStateQueue) {
this._instance.state = this._processPendingState(this._instance.props, this._instance.context);
}
checkpoint = transaction.checkpoint();
this._renderedComponent.unmountComponent(true);
transaction.rollback(checkpoint);
// Try again - we've informed the component about the error, so they can render an error message this time.
// If this throws again, the error will bubble up (and can be caught by a higher error boundary).
markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context);
}
return markup;
},
performInitialMount: function (renderedElement, hostParent, hostContainerInfo, transaction, context) {
var inst = this._instance;
var debugID = 0;
if (process.env.NODE_ENV !== 'production') {
debugID = this._debugID;
}
if (inst.componentWillMount) {
if (process.env.NODE_ENV !== 'production') {
measureLifeCyclePerf(function () {
return inst.componentWillMount();
}, debugID, 'componentWillMount');
} else {
inst.componentWillMount();
}
// When mounting, calls to `setState` by `componentWillMount` will set
// `this._pendingStateQueue` without triggering a re-render.
if (this._pendingStateQueue) {
inst.state = this._processPendingState(inst.props, inst.context);
}
}
// If not a stateless component, we now render
if (renderedElement === undefined) {
renderedElement = this._renderValidatedComponent();
}
var nodeType = ReactNodeTypes.getType(renderedElement);
this._renderedNodeType = nodeType;
var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
);
this._renderedComponent = child;
var markup = ReactReconciler.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID);
if (process.env.NODE_ENV !== 'production') {
if (debugID !== 0) {
var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
}
}
return markup;
},
getHostNode: function () {
return ReactReconciler.getHostNode(this._renderedComponent);
},
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function (safely) {
if (!this._renderedComponent) {
return;
}
var inst = this._instance;
if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) {
inst._calledComponentWillUnmount = true;
if (safely) {
var name = this.getName() + '.componentWillUnmount()';
ReactErrorUtils.invokeGuardedCallback(name, inst.componentWillUnmount.bind(inst));
} else {
if (process.env.NODE_ENV !== 'production') {
measureLifeCyclePerf(function () {
return inst.componentWillUnmount();
}, this._debugID, 'componentWillUnmount');
} else {
inst.componentWillUnmount();
}
}
}
if (this._renderedComponent) {
ReactReconciler.unmountComponent(this._renderedComponent, safely);
this._renderedNodeType = null;
this._renderedComponent = null;
this._instance = null;
}
// Reset pending fields
// Even if this component is scheduled for another update in ReactUpdates,
// it would still be ignored because these fields are reset.
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._pendingCallbacks = null;
this._pendingElement = null;
// These fields do not really need to be reset since this object is no
// longer accessible.
this._context = null;
this._rootNodeID = 0;
this._topLevelWrapper = null;
// Delete the reference from the instance to this internal representation
// which allow the internals to be properly cleaned up even if the user
// leaks a reference to the public instance.
ReactInstanceMap.remove(inst);
// Some existing components rely on inst.props even after they've been
// destroyed (in event handlers).
// TODO: inst.props = null;
// TODO: inst.state = null;
// TODO: inst.context = null;
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`
*
* @param {object} context
* @return {?object}
* @private
*/
_maskContext: function (context) {
var Component = this._currentElement.type;
var contextTypes = Component.contextTypes;
if (!contextTypes) {
return emptyObject;
}
var maskedContext = {};
for (var contextName in contextTypes) {
maskedContext[contextName] = context[contextName];
}
return maskedContext;
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`, and asserts that they are valid.
*
* @param {object} context
* @return {?object}
* @private
*/
_processContext: function (context) {
var maskedContext = this._maskContext(context);
if (process.env.NODE_ENV !== 'production') {
var Component = this._currentElement.type;
if (Component.contextTypes) {
this._checkContextTypes(Component.contextTypes, maskedContext, 'context');
}
}
return maskedContext;
},
/**
* @param {object} currentContext
* @return {object}
* @private
*/
_processChildContext: function (currentContext) {
var Component = this._currentElement.type;
var inst = this._instance;
var childContext;
if (inst.getChildContext) {
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onBeginProcessingChildContext();
try {
childContext = inst.getChildContext();
} finally {
ReactInstrumentation.debugTool.onEndProcessingChildContext();
}
} else {
childContext = inst.getChildContext();
}
}
if (childContext) {
!(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().', this.getName() || 'ReactCompositeComponent') : _prodInvariant('107', this.getName() || 'ReactCompositeComponent') : void 0;
if (process.env.NODE_ENV !== 'production') {
this._checkContextTypes(Component.childContextTypes, childContext, 'child context');
}
for (var name in childContext) {
!(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : _prodInvariant('108', this.getName() || 'ReactCompositeComponent', name) : void 0;
}
return _assign({}, currentContext, childContext);
}
return currentContext;
},
/**
* Assert that the context types are valid
*
* @param {object} typeSpecs Map of context field to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
_checkContextTypes: function (typeSpecs, values, location) {
if (process.env.NODE_ENV !== 'production') {
checkReactTypeSpec(typeSpecs, values, location, this.getName(), null, this._debugID);
}
},
receiveComponent: function (nextElement, transaction, nextContext) {
var prevElement = this._currentElement;
var prevContext = this._context;
this._pendingElement = null;
this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
},
/**
* If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
* is set, update the component.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function (transaction) {
if (this._pendingElement != null) {
ReactReconciler.receiveComponent(this, this._pendingElement, transaction, this._context);
} else if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
} else {
this._updateBatchNumber = null;
}
},
/**
* Perform an update to a mounted component. The componentWillReceiveProps and
* shouldComponentUpdate methods are called, then (assuming the update isn't
* skipped) the remaining update lifecycle methods are called and the DOM
* representation is updated.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactElement} prevParentElement
* @param {ReactElement} nextParentElement
* @internal
* @overridable
*/
updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
var inst = this._instance;
!(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Attempted to update component `%s` that has already been unmounted (or failed to mount).', this.getName() || 'ReactCompositeComponent') : _prodInvariant('136', this.getName() || 'ReactCompositeComponent') : void 0;
var willReceive = false;
var nextContext;
// Determine if the context has changed or not
if (this._context === nextUnmaskedContext) {
nextContext = inst.context;
} else {
nextContext = this._processContext(nextUnmaskedContext);
willReceive = true;
}
var prevProps = prevParentElement.props;
var nextProps = nextParentElement.props;
// Not a simple state update but a props update
if (prevParentElement !== nextParentElement) {
willReceive = true;
}
// An update here will schedule an update but immediately set
// _pendingStateQueue which will ensure that any state updates gets
// immediately reconciled instead of waiting for the next batch.
if (willReceive && inst.componentWillReceiveProps) {
if (process.env.NODE_ENV !== 'production') {
measureLifeCyclePerf(function () {
return inst.componentWillReceiveProps(nextProps, nextContext);
}, this._debugID, 'componentWillReceiveProps');
} else {
inst.componentWillReceiveProps(nextProps, nextContext);
}
}
var nextState = this._processPendingState(nextProps, nextContext);
var shouldUpdate = true;
if (!this._pendingForceUpdate) {
if (inst.shouldComponentUpdate) {
if (process.env.NODE_ENV !== 'production') {
shouldUpdate = measureLifeCyclePerf(function () {
return inst.shouldComponentUpdate(nextProps, nextState, nextContext);
}, this._debugID, 'shouldComponentUpdate');
} else {
shouldUpdate = inst.shouldComponentUpdate(nextProps, nextState, nextContext);
}
} else {
if (this._compositeType === CompositeTypes.PureClass) {
shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState);
}
}
}
if (process.env.NODE_ENV !== 'production') {
process.env.NODE_ENV !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0;
}
this._updateBatchNumber = null;
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
} else {
// If it's determined that a component should not update, we still want
// to set props and state but we shortcut the rest of the update.
this._currentElement = nextParentElement;
this._context = nextUnmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
}
},
_processPendingState: function (props, context) {
var inst = this._instance;
var queue = this._pendingStateQueue;
var replace = this._pendingReplaceState;
this._pendingReplaceState = false;
this._pendingStateQueue = null;
if (!queue) {
return inst.state;
}
if (replace && queue.length === 1) {
return queue[0];
}
var nextState = _assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
_assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
}
return nextState;
},
/**
* Merges new props and state, notifies delegate methods of update and
* performs update.
*
* @param {ReactElement} nextElement Next element
* @param {object} nextProps Next public object to set as properties.
* @param {?object} nextState Next object to set as state.
* @param {?object} nextContext Next public object to set as context.
* @param {ReactReconcileTransaction} transaction
* @param {?object} unmaskedContext
* @private
*/
_performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
var _this2 = this;
var inst = this._instance;
var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
var prevProps;
var prevState;
var prevContext;
if (hasComponentDidUpdate) {
prevProps = inst.props;
prevState = inst.state;
prevContext = inst.context;
}
if (inst.componentWillUpdate) {
if (process.env.NODE_ENV !== 'production') {
measureLifeCyclePerf(function () {
return inst.componentWillUpdate(nextProps, nextState, nextContext);
}, this._debugID, 'componentWillUpdate');
} else {
inst.componentWillUpdate(nextProps, nextState, nextContext);
}
}
this._currentElement = nextElement;
this._context = unmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
this._updateRenderedComponent(transaction, unmaskedContext);
if (hasComponentDidUpdate) {
if (process.env.NODE_ENV !== 'production') {
transaction.getReactMountReady().enqueue(function () {
measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), _this2._debugID, 'componentDidUpdate');
});
} else {
transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
}
}
},
/**
* Call the component's `render` method and update the DOM accordingly.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
_updateRenderedComponent: function (transaction, context) {
var prevComponentInstance = this._renderedComponent;
var prevRenderedElement = prevComponentInstance._currentElement;
var nextRenderedElement = this._renderValidatedComponent();
var debugID = 0;
if (process.env.NODE_ENV !== 'production') {
debugID = this._debugID;
}
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
} else {
var oldHostNode = ReactReconciler.getHostNode(prevComponentInstance);
ReactReconciler.unmountComponent(prevComponentInstance, false);
var nodeType = ReactNodeTypes.getType(nextRenderedElement);
this._renderedNodeType = nodeType;
var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes.EMPTY /* shouldHaveDebugID */
);
this._renderedComponent = child;
var nextMarkup = ReactReconciler.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID);
if (process.env.NODE_ENV !== 'production') {
if (debugID !== 0) {
var childDebugIDs = child._debugID !== 0 ? [child._debugID] : [];
ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs);
}
}
this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance);
}
},
/**
* Overridden in shallow rendering.
*
* @protected
*/
_replaceNodeWithMarkup: function (oldHostNode, nextMarkup, prevInstance) {
ReactComponentEnvironment.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance);
},
/**
* @protected
*/
_renderValidatedComponentWithoutOwnerOrContext: function () {
var inst = this._instance;
var renderedElement;
if (process.env.NODE_ENV !== 'production') {
renderedElement = measureLifeCyclePerf(function () {
return inst.render();
}, this._debugID, 'render');
} else {
renderedElement = inst.render();
}
if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (renderedElement === undefined && inst.render._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
renderedElement = null;
}
}
return renderedElement;
},
/**
* @private
*/
_renderValidatedComponent: function () {
var renderedElement;
if (process.env.NODE_ENV !== 'production' || this._compositeType !== CompositeTypes.StatelessFunctional) {
ReactCurrentOwner.current = this;
try {
renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
} finally {
ReactCurrentOwner.current = null;
}
} else {
renderedElement = this._renderValidatedComponentWithoutOwnerOrContext();
}
!(
// TODO: An `isValidNode` function would probably be more appropriate
renderedElement === null || renderedElement === false || React.isValidElement(renderedElement)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : _prodInvariant('109', this.getName() || 'ReactCompositeComponent') : void 0;
return renderedElement;
},
/**
* Lazily allocates the refs object and stores `component` as `ref`.
*
* @param {string} ref Reference name.
* @param {component} component Component to store as `ref`.
* @final
* @private
*/
attachRef: function (ref, component) {
var inst = this.getPublicInstance();
!(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : _prodInvariant('110') : void 0;
var publicComponentInstance = component.getPublicInstance();
if (process.env.NODE_ENV !== 'production') {
var componentName = component && component.getName ? component.getName() : 'a component';
process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null || component._compositeType !== CompositeTypes.StatelessFunctional, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : void 0;
}
var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
refs[ref] = publicComponentInstance;
},
/**
* Detaches a reference name.
*
* @param {string} ref Name to dereference.
* @final
* @private
*/
detachRef: function (ref) {
var refs = this.getPublicInstance().refs;
delete refs[ref];
},
/**
* Get a text description of the component that can be used to identify it
* in error messages.
* @return {string} The name or null.
* @internal
*/
getName: function () {
var type = this._currentElement.type;
var constructor = this._instance && this._instance.constructor;
return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
},
/**
* Get the publicly accessible representation of this component - i.e. what
* is exposed by refs and returned by render. Can be null for stateless
* components.
*
* @return {ReactComponent} the public component instance.
* @internal
*/
getPublicInstance: function () {
var inst = this._instance;
if (this._compositeType === CompositeTypes.StatelessFunctional) {
return null;
}
return inst;
},
// Stub
_instantiateReactComponent: null
};
module.exports = ReactCompositeComponent;
|
ajax/libs/react-virtualized/9.0.4/react-virtualized.js
|
nolsherry/cdnjs
|
!function(root, factory) {
"object" == typeof exports && "object" == typeof module ? module.exports = factory(require("React"), require("ReactDOM")) : "function" == typeof define && define.amd ? define([ "React", "ReactDOM" ], factory) : "object" == typeof exports ? exports.ReactVirtualized = factory(require("React"), require("ReactDOM")) : root.ReactVirtualized = factory(root.React, root.ReactDOM);
}(this, function(__WEBPACK_EXTERNAL_MODULE_89__, __WEBPACK_EXTERNAL_MODULE_96__) {
/******/
return function(modules) {
/******/
/******/
// 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: !1
};
/******/
/******/
// Return the exports of the module
/******/
/******/
/******/
// Execute the module function
/******/
/******/
/******/
// Flag the module as loaded
/******/
return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__),
module.loaded = !0, module.exports;
}
// webpackBootstrap
/******/
// The module cache
/******/
var installedModules = {};
/******/
/******/
// Load entry module and return exports
/******/
/******/
/******/
/******/
// expose the modules object (__webpack_modules__)
/******/
/******/
/******/
// expose the module cache
/******/
/******/
/******/
// __webpack_public_path__
/******/
return __webpack_require__.m = modules, __webpack_require__.c = installedModules,
__webpack_require__.p = "", __webpack_require__(0);
}([ /* 0 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _ArrowKeyStepper = __webpack_require__(1);
Object.defineProperty(exports, "ArrowKeyStepper", {
enumerable: !0,
get: function() {
return _ArrowKeyStepper.ArrowKeyStepper;
}
});
var _AutoSizer = __webpack_require__(90);
Object.defineProperty(exports, "AutoSizer", {
enumerable: !0,
get: function() {
return _AutoSizer.AutoSizer;
}
});
var _CellMeasurer = __webpack_require__(93);
Object.defineProperty(exports, "CellMeasurer", {
enumerable: !0,
get: function() {
return _CellMeasurer.CellMeasurer;
}
}), Object.defineProperty(exports, "CellMeasurerCache", {
enumerable: !0,
get: function() {
return _CellMeasurer.CellMeasurerCache;
}
});
var _Collection = __webpack_require__(98);
Object.defineProperty(exports, "Collection", {
enumerable: !0,
get: function() {
return _Collection.Collection;
}
});
var _ColumnSizer = __webpack_require__(118);
Object.defineProperty(exports, "ColumnSizer", {
enumerable: !0,
get: function() {
return _ColumnSizer.ColumnSizer;
}
});
var _Table = __webpack_require__(120);
Object.defineProperty(exports, "defaultTableCellDataGetter", {
enumerable: !0,
get: function() {
return _Table.defaultCellDataGetter;
}
}), Object.defineProperty(exports, "defaultTableCellRenderer", {
enumerable: !0,
get: function() {
return _Table.defaultCellRenderer;
}
}), Object.defineProperty(exports, "defaultTableHeaderRenderer", {
enumerable: !0,
get: function() {
return _Table.defaultHeaderRenderer;
}
}), Object.defineProperty(exports, "defaultTableRowRenderer", {
enumerable: !0,
get: function() {
return _Table.defaultRowRenderer;
}
}), Object.defineProperty(exports, "Table", {
enumerable: !0,
get: function() {
return _Table.Table;
}
}), Object.defineProperty(exports, "Column", {
enumerable: !0,
get: function() {
return _Table.Column;
}
}), Object.defineProperty(exports, "SortDirection", {
enumerable: !0,
get: function() {
return _Table.SortDirection;
}
}), Object.defineProperty(exports, "SortIndicator", {
enumerable: !0,
get: function() {
return _Table.SortIndicator;
}
});
var _Grid = __webpack_require__(128);
Object.defineProperty(exports, "defaultCellRangeRenderer", {
enumerable: !0,
get: function() {
return _Grid.defaultCellRangeRenderer;
}
}), Object.defineProperty(exports, "Grid", {
enumerable: !0,
get: function() {
return _Grid.Grid;
}
});
var _InfiniteLoader = __webpack_require__(137);
Object.defineProperty(exports, "InfiniteLoader", {
enumerable: !0,
get: function() {
return _InfiniteLoader.InfiniteLoader;
}
});
var _List = __webpack_require__(139);
Object.defineProperty(exports, "List", {
enumerable: !0,
get: function() {
return _List.List;
}
});
var _MultiGrid = __webpack_require__(144);
Object.defineProperty(exports, "MultiGrid", {
enumerable: !0,
get: function() {
return _MultiGrid.MultiGrid;
}
});
var _ScrollSync = __webpack_require__(146);
Object.defineProperty(exports, "ScrollSync", {
enumerable: !0,
get: function() {
return _ScrollSync.ScrollSync;
}
});
var _WindowScroller = __webpack_require__(148);
Object.defineProperty(exports, "WindowScroller", {
enumerable: !0,
get: function() {
return _WindowScroller.WindowScroller;
}
});
}, /* 1 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.ArrowKeyStepper = exports.default = void 0;
var _ArrowKeyStepper2 = __webpack_require__(2), _ArrowKeyStepper3 = _interopRequireDefault(_ArrowKeyStepper2);
exports.default = _ArrowKeyStepper3.default, exports.ArrowKeyStepper = _ArrowKeyStepper3.default;
}, /* 2 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(89), _react2 = _interopRequireDefault(_react), ArrowKeyStepper = function(_PureComponent) {
function ArrowKeyStepper(props, context) {
(0, _classCallCheck3.default)(this, ArrowKeyStepper);
var _this = (0, _possibleConstructorReturn3.default)(this, (ArrowKeyStepper.__proto__ || (0,
_getPrototypeOf2.default)(ArrowKeyStepper)).call(this, props, context));
return _this.state = {
scrollToColumn: props.scrollToColumn,
scrollToRow: props.scrollToRow
}, _this._columnStartIndex = 0, _this._columnStopIndex = 0, _this._rowStartIndex = 0,
_this._rowStopIndex = 0, _this._onKeyDown = _this._onKeyDown.bind(_this), _this._onSectionRendered = _this._onSectionRendered.bind(_this),
_this;
}
return (0, _inherits3.default)(ArrowKeyStepper, _PureComponent), (0, _createClass3.default)(ArrowKeyStepper, [ {
key: "componentWillReceiveProps",
value: function(nextProps) {
var scrollToColumn = nextProps.scrollToColumn, scrollToRow = nextProps.scrollToRow, _props = this.props, prevScrollToColumn = _props.scrollToColumn, prevScrollToRow = _props.scrollToRow;
prevScrollToColumn !== scrollToColumn && prevScrollToRow !== scrollToRow ? this.setState({
scrollToColumn: scrollToColumn,
scrollToRow: scrollToRow
}) : prevScrollToColumn !== scrollToColumn ? this.setState({
scrollToColumn: scrollToColumn
}) : prevScrollToRow !== scrollToRow && this.setState({
scrollToRow: scrollToRow
});
}
}, {
key: "render",
value: function() {
var _props2 = this.props, className = _props2.className, children = _props2.children, _state = this.state, scrollToColumn = _state.scrollToColumn, scrollToRow = _state.scrollToRow;
return _react2.default.createElement("div", {
className: className,
onKeyDown: this._onKeyDown
}, children({
onSectionRendered: this._onSectionRendered,
scrollToColumn: scrollToColumn,
scrollToRow: scrollToRow
}));
}
}, {
key: "_onKeyDown",
value: function(event) {
var _props3 = this.props, columnCount = _props3.columnCount, disabled = _props3.disabled, mode = _props3.mode, rowCount = _props3.rowCount;
if (!disabled) {
var _state2 = this.state, scrollToColumnPrevious = _state2.scrollToColumn, scrollToRowPrevious = _state2.scrollToRow, _state3 = this.state, scrollToColumn = _state3.scrollToColumn, scrollToRow = _state3.scrollToRow;
switch (event.key) {
case "ArrowDown":
scrollToRow = "cells" === mode ? Math.min(scrollToRow + 1, rowCount - 1) : Math.min(this._rowStopIndex + 1, rowCount - 1);
break;
case "ArrowLeft":
scrollToColumn = "cells" === mode ? Math.max(scrollToColumn - 1, 0) : Math.max(this._columnStartIndex - 1, 0);
break;
case "ArrowRight":
scrollToColumn = "cells" === mode ? Math.min(scrollToColumn + 1, columnCount - 1) : Math.min(this._columnStopIndex + 1, columnCount - 1);
break;
case "ArrowUp":
scrollToRow = "cells" === mode ? Math.max(scrollToRow - 1, 0) : Math.max(this._rowStartIndex - 1, 0);
}
scrollToColumn === scrollToColumnPrevious && scrollToRow === scrollToRowPrevious || (event.preventDefault(),
this.setState({
scrollToColumn: scrollToColumn,
scrollToRow: scrollToRow
}));
}
}
}, {
key: "_onSectionRendered",
value: function(_ref) {
var columnStartIndex = _ref.columnStartIndex, columnStopIndex = _ref.columnStopIndex, rowStartIndex = _ref.rowStartIndex, rowStopIndex = _ref.rowStopIndex;
this._columnStartIndex = columnStartIndex, this._columnStopIndex = columnStopIndex,
this._rowStartIndex = rowStartIndex, this._rowStopIndex = rowStopIndex;
}
} ]), ArrowKeyStepper;
}(_react.PureComponent);
ArrowKeyStepper.defaultProps = {
disabled: !1,
mode: "edges",
scrollToColumn: 0,
scrollToRow: 0
}, exports.default = ArrowKeyStepper;
}, /* 3 */
/***/
function(module, exports, __webpack_require__) {
module.exports = {
default: __webpack_require__(4),
__esModule: !0
};
}, /* 4 */
/***/
function(module, exports, __webpack_require__) {
__webpack_require__(5), module.exports = __webpack_require__(16).Object.getPrototypeOf;
}, /* 5 */
/***/
function(module, exports, __webpack_require__) {
// 19.1.2.9 Object.getPrototypeOf(O)
var toObject = __webpack_require__(6), $getPrototypeOf = __webpack_require__(8);
__webpack_require__(14)("getPrototypeOf", function() {
return function(it) {
return $getPrototypeOf(toObject(it));
};
});
}, /* 6 */
/***/
function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(7);
module.exports = function(it) {
return Object(defined(it));
};
}, /* 7 */
/***/
function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function(it) {
if (void 0 == it) throw TypeError("Can't call method on " + it);
return it;
};
}, /* 8 */
/***/
function(module, exports, __webpack_require__) {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has = __webpack_require__(9), toObject = __webpack_require__(6), IE_PROTO = __webpack_require__(10)("IE_PROTO"), ObjectProto = Object.prototype;
module.exports = Object.getPrototypeOf || function(O) {
return O = toObject(O), has(O, IE_PROTO) ? O[IE_PROTO] : "function" == typeof O.constructor && O instanceof O.constructor ? O.constructor.prototype : O instanceof Object ? ObjectProto : null;
};
}, /* 9 */
/***/
function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function(it, key) {
return hasOwnProperty.call(it, key);
};
}, /* 10 */
/***/
function(module, exports, __webpack_require__) {
var shared = __webpack_require__(11)("keys"), uid = __webpack_require__(13);
module.exports = function(key) {
return shared[key] || (shared[key] = uid(key));
};
}, /* 11 */
/***/
function(module, exports, __webpack_require__) {
var global = __webpack_require__(12), SHARED = "__core-js_shared__", store = global[SHARED] || (global[SHARED] = {});
module.exports = function(key) {
return store[key] || (store[key] = {});
};
}, /* 12 */
/***/
function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = "undefined" != typeof window && window.Math == Math ? window : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();
"number" == typeof __g && (__g = global);
}, /* 13 */
/***/
function(module, exports) {
var id = 0, px = Math.random();
module.exports = function(key) {
return "Symbol(".concat(void 0 === key ? "" : key, ")_", (++id + px).toString(36));
};
}, /* 14 */
/***/
function(module, exports, __webpack_require__) {
// most Object methods by ES6 should accept primitives
var $export = __webpack_require__(15), core = __webpack_require__(16), fails = __webpack_require__(25);
module.exports = function(KEY, exec) {
var fn = (core.Object || {})[KEY] || Object[KEY], exp = {};
exp[KEY] = exec(fn), $export($export.S + $export.F * fails(function() {
fn(1);
}), "Object", exp);
};
}, /* 15 */
/***/
function(module, exports, __webpack_require__) {
var global = __webpack_require__(12), core = __webpack_require__(16), ctx = __webpack_require__(17), hide = __webpack_require__(19), PROTOTYPE = "prototype", $export = function(type, name, source) {
var key, own, out, IS_FORCED = type & $export.F, IS_GLOBAL = type & $export.G, IS_STATIC = type & $export.S, IS_PROTO = type & $export.P, IS_BIND = type & $export.B, IS_WRAP = type & $export.W, exports = IS_GLOBAL ? core : core[name] || (core[name] = {}), expProto = exports[PROTOTYPE], target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
IS_GLOBAL && (source = name);
for (key in source) // contains in native
own = !IS_FORCED && target && void 0 !== target[key], own && key in exports || (// export native or passed
out = own ? target[key] : source[key], // prevent global pollution for namespaces
exports[key] = IS_GLOBAL && "function" != typeof target[key] ? source[key] : IS_BIND && own ? ctx(out, global) : IS_WRAP && target[key] == out ? function(C) {
var F = function(a, b, c) {
if (this instanceof C) {
switch (arguments.length) {
case 0:
return new C();
case 1:
return new C(a);
case 2:
return new C(a, b);
}
return new C(a, b, c);
}
return C.apply(this, arguments);
};
return F[PROTOTYPE] = C[PROTOTYPE], F;
}(out) : IS_PROTO && "function" == typeof out ? ctx(Function.call, out) : out, // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
IS_PROTO && ((exports.virtual || (exports.virtual = {}))[key] = out, // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
type & $export.R && expProto && !expProto[key] && hide(expProto, key, out)));
};
// type bitmap
$export.F = 1, // forced
$export.G = 2, // global
$export.S = 4, // static
$export.P = 8, // proto
$export.B = 16, // bind
$export.W = 32, // wrap
$export.U = 64, // safe
$export.R = 128, // real proto method for `library`
module.exports = $export;
}, /* 16 */
/***/
function(module, exports) {
var core = module.exports = {
version: "2.4.0"
};
"number" == typeof __e && (__e = core);
}, /* 17 */
/***/
function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(18);
module.exports = function(fn, that, length) {
if (aFunction(fn), void 0 === that) return fn;
switch (length) {
case 1:
return function(a) {
return fn.call(that, a);
};
case 2:
return function(a, b) {
return fn.call(that, a, b);
};
case 3:
return function(a, b, c) {
return fn.call(that, a, b, c);
};
}
return function() {
return fn.apply(that, arguments);
};
};
}, /* 18 */
/***/
function(module, exports) {
module.exports = function(it) {
if ("function" != typeof it) throw TypeError(it + " is not a function!");
return it;
};
}, /* 19 */
/***/
function(module, exports, __webpack_require__) {
var dP = __webpack_require__(20), createDesc = __webpack_require__(28);
module.exports = __webpack_require__(24) ? function(object, key, value) {
return dP.f(object, key, createDesc(1, value));
} : function(object, key, value) {
return object[key] = value, object;
};
}, /* 20 */
/***/
function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(21), IE8_DOM_DEFINE = __webpack_require__(23), toPrimitive = __webpack_require__(27), dP = Object.defineProperty;
exports.f = __webpack_require__(24) ? Object.defineProperty : function(O, P, Attributes) {
if (anObject(O), P = toPrimitive(P, !0), anObject(Attributes), IE8_DOM_DEFINE) try {
return dP(O, P, Attributes);
} catch (e) {}
if ("get" in Attributes || "set" in Attributes) throw TypeError("Accessors not supported!");
return "value" in Attributes && (O[P] = Attributes.value), O;
};
}, /* 21 */
/***/
function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(22);
module.exports = function(it) {
if (!isObject(it)) throw TypeError(it + " is not an object!");
return it;
};
}, /* 22 */
/***/
function(module, exports) {
module.exports = function(it) {
return "object" == typeof it ? null !== it : "function" == typeof it;
};
}, /* 23 */
/***/
function(module, exports, __webpack_require__) {
module.exports = !__webpack_require__(24) && !__webpack_require__(25)(function() {
return 7 != Object.defineProperty(__webpack_require__(26)("div"), "a", {
get: function() {
return 7;
}
}).a;
});
}, /* 24 */
/***/
function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(25)(function() {
return 7 != Object.defineProperty({}, "a", {
get: function() {
return 7;
}
}).a;
});
}, /* 25 */
/***/
function(module, exports) {
module.exports = function(exec) {
try {
return !!exec();
} catch (e) {
return !0;
}
};
}, /* 26 */
/***/
function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(22), document = __webpack_require__(12).document, is = isObject(document) && isObject(document.createElement);
module.exports = function(it) {
return is ? document.createElement(it) : {};
};
}, /* 27 */
/***/
function(module, exports, __webpack_require__) {
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(22);
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function(it, S) {
if (!isObject(it)) return it;
var fn, val;
if (S && "function" == typeof (fn = it.toString) && !isObject(val = fn.call(it))) return val;
if ("function" == typeof (fn = it.valueOf) && !isObject(val = fn.call(it))) return val;
if (!S && "function" == typeof (fn = it.toString) && !isObject(val = fn.call(it))) return val;
throw TypeError("Can't convert object to primitive value");
};
}, /* 28 */
/***/
function(module, exports) {
module.exports = function(bitmap, value) {
return {
enumerable: !(1 & bitmap),
configurable: !(2 & bitmap),
writable: !(4 & bitmap),
value: value
};
};
}, /* 29 */
/***/
function(module, exports) {
"use strict";
exports.__esModule = !0, exports.default = function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
};
}, /* 30 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
exports.__esModule = !0;
var _defineProperty = __webpack_require__(31), _defineProperty2 = _interopRequireDefault(_defineProperty);
exports.default = function() {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0,
"value" in descriptor && (descriptor.writable = !0), (0, _defineProperty2.default)(target, descriptor.key, descriptor);
}
}
return function(Constructor, protoProps, staticProps) {
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps),
Constructor;
};
}();
}, /* 31 */
/***/
function(module, exports, __webpack_require__) {
module.exports = {
default: __webpack_require__(32),
__esModule: !0
};
}, /* 32 */
/***/
function(module, exports, __webpack_require__) {
__webpack_require__(33);
var $Object = __webpack_require__(16).Object;
module.exports = function(it, key, desc) {
return $Object.defineProperty(it, key, desc);
};
}, /* 33 */
/***/
function(module, exports, __webpack_require__) {
var $export = __webpack_require__(15);
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
$export($export.S + $export.F * !__webpack_require__(24), "Object", {
defineProperty: __webpack_require__(20).f
});
}, /* 34 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
exports.__esModule = !0;
var _typeof2 = __webpack_require__(35), _typeof3 = _interopRequireDefault(_typeof2);
exports.default = function(self, call) {
if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !call || "object" !== ("undefined" == typeof call ? "undefined" : (0, _typeof3.default)(call)) && "function" != typeof call ? self : call;
};
}, /* 35 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
exports.__esModule = !0;
var _iterator = __webpack_require__(36), _iterator2 = _interopRequireDefault(_iterator), _symbol = __webpack_require__(65), _symbol2 = _interopRequireDefault(_symbol), _typeof = "function" == typeof _symbol2.default && "symbol" == typeof _iterator2.default ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && "function" == typeof _symbol2.default && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj;
};
exports.default = "function" == typeof _symbol2.default && "symbol" === _typeof(_iterator2.default) ? function(obj) {
return "undefined" == typeof obj ? "undefined" : _typeof(obj);
} : function(obj) {
return obj && "function" == typeof _symbol2.default && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : "undefined" == typeof obj ? "undefined" : _typeof(obj);
};
}, /* 36 */
/***/
function(module, exports, __webpack_require__) {
module.exports = {
default: __webpack_require__(37),
__esModule: !0
};
}, /* 37 */
/***/
function(module, exports, __webpack_require__) {
__webpack_require__(38), __webpack_require__(60), module.exports = __webpack_require__(64).f("iterator");
}, /* 38 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
var $at = __webpack_require__(39)(!0);
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(41)(String, "String", function(iterated) {
this._t = String(iterated), // target
this._i = 0;
}, function() {
var point, O = this._t, index = this._i;
return index >= O.length ? {
value: void 0,
done: !0
} : (point = $at(O, index), this._i += point.length, {
value: point,
done: !1
});
});
}, /* 39 */
/***/
function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(40), defined = __webpack_require__(7);
// true -> String#at
// false -> String#codePointAt
module.exports = function(TO_STRING) {
return function(that, pos) {
var a, b, s = String(defined(that)), i = toInteger(pos), l = s.length;
return i < 0 || i >= l ? TO_STRING ? "" : void 0 : (a = s.charCodeAt(i), a < 55296 || a > 56319 || i + 1 === l || (b = s.charCodeAt(i + 1)) < 56320 || b > 57343 ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 55296 << 10) + (b - 56320) + 65536);
};
};
}, /* 40 */
/***/
function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil, floor = Math.floor;
module.exports = function(it) {
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
}, /* 41 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
var LIBRARY = __webpack_require__(42), $export = __webpack_require__(15), redefine = __webpack_require__(43), hide = __webpack_require__(19), has = __webpack_require__(9), Iterators = __webpack_require__(44), $iterCreate = __webpack_require__(45), setToStringTag = __webpack_require__(58), getPrototypeOf = __webpack_require__(8), ITERATOR = __webpack_require__(59)("iterator"), BUGGY = !([].keys && "next" in [].keys()), FF_ITERATOR = "@@iterator", KEYS = "keys", VALUES = "values", returnThis = function() {
return this;
};
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
$iterCreate(Constructor, NAME, next);
var methods, key, IteratorPrototype, getMethod = function(kind) {
if (!BUGGY && kind in proto) return proto[kind];
switch (kind) {
case KEYS:
return function() {
return new Constructor(this, kind);
};
case VALUES:
return function() {
return new Constructor(this, kind);
};
}
return function() {
return new Constructor(this, kind);
};
}, TAG = NAME + " Iterator", DEF_VALUES = DEFAULT == VALUES, VALUES_BUG = !1, proto = Base.prototype, $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT], $default = $native || getMethod(DEFAULT), $entries = DEFAULT ? DEF_VALUES ? getMethod("entries") : $default : void 0, $anyNative = "Array" == NAME ? proto.entries || $native : $native;
if (// Fix native
$anyNative && (IteratorPrototype = getPrototypeOf($anyNative.call(new Base())),
IteratorPrototype !== Object.prototype && (// Set @@toStringTag to native iterators
setToStringTag(IteratorPrototype, TAG, !0), // fix for some old engines
LIBRARY || has(IteratorPrototype, ITERATOR) || hide(IteratorPrototype, ITERATOR, returnThis))),
// fix Array#{values, @@iterator}.name in V8 / FF
DEF_VALUES && $native && $native.name !== VALUES && (VALUES_BUG = !0, $default = function() {
return $native.call(this);
}), // Define iterator
LIBRARY && !FORCED || !BUGGY && !VALUES_BUG && proto[ITERATOR] || hide(proto, ITERATOR, $default),
// Plug for library
Iterators[NAME] = $default, Iterators[TAG] = returnThis, DEFAULT) if (methods = {
values: DEF_VALUES ? $default : getMethod(VALUES),
keys: IS_SET ? $default : getMethod(KEYS),
entries: $entries
}, FORCED) for (key in methods) key in proto || redefine(proto, key, methods[key]); else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
return methods;
};
}, /* 42 */
/***/
function(module, exports) {
module.exports = !0;
}, /* 43 */
/***/
function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(19);
}, /* 44 */
/***/
function(module, exports) {
module.exports = {};
}, /* 45 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
var create = __webpack_require__(46), descriptor = __webpack_require__(28), setToStringTag = __webpack_require__(58), IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
__webpack_require__(19)(IteratorPrototype, __webpack_require__(59)("iterator"), function() {
return this;
}), module.exports = function(Constructor, NAME, next) {
Constructor.prototype = create(IteratorPrototype, {
next: descriptor(1, next)
}), setToStringTag(Constructor, NAME + " Iterator");
};
}, /* 46 */
/***/
function(module, exports, __webpack_require__) {
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = __webpack_require__(21), dPs = __webpack_require__(47), enumBugKeys = __webpack_require__(56), IE_PROTO = __webpack_require__(10)("IE_PROTO"), Empty = function() {}, PROTOTYPE = "prototype", createDict = function() {
// Thrash, waste and sodomy: IE GC bug
var iframeDocument, iframe = __webpack_require__(26)("iframe"), i = enumBugKeys.length, lt = "<", gt = ">";
for (iframe.style.display = "none", __webpack_require__(57).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(lt + "script" + gt + "document.F=Object" + lt + "/script" + gt),
iframeDocument.close(), createDict = iframeDocument.F; i--; ) delete createDict[PROTOTYPE][enumBugKeys[i]];
return createDict();
};
module.exports = Object.create || function(O, Properties) {
var result;
// add "__proto__" for Object.getPrototypeOf polyfill
return null !== O ? (Empty[PROTOTYPE] = anObject(O), result = new Empty(), Empty[PROTOTYPE] = null,
result[IE_PROTO] = O) : result = createDict(), void 0 === Properties ? result : dPs(result, Properties);
};
}, /* 47 */
/***/
function(module, exports, __webpack_require__) {
var dP = __webpack_require__(20), anObject = __webpack_require__(21), getKeys = __webpack_require__(48);
module.exports = __webpack_require__(24) ? Object.defineProperties : function(O, Properties) {
anObject(O);
for (var P, keys = getKeys(Properties), length = keys.length, i = 0; length > i; ) dP.f(O, P = keys[i++], Properties[P]);
return O;
};
}, /* 48 */
/***/
function(module, exports, __webpack_require__) {
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(49), enumBugKeys = __webpack_require__(56);
module.exports = Object.keys || function(O) {
return $keys(O, enumBugKeys);
};
}, /* 49 */
/***/
function(module, exports, __webpack_require__) {
var has = __webpack_require__(9), toIObject = __webpack_require__(50), arrayIndexOf = __webpack_require__(53)(!1), IE_PROTO = __webpack_require__(10)("IE_PROTO");
module.exports = function(object, names) {
var key, O = toIObject(object), i = 0, result = [];
for (key in O) key != IE_PROTO && has(O, key) && result.push(key);
// Don't enum bug & hidden keys
for (;names.length > i; ) has(O, key = names[i++]) && (~arrayIndexOf(result, key) || result.push(key));
return result;
};
}, /* 50 */
/***/
function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(51), defined = __webpack_require__(7);
module.exports = function(it) {
return IObject(defined(it));
};
}, /* 51 */
/***/
function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(52);
module.exports = Object("z").propertyIsEnumerable(0) ? Object : function(it) {
return "String" == cof(it) ? it.split("") : Object(it);
};
}, /* 52 */
/***/
function(module, exports) {
var toString = {}.toString;
module.exports = function(it) {
return toString.call(it).slice(8, -1);
};
}, /* 53 */
/***/
function(module, exports, __webpack_require__) {
// false -> Array#indexOf
// true -> Array#includes
var toIObject = __webpack_require__(50), toLength = __webpack_require__(54), toIndex = __webpack_require__(55);
module.exports = function(IS_INCLUDES) {
return function($this, el, fromIndex) {
var value, O = toIObject($this), length = toLength(O.length), index = toIndex(fromIndex, length);
// Array#includes uses SameValueZero equality algorithm
if (IS_INCLUDES && el != el) {
for (;length > index; ) if (value = O[index++], value != value) return !0;
} else for (;length > index; index++) if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
return !IS_INCLUDES && -1;
};
};
}, /* 54 */
/***/
function(module, exports, __webpack_require__) {
// 7.1.15 ToLength
var toInteger = __webpack_require__(40), min = Math.min;
module.exports = function(it) {
return it > 0 ? min(toInteger(it), 9007199254740991) : 0;
};
}, /* 55 */
/***/
function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(40), max = Math.max, min = Math.min;
module.exports = function(index, length) {
return index = toInteger(index), index < 0 ? max(index + length, 0) : min(index, length);
};
}, /* 56 */
/***/
function(module, exports) {
// IE 8- don't enum bug keys
module.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");
}, /* 57 */
/***/
function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(12).document && document.documentElement;
}, /* 58 */
/***/
function(module, exports, __webpack_require__) {
var def = __webpack_require__(20).f, has = __webpack_require__(9), TAG = __webpack_require__(59)("toStringTag");
module.exports = function(it, tag, stat) {
it && !has(it = stat ? it : it.prototype, TAG) && def(it, TAG, {
configurable: !0,
value: tag
});
};
}, /* 59 */
/***/
function(module, exports, __webpack_require__) {
var store = __webpack_require__(11)("wks"), uid = __webpack_require__(13), Symbol = __webpack_require__(12).Symbol, USE_SYMBOL = "function" == typeof Symbol, $exports = module.exports = function(name) {
return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)("Symbol." + name));
};
$exports.store = store;
}, /* 60 */
/***/
function(module, exports, __webpack_require__) {
__webpack_require__(61);
for (var global = __webpack_require__(12), hide = __webpack_require__(19), Iterators = __webpack_require__(44), TO_STRING_TAG = __webpack_require__(59)("toStringTag"), collections = [ "NodeList", "DOMTokenList", "MediaList", "StyleSheetList", "CSSRuleList" ], i = 0; i < 5; i++) {
var NAME = collections[i], Collection = global[NAME], proto = Collection && Collection.prototype;
proto && !proto[TO_STRING_TAG] && hide(proto, TO_STRING_TAG, NAME), Iterators[NAME] = Iterators.Array;
}
}, /* 61 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
var addToUnscopables = __webpack_require__(62), step = __webpack_require__(63), Iterators = __webpack_require__(44), toIObject = __webpack_require__(50);
// 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]()
module.exports = __webpack_require__(41)(Array, "Array", function(iterated, kind) {
this._t = toIObject(iterated), // target
this._i = 0, // next index
this._k = kind;
}, function() {
var O = this._t, kind = this._k, index = this._i++;
return !O || index >= O.length ? (this._t = void 0, step(1)) : "keys" == kind ? step(0, index) : "values" == kind ? step(0, O[index]) : step(0, [ index, O[index] ]);
}, "values"), // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array, addToUnscopables("keys"), addToUnscopables("values"),
addToUnscopables("entries");
}, /* 62 */
/***/
function(module, exports) {
module.exports = function() {};
}, /* 63 */
/***/
function(module, exports) {
module.exports = function(done, value) {
return {
value: value,
done: !!done
};
};
}, /* 64 */
/***/
function(module, exports, __webpack_require__) {
exports.f = __webpack_require__(59);
}, /* 65 */
/***/
function(module, exports, __webpack_require__) {
module.exports = {
default: __webpack_require__(66),
__esModule: !0
};
}, /* 66 */
/***/
function(module, exports, __webpack_require__) {
__webpack_require__(67), __webpack_require__(78), __webpack_require__(79), __webpack_require__(80),
module.exports = __webpack_require__(16).Symbol;
}, /* 67 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
// ECMAScript 6 symbols shim
var global = __webpack_require__(12), has = __webpack_require__(9), DESCRIPTORS = __webpack_require__(24), $export = __webpack_require__(15), redefine = __webpack_require__(43), META = __webpack_require__(68).KEY, $fails = __webpack_require__(25), shared = __webpack_require__(11), setToStringTag = __webpack_require__(58), uid = __webpack_require__(13), wks = __webpack_require__(59), wksExt = __webpack_require__(64), wksDefine = __webpack_require__(69), keyOf = __webpack_require__(70), enumKeys = __webpack_require__(71), isArray = __webpack_require__(74), anObject = __webpack_require__(21), toIObject = __webpack_require__(50), toPrimitive = __webpack_require__(27), createDesc = __webpack_require__(28), _create = __webpack_require__(46), gOPNExt = __webpack_require__(75), $GOPD = __webpack_require__(77), $DP = __webpack_require__(20), $keys = __webpack_require__(48), gOPD = $GOPD.f, dP = $DP.f, gOPN = gOPNExt.f, $Symbol = global.Symbol, $JSON = global.JSON, _stringify = $JSON && $JSON.stringify, PROTOTYPE = "prototype", HIDDEN = wks("_hidden"), TO_PRIMITIVE = wks("toPrimitive"), isEnum = {}.propertyIsEnumerable, SymbolRegistry = shared("symbol-registry"), AllSymbols = shared("symbols"), OPSymbols = shared("op-symbols"), ObjectProto = Object[PROTOTYPE], USE_NATIVE = "function" == typeof $Symbol, QObject = global.QObject, setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild, setSymbolDesc = DESCRIPTORS && $fails(function() {
return 7 != _create(dP({}, "a", {
get: function() {
return dP(this, "a", {
value: 7
}).a;
}
})).a;
}) ? function(it, key, D) {
var protoDesc = gOPD(ObjectProto, key);
protoDesc && delete ObjectProto[key], dP(it, key, D), protoDesc && it !== ObjectProto && dP(ObjectProto, key, protoDesc);
} : dP, wrap = function(tag) {
var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
return sym._k = tag, sym;
}, isSymbol = USE_NATIVE && "symbol" == typeof $Symbol.iterator ? function(it) {
return "symbol" == typeof it;
} : function(it) {
return it instanceof $Symbol;
}, $defineProperty = function(it, key, D) {
return it === ObjectProto && $defineProperty(OPSymbols, key, D), anObject(it), key = toPrimitive(key, !0),
anObject(D), has(AllSymbols, key) ? (D.enumerable ? (has(it, HIDDEN) && it[HIDDEN][key] && (it[HIDDEN][key] = !1),
D = _create(D, {
enumerable: createDesc(0, !1)
})) : (has(it, HIDDEN) || dP(it, HIDDEN, createDesc(1, {})), it[HIDDEN][key] = !0),
setSymbolDesc(it, key, D)) : dP(it, key, D);
}, $defineProperties = function(it, P) {
anObject(it);
for (var key, keys = enumKeys(P = toIObject(P)), i = 0, l = keys.length; l > i; ) $defineProperty(it, key = keys[i++], P[key]);
return it;
}, $create = function(it, P) {
return void 0 === P ? _create(it) : $defineProperties(_create(it), P);
}, $propertyIsEnumerable = function(key) {
var E = isEnum.call(this, key = toPrimitive(key, !0));
return !(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) && (!(E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key]) || E);
}, $getOwnPropertyDescriptor = function(it, key) {
if (it = toIObject(it), key = toPrimitive(key, !0), it !== ObjectProto || !has(AllSymbols, key) || has(OPSymbols, key)) {
var D = gOPD(it, key);
return !D || !has(AllSymbols, key) || has(it, HIDDEN) && it[HIDDEN][key] || (D.enumerable = !0),
D;
}
}, $getOwnPropertyNames = function(it) {
for (var key, names = gOPN(toIObject(it)), result = [], i = 0; names.length > i; ) has(AllSymbols, key = names[i++]) || key == HIDDEN || key == META || result.push(key);
return result;
}, $getOwnPropertySymbols = function(it) {
for (var key, IS_OP = it === ObjectProto, names = gOPN(IS_OP ? OPSymbols : toIObject(it)), result = [], i = 0; names.length > i; ) !has(AllSymbols, key = names[i++]) || IS_OP && !has(ObjectProto, key) || result.push(AllSymbols[key]);
return result;
};
// 19.4.1.1 Symbol([description])
USE_NATIVE || ($Symbol = function() {
if (this instanceof $Symbol) throw TypeError("Symbol is not a constructor!");
var tag = uid(arguments.length > 0 ? arguments[0] : void 0), $set = function(value) {
this === ObjectProto && $set.call(OPSymbols, value), has(this, HIDDEN) && has(this[HIDDEN], tag) && (this[HIDDEN][tag] = !1),
setSymbolDesc(this, tag, createDesc(1, value));
};
return DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, {
configurable: !0,
set: $set
}), wrap(tag);
}, redefine($Symbol[PROTOTYPE], "toString", function() {
return this._k;
}), $GOPD.f = $getOwnPropertyDescriptor, $DP.f = $defineProperty, __webpack_require__(76).f = gOPNExt.f = $getOwnPropertyNames,
__webpack_require__(73).f = $propertyIsEnumerable, __webpack_require__(72).f = $getOwnPropertySymbols,
DESCRIPTORS && !__webpack_require__(42) && redefine(ObjectProto, "propertyIsEnumerable", $propertyIsEnumerable, !0),
wksExt.f = function(name) {
return wrap(wks(name));
}), $export($export.G + $export.W + $export.F * !USE_NATIVE, {
Symbol: $Symbol
});
for (var symbols = "hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","), i = 0; symbols.length > i; ) wks(symbols[i++]);
for (var symbols = $keys(wks.store), i = 0; symbols.length > i; ) wksDefine(symbols[i++]);
$export($export.S + $export.F * !USE_NATIVE, "Symbol", {
// 19.4.2.1 Symbol.for(key)
for: function(key) {
return has(SymbolRegistry, key += "") ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key);
},
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: function(key) {
if (isSymbol(key)) return keyOf(SymbolRegistry, key);
throw TypeError(key + " is not a symbol!");
},
useSetter: function() {
setter = !0;
},
useSimple: function() {
setter = !1;
}
}), $export($export.S + $export.F * !USE_NATIVE, "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
}), // 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function() {
var S = $Symbol();
// MS Edge converts symbol values to JSON as {}
// WebKit converts symbol values to JSON as null
// V8 throws on boxed symbols
return "[null]" != _stringify([ S ]) || "{}" != _stringify({
a: S
}) || "{}" != _stringify(Object(S));
})), "JSON", {
stringify: function(it) {
if (void 0 !== it && !isSymbol(it)) {
for (// IE8 returns string on undefined
var replacer, $replacer, args = [ it ], i = 1; arguments.length > i; ) args.push(arguments[i++]);
return replacer = args[1], "function" == typeof replacer && ($replacer = replacer),
!$replacer && isArray(replacer) || (replacer = function(key, value) {
if ($replacer && (value = $replacer.call(this, key, value)), !isSymbol(value)) return value;
}), args[1] = replacer, _stringify.apply($JSON, args);
}
}
}), // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(19)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf),
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol, "Symbol"), // 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, "Math", !0), // 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, "JSON", !0);
}, /* 68 */
/***/
function(module, exports, __webpack_require__) {
var META = __webpack_require__(13)("meta"), isObject = __webpack_require__(22), has = __webpack_require__(9), setDesc = __webpack_require__(20).f, id = 0, isExtensible = Object.isExtensible || function() {
return !0;
}, FREEZE = !__webpack_require__(25)(function() {
return isExtensible(Object.preventExtensions({}));
}), setMeta = function(it) {
setDesc(it, META, {
value: {
i: "O" + ++id,
// object ID
w: {}
}
});
}, fastKey = function(it, create) {
// return primitive with prefix
if (!isObject(it)) return "symbol" == typeof it ? it : ("string" == typeof it ? "S" : "P") + it;
if (!has(it, META)) {
// can't set metadata to uncaught frozen object
if (!isExtensible(it)) return "F";
// not necessary to add metadata
if (!create) return "E";
// add missing metadata
setMeta(it);
}
return it[META].i;
}, getWeak = function(it, create) {
if (!has(it, META)) {
// can't set metadata to uncaught frozen object
if (!isExtensible(it)) return !0;
// not necessary to add metadata
if (!create) return !1;
// add missing metadata
setMeta(it);
}
return it[META].w;
}, onFreeze = function(it) {
return FREEZE && meta.NEED && isExtensible(it) && !has(it, META) && setMeta(it),
it;
}, meta = module.exports = {
KEY: META,
NEED: !1,
fastKey: fastKey,
getWeak: getWeak,
onFreeze: onFreeze
};
}, /* 69 */
/***/
function(module, exports, __webpack_require__) {
var global = __webpack_require__(12), core = __webpack_require__(16), LIBRARY = __webpack_require__(42), wksExt = __webpack_require__(64), defineProperty = __webpack_require__(20).f;
module.exports = function(name) {
var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
"_" == name.charAt(0) || name in $Symbol || defineProperty($Symbol, name, {
value: wksExt.f(name)
});
};
}, /* 70 */
/***/
function(module, exports, __webpack_require__) {
var getKeys = __webpack_require__(48), toIObject = __webpack_require__(50);
module.exports = function(object, el) {
for (var key, O = toIObject(object), keys = getKeys(O), length = keys.length, index = 0; length > index; ) if (O[key = keys[index++]] === el) return key;
};
}, /* 71 */
/***/
function(module, exports, __webpack_require__) {
// all enumerable object keys, includes symbols
var getKeys = __webpack_require__(48), gOPS = __webpack_require__(72), pIE = __webpack_require__(73);
module.exports = function(it) {
var result = getKeys(it), getSymbols = gOPS.f;
if (getSymbols) for (var key, symbols = getSymbols(it), isEnum = pIE.f, i = 0; symbols.length > i; ) isEnum.call(it, key = symbols[i++]) && result.push(key);
return result;
};
}, /* 72 */
/***/
function(module, exports) {
exports.f = Object.getOwnPropertySymbols;
}, /* 73 */
/***/
function(module, exports) {
exports.f = {}.propertyIsEnumerable;
}, /* 74 */
/***/
function(module, exports, __webpack_require__) {
// 7.2.2 IsArray(argument)
var cof = __webpack_require__(52);
module.exports = Array.isArray || function(arg) {
return "Array" == cof(arg);
};
}, /* 75 */
/***/
function(module, exports, __webpack_require__) {
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toIObject = __webpack_require__(50), gOPN = __webpack_require__(76).f, toString = {}.toString, windowNames = "object" == typeof window && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [], getWindowNames = function(it) {
try {
return gOPN(it);
} catch (e) {
return windowNames.slice();
}
};
module.exports.f = function(it) {
return windowNames && "[object Window]" == toString.call(it) ? getWindowNames(it) : gOPN(toIObject(it));
};
}, /* 76 */
/***/
function(module, exports, __webpack_require__) {
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys = __webpack_require__(49), hiddenKeys = __webpack_require__(56).concat("length", "prototype");
exports.f = Object.getOwnPropertyNames || function(O) {
return $keys(O, hiddenKeys);
};
}, /* 77 */
/***/
function(module, exports, __webpack_require__) {
var pIE = __webpack_require__(73), createDesc = __webpack_require__(28), toIObject = __webpack_require__(50), toPrimitive = __webpack_require__(27), has = __webpack_require__(9), IE8_DOM_DEFINE = __webpack_require__(23), gOPD = Object.getOwnPropertyDescriptor;
exports.f = __webpack_require__(24) ? gOPD : function(O, P) {
if (O = toIObject(O), P = toPrimitive(P, !0), IE8_DOM_DEFINE) try {
return gOPD(O, P);
} catch (e) {}
if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
};
}, /* 78 */
/***/
function(module, exports) {}, /* 79 */
/***/
function(module, exports, __webpack_require__) {
__webpack_require__(69)("asyncIterator");
}, /* 80 */
/***/
function(module, exports, __webpack_require__) {
__webpack_require__(69)("observable");
}, /* 81 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
exports.__esModule = !0;
var _setPrototypeOf = __webpack_require__(82), _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf), _create = __webpack_require__(86), _create2 = _interopRequireDefault(_create), _typeof2 = __webpack_require__(35), _typeof3 = _interopRequireDefault(_typeof2);
exports.default = function(subClass, superClass) {
if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + ("undefined" == typeof superClass ? "undefined" : (0,
_typeof3.default)(superClass)));
subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: !1,
writable: !0,
configurable: !0
}
}), superClass && (_setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass);
};
}, /* 82 */
/***/
function(module, exports, __webpack_require__) {
module.exports = {
default: __webpack_require__(83),
__esModule: !0
};
}, /* 83 */
/***/
function(module, exports, __webpack_require__) {
__webpack_require__(84), module.exports = __webpack_require__(16).Object.setPrototypeOf;
}, /* 84 */
/***/
function(module, exports, __webpack_require__) {
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $export = __webpack_require__(15);
$export($export.S, "Object", {
setPrototypeOf: __webpack_require__(85).set
});
}, /* 85 */
/***/
function(module, exports, __webpack_require__) {
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var isObject = __webpack_require__(22), anObject = __webpack_require__(21), check = function(O, proto) {
if (anObject(O), !isObject(proto) && null !== proto) throw TypeError(proto + ": can't set as prototype!");
};
module.exports = {
set: Object.setPrototypeOf || ("__proto__" in {} ? // eslint-disable-line
function(test, buggy, set) {
try {
set = __webpack_require__(17)(Function.call, __webpack_require__(77).f(Object.prototype, "__proto__").set, 2),
set(test, []), buggy = !(test instanceof Array);
} catch (e) {
buggy = !0;
}
return function(O, proto) {
return check(O, proto), buggy ? O.__proto__ = proto : set(O, proto), O;
};
}({}, !1) : void 0),
check: check
};
}, /* 86 */
/***/
function(module, exports, __webpack_require__) {
module.exports = {
default: __webpack_require__(87),
__esModule: !0
};
}, /* 87 */
/***/
function(module, exports, __webpack_require__) {
__webpack_require__(88);
var $Object = __webpack_require__(16).Object;
module.exports = function(P, D) {
return $Object.create(P, D);
};
}, /* 88 */
/***/
function(module, exports, __webpack_require__) {
var $export = __webpack_require__(15);
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
$export($export.S, "Object", {
create: __webpack_require__(46)
});
}, /* 89 */
/***/
function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_89__;
}, /* 90 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.AutoSizer = exports.default = void 0;
var _AutoSizer2 = __webpack_require__(91), _AutoSizer3 = _interopRequireDefault(_AutoSizer2);
exports.default = _AutoSizer3.default, exports.AutoSizer = _AutoSizer3.default;
}, /* 91 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(89), _react2 = _interopRequireDefault(_react), _detectElementResize = __webpack_require__(92), _detectElementResize2 = _interopRequireDefault(_detectElementResize), AutoSizer = function(_PureComponent) {
function AutoSizer(props) {
(0, _classCallCheck3.default)(this, AutoSizer);
var _this = (0, _possibleConstructorReturn3.default)(this, (AutoSizer.__proto__ || (0,
_getPrototypeOf2.default)(AutoSizer)).call(this, props));
return _this.state = {
height: 0,
width: 0
}, _this._onResize = _this._onResize.bind(_this), _this._setRef = _this._setRef.bind(_this),
_this;
}
return (0, _inherits3.default)(AutoSizer, _PureComponent), (0, _createClass3.default)(AutoSizer, [ {
key: "componentDidMount",
value: function() {
this._parentNode = this._autoSizer.parentNode, this._detectElementResize = (0, _detectElementResize2.default)(),
this._detectElementResize.addResizeListener(this._parentNode, this._onResize), this._onResize();
}
}, {
key: "componentWillUnmount",
value: function() {
this._detectElementResize && this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
}
}, {
key: "render",
value: function() {
var _props = this.props, children = _props.children, disableHeight = _props.disableHeight, disableWidth = _props.disableWidth, _state = this.state, height = _state.height, width = _state.width, outerStyle = {
overflow: "visible"
};
return disableHeight || (outerStyle.height = 0), disableWidth || (outerStyle.width = 0),
_react2.default.createElement("div", {
ref: this._setRef,
style: outerStyle
}, children({
height: height,
width: width
}));
}
}, {
key: "_onResize",
value: function() {
var onResize = this.props.onResize, boundingRect = this._parentNode.getBoundingClientRect(), height = boundingRect.height || 0, width = boundingRect.width || 0, style = window.getComputedStyle(this._parentNode) || {}, paddingLeft = parseInt(style.paddingLeft, 10) || 0, paddingRight = parseInt(style.paddingRight, 10) || 0, paddingTop = parseInt(style.paddingTop, 10) || 0, paddingBottom = parseInt(style.paddingBottom, 10) || 0;
this.setState({
height: height - paddingTop - paddingBottom,
width: width - paddingLeft - paddingRight
}), onResize({
height: height,
width: width
});
}
}, {
key: "_setRef",
value: function(autoSizer) {
this._autoSizer = autoSizer;
}
} ]), AutoSizer;
}(_react.PureComponent);
AutoSizer.defaultProps = {
onResize: function() {}
}, exports.default = AutoSizer;
}, /* 92 */
/***/
function(module, exports) {
"use strict";
function createDetectElementResize() {
var _window;
_window = "undefined" != typeof window ? window : "undefined" != typeof self ? self : this;
var attachEvent = "undefined" != typeof document && document.attachEvent;
if (!attachEvent) {
var requestFrame = function() {
var raf = _window.requestAnimationFrame || _window.mozRequestAnimationFrame || _window.webkitRequestAnimationFrame || function(fn) {
return _window.setTimeout(fn, 20);
};
return function(fn) {
return raf(fn);
};
}(), cancelFrame = function() {
var cancel = _window.cancelAnimationFrame || _window.mozCancelAnimationFrame || _window.webkitCancelAnimationFrame || _window.clearTimeout;
return function(id) {
return cancel(id);
};
}(), resetTriggers = function(element) {
var triggers = element.__resizeTriggers__, expand = triggers.firstElementChild, contract = triggers.lastElementChild, expandChild = expand.firstElementChild;
contract.scrollLeft = contract.scrollWidth, contract.scrollTop = contract.scrollHeight,
expandChild.style.width = expand.offsetWidth + 1 + "px", expandChild.style.height = expand.offsetHeight + 1 + "px",
expand.scrollLeft = expand.scrollWidth, expand.scrollTop = expand.scrollHeight;
}, checkTriggers = function(element) {
return element.offsetWidth != element.__resizeLast__.width || element.offsetHeight != element.__resizeLast__.height;
}, scrollListener = function(e) {
if (!(e.target.className.indexOf("contract-trigger") < 0 && e.target.className.indexOf("expand-trigger") < 0)) {
var element = this;
resetTriggers(this), this.__resizeRAF__ && cancelFrame(this.__resizeRAF__), this.__resizeRAF__ = requestFrame(function() {
checkTriggers(element) && (element.__resizeLast__.width = element.offsetWidth, element.__resizeLast__.height = element.offsetHeight,
element.__resizeListeners__.forEach(function(fn) {
fn.call(element, e);
}));
});
}
}, animation = !1, animationstring = "animation", keyframeprefix = "", animationstartevent = "animationstart", domPrefixes = "Webkit Moz O ms".split(" "), startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), pfx = "", elm = document.createElement("fakeelement");
if (void 0 !== elm.style.animationName && (animation = !0), animation === !1) for (var i = 0; i < domPrefixes.length; i++) if (void 0 !== elm.style[domPrefixes[i] + "AnimationName"]) {
pfx = domPrefixes[i], animationstring = pfx + "Animation", keyframeprefix = "-" + pfx.toLowerCase() + "-",
animationstartevent = startEvents[i], animation = !0;
break;
}
var animationName = "resizeanim", animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ", animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
}
var createStyles = function() {
if (!document.getElementById("detectElementResize")) {
var css = (animationKeyframes ? animationKeyframes : "") + ".resize-triggers { " + (animationStyle ? animationStyle : "") + 'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', head = document.head || document.getElementsByTagName("head")[0], style = document.createElement("style");
style.id = "detectElementResize", style.type = "text/css", style.styleSheet ? style.styleSheet.cssText = css : style.appendChild(document.createTextNode(css)),
head.appendChild(style);
}
}, addResizeListener = function(element, fn) {
if (attachEvent) element.attachEvent("onresize", fn); else {
if (!element.__resizeTriggers__) {
var elementStyle = _window.getComputedStyle(element);
elementStyle && "static" == elementStyle.position && (element.style.position = "relative"),
createStyles(), element.__resizeLast__ = {}, element.__resizeListeners__ = [], (element.__resizeTriggers__ = document.createElement("div")).className = "resize-triggers",
element.__resizeTriggers__.innerHTML = '<div class="expand-trigger"><div></div></div><div class="contract-trigger"></div>',
element.appendChild(element.__resizeTriggers__), resetTriggers(element), element.addEventListener("scroll", scrollListener, !0),
animationstartevent && (element.__resizeTriggers__.__animationListener__ = function(e) {
e.animationName == animationName && resetTriggers(element);
}, element.__resizeTriggers__.addEventListener(animationstartevent, element.__resizeTriggers__.__animationListener__));
}
element.__resizeListeners__.push(fn);
}
}, removeResizeListener = function(element, fn) {
if (attachEvent) element.detachEvent("onresize", fn); else if (element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1),
!element.__resizeListeners__.length) {
element.removeEventListener("scroll", scrollListener, !0), element.__resizeTriggers__.__animationListener__ && (element.__resizeTriggers__.removeEventListener(animationstartevent, element.__resizeTriggers__.__animationListener__),
element.__resizeTriggers__.__animationListener__ = null);
try {
element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
} catch (e) {}
}
};
return {
addResizeListener: addResizeListener,
removeResizeListener: removeResizeListener
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = createDetectElementResize;
}, /* 93 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.CellMeasurerCache = exports.CellMeasurer = exports.default = void 0;
var _CellMeasurer2 = __webpack_require__(94), _CellMeasurer3 = _interopRequireDefault(_CellMeasurer2), _CellMeasurerCache2 = __webpack_require__(97), _CellMeasurerCache3 = _interopRequireDefault(_CellMeasurerCache2);
exports.default = _CellMeasurer3.default, exports.CellMeasurer = _CellMeasurer3.default,
exports.CellMeasurerCache = _CellMeasurerCache3.default;
}, /* 94 */
/***/
function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */
(function(process) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function warnAboutImproperUse(parent) {
"production" !== process.env.NODE_ENV && parent && void 0 === parent.props.deferredMeasurementCache && parent.__warnedAboutImproperUse !== !0 && (parent.__warnedAboutImproperUse = !0,
console.warn("CellMeasurer should be rendered within a Grid that has a deferredMeasurementCache prop."));
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(89), _reactDom = __webpack_require__(96), EMPTY_OBJECT = {}, CellMeasurer = function(_PureComponent) {
function CellMeasurer(props, context) {
(0, _classCallCheck3.default)(this, CellMeasurer);
var _this = (0, _possibleConstructorReturn3.default)(this, (CellMeasurer.__proto__ || (0,
_getPrototypeOf2.default)(CellMeasurer)).call(this, props, context));
return _this._measure = _this._measure.bind(_this), _this;
}
return (0, _inherits3.default)(CellMeasurer, _PureComponent), (0, _createClass3.default)(CellMeasurer, [ {
key: "componentDidMount",
value: function() {
this._maybeMeasureCell();
}
}, {
key: "componentDidUpdate",
value: function(prevProps, prevState) {
this._maybeMeasureCell();
}
}, {
key: "render",
value: function() {
var children = this.props.children;
if ("production" !== process.env.NODE_ENV) {
var _parent = this.props.parent;
warnAboutImproperUse(_parent);
}
return "function" == typeof children ? children({
measure: this._measure
}) : children;
}
}, {
key: "_maybeMeasureCell",
value: function() {
var _props = this.props, cache = _props.cache, columnIndex = _props.columnIndex, parent = _props.parent, rowIndex = _props.rowIndex;
if (!cache.has(rowIndex, columnIndex)) {
var node = (0, _reactDom.findDOMNode)(this), height = node.offsetHeight, width = node.offsetWidth;
cache.set(rowIndex, columnIndex, width, height), void 0 !== parent && parent.invalidateCellSizeAfterRender({
columnIndex: columnIndex,
rowIndex: rowIndex
});
}
}
}, {
key: "_measure",
value: function() {
var _props2 = this.props, cache = _props2.cache, columnIndex = _props2.columnIndex, parent = _props2.parent, rowIndex = _props2.rowIndex, node = (0,
_reactDom.findDOMNode)(this), height = node.offsetHeight, width = node.offsetWidth;
height === cache.getHeight(rowIndex, columnIndex) && width === cache.getWidth(rowIndex, columnIndex) || (cache.set(rowIndex, columnIndex, width, height),
parent.recomputeGridSize({
columnIndex: columnIndex,
rowIndex: rowIndex
}));
}
} ]), CellMeasurer;
}(_react.PureComponent);
CellMeasurer.defaultProps = {
style: EMPTY_OBJECT
}, exports.default = CellMeasurer;
}).call(exports, __webpack_require__(95));
}, /* 95 */
/***/
function(module, exports) {
function defaultSetTimout() {
throw new Error("setTimeout has not been defined");
}
function defaultClearTimeout() {
throw new Error("clearTimeout has not been defined");
}
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) //normal enviroments in sane situations
return setTimeout(fun, 0);
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) return cachedSetTimeout = setTimeout,
setTimeout(fun, 0);
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch (e) {
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch (e) {
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) //normal enviroments in sane situations
return clearTimeout(marker);
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) return cachedClearTimeout = clearTimeout,
clearTimeout(marker);
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e) {
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e) {
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
function cleanUpNextTick() {
draining && currentQueue && (draining = !1, currentQueue.length ? queue = currentQueue.concat(queue) : queueIndex = -1,
queue.length && drainQueue());
}
function drainQueue() {
if (!draining) {
var timeout = runTimeout(cleanUpNextTick);
draining = !0;
for (var len = queue.length; len; ) {
for (currentQueue = queue, queue = []; ++queueIndex < len; ) currentQueue && currentQueue[queueIndex].run();
queueIndex = -1, len = queue.length;
}
currentQueue = null, draining = !1, runClearTimeout(timeout);
}
}
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun, this.array = array;
}
function noop() {}
// shim for using process in browser
var cachedSetTimeout, cachedClearTimeout, process = module.exports = {};
!function() {
try {
cachedSetTimeout = "function" == typeof setTimeout ? setTimeout : defaultSetTimout;
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
cachedClearTimeout = "function" == typeof clearTimeout ? clearTimeout : defaultClearTimeout;
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
}();
var currentQueue, queue = [], draining = !1, queueIndex = -1;
process.nextTick = function(fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) for (var i = 1; i < arguments.length; i++) args[i - 1] = arguments[i];
queue.push(new Item(fun, args)), 1 !== queue.length || draining || runTimeout(drainQueue);
}, Item.prototype.run = function() {
this.fun.apply(null, this.array);
}, process.title = "browser", process.browser = !0, process.env = {}, process.argv = [],
process.version = "", // empty string to avoid regexp issues
process.versions = {}, process.on = noop, process.addListener = noop, process.once = noop,
process.off = noop, process.removeListener = noop, process.removeAllListeners = noop,
process.emit = noop, process.binding = function(name) {
throw new Error("process.binding is not supported");
}, process.cwd = function() {
return "/";
}, process.chdir = function(dir) {
throw new Error("process.chdir is not supported");
}, process.umask = function() {
return 0;
};
}, /* 96 */
/***/
function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_96__;
}, /* 97 */
/***/
function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */
(function(process) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function defaultKeyMapper(rowIndex, columnIndex) {
return rowIndex + "-" + columnIndex;
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.DEFAULT_WIDTH = exports.DEFAULT_HEIGHT = void 0;
var _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), DEFAULT_HEIGHT = exports.DEFAULT_HEIGHT = 30, DEFAULT_WIDTH = exports.DEFAULT_WIDTH = 100, CellMeasurerCache = function() {
function CellMeasurerCache() {
var _this = this, params = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
(0, _classCallCheck3.default)(this, CellMeasurerCache), this.columnWidth = function(_ref) {
var index = _ref.index;
return _this._columnWidthCache.hasOwnProperty(index) ? _this._columnWidthCache[index] : _this._defaultWidth;
}, this.rowHeight = function(_ref2) {
var index = _ref2.index;
return _this._rowHeightCache.hasOwnProperty(index) ? _this._rowHeightCache[index] : _this._defaultHeight;
};
var defaultHeight = params.defaultHeight, defaultWidth = params.defaultWidth, fixedHeight = params.fixedHeight, fixedWidth = params.fixedWidth, keyMapper = params.keyMapper, minHeight = params.minHeight, minWidth = params.minWidth;
this._hasFixedHeight = fixedHeight === !0, this._hasFixedWidth = fixedWidth === !0,
this._minHeight = minHeight || 0, this._minWidth = minWidth || 0, this._keyMapper = keyMapper || defaultKeyMapper,
this._defaultHeight = Math.max(this._minHeight, "number" == typeof defaultHeight ? defaultHeight : DEFAULT_HEIGHT),
this._defaultWidth = Math.max(this._minWidth, "number" == typeof defaultWidth ? defaultWidth : DEFAULT_WIDTH),
"production" !== process.env.NODE_ENV && (this._hasFixedHeight === !1 && this._hasFixedWidth === !1 && console.warn("CellMeasurerCache should only measure a cell's width or height. You have configured CellMeasurerCache to measure both. This will result in poor performance."),
this._hasFixedHeight === !1 && 0 === this._defaultHeight && console.warn("Fixed height CellMeasurerCache should specify a :defaultHeight greater than 0. Failing to do so will lead to unnecessary layout and poor performance."),
this._hasFixedWidth === !1 && 0 === this._defaultWidth && console.warn("Fixed width CellMeasurerCache should specify a :defaultWidth greater than 0. Failing to do so will lead to unnecessary layout and poor performance.")),
this._columnCount = 0, this._rowCount = 0, this._cellHeightCache = {}, this._cellWidthCache = {},
this._columnWidthCache = {}, this._rowHeightCache = {};
}
return (0, _createClass3.default)(CellMeasurerCache, [ {
key: "clear",
value: function(rowIndex, columnIndex) {
var key = this._keyMapper(rowIndex, columnIndex);
delete this._cellHeightCache[key], delete this._cellWidthCache[key];
}
}, {
key: "clearAll",
value: function() {
this._cellHeightCache = {}, this._cellWidthCache = {};
}
}, {
key: "hasFixedHeight",
value: function() {
return this._hasFixedHeight;
}
}, {
key: "hasFixedWidth",
value: function() {
return this._hasFixedWidth;
}
}, {
key: "getHeight",
value: function(rowIndex, columnIndex) {
var key = this._keyMapper(rowIndex, columnIndex);
return this._cellHeightCache.hasOwnProperty(key) ? Math.max(this._minHeight, this._cellHeightCache[key]) : this._defaultHeight;
}
}, {
key: "getWidth",
value: function(rowIndex, columnIndex) {
var key = this._keyMapper(rowIndex, columnIndex);
return this._cellWidthCache.hasOwnProperty(key) ? Math.max(this._minWidth, this._cellWidthCache[key]) : this._defaultWidth;
}
}, {
key: "has",
value: function(rowIndex, columnIndex) {
var key = this._keyMapper(rowIndex, columnIndex);
return this._cellHeightCache.hasOwnProperty(key);
}
}, {
key: "set",
value: function(rowIndex, columnIndex, width, height) {
var key = this._keyMapper(rowIndex, columnIndex);
columnIndex >= this._columnCount && (this._columnCount = columnIndex + 1), rowIndex >= this._rowCount && (this._rowCount = rowIndex + 1),
this._cellHeightCache[key] = height, this._cellWidthCache[key] = width;
for (var columnWidth = 0, i = 0; i < this._rowCount; i++) columnWidth = Math.max(columnWidth, this.getWidth(i, columnIndex));
for (var rowHeight = 0, _i = 0; _i < this._columnCount; _i++) rowHeight = Math.max(rowHeight, this.getHeight(rowIndex, _i));
this._columnWidthCache[columnIndex] = columnWidth, this._rowHeightCache[rowIndex] = rowHeight;
}
} ]), CellMeasurerCache;
}();
exports.default = CellMeasurerCache;
}).call(exports, __webpack_require__(95));
}, /* 98 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.Collection = exports.default = void 0;
var _Collection2 = __webpack_require__(99), _Collection3 = _interopRequireDefault(_Collection2);
exports.default = _Collection3.default, exports.Collection = _Collection3.default;
}, /* 99 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function defaultCellGroupRenderer(_ref4) {
var cellCache = _ref4.cellCache, cellRenderer = _ref4.cellRenderer, cellSizeAndPositionGetter = _ref4.cellSizeAndPositionGetter, indices = _ref4.indices, isScrolling = _ref4.isScrolling;
return indices.map(function(index) {
var cellMetadata = cellSizeAndPositionGetter({
index: index
}), cellRendererProps = {
index: index,
isScrolling: isScrolling,
key: index,
style: {
height: cellMetadata.height,
left: cellMetadata.x,
position: "absolute",
top: cellMetadata.y,
width: cellMetadata.width
}
};
return isScrolling ? (index in cellCache || (cellCache[index] = cellRenderer(cellRendererProps)),
cellCache[index]) : cellRenderer(cellRendererProps);
}).filter(function(renderedCell) {
return !!renderedCell;
});
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _extends2 = __webpack_require__(100), _extends3 = _interopRequireDefault(_extends2), _objectWithoutProperties2 = __webpack_require__(105), _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2), _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(89), _react2 = _interopRequireDefault(_react), _CollectionView = __webpack_require__(106), _CollectionView2 = _interopRequireDefault(_CollectionView), _calculateSizeAndPositionData2 = __webpack_require__(114), _calculateSizeAndPositionData3 = _interopRequireDefault(_calculateSizeAndPositionData2), _getUpdatedOffsetForIndex = __webpack_require__(117), _getUpdatedOffsetForIndex2 = _interopRequireDefault(_getUpdatedOffsetForIndex), Collection = function(_PureComponent) {
function Collection(props, context) {
(0, _classCallCheck3.default)(this, Collection);
var _this = (0, _possibleConstructorReturn3.default)(this, (Collection.__proto__ || (0,
_getPrototypeOf2.default)(Collection)).call(this, props, context));
return _this._cellMetadata = [], _this._lastRenderedCellIndices = [], _this._cellCache = [],
_this._isScrollingChange = _this._isScrollingChange.bind(_this), _this._setCollectionViewRef = _this._setCollectionViewRef.bind(_this),
_this;
}
return (0, _inherits3.default)(Collection, _PureComponent), (0, _createClass3.default)(Collection, [ {
key: "forceUpdate",
value: function() {
void 0 !== this._collectionView && this._collectionView.forceUpdate();
}
}, {
key: "recomputeCellSizesAndPositions",
value: function() {
this._cellCache = [], this._collectionView.recomputeCellSizesAndPositions();
}
}, {
key: "render",
value: function() {
var props = (0, _objectWithoutProperties3.default)(this.props, []);
return _react2.default.createElement(_CollectionView2.default, (0, _extends3.default)({
cellLayoutManager: this,
isScrollingChange: this._isScrollingChange,
ref: this._setCollectionViewRef
}, props));
}
}, {
key: "calculateSizeAndPositionData",
value: function() {
var _props = this.props, cellCount = _props.cellCount, cellSizeAndPositionGetter = _props.cellSizeAndPositionGetter, sectionSize = _props.sectionSize, data = (0,
_calculateSizeAndPositionData3.default)({
cellCount: cellCount,
cellSizeAndPositionGetter: cellSizeAndPositionGetter,
sectionSize: sectionSize
});
this._cellMetadata = data.cellMetadata, this._sectionManager = data.sectionManager,
this._height = data.height, this._width = data.width;
}
}, {
key: "getLastRenderedIndices",
value: function() {
return this._lastRenderedCellIndices;
}
}, {
key: "getScrollPositionForCell",
value: function(_ref) {
var align = _ref.align, cellIndex = _ref.cellIndex, height = _ref.height, scrollLeft = _ref.scrollLeft, scrollTop = _ref.scrollTop, width = _ref.width, cellCount = this.props.cellCount;
if (cellIndex >= 0 && cellIndex < cellCount) {
var cellMetadata = this._cellMetadata[cellIndex];
scrollLeft = (0, _getUpdatedOffsetForIndex2.default)({
align: align,
cellOffset: cellMetadata.x,
cellSize: cellMetadata.width,
containerSize: width,
currentOffset: scrollLeft,
targetIndex: cellIndex
}), scrollTop = (0, _getUpdatedOffsetForIndex2.default)({
align: align,
cellOffset: cellMetadata.y,
cellSize: cellMetadata.height,
containerSize: height,
currentOffset: scrollTop,
targetIndex: cellIndex
});
}
return {
scrollLeft: scrollLeft,
scrollTop: scrollTop
};
}
}, {
key: "getTotalSize",
value: function() {
return {
height: this._height,
width: this._width
};
}
}, {
key: "cellRenderers",
value: function(_ref2) {
var _this2 = this, height = _ref2.height, isScrolling = _ref2.isScrolling, width = _ref2.width, x = _ref2.x, y = _ref2.y, _props2 = this.props, cellGroupRenderer = _props2.cellGroupRenderer, cellRenderer = _props2.cellRenderer;
return this._lastRenderedCellIndices = this._sectionManager.getCellIndices({
height: height,
width: width,
x: x,
y: y
}), cellGroupRenderer({
cellCache: this._cellCache,
cellRenderer: cellRenderer,
cellSizeAndPositionGetter: function(_ref3) {
var index = _ref3.index;
return _this2._sectionManager.getCellMetadata({
index: index
});
},
indices: this._lastRenderedCellIndices,
isScrolling: isScrolling
});
}
}, {
key: "_isScrollingChange",
value: function(isScrolling) {
isScrolling || (this._cellCache = []);
}
}, {
key: "_setCollectionViewRef",
value: function(ref) {
this._collectionView = ref;
}
} ]), Collection;
}(_react.PureComponent);
Collection.defaultProps = {
"aria-label": "grid",
cellGroupRenderer: defaultCellGroupRenderer
}, exports.default = Collection;
}, /* 100 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
exports.__esModule = !0;
var _assign = __webpack_require__(101), _assign2 = _interopRequireDefault(_assign);
exports.default = _assign2.default || function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
}
return target;
};
}, /* 101 */
/***/
function(module, exports, __webpack_require__) {
module.exports = {
default: __webpack_require__(102),
__esModule: !0
};
}, /* 102 */
/***/
function(module, exports, __webpack_require__) {
__webpack_require__(103), module.exports = __webpack_require__(16).Object.assign;
}, /* 103 */
/***/
function(module, exports, __webpack_require__) {
// 19.1.3.1 Object.assign(target, source)
var $export = __webpack_require__(15);
$export($export.S + $export.F, "Object", {
assign: __webpack_require__(104)
});
}, /* 104 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
// 19.1.2.1 Object.assign(target, source, ...)
var getKeys = __webpack_require__(48), gOPS = __webpack_require__(72), pIE = __webpack_require__(73), toObject = __webpack_require__(6), IObject = __webpack_require__(51), $assign = Object.assign;
// should work with symbols and should have deterministic property order (V8 bug)
module.exports = !$assign || __webpack_require__(25)(function() {
var A = {}, B = {}, S = Symbol(), K = "abcdefghijklmnopqrst";
return A[S] = 7, K.split("").forEach(function(k) {
B[k] = k;
}), 7 != $assign({}, A)[S] || Object.keys($assign({}, B)).join("") != K;
}) ? function(target, source) {
for (// eslint-disable-line no-unused-vars
var T = toObject(target), aLen = arguments.length, index = 1, getSymbols = gOPS.f, isEnum = pIE.f; aLen > index; ) for (var key, S = IObject(arguments[index++]), keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S), length = keys.length, j = 0; length > j; ) isEnum.call(S, key = keys[j++]) && (T[key] = S[key]);
return T;
} : $assign;
}, /* 105 */
/***/
function(module, exports) {
"use strict";
exports.__esModule = !0, exports.default = function(obj, keys) {
var target = {};
for (var i in obj) keys.indexOf(i) >= 0 || Object.prototype.hasOwnProperty.call(obj, i) && (target[i] = obj[i]);
return target;
};
}, /* 106 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _extends2 = __webpack_require__(100), _extends3 = _interopRequireDefault(_extends2), _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(89), _react2 = _interopRequireDefault(_react), _classnames = __webpack_require__(107), _classnames2 = _interopRequireDefault(_classnames), _createCallbackMemoizer = __webpack_require__(108), _createCallbackMemoizer2 = _interopRequireDefault(_createCallbackMemoizer), _scrollbarSize = __webpack_require__(112), _scrollbarSize2 = _interopRequireDefault(_scrollbarSize), IS_SCROLLING_TIMEOUT = 150, SCROLL_POSITION_CHANGE_REASONS = {
OBSERVED: "observed",
REQUESTED: "requested"
}, CollectionView = function(_PureComponent) {
function CollectionView(props, context) {
(0, _classCallCheck3.default)(this, CollectionView);
var _this = (0, _possibleConstructorReturn3.default)(this, (CollectionView.__proto__ || (0,
_getPrototypeOf2.default)(CollectionView)).call(this, props, context));
return _this.state = {
isScrolling: !1,
scrollLeft: 0,
scrollTop: 0
}, _this._calculateSizeAndPositionDataOnNextUpdate = !1, _this._onSectionRenderedMemoizer = (0,
_createCallbackMemoizer2.default)(), _this._onScrollMemoizer = (0, _createCallbackMemoizer2.default)(!1),
_this._invokeOnSectionRenderedHelper = _this._invokeOnSectionRenderedHelper.bind(_this),
_this._onScroll = _this._onScroll.bind(_this), _this._setScrollingContainerRef = _this._setScrollingContainerRef.bind(_this),
_this._updateScrollPositionForScrollToCell = _this._updateScrollPositionForScrollToCell.bind(_this),
_this;
}
return (0, _inherits3.default)(CollectionView, _PureComponent), (0, _createClass3.default)(CollectionView, [ {
key: "recomputeCellSizesAndPositions",
value: function() {
this._calculateSizeAndPositionDataOnNextUpdate = !0, this.forceUpdate();
}
}, {
key: "componentDidMount",
value: function() {
var _props = this.props, cellLayoutManager = _props.cellLayoutManager, scrollLeft = _props.scrollLeft, scrollToCell = _props.scrollToCell, scrollTop = _props.scrollTop;
this._scrollbarSizeMeasured || (this._scrollbarSize = (0, _scrollbarSize2.default)(),
this._scrollbarSizeMeasured = !0, this.setState({})), scrollToCell >= 0 ? this._updateScrollPositionForScrollToCell() : (scrollLeft >= 0 || scrollTop >= 0) && this._setScrollPosition({
scrollLeft: scrollLeft,
scrollTop: scrollTop
}), this._invokeOnSectionRenderedHelper();
var _cellLayoutManager$ge = cellLayoutManager.getTotalSize(), totalHeight = _cellLayoutManager$ge.height, totalWidth = _cellLayoutManager$ge.width;
this._invokeOnScrollMemoizer({
scrollLeft: scrollLeft || 0,
scrollTop: scrollTop || 0,
totalHeight: totalHeight,
totalWidth: totalWidth
});
}
}, {
key: "componentDidUpdate",
value: function(prevProps, prevState) {
var _props2 = this.props, height = _props2.height, scrollToAlignment = _props2.scrollToAlignment, scrollToCell = _props2.scrollToCell, width = _props2.width, _state = this.state, scrollLeft = _state.scrollLeft, scrollPositionChangeReason = _state.scrollPositionChangeReason, scrollTop = _state.scrollTop;
scrollPositionChangeReason === SCROLL_POSITION_CHANGE_REASONS.REQUESTED && (scrollLeft >= 0 && scrollLeft !== prevState.scrollLeft && scrollLeft !== this._scrollingContainer.scrollLeft && (this._scrollingContainer.scrollLeft = scrollLeft),
scrollTop >= 0 && scrollTop !== prevState.scrollTop && scrollTop !== this._scrollingContainer.scrollTop && (this._scrollingContainer.scrollTop = scrollTop)),
height === prevProps.height && scrollToAlignment === prevProps.scrollToAlignment && scrollToCell === prevProps.scrollToCell && width === prevProps.width || this._updateScrollPositionForScrollToCell(),
this._invokeOnSectionRenderedHelper();
}
}, {
key: "componentWillMount",
value: function() {
var cellLayoutManager = this.props.cellLayoutManager;
cellLayoutManager.calculateSizeAndPositionData(), this._scrollbarSize = (0, _scrollbarSize2.default)(),
void 0 === this._scrollbarSize ? (this._scrollbarSizeMeasured = !1, this._scrollbarSize = 0) : this._scrollbarSizeMeasured = !0;
}
}, {
key: "componentWillUnmount",
value: function() {
this._disablePointerEventsTimeoutId && clearTimeout(this._disablePointerEventsTimeoutId);
}
}, {
key: "componentWillReceiveProps",
value: function(nextProps) {
var _state2 = this.state, scrollLeft = _state2.scrollLeft, scrollTop = _state2.scrollTop;
0 !== nextProps.cellCount || 0 === scrollLeft && 0 === scrollTop ? nextProps.scrollLeft === this.props.scrollLeft && nextProps.scrollTop === this.props.scrollTop || this._setScrollPosition({
scrollLeft: nextProps.scrollLeft,
scrollTop: nextProps.scrollTop
}) : this._setScrollPosition({
scrollLeft: 0,
scrollTop: 0
}), (nextProps.cellCount !== this.props.cellCount || nextProps.cellLayoutManager !== this.props.cellLayoutManager || this._calculateSizeAndPositionDataOnNextUpdate) && nextProps.cellLayoutManager.calculateSizeAndPositionData(),
this._calculateSizeAndPositionDataOnNextUpdate && (this._calculateSizeAndPositionDataOnNextUpdate = !1);
}
}, {
key: "render",
value: function() {
var _props3 = this.props, autoHeight = _props3.autoHeight, cellCount = _props3.cellCount, cellLayoutManager = _props3.cellLayoutManager, className = _props3.className, height = _props3.height, horizontalOverscanSize = _props3.horizontalOverscanSize, id = _props3.id, noContentRenderer = _props3.noContentRenderer, style = _props3.style, verticalOverscanSize = _props3.verticalOverscanSize, width = _props3.width, _state3 = this.state, isScrolling = _state3.isScrolling, scrollLeft = _state3.scrollLeft, scrollTop = _state3.scrollTop, _cellLayoutManager$ge2 = cellLayoutManager.getTotalSize(), totalHeight = _cellLayoutManager$ge2.height, totalWidth = _cellLayoutManager$ge2.width, left = Math.max(0, scrollLeft - horizontalOverscanSize), top = Math.max(0, scrollTop - verticalOverscanSize), right = Math.min(totalWidth, scrollLeft + width + horizontalOverscanSize), bottom = Math.min(totalHeight, scrollTop + height + verticalOverscanSize), childrenToDisplay = height > 0 && width > 0 ? cellLayoutManager.cellRenderers({
height: bottom - top,
isScrolling: isScrolling,
width: right - left,
x: left,
y: top
}) : [], collectionStyle = {
boxSizing: "border-box",
direction: "ltr",
height: autoHeight ? "auto" : height,
position: "relative",
WebkitOverflowScrolling: "touch",
width: width,
willChange: "transform"
}, verticalScrollBarSize = totalHeight > height ? this._scrollbarSize : 0, horizontalScrollBarSize = totalWidth > width ? this._scrollbarSize : 0;
return collectionStyle.overflowX = totalWidth + verticalScrollBarSize <= width ? "hidden" : "auto",
collectionStyle.overflowY = totalHeight + horizontalScrollBarSize <= height ? "hidden" : "auto",
_react2.default.createElement("div", {
ref: this._setScrollingContainerRef,
"aria-label": this.props["aria-label"],
className: (0, _classnames2.default)("ReactVirtualized__Collection", className),
id: id,
onScroll: this._onScroll,
role: "grid",
style: (0, _extends3.default)({}, collectionStyle, style),
tabIndex: 0
}, cellCount > 0 && _react2.default.createElement("div", {
className: "ReactVirtualized__Collection__innerScrollContainer",
style: {
height: totalHeight,
maxHeight: totalHeight,
maxWidth: totalWidth,
overflow: "hidden",
pointerEvents: isScrolling ? "none" : "",
width: totalWidth
}
}, childrenToDisplay), 0 === cellCount && noContentRenderer());
}
}, {
key: "_enablePointerEventsAfterDelay",
value: function() {
var _this2 = this;
this._disablePointerEventsTimeoutId && clearTimeout(this._disablePointerEventsTimeoutId),
this._disablePointerEventsTimeoutId = setTimeout(function() {
var isScrollingChange = _this2.props.isScrollingChange;
isScrollingChange(!1), _this2._disablePointerEventsTimeoutId = null, _this2.setState({
isScrolling: !1
});
}, IS_SCROLLING_TIMEOUT);
}
}, {
key: "_invokeOnSectionRenderedHelper",
value: function() {
var _props4 = this.props, cellLayoutManager = _props4.cellLayoutManager, onSectionRendered = _props4.onSectionRendered;
this._onSectionRenderedMemoizer({
callback: onSectionRendered,
indices: {
indices: cellLayoutManager.getLastRenderedIndices()
}
});
}
}, {
key: "_invokeOnScrollMemoizer",
value: function(_ref) {
var _this3 = this, scrollLeft = _ref.scrollLeft, scrollTop = _ref.scrollTop, totalHeight = _ref.totalHeight, totalWidth = _ref.totalWidth;
this._onScrollMemoizer({
callback: function(_ref2) {
var scrollLeft = _ref2.scrollLeft, scrollTop = _ref2.scrollTop, _props5 = _this3.props, height = _props5.height, onScroll = _props5.onScroll, width = _props5.width;
onScroll({
clientHeight: height,
clientWidth: width,
scrollHeight: totalHeight,
scrollLeft: scrollLeft,
scrollTop: scrollTop,
scrollWidth: totalWidth
});
},
indices: {
scrollLeft: scrollLeft,
scrollTop: scrollTop
}
});
}
}, {
key: "_setScrollingContainerRef",
value: function(ref) {
this._scrollingContainer = ref;
}
}, {
key: "_setScrollPosition",
value: function(_ref3) {
var scrollLeft = _ref3.scrollLeft, scrollTop = _ref3.scrollTop, newState = {
scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS.REQUESTED
};
scrollLeft >= 0 && (newState.scrollLeft = scrollLeft), scrollTop >= 0 && (newState.scrollTop = scrollTop),
(scrollLeft >= 0 && scrollLeft !== this.state.scrollLeft || scrollTop >= 0 && scrollTop !== this.state.scrollTop) && this.setState(newState);
}
}, {
key: "_updateScrollPositionForScrollToCell",
value: function() {
var _props6 = this.props, cellLayoutManager = _props6.cellLayoutManager, height = _props6.height, scrollToAlignment = _props6.scrollToAlignment, scrollToCell = _props6.scrollToCell, width = _props6.width, _state4 = this.state, scrollLeft = _state4.scrollLeft, scrollTop = _state4.scrollTop;
if (scrollToCell >= 0) {
var scrollPosition = cellLayoutManager.getScrollPositionForCell({
align: scrollToAlignment,
cellIndex: scrollToCell,
height: height,
scrollLeft: scrollLeft,
scrollTop: scrollTop,
width: width
});
scrollPosition.scrollLeft === scrollLeft && scrollPosition.scrollTop === scrollTop || this._setScrollPosition(scrollPosition);
}
}
}, {
key: "_onScroll",
value: function(event) {
if (event.target === this._scrollingContainer) {
this._enablePointerEventsAfterDelay();
var _props7 = this.props, cellLayoutManager = _props7.cellLayoutManager, height = _props7.height, isScrollingChange = _props7.isScrollingChange, width = _props7.width, scrollbarSize = this._scrollbarSize, _cellLayoutManager$ge3 = cellLayoutManager.getTotalSize(), totalHeight = _cellLayoutManager$ge3.height, totalWidth = _cellLayoutManager$ge3.width, scrollLeft = Math.max(0, Math.min(totalWidth - width + scrollbarSize, event.target.scrollLeft)), scrollTop = Math.max(0, Math.min(totalHeight - height + scrollbarSize, event.target.scrollTop));
if (this.state.scrollLeft !== scrollLeft || this.state.scrollTop !== scrollTop) {
var scrollPositionChangeReason = event.cancelable ? SCROLL_POSITION_CHANGE_REASONS.OBSERVED : SCROLL_POSITION_CHANGE_REASONS.REQUESTED;
this.state.isScrolling || isScrollingChange(!0), this.setState({
isScrolling: !0,
scrollLeft: scrollLeft,
scrollPositionChangeReason: scrollPositionChangeReason,
scrollTop: scrollTop
});
}
this._invokeOnScrollMemoizer({
scrollLeft: scrollLeft,
scrollTop: scrollTop,
totalWidth: totalWidth,
totalHeight: totalHeight
});
}
}
} ]), CollectionView;
}(_react.PureComponent);
CollectionView.defaultProps = {
"aria-label": "grid",
horizontalOverscanSize: 0,
noContentRenderer: function() {
return null;
},
onScroll: function() {
return null;
},
onSectionRendered: function() {
return null;
},
scrollToAlignment: "auto",
style: {},
verticalOverscanSize: 0
}, exports.default = CollectionView;
}, /* 107 */
/***/
function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
!function() {
"use strict";
function classNames() {
for (var classes = [], i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (arg) {
var argType = typeof arg;
if ("string" === argType || "number" === argType) classes.push(arg); else if (Array.isArray(arg)) classes.push(classNames.apply(null, arg)); else if ("object" === argType) for (var key in arg) hasOwn.call(arg, key) && arg[key] && classes.push(key);
}
}
return classes.join(" ");
}
var hasOwn = {}.hasOwnProperty;
"undefined" != typeof module && module.exports ? module.exports = classNames : (__WEBPACK_AMD_DEFINE_ARRAY__ = [],
__WEBPACK_AMD_DEFINE_RESULT__ = function() {
return classNames;
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), // register as 'classnames', consistent with npm package name
!(void 0 !== __WEBPACK_AMD_DEFINE_RESULT__ && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)));
}();
}, /* 108 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function createCallbackMemoizer() {
var requireAllKeys = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0], cachedIndices = {};
return function(_ref) {
var callback = _ref.callback, indices = _ref.indices, keys = (0, _keys2.default)(indices), allInitialized = !requireAllKeys || keys.every(function(key) {
var value = indices[key];
return Array.isArray(value) ? value.length > 0 : value >= 0;
}), indexChanged = keys.length !== (0, _keys2.default)(cachedIndices).length || keys.some(function(key) {
var cachedValue = cachedIndices[key], value = indices[key];
return Array.isArray(value) ? cachedValue.join(",") !== value.join(",") : cachedValue !== value;
});
cachedIndices = indices, allInitialized && indexChanged && callback(indices);
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _keys = __webpack_require__(109), _keys2 = _interopRequireDefault(_keys);
exports.default = createCallbackMemoizer;
}, /* 109 */
/***/
function(module, exports, __webpack_require__) {
module.exports = {
default: __webpack_require__(110),
__esModule: !0
};
}, /* 110 */
/***/
function(module, exports, __webpack_require__) {
__webpack_require__(111), module.exports = __webpack_require__(16).Object.keys;
}, /* 111 */
/***/
function(module, exports, __webpack_require__) {
// 19.1.2.14 Object.keys(O)
var toObject = __webpack_require__(6), $keys = __webpack_require__(48);
__webpack_require__(14)("keys", function() {
return function(it) {
return $keys(toObject(it));
};
});
}, /* 112 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = function(recalc) {
if ((!size || recalc) && _inDOM2.default) {
var scrollDiv = document.createElement("div");
scrollDiv.style.position = "absolute", scrollDiv.style.top = "-9999px", scrollDiv.style.width = "50px",
scrollDiv.style.height = "50px", scrollDiv.style.overflow = "scroll", document.body.appendChild(scrollDiv),
size = scrollDiv.offsetWidth - scrollDiv.clientWidth, document.body.removeChild(scrollDiv);
}
return size;
};
var _inDOM = __webpack_require__(113), _inDOM2 = _interopRequireDefault(_inDOM), size = void 0;
module.exports = exports.default;
}, /* 113 */
/***/
function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = !("undefined" == typeof window || !window.document || !window.document.createElement),
module.exports = exports.default;
}, /* 114 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function calculateSizeAndPositionData(_ref) {
for (var cellCount = _ref.cellCount, cellSizeAndPositionGetter = _ref.cellSizeAndPositionGetter, sectionSize = _ref.sectionSize, cellMetadata = [], sectionManager = new _SectionManager2.default(sectionSize), height = 0, width = 0, index = 0; index < cellCount; index++) {
var cellMetadatum = cellSizeAndPositionGetter({
index: index
});
if (null == cellMetadatum.height || isNaN(cellMetadatum.height) || null == cellMetadatum.width || isNaN(cellMetadatum.width) || null == cellMetadatum.x || isNaN(cellMetadatum.x) || null == cellMetadatum.y || isNaN(cellMetadatum.y)) throw Error("Invalid metadata returned for cell " + index + ":\n x:" + cellMetadatum.x + ", y:" + cellMetadatum.y + ", width:" + cellMetadatum.width + ", height:" + cellMetadatum.height);
height = Math.max(height, cellMetadatum.y + cellMetadatum.height), width = Math.max(width, cellMetadatum.x + cellMetadatum.width),
cellMetadata[index] = cellMetadatum, sectionManager.registerCell({
cellMetadatum: cellMetadatum,
index: index
});
}
return {
cellMetadata: cellMetadata,
height: height,
sectionManager: sectionManager,
width: width
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = calculateSizeAndPositionData;
var _SectionManager = __webpack_require__(115), _SectionManager2 = _interopRequireDefault(_SectionManager);
}, /* 115 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _keys = __webpack_require__(109), _keys2 = _interopRequireDefault(_keys), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _Section = __webpack_require__(116), _Section2 = _interopRequireDefault(_Section), SECTION_SIZE = 100, SectionManager = function() {
function SectionManager() {
var sectionSize = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : SECTION_SIZE;
(0, _classCallCheck3.default)(this, SectionManager), this._sectionSize = sectionSize,
this._cellMetadata = [], this._sections = {};
}
return (0, _createClass3.default)(SectionManager, [ {
key: "getCellIndices",
value: function(_ref) {
var height = _ref.height, width = _ref.width, x = _ref.x, y = _ref.y, indices = {};
return this.getSections({
height: height,
width: width,
x: x,
y: y
}).forEach(function(section) {
return section.getCellIndices().forEach(function(index) {
indices[index] = index;
});
}), (0, _keys2.default)(indices).map(function(index) {
return indices[index];
});
}
}, {
key: "getCellMetadata",
value: function(_ref2) {
var index = _ref2.index;
return this._cellMetadata[index];
}
}, {
key: "getSections",
value: function(_ref3) {
for (var height = _ref3.height, width = _ref3.width, x = _ref3.x, y = _ref3.y, sectionXStart = Math.floor(x / this._sectionSize), sectionXStop = Math.floor((x + width - 1) / this._sectionSize), sectionYStart = Math.floor(y / this._sectionSize), sectionYStop = Math.floor((y + height - 1) / this._sectionSize), sections = [], sectionX = sectionXStart; sectionX <= sectionXStop; sectionX++) for (var sectionY = sectionYStart; sectionY <= sectionYStop; sectionY++) {
var key = sectionX + "." + sectionY;
this._sections[key] || (this._sections[key] = new _Section2.default({
height: this._sectionSize,
width: this._sectionSize,
x: sectionX * this._sectionSize,
y: sectionY * this._sectionSize
})), sections.push(this._sections[key]);
}
return sections;
}
}, {
key: "getTotalSectionCount",
value: function() {
return (0, _keys2.default)(this._sections).length;
}
}, {
key: "toString",
value: function() {
var _this = this;
return (0, _keys2.default)(this._sections).map(function(index) {
return _this._sections[index].toString();
});
}
}, {
key: "registerCell",
value: function(_ref4) {
var cellMetadatum = _ref4.cellMetadatum, index = _ref4.index;
this._cellMetadata[index] = cellMetadatum, this.getSections(cellMetadatum).forEach(function(section) {
return section.addCellIndex({
index: index
});
});
}
} ]), SectionManager;
}();
exports.default = SectionManager;
}, /* 116 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), Section = function() {
function Section(_ref) {
var height = _ref.height, width = _ref.width, x = _ref.x, y = _ref.y;
(0, _classCallCheck3.default)(this, Section), this.height = height, this.width = width,
this.x = x, this.y = y, this._indexMap = {}, this._indices = [];
}
return (0, _createClass3.default)(Section, [ {
key: "addCellIndex",
value: function(_ref2) {
var index = _ref2.index;
this._indexMap[index] || (this._indexMap[index] = !0, this._indices.push(index));
}
}, {
key: "getCellIndices",
value: function() {
return this._indices;
}
}, {
key: "toString",
value: function() {
return this.x + "," + this.y + " " + this.width + "x" + this.height;
}
} ]), Section;
}();
exports.default = Section;
}, /* 117 */
/***/
function(module, exports) {
"use strict";
function getUpdatedOffsetForIndex(_ref) {
var _ref$align = _ref.align, align = void 0 === _ref$align ? "auto" : _ref$align, cellOffset = _ref.cellOffset, cellSize = _ref.cellSize, containerSize = _ref.containerSize, currentOffset = _ref.currentOffset, maxOffset = cellOffset, minOffset = maxOffset - containerSize + cellSize;
switch (align) {
case "start":
return maxOffset;
case "end":
return minOffset;
case "center":
return maxOffset - (containerSize - cellSize) / 2;
default:
return Math.max(minOffset, Math.min(maxOffset, currentOffset));
}
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = getUpdatedOffsetForIndex;
}, /* 118 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.ColumnSizer = exports.default = void 0;
var _ColumnSizer2 = __webpack_require__(119), _ColumnSizer3 = _interopRequireDefault(_ColumnSizer2);
exports.default = _ColumnSizer3.default, exports.ColumnSizer = _ColumnSizer3.default;
}, /* 119 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(89), ColumnSizer = function(_PureComponent) {
function ColumnSizer(props, context) {
(0, _classCallCheck3.default)(this, ColumnSizer);
var _this = (0, _possibleConstructorReturn3.default)(this, (ColumnSizer.__proto__ || (0,
_getPrototypeOf2.default)(ColumnSizer)).call(this, props, context));
return _this._registerChild = _this._registerChild.bind(_this), _this;
}
return (0, _inherits3.default)(ColumnSizer, _PureComponent), (0, _createClass3.default)(ColumnSizer, [ {
key: "componentDidUpdate",
value: function(prevProps, prevState) {
var _props = this.props, columnMaxWidth = _props.columnMaxWidth, columnMinWidth = _props.columnMinWidth, columnCount = _props.columnCount, width = _props.width;
columnMaxWidth === prevProps.columnMaxWidth && columnMinWidth === prevProps.columnMinWidth && columnCount === prevProps.columnCount && width === prevProps.width || this._registeredChild && this._registeredChild.recomputeGridSize();
}
}, {
key: "render",
value: function() {
var _props2 = this.props, children = _props2.children, columnMaxWidth = _props2.columnMaxWidth, columnMinWidth = _props2.columnMinWidth, columnCount = _props2.columnCount, width = _props2.width, safeColumnMinWidth = columnMinWidth || 1, safeColumnMaxWidth = columnMaxWidth ? Math.min(columnMaxWidth, width) : width, columnWidth = width / columnCount;
columnWidth = Math.max(safeColumnMinWidth, columnWidth), columnWidth = Math.min(safeColumnMaxWidth, columnWidth),
columnWidth = Math.floor(columnWidth);
var adjustedWidth = Math.min(width, columnWidth * columnCount);
return children({
adjustedWidth: adjustedWidth,
getColumnWidth: function() {
return columnWidth;
},
registerChild: this._registerChild
});
}
}, {
key: "_registerChild",
value: function(child) {
if (child && "function" != typeof child.recomputeGridSize) throw Error("Unexpected child type registered; only Grid/MultiGrid children are supported.");
this._registeredChild = child, this._registeredChild && this._registeredChild.recomputeGridSize();
}
} ]), ColumnSizer;
}(_react.PureComponent);
exports.default = ColumnSizer;
}, /* 120 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.SortIndicator = exports.SortDirection = exports.Column = exports.Table = exports.defaultRowRenderer = exports.defaultHeaderRenderer = exports.defaultCellRenderer = exports.defaultCellDataGetter = exports.default = void 0;
var _Table2 = __webpack_require__(121), _Table3 = _interopRequireDefault(_Table2), _defaultCellDataGetter2 = __webpack_require__(127), _defaultCellDataGetter3 = _interopRequireDefault(_defaultCellDataGetter2), _defaultCellRenderer2 = __webpack_require__(126), _defaultCellRenderer3 = _interopRequireDefault(_defaultCellRenderer2), _defaultHeaderRenderer2 = __webpack_require__(123), _defaultHeaderRenderer3 = _interopRequireDefault(_defaultHeaderRenderer2), _defaultRowRenderer2 = __webpack_require__(136), _defaultRowRenderer3 = _interopRequireDefault(_defaultRowRenderer2), _Column2 = __webpack_require__(122), _Column3 = _interopRequireDefault(_Column2), _SortDirection2 = __webpack_require__(125), _SortDirection3 = _interopRequireDefault(_SortDirection2), _SortIndicator2 = __webpack_require__(124), _SortIndicator3 = _interopRequireDefault(_SortIndicator2);
exports.default = _Table3.default, exports.defaultCellDataGetter = _defaultCellDataGetter3.default,
exports.defaultCellRenderer = _defaultCellRenderer3.default, exports.defaultHeaderRenderer = _defaultHeaderRenderer3.default,
exports.defaultRowRenderer = _defaultRowRenderer3.default, exports.Table = _Table3.default,
exports.Column = _Column3.default, exports.SortDirection = _SortDirection3.default,
exports.SortIndicator = _SortIndicator3.default;
}, /* 121 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _extends2 = __webpack_require__(100), _extends3 = _interopRequireDefault(_extends2), _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _classnames = __webpack_require__(107), _classnames2 = _interopRequireDefault(_classnames), _Column = __webpack_require__(122), _react = (_interopRequireDefault(_Column),
__webpack_require__(89)), _react2 = _interopRequireDefault(_react), _reactDom = __webpack_require__(96), _Grid = __webpack_require__(128), _Grid2 = _interopRequireDefault(_Grid), _defaultRowRenderer = __webpack_require__(136), _defaultRowRenderer2 = _interopRequireDefault(_defaultRowRenderer), _SortDirection = __webpack_require__(125), _SortDirection2 = _interopRequireDefault(_SortDirection), Table = function(_PureComponent) {
function Table(props) {
(0, _classCallCheck3.default)(this, Table);
var _this = (0, _possibleConstructorReturn3.default)(this, (Table.__proto__ || (0,
_getPrototypeOf2.default)(Table)).call(this, props));
return _this.state = {
scrollbarWidth: 0
}, _this._createColumn = _this._createColumn.bind(_this), _this._createRow = _this._createRow.bind(_this),
_this._onScroll = _this._onScroll.bind(_this), _this._onSectionRendered = _this._onSectionRendered.bind(_this),
_this._setRef = _this._setRef.bind(_this), _this;
}
return (0, _inherits3.default)(Table, _PureComponent), (0, _createClass3.default)(Table, [ {
key: "forceUpdateGrid",
value: function() {
this.Grid.forceUpdate();
}
}, {
key: "measureAllRows",
value: function() {
this.Grid.measureAllCells();
}
}, {
key: "recomputeRowHeights",
value: function() {
var index = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
this.Grid.recomputeGridSize({
rowIndex: index
});
}
}, {
key: "scrollToRow",
value: function() {
var index = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
this.Grid.scrollToCell({
columnIndex: 0,
rowIndex: index
});
}
}, {
key: "componentDidMount",
value: function() {
this._setScrollbarWidth();
}
}, {
key: "componentDidUpdate",
value: function() {
this._setScrollbarWidth();
}
}, {
key: "render",
value: function() {
var _this2 = this, _props = this.props, children = _props.children, className = _props.className, disableHeader = _props.disableHeader, gridClassName = _props.gridClassName, gridStyle = _props.gridStyle, headerHeight = _props.headerHeight, height = _props.height, id = _props.id, noRowsRenderer = _props.noRowsRenderer, rowClassName = _props.rowClassName, rowStyle = _props.rowStyle, scrollToIndex = _props.scrollToIndex, style = _props.style, width = _props.width, scrollbarWidth = this.state.scrollbarWidth, availableRowsHeight = disableHeader ? height : height - headerHeight, rowClass = rowClassName instanceof Function ? rowClassName({
index: -1
}) : rowClassName, rowStyleObject = rowStyle instanceof Function ? rowStyle({
index: -1
}) : rowStyle;
return this._cachedColumnStyles = [], _react2.default.Children.toArray(children).forEach(function(column, index) {
var flexStyles = _this2._getFlexStyleForColumn(column, column.props.style);
_this2._cachedColumnStyles[index] = (0, _extends3.default)({}, flexStyles, {
overflow: "hidden"
});
}), _react2.default.createElement("div", {
className: (0, _classnames2.default)("ReactVirtualized__Table", className),
id: id,
style: style
}, !disableHeader && _react2.default.createElement("div", {
className: (0, _classnames2.default)("ReactVirtualized__Table__headerRow", rowClass),
style: (0, _extends3.default)({}, rowStyleObject, {
height: headerHeight,
overflow: "hidden",
paddingRight: scrollbarWidth,
width: width
})
}, this._getRenderedHeaderRow()), _react2.default.createElement(_Grid2.default, (0,
_extends3.default)({}, this.props, {
autoContainerWidth: !0,
className: (0, _classnames2.default)("ReactVirtualized__Table__Grid", gridClassName),
cellRenderer: this._createRow,
columnWidth: width,
columnCount: 1,
height: availableRowsHeight,
id: void 0,
noContentRenderer: noRowsRenderer,
onScroll: this._onScroll,
onSectionRendered: this._onSectionRendered,
ref: this._setRef,
scrollbarWidth: scrollbarWidth,
scrollToRow: scrollToIndex,
style: (0, _extends3.default)({}, gridStyle, {
overflowX: "hidden"
})
})));
}
}, {
key: "_createColumn",
value: function(_ref) {
var column = _ref.column, columnIndex = _ref.columnIndex, isScrolling = _ref.isScrolling, parent = _ref.parent, rowData = _ref.rowData, rowIndex = _ref.rowIndex, _column$props = column.props, cellDataGetter = _column$props.cellDataGetter, cellRenderer = _column$props.cellRenderer, className = _column$props.className, columnData = _column$props.columnData, dataKey = _column$props.dataKey, cellData = cellDataGetter({
columnData: columnData,
dataKey: dataKey,
rowData: rowData
}), renderedCell = cellRenderer({
cellData: cellData,
columnData: columnData,
dataKey: dataKey,
isScrolling: isScrolling,
parent: parent,
rowData: rowData,
rowIndex: rowIndex
}), style = this._cachedColumnStyles[columnIndex], title = "string" == typeof renderedCell ? renderedCell : null;
return _react2.default.createElement("div", {
key: "Row" + rowIndex + "-Col" + columnIndex,
className: (0, _classnames2.default)("ReactVirtualized__Table__rowColumn", className),
style: style,
title: title
}, renderedCell);
}
}, {
key: "_createHeader",
value: function(_ref2) {
var column = _ref2.column, index = _ref2.index, _props2 = this.props, headerClassName = _props2.headerClassName, headerStyle = _props2.headerStyle, onHeaderClick = _props2.onHeaderClick, sort = _props2.sort, sortBy = _props2.sortBy, sortDirection = _props2.sortDirection, _column$props2 = column.props, dataKey = _column$props2.dataKey, disableSort = _column$props2.disableSort, headerRenderer = _column$props2.headerRenderer, label = _column$props2.label, columnData = _column$props2.columnData, sortEnabled = !disableSort && sort, classNames = (0,
_classnames2.default)("ReactVirtualized__Table__headerColumn", headerClassName, column.props.headerClassName, {
ReactVirtualized__Table__sortableHeaderColumn: sortEnabled
}), style = this._getFlexStyleForColumn(column, headerStyle), renderedHeader = headerRenderer({
columnData: columnData,
dataKey: dataKey,
disableSort: disableSort,
label: label,
sortBy: sortBy,
sortDirection: sortDirection
}), a11yProps = {};
return (sortEnabled || onHeaderClick) && !function() {
var newSortDirection = sortBy !== dataKey || sortDirection === _SortDirection2.default.DESC ? _SortDirection2.default.ASC : _SortDirection2.default.DESC, onClick = function() {
sortEnabled && sort({
sortBy: dataKey,
sortDirection: newSortDirection
}), onHeaderClick && onHeaderClick({
columnData: columnData,
dataKey: dataKey
});
}, onKeyDown = function(event) {
"Enter" !== event.key && " " !== event.key || onClick();
};
a11yProps["aria-label"] = column.props["aria-label"] || label || dataKey, a11yProps.role = "rowheader",
a11yProps.tabIndex = 0, a11yProps.onClick = onClick, a11yProps.onKeyDown = onKeyDown;
}(), _react2.default.createElement("div", (0, _extends3.default)({}, a11yProps, {
key: "Header-Col" + index,
className: classNames,
style: style
}), renderedHeader);
}
}, {
key: "_createRow",
value: function(_ref3) {
var _this3 = this, index = _ref3.rowIndex, isScrolling = _ref3.isScrolling, key = _ref3.key, parent = _ref3.parent, style = _ref3.style, _props3 = this.props, children = _props3.children, onRowClick = _props3.onRowClick, onRowDoubleClick = _props3.onRowDoubleClick, onRowMouseOver = _props3.onRowMouseOver, onRowMouseOut = _props3.onRowMouseOut, rowClassName = _props3.rowClassName, rowGetter = _props3.rowGetter, rowRenderer = _props3.rowRenderer, rowStyle = _props3.rowStyle, scrollbarWidth = this.state.scrollbarWidth, rowClass = rowClassName instanceof Function ? rowClassName({
index: index
}) : rowClassName, rowStyleObject = rowStyle instanceof Function ? rowStyle({
index: index
}) : rowStyle, rowData = rowGetter({
index: index
}), columns = _react2.default.Children.toArray(children).map(function(column, columnIndex) {
return _this3._createColumn({
column: column,
columnIndex: columnIndex,
isScrolling: isScrolling,
parent: parent,
rowData: rowData,
rowIndex: index,
scrollbarWidth: scrollbarWidth
});
}), className = (0, _classnames2.default)("ReactVirtualized__Table__row", rowClass), flattenedStyle = (0,
_extends3.default)({}, style, rowStyleObject, {
height: this._getRowHeight(index),
overflow: "hidden",
paddingRight: scrollbarWidth
});
return rowRenderer({
className: className,
columns: columns,
index: index,
isScrolling: isScrolling,
key: key,
onRowClick: onRowClick,
onRowDoubleClick: onRowDoubleClick,
onRowMouseOver: onRowMouseOver,
onRowMouseOut: onRowMouseOut,
rowData: rowData,
style: flattenedStyle
});
}
}, {
key: "_getFlexStyleForColumn",
value: function(column) {
var customStyle = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, flexValue = column.props.flexGrow + " " + column.props.flexShrink + " " + column.props.width + "px", style = (0,
_extends3.default)({}, customStyle, {
flex: flexValue,
msFlex: flexValue,
WebkitFlex: flexValue
});
return column.props.maxWidth && (style.maxWidth = column.props.maxWidth), column.props.minWidth && (style.minWidth = column.props.minWidth),
style;
}
}, {
key: "_getRenderedHeaderRow",
value: function() {
var _this4 = this, _props4 = this.props, children = _props4.children, disableHeader = _props4.disableHeader, items = disableHeader ? [] : _react2.default.Children.toArray(children);
return items.map(function(column, index) {
return _this4._createHeader({
column: column,
index: index
});
});
}
}, {
key: "_getRowHeight",
value: function(rowIndex) {
var rowHeight = this.props.rowHeight;
return rowHeight instanceof Function ? rowHeight({
index: rowIndex
}) : rowHeight;
}
}, {
key: "_onScroll",
value: function(_ref4) {
var clientHeight = _ref4.clientHeight, scrollHeight = _ref4.scrollHeight, scrollTop = _ref4.scrollTop, onScroll = this.props.onScroll;
onScroll({
clientHeight: clientHeight,
scrollHeight: scrollHeight,
scrollTop: scrollTop
});
}
}, {
key: "_onSectionRendered",
value: function(_ref5) {
var rowOverscanStartIndex = _ref5.rowOverscanStartIndex, rowOverscanStopIndex = _ref5.rowOverscanStopIndex, rowStartIndex = _ref5.rowStartIndex, rowStopIndex = _ref5.rowStopIndex, onRowsRendered = this.props.onRowsRendered;
onRowsRendered({
overscanStartIndex: rowOverscanStartIndex,
overscanStopIndex: rowOverscanStopIndex,
startIndex: rowStartIndex,
stopIndex: rowStopIndex
});
}
}, {
key: "_setRef",
value: function(ref) {
this.Grid = ref;
}
}, {
key: "_setScrollbarWidth",
value: function() {
var Grid = (0, _reactDom.findDOMNode)(this.Grid), clientWidth = Grid.clientWidth || 0, offsetWidth = Grid.offsetWidth || 0, scrollbarWidth = offsetWidth - clientWidth;
this.setState({
scrollbarWidth: scrollbarWidth
});
}
} ]), Table;
}(_react.PureComponent);
Table.defaultProps = {
disableHeader: !1,
estimatedRowSize: 30,
headerHeight: 0,
headerStyle: {},
noRowsRenderer: function() {
return null;
},
onRowsRendered: function() {
return null;
},
onScroll: function() {
return null;
},
overscanRowCount: 10,
rowRenderer: _defaultRowRenderer2.default,
rowStyle: {},
scrollToAlignment: "auto",
style: {}
}, exports.default = Table;
}, /* 122 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(89), _defaultHeaderRenderer = __webpack_require__(123), _defaultHeaderRenderer2 = _interopRequireDefault(_defaultHeaderRenderer), _defaultCellRenderer = __webpack_require__(126), _defaultCellRenderer2 = _interopRequireDefault(_defaultCellRenderer), _defaultCellDataGetter = __webpack_require__(127), _defaultCellDataGetter2 = _interopRequireDefault(_defaultCellDataGetter), Column = function(_Component) {
function Column() {
return (0, _classCallCheck3.default)(this, Column), (0, _possibleConstructorReturn3.default)(this, (Column.__proto__ || (0,
_getPrototypeOf2.default)(Column)).apply(this, arguments));
}
return (0, _inherits3.default)(Column, _Component), Column;
}(_react.Component);
Column.defaultProps = {
cellDataGetter: _defaultCellDataGetter2.default,
cellRenderer: _defaultCellRenderer2.default,
flexGrow: 0,
flexShrink: 1,
headerRenderer: _defaultHeaderRenderer2.default,
style: {}
}, exports.default = Column;
}, /* 123 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function defaultHeaderRenderer(_ref) {
var dataKey = (_ref.columnData, _ref.dataKey), label = (_ref.disableSort, _ref.label), sortBy = _ref.sortBy, sortDirection = _ref.sortDirection, showSortIndicator = sortBy === dataKey, children = [ _react2.default.createElement("span", {
className: "ReactVirtualized__Table__headerTruncatedText",
key: "label",
title: label
}, label) ];
return showSortIndicator && children.push(_react2.default.createElement(_SortIndicator2.default, {
key: "SortIndicator",
sortDirection: sortDirection
})), children;
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = defaultHeaderRenderer;
var _react = __webpack_require__(89), _react2 = _interopRequireDefault(_react), _SortIndicator = __webpack_require__(124), _SortIndicator2 = _interopRequireDefault(_SortIndicator);
}, /* 124 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function SortIndicator(_ref) {
var sortDirection = _ref.sortDirection, classNames = (0, _classnames2.default)("ReactVirtualized__Table__sortableHeaderIcon", {
"ReactVirtualized__Table__sortableHeaderIcon--ASC": sortDirection === _SortDirection2.default.ASC,
"ReactVirtualized__Table__sortableHeaderIcon--DESC": sortDirection === _SortDirection2.default.DESC
});
return _react2.default.createElement("svg", {
className: classNames,
width: 18,
height: 18,
viewBox: "0 0 24 24"
}, sortDirection === _SortDirection2.default.ASC ? _react2.default.createElement("path", {
d: "M7 14l5-5 5 5z"
}) : _react2.default.createElement("path", {
d: "M7 10l5 5 5-5z"
}), _react2.default.createElement("path", {
d: "M0 0h24v24H0z",
fill: "none"
}));
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = SortIndicator;
var _react = __webpack_require__(89), _react2 = _interopRequireDefault(_react), _classnames = __webpack_require__(107), _classnames2 = _interopRequireDefault(_classnames), _SortDirection = __webpack_require__(125), _SortDirection2 = _interopRequireDefault(_SortDirection);
}, /* 125 */
/***/
function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
});
var SortDirection = {
ASC: "ASC",
DESC: "DESC"
};
exports.default = SortDirection;
}, /* 126 */
/***/
function(module, exports) {
"use strict";
function defaultCellRenderer(_ref) {
var cellData = _ref.cellData;
_ref.cellDataKey, _ref.columnData, _ref.rowData, _ref.rowIndex;
return null == cellData ? "" : String(cellData);
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = defaultCellRenderer;
}, /* 127 */
/***/
function(module, exports) {
"use strict";
function defaultCellDataGetter(_ref) {
var dataKey = (_ref.columnData, _ref.dataKey), rowData = _ref.rowData;
return rowData.get instanceof Function ? rowData.get(dataKey) : rowData[dataKey];
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = defaultCellDataGetter;
}, /* 128 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.defaultCellRangeRenderer = exports.Grid = exports.default = void 0;
var _Grid2 = __webpack_require__(129), _Grid3 = _interopRequireDefault(_Grid2), _defaultCellRangeRenderer2 = __webpack_require__(135), _defaultCellRangeRenderer3 = _interopRequireDefault(_defaultCellRangeRenderer2);
exports.default = _Grid3.default, exports.Grid = _Grid3.default, exports.defaultCellRangeRenderer = _defaultCellRangeRenderer3.default;
}, /* 129 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.DEFAULT_SCROLLING_RESET_TIME_INTERVAL = void 0;
var _extends2 = __webpack_require__(100), _extends3 = _interopRequireDefault(_extends2), _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(89), _react2 = _interopRequireDefault(_react), _classnames = __webpack_require__(107), _classnames2 = _interopRequireDefault(_classnames), _calculateSizeAndPositionDataAndUpdateScrollOffset = __webpack_require__(130), _calculateSizeAndPositionDataAndUpdateScrollOffset2 = _interopRequireDefault(_calculateSizeAndPositionDataAndUpdateScrollOffset), _ScalingCellSizeAndPositionManager = __webpack_require__(131), _ScalingCellSizeAndPositionManager2 = _interopRequireDefault(_ScalingCellSizeAndPositionManager), _createCallbackMemoizer = __webpack_require__(108), _createCallbackMemoizer2 = _interopRequireDefault(_createCallbackMemoizer), _defaultOverscanIndicesGetter = __webpack_require__(133), _defaultOverscanIndicesGetter2 = _interopRequireDefault(_defaultOverscanIndicesGetter), _updateScrollIndexHelper = __webpack_require__(134), _updateScrollIndexHelper2 = _interopRequireDefault(_updateScrollIndexHelper), _defaultCellRangeRenderer = __webpack_require__(135), _defaultCellRangeRenderer2 = _interopRequireDefault(_defaultCellRangeRenderer), DEFAULT_SCROLLING_RESET_TIME_INTERVAL = exports.DEFAULT_SCROLLING_RESET_TIME_INTERVAL = 150, SCROLL_POSITION_CHANGE_REASONS = {
OBSERVED: "observed",
REQUESTED: "requested"
}, Grid = function(_PureComponent) {
function Grid(props, context) {
(0, _classCallCheck3.default)(this, Grid);
var _this = (0, _possibleConstructorReturn3.default)(this, (Grid.__proto__ || (0,
_getPrototypeOf2.default)(Grid)).call(this, props, context));
_this.state = {
isScrolling: !1,
scrollDirectionHorizontal: _defaultOverscanIndicesGetter.SCROLL_DIRECTION_FORWARD,
scrollDirectionVertical: _defaultOverscanIndicesGetter.SCROLL_DIRECTION_FORWARD,
scrollLeft: 0,
scrollTop: 0
}, _this._onGridRenderedMemoizer = (0, _createCallbackMemoizer2.default)(), _this._onScrollMemoizer = (0,
_createCallbackMemoizer2.default)(!1), _this._debounceScrollEndedCallback = _this._debounceScrollEndedCallback.bind(_this),
_this._invokeOnGridRenderedHelper = _this._invokeOnGridRenderedHelper.bind(_this),
_this._onScroll = _this._onScroll.bind(_this), _this._setScrollingContainerRef = _this._setScrollingContainerRef.bind(_this),
_this._updateScrollLeftForScrollToColumn = _this._updateScrollLeftForScrollToColumn.bind(_this),
_this._updateScrollTopForScrollToRow = _this._updateScrollTopForScrollToRow.bind(_this),
_this._columnWidthGetter = _this._wrapSizeGetter(props.columnWidth), _this._rowHeightGetter = _this._wrapSizeGetter(props.rowHeight),
_this._deferredInvalidateColumnIndex = null, _this._deferredInvalidateRowIndex = null,
_this._recomputeScrollLeftFlag = !1, _this._recomputeScrollTopFlag = !1;
var deferredMeasurementCache = props.deferredMeasurementCache, deferredMode = "undefined" != typeof deferredMeasurementCache;
return _this._columnSizeAndPositionManager = new _ScalingCellSizeAndPositionManager2.default({
batchAllCells: deferredMode && !deferredMeasurementCache.hasFixedHeight(),
cellCount: props.columnCount,
cellSizeGetter: function(params) {
return _this._columnWidthGetter(params);
},
estimatedCellSize: _this._getEstimatedColumnSize(props)
}), _this._rowSizeAndPositionManager = new _ScalingCellSizeAndPositionManager2.default({
batchAllCells: deferredMode && !deferredMeasurementCache.hasFixedWidth(),
cellCount: props.rowCount,
cellSizeGetter: function(params) {
return _this._rowHeightGetter(params);
},
estimatedCellSize: _this._getEstimatedRowSize(props)
}), _this._cellCache = {}, _this._styleCache = {}, _this;
}
return (0, _inherits3.default)(Grid, _PureComponent), (0, _createClass3.default)(Grid, [ {
key: "invalidateCellSizeAfterRender",
value: function(_ref) {
var columnIndex = _ref.columnIndex, rowIndex = _ref.rowIndex;
this._deferredInvalidateColumnIndex = "number" == typeof this._deferredInvalidateColumnIndex ? Math.min(this._deferredInvalidateColumnIndex, columnIndex) : columnIndex,
this._deferredInvalidateRowIndex = "number" == typeof this._deferredInvalidateRowIndex ? Math.min(this._deferredInvalidateRowIndex, rowIndex) : rowIndex;
}
}, {
key: "measureAllCells",
value: function() {
var _props = this.props, columnCount = _props.columnCount, rowCount = _props.rowCount;
this._columnSizeAndPositionManager.getSizeAndPositionOfCell(columnCount - 1), this._rowSizeAndPositionManager.getSizeAndPositionOfCell(rowCount - 1);
}
}, {
key: "recomputeGridSize",
value: function() {
var _ref2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, _ref2$columnIndex = _ref2.columnIndex, columnIndex = void 0 === _ref2$columnIndex ? 0 : _ref2$columnIndex, _ref2$rowIndex = _ref2.rowIndex, rowIndex = void 0 === _ref2$rowIndex ? 0 : _ref2$rowIndex, _props2 = this.props, scrollToColumn = _props2.scrollToColumn, scrollToRow = _props2.scrollToRow;
this._columnSizeAndPositionManager.resetCell(columnIndex), this._rowSizeAndPositionManager.resetCell(rowIndex),
this._recomputeScrollLeftFlag = scrollToColumn >= 0 && columnIndex <= scrollToColumn,
this._recomputeScrollTopFlag = scrollToRow >= 0 && rowIndex <= scrollToRow, this._cellCache = {},
this._styleCache = {}, this.forceUpdate();
}
}, {
key: "scrollToCell",
value: function(_ref3) {
var columnIndex = _ref3.columnIndex, rowIndex = _ref3.rowIndex, props = this.props;
this._updateScrollLeftForScrollToColumn((0, _extends3.default)({}, props, {
scrollToColumn: columnIndex
})), this._updateScrollTopForScrollToRow((0, _extends3.default)({}, props, {
scrollToRow: rowIndex
}));
}
}, {
key: "componentDidMount",
value: function() {
var _props3 = this.props, getScrollbarSize = _props3.getScrollbarSize, scrollLeft = _props3.scrollLeft, scrollToColumn = _props3.scrollToColumn, scrollTop = _props3.scrollTop, scrollToRow = _props3.scrollToRow;
this._handleInvalidatedGridSize(), this._scrollbarSizeMeasured || (this._scrollbarSize = getScrollbarSize(),
this._scrollbarSizeMeasured = !0, this.setState({})), (scrollLeft >= 0 || scrollTop >= 0) && this._setScrollPosition({
scrollLeft: scrollLeft,
scrollTop: scrollTop
}), (scrollToColumn >= 0 || scrollToRow >= 0) && (this._updateScrollLeftForScrollToColumn(),
this._updateScrollTopForScrollToRow()), this._invokeOnGridRenderedHelper(), this._invokeOnScrollMemoizer({
scrollLeft: scrollLeft || 0,
scrollTop: scrollTop || 0,
totalColumnsWidth: this._columnSizeAndPositionManager.getTotalSize(),
totalRowsHeight: this._rowSizeAndPositionManager.getTotalSize()
});
}
}, {
key: "componentDidUpdate",
value: function(prevProps, prevState) {
var _this2 = this, _props4 = this.props, autoHeight = _props4.autoHeight, columnCount = _props4.columnCount, height = _props4.height, rowCount = _props4.rowCount, scrollToAlignment = _props4.scrollToAlignment, scrollToColumn = _props4.scrollToColumn, scrollToRow = _props4.scrollToRow, width = _props4.width, _state = this.state, scrollLeft = _state.scrollLeft, scrollPositionChangeReason = _state.scrollPositionChangeReason, scrollTop = _state.scrollTop;
this._handleInvalidatedGridSize();
var columnOrRowCountJustIncreasedFromZero = columnCount > 0 && 0 === prevProps.columnCount || rowCount > 0 && 0 === prevProps.rowCount;
if (scrollPositionChangeReason === SCROLL_POSITION_CHANGE_REASONS.REQUESTED && (scrollLeft >= 0 && (scrollLeft !== prevState.scrollLeft && scrollLeft !== this._scrollingContainer.scrollLeft || columnOrRowCountJustIncreasedFromZero) && (this._scrollingContainer.scrollLeft = scrollLeft),
!autoHeight && scrollTop >= 0 && (scrollTop !== prevState.scrollTop && scrollTop !== this._scrollingContainer.scrollTop || columnOrRowCountJustIncreasedFromZero) && (this._scrollingContainer.scrollTop = scrollTop)),
this._recomputeScrollLeftFlag ? (this._recomputeScrollLeftFlag = !1, this._updateScrollLeftForScrollToColumn(this.props)) : (0,
_updateScrollIndexHelper2.default)({
cellSizeAndPositionManager: this._columnSizeAndPositionManager,
previousCellsCount: prevProps.columnCount,
previousCellSize: prevProps.columnWidth,
previousScrollToAlignment: prevProps.scrollToAlignment,
previousScrollToIndex: prevProps.scrollToColumn,
previousSize: prevProps.width,
scrollOffset: scrollLeft,
scrollToAlignment: scrollToAlignment,
scrollToIndex: scrollToColumn,
size: width,
updateScrollIndexCallback: function(scrollToColumn) {
return _this2._updateScrollLeftForScrollToColumn(_this2.props);
}
}), this._recomputeScrollTopFlag ? (this._recomputeScrollTopFlag = !1, this._updateScrollTopForScrollToRow(this.props)) : (0,
_updateScrollIndexHelper2.default)({
cellSizeAndPositionManager: this._rowSizeAndPositionManager,
previousCellsCount: prevProps.rowCount,
previousCellSize: prevProps.rowHeight,
previousScrollToAlignment: prevProps.scrollToAlignment,
previousScrollToIndex: prevProps.scrollToRow,
previousSize: prevProps.height,
scrollOffset: scrollTop,
scrollToAlignment: scrollToAlignment,
scrollToIndex: scrollToRow,
size: height,
updateScrollIndexCallback: function(scrollToRow) {
return _this2._updateScrollTopForScrollToRow(_this2.props);
}
}), this._invokeOnGridRenderedHelper(), scrollLeft !== prevState.scrollLeft || scrollTop !== prevState.scrollTop) {
var totalRowsHeight = this._rowSizeAndPositionManager.getTotalSize(), totalColumnsWidth = this._columnSizeAndPositionManager.getTotalSize();
this._invokeOnScrollMemoizer({
scrollLeft: scrollLeft,
scrollTop: scrollTop,
totalColumnsWidth: totalColumnsWidth,
totalRowsHeight: totalRowsHeight
});
}
}
}, {
key: "componentWillMount",
value: function() {
var getScrollbarSize = this.props.getScrollbarSize;
this._scrollbarSize = getScrollbarSize(), void 0 === this._scrollbarSize ? (this._scrollbarSizeMeasured = !1,
this._scrollbarSize = 0) : this._scrollbarSizeMeasured = !0, this._calculateChildrenToRender();
}
}, {
key: "componentWillUnmount",
value: function() {
this._disablePointerEventsTimeoutId && clearTimeout(this._disablePointerEventsTimeoutId);
}
}, {
key: "componentWillReceiveProps",
value: function(nextProps) {
var _this3 = this, _state2 = this.state, scrollLeft = _state2.scrollLeft, scrollTop = _state2.scrollTop;
if (0 === nextProps.columnCount && 0 !== scrollLeft || 0 === nextProps.rowCount && 0 !== scrollTop) this._setScrollPosition({
scrollLeft: 0,
scrollTop: 0
}); else if (nextProps.scrollLeft !== this.props.scrollLeft || nextProps.scrollTop !== this.props.scrollTop) {
var newState = {};
null != nextProps.scrollLeft && (newState.scrollLeft = nextProps.scrollLeft), null != nextProps.scrollTop && (newState.scrollTop = nextProps.scrollTop),
this._setScrollPosition(newState);
}
nextProps.columnWidth === this.props.columnWidth && nextProps.rowHeight === this.props.rowHeight || (this._styleCache = {}),
this._columnWidthGetter = this._wrapSizeGetter(nextProps.columnWidth), this._rowHeightGetter = this._wrapSizeGetter(nextProps.rowHeight),
this._columnSizeAndPositionManager.configure({
cellCount: nextProps.columnCount,
estimatedCellSize: this._getEstimatedColumnSize(nextProps)
}), this._rowSizeAndPositionManager.configure({
cellCount: nextProps.rowCount,
estimatedCellSize: this._getEstimatedRowSize(nextProps)
});
var _props5 = this.props, columnCount = _props5.columnCount, rowCount = _props5.rowCount;
0 !== columnCount && 0 !== rowCount || (columnCount = 0, rowCount = 0), (0, _calculateSizeAndPositionDataAndUpdateScrollOffset2.default)({
cellCount: columnCount,
cellSize: this.props.columnWidth,
computeMetadataCallback: function() {
return _this3._columnSizeAndPositionManager.resetCell(0);
},
computeMetadataCallbackProps: nextProps,
nextCellsCount: nextProps.columnCount,
nextCellSize: nextProps.columnWidth,
nextScrollToIndex: nextProps.scrollToColumn,
scrollToIndex: this.props.scrollToColumn,
updateScrollOffsetForScrollToIndex: function() {
return _this3._updateScrollLeftForScrollToColumn(nextProps, _this3.state);
}
}), (0, _calculateSizeAndPositionDataAndUpdateScrollOffset2.default)({
cellCount: rowCount,
cellSize: this.props.rowHeight,
computeMetadataCallback: function() {
return _this3._rowSizeAndPositionManager.resetCell(0);
},
computeMetadataCallbackProps: nextProps,
nextCellsCount: nextProps.rowCount,
nextCellSize: nextProps.rowHeight,
nextScrollToIndex: nextProps.scrollToRow,
scrollToIndex: this.props.scrollToRow,
updateScrollOffsetForScrollToIndex: function() {
return _this3._updateScrollTopForScrollToRow(nextProps, _this3.state);
}
});
}
}, {
key: "componentWillUpdate",
value: function(nextProps, nextState) {
this._calculateChildrenToRender(nextProps, nextState);
}
}, {
key: "render",
value: function() {
var _props6 = this.props, autoContainerWidth = _props6.autoContainerWidth, autoHeight = _props6.autoHeight, className = _props6.className, containerStyle = _props6.containerStyle, height = _props6.height, id = _props6.id, noContentRenderer = _props6.noContentRenderer, style = _props6.style, tabIndex = _props6.tabIndex, width = _props6.width, isScrolling = this.state.isScrolling, gridStyle = {
boxSizing: "border-box",
direction: "ltr",
height: autoHeight ? "auto" : height,
position: "relative",
width: width,
WebkitOverflowScrolling: "touch",
willChange: "transform"
}, totalColumnsWidth = this._columnSizeAndPositionManager.getTotalSize(), totalRowsHeight = this._rowSizeAndPositionManager.getTotalSize(), verticalScrollBarSize = totalRowsHeight > height ? this._scrollbarSize : 0, horizontalScrollBarSize = totalColumnsWidth > width ? this._scrollbarSize : 0;
gridStyle.overflowX = totalColumnsWidth + verticalScrollBarSize <= width ? "hidden" : "auto",
gridStyle.overflowY = totalRowsHeight + horizontalScrollBarSize <= height ? "hidden" : "auto";
var childrenToDisplay = this._childrenToDisplay, showNoContentRenderer = 0 === childrenToDisplay.length && height > 0 && width > 0;
return _react2.default.createElement("div", {
ref: this._setScrollingContainerRef,
"aria-label": this.props["aria-label"],
className: (0, _classnames2.default)("ReactVirtualized__Grid", className),
id: id,
onScroll: this._onScroll,
role: "grid",
style: (0, _extends3.default)({}, gridStyle, style),
tabIndex: tabIndex
}, childrenToDisplay.length > 0 && _react2.default.createElement("div", {
className: "ReactVirtualized__Grid__innerScrollContainer",
style: (0, _extends3.default)({
width: autoContainerWidth ? "auto" : totalColumnsWidth,
height: totalRowsHeight,
maxWidth: totalColumnsWidth,
maxHeight: totalRowsHeight,
overflow: "hidden",
pointerEvents: isScrolling ? "none" : ""
}, containerStyle)
}, childrenToDisplay), showNoContentRenderer && noContentRenderer());
}
}, {
key: "_calculateChildrenToRender",
value: function() {
var props = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.props, state = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.state, cellRenderer = props.cellRenderer, cellRangeRenderer = props.cellRangeRenderer, columnCount = props.columnCount, deferredMeasurementCache = props.deferredMeasurementCache, height = props.height, overscanColumnCount = props.overscanColumnCount, overscanIndicesGetter = props.overscanIndicesGetter, overscanRowCount = props.overscanRowCount, rowCount = props.rowCount, width = props.width, isScrolling = state.isScrolling, scrollDirectionHorizontal = state.scrollDirectionHorizontal, scrollDirectionVertical = state.scrollDirectionVertical, scrollLeft = state.scrollLeft, scrollTop = state.scrollTop;
if (this._childrenToDisplay = [], height > 0 && width > 0) {
var visibleColumnIndices = this._columnSizeAndPositionManager.getVisibleCellRange({
containerSize: width,
offset: scrollLeft
}), visibleRowIndices = this._rowSizeAndPositionManager.getVisibleCellRange({
containerSize: height,
offset: scrollTop
}), horizontalOffsetAdjustment = this._columnSizeAndPositionManager.getOffsetAdjustment({
containerSize: width,
offset: scrollLeft
}), verticalOffsetAdjustment = this._rowSizeAndPositionManager.getOffsetAdjustment({
containerSize: height,
offset: scrollTop
});
this._renderedColumnStartIndex = visibleColumnIndices.start, this._renderedColumnStopIndex = visibleColumnIndices.stop,
this._renderedRowStartIndex = visibleRowIndices.start, this._renderedRowStopIndex = visibleRowIndices.stop;
var overscanColumnIndices = overscanIndicesGetter({
cellCount: columnCount,
overscanCellsCount: overscanColumnCount,
scrollDirection: scrollDirectionHorizontal,
startIndex: this._renderedColumnStartIndex,
stopIndex: this._renderedColumnStopIndex
}), overscanRowIndices = overscanIndicesGetter({
cellCount: rowCount,
overscanCellsCount: overscanRowCount,
scrollDirection: scrollDirectionVertical,
startIndex: this._renderedRowStartIndex,
stopIndex: this._renderedRowStopIndex
});
this._columnStartIndex = overscanColumnIndices.overscanStartIndex, this._columnStopIndex = overscanColumnIndices.overscanStopIndex,
this._rowStartIndex = overscanRowIndices.overscanStartIndex, this._rowStopIndex = overscanRowIndices.overscanStopIndex,
this._childrenToDisplay = cellRangeRenderer({
cellCache: this._cellCache,
cellRenderer: cellRenderer,
columnSizeAndPositionManager: this._columnSizeAndPositionManager,
columnStartIndex: this._columnStartIndex,
columnStopIndex: this._columnStopIndex,
deferredMeasurementCache: deferredMeasurementCache,
horizontalOffsetAdjustment: horizontalOffsetAdjustment,
isScrolling: isScrolling,
parent: this,
rowSizeAndPositionManager: this._rowSizeAndPositionManager,
rowStartIndex: this._rowStartIndex,
rowStopIndex: this._rowStopIndex,
scrollLeft: scrollLeft,
scrollTop: scrollTop,
styleCache: this._styleCache,
verticalOffsetAdjustment: verticalOffsetAdjustment,
visibleColumnIndices: visibleColumnIndices,
visibleRowIndices: visibleRowIndices
});
}
}
}, {
key: "_debounceScrollEnded",
value: function() {
var scrollingResetTimeInterval = this.props.scrollingResetTimeInterval;
this._disablePointerEventsTimeoutId && clearTimeout(this._disablePointerEventsTimeoutId),
this._disablePointerEventsTimeoutId = setTimeout(this._debounceScrollEndedCallback, scrollingResetTimeInterval);
}
}, {
key: "_debounceScrollEndedCallback",
value: function() {
this._disablePointerEventsTimeoutId = null;
var styleCache = this._styleCache;
this._cellCache = {}, this._styleCache = {};
for (var rowIndex = this._rowStartIndex; rowIndex <= this._rowStopIndex; rowIndex++) for (var columnIndex = this._columnStartIndex; columnIndex <= this._columnStopIndex; columnIndex++) {
var key = rowIndex + "-" + columnIndex;
this._styleCache[key] = styleCache[key];
}
this.setState({
isScrolling: !1
});
}
}, {
key: "_getEstimatedColumnSize",
value: function(props) {
return "number" == typeof props.columnWidth ? props.columnWidth : props.estimatedColumnSize;
}
}, {
key: "_getEstimatedRowSize",
value: function(props) {
return "number" == typeof props.rowHeight ? props.rowHeight : props.estimatedRowSize;
}
}, {
key: "_handleInvalidatedGridSize",
value: function() {
if ("number" == typeof this._deferredInvalidateColumnIndex) {
var columnIndex = this._deferredInvalidateColumnIndex, rowIndex = this._deferredInvalidateRowIndex;
delete this._deferredInvalidateColumnIndex, delete this._deferredInvalidateRowIndex,
this.recomputeGridSize({
columnIndex: columnIndex,
rowIndex: rowIndex
});
}
}
}, {
key: "_invokeOnGridRenderedHelper",
value: function() {
var onSectionRendered = this.props.onSectionRendered;
this._onGridRenderedMemoizer({
callback: onSectionRendered,
indices: {
columnOverscanStartIndex: this._columnStartIndex,
columnOverscanStopIndex: this._columnStopIndex,
columnStartIndex: this._renderedColumnStartIndex,
columnStopIndex: this._renderedColumnStopIndex,
rowOverscanStartIndex: this._rowStartIndex,
rowOverscanStopIndex: this._rowStopIndex,
rowStartIndex: this._renderedRowStartIndex,
rowStopIndex: this._renderedRowStopIndex
}
});
}
}, {
key: "_invokeOnScrollMemoizer",
value: function(_ref4) {
var _this4 = this, scrollLeft = _ref4.scrollLeft, scrollTop = _ref4.scrollTop, totalColumnsWidth = _ref4.totalColumnsWidth, totalRowsHeight = _ref4.totalRowsHeight;
this._onScrollMemoizer({
callback: function(_ref5) {
var scrollLeft = _ref5.scrollLeft, scrollTop = _ref5.scrollTop, _props7 = _this4.props, height = _props7.height, onScroll = _props7.onScroll, width = _props7.width;
onScroll({
clientHeight: height,
clientWidth: width,
scrollHeight: totalRowsHeight,
scrollLeft: scrollLeft,
scrollTop: scrollTop,
scrollWidth: totalColumnsWidth
});
},
indices: {
scrollLeft: scrollLeft,
scrollTop: scrollTop
}
});
}
}, {
key: "_setScrollingContainerRef",
value: function(ref) {
this._scrollingContainer = ref;
}
}, {
key: "_setScrollPosition",
value: function(_ref6) {
var scrollLeft = _ref6.scrollLeft, scrollTop = _ref6.scrollTop, newState = {
scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS.REQUESTED
};
scrollLeft >= 0 && (newState.scrollDirectionHorizontal = scrollLeft > this.state.scrollLeft ? _defaultOverscanIndicesGetter.SCROLL_DIRECTION_FORWARD : _defaultOverscanIndicesGetter.SCROLL_DIRECTION_BACKWARD,
newState.scrollLeft = scrollLeft), scrollTop >= 0 && (newState.scrollDirectionVertical = scrollTop > this.state.scrollTop ? _defaultOverscanIndicesGetter.SCROLL_DIRECTION_FORWARD : _defaultOverscanIndicesGetter.SCROLL_DIRECTION_BACKWARD,
newState.scrollTop = scrollTop), (scrollLeft >= 0 && scrollLeft !== this.state.scrollLeft || scrollTop >= 0 && scrollTop !== this.state.scrollTop) && this.setState(newState);
}
}, {
key: "_wrapPropertyGetter",
value: function(value) {
return value instanceof Function ? value : function() {
return value;
};
}
}, {
key: "_wrapSizeGetter",
value: function(size) {
return this._wrapPropertyGetter(size);
}
}, {
key: "_updateScrollLeftForScrollToColumn",
value: function() {
var props = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.props, state = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.state, columnCount = props.columnCount, height = props.height, scrollToAlignment = props.scrollToAlignment, scrollToColumn = props.scrollToColumn, width = props.width, scrollLeft = state.scrollLeft;
if (scrollToColumn >= 0 && columnCount > 0) {
var targetIndex = Math.max(0, Math.min(columnCount - 1, scrollToColumn)), totalRowsHeight = this._rowSizeAndPositionManager.getTotalSize(), scrollBarSize = totalRowsHeight > height ? this._scrollbarSize : 0, calculatedScrollLeft = this._columnSizeAndPositionManager.getUpdatedOffsetForIndex({
align: scrollToAlignment,
containerSize: width - scrollBarSize,
currentOffset: scrollLeft,
targetIndex: targetIndex
});
scrollLeft !== calculatedScrollLeft && this._setScrollPosition({
scrollLeft: calculatedScrollLeft
});
}
}
}, {
key: "_updateScrollTopForScrollToRow",
value: function() {
var props = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.props, state = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.state, height = props.height, rowCount = props.rowCount, scrollToAlignment = props.scrollToAlignment, scrollToRow = props.scrollToRow, width = props.width, scrollTop = state.scrollTop;
if (scrollToRow >= 0 && rowCount > 0) {
var targetIndex = Math.max(0, Math.min(rowCount - 1, scrollToRow)), totalColumnsWidth = this._columnSizeAndPositionManager.getTotalSize(), scrollBarSize = totalColumnsWidth > width ? this._scrollbarSize : 0, calculatedScrollTop = this._rowSizeAndPositionManager.getUpdatedOffsetForIndex({
align: scrollToAlignment,
containerSize: height - scrollBarSize,
currentOffset: scrollTop,
targetIndex: targetIndex
});
scrollTop !== calculatedScrollTop && this._setScrollPosition({
scrollTop: calculatedScrollTop
});
}
}
}, {
key: "_onScroll",
value: function(event) {
if (event.target === this._scrollingContainer && !(event.target.scrollTop < 0)) {
this._debounceScrollEnded();
var _props8 = this.props, autoHeight = _props8.autoHeight, height = _props8.height, width = _props8.width, scrollbarSize = this._scrollbarSize, totalRowsHeight = this._rowSizeAndPositionManager.getTotalSize(), totalColumnsWidth = this._columnSizeAndPositionManager.getTotalSize(), scrollLeft = Math.min(Math.max(0, totalColumnsWidth - width + scrollbarSize), event.target.scrollLeft), scrollTop = Math.min(Math.max(0, totalRowsHeight - height + scrollbarSize), event.target.scrollTop);
if (this.state.scrollLeft !== scrollLeft || this.state.scrollTop !== scrollTop) {
var scrollDirectionHorizontal = scrollLeft > this.state.scrollLeft ? _defaultOverscanIndicesGetter.SCROLL_DIRECTION_FORWARD : _defaultOverscanIndicesGetter.SCROLL_DIRECTION_BACKWARD, scrollDirectionVertical = scrollTop > this.state.scrollTop ? _defaultOverscanIndicesGetter.SCROLL_DIRECTION_FORWARD : _defaultOverscanIndicesGetter.SCROLL_DIRECTION_BACKWARD, newState = {
isScrolling: !0,
scrollDirectionHorizontal: scrollDirectionHorizontal,
scrollDirectionVertical: scrollDirectionVertical,
scrollLeft: scrollLeft,
scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS.OBSERVED
};
autoHeight || (newState.scrollTop = scrollTop), this.setState(newState);
}
this._invokeOnScrollMemoizer({
scrollLeft: scrollLeft,
scrollTop: scrollTop,
totalColumnsWidth: totalColumnsWidth,
totalRowsHeight: totalRowsHeight
});
}
}
} ]), Grid;
}(_react.PureComponent);
Grid.defaultProps = {
"aria-label": "grid",
cellRangeRenderer: _defaultCellRangeRenderer2.default,
estimatedColumnSize: 100,
estimatedRowSize: 30,
getScrollbarSize: __webpack_require__(112),
noContentRenderer: function() {
return null;
},
onScroll: function() {
return null;
},
onSectionRendered: function() {
return null;
},
overscanColumnCount: 0,
overscanIndicesGetter: _defaultOverscanIndicesGetter2.default,
overscanRowCount: 10,
scrollingResetTimeInterval: DEFAULT_SCROLLING_RESET_TIME_INTERVAL,
scrollToAlignment: "auto",
style: {},
tabIndex: 0
}, exports.default = Grid;
}, /* 130 */
/***/
function(module, exports) {
"use strict";
function calculateSizeAndPositionDataAndUpdateScrollOffset(_ref) {
var cellCount = _ref.cellCount, cellSize = _ref.cellSize, computeMetadataCallback = _ref.computeMetadataCallback, computeMetadataCallbackProps = _ref.computeMetadataCallbackProps, nextCellsCount = _ref.nextCellsCount, nextCellSize = _ref.nextCellSize, nextScrollToIndex = _ref.nextScrollToIndex, scrollToIndex = _ref.scrollToIndex, updateScrollOffsetForScrollToIndex = _ref.updateScrollOffsetForScrollToIndex;
cellCount === nextCellsCount && ("number" != typeof cellSize && "number" != typeof nextCellSize || cellSize === nextCellSize) || (computeMetadataCallback(computeMetadataCallbackProps),
scrollToIndex >= 0 && scrollToIndex === nextScrollToIndex && updateScrollOffsetForScrollToIndex());
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = calculateSizeAndPositionDataAndUpdateScrollOffset;
}, /* 131 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.DEFAULT_MAX_SCROLL_SIZE = void 0;
var _objectWithoutProperties2 = __webpack_require__(105), _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _CellSizeAndPositionManager = __webpack_require__(132), _CellSizeAndPositionManager2 = _interopRequireDefault(_CellSizeAndPositionManager), DEFAULT_MAX_SCROLL_SIZE = exports.DEFAULT_MAX_SCROLL_SIZE = 15e5, ScalingCellSizeAndPositionManager = function() {
function ScalingCellSizeAndPositionManager(_ref) {
var _ref$maxScrollSize = _ref.maxScrollSize, maxScrollSize = void 0 === _ref$maxScrollSize ? DEFAULT_MAX_SCROLL_SIZE : _ref$maxScrollSize, params = (0,
_objectWithoutProperties3.default)(_ref, [ "maxScrollSize" ]);
(0, _classCallCheck3.default)(this, ScalingCellSizeAndPositionManager), this._cellSizeAndPositionManager = new _CellSizeAndPositionManager2.default(params),
this._maxScrollSize = maxScrollSize;
}
return (0, _createClass3.default)(ScalingCellSizeAndPositionManager, [ {
key: "areOffsetsAdjusted",
value: function() {
return this._cellSizeAndPositionManager.getTotalSize() > this._maxScrollSize;
}
}, {
key: "configure",
value: function(params) {
this._cellSizeAndPositionManager.configure(params);
}
}, {
key: "getCellCount",
value: function() {
return this._cellSizeAndPositionManager.getCellCount();
}
}, {
key: "getEstimatedCellSize",
value: function() {
return this._cellSizeAndPositionManager.getEstimatedCellSize();
}
}, {
key: "getLastMeasuredIndex",
value: function() {
return this._cellSizeAndPositionManager.getLastMeasuredIndex();
}
}, {
key: "getOffsetAdjustment",
value: function(_ref2) {
var containerSize = _ref2.containerSize, offset = _ref2.offset, totalSize = this._cellSizeAndPositionManager.getTotalSize(), safeTotalSize = this.getTotalSize(), offsetPercentage = this._getOffsetPercentage({
containerSize: containerSize,
offset: offset,
totalSize: safeTotalSize
});
return Math.round(offsetPercentage * (safeTotalSize - totalSize));
}
}, {
key: "getSizeAndPositionOfCell",
value: function(index) {
return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(index);
}
}, {
key: "getSizeAndPositionOfLastMeasuredCell",
value: function() {
return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell();
}
}, {
key: "getTotalSize",
value: function() {
return Math.min(this._maxScrollSize, this._cellSizeAndPositionManager.getTotalSize());
}
}, {
key: "getUpdatedOffsetForIndex",
value: function(_ref3) {
var _ref3$align = _ref3.align, align = void 0 === _ref3$align ? "auto" : _ref3$align, containerSize = _ref3.containerSize, currentOffset = _ref3.currentOffset, targetIndex = _ref3.targetIndex, totalSize = _ref3.totalSize;
currentOffset = this._safeOffsetToOffset({
containerSize: containerSize,
offset: currentOffset
});
var offset = this._cellSizeAndPositionManager.getUpdatedOffsetForIndex({
align: align,
containerSize: containerSize,
currentOffset: currentOffset,
targetIndex: targetIndex,
totalSize: totalSize
});
return this._offsetToSafeOffset({
containerSize: containerSize,
offset: offset
});
}
}, {
key: "getVisibleCellRange",
value: function(_ref4) {
var containerSize = _ref4.containerSize, offset = _ref4.offset;
return offset = this._safeOffsetToOffset({
containerSize: containerSize,
offset: offset
}), this._cellSizeAndPositionManager.getVisibleCellRange({
containerSize: containerSize,
offset: offset
});
}
}, {
key: "resetCell",
value: function(index) {
this._cellSizeAndPositionManager.resetCell(index);
}
}, {
key: "_getOffsetPercentage",
value: function(_ref5) {
var containerSize = _ref5.containerSize, offset = _ref5.offset, totalSize = _ref5.totalSize;
return totalSize <= containerSize ? 0 : offset / (totalSize - containerSize);
}
}, {
key: "_offsetToSafeOffset",
value: function(_ref6) {
var containerSize = _ref6.containerSize, offset = _ref6.offset, totalSize = this._cellSizeAndPositionManager.getTotalSize(), safeTotalSize = this.getTotalSize();
if (totalSize === safeTotalSize) return offset;
var offsetPercentage = this._getOffsetPercentage({
containerSize: containerSize,
offset: offset,
totalSize: totalSize
});
return Math.round(offsetPercentage * (safeTotalSize - containerSize));
}
}, {
key: "_safeOffsetToOffset",
value: function(_ref7) {
var containerSize = _ref7.containerSize, offset = _ref7.offset, totalSize = this._cellSizeAndPositionManager.getTotalSize(), safeTotalSize = this.getTotalSize();
if (totalSize === safeTotalSize) return offset;
var offsetPercentage = this._getOffsetPercentage({
containerSize: containerSize,
offset: offset,
totalSize: safeTotalSize
});
return Math.round(offsetPercentage * (totalSize - containerSize));
}
} ]), ScalingCellSizeAndPositionManager;
}();
exports.default = ScalingCellSizeAndPositionManager;
}, /* 132 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), CellSizeAndPositionManager = function() {
function CellSizeAndPositionManager(_ref) {
var _ref$batchAllCells = _ref.batchAllCells, batchAllCells = void 0 !== _ref$batchAllCells && _ref$batchAllCells, cellCount = _ref.cellCount, cellSizeGetter = _ref.cellSizeGetter, estimatedCellSize = _ref.estimatedCellSize;
(0, _classCallCheck3.default)(this, CellSizeAndPositionManager), this._batchAllCells = batchAllCells,
this._cellSizeGetter = cellSizeGetter, this._cellCount = cellCount, this._estimatedCellSize = estimatedCellSize,
this._cellSizeAndPositionData = {}, this._lastMeasuredIndex = -1, this._lastBatchedIndex = -1;
}
return (0, _createClass3.default)(CellSizeAndPositionManager, [ {
key: "areOffsetsAdjusted",
value: function() {
return !1;
}
}, {
key: "configure",
value: function(_ref2) {
var cellCount = _ref2.cellCount, estimatedCellSize = _ref2.estimatedCellSize;
this._cellCount = cellCount, this._estimatedCellSize = estimatedCellSize;
}
}, {
key: "getCellCount",
value: function() {
return this._cellCount;
}
}, {
key: "getEstimatedCellSize",
value: function() {
return this._estimatedCellSize;
}
}, {
key: "getLastMeasuredIndex",
value: function() {
return this._lastMeasuredIndex;
}
}, {
key: "getOffsetAdjustment",
value: function(_ref3) {
_ref3.containerSize, _ref3.offset;
return 0;
}
}, {
key: "getSizeAndPositionOfCell",
value: function(index) {
if (index < 0 || index >= this._cellCount) throw Error("Requested index " + index + " is outside of range 0.." + this._cellCount);
if (index > this._lastMeasuredIndex) for (var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell(), _offset = lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size, i = this._lastMeasuredIndex + 1; i <= index; i++) {
var _size = this._cellSizeGetter({
index: i
});
if (void 0 === _size || isNaN(_size)) throw Error("Invalid size returned for cell " + i + " of value " + _size);
null === _size ? (this._cellSizeAndPositionData[i] = {
offset: _offset,
size: 0
}, this._lastBatchedIndex = index) : (this._cellSizeAndPositionData[i] = {
offset: _offset,
size: _size
}, _offset += _size, this._lastMeasuredIndex = index);
}
return this._cellSizeAndPositionData[index];
}
}, {
key: "getSizeAndPositionOfLastMeasuredCell",
value: function() {
return this._lastMeasuredIndex >= 0 ? this._cellSizeAndPositionData[this._lastMeasuredIndex] : {
offset: 0,
size: 0
};
}
}, {
key: "getTotalSize",
value: function() {
var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell();
return lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size + (this._cellCount - this._lastMeasuredIndex - 1) * this._estimatedCellSize;
}
}, {
key: "getUpdatedOffsetForIndex",
value: function(_ref4) {
var _ref4$align = _ref4.align, align = void 0 === _ref4$align ? "auto" : _ref4$align, containerSize = _ref4.containerSize, currentOffset = _ref4.currentOffset, targetIndex = _ref4.targetIndex;
if (containerSize <= 0) return 0;
var datum = this.getSizeAndPositionOfCell(targetIndex), maxOffset = datum.offset, minOffset = maxOffset - containerSize + datum.size, idealOffset = void 0;
switch (align) {
case "start":
idealOffset = maxOffset;
break;
case "end":
idealOffset = minOffset;
break;
case "center":
idealOffset = maxOffset - (containerSize - datum.size) / 2;
break;
default:
idealOffset = Math.max(minOffset, Math.min(maxOffset, currentOffset));
}
var totalSize = this.getTotalSize();
return Math.max(0, Math.min(totalSize - containerSize, idealOffset));
}
}, {
key: "getVisibleCellRange",
value: function(params) {
if (this._batchAllCells) return {
start: 0,
stop: this._cellCount - 1
};
var containerSize = params.containerSize, offset = params.offset, totalSize = this.getTotalSize();
if (0 === totalSize) return {};
var maxOffset = offset + containerSize, start = this._findNearestCell(offset), datum = this.getSizeAndPositionOfCell(start);
offset = datum.offset + datum.size;
for (var stop = start; offset < maxOffset && stop < this._cellCount - 1; ) stop++,
offset += this.getSizeAndPositionOfCell(stop).size;
return {
start: start,
stop: stop
};
}
}, {
key: "resetCell",
value: function(index) {
this._lastMeasuredIndex = Math.min(this._lastMeasuredIndex, index - 1);
}
}, {
key: "_binarySearch",
value: function(_ref5) {
for (var high = _ref5.high, low = _ref5.low, offset = _ref5.offset, middle = void 0, currentOffset = void 0; low <= high; ) {
if (middle = low + Math.floor((high - low) / 2), currentOffset = this.getSizeAndPositionOfCell(middle).offset,
currentOffset === offset) return middle;
currentOffset < offset ? low = middle + 1 : currentOffset > offset && (high = middle - 1);
}
if (low > 0) return low - 1;
}
}, {
key: "_exponentialSearch",
value: function(_ref6) {
for (var index = _ref6.index, offset = _ref6.offset, interval = 1; index < this._cellCount && this.getSizeAndPositionOfCell(index).offset < offset; ) index += interval,
interval *= 2;
return this._binarySearch({
high: Math.min(index, this._cellCount - 1),
low: Math.floor(index / 2),
offset: offset
});
}
}, {
key: "_findNearestCell",
value: function(offset) {
if (isNaN(offset)) throw Error("Invalid offset " + offset + " specified");
offset = Math.max(0, offset);
var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell(), lastMeasuredIndex = Math.max(0, this._lastMeasuredIndex);
return lastMeasuredCellSizeAndPosition.offset >= offset ? this._binarySearch({
high: lastMeasuredIndex,
low: 0,
offset: offset
}) : this._exponentialSearch({
index: lastMeasuredIndex,
offset: offset
});
}
} ]), CellSizeAndPositionManager;
}();
exports.default = CellSizeAndPositionManager;
}, /* 133 */
/***/
function(module, exports) {
"use strict";
function defaultOverscanIndicesGetter(_ref) {
var cellCount = _ref.cellCount, overscanCellsCount = _ref.overscanCellsCount, scrollDirection = _ref.scrollDirection, startIndex = _ref.startIndex, stopIndex = _ref.stopIndex, overscanStartIndex = void 0, overscanStopIndex = void 0;
switch (scrollDirection) {
case SCROLL_DIRECTION_FORWARD:
overscanStartIndex = startIndex, overscanStopIndex = stopIndex + overscanCellsCount;
break;
case SCROLL_DIRECTION_BACKWARD:
overscanStartIndex = startIndex - overscanCellsCount, overscanStopIndex = stopIndex;
}
return {
overscanStartIndex: Math.max(0, overscanStartIndex),
overscanStopIndex: Math.min(cellCount - 1, overscanStopIndex)
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = defaultOverscanIndicesGetter;
var SCROLL_DIRECTION_BACKWARD = exports.SCROLL_DIRECTION_BACKWARD = -1, SCROLL_DIRECTION_FORWARD = exports.SCROLL_DIRECTION_FORWARD = 1;
}, /* 134 */
/***/
function(module, exports) {
"use strict";
function updateScrollIndexHelper(_ref) {
var cellSize = _ref.cellSize, cellSizeAndPositionManager = _ref.cellSizeAndPositionManager, previousCellsCount = _ref.previousCellsCount, previousCellSize = _ref.previousCellSize, previousScrollToAlignment = _ref.previousScrollToAlignment, previousScrollToIndex = _ref.previousScrollToIndex, previousSize = _ref.previousSize, scrollOffset = _ref.scrollOffset, scrollToAlignment = _ref.scrollToAlignment, scrollToIndex = _ref.scrollToIndex, size = _ref.size, updateScrollIndexCallback = _ref.updateScrollIndexCallback, cellCount = cellSizeAndPositionManager.getCellCount(), hasScrollToIndex = scrollToIndex >= 0 && scrollToIndex < cellCount, sizeHasChanged = size !== previousSize || !previousCellSize || "number" == typeof cellSize && cellSize !== previousCellSize;
hasScrollToIndex && (sizeHasChanged || scrollToAlignment !== previousScrollToAlignment || scrollToIndex !== previousScrollToIndex) ? updateScrollIndexCallback(scrollToIndex) : !hasScrollToIndex && cellCount > 0 && (size < previousSize || cellCount < previousCellsCount) && scrollOffset > cellSizeAndPositionManager.getTotalSize() - size && updateScrollIndexCallback(cellCount - 1);
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = updateScrollIndexHelper;
}, /* 135 */
/***/
function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */
(function(process) {
"use strict";
function defaultCellRangeRenderer(_ref) {
for (var cellCache = _ref.cellCache, cellRenderer = _ref.cellRenderer, columnSizeAndPositionManager = _ref.columnSizeAndPositionManager, columnStartIndex = _ref.columnStartIndex, columnStopIndex = _ref.columnStopIndex, deferredMeasurementCache = _ref.deferredMeasurementCache, horizontalOffsetAdjustment = _ref.horizontalOffsetAdjustment, isScrolling = _ref.isScrolling, parent = _ref.parent, rowSizeAndPositionManager = _ref.rowSizeAndPositionManager, rowStartIndex = _ref.rowStartIndex, rowStopIndex = _ref.rowStopIndex, styleCache = (_ref.scrollLeft,
_ref.scrollTop, _ref.styleCache), verticalOffsetAdjustment = _ref.verticalOffsetAdjustment, visibleColumnIndices = _ref.visibleColumnIndices, visibleRowIndices = _ref.visibleRowIndices, deferredMode = "undefined" != typeof deferredMeasurementCache, renderedCells = [], areOffsetsAdjusted = columnSizeAndPositionManager.areOffsetsAdjusted() || rowSizeAndPositionManager.areOffsetsAdjusted(), canCacheStyle = !isScrolling || !areOffsetsAdjusted, rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) for (var rowDatum = rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex), columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
var columnDatum = columnSizeAndPositionManager.getSizeAndPositionOfCell(columnIndex), isVisible = columnIndex >= visibleColumnIndices.start && columnIndex <= visibleColumnIndices.stop && rowIndex >= visibleRowIndices.start && rowIndex <= visibleRowIndices.stop, key = rowIndex + "-" + columnIndex, style = void 0;
canCacheStyle && styleCache[key] ? style = styleCache[key] : deferredMode && !deferredMeasurementCache.has(rowIndex, columnIndex) ? style = {
height: "auto",
left: 0,
position: "absolute",
top: 0,
width: "auto"
} : (style = {
height: rowDatum.size,
left: columnDatum.offset + horizontalOffsetAdjustment,
position: "absolute",
top: rowDatum.offset + verticalOffsetAdjustment,
width: columnDatum.size
}, styleCache[key] = style);
var cellRendererParams = {
columnIndex: columnIndex,
isScrolling: isScrolling,
isVisible: isVisible,
key: key,
parent: parent,
rowIndex: rowIndex,
style: style
}, renderedCell = void 0;
!isScrolling || horizontalOffsetAdjustment || verticalOffsetAdjustment ? renderedCell = cellRenderer(cellRendererParams) : (cellCache[key] || (cellCache[key] = cellRenderer(cellRendererParams)),
renderedCell = cellCache[key]), null != renderedCell && renderedCell !== !1 && ("production" !== process.env.NODE_ENV && warnAboutMissingStyle(parent, renderedCell),
renderedCells.push(renderedCell));
}
return renderedCells;
}
function warnAboutMissingStyle(parent, renderedCell) {
"production" !== process.env.NODE_ENV && renderedCell && void 0 === renderedCell.props.style && parent.__warnedAboutMissingStyle !== !0 && (parent.__warnedAboutMissingStyle = !0,
console.warn("Rendered cell should include style property for positioning."));
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = defaultCellRangeRenderer;
}).call(exports, __webpack_require__(95));
}, /* 136 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function defaultRowRenderer(_ref) {
var className = _ref.className, columns = _ref.columns, index = _ref.index, key = (_ref.isScrolling,
_ref.key), onRowClick = _ref.onRowClick, onRowDoubleClick = _ref.onRowDoubleClick, onRowMouseOver = _ref.onRowMouseOver, onRowMouseOut = _ref.onRowMouseOut, rowData = _ref.rowData, style = _ref.style, a11yProps = {};
return (onRowClick || onRowDoubleClick || onRowMouseOver || onRowMouseOut) && (a11yProps["aria-label"] = "row",
a11yProps.role = "row", a11yProps.tabIndex = 0, onRowClick && (a11yProps.onClick = function() {
return onRowClick({
index: index,
rowData: rowData
});
}), onRowDoubleClick && (a11yProps.onDoubleClick = function() {
return onRowDoubleClick({
index: index,
rowData: rowData
});
}), onRowMouseOut && (a11yProps.onMouseOut = function() {
return onRowMouseOut({
index: index,
rowData: rowData
});
}), onRowMouseOver && (a11yProps.onMouseOver = function() {
return onRowMouseOver({
index: index,
rowData: rowData
});
})), _react2.default.createElement("div", (0, _extends3.default)({}, a11yProps, {
className: className,
key: key,
style: style
}), columns);
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _extends2 = __webpack_require__(100), _extends3 = _interopRequireDefault(_extends2);
exports.default = defaultRowRenderer;
var _react = __webpack_require__(89), _react2 = _interopRequireDefault(_react);
}, /* 137 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.InfiniteLoader = exports.default = void 0;
var _InfiniteLoader2 = __webpack_require__(138), _InfiniteLoader3 = _interopRequireDefault(_InfiniteLoader2);
exports.default = _InfiniteLoader3.default, exports.InfiniteLoader = _InfiniteLoader3.default;
}, /* 138 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function isRangeVisible(_ref2) {
var lastRenderedStartIndex = _ref2.lastRenderedStartIndex, lastRenderedStopIndex = _ref2.lastRenderedStopIndex, startIndex = _ref2.startIndex, stopIndex = _ref2.stopIndex;
return !(startIndex > lastRenderedStopIndex || stopIndex < lastRenderedStartIndex);
}
function scanForUnloadedRanges(_ref3) {
for (var isRowLoaded = _ref3.isRowLoaded, minimumBatchSize = _ref3.minimumBatchSize, rowCount = _ref3.rowCount, startIndex = _ref3.startIndex, stopIndex = _ref3.stopIndex, unloadedRanges = [], rangeStartIndex = null, rangeStopIndex = null, index = startIndex; index <= stopIndex; index++) {
var loaded = isRowLoaded({
index: index
});
loaded ? null !== rangeStopIndex && (unloadedRanges.push({
startIndex: rangeStartIndex,
stopIndex: rangeStopIndex
}), rangeStartIndex = rangeStopIndex = null) : (rangeStopIndex = index, null === rangeStartIndex && (rangeStartIndex = index));
}
if (null !== rangeStopIndex) {
for (var potentialStopIndex = Math.min(Math.max(rangeStopIndex, rangeStartIndex + minimumBatchSize - 1), rowCount - 1), _index = rangeStopIndex + 1; _index <= potentialStopIndex && !isRowLoaded({
index: _index
}); _index++) rangeStopIndex = _index;
unloadedRanges.push({
startIndex: rangeStartIndex,
stopIndex: rangeStopIndex
});
}
if (unloadedRanges.length) for (var firstUnloadedRange = unloadedRanges[0]; firstUnloadedRange.stopIndex - firstUnloadedRange.startIndex + 1 < minimumBatchSize && firstUnloadedRange.startIndex > 0; ) {
var _index2 = firstUnloadedRange.startIndex - 1;
if (isRowLoaded({
index: _index2
})) break;
firstUnloadedRange.startIndex = _index2;
}
return unloadedRanges;
}
function forceUpdateReactVirtualizedComponent(component) {
var recomputeSize = "function" == typeof component.recomputeGridSize ? component.recomputeGridSize : component.recomputeRowHeights;
recomputeSize ? recomputeSize.call(component) : component.forceUpdate();
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2);
exports.isRangeVisible = isRangeVisible, exports.scanForUnloadedRanges = scanForUnloadedRanges,
exports.forceUpdateReactVirtualizedComponent = forceUpdateReactVirtualizedComponent;
var _react = __webpack_require__(89), _createCallbackMemoizer = __webpack_require__(108), _createCallbackMemoizer2 = _interopRequireDefault(_createCallbackMemoizer), InfiniteLoader = function(_PureComponent) {
function InfiniteLoader(props, context) {
(0, _classCallCheck3.default)(this, InfiniteLoader);
var _this = (0, _possibleConstructorReturn3.default)(this, (InfiniteLoader.__proto__ || (0,
_getPrototypeOf2.default)(InfiniteLoader)).call(this, props, context));
return _this._loadMoreRowsMemoizer = (0, _createCallbackMemoizer2.default)(), _this._onRowsRendered = _this._onRowsRendered.bind(_this),
_this._registerChild = _this._registerChild.bind(_this), _this;
}
return (0, _inherits3.default)(InfiniteLoader, _PureComponent), (0, _createClass3.default)(InfiniteLoader, [ {
key: "render",
value: function() {
var children = this.props.children;
return children({
onRowsRendered: this._onRowsRendered,
registerChild: this._registerChild
});
}
}, {
key: "_loadUnloadedRanges",
value: function(unloadedRanges) {
var _this2 = this, loadMoreRows = this.props.loadMoreRows;
unloadedRanges.forEach(function(unloadedRange) {
var promise = loadMoreRows(unloadedRange);
promise && promise.then(function() {
isRangeVisible({
lastRenderedStartIndex: _this2._lastRenderedStartIndex,
lastRenderedStopIndex: _this2._lastRenderedStopIndex,
startIndex: unloadedRange.startIndex,
stopIndex: unloadedRange.stopIndex
}) && _this2._registeredChild && forceUpdateReactVirtualizedComponent(_this2._registeredChild);
});
});
}
}, {
key: "_onRowsRendered",
value: function(_ref) {
var _this3 = this, startIndex = _ref.startIndex, stopIndex = _ref.stopIndex, _props = this.props, isRowLoaded = _props.isRowLoaded, minimumBatchSize = _props.minimumBatchSize, rowCount = _props.rowCount, threshold = _props.threshold;
this._lastRenderedStartIndex = startIndex, this._lastRenderedStopIndex = stopIndex;
var unloadedRanges = scanForUnloadedRanges({
isRowLoaded: isRowLoaded,
minimumBatchSize: minimumBatchSize,
rowCount: rowCount,
startIndex: Math.max(0, startIndex - threshold),
stopIndex: Math.min(rowCount - 1, stopIndex + threshold)
}), squashedUnloadedRanges = unloadedRanges.reduce(function(reduced, unloadedRange) {
return reduced.concat([ unloadedRange.startIndex, unloadedRange.stopIndex ]);
}, []);
this._loadMoreRowsMemoizer({
callback: function() {
_this3._loadUnloadedRanges(unloadedRanges);
},
indices: {
squashedUnloadedRanges: squashedUnloadedRanges
}
});
}
}, {
key: "_registerChild",
value: function(registeredChild) {
this._registeredChild = registeredChild;
}
} ]), InfiniteLoader;
}(_react.PureComponent);
InfiniteLoader.defaultProps = {
minimumBatchSize: 10,
rowCount: 0,
threshold: 15
}, exports.default = InfiniteLoader;
}, /* 139 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.List = exports.default = void 0;
var _List2 = __webpack_require__(140), _List3 = _interopRequireDefault(_List2);
exports.default = _List3.default, exports.List = _List3.default;
}, /* 140 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _getOwnPropertyDescriptor = __webpack_require__(141), _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor), _objectWithoutProperties2 = __webpack_require__(105), _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2), _extends2 = __webpack_require__(100), _extends3 = _interopRequireDefault(_extends2), _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _Grid = __webpack_require__(128), _Grid2 = _interopRequireDefault(_Grid), _react = __webpack_require__(89), _react2 = _interopRequireDefault(_react), _classnames = __webpack_require__(107), _classnames2 = _interopRequireDefault(_classnames), List = function(_PureComponent) {
function List(props, context) {
(0, _classCallCheck3.default)(this, List);
var _this = (0, _possibleConstructorReturn3.default)(this, (List.__proto__ || (0,
_getPrototypeOf2.default)(List)).call(this, props, context));
return _this._cellRenderer = _this._cellRenderer.bind(_this), _this._onScroll = _this._onScroll.bind(_this),
_this._onSectionRendered = _this._onSectionRendered.bind(_this), _this._setRef = _this._setRef.bind(_this),
_this;
}
return (0, _inherits3.default)(List, _PureComponent), (0, _createClass3.default)(List, [ {
key: "forceUpdateGrid",
value: function() {
this.Grid.forceUpdate();
}
}, {
key: "measureAllRows",
value: function() {
this.Grid.measureAllCells();
}
}, {
key: "recomputeRowHeights",
value: function() {
var index = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
this.Grid.recomputeGridSize({
rowIndex: index
});
}
}, {
key: "scrollToRow",
value: function() {
var index = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
this.Grid.scrollToCell({
columnIndex: 0,
rowIndex: index
});
}
}, {
key: "render",
value: function() {
var _props = this.props, className = _props.className, noRowsRenderer = _props.noRowsRenderer, scrollToIndex = _props.scrollToIndex, width = _props.width, classNames = (0,
_classnames2.default)("ReactVirtualized__List", className);
return _react2.default.createElement(_Grid2.default, (0, _extends3.default)({}, this.props, {
autoContainerWidth: !0,
cellRenderer: this._cellRenderer,
className: classNames,
columnWidth: width,
columnCount: 1,
noContentRenderer: noRowsRenderer,
onScroll: this._onScroll,
onSectionRendered: this._onSectionRendered,
ref: this._setRef,
scrollToRow: scrollToIndex
}));
}
}, {
key: "_cellRenderer",
value: function(_ref) {
var rowIndex = _ref.rowIndex, style = _ref.style, rest = (0, _objectWithoutProperties3.default)(_ref, [ "rowIndex", "style" ]), rowRenderer = this.props.rowRenderer, _Object$getOwnPropert = (0,
_getOwnPropertyDescriptor2.default)(style, "width"), writable = _Object$getOwnPropert.writable;
return writable && (style.width = "100%"), rowRenderer((0, _extends3.default)({
index: rowIndex,
style: style
}, rest));
}
}, {
key: "_setRef",
value: function(ref) {
this.Grid = ref;
}
}, {
key: "_onScroll",
value: function(_ref2) {
var clientHeight = _ref2.clientHeight, scrollHeight = _ref2.scrollHeight, scrollTop = _ref2.scrollTop, onScroll = this.props.onScroll;
onScroll({
clientHeight: clientHeight,
scrollHeight: scrollHeight,
scrollTop: scrollTop
});
}
}, {
key: "_onSectionRendered",
value: function(_ref3) {
var rowOverscanStartIndex = _ref3.rowOverscanStartIndex, rowOverscanStopIndex = _ref3.rowOverscanStopIndex, rowStartIndex = _ref3.rowStartIndex, rowStopIndex = _ref3.rowStopIndex, onRowsRendered = this.props.onRowsRendered;
onRowsRendered({
overscanStartIndex: rowOverscanStartIndex,
overscanStopIndex: rowOverscanStopIndex,
startIndex: rowStartIndex,
stopIndex: rowStopIndex
});
}
} ]), List;
}(_react.PureComponent);
List.defaultProps = {
estimatedRowSize: 30,
noRowsRenderer: function() {
return null;
},
onRowsRendered: function() {
return null;
},
onScroll: function() {
return null;
},
overscanRowCount: 10,
scrollToAlignment: "auto",
style: {}
}, exports.default = List;
}, /* 141 */
/***/
function(module, exports, __webpack_require__) {
module.exports = {
default: __webpack_require__(142),
__esModule: !0
};
}, /* 142 */
/***/
function(module, exports, __webpack_require__) {
__webpack_require__(143);
var $Object = __webpack_require__(16).Object;
module.exports = function(it, key) {
return $Object.getOwnPropertyDescriptor(it, key);
};
}, /* 143 */
/***/
function(module, exports, __webpack_require__) {
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
var toIObject = __webpack_require__(50), $getOwnPropertyDescriptor = __webpack_require__(77).f;
__webpack_require__(14)("getOwnPropertyDescriptor", function() {
return function(it, key) {
return $getOwnPropertyDescriptor(toIObject(it), key);
};
});
}, /* 144 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.MultiGrid = exports.default = void 0;
var _MultiGrid2 = __webpack_require__(145), _MultiGrid3 = _interopRequireDefault(_MultiGrid2);
exports.default = _MultiGrid3.default, exports.MultiGrid = _MultiGrid3.default;
}, /* 145 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _extends2 = __webpack_require__(100), _extends3 = _interopRequireDefault(_extends2), _objectWithoutProperties2 = __webpack_require__(105), _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2), _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(89), _react2 = _interopRequireDefault(_react), _Grid = __webpack_require__(128), _Grid2 = _interopRequireDefault(_Grid), MultiGrid = function(_PureComponent) {
function MultiGrid(props, context) {
(0, _classCallCheck3.default)(this, MultiGrid);
var _this = (0, _possibleConstructorReturn3.default)(this, (MultiGrid.__proto__ || (0,
_getPrototypeOf2.default)(MultiGrid)).call(this, props, context));
return _this.state = {
scrollLeft: 0,
scrollTop: 0
}, _this._bottomLeftGridRef = _this._bottomLeftGridRef.bind(_this), _this._bottomRightGridRef = _this._bottomRightGridRef.bind(_this),
_this._cellRendererBottomLeftGrid = _this._cellRendererBottomLeftGrid.bind(_this),
_this._cellRendererBottomRightGrid = _this._cellRendererBottomRightGrid.bind(_this),
_this._cellRendererTopRightGrid = _this._cellRendererTopRightGrid.bind(_this), _this._columnWidthRightGrid = _this._columnWidthRightGrid.bind(_this),
_this._onScroll = _this._onScroll.bind(_this), _this._rowHeightBottomGrid = _this._rowHeightBottomGrid.bind(_this),
_this._topLeftGridRef = _this._topLeftGridRef.bind(_this), _this._topRightGridRef = _this._topRightGridRef.bind(_this),
_this;
}
return (0, _inherits3.default)(MultiGrid, _PureComponent), (0, _createClass3.default)(MultiGrid, [ {
key: "forceUpdateGrids",
value: function() {
this._bottomLeftGrid && this._bottomLeftGrid.forceUpdate(), this._bottomRightGrid && this._bottomRightGrid.forceUpdate(),
this._topLeftGrid && this._topLeftGrid.forceUpdate(), this._topRightGrid && this._topRightGrid.forceUpdate();
}
}, {
key: "measureAllCells",
value: function() {
this._bottomLeftGrid && this._bottomLeftGrid.measureAllCells(), this._bottomRightGrid && this._bottomRightGrid.measureAllCells(),
this._topLeftGrid && this._topLeftGrid.measureAllCells(), this._topRightGrid && this._topRightGrid.measureAllCells();
}
}, {
key: "recomputeGridSize",
value: function() {
var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, _ref$columnIndex = _ref.columnIndex, columnIndex = void 0 === _ref$columnIndex ? 0 : _ref$columnIndex, _ref$rowIndex = _ref.rowIndex, rowIndex = void 0 === _ref$rowIndex ? 0 : _ref$rowIndex, _props = this.props, fixedColumnCount = _props.fixedColumnCount, fixedRowCount = _props.fixedRowCount, adjustedColumnIndex = Math.max(0, columnIndex - fixedColumnCount), adjustedRowIndex = Math.max(0, rowIndex - fixedRowCount);
this._bottomLeftGrid && this._bottomLeftGrid.recomputeGridSize({
columnIndex: columnIndex,
rowIndex: adjustedRowIndex
}), this._bottomRightGrid && this._bottomRightGrid.recomputeGridSize({
columnIndex: adjustedColumnIndex,
rowIndex: adjustedRowIndex
}), this._topLeftGrid && this._topLeftGrid.recomputeGridSize({
columnIndex: columnIndex,
rowIndex: rowIndex
}), this._topRightGrid && this._topRightGrid.recomputeGridSize({
columnIndex: adjustedColumnIndex,
rowIndex: rowIndex
}), this._leftGridWidth = null, this._topGridHeight = null, this._maybeCalculateCachedStyles(null, this.props);
}
}, {
key: "componentWillMount",
value: function() {
this._maybeCalculateCachedStyles(null, this.props);
}
}, {
key: "componentWillReceiveProps",
value: function(nextProps) {
var _props2 = this.props, columnWidth = _props2.columnWidth, fixedColumnCount = _props2.fixedColumnCount, fixedRowCount = _props2.fixedRowCount, rowHeight = _props2.rowHeight;
columnWidth === nextProps.columnWidth && fixedColumnCount === nextProps.fixedColumnCount || (this._leftGridWidth = null),
fixedRowCount === nextProps.fixedRowCount && rowHeight === nextProps.rowHeight || (this._topGridHeight = null),
this._maybeCalculateCachedStyles(this.props, nextProps);
}
}, {
key: "render",
value: function() {
var _props3 = this.props, onScroll = _props3.onScroll, onSectionRendered = _props3.onSectionRendered, scrollToColumn = (_props3.scrollLeft,
_props3.scrollToColumn), scrollToRow = (_props3.scrollTop, _props3.scrollToRow), rest = (0,
_objectWithoutProperties3.default)(_props3, [ "onScroll", "onSectionRendered", "scrollLeft", "scrollToColumn", "scrollTop", "scrollToRow" ]), _state = this.state, scrollLeft = _state.scrollLeft, scrollTop = _state.scrollTop;
return _react2.default.createElement("div", {
style: this._containerOuterStyle
}, _react2.default.createElement("div", {
style: this._containerTopStyle
}, this._renderTopLeftGrid(rest), this._renderTopRightGrid((0, _extends3.default)({}, rest, {
scrollLeft: scrollLeft
}))), _react2.default.createElement("div", {
style: this._containerBottomStyle
}, this._renderBottomLeftGrid((0, _extends3.default)({}, rest, {
scrollTop: scrollTop
})), this._renderBottomRightGrid((0, _extends3.default)({}, rest, {
onScroll: onScroll,
onSectionRendered: onSectionRendered,
scrollLeft: scrollLeft,
scrollToColumn: scrollToColumn,
scrollToRow: scrollToRow,
scrollTop: scrollTop
}))));
}
}, {
key: "_bottomLeftGridRef",
value: function(ref) {
this._bottomLeftGrid = ref;
}
}, {
key: "_bottomRightGridRef",
value: function(ref) {
this._bottomRightGrid = ref;
}
}, {
key: "_cellRendererBottomLeftGrid",
value: function(_ref2) {
var rowIndex = _ref2.rowIndex, rest = (0, _objectWithoutProperties3.default)(_ref2, [ "rowIndex" ]), _props4 = this.props, cellRenderer = _props4.cellRenderer, fixedRowCount = _props4.fixedRowCount;
return cellRenderer((0, _extends3.default)({}, rest, {
rowIndex: rowIndex + fixedRowCount
}));
}
}, {
key: "_cellRendererBottomRightGrid",
value: function(_ref3) {
var columnIndex = _ref3.columnIndex, rowIndex = _ref3.rowIndex, rest = (0, _objectWithoutProperties3.default)(_ref3, [ "columnIndex", "rowIndex" ]), _props5 = this.props, cellRenderer = _props5.cellRenderer, fixedColumnCount = _props5.fixedColumnCount, fixedRowCount = _props5.fixedRowCount;
return cellRenderer((0, _extends3.default)({}, rest, {
columnIndex: columnIndex + fixedColumnCount,
rowIndex: rowIndex + fixedRowCount
}));
}
}, {
key: "_cellRendererTopRightGrid",
value: function(_ref4) {
var columnIndex = _ref4.columnIndex, rest = (0, _objectWithoutProperties3.default)(_ref4, [ "columnIndex" ]), _props6 = this.props, cellRenderer = _props6.cellRenderer, fixedColumnCount = _props6.fixedColumnCount;
return cellRenderer((0, _extends3.default)({}, rest, {
columnIndex: columnIndex + fixedColumnCount
}));
}
}, {
key: "_columnWidthRightGrid",
value: function(_ref5) {
var index = _ref5.index, _props7 = this.props, fixedColumnCount = _props7.fixedColumnCount, columnWidth = _props7.columnWidth;
return columnWidth instanceof Function ? columnWidth({
index: index + fixedColumnCount
}) : columnWidth;
}
}, {
key: "_getBottomGridHeight",
value: function(props) {
var height = props.height, topGridHeight = this._getTopGridHeight(props);
return height - topGridHeight;
}
}, {
key: "_getLeftGridWidth",
value: function(props) {
var fixedColumnCount = props.fixedColumnCount, columnWidth = props.columnWidth;
if (null == this._leftGridWidth) if (columnWidth instanceof Function) {
for (var leftGridWidth = 0, index = 0; index < fixedColumnCount; index++) leftGridWidth += columnWidth({
index: index
});
this._leftGridWidth = leftGridWidth;
} else this._leftGridWidth = columnWidth * fixedColumnCount;
return this._leftGridWidth;
}
}, {
key: "_getRightGridWidth",
value: function(props) {
var width = props.width, leftGridWidth = this._getLeftGridWidth(props);
return width - leftGridWidth;
}
}, {
key: "_getTopGridHeight",
value: function(props) {
var fixedRowCount = props.fixedRowCount, rowHeight = props.rowHeight;
if (null == this._topGridHeight) if (rowHeight instanceof Function) {
for (var topGridHeight = 0, index = 0; index < fixedRowCount; index++) topGridHeight += rowHeight({
index: index
});
this._topGridHeight = topGridHeight;
} else this._topGridHeight = rowHeight * fixedRowCount;
return this._topGridHeight;
}
}, {
key: "_maybeCalculateCachedStyles",
value: function(prevProps, props) {
var columnWidth = props.columnWidth, height = props.height, fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, rowHeight = props.rowHeight, style = props.style, styleBottomLeftGrid = props.styleBottomLeftGrid, styleBottomRightGrid = props.styleBottomRightGrid, styleTopLeftGrid = props.styleTopLeftGrid, styleTopRightGrid = props.styleTopRightGrid, width = props.width, firstRender = !prevProps, sizeChange = firstRender || height !== prevProps.height || width !== prevProps.width, leftSizeChange = firstRender || columnWidth !== prevProps.columnWidth || fixedColumnCount !== prevProps.fixedColumnCount, topSizeChange = firstRender || fixedRowCount !== prevProps.fixedRowCount || rowHeight !== prevProps.rowHeight;
(firstRender || sizeChange || style !== prevProps.style) && (this._containerOuterStyle = (0,
_extends3.default)({
height: height,
width: width
}, style)), (firstRender || sizeChange || topSizeChange) && (this._containerTopStyle = {
height: this._getTopGridHeight(props),
position: "relative",
width: width
}, this._containerBottomStyle = {
height: height - this._getTopGridHeight(props),
overflow: "hidden",
position: "relative",
width: width
}), (firstRender || styleBottomLeftGrid !== prevProps.styleBottomLeftGrid) && (this._bottomLeftGridStyle = (0,
_extends3.default)({
left: 0,
outline: 0,
overflowX: "hidden",
overflowY: "hidden",
position: "absolute"
}, styleBottomLeftGrid)), (firstRender || leftSizeChange || styleBottomRightGrid !== prevProps.styleBottomRightGrid) && (this._bottomRightGridStyle = (0,
_extends3.default)({
left: this._getLeftGridWidth(props),
outline: 0,
position: "absolute"
}, styleBottomRightGrid)), (firstRender || styleTopLeftGrid !== prevProps.styleTopLeftGrid) && (this._topLeftGridStyle = (0,
_extends3.default)({
left: 0,
outline: 0,
overflowX: "hidden",
overflowY: "hidden",
position: "absolute",
top: 0
}, styleTopLeftGrid)), (firstRender || leftSizeChange || styleTopRightGrid !== prevProps.styleTopRightGrid) && (this._topRightGridStyle = (0,
_extends3.default)({
left: this._getLeftGridWidth(props),
outline: 0,
overflowX: "hidden",
overflowY: "hidden",
position: "absolute",
top: 0
}, styleTopRightGrid));
}
}, {
key: "_onScroll",
value: function(scrollInfo) {
var scrollLeft = scrollInfo.scrollLeft, scrollTop = scrollInfo.scrollTop;
this.setState({
scrollLeft: scrollLeft,
scrollTop: scrollTop
});
var onScroll = this.props.onScroll;
onScroll && onScroll(scrollInfo);
}
}, {
key: "_renderBottomLeftGrid",
value: function(props) {
var fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, rowCount = props.rowCount, scrollTop = props.scrollTop;
return fixedColumnCount ? _react2.default.createElement(_Grid2.default, (0, _extends3.default)({}, props, {
cellRenderer: this._cellRendererBottomLeftGrid,
columnCount: fixedColumnCount,
height: this._getBottomGridHeight(props),
ref: this._bottomLeftGridRef,
rowCount: Math.max(0, rowCount - fixedRowCount),
rowHeight: this._rowHeightBottomGrid,
scrollTop: scrollTop,
style: this._bottomLeftGridStyle,
width: this._getLeftGridWidth(props)
})) : null;
}
}, {
key: "_renderBottomRightGrid",
value: function(props) {
var columnCount = props.columnCount, fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, rowCount = props.rowCount, scrollToColumn = props.scrollToColumn, scrollToRow = props.scrollToRow;
return _react2.default.createElement(_Grid2.default, (0, _extends3.default)({}, props, {
cellRenderer: this._cellRendererBottomRightGrid,
columnCount: Math.max(0, columnCount - fixedColumnCount),
columnWidth: this._columnWidthRightGrid,
height: this._getBottomGridHeight(props),
onScroll: this._onScroll,
ref: this._bottomRightGridRef,
rowCount: Math.max(0, rowCount - fixedRowCount),
rowHeight: this._rowHeightBottomGrid,
scrollToColumn: scrollToColumn - fixedColumnCount,
scrollToRow: scrollToRow - fixedRowCount,
style: this._bottomRightGridStyle,
width: this._getRightGridWidth(props)
}));
}
}, {
key: "_renderTopLeftGrid",
value: function(props) {
var fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount;
return fixedColumnCount && fixedRowCount ? _react2.default.createElement(_Grid2.default, (0,
_extends3.default)({}, props, {
columnCount: fixedColumnCount,
height: this._getTopGridHeight(props),
ref: this._topLeftGridRef,
rowCount: fixedRowCount,
style: this._topLeftGridStyle,
width: this._getLeftGridWidth(props)
})) : null;
}
}, {
key: "_renderTopRightGrid",
value: function(props) {
var columnCount = props.columnCount, fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, scrollLeft = props.scrollLeft;
return fixedRowCount ? _react2.default.createElement(_Grid2.default, (0, _extends3.default)({}, props, {
cellRenderer: this._cellRendererTopRightGrid,
columnCount: Math.max(0, columnCount - fixedColumnCount),
columnWidth: this._columnWidthRightGrid,
height: this._getTopGridHeight(props),
ref: this._topRightGridRef,
rowCount: fixedRowCount,
scrollLeft: scrollLeft,
style: this._topRightGridStyle,
width: this._getRightGridWidth(props)
})) : null;
}
}, {
key: "_rowHeightBottomGrid",
value: function(_ref6) {
var index = _ref6.index, _props8 = this.props, fixedRowCount = _props8.fixedRowCount, rowHeight = _props8.rowHeight;
return rowHeight instanceof Function ? rowHeight({
index: index + fixedRowCount
}) : rowHeight;
}
}, {
key: "_topLeftGridRef",
value: function(ref) {
this._topLeftGrid = ref;
}
}, {
key: "_topRightGridRef",
value: function(ref) {
this._topRightGrid = ref;
}
} ]), MultiGrid;
}(_react.PureComponent);
MultiGrid.defaultProps = {
fixedColumnCount: 0,
fixedRowCount: 0,
style: {},
styleBottomLeftGrid: {},
styleBottomRightGrid: {},
styleTopLeftGrid: {},
styleTopRightGrid: {}
}, exports.default = MultiGrid;
}, /* 146 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.ScrollSync = exports.default = void 0;
var _ScrollSync2 = __webpack_require__(147), _ScrollSync3 = _interopRequireDefault(_ScrollSync2);
exports.default = _ScrollSync3.default, exports.ScrollSync = _ScrollSync3.default;
}, /* 147 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(89), ScrollSync = function(_PureComponent) {
function ScrollSync(props, context) {
(0, _classCallCheck3.default)(this, ScrollSync);
var _this = (0, _possibleConstructorReturn3.default)(this, (ScrollSync.__proto__ || (0,
_getPrototypeOf2.default)(ScrollSync)).call(this, props, context));
return _this.state = {
clientHeight: 0,
clientWidth: 0,
scrollHeight: 0,
scrollLeft: 0,
scrollTop: 0,
scrollWidth: 0
}, _this._onScroll = _this._onScroll.bind(_this), _this;
}
return (0, _inherits3.default)(ScrollSync, _PureComponent), (0, _createClass3.default)(ScrollSync, [ {
key: "render",
value: function() {
var children = this.props.children, _state = this.state, clientHeight = _state.clientHeight, clientWidth = _state.clientWidth, scrollHeight = _state.scrollHeight, scrollLeft = _state.scrollLeft, scrollTop = _state.scrollTop, scrollWidth = _state.scrollWidth;
return children({
clientHeight: clientHeight,
clientWidth: clientWidth,
onScroll: this._onScroll,
scrollHeight: scrollHeight,
scrollLeft: scrollLeft,
scrollTop: scrollTop,
scrollWidth: scrollWidth
});
}
}, {
key: "_onScroll",
value: function(_ref) {
var clientHeight = _ref.clientHeight, clientWidth = _ref.clientWidth, scrollHeight = _ref.scrollHeight, scrollLeft = _ref.scrollLeft, scrollTop = _ref.scrollTop, scrollWidth = _ref.scrollWidth;
this.setState({
clientHeight: clientHeight,
clientWidth: clientWidth,
scrollHeight: scrollHeight,
scrollLeft: scrollLeft,
scrollTop: scrollTop,
scrollWidth: scrollWidth
});
}
} ]), ScrollSync;
}(_react.PureComponent);
exports.default = ScrollSync;
}, /* 148 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.IS_SCROLLING_TIMEOUT = exports.WindowScroller = exports.default = void 0;
var _onScroll = __webpack_require__(149);
Object.defineProperty(exports, "IS_SCROLLING_TIMEOUT", {
enumerable: !0,
get: function() {
return _onScroll.IS_SCROLLING_TIMEOUT;
}
});
var _WindowScroller2 = __webpack_require__(150), _WindowScroller3 = _interopRequireDefault(_WindowScroller2);
exports.default = _WindowScroller3.default, exports.WindowScroller = _WindowScroller3.default;
}, /* 149 */
/***/
function(module, exports) {
"use strict";
function enablePointerEventsIfDisabled() {
disablePointerEventsTimeoutId && (disablePointerEventsTimeoutId = null, document.body.style.pointerEvents = originalBodyPointerEvents,
originalBodyPointerEvents = null);
}
function enablePointerEventsAfterDelayCallback() {
enablePointerEventsIfDisabled(), mountedInstances.forEach(function(instance) {
return instance.__resetIsScrolling();
});
}
function enablePointerEventsAfterDelay() {
disablePointerEventsTimeoutId && clearTimeout(disablePointerEventsTimeoutId), disablePointerEventsTimeoutId = setTimeout(enablePointerEventsAfterDelayCallback, IS_SCROLLING_TIMEOUT);
}
function onScrollWindow(event) {
event.currentTarget === window && null == originalBodyPointerEvents && (originalBodyPointerEvents = document.body.style.pointerEvents,
document.body.style.pointerEvents = "none"), enablePointerEventsAfterDelay(), mountedInstances.forEach(function(instance) {
instance.scrollElement === event.currentTarget && instance.__handleWindowScrollEvent(event);
});
}
function registerScrollListener(component, element) {
mountedInstances.some(function(instance) {
return instance.scrollElement === element;
}) || element.addEventListener("scroll", onScrollWindow), mountedInstances.push(component);
}
function unregisterScrollListener(component, element) {
mountedInstances = mountedInstances.filter(function(instance) {
return instance !== component;
}), mountedInstances.length || (element.removeEventListener("scroll", onScrollWindow),
disablePointerEventsTimeoutId && (clearTimeout(disablePointerEventsTimeoutId), enablePointerEventsIfDisabled()));
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.registerScrollListener = registerScrollListener, exports.unregisterScrollListener = unregisterScrollListener;
var mountedInstances = [], originalBodyPointerEvents = null, disablePointerEventsTimeoutId = null, IS_SCROLLING_TIMEOUT = exports.IS_SCROLLING_TIMEOUT = 150;
}, /* 150 */
/***/
function(module, exports, __webpack_require__) {
"use strict";
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var _getPrototypeOf = __webpack_require__(3), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(29), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(30), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(34), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(81), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(89), _reactDom = __webpack_require__(96), _reactDom2 = _interopRequireDefault(_reactDom), _onScroll = __webpack_require__(149), _dimensions = __webpack_require__(151), WindowScroller = function(_PureComponent) {
function WindowScroller(props) {
(0, _classCallCheck3.default)(this, WindowScroller);
var _this = (0, _possibleConstructorReturn3.default)(this, (WindowScroller.__proto__ || (0,
_getPrototypeOf2.default)(WindowScroller)).call(this, props)), height = "undefined" != typeof window ? (0,
_dimensions.getHeight)(props.scrollElement || window) : 0;
return _this.state = {
height: height,
isScrolling: !1,
scrollTop: 0
}, _this._onResize = _this._onResize.bind(_this), _this.__handleWindowScrollEvent = _this.__handleWindowScrollEvent.bind(_this),
_this.__resetIsScrolling = _this.__resetIsScrolling.bind(_this), _this;
}
return (0, _inherits3.default)(WindowScroller, _PureComponent), (0, _createClass3.default)(WindowScroller, [ {
key: "updatePosition",
value: function(scrollElement) {
var onResize = this.props.onResize, height = this.state.height;
scrollElement = scrollElement || this.props.scrollElement || window, this._positionFromTop = (0,
_dimensions.getPositionFromTop)(_reactDom2.default.findDOMNode(this), scrollElement);
var newHeight = (0, _dimensions.getHeight)(scrollElement);
height !== newHeight && (this.setState({
height: newHeight
}), onResize({
height: newHeight
}));
}
}, {
key: "componentDidMount",
value: function() {
var scrollElement = this.props.scrollElement || window;
this.updatePosition(scrollElement), (0, _onScroll.registerScrollListener)(this, scrollElement),
window.addEventListener("resize", this._onResize, !1);
}
}, {
key: "componentWillReceiveProps",
value: function(nextProps) {
var scrollElement = this.props.scrollElement || window, nextScrollElement = nextProps.scrollElement || window;
scrollElement !== nextScrollElement && (this.updatePosition(nextScrollElement),
(0, _onScroll.unregisterScrollListener)(this, scrollElement), (0, _onScroll.registerScrollListener)(this, nextScrollElement));
}
}, {
key: "componentWillUnmount",
value: function() {
(0, _onScroll.unregisterScrollListener)(this, this.props.scrollElement || window),
window.removeEventListener("resize", this._onResize, !1);
}
}, {
key: "render",
value: function() {
var children = this.props.children, _state = this.state, isScrolling = _state.isScrolling, scrollTop = _state.scrollTop, height = _state.height;
return children({
height: height,
isScrolling: isScrolling,
scrollTop: scrollTop
});
}
}, {
key: "_onResize",
value: function(event) {
this.updatePosition();
}
}, {
key: "__handleWindowScrollEvent",
value: function(event) {
var onScroll = this.props.onScroll, scrollElement = this.props.scrollElement || window, scrollTop = Math.max(0, (0,
_dimensions.getScrollTop)(scrollElement) - this._positionFromTop);
this.setState({
isScrolling: !0,
scrollTop: scrollTop
}), onScroll({
scrollTop: scrollTop
});
}
}, {
key: "__resetIsScrolling",
value: function() {
this.setState({
isScrolling: !1
});
}
}, {
key: "scrollElement",
get: function() {
return this.props.scrollElement || window;
}
} ]), WindowScroller;
}(_react.PureComponent);
WindowScroller.defaultProps = {
onResize: function() {},
onScroll: function() {}
}, exports.default = WindowScroller;
}, /* 151 */
/***/
function(module, exports) {
"use strict";
function getHeight(element) {
return element === window ? "number" == typeof window.innerHeight ? window.innerHeight : 0 : element.getBoundingClientRect().height;
}
function getPositionFromTop(element, container) {
var offset = container === window ? 0 : getScrollTop(container), containerElement = container === window ? document.documentElement : container;
return element.getBoundingClientRect().top + offset - containerElement.getBoundingClientRect().top;
}
function getScrollTop(element) {
return element === window ? "scrollY" in window ? window.scrollY : document.documentElement.scrollTop : element.scrollTop;
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.getHeight = getHeight, exports.getPositionFromTop = getPositionFromTop,
exports.getScrollTop = getScrollTop;
} ]);
});
//# sourceMappingURL=react-virtualized.js.map
|
__tests__/boilerplate_test.js
|
ArcQ/variable-form-fields
|
// import React from 'react';
// import {
// renderIntoDocument,
// findRenderedDOMComponentWithClass,
// findRenderedDOMComponentWithTag,
// Simulate
// } from 'react-addons-test-utils';
import { expect } from 'chai';
describe('Boilerplate', function () {
it('should do boilerplate things', function () {
// TODO: test something now
expect(true).to.equal(true);
});
});
|
lib/components/SevenHour.js
|
thatPamIAm/weathrly
|
import React from 'react';
import icons from '../weather_icons/WeatherIcons';
const SevenHour = ({ hourlyForecast }) => {
if (!hourlyForecast) {
return null;
}
const sevenHourForecast = hourlyForecast.slice(0, 7);
const sevenHourDataLoop = sevenHourForecast.map((hour, i) => {
return (
<div key={i} className="hourly-box">
<h2 className="hourly-forecast hourly-time" tabIndex="0">{hour.FCTTIME.civil}</h2>
<div className={`hourly-icon ${icons[hour.icon]}`} tabIndex="0" alt="hourly weather icon"
aria-label="hourly weather icon"></div>
<h2 className="hourly-forecast hourly-temp" tabIndex="0">{hour.temp.english}°F</h2>
</div>
);
});
return (
<section className="seven-hour-container">
{sevenHourDataLoop}
</section>
);
};
export default SevenHour;
|
src/components/const/addedVideoUser.js
|
motion123/mbookmakerUI
|
/**
* Created by tomino on 17/03/14.
*/
import React from 'react';
import {List,ListItem} from 'material-ui/List';
import InfiniteScroll from 'react-infinite-scroller';
import CircularProgress from 'material-ui/CircularProgress';
import style from './boardList.css';
import {grey500, darkBlack, lightBlack} from 'material-ui/styles/colors';
export default class AddVideoUser extends React.Component {
render() {
const {
boardInfo,
loadMore,
hasMore,
} = this.props;
const loader = <div className={style.loader}>
<CircularProgress
size={20}
/>
</div>;
let item = [];
boardInfo.map((info) =>
item.push(
<ListItem
key={info._id}
primaryText={info._user.name}
secondaryText={
<p>
<span style={{color: darkBlack}}>{info.board_title}</span>
へ追加しました。
</p>
}
/>
)
);
return (
<InfiniteScroll
loadMore={loadMore}
loader={loader}
hasMore={hasMore}
useWindow={false}
>
<List>
{item}
</List>
</InfiniteScroll>
);
}
}
|
src/svg-icons/notification/sd-card.js
|
w01fgang/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let NotificationSdCard = (props) => (
<SvgIcon {...props}>
<path d="M18 2h-8L4.02 8 4 20c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-6 6h-2V4h2v4zm3 0h-2V4h2v4zm3 0h-2V4h2v4z"/>
</SvgIcon>
);
NotificationSdCard = pure(NotificationSdCard);
NotificationSdCard.displayName = 'NotificationSdCard';
NotificationSdCard.muiName = 'SvgIcon';
export default NotificationSdCard;
|
src/Overlay.js
|
glortho/react-overlays
|
import React from 'react';
import Portal from './Portal';
import Position from './Position';
import RootCloseWrapper from './RootCloseWrapper';
import elementType from 'react-prop-types/lib/elementType';
/**
* Built on top of `<Position/>` and `<Portal/>`, the overlay component is great for custom tooltip overlays.
*/
class Overlay extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {exited: !props.show};
this.onHiddenListener = this.handleHidden.bind(this);
}
componentWillReceiveProps(nextProps) {
if (nextProps.show) {
this.setState({exited: false});
} else if (!nextProps.transition) {
// Otherwise let handleHidden take care of marking exited.
this.setState({exited: true});
}
}
render() {
let {
container
, containerPadding
, target
, placement
, rootClose
, children
, transition: Transition
, ...props } = this.props;
// Don't un-render the overlay while it's transitioning out.
const mountOverlay = props.show || (Transition && !this.state.exited);
if (!mountOverlay) {
// Don't bother showing anything if we don't have to.
return null;
}
let child = children;
// Position is be inner-most because it adds inline styles into the child,
// which the other wrappers don't forward correctly.
child = (
<Position {...{container, containerPadding, target, placement}}>
{child}
</Position>
);
if (Transition) {
let { onExit, onExiting, onEnter, onEntering, onEntered } = props;
// This animates the child node by injecting props, so it must precede
// anything that adds a wrapping div.
child = (
<Transition
in={props.show}
transitionAppear
onExit={onExit}
onExiting={onExiting}
onExited={this.onHiddenListener}
onEnter={onEnter}
onEntering={onEntering}
onEntered={onEntered}
>
{child}
</Transition>
);
}
// This goes after everything else because it adds a wrapping div.
if (rootClose) {
child = (
<RootCloseWrapper onRootClose={props.onHide}>
{child}
</RootCloseWrapper>
);
}
return (
<Portal container={container}>
{child}
</Portal>
);
}
handleHidden(...args) {
this.setState({exited: true});
if (this.props.onExited) {
this.props.onExited(...args);
}
}
}
Overlay.propTypes = {
...Portal.propTypes,
...Position.propTypes,
/**
* Set the visibility of the Overlay
*/
show: React.PropTypes.bool,
/**
* Specify whether the overlay should trigger onHide when the user clicks outside the overlay
*/
rootClose: React.PropTypes.bool,
/**
* A Callback fired by the Overlay when it wishes to be hidden.
*/
onHide: React.PropTypes.func,
/**
* A `<Transition/>` component used to animate the overlay changes visibility.
*/
transition: elementType,
/**
* Callback fired before the Overlay transitions in
*/
onEnter: React.PropTypes.func,
/**
* Callback fired as the Overlay begins to transition in
*/
onEntering: React.PropTypes.func,
/**
* Callback fired after the Overlay finishes transitioning in
*/
onEntered: React.PropTypes.func,
/**
* Callback fired right before the Overlay transitions out
*/
onExit: React.PropTypes.func,
/**
* Callback fired as the Overlay begins to transition out
*/
onExiting: React.PropTypes.func,
/**
* Callback fired after the Overlay finishes transitioning out
*/
onExited: React.PropTypes.func
};
export default Overlay;
|
ajax/libs/onsen/2.0.0-beta.8/js/onsenui.min.js
|
maruilian11/cdnjs
|
/*! onsenui v2.0.0-beta.8 - 2016-03-25 */
"undefined"==typeof WeakMap&&!function(){var defineProperty=Object.defineProperty,counter=Date.now()%1e9,WeakMap=function(){this.name="__st"+(1e9*Math.random()>>>0)+(counter++ +"__")};WeakMap.prototype={set:function(key,value){var entry=key[this.name];return entry&&entry[0]===key?entry[1]=value:defineProperty(key,this.name,{value:[key,value],writable:!0}),this},get:function(key){var entry;return(entry=key[this.name])&&entry[0]===key?entry[1]:void 0},"delete":function(key){var entry=key[this.name];return entry&&entry[0]===key?(entry[0]=entry[1]=void 0,!0):!1},has:function(key){var entry=key[this.name];return entry?entry[0]===key:!1}},window.WeakMap=WeakMap}(),function(global){function scheduleCallback(observer){scheduledObservers.push(observer),isScheduled||(isScheduled=!0,setImmediate(dispatchCallbacks))}function wrapIfNeeded(node){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(node)||node}function dispatchCallbacks(){isScheduled=!1;var observers=scheduledObservers;scheduledObservers=[],observers.sort(function(o1,o2){return o1.uid_-o2.uid_});var anyNonEmpty=!1;observers.forEach(function(observer){var queue=observer.takeRecords();removeTransientObserversFor(observer),queue.length&&(observer.callback_(queue,observer),anyNonEmpty=!0)}),anyNonEmpty&&dispatchCallbacks()}function removeTransientObserversFor(observer){observer.nodes_.forEach(function(node){var registrations=registrationsTable.get(node);registrations&®istrations.forEach(function(registration){registration.observer===observer&®istration.removeTransientObservers()})})}function forEachAncestorAndObserverEnqueueRecord(target,callback){for(var node=target;node;node=node.parentNode){var registrations=registrationsTable.get(node);if(registrations)for(var j=0;j<registrations.length;j++){var registration=registrations[j],options=registration.options;if(node===target||options.subtree){var record=callback(options);record&®istration.enqueue(record)}}}}function JsMutationObserver(callback){this.callback_=callback,this.nodes_=[],this.records_=[],this.uid_=++uidCounter}function MutationRecord(type,target){this.type=type,this.target=target,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function copyMutationRecord(original){var record=new MutationRecord(original.type,original.target);return record.addedNodes=original.addedNodes.slice(),record.removedNodes=original.removedNodes.slice(),record.previousSibling=original.previousSibling,record.nextSibling=original.nextSibling,record.attributeName=original.attributeName,record.attributeNamespace=original.attributeNamespace,record.oldValue=original.oldValue,record}function getRecord(type,target){return currentRecord=new MutationRecord(type,target)}function getRecordWithOldValue(oldValue){return recordWithOldValue?recordWithOldValue:(recordWithOldValue=copyMutationRecord(currentRecord),recordWithOldValue.oldValue=oldValue,recordWithOldValue)}function clearRecords(){currentRecord=recordWithOldValue=void 0}function recordRepresentsCurrentMutation(record){return record===recordWithOldValue||record===currentRecord}function selectRecord(lastRecord,newRecord){return lastRecord===newRecord?lastRecord:recordWithOldValue&&recordRepresentsCurrentMutation(lastRecord)?recordWithOldValue:null}function Registration(observer,target,options){this.observer=observer,this.target=target,this.options=options,this.transientObservedNodes=[]}var setImmediate,registrationsTable=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))setImmediate=setTimeout;else if(window.setImmediate)setImmediate=window.setImmediate;else{var setImmediateQueue=[],sentinel=String(Math.random());window.addEventListener("message",function(e){if(e.data===sentinel){var queue=setImmediateQueue;setImmediateQueue=[],queue.forEach(function(func){func()})}}),setImmediate=function(func){setImmediateQueue.push(func),window.postMessage(sentinel,"*")}}var isScheduled=!1,scheduledObservers=[],uidCounter=0;JsMutationObserver.prototype={observe:function(target,options){if(target=wrapIfNeeded(target),!options.childList&&!options.attributes&&!options.characterData||options.attributeOldValue&&!options.attributes||options.attributeFilter&&options.attributeFilter.length&&!options.attributes||options.characterDataOldValue&&!options.characterData)throw new SyntaxError;var registrations=registrationsTable.get(target);registrations||registrationsTable.set(target,registrations=[]);for(var registration,i=0;i<registrations.length;i++)if(registrations[i].observer===this){registration=registrations[i],registration.removeListeners(),registration.options=options;break}registration||(registration=new Registration(this,target,options),registrations.push(registration),this.nodes_.push(target)),registration.addListeners()},disconnect:function(){this.nodes_.forEach(function(node){for(var registrations=registrationsTable.get(node),i=0;i<registrations.length;i++){var registration=registrations[i];if(registration.observer===this){registration.removeListeners(),registrations.splice(i,1);break}}},this),this.records_=[]},takeRecords:function(){var copyOfRecords=this.records_;return this.records_=[],copyOfRecords}};var currentRecord,recordWithOldValue;Registration.prototype={enqueue:function(record){var records=this.observer.records_,length=records.length;if(records.length>0){var lastRecord=records[length-1],recordToReplaceLast=selectRecord(lastRecord,record);if(recordToReplaceLast)return void(records[length-1]=recordToReplaceLast)}else scheduleCallback(this.observer);records[length]=record},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(node){var options=this.options;options.attributes&&node.addEventListener("DOMAttrModified",this,!0),options.characterData&&node.addEventListener("DOMCharacterDataModified",this,!0),options.childList&&node.addEventListener("DOMNodeInserted",this,!0),(options.childList||options.subtree)&&node.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(node){var options=this.options;options.attributes&&node.removeEventListener("DOMAttrModified",this,!0),options.characterData&&node.removeEventListener("DOMCharacterDataModified",this,!0),options.childList&&node.removeEventListener("DOMNodeInserted",this,!0),(options.childList||options.subtree)&&node.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(node){if(node!==this.target){this.addListeners_(node),this.transientObservedNodes.push(node);var registrations=registrationsTable.get(node);registrations||registrationsTable.set(node,registrations=[]),registrations.push(this)}},removeTransientObservers:function(){var transientObservedNodes=this.transientObservedNodes;this.transientObservedNodes=[],transientObservedNodes.forEach(function(node){this.removeListeners_(node);for(var registrations=registrationsTable.get(node),i=0;i<registrations.length;i++)if(registrations[i]===this){registrations.splice(i,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var name=e.attrName,namespace=e.relatedNode.namespaceURI,target=e.target,record=new getRecord("attributes",target);record.attributeName=name,record.attributeNamespace=namespace;var oldValue=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;forEachAncestorAndObserverEnqueueRecord(target,function(options){return!options.attributes||options.attributeFilter&&options.attributeFilter.length&&-1===options.attributeFilter.indexOf(name)&&-1===options.attributeFilter.indexOf(namespace)?void 0:options.attributeOldValue?getRecordWithOldValue(oldValue):record});break;case"DOMCharacterDataModified":var target=e.target,record=getRecord("characterData",target),oldValue=e.prevValue;forEachAncestorAndObserverEnqueueRecord(target,function(options){return options.characterData?options.characterDataOldValue?getRecordWithOldValue(oldValue):record:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var addedNodes,removedNodes,changedNode=e.target;"DOMNodeInserted"===e.type?(addedNodes=[changedNode],removedNodes=[]):(addedNodes=[],removedNodes=[changedNode]);var previousSibling=changedNode.previousSibling,nextSibling=changedNode.nextSibling,record=getRecord("childList",e.target.parentNode);record.addedNodes=addedNodes,record.removedNodes=removedNodes,record.previousSibling=previousSibling,record.nextSibling=nextSibling,forEachAncestorAndObserverEnqueueRecord(e.relatedNode,function(options){return options.childList?record:void 0})}clearRecords()}},global.JsMutationObserver=JsMutationObserver,global.MutationObserver||(global.MutationObserver=JsMutationObserver)}(this),window.CustomElements=window.CustomElements||{flags:{}},function(scope){var flags=scope.flags,modules=[],addModule=function(module){modules.push(module)},initializeModules=function(){modules.forEach(function(module){module(scope)})};scope.addModule=addModule,scope.initializeModules=initializeModules,scope.hasNative=Boolean(document.registerElement),scope.useNative=!flags.register&&scope.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||HTMLImports.useNative)}(window.CustomElements),window.CustomElements.addModule(function(scope){function forSubtree(node,cb){findAllElements(node,function(e){return cb(e)?!0:void forRoots(e,cb)}),forRoots(node,cb)}function findAllElements(node,find,data){var e=node.firstElementChild;if(!e)for(e=node.firstChild;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.nextSibling;for(;e;)find(e,data)!==!0&&findAllElements(e,find,data),e=e.nextElementSibling;return null}function forRoots(node,cb){for(var root=node.shadowRoot;root;)forSubtree(root,cb),root=root.olderShadowRoot}function forDocumentTree(doc,cb){_forDocumentTree(doc,cb,[])}function _forDocumentTree(doc,cb,processingDocuments){if(doc=wrap(doc),!(processingDocuments.indexOf(doc)>=0)){processingDocuments.push(doc);for(var n,imports=doc.querySelectorAll("link[rel="+IMPORT_LINK_TYPE+"]"),i=0,l=imports.length;l>i&&(n=imports[i]);i++)n["import"]&&_forDocumentTree(n["import"],cb,processingDocuments);cb(doc)}}var IMPORT_LINK_TYPE=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none";scope.forDocumentTree=forDocumentTree,scope.forSubtree=forSubtree}),window.CustomElements.addModule(function(scope){function addedNode(node){return added(node)||addedSubtree(node)}function added(node){return scope.upgrade(node)?!0:void attached(node)}function addedSubtree(node){forSubtree(node,function(e){return added(e)?!0:void 0})}function attachedNode(node){attached(node),inDocument(node)&&forSubtree(node,function(e){attached(e)})}function deferMutation(fn){pendingMutations.push(fn),isPendingMutations||(isPendingMutations=!0,setTimeout(takeMutations))}function takeMutations(){isPendingMutations=!1;for(var p,$p=pendingMutations,i=0,l=$p.length;l>i&&(p=$p[i]);i++)p();pendingMutations=[]}function attached(element){hasPolyfillMutations?deferMutation(function(){_attached(element)}):_attached(element)}function _attached(element){element.__upgraded__&&(element.attachedCallback||element.detachedCallback)&&!element.__attached&&inDocument(element)&&(element.__attached=!0,element.attachedCallback&&element.attachedCallback())}function detachedNode(node){detached(node),forSubtree(node,function(e){detached(e)})}function detached(element){hasPolyfillMutations?deferMutation(function(){_detached(element)}):_detached(element)}function _detached(element){element.__upgraded__&&(element.attachedCallback||element.detachedCallback)&&element.__attached&&!inDocument(element)&&(element.__attached=!1,element.detachedCallback&&element.detachedCallback())}function inDocument(element){for(var p=element,doc=wrap(document);p;){if(p==doc)return!0;p=p.parentNode||p.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&p.host}}function watchShadow(node){if(node.shadowRoot&&!node.shadowRoot.__watched){flags.dom&&console.log("watching shadow-root for: ",node.localName);for(var root=node.shadowRoot;root;)observe(root),root=root.olderShadowRoot}}function handler(mutations){if(flags.dom){var mx=mutations[0];if(mx&&"childList"===mx.type&&mx.addedNodes&&mx.addedNodes){for(var d=mx.addedNodes[0];d&&d!==document&&!d.host;)d=d.parentNode;var u=d&&(d.URL||d._URL||d.host&&d.host.localName)||"";u=u.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",mutations.length,u||"")}mutations.forEach(function(mx){"childList"===mx.type&&(forEach(mx.addedNodes,function(n){n.localName&&addedNode(n)}),forEach(mx.removedNodes,function(n){n.localName&&detachedNode(n)}))}),flags.dom&&console.groupEnd()}function takeRecords(node){for(node=wrap(node),node||(node=wrap(document));node.parentNode;)node=node.parentNode;var observer=node.__observer;observer&&(handler(observer.takeRecords()),takeMutations())}function observe(inRoot){if(!inRoot.__observer){var observer=new MutationObserver(handler);observer.observe(inRoot,{childList:!0,subtree:!0}),inRoot.__observer=observer}}function upgradeDocument(doc){doc=wrap(doc),flags.dom&&console.group("upgradeDocument: ",doc.baseURI.split("/").pop()),addedNode(doc),observe(doc),flags.dom&&console.groupEnd()}function upgradeDocumentTree(doc){forDocumentTree(doc,upgradeDocument)}var flags=scope.flags,forSubtree=scope.forSubtree,forDocumentTree=scope.forDocumentTree,hasPolyfillMutations=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;scope.hasPolyfillMutations=hasPolyfillMutations;var isPendingMutations=!1,pendingMutations=[],forEach=Array.prototype.forEach.call.bind(Array.prototype.forEach),originalCreateShadowRoot=Element.prototype.createShadowRoot;originalCreateShadowRoot&&(Element.prototype.createShadowRoot=function(){var root=originalCreateShadowRoot.call(this);return CustomElements.watchShadow(this),root}),scope.watchShadow=watchShadow,scope.upgradeDocumentTree=upgradeDocumentTree,scope.upgradeSubtree=addedSubtree,scope.upgradeAll=addedNode,scope.attachedNode=attachedNode,scope.takeRecords=takeRecords}),window.CustomElements.addModule(function(scope){function upgrade(node){if(!node.__upgraded__&&node.nodeType===Node.ELEMENT_NODE){var is=node.getAttribute("is"),definition=scope.getRegisteredDefinition(is||node.localName);if(definition){if(is&&definition.tag==node.localName)return upgradeWithDefinition(node,definition);if(!is&&!definition["extends"])return upgradeWithDefinition(node,definition)}}}function upgradeWithDefinition(element,definition){return flags.upgrade&&console.group("upgrade:",element.localName),definition.is&&element.setAttribute("is",definition.is),implementPrototype(element,definition),element.__upgraded__=!0,created(element),scope.attachedNode(element),scope.upgradeSubtree(element),flags.upgrade&&console.groupEnd(),element}function implementPrototype(element,definition){Object.__proto__?element.__proto__=definition.prototype:(customMixin(element,definition.prototype,definition["native"]),element.__proto__=definition.prototype)}function customMixin(inTarget,inSrc,inNative){for(var used={},p=inSrc;p!==inNative&&p!==HTMLElement.prototype;){for(var k,keys=Object.getOwnPropertyNames(p),i=0;k=keys[i];i++)used[k]||(Object.defineProperty(inTarget,k,Object.getOwnPropertyDescriptor(p,k)),used[k]=1);p=Object.getPrototypeOf(p)}}function created(element){element.createdCallback&&element.createdCallback()}var flags=scope.flags;scope.upgrade=upgrade,scope.upgradeWithDefinition=upgradeWithDefinition,scope.implementPrototype=implementPrototype}),window.CustomElements.addModule(function(scope){function register(name,options){var definition=options||{};if(!name)throw new Error("document.registerElement: first argument `name` must not be empty");if(name.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(name)+"'.");if(isReservedTag(name))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(name)+"'. The type name is invalid.");if(getRegisteredDefinition(name))throw new Error("DuplicateDefinitionError: a type with name '"+String(name)+"' is already registered");return definition.prototype||(definition.prototype=Object.create(HTMLElement.prototype)),definition.__name=name.toLowerCase(),definition.lifecycle=definition.lifecycle||{},definition.ancestry=ancestry(definition["extends"]),resolveTagName(definition),resolvePrototypeChain(definition),overrideAttributeApi(definition.prototype),registerDefinition(definition.__name,definition),definition.ctor=generateConstructor(definition),definition.ctor.prototype=definition.prototype,definition.prototype.constructor=definition.ctor,scope.ready&&upgradeDocumentTree(document),definition.ctor}function overrideAttributeApi(prototype){if(!prototype.setAttribute._polyfilled){var setAttribute=prototype.setAttribute;prototype.setAttribute=function(name,value){changeAttribute.call(this,name,value,setAttribute)};var removeAttribute=prototype.removeAttribute;prototype.removeAttribute=function(name){changeAttribute.call(this,name,null,removeAttribute)},prototype.setAttribute._polyfilled=!0}}function changeAttribute(name,value,operation){name=name.toLowerCase();var oldValue=this.getAttribute(name);operation.apply(this,arguments);var newValue=this.getAttribute(name);this.attributeChangedCallback&&newValue!==oldValue&&this.attributeChangedCallback(name,oldValue,newValue)}function isReservedTag(name){for(var i=0;i<reservedTagList.length;i++)if(name===reservedTagList[i])return!0}function ancestry(extnds){var extendee=getRegisteredDefinition(extnds);return extendee?ancestry(extendee["extends"]).concat([extendee]):[]}function resolveTagName(definition){for(var a,baseTag=definition["extends"],i=0;a=definition.ancestry[i];i++)baseTag=a.is&&a.tag;definition.tag=baseTag||definition.__name,baseTag&&(definition.is=definition.__name)}function resolvePrototypeChain(definition){if(!Object.__proto__){var nativePrototype=HTMLElement.prototype;if(definition.is){var inst=document.createElement(definition.tag),expectedPrototype=Object.getPrototypeOf(inst);expectedPrototype===definition.prototype&&(nativePrototype=expectedPrototype)}for(var ancestor,proto=definition.prototype;proto&&proto!==nativePrototype;)ancestor=Object.getPrototypeOf(proto),proto.__proto__=ancestor,proto=ancestor;definition["native"]=nativePrototype}}function instantiate(definition){return upgradeWithDefinition(domCreateElement(definition.tag),definition)}function getRegisteredDefinition(name){return name?registry[name.toLowerCase()]:void 0}function registerDefinition(name,definition){registry[name]=definition}function generateConstructor(definition){return function(){return instantiate(definition)}}function createElementNS(namespace,tag,typeExtension){return namespace===HTML_NAMESPACE?createElement(tag,typeExtension):domCreateElementNS(namespace,tag)}function createElement(tag,typeExtension){tag&&(tag=tag.toLowerCase()),typeExtension&&(typeExtension=typeExtension.toLowerCase());var definition=getRegisteredDefinition(typeExtension||tag);if(definition){if(tag==definition.tag&&typeExtension==definition.is)return new definition.ctor;if(!typeExtension&&!definition.is)return new definition.ctor}var element;return typeExtension?(element=createElement(tag),element.setAttribute("is",typeExtension),element):(element=domCreateElement(tag),tag.indexOf("-")>=0&&implementPrototype(element,HTMLElement),element)}function wrapDomMethodToForceUpgrade(obj,methodName){var orig=obj[methodName];obj[methodName]=function(){var n=orig.apply(this,arguments);return upgradeAll(n),n}}var isInstance,isIE11OrOlder=scope.isIE11OrOlder,upgradeDocumentTree=scope.upgradeDocumentTree,upgradeAll=scope.upgradeAll,upgradeWithDefinition=scope.upgradeWithDefinition,implementPrototype=scope.implementPrototype,useNative=scope.useNative,reservedTagList=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],registry={},HTML_NAMESPACE="http://www.w3.org/1999/xhtml",domCreateElement=document.createElement.bind(document),domCreateElementNS=document.createElementNS.bind(document);isInstance=Object.__proto__||useNative?function(obj,base){return obj instanceof base}:function(obj,ctor){for(var p=obj;p;){if(p===ctor.prototype)return!0;p=p.__proto__}return!1},wrapDomMethodToForceUpgrade(Node.prototype,"cloneNode"),wrapDomMethodToForceUpgrade(document,"importNode"),isIE11OrOlder&&!function(){var importNode=document.importNode;document.importNode=function(){var n=importNode.apply(document,arguments);if(n.nodeType==n.DOCUMENT_FRAGMENT_NODE){var f=document.createDocumentFragment();return f.appendChild(n),f}return n}}(),document.registerElement=register,document.createElement=createElement,document.createElementNS=createElementNS,scope.registry=registry,scope["instanceof"]=isInstance,scope.reservedTagList=reservedTagList,scope.getRegisteredDefinition=getRegisteredDefinition,document.register=document.registerElement}),function(scope){function bootstrap(){upgradeDocumentTree(wrap(document)),window.HTMLImports&&(HTMLImports.__importsParsingHook=function(elt){upgradeDocumentTree(wrap(elt["import"]))}),CustomElements.ready=!0,setTimeout(function(){CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}var useNative=scope.useNative,initializeModules=scope.initializeModules,isIE11OrOlder=/Trident/.test(navigator.userAgent);if(useNative){var nop=function(){};scope.watchShadow=nop,scope.upgrade=nop,scope.upgradeAll=nop,scope.upgradeDocumentTree=nop,scope.upgradeSubtree=nop,scope.takeRecords=nop,scope["instanceof"]=function(obj,base){return obj instanceof base}}else initializeModules();var upgradeDocumentTree=scope.upgradeDocumentTree;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(node){return node}),isIE11OrOlder&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(inType,params){params=params||{};var e=document.createEvent("CustomEvent");return e.initCustomEvent(inType,Boolean(params.bubbles),Boolean(params.cancelable),params.detail),e},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||scope.flags.eager)bootstrap();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var loadEvent=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(loadEvent,bootstrap)}else bootstrap();scope.isIE11OrOlder=isIE11OrOlder}(window.CustomElements),window.CustomEvent||!function(){var CustomEvent;CustomEvent=function(event,params){var evt;return params=params||{bubbles:!1,cancelable:!1,detail:void 0},evt=document.createEvent("CustomEvent"),evt.initCustomEvent(event,params.bubbles,params.cancelable,params.detail),evt},CustomEvent.prototype=window.Event.prototype,window.CustomEvent=CustomEvent}(),window.animit=function(){"use strict";var TIMEOUT_RATIO=1.4,util={};util.capitalize=function(str){return str.charAt(0).toUpperCase()+str.slice(1)},util.buildTransitionValue=function(params){params.property=params.property||"all",params.duration=params.duration||.4,params.timing=params.timing||"linear";var props=params.property.split(/ +/);return props.map(function(prop){return prop+" "+params.duration+"s "+params.timing}).join(", ")},util.onceOnTransitionEnd=function(element,callback){if(!element)return function(){};var fn=function(event){element==event.target&&(event.stopPropagation(),removeListeners(),callback())},removeListeners=function(){util._transitionEndEvents.forEach(function(eventName){element.removeEventListener(eventName,fn,!1)})};return util._transitionEndEvents.forEach(function(eventName){element.addEventListener(eventName,fn,!1)}),removeListeners},util._transitionEndEvents=function(){return"ontransitionend"in window?["transitionend"]:"onwebkittransitionend"in window?["webkitTransitionEnd"]:"webkit"===util.vendorPrefix||"o"===util.vendorPrefix||"moz"===util.vendorPrefix||"ms"===util.vendorPrefix?[util.vendorPrefix+"TransitionEnd","transitionend"]:[]}(),util._cssPropertyDict=function(){for(var styles=window.getComputedStyle(document.documentElement,""),dict={},a="A".charCodeAt(0),z="z".charCodeAt(0),upper=function(s){return s.substr(1).toUpperCase()},i=0;i<styles.length;i++){var key=styles[i].replace(/^[\-]+/,"").replace(/[\-][a-z]/g,upper).replace(/^moz/,"Moz");a<=key.charCodeAt(0)&&z>=key.charCodeAt(0)&&"cssText"!==key&&"parentText"!==key&&(dict[key]=!0)}return dict}(),util.hasCssProperty=function(name){return name in util._cssPropertyDict},util.vendorPrefix=function(){var styles=window.getComputedStyle(document.documentElement,""),pre=(Array.prototype.slice.call(styles).join("").match(/-(moz|webkit|ms)-/)||""===styles.OLink&&["","o"])[1];return pre}(),util.forceLayoutAtOnce=function(elements,callback){this.batchImmediate(function(){elements.forEach(function(element){element.offsetHeight}),callback()})},util.batchImmediate=function(){var callbacks=[];return function(callback){0===callbacks.length&&setImmediate(function(){var concreateCallbacks=callbacks.slice(0);callbacks=[],concreateCallbacks.forEach(function(callback){callback()})}),callbacks.push(callback)}}(),util.batchAnimationFrame=function(){var callbacks=[],raf=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback){setTimeout(callback,1e3/60)};return function(callback){0===callbacks.length&&raf(function(){var concreateCallbacks=callbacks.slice(0);callbacks=[],concreateCallbacks.forEach(function(callback){callback()})}),callbacks.push(callback)}}(),util.transitionPropertyName=function(){if(util.hasCssProperty("transitionDuration"))return"transition";if(util.hasCssProperty(util.vendorPrefix+"TransitionDuration"))return util.vendorPrefix+"Transition";throw new Error("Invalid state")}();var Animit=function(element){if(!(this instanceof Animit))return new Animit(element);if(element instanceof HTMLElement)this.elements=[element];else{if("[object Array]"!==Object.prototype.toString.call(element))throw new Error("First argument must be an array or an instance of HTMLElement.");this.elements=element}this.transitionQueue=[],this.lastStyleAttributeDict=[]};return Animit.prototype={transitionQueue:void 0,elements:void 0,play:function(callback){return"function"==typeof callback&&this.transitionQueue.push(function(done){callback(),done()}),this.startAnimation(),this},queue:function(transition,options){var queue=this.transitionQueue;if(transition&&options&&(options.css=transition,transition=new Animit.Transition(options)),transition instanceof Function||transition instanceof Animit.Transition||(transition=new Animit.Transition(transition.css?transition:{css:transition})),transition instanceof Function)queue.push(transition);else{if(!(transition instanceof Animit.Transition))throw new Error("Invalid arguments");queue.push(transition.build())}return this},wait:function(seconds){return seconds>0&&this.transitionQueue.push(function(done){setTimeout(done,1e3*seconds)}),this},saveStyle:function(){return this.transitionQueue.push(function(done){this.elements.forEach(function(element,index){for(var css=this.lastStyleAttributeDict[index]={},i=0;i<element.style.length;i++)css[element.style[i]]=element.style[element.style[i]]}.bind(this)),done()}.bind(this)),this},restoreStyle:function(options){function reset(){self.elements.forEach(function(element,index){element.style[transitionName]="none";var css=self.lastStyleAttributeDict[index];if(!css)throw new Error("restoreStyle(): The style is not saved. Invoke saveStyle() before.");self.lastStyleAttributeDict[index]=void 0;for(var i=0,name="";i<element.style.length;i++)name=element.style[i],"undefined"==typeof css[element.style[i]]&&(css[element.style[i]]="");Object.keys(css).forEach(function(key){element.style[key]=css[key]})})}options=options||{};var self=this;if(options.transition&&!options.duration)throw new Error('"options.duration" is required when "options.transition" is enabled.');var transitionName=util.transitionPropertyName;if(options.transition||options.duration&&options.duration>0){var transitionValue=options.transition||"all "+options.duration+"s "+(options.timing||"linear");this.transitionQueue.push(function(done){var timeoutId,elements=this.elements,clearTransition=function(){elements.forEach(function(element){element.style[transitionName]=""})},removeListeners=util.onceOnTransitionEnd(elements[0],function(){clearTimeout(timeoutId),clearTransition(),done()});timeoutId=setTimeout(function(){removeListeners(),clearTransition(),done()},1e3*options.duration*TIMEOUT_RATIO),elements.forEach(function(element,index){var css=self.lastStyleAttributeDict[index];if(!css)throw new Error("restoreStyle(): The style is not saved. Invoke saveStyle() before.");self.lastStyleAttributeDict[index]=void 0;for(var name,i=0,len=element.style.length;len>i;i++)name=element.style[i],void 0===css[name]&&(css[name]="");element.style[transitionName]=transitionValue,Object.keys(css).forEach(function(key){key!==transitionName&&(element.style[key]=css[key])}),element.style[transitionName]=transitionValue})})}else this.transitionQueue.push(function(done){reset(),done()});return this},startAnimation:function(){return this._dequeueTransition(),this},_dequeueTransition:function(){var transition=this.transitionQueue.shift();if(this._currentTransition)throw new Error("Current transition exists.");this._currentTransition=transition;var self=this,called=!1,done=function(){if(called)throw new Error("Invalid state: This callback is called twice.");called=!0,self._currentTransition=void 0,self._dequeueTransition()};transition&&transition.call(this,done)}},Animit.runAll=function(){for(var i=0;i<arguments.length;i++)arguments[i].play()},Animit.Transition=function(options){this.options=options||{},this.options.duration=this.options.duration||0,this.options.timing=this.options.timing||"linear",this.options.css=this.options.css||{},this.options.property=this.options.property||"all"},Animit.Transition.prototype={build:function(){function createActualCssProps(css){var result={};return Object.keys(css).forEach(function(name){var value=css[name];if(util.hasCssProperty(name))return void(result[name]=value);var prefixed=util.vendorPrefix+util.capitalize(name);util.hasCssProperty(prefixed)?result[prefixed]=value:(result[prefixed]=value,result[name]=value)}),result}if(0===Object.keys(this.options.css).length)throw new Error("options.css is required.");var css=createActualCssProps(this.options.css);if(this.options.duration>0){var transitionValue=util.buildTransitionValue(this.options),self=this;return function(callback){var timeoutId,elements=this.elements,timeout=1e3*self.options.duration*TIMEOUT_RATIO,removeListeners=util.onceOnTransitionEnd(elements[0],function(){clearTimeout(timeoutId),callback()});timeoutId=setTimeout(function(){removeListeners(),callback()},timeout),elements.forEach(function(element){element.style[util.transitionPropertyName]=transitionValue,Object.keys(css).forEach(function(name){element.style[name]=css[name]})})}}return this.options.duration<=0?function(callback){var elements=this.elements;elements.forEach(function(element){element.style[util.transitionPropertyName]="",Object.keys(css).forEach(function(name){element.style[name]=css[name]})}),elements.length>0?util.forceLayoutAtOnce(elements,function(){util.batchAnimationFrame(callback)}):util.batchAnimationFrame(callback)}:void 0}},Animit}(),function(){"remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}(),"document"in self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))?!function(){
"use strict";var testElement=document.createElement("_");if(testElement.classList.add("c1","c2"),!testElement.classList.contains("c2")){var createMethod=function(method){var original=DOMTokenList.prototype[method];DOMTokenList.prototype[method]=function(token){var i,len=arguments.length;for(i=0;len>i;i++)token=arguments[i],original.call(this,token)}};createMethod("add"),createMethod("remove")}if(testElement.classList.toggle("c3",!1),testElement.classList.contains("c3")){var _toggle=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(token,force){return 1 in arguments&&!this.contains(token)==!force?force:_toggle.call(this,token)}}testElement=null}():!function(view){"use strict";if("Element"in view){var classListProp="classList",protoProp="prototype",elemCtrProto=view.Element[protoProp],objCtr=Object,strTrim=String[protoProp].trim||function(){return this.replace(/^\s+|\s+$/g,"")},arrIndexOf=Array[protoProp].indexOf||function(item){for(var i=0,len=this.length;len>i;i++)if(i in this&&this[i]===item)return i;return-1},DOMEx=function(type,message){this.name=type,this.code=DOMException[type],this.message=message},checkTokenAndGetIndex=function(classList,token){if(""===token)throw new DOMEx("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(token))throw new DOMEx("INVALID_CHARACTER_ERR","String contains an invalid character");return arrIndexOf.call(classList,token)},ClassList=function(elem){for(var trimmedClasses=strTrim.call(elem.getAttribute("class")||""),classes=trimmedClasses?trimmedClasses.split(/\s+/):[],i=0,len=classes.length;len>i;i++)this.push(classes[i]);this._updateClassName=function(){elem.setAttribute("class",this.toString())}},classListProto=ClassList[protoProp]=[],classListGetter=function(){return new ClassList(this)};if(DOMEx[protoProp]=Error[protoProp],classListProto.item=function(i){return this[i]||null},classListProto.contains=function(token){return token+="",-1!==checkTokenAndGetIndex(this,token)},classListProto.add=function(){var token,tokens=arguments,i=0,l=tokens.length,updated=!1;do token=tokens[i]+"",-1===checkTokenAndGetIndex(this,token)&&(this.push(token),updated=!0);while(++i<l);updated&&this._updateClassName()},classListProto.remove=function(){var token,index,tokens=arguments,i=0,l=tokens.length,updated=!1;do for(token=tokens[i]+"",index=checkTokenAndGetIndex(this,token);-1!==index;)this.splice(index,1),updated=!0,index=checkTokenAndGetIndex(this,token);while(++i<l);updated&&this._updateClassName()},classListProto.toggle=function(token,force){token+="";var result=this.contains(token),method=result?force!==!0&&"remove":force!==!1&&"add";return method&&this[method](token),force===!0||force===!1?force:!result},classListProto.toString=function(){return this.join(" ")},objCtr.defineProperty){var classListPropDesc={get:classListGetter,enumerable:!0,configurable:!0};try{objCtr.defineProperty(elemCtrProto,classListProp,classListPropDesc)}catch(ex){-2146823252===ex.number&&(classListPropDesc.enumerable=!1,objCtr.defineProperty(elemCtrProto,classListProp,classListPropDesc))}}else objCtr[protoProp].__defineGetter__&&elemCtrProto.__defineGetter__(classListProp,classListGetter)}}(self)),function(){"use strict";function FastClick(layer,options){function bind(method,context){return function(){return method.apply(context,arguments)}}var oldOnClick;if(options=options||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=options.touchBoundary||10,this.layer=layer,this.tapDelay=options.tapDelay||200,this.tapTimeout=options.tapTimeout||700,!FastClick.notNeeded(layer)){for(var methods=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],context=this,i=0,l=methods.length;l>i;i++)context[methods[i]]=bind(context[methods[i]],context);deviceIsAndroid&&(layer.addEventListener("mouseover",this.onMouse,!0),layer.addEventListener("mousedown",this.onMouse,!0),layer.addEventListener("mouseup",this.onMouse,!0)),layer.addEventListener("click",this.onClick,!0),layer.addEventListener("touchstart",this.onTouchStart,!1),layer.addEventListener("touchmove",this.onTouchMove,!1),layer.addEventListener("touchend",this.onTouchEnd,!1),layer.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(layer.removeEventListener=function(type,callback,capture){var rmv=Node.prototype.removeEventListener;"click"===type?rmv.call(layer,type,callback.hijacked||callback,capture):rmv.call(layer,type,callback,capture)},layer.addEventListener=function(type,callback,capture){var adv=Node.prototype.addEventListener;"click"===type?adv.call(layer,type,callback.hijacked||(callback.hijacked=function(event){event.propagationStopped||callback(event)}),capture):adv.call(layer,type,callback,capture)}),"function"==typeof layer.onclick&&(oldOnClick=layer.onclick,layer.addEventListener("click",function(event){oldOnClick(event)},!1),layer.onclick=null)}}var deviceIsWindowsPhone=navigator.userAgent.indexOf("Windows Phone")>=0,deviceIsAndroid=navigator.userAgent.indexOf("Android")>0&&!deviceIsWindowsPhone,deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent)&&!deviceIsWindowsPhone,deviceIsIOS4=deviceIsIOS&&/OS 4_\d(_\d)?/.test(navigator.userAgent),deviceIsIOSWithBadTarget=deviceIsIOS&&/OS [6-7]_\d/.test(navigator.userAgent),deviceIsBlackBerry10=navigator.userAgent.indexOf("BB10")>0;FastClick.prototype.needsClick=function(target){switch(target.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(target.disabled)return!0;break;case"input":if(deviceIsIOS&&"file"===target.type||target.disabled)return!0;break;case"label":case"iframe":case"video":return!0}return/\bneedsclick\b/.test(target.className)},FastClick.prototype.needsFocus=function(target){switch(target.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!deviceIsAndroid;case"input":switch(target.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!target.disabled&&!target.readOnly;default:return/\bneedsfocus\b/.test(target.className)}},FastClick.prototype.sendClick=function(targetElement,event){var clickEvent,touch;document.activeElement&&document.activeElement!==targetElement&&document.activeElement.blur(),touch=event.changedTouches[0],clickEvent=document.createEvent("MouseEvents"),clickEvent.initMouseEvent(this.determineEventType(targetElement),!0,!0,window,1,touch.screenX,touch.screenY,touch.clientX,touch.clientY,!1,!1,!1,!1,0,null),clickEvent.forwardedTouchEvent=!0,targetElement.dispatchEvent(clickEvent)},FastClick.prototype.determineEventType=function(targetElement){return deviceIsAndroid&&"select"===targetElement.tagName.toLowerCase()?"mousedown":"click"},FastClick.prototype.focus=function(targetElement){var length;deviceIsIOS&&targetElement.setSelectionRange&&0!==targetElement.type.indexOf("date")&&"time"!==targetElement.type&&"month"!==targetElement.type?(length=targetElement.value.length,targetElement.setSelectionRange(length,length)):targetElement.focus()},FastClick.prototype.updateScrollParent=function(targetElement){var scrollParent,parentElement;if(scrollParent=targetElement.fastClickScrollParent,!scrollParent||!scrollParent.contains(targetElement)){parentElement=targetElement;do{if(parentElement.scrollHeight>parentElement.offsetHeight){scrollParent=parentElement,targetElement.fastClickScrollParent=parentElement;break}parentElement=parentElement.parentElement}while(parentElement)}scrollParent&&(scrollParent.fastClickLastScrollTop=scrollParent.scrollTop)},FastClick.prototype.getTargetElementFromEventTarget=function(eventTarget){return eventTarget.nodeType===Node.TEXT_NODE?eventTarget.parentNode:eventTarget},FastClick.prototype.onTouchStart=function(event){var targetElement,touch,selection;if(event.targetTouches.length>1)return!0;if(targetElement=this.getTargetElementFromEventTarget(event.target),touch=event.targetTouches[0],deviceIsIOS){if(selection=window.getSelection(),selection.rangeCount&&!selection.isCollapsed)return!0;if(!deviceIsIOS4){if(touch.identifier&&touch.identifier===this.lastTouchIdentifier)return event.preventDefault(),!1;this.lastTouchIdentifier=touch.identifier,this.updateScrollParent(targetElement)}}return this.trackingClick=!0,this.trackingClickStart=event.timeStamp,this.targetElement=targetElement,this.touchStartX=touch.pageX,this.touchStartY=touch.pageY,event.timeStamp-this.lastClickTime<this.tapDelay&&event.timeStamp-this.lastClickTime>-1&&event.preventDefault(),!0},FastClick.prototype.touchHasMoved=function(event){var touch=event.changedTouches[0],boundary=this.touchBoundary;return Math.abs(touch.pageX-this.touchStartX)>boundary||Math.abs(touch.pageY-this.touchStartY)>boundary?!0:!1},FastClick.prototype.onTouchMove=function(event){return this.trackingClick?((this.targetElement!==this.getTargetElementFromEventTarget(event.target)||this.touchHasMoved(event))&&(this.trackingClick=!1,this.targetElement=null),!0):!0},FastClick.prototype.findControl=function(labelElement){return void 0!==labelElement.control?labelElement.control:labelElement.htmlFor?document.getElementById(labelElement.htmlFor):labelElement.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},FastClick.prototype.onTouchEnd=function(event){var forElement,trackingClickStart,targetTagName,scrollParent,touch,targetElement=this.targetElement;if(!this.trackingClick)return!0;if(event.timeStamp-this.lastClickTime<this.tapDelay&&event.timeStamp-this.lastClickTime>-1)return this.cancelNextClick=!0,!0;if(event.timeStamp-this.trackingClickStart>this.tapTimeout)return!0;if(this.cancelNextClick=!1,this.lastClickTime=event.timeStamp,trackingClickStart=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,deviceIsIOSWithBadTarget&&(touch=event.changedTouches[0],targetElement=document.elementFromPoint(touch.pageX-window.pageXOffset,touch.pageY-window.pageYOffset)||targetElement,targetElement.fastClickScrollParent=this.targetElement.fastClickScrollParent),targetTagName=targetElement.tagName.toLowerCase(),"label"===targetTagName){if(forElement=this.findControl(targetElement)){if(this.focus(targetElement),deviceIsAndroid)return!1;targetElement=forElement}}else if(this.needsFocus(targetElement))return event.timeStamp-trackingClickStart>100||deviceIsIOS&&window.top!==window&&"input"===targetTagName?(this.targetElement=null,!1):(this.focus(targetElement),this.sendClick(targetElement,event),deviceIsIOS&&"select"===targetTagName||(this.targetElement=null,event.preventDefault()),!1);return deviceIsIOS&&!deviceIsIOS4&&(scrollParent=targetElement.fastClickScrollParent,scrollParent&&scrollParent.fastClickLastScrollTop!==scrollParent.scrollTop)?!0:(this.needsClick(targetElement)||(event.preventDefault(),this.sendClick(targetElement,event)),!1)},FastClick.prototype.onTouchCancel=function(){this.trackingClick=!1,this.targetElement=null},FastClick.prototype.onMouse=function(event){return this.targetElement?event.forwardedTouchEvent?!0:event.cancelable&&(!this.needsClick(this.targetElement)||this.cancelNextClick)?(event.stopImmediatePropagation?event.stopImmediatePropagation():event.propagationStopped=!0,event.stopPropagation(),event.preventDefault(),!1):!0:!0},FastClick.prototype.onClick=function(event){var permitted;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===event.target.type&&0===event.detail?!0:(permitted=this.onMouse(event),permitted||(this.targetElement=null),permitted)},FastClick.prototype.destroy=function(){var layer=this.layer;deviceIsAndroid&&(layer.removeEventListener("mouseover",this.onMouse,!0),layer.removeEventListener("mousedown",this.onMouse,!0),layer.removeEventListener("mouseup",this.onMouse,!0)),layer.removeEventListener("click",this.onClick,!0),layer.removeEventListener("touchstart",this.onTouchStart,!1),layer.removeEventListener("touchmove",this.onTouchMove,!1),layer.removeEventListener("touchend",this.onTouchEnd,!1),layer.removeEventListener("touchcancel",this.onTouchCancel,!1)},FastClick.notNeeded=function(layer){var metaViewport,chromeVersion,blackberryVersion,firefoxVersion;if("undefined"==typeof window.ontouchstart)return!0;if(chromeVersion=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!deviceIsAndroid)return!0;if(metaViewport=document.querySelector("meta[name=viewport]")){if(-1!==metaViewport.content.indexOf("user-scalable=no"))return!0;if(chromeVersion>31&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}if(deviceIsBlackBerry10&&(blackberryVersion=navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/),blackberryVersion[1]>=10&&blackberryVersion[2]>=3&&(metaViewport=document.querySelector("meta[name=viewport]")))){if(-1!==metaViewport.content.indexOf("user-scalable=no"))return!0;if(document.documentElement.scrollWidth<=window.outerWidth)return!0}return"none"===layer.style.msTouchAction||"manipulation"===layer.style.touchAction?!0:(firefoxVersion=+(/Firefox\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1],firefoxVersion>=27&&(metaViewport=document.querySelector("meta[name=viewport]"),metaViewport&&(-1!==metaViewport.content.indexOf("user-scalable=no")||document.documentElement.scrollWidth<=window.outerWidth))?!0:"none"===layer.style.touchAction||"manipulation"===layer.style.touchAction?!0:!1)},FastClick.attach=function(layer,options){return new FastClick(layer,options)},window.FastClick=FastClick}();var MicroEvent=function(){};MicroEvent.prototype={on:function(event,fct){this._events=this._events||{},this._events[event]=this._events[event]||[],this._events[event].push(fct)},once:function(event,fct){var self=this,wrapper=function(){return self.off(event,wrapper),fct.apply(null,arguments)};this.on(event,wrapper)},off:function(event,fct){this._events=this._events||{},event in this._events!=!1&&this._events[event].splice(this._events[event].indexOf(fct),1)},emit:function(event){if(this._events=this._events||{},event in this._events!=!1)for(var i=0;i<this._events[event].length;i++)this._events[event][i].apply(this,Array.prototype.slice.call(arguments,1))}},MicroEvent.mixin=function(destObject){for(var props=["on","once","off","emit"],i=0;i<props.length;i++)"function"==typeof destObject?destObject.prototype[props[i]]=MicroEvent.prototype[props[i]]:destObject[props[i]]=MicroEvent.prototype[props[i]]},"undefined"!=typeof module&&"exports"in module&&(module.exports=MicroEvent),window.MicroEvent=MicroEvent,!function(e,t,n){function r(e,t){return typeof e===t}function o(){var e,t,n,o,i,s,a;for(var l in S)if(S.hasOwnProperty(l)){if(e=[],t=S[l],t.name&&(e.push(t.name.toLowerCase()),t.options&&t.options.aliases&&t.options.aliases.length))for(n=0;n<t.options.aliases.length;n++)e.push(t.options.aliases[n].toLowerCase());for(o=r(t.fn,"function")?t.fn():t.fn,i=0;i<e.length;i++)s=e[i],a=s.split("."),1===a.length?Modernizr[a[0]]=o:(!Modernizr[a[0]]||Modernizr[a[0]]instanceof Boolean||(Modernizr[a[0]]=new Boolean(Modernizr[a[0]])),Modernizr[a[0]][a[1]]=o),C.push((o?"":"no-")+a.join("-"))}}function i(e){var t=w.className,n=Modernizr._config.classPrefix||"";if(_&&(t=t.baseVal),Modernizr._config.enableJSClass){var r=new RegExp("(^|\\s)"+n+"no-js(\\s|$)");t=t.replace(r,"$1"+n+"js$2")}Modernizr._config.enableClasses&&(t+=" "+n+e.join(" "+n),_?w.className.baseVal=t:w.className=t)}function s(e,t){if("object"==typeof e)for(var n in e)N(e,n)&&s(n,e[n]);else{e=e.toLowerCase();var r=e.split("."),o=Modernizr[r[0]];if(2==r.length&&(o=o[r[1]]),"undefined"!=typeof o)return Modernizr;t="function"==typeof t?t():t,1==r.length?Modernizr[r[0]]=t:(!Modernizr[r[0]]||Modernizr[r[0]]instanceof Boolean||(Modernizr[r[0]]=new Boolean(Modernizr[r[0]])),Modernizr[r[0]][r[1]]=t),i([(t&&0!=t?"":"no-")+r.join("-")]),Modernizr._trigger(e,t)}return Modernizr}function a(){return"function"!=typeof t.createElement?t.createElement(arguments[0]):_?t.createElementNS.call(t,"http://www.w3.org/2000/svg",arguments[0]):t.createElement.apply(t,arguments)}function l(e,t){return!!~(""+e).indexOf(t)}function u(){var e=t.body;return e||(e=a(_?"svg":"body"),e.fake=!0),e}function f(e,n,r,o){var i,s,l,f,c="modernizr",d=a("div"),p=u();if(parseInt(r,10))for(;r--;)l=a("div"),l.id=o?o[r]:c+(r+1),d.appendChild(l);return i=a("style"),i.type="text/css",i.id="s"+c,(p.fake?p:d).appendChild(i),p.appendChild(d),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(t.createTextNode(e)),d.id=c,p.fake&&(p.style.background="",p.style.overflow="hidden",f=w.style.overflow,w.style.overflow="hidden",w.appendChild(p)),s=n(d,e),p.fake?(p.parentNode.removeChild(p),w.style.overflow=f,w.offsetHeight):d.parentNode.removeChild(d),!!s}function c(e){return e.replace(/([a-z])-([a-z])/g,function(e,t,n){return t+n.toUpperCase()}).replace(/^-/,"")}function d(e,t){return function(){return e.apply(t,arguments)}}function p(e,t,n){var o;for(var i in e)if(e[i]in t)return n===!1?e[i]:(o=t[e[i]],r(o,"function")?d(o,n||t):o);return!1}function m(e){return e.replace(/([A-Z])/g,function(e,t){return"-"+t.toLowerCase()}).replace(/^ms-/,"-ms-")}function h(t,r){var o=t.length;if("CSS"in e&&"supports"in e.CSS){for(;o--;)if(e.CSS.supports(m(t[o]),r))return!0;return!1}if("CSSSupportsRule"in e){for(var i=[];o--;)i.push("("+m(t[o])+":"+r+")");return i=i.join(" or "),f("@supports ("+i+") { #modernizr { position: absolute; } }",function(e){return"absolute"==getComputedStyle(e,null).position})}return n}function g(e,t,o,i){function s(){f&&(delete L.style,delete L.modElem)}if(i=r(i,"undefined")?!1:i,!r(o,"undefined")){var u=h(e,o);if(!r(u,"undefined"))return u}for(var f,d,p,m,g,v=["modernizr","tspan"];!L.style;)f=!0,L.modElem=a(v.shift()),L.style=L.modElem.style;for(p=e.length,d=0;p>d;d++)if(m=e[d],g=L.style[m],l(m,"-")&&(m=c(m)),L.style[m]!==n){if(i||r(o,"undefined"))return s(),"pfx"==t?m:!0;try{L.style[m]=o}catch(y){}if(L.style[m]!=g)return s(),"pfx"==t?m:!0}return s(),!1}function v(e,t,n,o,i){var s=e.charAt(0).toUpperCase()+e.slice(1),a=(e+" "+k.join(s+" ")+s).split(" ");return r(t,"string")||r(t,"undefined")?g(a,t,o,i):(a=(e+" "+T.join(s+" ")+s).split(" "),p(a,t,n))}function y(e,t,r){return v(e,n,n,t,r)}var C=[],S=[],x={_version:"3.1.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,t){var n=this;setTimeout(function(){t(n[e])},0)},addTest:function(e,t,n){S.push({name:e,fn:t,options:n})},addAsyncTest:function(e){S.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=x,Modernizr=new Modernizr,Modernizr.addTest("svg",!!t.createElementNS&&!!t.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect);var b=x._config.usePrefixes?" -webkit- -moz- -o- -ms- ".split(" "):[];x._prefixes=b;var w=t.documentElement,_="svg"===w.nodeName.toLowerCase();_||!function(e,t){function n(e,t){var n=e.createElement("p"),r=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x<style>"+t+"</style>",r.insertBefore(n.lastChild,r.firstChild)}function r(){var e=C.elements;return"string"==typeof e?e.split(" "):e}function o(e,t){var n=C.elements;"string"!=typeof n&&(n=n.join(" ")),"string"!=typeof e&&(e=e.join(" ")),C.elements=n+" "+e,u(t)}function i(e){var t=y[e[g]];return t||(t={},v++,e[g]=v,y[v]=t),t}function s(e,n,r){if(n||(n=t),c)return n.createElement(e);r||(r=i(n));var o;return o=r.cache[e]?r.cache[e].cloneNode():h.test(e)?(r.cache[e]=r.createElem(e)).cloneNode():r.createElem(e),!o.canHaveChildren||m.test(e)||o.tagUrn?o:r.frag.appendChild(o)}function a(e,n){if(e||(e=t),c)return e.createDocumentFragment();n=n||i(e);for(var o=n.frag.cloneNode(),s=0,a=r(),l=a.length;l>s;s++)o.createElement(a[s]);return o}function l(e,t){t.cache||(t.cache={},t.createElem=e.createElement,t.createFrag=e.createDocumentFragment,t.frag=t.createFrag()),e.createElement=function(n){return C.shivMethods?s(n,e,t):t.createElem(n)},e.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+r().join().replace(/[\w\-:]+/g,function(e){return t.createElem(e),t.frag.createElement(e),'c("'+e+'")'})+");return n}")(C,t.frag)}function u(e){e||(e=t);var r=i(e);return!C.shivCSS||f||r.hasCSS||(r.hasCSS=!!n(e,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),c||l(e,r),e}var f,c,d="3.7.3",p=e.html5||{},m=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,h=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,g="_html5shiv",v=0,y={};!function(){try{var e=t.createElement("a");e.innerHTML="<xyz></xyz>",f="hidden"in e,c=1==e.childNodes.length||function(){t.createElement("a");var e=t.createDocumentFragment();return"undefined"==typeof e.cloneNode||"undefined"==typeof e.createDocumentFragment||"undefined"==typeof e.createElement}()}catch(n){f=!0,c=!0}}();var C={elements:p.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:d,shivCSS:p.shivCSS!==!1,supportsUnknownElements:c,shivMethods:p.shivMethods!==!1,type:"default",shivDocument:u,createElement:s,createDocumentFragment:a,addElements:o};e.html5=C,u(t),"object"==typeof module&&module.exports&&(module.exports=C)}("undefined"!=typeof e?e:this,t);var E="Moz O ms Webkit",T=x._config.usePrefixes?E.toLowerCase().split(" "):[];x._domPrefixes=T;var N;!function(){var e={}.hasOwnProperty;N=r(e,"undefined")||r(e.call,"undefined")?function(e,t){return t in e&&r(e.constructor.prototype[t],"undefined")}:function(t,n){return e.call(t,n)}}(),x._l={},x.on=function(e,t){this._l[e]||(this._l[e]=[]),this._l[e].push(t),Modernizr.hasOwnProperty(e)&&setTimeout(function(){Modernizr._trigger(e,Modernizr[e])},0)},x._trigger=function(e,t){if(this._l[e]){var n=this._l[e];setTimeout(function(){var e,r;for(e=0;e<n.length;e++)(r=n[e])(t)},0),delete this._l[e]}},Modernizr._q.push(function(){x.addTest=s}),Modernizr.addTest("canvas",function(){var e=a("canvas");return!(!e.getContext||!e.getContext("2d"))});var P="CSS"in e&&"supports"in e.CSS,j="supportsCSS"in e;Modernizr.addTest("supports",P||j);var k=x._config.usePrefixes?E.split(" "):[];x._cssomPrefixes=k;var z=x.testStyles=f,F={elem:a("modernizr")};Modernizr._q.push(function(){delete F.elem});var L={style:F.elem.style};Modernizr._q.unshift(function(){delete L.style}),x.testProp=function(e,t,r){return g([e],n,t,r)},x.testAllProps=v,x.testAllProps=y,Modernizr.addTest("borderradius",y("borderRadius","0px",!0)),Modernizr.addTest("boxshadow",y("boxShadow","1px 1px",!0)),Modernizr.addTest("cssanimations",y("animationName","a",!0)),Modernizr.addTest("csstransforms",function(){return-1===navigator.userAgent.indexOf("Android 2.")&&y("transform","scale(1)",!0)}),Modernizr.addTest("csstransforms3d",function(){var e=!!y("perspective","1px",!0),t=Modernizr._config.usePrefixes;if(e&&(!t||"webkitPerspective"in w.style)){var n;Modernizr.supports?n="@supports (perspective: 1px)":(n="@media (transform-3d)",t&&(n+=",(-webkit-transform-3d)")),n+="{#modernizr{left:9px;position:absolute;height:5px;margin:0;padding:0;border:0}}",z(n,function(t){e=9===t.offsetLeft&&5===t.offsetHeight})}return e}),Modernizr.addTest("csstransitions",y("transition","all",!0)),o(),i(C),delete x.addTest,delete x.addAsyncTest;for(var A=0;A<Modernizr._q.length;A++)Modernizr._q[A]();e.Modernizr=Modernizr}(window,document),!function n(t,e,r){function o(u,f){if(!e[u]){if(!t[u]){var c="function"==typeof require&&require;if(!f&&c)return c(u,!0);if(i)return i(u,!0);var s=new Error("Cannot find module '"+u+"'");throw s.code="MODULE_NOT_FOUND",s}var l=e[u]={exports:{}};t[u][0].call(l.exports,function(n){var e=t[u][1][n];return o(e?e:n)},l,l.exports,n,t,e,r)}return e[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(n,t,e){"use strict";function r(){}function o(n){try{return n.then}catch(t){return d=t,w}}function i(n,t){try{return n(t)}catch(e){return d=e,w}}function u(n,t,e){try{n(t,e)}catch(r){return d=r,w}}function f(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof n)throw new TypeError("not a function");this._37=0,this._12=null,this._59=[],n!==r&&v(n,this)}function c(n,t,e){return new n.constructor(function(o,i){var u=new f(r);u.then(o,i),s(n,new p(t,e,u))})}function s(n,t){for(;3===n._37;)n=n._12;return 0===n._37?void n._59.push(t):void y(function(){var e=1===n._37?t.onFulfilled:t.onRejected;if(null===e)return void(1===n._37?l(t.promise,n._12):a(t.promise,n._12));var r=i(e,n._12);r===w?a(t.promise,d):l(t.promise,r)})}function l(n,t){if(t===n)return a(n,new TypeError("A promise cannot be resolved with itself."));if(t&&("object"==typeof t||"function"==typeof t)){var e=o(t);if(e===w)return a(n,d);if(e===n.then&&t instanceof f)return n._37=3,n._12=t,void h(n);if("function"==typeof e)return void v(e.bind(t),n)}n._37=1,n._12=t,h(n)}function a(n,t){n._37=2,n._12=t,h(n)}function h(n){for(var t=0;t<n._59.length;t++)s(n,n._59[t]);n._59=null}function p(n,t,e){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.promise=e}function v(n,t){var e=!1,r=u(n,function(n){e||(e=!0,l(t,n))},function(n){e||(e=!0,a(t,n))});e||r!==w||(e=!0,a(t,d))}var y=n("asap/raw"),d=null,w={};t.exports=f,f._99=r,f.prototype.then=function(n,t){if(this.constructor!==f)return c(this,n,t);var e=new f(r);return s(this,new p(n,t,e)),e}},{"asap/raw":4}],2:[function(n,t,e){"use strict";function r(n){var t=new o(o._99);return t._37=1,t._12=n,t}var o=n("./core.js");t.exports=o;var i=r(!0),u=r(!1),f=r(null),c=r(void 0),s=r(0),l=r("");o.resolve=function(n){if(n instanceof o)return n;if(null===n)return f;if(void 0===n)return c;if(n===!0)return i;if(n===!1)return u;if(0===n)return s;if(""===n)return l;if("object"==typeof n||"function"==typeof n)try{var t=n.then;if("function"==typeof t)return new o(t.bind(n))}catch(e){return new o(function(n,t){t(e)})}return r(n)},o.all=function(n){var t=Array.prototype.slice.call(n);return new o(function(n,e){function r(u,f){if(f&&("object"==typeof f||"function"==typeof f)){if(f instanceof o&&f.then===o.prototype.then){for(;3===f._37;)f=f._12;return 1===f._37?r(u,f._12):(2===f._37&&e(f._12),void f.then(function(n){r(u,n)},e))}var c=f.then;if("function"==typeof c){var s=new o(c.bind(f));return void s.then(function(n){r(u,n)},e)}}t[u]=f,0===--i&&n(t)}if(0===t.length)return n([]);for(var i=t.length,u=0;u<t.length;u++)r(u,t[u])})},o.reject=function(n){return new o(function(t,e){e(n)})},o.race=function(n){return new o(function(t,e){n.forEach(function(n){o.resolve(n).then(t,e)})})},o.prototype["catch"]=function(n){return this.then(null,n)}},{"./core.js":1}],3:[function(n,t,e){"use strict";function r(){if(c.length)throw c.shift()}function o(n){var t;t=f.length?f.pop():new i,t.task=n,u(t)}function i(){this.task=null}var u=n("./raw"),f=[],c=[],s=u.makeRequestCallFromTimer(r);t.exports=o,i.prototype.call=function(){try{this.task.call()}catch(n){o.onerror?o.onerror(n):(c.push(n),s())}finally{this.task=null,f[f.length]=this}}},{"./raw":4}],4:[function(n,t,e){(function(n){"use strict";function e(n){f.length||(u(),c=!0),f[f.length]=n}function r(){for(;s<f.length;){var n=s;if(s+=1,f[n].call(),s>l){for(var t=0,e=f.length-s;e>t;t++)f[t]=f[t+s];f.length-=s,s=0}}f.length=0,s=0,c=!1}function o(n){var t=1,e=new a(n),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}function i(n){return function(){function t(){clearTimeout(e),clearInterval(r),n()}var e=setTimeout(t,0),r=setInterval(t,50)}}t.exports=e;var u,f=[],c=!1,s=0,l=1024,a=n.MutationObserver||n.WebKitMutationObserver;u="function"==typeof a?o(r):i(r),e.requestFlush=u,e.makeRequestCallFromTimer=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(n,t,e){"function"!=typeof Promise.prototype.done&&(Promise.prototype.done=function(n,t){var e=arguments.length?this.then.apply(this,arguments):this;e.then(null,function(n){setTimeout(function(){throw n},0)})})},{}],6:[function(n,t,e){n("asap"),"undefined"==typeof Promise&&(Promise=n("./lib/core.js"),n("./lib/es6-extensions.js")),n("./polyfill-done.js")},{"./lib/core.js":1,"./lib/es6-extensions.js":2,"./polyfill-done.js":5,asap:3}]},{},[6]),function(global,undefined){"use strict";function addFromSetImmediateArguments(args){return tasksByHandle[nextHandle]=partiallyApplied.apply(undefined,args),nextHandle++}function partiallyApplied(handler){var args=[].slice.call(arguments,1);return function(){"function"==typeof handler?handler.apply(undefined,args):new Function(""+handler)()}}function runIfPresent(handle){if(currentlyRunningATask)setTimeout(partiallyApplied(runIfPresent,handle),0);else{var task=tasksByHandle[handle];if(task){currentlyRunningATask=!0;try{task()}finally{clearImmediate(handle),currentlyRunningATask=!1}}}}function clearImmediate(handle){delete tasksByHandle[handle]}function installNextTickImplementation(){setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);return process.nextTick(partiallyApplied(runIfPresent,handle)),handle}}function canUsePostMessage(){if(global.postMessage&&!global.importScripts){var postMessageIsAsynchronous=!0,oldOnMessage=global.onmessage;return global.onmessage=function(){postMessageIsAsynchronous=!1},global.postMessage("","*"),global.onmessage=oldOnMessage,postMessageIsAsynchronous}}function installPostMessageImplementation(){var messagePrefix="setImmediate$"+Math.random()+"$",onGlobalMessage=function(event){event.source===global&&"string"==typeof event.data&&0===event.data.indexOf(messagePrefix)&&runIfPresent(+event.data.slice(messagePrefix.length))};global.addEventListener?global.addEventListener("message",onGlobalMessage,!1):global.attachEvent("onmessage",onGlobalMessage),setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);return global.postMessage(messagePrefix+handle,"*"),handle}}function installMessageChannelImplementation(){var channel=new MessageChannel;channel.port1.onmessage=function(event){var handle=event.data;runIfPresent(handle)},setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);return channel.port2.postMessage(handle),handle}}function installReadyStateChangeImplementation(){var html=doc.documentElement;setImmediate=function(){var handle=addFromSetImmediateArguments(arguments),script=doc.createElement("script");return script.onreadystatechange=function(){runIfPresent(handle),script.onreadystatechange=null,html.removeChild(script),script=null},html.appendChild(script),handle}}function installSetTimeoutImplementation(){setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);return setTimeout(partiallyApplied(runIfPresent,handle),0),handle}}if(!global.setImmediate){var setImmediate,nextHandle=1,tasksByHandle={},currentlyRunningATask=!1,doc=global.document,attachTo=Object.getPrototypeOf&&Object.getPrototypeOf(global);attachTo=attachTo&&attachTo.setTimeout?attachTo:global,"[object process]"==={}.toString.call(global.process)?installNextTickImplementation():canUsePostMessage()?installPostMessageImplementation():global.MessageChannel?installMessageChannelImplementation():doc&&"onreadystatechange"in doc.createElement("script")?installReadyStateChangeImplementation():installSetTimeoutImplementation(),attachTo.setImmediate=setImmediate,attachTo.clearImmediate=clearImmediate}}(function(){return this}()),function(){function Viewport(){return this.PRE_IOS7_VIEWPORT="initial-scale=1, maximum-scale=1, user-scalable=no",this.IOS7_VIEWPORT="initial-scale=1, maximum-scale=1, user-scalable=no",this.DEFAULT_VIEWPORT="initial-scale=1, maximum-scale=1, user-scalable=no",this.ensureViewportElement(),this.platform={},this.platform.name=this.getPlatformName(),this.platform.version=this.getPlatformVersion(),this}Viewport.prototype.ensureViewportElement=function(){
this.viewportElement=document.querySelector("meta[name=viewport]"),this.viewportElement||(this.viewportElement=document.createElement("meta"),this.viewportElement.name="viewport",document.head.appendChild(this.viewportElement))},Viewport.prototype.setup=function(){function isWebView(){return!!(window.cordova||window.phonegap||window.PhoneGap)}this.viewportElement&&"true"!=this.viewportElement.getAttribute("data-no-adjust")&&("ios"==this.platform.name?this.platform.version>=7&&isWebView()?this.viewportElement.setAttribute("content",this.IOS7_VIEWPORT):this.viewportElement.setAttribute("content",this.PRE_IOS7_VIEWPORT):this.viewportElement.setAttribute("content",this.DEFAULT_VIEWPORT))},Viewport.prototype.getPlatformName=function(){return navigator.userAgent.match(/Android/i)?"android":navigator.userAgent.match(/iPhone|iPad|iPod/i)?"ios":void 0},Viewport.prototype.getPlatformVersion=function(){var start=window.navigator.userAgent.indexOf("OS ");return window.Number(window.navigator.userAgent.substr(start+3,3).replace("_","."))},window.Viewport=Viewport}(),function(){function getAttributes(element){return Node_get_attributes.call(element)}function setAttribute(element,attribute,value){try{Element_setAttribute.call(element,attribute,value)}catch(e){}}function removeAttribute(element,attribute){Element_removeAttribute.call(element,attribute)}function childNodes(element){return Node_get_childNodes.call(element)}function empty(element){for(;element.childNodes.length;)element.removeChild(element.lastChild)}function insertAdjacentHTML(element,position,html){HTMLElement_insertAdjacentHTMLPropertyDescriptor.value.call(element,position,html)}function inUnsafeMode(){var isUnsafe=!0;try{detectionDiv.innerHTML="<test/>"}catch(ex){isUnsafe=!1}return isUnsafe}function cleanse(html,targetElement){function cleanseAttributes(element){var attributes=getAttributes(element);if(attributes&&attributes.length){for(var events,i=0,len=attributes.length;len>i;i++){var attribute=attributes[i],name=attribute.name;"o"!==name[0]&&"O"!==name[0]||"n"!==name[1]&&"N"!==name[1]||(events=events||[],events.push({name:attribute.name,value:attribute.value}))}if(events)for(var i=0,len=events.length;len>i;i++){var attribute=events[i];removeAttribute(element,attribute.name),setAttribute(element,"x-"+attribute.name,attribute.value)}}for(var children=childNodes(element),i=0,len=children.length;len>i;i++)cleanseAttributes(children[i])}var cleaner=document.implementation.createHTMLDocument("cleaner");empty(cleaner.documentElement),MSApp.execUnsafeLocalFunction(function(){insertAdjacentHTML(cleaner.documentElement,"afterbegin",html)});var scripts=cleaner.documentElement.querySelectorAll("script");Array.prototype.forEach.call(scripts,function(script){switch(script.type.toLowerCase()){case"":script.type="text/inert";break;case"text/javascript":case"text/ecmascript":case"text/x-javascript":case"text/jscript":case"text/livescript":case"text/javascript1.1":case"text/javascript1.2":case"text/javascript1.3":script.type="text/inert-"+script.type.slice("text/".length);break;case"application/javascript":case"application/ecmascript":case"application/x-javascript":script.type="application/inert-"+script.type.slice("application/".length)}}),cleanseAttributes(cleaner.documentElement);var cleanedNodes=[];return"HTML"===targetElement.tagName?cleanedNodes=Array.prototype.slice.call(document.adoptNode(cleaner.documentElement).childNodes):(cleaner.head&&(cleanedNodes=cleanedNodes.concat(Array.prototype.slice.call(document.adoptNode(cleaner.head).childNodes))),cleaner.body&&(cleanedNodes=cleanedNodes.concat(Array.prototype.slice.call(document.adoptNode(cleaner.body).childNodes)))),cleanedNodes}function cleansePropertySetter(property,setter){var propertyDescriptor=Object.getOwnPropertyDescriptor(HTMLElement.prototype,property),originalSetter=propertyDescriptor.set;Object.defineProperty(HTMLElement.prototype,property,{get:propertyDescriptor.get,set:function(value){if(window.WinJS&&window.WinJS._execUnsafe&&inUnsafeMode())originalSetter.call(this,value);else{var that=this,nodes=cleanse(value,that);MSApp.execUnsafeLocalFunction(function(){setter(propertyDescriptor,that,nodes)})}},enumerable:propertyDescriptor.enumerable,configurable:propertyDescriptor.configurable})}if(window.MSApp&&MSApp.execUnsafeLocalFunction){var Element_setAttribute=Object.getOwnPropertyDescriptor(Element.prototype,"setAttribute").value,Element_removeAttribute=Object.getOwnPropertyDescriptor(Element.prototype,"removeAttribute").value,HTMLElement_insertAdjacentHTMLPropertyDescriptor=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"insertAdjacentHTML"),Node_get_attributes=Object.getOwnPropertyDescriptor(Node.prototype,"attributes").get,Node_get_childNodes=Object.getOwnPropertyDescriptor(Node.prototype,"childNodes").get,detectionDiv=document.createElement("div");cleansePropertySetter("innerHTML",function(propertyDescriptor,target,elements){empty(target);for(var i=0,len=elements.length;len>i;i++)target.appendChild(elements[i])}),cleansePropertySetter("outerHTML",function(propertyDescriptor,target,elements){for(var i=0,len=elements.length;len>i;i++)target.insertAdjacentElement("afterend",elements[i]);target.parentNode.removeChild(target)})}}(),function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory():"function"==typeof define&&define.amd?define(factory):global.ons=factory()}(this,function(){"use strict";function setup(){GestureDetector.READY||(Event$1.determineEventTypes(),Utils.each(GestureDetector.gestures,function(gesture){Detection.register(gesture)}),Event$1.onTouch(GestureDetector.DOCUMENT,EVENT_MOVE,Detection.detect),Event$1.onTouch(GestureDetector.DOCUMENT,EVENT_END,Detection.detect),GestureDetector.READY=!0)}function waitDeviceReady(){var unlockDeviceReady=ons$1._readyLock.lock();window.addEventListener("WebComponentsReady",function(){ons$1.isWebView()?window.document.addEventListener("deviceready",unlockDeviceReady,!1):unlockDeviceReady()},!1)}var babelHelpers={};babelHelpers["typeof"]=function(obj){return obj&&"undefined"!=typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},babelHelpers.classCallCheck=function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")},babelHelpers.createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),babelHelpers.inherits=function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)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:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)},babelHelpers.possibleConstructorReturn=function(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call};var unwrap=function(string){return string.slice(1,-1)},isObjectString=function(string){return string.startsWith("{")&&string.endsWith("}")},isArrayString=function(string){return string.startsWith("[")&&string.endsWith("]")},isQuotedString=function(string){return string.startsWith("'")&&string.endsWith("'")||string.startsWith('"')&&string.endsWith('"')},error=function(token,string,originalString){throw new Error("Unexpected token '"+token+"' at position "+(originalString.length-string.length-1)+" in string: '"+originalString+"'")},processToken=function(token,string,originalString){return"true"===token||"false"===token?"true"===token:isQuotedString(token)?unwrap(token):isNaN(token)?isObjectString(token)?parseObject(unwrap(token)):isArrayString(token)?parseArray(unwrap(token)):void error(token,string,originalString):+token},nextToken=function(string){string=string.trimLeft();var limit=string.length;if(":"===string[0]||","===string[0])limit=1;else if("{"===string[0]||"["===string[0]){for(var c=string.charCodeAt(0),nestedObject=1,i=1;i<string.length;i++)if(string.charCodeAt(i)===c)nestedObject++;else if(string.charCodeAt(i)===c+2&&(nestedObject--,0===nestedObject)){limit=i+1;break}}else if("'"===string[0]||'"'===string[0]){for(var i=1;i<string.length;i++)if(string[i]===string[0]){limit=i+1;break}}else for(var i=1;i<string.length;i++)if(-1!==[" ",",",":"].indexOf(string[i])){limit=i;break}return string.slice(0,limit)},parseObject=function(string){var isValidKey=function(key){return/^[A-Z_\$][A-Z0-9_\$]*$/i.test(key)};string=string.trim();for(var originalString=string,readingKey=!0,key=void 0,previousToken=void 0,token=void 0,object={};string.length>0;)if(previousToken=token,token=nextToken(string),string=string.slice(token.length,string.length).trimLeft(),":"===token&&(!readingKey||!previousToken||","===previousToken)||","===token&&readingKey||":"!==token&&","!==token&&previousToken&&","!==previousToken&&":"!==previousToken)error(token,string,originalString);else if(":"===token&&readingKey&&previousToken){if(!isValidKey(previousToken))throw new Error("Invalid key token '"+previousToken+"' at position 0 in string: '"+originalString+"'");key=previousToken,readingKey=!1}else","===token&&!readingKey&&previousToken&&(object[key]=processToken(previousToken,string,originalString),readingKey=!0);return token&&(object[key]=processToken(token,string,originalString)),object},parseArray=function(string){string=string.trim();for(var originalString=string,previousToken=void 0,token=void 0,array=[];string.length>0;)previousToken=token,token=nextToken(string),string=string.slice(token.length,string.length).trimLeft(),","!==token||previousToken&&","!==previousToken?","===token&&array.push(processToken(previousToken,string,originalString)):error(token,string,originalString);return token&&(","!==token?array.push(processToken(token,string,originalString)):error(token,string,originalString)),array},parse=function(string){if(string=string.trim(),isObjectString(string))return parseObject(unwrap(string));if(isArrayString(string))return parseArray(unwrap(string));throw new Error("Provided string must be object or array like: "+string)},util={};util.prepareQuery=function(query){return query instanceof Function?query:function(element){return util.match(element,query)}},util.match=function(element,query){return"."===query[0]?element.classList.contains(query.slice(1)):element.nodeName.toLowerCase()===query},util.findChild=function(element,query){for(var match=util.prepareQuery(query),i=0;i<element.children.length;i++){var node=element.children[i];if(match(node))return node}return null},util.findChildRecursively=function(element,query){for(var match=util.prepareQuery(query),i=0;i<element.children.length;i++){var node=element.children[i];if(match(node))return node;var nodeMatch=util.findChildRecursively(node,match);if(nodeMatch)return nodeMatch}return null},util.findParent=function(element,query){for(var match=util.prepareQuery(query),parent=element.parentNode;;){if(!parent||parent===document)return null;if(match(parent))return parent;parent=parent.parentNode}},util.isAttached=function(element){for(;document.documentElement!==element;){if(!element)return!1;element=element.parentNode}return!0},util.hasAnyComponentAsParent=function(element){for(;element&&document.documentElement!==element;)if(element=element.parentNode,element&&element.nodeName.toLowerCase().match(/(ons-navigator|ons-tabbar|ons-sliding-menu|ons-split-view)/))return!0;return!1},util.propagateAction=function(element,action){for(var i=0;i<element.childNodes.length;i++){var child=element.childNodes[i];child[action]instanceof Function?child[action]():util.propagateAction(child,action)}},util.create=function(){var selector=arguments.length<=0||void 0===arguments[0]?"":arguments[0],style=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],classList=selector.split("."),element=document.createElement(classList.shift()||"div");return classList.length&&(element.className=classList.join(" ")),util.extend(element.style,style),element},util.createElement=function(html){var wrapper=document.createElement("div");if(wrapper.innerHTML=html,wrapper.children.length>1)throw new Error('"html" must be one wrapper element.');return wrapper.children[0]},util.createFragment=function(html){var wrapper=document.createElement("div");wrapper.innerHTML=html;for(var fragment=document.createDocumentFragment();wrapper.firstChild;)fragment.appendChild(wrapper.firstChild);return fragment},util.extend=function(dst){for(var _len=arguments.length,args=Array(_len>1?_len-1:0),_key=1;_len>_key;_key++)args[_key-1]=arguments[_key];for(var i=0;i<args.length;i++)if(args[i])for(var keys=Object.keys(args[i]),j=0;j<keys.length;j++){var key=keys[j];dst[key]=args[i][key]}return dst},util.arrayFrom=function(arrayLike){return Array.prototype.slice.apply(arrayLike)},util.parseJSONObjectSafely=function(jsonString){var failSafe=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];try{var result=JSON.parse(""+jsonString);if("object"===("undefined"==typeof result?"undefined":babelHelpers["typeof"](result))&&null!==result)return result}catch(e){return failSafe}return failSafe},util.findFromPath=function(path){path=path.split(".");for(var key,el=window;key=path.shift();)el=el[key];return el},util.triggerElementEvent=function(target,eventName){var detail=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],event=new CustomEvent(eventName,{bubbles:!0,cancelable:!0,detail:detail});return Object.keys(detail).forEach(function(key){event[key]=detail[key]}),target.dispatchEvent(event),event},util.hasModifier=function(target,modifierName){return target.hasAttribute("modifier")?target.getAttribute("modifier").split(/\s+/).some(function(e){return e===modifierName}):!1},util.addModifier=function(target,modifierName){if(util.hasModifier(target,modifierName))return!1;modifierName=modifierName.trim();var modifierAttribute=target.getAttribute("modifier")||"";return target.setAttribute("modifier",(modifierAttribute+" "+modifierName).trim()),!0},util.removeModifier=function(target,modifierName){if(!target.getAttribute("modifier"))return!1;var modifiers=target.getAttribute("modifier").split(/\s+/),newModifiers=modifiers.filter(function(item){return item&&item!==modifierName});return target.setAttribute("modifier",newModifiers.join(" ")),modifiers.length!==newModifiers.length},util.updateParentPosition=function(el){!el._parentUpdated&&el.parentElement&&("static"===window.getComputedStyle(el.parentElement).getPropertyValue("position")&&(el.parentElement.style.position="relative"),el._parentUpdated=!0)},util.bindListeners=function(element,listenerNames){listenerNames.forEach(function(name){var boundName=name.replace(/^_[a-z]/,"_bound"+name[1].toUpperCase());element[boundName]=element[boundName]||element[name].bind(element)})},util.each=function(obj,f){return Object.keys(obj).forEach(function(key){return f(key,obj[key])})};var safe=function(f){return function(){return f instanceof Function?f.apply(this,arguments):void 0}};util.safeCall=function(object,prop){for(var _len2=arguments.length,rest=Array(_len2>2?_len2-2:0),_key2=2;_len2>_key2;_key2++)rest[_key2-2]=arguments[_key2];return safe(object[prop]).apply(object,rest)},util.safeApply=function(object,prop,rest){return safe(object[prop]).apply(object,rest)};var isOfType=function isOfType(object,type){return Array.isArray(type)?type.some(function(type){return isOfType(object,type)}):null===object?"null"===type:type instanceof Function&&object instanceof type||"string"==typeof type&&("undefined"==typeof object?"undefined":babelHelpers["typeof"](object))===type},_printType=function _printType(type){return Array.isArray(type)?type.map(_printType).join(" or "):type instanceof Function&&"an instance of "+type||"null"===type&&"null"||"string"==typeof type&&"a "+type||JSON.stringify(type)},validated=util.validated=function(name,object,options){var type=options&&options.type||!options.object&&options;if(type&&!isOfType(object,type)&&!options.dynamicCall&&!options.safeCall)throw new Error(name+" must be "+_printType(type)+". You provided "+object);if(options&&options.object){var _ret=function(){name=name?name+".":"";var result={};return Object.keys(options.object).forEach(function(key){var dynamicCall=options.object[key].dynamicCall;dynamicCall&&(dynamicCall.object=dynamicCall.object||object,dynamicCall.key=dynamicCall.key||key),result[key]=validated(name+key,object[key],options.object[key])}),{v:result}}();if("object"===("undefined"==typeof _ret?"undefined":babelHelpers["typeof"](_ret)))return _ret.v}if(type===Function||"function"===type){var _ret2=function(){var _ref=options.dynamicCall||{},obj=_ref.object,key=_ref.key,context=options.context||obj,test=options.safeCall?safe:options.dynamicCall?function(f){return validated(name,f,Function)}:function(f){return f};return object=options.dynamicCall?function(){for(var _len3=arguments.length,rest=Array(_len3),_key3=0;_len3>_key3;_key3++)rest[_key3]=arguments[_key3];return test(obj[key]).apply(context,rest)}:test(object),options.returns?{v:function(){for(var _len4=arguments.length,rest=Array(_len4),_key4=0;_len4>_key4;_key4++)rest[_key4]=arguments[_key4];return validated(name+"'s result",object.apply(context,rest),options.returns)}}:void 0}();if("object"===("undefined"==typeof _ret2?"undefined":babelHelpers["typeof"](_ret2)))return _ret2.v}return object};util.updateRipple=function(target){var rippleElement=util.findChild(target,"ons-ripple");target.hasAttribute("ripple")?rippleElement||target.insertBefore(document.createElement("ons-ripple"),target.firstChild):rippleElement&&rippleElement.remove()},util.animationOptionsParse=parse;var Event$1,Utils,Detection,PointerEvent,GestureDetector=function GestureDetector(element,options){return new GestureDetector.Instance(element,options||{})};GestureDetector.defaults={behavior:{userSelect:"none",touchAction:"pan-y",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},GestureDetector.DOCUMENT=document,GestureDetector.HAS_POINTEREVENTS=navigator.pointerEnabled||navigator.msPointerEnabled,GestureDetector.HAS_TOUCHEVENTS="ontouchstart"in window,GestureDetector.IS_MOBILE=/mobile|tablet|ip(ad|hone|od)|android|silk/i.test(navigator.userAgent),GestureDetector.NO_MOUSEEVENTS=GestureDetector.HAS_TOUCHEVENTS&&GestureDetector.IS_MOBILE||GestureDetector.HAS_POINTEREVENTS,GestureDetector.CALCULATE_INTERVAL=25;var EVENT_TYPES={},DIRECTION_DOWN=GestureDetector.DIRECTION_DOWN="down",DIRECTION_LEFT=GestureDetector.DIRECTION_LEFT="left",DIRECTION_UP=GestureDetector.DIRECTION_UP="up",DIRECTION_RIGHT=GestureDetector.DIRECTION_RIGHT="right",POINTER_MOUSE=GestureDetector.POINTER_MOUSE="mouse",POINTER_TOUCH=GestureDetector.POINTER_TOUCH="touch",POINTER_PEN=GestureDetector.POINTER_PEN="pen",EVENT_START=GestureDetector.EVENT_START="start",EVENT_MOVE=GestureDetector.EVENT_MOVE="move",EVENT_END=GestureDetector.EVENT_END="end",EVENT_RELEASE=GestureDetector.EVENT_RELEASE="release",EVENT_TOUCH=GestureDetector.EVENT_TOUCH="touch";GestureDetector.READY=!1,GestureDetector.plugins=GestureDetector.plugins||{},GestureDetector.gestures=GestureDetector.gestures||{},Utils=GestureDetector.utils={extend:function(dest,src,merge){for(var key in src)!src.hasOwnProperty(key)||void 0!==dest[key]&&merge||(dest[key]=src[key]);return dest},on:function(element,type,handler){element.addEventListener(type,handler,!1)},off:function(element,type,handler){element.removeEventListener(type,handler,!1)},each:function(obj,iterator,context){var i,len;if("forEach"in obj)obj.forEach(iterator,context);else if(void 0!==obj.length){for(i=0,len=obj.length;len>i;i++)if(iterator.call(context,obj[i],i,obj)===!1)return}else for(i in obj)if(obj.hasOwnProperty(i)&&iterator.call(context,obj[i],i,obj)===!1)return},inStr:function(src,find){return src.indexOf(find)>-1},inArray:function(src,find){if(src.indexOf){var index=src.indexOf(find);return-1===index?!1:index}for(var i=0,len=src.length;len>i;i++)if(src[i]===find)return i;return!1},toArray:function(obj){return Array.prototype.slice.call(obj,0)},hasParent:function(node,parent){for(;node;){if(node==parent)return!0;node=node.parentNode}return!1},getCenter:function(touches){var pageX=[],pageY=[],clientX=[],clientY=[],min=Math.min,max=Math.max;return 1===touches.length?{pageX:touches[0].pageX,pageY:touches[0].pageY,clientX:touches[0].clientX,clientY:touches[0].clientY}:(Utils.each(touches,function(touch){pageX.push(touch.pageX),pageY.push(touch.pageY),clientX.push(touch.clientX),clientY.push(touch.clientY)}),{pageX:(min.apply(Math,pageX)+max.apply(Math,pageX))/2,pageY:(min.apply(Math,pageY)+max.apply(Math,pageY))/2,clientX:(min.apply(Math,clientX)+max.apply(Math,clientX))/2,clientY:(min.apply(Math,clientY)+max.apply(Math,clientY))/2})},getVelocity:function(deltaTime,deltaX,deltaY){return{x:Math.abs(deltaX/deltaTime)||0,y:Math.abs(deltaY/deltaTime)||0}},getAngle:function(touch1,touch2){var x=touch2.clientX-touch1.clientX,y=touch2.clientY-touch1.clientY;return 180*Math.atan2(y,x)/Math.PI},getDirection:function(touch1,touch2){var x=Math.abs(touch1.clientX-touch2.clientX),y=Math.abs(touch1.clientY-touch2.clientY);return x>=y?touch1.clientX-touch2.clientX>0?DIRECTION_LEFT:DIRECTION_RIGHT:touch1.clientY-touch2.clientY>0?DIRECTION_UP:DIRECTION_DOWN},getDistance:function(touch1,touch2){var x=touch2.clientX-touch1.clientX,y=touch2.clientY-touch1.clientY;return Math.sqrt(x*x+y*y)},getScale:function(start,end){return start.length>=2&&end.length>=2?this.getDistance(end[0],end[1])/this.getDistance(start[0],start[1]):1},getRotation:function(start,end){return start.length>=2&&end.length>=2?this.getAngle(end[1],end[0])-this.getAngle(start[1],start[0]):0},isVertical:function(direction){return direction==DIRECTION_UP||direction==DIRECTION_DOWN},setPrefixedCss:function(element,prop,value,toggle){var prefixes=["","Webkit","Moz","O","ms"];prop=Utils.toCamelCase(prop);for(var i=0;i<prefixes.length;i++){var p=prop;if(prefixes[i]&&(p=prefixes[i]+p.slice(0,1).toUpperCase()+p.slice(1)),p in element.style){element.style[p]=(null===toggle||toggle)&&value||"";break}}},toggleBehavior:function(element,props,toggle){if(props&&element&&element.style){Utils.each(props,function(value,prop){Utils.setPrefixedCss(element,prop,value,toggle)});var falseFn=toggle&&function(){return!1};"none"==props.userSelect&&(element.onselectstart=falseFn),"none"==props.userDrag&&(element.ondragstart=falseFn)}},toCamelCase:function(str){return str.replace(/[_-]([a-z])/g,function(s){return s[1].toUpperCase()})}},Event$1=GestureDetector.event={preventMouseEvents:!1,started:!1,shouldDetect:!1,on:function(element,type,handler,hook){var types=type.split(" ");Utils.each(types,function(type){Utils.on(element,type,handler),hook&&hook(type)})},off:function(element,type,handler,hook){var types=type.split(" ");Utils.each(types,function(type){Utils.off(element,type,handler),hook&&hook(type)})},onTouch:function(element,eventType,handler){var self=this,onTouchHandler=function(ev){var triggerType,srcType=ev.type.toLowerCase(),isPointer=GestureDetector.HAS_POINTEREVENTS,isMouse=Utils.inStr(srcType,"mouse");isMouse&&self.preventMouseEvents||(isMouse&&eventType==EVENT_START&&0===ev.button?(self.preventMouseEvents=!1,self.shouldDetect=!0):isPointer&&eventType==EVENT_START?self.shouldDetect=1===ev.buttons||PointerEvent.matchType(POINTER_TOUCH,ev):isMouse||eventType!=EVENT_START||(self.preventMouseEvents=!0,self.shouldDetect=!0),isPointer&&eventType!=EVENT_END&&PointerEvent.updatePointer(eventType,ev),self.shouldDetect&&(triggerType=self.doDetect.call(self,ev,eventType,element,handler)),triggerType==EVENT_END&&(self.preventMouseEvents=!1,self.shouldDetect=!1,PointerEvent.reset()),isPointer&&eventType==EVENT_END&&PointerEvent.updatePointer(eventType,ev))};return this.on(element,EVENT_TYPES[eventType],onTouchHandler),onTouchHandler},doDetect:function(ev,eventType,element,handler){var touchList=this.getTouchList(ev,eventType),touchListLength=touchList.length,triggerType=eventType,triggerChange=touchList.trigger,changedLength=touchListLength;eventType==EVENT_START?triggerChange=EVENT_TOUCH:eventType==EVENT_END&&(triggerChange=EVENT_RELEASE,changedLength=touchList.length-(ev.changedTouches?ev.changedTouches.length:1)),changedLength>0&&this.started&&(triggerType=EVENT_MOVE),this.started=!0;var evData=this.collectEventData(element,triggerType,touchList,ev);return eventType!=EVENT_END&&handler.call(Detection,evData),triggerChange&&(evData.changedLength=changedLength,evData.eventType=triggerChange,handler.call(Detection,evData),evData.eventType=triggerType,delete evData.changedLength),triggerType==EVENT_END&&(handler.call(Detection,evData),this.started=!1),triggerType},determineEventTypes:function(){var types;return types=GestureDetector.HAS_POINTEREVENTS?window.PointerEvent?["pointerdown","pointermove","pointerup pointercancel lostpointercapture"]:["MSPointerDown","MSPointerMove","MSPointerUp MSPointerCancel MSLostPointerCapture"]:GestureDetector.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],EVENT_TYPES[EVENT_START]=types[0],EVENT_TYPES[EVENT_MOVE]=types[1],EVENT_TYPES[EVENT_END]=types[2],EVENT_TYPES},getTouchList:function(ev,eventType){if(GestureDetector.HAS_POINTEREVENTS)return PointerEvent.getTouchList();if(ev.touches){if(eventType==EVENT_MOVE)return ev.touches;var identifiers=[],concat=[].concat(Utils.toArray(ev.touches),Utils.toArray(ev.changedTouches)),touchList=[];return Utils.each(concat,function(touch){Utils.inArray(identifiers,touch.identifier)===!1&&touchList.push(touch),identifiers.push(touch.identifier)}),touchList}return ev.identifier=1,[ev]},collectEventData:function(element,eventType,touches,ev){var pointerType=POINTER_TOUCH;return Utils.inStr(ev.type,"mouse")||PointerEvent.matchType(POINTER_MOUSE,ev)?pointerType=POINTER_MOUSE:PointerEvent.matchType(POINTER_PEN,ev)&&(pointerType=POINTER_PEN),{center:Utils.getCenter(touches),timeStamp:Date.now(),target:ev.target,touches:touches,eventType:eventType,pointerType:pointerType,srcEvent:ev,preventDefault:function(){var srcEvent=this.srcEvent;srcEvent.preventManipulation&&srcEvent.preventManipulation(),srcEvent.preventDefault&&srcEvent.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return Detection.stopDetect()}}}},PointerEvent=GestureDetector.PointerEvent={pointers:{},getTouchList:function(){var touchlist=[];return Utils.each(this.pointers,function(pointer){touchlist.push(pointer)}),touchlist},updatePointer:function(eventType,pointerEvent){eventType==EVENT_END||eventType!=EVENT_END&&1!==pointerEvent.buttons?delete this.pointers[pointerEvent.pointerId]:(pointerEvent.identifier=pointerEvent.pointerId,this.pointers[pointerEvent.pointerId]=pointerEvent)},matchType:function(pointerType,ev){if(!ev.pointerType)return!1;var pt=ev.pointerType,types={};return types[POINTER_MOUSE]=pt===(ev.MSPOINTER_TYPE_MOUSE||POINTER_MOUSE),types[POINTER_TOUCH]=pt===(ev.MSPOINTER_TYPE_TOUCH||POINTER_TOUCH),types[POINTER_PEN]=pt===(ev.MSPOINTER_TYPE_PEN||POINTER_PEN),types[pointerType]},reset:function(){this.pointers={}}},Detection=GestureDetector.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(inst,eventData){this.current||(this.stopped=!1,this.current={inst:inst,startEvent:Utils.extend({},eventData),lastEvent:!1,lastCalcEvent:!1,futureCalcEvent:!1,lastCalcData:{},name:""},this.detect(eventData))},detect:function(eventData){if(this.current&&!this.stopped){eventData=this.extendEventData(eventData);var inst=this.current.inst,instOptions=inst.options;return Utils.each(this.gestures,function(gesture){!this.stopped&&inst.enabled&&instOptions[gesture.name]&&gesture.handler.call(gesture,eventData,inst)},this),this.current&&(this.current.lastEvent=eventData),eventData.eventType==EVENT_END&&this.stopDetect(),eventData}},stopDetect:function(){this.previous=Utils.extend({},this.current),this.current=null,this.stopped=!0},getCalculatedData:function(ev,center,deltaTime,deltaX,deltaY){var cur=this.current,recalc=!1,calcEv=cur.lastCalcEvent,calcData=cur.lastCalcData;calcEv&&ev.timeStamp-calcEv.timeStamp>GestureDetector.CALCULATE_INTERVAL&&(center=calcEv.center,deltaTime=ev.timeStamp-calcEv.timeStamp,deltaX=ev.center.clientX-calcEv.center.clientX,deltaY=ev.center.clientY-calcEv.center.clientY,recalc=!0),(ev.eventType==EVENT_TOUCH||ev.eventType==EVENT_RELEASE)&&(cur.futureCalcEvent=ev),(!cur.lastCalcEvent||recalc)&&(calcData.velocity=Utils.getVelocity(deltaTime,deltaX,deltaY),calcData.angle=Utils.getAngle(center,ev.center),calcData.direction=Utils.getDirection(center,ev.center),cur.lastCalcEvent=cur.futureCalcEvent||ev,cur.futureCalcEvent=ev),ev.velocityX=calcData.velocity.x,ev.velocityY=calcData.velocity.y,ev.interimAngle=calcData.angle,ev.interimDirection=calcData.direction},extendEventData:function(ev){var cur=this.current,startEv=cur.startEvent,lastEv=cur.lastEvent||startEv;(ev.eventType==EVENT_TOUCH||ev.eventType==EVENT_RELEASE)&&(startEv.touches=[],Utils.each(ev.touches,function(touch){startEv.touches.push({clientX:touch.clientX,clientY:touch.clientY})}));var deltaTime=ev.timeStamp-startEv.timeStamp,deltaX=ev.center.clientX-startEv.center.clientX,deltaY=ev.center.clientY-startEv.center.clientY;return this.getCalculatedData(ev,lastEv.center,deltaTime,deltaX,deltaY),Utils.extend(ev,{startEvent:startEv,deltaTime:deltaTime,deltaX:deltaX,deltaY:deltaY,distance:Utils.getDistance(startEv.center,ev.center),angle:Utils.getAngle(startEv.center,ev.center),direction:Utils.getDirection(startEv.center,ev.center),scale:Utils.getScale(startEv.touches,ev.touches),rotation:Utils.getRotation(startEv.touches,ev.touches)}),ev},register:function(gesture){var options=gesture.defaults||{};return void 0===options[gesture.name]&&(options[gesture.name]=!0),Utils.extend(GestureDetector.defaults,options,!0),gesture.index=gesture.index||1e3,this.gestures.push(gesture),this.gestures.sort(function(a,b){return a.index<b.index?-1:a.index>b.index?1:0}),this.gestures}},GestureDetector.Instance=function(element,options){var self=this;setup(),this.element=element,this.enabled=!0,Utils.each(options,function(value,name){delete options[name],options[Utils.toCamelCase(name)]=value}),this.options=Utils.extend(Utils.extend({},GestureDetector.defaults),options||{}),this.options.behavior&&Utils.toggleBehavior(this.element,this.options.behavior,!0),this.eventStartHandler=Event$1.onTouch(element,EVENT_START,function(ev){self.enabled&&ev.eventType==EVENT_START?Detection.startDetect(self,ev):ev.eventType==EVENT_TOUCH&&Detection.detect(ev)}),this.eventHandlers=[]},GestureDetector.Instance.prototype={on:function(gestures,handler){var self=this;return Event$1.on(self.element,gestures,handler,function(type){self.eventHandlers.push({gesture:type,handler:handler})}),self},off:function(gestures,handler){var self=this;return Event$1.off(self.element,gestures,handler,function(type){var index=Utils.inArray({gesture:type,handler:handler});index!==!1&&self.eventHandlers.splice(index,1)}),self},trigger:function(gesture,eventData){eventData||(eventData={});var event=GestureDetector.DOCUMENT.createEvent("Event");event.initEvent(gesture,!0,!0),event.gesture=eventData;var element=this.element;return Utils.hasParent(eventData.target,element)&&(element=eventData.target),element.dispatchEvent(event),this},enable:function(state){return this.enabled=state,this},dispose:function(){
var i,eh;for(Utils.toggleBehavior(this.element,this.options.behavior,!1),i=-1;eh=this.eventHandlers[++i];)Utils.off(this.element,eh.gesture,eh.handler);return this.eventHandlers=[],Event$1.off(this.element,EVENT_TYPES[EVENT_START],this.eventStartHandler),null}},function(name){function dragGesture(ev,inst){var cur=Detection.current;if(!(inst.options.dragMaxTouches>0&&ev.touches.length>inst.options.dragMaxTouches))switch(ev.eventType){case EVENT_START:triggered=!1;break;case EVENT_MOVE:if(ev.distance<inst.options.dragMinDistance&&cur.name!=name)return;var startCenter=cur.startEvent.center;if(cur.name!=name&&(cur.name=name,inst.options.dragDistanceCorrection&&ev.distance>0)){var factor=Math.abs(inst.options.dragMinDistance/ev.distance);startCenter.pageX+=ev.deltaX*factor,startCenter.pageY+=ev.deltaY*factor,startCenter.clientX+=ev.deltaX*factor,startCenter.clientY+=ev.deltaY*factor,ev=Detection.extendEventData(ev)}(cur.lastEvent.dragLockToAxis||inst.options.dragLockToAxis&&inst.options.dragLockMinDistance<=ev.distance)&&(ev.dragLockToAxis=!0);var lastDirection=cur.lastEvent.direction;ev.dragLockToAxis&&lastDirection!==ev.direction&&(ev.direction=Utils.isVertical(lastDirection)?ev.deltaY<0?DIRECTION_UP:DIRECTION_DOWN:ev.deltaX<0?DIRECTION_LEFT:DIRECTION_RIGHT),triggered||(inst.trigger(name+"start",ev),triggered=!0),inst.trigger(name,ev),inst.trigger(name+ev.direction,ev);var isVertical=Utils.isVertical(ev.direction);(inst.options.dragBlockVertical&&isVertical||inst.options.dragBlockHorizontal&&!isVertical)&&ev.preventDefault();break;case EVENT_RELEASE:triggered&&ev.changedLength<=inst.options.dragMaxTouches&&(inst.trigger(name+"end",ev),triggered=!1);break;case EVENT_END:triggered=!1}}var triggered=!1;GestureDetector.gestures.Drag={name:name,index:50,handler:dragGesture,defaults:{dragMinDistance:10,dragDistanceCorrection:!0,dragMaxTouches:1,dragBlockHorizontal:!1,dragBlockVertical:!1,dragLockToAxis:!1,dragLockMinDistance:25}}}("drag"),GestureDetector.gestures.Gesture={name:"gesture",index:1337,handler:function(ev,inst){inst.trigger(this.name,ev)}},function(name){function holdGesture(ev,inst){var options=inst.options,current=Detection.current;switch(ev.eventType){case EVENT_START:clearTimeout(timer),current.name=name,timer=setTimeout(function(){current&¤t.name==name&&inst.trigger(name,ev)},options.holdTimeout);break;case EVENT_MOVE:ev.distance>options.holdThreshold&&clearTimeout(timer);break;case EVENT_RELEASE:clearTimeout(timer)}}var timer;GestureDetector.gestures.Hold={name:name,index:10,defaults:{holdTimeout:500,holdThreshold:2},handler:holdGesture}}("hold"),GestureDetector.gestures.Release={name:"release",index:1/0,handler:function(ev,inst){ev.eventType==EVENT_RELEASE&&inst.trigger(this.name,ev)}},GestureDetector.gestures.Swipe={name:"swipe",index:40,defaults:{swipeMinTouches:1,swipeMaxTouches:1,swipeVelocityX:.6,swipeVelocityY:.6},handler:function(ev,inst){if(ev.eventType==EVENT_RELEASE){var touches=ev.touches.length,options=inst.options;if(touches<options.swipeMinTouches||touches>options.swipeMaxTouches)return;(ev.velocityX>options.swipeVelocityX||ev.velocityY>options.swipeVelocityY)&&(inst.trigger(this.name,ev),inst.trigger(this.name+ev.direction,ev))}}},function(name){function tapGesture(ev,inst){var sincePrev,didDoubleTap,options=inst.options,current=Detection.current,prev=Detection.previous;switch(ev.eventType){case EVENT_START:hasMoved=!1;break;case EVENT_MOVE:hasMoved=hasMoved||ev.distance>options.tapMaxDistance;break;case EVENT_END:!Utils.inStr(ev.srcEvent.type,"cancel")&&ev.deltaTime<options.tapMaxTime&&!hasMoved&&(sincePrev=prev&&prev.lastEvent&&ev.timeStamp-prev.lastEvent.timeStamp,didDoubleTap=!1,prev&&prev.name==name&&sincePrev&&sincePrev<options.doubleTapInterval&&ev.distance<options.doubleTapDistance&&(inst.trigger("doubletap",ev),didDoubleTap=!0),(!didDoubleTap||options.tapAlways)&&(current.name=name,inst.trigger(current.name,ev)))}}var hasMoved=!1;GestureDetector.gestures.Tap={name:name,index:100,handler:tapGesture,defaults:{tapMaxTime:250,tapMaxDistance:10,tapAlways:!0,doubleTapDistance:20,doubleTapInterval:300}}}("tap"),GestureDetector.gestures.Touch={name:"touch",index:-(1/0),defaults:{preventDefault:!1,preventMouse:!1},handler:function(ev,inst){return inst.options.preventMouse&&ev.pointerType==POINTER_MOUSE?void ev.stopDetect():(inst.options.preventDefault&&ev.preventDefault(),void(ev.eventType==EVENT_TOUCH&&inst.trigger("touch",ev)))}},function(name){function transformGesture(ev,inst){switch(ev.eventType){case EVENT_START:triggered=!1;break;case EVENT_MOVE:if(ev.touches.length<2)return;var scaleThreshold=Math.abs(1-ev.scale),rotationThreshold=Math.abs(ev.rotation);if(scaleThreshold<inst.options.transformMinScale&&rotationThreshold<inst.options.transformMinRotation)return;Detection.current.name=name,triggered||(inst.trigger(name+"start",ev),triggered=!0),inst.trigger(name,ev),rotationThreshold>inst.options.transformMinRotation&&inst.trigger("rotate",ev),scaleThreshold>inst.options.transformMinScale&&(inst.trigger("pinch",ev),inst.trigger("pinch"+(ev.scale<1?"in":"out"),ev));break;case EVENT_RELEASE:triggered&&ev.changedLength<2&&(inst.trigger(name+"end",ev),triggered=!1)}}var triggered=!1;GestureDetector.gestures.Transform={name:name,index:45,defaults:{transformMinScale:.01,transformMinRotation:1},handler:transformGesture}}("transform");var Platform=function(){function Platform(){babelHelpers.classCallCheck(this,Platform),this._renderPlatform=null}return babelHelpers.createClass(Platform,[{key:"select",value:function(platform){"string"==typeof platform&&(this._renderPlatform=platform.trim().toLowerCase())}},{key:"isWebView",value:function(){if("loading"===document.readyState||"uninitialized"==document.readyState)throw new Error("isWebView() method is available after dom contents loaded.");return!!(window.cordova||window.phonegap||window.PhoneGap)}},{key:"isIOS",value:function(){return this._renderPlatform?"ios"===this._renderPlatform:"object"===("undefined"==typeof device?"undefined":babelHelpers["typeof"](device))?/iOS/i.test(device.platform):/iPhone|iPad|iPod/i.test(navigator.userAgent)}},{key:"isAndroid",value:function(){return this._renderPlatform?"android"===this._renderPlatform:/Android/i.test("object"===("undefined"==typeof device?"undefined":babelHelpers["typeof"](device))?device.platform:navigator.userAgent)}},{key:"isAndroidPhone",value:function(){return/Android/i.test(navigator.userAgent)&&/Mobile/i.test(navigator.userAgent)}},{key:"isAndroidTablet",value:function(){return/Android/i.test(navigator.userAgent)&&!/Mobile/i.test(navigator.userAgent)}},{key:"isWP",value:function(){return this._renderPlatform?"wp"===this._renderPlatform:"object"===("undefined"==typeof device?"undefined":babelHelpers["typeof"](device))?/Win32NT|WinCE/i.test(device.platform):/Windows Phone|IEMobile|WPDesktop/i.test(navigator.userAgent)}},{key:"isIPhone",value:function(){return/iPhone/i.test(navigator.userAgent)}},{key:"isIPad",value:function(){return/iPad/i.test(navigator.userAgent)}},{key:"isIPod",value:function(){return/iPod/i.test(navigator.userAgent)}},{key:"isBlackBerry",value:function(){return this._renderPlatform?"blackberry"===this._renderPlatform:"object"===("undefined"==typeof device?"undefined":babelHelpers["typeof"](device))?/BlackBerry/i.test(device.platform):/BlackBerry|RIM Tablet OS|BB10/i.test(navigator.userAgent)}},{key:"isOpera",value:function(){return this._renderPlatform?"opera"===this._renderPlatform:!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0}},{key:"isFirefox",value:function(){return this._renderPlatform?"firefox"===this._renderPlatform:"undefined"!=typeof InstallTrigger}},{key:"isSafari",value:function(){return this._renderPlatform?"safari"===this._renderPlatform:Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0}},{key:"isChrome",value:function(){return this._renderPlatform?"chrome"===this._renderPlatform:!(!window.chrome||window.opera||navigator.userAgent.indexOf(" OPR/")>=0||navigator.userAgent.indexOf(" Edge/")>=0)}},{key:"isIE",value:function(){return this._renderPlatform?"ie"===this._renderPlatform:!1||!!document.documentMode}},{key:"isEdge",value:function(){return this._renderPlatform?"edge"===this._renderPlatform:navigator.userAgent.indexOf(" Edge/")>=0}},{key:"isIOS7above",value:function(){if("object"===("undefined"==typeof device?"undefined":babelHelpers["typeof"](device)))return/iOS/i.test(device.platform)&&parseInt(device.version.split(".")[0])>=7;if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){var ver=(navigator.userAgent.match(/\b[0-9]+_[0-9]+(?:_[0-9]+)?\b/)||[""])[0].replace(/_/g,".");return parseInt(ver.split(".")[0])>=7}return!1}},{key:"getMobileOS",value:function(){return this.isAndroid()?"android":this.isIOS()?"ios":this.isWP()?"wp":"other"}},{key:"getIOSDevice",value:function(){return this.isIPhone()?"iphone":this.isIPad()?"ipad":this.isIPod()?"ipod":"na"}}]),Platform}(),platform=new Platform,notification={};notification._createAlertDialog=function(title,message,buttonLabels,primaryButtonIndex,modifier,animation,id,_callback,messageIsHTML,cancelable,promptDialog,autofocus,placeholder,defaultValue,submitOnEnter,compile){compile=compile||function(object){return object};var titleElementHTML="string"==typeof title?'<div class="alert-dialog-title"></div>':"",dialogElement=util.createElement("\n <ons-alert-dialog>\n "+titleElementHTML+'\n <div class="alert-dialog-content"></div>\n <div class="alert-dialog-footer"></div>\n </ons-alert-dialog>');CustomElements.upgrade(dialogElement),id&&dialogElement.setAttribute("id",id);var titleElement=dialogElement.querySelector(".alert-dialog-title"),messageElement=dialogElement.querySelector(".alert-dialog-content"),footerElement=dialogElement.querySelector(".alert-dialog-footer"),inputElement=void 0,result={};result.promise=new Promise(function(resolve,reject){result.resolve=resolve,result.reject=reject}),modifier=modifier||dialogElement.getAttribute("modifier"),"string"==typeof title&&(titleElement.textContent=title),titleElement=null,dialogElement.setAttribute("animation",animation),messageIsHTML?messageElement.innerHTML=message:messageElement.textContent=message,promptDialog&&(inputElement=util.createElement('<input class="text-input" type="text"></input>'),modifier&&inputElement.classList.add("text-input--"+modifier),inputElement.setAttribute("placeholder",placeholder),inputElement.value=defaultValue,inputElement.style.width="100%",inputElement.style.marginTop="10px",messageElement.appendChild(inputElement),submitOnEnter&&inputElement.addEventListener("keypress",function(event){13===event.keyCode&&dialogElement.hide({callback:function(){_callback(inputElement.value),result.resolve(inputElement.value),dialogElement.destroy(),dialogElement=null}})},!1)),document.body.appendChild(dialogElement),compile(dialogElement),buttonLabels.length<=2&&footerElement.classList.add("alert-dialog-footer--one");for(var createButton=function(i){var buttonElement=util.createElement('<button class="alert-dialog-button"></button>');buttonElement.appendChild(document.createTextNode(buttonLabels[i])),i==primaryButtonIndex&&buttonElement.classList.add("alert-dialog-button--primal"),buttonLabels.length<=2&&buttonElement.classList.add("alert-dialog-button--one");var onClick=function onClick(){buttonElement.removeEventListener("click",onClick,!1),dialogElement.hide({callback:function(){promptDialog?(_callback(inputElement.value),result.resolve(inputElement.value)):(_callback(i),result.resolve(i)),dialogElement.destroy(),dialogElement=inputElement=buttonElement=null}})};buttonElement.addEventListener("click",onClick,!1),footerElement.appendChild(buttonElement)},i=0;i<buttonLabels.length;i++)createButton(i);return cancelable&&(dialogElement.setCancelable(cancelable),dialogElement.addEventListener("cancel",function(){promptDialog?(_callback(null),result.reject(null)):(_callback(-1),result.reject(-1)),setTimeout(function(){dialogElement.destroy(),dialogElement=null,inputElement=null})},!1)),dialogElement.show({callback:function(){inputElement&&promptDialog&&autofocus&&inputElement.focus()}}),messageElement=footerElement=null,modifier&&(dialogElement.setAttribute("modifier",""),dialogElement.setAttribute("modifier",modifier)),result.promise},notification._alertOriginal=function(message){var options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];"string"==typeof message?options.message=message:options=message;var defaults={buttonLabel:"OK",animation:"default",title:"Alert",callback:function(){}};if(options=util.extend({},defaults,options),!options.message&&!options.messageHTML)throw new Error("Alert dialog must contain a message.");return notification._createAlertDialog(options.title,options.message||options.messageHTML,[options.buttonLabel],0,options.modifier,options.animation,options.id,options.callback,options.message?!1:!0,!1,!1,!1,"","",!1,options.compile)},notification.alert=notification._alertOriginal,notification._confirmOriginal=function(options){var defaults={buttonLabels:["Cancel","OK"],primaryButtonIndex:1,animation:"default",title:"Confirm",callback:function(){},cancelable:!1};if(options=util.extend({},defaults,options),!options.message&&!options.messageHTML)throw new Error("Confirm dialog must contain a message.");return notification._createAlertDialog(options.title,options.message||options.messageHTML,options.buttonLabels,options.primaryButtonIndex,options.modifier,options.animation,options.id,options.callback,options.message?!1:!0,options.cancelable,!1,!1,"","",!1,options.compile)},notification.confirm=notification._confirmOriginal,notification._promptOriginal=function(options){var defaults={buttonLabel:"OK",animation:"default",title:"Alert",defaultValue:"",placeholder:"",callback:function(){},cancelable:!1,autofocus:!0,submitOnEnter:!0};if(options=util.extend({},defaults,options),!options.message&&!options.messageHTML)throw new Error("Prompt dialog must contain a message.");return notification._createAlertDialog(options.title,options.message||options.messageHTML,[options.buttonLabel],0,options.modifier,options.animation,options.id,options.callback,options.message?!1:!0,options.cancelable,!0,options.autofocus,options.placeholder,options.defaultValue,options.submitOnEnter,options.compile)},notification.prompt=notification._promptOriginal;var pageAttributeExpression={_variables:{},defineVariable:function(name,value){var overwrite=arguments.length<=2||void 0===arguments[2]?!1:arguments[2];if("string"!=typeof name)throw new Error("Variable name must be a string.");if("string"!=typeof value&&"function"!=typeof value)throw new Error("Variable value must be a string or a function.");if(this._variables.hasOwnProperty(name)&&!overwrite)throw new Error('"'+name+'" is already defined.');this._variables[name]=value},getVariable:function(name){return this._variables.hasOwnProperty(name)?this._variables[name]:null},removeVariable:function(name){delete this._variables[name]},getAllVariables:function(){return this._variables},_parsePart:function(part){var c=void 0,inInterpolation=!1,currentIndex=0,tokens=[];if(0===part.length)throw new Error("Unable to parse empty string.");for(var i=0;i<part.length;i++)if(c=part.charAt(i),"$"===c&&"{"===part.charAt(i+1)){if(inInterpolation)throw new Error("Nested interpolation not supported.");var token=part.substring(currentIndex,i);token.length>0&&tokens.push(part.substring(currentIndex,i)),currentIndex=i,inInterpolation=!0}else if("}"===c){if(!inInterpolation)throw new Error("} must be preceeded by ${");var token=part.substring(currentIndex,i+1);token.length>0&&tokens.push(part.substring(currentIndex,i+1)),currentIndex=i+1,inInterpolation=!1}if(inInterpolation)throw new Error("Unterminated interpolation.");return tokens.push(part.substring(currentIndex,part.length)),tokens},_replaceToken:function(token){var re=/^\${(.*?)}$/,match=token.match(re);if(match){var name=match[1].trim(),variable=this.getVariable(name);if(null===variable)throw new Error('Variable "'+name+'" does not exist.');if("string"==typeof variable)return variable;var rv=variable();if("string"!=typeof rv)throw new Error("Must return a string.");return rv}return token},_replaceTokens:function(tokens){return tokens.map(this._replaceToken.bind(this))},_parseExpression:function(expression){return expression.split(",").map(function(part){return part.trim()}).map(this._parsePart.bind(this)).map(this._replaceTokens.bind(this)).map(function(part){return part.join("")})},evaluate:function(expression){return expression?this._parseExpression(expression):[]}};pageAttributeExpression.defineVariable("mobileOS",platform.getMobileOS()),pageAttributeExpression.defineVariable("iOSDevice",platform.getIOSDevice()),pageAttributeExpression.defineVariable("runtime",function(){return platform.isWebView()?"cordova":"browser"});var internal={};internal.config={autoStatusBarFill:!0,animationsDisabled:!1},internal.nullElement=window.document.createElement("div"),internal.isEnabledAutoStatusBarFill=function(){return!!internal.config.autoStatusBarFill},internal.normalizePageHTML=function(html){return html=(""+html).trim(),html.match(/^<ons-page/)||(html="<ons-page _muted>"+html+"</ons-page>"),html},internal.waitDOMContentLoaded=function(callback){"loading"===window.document.readyState||"uninitialized"==window.document.readyState?window.document.addEventListener("DOMContentLoaded",callback):setImmediate(callback)},internal.shouldFillStatusBar=function(element){var checkStatusBar=function(){if(internal.isEnabledAutoStatusBarFill()&&platform.isWebView()&&platform.isIOS7above()){if(!(element instanceof HTMLElement))throw new Error("element must be an instance of HTMLElement");for(;;){if(element.hasAttribute("no-status-bar-fill"))return!1;if(element=element.parentNode,!element||!element.hasAttribute)return!0}}return!1};return new Promise(function(resolve,reject){"object"===("undefined"==typeof device?"undefined":babelHelpers["typeof"](device))?document.addEventListener("deviceready",function(){checkStatusBar()&&resolve()}):checkStatusBar()&&resolve(),reject()})},internal.templateStore={_storage:{},get:function(key){return internal.templateStore._storage[key]||null},set:function(key,template){internal.templateStore._storage[key]=template}},window.document.addEventListener("_templateloaded",function(e){"ons-template"===e.target.nodeName.toLowerCase()&&internal.templateStore.set(e.templateId,e.template)},!1),window.document.addEventListener("DOMContentLoaded",function(){function register(query){for(var templates=window.document.querySelectorAll(query),i=0;i<templates.length;i++)internal.templateStore.set(templates[i].getAttribute("id"),templates[i].textContent)}register('script[type="text/ons-template"]'),register('script[type="text/template"]'),register('script[type="text/ng-template"]')},!1),internal.getTemplateHTMLAsync=function(page){return new Promise(function(resolve,reject){setImmediate(function(){var cache=internal.templateStore.get(page);if(cache){var html="string"==typeof cache?cache:cache[1];resolve(html)}else!function(){var xhr=new XMLHttpRequest;xhr.open("GET",page,!0),xhr.onload=function(response){var html=xhr.responseText;xhr.status>=400&&xhr.status<600?reject(html):resolve(html)},xhr.onerror=function(){throw new Error("The page is not found: "+page)},xhr.send(null)}()})})},internal.getPageHTMLAsync=function(page){var pages=pageAttributeExpression.evaluate(page),getPage=function getPage(page){return"string"!=typeof page?Promise.reject("Must specify a page."):internal.getTemplateHTMLAsync(page).then(function(html){return internal.normalizePageHTML(html)},function(error){return 0===pages.length?Promise.reject(error):getPage(pages.shift())}).then(function(html){return internal.normalizePageHTML(html)})};return getPage(pages.shift())};var AnimatorFactory=function(){function AnimatorFactory(opts){if(babelHelpers.classCallCheck(this,AnimatorFactory),this._animators=opts.animators,this._baseClass=opts.baseClass,this._baseClassName=opts.baseClassName||opts.baseClass.name,this._animation=opts.defaultAnimation||"default",this._animationOptions=opts.defaultAnimationOptions||{},!this._animators[this._animation])throw new Error("No such animation: "+this._animation)}return babelHelpers.createClass(AnimatorFactory,[{key:"setAnimationOptions",value:function(options){this._animationOptions=options}},{key:"newAnimator",value:function(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],defaultAnimator=arguments[1],animator=null;if(options.animation instanceof this._baseClass)return options.animation;var Animator=null;if("string"==typeof options.animation&&(Animator=this._animators[options.animation]),!Animator&&defaultAnimator)animator=defaultAnimator;else{Animator=Animator||this._animators[this._animation];var animationOpts=util.extend({},this._animationOptions,options.animationOptions||{},internal.config.animationsDisabled?{duration:0,delay:0}:{});animator=new Animator(animationOpts),"function"==typeof animator&&(animator=new animator(animationOpts))}if(!(animator instanceof this._baseClass))throw new Error('"animator" is not an instance of '+this._baseClassName+".");return animator}}],[{key:"parseAnimationOptionsString",value:function(jsonString){try{if("string"==typeof jsonString){var result=util.animationOptionsParse(jsonString);if("object"===("undefined"==typeof result?"undefined":babelHelpers["typeof"](result))&&null!==result)return result;console.error('"animation-options" attribute must be a JSON object string: '+jsonString)}return{}}catch(e){return console.error('"animation-options" attribute must be a JSON object string: '+jsonString),{}}}}]),AnimatorFactory}(),ModifierUtil=function(){function ModifierUtil(){babelHelpers.classCallCheck(this,ModifierUtil)}return babelHelpers.createClass(ModifierUtil,null,[{key:"diff",value:function(last,current){function makeDict(modifier){var dict={};return ModifierUtil.split(modifier).forEach(function(token){return dict[token]=token}),dict}last=makeDict((""+last).trim()),current=makeDict((""+current).trim());var removed=Object.keys(last).reduce(function(result,token){return current[token]||result.push(token),result},[]),added=Object.keys(current).reduce(function(result,token){return last[token]||result.push(token),result},[]);return{added:added,removed:removed}}},{key:"applyDiffToClassList",value:function(diff,classList,template){diff.added.map(function(modifier){return template.replace(/\*/g,modifier)}).forEach(function(klass){return classList.add(klass)}),diff.removed.map(function(modifier){return template.replace(/\*/g,modifier)}).forEach(function(klass){return classList.remove(klass)})}},{key:"applyDiffToElement",value:function(diff,element,scheme){var matches=function(e,s){return(e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector).call(e,s)};for(var selector in scheme)if(scheme.hasOwnProperty(selector))for(var targetElements=!selector||matches(element,selector)?[element]:element.querySelectorAll(selector),i=0;i<targetElements.length;i++)ModifierUtil.applyDiffToClassList(diff,targetElements[i].classList,scheme[selector])}},{key:"onModifierChanged",value:function(last,current,element,scheme){return ModifierUtil.applyDiffToElement(ModifierUtil.diff(last,current),element,scheme)}},{key:"initModifier",value:function(element,scheme){var modifier=element.getAttribute("modifier");"string"==typeof modifier&&ModifierUtil.applyDiffToElement({removed:[],added:ModifierUtil.split(modifier)},element,scheme)}},{key:"split",value:function(modifier){return"string"!=typeof modifier?[]:modifier.trim().split(/ +/).filter(function(token){return""!==token})}}]),ModifierUtil}(),scheme={createItemContent:{type:"function",returns:Element},countItems:{type:"function",returns:"number"},calculateItemHeight:{type:"function",returns:"number"},updateItemContent:{type:"function",safeCall:!0},destroy:{type:"function",safeCall:!0},destroyItem:{type:"function",safeCall:!0}},LazyRepeatDelegate=function(){function LazyRepeatDelegate(userDelegate){var templateElement=arguments.length<=1||void 0===arguments[1]?null:arguments[1];babelHelpers.classCallCheck(this,LazyRepeatDelegate),this._userDelegate=util.validated("delegate",userDelegate,"object"),this._templateElement=util.validated("templateElement",templateElement,[Element,"null"])}return babelHelpers.createClass(LazyRepeatDelegate,[{key:"_validated",value:function(key){var _scheme=arguments.length<=1||void 0===arguments[1]?scheme:arguments[1];return util.validated(key,null,util.extend({},_scheme[key],{dynamicCall:{object:this._userDelegate,key:key}}))}},{key:"prepareItem",value:function(index,done){return done({element:this._validated("createItemContent")(index,this._templateElement)})}},{key:"countItems",value:function(){return this._validated("countItems")()}},{key:"updateItem",value:function(index,item){return this._validated("updateItemContent")(index,item)}},{key:"calculateItemHeight",value:function(index){return this._validated("calculateItemHeight")(index)}},{key:"destroyItem",value:function(index,item){return this._validated("destroyItem")(index,item)}},{key:"destroy",value:function(){this._validated("destroy")(),this._userDelegate=this._templateElement=null}},{key:"itemHeight",get:function(){return this._userDelegate.itemHeight}}]),LazyRepeatDelegate}(),LazyRepeatProvider=function(){function LazyRepeatProvider(wrapperElement,delegate){if(babelHelpers.classCallCheck(this,LazyRepeatProvider),this._wrapperElement=util.validated("wrapperElement",wrapperElement,Element),this._delegate=util.validated("delegate",delegate,LazyRepeatDelegate),"ons-list"===wrapperElement.tagName.toLowerCase()&&wrapperElement.classList.add("lazy-list"),this._pageContent=util.findParent(wrapperElement,".ons-scroller__content"),this._pageContent||(this._pageContent=util.findParent(wrapperElement,".page__content")),!this._pageContent)throw new Error("ons-lazy-repeat must be a descendant of an <ons-page> or an <ons-scroller> element.");this._topPositions=[],this._renderedItems={};try{this._delegate.itemHeight||this._delegate.calculateItemHeight(0)}catch(e){if(!/must be (a|an instance of) function/.test(""+e))throw e;this._unknownItemHeight=!0}this._addEventListeners(),this._onChange()}return babelHelpers.createClass(LazyRepeatProvider,[{key:"_checkItemHeight",value:function(callback){var _this=this;this._delegate.prepareItem(0,function(_ref){var element=_ref.element;_this._unknownItemHeight&&(_this._wrapperElement.appendChild(element),_this._itemHeight=element.offsetHeight,_this._wrapperElement.removeChild(element),delete _this._unknownItemHeight,callback())})}},{key:"_countItems",value:function(){return this._delegate.countItems()}},{key:"_getItemHeight",value:function(i){return this.staticItemHeight||this._delegate.calculateItemHeight(i)}},{key:"_onChange",value:function(){this._render()}},{key:"refresh",value:function(){this._removeAllElements(),this._onChange()}},{key:"_render",value:function(){var _this2=this;if(this._unknownItemHeight)return this._checkItemHeight(this._render.bind(this));var items=this._getItemsInView(),keep={};items.forEach(function(item){_this2._renderElement(item),keep[item.index]=!0}),Object.keys(this._renderedItems).forEach(function(key){return keep[key]||_this2._removeElement(key)}),this._wrapperElement.style.height=this._listHeight+"px"}},{key:"_renderElement",value:function(_ref2){var _this3=this,index=_ref2.index,top=_ref2.top,item=this._renderedItems[index];return item?(this._delegate.updateItem(index,item),void(item.element.style.top=top+"px")):void this._delegate.prepareItem(index,function(item){util.extend(item.element.style,{position:"absolute",top:top+"px",left:0,right:0}),_this3._wrapperElement.appendChild(item.element),_this3._renderedItems[index]=item})}},{key:"_removeElement",value:function(index){var item=this._renderedItems[index];this._delegate.destroyItem(index,item),item.element.parentElement&&item.element.parentElement.removeChild(item.element),delete this._renderedItems[index]}},{key:"_removeAllElements",value:function(){var _this4=this;Object.keys(this._renderedItems).forEach(function(key){return _this4._removeElement(key)})}},{key:"_calculateStartIndex",value:function(current){var start=0,end=this._itemCount-1;if(this.staticItemHeight)return parseInt(-current/this.staticItemHeight);for(;;){var middle=Math.floor((start+end)/2),value=current+this._topPositions[middle];if(start>end)return 0;if(0>=value&&value+this._getItemHeight(middle)>0)return middle;isNaN(value)||value>=0?end=middle-1:start=middle+1}}},{key:"_recalculateTopPositions",value:function(){Math.min(this._topPositions.length,this._itemCount);this._topPositions[0]=0;for(var _l,i=1;_l>i;i++)this._topPositions[i]=this._topPositions[i-1]+this._getItemHeight(i)}},{key:"_getItemsInView",value:function(){var offset=this._wrapperElement.getBoundingClientRect().top,limit=4*window.innerHeight-offset,count=this._countItems();count!==this._itemCount&&(this._itemCount=count,this._recalculateTopPositions());for(var i=Math.max(0,this._calculateStartIndex(offset)-30),items=[],top=this._topPositions[i];count>i&&limit>top;i++)i>=this._topPositions.length&&(this._topPositions.length+=100),this._topPositions[i]=top,items.push({top:top,index:i}),top+=this._getItemHeight(i);return this._listHeight=top,items}},{key:"_debounce",value:function(func,wait,immediate){var timeout=void 0;return function(){var _this5=this,_arguments=arguments,callNow=immediate&&!timeout;clearTimeout(timeout),callNow?func.apply(this,arguments):timeout=setTimeout(function(){timeout=null,func.apply(_this5,_arguments)},wait)}}},{key:"_doubleFireOnTouchend",value:function(){this._render(),this._debounce(this._render.bind(this),100)}},{key:"_addEventListeners",value:function(){util.bindListeners(this,["_onChange","_doubleFireOnTouchend"]),platform.isIOS()&&(this._boundOnChange=this._debounce(this._boundOnChange,30)),this._pageContent.addEventListener("scroll",this._boundOnChange,!0),platform.isIOS()&&(this._pageContent.addEventListener("touchmove",this._boundOnChange,!0),this._pageContent.addEventListener("touchend",this._boundDoubleFireOnTouchend,!0)),window.document.addEventListener("resize",this._boundOnChange,!0)}},{key:"_removeEventListeners",value:function(){this._pageContent.removeEventListener("scroll",this._boundOnChange,!0),platform.isIOS()&&(this._pageContent.removeEventListener("touchmove",this._boundOnChange,!0),this._pageContent.removeEventListener("touchend",this._boundDoubleFireOnTouchend,!0)),window.document.removeEventListener("resize",this._boundOnChange,!0)}},{key:"destroy",value:function(){this._removeAllElements(),this._delegate.destroy(),this._parentElement=this._delegate=this._renderedItems=null,this._removeEventListeners()}},{key:"staticItemHeight",get:function(){return this._delegate.itemHeight||this._itemHeight}}]),LazyRepeatProvider}();internal.AnimatorFactory=AnimatorFactory,internal.ModifierUtil=ModifierUtil,internal.LazyRepeatProvider=LazyRepeatProvider,internal.LazyRepeatDelegate=LazyRepeatDelegate;var create=function(){var obj={_isPortrait:!1,isPortrait:function(){return this._isPortrait()},isLandscape:function(){return!this.isPortrait()},_init:function(){return document.addEventListener("DOMContentLoaded",this._onDOMContentLoaded.bind(this),!1),"orientation"in window?window.addEventListener("orientationchange",this._onOrientationChange.bind(this),!1):window.addEventListener("resize",this._onResize.bind(this),!1),this._isPortrait=function(){return window.innerHeight>window.innerWidth},this},_onDOMContentLoaded:function(){this._installIsPortraitImplementation(),this.emit("change",{isPortrait:this.isPortrait()})},_installIsPortraitImplementation:function(){var isPortrait=window.innerWidth<window.innerHeight;this._isPortrait="orientation"in window?window.orientation%180===0?function(){return 0===Math.abs(window.orientation%180)?isPortrait:!isPortrait}:function(){return 90===Math.abs(window.orientation%180)?isPortrait:!isPortrait;
}:function(){return window.innerHeight>window.innerWidth}},_onOrientationChange:function(){var _this=this,isPortrait=this._isPortrait(),nIter=0,interval=setInterval(function(){nIter++;var w=window.innerWidth,h=window.innerHeight;isPortrait&&h>=w||!isPortrait&&w>=h?(_this.emit("change",{isPortrait:isPortrait}),clearInterval(interval)):50===nIter&&(_this.emit("change",{isPortrait:isPortrait}),clearInterval(interval))},20)},_onResize:function(){this.emit("change",{isPortrait:this.isPortrait()})}};return MicroEvent.mixin(obj),obj},orientation=create()._init(),softwareKeyboard=new MicroEvent;softwareKeyboard._visible=!1;var onShow=function(){softwareKeyboard._visible=!0,softwareKeyboard.emit("show")},onHide=function(){softwareKeyboard._visible=!1,softwareKeyboard.emit("hide")},bindEvents=function(){return"undefined"!=typeof Keyboard?(Keyboard.onshow=onShow,Keyboard.onhide=onHide,softwareKeyboard.emit("init",{visible:Keyboard.isVisible}),!0):"undefined"!=typeof cordova.plugins&&"undefined"!=typeof cordova.plugins.Keyboard?(window.addEventListener("native.keyboardshow",onShow),window.addEventListener("native.keyboardhide",onHide),softwareKeyboard.emit("init",{visible:cordova.plugins.Keyboard.isVisible}),!0):!1},noPluginError=function(){console.warn("ons-keyboard: Cordova Keyboard plugin is not present.")};document.addEventListener("deviceready",function(){bindEvents()||((document.querySelector("[ons-keyboard-active]")||document.querySelector("[ons-keyboard-inactive]"))&&noPluginError(),softwareKeyboard.on=noPluginError)});var util$1={_ready:!1,_domContentLoaded:!1,_onDOMContentLoaded:function(){util$1._domContentLoaded=!0,platform.isWebView()?window.document.addEventListener("deviceready",function(){util$1._ready=!0},!1):util$1._ready=!0},addBackButtonListener:function(fn){if(!this._domContentLoaded)throw new Error("This method is available after DOMContentLoaded");this._ready?window.document.addEventListener("backbutton",fn,!1):window.document.addEventListener("deviceready",function(){window.document.addEventListener("backbutton",fn,!1)})},removeBackButtonListener:function(fn){if(!this._domContentLoaded)throw new Error("This method is available after DOMContentLoaded");this._ready?window.document.removeEventListener("backbutton",fn,!1):window.document.addEventListener("deviceready",function(){window.document.removeEventListener("backbutton",fn,!1)})}};window.addEventListener("DOMContentLoaded",function(){return util$1._onDOMContentLoaded()},!1);var HandlerRepository={_store:{},_genId:function(){var i=0;return function(){return i++}}(),set:function(element,handler){element.dataset.deviceBackButtonHandlerId&&this.remove(element);var id=element.dataset.deviceBackButtonHandlerId=HandlerRepository._genId();this._store[id]=handler},remove:function(element){element.dataset.deviceBackButtonHandlerId&&(delete this._store[element.dataset.deviceBackButtonHandlerId],delete element.dataset.deviceBackButtonHandlerId)},get:function(element){if(!element.dataset.deviceBackButtonHandlerId)return void 0;var id=element.dataset.deviceBackButtonHandlerId;if(!this._store[id])throw new Error;return this._store[id]},has:function(element){var id=element.dataset.deviceBackButtonHandlerId;return!!this._store[id]}},DeviceBackButtonDispatcher=function(){function DeviceBackButtonDispatcher(){babelHelpers.classCallCheck(this,DeviceBackButtonDispatcher),this._isEnabled=!1,this._boundCallback=this._callback.bind(this)}return babelHelpers.createClass(DeviceBackButtonDispatcher,[{key:"enable",value:function(){this._isEnabled||(util$1.addBackButtonListener(this._boundCallback),this._isEnabled=!0)}},{key:"disable",value:function(){this._isEnabled&&(util$1.removeBackButtonListener(this._boundCallback),this._isEnabled=!1)}},{key:"fireDeviceBackButtonEvent",value:function(){var event=document.createEvent("Event");event.initEvent("backbutton",!0,!0),document.dispatchEvent(event)}},{key:"_callback",value:function(){this._dispatchDeviceBackButtonEvent()}},{key:"createHandler",value:function(element,callback){if(!(element instanceof HTMLElement))throw new Error("element must be an instance of HTMLElement");if(!(callback instanceof Function))throw new Error("callback must be an instance of Function");var handler={_callback:callback,_element:element,disable:function(){HandlerRepository.remove(element)},setListener:function(callback){this._callback=callback},enable:function(){HandlerRepository.set(element,this)},isEnabled:function(){return HandlerRepository.get(element)===this},destroy:function(){HandlerRepository.remove(element),this._callback=this._element=null}};return handler.enable(),handler}},{key:"_dispatchDeviceBackButtonEvent",value:function(){function createEvent(element){return{_element:element,callParentHandler:function(){for(var parent=this._element.parentNode;parent;){if(handler=HandlerRepository.get(parent))return handler._callback(createEvent(parent));parent=parent.parentNode}}}}var tree=this._captureTree(),element=this._findHandlerLeafElement(tree),handler=HandlerRepository.get(element);handler._callback(createEvent(element))}},{key:"_captureTree",value:function(){function createTree(element){return{element:element,children:Array.prototype.concat.apply([],arrayOf(element.children).map(function(childElement){if("none"===childElement.style.display)return[];if(0===childElement.children.length&&!HandlerRepository.has(childElement))return[];var result=createTree(childElement);return 0!==result.children.length||HandlerRepository.has(result.element)?[result]:[]}))}}function arrayOf(target){for(var result=[],i=0;i<target.length;i++)result.push(target[i]);return result}return createTree(document.body)}},{key:"_findHandlerLeafElement",value:function(tree){function find(node){return 0===node.children.length?node.element:1===node.children.length?find(node.children[0]):node.children.map(function(childNode){return childNode.element}).reduce(function(left,right){if(!left)return right;var leftZ=parseInt(window.getComputedStyle(left,"").zIndex,10),rightZ=parseInt(window.getComputedStyle(right,"").zIndex,10);if(!isNaN(leftZ)&&!isNaN(rightZ))return leftZ>rightZ?left:right;throw new Error("Capturing backbutton-handler is failure.")},null)}return find(tree)}}]),DeviceBackButtonDispatcher}(),deviceBackButtonDispatcher=new DeviceBackButtonDispatcher,autoStyleEnabled=!0,modifiersMap={quiet:"material--flat",light:"material--flat",outline:"material--flat",cta:"","large--quiet":"material--flat large","large--cta":"large",noborder:"",chevron:"",tappable:"",underbar:""},platforms={};platforms.android=function(element){if(!/ons-fab|ons-speed-dial|ons-progress/.test(element.tagName.toLowerCase())&&!/material/.test(element.getAttribute("modifier"))){var oldModifier=element.getAttribute("modifier")||"",newModifier=oldModifier.trim().split(/\s+/).map(function(e){return modifiersMap.hasOwnProperty(e)?modifiersMap[e]:e});newModifier.unshift("material"),element.setAttribute("modifier",newModifier.join(" ").trim())}!/ons-button|ons-list-item|ons-fab|ons-speed-dial|ons-tab$/.test(element.tagName.toLowerCase())||element.hasAttribute("ripple")||util.findChild(element,"ons-ripple")||("ons-list-item"===element.tagName.toLowerCase()?element.hasAttribute("tappable")&&(element.setAttribute("ripple",""),element.removeAttribute("tappable")):element.setAttribute("ripple",""))},platforms.ios=function(element){/material/.test(element.getAttribute("modifier"))&&(util.removeModifier(element,"material"),util.removeModifier(element,"material--flat")&&util.addModifier(element,util.removeModifier(element,"large")?"large--quiet":"quiet"),element.getAttribute("modifier")||element.removeAttribute("modifier")),element.hasAttribute("ripple")&&("ons-list-item"===element.tagName.toLowerCase()&&element.setAttribute("tappable",""),element.removeAttribute("ripple"))};var unlocked={android:!0},prepareAutoStyle=function(element,force){if(autoStyleEnabled&&!element.hasAttribute("disable-auto-styling")){var mobileOS=platform.getMobileOS();platforms.hasOwnProperty(mobileOS)&&(unlocked.hasOwnProperty(mobileOS)||force)&&platforms[mobileOS](element)}},autoStyle={isEnabled:function(){return autoStyleEnabled},enable:function(){return autoStyleEnabled=!0},disable:function(){return autoStyleEnabled=!1},prepare:prepareAutoStyle},generateId=function(){var i=0;return function(){return i++}}(),DoorLock=function(){function DoorLock(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];babelHelpers.classCallCheck(this,DoorLock),this._lockList=[],this._waitList=[],this._log=options.log||function(){}}return babelHelpers.createClass(DoorLock,[{key:"lock",value:function(){var _this=this,unlock=function unlock(){_this._unlock(unlock)};return unlock.id=generateId(),this._lockList.push(unlock),this._log("lock: "+unlock.id),unlock}},{key:"_unlock",value:function(fn){var index=this._lockList.indexOf(fn);if(-1===index)throw new Error("This function is not registered in the lock list.");this._lockList.splice(index,1),this._log("unlock: "+fn.id),this._tryToFreeWaitList()}},{key:"_tryToFreeWaitList",value:function(){for(;!this.isLocked()&&this._waitList.length>0;)this._waitList.shift()()}},{key:"waitUnlock",value:function(callback){if(!(callback instanceof Function))throw new Error("The callback param must be a function.");this.isLocked()?this._waitList.push(callback):callback()}},{key:"isLocked",value:function(){return this._lockList.length>0}}]),DoorLock}(),ons$1={};ons$1._util=util,ons$1._deviceBackButtonDispatcher=deviceBackButtonDispatcher,ons$1._internal=internal,ons$1.GestureDetector=GestureDetector,ons$1.platform=platform,ons$1.softwareKeyboard=softwareKeyboard,ons$1.pageAttributeExpression=pageAttributeExpression,ons$1.orientation=orientation,ons$1.notification=notification,ons$1._animationOptionsParser=parse,ons$1._autoStyle=autoStyle,ons$1._DoorLock=DoorLock,ons$1._readyLock=new DoorLock,ons$1.platform.select((window.location.search.match(/platform=([\w-]+)/)||[])[1]),waitDeviceReady(),ons$1.isReady=function(){return!ons$1._readyLock.isLocked()},ons$1.isWebView=ons$1.platform.isWebView,ons$1.ready=function(callback){ons$1.isReady()?callback():ons$1._readyLock.waitUnlock(callback)},ons$1.setDefaultDeviceBackButtonListener=function(listener){ons$1._defaultDeviceBackButtonHandler.setListener(listener)},ons$1.disableDeviceBackButtonHandler=function(){ons$1._deviceBackButtonDispatcher.disable()},ons$1.enableDeviceBackButtonHandler=function(){ons$1._deviceBackButtonDispatcher.enable()},ons$1.enableAutoStatusBarFill=function(){if(ons$1.isReady())throw new Error("This method must be called before ons.isReady() is true.");ons$1._internal.config.autoStatusBarFill=!0},ons$1.disableAutoStatusBarFill=function(){if(ons$1.isReady())throw new Error("This method must be called before ons.isReady() is true.");ons$1._internal.config.autoStatusBarFill=!1},ons$1.disableAnimations=function(){ons$1._internal.config.animationsDisabled=!0},ons$1.enableAnimations=function(){ons$1._internal.config.animationsDisabled=!1},ons$1.disableAutoStyling=ons$1._autoStyle.disable,ons$1.enableAutoStyling=ons$1._autoStyle.enable,ons$1.forcePlatformStyling=function(newPlatform){ons$1.enableAutoStyling(),ons$1.platform.select(newPlatform||"ios"),ons$1._util.arrayFrom(document.querySelectorAll("ons-if")).forEach(function(element){element._platformUpdate()}),ons$1._util.arrayFrom(document.querySelectorAll("[_compiled]")).forEach(function(element){ons$1._autoStyle.prepare(element,!0)})},ons$1._createPopoverOriginal=function(page){var options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(!page)throw new Error("Page url must be defined.");return ons$1._internal.getPageHTMLAsync(page).then(function(html){html=html.match(/<ons-popover/gi)?"<div>"+html+"</div>":"<ons-popover>"+html+"</ons-popover>";var div=ons$1._util.createElement("<div>"+html+"</div>"),popover=div.querySelector("ons-popover");return CustomElements.upgrade(popover),document.body.appendChild(popover),options.link instanceof Function&&options.link(popover),popover})},ons$1.createPopover=ons$1._createPopoverOriginal,ons$1._createDialogOriginal=function(page){var options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(!page)throw new Error("Page url must be defined.");return ons$1._internal.getPageHTMLAsync(page).then(function(html){html=html.match(/<ons-dialog/gi)?"<div>"+html+"</div>":"<ons-dialog>"+html+"</ons-dialog>";var div=ons$1._util.createElement("<div>"+html+"</div>"),dialog=div.querySelector("ons-dialog");return CustomElements.upgrade(dialog),document.body.appendChild(dialog),options.link instanceof Function&&options.link(dialog),dialog})},ons$1.createDialog=ons$1._createDialogOriginal,ons$1._createAlertDialogOriginal=function(page){var options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(!page)throw new Error("Page url must be defined.");return ons$1._internal.getPageHTMLAsync(page).then(function(html){html=html.match(/<ons-alert-dialog/gi)?"<div>"+html+"</div>":"<ons-alert-dialog>"+html+"</ons-alert-dialog>";var div=ons$1._util.createElement("<div>"+html+"</div>"),alertDialog=div.querySelector("ons-alert-dialog");return CustomElements.upgrade(alertDialog),document.body.appendChild(alertDialog),options.link instanceof Function&&options.link(alertDialog),alertDialog})},ons$1.createAlertDialog=ons$1._createAlertDialogOriginal,ons$1._resolveLoadingPlaceholderOriginal=function(page,link){var elements=ons$1._util.arrayFrom(window.document.querySelectorAll("[ons-loading-placeholder]"));if(!(elements.length>0))throw new Error("No ons-loading-placeholder exists.");elements.filter(function(element){return!element.getAttribute("page")}).forEach(function(element){element.setAttribute("ons-loading-placeholder",page),ons$1._resolveLoadingPlaceholder(element,page,link)})},ons$1.resolveLoadingPlaceholder=ons$1._resolveLoadingPlaceholderOriginal,ons$1._setupLoadingPlaceHolders=function(){ons$1.ready(function(){var elements=ons$1._util.arrayFrom(window.document.querySelectorAll("[ons-loading-placeholder]"));elements.forEach(function(element){var page=element.getAttribute("ons-loading-placeholder");"string"==typeof page&&ons$1._resolveLoadingPlaceholder(element,page)})})},ons$1._resolveLoadingPlaceholder=function(element,page,link){link=link||function(element,done){done()},ons$1._internal.getPageHTMLAsync(page).then(function(html){for(;element.firstChild;)element.removeChild(element.firstChild);var contentElement=ons$1._util.createElement("<div>"+html+"</div>");contentElement.style.display="none",element.appendChild(contentElement),link(contentElement,function(){contentElement.style.display=""})})["catch"](function(error){throw new Error("Unabled to resolve placeholder: "+error)})};var BaseElement=function(){if("function"!=typeof HTMLElement){var BaseElement=function(){};return BaseElement.prototype=document.createElement("div"),BaseElement}return HTMLElement}(),TemplateElement=function(_BaseElement){function TemplateElement(){return babelHelpers.classCallCheck(this,TemplateElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(TemplateElement).apply(this,arguments))}return babelHelpers.inherits(TemplateElement,_BaseElement),babelHelpers.createClass(TemplateElement,[{key:"createdCallback",value:function(){for(this.template=this.innerHTML;this.firstChild;)this.removeChild(this.firstChild)}},{key:"attachedCallback",value:function(){var event=new CustomEvent("_templateloaded",{bubbles:!0,cancelable:!0});event.template=this.template,event.templateId=this.getAttribute("id"),this.dispatchEvent(event)}}]),TemplateElement}(BaseElement);window.OnsTemplateElement=document.registerElement("ons-template",{prototype:TemplateElement.prototype});var ConditionalElement=function(_BaseElement){function ConditionalElement(){return babelHelpers.classCallCheck(this,ConditionalElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(ConditionalElement).apply(this,arguments))}return babelHelpers.inherits(ConditionalElement,_BaseElement),babelHelpers.createClass(ConditionalElement,[{key:"createdCallback",value:function(){null!==platform._renderPlatform?this._platformUpdate():this._isAllowedPlatform()||(this.innerHTML=""),this._onOrientationChange()}},{key:"attachedCallback",value:function(){orientation.on("change",this._onOrientationChange.bind(this))}},{key:"attributeChangedCallback",value:function(name){"orientation"===name&&this._onOrientationChange()}},{key:"detachedCallback",value:function(){orientation.off("change",this._onOrientationChange)}},{key:"_platformUpdate",value:function(){this.style.display=this._isAllowedPlatform()?"":"none"}},{key:"_isAllowedPlatform",value:function(){return!this.getAttribute("platform")||this.getAttribute("platform").split(/\s+/).indexOf(platform.getMobileOS())>=0}},{key:"_onOrientationChange",value:function(){if(this.hasAttribute("orientation")&&this._isAllowedPlatform()){var conditionalOrientation=this.getAttribute("orientation").toLowerCase(),currentOrientation=orientation.isPortrait()?"portrait":"landscape";this.style.display=conditionalOrientation===currentOrientation?"":"none"}}}]),ConditionalElement}(BaseElement);window.OnsConditionalElement=document.registerElement("ons-if",{prototype:ConditionalElement.prototype});var AlertDialogAnimator=function(){function AlertDialogAnimator(){var _ref=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],_ref$timing=_ref.timing,timing=void 0===_ref$timing?"linear":_ref$timing,_ref$delay=_ref.delay,delay=void 0===_ref$delay?0:_ref$delay,_ref$duration=_ref.duration,duration=void 0===_ref$duration?.2:_ref$duration;babelHelpers.classCallCheck(this,AlertDialogAnimator),this.timing=timing,this.delay=delay,this.duration=duration}return babelHelpers.createClass(AlertDialogAnimator,[{key:"show",value:function(dialog,done){done()}},{key:"hide",value:function(dialog,done){done()}}]),AlertDialogAnimator}(),AndroidAlertDialogAnimator=function(_AlertDialogAnimator){function AndroidAlertDialogAnimator(){var _ref2=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],_ref2$timing=_ref2.timing,timing=void 0===_ref2$timing?"cubic-bezier(.1, .7, .4, 1)":_ref2$timing,_ref2$duration=_ref2.duration,duration=void 0===_ref2$duration?.2:_ref2$duration,_ref2$delay=_ref2.delay,delay=void 0===_ref2$delay?0:_ref2$delay;return babelHelpers.classCallCheck(this,AndroidAlertDialogAnimator),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(AndroidAlertDialogAnimator).call(this,{duration:duration,timing:timing,delay:delay}))}return babelHelpers.inherits(AndroidAlertDialogAnimator,_AlertDialogAnimator),babelHelpers.createClass(AndroidAlertDialogAnimator,[{key:"show",value:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask).queue({opacity:0}).wait(this.delay).queue({opacity:1},{duration:this.duration,timing:this.timing}),animit(dialog._dialog).saveStyle().queue({css:{transform:"translate3d(-50%, -50%, 0) scale3d(0.9, 0.9, 1.0)",opacity:0},duration:0}).wait(this.delay).queue({css:{transform:"translate3d(-50%, -50%, 0) scale3d(1.0, 1.0, 1.0)",opacity:1},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}))}},{key:"hide",value:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask).queue({opacity:1}).wait(this.delay).queue({opacity:0},{duration:this.duration,timing:this.timing}),animit(dialog._dialog).saveStyle().queue({css:{transform:"translate3d(-50%, -50%, 0) scale3d(1.0, 1.0, 1.0)",opacity:1},duration:0}).wait(this.delay).queue({css:{transform:"translate3d(-50%, -50%, 0) scale3d(0.9, 0.9, 1.0)",opacity:0},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}))}}]),AndroidAlertDialogAnimator}(AlertDialogAnimator),IOSAlertDialogAnimator=function(_AlertDialogAnimator2){function IOSAlertDialogAnimator(){var _ref3=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],_ref3$timing=_ref3.timing,timing=void 0===_ref3$timing?"cubic-bezier(.1, .7, .4, 1)":_ref3$timing,_ref3$duration=_ref3.duration,duration=void 0===_ref3$duration?.2:_ref3$duration,_ref3$delay=_ref3.delay,delay=void 0===_ref3$delay?0:_ref3$delay;return babelHelpers.classCallCheck(this,IOSAlertDialogAnimator),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(IOSAlertDialogAnimator).call(this,{duration:duration,timing:timing,delay:delay}))}return babelHelpers.inherits(IOSAlertDialogAnimator,_AlertDialogAnimator2),babelHelpers.createClass(IOSAlertDialogAnimator,[{key:"show",value:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask).queue({opacity:0}).wait(this.delay).queue({opacity:1},{duration:this.duration,timing:this.timing}),animit(dialog._dialog).saveStyle().queue({css:{transform:"translate3d(-50%, -50%, 0) scale3d(1.3, 1.3, 1.0)",opacity:0},duration:0}).wait(this.delay).queue({css:{transform:"translate3d(-50%, -50%, 0) scale3d(1.0, 1.0, 1.0)",opacity:1},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}))}},{key:"hide",value:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask).queue({opacity:1}).wait(this.delay).queue({opacity:0},{duration:this.duration,timing:this.timing}),animit(dialog._dialog).saveStyle().queue({css:{opacity:1},duration:0}).wait(this.delay).queue({css:{opacity:0},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}))}}]),IOSAlertDialogAnimator}(AlertDialogAnimator),scheme$1={".alert-dialog":"alert-dialog--*",".alert-dialog-container":"alert-dialog-container--*",".alert-dialog-title":"alert-dialog-title--*",".alert-dialog-content":"alert-dialog-content--*",".alert-dialog-footer":"alert-dialog-footer--*",".alert-dialog-button":"alert-dialog-button--*",".alert-dialog-footer--one":"alert-dialog-footer--one--*",".alert-dialog-button--one":"alert-dialog-button--one--*",".alert-dialog-button--primal":"alert-dialog-button--primal--*",".alert-dialog-mask":"alert-dialog-mask--*"},templateSource=util.createElement('\n <div>\n <div class="alert-dialog-mask"></div>\n <div class="alert-dialog">\n <div class="alert-dialog-container"></div>\n </div>\n </div>\n'),_animatorDict={none:AlertDialogAnimator,"default":function(){return platform.isAndroid()?AndroidAlertDialogAnimator:IOSAlertDialogAnimator},fade:function(){return platform.isAndroid()?AndroidAlertDialogAnimator:IOSAlertDialogAnimator}},AlertDialogElement=function(_BaseElement){function AlertDialogElement(){return babelHelpers.classCallCheck(this,AlertDialogElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(AlertDialogElement).apply(this,arguments))}return babelHelpers.inherits(AlertDialogElement,_BaseElement),babelHelpers.createClass(AlertDialogElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile(),this._visible=!1,this._doorLock=new DoorLock,this._boundCancel=this._cancel.bind(this),this._animatorFactory=new AnimatorFactory({animators:_animatorDict,baseClass:AlertDialogAnimator,baseClassName:"AlertDialogAnimator",defaultAnimation:this.getAttribute("animation")})}},{key:"_compile",value:function(){autoStyle.prepare(this);var style=this.getAttribute("style");this.style.display="none";var template=templateSource.cloneNode(!0),alertDialog=template.children[1];for(style&&alertDialog.setAttribute("style",style);this.firstChild;)alertDialog.children[0].appendChild(this.firstChild);for(;template.firstChild;)this.appendChild(template.firstChild);this._dialog.style.zIndex=20001,this._mask.style.zIndex=2e4,this.getAttribute("mask-color")&&(this._mask.style.backgroundColor=this.getAttribute("mask-color")),ModifierUtil.initModifier(this,scheme$1),this.setAttribute("_compiled","")}},{key:"setDisabled",value:function(disabled){if("boolean"!=typeof disabled)throw new Error("Argument must be a boolean.");disabled?this.setAttribute("disabled",""):this.removeAttribute("disabled")}},{key:"isDisabled",value:function(){return this.hasAttribute("disabled")}},{key:"setCancelable",value:function(cancelable){if("boolean"!=typeof cancelable)throw new Error("Argument must be a boolean.");cancelable?this.setAttribute("cancelable",""):this.removeAttribute("cancelable")}},{key:"show",value:function(){var _this2=this,options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],_cancel2=!1,callback=options.callback||function(){};if(options.animationOptions=util.extend(options.animationOptions||{},AnimatorFactory.parseAnimationOptionsString(this.getAttribute("animation-options"))),util.triggerElementEvent(this,"preshow",{alertDialog:this,cancel:function(){_cancel2=!0}}),_cancel2)return Promise.reject("Canceled in preshow event.");var _ret=function(){var tryShow=function(){var unlock=_this2._doorLock.lock(),animator=_this2._animatorFactory.newAnimator(options);return _this2.style.display="block",_this2._mask.style.opacity="1",new Promise(function(resolve){animator.show(_this2,function(){_this2._visible=!0,unlock(),util.triggerElementEvent(_this2,"postshow",{alertDialog:_this2}),callback(),resolve(_this2)})})};return{v:new Promise(function(resolve){_this2._doorLock.waitUnlock(function(){return resolve(tryShow())})})}}();return"object"===("undefined"==typeof _ret?"undefined":babelHelpers["typeof"](_ret))?_ret.v:void 0}},{key:"hide",value:function(){var _this3=this,options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],_cancel3=!1,callback=options.callback||function(){};if(options.animationOptions=util.extend(options.animationOptions||{},AnimatorFactory.parseAnimationOptionsString(this.getAttribute("animation-options"))),util.triggerElementEvent(this,"prehide",{alertDialog:this,cancel:function(){_cancel3=!0}}),_cancel3)return Promise.reject("Canceled in prehide event.");var _ret2=function(){var tryHide=function(){var unlock=_this3._doorLock.lock(),animator=_this3._animatorFactory.newAnimator(options);return new Promise(function(resolve){animator.hide(_this3,function(){_this3.style.display="none",_this3._visible=!1,unlock(),util.triggerElementEvent(_this3,"posthide",{alertDialog:_this3}),callback(),resolve(_this3)})})};return{v:new Promise(function(resolve){_this3._doorLock.waitUnlock(function(){return resolve(tryHide())})})}}();return"object"===("undefined"==typeof _ret2?"undefined":babelHelpers["typeof"](_ret2))?_ret2.v:void 0}},{key:"isShown",value:function(){return this._visible}},{key:"destroy",value:function(){this.parentElement&&this.parentElement.removeChild(this)}},{key:"isCancelable",value:function(){return this.hasAttribute("cancelable")}},{key:"_onDeviceBackButton",value:function(event){this.isCancelable()?this._cancel():event.callParentHandler()}},{key:"_cancel",value:function(){var _this4=this;this.isCancelable()&&this.hide({callback:function(){util.triggerElementEvent(_this4,"cancel")}})}},{key:"attachedCallback",value:function(){this._deviceBackButtonHandler=deviceBackButtonDispatcher.createHandler(this,this._onDeviceBackButton.bind(this)),this._mask.addEventListener("click",this._boundCancel,!1)}},{key:"detachedCallback",value:function(){this._deviceBackButtonHandler.destroy(),this._deviceBackButtonHandler=null,this._mask.removeEventListener("click",this._boundCancel.bind(this),!1)}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$1):void 0}},{key:"_mask",get:function(){return util.findChild(this,".alert-dialog-mask")}},{key:"_dialog",get:function(){return util.findChild(this,".alert-dialog")}},{key:"_titleElement",get:function(){return util.findChild(this._dialog.children[0],".alert-dialog-title")}},{key:"_contentElement",get:function(){return util.findChild(this._dialog.children[0],".alert-dialog-content")}}]),AlertDialogElement}(BaseElement),OnsAlertDialogElement=window.OnsAlertDialogElement=document.registerElement("ons-alert-dialog",{prototype:AlertDialogElement.prototype});OnsAlertDialogElement.registerAnimator=function(name,Animator){if(!(Animator.prototype instanceof AlertDialogAnimator))throw new Error('"Animator" param must inherit OnsAlertDialogElement.AlertDialogAnimator');_animatorDict[name]=Animator},OnsAlertDialogElement.AlertDialogAnimator=AlertDialogAnimator;var scheme$2={"":"back-button--*",".back-button__icon":"back-button--*__icon",".back-button__label":"back-button--*__label"},BackButtonElement=function(_BaseElement){function BackButtonElement(){return babelHelpers.classCallCheck(this,BackButtonElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(BackButtonElement).apply(this,arguments))}return babelHelpers.inherits(BackButtonElement,_BaseElement),babelHelpers.createClass(BackButtonElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile(),this._options={},this._boundOnClick=this._onClick.bind(this)}},{key:"_compile",value:function(){autoStyle.prepare(this),this.classList.add("back-button");var label=util.createElement('\n <span class="back-button__label">'+this.innerHTML+"</span>\n ");this.innerHTML="";var icon=util.createElement('\n <span class="back-button__icon"></span>\n ');this.appendChild(icon),this.appendChild(label),ModifierUtil.initModifier(this,scheme$2),this.setAttribute("_compiled","")}},{key:"_onClick",value:function(){var navigator=util.findParent(this,"ons-navigator");navigator&&(this.hasAttribute("animation")&&(this.options.animation=this.getAttribute("animation")),this.hasAttribute("animation-options")&&(this.options.animationOptions=util.animationOptionsParse(this.getAttribute("animation-options"))),this.hasAttribute("on-transition-end")&&(this.options.onTransitionEnd=window.eval("("+this.getAttribute("on-transition-end")+")")),this.hasAttribute("refresh")&&(this.options.refresh="true"===this.getAttribute("refresh")),navigator.popPage(this.options))}},{key:"attachedCallback",value:function(){this.addEventListener("click",this._boundOnClick,!1)}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$2):void 0}},{key:"detachedCallback",value:function(){this.removeEventListener("click",this._boundOnClick,!1)}},{key:"show",value:function(){this.style.display="inline-block"}},{key:"hide",value:function(){this.style.display="none"}},{key:"options",get:function(){return this._options},set:function(object){this._options=object}}]),BackButtonElement}(BaseElement);window.OnsBackButtonElement=document.registerElement("ons-back-button",{prototype:BackButtonElement.prototype});var scheme$3={"":"bottom-bar--*"},BottomToolbarElement=function(_BaseElement){function BottomToolbarElement(){return babelHelpers.classCallCheck(this,BottomToolbarElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(BottomToolbarElement).apply(this,arguments))}return babelHelpers.inherits(BottomToolbarElement,_BaseElement),babelHelpers.createClass(BottomToolbarElement,[{key:"createdCallback",value:function(){this.classList.add("bottom-bar"),ModifierUtil.initModifier(this,scheme$3)}},{key:"attachedCallback",value:function(){var page=util.findParent(this,"ons-page");this.parentNode!=page&&page._registerBottomToolbar(this)}},{key:"attributeChangedCallback",value:function(name,last,current){"modifier"===name&&ModifierUtil.onModifierChanged(last,current,this,scheme$3)}}]),BottomToolbarElement}(BaseElement);window.OnsBottomToolbarElement=document.registerElement("ons-bottom-toolbar",{prototype:BottomToolbarElement.prototype});var scheme$4={"":"button--*"},ButtonElement=function(_BaseElement){function ButtonElement(){return babelHelpers.classCallCheck(this,ButtonElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(ButtonElement).apply(this,arguments))}return babelHelpers.inherits(ButtonElement,_BaseElement),babelHelpers.createClass(ButtonElement,[{key:"createdCallback",
value:function(){this.hasAttribute("_compiled")||this._compile()}},{key:"attributeChangedCallback",value:function(name,last,current){switch(name){case"modifier":ModifierUtil.onModifierChanged(last,current,this,scheme$4);break;case"ripple":this._updateRipple()}}},{key:"_compile",value:function(){autoStyle.prepare(this),this.classList.add("button"),this._updateRipple(),ModifierUtil.initModifier(this,scheme$4),this.setAttribute("_compiled","")}},{key:"_updateRipple",value:function(){util.updateRipple(this)}}]),ButtonElement}(BaseElement);window.OnsButtonElement=document.registerElement("ons-button",{prototype:ButtonElement.prototype});var scheme$5={"":"carousel-item--*"},CarouselItemElement=function(_BaseElement){function CarouselItemElement(){return babelHelpers.classCallCheck(this,CarouselItemElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(CarouselItemElement).apply(this,arguments))}return babelHelpers.inherits(CarouselItemElement,_BaseElement),babelHelpers.createClass(CarouselItemElement,[{key:"createdCallback",value:function(){this.style.width="100%",ModifierUtil.initModifier(this,scheme$5)}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$5):void 0}}]),CarouselItemElement}(BaseElement);window.OnsCarouselItemElement=document.registerElement("ons-carousel-item",{prototype:CarouselItemElement.prototype});var VerticalModeTrait={_getScrollDelta:function(event){return event.gesture.deltaY},_getScrollVelocity:function(event){return event.gesture.velocityY},_getElementSize:function(){return this._currentElementSize||(this._currentElementSize=this.getBoundingClientRect().height),this._currentElementSize},_generateScrollTransform:function(scroll){return"translate3d(0px, "+-scroll+"px, 0px)"},_updateDimensionData:function(){this._style=window.getComputedStyle(this),this._dimensions=this.getBoundingClientRect()},_updateOffset:function(){if(this.isCentered()){var height=(this._dimensions.height||0)-parseInt(this._style.paddingTop,10)-parseInt(this._style.paddingBottom,10);this._offset=-(height-this._getCarouselItemSize())/2}},_layoutCarouselItems:function(){for(var children=this._getCarouselItemElements(),sizeAttr=this._getCarouselItemSizeAttr(),sizeInfo=this._decomposeSizeString(sizeAttr),width=(this._dimensions.width||0)-parseInt(this._style.paddingLeft,10)-parseInt(this._style.paddingRight,10),i=0;i<children.length;i++)children[i].style.position="absolute",children[i].style.height=sizeAttr,children[i].style.width=width+"px",children[i].style.visibility="visible",children[i].style.top=i*sizeInfo.number+sizeInfo.unit},_setup:function(){this._updateDimensionData(),this._updateOffset(),this._layoutCarouselItems()}},HorizontalModeTrait={_getScrollDelta:function(event){return event.gesture.deltaX},_getScrollVelocity:function(event){return event.gesture.velocityX},_getElementSize:function(){return this._currentElementSize||(this._currentElementSize=this.getBoundingClientRect().width),this._currentElementSize},_generateScrollTransform:function(scroll){return"translate3d("+-scroll+"px, 0px, 0px)"},_updateDimensionData:function(){this._style=window.getComputedStyle(this),this._dimensions=this.getBoundingClientRect()},_updateOffset:function(){if(this.isCentered()){var width=(this._dimensions.width||0)-parseInt(this._style.paddingLeft,10)-parseInt(this._style.paddingRight,10);this._offset=-(width-this._getCarouselItemSize())/2}},_layoutCarouselItems:function(){for(var children=this._getCarouselItemElements(),sizeAttr=this._getCarouselItemSizeAttr(),sizeInfo=this._decomposeSizeString(sizeAttr),height=(this._dimensions.height||0)-parseInt(this._style.paddingTop,10)-parseInt(this._style.paddingBottom,10),i=0;i<children.length;i++)children[i].style.position="absolute",children[i].style.height=height+"px",children[i].style.width=sizeAttr,children[i].style.visibility="visible",children[i].style.left=i*sizeInfo.number+sizeInfo.unit},_setup:function(){this._updateDimensionData(),this._updateOffset(),this._layoutCarouselItems()}},CarouselElement=function(_BaseElement){function CarouselElement(){return babelHelpers.classCallCheck(this,CarouselElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(CarouselElement).apply(this,arguments))}return babelHelpers.inherits(CarouselElement,_BaseElement),babelHelpers.createClass(CarouselElement,[{key:"createdCallback",value:function(){this._doorLock=new DoorLock,this._scroll=0,this._offset=0,this._lastActiveIndex=0,this._boundOnDrag=this._onDrag.bind(this),this._boundOnDragEnd=this._onDragEnd.bind(this),this._boundOnResize=this._onResize.bind(this),this._mixin(this._isVertical()?VerticalModeTrait:HorizontalModeTrait),this._setup(),this._setupInitialIndex(),this._saveLastState()}},{key:"_onResize",value:function(){this.refresh()}},{key:"_onDirectionChange",value:function(){this._isVertical()?(this.style.overflowX="auto",this.style.overflowY=""):(this.style.overflowX="",this.style.overflowY="auto"),this.refresh()}},{key:"_saveLastState",value:function(){this._lastState={elementSize:this._getCarouselItemSize(),carouselElementCount:this.getCarouselItemCount(),width:this._getCarouselItemSize()*this.getCarouselItemCount()}}},{key:"_getCarouselItemSize",value:function(){var sizeAttr=this._getCarouselItemSizeAttr(),sizeInfo=this._decomposeSizeString(sizeAttr),elementSize=this._getElementSize();if("%"===sizeInfo.unit)return Math.round(sizeInfo.number/100*elementSize);if("px"===sizeInfo.unit)return sizeInfo.number;throw new Error("Invalid state")}},{key:"_getInitialIndex",value:function(){var index=parseInt(this.getAttribute("initial-index"),10);return"number"!=typeof index||isNaN(index)?0:Math.max(Math.min(index,this.getCarouselItemCount()-1),0)}},{key:"_getCarouselItemSizeAttr",value:function(){var attrName="item-"+(this._isVertical()?"height":"width"),itemSizeAttr=(""+this.getAttribute(attrName)).trim();return itemSizeAttr.match(/^\d+(px|%)$/)?itemSizeAttr:"100%"}},{key:"_decomposeSizeString",value:function(size){var matches=size.match(/^(\d+)(px|%)/);return{number:parseInt(matches[1],10),unit:matches[2]}}},{key:"_setupInitialIndex",value:function(){this._scroll=(this._offset||0)+this._getCarouselItemSize()*this._getInitialIndex(),this._lastActiveIndex=this._getInitialIndex(),this._scrollTo(this._scroll)}},{key:"setSwipeable",value:function(swipeable){swipeable?this.setAttribute("swipeable",""):this.removeAttribute("swipeable")}},{key:"isSwipeable",value:function(){return this.hasAttribute("swipeable")}},{key:"setAutoScrollRatio",value:function(ratio){if(0>ratio||ratio>1)throw new Error("Invalid ratio.");this.setAttribute("auto-scroll-ratio",ratio)}},{key:"getAutoScrollRatio",value:function(){var attr=this.getAttribute("auto-scroll-ratio");if(!attr)return.5;var scrollRatio=parseFloat(attr);if(0>scrollRatio||scrollRatio>1)throw new Error("Invalid ratio.");return isNaN(scrollRatio)?.5:scrollRatio}},{key:"setActiveCarouselItemIndex",value:function(index){var _this2=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(options&&"object"!=("undefined"==typeof options?"undefined":babelHelpers["typeof"](options)))throw new Error("options must be an object. You supplied "+options);options.animationOptions=util.extend({duration:.3,timing:"cubic-bezier(.1, .7, .1, 1)"},options.animationOptions||{},this.hasAttribute("animation-options")?util.animationOptionsParse(this.getAttribute("animation-options")):{}),index=Math.max(0,Math.min(index,this.getCarouselItemCount()-1));var scroll=(this._offset||0)+this._getCarouselItemSize()*index,max=this._calculateMaxScroll();return this._scroll=Math.max(0,Math.min(max,scroll)),this._scrollTo(this._scroll,options).then(function(){return _this2._tryFirePostChangeEvent(),_this2})}},{key:"getActiveCarouselItemIndex",value:function(){var scroll=this._scroll-(this._offset||0),count=this.getCarouselItemCount(),size=this._getCarouselItemSize();if(0>scroll)return 0;var i=void 0;for(i=0;count>i;i++)if(scroll>=size*i&&size*(i+1)>scroll)return i;return i}},{key:"next",value:function(options){return this.setActiveCarouselItemIndex(this.getActiveCarouselItemIndex()+1,options)}},{key:"prev",value:function(options){return this.setActiveCarouselItemIndex(this.getActiveCarouselItemIndex()-1,options)}},{key:"setAutoScrollEnabled",value:function(enabled){enabled?this.setAttribute("auto-scroll",""):this.removeAttribute("auto-scroll")}},{key:"isAutoScrollEnabled",value:function(){return this.hasAttribute("auto-scroll")}},{key:"setDisabled",value:function(disabled){disabled?this.setAttribute("disabled",""):this.removeAttribute("disabled")}},{key:"isDisabled",value:function(){return this.hasAttribute("disabled")}},{key:"setOverscrollable",value:function(scrollable){scrollable?this.setAttribute("overscrollable",""):this.removeAttribute("overscrollable")}},{key:"isOverscrollable",value:function(){return this.hasAttribute("overscrollable")}},{key:"setCentered",value:function(centered){centered?this.setAttribute("centered",""):this.removeAttribute("centered")}},{key:"isCentered",value:function(){return this.hasAttribute("centered")}},{key:"_isEnabledChangeEvent",value:function(){var elementSize=this._getElementSize(),carouselItemSize=this._getCarouselItemSize();return this.isAutoScrollEnabled()&&elementSize===carouselItemSize}},{key:"_isVertical",value:function(){return"vertical"===this.getAttribute("direction")}},{key:"_prepareEventListeners",value:function(){this._gestureDetector=new GestureDetector(this,{dragMinDistance:1}),this._updateSwipeable(),window.addEventListener("resize",this._boundOnResize,!0)}},{key:"_removeEventListeners",value:function(){this._gestureDetector.dispose(),this._gestureDetector=null,window.removeEventListener("resize",this._boundOnResize,!0)}},{key:"_updateSwipeable",value:function(){this._gestureDetector&&(this.isSwipeable()?(this._gestureDetector.on("drag dragleft dragright dragup dragdown swipe swipeleft swiperight swipeup swipedown",this._boundOnDrag),this._gestureDetector.on("dragend",this._boundOnDragEnd)):(this._gestureDetector.off("drag dragleft dragright dragup dragdown swipe swipeleft swiperight swipeup swipedown",this._boundOnDrag),this._gestureDetector.off("dragend",this._boundOnDragEnd)))}},{key:"_tryFirePostChangeEvent",value:function(){var currentIndex=this.getActiveCarouselItemIndex();if(this._lastActiveIndex!==currentIndex){var lastActiveIndex=this._lastActiveIndex;this._lastActiveIndex=currentIndex,util.triggerElementEvent(this,"postchange",{carousel:this,activeIndex:currentIndex,lastActiveIndex:lastActiveIndex})}}},{key:"_onDrag",value:function(event){var direction=event.gesture.direction;if((!this._isVertical()||"left"!==direction&&"right"!==direction)&&(this._isVertical()||"up"!==direction&&"down"!==direction)){event.stopPropagation(),this._lastDragEvent=event;var scroll=this._scroll-this._getScrollDelta(event);this._scrollTo(scroll),event.gesture.preventDefault(),this._tryFirePostChangeEvent()}}},{key:"_onDragEnd",value:function(event){var _this3=this;if(this._currentElementSize=void 0,this._scroll=this._scroll-this._getScrollDelta(event),0!==this._getScrollDelta(event)&&event.stopPropagation(),this._isOverScroll(this._scroll)){var waitForAction=!1;util.triggerElementEvent(this,"overscroll",{carousel:this,activeIndex:this.getActiveCarouselItemIndex(),direction:this._getOverScrollDirection(),waitToReturn:function(promise){waitForAction=!0,promise.then(function(){return _this3._scrollToKillOverScroll()})}}),waitForAction||this._scrollToKillOverScroll()}else this._startMomentumScroll();this._lastDragEvent=null,event.gesture.preventDefault()}},{key:"_mixin",value:function(trait){Object.keys(trait).forEach(function(key){this[key]=trait[key]}.bind(this))}},{key:"_startMomentumScroll",value:function(){if(this._lastDragEvent){var velocity=this._getScrollVelocity(this._lastDragEvent),duration=.3,scrollDelta=100*duration*velocity,scroll=this._normalizeScrollPosition(this._scroll+(this._getScrollDelta(this._lastDragEvent)>0?-scrollDelta:scrollDelta));this._scroll=scroll,animit(this._getCarouselItemElements()).queue({transform:this._generateScrollTransform(this._scroll)},{duration:duration,timing:"cubic-bezier(.1, .7, .1, 1)"}).queue(function(done){done(),this._tryFirePostChangeEvent()}.bind(this)).play()}}},{key:"_normalizeScrollPosition",value:function(scroll){var max=this._calculateMaxScroll();if(!this.isAutoScrollEnabled())return Math.max(0,Math.min(max,scroll));for(var arr=[],size=this._getCarouselItemSize(),nbrOfItems=this.getCarouselItemCount(),i=0;nbrOfItems>i;i++)i*size+this._offset<max&&arr.push(i*size+this._offset);arr.push(max),arr.sort(function(left,right){return left=Math.abs(left-scroll),right=Math.abs(right-scroll),left-right}),arr=arr.filter(function(item,pos){return!pos||item!=arr[pos-1]});var lastScroll=this._lastActiveIndex*size+this._offset,scrollRatio=Math.abs(scroll-lastScroll)/size,result=arr[0];return scrollRatio<=this.getAutoScrollRatio()?result=lastScroll:1>scrollRatio&&arr[0]===lastScroll&&arr.length>1&&(result=arr[1]),Math.max(0,Math.min(max,result))}},{key:"_getCarouselItemElements",value:function(){return util.arrayFrom(this.children).filter(function(child){return"ons-carousel-item"===child.nodeName.toLowerCase()})}},{key:"_scrollTo",value:function(scroll){var _this4=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],isOverscrollable=this.isOverscrollable(),normalizeScroll=function(scroll){var ratio=.35;if(0>scroll)return isOverscrollable?Math.round(scroll*ratio):0;var maxScroll=_this4._calculateMaxScroll();return scroll>maxScroll?isOverscrollable?maxScroll+Math.round((scroll-maxScroll)*ratio):maxScroll:scroll};return new Promise(function(resolve){animit(_this4._getCarouselItemElements()).queue({transform:_this4._generateScrollTransform(normalizeScroll(scroll))},"none"!==options.animation?options.animationOptions:{}).play(function(){options.callback instanceof Function&&options.callback(),resolve()})})}},{key:"_calculateMaxScroll",value:function(){var max=this.getCarouselItemCount()*this._getCarouselItemSize()-this._getElementSize();return Math.ceil(0>max?0:max)}},{key:"_isOverScroll",value:function(scroll){return 0>scroll||scroll>this._calculateMaxScroll()?!0:!1}},{key:"_getOverScrollDirection",value:function(){return this._isVertical()?this._scroll<=0?"up":"down":this._scroll<=0?"left":"right"}},{key:"_scrollToKillOverScroll",value:function(){var duration=.4;if(this._scroll<0)return animit(this._getCarouselItemElements()).queue({transform:this._generateScrollTransform(0)},{duration:duration,timing:"cubic-bezier(.1, .4, .1, 1)"}).queue(function(done){done(),this._tryFirePostChangeEvent()}.bind(this)).play(),void(this._scroll=0);var maxScroll=this._calculateMaxScroll();return maxScroll<this._scroll?(animit(this._getCarouselItemElements()).queue({transform:this._generateScrollTransform(maxScroll)},{duration:duration,timing:"cubic-bezier(.1, .4, .1, 1)"}).queue(function(done){done(),this._tryFirePostChangeEvent()}.bind(this)).play(),void(this._scroll=maxScroll)):void 0}},{key:"getCarouselItemCount",value:function(){return this._getCarouselItemElements().length}},{key:"refresh",value:function(){if(0!==this._getCarouselItemSize()){if(this._mixin(this._isVertical()?VerticalModeTrait:HorizontalModeTrait),this._setup(),this._lastState&&this._lastState.width>0){var scroll=this._scroll;this._isOverScroll(scroll)?this._scrollToKillOverScroll():(this.isAutoScrollEnabled()&&(scroll=this._normalizeScrollPosition(scroll)),this._scrollTo(scroll))}this._saveLastState(),util.triggerElementEvent(this,"refresh",{carousel:this})}}},{key:"first",value:function(options){return this.setActiveCarouselItemIndex(0,options)}},{key:"last",value:function(options){this.setActiveCarouselItemIndex(Math.max(this.getCarouselItemCount()-1,0),options)}},{key:"attachedCallback",value:function(){this._prepareEventListeners(),this._setup(),this._setupInitialIndex(),this._saveLastState()}},{key:"attributeChangedCallback",value:function(name,last,current){switch(name){case"swipeable":this._updateSwipeable();break;case"direction":this._onDirectionChange()}}},{key:"detachedCallback",value:function(){this._removeEventListeners()}}]),CarouselElement}(BaseElement);window.OnsCarouselElement=document.registerElement("ons-carousel",{prototype:CarouselElement.prototype});var ColumnElement=function(_BaseElement){function ColumnElement(){return babelHelpers.classCallCheck(this,ColumnElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(ColumnElement).apply(this,arguments))}return babelHelpers.inherits(ColumnElement,_BaseElement),babelHelpers.createClass(ColumnElement,[{key:"createdCallback",value:function(){this.getAttribute("width")&&this._updateWidth()}},{key:"attributeChangedCallback",value:function(name,last,current){"width"===name&&this._updateWidth()}},{key:"_updateWidth",value:function(){var width=this.getAttribute("width");"string"==typeof width&&(width=(""+width).trim(),width=width.match(/^\d+$/)?width+"%":width,this.style.webkitBoxFlex="0",this.style.webkitFlex="0 0 "+width,this.style.mozBoxFlex="0",this.style.mozFlex="0 0 "+width,this.style.msFlex="0 0 "+width,this.style.flex="0 0 "+width,this.style.maxWidth=width)}}]),ColumnElement}(BaseElement);window.OnsColElement=document.registerElement("ons-col",{prototype:ColumnElement.prototype});var DialogAnimator=function(){function DialogAnimator(){var _ref=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],_ref$timing=_ref.timing,timing=void 0===_ref$timing?"linear":_ref$timing,_ref$delay=_ref.delay,delay=void 0===_ref$delay?0:_ref$delay,_ref$duration=_ref.duration,duration=void 0===_ref$duration?.2:_ref$duration;babelHelpers.classCallCheck(this,DialogAnimator),this.timing=timing,this.delay=delay,this.duration=duration}return babelHelpers.createClass(DialogAnimator,[{key:"show",value:function(dialog,done){done()}},{key:"hide",value:function(dialog,done){done()}}]),DialogAnimator}(),AndroidDialogAnimator=function(_DialogAnimator){function AndroidDialogAnimator(){var _ref2=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],_ref2$timing=_ref2.timing,timing=void 0===_ref2$timing?"ease-in-out":_ref2$timing,_ref2$delay=_ref2.delay,delay=void 0===_ref2$delay?0:_ref2$delay,_ref2$duration=_ref2.duration,duration=void 0===_ref2$duration?.3:_ref2$duration;return babelHelpers.classCallCheck(this,AndroidDialogAnimator),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(AndroidDialogAnimator).call(this,{timing:timing,delay:delay,duration:duration}))}return babelHelpers.inherits(AndroidDialogAnimator,_DialogAnimator),babelHelpers.createClass(AndroidDialogAnimator,[{key:"show",value:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask).queue({opacity:0}).wait(this.delay).queue({opacity:1},{duration:this.duration,timing:this.timing}),animit(dialog._dialog).saveStyle().queue({css:{transform:"translate3d(-50%, -60%, 0)",opacity:0},duration:0}).wait(this.delay).queue({css:{transform:"translate3d(-50%, -50%, 0)",opacity:1},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}))}},{key:"hide",value:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask).queue({opacity:1}).wait(this.delay).queue({opacity:0},{duration:this.duration,timing:this.timing}),animit(dialog._dialog).saveStyle().queue({css:{transform:"translate3d(-50%, -50%, 0)",opacity:1},duration:0}).wait(this.delay).queue({css:{transform:"translate3d(-50%, -60%, 0)",opacity:0},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}))}}]),AndroidDialogAnimator}(DialogAnimator),IOSDialogAnimator=function(_DialogAnimator2){function IOSDialogAnimator(){var _ref3=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],_ref3$timing=_ref3.timing,timing=void 0===_ref3$timing?"ease-in-out":_ref3$timing,_ref3$delay=_ref3.delay,delay=void 0===_ref3$delay?0:_ref3$delay,_ref3$duration=_ref3.duration,duration=void 0===_ref3$duration?.3:_ref3$duration;return babelHelpers.classCallCheck(this,IOSDialogAnimator),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(IOSDialogAnimator).call(this,{timing:timing,delay:delay,duration:duration}))}return babelHelpers.inherits(IOSDialogAnimator,_DialogAnimator2),babelHelpers.createClass(IOSDialogAnimator,[{key:"show",value:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask).queue({opacity:0}).wait(this.delay).queue({opacity:1},{duration:this.duration,timing:this.timing}),animit(dialog._dialog).saveStyle().queue({css:{transform:"translate3d(-50%, 300%, 0)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3d(-50%, -50%, 0)"},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}))}},{key:"hide",value:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask).queue({opacity:1}).wait(this.delay).queue({opacity:0},{duration:this.duration,timing:this.timing}),animit(dialog._dialog).saveStyle().queue({css:{transform:"translate3d(-50%, -50%, 0)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3d(-50%, 300%, 0)"},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}))}}]),IOSDialogAnimator}(DialogAnimator),SlideDialogAnimator=function(_DialogAnimator3){function SlideDialogAnimator(){var _ref4=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],_ref4$timing=_ref4.timing,timing=void 0===_ref4$timing?"cubic-bezier(.1, .7, .4, 1)":_ref4$timing,_ref4$delay=_ref4.delay,delay=void 0===_ref4$delay?0:_ref4$delay,_ref4$duration=_ref4.duration,duration=void 0===_ref4$duration?.2:_ref4$duration;return babelHelpers.classCallCheck(this,SlideDialogAnimator),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(SlideDialogAnimator).call(this,{timing:timing,delay:delay,duration:duration}))}return babelHelpers.inherits(SlideDialogAnimator,_DialogAnimator3),babelHelpers.createClass(SlideDialogAnimator,[{key:"show",value:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask).queue({opacity:0}).wait(this.delay).queue({opacity:1},{duration:this.duration,timing:this.timing}),animit(dialog._dialog).saveStyle().queue({css:{transform:"translate3D(-50%, -350%, 0)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(-50%, -50%, 0)"},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}))}},{key:"hide",value:function(dialog,callback){callback=callback?callback:function(){},animit.runAll(animit(dialog._mask).queue({opacity:1}).wait(this.delay).queue({opacity:0},{duration:this.duration,timing:this.timing}),animit(dialog._dialog).saveStyle().queue({css:{transform:"translate3D(-50%, -50%, 0)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(-50%, -350%, 0)"},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}))}}]),SlideDialogAnimator}(DialogAnimator),scheme$6={".dialog":"dialog--*",".dialog-container":"dialog-container--*",".dialog-mask":"dialog-mask--*"},templateSource$1=util.createElement('\n <div>\n <div class="dialog-mask"></div>\n <div class="dialog">\n <div class="dialog-container"></div>\n </div>\n </div>\n'),_animatorDict$1={"default":function(){return platform.isAndroid()?AndroidDialogAnimator:IOSDialogAnimator},fade:function(){return platform.isAndroid()?AndroidDialogAnimator:IOSDialogAnimator},slide:SlideDialogAnimator,none:DialogAnimator},DialogElement=function(_BaseElement){function DialogElement(){return babelHelpers.classCallCheck(this,DialogElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(DialogElement).apply(this,arguments))}return babelHelpers.inherits(DialogElement,_BaseElement),babelHelpers.createClass(DialogElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile(),this._visible=!1,this._doorLock=new DoorLock,this._boundCancel=this._cancel.bind(this),this._animatorFactory=new AnimatorFactory({animators:_animatorDict$1,baseClass:DialogAnimator,baseClassName:"DialogAnimator",defaultAnimation:this.getAttribute("animation")})}},{key:"_compile",value:function(){autoStyle.prepare(this);var style=this.getAttribute("style");this.style.display="none";var template=templateSource$1.cloneNode(!0),dialog=template.children[1];for(style&&dialog.setAttribute("style",style);this.firstChild;)dialog.children[0].appendChild(this.firstChild);for(;template.firstChild;)this.appendChild(template.firstChild);this._dialog.style.zIndex=20001,this._mask.style.zIndex=2e4,this.setAttribute("no-status-bar-fill",""),ModifierUtil.initModifier(this,scheme$6),this.setAttribute("_compiled","")}},{key:"getDeviceBackButtonHandler",value:function(){return this._deviceBackButtonHandler}},{key:"_onDeviceBackButton",value:function(event){this.isCancelable()?this._cancel():event.callParentHandler()}},{key:"_cancel",value:function(){var _this2=this;this.isCancelable()&&this.hide({callback:function(){util.triggerElementEvent(_this2,"cancel")}})}},{key:"show",value:function(){var _this3=this,options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],_cancel2=!1,callback=options.callback||function(){};if(options.animationOptions=util.extend(options.animationOptions||{},AnimatorFactory.parseAnimationOptionsString(this.getAttribute("animation-options"))),util.triggerElementEvent(this,"preshow",{dialog:this,cancel:function(){_cancel2=!0}}),_cancel2)return Promise.reject("Canceled in preshow event.");var _ret=function(){var tryShow=function(){var unlock=_this3._doorLock.lock(),animator=_this3._animatorFactory.newAnimator(options);return _this3.style.display="block",_this3._mask.style.opacity="1",new Promise(function(resolve){animator.show(_this3,function(){_this3._visible=!0,unlock(),util.triggerElementEvent(_this3,"postshow",{dialog:_this3}),callback(),resolve(_this3)})})};return{v:new Promise(function(resolve){_this3._doorLock.waitUnlock(function(){return resolve(tryShow())})})}}();return"object"===("undefined"==typeof _ret?"undefined":babelHelpers["typeof"](_ret))?_ret.v:void 0}},{key:"hide",value:function(){var _this4=this,options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],_cancel3=!1,callback=options.callback||function(){};if(options.animationOptions=util.extend(options.animationOptions||{},AnimatorFactory.parseAnimationOptionsString(this.getAttribute("animation-options"))),util.triggerElementEvent(this,"prehide",{dialog:this,cancel:function(){_cancel3=!0}}),_cancel3)return Promise.reject("Canceled in prehide event.");var _ret2=function(){var tryHide=function(){var unlock=_this4._doorLock.lock(),animator=_this4._animatorFactory.newAnimator(options);return new Promise(function(resolve){animator.hide(_this4,function(){_this4.style.display="none",_this4._visible=!1,unlock(),util.triggerElementEvent(_this4,"posthide",{dialog:_this4}),callback(),resolve(_this4)})})};return{v:new Promise(function(resolve){_this4._doorLock.waitUnlock(function(){return resolve(tryHide())})})}}();return"object"===("undefined"==typeof _ret2?"undefined":babelHelpers["typeof"](_ret2))?_ret2.v:void 0}},{key:"destroy",value:function(){this.parentElement&&this.parentElement.removeChild(this)}},{key:"isShown",value:function(){return this._visible}},{key:"isCancelable",value:function(){return this.hasAttribute("cancelable")}},{key:"setDisabled",value:function(disabled){if("boolean"!=typeof disabled)throw new Error("Argument must be a boolean.");disabled?this.setAttribute("disabled",""):this.removeAttribute("disabled")}},{key:"isDisabled",value:function(){return this.hasAttribute("disabled")}},{key:"setCancelable",value:function(cancelable){if("boolean"!=typeof cancelable)throw new Error("Argument must be a boolean.");cancelable?this.setAttribute("cancelable",""):this.removeAttribute("cancelable")}},{key:"attachedCallback",value:function(){this._deviceBackButtonHandler=deviceBackButtonDispatcher.createHandler(this,this._onDeviceBackButton.bind(this)),this._mask.addEventListener("click",this._boundCancel,!1)}},{key:"detachedCallback",value:function(){this._deviceBackButtonHandler.destroy(),this._deviceBackButtonHandler=null,this._mask.removeEventListener("click",this._boundCancel.bind(this),!1)}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$6):void 0}},{key:"_mask",get:function(){return util.findChild(this,".dialog-mask")}},{key:"_dialog",get:function(){return util.findChild(this,".dialog")}}]),DialogElement}(BaseElement),OnsDialogElement=window.OnsDialogElement=document.registerElement("ons-dialog",{prototype:DialogElement.prototype});OnsDialogElement.registerAnimator=function(name,Animator){if(!(Animator.prototype instanceof DialogAnimator))throw new Error('"Animator" param must inherit OnsDialogElement.DialogAnimator');_animatorDict$1[name]=Animator},OnsDialogElement.DialogAnimator=DialogAnimator;var scheme$7={"":"fab--*"},FabElement=function(_BaseElement){function FabElement(){return babelHelpers.classCallCheck(this,FabElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(FabElement).apply(this,arguments))}return babelHelpers.inherits(FabElement,_BaseElement),babelHelpers.createClass(FabElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile()}},{key:"_compile",value:function(){autoStyle.prepare(this),this.classList.add("fab");var content=document.createElement("span");content.classList.add("fab__icon"),util.arrayFrom(this.childNodes).forEach(function(element){element.tagName&&"ons-ripple"===element.tagName.toLowerCase()||content.appendChild(element)}),this.appendChild(content),this._updateRipple(),ModifierUtil.initModifier(this,scheme$7),this._updatePosition(),this.hide(),this.setAttribute("_compiled","")}},{key:"attributeChangedCallback",value:function(name,last,current){switch(name){case"modifier":ModifierUtil.onModifierChanged(last,current,this,scheme$7);break;case"ripple":this._updateRipple();break;case"position":this._updatePosition()}}},{key:"_show",value:function(){this.isInline()||this.show()}},{key:"_hide",value:function(){this.isInline()||this.hide()}},{key:"_updateRipple",value:function(){util.updateRipple(this)}},{key:"_updatePosition",value:function(){var position=this.getAttribute("position");switch(this.classList.remove("fab--top__left","fab--bottom__right","fab--bottom__left","fab--top__right","fab--top__center","fab--bottom__center"),position){case"top right":case"right top":this.classList.add("fab--top__right");break;case"top left":case"left top":this.classList.add("fab--top__left");break;case"bottom right":case"right bottom":this.classList.add("fab--bottom__right");break;case"bottom left":case"left bottom":this.classList.add("fab--bottom__left");break;case"center top":case"top center":this.classList.add("fab--top__center");break;case"center bottom":case"bottom center":this.classList.add("fab--bottom__center")}}},{key:"show",value:function(){arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.style.transform="scale(1)",this.style.webkitTransform="scale(1)"}},{key:"hide",value:function(){arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.style.transform="scale(0)",this.style.webkitTransform="scale(0)"}},{key:"setDisabled",value:function(disabled){if("boolean"!=typeof disabled)throw new Error("Argument must be a boolean.");disabled?this.setAttribute("disabled",""):this.removeAttribute("disabled")}},{key:"isDisabled",value:function(){return this.hasAttribute("disabled")}},{key:"isInline",value:function(){return this.hasAttribute("inline")}},{key:"isShown",value:function(){return"scale(1)"===this.style.transform&&"none"!==this.style.display;
}},{key:"toggle",value:function(){this.isShown()?this.hide():this.show()}}]),FabElement}(BaseElement);window.OnsFabElement=document.registerElement("ons-fab",{prototype:FabElement.prototype});var GestureDetectorElement=function(_BaseElement){function GestureDetectorElement(){return babelHelpers.classCallCheck(this,GestureDetectorElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(GestureDetectorElement).apply(this,arguments))}return babelHelpers.inherits(GestureDetectorElement,_BaseElement),babelHelpers.createClass(GestureDetectorElement,[{key:"createdCallback",value:function(){this._gestureDetector=new GestureDetector(this)}}]),GestureDetectorElement}(BaseElement);window.OnsGestureDetectorElement=document.registerElement("ons-gesture-detector",{prototype:GestureDetectorElement.prototype});var IconElement=function(_BaseElement){function IconElement(){return babelHelpers.classCallCheck(this,IconElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(IconElement).apply(this,arguments))}return babelHelpers.inherits(IconElement,_BaseElement),babelHelpers.createClass(IconElement,[{key:"createdCallback",value:function(){this._update()}},{key:"attributeChangedCallback",value:function(name,last,current){-1!==["icon","size"].indexOf(name)&&this._update()}},{key:"_update",value:function(){var _this2=this;this._cleanClassAttribute();var builded=this._buildClassAndStyle(this);for(var key in builded.style)builded.style.hasOwnProperty(key)&&(this.style[key]=builded.style[key]);builded.classList.forEach(function(className){return _this2.classList.add(className)})}},{key:"_cleanClassAttribute",value:function(){var _this3=this;util.arrayFrom(this.classList).filter(function(className){return/^(fa$|fa-|ion-|zmdi-)/.test(className)}).forEach(function(className){return _this3.classList.remove(className)}),this.classList.remove("zmdi"),this.classList.remove("ons-icon--ion")}},{key:"_buildClassAndStyle",value:function(){var classList=["ons-icon"],style={},iconName=this._iconName;0===iconName.indexOf("ion-")?(classList.push(iconName),classList.push("ons-icon--ion")):0===iconName.indexOf("fa-")?(classList.push(iconName),classList.push("fa")):0===iconName.indexOf("md-")?(classList.push("zmdi"),classList.push("zmdi-"+iconName.split(/\-(.+)?/)[1])):(classList.push("fa"),classList.push("fa-"+iconName));var size=""+this.getAttribute("size");return size.match(/^[1-5]x|lg$/)?(classList.push("fa-"+size),this.style.removeProperty("font-size")):style.fontSize=size,{classList:classList,style:style}}},{key:"_iconName",get:function(){return""+this.getAttribute("icon")}}]),IconElement}(BaseElement);window.OnsIconElement=document.registerElement("ons-icon",{prototype:IconElement.prototype});var LazyRepeatElement=function(_BaseElement){function LazyRepeatElement(){return babelHelpers.classCallCheck(this,LazyRepeatElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(LazyRepeatElement).apply(this,arguments))}return babelHelpers.inherits(LazyRepeatElement,_BaseElement),babelHelpers.createClass(LazyRepeatElement,[{key:"createdCallback",value:function(){this.style.display="none"}},{key:"attachedCallback",value:function(){util.updateParentPosition(this),this.hasAttribute("delegate")&&this.setDelegate(window[this.getAttribute("delegate")])}},{key:"setDelegate",value:function(userDelegate){this._lazyRepeatProvider&&this._lazyRepeatProvider.destroy(),!this._templateElement&&this.children[0]&&(this._templateElement=this.removeChild(this.children[0]));var delegate=new LazyRepeatDelegate(userDelegate,this._templateElement||null);this._lazyRepeatProvider=new LazyRepeatProvider(this.parentElement,delegate)}},{key:"refresh",value:function(){this._lazyRepeatProvider&&this._lazyRepeatProvider.refresh()}},{key:"attributeChangedCallback",value:function(name,last,current){}},{key:"detachedCallback",value:function(){this._lazyRepeatProvider&&(this._lazyRepeatProvider.destroy(),this._lazyRepeatProvider=null)}},{key:"delegate",set:function(userDelegate){this.setDelegate(userDelegate)}}]),LazyRepeatElement}(BaseElement);window.OnsLazyRepeatElement=document.registerElement("ons-lazy-repeat",{prototype:LazyRepeatElement.prototype});var scheme$8={"":"list__header--*"},ListHeaderElement=function(_BaseElement){function ListHeaderElement(){return babelHelpers.classCallCheck(this,ListHeaderElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(ListHeaderElement).apply(this,arguments))}return babelHelpers.inherits(ListHeaderElement,_BaseElement),babelHelpers.createClass(ListHeaderElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile()}},{key:"_compile",value:function(){autoStyle.prepare(this),this.classList.add("list__header"),ModifierUtil.initModifier(this,scheme$8),this.setAttribute("_compiled","")}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$8):void 0}}]),ListHeaderElement}(BaseElement);window.OnsListHeaderElement=document.registerElement("ons-list-header",{prototype:ListHeaderElement.prototype});var scheme$9={".list__item":"list__item--*",".list__item__left":"list__item--*__left",".list__item__center":"list__item--*__center",".list__item__right":"list__item--*__right",".list__item__label":"list__item--*__label",".list__item__title":"list__item--*__title",".list__item__subtitle":"list__item--*__subtitle",".list__item__thumbnail":"list__item--*__thumbnail",".list__item__icon":"list__item--*__icon"},ListItemElement=function(_BaseElement){function ListItemElement(){return babelHelpers.classCallCheck(this,ListItemElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(ListItemElement).apply(this,arguments))}return babelHelpers.inherits(ListItemElement,_BaseElement),babelHelpers.createClass(ListItemElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile()}},{key:"_compile",value:function(){autoStyle.prepare(this),this.classList.add("list__item");for(var left=void 0,center=void 0,right=void 0,i=0;i<this.children.length;i++){var el=this.children[i];el.classList.contains("left")?(el.classList.add("list__item__left"),left=el):el.classList.contains("center")?center=el:el.classList.contains("right")&&(el.classList.add("list__item__right"),right=el)}if(!center){if(center=document.createElement("div"),left||right)for(var i=this.childNodes.length-1;i>=0;i--){var el=this.childNodes[i];el!==left&&el!==right&¢er.insertBefore(el,center.firstChild)}else center.innerHTML=this.innerHTML,this.innerHTML="";this.insertBefore(center,right||null)}center.classList.add("center"),center.classList.add("list__item__center"),this._updateRipple(),ModifierUtil.initModifier(this,scheme$9),this.setAttribute("_compiled","")}},{key:"attributeChangedCallback",value:function(name,last,current){switch(name){case"modifier":ModifierUtil.onModifierChanged(last,current,this,scheme$9);break;case"ripple":this._updateRipple()}}},{key:"attachedCallback",value:function(){this.addEventListener("drag",this._onDrag),this.addEventListener("touchstart",this._onTouch),this.addEventListener("mousedown",this._onTouch),this.addEventListener("touchend",this._onRelease),this.addEventListener("touchmove",this._onRelease),this.addEventListener("touchcancel",this._onRelease),this.addEventListener("mouseup",this._onRelease),this.addEventListener("mouseout",this._onRelease),this.addEventListener("touchleave",this._onRelease),this._originalBackgroundColor=this.style.backgroundColor,this.tapped=!1}},{key:"detachedCallback",value:function(){this.removeEventListener("drag",this._onDrag),this.removeEventListener("touchstart",this._onTouch),this.removeEventListener("mousedown",this._onTouch),this.removeEventListener("touchend",this._onRelease),this.removeEventListener("touchmove",this._onRelease),this.removeEventListener("touchcancel",this._onRelease),this.removeEventListener("mouseup",this._onRelease),this.removeEventListener("mouseout",this._onRelease),this.removeEventListener("touchleave",this._onRelease)}},{key:"_updateRipple",value:function(){util.updateRipple(this)}},{key:"_onDrag",value:function(event){var gesture=event.gesture;this._shouldLockOnDrag()&&["left","right"].indexOf(gesture.direction)>-1&&gesture.preventDefault()}},{key:"_onTouch",value:function(){this.tapped||(this.tapped=!0,this.style.transition=this._transition,this.style.webkitTransition=this._transition,this.style.MozTransition=this._transition,this._tappable&&(this.style.backgroundColor&&(this._originalBackgroundColor=this.style.backgroundColor),this.style.backgroundColor=this._tapColor))}},{key:"_onRelease",value:function(){this.tapped=!1,this.style.transition="",this.style.webkitTransition="",this.style.MozTransition="",this.style.backgroundColor=this._originalBackgroundColor||""}},{key:"_shouldLockOnDrag",value:function(){return this.hasAttribute("lock-on-drag")}},{key:"_transition",get:function(){return"background-color 0.0s linear 0.02s"}},{key:"_tappable",get:function(){return this.hasAttribute("tappable")}},{key:"_tapColor",get:function(){return this.getAttribute("tappable")||"#d9d9d9"}}]),ListItemElement}(BaseElement);window.OnsListItemElement=document.registerElement("ons-list-item",{prototype:ListItemElement.prototype});var scheme$10={"":"list--*"},ListElement=function(_BaseElement){function ListElement(){return babelHelpers.classCallCheck(this,ListElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(ListElement).apply(this,arguments))}return babelHelpers.inherits(ListElement,_BaseElement),babelHelpers.createClass(ListElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile()}},{key:"_compile",value:function(){autoStyle.prepare(this),this.classList.add("list"),ModifierUtil.initModifier(this,scheme$10),this.setAttribute("_compiled","")}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$10):void 0}}]),ListElement}(BaseElement);window.OnsListElement=document.registerElement("ons-list",{prototype:ListElement.prototype});var scheme$11={".text-input":"text-input--*",".text-input__label":"text-input--*__label",".radio-button":"radio-button--*",".radio-button__input":"radio-button--*__input",".radio-button__checkmark":"radio-button--*__checkmark",".checkbox":"checkbox--*",".checkbox__input":"checkbox--*__input",".checkbox__checkmark":"checkbox--*__checkmark"},INPUT_ATTRIBUTES=["autocapitalize","autocomplete","autocorrect","autofocus","checked","disabled","inputmode","max","maxlength","min","minlength","name","pattern","placeholder","readonly","size","step","type","validator","value"],MaterialInputElement=function(_BaseElement){function MaterialInputElement(){return babelHelpers.classCallCheck(this,MaterialInputElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(MaterialInputElement).apply(this,arguments))}return babelHelpers.inherits(MaterialInputElement,_BaseElement),babelHelpers.createClass(MaterialInputElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile()}},{key:"_compile",value:function(){autoStyle.prepare(this);var helper=document.createElement("span");helper.classList.add("_helper");var container=document.createElement("label");container.appendChild(document.createElement("input")),container.appendChild(helper);var label=document.createElement("span");switch(label.classList.add("input-label"),util.arrayFrom(this.childNodes).forEach(function(element){return label.appendChild(element)}),this.hasAttribute("content-left")?container.insertBefore(label,container.firstChild):container.appendChild(label),this.appendChild(container),this.getAttribute("type")){case"checkbox":this.classList.add("checkbox"),this._input.classList.add("checkbox__input"),this._helper.classList.add("checkbox__checkmark"),this._updateBoundAttributes();break;case"radio":this.classList.add("radio-button"),this._input.classList.add("radio-button__input"),this._helper.classList.add("radio-button__checkmark"),this._updateBoundAttributes();break;default:this._input.classList.add("text-input"),this._helper.classList.add("text-input__label"),this._input.parentElement.classList.add("text-input__container"),this._updateLabel(),this._updateLabelColor(),this._updateBoundAttributes(),this._updateLabelClass(),this._boundOnInput=this._onInput.bind(this),this._boundOnFocusin=this._onFocusin.bind(this),this._boundOnFocusout=this._onFocusout.bind(this)}this._boundDelegateEvent=this._delegateEvent.bind(this),this.hasAttribute("input-id")&&(this._input.id=this.getAttribute("input-id")),ModifierUtil.initModifier(this,scheme$11),this.setAttribute("_compiled","")}},{key:"attributeChangedCallback",value:function(name,last,current){if("modifier"===name)return ModifierUtil.onModifierChanged(last,current,this,scheme$11);if("placeholder"===name)return this._updateLabel();if("input-id"===name)this._input.id=current;else if(INPUT_ATTRIBUTES.indexOf(name)>=0)return this._updateBoundAttributes()}},{key:"attachedCallback",value:function(){"checkbox"!==this._input.type&&"radio"!==this._input.type&&(this._input.addEventListener("input",this._boundOnInput),this._input.addEventListener("focusin",this._boundOnFocusin),this._input.addEventListener("focusout",this._boundOnFocusout)),this._input.addEventListener("focus",this._boundDelegateEvent),this._input.addEventListener("blur",this._boundDelegateEvent)}},{key:"detachedCallback",value:function(){this._input.removeEventListener("input",this._boundOnInput),this._input.removeEventListener("focusin",this._boundOnFocusin),this._input.removeEventListener("focusout",this._boundOnFocusout),this._input.removeEventListener("focus",this._boundDelegateEvent),this._input.removeEventListener("blur",this._boundDelegateEvent)}},{key:"_setLabel",value:function(value){"undefined"!=typeof this._helper.textContent?this._helper.textContent=value:this._helper.innerText=value}},{key:"_updateLabel",value:function(){this._setLabel(this.hasAttribute("placeholder")?this.getAttribute("placeholder"):"")}},{key:"_updateBoundAttributes",value:function(){var _this2=this;INPUT_ATTRIBUTES.forEach(function(attr){_this2.hasAttribute(attr)?_this2._input.setAttribute(attr,_this2.getAttribute(attr)):_this2._input.removeAttribute(attr)})}},{key:"_updateLabelColor",value:function(){this._helper.style.color=this.value.length>0&&this._input===document.activeElement?"":"rgba(0, 0, 0, 0.5)"}},{key:"_updateLabelClass",value:function(){""===this.value?this._helper.classList.remove("text-input__label--active"):this._helper.classList.add("text-input__label--active")}},{key:"_delegateEvent",value:function(event){var e=new CustomEvent(event.type,{bubbles:!1,cancelable:!0});return this.dispatchEvent(e)}},{key:"_onInput",value:function(event){this._updateLabelClass(),this._updateLabelColor()}},{key:"_onFocusin",value:function(event){this._updateLabelClass(),this._updateLabelColor()}},{key:"_onFocusout",value:function(event){this._updateLabelColor()}},{key:"_input",get:function(){return this.querySelector("input")}},{key:"_helper",get:function(){return this.querySelector("._helper")}},{key:"value",get:function(){return this._input.value},set:function(val){return this._input.value=val,this._onInput(),this._input.val}},{key:"checked",get:function(){return this._input.checked},set:function(val){this._input.checked=val}},{key:"_isTextInput",get:function(){return this._input.classList.contains("text-input")}}]),MaterialInputElement}(BaseElement);window.OnsInputElement=document.registerElement("ons-input",{prototype:MaterialInputElement.prototype});var ModalAnimator=function(){function ModalAnimator(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];babelHelpers.classCallCheck(this,ModalAnimator),this.delay=0,this.duration=.2,this.timing=options.timing||this.timing,this.duration=void 0!==options.duration?options.duration:this.duration,this.delay=void 0!==options.delay?options.delay:this.delay}return babelHelpers.createClass(ModalAnimator,[{key:"show",value:function(modal,callback){callback()}},{key:"hide",value:function(modal,callback){callback()}}]),ModalAnimator}(),FadeModalAnimator=function(_ModalAnimator){function FadeModalAnimator(options){return babelHelpers.classCallCheck(this,FadeModalAnimator),options.timing=options.timing||"linear",options.duration=options.duration||"0.3",options.delay=options.delay||0,babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(FadeModalAnimator).call(this,options))}return babelHelpers.inherits(FadeModalAnimator,_ModalAnimator),babelHelpers.createClass(FadeModalAnimator,[{key:"show",value:function(modal,callback){callback=callback?callback:function(){},animit(modal).queue({opacity:0}).wait(this.delay).queue({opacity:1},{duration:this.duration,timing:this.timing}).queue(function(done){callback(),done()}).play()}},{key:"hide",value:function(modal,callback){callback=callback?callback:function(){},animit(modal).queue({opacity:1}).wait(this.delay).queue({opacity:0},{duration:this.duration,timing:this.timing}).queue(function(done){callback(),done()}).play()}}]),FadeModalAnimator}(ModalAnimator),scheme$12={"":"modal--*",modal__content:"modal--*__content"},_animatorDict$2={"default":ModalAnimator,fade:FadeModalAnimator,none:ModalAnimator},ModalElement=function(_BaseElement){function ModalElement(){return babelHelpers.classCallCheck(this,ModalElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(ModalElement).apply(this,arguments))}return babelHelpers.inherits(ModalElement,_BaseElement),babelHelpers.createClass(ModalElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile(),this._doorLock=new DoorLock,this._animatorFactory=new AnimatorFactory({animators:_animatorDict$2,baseClass:ModalAnimator,baseClassName:"ModalAnimator",defaultAnimation:this.getAttribute("animation")})}},{key:"getDeviceBackButtonHandler",value:function(){return this._deviceBackButtonHandler}},{key:"setDeviceBackButtonHandler",value:function(callback){this._deviceBackButtonHandler&&this._deviceBackButtonHandler.destroy(),this._deviceBackButtonHandler=deviceBackButtonDispatcher.createHandler(this,callback),this._onDeviceBackButton=callback}},{key:"_onDeviceBackButton",value:function(){}},{key:"_compile",value:function(){this.style.display="none",this.classList.add("modal");var wrapper=document.createElement("div");for(wrapper.classList.add("modal__content");this.childNodes[0];){var node=this.childNodes[0];this.removeChild(node),wrapper.insertBefore(node,null)}this.appendChild(wrapper),ModifierUtil.initModifier(this,scheme$12),this.setAttribute("_compiled","")}},{key:"detachedCallback",value:function(){this._deviceBackButtonHandler&&this._deviceBackButtonHandler.destroy()}},{key:"attachedCallback",value:function(){setImmediate(this._ensureNodePosition.bind(this)),this._deviceBackButtonHandler=deviceBackButtonDispatcher.createHandler(this,this._onDeviceBackButton.bind(this))}},{key:"_ensureNodePosition",value:function(){if(this.parentNode&&!this.hasAttribute("inline")&&"ons-page"!==this.parentNode.nodeName.toLowerCase()){for(var page=this;;){if(page=page.parentNode,!page)return;if("ons-page"===page.nodeName.toLowerCase())break}page._registerExtraElement(this)}}},{key:"isShown",value:function(){return"none"!==this.style.display}},{key:"show",value:function(){var _this2=this,options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];options.animationOptions=util.extend(options.animationOptions||{},AnimatorFactory.parseAnimationOptionsString(this.getAttribute("animation-options")));var callback=options.callback||function(){},tryShow=function(){var unlock=_this2._doorLock.lock(),animator=_this2._animatorFactory.newAnimator(options);return _this2.style.display="table",new Promise(function(resolve){animator.show(_this2,function(){unlock(),callback(),resolve(_this2)})})};return new Promise(function(resolve){_this2._doorLock.waitUnlock(function(){return resolve(tryShow())})})}},{key:"toggle",value:function(){return this.isShown()?this.hide.apply(this,arguments):this.show.apply(this,arguments)}},{key:"hide",value:function(){var _this3=this,options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];options.animationOptions=util.extend(options.animationOptions||{},AnimatorFactory.parseAnimationOptionsString(this.getAttribute("animation-options")));var callback=options.callback||function(){},tryHide=function(){var unlock=_this3._doorLock.lock(),animator=_this3._animatorFactory.newAnimator(options);return new Promise(function(resolve){animator.hide(_this3,function(){_this3.style.display="none",unlock(),callback(),resolve(_this3)})})};return new Promise(function(resolve){_this3._doorLock.waitUnlock(function(){return resolve(tryHide())})})}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$12):void 0}}]),ModalElement}(BaseElement);window.OnsModalElement=document.registerElement("ons-modal",{prototype:ModalElement.prototype}),window.OnsModalElement.registerAnimator=function(name,Animator){if(!(Animator.prototype instanceof ModalAnimator))throw new Error('"Animator" param must inherit OnsModalElement.ModalAnimator');_animatorDict$2[name]=Animator},window.OnsModalElement.ModalAnimator=ModalAnimator;var NavigatorTransitionAnimator=function(){function NavigatorTransitionAnimator(options){babelHelpers.classCallCheck(this,NavigatorTransitionAnimator),options=util.extend({timing:"linear",duration:"0.4",delay:"0"},options||{}),this.timing=options.timing,this.duration=options.duration,this.delay=options.delay}return babelHelpers.createClass(NavigatorTransitionAnimator,[{key:"push",value:function(enterPage,leavePage,callback){callback()}},{key:"pop",value:function(enterPage,leavePage,callback){callback()}}]),NavigatorTransitionAnimator}(),IOSSlideNavigatorTransitionAnimator=function(_NavigatorTransitionA){function IOSSlideNavigatorTransitionAnimator(options){babelHelpers.classCallCheck(this,IOSSlideNavigatorTransitionAnimator),options=util.extend({duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)",delay:0},options||{});var _this=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(IOSSlideNavigatorTransitionAnimator).call(this,options));return _this.backgroundMask=util.createElement('\n <div style="position: absolute; width: 100%; height: 100%;\n background-color: black; opacity: 0; z-index: 2"></div>\n '),_this}return babelHelpers.inherits(IOSSlideNavigatorTransitionAnimator,_NavigatorTransitionA),babelHelpers.createClass(IOSSlideNavigatorTransitionAnimator,[{key:"_decompose",value:function(page){CustomElements.upgrade(page.element);var toolbar=page.element._getToolbarElement();CustomElements.upgrade(toolbar);var left=toolbar._getToolbarLeftItemsElement(),right=toolbar._getToolbarRightItemsElement(),excludeBackButtonLabel=function(elements){for(var result=[],i=0;i<elements.length;i++)if("ons-back-button"===elements[i].nodeName.toLowerCase()){var iconElement=elements[i].querySelector(".back-button__icon");iconElement&&result.push(iconElement)}else result.push(elements[i]);return result},other=[].concat(0===left.children.length?left:excludeBackButtonLabel(left.children)).concat(0===right.children.length?right:excludeBackButtonLabel(right.children)),pageLabels=[toolbar._getToolbarCenterItemsElement(),toolbar._getToolbarBackButtonLabelElement()];return{pageLabels:pageLabels,other:other,content:page.element._getContentElement(),background:page.element._getBackgroundElement(),toolbar:toolbar,bottomToolbar:page.element._getBottomToolbarElement()}}},{key:"_shouldAnimateToolbar",value:function(enterPage,leavePage){var bothPageHasToolbar=enterPage.element._canAnimateToolbar()&&leavePage.element._canAnimateToolbar(),noMaterialToolbar=!enterPage.element._getToolbarElement().classList.contains("navigation-bar--material")&&!leavePage.element._getToolbarElement().classList.contains("navigation-bar--material");return bothPageHasToolbar&&noMaterialToolbar}},{key:"push",value:function(enterPage,leavePage,callback){var _this2=this;this.backgroundMask.remove(),leavePage.element.parentNode.insertBefore(this.backgroundMask,leavePage.element.nextSibling);var enterPageDecomposition=this._decompose(enterPage),leavePageDecomposition=this._decompose(leavePage),delta=function(){var rect=leavePage.element.getBoundingClientRect();return Math.round((rect.right-rect.left)/2*.6)}(),maskClear=animit(this.backgroundMask).saveStyle().queue({opacity:0,transform:"translate3d(0, 0, 0)"}).wait(this.delay).queue({opacity:.1},{duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){_this2.backgroundMask.remove(),done()}),shouldAnimateToolbar=this._shouldAnimateToolbar(enterPage,leavePage);shouldAnimateToolbar?animit.runAll(maskClear,animit([enterPageDecomposition.content,enterPageDecomposition.bottomToolbar,enterPageDecomposition.background]).saveStyle().queue({css:{transform:"translate3D(100%, 0px, 0px)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0px, 0px, 0px)"},duration:this.duration,timing:this.timing}).restoreStyle(),animit(enterPageDecomposition.pageLabels).saveStyle().queue({css:{transform:"translate3d("+delta+"px, 0, 0)",opacity:0},duration:0}).wait(this.delay).queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:this.duration,timing:this.timing}).restoreStyle(),animit(enterPageDecomposition.other).saveStyle().queue({css:{opacity:0},duration:0}).wait(this.delay).queue({css:{opacity:1},duration:this.duration,timing:this.timing}).restoreStyle(),animit([leavePageDecomposition.content,leavePageDecomposition.bottomToolbar,leavePageDecomposition.background]).saveStyle().queue({css:{transform:"translate3D(0, 0, 0)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(-25%, 0px, 0px)"},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}),animit(leavePageDecomposition.pageLabels).saveStyle().queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:0}).wait(this.delay).queue({css:{transform:"translate3d(-"+delta+"px, 0, 0)",opacity:0},duration:this.duration,timing:this.timing}).restoreStyle(),animit(leavePageDecomposition.other).saveStyle().queue({css:{opacity:1},duration:0}).wait(this.delay).queue({css:{opacity:0},duration:this.duration,timing:this.timing}).restoreStyle()):animit.runAll(maskClear,animit(enterPage.element).saveStyle().queue({css:{transform:"translate3D(100%, 0px, 0px)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0px, 0px, 0px)"},duration:this.duration,timing:this.timing}).restoreStyle(),animit(leavePage.element).saveStyle().queue({css:{transform:"translate3D(0, 0, 0)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(-25%, 0px, 0px)"},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}))}},{key:"pop",value:function(enterPage,leavePage,done){this.backgroundMask.remove(),enterPage.element.parentNode.insertBefore(this.backgroundMask,enterPage.element.nextSibling);var enterPageDecomposition=this._decompose(enterPage),leavePageDecomposition=this._decompose(leavePage),delta=function(){var rect=leavePage.element.getBoundingClientRect();return Math.round((rect.right-rect.left)/2*.6)}(),maskClear=animit(this.backgroundMask).saveStyle().queue({opacity:.1,transform:"translate3d(0, 0, 0)"}).wait(this.delay).queue({opacity:0},{duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){done()}),shouldAnimateToolbar=this._shouldAnimateToolbar(enterPage,leavePage);shouldAnimateToolbar?animit.runAll(maskClear,animit([enterPageDecomposition.content,enterPageDecomposition.bottomToolbar,enterPageDecomposition.background]).saveStyle().queue({css:{transform:"translate3D(-25%, 0px, 0px)",opacity:.9},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0px, 0px, 0px)",opacity:1},duration:this.duration,timing:this.timing}).restoreStyle(),animit(enterPageDecomposition.pageLabels).saveStyle().queue({css:{transform:"translate3d(-"+delta+"px, 0, 0)",opacity:0},duration:0}).wait(this.delay).queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:this.duration,timing:this.timing}).restoreStyle(),animit(enterPageDecomposition.toolbar).saveStyle().queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:0}).wait(this.delay).queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:this.duration,timing:this.timing}).restoreStyle(),animit(enterPageDecomposition.other).saveStyle().queue({css:{opacity:0},duration:0}).wait(this.delay).queue({css:{opacity:1},duration:this.duration,timing:this.timing}).restoreStyle(),animit([leavePageDecomposition.content,leavePageDecomposition.bottomToolbar,leavePageDecomposition.background]).queue({css:{transform:"translate3D(0px, 0px, 0px)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(100%, 0px, 0px)"},duration:this.duration,timing:this.timing}).wait(0).queue(function(finish){this.backgroundMask.remove(),done(),finish()}.bind(this)),animit(leavePageDecomposition.other).queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:0}).wait(this.delay).queue({css:{transform:"translate3d(0, 0, 0)",opacity:0},duration:this.duration,timing:this.timing}),animit(leavePageDecomposition.toolbar).queue({css:{background:"none",backgroundColor:"rgba(0, 0, 0, 0)",borderColor:"rgba(0, 0, 0, 0)"},duration:0}),animit(leavePageDecomposition.pageLabels).queue({css:{transform:"translate3d(0, 0, 0)",opacity:1},duration:0}).wait(this.delay).queue({css:{transform:"translate3d("+delta+"px, 0, 0)",opacity:0},duration:this.duration,timing:this.timing})):animit.runAll(maskClear,animit(enterPage.element).saveStyle().queue({css:{transform:"translate3D(-25%, 0px, 0px)",opacity:.9},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0px, 0px, 0px)",opacity:1},duration:this.duration,timing:this.timing}).restoreStyle(),animit(leavePage.element).queue({css:{transform:"translate3D(0px, 0px, 0px)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(100%, 0px, 0px)"},duration:this.duration,timing:this.timing}).queue(function(finish){this.backgroundMask.remove(),done(),finish()}.bind(this)))}}]),IOSSlideNavigatorTransitionAnimator}(NavigatorTransitionAnimator),IOSLiftNavigatorTransitionAnimator=function(_NavigatorTransitionA){function IOSLiftNavigatorTransitionAnimator(options){babelHelpers.classCallCheck(this,IOSLiftNavigatorTransitionAnimator),options=util.extend({duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)",delay:0},options||{});var _this=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(IOSLiftNavigatorTransitionAnimator).call(this,options));return _this.backgroundMask=util.createElement('\n <div style="position: absolute; width: 100%; height: 100%;\n background: linear-gradient(black, white);"></div>\n '),_this}return babelHelpers.inherits(IOSLiftNavigatorTransitionAnimator,_NavigatorTransitionA),babelHelpers.createClass(IOSLiftNavigatorTransitionAnimator,[{key:"push",value:function(enterPage,leavePage,callback){var _this2=this;this.backgroundMask.remove(),leavePage.element.parentNode.insertBefore(this.backgroundMask,leavePage.element);var maskClear=animit(this.backgroundMask).wait(.6).queue(function(done){_this2.backgroundMask.remove(),done()});animit.runAll(maskClear,animit(enterPage.element).saveStyle().queue({css:{transform:"translate3D(0, 100%, 0)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, 0, 0)"},duration:this.duration,timing:this.timing}).wait(.2).restoreStyle().queue(function(done){callback(),done()}),animit(leavePage.element).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, -10%, 0)",opacity:.9},duration:this.duration,timing:this.timing
}))}},{key:"pop",value:function(enterPage,leavePage,callback){var _this3=this;this.backgroundMask.remove(),enterPage.element.parentNode.insertBefore(this.backgroundMask,enterPage.element),animit.runAll(animit(this.backgroundMask).wait(.4).queue(function(done){_this3.backgroundMask.remove(),done()}),animit(enterPage.element).queue({css:{transform:"translate3D(0, -10%, 0)",opacity:.9},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:this.duration,timing:this.timing}).wait(.4).queue(function(done){callback(),done()}),animit(leavePage.element).queue({css:{transform:"translate3D(0, 0, 0)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, 100%, 0)"},duration:this.duration,timing:this.timing}))}}]),IOSLiftNavigatorTransitionAnimator}(NavigatorTransitionAnimator),IOSFadeNavigatorTransitionAnimator=function(_NavigatorTransitionA){function IOSFadeNavigatorTransitionAnimator(options){return babelHelpers.classCallCheck(this,IOSFadeNavigatorTransitionAnimator),options=util.extend({timing:"linear",duration:"0.4",delay:"0"},options||{}),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(IOSFadeNavigatorTransitionAnimator).call(this,options))}return babelHelpers.inherits(IOSFadeNavigatorTransitionAnimator,_NavigatorTransitionA),babelHelpers.createClass(IOSFadeNavigatorTransitionAnimator,[{key:"push",value:function(enterPage,leavePage,callback){animit.runAll(animit([enterPage.element._getContentElement(),enterPage.element._getBackgroundElement()]).saveStyle().queue({css:{transform:"translate3D(0, 0, 0)",opacity:0},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}),animit(enterPage.element._getToolbarElement()).saveStyle().queue({css:{transform:"translate3D(0, 0, 0)",opacity:0},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:this.duration,timing:this.timing}).restoreStyle())}},{key:"pop",value:function(enterPage,leavePage,callback){animit.runAll(animit([leavePage.element._getContentElement(),leavePage.element._getBackgroundElement()]).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, 0, 0)",opacity:0},duration:this.duration,timing:this.timing}).queue(function(done){callback(),done()}),animit(leavePage.element._getToolbarElement()).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, 0, 0)",opacity:0},duration:this.duration,timing:this.timing}))}}]),IOSFadeNavigatorTransitionAnimator}(NavigatorTransitionAnimator),MDSlideNavigatorTransitionAnimator=function(_NavigatorTransitionA){function MDSlideNavigatorTransitionAnimator(options){babelHelpers.classCallCheck(this,MDSlideNavigatorTransitionAnimator),options=util.extend({duration:.3,timing:"cubic-bezier(.1, .7, .4, 1)",delay:0},options||{});var _this=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(MDSlideNavigatorTransitionAnimator).call(this,options));return _this.backgroundMask=util.createElement('\n <div style="position: absolute; width: 100%; height: 100%; z-index: 2;\n background-color: black; opacity: 0;"></div>\n '),_this.blackMaskOpacity=.4,_this}return babelHelpers.inherits(MDSlideNavigatorTransitionAnimator,_NavigatorTransitionA),babelHelpers.createClass(MDSlideNavigatorTransitionAnimator,[{key:"push",value:function(enterPage,leavePage,callback){var _this2=this;this.backgroundMask.remove(),leavePage.element.parentElement.insertBefore(this.backgroundMask,leavePage.element.nextSibling),animit.runAll(animit(this.backgroundMask).saveStyle().queue({opacity:0,transform:"translate3d(0, 0, 0)"}).wait(this.delay).queue({opacity:this.blackMaskOpacity},{duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){_this2.backgroundMask.remove(),done()}),animit(enterPage.element).saveStyle().queue({css:{transform:"translate3D(100%, 0, 0)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, 0, 0)"},duration:this.duration,timing:this.timing}).restoreStyle(),animit(leavePage.element).saveStyle().queue({css:{transform:"translate3D(0, 0, 0)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(-45%, 0px, 0px)"},duration:this.duration,timing:this.timing}).restoreStyle().wait(.2).queue(function(done){callback(),done()}))}},{key:"pop",value:function(enterPage,leavePage,done){var _this3=this;this.backgroundMask.remove(),enterPage.element.parentNode.insertBefore(this.backgroundMask,enterPage.element.nextSibling),animit.runAll(animit(this.backgroundMask).saveStyle().queue({opacity:this.blackMaskOpacity,transform:"translate3d(0, 0, 0)"}).wait(this.delay).queue({opacity:0},{duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){_this3.backgroundMask.remove(),done()}),animit(enterPage.element).saveStyle().queue({css:{transform:"translate3D(-45%, 0px, 0px)",opacity:.9},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0px, 0px, 0px)",opacity:1},duration:this.duration,timing:this.timing}).restoreStyle(),animit(leavePage.element).queue({css:{transform:"translate3D(0px, 0px, 0px)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(100%, 0px, 0px)"},duration:this.duration,timing:this.timing}).wait(.2).queue(function(finish){done(),finish()}))}}]),MDSlideNavigatorTransitionAnimator}(NavigatorTransitionAnimator),MDLiftNavigatorTransitionAnimator=function(_NavigatorTransitionA){function MDLiftNavigatorTransitionAnimator(options){babelHelpers.classCallCheck(this,MDLiftNavigatorTransitionAnimator),options=util.extend({duration:.4,timing:"cubic-bezier(.1, .7, .1, 1)",delay:.05},options||{});var _this=babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(MDLiftNavigatorTransitionAnimator).call(this,options));return _this.backgroundMask=util.createElement('\n <div style="position: absolute; width: 100%; height: 100%;\n background-color: black;"></div>\n '),_this}return babelHelpers.inherits(MDLiftNavigatorTransitionAnimator,_NavigatorTransitionA),babelHelpers.createClass(MDLiftNavigatorTransitionAnimator,[{key:"push",value:function(enterPage,leavePage,callback){var _this2=this;this.backgroundMask.remove(),leavePage.element.parentNode.insertBefore(this.backgroundMask,leavePage.element);var maskClear=animit(this.backgroundMask).wait(.6).queue(function(done){_this2.backgroundMask.remove(),done()});animit.runAll(maskClear,animit(enterPage.element).saveStyle().queue({css:{transform:"translate3D(0, 100%, 0)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, 0, 0)"},duration:this.duration,timing:this.timing}).wait(.5).restoreStyle().queue(function(done){callback(),done()}),animit(leavePage.element).queue({css:{opacity:1},duration:0}).wait(0).queue({css:{opacity:.4},duration:this.duration,timing:this.timing}))}},{key:"pop",value:function(enterPage,leavePage,callback){var _this3=this;this.backgroundMask.remove(),enterPage.element.parentNode.insertBefore(this.backgroundMask,enterPage.element),animit.runAll(animit(this.backgroundMask).wait(.4).queue(function(done){_this3.backgroundMask.remove(),done()}),animit(enterPage.element).queue({css:{transform:"translate3D(0, 0, 0)",opacity:.4},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:this.duration,timing:this.timing}).wait(.4).queue(function(done){callback(),done()}),animit(leavePage.element).queue({css:{transform:"translate3D(0, 0, 0)"},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, 100%, 0)"},duration:this.duration,timing:this.timing}))}}]),MDLiftNavigatorTransitionAnimator}(NavigatorTransitionAnimator),MDFadeNavigatorTransitionAnimator=function(_NavigatorTransitionA){function MDFadeNavigatorTransitionAnimator(options){return babelHelpers.classCallCheck(this,MDFadeNavigatorTransitionAnimator),options=util.extend({timing:"ease-out",duration:"0.25",delay:"0.20"},options||{}),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(MDFadeNavigatorTransitionAnimator).call(this,options))}return babelHelpers.inherits(MDFadeNavigatorTransitionAnimator,_NavigatorTransitionA),babelHelpers.createClass(MDFadeNavigatorTransitionAnimator,[{key:"push",value:function(enterPage,leavePage,callback){animit.runAll(animit(enterPage.element).saveStyle().queue({css:{transform:"translate3D(0, 42px, 0)",opacity:0},duration:0}).wait(this.delay).queue({css:{transform:"translate3D(0, 0, 0)",opacity:1},duration:this.duration,timing:this.timing}).restoreStyle().queue(function(done){callback(),done()}))}},{key:"pop",value:function(enterPage,leavePage,callback){animit.runAll(animit(leavePage.element).queue({css:{transform:"translate3D(0, 0, 0)"},duration:0}).wait(.15).queue({css:{transform:"translate3D(0, 38px, 0)"},duration:this.duration,timing:this.timing}).queue(function(done){callback(),done()}),animit(leavePage.element).queue({css:{opacity:1},duration:0}).wait(.04).queue({css:{opacity:0},duration:this.duration,timing:this.timing}))}}]),MDFadeNavigatorTransitionAnimator}(NavigatorTransitionAnimator),NoneNavigatorTransitionAnimator=function(_NavigatorTransitionA){function NoneNavigatorTransitionAnimator(options){return babelHelpers.classCallCheck(this,NoneNavigatorTransitionAnimator),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(NoneNavigatorTransitionAnimator).call(this,options))}return babelHelpers.inherits(NoneNavigatorTransitionAnimator,_NavigatorTransitionA),babelHelpers.createClass(NoneNavigatorTransitionAnimator,[{key:"push",value:function(enterPage,leavePage,callback){callback()}},{key:"pop",value:function(enterPage,leavePage,callback){callback()}}]),NoneNavigatorTransitionAnimator}(NavigatorTransitionAnimator),NavigatorPage=function(){function NavigatorPage(params){var _this=this;babelHelpers.classCallCheck(this,NavigatorPage),this.page=params.page,this.name=params.page,this.element=params.element,this.options=params.options,this.navigator=params.navigator,this.initialContent=params.initialContent,this.backButton=util.findChildRecursively(this.element,"ons-back-button"),this.backButton&&CustomElements.upgrade(this.backButton),this._blockEvents=function(event){(_this.navigator._isPopping||_this.navigator._isPushing)&&(event.preventDefault(),event.stopPropagation())},this._pointerEvents.forEach(function(event){return _this.element.addEventListener(event,_this._blockEvents)},!1)}return babelHelpers.createClass(NavigatorPage,[{key:"getDeviceBackButtonHandler",value:function(){return this._deviceBackButtonHandler}},{key:"getPageView",value:function(){if(!this._page&&(this._page=util.findParent("ons-page"),!this._page))throw new Error("Fail to fetch ons-page element.");return this._page}},{key:"updateBackButton",value:function(){this.backButton&&(1===this.navigator._pages.length||this.options._forceHideBackButton?(this.backButton.hide(),this.options._forceHideBackButton=!1):this.backButton.show())}},{key:"destroy",value:function(){var _this2=this;this._pointerEvents.forEach(function(event){return _this2.element.removeEventListener(event,_this2._blockEvents)},!1),this.element._destroy();var index=this.navigator._pages.indexOf(this);-1!==index&&this.navigator._pages.splice(index,1),this.element=this._page=this.options=this.navigator=null}},{key:"_pointerEvents",get:function(){return["touchmove"]}}]),NavigatorPage}(),_animatorDict$3={"default":function(){return platform.isAndroid()?MDFadeNavigatorTransitionAnimator:IOSSlideNavigatorTransitionAnimator},slide:function(){return platform.isAndroid()?MDSlideNavigatorTransitionAnimator:IOSSlideNavigatorTransitionAnimator},lift:function(){return platform.isAndroid()?MDLiftNavigatorTransitionAnimator:IOSLiftNavigatorTransitionAnimator},fade:function(){return platform.isAndroid()?MDFadeNavigatorTransitionAnimator:IOSFadeNavigatorTransitionAnimator},"slide-ios":IOSSlideNavigatorTransitionAnimator,"slide-md":MDSlideNavigatorTransitionAnimator,"lift-ios":IOSLiftNavigatorTransitionAnimator,"lift-md":MDLiftNavigatorTransitionAnimator,"fade-ios":IOSFadeNavigatorTransitionAnimator,"fade-md":MDFadeNavigatorTransitionAnimator,none:NoneNavigatorTransitionAnimator},rewritables={ready:function(navigatorElement,callback){callback()},link:function(navigatorElement,target,options,callback){callback(target)}},NavigatorElement=function(_BaseElement){function NavigatorElement(){return babelHelpers.classCallCheck(this,NavigatorElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(NavigatorElement).apply(this,arguments))}return babelHelpers.inherits(NavigatorElement,_BaseElement),babelHelpers.createClass(NavigatorElement,[{key:"createdCallback",value:function(){this._doorLock=new DoorLock,this._pages=[],this._boundOnDeviceBackButton=this._onDeviceBackButton.bind(this),this._isRunning=this._isRunning=!1,this.options={cancelIfRunning:!0},this._initialHTML=this.innerHTML,this.innerHTML="",this._animatorFactory=new AnimatorFactory({animators:_animatorDict$3,baseClass:NavigatorTransitionAnimator,baseClassName:"NavigatorTransitionAnimator",defaultAnimation:this.getAttribute("animation")})}},{key:"canPopPage",value:function(){return this._pages.length>1}},{key:"replacePage",value:function(page){var _this2=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if("object"===("undefined"==typeof page?"undefined":babelHelpers["typeof"](page))&&null!==page?options=page:options.page=page,options&&"object"!=("undefined"==typeof options?"undefined":babelHelpers["typeof"](options)))throw new Error("options must be an object. You supplied "+options);var onTransitionEnd=options.onTransitionEnd||function(){};return 1===this._pages.length&&(options._forceHideBackButton=!0),options.onTransitionEnd=function(){_this2._pages.length>1&&_this2._pages[_this2._pages.length-2].destroy(),onTransitionEnd()},this.pushPage(options.page,options)}},{key:"popPage",value:function(){var _this3=this,options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];if(options&&"object"!=("undefined"==typeof options?"undefined":babelHelpers["typeof"](options)))throw new Error("options must be an object. You supplied "+options);if(options=util.extend({},this.options||{},options),options.cancelIfRunning&&this._isRunning)return Promise.reject("popPage is already running.");options.animationOptions=util.extend(options.animationOptions||{},AnimatorFactory.parseAnimationOptionsString(this.getAttribute("animation-options")));var tryPopPage=function(){if(_this3._pages.length<=1)throw new Error("ons-navigator's page stack is empty.");if(_this3._emitPrePopEvent())return Promise.reject("Canceled in prepop event.");var unlock=_this3._doorLock.lock();if(!options.refresh)return _this3._popPage(options,unlock);var _ret=function(){var index=_this3._pages.length-2;if(!_this3._pages[index].page)throw new Error("Refresh option cannot be used with pages directly inside the Navigator. Use ons-template instead.");return{v:internal.getPageHTMLAsync(_this3._pages[index].page).then(function(templateHTML){var element=_this3._createPageElement(templateHTML),pageObject=_this3._createPageObject(_this3._pages[index].page,element,_this3._pages[index].options);return new Promise(function(resolve){rewritables.link(_this3,element,_this3._pages[index].options,function(element){_this3.insertBefore(element,_this3._pages[index]?_this3._pages[index].element:null),_this3._pages.splice(index,0,pageObject),_this3._pages[index+1].destroy(),resolve(_this3._popPage(options,unlock))})})})}}();return"object"===("undefined"==typeof _ret?"undefined":babelHelpers["typeof"](_ret))?_ret.v:void 0};return new Promise(function(resolve){_this3._doorLock.waitUnlock(function(){return resolve(tryPopPage())})})}},{key:"_popPage",value:function(options,unlock){var _this4=this;options.animationOptions=util.extend(options.animationOptions||{},AnimatorFactory.parseAnimationOptionsString(this.getAttribute("animation-options")));var leavePage=this._pages.pop(),enterPage=this._pages[this._pages.length-1];enterPage.updateBackButton(),leavePage.element._hide(),enterPage&&(enterPage.element.style.display="block",enterPage.element._show());var eventDetail={leavePage:leavePage,enterPage:this._pages[this._pages.length-1],navigator:this};return new Promise(function(resolve){var callback=function(){leavePage.destroy(),_this4._isRunning=!1,unlock();var event=util.triggerElementEvent(_this4,"postpop",eventDetail);event.leavePage=null,"function"==typeof options.onTransitionEnd&&options.onTransitionEnd(),resolve(enterPage)};_this4._isRunning=!0;var animator=_this4._animatorFactory.newAnimator(options,leavePage.options.animator);animator.pop(enterPage,leavePage,callback)})}},{key:"insertPage",value:function(index,page){var _this5=this,options=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if("object"===("undefined"==typeof page?"undefined":babelHelpers["typeof"](page))&&null!==page?options=page:options.page=page,options&&"object"!=("undefined"==typeof options?"undefined":babelHelpers["typeof"](options)))throw new Error("options must be an object. You supplied "+options);if(index=this._normalizeIndex(index),index>=this._pages.length)return this.pushPage.apply(this,[].slice.call(arguments,1));var tryInsertPage=function(){var unlock=_this5._doorLock.lock(),run=function(templateHTML){var element=_this5._createPageElement(templateHTML),pageObject=_this5._createPageObject(page,element,options);return new Promise(function(resolve){rewritables.link(_this5,element,options,function(element){element.style.display="none",_this5.insertBefore(element,_this5._pages[index].element),_this5._pages.splice(index,0,pageObject),_this5.getCurrentPage().updateBackButton(),setTimeout(function(){unlock(),element=null,resolve(_this5._pages[index])},1e3/60)})})};return options.pageHTML?run(options.pageHTML):internal.getPageHTMLAsync(page).then(run)};return new Promise(function(resolve){_this5._doorLock.waitUnlock(function(){return resolve(tryInsertPage())})})}},{key:"_normalizeIndex",value:function(index){return 0>index&&(index=Math.abs(this._pages.length+index)%this._pages.length),index}},{key:"getCurrentPage",value:function(){if(this._pages.length<=0)throw new Error("Invalid state");return this._pages[this._pages.length-1]}},{key:"_show",value:function(){this._pages[this._pages.length-1]&&this._pages[this._pages.length-1].element._show()}},{key:"_hide",value:function(){this._pages[this._pages.length-1]&&this._pages[this._pages.length-1].element._hide()}},{key:"_destroy",value:function(){for(var i=this._pages.length-1;i>=0;i--)this._pages[i].destroy();this.remove()}},{key:"_onDeviceBackButton",value:function(event){this._pages.length>1?this.popPage():event.callParentHandler()}},{key:"resetToPage",value:function(page){var _this6=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if("object"===("undefined"==typeof page?"undefined":babelHelpers["typeof"](page))&&null!==page?options=page:options.page=page,options&&"object"!=("undefined"==typeof options?"undefined":babelHelpers["typeof"](options)))throw new Error("options must be an object. You supplied "+options);options.animator||options.animation||(options.animation="none");var onTransitionEnd=options.onTransitionEnd||function(){};return options.onTransitionEnd=function(){for(;_this6._pages.length>1;)_this6._pages.shift().destroy();_this6._pages[0].updateBackButton(),onTransitionEnd()},options.pageHTML||void 0!==options.page&&""!==page||(this.hasAttribute("page")?options.page=this.getAttribute("page"):(options.pageHTML=this._initialHTML,options.page="")),this.pushPage(options.page,options)}},{key:"attributeChangedCallback",value:function(name,last,current){}},{key:"attachedCallback",value:function(){var _this7=this;this._deviceBackButtonHandler=deviceBackButtonDispatcher.createHandler(this,this._boundOnDeviceBackButton),rewritables.ready(this,function(){if(0===_this7._pages.length)if(_this7.getAttribute("page"))_this7.pushPage(_this7.getAttribute("page"),{animation:"none"});else{var element=_this7._createPageElement(_this7._initialHTML||"");_this7._pushPageDOM(_this7._createPageObject("",element,{}),function(){})}})}},{key:"detachedCallback",value:function(){this._deviceBackButtonHandler.destroy(),this._deviceBackButtonHandler=null}},{key:"pushPage",value:function(page){var _this8=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if("object"===("undefined"==typeof page?"undefined":babelHelpers["typeof"](page))&&null!==page?options=page:options.page=page,options&&"object"!=("undefined"==typeof options?"undefined":babelHelpers["typeof"](options)))throw new Error("options must be an object. You supplied "+options);return options=util.extend({},this.options||{},options),options.cancelIfRunning&&this._isRunning?Promise.reject("pushPage is already running."):this._emitPrePushEvent()?Promise.reject("Canceled in prepush event."):(options.animationOptions=util.extend(options.animationOptions||{},AnimatorFactory.parseAnimationOptionsString(this.getAttribute("animation-options"))),this._isRunning=!0,new Promise(function(resolve){_this8._doorLock.waitUnlock(function(){return resolve(_this8._pushPage(options))})}))}},{key:"_pushPage",value:function(options){var _this9=this,unlock=this._doorLock.lock(),done=function(){unlock()},run=function(templateHTML){var element=_this9._createPageElement(templateHTML);return _this9._pushPageDOM(_this9._createPageObject(options.page,element,options),done)};return options.pageHTML?run(options.pageHTML):internal.getPageHTMLAsync(options.page).then(run)}},{key:"_pushPageDOM",value:function(pageObject,unlock){var _this10=this;unlock=unlock||function(){};var element=pageObject.element,options=pageObject.options,eventDetail={enterPage:pageObject,leavePage:this._pages[this._pages.length-1],navigator:this};return this._pages.push(pageObject),pageObject.updateBackButton(),new Promise(function(resolve){var done=function(){_this10._pages[_this10._pages.length-2]&&(_this10._pages[_this10._pages.length-2].element.style.display="none"),_this10._isRunning=!1,unlock(),util.triggerElementEvent(_this10,"postpush",eventDetail),"function"==typeof options.onTransitionEnd&&options.onTransitionEnd(),element=null,resolve(_this10._pages[_this10._pages.length-1])};_this10._isRunning=!0,rewritables.link(_this10,element,options,function(element){CustomElements.upgrade(element),setTimeout(function(){if(_this10._pages.length>1){var leavePage=_this10._pages.slice(-2)[0],enterPage=_this10._pages.slice(-1)[0];_this10.appendChild(element),leavePage.element._hide(),enterPage.element._show(),options.animator.push(enterPage,leavePage,done)}else _this10.appendChild(element),element._show(),done()},1e3/60)})})}},{key:"bringPageTop",value:function(item){var _this11=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(options&&"object"!=("undefined"==typeof options?"undefined":babelHelpers["typeof"](options)))throw new Error("options must be an object. You supplied "+options);if(options=util.extend({},this.options||{},options),options.cancelIfRunning&&this._isRunning)return Promise.reject("pushPage is already running.");if(this._emitPrePushEvent())return Promise.reject("Canceled in prepush event.");var index=void 0;if("string"==typeof item)options.page=item,index=this._lastIndexOfPage(options.page);else{if("number"!=typeof item)throw new Error("First argument must be a page name or the index of an existing page. You supplied "+item);if(index=this._normalizeIndex(item),item>=this._pages.length)throw new Error("The provided index does not match an existing page.");options.page=this._pages[index].page}if(0>index)return new Promise(function(resolve){_this11._doorLock.waitUnlock(function(){return resolve(_this11._pushPage(options))})});if(index===this._pages.length-1)return Promise.resolve(this._pages[index]);var _ret2=function(){var tryBringPageTop=function(){var unlock=_this11._doorLock.lock(),done=function(){unlock()},pageObject=_this11._pages.splice(index,1)[0];return pageObject.element.style.display="block",pageObject.element.setAttribute("_skipinit",""),options.animation&&(options.animator=_this11._animatorFactory.newAnimator(options)),pageObject.options=util.extend(pageObject.options,options),_this11._pushPageDOM(pageObject,done)};return{v:new Promise(function(resolve){_this11._doorLock.waitUnlock(function(){return resolve(tryBringPageTop())})})}}();return"object"===("undefined"==typeof _ret2?"undefined":babelHelpers["typeof"](_ret2))?_ret2.v:void 0}},{key:"_lastIndexOfPage",value:function(page){var index=void 0;for(index=this._pages.length-1;index>=0&&this._pages[index].page!==page;index--);return index}},{key:"_emitPrePushEvent",value:function(){var isCanceled=!1;return util.triggerElementEvent(this,"prepush",{navigator:this,currentPage:this._pages.length>0?this.getCurrentPage():void 0,cancel:function(){isCanceled=!0}}),isCanceled}},{key:"_emitPrePopEvent",value:function(){var isCanceled=!1,leavePage=this.getCurrentPage();return util.triggerElementEvent(this,"prepop",{navigator:this,currentPage:leavePage,leavePage:leavePage,enterPage:this._pages[this._pages.length-2],cancel:function(){isCanceled=!0}}),isCanceled}},{key:"_createPageObject",value:function(page,element,options){return options.animator=this._animatorFactory.newAnimator(options),new NavigatorPage({page:page,element:element,options:options,navigator:this})}},{key:"_createPageElement",value:function(templateHTML){var pageElement=util.createElement(internal.normalizePageHTML(templateHTML));if("ons-page"!==pageElement.nodeName.toLowerCase())throw new Error('You must supply an "ons-page" element to "ons-navigator".');return pageElement}},{key:"options",get:function(){return this._options},set:function(object){this._options=object,this._options.hasOwnProperty("cancelIfRunning")||(this._options.cancelIfRunning=!0)}},{key:"pages",get:function(){return this._pages.slice(0)}}]),NavigatorElement}(BaseElement);window.OnsNavigatorElement=document.registerElement("ons-navigator",{prototype:NavigatorElement.prototype}),window.OnsNavigatorElement.registerAnimator=function(name,Animator){if(!(Animator.prototype instanceof NavigatorTransitionAnimator))throw new Error('"Animator" param must inherit OnsNavigatorElement.NavigatorTransitionAnimator');_animatorDict$3[name]=Animator},window.OnsNavigatorElement.rewritables=rewritables,window.OnsNavigatorElement.NavigatorTransitionAnimator=NavigatorTransitionAnimator;var scheme$13={"":"page--*",".page__content":"page--*__content",".page__background":"page--*__background"},nullToolbarElement=document.createElement("ons-toolbar"),PageElement=function(_BaseElement){function PageElement(){return babelHelpers.classCallCheck(this,PageElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(PageElement).apply(this,arguments))}return babelHelpers.inherits(PageElement,_BaseElement),babelHelpers.createClass(PageElement,[{key:"createdCallback",value:function(){this.classList.add("page"),this.hasAttribute("_compiled")||this._compile(),this._isShown=!1,this._contentElement=this._getContentElement(),this._isMuted=this.hasAttribute("_muted"),this._skipInit=this.hasAttribute("_skipinit"),this.eventDetail={page:this}}},{key:"attachedCallback",value:function(){var _this2=this;this._isMuted||(this._skipInit?this.removeAttribute("_skipinit"):util.triggerElementEvent(this,"init",this.eventDetail)),util.hasAnyComponentAsParent(this)||setImmediate(function(){return _this2._show()}),this._tryToFillStatusBar();var infiniteScroll=this.getAttribute("on-infinite-scroll")||this.getAttribute("oninfinitescroll");this.attributeChangedCallback("oninfinitescroll",null,infiniteScroll)}},{key:"_onScroll",value:function(){var _this3=this,c=this._contentElement,overLimit=(c.scrollTop+c.clientHeight)/c.scrollHeight>=this._infiniteScrollLimit;this._onInfiniteScroll&&!this._loadingContent&&overLimit&&(this._loadingContent=!0,this._onInfiniteScroll(function(){return _this3._loadingContent=!1}))}},{key:"getDeviceBackButtonHandler",value:function(){return this._deviceBackButtonHandler||null}},{key:"setDeviceBackButtonHandler",value:function(callback){this._deviceBackButtonHandler&&this._deviceBackButtonHandler.destroy(),this._deviceBackButtonHandler=deviceBackButtonDispatcher.createHandler(this,callback)}},{key:"_getContentElement",value:function(){var result=util.findChild(this,".page__content");if(result)return result;throw Error('fail to get ".page__content" element.')}},{key:"_canAnimateToolbar",value:function(){return util.findChild(this,"ons-toolbar")?!0:!!util.findChild(this._contentElement,function(e){return"ons-toolbar"===e.nodeName.toLowerCase()&&!e.hasAttribute("inline")})}},{key:"_getBackgroundElement",value:function(){var result=util.findChild(this,".page__background");if(result)return result;throw Error('fail to get ".page__background" element.')}},{key:"_getBottomToolbarElement",value:function(){return util.findChild(this,"ons-bottom-toolbar")||internal.nullElement}},{key:"_getToolbarElement",value:function(){return util.findChild(this,"ons-toolbar")||nullToolbarElement}},{key:"_registerToolbar",value:function(element){this._contentElement.setAttribute("no-status-bar-fill",""),util.findChild(this,".page__status-bar-fill")?this.insertBefore(element,this.children[1]):this.insertBefore(element,this.children[0])}},{key:"_registerBottomToolbar",value:function(element){this.classList.add("page-with-bottom-toolbar"),this.appendChild(element)}},{key:"attributeChangedCallback",value:function(name,last,current){var _this4=this;return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$13):void("_muted"===name?this._isMuted=this.hasAttribute("_muted"):"_skipinit"===name?this._skipInit=this.hasAttribute("_skipinit"):name.match(/on-?infinite-?scroll/i)&&(this.onInfiniteScroll=null===current?null:function(done){var f=util.findFromPath(current);_this4.onInfiniteScroll=f,f(done)}))}},{key:"_compile",value:function(){autoStyle.prepare(this);for(var background=util.create(".page__background"),content=util.create(".page__content");this.firstChild;)content.appendChild(this.firstChild);this.appendChild(background),this.appendChild(content),ModifierUtil.initModifier(this,scheme$13),this.setAttribute("_compiled","")}},{key:"_registerExtraElement",value:function(element){var extra=util.findChild(this,".page__extra");extra||(extra=util.create(".page__extra",{zIndex:10001}),this.appendChild(extra)),extra.appendChild(element)}},{key:"_tryToFillStatusBar",value:function(){var _this5=this;return internal.shouldFillStatusBar(this).then(function(){var fill=_this5.querySelector(".page__status-bar-fill");return fill||(fill=util.create(".page__status-bar-fill"),_this5.insertBefore(fill,_this5.children[0])),fill})["catch"](function(){var el=_this5.querySelector(".page__status-bar-fill");el&&el.remove()})}},{key:"_show",value:function(){!this.isShown&&util.isAttached(this)&&(this.isShown=!0,this._isMuted||util.triggerElementEvent(this,"show",this.eventDetail),util.propagateAction(this._contentElement,"_show"))}},{key:"_hide",value:function(){this.isShown&&(this.isShown=!1,this._isMuted||util.triggerElementEvent(this,"hide",this.eventDetail),util.propagateAction(this._contentElement,"_hide"))}},{key:"_destroy",value:function(){this._hide(),this._isMuted||util.triggerElementEvent(this,"destroy",this.eventDetail),this.getDeviceBackButtonHandler()&&this.getDeviceBackButtonHandler().destroy(),util.propagateAction(this._contentElement,"_destroy"),this.remove()}},{key:"isShown",get:function(){return this._isShown},set:function(value){this._isShown=value}},{key:"onInfiniteScroll",set:function(value){if(null===value)return this._onInfiniteScroll=null,void this._contentElement.removeEventListener("scroll",this._boundOnScroll);if(!(value instanceof Function))throw new Error("onInfiniteScroll must be a function or null");
this._onInfiniteScroll||(this._infiniteScrollLimit=.9,this._boundOnScroll=this._onScroll.bind(this),this._contentElement.addEventListener("scroll",this._boundOnScroll)),this._onInfiniteScroll=value}}]),PageElement}(BaseElement);window.OnsPageElement=document.registerElement("ons-page",{prototype:PageElement.prototype});var PopoverAnimator=function(){function PopoverAnimator(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];babelHelpers.classCallCheck(this,PopoverAnimator),this.options=util.extend({timing:"cubic-bezier(.1, .7, .4, 1)",duration:.2,delay:0},options)}return babelHelpers.createClass(PopoverAnimator,[{key:"show",value:function(popover,callback){callback()}},{key:"hide",value:function(popover,callback){callback()}},{key:"_animate",value:function(element,_ref){var from=_ref.from,to=_ref.to,options=_ref.options,callback=_ref.callback,_ref$restore=_ref.restore,restore=void 0===_ref$restore?!1:_ref$restore,animation=_ref.animation;return options=util.extend({},this.options,options),animation&&(from=animation.from,to=animation.to),animation=animit(element),restore&&(animation=animation.saveStyle()),animation=animation.queue(from).wait(options.delay).queue({css:to,duration:options.duration,timing:options.timing}),restore&&(animation=animation.restoreStyle()),callback&&(animation=animation.queue(function(done){callback(),done()})),animation}},{key:"_animateAll",value:function(element,animations){var _this=this;Object.keys(animations).forEach(function(key){return _this._animate(element[key],animations[key]).play()})}}]),PopoverAnimator}(),fade={out:{from:{opacity:1},to:{opacity:0}},"in":{from:{opacity:0},to:{opacity:1}}},MDFadePopoverAnimator=function(_PopoverAnimator){function MDFadePopoverAnimator(){return babelHelpers.classCallCheck(this,MDFadePopoverAnimator),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(MDFadePopoverAnimator).apply(this,arguments))}return babelHelpers.inherits(MDFadePopoverAnimator,_PopoverAnimator),babelHelpers.createClass(MDFadePopoverAnimator,[{key:"show",value:function(popover,callback){this._animateAll(popover,{_mask:fade["in"],_popover:{animation:fade["in"],restore:!0,callback:callback}})}},{key:"hide",value:function(popover,callback){this._animateAll(popover,{_mask:fade.out,_popover:{animation:fade.out,restore:!0,callback:callback}})}}]),MDFadePopoverAnimator}(PopoverAnimator),IOSFadePopoverAnimator=function(_MDFadePopoverAnimato){function IOSFadePopoverAnimator(){return babelHelpers.classCallCheck(this,IOSFadePopoverAnimator),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(IOSFadePopoverAnimator).apply(this,arguments))}return babelHelpers.inherits(IOSFadePopoverAnimator,_MDFadePopoverAnimato),babelHelpers.createClass(IOSFadePopoverAnimator,[{key:"show",value:function(popover,callback){this._animateAll(popover,{_mask:fade["in"],_popover:{from:{transform:"scale3d(1.3, 1.3, 1.0)",opacity:0},to:{transform:"scale3d(1.0, 1.0, 1.0)",opacity:1},restore:!0,callback:callback}})}}]),IOSFadePopoverAnimator}(MDFadePopoverAnimator),animators={PopoverAnimator:PopoverAnimator,IOSFadePopoverAnimator:IOSFadePopoverAnimator,MDFadePopoverAnimator:MDFadePopoverAnimator},scheme$14={".popover":"popover--*",".popover-mask":"popover-mask--*",".popover__container":"popover__container--*",".popover__content":"popover__content--*",".popover__arrow":"popover__arrow--*"},_animatorDict$4={"default":function(){return platform.isAndroid()?animators.MDFadePopoverAnimator:animators.IOSFadePopoverAnimator},none:animators.PopoverAnimator,"fade-ios":animators.IOSFadePopoverAnimator,"fade-md":animators.MDFadePopoverAnimator},templateSource$2=util.createFragment('\n <div class="popover-mask"></div>\n <div class="popover__container">\n <div class="popover__content"></div>\n <div class="popover__arrow"></div>\n </div>\n'),positions={up:"bottom",left:"right",down:"top",right:"left"},PopoverElement=(Object.keys(positions),function(_BaseElement){function PopoverElement(){return babelHelpers.classCallCheck(this,PopoverElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(PopoverElement).apply(this,arguments))}return babelHelpers.inherits(PopoverElement,_BaseElement),babelHelpers.createClass(PopoverElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile(),this._doorLock=new DoorLock,this._boundOnChange=this._onChange.bind(this),this._boundCancel=this._cancel.bind(this),this._initAnimatorFactory()}},{key:"_initAnimatorFactory",value:function(){var factory=new AnimatorFactory({animators:_animatorDict$4,baseClass:animators.PopoverAnimator,baseClassName:"PopoverAnimator",defaultAnimation:this.getAttribute("animation")||"default"});this._animator=function(options){return factory.newAnimator(options)}}},{key:"_onDeviceBackButton",value:function(event){this.isCancelable()?this._cancel():event.callParentHandler()}},{key:"_positionPopover",value:function(target){var radius=this._radius,el=this._content,margin=this._margin,pos=target.getBoundingClientRect(),isMD=util.hasModifier(this,"material"),cover=isMD&&this.hasAttribute("cover-target"),distance={top:pos.top-margin,left:pos.left-margin,right:window.innerWidth-pos.right-margin,bottom:window.innerHeight-pos.bottom-margin},_calculateDirections2=this._calculateDirections(distance),vertical=_calculateDirections2.vertical,primary=_calculateDirections2.primary,secondary=_calculateDirections2.secondary;this._popover.classList.add("popover--"+primary);var offset=cover?0:(vertical?pos.height:pos.width)+(isMD?0:14);this.style[primary]=Math.max(0,distance[primary]+offset)+margin+"px",el.style[primary]=0;var l=vertical?"width":"height",sizes=function(style){return{width:parseInt(style.getPropertyValue("width")),height:parseInt(style.getPropertyValue("height"))}}(window.getComputedStyle(el));el.style[secondary]=Math.max(0,distance[secondary]-(sizes[l]-pos[l])/2)+"px",this._arrow.style[secondary]=Math.max(radius,distance[secondary]+pos[l]/2)+"px",this._setTransformOrigin(distance,sizes,pos,primary),el.removeAttribute("data-animit-orig-style")}},{key:"_setTransformOrigin",value:function(distance,sizes,pos,primary){var calc=function(a,o,l){return primary===a?sizes[l]/2:distance[a]+(primary===o?-sizes[l]:sizes[l]-pos[l])/2},x=calc("left","right","width")+"px",y=calc("top","bottom","height")+"px";util.extend(this._popover.style,{transformOrigin:x+" "+y,webkitTransformOriginX:x,webkitTransformOriginY:y})}},{key:"_calculateDirections",value:function(distance){var options=(this.getAttribute("direction")||"up down left right").split(/\s+/).map(function(e){return positions[e]}),primary=options.sort(function(a,b){return distance[a]-distance[b]})[0],vertical=-1!==["top","bottom"].indexOf(primary),secondary=void 0;return secondary=vertical?distance.left<distance.right?"left":"right":distance.top<distance.bottom?"top":"bottom",{vertical:vertical,primary:primary,secondary:secondary}}},{key:"_clearStyles",value:function(){var _this2=this;["top","bottom","left","right"].forEach(function(e){_this2._arrow.style[e]=_this2._content.style[e]=_this2.style[e]="",_this2._popover.classList.remove("popover--"+e)})}},{key:"_onChange",value:function(){var _this3=this;setImmediate(function(){_this3._currentTarget&&_this3._positionPopover(_this3._currentTarget)})}},{key:"_compile",value:function(){autoStyle.prepare(this),this.classList.add("popover");for(var template=templateSource$2.cloneNode(!0),content=template.querySelector(".popover__content");this.childNodes[0];)content.appendChild(this.childNodes[0]);this.appendChild(template),this.hasAttribute("style")&&(this._popover.setAttribute("style",this.getAttribute("style")),this.removeAttribute("style")),this.hasAttribute("mask-color")&&(this._mask.style.backgroundColor=this.getAttribute("mask-color")),ModifierUtil.initModifier(this,scheme$14),this.setAttribute("_compiled","")}},{key:"_prepareAnimationOptions",value:function(options){if(options.animation&&!(options.animation in _animatorDict$4))throw new Error("Animator "+options.animation+" is not registered.");options.animationOptions=util.extend(AnimatorFactory.parseAnimationOptionsString(this.getAttribute("animation-options")),options.animationOptions||{})}},{key:"_executeAction",value:function(actions){var _this4=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],callback=options.callback,action=actions.action,before=actions.before,after=actions.after;this._prepareAnimationOptions(options);var canceled=!1;return util.triggerElementEvent(this,"pre"+action,{popover:this,cancel:function(){return canceled=!0}}),canceled?Promise.reject("Canceled in pre"+action+" event."):new Promise(function(resolve){_this4._doorLock.waitUnlock(function(){var unlock=_this4._doorLock.lock();before&&before(),_this4._animator(options)[action](_this4,function(){after&&after(),unlock(),util.triggerElementEvent(_this4,"post"+action,{popover:_this4}),callback&&callback(),resolve(_this4)})})})}},{key:"show",value:function(target){var _this5=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if("string"==typeof target?target=document.querySelector(target):target instanceof Event&&(target=target.target),!(target instanceof HTMLElement))throw new Error("Invalid target");return this._executeAction({action:"show",before:function(){_this5.style.display="block",_this5._currentTarget=target,_this5._positionPopover(target)}},options)}},{key:"hide",value:function(){var _this6=this,options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return this._executeAction({action:"hide",after:function(){_this6.style.display="none",_this6._clearStyles()}},options)}},{key:"isShown",value:function(){return"none"!==window.getComputedStyle(this).getPropertyValue("display")}},{key:"attachedCallback",value:function(){this._margin=parseInt(window.getComputedStyle(this).getPropertyValue("top")),this._radius=parseInt(window.getComputedStyle(this._content).getPropertyValue("border-radius")),this._mask.addEventListener("click",this._boundCancel,!1),this._deviceBackButtonHandler=deviceBackButtonDispatcher.createHandler(this,this._onDeviceBackButton.bind(this)),this._popover.addEventListener("DOMNodeInserted",this._boundOnChange,!1),this._popover.addEventListener("DOMNodeRemoved",this._boundOnChange,!1),window.addEventListener("resize",this._boundOnChange,!1)}},{key:"detachedCallback",value:function(){this._mask.removeEventListener("click",this._boundCancel,!1),this._deviceBackButtonHandler.destroy(),this._deviceBackButtonHandler=null,this._popover.removeEventListener("DOMNodeInserted",this._boundOnChange,!1),this._popover.removeEventListener("DOMNodeRemoved",this._boundOnChange,!1),window.removeEventListener("resize",this._boundOnChange,!1)}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$14):"direction"===name?this._boundOnChange():void("animation"===name&&this._initAnimatorFactory())}},{key:"setCancelable",value:function(cancelable){if("boolean"!=typeof cancelable)throw new Error("Argument must be a boolean.");cancelable?this.setAttribute("cancelable",""):this.removeAttribute("cancelable")}},{key:"isCancelable",value:function(){return this.hasAttribute("cancelable")}},{key:"destroy",value:function(){this.parentElement&&this.parentElement.removeChild(this)}},{key:"_cancel",value:function(){var _this7=this;this.isCancelable()&&this.hide({callback:function(){util.triggerElementEvent(_this7,"cancel")}})}},{key:"_mask",get:function(){return this.children[0]}},{key:"_popover",get:function(){return this.children[1]}},{key:"_content",get:function(){return this._popover.children[0]}},{key:"_arrow",get:function(){return this._popover.children[1]}}]),PopoverElement}(BaseElement));window.OnsPopoverElement=document.registerElement("ons-popover",{prototype:PopoverElement.prototype}),window.OnsPopoverElement.registerAnimator=function(name,Animator){if(!(Animator.prototype instanceof animators.PopoverAnimator))throw new Error('"Animator" param must inherit PopoverAnimator');_animatorDict$4[name]=Animator},window.OnsPopoverElement.PopoverAnimator=animators.PopoverAnimator;var scheme$15={".progress-bar":"progress-bar--*",".progress-bar__primary":"progress-bar__primary--*",".progress-bar__secondary":"progress-bar__secondary--*"},template=util.createElement('\n <div class="progress-bar">\n <div class="progress-bar__secondary"></div>\n <div class="progress-bar__primary"></div>\n </div>\n'),ProgressBarElement=function(_BaseElement){function ProgressBarElement(){return babelHelpers.classCallCheck(this,ProgressBarElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(ProgressBarElement).apply(this,arguments))}return babelHelpers.inherits(ProgressBarElement,_BaseElement),babelHelpers.createClass(ProgressBarElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile()}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$15):void("value"===name||"secondary-value"===name?this._updateValue():"indeterminate"===name&&this._updateDeterminate())}},{key:"_updateDeterminate",value:function(){this.hasAttribute("indeterminate")?(this._template.classList.add("progress-bar--indeterminate"),this._template.classList.remove("progress-bar--determinate")):(this._template.classList.add("progress-bar--determinate"),this._template.classList.remove("progress-bar--indeterminate"))}},{key:"_updateValue",value:function(){this._primary.style.width=this.hasAttribute("value")?this.getAttribute("value")+"%":"0%",this._secondary.style.width=this.hasAttribute("secondary-value")?this.getAttribute("secondary-value")+"%":"0%"}},{key:"_compile",value:function(){this._template=template.cloneNode(!0),this._primary=this._template.childNodes[3],this._secondary=this._template.childNodes[1],this._updateDeterminate(),this._updateValue(),this.appendChild(this._template),ModifierUtil.initModifier(this,scheme$15),this.setAttribute("_compiled","")}}]),ProgressBarElement}(BaseElement);window.OnsProgressBarElement=document.registerElement("ons-progress-bar",{prototype:ProgressBarElement.prototype});var scheme$16={".progress-circular":"progress-circular--*",".progress-circular__primary":"progress-circular__primary--*",".progress-circular__secondary":"progress-circular__secondary--*"},template$1=util.createElement('\n <svg class="progress-circular">\n <circle class="progress-circular__secondary" cx="50%" cy="50%" r="40%" fill="none" stroke-width="10%" stroke-miterlimit="10"/>\n <circle class="progress-circular__primary" cx="50%" cy="50%" r="40%" fill="none" stroke-width="10%" stroke-miterlimit="10"/>\n </svg>\n'),ProgressCircularElement=function(_BaseElement){function ProgressCircularElement(){return babelHelpers.classCallCheck(this,ProgressCircularElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(ProgressCircularElement).apply(this,arguments))}return babelHelpers.inherits(ProgressCircularElement,_BaseElement),babelHelpers.createClass(ProgressCircularElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile()}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$16):void("value"===name||"secondary-value"===name?this._updateValue():"indeterminate"===name&&this._updateDeterminate())}},{key:"_updateDeterminate",value:function(){this.hasAttribute("indeterminate")?(this._template.classList.add("progress-circular--indeterminate"),this._template.classList.remove("progress-circular--determinate")):(this._template.classList.add("progress-circular--determinate"),this._template.classList.remove("progress-circular--indeterminate"))}},{key:"_updateValue",value:function(){if(this.hasAttribute("value")){var per=Math.ceil(251.32*this.getAttribute("value")*.01);this._primary.style["stroke-dasharray"]=per+"%, 251.32%"}if(this.hasAttribute("secondary-value")){var per=Math.ceil(251.32*this.getAttribute("secondary-value")*.01);this._secondary.style["stroke-dasharray"]=per+"%, 251.32%"}}},{key:"_compile",value:function(){this._template=template$1.cloneNode(!0),this._primary=this._template.childNodes[3],this._secondary=this._template.childNodes[1],this._updateDeterminate(),this._updateValue(),this.appendChild(this._template),ModifierUtil.initModifier(this,scheme$16),this.setAttribute("_compiled","")}}]),ProgressCircularElement}(BaseElement);window.OnsProgressCircularElement=document.registerElement("ons-progress-circular",{prototype:ProgressCircularElement.prototype});var STATE_INITIAL="initial",STATE_PREACTION="preaction",STATE_ACTION="action",PullHookElement=function(_BaseElement){function PullHookElement(){return babelHelpers.classCallCheck(this,PullHookElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(PullHookElement).apply(this,arguments))}return babelHelpers.inherits(PullHookElement,_BaseElement),babelHelpers.createClass(PullHookElement,[{key:"createdCallback",value:function(){if(this.hasAttribute("_compiled")?this._scrollElement=this.parentElement:(this._scrollElement=this._createScrollElement(),this.setAttribute("_compiled","")),this._pageElement=this._scrollElement.parentElement,!this._pageElement.classList.contains("page__content")&&!this._pageElement.classList.contains("ons-scroller__content"))throw new Error("<ons-pull-hook> must be a direct descendant of an <ons-page> or an <ons-scroller> element.");this._boundOnDrag=this._onDrag.bind(this),this._boundOnDragStart=this._onDragStart.bind(this),this._boundOnDragEnd=this._onDragEnd.bind(this),this._boundOnScroll=this._onScroll.bind(this),this._currentTranslation=0,this._setState(STATE_INITIAL,!0),this._setStyle()}},{key:"_createScrollElement",value:function(){var scrollElement=util.createElement('<div class="scroll"><div>'),pageElement=this.parentElement;for(scrollElement.appendChild(this);pageElement.firstChild;)scrollElement.appendChild(pageElement.firstChild);return pageElement.appendChild(scrollElement),scrollElement}},{key:"_setStyle",value:function(){var height=this.getHeight();this.style.top="-"+height+"px",this.style.height=height+"px",this.style.lineHeight=height+"px"}},{key:"_onScroll",value:function(event){var element=this._pageElement;element.scrollTop<0&&(element.scrollTop=0)}},{key:"_generateTranslationTransform",value:function(scroll){return"translate3d(0px, "+scroll+"px, 0px)"}},{key:"_onDrag",value:function(event){var _this2=this;if(!this.isDisabled()&&"left"!==event.gesture.direction&&"right"!==event.gesture.direction){var element=this._pageElement;if(element.scrollTop=this._startScroll-event.gesture.deltaY,element.scrollTop<window.innerHeight&&"up"!==event.gesture.direction&&event.gesture.preventDefault(),0===this._currentTranslation&&0===this._getCurrentScroll()){this._transitionDragLength=event.gesture.deltaY;var direction=event.gesture.interimDirection;"down"===direction?this._transitionDragLength-=1:this._transitionDragLength+=1}var scroll=Math.max(event.gesture.deltaY-this._startScroll,0);this._thresholdHeightEnabled()&&scroll>=this.getThresholdHeight()?(event.gesture.stopDetect(),setImmediate(function(){_this2._setState(STATE_ACTION),_this2._translateTo(_this2.getHeight(),{animate:!0}),_this2._waitForAction(_this2._onDone.bind(_this2))})):this._setState(scroll>=this.getHeight()?STATE_PREACTION:STATE_INITIAL),event.stopPropagation(),this._translateTo(scroll)}}},{key:"_onDragStart",value:function(event){this.isDisabled()||(this._startScroll=this._getCurrentScroll())}},{key:"_onDragEnd",value:function(event){if(!this.isDisabled()&&this._currentTranslation>0){var scroll=this._currentTranslation;scroll>this.getHeight()?(this._setState(STATE_ACTION),this._translateTo(this.getHeight(),{animate:!0}),this._waitForAction(this._onDone.bind(this))):this._translateTo(0,{animate:!0})}}},{key:"setActionCallback",value:function(callback){this._callback=callback}},{key:"_waitForAction",value:function(done){this._callback instanceof Function?this._callback.call(null,done):done()}},{key:"_onDone",value:function(done){this._translateTo(0,{animate:!0}),this._setState(STATE_INITIAL)}},{key:"getHeight",value:function(){return parseInt(this.getAttribute("height")||"64",10)}},{key:"setHeight",value:function(height){this.setAttribute("height",height+"px"),this._setStyle()}},{key:"setThresholdHeight",value:function(thresholdHeight){this.setAttribute("threshold-height",thresholdHeight+"px")}},{key:"getThresholdHeight",value:function(){return parseInt(this.getAttribute("threshold-height")||"96",10)}},{key:"_thresholdHeightEnabled",value:function(){var th=this.getThresholdHeight();return th>0&&th>=this.getHeight()}},{key:"_setState",value:function(state,noEvent){var lastState=this._getState();this.setAttribute("state",state),noEvent||lastState===this._getState()||util.triggerElementEvent(this,"changestate",{pullHook:this,state:state,lastState:lastState})}},{key:"_getState",value:function(){return this.getAttribute("state")}},{key:"getCurrentState",value:function(){return this._getState()}},{key:"_getCurrentScroll",value:function(){return this._pageElement.scrollTop}},{key:"getPullDistance",value:function(){return this._currentTranslation}},{key:"isDisabled",value:function(){return this.hasAttribute("disabled")}},{key:"_isContentFixed",value:function(){return this.hasAttribute("fixed-content")}},{key:"setDisabled",value:function(disabled){disabled?this.setAttribute("disabled",""):this.removeAttribute("disabled")}},{key:"_getScrollableElement",value:function(){return this._isContentFixed()?this:this._scrollElement}},{key:"_translateTo",value:function(scroll){var _this3=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(0!=this._currentTranslation||0!=scroll){var done=function(){0===scroll&&_this3._getScrollableElement().removeAttribute("style"),options.callback&&options.callback()};this._currentTranslation=scroll,options.animate?animit(this._getScrollableElement()).queue({transform:this._generateTranslationTransform(scroll)},{duration:.3,timing:"cubic-bezier(.1, .7, .1, 1)"}).play(done):animit(this._getScrollableElement()).queue({transform:this._generateTranslationTransform(scroll)}).play(done)}}},{key:"_getMinimumScroll",value:function(){var scrollHeight=this._scrollElement.getBoundingClientRect().height,pageHeight=this._pageElement.getBoundingClientRect().height;return scrollHeight>pageHeight?-(scrollHeight-pageHeight):0}},{key:"_createEventListeners",value:function(){this._gestureDetector=new GestureDetector(this._pageElement,{dragMinDistance:1,dragDistanceCorrection:!1}),this._gestureDetector.on("drag",this._boundOnDrag),this._gestureDetector.on("dragstart",this._boundOnDragStart),this._gestureDetector.on("dragend",this._boundOnDragEnd),this._scrollElement.parentElement.addEventListener("scroll",this._boundOnScroll,!1)}},{key:"_destroyEventListeners",value:function(){this._gestureDetector.off("drag",this._boundOnDrag),this._gestureDetector.off("dragstart",this._boundOnDragStart),this._gestureDetector.off("dragend",this._boundOnDragEnd),this._gestureDetector.dispose(),this._gestureDetector=null,this._scrollElement.parentElement.removeEventListener("scroll",this._boundOnScroll,!1)}},{key:"attachedCallback",value:function(){this._createEventListeners()}},{key:"detachedCallback",value:function(){this._destroyEventListeners()}},{key:"attributeChangedCallback",value:function(name,last,current){}}]),PullHookElement}(BaseElement);window.OnsPullHookElement=document.registerElement("ons-pull-hook",{prototype:PullHookElement.prototype}),window.OnsPullHookElement.STATE_ACTION=STATE_ACTION,window.OnsPullHookElement.STATE_INITIAL=STATE_INITIAL,window.OnsPullHookElement.STATE_PREACTION=STATE_PREACTION;var AnimatorCSS=function(){function AnimatorCSS(){babelHelpers.classCallCheck(this,AnimatorCSS),this._queue=[],this._index=0}return babelHelpers.createClass(AnimatorCSS,[{key:"animate",value:function(el,final){var duration=arguments.length<=2||void 0===arguments[2]?200:arguments[2],start=(new Date).getTime(),initial={},stopped=!1,next=!1,timeout=!1,properties=Object.keys(final),updateStyles=function(){var s=window.getComputedStyle(el);properties.forEach(s.getPropertyValue.bind(s)),s=el.offsetHeight},result={stop:function(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];timeout&&clearTimeout(timeout);var k=Math.min(1,((new Date).getTime()-start)/duration);return properties.forEach(function(i){el.style[i]=(1-k)*initial[i]+k*final[i]+("opacity"==i?"":"px")}),el.style.transitionDuration="0s",options.stopNext?next=!1:stopped||(stopped=!0,next&&next()),result},then:function(cb){return next=cb,stopped&&next&&next(),result},speed:function(newDuration){return internal.config.animationsDisabled&&(newDuration=0),stopped||!function(){timeout&&clearTimeout(timeout);var passed=(new Date).getTime()-start,k=passed/duration,remaining=newDuration*(1-k);properties.forEach(function(i){el.style[i]=(1-k)*initial[i]+k*final[i]+("opacity"==i?"":"px")}),updateStyles(),start=el.speedUpTime,duration=remaining,el.style.transitionDuration=duration/1e3+"s",properties.forEach(function(i){el.style[i]=final[i]+("opacity"==i?"":"px")}),timeout=setTimeout(result.stop,remaining)}(),result},finish:function(){var milliseconds=arguments.length<=0||void 0===arguments[0]?50:arguments[0],k=((new Date).getTime()-start)/duration;return result.speed(milliseconds/(1-k)),result}};if(el.hasAttribute("disabled")||stopped||internal.config.animationsDisabled)return result;var style=window.getComputedStyle(el);return properties.forEach(function(e){var v=parseFloat(style.getPropertyValue(e));initial[e]=isNaN(v)?0:v}),stopped||(el.style.transitionProperty=properties.join(","),el.style.transitionDuration=duration/1e3+"s",properties.forEach(function(e){el.style[e]=final[e]+("opacity"==e?"":"px")})),timeout=setTimeout(result.stop,duration),this._onStopAnimations(el,result.stop),result}}]),babelHelpers.createClass(AnimatorCSS,[{key:"_onStopAnimations",value:function(el,listener){var queue=this._queue,i=this._index++;queue[el]=queue[el]||[],queue[el][i]=function(options){return delete queue[el][i],queue[el]&&0==queue[el].length&&delete queue[el],listener(options)}}},{key:"stopAnimations",value:function(el){var _this=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return Array.isArray(el)?el.forEach(function(el){_this.stopAnimations(el,options)}):void(this._queue[el]||[]).forEach(function(e){e(options||{})})}},{key:"stopAll",value:function(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.stopAnimations(Object.keys(this._queue),options)}},{key:"fade",value:function(el){var duration=arguments.length<=1||void 0===arguments[1]?200:arguments[1];return this.animate(el,{opacity:0},duration)}}]),AnimatorCSS}(),RippleElement=function(_BaseElement){function RippleElement(){return babelHelpers.classCallCheck(this,RippleElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(RippleElement).apply(this,arguments))}return babelHelpers.inherits(RippleElement,_BaseElement),babelHelpers.createClass(RippleElement,[{key:"createdCallback",value:function(){var _this2=this;this.classList.add("ripple"),this.hasAttribute("_compiled")?(this._background=this.getElementsByClassName("ripple__background")[0],this._wave=this.getElementsByClassName("ripple__wave")[0]):this._compile(),this._animator=new AnimatorCSS,["color","center","start-radius","background"].forEach(function(e){_this2.attributeChangedCallback(e,null,_this2.getAttribute(e))})}},{key:"_compile",value:function(){var _this3=this;["_wave","_background"].forEach(function(e){_this3[e]=document.createElement("div"),_this3[e].classList.add("ripple_"+e),_this3.appendChild(_this3[e])}),this.setAttribute("_compiled","")}},{key:"_calculateCoords",value:function(e){var x,y,h,w,r,b=this.getBoundingClientRect();return this._center?(x=b.width/2,y=b.height/2,r=Math.sqrt(x*x+y*y)):(x=(e.clientX||e.changedTouches[0].clientX)-b.left,y=(e.clientY||e.changedTouches[0].clientY)-b.top,h=Math.max(y,b.height-y),w=Math.max(x,b.width-x),r=Math.sqrt(h*h+w*w)),{x:x,y:y,r:r}}},{key:"_rippleAnimation",value:function(e){var duration=arguments.length<=1||void 0===arguments[1]?300:arguments[1],_animator=this._animator,_wave=this._wave,_background=this._background,_minR=this._minR,_calculateCoords2=this._calculateCoords(e),x=_calculateCoords2.x,y=_calculateCoords2.y,r=_calculateCoords2.r;return _animator.stopAll({stopNext:1}),_animator.animate(_background,{opacity:1},duration),util.extend(_wave.style,{opacity:1,top:y-_minR+"px",left:x-_minR+"px",width:2*_minR+"px",height:2*_minR+"px"}),_animator.animate(_wave,{top:y-r,left:x-r,height:2*r,width:2*r},duration)}},{key:"_updateParent",value:function(){if(!this._parentUpdated&&this.parentNode){var computedStyle=window.getComputedStyle(this.parentNode);"static"===computedStyle.getPropertyValue("position")&&(this.parentNode.style.position="relative"),this._parentUpdated=!0}}},{key:"_onTap",value:function(e){var _this4=this;this.isDisabled()||(this._updateParent(),this._rippleAnimation(e.gesture.srcEvent).then(function(){_this4._animator.fade(_this4._wave),_this4._animator.fade(_this4._background)}))}},{key:"_onHold",value:function(e){this.isDisabled()||(this._updateParent(),this._holding=this._rippleAnimation(e.gesture.srcEvent,2e3),document.addEventListener("release",this._boundOnRelease))}},{key:"_onRelease",value:function(e){var _this5=this;this._holding&&(this._holding.speed(300).then(function(){_this5._animator.stopAll({stopNext:!0}),_this5._animator.fade(_this5._wave),_this5._animator.fade(_this5._background)}),this._holding=!1),document.removeEventListener("release",this._boundOnRelease)}},{key:"_onDragStart",value:function(e){return this._holding?this._onRelease(e):void(-1!=["left","right"].indexOf(e.gesture.direction)&&this._onTap(e))}},{key:"attachedCallback",value:function(){this._parentNode=this.parentNode,this._boundOnTap=this._onTap.bind(this),this._boundOnHold=this._onHold.bind(this),this._boundOnDragStart=this._onDragStart.bind(this),this._boundOnRelease=this._onRelease.bind(this),internal.config.animationsDisabled?this.setDisabled(!0):(this._parentNode.addEventListener("tap",this._boundOnTap),this._parentNode.addEventListener("hold",this._boundOnHold),this._parentNode.addEventListener("dragstart",this._boundOnDragStart))}},{key:"detachedCallback",value:function(){this._parentNode.removeEventListener("tap",this._boundOnTap),this._parentNode.removeEventListener("hold",this._boundOnHold),this._parentNode.removeEventListener("dragstart",this._boundOnDragStart)}},{key:"attributeChangedCallback",value:function(name,last,current){"start-radius"===name&&(this._minR=Math.max(0,parseFloat(current)||0)),"color"===name&¤t&&(this._wave.style.background=current,this.hasAttribute("background")||(this._background.style.background=current)),"background"===name&&(current||last)&&("none"===current?(this._background.setAttribute("disabled","disabled"),this._background.style.background="transparent"):(this._background.hasAttribute("disabled")&&this._background.removeAttribute("disabled"),this._background.style.background=current)),"center"===name&&(this._center=null!=current&&"false"!=current)}},{key:"setDisabled",value:function(disabled){if("boolean"!=typeof disabled)throw new Error("Argument must be a boolean.");disabled?this.setAttribute("disabled",""):this.removeAttribute("disabled")}},{key:"isDisabled",value:function(){return this.hasAttribute("disabled")}}]),RippleElement}(BaseElement);window.OnsRippleElement=document.registerElement("ons-ripple",{prototype:RippleElement.prototype}),window.OnsRowElement=window.OnsRowElement?window.OnsRowElement:document.registerElement("ons-row");var ScrollbarElement=function(_BaseElement){function ScrollbarElement(){return babelHelpers.classCallCheck(this,ScrollbarElement),
babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(ScrollbarElement).apply(this,arguments))}return babelHelpers.inherits(ScrollbarElement,_BaseElement),babelHelpers.createClass(ScrollbarElement,[{key:"createdCallback",value:function(){var _this2=this;this.hasAttribute("_compiled")?this._scroll=util.findChild(this,".scrollbar"):this._compile(),this._timeout=!1,this._boundOnDragStart=this._onDragStart.bind(this),this._boundOnScroll=this._onScroll.bind(this),this._boundOnResize=this._onResize.bind(this),["height","draggable","autohide","autohide-delay","hidden","native","update-on-scroll"].forEach(function(e){_this2.attributeChangedCallback(e,null,_this2.getAttribute(e))})}},{key:"_compile",value:function(){this.classList.add("scrollbar-container"),this._scroll=util.createElement('<div class="scrollbar"><div class="scrollbar-touch"></div></div>'),this.appendChild(this._scroll),this.setAttribute("_compiled","")}},{key:"_attach",value:function(){var _this3=this,styles=window.getComputedStyle(this.parentNode);"static"===styles.getPropertyValue("position")&&(this.parentNode.style.position="relative"),this._content=util.createElement('<div class="scrollbar-content"></div>'),Array.prototype.slice.call(this.parentNode.childNodes).forEach(function(e){e!=_this3&&_this3._content.appendChild(e)}),this.parentNode.insertBefore(this._content,this),this.setAttribute("_attached","")}},{key:"_onScroll",value:function(e){this._updateOnScroll?this.updateScrollbar():this._updateScrollbarLocation(),this._autohide&&this._updateAutohide()}},{key:"_onResize",value:function(e){this.updateScrollbar()}},{key:"_updateAutohide",value:function(){var _this4=this;this._scrolling||(this._scrolling=!0,this.classList.add("scrollbar-autohide-visible")),clearTimeout(this._timeout),this._timeout=setTimeout(function(){_this4._scrolling=!1,_this4.classList.remove("scrollbar-autohide-visible")},this._autohideDelay)}},{key:"updateScrollbar",value:function(){var content=this._content,scroll=this._scroll,container=this;this._hidden||this._native||(scroll.style.display=content.clientHeight>=content.scrollHeight?"none":"block",scroll.style.height=Math.round(this._height||container.clientHeight*content.clientHeight/content.scrollHeight)+"px",this._contentMax=content.scrollHeight-content.clientHeight,this._scrollMax=container.clientHeight-scroll.clientHeight,this._updateScrollbarLocation())}},{key:"_updateScrollbarLocation",value:function(){this._scroll.style.top=Math.round(this._scrollMax*this._content.scrollTop/this._contentMax)+"px"}},{key:"_onDragStart",value:function(e){var _this5=this,startY=this._scroll.offsetTop,onMove=function(e){_this5.classList.add("scrollbar-dragging");var progress=Math.min(1,Math.max(0,(startY+e.gesture.deltaY)/_this5._scrollMax));_this5._content.scrollTop=_this5._contentMax*progress};document.addEventListener("drag",onMove),document.addEventListener("release",function(){_this5.classList.remove("scrollbar-dragging"),document.removeEventListener("drag",onMove)})}},{key:"_onTouchStart",value:function(e){e.preventDefault()}},{key:"attachedCallback",value:function(){this.hasAttribute("_attached")?this._content=this.parentNode.getElementsByClassName("scrollbar-content")[0]:this._attach(),this._native&&this._content.classList.add("scrollbar-native"),this._content.addEventListener("scroll",this._boundOnScroll),window.addEventListener("resize",this._boundOnResize),this.updateScrollbar(),this._draggable&&(this._scroll.addEventListener("dragstart",this._boundOnDragStart),this._scroll.addEventListener("touchstart",this._onTouchStart))}},{key:"detachedCallback",value:function(){this._content.removeEventListener("scroll",this._boundOnScroll),this._scroll.removeEventListener("dragstart",this._boundOnDragStart),this._scroll.removeEventListener("touchstart",this._onTouchStart),this._timeout&&clearTimeout(this._timeout),window.removeEventListener("resize",this._boundOnResize)}},{key:"attributeChangedCallback",value:function(name,last,current){"update-on-scroll"===name&&(this._updateOnScroll=null!==current),"autohide-delay"===name&&(this._autohideDelay=parseInt(current)||500),"height"===name&&(this._height=parseInt(current)||0),-1!==["draggable","autohide","hidden","native"].indexOf(name)&&(this["_"+name]=null!==current),this._content&&this.updateScrollbar()}}]),ScrollbarElement}(BaseElement);window.OnsScrollbarElement=document.registerElement("ons-scrollbar",{prototype:ScrollbarElement.prototype});var scheme$17={"":"speed-dial__item--*"},SpeedDialItemElement=function(_BaseElement){function SpeedDialItemElement(){return babelHelpers.classCallCheck(this,SpeedDialItemElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(SpeedDialItemElement).apply(this,arguments))}return babelHelpers.inherits(SpeedDialItemElement,_BaseElement),babelHelpers.createClass(SpeedDialItemElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile(),this._boundOnClick=this._onClick.bind(this)}},{key:"attributeChangedCallback",value:function(name,last,current){switch(name){case"modifier":ModifierUtil.onModifierChanged(last,current,this,scheme$17);break;case"ripple":this._updateRipple()}}},{key:"attachedCallback",value:function(){this.addEventListener("click",this._boundOnClick,!1)}},{key:"detachedCallback",value:function(){this.removeEventListener("click",this._boundOnClick,!1)}},{key:"_updateRipple",value:function(){util.updateRipple(this)}},{key:"_onClick",value:function(e){e.stopPropagation()}},{key:"_compile",value:function(){autoStyle.prepare(this),this.classList.add("fab"),this.classList.add("fab--mini"),this.classList.add("speed-dial__item"),this._updateRipple(),ModifierUtil.initModifier(this,scheme$17),this.setAttribute("_compiled","")}}]),SpeedDialItemElement}(BaseElement);window.OnsSpeedDialItemElement=document.registerElement("ons-speed-dial-item",{prototype:SpeedDialItemElement.prototype});var scheme$18={"":"speed-dial--*"},SpeedDialElement=function(_BaseElement){function SpeedDialElement(){return babelHelpers.classCallCheck(this,SpeedDialElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(SpeedDialElement).apply(this,arguments))}return babelHelpers.inherits(SpeedDialElement,_BaseElement),babelHelpers.createClass(SpeedDialElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||(this._compile(),this.classList.add("speed__dial"),this._updateDirection(this.hasAttribute("direction")?this.getAttribute("direction"):"up"),this._updatePosition(),this.hasAttribute("disabled")&&this.setDisabled(!0)),this._shown=!0,this._itemShown=!1,this._boundOnClick=this._onClick.bind(this)}},{key:"_compile",value:function(){autoStyle.prepare(this);var content=document.createElement("ons-fab");util.arrayFrom(this.childNodes).forEach(function(node){8==node.nodeType||3===node.nodeType&&!/\S/.test(node.nodeValue)?node.remove():"ons-speed-dial-item"!==node.nodeName.toLowerCase()&&util.findChild(content,"span").appendChild(node)}),this.insertBefore(content,this.firstChild),this._updateRipple(),ModifierUtil.initModifier(this,scheme$18),this.setAttribute("_compiled","")}},{key:"attributeChangedCallback",value:function(name,last,current){switch(name){case"modifier":ModifierUtil.onModifierChanged(last,current,this,scheme$18);break;case"ripple":this._updateRipple();break;case"direction":this._updateDirection(current);break;case"position":this._updatePosition();break;case"disabled":this.setDisabled(null!==current)}}},{key:"attachedCallback",value:function(){this.addEventListener("click",this._boundOnClick,!1)}},{key:"detachedCallback",value:function(){this.removeEventListener("click",this._boundOnClick,!1)}},{key:"_onClick",value:function(e){this.isDisabled()||this.toggleItems()}},{key:"_show",value:function(){this.isInline()||this.show()}},{key:"_hide",value:function(){this.isInline()||this.hide()}},{key:"_updateRipple",value:function(){var fab=util.findChild(this,"ons-fab");this.hasAttribute("ripple")?fab.setAttribute("ripple",""):fab.removeAttribute("ripple")}},{key:"_updateDirection",value:function(direction){for(var children=this.items,i=0;i<children.length;i++)children[i].style.transitionDelay=25*i+"ms",children[i].style.webkitTransitionDelay=25*i+"ms",children[i].style.bottom="auto",children[i].style.right="auto",children[i].style.top="auto",children[i].style.left="auto";switch(direction){case"up":for(var i=0;i<children.length;i++)children[i].style.bottom=72+56*i+"px",children[i].style.right="8px";break;case"down":for(var i=0;i<children.length;i++)children[i].style.top=72+56*i+"px",children[i].style.left="8px";break;case"left":for(var i=0;i<children.length;i++)children[i].style.top="8px",children[i].style.right=72+56*i+"px";break;case"right":for(var i=0;i<children.length;i++)children[i].style.top="8px",children[i].style.left=72+56*i+"px";break;default:throw new Error("Argument must be one of up, down, left or right.")}}},{key:"_updatePosition",value:function(){var position=this.getAttribute("position");switch(this.classList.remove("fab--top__left","fab--bottom__right","fab--bottom__left","fab--top__right","fab--top__center","fab--bottom__center"),position){case"top right":case"right top":this.classList.add("fab--top__right");break;case"top left":case"left top":this.classList.add("fab--top__left");break;case"bottom right":case"right bottom":this.classList.add("fab--bottom__right");break;case"bottom left":case"left bottom":this.classList.add("fab--bottom__left");break;case"center top":case"top center":this.classList.add("fab--top__center");break;case"center bottom":case"bottom center":this.classList.add("fab--bottom__center")}}},{key:"show",value:function(){arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.querySelector("ons-fab").show(),this._shown=!0}},{key:"hide",value:function(){{var _this2=this;arguments.length<=0||void 0===arguments[0]?{}:arguments[0]}this.hideItems(),setTimeout(function(){_this2.querySelector("ons-fab").hide()},200),this._shown=!1}},{key:"showItems",value:function(){if(!this._itemShown)for(var children=this.items,i=0;i<children.length;i++)children[i].style.transform="scale(1)",children[i].style.webkitTransform="scale(1)",children[i].style.transitionDelay=25*i+"ms",children[i].style.webkitTransitionDelay=25*i+"ms";this._itemShown=!0}},{key:"hideItems",value:function(){if(this._itemShown)for(var children=this.items,i=0;i<children.length;i++)children[i].style.transform="scale(0)",children[i].style.webkitTransform="scale(0)",children[i].style.transitionDelay=25*(children.length-i)+"ms",children[i].style.webkitTransitionDelay=25*(children.length-i)+"ms";this._itemShown=!1}},{key:"setDisabled",value:function(disabled){if("boolean"!=typeof disabled)throw new Error("Argument must be a boolean.");disabled?(this.hideItems(),this.setAttribute("disabled",""),util.arrayFrom(this.childNodes).forEach(function(element){return element.classList.contains("fab")?element.setAttribute("disabled",""):!0})):(this.removeAttribute("disabled"),util.arrayFrom(this.childNodes).forEach(function(element){return element.classList.contains("fab")?element.removeAttribute("disabled"):!0}))}},{key:"isDisabled",value:function(){return this.hasAttribute("disabled")}},{key:"isInline",value:function(){return this.hasAttribute("inline")}},{key:"isShown",value:function(){return this._shown&&"none"!==this.style.display}},{key:"isItemShown",value:function(){return this._itemShown}},{key:"toggle",value:function(){this.isShown()?this.hide():this.show()}},{key:"toggleItems",value:function(){this.isItemShown()?this.hideItems():this.showItems()}},{key:"items",get:function(){return util.arrayFrom(this.querySelectorAll("ons-speed-dial-item"))}}]),SpeedDialElement}(BaseElement);window.OnsSpeedDialElement=document.registerElement("ons-speed-dial",{prototype:SpeedDialElement.prototype});var rewritables$1={ready:function(element,callback){setImmediate(callback)},link:function(element,target,options,callback){callback(target)}},SplitterContentElement=function(_BaseElement){function SplitterContentElement(){return babelHelpers.classCallCheck(this,SplitterContentElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(SplitterContentElement).apply(this,arguments))}return babelHelpers.inherits(SplitterContentElement,_BaseElement),babelHelpers.createClass(SplitterContentElement,[{key:"createdCallback",value:function(){this._page=null}},{key:"attachedCallback",value:function(){if(!util.match(this.parentNode,"ons-splitter"))throw new Error('"ons-splitter-content" must have "ons-splitter" as parentNode.');this.attributeChangedCallback("page",null,this.getAttribute("page"))}},{key:"detachedCallback",value:function(){}},{key:"attributeChangedCallback",value:function(name,last,current){var _this2=this;"page"===name&&null!==current&&rewritables$1.ready(this,function(){return _this2.load(current)})}},{key:"load",value:function(page){var _this3=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this._page=page;var callback=options.callback;return internal.getPageHTMLAsync(page).then(function(html){return new Promise(function(resolve){rewritables$1.link(_this3,util.createFragment(html),options,function(fragment){_this3._hide(),_this3.innerHTML="",_this3.appendChild(fragment),_this3._show(),callback&&callback(),resolve(_this3.firstChild)})})})}},{key:"_show",value:function(){util.propagateAction(this,"_show")}},{key:"_hide",value:function(){util.propagateAction(this,"_hide")}},{key:"_destroy",value:function(){util.propagateAction(this,"_destroy"),this.remove()}},{key:"page",get:function(){return this._page}}]),SplitterContentElement}(BaseElement);window.OnsSplitterContentElement=document.registerElement("ons-splitter-content",{prototype:SplitterContentElement.prototype}),window.OnsSplitterContentElement.rewritables=rewritables$1;var SplitterMaskElement=function(_BaseElement){function SplitterMaskElement(){return babelHelpers.classCallCheck(this,SplitterMaskElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(SplitterMaskElement).apply(this,arguments))}return babelHelpers.inherits(SplitterMaskElement,_BaseElement),babelHelpers.createClass(SplitterMaskElement,[{key:"createdCallback",value:function(){this._boundOnClick=this._onClick.bind(this)}},{key:"_onClick",value:function(event){util.match(this.parentNode,"ons-splitter")&&this.parentNode._sides.forEach(function(side){return side.close("left")["catch"](function(){})}),event.stopPropagation()}},{key:"attributeChangedCallback",value:function(name,last,current){}},{key:"attachedCallback",value:function(){this.addEventListener("click",this._boundOnClick)}},{key:"detachedCallback",value:function(){this.removeEventListener("click",this._boundOnClick)}}]),SplitterMaskElement}(BaseElement);window.OnsSplitterMaskElement=document.registerElement("ons-splitter-mask",{prototype:SplitterMaskElement.prototype});var SplitterAnimator=function(){function SplitterAnimator(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];babelHelpers.classCallCheck(this,SplitterAnimator),this._options={timing:"cubic-bezier(.1, .7, .1, 1)",duration:"0.3",delay:"0"},this.updateOptions(options)}return babelHelpers.createClass(SplitterAnimator,[{key:"updateOptions",value:function(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];util.extend(this._options,options),this._timing=this._options.timing,this._duration=this._options.duration,this._delay=this._options.delay}},{key:"activate",value:function(sideElement){var splitter=sideElement.parentNode;this._side=sideElement,this._content=splitter.content,this._mask=splitter.mask}},{key:"inactivate",value:function(){this._content=this._side=this._mask=null}},{key:"translate",value:function(distance){animit(this._side).queue({transform:"translate3d("+(this.minus+distance)+"px, 0px, 0px)"}).play()}},{key:"open",value:function(done){animit.runAll(animit(this._side).wait(this._delay).queue({transform:"translate3d("+this.minus+"100%, 0px, 0px)"},{duration:this._duration,timing:this._timing}).queue(function(callback){callback(),done&&done()}),animit(this._mask).wait(this._delay).queue({display:"block"}).queue({opacity:"1"},{duration:this._duration,timing:"linear"}))}},{key:"close",value:function(done){var _this=this;animit.runAll(animit(this._side).wait(this._delay).queue({transform:"translate3d(0px, 0px, 0px)"},{duration:this._duration,timing:this._timing}).queue(function(callback){_this._side.style.webkitTransition="",done&&done(),callback()}),animit(this._mask).wait(this._delay).queue({opacity:"0"},{duration:this._duration,timing:"linear"}).queue({display:"none"}))}},{key:"minus",get:function(){return"right"===this._side._side?"-":""}}]),SplitterAnimator}(),SPLIT_MODE="split",COLLAPSE_MODE="collapse",CLOSED_STATE="closed",OPEN_STATE="open",CHANGING_STATE="changing",rewritables$2={ready:function(splitterSideElement,callback){setImmediate(callback)},link:function(splitterSideElement,target,options,callback){callback(target)}},CollapseDetection=function(){function CollapseDetection(element,target){babelHelpers.classCallCheck(this,CollapseDetection),this._element=element,this._boundOnChange=this._onChange.bind(this),target&&this.changeTarget(target)}return babelHelpers.createClass(CollapseDetection,[{key:"changeTarget",value:function(target){this.disable(),this._target=target,target&&(this._orientation=-1!==["portrait","landscape"].indexOf(target),this.activate())}},{key:"_match",value:function(value){return this._orientation?this._target===(value.isPortrait?"portrait":"landscape"):value.matches}},{key:"_onChange",value:function(value){this._element._updateMode(this._match(value)?COLLAPSE_MODE:SPLIT_MODE)}},{key:"activate",value:function(){this._orientation?(ons.orientation.on("change",this._boundOnChange),this._onChange({isPortrait:ons.orientation.isPortrait()})):(this._queryResult=window.matchMedia(this._target),this._queryResult.addListener(this._boundOnChange),this._onChange(this._queryResult))}},{key:"disable",value:function(){this._orientation?ons.orientation.off("change",this._boundOnChange):this._queryResult&&(this._queryResult.removeListener(this._boundOnChange),this._queryResult=null)}}]),CollapseDetection}(),widthToPx=function(width,parent){var value=parseInt(width,10),px=/px/.test(width);return px?value:Math.round(parent.offsetWidth*value/100)},CollapseMode=function(){function CollapseMode(element){babelHelpers.classCallCheck(this,CollapseMode),this._active=!1,this._state=CLOSED_STATE,this._element=element,this._lock=new DoorLock}return babelHelpers.createClass(CollapseMode,[{key:"_animator",get:function(){return this._element._animator}}]),babelHelpers.createClass(CollapseMode,[{key:"isOpen",value:function(){return this._active&&this._state!==CLOSED_STATE}},{key:"handleGesture",value:function(e){!this._active||this._lock.isLocked()||this._isOpenOtherSideMenu()||("dragstart"===e.type?this._onDragStart(e):this._ignoreDrag||("dragend"===e.type?this._onDragEnd(e):this._onDrag(e)))}},{key:"_onDragStart",value:function(event){var scrolling=!/left|right/.test(event.gesture.direction),distance="left"===this._element._side?event.gesture.center.clientX:window.innerWidth-event.gesture.center.clientX,area=this._element._swipeTargetWidth,isOpen=this.isOpen();this._ignoreDrag=scrolling||area&&distance>area,this._width=widthToPx(this._element._width,this._element.parentNode),this._startDistance=this._distance=isOpen?this._width:0}},{key:"_onDrag",value:function(event){event.gesture.preventDefault();var delta="left"===this._element._side?event.gesture.deltaX:-event.gesture.deltaX,distance=Math.max(0,Math.min(this._width,this._startDistance+delta));distance!==this._distance&&(this._animator.translate(distance),this._distance=distance,this._state=CHANGING_STATE)}},{key:"_onDragEnd",value:function(event){var distance=this._distance,width=this._width,el=this._element,direction=event.gesture.interimDirection,shouldOpen=el._side!==direction&&distance>width*el._threshold;this.executeAction(shouldOpen?"open":"close")}},{key:"layout",value:function(){this._active&&this._state===OPEN_STATE&&this._animator.open()}},{key:"enterMode",value:function(){this._active||(this._active=!0,this.layout())}},{key:"exitMode",value:function(){this._active=!1}},{key:"_isOpenOtherSideMenu",value:function(){var _this=this;return util.arrayFrom(this._element.parentElement.children).some(function(e){return util.match(e,"ons-splitter-side")&&e!==_this._element&&e.isOpen()})}},{key:"executeAction",value:function(name){var _this2=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],FINAL_STATE="open"===name?OPEN_STATE:CLOSED_STATE;if(!this._active)return Promise.resolve(!1);if(this._state===FINAL_STATE)return Promise.resolve(this._element);if(this._lock.isLocked())return Promise.reject("Splitter side is locked.");if("open"===name&&this._isOpenOtherSideMenu())return Promise.reject("Another menu is already open.");if(this._element._emitEvent("pre"+name))return Promise.reject("Canceled in pre"+name+" event.");var callback=options.callback,unlock=this._lock.lock(),done=function(){_this2._state=FINAL_STATE,_this2.layout(),unlock(),_this2._element._emitEvent("post"+name),callback&&callback()};return options.withoutAnimation?(done(),Promise.resolve(this._element)):(this._state=CHANGING_STATE,new Promise(function(resolve){_this2._animator[name](function(){done(),resolve(_this2._element)})}))}}]),CollapseMode}(),SplitterSideElement=function(_BaseElement){function SplitterSideElement(){return babelHelpers.classCallCheck(this,SplitterSideElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(SplitterSideElement).apply(this,arguments))}return babelHelpers.inherits(SplitterSideElement,_BaseElement),babelHelpers.createClass(SplitterSideElement,[{key:"createdCallback",value:function(){var _this4=this;this._collapseMode=new CollapseMode(this),this._collapseDetection=new CollapseDetection(this),this._animatorFactory=new AnimatorFactory({animators:window.OnsSplitterElement._animatorDict,baseClass:SplitterAnimator,baseClassName:"SplitterAnimator",defaultAnimation:this.getAttribute("animation")}),this._boundHandleGesture=function(e){return _this4._collapseMode.handleGesture(e)},this._watchedAttributes=["animation","width","side","collapse","swipeable","swipe-target-width","animation-options","open-threshold","page"]}},{key:"attachedCallback",value:function(){var _this5=this;if(!util.match(this.parentNode,"ons-splitter"))throw new Error("Parent must be an ons-splitter element.");this._gestureDetector=new GestureDetector(this.parentElement,{dragMinDistance:1}),this._watchedAttributes.forEach(function(e){return _this5._update(e)})}},{key:"detachedCallback",value:function(){this._collapseDetection.disable(),this._gestureDetector.dispose(),this._gestureDetector=null}},{key:"attributeChangedCallback",value:function(name,last,current){-1!==this._watchedAttributes.indexOf(name)&&this._update(name,current)}},{key:"_update",value:function(name,value){return name="_update"+name.split("-").map(function(e){return e[0].toUpperCase()+e.slice(1)}).join(""),this[name](value)}},{key:"_emitEvent",value:function(name){if("pre"!==name.slice(0,3))return util.triggerElementEvent(this,name,{side:this});var isCanceled=!1;return util.triggerElementEvent(this,name,{side:this,cancel:function(){return isCanceled=!0}}),isCanceled}},{key:"_updateCollapse",value:function(){var value=arguments.length<=0||void 0===arguments[0]?this.getAttribute("collapse"):arguments[0];return null===value||"split"===value?(this._collapseDetection.disable(),this._updateMode(SPLIT_MODE)):""===value||"collapse"===value?(this._collapseDetection.disable(),this._updateMode(COLLAPSE_MODE)):void this._collapseDetection.changeTarget(value)}},{key:"_updateMode",value:function(mode){mode!==this._mode&&(this._mode=mode,this._collapseMode[mode===COLLAPSE_MODE?"enterMode":"exitMode"](),this.setAttribute("mode",mode),util.triggerElementEvent(this,"modechange",{side:this,mode:mode}))}},{key:"_updatePage",value:function(){var _this6=this,page=arguments.length<=0||void 0===arguments[0]?this.getAttribute("page"):arguments[0];null!==page&&rewritables$2.ready(this,function(){return _this6.load(page)})}},{key:"_updateOpenThreshold",value:function(){var threshold=arguments.length<=0||void 0===arguments[0]?this.getAttribute("open-threshold"):arguments[0];this._threshold=Math.max(0,Math.min(1,parseFloat(threshold)||.3))}},{key:"_updateSwipeable",value:function(){var swipeable=arguments.length<=0||void 0===arguments[0]?this.getAttribute("swipeable"):arguments[0],action=null===swipeable?"off":"on";this._gestureDetector[action]("dragstart dragleft dragright dragend",this._boundHandleGesture)}},{key:"_updateSwipeTargetWidth",value:function(){var value=arguments.length<=0||void 0===arguments[0]?this.getAttribute("swipe-target-width"):arguments[0];this._swipeTargetWidth=Math.max(0,parseInt(value)||0)}},{key:"_updateWidth",value:function(){var width=arguments.length<=0||void 0===arguments[0]?this.getAttribute("width"):arguments[0];this._width=/^\d+(px|%)$/.test(width)?width:"80%",this.style.width=this._width}},{key:"_updateSide",value:function(){var side=arguments.length<=0||void 0===arguments[0]?this.getAttribute("side"):arguments[0];this._side="right"===side?side:"left"}},{key:"_updateAnimation",value:function(){var animation=arguments.length<=0||void 0===arguments[0]?this.getAttribute("animation"):arguments[0];this._animator=this._animatorFactory.newAnimator({animation:animation}),this._animator.activate(this)}},{key:"_updateAnimationOptions",value:function(){var value=arguments.length<=0||void 0===arguments[0]?this.getAttribute("animation-options"):arguments[0];this._animator.updateOptions(AnimatorFactory.parseAnimationOptionsString(value))}},{key:"isOpen",value:function(){return this._collapseMode.isOpen()}},{key:"open",value:function(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return this._collapseMode.executeAction("open",options)}},{key:"close",value:function(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return this._collapseMode.executeAction("close",options)}},{key:"toggle",value:function(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return this.isOpen()?this.close(options):this.open(options)}},{key:"load",value:function(page){var _this7=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this._page=page;var callback=options.callback;return internal.getPageHTMLAsync(page).then(function(html){return new Promise(function(resolve){rewritables$2.link(_this7,util.createFragment(html),options,function(fragment){_this7._hide(),_this7.innerHTML="",_this7.appendChild(fragment),_this7._show(),callback&&callback(),resolve(_this7.firstChild)})})})}},{key:"_show",value:function(){util.propagateAction(this,"_show")}},{key:"_hide",value:function(){util.propagateAction(this,"_hide")}},{key:"_destroy",value:function(){util.propagateAction(this,"_destroy"),this.remove()}},{key:"page",get:function(){return this._page}},{key:"mode",get:function(){return this._mode}}]),SplitterSideElement}(BaseElement);window.OnsSplitterSideElement=document.registerElement("ons-splitter-side",{prototype:SplitterSideElement.prototype}),window.OnsSplitterSideElement.rewritables=rewritables$2;var SplitterElement=function(_BaseElement){function SplitterElement(){return babelHelpers.classCallCheck(this,SplitterElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(SplitterElement).apply(this,arguments))}return babelHelpers.inherits(SplitterElement,_BaseElement),babelHelpers.createClass(SplitterElement,[{key:"_getSide",value:function(side){var element=util.findChild(this,function(e){return util.match(e,"ons-splitter-side")&&e.getAttribute("side")===side});return element&&CustomElements.upgrade(element),element}},{key:"_onDeviceBackButton",value:function(handler){this._sides.some(function(s){return s.isOpen()?s.close():!1})||handler.callParentHandler()}},{key:"_onModeChange",value:function(e){e.target.parentNode&&this._layout()}},{key:"_layout",value:function(){var _this2=this;this._sides.forEach(function(side){_this2.content.style[side._side]="split"===side.mode?side._width:0})}},{key:"createdCallback",value:function(){this._boundOnDeviceBackButton=this._onDeviceBackButton.bind(this),this._boundOnModeChange=this._onModeChange.bind(this)}},{key:"attachedCallback",value:function(){var _this3=this;this._backButtonHandler=deviceBackButtonDispatcher.createHandler(this,this._boundOnDeviceBackButton),this.addEventListener("modechange",this._boundOnModeChange,!1),setImmediate(function(){return _this3._layout()})}},{key:"detachedCallback",value:function(){this._backButtonHandler.destroy(),this._backButtonHandler=null,this.removeEventListener("modechange",this._boundOnModeChange,!1)}},{key:"attributeChangedCallback",value:function(name,last,current){}},{key:"_show",value:function(){util.propagateAction(this,"_show")}},{key:"_hide",value:function(){util.propagateAction(this,"_hide")}},{key:"_destroy",value:function(){util.propagateAction(this,"_destroy"),this.remove()}},{key:"left",get:function(){return this._getSide("left")}},{key:"right",get:function(){return this._getSide("right")}},{key:"_sides",get:function(){return[this.left,this.right].filter(function(e){return e})}},{key:"content",get:function(){return util.findChild(this,"ons-splitter-content")||this.appendChild(document.createElement("ons-splitter-content"))}},{key:"mask",get:function(){return util.findChild(this,"ons-splitter-mask")||this.appendChild(document.createElement("ons-splitter-mask"))}},{key:"backButtonHandler",get:function(){return this._backButtonHandler}}]),SplitterElement}(BaseElement);window.OnsSplitterElement=document.registerElement("ons-splitter",{prototype:SplitterElement.prototype}),window.OnsSplitterElement._animatorDict={"default":SplitterAnimator,overlay:SplitterAnimator},window.OnsSplitterElement.registerAnimator=function(name,Animator){if(!(Animator instanceof SplitterAnimator))throw new Error("Animator parameter must be an instance of SplitterAnimator.");window.OnsSplitterElement._animatorDict[name]=Animator},window.OnsSplitterElement.SplitterAnimator=SplitterAnimator;var scheme$19={"":"switch--*",".switch__input":"switch--*__input",".switch__handle":"switch--*__handle",".switch__toggle":"switch--*__toggle"},template$2=util.createFragment('\n <input type="checkbox" class="switch__input">\n <div class="switch__toggle">\n <div class="switch__handle">\n <div class="switch__touch"></div>\n </div>\n </div>\n'),locations={ios:[1,21],material:[0,16]},SwitchElement=function(_BaseElement){function SwitchElement(){return babelHelpers.classCallCheck(this,SwitchElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(SwitchElement).apply(this,arguments))}return babelHelpers.inherits(SwitchElement,_BaseElement),babelHelpers.createClass(SwitchElement,[{key:"isChecked",value:function(){return this.checked}},{key:"setChecked",value:function(isChecked){this.checked=!!isChecked}},{key:"getCheckboxElement",value:function(){return this._checkbox}},{key:"createdCallback",value:function(){var _this2=this;this.hasAttribute("_compiled")||this._compile(),this._checkbox=this.querySelector(".switch__input"),this._handle=this.querySelector(".switch__handle"),["checked","disabled","modifier","name","input-id"].forEach(function(e){_this2.attributeChangedCallback(e,null,_this2.getAttribute(e))})}},{key:"_compile",value:function(){autoStyle.prepare(this),this.classList.add("switch"),this.appendChild(template$2.cloneNode(!0)),this.setAttribute("_compiled","")}},{key:"detachedCallback",value:function(){this._checkbox.removeEventListener("change",this._onChange),this.removeEventListener("dragstart",this._onDragStart),this.removeEventListener("hold",this._onHold),this.removeEventListener("tap",this.click),this.removeEventListener("click",this._onClick),this._gestureDetector.dispose();
}},{key:"attachedCallback",value:function(){this._checkbox.addEventListener("change",this._onChange),this._gestureDetector=new GestureDetector(this,{dragMinDistance:1,holdTimeout:251}),this.addEventListener("dragstart",this._onDragStart),this.addEventListener("hold",this._onHold),this.addEventListener("tap",this.click),this._boundOnRelease=this._onRelease.bind(this),this.addEventListener("click",this._onClick)}},{key:"_onChange",value:function(){this.checked?this.parentNode.setAttribute("checked",""):this.parentNode.removeAttribute("checked")}},{key:"_onClick",value:function(ev){ev.target.classList.contains("switch__touch")&&ev.preventDefault()}},{key:"click",value:function(){this.disabled||(this.checked=!this.checked,util.triggerElementEvent(this.getCheckboxElement(),"change"))}},{key:"_getPosition",value:function(e){var l=this._locations;return Math.min(l[1],Math.max(l[0],this._startX+e.gesture.deltaX))}},{key:"_onHold",value:function(e){this.disabled||(this.classList.add("switch--active"),document.addEventListener("release",this._boundOnRelease))}},{key:"_onDragStart",value:function(e){return this.disabled||-1===["left","right"].indexOf(e.gesture.direction)?void this.classList.remove("switch--active"):(this.classList.add("switch--active"),this._startX=this._locations[this.checked?1:0],this.addEventListener("drag",this._onDrag),void document.addEventListener("release",this._boundOnRelease))}},{key:"_onDrag",value:function(e){e.gesture.srcEvent.preventDefault(),this._handle.style.left=this._getPosition(e)+"px"}},{key:"_onRelease",value:function(e){var l=this._locations,position=this._getPosition(e);this.checked=position>=(l[0]+l[1])/2,this.removeEventListener("drag",this._onDrag),document.removeEventListener("release",this._boundOnRelease),this._handle.style.left="",this.classList.remove("switch--active")}},{key:"attributeChangedCallback",value:function(name,last,current){switch(name){case"modifier":this._isMaterial=-1!==(current||"").indexOf("material"),this._locations=locations[this._isMaterial?"material":"ios"],ModifierUtil.onModifierChanged(last,current,this,scheme$19);break;case"input-id":this._checkbox.id=current;break;case"checked":this._checkbox.checked=null!==current;case"disabled":null!==current?this._checkbox.setAttribute(name,""):this._checkbox.removeAttribute(name)}}},{key:"checked",get:function(){return this._checkbox.checked},set:function(value){!!value!==this._checkbox.checked&&(this._checkbox.click(),this._checkbox.checked=!!value,this.checked?this.setAttribute("checked",""):this.removeAttribute("checked"))}},{key:"disabled",get:function(){return this._checkbox.disabled},set:function(value){this._checkbox.disabled=value,this.disabled?this.setAttribute("disabled",""):this.removeAttribute("disabled")}}]),SwitchElement}(BaseElement);window.OnsSwitchElement=document.registerElement("ons-switch",{prototype:SwitchElement.prototype});var TabbarAnimator=function(){function TabbarAnimator(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];babelHelpers.classCallCheck(this,TabbarAnimator),this.timing=options.timing||"linear",this.duration=void 0!==options.duration?options.duration:"0.4",this.delay=void 0!==options.delay?options.delay:"0"}return babelHelpers.createClass(TabbarAnimator,[{key:"apply",value:function(enterPage,leavePage,enterPageIndex,leavePageIndex,done){throw new Error("This method must be implemented.")}}]),TabbarAnimator}(),TabbarNoneAnimator=function(_TabbarAnimator){function TabbarNoneAnimator(){return babelHelpers.classCallCheck(this,TabbarNoneAnimator),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(TabbarNoneAnimator).apply(this,arguments))}return babelHelpers.inherits(TabbarNoneAnimator,_TabbarAnimator),babelHelpers.createClass(TabbarNoneAnimator,[{key:"apply",value:function(enterPage,leavePage,enterIndex,leaveIndex,done){setTimeout(done,1e3/60)}}]),TabbarNoneAnimator}(TabbarAnimator),TabbarFadeAnimator=function(_TabbarAnimator2){function TabbarFadeAnimator(options){return babelHelpers.classCallCheck(this,TabbarFadeAnimator),options.timing=void 0!==options.timing?options.timing:"linear",options.duration=void 0!==options.duration?options.duration:"0.4",options.delay=void 0!==options.delay?options.delay:"0",babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(TabbarFadeAnimator).call(this,options))}return babelHelpers.inherits(TabbarFadeAnimator,_TabbarAnimator2),babelHelpers.createClass(TabbarFadeAnimator,[{key:"apply",value:function(enterPage,leavePage,enterPageIndex,leavePageIndex,done){animit.runAll(animit(enterPage).saveStyle().queue({transform:"translate3D(0, 0, 0)",opacity:0}).wait(this.delay).queue({transform:"translate3D(0, 0, 0)",opacity:1},{duration:this.duration,timing:this.timing}).restoreStyle().queue(function(callback){done(),callback()}),animit(leavePage).queue({transform:"translate3D(0, 0, 0)",opacity:1}).wait(this.delay).queue({transform:"translate3D(0, 0, 0)",opacity:0},{duration:this.duration,timing:this.timing}))}}]),TabbarFadeAnimator}(TabbarAnimator),TabbarSlideAnimator=function(_TabbarAnimator3){function TabbarSlideAnimator(options){return babelHelpers.classCallCheck(this,TabbarSlideAnimator),options.timing=void 0!==options.timing?options.timing:"ease-in",options.duration=void 0!==options.duration?options.duration:"0.15",options.delay=void 0!==options.delay?options.delay:"0",babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(TabbarSlideAnimator).call(this,options))}return babelHelpers.inherits(TabbarSlideAnimator,_TabbarAnimator3),babelHelpers.createClass(TabbarSlideAnimator,[{key:"apply",value:function(enterPage,leavePage,enterIndex,leaveIndex,done){var sgn=enterIndex>leaveIndex;animit.runAll(animit(enterPage).saveStyle().queue({transform:"translate3D("+(sgn?"":"-")+"100%, 0, 0)"}).wait(this.delay).queue({transform:"translate3D(0, 0, 0)"},{duration:this.duration,timing:this.timing}).restoreStyle().queue(function(callback){done(),callback()}),animit(leavePage).queue({transform:"translate3D(0, 0, 0)"}).wait(this.delay).queue({transform:"translate3D("+(sgn?"-":"")+"100%, 0, 0)"},{duration:this.duration,timing:this.timing}))}}]),TabbarSlideAnimator}(TabbarAnimator),scheme$21={".tab-bar__content":"tab-bar--*__content",".tab-bar":"tab-bar--*"},_animatorDict$5={"default":TabbarNoneAnimator,fade:TabbarFadeAnimator,slide:TabbarSlideAnimator,none:TabbarNoneAnimator},rewritables$3={ready:function(tabbarElement,callback){callback()},link:function(tabbarElement,target,options,callback){callback(target)},unlink:function(tabbarElement,target,callback){callback(target)}},generateId$1=function(){var i=0;return function(){return"ons-tabbar-gen-"+i++}}(),TabbarElement=function(_BaseElement){function TabbarElement(){return babelHelpers.classCallCheck(this,TabbarElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(TabbarElement).apply(this,arguments))}return babelHelpers.inherits(TabbarElement,_BaseElement),babelHelpers.createClass(TabbarElement,[{key:"createdCallback",value:function(){this._tabbarId=generateId$1(),this.hasAttribute("_compiled")||this._compile(),this._contentElement=util.findChild(this,".tab-bar__content"),this._animatorFactory=new AnimatorFactory({animators:_animatorDict$5,baseClass:TabbarAnimator,baseClassName:"TabbarAnimator",defaultAnimation:this.getAttribute("animation")})}},{key:"_compile",value:function(){autoStyle.prepare(this),"auto"===this.getAttribute("position")&&this.setAttribute("position",platform.isAndroid()?"top":"bottom");var wrapper=document.createDocumentFragment(),content=document.createElement("div");content.classList.add("ons-tab-bar__content"),content.classList.add("tab-bar__content");var tabbar=document.createElement("div");for(tabbar.classList.add("tab-bar"),tabbar.classList.add("ons-tab-bar__footer"),tabbar.classList.add("ons-tabbar-inner"),wrapper.appendChild(content),wrapper.appendChild(tabbar);this.childNodes[0];)tabbar.appendChild(this.removeChild(this.childNodes[0]));this.appendChild(wrapper),this._hasTopTabbar()&&this._prepareForTopTabbar(),ModifierUtil.initModifier(this,scheme$21),this.setAttribute("_compiled","")}},{key:"_hasTopTabbar",value:function(){return"top"===this.getAttribute("position")}},{key:"_prepareForTopTabbar",value:function(){var _this2=this,content=util.findChild(this,".tab-bar__content"),tabbar=util.findChild(this,".tab-bar");content.setAttribute("no-status-bar-fill",""),content.classList.add("tab-bar--top__content"),tabbar.classList.add("tab-bar--top");var page=util.findParent(this,"ons-page");page&&(this.style.top=window.getComputedStyle(page._getContentElement(),null).getPropertyValue("padding-top"),"ons-toolbar"===page.firstChild.tagName.toLowerCase()&&util.addModifier(page.firstChild,"noshadow")),internal.shouldFillStatusBar(this).then(function(){var fill=_this2.querySelector(".tab-bar__status-bar-fill");return fill instanceof HTMLElement?fill:(fill=document.createElement("div"),fill.classList.add("tab-bar__status-bar-fill"),fill.style.width="0px",fill.style.height="0px",_this2.insertBefore(fill,_this2.children[0]),fill)})["catch"](function(){var el=_this2.querySelector(".tab-bar__status-bar-fill");el instanceof HTMLElement&&el.remove()})}},{key:"_getTabbarElement",value:function(){return util.findChild(this,".tab-bar")}},{key:"loadPage",value:function(page){var _this3=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Promise(function(resolve){OnsTabElement.prototype._createPageElement(page,function(pageElement){resolve(_this3._loadPageDOMAsync(pageElement,options))})})}},{key:"_loadPageDOMAsync",value:function(pageElement){var _this4=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Promise(function(resolve){rewritables$3.link(_this4,pageElement,options,function(pageElement){_this4._contentElement.appendChild(pageElement),-1!==_this4.getActiveTabIndex()?resolve(_this4._switchPage(pageElement,options)):(options.callback instanceof Function&&options.callback(),_this4._oldPageElement=pageElement,resolve(pageElement))})})}},{key:"getTabbarId",value:function(){return this._tabbarId}},{key:"_getCurrentPageElement",value:function(){for(var pages=this._contentElement.children,page=null,i=0;i<pages.length;i++)if("none"!==pages[i].style.display){page=pages[i];break}if(page&&"ons-page"!==page.nodeName.toLowerCase())throw new Error('Invalid state: page element must be a "ons-page" element.');return page}},{key:"_switchPage",value:function(element,options){var oldPageElement=this._oldPageElement||internal.nullElement;this._oldPageElement=element;var animator=this._animatorFactory.newAnimator(options);return new Promise(function(resolve){oldPageElement!==internal.nullElement&&oldPageElement._hide(),animator.apply(element,oldPageElement,options.selectedTabIndex,options.previousTabIndex,function(){oldPageElement!==internal.nullElement&&(oldPageElement.style.display="none"),element.style.display="block",element._show(),options.callback instanceof Function&&options.callback(),resolve(element)})})}},{key:"setActiveTab",value:function(index){var _this5=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(options&&"object"!=("undefined"==typeof options?"undefined":babelHelpers["typeof"](options)))throw new Error("options must be an object. You supplied "+options);options.animationOptions=util.extend(options.animationOptions||{},AnimatorFactory.parseAnimationOptionsString(this.getAttribute("animation-options"))),!options.animation&&this.hasAttribute("animation")&&(options.animation=this.getAttribute("animation"));var previousTab=this._getActiveTabElement(),selectedTab=this._getTabElement(index),previousTabIndex=this.getActiveTabIndex(),selectedTabIndex=index,previousPageElement=this._getCurrentPageElement();if(!selectedTab)return Promise.reject("Specified index does not match any tab.");if(selectedTabIndex===previousTabIndex)return util.triggerElementEvent(this,"reactive",{index:selectedTabIndex,tabItem:selectedTab}),Promise.resolve(previousPageElement);var canceled=!1;if(util.triggerElementEvent(this,"prechange",{index:selectedTabIndex,tabItem:selectedTab,cancel:function(){return canceled=!0}}),canceled)return selectedTab.setInactive(),previousTab&&previousTab.setActive(),Promise.reject("Canceled in prechange event.");selectedTab.setActive();var needLoad=!selectedTab.isLoaded()&&!options.keepPage;if(util.arrayFrom(this._getTabbarElement().children).forEach(function(tab){tab!=selectedTab?tab.setInactive():needLoad||util.triggerElementEvent(_this5,"postchange",{index:selectedTabIndex,tabItem:selectedTab})}),needLoad){var removeElement,params,_ret=function(){removeElement=!1,(!previousTab&&previousPageElement||previousTab&&previousTab._pageElement!==previousPageElement)&&(removeElement=!0),params={callback:function(){util.triggerElementEvent(_this5,"postchange",{index:selectedTabIndex,tabItem:selectedTab}),options.callback instanceof Function&&options.callback()},previousTabIndex:previousTabIndex,selectedTabIndex:selectedTabIndex},options.animation&&(params.animation=options.animation),params.animationOptions=options.animationOptions||{};var link=function(element,callback){rewritables$3.link(_this5,element,options,callback)};return{v:new Promise(function(resolve){selectedTab._loadPageElement(function(pageElement){resolve(_this5._loadPersistentPageDOM(pageElement,params))},link)})}}();if("object"===("undefined"==typeof _ret?"undefined":babelHelpers["typeof"](_ret)))return _ret.v}return Promise.resolve(previousPageElement)}},{key:"_loadPersistentPageDOM",value:function(element){var options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return util.isAttached(element)||this._contentElement.appendChild(element),element.removeAttribute("style"),this._switchPage(element,options)}},{key:"setTabbarVisibility",value:function(visible){this._contentElement.style[this._hasTopTabbar()?"top":"bottom"]=visible?"":"0px",this._getTabbarElement().style.display=visible?"":"none"}},{key:"getActiveTabIndex",value:function(){for(var tabs=this._getTabbarElement().children,i=0;i<tabs.length;i++)if(tabs[i]instanceof window.OnsTabElement&&tabs[i].isActive&&tabs[i].isActive())return i;return-1}},{key:"_getActiveTabElement",value:function(){return this._getTabElement(this.getActiveTabIndex())}},{key:"_getTabElement",value:function(index){return this._getTabbarElement().children[index]}},{key:"detachedCallback",value:function(){}},{key:"attachedCallback",value:function(){}},{key:"_show",value:function(){var currentPageElement=this._getCurrentPageElement();currentPageElement&¤tPageElement._show()}},{key:"_hide",value:function(){var currentPageElement=this._getCurrentPageElement();currentPageElement&¤tPageElement._hide()}},{key:"_destroy",value:function(){for(var pages=this._contentElement.children,i=pages.length-1;i>=0;i--)pages[i]._destroy();this.remove()}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$21):void 0}}]),TabbarElement}(BaseElement);window.OnsTabbarElement=document.registerElement("ons-tabbar",{prototype:TabbarElement.prototype}),window.OnsTabbarElement.registerAnimator=function(name,Animator){if(!(Animator.prototype instanceof TabbarAnimator))throw new Error('"Animator" param must inherit OnsTabbarElement.TabbarAnimator');_animatorDict$5[name]=Animator},window.OnsTabbarElement.rewritables=rewritables$3,window.OnsTabbarElement.TabbarAnimator=TabbarAnimator;var OnsTabbarElement$1=OnsTabbarElement,scheme$20={"":"tab-bar--*__item",".tab-bar__button":"tab-bar--*__button"},templateSource$3=util.createElement('\n <div>\n <input type="radio" style="display: none">\n <button class="tab-bar__button tab-bar-inner"></button>\n </div>\n'),defaultInnerTemplateSource=util.createElement('\n <div>\n <div class="tab-bar__icon">\n <ons-icon icon="ion-cloud" style="font-size: 28px; line-height: 34px; vertical-align: top;"></ons-icon>\n </div>\n <div class="tab-bar__label">label</div>\n </div>\n'),TabElement=function(_BaseElement){function TabElement(){return babelHelpers.classCallCheck(this,TabElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(TabElement).apply(this,arguments))}return babelHelpers.inherits(TabElement,_BaseElement),babelHelpers.createClass(TabElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile(),this._boundOnClick=this._onClick.bind(this)}},{key:"_compile",value:function(){autoStyle.prepare(this);for(var fragment=document.createDocumentFragment(),hasChildren=!1;this.childNodes[0];){var node=this.childNodes[0];this.removeChild(node),fragment.appendChild(node),node.nodeType==Node.ELEMENT_NODE&&(hasChildren=!0)}for(var template=templateSource$3.cloneNode(!0);template.children[0];)this.appendChild(template.children[0]);this.classList.add("tab-bar__item");var button=util.findChild(this,".tab-bar__button");hasChildren?(button.appendChild(fragment),this._hasDefaultTemplate=!1):(this._hasDefaultTemplate=!0,this._updateDefaultTemplate()),this._updateRipple(),ModifierUtil.initModifier(this,scheme$20),this.setAttribute("_compiled","")}},{key:"_updateRipple",value:function(){util.updateRipple(this)}},{key:"_updateDefaultTemplate",value:function(){function getLabelElement(){return self.querySelector(".tab-bar__label")}function getIconElement(){return self.querySelector("ons-icon")}if(this._hasDefaultTemplate){for(var button=util.findChild(this,".tab-bar__button"),template=defaultInnerTemplateSource.cloneNode(!0);template.children[0];)button.appendChild(template.children[0]);var self=this,icon=this.getAttribute("icon"),label=this.getAttribute("label");if("string"==typeof icon)getIconElement().setAttribute("icon",icon);else{var wrapper=button.querySelector(".tab-bar__icon");wrapper.parentNode.removeChild(wrapper)}"string"==typeof label?getLabelElement().textContent=label:getLabelElement().parentNode.removeChild(getLabelElement())}}},{key:"_onClick",value:function(){var tabbar=this._findTabbarElement();tabbar&&tabbar.setActiveTab(this._findTabIndex())}},{key:"setActive",value:function(){var radio=util.findChild(this,"input");radio.checked=!0,this.classList.add("active"),util.arrayFrom(this.querySelectorAll("[ons-tab-inactive], ons-tab-inactive")).forEach(function(element){return element.style.display="none"}),util.arrayFrom(this.querySelectorAll("[ons-tab-active], ons-tab-active")).forEach(function(element){return element.style.display="inherit"})}},{key:"setInactive",value:function(){var radio=util.findChild(this,"input");radio.checked=!1,this.classList.remove("active"),util.arrayFrom(this.querySelectorAll("[ons-tab-inactive], ons-tab-inactive")).forEach(function(element){return element.style.display="inherit"}),util.arrayFrom(this.querySelectorAll("[ons-tab-active], ons-tab-active")).forEach(function(element){return element.style.display="none"})}},{key:"isLoaded",value:function(){return!1}},{key:"_loadPageElement",value:function(callback,link){var _this2=this;this._pageElement?callback(this._pageElement):this._createPageElement(this.getAttribute("page"),function(element){link(element,function(element){_this2._pageElement=element,callback(element)})})}},{key:"_createPageElement",value:function(page,callback){internal.getPageHTMLAsync(page).then(function(html){callback(util.createElement(html.trim()))})}},{key:"isActive",value:function(){return this.classList.contains("active")}},{key:"detachedCallback",value:function(){this.removeEventListener("click",this._boundOnClick,!1)}},{key:"attachedCallback",value:function(){var _this3=this;this._ensureElementPosition();var tabbar=this._findTabbarElement();if(tabbar.hasAttribute("modifier")){var prefix=this.hasAttribute("modifier")?this.getAttribute("modifier")+" ":"";this.setAttribute("modifier",prefix+tabbar.getAttribute("modifier"))}this.hasAttribute("active")?!function(){var tabIndex=_this3._findTabIndex();OnsTabbarElement$1.rewritables.ready(tabbar,function(){setImmediate(function(){return tabbar.setActiveTab(tabIndex,{animation:"none"})})})}():OnsTabbarElement$1.rewritables.ready(tabbar,function(){setImmediate(function(){return _this3._createPageElement(_this3.getAttribute("page"),function(pageElement){OnsTabbarElement$1.rewritables.link(tabbar,pageElement,{},function(pageElement){_this3._pageElement=pageElement,_this3._pageElement.style.display="none",tabbar._contentElement.appendChild(_this3._pageElement)})})})}),this.addEventListener("click",this._boundOnClick,!1)}},{key:"_findTabbarElement",value:function(){return this.parentNode&&"ons-tabbar"===this.parentNode.nodeName.toLowerCase()?this.parentNode:this.parentNode.parentNode&&"ons-tabbar"===this.parentNode.parentNode.nodeName.toLowerCase()?this.parentNode.parentNode:null}},{key:"_findTabIndex",value:function(){for(var elements=this.parentNode.children,i=0;i<elements.length;i++)if(this===elements[i])return i}},{key:"_ensureElementPosition",value:function(){if(!this._findTabbarElement())throw new Error("This ons-tab element is must be child of ons-tabbar element.")}},{key:"attributeChangedCallback",value:function(name,last,current){switch(name){case"modifier":ModifierUtil.onModifierChanged(last,current,this,scheme$20);break;case"ripple":this._updateRipple();break;case"icon":case"label":this._updateDefaultTemplate()}}}]),TabElement}(BaseElement);window.OnsTabElement=document.registerElement("ons-tab",{prototype:TabElement.prototype}),document.registerElement("ons-tabbar-item",{prototype:Object.create(TabElement.prototype)});var scheme$22={"":"toolbar-button--*"},ToolbarButtonElement=function(_BaseElement){function ToolbarButtonElement(){return babelHelpers.classCallCheck(this,ToolbarButtonElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(ToolbarButtonElement).apply(this,arguments))}return babelHelpers.inherits(ToolbarButtonElement,_BaseElement),babelHelpers.createClass(ToolbarButtonElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile()}},{key:"_compile",value:function(){autoStyle.prepare(this),this.classList.add("toolbar-button"),ModifierUtil.initModifier(this,scheme$22),this.setAttribute("_compiled","")}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$22):void 0}}]),ToolbarButtonElement}(BaseElement);window.OnsToolbarButton=document.registerElement("ons-toolbar-button",{prototype:ToolbarButtonElement.prototype});var scheme$23={"":"navigation-bar--*",".navigation-bar__left":"navigation-bar--*__left",".navigation-bar__center":"navigation-bar--*__center",".navigation-bar__right":"navigation-bar--*__right"},ToolbarElement=function(_BaseElement){function ToolbarElement(){return babelHelpers.classCallCheck(this,ToolbarElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(ToolbarElement).apply(this,arguments))}return babelHelpers.inherits(ToolbarElement,_BaseElement),babelHelpers.createClass(ToolbarElement,[{key:"createdCallback",value:function(){var _this2=this;this.hasAttribute("_compiled")||this._compile(),this._tryToEnsureNodePosition(),setImmediate(function(){return _this2._tryToEnsureNodePosition()})}},{key:"attributeChangedCallback",value:function(name,last,current){return"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$23):void 0}},{key:"attachedCallback",value:function(){var _this3=this;this._tryToEnsureNodePosition(),setImmediate(function(){return _this3._tryToEnsureNodePosition()})}},{key:"_tryToEnsureNodePosition",value:function(){if(this.parentNode&&!this.hasAttribute("inline")){var page=util.findParent(this,"ons-page");page&&page!==this.parentNode&&page._registerToolbar(this)}}},{key:"_getToolbarLeftItemsElement",value:function(){return this.querySelector(".left")||internal.nullElement}},{key:"_getToolbarCenterItemsElement",value:function(){return this.querySelector(".center")||internal.nullElement}},{key:"_getToolbarRightItemsElement",value:function(){return this.querySelector(".right")||internal.nullElement}},{key:"_getToolbarBackButtonLabelElement",value:function(){return this.querySelector("ons-back-button .back-button__label")||internal.nullElement}},{key:"_compile",value:function(){autoStyle.prepare(this),this.classList.add("navigation-bar"),this._ensureToolbarItemElements(),ModifierUtil.initModifier(this,scheme$23),this.setAttribute("_compiled","")}},{key:"_ensureToolbarItemElements",value:function(){for(var hasCenterClassElementOnly=1===this.children.length&&this.children[0].classList.contains("center"),i=0;i<this.childNodes.length;i++)1!=this.childNodes[i].nodeType&&this.removeChild(this.childNodes[i]);var center=this._ensureToolbarElement("center");if(center.classList.add("navigation-bar__title"),!hasCenterClassElementOnly){var left=this._ensureToolbarElement("left"),right=this._ensureToolbarElement("right");(this.children[0]!==left||this.children[1]!==center||this.children[2]!==right)&&(left.parentNode&&this.removeChild(left),center.parentNode&&this.removeChild(center),right.parentNode&&this.removeChild(right),this.appendChild(left),this.appendChild(center),this.appendChild(right))}}},{key:"_ensureToolbarElement",value:function(name){var element=util.findChild(this,"."+name)||util.create("."+name);return element.classList.add("navigation-bar__"+name),element}}]),ToolbarElement}(BaseElement);window.OnsToolbarElement=document.registerElement("ons-toolbar",{prototype:ToolbarElement.prototype});var scheme$24={".range":"range--*",".range__left":"range--*__left"},INPUT_ATTRIBUTES$1=["autofocus","disabled","inputmode","max","min","name","placeholder","readonly","size","step","validator","value"],MaterialInputElement$1=function(_BaseElement){function MaterialInputElement(){return babelHelpers.classCallCheck(this,MaterialInputElement),babelHelpers.possibleConstructorReturn(this,Object.getPrototypeOf(MaterialInputElement).apply(this,arguments))}return babelHelpers.inherits(MaterialInputElement,_BaseElement),babelHelpers.createClass(MaterialInputElement,[{key:"createdCallback",value:function(){this.hasAttribute("_compiled")||this._compile(),this._updateBoundAttributes(),this._onChange()}},{key:"_compile",value:function(){autoStyle.prepare(this),this.innerHTML='\n <input type="range" class="range">\n <div class="range__left"></div>\n ',ModifierUtil.initModifier(this,scheme$24),this.setAttribute("_compiled","")}},{key:"_onChange",value:function(){this._left.style.width=100*this._ratio+"%"}},{key:"attributeChangedCallback",value:function(name,last,current){"modifier"===name?ModifierUtil.onModifierChanged(last,current,this,scheme$24):INPUT_ATTRIBUTES$1.indexOf(name)>=0&&(this._updateBoundAttributes(),("min"===name||"max"===name)&&this._onChange())}},{key:"attachedCallback",value:function(){this.addEventListener("input",this._onChange)}},{key:"detachedCallback",value:function(){this.removeEventListener("input",this._onChange)}},{key:"_updateBoundAttributes",value:function(){var _this2=this;INPUT_ATTRIBUTES$1.forEach(function(attr){_this2.hasAttribute(attr)?_this2._input.setAttribute(attr,_this2.getAttribute(attr)):_this2._input.removeAttribute(attr)})}},{key:"_ratio",get:function(){var min=""===this._input.min?0:parseInt(this._input.min),max=""===this._input.max?100:parseInt(this._input.max);return(this.value-min)/(max-min)}},{key:"_input",get:function(){return this.querySelector("input")}},{key:"_left",get:function(){return this.querySelector(".range__left")}},{key:"value",get:function(){return this._input.value},set:function(val){return this._input.value=val,this._onChange(),this._input.val}}]),MaterialInputElement}(BaseElement);return window.OnsRangeElement=document.registerElement("ons-range",{prototype:MaterialInputElement$1.prototype}),window.addEventListener("load",function(){return FastClick.attach(document.body)},!1),window.addEventListener("DOMContentLoaded",function(){ons$1._deviceBackButtonDispatcher.enable(),ons$1._defaultDeviceBackButtonHandler=ons$1._deviceBackButtonDispatcher.createHandler(window.document.body,function(){navigator.app.exitApp()}),document.body._gestureDetector=new ons$1.GestureDetector(document.body)},!1),ons$1.ready(function(){ons$1._setupLoadingPlaceHolders()}),(new Viewport).setup(),Modernizr.testStyles("#modernizr { -webkit-overflow-scrolling:touch }",function(elem,rule){Modernizr.addTest("overflowtouch",window.getComputedStyle&&"touch"==window.getComputedStyle(elem).getPropertyValue("-webkit-overflow-scrolling"))}),ons$1});
|
demo/component/BrushDemo.js
|
sdoomz/recharts
|
import React from 'react';
import { Surface, Brush } from 'recharts';
export default React.createClass({
render () {
let data = [
'2015-10-01',
'2015-10-02',
'2015-10-03',
'2015-10-04',
'2015-10-05',
'2015-10-06',
'2015-10-07',
'2015-10-08',
'2015-10-09',
'2015-10-10',
'2015-10-11',
'2015-10-12',
'2015-10-13',
'2015-10-14',
'2015-10-15',
'2015-10-16',
'2015-10-17',
'2015-10-18',
'2015-10-19',
'2015-10-20',
'2015-10-21',
'2015-10-22',
'2015-10-23',
'2015-10-24',
'2015-10-25',
'2015-10-26',
'2015-10-27',
'2015-10-28',
'2015-10-29',
'2015-10-30'
];
return (
<Surface width={800} height={200}>
<Brush x={100} y={50} width={400} height={40} data={data}/>
</Surface>
);
}
});
|
src/components/Main.js
|
malecki/gcmeme
|
require('normalize.css/normalize.css');
require('styles/App.css');
import React from 'react';
import { hashHistory, Router, Route, Link, Redirect } from 'react-router'
import { TwitterButton} from "react-social";
import { MainText } from 'sources/main-text'
class StaticComponent extends React.Component{
constructor(props) {
super(props);
}
render(){
var props = this.props;
let texts = MainText
let _bottomItems = [
'More than silence. More than thoughts. More than prayers. More.',
'We get shit done.',
'Now. Ready? Action!',
'From Stonewall to Pulse.',
'#LGBTLivesMatter #BlackLivesMatter #MuslimLivesMatter'
]
let I = texts.length
let iRand = Math.floor(Math.random()*I)
let i = props.params.id ? props.params.id : iRand
i = i < I ? i : i % I
let iPrev = i-1 >= 0 ? i-1 : I-1
let iNext = i+1 < I ? i+1 : 0
let mainText = texts[i]
let botText = _bottomItems[Math.floor(Math.random()*_bottomItems.length)]
let url = "http://guncontrol.lgbt/#/" + i
let fburl = "https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fguncontrol.lgbt%2F%23%2f"+i+"&src=sdkpreparse"
return(
<div>
<div className="index">
<div className="maintext"><Link to={{pathname:"/", query:{id: iRand}, hash: iRand}}>{mainText}</Link></div>
<div className="list-head"><p>The new gay agenda</p></div>
<div className="list-container">
<ul>
<li>☑︎ Marriage</li>
<li>☐ Gun control</li>
<ul>
<li><a target="_blank" href="http://contactingthecongress.org">contactingthecongress.org</a></li>
<li><a target="_blank" href="http://demandaplan.org">demandaplan.org</a></li>
<li><a target="_blank" href="http://30guncontrolactionsyoucantakenow.com">30guncontrolactionsyoucantakenow.com</a></li>
</ul>
</ul>
</div>
</div>
<footer className="bar">
<Link to={{pathname: "/", query: {id: iPrev}, hash: iPrev, state: "test"}}> « </Link>
<div>{botText}</div>
<Link to="/" params={{id: iNext}}> » </Link>
</footer>
<footer className="links"><a href="http://guncontrol.lgbt/#/">guncontrol.lgbt</a>
<a target="_blank" href="https://www.instagram.com/guncontrol.lgbt/?ref=badge" class="ig-b- ig-b-v-24"><img src="//badges.instagram.com/static/images/ig-badge-view-24.png" alt="Instagram" /></a>
<TwitterButton url={url} message={mainText}>
{" Tweet "}
</TwitterButton>
</footer>
</div>
)
}
}
class AppComponent extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<Router history={hashHistory}>
<Route path='/' component={StaticComponent} />
<Route path='/:id' component={StaticComponent} />
</Router>
);
}
}
AppComponent.defaultProps = {
};
export default AppComponent;
|
test/specs/views/Feed/FeedDate-test.js
|
vageeshb/Semantic-UI-React
|
import faker from 'faker'
import React from 'react'
import * as common from 'test/specs/commonTests'
import FeedDate from 'src/views/Feed/FeedDate'
describe('FeedDate', () => {
common.isConformant(FeedDate)
common.rendersChildren(FeedDate)
it('renders text with date prop', () => {
const text = faker.hacker.phrase()
shallow(<FeedDate content={text} />).should.contain.text(text)
})
})
|
examples/cra-kitchen-sink/src/stories/welcome.stories.js
|
kadirahq/react-storybook
|
import React from 'react';
import { Welcome } from '@storybook/react/demo';
import { linkTo } from '@storybook/addon-links';
export default {
title: 'Welcome',
component: Welcome,
};
export const Story1 = () => <Welcome showApp={linkTo('Button')} />;
Story1.title = 'to Storybook';
|
src/components/form/group/index.js
|
rangle/react-redux-starter
|
import React from 'react';
function FormGroup({ children, testid, ...props}) {
return (
<div data-testid={testid} className="py2" {...props}>
{children}
</div>
);
}
FormGroup.propTypes = {
children: React.PropTypes.node,
testid: React.PropTypes.string,
};
export default FormGroup;
|
profiles/classified_advertising/modules/contrib/jquery_update/replace/jquery/1.9/jquery.js
|
londynek/drupal
|
/*!
* jQuery JavaScript Library v1.9.1
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2013-2-4
*/
(function( window, undefined ) {
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
// Support: Firefox 18+
//"use strict";
var
// The deferred used on DOM ready
readyList,
// A central reference to the root jQuery(document)
rootjQuery,
// Support: IE<9
// For `typeof node.method` instead of `node.method !== undefined`
core_strundefined = typeof undefined,
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
location = window.location,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// [[Class]] -> type pairs
class2type = {},
// List of deleted data cache ids, so we can reuse them
core_deletedIds = [],
core_version = "1.9.1",
// Save a reference to some core methods
core_concat = core_deletedIds.concat,
core_push = core_deletedIds.push,
core_slice = core_deletedIds.slice,
core_indexOf = core_deletedIds.indexOf,
core_toString = class2type.toString,
core_hasOwn = class2type.hasOwnProperty,
core_trim = core_version.trim,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Used for matching numbers
core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
// Used for splitting on whitespace
core_rnotwhite = /\S+/g,
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
},
// The ready event handler
completed = function( event ) {
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
detach();
jQuery.ready();
}
},
// Clean-up method for dom ready events
detach = function() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
}
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: core_version,
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
// scripts is true for back-compat
jQuery.merge( this, jQuery.parseHTML(
match[1],
context && context.nodeType ? context.ownerDocument || context : document,
true
) );
// HANDLE: $(html, props)
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
for ( match in context ) {
// Properties of context are called as methods if possible
if ( jQuery.isFunction( this[ match ] ) ) {
this[ match ]( context[ match ] );
// ...and otherwise set as attributes
} else {
this.attr( match, context[ match ] );
}
}
}
return this;
// HANDLE: $(#id)
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(DOMElement)
} else if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return core_slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Add the callback
jQuery.ready.promise().done( fn );
return this;
},
slice: function() {
return this.pushStack( core_slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: core_push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var src, copyIsArray, copy, name, options, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger("ready").off("ready");
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
isWindow: function( obj ) {
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
if ( obj == null ) {
return String( obj );
}
return typeof obj === "object" || typeof obj === "function" ?
class2type[ core_toString.call(obj) ] || "object" :
typeof obj;
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!core_hasOwn.call(obj, "constructor") &&
!core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || core_hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
parseHTML: function( data, context, keepScripts ) {
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
keepScripts = context;
context = false;
}
context = context || document;
var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && [];
// Single tag
if ( parsed ) {
return [ context.createElement( parsed[1] ) ];
}
parsed = jQuery.buildFragment( [ data ], context, scripts );
if ( scripts ) {
jQuery( scripts ).remove();
}
return jQuery.merge( [], parsed.childNodes );
},
parseJSON: function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
if ( data === null ) {
return data;
}
if ( typeof data === "string" ) {
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
if ( data ) {
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
}
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
var xml, tmp;
if ( !data || typeof data !== "string" ) {
return null;
}
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && jQuery.trim( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var value,
i = 0,
length = obj.length,
isArray = isArraylike( obj );
if ( args ) {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
}
}
return obj;
},
// Use native String.trim function wherever possible
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
function( text ) {
return text == null ?
"" :
core_trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
if ( isArraylike( Object(arr) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
core_push.call( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
var len;
if ( arr ) {
if ( core_indexOf ) {
return core_indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var l = second.length,
i = first.length,
j = 0;
if ( typeof l === "number" ) {
for ( ; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value,
i = 0,
length = elems.length,
isArray = isArraylike( elems ),
ret = [];
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return core_concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var args, proxy, tmp;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = core_slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0,
length = elems.length,
bulk = key == null;
// Sets many values
if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
}
// Sets one value
} else if ( value !== undefined ) {
chainable = true;
if ( !jQuery.isFunction( value ) ) {
raw = true;
}
if ( bulk ) {
// Bulk operations run against the entire set
if ( raw ) {
fn.call( elems, value );
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function( elem, key, value ) {
return bulk.call( jQuery( elem ), value );
};
}
}
if ( fn ) {
for ( ; i < length; i++ ) {
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
}
}
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
}
});
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed, false );
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", completed );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch(e) {}
if ( top && top.doScroll ) {
(function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left");
} catch(e) {
return setTimeout( doScrollCheck, 50 );
}
// detach all dom ready events
detach();
// and execute any waiting functions
jQuery.ready();
}
})();
}
}
}
return readyList.promise( obj );
};
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
function isArraylike( obj ) {
var length = obj.length,
type = jQuery.type( obj );
if ( jQuery.isWindow( obj ) ) {
return false;
}
if ( obj.nodeType === 1 && length ) {
return true;
}
return type === "array" || type !== "function" &&
( length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
( optionsCache[ options ] || createOptions( options ) ) :
jQuery.extend( {}, options );
var // Flag to know if list is currently firing
firing,
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// First callback to fire (used internally by add and fireWith)
firingStart,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// First, we save the current length
var start = list.length;
(function add( args ) {
jQuery.each( args, function( _, arg ) {
var type = jQuery.type( arg );
if ( type === "function" ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
// Inspect recursively
add( arg );
}
});
})( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away
} else if ( memory ) {
firingStart = start;
fire( memory );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( firing ) {
if ( index <= firingLength ) {
firingLength--;
}
if ( index <= firingIndex ) {
firingIndex--;
}
}
}
});
}
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( list && ( !fired || stack ) ) {
if ( firing ) {
stack.push( args );
} else {
fire( args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
jQuery.extend({
Deferred: function( func ) {
var tuples = [
// action, add listener, listener list, final state
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory") ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var action = tuple[ 0 ],
fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[1] ](function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
}
});
});
fns = null;
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Keep pipe for back-compat
promise.pipe = promise.then;
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
promise[ tuple[1] ] = list.add;
// Handle state
if ( stateString ) {
list.add(function() {
// state = [ resolved | rejected ]
state = stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
// deferred[ resolve | reject | notify ]
deferred[ tuple[0] ] = function() {
deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
return this;
};
deferred[ tuple[0] + "With" ] = list.fireWith;
});
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = core_slice.call( arguments ),
length = resolveValues.length,
// the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
},
progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if ( length > 1 ) {
progressValues = new Array( length );
progressContexts = new Array( length );
resolveContexts = new Array( length );
for ( ; i < length; i++ ) {
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
resolveValues[ i ].promise()
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject )
.progress( updateFunc( i, progressContexts, progressValues ) );
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues );
}
return deferred.promise();
}
});
jQuery.support = (function() {
var support, all, a,
input, select, fragment,
opt, eventName, isSupported, i,
div = document.createElement("div");
// Setup
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
// Support tests won't run in some limited or non-browser environments
all = div.getElementsByTagName("*");
a = div.getElementsByTagName("a")[ 0 ];
if ( !all || !a || !all.length ) {
return {};
}
// First batch of tests
select = document.createElement("select");
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName("input")[ 0 ];
a.style.cssText = "top:1px;float:left;opacity:.5";
support = {
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: div.firstChild.nodeType === 3,
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: a.getAttribute("href") === "/a",
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.5/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
checkOn: !!input.value,
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Tests for enctype support on a form (#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel: document.compatMode === "CSS1Compat",
// Will be defined later
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true,
boxSizingReliable: true,
pixelPosition: false
};
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Support: IE<9
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
// Check if we can trust getAttribute("value")
input = document.createElement("input");
input.setAttribute( "value", "" );
support.input = input.getAttribute( "value" ) === "";
// Check if an input maintains its value after becoming a radio
input.value = "t";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "checked", "t" );
input.setAttribute( "name", "t" );
fragment = document.createDocumentFragment();
fragment.appendChild( input );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE<9
// Opera does not clone events (and typeof div.attachEvent === undefined).
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
if ( div.attachEvent ) {
div.attachEvent( "onclick", function() {
support.noCloneEvent = false;
});
div.cloneNode( true ).click();
}
// Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
for ( i in { submit: true, change: true, focusin: true }) {
div.setAttribute( eventName = "on" + i, "t" );
support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
}
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
// Run tests that need a body at doc ready
jQuery(function() {
var container, marginDiv, tds,
divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
container = document.createElement("div");
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
body.appendChild( container ).appendChild( div );
// Support: IE8
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
tds = div.getElementsByTagName("td");
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Support: IE8
// Check if empty table cells still have offsetWidth/Height
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check box-sizing and margin behavior
div.innerHTML = "";
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
support.boxSizing = ( div.offsetWidth === 4 );
support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
// Use window.getComputedStyle because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. (#3333)
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv = div.appendChild( document.createElement("div") );
marginDiv.style.cssText = div.style.cssText = divReset;
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
support.reliableMarginRight =
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
}
if ( typeof div.style.zoom !== core_strundefined ) {
// Support: IE<8
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
div.innerHTML = "";
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Support: IE6
// Check if elements with layout shrink-wrap their children
div.style.display = "block";
div.innerHTML = "<div></div>";
div.firstChild.style.width = "5px";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
if ( support.inlineBlockNeedsLayout ) {
// Prevent IE 6 from affecting layout for positioned elements #11048
// Prevent IE from shrinking the body in IE 7 mode #12869
// Support: IE<8
body.style.zoom = 1;
}
}
body.removeChild( container );
// Null elements to avoid leaks in IE
container = div = tds = marginDiv = null;
});
// Null elements to avoid leaks in IE
all = select = fragment = opt = a = input = null;
return support;
})();
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
function internalData( elem, name, data, pvt /* Internal Use Only */ ){
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
}
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var i, l, thisCache,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split(" ");
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}
for ( i = 0, l = name.length; i < l; i++ ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
}
jQuery.extend({
cache: {},
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data ) {
return internalData( elem, name, data );
},
removeData: function( elem, name ) {
return internalRemoveData( elem, name );
},
// For internal use only.
_data: function( elem, name, data ) {
return internalData( elem, name, data, true );
},
_removeData: function( elem, name ) {
return internalRemoveData( elem, name, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
// Do not set data on non-element because it will not be cleared (#8335).
if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
return false;
}
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
// nodes accept data unless otherwise specified; rejection can be conditional
return !noData || noData !== true && elem.getAttribute("classid") === noData;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var attrs, name,
elem = this[0],
i = 0,
data = null;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attrs = elem.attributes;
for ( ; i < attrs.length; i++ ) {
name = attrs[i].name;
if ( !name.indexOf( "data-" ) ) {
name = jQuery.camelCase( name.slice(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
return jQuery.access( this, function( value ) {
if ( value === undefined ) {
// Try to fetch any internally stored data first
return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
}
this.each(function() {
jQuery.data( this, key, value );
});
}, null, value, arguments.length > 1, null, true );
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
jQuery.extend({
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray(data) ) {
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
hooks.cur = fn;
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
jQuery._removeData( elem, type + "queue" );
jQuery._removeData( elem, key );
})
});
}
});
jQuery.fn.extend({
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}
return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
});
var nodeHook, boolHook,
rclass = /[\t\r\n]/g,
rreturn = /\r/g,
rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i,
rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,
ruseDefault = /^(?:checked|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute,
getSetInput = jQuery.support.input;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
// The disjunction here is for better compressibility (see removeClass)
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
" "
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
cur += clazz + " ";
}
}
elem.className = jQuery.trim( cur );
}
}
}
return this;
},
removeClass: function( value ) {
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = arguments.length === 0 || typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
""
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
}
elem.className = value ? jQuery.trim( cur ) : "";
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.match( core_rnotwhite ) || [];
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
// Toggle whole class name
} else if ( type === core_strundefined || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
return true;
}
}
return false;
},
val: function( value ) {
var ret, hooks, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var val,
self = jQuery(this);
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
max :
one ? index : 0;
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attr: function( elem, name, value ) {
var hooks, notxml, ret,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === core_strundefined ) {
return jQuery.prop( elem, name, value );
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( notxml ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
} else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, value + "" );
return value;
}
} else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
// In IE9+, Flash objects don't have .getAttribute (#12945)
// Support: IE9+
if ( typeof elem.getAttribute !== core_strundefined ) {
ret = elem.getAttribute( name );
}
// Non-existent attributes return null, we normalize to undefined
return ret == null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var name, propName,
i = 0,
attrNames = value && value.match( core_rnotwhite );
if ( attrNames && elem.nodeType === 1 ) {
while ( (name = attrNames[i++]) ) {
propName = jQuery.propFix[ name ] || name;
// Boolean attributes get special treatment (#10870)
if ( rboolean.test( name ) ) {
// Set corresponding property to false for boolean attributes
// Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
if ( !getSetAttribute && ruseDefault.test( name ) ) {
elem[ jQuery.camelCase( "default-" + name ) ] =
elem[ propName ] = false;
} else {
elem[ propName ] = false;
}
// See #9699 for explanation of this approach (setting first, then removal)
} else {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to default in case type is set after value during creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return ( elem[ name ] = value );
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
var
// Use .prop to determine if this attribute is understood as boolean
prop = jQuery.prop( elem, name ),
// Fetch it accordingly
attr = typeof prop === "boolean" && elem.getAttribute( name ),
detail = typeof prop === "boolean" ?
getSetInput && getSetAttribute ?
attr != null :
// oldIE fabricates an empty string for missing boolean attributes
// and conflates checked/selected into attroperties
ruseDefault.test( name ) ?
elem[ jQuery.camelCase( "default-" + name ) ] :
!!attr :
// fetch an attribute node for properties not recognized as boolean
elem.getAttributeNode( name );
return detail && detail.value !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
// IE<8 needs the *property* name
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
// Use defaultChecked and defaultSelected for oldIE
} else {
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
}
return name;
}
};
// fix oldIE value attroperty
if ( !getSetInput || !getSetAttribute ) {
jQuery.attrHooks.value = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
return jQuery.nodeName( elem, "input" ) ?
// Ignore the value *property* by using defaultValue
elem.defaultValue :
ret && ret.specified ? ret.value : undefined;
},
set: function( elem, value, name ) {
if ( jQuery.nodeName( elem, "input" ) ) {
// Does not return so that setAttribute is also used
elem.defaultValue = value;
} else {
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
return nodeHook && nodeHook.set( elem, value, name );
}
}
};
}
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?
ret.value :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
elem.setAttributeNode(
(ret = elem.ownerDocument.createAttribute( name ))
);
}
ret.value = value += "";
// Break association with cloned elements by also using setAttribute (#9646)
return name === "value" || value === elem.getAttribute( name ) ?
value :
undefined;
}
};
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
nodeHook.set( elem, value === "" ? false : value, name );
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
}
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret == null ? undefined : ret;
}
});
});
// href/src property should get the full normalized URL (#10299/#12915)
jQuery.each([ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Note: IE uppercases css property names, but if we were to .toLowerCase()
// .cssText, that would destroy case senstitivity in URL's, like in "background"
return elem.style.cssText || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = value + "" );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
});
});
var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
global: {},
add: function( elem, types, handler, data, selector ) {
var tmp, events, t, handleObjIn,
special, eventHandle, handleObj,
handlers, type, namespaces, origType,
elemData = jQuery._data( elem );
// Don't attach events to noData or text/comment nodes (but allow plain objects)
if ( !elemData ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
if ( !(events = elemData.events) ) {
events = elemData.events = {};
}
if ( !(eventHandle = elemData.handle) ) {
eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
if ( !(handlers = events[ type ]) ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, handleObj, tmp,
origCount, t, events,
special, handlers, type,
namespaces, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = ( types || "" ).match( core_rnotwhite ) || [""];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
type = origType = tmp[1];
namespaces = ( tmp[2] || "" ).split( "." ).sort();
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector ? special.delegateType : special.bindType ) || type;
handlers = events[ type ] || [];
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
// Remove matching events
origCount = j = handlers.length;
while ( j-- ) {
handleObj = handlers[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
if ( handleObj.selector ) {
handlers.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( origCount && !handlers.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle;
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery._removeData( elem, "events" );
}
},
trigger: function( event, data, elem, onlyHandlers ) {
var handle, ontype, cur,
bubbleType, special, tmp, i,
eventPath = [ elem || document ],
type = core_hasOwn.call( event, "type" ) ? event.type : event,
namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf(".") >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf(":") < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[ jQuery.expando ] ?
event :
new jQuery.Event( type, typeof event === "object" && event );
event.isTrigger = true;
event.namespace = namespaces.join(".");
event.namespace_re = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
null;
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data == null ?
[ event ] :
jQuery.makeArray( data, [ event ] );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode;
}
for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur );
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === (elem.ownerDocument || document) ) {
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
try {
elem[ type ]();
} catch ( e ) {
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
}
jQuery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event );
var i, ret, handleObj, matched, j,
handlerQueue = [],
args = core_slice.call( arguments ),
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
// Run delegates first; they may want to stop propagation beneath us
i = 0;
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
event.currentTarget = matched.elem;
j = 0;
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
if ( (event.result = ret) === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
handlers: function( event, handlers ) {
var sel, handleObj, matches, i,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
// Find delegate handlers
// Black-hole SVG <use> instance trees (#13180)
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
for ( ; cur != this; cur = cur.parentNode || this ) {
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
// Don't conflict with Object.prototype properties (#13203)
sel = handleObj.selector + " ";
if ( matches[ sel ] === undefined ) {
matches[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( matches[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, handlers: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( delegateCount < handlers.length ) {
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
}
return handlerQueue;
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop, copy,
type = event.type,
originalEvent = event,
fixHook = this.fixHooks[ type ];
if ( !fixHook ) {
this.fixHooks[ type ] = fixHook =
rmouseEvent.test( type ) ? this.mouseHooks :
rkeyEvent.test( type ) ? this.keyHooks :
{};
}
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = new jQuery.Event( originalEvent );
i = copy.length;
while ( i-- ) {
prop = copy[ i ];
event[ prop ] = originalEvent[ prop ];
}
// Support: IE<9
// Fix target property (#1925)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Support: Chrome 23+, Safari?
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// Support: IE<9
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
event.metaKey = !!event.metaKey;
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
},
// Includes some event props shared by KeyEvent and MouseEvent
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var body, eventDoc, doc,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
click: {
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
this.click();
return false;
}
}
},
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
if ( this !== document.activeElement && this.focus ) {
try {
this.focus();
return false;
} catch ( e ) {
// Support: IE<9
// If we error on focus to hidden element (#1486, #12518),
// let .trigger() run the handlers
}
}
},
delegateType: "focusin"
},
blur: {
trigger: function() {
if ( this === document.activeElement && this.blur ) {
this.blur();
return false;
}
},
delegateType: "focusout"
},
beforeunload: {
postDispatch: function( event ) {
// Even when returnValue equals to undefined Firefox will still show alert
if ( event.result !== undefined ) {
event.originalEvent.returnValue = event.result;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{ type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
var name = "on" + type;
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event, to properly expose it to GC
if ( typeof elem[ name ] === core_strundefined ) {
elem[ name ] = null;
}
elem.detachEvent( name, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if ( !e ) {
return;
}
// If preventDefault exists, run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// Support: IE
// Otherwise set the returnValue property of the original event to false
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if ( !e ) {
return;
}
// If stopPropagation exists, run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// Support: IE
// Set the cancelBubble property of the original event to true
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
}
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !jQuery._data( form, "submitBubbles" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
jQuery._data( form, "submitBubbles", true );
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
}
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event, true );
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
jQuery._data( elem, "changeBubbles", true );
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return !rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var type, origFn;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
var elem = this[0];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://sizzlejs.com/
*/
(function( window, undefined ) {
var i,
cachedruns,
Expr,
getText,
isXML,
compile,
hasDuplicate,
outermostContext,
// Local document vars
setDocument,
document,
docElem,
documentIsXML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
sortOrder,
// Instance-specific data
expando = "sizzle" + -(new Date()),
preferredDoc = window.document,
support = {},
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
// General-purpose constants
strundefined = typeof undefined,
MAX_NEGATIVE = 1 << 31,
// Array methods
arr = [],
pop = arr.pop,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf if we can't use a native one
indexOf = arr.indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[i] === elem ) {
return i;
}
}
return -1;
},
// Regular expressions
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
operators = "([*^$|!~]?=)",
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
"*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
// Prefer arguments quoted,
// then not containing pseudos/brackets,
// then attribute selectors/non-parenthetical expressions,
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rsibling = /[\x20\t\r\n\f]*[+~]/,
rnative = /^[^{]+\{\s*\[native code/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rescape = /'|\\/g,
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
funescape = function( _, escaped ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
return high !== high ?
escaped :
// BMP codepoint
high < 0 ?
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
};
// Use a stripped-down slice if we can't use a native one
try {
slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType;
} catch ( e ) {
slice = function( i ) {
var elem,
results = [];
while ( (elem = this[i++]) ) {
results.push( elem );
}
return results;
};
}
/**
* For feature detection
* @param {Function} fn The function to test for native support
*/
function isNative( fn ) {
return rnative.test( fn + "" );
}
/**
* Create key-value caches of limited size
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var cache,
keys = [];
return (cache = function( key, value ) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if ( keys.push( key += " " ) > Expr.cacheLength ) {
// Only keep the most recent entries
delete cache[ keys.shift() ];
}
return (cache[ key ] = value);
});
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created div and expects a boolean result
*/
function assert( fn ) {
var div = document.createElement("div");
try {
return fn( div );
} catch (e) {
return false;
} finally {
// release memory in IE
div = null;
}
}
function Sizzle( selector, context, results, seed ) {
var match, elem, m, nodeType,
// QSA vars
i, groups, old, nid, newContext, newSelector;
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
results = results || [];
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
return [];
}
if ( !documentIsXML && !seed ) {
// Shortcuts
if ( (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID")
if ( (m = match[1]) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
} else {
// Context is not a document
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
}
}
// Speed-up: Sizzle("TAG")
} else if ( match[2] ) {
push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
return results;
// Speed-up: Sizzle(".CLASS")
} else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
return results;
}
}
// QSA path
if ( support.qsa && !rbuggyQSA.test(selector) ) {
old = true;
nid = expando;
newContext = context;
newSelector = nodeType === 9 && selector;
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
groups = tokenize( selector );
if ( (old = context.getAttribute("id")) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", nid );
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while ( i-- ) {
groups[i] = nid + toSelector( groups[i] );
}
newContext = rsibling.test( selector ) && context.parentNode || context;
newSelector = groups.join(",");
}
if ( newSelector ) {
try {
push.apply( results, slice.call( newContext.querySelectorAll(
newSelector
), 0 ) );
return results;
} catch(qsaError) {
} finally {
if ( !old ) {
context.removeAttribute("id");
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* Detect xml
* @param {Element|Object} elem An element or a document
*/
isXML = Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function( node ) {
var doc = node ? node.ownerDocument || node : preferredDoc;
// If no document and documentElement is available, return
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
return document;
}
// Set our document
document = doc;
docElem = doc.documentElement;
// Support tests
documentIsXML = isXML( doc );
// Check if getElementsByTagName("*") returns only elements
support.tagNameNoComments = assert(function( div ) {
div.appendChild( doc.createComment("") );
return !div.getElementsByTagName("*").length;
});
// Check if attributes should be retrieved by attribute nodes
support.attributes = assert(function( div ) {
div.innerHTML = "<select></select>";
var type = typeof div.lastChild.getAttribute("multiple");
// IE8 returns a string for some attributes even when not present
return type !== "boolean" && type !== "string";
});
// Check if getElementsByClassName can be trusted
support.getByClassName = assert(function( div ) {
// Opera can't find a second classname (in 9.6)
div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
return false;
}
// Safari 3.2 caches class attributes and doesn't catch changes
div.lastChild.className = "e";
return div.getElementsByClassName("e").length === 2;
});
// Check if getElementById returns elements by name
// Check if getElementsByName privileges form controls or returns elements by ID
support.getByName = assert(function( div ) {
// Inject content
div.id = expando + 0;
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
docElem.insertBefore( div, docElem.firstChild );
// Test
var pass = doc.getElementsByName &&
// buggy browsers will return fewer than the correct 2
doc.getElementsByName( expando ).length === 2 +
// buggy browsers will return more than the correct 0
doc.getElementsByName( expando + 0 ).length;
support.getIdNotName = !doc.getElementById( expando );
// Cleanup
docElem.removeChild( div );
return pass;
});
// IE6/7 return modified attributes
Expr.attrHandle = assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
div.firstChild.getAttribute("href") === "#";
}) ?
{} :
{
"href": function( elem ) {
return elem.getAttribute( "href", 2 );
},
"type": function( elem ) {
return elem.getAttribute("type");
}
};
// ID find and filter
if ( support.getIdNotName ) {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
var m = context.getElementById( id );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
};
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
return elem.getAttribute("id") === attrId;
};
};
} else {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
var m = context.getElementById( id );
return m ?
m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
[m] :
undefined :
[];
}
};
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
}
// Tag
Expr.find["TAG"] = support.tagNameNoComments ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
while ( (elem = results[i++]) ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
};
// Name
Expr.find["NAME"] = support.getByName && function( tag, context ) {
if ( typeof context.getElementsByName !== strundefined ) {
return context.getElementsByName( name );
}
};
// Class
Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
return context.getElementsByClassName( className );
}
};
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21),
// no need to also add to buggyMatches since matches checks buggyQSA
// A support test would require too much code (would include document ready)
rbuggyQSA = [ ":focus" ];
if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( div ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explictly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select><option selected=''></option></select>";
// IE8 - Some boolean attributes are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
});
assert(function( div ) {
// Opera 10-12/IE8 - ^= $= *= and empty values
// Should not select anything
div.innerHTML = "<input type='hidden' i=''/>";
if ( div.querySelectorAll("[i^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Opera 10-11 does not throw on post-comma invalid pseudos
div.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
docElem.mozMatchesSelector ||
docElem.webkitMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector) )) ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( div, "[s!='']:x" );
rbuggyMatches.push( "!=", pseudos );
});
}
rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
// Element contains another
// Purposefully does not implement inclusive descendent
// As in, an element does not contain itself
contains = isNative(docElem.contains) || docElem.compareDocumentPosition ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
// Document order sorting
sortOrder = docElem.compareDocumentPosition ?
function( a, b ) {
var compare;
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
if ( a === doc || contains( preferredDoc, a ) ) {
return -1;
}
if ( b === doc || contains( preferredDoc, b ) ) {
return 1;
}
return 0;
}
return compare & 4 ? -1 : 1;
}
return a.compareDocumentPosition ? -1 : 1;
} :
function( a, b ) {
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [ a ],
bp = [ b ];
// Exit early if the nodes are identical
if ( a === b ) {
hasDuplicate = true;
return 0;
// Parentless nodes are either documents or disconnected
} else if ( !aup || !bup ) {
return a === doc ? -1 :
b === doc ? 1 :
aup ? -1 :
bup ? 1 :
0;
// If the nodes are siblings, we can do a quick check
} else if ( aup === bup ) {
return siblingCheck( a, b );
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ( (cur = cur.parentNode) ) {
ap.unshift( cur );
}
cur = b;
while ( (cur = cur.parentNode) ) {
bp.unshift( cur );
}
// Walk down the tree looking for a discrepancy
while ( ap[i] === bp[i] ) {
i++;
}
return i ?
// Do a sibling check if the nodes have a common ancestor
siblingCheck( ap[i], bp[i] ) :
// Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 :
0;
};
// Always assume the presence of duplicates if sort doesn't
// pass them to our comparison function (as in Google Chrome).
hasDuplicate = false;
[0, 0].sort( sortOrder );
support.detectDuplicates = hasDuplicate;
return document;
};
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
// rbuggyQSA always contains :focus, so no need for an existence check
if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch(e) {}
}
return Sizzle( expr, document, null, [elem] ).length > 0;
};
Sizzle.contains = function( context, elem ) {
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
}
return contains( context, elem );
};
Sizzle.attr = function( elem, name ) {
var val;
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
if ( !documentIsXML ) {
name = name.toLowerCase();
}
if ( (val = Expr.attrHandle[ name ]) ) {
return val( elem );
}
if ( documentIsXML || support.attributes ) {
return elem.getAttribute( name );
}
return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?
name :
val && val.specified ? val.value : null;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
// Document sorting and removing duplicates
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
i = 1,
j = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( ; (elem = results[i]); i++ ) {
if ( elem === results[ i - 1 ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
return results;
};
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE );
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
// Returns a function to use in pseudos for input types
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
// Returns a function to use in pseudos for buttons
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
// Returns a function to use in pseudos for positionals
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
for ( ; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
ret += getText( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
if ( !match[3] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if ( match[3] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var excess,
unquoted = !match[5] && match[2];
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
// Accept quoted arguments as-is
if ( match[4] ) {
match[2] = match[4];
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
match[0] = match[0].slice( 0, excess );
match[2] = unquoted.slice( 0, excess );
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"TAG": function( nodeName ) {
if ( nodeName === "*" ) {
return function() { return true; };
}
nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.slice( -check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
function( elem ) {
return !!elem.parentNode;
} :
function( elem, context, xml ) {
var cache, outerCache, node, diff, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType;
if ( parent ) {
// :(first|last|only)-(child|of-type)
if ( simple ) {
while ( dir ) {
node = elem;
while ( (node = node[ dir ]) ) {
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
return true;
}
start = [ forward ? parent.firstChild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
outerCache = parent[ expando ] || (parent[ expando ] = {});
cache = outerCache[ type ] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = cache[0] === dirruns && cache[2];
node = nodeIndex && parent.childNodes[ nodeIndex ];
while ( (node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start.pop()) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
outerCache[ type ] = [ dirruns, nodeIndex, diff ];
break;
}
}
// Use previously-cached element index if available
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
diff = cache[1];
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
} else {
// Use the same loop as above to seek `elem` from the start
while ( (node = ++nodeIndex && node && node[ dir ] ||
(diff = nodeIndex = 0) || start.pop()) ) {
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
// Cache the index of each encountered element
if ( useCache ) {
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
break;
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf.call( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
// Potentially complex pseudos
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) {
// lang value must be a valid identifider
if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
if ( (elemLang = documentIsXML ?
elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
elem.lang) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
}
} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
return false;
};
}),
// Miscellaneous
"target": function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
"root": function( elem ) {
return elem === docElem;
},
"focus": function( elem ) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
// Greater than "@" means alpha characters (specifically not starting with "#" or "?")
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
return false;
}
}
return true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
// Element/input types
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function( elem ) {
var attr;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" &&
elem.type === "text" &&
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
},
// Position-in-collection
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
Expr.pseudos[ i ] = createButtonPseudo( i );
}
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( tokens = [] );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
matched = match.shift();
tokens.push( {
value: matched,
// Cast descendant combinators to space
type: match[0].replace( rtrim, " " )
} );
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push( {
value: matched,
type: type,
matches: match
} );
soFar = soFar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
}
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var data, cache, outerCache,
dirkey = dirruns + " " + doneName;
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
if ( (data = cache[1]) === true || data === cachedruns ) {
return data === true;
}
} else {
cache = outerCache[ dir ] = [ dirkey ];
cache[1] = matcher( elem, context, xml ) || cachedruns;
if ( cache[1] === true ) {
return true;
}
}
}
}
}
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
// A counter to specify which element is currently being matched
var matcherCachedRuns = 0,
bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
setMatched = [],
matchedCount = 0,
i = "0",
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = matcherCachedRuns;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++matcherCachedRuns;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
}
i = group.length;
while ( i-- ) {
cached = matcherFromTokens( group[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
}
return cached;
};
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function select( selector, context, results, seed ) {
var i, tokens, token, type, find,
match = tokenize( selector );
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
context.nodeType === 9 && !documentIsXML &&
Expr.relative[ tokens[1].type ] ) {
context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && context.parentNode || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, slice.call( seed, 0 ) );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
documentIsXML,
results,
rsibling.test( selector )
);
return results;
}
// Deprecated
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Easy API for creating new setFilters
function setFilters() {}
Expr.filters = setFilters.prototype = Expr.pseudos;
Expr.setFilters = new setFilters();
// Initialize with the default document
setDocument();
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})( window );
var runtil = /Until$/,
rparentsprev = /^(?:parents|prev(?:Until|All))/,
isSimple = /^.[^:#\[\.,]*$/,
rneedsContext = jQuery.expr.match.needsContext,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var i, ret, self,
len = this.length;
if ( typeof selector !== "string" ) {
self = this;
return this.pushStack( jQuery( selector ).filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
}) );
}
ret = [];
for ( i = 0; i < len; i++ ) {
jQuery.find( selector, this[ i ], ret );
}
// Needed because $( selector, context ) becomes $( context ).find( selector )
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
return ret;
},
has: function( target ) {
var i,
targets = jQuery( target, this ),
len = targets.length;
return this.filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false) );
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true) );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
rneedsContext.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
ret = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
cur = this[i];
while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
}
cur = cur.parentNode;
}
}
return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( jQuery.unique(all) );
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
});
jQuery.fn.andSelf = jQuery.fn.addBack;
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( this.length > 1 && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem ) {
return ( elem === qualifier ) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /^$|\/(?:java|ecma)script/i,
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
// We have to close these tags to support XHTML (#13200)
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
area: [ 1, "<map>", "</map>" ],
param: [ 1, "<object>", "</object>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
_default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
},
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
return this.domManip( arguments, false, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
});
},
after: function() {
return this.domManip( arguments, false, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
});
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem ) );
}
if ( elem.parentNode ) {
if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
setGlobalEval( getAll( elem, "script" ) );
}
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
// If this is a select, ensure that it displays empty (#12336)
// Support: IE<9
if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
elem.options.length = 0;
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
return jQuery.access( this, function( value ) {
var elem = this[0] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
undefined;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1></$2>" );
try {
for (; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
elem = this[i] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch(e) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function( value ) {
var isFunc = jQuery.isFunction( value );
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( !isFunc && typeof value !== "string" ) {
value = jQuery( value ).not( this ).detach();
}
return this.domManip( [ value ], true, function( elem ) {
var next = this.nextSibling,
parent = this.parentNode;
if ( parent ) {
jQuery( this ).remove();
parent.insertBefore( elem, next );
}
});
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
// Flatten any nested arrays
args = core_concat.apply( [], args );
var first, node, hasScripts,
scripts, doc, fragment,
i = 0,
l = this.length,
set = this,
iNoClone = l - 1,
value = args[0],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
return this.each(function( index ) {
var self = set.eq( index );
if ( isFunction ) {
args[0] = value.call( this, index, table ? self.html() : undefined );
}
self.domManip( args, table, callback );
});
}
if ( l ) {
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
hasScripts = scripts.length;
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
for ( ; i < l; i++ ) {
node = fragment;
if ( i !== iNoClone ) {
node = jQuery.clone( node, true, true );
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
callback.call(
table && jQuery.nodeName( this[i], "table" ) ?
findOrAppend( this[i], "tbody" ) :
this[i],
node,
i
);
}
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].ownerDocument;
// Reenable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document insertion
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) &&
!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
if ( node.src ) {
// Hope ajax is available...
jQuery.ajax({
url: node.src,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
} else {
jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
}
}
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
}
}
return this;
}
});
function findOrAppend( elem, tag ) {
return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
var attr = elem.getAttributeNode("type");
elem.type = ( attr && attr.specified ) + "/" + elem.type;
return elem;
}
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[1];
} else {
elem.removeAttribute("type");
}
return elem;
}
// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
}
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 copies events bound via attachEvent when using cloneNode.
if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
data = jQuery._data( dest );
for ( e in data.events ) {
jQuery.removeEvent( dest, e, data.handle );
}
// Event data gets referenced instead of copied if the expando gets copied too
dest.removeAttribute( jQuery.expando );
}
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
if ( nodeName === "script" && dest.text !== src.text ) {
disableScript( dest ).text = src.text;
restoreScript( dest );
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) {
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.defaultSelected = dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
}
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var elems,
i = 0,
ret = [],
insert = jQuery( selector ),
last = insert.length - 1;
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone(true);
jQuery( insert[i] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
core_push.apply( ret, elems.get() );
}
return this.pushStack( ret );
};
});
function getAll( context, tag ) {
var elems, elem,
i = 0,
found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) {
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) :
found;
}
// Used in buildFragment, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( manipulation_rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var destElements, node, clone, i, srcElements,
inPage = jQuery.contains( elem.ownerDocument, elem );
if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
} else {
fragmentDiv.innerHTML = elem.outerHTML;
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
}
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );
// Fix all IE cloning issues
for ( i = 0; (node = srcElements[i]) != null; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
fixCloneNodeIssues( node, destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
if ( deepDataAndEvents ) {
srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone );
for ( i = 0; (node = srcElements[i]) != null; i++ ) {
cloneCopyEvent( node, destElements[i] );
}
} else {
cloneCopyEvent( elem, clone );
}
}
// Preserve script evaluation history
destElements = getAll( clone, "script" );
if ( destElements.length > 0 ) {
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
}
destElements = srcElements = node = null;
// Return the cloned set
return clone;
},
buildFragment: function( elems, context, scripts, selection ) {
var j, elem, contains,
tmp, tag, tbody, wrap,
l = elems.length,
// Ensure a safe fragment
safe = createSafeFragment( context ),
nodes = [],
i = 0;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
// Convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createTextNode( elem ) );
// Convert html into DOM nodes
} else {
tmp = tmp || safe.appendChild( context.createElement("div") );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
// Descend through wrappers to the right content
j = wrap[0];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Manually add leading whitespace removed by IE
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
elem = tag === "table" && !rtbody.test( elem ) ?
tmp.firstChild :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !rtbody.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.length;
while ( j-- ) {
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
elem.removeChild( tbody );
}
}
}
jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9
tmp.textContent = "";
// Fix #12392 for oldIE
while ( tmp.firstChild ) {
tmp.removeChild( tmp.firstChild );
}
// Remember the top-level container for proper cleanup
tmp = safe.lastChild;
}
}
}
// Fix #11356: Clear elements from fragment
if ( tmp ) {
safe.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !jQuery.support.appendChecked ) {
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
}
i = 0;
while ( (elem = nodes[ i++ ]) ) {
// #4087 - If origin and destination elements are the same, and this is
// that element, do not do anything
if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( safe.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
setGlobalEval( tmp );
}
// Capture executables
if ( scripts ) {
j = 0;
while ( (elem = tmp[ j++ ]) ) {
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
}
}
}
tmp = null;
return safe;
},
cleanData: function( elems, /* internal */ acceptData ) {
var elem, type, id, data,
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
deleteExpando = jQuery.support.deleteExpando,
special = jQuery.event.special;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( acceptData || jQuery.acceptData( elem ) ) {
id = elem[ internalKey ];
data = id && cache[ id ];
if ( data ) {
if ( data.events ) {
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
}
// Remove cache only if it was not already removed by jQuery.event.remove
if ( cache[ id ] ) {
delete cache[ id ];
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( deleteExpando ) {
delete elem[ internalKey ];
} else if ( typeof elem.removeAttribute !== core_strundefined ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
core_deletedIds.push( id );
}
}
}
}
}
});
var iframe, getStyles, curCSS,
ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity\s*=\s*([^)]*)/,
rposition = /^(top|right|bottom|left)$/,
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rmargin = /^margin/,
rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
elemdisplay = { BODY: "block" },
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: 0,
fontWeight: 400
},
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
// return a css property mapped to a potentially vendor prefixed property
function vendorPropName( style, name ) {
// shortcut for names that are not vendor prefixed
if ( name in style ) {
return name;
}
// check for vendor prefixed names
var capName = name.charAt(0).toUpperCase() + name.slice(1),
origName = name,
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in style ) {
return name;
}
}
return origName;
}
function isHidden( elem, el ) {
// isHidden might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
}
function showHide( elements, show ) {
var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = jQuery._data( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
}
} else {
if ( !values[ index ] ) {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
}
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
}
jQuery.fn.extend({
css: function( name, value ) {
return jQuery.access( this, function( elem, name, value ) {
var len, styles,
map = {},
i = 0;
if ( jQuery.isArray( name ) ) {
styles = getStyles( elem );
len = name.length;
for ( ; i < len; i++ ) {
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
}
return map;
}
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
},
show: function() {
return showHide( this, true );
},
hide: function() {
return showHide( this );
},
toggle: function( state ) {
var bool = typeof state === "boolean";
return this.each(function() {
if ( bool ? state : isHidden( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
});
}
});
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"columnCount": true,
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, hooks,
origName = jQuery.camelCase( name ),
style = elem.style;
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
// but it would mean to define eight (for every problematic property) identical functions
if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
style[ name ] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra, styles ) {
var num, val, hooks,
origName = jQuery.camelCase( name );
// Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks ) {
val = hooks.get( elem, true, extra );
}
// Otherwise, if a way to get the computed value exists, use that
if ( val === undefined ) {
val = curCSS( elem, name, styles );
}
//convert "normal" to computed value
if ( val === "normal" && name in cssNormalTransform ) {
val = cssNormalTransform[ name ];
}
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if ( extra === "" || extra ) {
num = parseFloat( val );
return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
}
return val;
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback, args ) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
// NOTE: we've included the "window" in window.getComputedStyle
// because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
getStyles = function( elem ) {
return window.getComputedStyle( elem, null );
};
curCSS = function( elem, name, _computed ) {
var width, minWidth, maxWidth,
computed = _computed || getStyles( elem ),
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
style = elem.style;
if ( computed ) {
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret;
};
} else if ( document.documentElement.currentStyle ) {
getStyles = function( elem ) {
return elem.currentStyle;
};
curCSS = function( elem, name, _computed ) {
var left, rs, rsLeft,
computed = _computed || getStyles( elem ),
ret = computed ? computed[ name ] : undefined,
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && style[ name ] ) {
ret = style[ name ];
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
// but not position css attributes, as those are proportional to the parent element instead
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values
left = style.left;
rs = elem.runtimeStyle;
rsLeft = rs && rs.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
rs.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
rs.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
}
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
// If we already have the right measurement, avoid augmentation
4 :
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for ( ; i < 4; i += 2 ) {
// both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
}
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// at this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
// at this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
// at this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
}
}
return val;
}
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
}
// use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
styles
)
) + "px";
}
// Try to determine the default display value of an element
function css_defaultDisplay( nodeName ) {
var doc = document,
display = elemdisplay[ nodeName ];
if ( !display ) {
display = actualDisplay( nodeName, doc );
// If the simple way fails, read from inside an iframe
if ( display === "none" || !display ) {
// Use the already-created iframe if possible
iframe = ( iframe ||
jQuery("<iframe frameborder='0' width='0' height='0'/>")
.css( "cssText", "display:block !important" )
).appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
doc.write("<!doctype html><html><body>");
doc.close();
display = actualDisplay( nodeName, doc );
iframe.detach();
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return display;
}
// Called ONLY from within css_defaultDisplay
function actualDisplay( name, doc ) {
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
display = jQuery.css( elem[0], "display" );
elem.remove();
return display;
}
jQuery.each([ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
}) :
getWidthOrHeight( elem, name, extra );
}
},
set: function( elem, value, extra ) {
var styles = extra && getStyles( elem );
return setPositiveNumber( elem, value, extra ?
augmentWidthOrHeight(
elem,
name,
extra,
jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles
) : 0
);
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
// if value === "", then remove inline opacity #12685
if ( ( value >= 1 || value === "" ) &&
jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
style.removeAttribute ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there is no filter style applied in a css rule or unset inline opacity, we are done
if ( value === "" || currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
// These hooks cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
jQuery(function() {
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
if ( computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" },
curCSS, [ elem, "marginRight" ] );
}
}
};
}
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
jQuery.each( [ "top", "left" ], function( i, prop ) {
jQuery.cssHooks[ prop ] = {
get: function( elem, computed ) {
if ( computed ) {
computed = curCSS( elem, prop );
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test( computed ) ?
jQuery( elem ).position()[ prop ] + "px" :
computed;
}
}
};
});
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
// Support: Opera <= 12.12
// Opera reports offsetWidths and offsetHeights less than zero on some elements
return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
(!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
// These hooks are used by animate to expand properties
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i = 0,
expanded = {},
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [ value ];
for ( ; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
});
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
jQuery.fn.extend({
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
})
.filter(function(){
var type = this.type;
// Use .is(":disabled") so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !manipulation_rcheckableType.test( type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
//Serialize an array of form elements or a set of
//key/values into a query string
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
};
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// Item is non-scalar (array or object), encode its numeric index.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
});
jQuery.fn.hover = function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
};
var
// Document location
ajaxLocParts,
ajaxLocation,
ajax_nonce = jQuery.now(),
ajax_rquery = /\?/,
rhash = /#.*$/,
rts = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat("*");
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( (dataType = dataTypes[i++]) ) {
// Prepend if requested
if ( dataType[0] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
// Otherwise append
} else {
(structure[ dataType ] = structure[ dataType ] || []).push( func );
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
});
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var deep, key,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
return target;
}
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
var selector, response, type,
self = this,
off = url.indexOf(" ");
if ( off >= 0 ) {
selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( params && typeof params === "object" ) {
type = "POST";
}
// If we have elements to modify, make the request
if ( self.length > 0 ) {
jQuery.ajax({
url: url,
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
data: params
}).done(function( responseText ) {
// Save response for use in complete callback
response = arguments;
self.html( selector ?
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
}).complete( callback && function( jqXHR, status ) {
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
});
}
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
jQuery.fn[ type ] = function( fn ){
return this.on( type, fn );
};
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
url: url,
type: method,
dataType: type,
data: data,
success: callback
});
};
});
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: ajaxLocation,
type: "GET",
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": window.String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
url: true,
context: true
}
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
return settings ?
// Building a settings object
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
// Extending ajaxSettings
ajaxExtend( jQuery.ajaxSettings, target );
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // Cross-domain detection vars
parts,
// Loop variable
i,
// URL without anti-cache param
cacheURL,
// Response headers as string
responseHeadersString,
// timeout handle
timeoutTimer,
// To know if global events are to be dispatched
fireGlobals,
transport,
// Response headers
responseHeaders,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks("once memory"),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
state = 0,
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while ( (match = rheaders.exec( responseHeadersString )) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match == null ? null : match;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function( name, value ) {
var lname = name.toLowerCase();
if ( !state ) {
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function( map ) {
var code;
if ( map ) {
if ( state < 2 ) {
for ( code in map ) {
// Lazy-add the new callback in a way that preserves old ones
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
} else {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
}
}
return this;
},
// Cancel the request
abort: function( statusText ) {
var finalText = statusText || strAbort;
if ( transport ) {
transport.abort( finalText );
}
done( 0, finalText );
return this;
}
};
// Attach deferreds
deferred.promise( jqXHR ).complete = completeDeferred.add;
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
// A cross-domain request is in order when we have a protocol:host:port mismatch
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
);
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefilter, stop there
if ( state === 2 ) {
return jqXHR;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger("ajaxStart");
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
cacheURL = s.url;
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add anti-cache in url if needed
if ( s.cache === false ) {
s.url = rts.test( cacheURL ) ?
// If there is already a '_' parameter, set its value
cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
// Otherwise add one to the end
cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
}
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( jQuery.lastModified[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
}
if ( jQuery.etag[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already and return
return jqXHR.abort();
}
// aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout(function() {
jqXHR.abort("timeout");
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch ( e ) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
throw e;
}
}
}
// Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// If successful, handle type chaining
if ( status >= 200 && status < 300 || status === 304 ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader("Last-Modified");
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader("etag");
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 ) {
isSuccess = true;
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
isSuccess = true;
statusText = "notmodified";
// If we have data, let's convert it
} else {
isSuccess = ajaxConvert( s, response );
statusText = isSuccess.state;
success = isSuccess.data;
error = isSuccess.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( status || !statusText ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger("ajaxStop");
}
}
}
return jqXHR;
},
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
}
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields;
// Fill responseXXX fields
for ( type in responseFields ) {
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
// Chain conversions given the request and the original response
function ajaxConvert( s, response ) {
var conv2, current, conv, tmp,
converters = {},
i = 0,
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice(),
prev = dataTypes[ 0 ];
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
// Convert to each sequential dataType, tolerating list modification
for ( ; (current = dataTypes[++i]); ) {
// There's only work to do if current dataType is non-auto
if ( current !== "*" ) {
// Convert response if prev dataType is non-auto and differs from current
if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split(" ");
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.splice( i--, 0, current );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s["throws"] ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
}
}
}
}
// Update prev for next iteration
prev = current;
}
}
return { state: "success", data: response };
}
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /(?:java|ecma)script/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || jQuery("head")[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement("script");
script.async = true;
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( script.parentNode ) {
script.parentNode.removeChild( script );
}
// Dereference the script
script = null;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
// Use native DOM manipulation to avoid our domManip AJAX trickery
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( undefined, true );
}
}
};
}
});
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
this[ callback ] = true;
return callback;
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
// Insert callback into url or form data
if ( jsonProp ) {
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
} else if ( s.jsonp !== false ) {
s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
overwritten = window[ callbackName ];
window[ callbackName ] = function() {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always(function() {
// Restore preexisting value
window[ callbackName ] = overwritten;
// Save back as free
if ( s[ callbackName ] ) {
// make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push( callbackName );
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
}
responseContainer = overwritten = undefined;
});
// Delegate to script
return "script";
}
});
var xhrCallbacks, xhrSupported,
xhrId = 0,
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject && function() {
// Abort all pending requests
var key;
for ( key in xhrCallbacks ) {
xhrCallbacks[ key ]( undefined, true );
}
};
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
xhrSupported = jQuery.ajaxSettings.xhr();
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
xhrSupported = jQuery.support.ajax = !!xhrSupported;
// Create transport if the browser can provide an xhr
if ( xhrSupported ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var handle, i,
xhr = s.xhr();
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers["X-Requested-With"] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( err ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status, responseHeaders, statusText, responses;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occurred
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
responses = {};
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
if ( typeof xhr.responseText === "string" ) {
responses.text = xhr.responseText;
}
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
if ( !s.async ) {
// if we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
setTimeout( callback );
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback( undefined, true );
}
}
};
}
});
}
var fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
rrun = /queueHooks$/,
animationPrefilters = [ defaultPrefilter ],
tweeners = {
"*": [function( prop, value ) {
var end, unit,
tween = this.createTween( prop, value ),
parts = rfxnum.exec( value ),
target = tween.cur(),
start = +target || 0,
scale = 1,
maxIterations = 20;
if ( parts ) {
end = +parts[2];
unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" && start ) {
// Iteratively approximate from a nonzero starting point
// Prefer the current property, because this process will be trivial if it uses the same units
// Fallback to end or a simple constant
start = jQuery.css( tween.elem, prop, true ) || end || 1;
do {
// If previous iteration zeroed out, double until we get *something*
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply
start = start / scale;
jQuery.style( tween.elem, prop, start + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
}
tween.unit = unit;
tween.start = start;
// If a +=/-= token was provided, we're doing a relative animation
tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
}
return tween;
}]
};
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout(function() {
fxNow = undefined;
});
return ( fxNow = jQuery.now() );
}
function createTweens( animation, props ) {
jQuery.each( props, function( prop, value ) {
var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( collection[ index ].call( animation, prop, value ) ) {
// we're done with this property
return;
}
}
});
}
function Animation( elem, properties, options ) {
var result,
stopped,
index = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector
delete tick.elem;
}),
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ]);
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
},
animation = deferred.promise({
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, { specialEasing: {} }, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if ( stopped ) {
return this;
}
stopped = true;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( 1 );
}
// resolve when we played the last frame
// otherwise, reject
if ( gotoEnd ) {
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
}),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length ; index++ ) {
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
return result;
}
}
createTweens( animation, props );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
jQuery.fx.timer(
jQuery.extend( tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue
})
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
function propFilter( props, specialEasing ) {
var value, name, index, easing, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
jQuery.Animation = jQuery.extend( Animation, {
tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) {
callback = props;
props = [ "*" ];
} else {
props = props.split(" ");
}
var prop,
index = 0,
length = props.length;
for ( ; index < length ; index++ ) {
prop = props[ index ];
tweeners[ prop ] = tweeners[ prop ] || [];
tweeners[ prop ].unshift( callback );
}
},
prefilter: function( callback, prepend ) {
if ( prepend ) {
animationPrefilters.unshift( callback );
} else {
animationPrefilters.push( callback );
}
}
});
function defaultPrefilter( elem, props, opts ) {
/*jshint validthis:true */
var prop, index, length,
value, dataShow, toggle,
tween, hooks, oldfire,
anim = this,
style = elem.style,
orig = {},
handled = [],
hidden = elem.nodeType && isHidden( elem );
// handle queue: false promises
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function() {
// doing this makes sure that the complete handler will be called
// before this completes
anim.always(function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
});
});
}
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( elem, "display" ) === "inline" &&
jQuery.css( elem, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !jQuery.support.shrinkWrapBlocks ) {
anim.always(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
});
}
}
// show/hide pass
for ( index in props ) {
value = props[ index ];
if ( rfxtypes.exec( value ) ) {
delete props[ index ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
continue;
}
handled.push( index );
}
}
length = handled.length;
if ( length ) {
dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
// store state if its toggle - enables .stop().toggle() to "reverse"
if ( toggle ) {
dataShow.hidden = !hidden;
}
if ( hidden ) {
jQuery( elem ).show();
} else {
anim.done(function() {
jQuery( elem ).hide();
});
}
anim.done(function() {
var prop;
jQuery._removeData( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
});
for ( index = 0 ; index < length ; index++ ) {
prop = handled[ index ];
tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = tween.start;
if ( hidden ) {
tween.end = tween.start;
tween.start = prop === "width" || prop === "height" ? 1 : 0;
}
}
}
}
}
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function( elem, options, prop, end, easing, unit ) {
this.elem = elem;
this.prop = prop;
this.easing = easing || "swing";
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
},
cur: function() {
var hooks = Tween.propHooks[ this.prop ];
return hooks && hooks.get ?
hooks.get( this ) :
Tween.propHooks._default.get( this );
},
run: function( percent ) {
var eased,
hooks = Tween.propHooks[ this.prop ];
if ( this.options.duration ) {
this.pos = eased = jQuery.easing[ this.easing ](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
if ( hooks && hooks.set ) {
hooks.set( this );
} else {
Tween.propHooks._default.set( this );
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function( tween ) {
var result;
if ( tween.elem[ tween.prop ] != null &&
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
return tween.elem[ tween.prop ];
}
// passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result = jQuery.css( tween.elem, tween.prop, "" );
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function( tween ) {
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
tween.elem[ tween.prop ] = tween.now;
}
}
}
};
// Remove in 2.0 - this supports IE8's panic based approach
// to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) {
tween.elem[ tween.prop ] = tween.now;
}
}
};
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
});
jQuery.fn.extend({
fadeTo: function( speed, to, easing, callback ) {
// show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show()
// animate to the value specified
.end().animate({ opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
doAnimation.finish = function() {
anim.stop( true );
};
// Empty animations, or finishing resolves immediately
if ( empty || jQuery._data( this, "finish" ) ) {
anim.stop( true );
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
var stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
};
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = jQuery._data( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
stopQueue( data[ index ] );
}
} else {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
stopQueue( data[ index ] );
}
}
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
timers.splice( index, 1 );
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
});
},
finish: function( type ) {
if ( type !== false ) {
type = type || "fx";
}
return this.each(function() {
var index,
data = jQuery._data( this ),
queue = data[ type + "queue" ],
hooks = data[ type + "queueHooks" ],
timers = jQuery.timers,
length = queue ? queue.length : 0;
// enable finishing flag on private data
data.finish = true;
// empty the queue first
jQuery.queue( this, type, [] );
if ( hooks && hooks.cur && hooks.cur.finish ) {
hooks.cur.finish.call( this );
}
// look for any active animations, and finish them
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
timers[ index ].anim.stop( true );
timers.splice( index, 1 );
}
}
// look for any animations in the old queue and finish them
for ( index = 0; index < length; index++ ) {
if ( queue[ index ] && queue[ index ].finish ) {
queue[ index ].finish.call( this );
}
}
// turn off finishing flag
delete data.finish;
});
}
});
// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
var which,
attrs = { height: type },
i = 0;
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth? 1 : 0;
for( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show"),
slideUp: genFx("hide"),
slideToggle: genFx("toggle"),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.speed = function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
// normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function() {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
}
};
return opt;
};
jQuery.easing = {
linear: function( p ) {
return p;
},
swing: function( p ) {
return 0.5 - Math.cos( p*Math.PI ) / 2;
}
};
jQuery.timers = [];
jQuery.fx = Tween.prototype.init;
jQuery.fx.tick = function() {
var timer,
timers = jQuery.timers,
i = 0;
fxNow = jQuery.now();
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Checks the timer has not already been removed
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
fxNow = undefined;
};
jQuery.fx.timer = function( timer ) {
if ( timer() && jQuery.timers.push( timer ) ) {
jQuery.fx.start();
}
};
jQuery.fx.interval = 13;
jQuery.fx.start = function() {
if ( !timerId ) {
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};
jQuery.fx.stop = function() {
clearInterval( timerId );
timerId = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
// Back Compat <1.8 extension point
jQuery.fx.step = {};
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var docElem, win,
box = { top: 0, left: 0 },
elem = this[ 0 ],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return;
}
docElem = doc.documentElement;
// Make sure it's not a disconnected DOM node
if ( !jQuery.contains( docElem, elem ) ) {
return box;
}
// If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc );
return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
};
};
jQuery.offset = {
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[ 0 ] ) {
return;
}
var offsetParent, offset,
parentOffset = { top: 0, left: 0 },
elem = this[ 0 ];
// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) {
// we assume that getBoundingClientRect is available when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
// Get *real* offsetParent
offsetParent = this.offsetParent();
// Get correct offsets
offset = this.offset();
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
parentOffset = offsetParent.offset();
}
// Add offsetParent borders
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
}
// Subtract parent offsets and element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
return {
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.documentElement;
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || document.documentElement;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
var top = /Y/.test( prop );
jQuery.fn[ method ] = function( val ) {
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? (prop in win) ? win[ prop ] :
win.document.documentElement[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
// margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return jQuery.access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
});
});
// Limit scope pollution from any deprecated API
// (function() {
// })();
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use a proper concatenation script that understands anonymous
// AMD modules. A named AMD is safest and most robust way to register.
// Lowercase jquery is used because AMD module names are derived from
// file names, and jQuery is normally delivered in a lowercase file name.
// Do this after creating the global so that if an AMD module wants to call
// noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
})( window );
|
src/js/components/chart/MarkerLabel.js
|
odedre/grommet-final
|
// (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import CSSClassnames from '../../utils/CSSClassnames';
import Props from '../../utils/Props';
import { announce } from '../../utils/Announcer';
const CLASS_ROOT = CSSClassnames.CHART_MARKER_LABEL;
const COLOR_INDEX = CSSClassnames.COLOR_INDEX;
export default class MarkerLabel extends Component {
constructor(props, context) {
super(props, context);
this.state = {
valueBasis: this._valueBasis(props)
};
}
componentWillReceiveProps (nextProps) {
const nextValueBasis = this._valueBasis(nextProps);
if (nextValueBasis !== this.state.valueBasis) {
this.setState({
valueBasis: nextValueBasis
}, () => {
if (typeof nextProps.label === 'string' ||
typeof nextProps.label === 'number') {
announce(nextProps.label);
}
});
}
}
_valueBasis (props) {
const { count, index, max, min, value } = props;
let valueBasis;
if (count) {
valueBasis = (index / Math.max(1, (count - 1))) * 100.0;
} else {
valueBasis = ((value - min) / Math.max(1, (max - min))) * 100.0;
}
return valueBasis;
}
_renderPlaceholder (basis) {
const classes = classnames(
`${CLASS_ROOT}__slot`,
`${CLASS_ROOT}__slot--placeholder`
);
return (
<div key="placeholder" className={classes} aria-hidden='true'
style={{ flexBasis: `${basis}%` }} />
);
}
_renderLabel (basis, flip) {
const { colorIndex } = this.props;
let { label } = this.props;
const classes = classnames(
`${CLASS_ROOT}__slot`, {
[`${CLASS_ROOT}__slot--flip`]: flip,
[`${COLOR_INDEX}-${colorIndex}`]: colorIndex
}
);
if (typeof label === 'string' || typeof label === 'number') {
label = <span>{label}</span>;
} else if (label.propTypes && label.propTypes.announce) {
// added for a11y to announce changes in the values
label = React.cloneElement(label, {
announce: true
});
}
return (
<div key="label" className={classes}
style={{ flexBasis: `${basis}%` }}>
{label}
</div>
);
}
render () {
const { align, className, reverse, vertical } = this.props;
const { valueBasis } = this.state;
const restProps = Props.omit(this.props,
Object.keys(MarkerLabel.propTypes));
const classes = classnames(
CLASS_ROOT, {
[`${CLASS_ROOT}--reverse`]: reverse,
[`${CLASS_ROOT}--vertical`]: vertical,
[`${CLASS_ROOT}--align-${align}`]: align
},
className
);
let firstItem, secondItem;
if (valueBasis < 50) {
// marker value in first half, align it after
firstItem = this._renderPlaceholder(valueBasis);
secondItem = this._renderLabel(100.0 - valueBasis, true);
} else {
// marker value in second half, align it before
firstItem = this._renderLabel(valueBasis);
secondItem = this._renderPlaceholder(100.0 - valueBasis);
}
return (
<div {...restProps} className={classes} >
{firstItem}
{secondItem}
</div>
);
}
}
// Need either count and index or value, min, and max
MarkerLabel.propTypes = {
align: PropTypes.oneOf(['start', 'end']), // only from Chart
colorIndex: PropTypes.string,
count: PropTypes.number,
index: PropTypes.number,
label: PropTypes.node,
max: PropTypes.number,
min: PropTypes.number,
reverse: PropTypes.bool,
value: PropTypes.number,
vertical: PropTypes.bool
};
MarkerLabel.defaultProps = {
max: 100,
min: 0
};
|
ajax/libs/vkui/4.27.2/cjs/lib/SSR.js
|
cdnjs/cdnjs
|
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SSRWrapper = exports.SSRContext = void 0;
var _jsxRuntime = require("./jsxRuntime");
var React = _interopRequireWildcard(require("react"));
var _platform = require("./platform");
var _browser = require("./browser");
var _dom = require("../lib/dom");
var SSRContext = /*#__PURE__*/React.createContext({
platform: null,
userAgent: "",
browserInfo: undefined
});
exports.SSRContext = SSRContext;
var SSRWrapper = function SSRWrapper(props) {
var userAgent = props.userAgent,
browserInfo = props.browserInfo,
children = props.children;
if (!browserInfo && userAgent) {
browserInfo = (0, _browser.computeBrowserInfo)(userAgent);
} // TODO: Каждый раз создаётся новый объект для контекста - плохо
var contextValue = {
platform: (0, _platform.platform)(browserInfo),
browserInfo: browserInfo,
userAgent: userAgent
}; // TODO: move to state, and update in effect?
var dom = (0, _dom.getDOM)();
return (0, _jsxRuntime.createScopedElement)(SSRContext.Provider, {
value: contextValue
}, (0, _jsxRuntime.createScopedElement)(_dom.DOMContext.Provider, {
value: dom
}, children));
};
exports.SSRWrapper = SSRWrapper;
//# sourceMappingURL=SSR.js.map
|
ajax/libs/primereact/7.0.0-rc.2/messages/messages.esm.js
|
cdnjs/cdnjs
|
import React, { Component } from 'react';
import { Ripple, classNames, CSSTransition } from 'primereact/core';
import { TransitionGroup } from 'react-transition-group';
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var UIMessageComponent = /*#__PURE__*/function (_Component) {
_inherits(UIMessageComponent, _Component);
var _super = _createSuper$1(UIMessageComponent);
function UIMessageComponent(props) {
var _this;
_classCallCheck(this, UIMessageComponent);
_this = _super.call(this, props);
_this.onClick = _this.onClick.bind(_assertThisInitialized(_this));
_this.onClose = _this.onClose.bind(_assertThisInitialized(_this));
return _this;
}
_createClass(UIMessageComponent, [{
key: "componentDidMount",
value: function componentDidMount() {
var _this2 = this;
if (!this.props.message.sticky) {
this.timeout = setTimeout(function () {
_this2.onClose(null);
}, this.props.message.life || 3000);
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (this.timeout) {
clearTimeout(this.timeout);
}
}
}, {
key: "onClose",
value: function onClose(event) {
if (this.timeout) {
clearTimeout(this.timeout);
}
if (this.props.onClose) {
this.props.onClose(this.props.message);
}
if (event) {
event.preventDefault();
event.stopPropagation();
}
}
}, {
key: "onClick",
value: function onClick() {
if (this.props.onClick) {
this.props.onClick(this.props.message);
}
}
}, {
key: "renderCloseIcon",
value: function renderCloseIcon() {
if (this.props.message.closable !== false) {
return /*#__PURE__*/React.createElement("button", {
type: "button",
className: "p-message-close p-link",
onClick: this.onClose
}, /*#__PURE__*/React.createElement("i", {
className: "p-message-close-icon pi pi-times"
}), /*#__PURE__*/React.createElement(Ripple, null));
}
return null;
}
}, {
key: "renderMessage",
value: function renderMessage() {
if (this.props.message) {
var _this$props$message = this.props.message,
severity = _this$props$message.severity,
content = _this$props$message.content,
summary = _this$props$message.summary,
detail = _this$props$message.detail;
var icon = classNames('p-message-icon pi ', {
'pi-info-circle': severity === 'info',
'pi-check': severity === 'success',
'pi-exclamation-triangle': severity === 'warn',
'pi-times-circle': severity === 'error'
});
return content || /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
className: icon
}), /*#__PURE__*/React.createElement("span", {
className: "p-message-summary"
}, summary), /*#__PURE__*/React.createElement("span", {
className: "p-message-detail"
}, detail));
}
return null;
}
}, {
key: "render",
value: function render() {
var severity = this.props.message.severity;
var className = 'p-message p-component p-message-' + severity;
var closeIcon = this.renderCloseIcon();
var message = this.renderMessage();
return /*#__PURE__*/React.createElement("div", {
ref: this.props.forwardRef,
className: className,
onClick: this.onClick
}, /*#__PURE__*/React.createElement("div", {
className: "p-message-wrapper"
}, message, closeIcon));
}
}]);
return UIMessageComponent;
}(Component);
_defineProperty(UIMessageComponent, "defaultProps", {
message: null,
onClose: null,
onClick: null
});
var UIMessage = /*#__PURE__*/React.forwardRef(function (props, ref) {
return /*#__PURE__*/React.createElement(UIMessageComponent, _extends({
forwardRef: ref
}, props));
});
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var messageIdx = 0;
var Messages = /*#__PURE__*/function (_Component) {
_inherits(Messages, _Component);
var _super = _createSuper(Messages);
function Messages(props) {
var _this;
_classCallCheck(this, Messages);
_this = _super.call(this, props);
_this.state = {
messages: []
};
_this.onClose = _this.onClose.bind(_assertThisInitialized(_this));
return _this;
}
_createClass(Messages, [{
key: "show",
value: function show(value) {
if (value) {
var newMessages = [];
if (Array.isArray(value)) {
for (var i = 0; i < value.length; i++) {
value[i].id = messageIdx++;
newMessages = [].concat(_toConsumableArray(this.state.messages), _toConsumableArray(value));
}
} else {
value.id = messageIdx++;
newMessages = this.state.messages ? [].concat(_toConsumableArray(this.state.messages), [value]) : [value];
}
this.setState({
messages: newMessages
});
}
}
}, {
key: "clear",
value: function clear() {
this.setState({
messages: []
});
}
}, {
key: "replace",
value: function replace(value) {
var _this2 = this;
this.setState({
messages: []
}, function () {
return _this2.show(value);
});
}
}, {
key: "onClose",
value: function onClose(message) {
var newMessages = this.state.messages.filter(function (msg) {
return msg.id !== message.id;
});
this.setState({
messages: newMessages
});
if (this.props.onRemove) {
this.props.onRemove(message);
}
}
}, {
key: "render",
value: function render() {
var _this3 = this;
return /*#__PURE__*/React.createElement("div", {
id: this.props.id,
className: this.props.className,
style: this.props.style
}, /*#__PURE__*/React.createElement(TransitionGroup, null, this.state.messages.map(function (message) {
var messageRef = /*#__PURE__*/React.createRef();
return /*#__PURE__*/React.createElement(CSSTransition, {
nodeRef: messageRef,
key: message.id,
classNames: "p-message",
unmountOnExit: true,
timeout: {
enter: 300,
exit: 300
},
options: _this3.props.transitionOptions
}, /*#__PURE__*/React.createElement(UIMessage, {
ref: messageRef,
message: message,
onClick: _this3.props.onClick,
onClose: _this3.onClose
}));
})));
}
}]);
return Messages;
}(Component);
_defineProperty(Messages, "defaultProps", {
id: null,
className: null,
style: null,
transitionOptions: null,
onRemove: null,
onClick: null
});
export { Messages };
|
blueprints/view/files/__test__/views/__name__View.spec.js
|
samzhao/HR-Recruitment-Management-System
|
import React from 'react'
describe('(View) <%= pascalEntityName %>', () => {
it('should exist', () => {
})
})
|
ajax/libs/angular-ui-select/0.9.6/select.js
|
mscharl/cdnjs
|
/*!
* ui-select
* http://github.com/angular-ui/ui-select
* Version: 0.9.6 - 2015-01-12T20:24:40.589Z
* License: MIT
*/
(function () {
"use strict";
var KEY = {
TAB: 9,
ENTER: 13,
ESC: 27,
SPACE: 32,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
SHIFT: 16,
CTRL: 17,
ALT: 18,
PAGE_UP: 33,
PAGE_DOWN: 34,
HOME: 36,
END: 35,
BACKSPACE: 8,
DELETE: 46,
COMMAND: 91,
MAP: { 91 : "COMMAND", 8 : "BACKSPACE" , 9 : "TAB" , 13 : "ENTER" , 16 : "SHIFT" , 17 : "CTRL" , 18 : "ALT" , 19 : "PAUSEBREAK" , 20 : "CAPSLOCK" , 27 : "ESC" , 32 : "SPACE" , 33 : "PAGE_UP", 34 : "PAGE_DOWN" , 35 : "END" , 36 : "HOME" , 37 : "LEFT" , 38 : "UP" , 39 : "RIGHT" , 40 : "DOWN" , 43 : "+" , 44 : "PRINTSCREEN" , 45 : "INSERT" , 46 : "DELETE", 48 : "0" , 49 : "1" , 50 : "2" , 51 : "3" , 52 : "4" , 53 : "5" , 54 : "6" , 55 : "7" , 56 : "8" , 57 : "9" , 59 : ";", 61 : "=" , 65 : "A" , 66 : "B" , 67 : "C" , 68 : "D" , 69 : "E" , 70 : "F" , 71 : "G" , 72 : "H" , 73 : "I" , 74 : "J" , 75 : "K" , 76 : "L", 77 : "M" , 78 : "N" , 79 : "O" , 80 : "P" , 81 : "Q" , 82 : "R" , 83 : "S" , 84 : "T" , 85 : "U" , 86 : "V" , 87 : "W" , 88 : "X" , 89 : "Y" , 90 : "Z", 96 : "0" , 97 : "1" , 98 : "2" , 99 : "3" , 100 : "4" , 101 : "5" , 102 : "6" , 103 : "7" , 104 : "8" , 105 : "9", 106 : "*" , 107 : "+" , 109 : "-" , 110 : "." , 111 : "/", 112 : "F1" , 113 : "F2" , 114 : "F3" , 115 : "F4" , 116 : "F5" , 117 : "F6" , 118 : "F7" , 119 : "F8" , 120 : "F9" , 121 : "F10" , 122 : "F11" , 123 : "F12", 144 : "NUMLOCK" , 145 : "SCROLLLOCK" , 186 : ";" , 187 : "=" , 188 : "," , 189 : "-" , 190 : "." , 191 : "/" , 192 : "`" , 219 : "[" , 220 : "\\" , 221 : "]" , 222 : "'"
},
isControl: function (e) {
var k = e.which;
switch (k) {
case KEY.COMMAND:
case KEY.SHIFT:
case KEY.CTRL:
case KEY.ALT:
return true;
}
if (e.metaKey) return true;
return false;
},
isFunctionKey: function (k) {
k = k.which ? k.which : k;
return k >= 112 && k <= 123;
},
isVerticalMovement: function (k){
return ~[KEY.UP, KEY.DOWN].indexOf(k);
},
isHorizontalMovement: function (k){
return ~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k);
}
};
/**
* Add querySelectorAll() to jqLite.
*
* jqLite find() is limited to lookups by tag name.
* TODO This will change with future versions of AngularJS, to be removed when this happens
*
* See jqLite.find - why not use querySelectorAll? https://github.com/angular/angular.js/issues/3586
* See feat(jqLite): use querySelectorAll instead of getElementsByTagName in jqLite.find https://github.com/angular/angular.js/pull/3598
*/
if (angular.element.prototype.querySelectorAll === undefined) {
angular.element.prototype.querySelectorAll = function(selector) {
return angular.element(this[0].querySelectorAll(selector));
};
}
/**
* Add closest() to jqLite.
*/
if (angular.element.prototype.closest === undefined) {
angular.element.prototype.closest = function( selector) {
var elem = this[0];
var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector;
while (elem) {
if (matchesSelector.bind(elem)(selector)) {
return elem;
} else {
elem = elem.parentElement;
}
}
return false;
};
}
angular.module('ui.select', [])
.constant('uiSelectConfig', {
theme: 'bootstrap',
searchEnabled: true,
placeholder: '', // Empty by default, like HTML tag <select>
refreshDelay: 1000, // In milliseconds
closeOnSelect: true
})
// See Rename minErr and make it accessible from outside https://github.com/angular/angular.js/issues/6913
.service('uiSelectMinErr', function() {
var minErr = angular.$$minErr('ui.select');
return function() {
var error = minErr.apply(this, arguments);
var message = error.message.replace(new RegExp('\nhttp://errors.angularjs.org/.*'), '');
return new Error(message);
};
})
/**
* Parses "repeat" attribute.
*
* Taken from AngularJS ngRepeat source code
* See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L211
*
* Original discussion about parsing "repeat" attribute instead of fully relying on ng-repeat:
* https://github.com/angular-ui/ui-select/commit/5dd63ad#commitcomment-5504697
*/
.service('RepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinErr, $parse) {
var self = this;
/**
* Example:
* expression = "address in addresses | filter: {street: $select.search} track by $index"
* itemName = "address",
* source = "addresses | filter: {street: $select.search}",
* trackByExp = "$index",
*/
self.parse = function(expression) {
var match = expression.match(/^\s*(?:([\s\S]+?)\s+as\s+)?([\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
if (!match) {
throw uiSelectMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",
expression);
}
return {
itemName: match[2], // (lhs) Left-hand side,
source: $parse(match[3]),
trackByExp: match[4],
modelMapper: $parse(match[1] || match[2])
};
};
self.getGroupNgRepeatExpression = function() {
return '$group in $select.groups';
};
self.getNgRepeatExpression = function(itemName, source, trackByExp, grouped) {
var expression = itemName + ' in ' + (grouped ? '$group.items' : source);
if (trackByExp) {
expression += ' track by ' + trackByExp;
}
return expression;
};
}])
/**
* Contains ui-select "intelligence".
*
* The goal is to limit dependency on the DOM whenever possible and
* put as much logic in the controller (instead of the link functions) as possible so it can be easily tested.
*/
.controller('uiSelectCtrl',
['$scope', '$element', '$timeout', '$filter', 'RepeatParser', 'uiSelectMinErr', 'uiSelectConfig',
function($scope, $element, $timeout, $filter, RepeatParser, uiSelectMinErr, uiSelectConfig) {
var ctrl = this;
var EMPTY_SEARCH = '';
ctrl.placeholder = undefined;
ctrl.search = EMPTY_SEARCH;
ctrl.activeIndex = 0;
ctrl.activeMatchIndex = -1;
ctrl.items = [];
ctrl.selected = undefined;
ctrl.open = false;
ctrl.focus = false;
ctrl.focusser = undefined; //Reference to input element used to handle focus events
ctrl.disabled = undefined; // Initialized inside uiSelect directive link function
ctrl.searchEnabled = undefined; // Initialized inside uiSelect directive link function
ctrl.resetSearchInput = undefined; // Initialized inside uiSelect directive link function
ctrl.refreshDelay = undefined; // Initialized inside uiSelectChoices directive link function
ctrl.multiple = false; // Initialized inside uiSelect directive link function
ctrl.disableChoiceExpression = undefined; // Initialized inside uiSelect directive link function
ctrl.tagging = {isActivated: false, fct: undefined};
ctrl.taggingTokens = {isActivated: false, tokens: undefined};
ctrl.lockChoiceExpression = undefined; // Initialized inside uiSelect directive link function
ctrl.closeOnSelect = true; // Initialized inside uiSelect directive link function
ctrl.clickTriggeredSelect = false;
ctrl.$filter = $filter;
ctrl.isEmpty = function() {
return angular.isUndefined(ctrl.selected) || ctrl.selected === null || ctrl.selected === '';
};
var _searchInput = $element.querySelectorAll('input.ui-select-search');
if (_searchInput.length !== 1) {
throw uiSelectMinErr('searchInput', "Expected 1 input.ui-select-search but got '{0}'.", _searchInput.length);
}
// Most of the time the user does not want to empty the search input when in typeahead mode
function _resetSearchInput() {
if (ctrl.resetSearchInput || (ctrl.resetSearchInput === undefined && uiSelectConfig.resetSearchInput)) {
ctrl.search = EMPTY_SEARCH;
//reset activeIndex
if (ctrl.selected && ctrl.items.length && !ctrl.multiple) {
ctrl.activeIndex = ctrl.items.indexOf(ctrl.selected);
}
}
}
// When the user clicks on ui-select, displays the dropdown list
ctrl.activate = function(initSearchValue, avoidReset) {
if (!ctrl.disabled && !ctrl.open) {
if(!avoidReset) _resetSearchInput();
ctrl.focusser.prop('disabled', true); //Will reactivate it on .close()
ctrl.open = true;
ctrl.activeMatchIndex = -1;
ctrl.activeIndex = ctrl.activeIndex >= ctrl.items.length ? 0 : ctrl.activeIndex;
// ensure that the index is set to zero for tagging variants
// that where first option is auto-selected
if ( ctrl.activeIndex === -1 && ctrl.taggingLabel !== false ) {
ctrl.activeIndex = 0;
}
// Give it time to appear before focus
$timeout(function() {
ctrl.search = initSearchValue || ctrl.search;
_searchInput[0].focus();
});
}
};
ctrl.findGroupByName = function(name) {
return ctrl.groups && ctrl.groups.filter(function(group) {
return group.name === name;
})[0];
};
ctrl.parseRepeatAttr = function(repeatAttr, groupByExp) {
function updateGroups(items) {
ctrl.groups = [];
angular.forEach(items, function(item) {
var groupFn = $scope.$eval(groupByExp);
var groupName = angular.isFunction(groupFn) ? groupFn(item) : item[groupFn];
var group = ctrl.findGroupByName(groupName);
if(group) {
group.items.push(item);
}
else {
ctrl.groups.push({name: groupName, items: [item]});
}
});
ctrl.items = [];
ctrl.groups.forEach(function(group) {
ctrl.items = ctrl.items.concat(group.items);
});
}
function setPlainItems(items) {
ctrl.items = items;
}
var setItemsFn = groupByExp ? updateGroups : setPlainItems;
ctrl.parserResult = RepeatParser.parse(repeatAttr);
ctrl.isGrouped = !!groupByExp;
ctrl.itemProperty = ctrl.parserResult.itemName;
// See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L259
$scope.$watchCollection(ctrl.parserResult.source, function(items) {
if (items === undefined || items === null) {
// If the user specifies undefined or null => reset the collection
// Special case: items can be undefined if the user did not initialized the collection on the scope
// i.e $scope.addresses = [] is missing
ctrl.items = [];
} else {
if (!angular.isArray(items)) {
throw uiSelectMinErr('items', "Expected an array but got '{0}'.", items);
} else {
if (ctrl.multiple){
//Remove already selected items (ex: while searching)
var filteredItems = items.filter(function(i) {return ctrl.selected.indexOf(i) < 0;});
setItemsFn(filteredItems);
}else{
setItemsFn(items);
}
ctrl.ngModel.$modelValue = null; //Force scope model value and ngModel value to be out of sync to re-run formatters
}
}
});
if (ctrl.multiple){
//Remove already selected items
$scope.$watchCollection('$select.selected', function(selectedItems){
var data = ctrl.parserResult.source($scope);
if (!selectedItems.length) {
setItemsFn(data);
}else{
if ( data !== undefined ) {
var filteredItems = data.filter(function(i) {return selectedItems.indexOf(i) < 0;});
setItemsFn(filteredItems);
}
}
ctrl.sizeSearchInput();
});
}
};
var _refreshDelayPromise;
/**
* Typeahead mode: lets the user refresh the collection using his own function.
*
* See Expose $select.search for external / remote filtering https://github.com/angular-ui/ui-select/pull/31
*/
ctrl.refresh = function(refreshAttr) {
if (refreshAttr !== undefined) {
// Debounce
// See https://github.com/angular-ui/bootstrap/blob/0.10.0/src/typeahead/typeahead.js#L155
// FYI AngularStrap typeahead does not have debouncing: https://github.com/mgcrea/angular-strap/blob/v2.0.0-rc.4/src/typeahead/typeahead.js#L177
if (_refreshDelayPromise) {
$timeout.cancel(_refreshDelayPromise);
}
_refreshDelayPromise = $timeout(function() {
$scope.$eval(refreshAttr);
}, ctrl.refreshDelay);
}
};
ctrl.setActiveItem = function(item) {
ctrl.activeIndex = ctrl.items.indexOf(item);
};
ctrl.isActive = function(itemScope) {
if ( !ctrl.open ) {
return false;
}
var itemIndex = ctrl.items.indexOf(itemScope[ctrl.itemProperty]);
var isActive = itemIndex === ctrl.activeIndex;
if ( !isActive || ( itemIndex < 0 && ctrl.taggingLabel !== false ) ||( itemIndex < 0 && ctrl.taggingLabel === false) ) {
return false;
}
if (isActive && !angular.isUndefined(ctrl.onHighlightCallback)) {
itemScope.$eval(ctrl.onHighlightCallback);
}
return isActive;
};
ctrl.isDisabled = function(itemScope) {
if (!ctrl.open) return;
var itemIndex = ctrl.items.indexOf(itemScope[ctrl.itemProperty]);
var isDisabled = false;
var item;
if (itemIndex >= 0 && !angular.isUndefined(ctrl.disableChoiceExpression)) {
item = ctrl.items[itemIndex];
isDisabled = !!(itemScope.$eval(ctrl.disableChoiceExpression)); // force the boolean value
item._uiSelectChoiceDisabled = isDisabled; // store this for later reference
}
return isDisabled;
};
// When the user selects an item with ENTER or clicks the dropdown
ctrl.select = function(item, skipFocusser, $event) {
if (item === undefined || !item._uiSelectChoiceDisabled) {
if ( ! ctrl.items && ! ctrl.search ) return;
if (!item || !item._uiSelectChoiceDisabled) {
if(ctrl.tagging.isActivated) {
// if taggingLabel is disabled, we pull from ctrl.search val
if ( ctrl.taggingLabel === false ) {
if ( ctrl.activeIndex < 0 ) {
item = ctrl.tagging.fct !== undefined ? ctrl.tagging.fct(ctrl.search) : ctrl.search;
if ( angular.equals( ctrl.items[0], item ) ) {
return;
}
} else {
// keyboard nav happened first, user selected from dropdown
item = ctrl.items[ctrl.activeIndex];
}
} else {
// tagging always operates at index zero, taggingLabel === false pushes
// the ctrl.search value without having it injected
if ( ctrl.activeIndex === 0 ) {
// ctrl.tagging pushes items to ctrl.items, so we only have empty val
// for `item` if it is a detected duplicate
if ( item === undefined ) return;
// create new item on the fly if we don't already have one;
// use tagging function if we have one
if ( ctrl.tagging.fct !== undefined && typeof item === 'string' ) {
item = ctrl.tagging.fct(ctrl.search);
// if item type is 'string', apply the tagging label
} else if ( typeof item === 'string' ) {
// trim the trailing space
item = item.replace(ctrl.taggingLabel,'').trim();
}
}
}
// search ctrl.selected for dupes potentially caused by tagging and return early if found
if ( ctrl.selected && ctrl.selected.filter( function (selection) { return angular.equals(selection, item); }).length > 0 ) {
ctrl.close(skipFocusser);
return;
}
}
var locals = {};
locals[ctrl.parserResult.itemName] = item;
if(ctrl.multiple) {
ctrl.selected.push(item);
ctrl.sizeSearchInput();
} else {
ctrl.selected = item;
}
$timeout(function(){
ctrl.onSelectCallback($scope, {
$item: item,
$model: ctrl.parserResult.modelMapper($scope, locals)
});
});
if (!ctrl.multiple || ctrl.closeOnSelect) {
ctrl.close(skipFocusser);
}
if ($event && $event.type === 'click') {
ctrl.clickTriggeredSelect = true;
}
}
}
};
// Closes the dropdown
ctrl.close = function(skipFocusser) {
if (!ctrl.open) return;
_resetSearchInput();
ctrl.open = false;
if (!ctrl.multiple){
$timeout(function(){
ctrl.focusser.prop('disabled', false);
if (!skipFocusser) ctrl.focusser[0].focus();
},0,false);
}
};
// Toggle dropdown
ctrl.toggle = function(e) {
if (ctrl.open) {
ctrl.close();
e.preventDefault();
e.stopPropagation();
} else {
ctrl.activate();
}
};
ctrl.isLocked = function(itemScope, itemIndex) {
var isLocked, item = ctrl.selected[itemIndex];
if (item && !angular.isUndefined(ctrl.lockChoiceExpression)) {
isLocked = !!(itemScope.$eval(ctrl.lockChoiceExpression)); // force the boolean value
item._uiSelectChoiceLocked = isLocked; // store this for later reference
}
return isLocked;
};
// Remove item from multiple select
ctrl.removeChoice = function(index){
var removedChoice = ctrl.selected[index];
// if the choice is locked, can't remove it
if(removedChoice._uiSelectChoiceLocked) return;
var locals = {};
locals[ctrl.parserResult.itemName] = removedChoice;
ctrl.selected.splice(index, 1);
ctrl.activeMatchIndex = -1;
ctrl.sizeSearchInput();
// Give some time for scope propagation.
$timeout(function(){
ctrl.onRemoveCallback($scope, {
$item: removedChoice,
$model: ctrl.parserResult.modelMapper($scope, locals)
});
});
};
ctrl.getPlaceholder = function(){
//Refactor single?
if(ctrl.multiple && ctrl.selected.length) return;
return ctrl.placeholder;
};
var containerSizeWatch;
ctrl.sizeSearchInput = function(){
var input = _searchInput[0],
container = _searchInput.parent().parent()[0];
_searchInput.css('width','10px');
var calculate = function(){
var newWidth = container.clientWidth - input.offsetLeft - 10;
if(newWidth < 50) newWidth = container.clientWidth;
_searchInput.css('width',newWidth+'px');
};
$timeout(function(){ //Give tags time to render correctly
if (container.clientWidth === 0 && !containerSizeWatch){
containerSizeWatch = $scope.$watch(function(){ return container.clientWidth;}, function(newValue){
if (newValue !== 0){
calculate();
containerSizeWatch();
containerSizeWatch = null;
}
});
}else if (!containerSizeWatch) {
calculate();
}
}, 0, false);
};
function _handleDropDownSelection(key) {
var processed = true;
switch (key) {
case KEY.DOWN:
if (!ctrl.open && ctrl.multiple) ctrl.activate(false, true); //In case its the search input in 'multiple' mode
else if (ctrl.activeIndex < ctrl.items.length - 1) { ctrl.activeIndex++; }
break;
case KEY.UP:
if (!ctrl.open && ctrl.multiple) ctrl.activate(false, true); //In case its the search input in 'multiple' mode
else if (ctrl.activeIndex > 0 || (ctrl.search.length === 0 && ctrl.tagging.isActivated)) { ctrl.activeIndex--; }
break;
case KEY.TAB:
if (!ctrl.multiple || ctrl.open) ctrl.select(ctrl.items[ctrl.activeIndex], true);
break;
case KEY.ENTER:
if(ctrl.open){
ctrl.select(ctrl.items[ctrl.activeIndex]);
} else {
ctrl.activate(false, true); //In case its the search input in 'multiple' mode
}
break;
case KEY.ESC:
ctrl.close();
break;
default:
processed = false;
}
return processed;
}
// Handles selected options in "multiple" mode
function _handleMatchSelection(key){
var caretPosition = _getCaretPosition(_searchInput[0]),
length = ctrl.selected.length,
// none = -1,
first = 0,
last = length-1,
curr = ctrl.activeMatchIndex,
next = ctrl.activeMatchIndex+1,
prev = ctrl.activeMatchIndex-1,
newIndex = curr;
if(caretPosition > 0 || (ctrl.search.length && key == KEY.RIGHT)) return false;
ctrl.close();
function getNewActiveMatchIndex(){
switch(key){
case KEY.LEFT:
// Select previous/first item
if(~ctrl.activeMatchIndex) return prev;
// Select last item
else return last;
break;
case KEY.RIGHT:
// Open drop-down
if(!~ctrl.activeMatchIndex || curr === last){
ctrl.activate();
return false;
}
// Select next/last item
else return next;
break;
case KEY.BACKSPACE:
// Remove selected item and select previous/first
if(~ctrl.activeMatchIndex){
ctrl.removeChoice(curr);
return prev;
}
// Select last item
else return last;
break;
case KEY.DELETE:
// Remove selected item and select next item
if(~ctrl.activeMatchIndex){
ctrl.removeChoice(ctrl.activeMatchIndex);
return curr;
}
else return false;
}
}
newIndex = getNewActiveMatchIndex();
if(!ctrl.selected.length || newIndex === false) ctrl.activeMatchIndex = -1;
else ctrl.activeMatchIndex = Math.min(last,Math.max(first,newIndex));
return true;
}
// Bind to keyboard shortcuts
_searchInput.on('keydown', function(e) {
var key = e.which;
// if(~[KEY.ESC,KEY.TAB].indexOf(key)){
// //TODO: SEGURO?
// ctrl.close();
// }
$scope.$apply(function() {
var processed = false;
var tagged = false;
if(ctrl.multiple && KEY.isHorizontalMovement(key)){
processed = _handleMatchSelection(key);
}
if (!processed && (ctrl.items.length > 0 || ctrl.tagging.isActivated)) {
processed = _handleDropDownSelection(key);
if ( ctrl.taggingTokens.isActivated ) {
for (var i = 0; i < ctrl.taggingTokens.tokens.length; i++) {
if ( ctrl.taggingTokens.tokens[i] === KEY.MAP[e.keyCode] ) {
// make sure there is a new value to push via tagging
if ( ctrl.search.length > 0 ) {
tagged = true;
}
}
}
if ( tagged ) {
$timeout(function() {
_searchInput.triggerHandler('tagged');
var newItem = ctrl.search.replace(KEY.MAP[e.keyCode],'').trim();
if ( ctrl.tagging.fct ) {
newItem = ctrl.tagging.fct( newItem );
}
ctrl.select( newItem, true);
});
}
}
}
if (processed && key != KEY.TAB) {
//TODO Check si el tab selecciona aun correctamente
//Crear test
e.preventDefault();
e.stopPropagation();
}
});
if(KEY.isVerticalMovement(key) && ctrl.items.length > 0){
_ensureHighlightVisible();
}
});
_searchInput.on('keyup', function(e) {
if ( ! KEY.isVerticalMovement(e.which) ) {
$scope.$evalAsync( function () {
ctrl.activeIndex = ctrl.taggingLabel === false ? -1 : 0;
});
}
// Push a "create new" item into array if there is a search string
if ( ctrl.tagging.isActivated && ctrl.search.length > 0 ) {
// return early with these keys
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC || KEY.isVerticalMovement(e.which) ) {
return;
}
// always reset the activeIndex to the first item when tagging
ctrl.activeIndex = ctrl.taggingLabel === false ? -1 : 0;
// taggingLabel === false bypasses all of this
if (ctrl.taggingLabel === false) return;
var items = angular.copy( ctrl.items );
var stashArr = angular.copy( ctrl.items );
var newItem;
var item;
var hasTag = false;
var dupeIndex = -1;
var tagItems;
var tagItem;
// case for object tagging via transform `ctrl.tagging.fct` function
if ( ctrl.tagging.fct !== undefined) {
tagItems = ctrl.$filter('filter')(items,{'isTag': true});
if ( tagItems.length > 0 ) {
tagItem = tagItems[0];
}
// remove the first element, if it has the `isTag` prop we generate a new one with each keyup, shaving the previous
if ( items.length > 0 && tagItem ) {
hasTag = true;
items = items.slice(1,items.length);
stashArr = stashArr.slice(1,stashArr.length);
}
newItem = ctrl.tagging.fct(ctrl.search);
newItem.isTag = true;
// verify the the tag doesn't match the value of an existing item
if ( stashArr.filter( function (origItem) { return angular.equals( origItem, ctrl.tagging.fct(ctrl.search) ); } ).length > 0 ) {
return;
}
// handle newItem string and stripping dupes in tagging string context
} else {
// find any tagging items already in the ctrl.items array and store them
tagItems = ctrl.$filter('filter')(items,function (item) {
return item.match(ctrl.taggingLabel);
});
if ( tagItems.length > 0 ) {
tagItem = tagItems[0];
}
item = items[0];
// remove existing tag item if found (should only ever be one tag item)
if ( item !== undefined && items.length > 0 && tagItem ) {
hasTag = true;
items = items.slice(1,items.length);
stashArr = stashArr.slice(1,stashArr.length);
}
newItem = ctrl.search+' '+ctrl.taggingLabel;
if ( _findApproxDupe(ctrl.selected, ctrl.search) > -1 ) {
return;
}
// verify the the tag doesn't match the value of an existing item from
// the searched data set or the items already selected
if ( _findCaseInsensitiveDupe(stashArr.concat(ctrl.selected)) ) {
// if there is a tag from prev iteration, strip it / queue the change
// and return early
if ( hasTag ) {
items = stashArr;
$scope.$evalAsync( function () {
ctrl.activeIndex = 0;
ctrl.items = items;
});
}
return;
}
if ( _findCaseInsensitiveDupe(stashArr) ) {
// if there is a tag from prev iteration, strip it
if ( hasTag ) {
ctrl.items = stashArr.slice(1,stashArr.length);
}
return;
}
}
if ( hasTag ) dupeIndex = _findApproxDupe(ctrl.selected, newItem);
// dupe found, shave the first item
if ( dupeIndex > -1 ) {
items = items.slice(dupeIndex+1,items.length-1);
} else {
items = [];
items.push(newItem);
items = items.concat(stashArr);
}
$scope.$evalAsync( function () {
ctrl.activeIndex = 0;
ctrl.items = items;
});
}
});
_searchInput.on('tagged', function() {
$timeout(function() {
_resetSearchInput();
});
});
_searchInput.on('blur', function() {
$timeout(function() {
ctrl.activeMatchIndex = -1;
});
});
function _findCaseInsensitiveDupe(arr) {
if ( arr === undefined || ctrl.search === undefined ) {
return false;
}
var hasDupe = arr.filter( function (origItem) {
if ( ctrl.search.toUpperCase() === undefined ) {
return false;
}
return origItem.toUpperCase() === ctrl.search.toUpperCase();
}).length > 0;
return hasDupe;
}
function _findApproxDupe(haystack, needle) {
var tempArr = angular.copy(haystack);
var dupeIndex = -1;
for (var i = 0; i <tempArr.length; i++) {
// handle the simple string version of tagging
if ( ctrl.tagging.fct === undefined ) {
// search the array for the match
if ( tempArr[i]+' '+ctrl.taggingLabel === needle ) {
dupeIndex = i;
}
// handle the object tagging implementation
} else {
var mockObj = tempArr[i];
mockObj.isTag = true;
if ( angular.equals(mockObj, needle) ) {
dupeIndex = i;
}
}
}
return dupeIndex;
}
function _getCaretPosition(el) {
if(angular.isNumber(el.selectionStart)) return el.selectionStart;
// selectionStart is not supported in IE8 and we don't want hacky workarounds so we compromise
else return el.value.length;
}
// See https://github.com/ivaynberg/select2/blob/3.4.6/select2.js#L1431
function _ensureHighlightVisible() {
var container = $element.querySelectorAll('.ui-select-choices-content');
var choices = container.querySelectorAll('.ui-select-choices-row');
if (choices.length < 1) {
throw uiSelectMinErr('choices', "Expected multiple .ui-select-choices-row but got '{0}'.", choices.length);
}
var highlighted = choices[ctrl.activeIndex];
var posY = highlighted.offsetTop + highlighted.clientHeight - container[0].scrollTop;
var height = container[0].offsetHeight;
if (posY > height) {
container[0].scrollTop += posY - height;
} else if (posY < highlighted.clientHeight) {
if (ctrl.isGrouped && ctrl.activeIndex === 0)
container[0].scrollTop = 0; //To make group header visible when going all the way up
else
container[0].scrollTop -= highlighted.clientHeight - posY;
}
}
$scope.$on('$destroy', function() {
_searchInput.off('keyup keydown tagged blur');
});
}])
.directive('uiSelect',
['$document', 'uiSelectConfig', 'uiSelectMinErr', '$compile', '$parse',
function($document, uiSelectConfig, uiSelectMinErr, $compile, $parse) {
return {
restrict: 'EA',
templateUrl: function(tElement, tAttrs) {
var theme = tAttrs.theme || uiSelectConfig.theme;
return theme + (angular.isDefined(tAttrs.multiple) ? '/select-multiple.tpl.html' : '/select.tpl.html');
},
replace: true,
transclude: true,
require: ['uiSelect', 'ngModel'],
scope: true,
controller: 'uiSelectCtrl',
controllerAs: '$select',
link: function(scope, element, attrs, ctrls, transcludeFn) {
var $select = ctrls[0];
var ngModel = ctrls[1];
var searchInput = element.querySelectorAll('input.ui-select-search');
$select.multiple = angular.isDefined(attrs.multiple) && (
attrs.multiple === '' ||
attrs.multiple.toLowerCase() === 'multiple' ||
attrs.multiple.toLowerCase() === 'true'
);
$select.closeOnSelect = function() {
if (angular.isDefined(attrs.closeOnSelect)) {
return $parse(attrs.closeOnSelect)();
} else {
return uiSelectConfig.closeOnSelect;
}
}();
$select.onSelectCallback = $parse(attrs.onSelect);
$select.onRemoveCallback = $parse(attrs.onRemove);
//From view --> model
ngModel.$parsers.unshift(function (inputValue) {
var locals = {},
result;
if ($select.multiple){
var resultMultiple = [];
for (var j = $select.selected.length - 1; j >= 0; j--) {
locals = {};
locals[$select.parserResult.itemName] = $select.selected[j];
result = $select.parserResult.modelMapper(scope, locals);
resultMultiple.unshift(result);
}
return resultMultiple;
}else{
locals = {};
locals[$select.parserResult.itemName] = inputValue;
result = $select.parserResult.modelMapper(scope, locals);
return result;
}
});
//From model --> view
ngModel.$formatters.unshift(function (inputValue) {
var data = $select.parserResult.source (scope, { $select : {search:''}}), //Overwrite $search
locals = {},
result;
if (data){
if ($select.multiple){
var resultMultiple = [];
var checkFnMultiple = function(list, value){
if (!list || !list.length) return;
for (var p = list.length - 1; p >= 0; p--) {
locals[$select.parserResult.itemName] = list[p];
result = $select.parserResult.modelMapper(scope, locals);
if (result == value){
resultMultiple.unshift(list[p]);
return true;
}
}
return false;
};
if (!inputValue) return resultMultiple; //If ngModel was undefined
for (var k = inputValue.length - 1; k >= 0; k--) {
if (!checkFnMultiple($select.selected, inputValue[k])){
checkFnMultiple(data, inputValue[k]);
}
}
return resultMultiple;
}else{
var checkFnSingle = function(d){
locals[$select.parserResult.itemName] = d;
result = $select.parserResult.modelMapper(scope, locals);
return result == inputValue;
};
//If possible pass same object stored in $select.selected
if ($select.selected && checkFnSingle($select.selected)) {
return $select.selected;
}
for (var i = data.length - 1; i >= 0; i--) {
if (checkFnSingle(data[i])) return data[i];
}
}
}
return inputValue;
});
//Set reference to ngModel from uiSelectCtrl
$select.ngModel = ngModel;
$select.choiceGrouped = function(group){
return $select.isGrouped && group && group.name;
};
//Idea from: https://github.com/ivaynberg/select2/blob/79b5bf6db918d7560bdd959109b7bcfb47edaf43/select2.js#L1954
var focusser = angular.element("<input ng-disabled='$select.disabled' class='ui-select-focusser ui-select-offscreen' type='text' aria-haspopup='true' role='button' />");
if(attrs.tabindex){
//tabindex might be an expression, wait until it contains the actual value before we set the focusser tabindex
attrs.$observe('tabindex', function(value) {
//If we are using multiple, add tabindex to the search input
if($select.multiple){
searchInput.attr("tabindex", value);
} else {
focusser.attr("tabindex", value);
}
//Remove the tabindex on the parent so that it is not focusable
element.removeAttr("tabindex");
});
}
$compile(focusser)(scope);
$select.focusser = focusser;
if (!$select.multiple){
element.append(focusser);
focusser.bind("focus", function(){
scope.$evalAsync(function(){
$select.focus = true;
});
});
focusser.bind("blur", function(){
scope.$evalAsync(function(){
$select.focus = false;
});
});
focusser.bind("keydown", function(e){
if (e.which === KEY.BACKSPACE) {
e.preventDefault();
e.stopPropagation();
$select.select(undefined);
scope.$apply();
return;
}
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) {
return;
}
if (e.which == KEY.DOWN || e.which == KEY.UP || e.which == KEY.ENTER || e.which == KEY.SPACE){
e.preventDefault();
e.stopPropagation();
$select.activate();
}
scope.$digest();
});
focusser.bind("keyup input", function(e){
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC || e.which == KEY.ENTER || e.which === KEY.BACKSPACE) {
return;
}
$select.activate(focusser.val()); //User pressed some regular key, so we pass it to the search input
focusser.val('');
scope.$digest();
});
}
scope.$watch('searchEnabled', function() {
var searchEnabled = scope.$eval(attrs.searchEnabled);
$select.searchEnabled = searchEnabled !== undefined ? searchEnabled : uiSelectConfig.searchEnabled;
});
attrs.$observe('disabled', function() {
// No need to use $eval() (thanks to ng-disabled) since we already get a boolean instead of a string
$select.disabled = attrs.disabled !== undefined ? attrs.disabled : false;
});
attrs.$observe('resetSearchInput', function() {
// $eval() is needed otherwise we get a string instead of a boolean
var resetSearchInput = scope.$eval(attrs.resetSearchInput);
$select.resetSearchInput = resetSearchInput !== undefined ? resetSearchInput : true;
});
attrs.$observe('tagging', function() {
if(attrs.tagging !== undefined)
{
// $eval() is needed otherwise we get a string instead of a boolean
var taggingEval = scope.$eval(attrs.tagging);
$select.tagging = {isActivated: true, fct: taggingEval !== true ? taggingEval : undefined};
}
else
{
$select.tagging = {isActivated: false, fct: undefined};
}
});
attrs.$observe('taggingLabel', function() {
if(attrs.tagging !== undefined )
{
// check eval for FALSE, in this case, we disable the labels
// associated with tagging
if ( attrs.taggingLabel === 'false' ) {
$select.taggingLabel = false;
}
else
{
$select.taggingLabel = attrs.taggingLabel !== undefined ? attrs.taggingLabel : '(new)';
}
}
});
attrs.$observe('taggingTokens', function() {
if (attrs.tagging !== undefined) {
var tokens = attrs.taggingTokens !== undefined ? attrs.taggingTokens.split('|') : [',','ENTER'];
$select.taggingTokens = {isActivated: true, tokens: tokens };
}
});
if ($select.multiple){
scope.$watchCollection(function(){ return ngModel.$modelValue; }, function(newValue, oldValue) {
if (oldValue != newValue)
ngModel.$modelValue = null; //Force scope model value and ngModel value to be out of sync to re-run formatters
});
$select.firstPass = true; // so the form doesn't get dirty as soon as it loads
scope.$watchCollection('$select.selected', function() {
if (!$select.firstPass) {
ngModel.$setViewValue(Date.now()); //Set timestamp as a unique string to force changes
} else {
$select.firstPass = false;
}
});
focusser.prop('disabled', true); //Focusser isn't needed if multiple
}else{
scope.$watch('$select.selected', function(newValue) {
if (ngModel.$viewValue !== newValue) {
ngModel.$setViewValue(newValue);
}
});
}
ngModel.$render = function() {
if($select.multiple){
// Make sure that model value is array
if(!angular.isArray(ngModel.$viewValue)){
// Have tolerance for null or undefined values
if(angular.isUndefined(ngModel.$viewValue) || ngModel.$viewValue === null){
$select.selected = [];
} else {
throw uiSelectMinErr('multiarr', "Expected model value to be array but got '{0}'", ngModel.$viewValue);
}
}
}
$select.selected = ngModel.$viewValue;
};
function onDocumentClick(e) {
var contains = false;
if (window.jQuery) {
// Firefox 3.6 does not support element.contains()
// See Node.contains https://developer.mozilla.org/en-US/docs/Web/API/Node.contains
contains = window.jQuery.contains(element[0], e.target);
} else {
contains = element[0].contains(e.target);
}
if (!contains && !$select.clickTriggeredSelect) {
$select.close(angular.element(e.target).closest('.ui-select-container.open').length > 0); // Skip focusser if the target is another select
scope.$digest();
}
$select.clickTriggeredSelect = false;
}
// See Click everywhere but here event http://stackoverflow.com/questions/12931369
$document.on('click', onDocumentClick);
scope.$on('$destroy', function() {
$document.off('click', onDocumentClick);
});
// Move transcluded elements to their correct position in main template
transcludeFn(scope, function(clone) {
// See Transclude in AngularJS http://blog.omkarpatil.com/2012/11/transclude-in-angularjs.html
// One day jqLite will be replaced by jQuery and we will be able to write:
// var transcludedElement = clone.filter('.my-class')
// instead of creating a hackish DOM element:
var transcluded = angular.element('<div>').append(clone);
var transcludedMatch = transcluded.querySelectorAll('.ui-select-match');
transcludedMatch.removeAttr('ui-select-match'); //To avoid loop in case directive as attr
if (transcludedMatch.length !== 1) {
throw uiSelectMinErr('transcluded', "Expected 1 .ui-select-match but got '{0}'.", transcludedMatch.length);
}
element.querySelectorAll('.ui-select-match').replaceWith(transcludedMatch);
var transcludedChoices = transcluded.querySelectorAll('.ui-select-choices');
transcludedChoices.removeAttr('ui-select-choices'); //To avoid loop in case directive as attr
if (transcludedChoices.length !== 1) {
throw uiSelectMinErr('transcluded', "Expected 1 .ui-select-choices but got '{0}'.", transcludedChoices.length);
}
element.querySelectorAll('.ui-select-choices').replaceWith(transcludedChoices);
});
}
};
}])
.directive('uiSelectChoices',
['uiSelectConfig', 'RepeatParser', 'uiSelectMinErr', '$compile',
function(uiSelectConfig, RepeatParser, uiSelectMinErr, $compile) {
return {
restrict: 'EA',
require: '^uiSelect',
replace: true,
transclude: true,
templateUrl: function(tElement) {
// Gets theme attribute from parent (ui-select)
var theme = tElement.parent().attr('theme') || uiSelectConfig.theme;
return theme + '/choices.tpl.html';
},
compile: function(tElement, tAttrs) {
if (!tAttrs.repeat) throw uiSelectMinErr('repeat', "Expected 'repeat' expression.");
return function link(scope, element, attrs, $select, transcludeFn) {
// var repeat = RepeatParser.parse(attrs.repeat);
var groupByExp = attrs.groupBy;
$select.parseRepeatAttr(attrs.repeat, groupByExp); //Result ready at $select.parserResult
$select.disableChoiceExpression = attrs.uiDisableChoice;
$select.onHighlightCallback = attrs.onHighlight;
if(groupByExp) {
var groups = element.querySelectorAll('.ui-select-choices-group');
if (groups.length !== 1) throw uiSelectMinErr('rows', "Expected 1 .ui-select-choices-group but got '{0}'.", groups.length);
groups.attr('ng-repeat', RepeatParser.getGroupNgRepeatExpression());
}
var choices = element.querySelectorAll('.ui-select-choices-row');
if (choices.length !== 1) {
throw uiSelectMinErr('rows', "Expected 1 .ui-select-choices-row but got '{0}'.", choices.length);
}
choices.attr('ng-repeat', RepeatParser.getNgRepeatExpression($select.parserResult.itemName, '$select.items', $select.parserResult.trackByExp, groupByExp))
.attr('ng-if', '$select.open') //Prevent unnecessary watches when dropdown is closed
.attr('ng-mouseenter', '$select.setActiveItem('+$select.parserResult.itemName +')')
.attr('ng-click', '$select.select(' + $select.parserResult.itemName + ',false,$event)');
var rowsInner = element.querySelectorAll('.ui-select-choices-row-inner');
if (rowsInner.length !== 1) throw uiSelectMinErr('rows', "Expected 1 .ui-select-choices-row-inner but got '{0}'.", rowsInner.length);
rowsInner.attr('uis-transclude-append', ''); //Adding uisTranscludeAppend directive to row element after choices element has ngRepeat
$compile(element, transcludeFn)(scope); //Passing current transcludeFn to be able to append elements correctly from uisTranscludeAppend
scope.$watch('$select.search', function(newValue) {
if(newValue && !$select.open && $select.multiple) $select.activate(false, true);
$select.activeIndex = $select.tagging.isActivated ? -1 : 0;
$select.refresh(attrs.refresh);
});
attrs.$observe('refreshDelay', function() {
// $eval() is needed otherwise we get a string instead of a number
var refreshDelay = scope.$eval(attrs.refreshDelay);
$select.refreshDelay = refreshDelay !== undefined ? refreshDelay : uiSelectConfig.refreshDelay;
});
};
}
};
}])
// Recreates old behavior of ng-transclude. Used internally.
.directive('uisTranscludeAppend', function () {
return {
link: function (scope, element, attrs, ctrl, transclude) {
transclude(scope, function (clone) {
element.append(clone);
});
}
};
})
.directive('uiSelectMatch', ['uiSelectConfig', function(uiSelectConfig) {
return {
restrict: 'EA',
require: '^uiSelect',
replace: true,
transclude: true,
templateUrl: function(tElement) {
// Gets theme attribute from parent (ui-select)
var theme = tElement.parent().attr('theme') || uiSelectConfig.theme;
var multi = tElement.parent().attr('multiple');
return theme + (multi ? '/match-multiple.tpl.html' : '/match.tpl.html');
},
link: function(scope, element, attrs, $select) {
$select.lockChoiceExpression = attrs.uiLockChoice;
attrs.$observe('placeholder', function(placeholder) {
$select.placeholder = placeholder !== undefined ? placeholder : uiSelectConfig.placeholder;
});
$select.allowClear = (angular.isDefined(attrs.allowClear)) ? (attrs.allowClear === '') ? true : (attrs.allowClear.toLowerCase() === 'true') : false;
if($select.multiple){
$select.sizeSearchInput();
}
}
};
}])
/**
* Highlights text that matches $select.search.
*
* Taken from AngularUI Bootstrap Typeahead
* See https://github.com/angular-ui/bootstrap/blob/0.10.0/src/typeahead/typeahead.js#L340
*/
.filter('highlight', function() {
function escapeRegexp(queryToEscape) {
return queryToEscape.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
}
return function(matchItem, query) {
return query && matchItem ? matchItem.replace(new RegExp(escapeRegexp(query), 'gi'), '<span class="ui-select-highlight">$&</span>') : matchItem;
};
});
}());
angular.module("ui.select").run(["$templateCache", function($templateCache) {$templateCache.put("bootstrap/choices.tpl.html","<ul class=\"ui-select-choices ui-select-choices-content dropdown-menu\" role=\"menu\" aria-labelledby=\"dLabel\" ng-show=\"$select.items.length > 0\"><li class=\"ui-select-choices-group\"><div class=\"divider\" ng-show=\"$select.isGrouped && $index > 0\"></div><div ng-show=\"$select.isGrouped\" class=\"ui-select-choices-group-label dropdown-header\" ng-bind-html=\"$group.name\"></div><div class=\"ui-select-choices-row\" ng-class=\"{active: $select.isActive(this), disabled: $select.isDisabled(this)}\"><a href=\"javascript:void(0)\" class=\"ui-select-choices-row-inner\"></a></div></li></ul>");
$templateCache.put("bootstrap/match-multiple.tpl.html","<span class=\"ui-select-match\"><span ng-repeat=\"$item in $select.selected\"><span style=\"margin-right: 3px;\" class=\"ui-select-match-item btn btn-default btn-xs\" tabindex=\"-1\" type=\"button\" ng-disabled=\"$select.disabled\" ng-click=\"$select.activeMatchIndex = $index;\" ng-class=\"{\'btn-primary\':$select.activeMatchIndex === $index, \'select-locked\':$select.isLocked(this, $index)}\"><span class=\"close ui-select-match-close\" ng-hide=\"$select.disabled\" ng-click=\"$select.removeChoice($index)\"> ×</span> <span uis-transclude-append=\"\"></span></span></span></span>");
$templateCache.put("bootstrap/match.tpl.html","<div class=\"ui-select-match\" ng-hide=\"$select.open\" ng-disabled=\"$select.disabled\" ng-class=\"{\'btn-default-focus\':$select.focus}\"><button type=\"button\" class=\"btn btn-default btn-block ui-select-toggle\" tabindex=\"-1\" ;=\"\" ng-disabled=\"$select.disabled\" ng-click=\"$select.activate()\"><span ng-show=\"$select.isEmpty()\" class=\"ui-select-placeholder text-muted\">{{$select.placeholder}}</span> <span ng-hide=\"$select.isEmpty()\" class=\"ui-select-match-text\" ng-class=\"{\'ui-select-allow-clear\': $select.allowClear && !$select.isEmpty()}\" ng-transclude=\"\"></span> <i class=\"caret pull-right\" ng-click=\"$select.toggle($event)\"></i></button> <button type=\"button\" class=\"ui-select-clear\" ng-if=\"$select.allowClear && !$select.isEmpty()\" ng-click=\"$select.select(undefined)\"><i class=\"glyphicon glyphicon-remove\"></i></button></div>");
$templateCache.put("bootstrap/select-multiple.tpl.html","<div class=\"ui-select-container ui-select-multiple ui-select-bootstrap dropdown form-control\" ng-class=\"{open: $select.open}\"><div><div class=\"ui-select-match\"></div><input type=\"text\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" class=\"ui-select-search input-xs\" placeholder=\"{{$select.getPlaceholder()}}\" ng-disabled=\"$select.disabled\" ng-hide=\"$select.disabled\" ng-click=\"$select.activate()\" ng-model=\"$select.search\"></div><div class=\"ui-select-choices\"></div></div>");
$templateCache.put("bootstrap/select.tpl.html","<div class=\"ui-select-container ui-select-bootstrap dropdown\" ng-class=\"{open: $select.open}\"><div class=\"ui-select-match\"></div><input type=\"text\" autocomplete=\"off\" tabindex=\"-1\" class=\"form-control ui-select-search\" placeholder=\"{{$select.placeholder}}\" ng-model=\"$select.search\" ng-show=\"$select.searchEnabled && $select.open\"><div class=\"ui-select-choices\"></div></div>");
$templateCache.put("select2/choices.tpl.html","<ul class=\"ui-select-choices ui-select-choices-content select2-results\"><li class=\"ui-select-choices-group\" ng-class=\"{\'select2-result-with-children\': $select.choiceGrouped($group) }\"><div ng-show=\"$select.choiceGrouped($group)\" class=\"ui-select-choices-group-label select2-result-label\" ng-bind-html=\"$group.name\"></div><ul ng-class=\"{\'select2-result-sub\': $select.choiceGrouped($group), \'select2-result-single\': !$select.choiceGrouped($group) }\"><li class=\"ui-select-choices-row\" ng-class=\"{\'select2-highlighted\': $select.isActive(this), \'select2-disabled\': $select.isDisabled(this)}\"><div class=\"select2-result-label ui-select-choices-row-inner\"></div></li></ul></li></ul>");
$templateCache.put("select2/match-multiple.tpl.html","<span class=\"ui-select-match\"><li class=\"ui-select-match-item select2-search-choice\" ng-repeat=\"$item in $select.selected\" ng-class=\"{\'select2-search-choice-focus\':$select.activeMatchIndex === $index, \'select2-locked\':$select.isLocked(this, $index)}\"><span uis-transclude-append=\"\"></span> <a href=\"javascript:;\" class=\"ui-select-match-close select2-search-choice-close\" ng-click=\"$select.removeChoice($index)\" tabindex=\"-1\"></a></li></span>");
$templateCache.put("select2/match.tpl.html","<a class=\"select2-choice ui-select-match\" ng-class=\"{\'select2-default\': $select.isEmpty()}\" ng-click=\"$select.activate()\"><span ng-show=\"$select.isEmpty()\" class=\"select2-chosen\">{{$select.placeholder}}</span> <span ng-hide=\"$select.isEmpty()\" class=\"select2-chosen\" ng-transclude=\"\"></span> <abbr ng-if=\"$select.allowClear && !$select.isEmpty()\" class=\"select2-search-choice-close\" ng-click=\"$select.select(undefined)\"></abbr> <span class=\"select2-arrow ui-select-toggle\" ng-click=\"$select.toggle($event)\"><b></b></span></a>");
$templateCache.put("select2/select-multiple.tpl.html","<div class=\"ui-select-container ui-select-multiple select2 select2-container select2-container-multi\" ng-class=\"{\'select2-container-active select2-dropdown-open open\': $select.open,\n \'select2-container-disabled\': $select.disabled}\"><ul class=\"select2-choices\"><span class=\"ui-select-match\"></span><li class=\"select2-search-field\"><input type=\"text\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" class=\"select2-input ui-select-search\" placeholder=\"{{$select.getPlaceholder()}}\" ng-disabled=\"$select.disabled\" ng-hide=\"$select.disabled\" ng-model=\"$select.search\" ng-click=\"$select.activate()\" style=\"width: 34px;\"></li></ul><div class=\"select2-drop select2-with-searchbox select2-drop-active\" ng-class=\"{\'select2-display-none\': !$select.open}\"><div class=\"ui-select-choices\"></div></div></div>");
$templateCache.put("select2/select.tpl.html","<div class=\"ui-select-container select2 select2-container\" ng-class=\"{\'select2-container-active select2-dropdown-open open\': $select.open,\n \'select2-container-disabled\': $select.disabled,\n \'select2-container-active\': $select.focus, \n \'select2-allowclear\': $select.allowClear && !$select.isEmpty()}\"><div class=\"ui-select-match\"></div><div class=\"select2-drop select2-with-searchbox select2-drop-active\" ng-class=\"{\'select2-display-none\': !$select.open}\"><div class=\"select2-search\" ng-show=\"$select.searchEnabled\"><input type=\"text\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" class=\"ui-select-search select2-input\" ng-model=\"$select.search\"></div><div class=\"ui-select-choices\"></div></div></div>");
$templateCache.put("selectize/choices.tpl.html","<div ng-show=\"$select.open\" class=\"ui-select-choices selectize-dropdown single\"><div class=\"ui-select-choices-content selectize-dropdown-content\"><div class=\"ui-select-choices-group optgroup\"><div ng-show=\"$select.isGrouped\" class=\"ui-select-choices-group-label optgroup-header\" ng-bind-html=\"$group.name\"></div><div class=\"ui-select-choices-row\" ng-class=\"{active: $select.isActive(this), disabled: $select.isDisabled(this)}\"><div class=\"option ui-select-choices-row-inner\" data-selectable=\"\"></div></div></div></div></div>");
$templateCache.put("selectize/match.tpl.html","<div ng-hide=\"($select.open || $select.isEmpty())\" class=\"ui-select-match\" ng-transclude=\"\"></div>");
$templateCache.put("selectize/select.tpl.html","<div class=\"ui-select-container selectize-control single\" ng-class=\"{\'open\': $select.open}\"><div class=\"selectize-input\" ng-class=\"{\'focus\': $select.open, \'disabled\': $select.disabled, \'selectize-focus\' : $select.focus}\" ng-click=\"$select.activate()\"><div class=\"ui-select-match\"></div><input type=\"text\" autocomplete=\"off\" tabindex=\"-1\" class=\"ui-select-search ui-select-toggle\" ng-click=\"$select.toggle($event)\" placeholder=\"{{$select.placeholder}}\" ng-model=\"$select.search\" ng-hide=\"!$select.searchEnabled || ($select.selected && !$select.open)\" ng-disabled=\"$select.disabled\"></div><div class=\"ui-select-choices\"></div></div>");}]);
|
examples/cra-react15/src/stories/welcome.stories.js
|
storybooks/react-storybook
|
import React from 'react';
import { storiesOf } from '@storybook/react';
import { linkTo } from '@storybook/addon-links';
import { Welcome } from '@storybook/react/demo';
storiesOf('Welcome', module)
.addParameters({
component: Welcome,
})
.add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);
|
app/containers/App/index.js
|
vkurzweg/aloha
|
/**
*
* App.react.js
*
* This component is the skeleton around the actual pages, and should only
* contain code that should be seen on all pages. (e.g. navigation bar)
*
* NOTE: while this component should technically be a stateless functional
* component (SFC), hot reloading does not currently support SFCs. If hot
* reloading is not a necessity for you then you can refactor it and remove
* the linting exception.
*/
import React from 'react';
export default class App extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
static propTypes = {
children: React.PropTypes.node,
};
render() {
return (
<div>
{React.Children.toArray(this.props.children)}
</div>
);
}
}
|
docs/app/Examples/modules/Checkbox/Variations/index.js
|
clemensw/stardust
|
import React from 'react'
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection'
import { Message } from 'semantic-ui-react'
const CheckboxVariationsExamples = () => (
<ExampleSection title='Variations'>
<ComponentExample
title='Fitted'
description='A fitted checkbox does not leave padding for a label.'
examplePath='modules/Checkbox/Variations/CheckboxExampleFitted'
>
<Message>
The{' '}
<a href='http://semantic-ui.com/modules/checkbox.html#fitted' target='_blank'>
<code>fitted</code>
</a>
{' '}class is automatically applied if there is no <code>label</code> prop.
</Message>
</ComponentExample>
</ExampleSection>
)
export default CheckboxVariationsExamples
|
ajax/libs/react-data-grid/1.0.38/react-data-grid.js
|
tonytomov/cdnjs
|
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"), require("react-dom"));
else if(typeof define === 'function' && define.amd)
define(["react", "react-dom"], factory);
else if(typeof exports === 'object')
exports["ReactDataGrid"] = factory(require("react"), require("react-dom"));
else
root["ReactDataGrid"] = factory(root["React"], root["ReactDOM"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_2__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var Grid = __webpack_require__(49);
var Row = __webpack_require__(15);
var Cell = __webpack_require__(20);
module.exports = Grid;
module.exports.Row = Row;
module.exports.Cell = Cell;
/***/ },
/* 1 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
/***/ },
/* 2 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2015 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
function classNames() {
var classes = '';
var arg;
for (var i = 0; i < arguments.length; i++) {
arg = arguments[i];
if (!arg) {
continue;
}
if ('string' === typeof arg || 'number' === typeof arg) {
classes += ' ' + arg;
} else if (Object.prototype.toString.call(arg) === '[object Array]') {
classes += ' ' + classNames.apply(null, arg);
} else if ('object' === typeof arg) {
for (var key in arg) {
if (!arg.hasOwnProperty(key) || !arg[key]) {
continue;
}
classes += ' ' + key;
}
}
}
return classes.substr(1);
}
// safely export classNames for node / browserify
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
}
// safely export classNames for RequireJS
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
return classNames;
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
var freeGlobal = __webpack_require__(28);
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
module.exports = root;
/***/ },
/* 5 */
/***/ function(module, exports) {
'use strict';
module.exports = {
getColumn: function getColumn(columns, idx) {
if (Array.isArray(columns)) {
return columns[idx];
} else if (typeof Immutable !== 'undefined') {
return columns.get(idx);
}
},
spliceColumn: function spliceColumn(metrics, idx, column) {
if (Array.isArray(metrics.columns)) {
metrics.columns.splice(idx, 1, column);
} else if (typeof Immutable !== 'undefined') {
metrics.columns = metrics.columns.splice(idx, 1, column);
}
return metrics;
},
getSize: function getSize(columns) {
if (Array.isArray(columns)) {
return columns.length;
} else if (typeof Immutable !== 'undefined') {
return columns.size;
}
},
// Logic extented to allow for functions to be passed down in column.editable
// this allows us to deicde whether we can be edting from a cell level
canEdit: function canEdit(col, rowData, enableCellSelect) {
if (col.editable != null && typeof col.editable === 'function') {
return enableCellSelect === true && col.editable(rowData);
}
return enableCellSelect === true && (!!col.editor || !!col.editable);
}
};
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(1);
var ExcelColumnShape = {
name: React.PropTypes.node.isRequired,
key: React.PropTypes.string.isRequired,
width: React.PropTypes.number.isRequired,
filterable: React.PropTypes.bool
};
module.exports = ExcelColumnShape;
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
var baseIsNative = __webpack_require__(79),
getValue = __webpack_require__(88);
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
module.exports = getNative;
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var PropTypes = __webpack_require__(1).PropTypes;
module.exports = {
selected: PropTypes.object.isRequired,
copied: PropTypes.object,
dragged: PropTypes.object,
onCellClick: PropTypes.func.isRequired,
onCellDoubleClick: PropTypes.func.isRequired,
onCommit: PropTypes.func.isRequired,
onCommitCancel: PropTypes.func.isRequired,
handleDragEnterRow: PropTypes.func.isRequired,
handleTerminateDrag: PropTypes.func.isRequired
};
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(1);
var shallowCloneObject = __webpack_require__(16);
var contextTypes = {
metricsComputator: React.PropTypes.object
};
var MetricsComputatorMixin = {
childContextTypes: contextTypes,
getChildContext: function getChildContext() {
return { metricsComputator: this };
},
getMetricImpl: function getMetricImpl(name) {
return this._DOMMetrics.metrics[name].value;
},
registerMetricsImpl: function registerMetricsImpl(component, metrics) {
var getters = {};
var s = this._DOMMetrics;
for (var name in metrics) {
if (s.metrics[name] !== undefined) {
throw new Error('DOM metric ' + name + ' is already defined');
}
s.metrics[name] = { component: component, computator: metrics[name].bind(component) };
getters[name] = this.getMetricImpl.bind(null, name);
}
if (s.components.indexOf(component) === -1) {
s.components.push(component);
}
return getters;
},
unregisterMetricsFor: function unregisterMetricsFor(component) {
var s = this._DOMMetrics;
var idx = s.components.indexOf(component);
if (idx > -1) {
s.components.splice(idx, 1);
var name = void 0;
var metricsToDelete = {};
for (name in s.metrics) {
if (s.metrics[name].component === component) {
metricsToDelete[name] = true;
}
}
for (name in metricsToDelete) {
if (metricsToDelete.hasOwnProperty(name)) {
delete s.metrics[name];
}
}
}
},
updateMetrics: function updateMetrics() {
var s = this._DOMMetrics;
var needUpdate = false;
for (var name in s.metrics) {
if (!s.metrics.hasOwnProperty(name)) continue;
var newMetric = s.metrics[name].computator();
if (newMetric !== s.metrics[name].value) {
needUpdate = true;
}
s.metrics[name].value = newMetric;
}
if (needUpdate) {
for (var i = 0, len = s.components.length; i < len; i++) {
if (s.components[i].metricsUpdated) {
s.components[i].metricsUpdated();
}
}
}
},
componentWillMount: function componentWillMount() {
this._DOMMetrics = {
metrics: {},
components: []
};
},
componentDidMount: function componentDidMount() {
if (window.addEventListener) {
window.addEventListener('resize', this.updateMetrics);
} else {
window.attachEvent('resize', this.updateMetrics);
}
this.updateMetrics();
},
componentWillUnmount: function componentWillUnmount() {
window.removeEventListener('resize', this.updateMetrics);
}
};
var MetricsMixin = {
contextTypes: contextTypes,
componentWillMount: function componentWillMount() {
if (this.DOMMetrics) {
this._DOMMetricsDefs = shallowCloneObject(this.DOMMetrics);
this.DOMMetrics = {};
for (var name in this._DOMMetricsDefs) {
if (!this._DOMMetricsDefs.hasOwnProperty(name)) continue;
this.DOMMetrics[name] = function () {};
}
}
},
componentDidMount: function componentDidMount() {
if (this.DOMMetrics) {
this.DOMMetrics = this.registerMetrics(this._DOMMetricsDefs);
}
},
componentWillUnmount: function componentWillUnmount() {
if (!this.registerMetricsImpl) {
return this.context.metricsComputator.unregisterMetricsFor(this);
}
if (this.hasOwnProperty('DOMMetrics')) {
delete this.DOMMetrics;
}
},
registerMetrics: function registerMetrics(metrics) {
if (this.registerMetricsImpl) {
return this.registerMetricsImpl(this, metrics);
}
return this.context.metricsComputator.registerMetricsImpl(this, metrics);
},
getMetric: function getMetric(name) {
if (this.getMetricImpl) {
return this.getMetricImpl(name);
}
return this.context.metricsComputator.getMetricImpl(name);
}
};
module.exports = {
MetricsComputatorMixin: MetricsComputatorMixin,
MetricsMixin: MetricsMixin
};
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
var listCacheClear = __webpack_require__(98),
listCacheDelete = __webpack_require__(99),
listCacheGet = __webpack_require__(100),
listCacheHas = __webpack_require__(101),
listCacheSet = __webpack_require__(102);
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
module.exports = ListCache;
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
var eq = __webpack_require__(31);
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
module.exports = assocIndexOf;
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
var isKeyable = __webpack_require__(95);
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
module.exports = getMapData;
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(7);
/* Built-in method references that are verified to be native. */
var nativeCreate = getNative(Object, 'create');
module.exports = nativeCreate;
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var shallowCloneObject = __webpack_require__(16);
var sameColumn = __webpack_require__(39);
var ColumnUtils = __webpack_require__(5);
var getScrollbarSize = __webpack_require__(24);
function setColumnWidths(columns, totalWidth) {
return columns.map(function (column) {
var colInfo = Object.assign({}, column);
if (column.width) {
if (/^([0-9]+)%$/.exec(column.width.toString())) {
colInfo.width = Math.floor(column.width / 100 * totalWidth);
}
}
return colInfo;
});
}
function setDefferedColumnWidths(columns, unallocatedWidth, minColumnWidth) {
var defferedColumns = columns.filter(function (c) {
return !c.width;
});
return columns.map(function (column) {
if (!column.width) {
if (unallocatedWidth <= 0) {
column.width = minColumnWidth;
} else {
column.width = Math.floor(unallocatedWidth / ColumnUtils.getSize(defferedColumns));
}
}
return column;
});
}
function setColumnOffsets(columns) {
var left = 0;
return columns.map(function (column) {
column.left = left;
left += column.width;
return column;
});
}
/**
* Update column metrics calculation.
*
* @param {ColumnMetricsType} metrics
*/
function recalculate(metrics) {
// compute width for columns which specify width
var columns = setColumnWidths(metrics.columns, metrics.totalWidth);
var unallocatedWidth = columns.filter(function (c) {
return c.width;
}).reduce(function (w, column) {
return w - column.width;
}, metrics.totalWidth);
unallocatedWidth -= getScrollbarSize();
var width = columns.filter(function (c) {
return c.width;
}).reduce(function (w, column) {
return w + column.width;
}, 0);
// compute width for columns which doesn't specify width
columns = setDefferedColumnWidths(columns, unallocatedWidth, metrics.minColumnWidth);
// compute left offset
columns = setColumnOffsets(columns);
return {
columns: columns,
width: width,
totalWidth: metrics.totalWidth,
minColumnWidth: metrics.minColumnWidth
};
}
/**
* Update column metrics calculation by resizing a column.
*
* @param {ColumnMetricsType} metrics
* @param {Column} column
* @param {number} width
*/
function resizeColumn(metrics, index, width) {
var column = ColumnUtils.getColumn(metrics.columns, index);
var metricsClone = shallowCloneObject(metrics);
metricsClone.columns = metrics.columns.slice(0);
var updatedColumn = shallowCloneObject(column);
updatedColumn.width = Math.max(width, metricsClone.minColumnWidth);
metricsClone = ColumnUtils.spliceColumn(metricsClone, index, updatedColumn);
return recalculate(metricsClone);
}
function areColumnsImmutable(prevColumns, nextColumns) {
return typeof Immutable !== 'undefined' && prevColumns instanceof Immutable.List && nextColumns instanceof Immutable.List;
}
function compareEachColumn(prevColumns, nextColumns, isSameColumn) {
var i = void 0;
var len = void 0;
var column = void 0;
var prevColumnsByKey = {};
var nextColumnsByKey = {};
if (ColumnUtils.getSize(prevColumns) !== ColumnUtils.getSize(nextColumns)) {
return false;
}
for (i = 0, len = ColumnUtils.getSize(prevColumns); i < len; i++) {
column = prevColumns[i];
prevColumnsByKey[column.key] = column;
}
for (i = 0, len = ColumnUtils.getSize(nextColumns); i < len; i++) {
column = nextColumns[i];
nextColumnsByKey[column.key] = column;
var prevColumn = prevColumnsByKey[column.key];
if (prevColumn === undefined || !isSameColumn(prevColumn, column)) {
return false;
}
}
for (i = 0, len = ColumnUtils.getSize(prevColumns); i < len; i++) {
column = prevColumns[i];
var nextColumn = nextColumnsByKey[column.key];
if (nextColumn === undefined) {
return false;
}
}
return true;
}
function sameColumns(prevColumns, nextColumns, isSameColumn) {
if (areColumnsImmutable(prevColumns, nextColumns)) {
return prevColumns === nextColumns;
}
return compareEachColumn(prevColumns, nextColumns, isSameColumn);
}
module.exports = { recalculate: recalculate, resizeColumn: resizeColumn, sameColumn: sameColumn, sameColumns: sameColumns };
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var React = __webpack_require__(1);
var joinClasses = __webpack_require__(3);
var Cell = __webpack_require__(20);
var ColumnMetrics = __webpack_require__(14);
var ColumnUtilsMixin = __webpack_require__(5);
var cellMetaDataShape = __webpack_require__(8);
var PropTypes = React.PropTypes;
var CellExpander = React.createClass({
displayName: 'CellExpander',
render: function render() {
return React.createElement(Cell, this.props);
}
});
var Row = React.createClass({
displayName: 'Row',
propTypes: {
height: PropTypes.number.isRequired,
columns: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,
row: PropTypes.any.isRequired,
cellRenderer: PropTypes.func,
cellMetaData: PropTypes.shape(cellMetaDataShape),
isSelected: PropTypes.bool,
idx: PropTypes.number.isRequired,
expandedRows: PropTypes.arrayOf(PropTypes.object),
extraClasses: PropTypes.string,
forceUpdate: PropTypes.bool,
subRowDetails: PropTypes.object,
isRowHovered: PropTypes.bool
},
mixins: [ColumnUtilsMixin],
getDefaultProps: function getDefaultProps() {
return {
cellRenderer: Cell,
isSelected: false,
height: 35
};
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
return !ColumnMetrics.sameColumns(this.props.columns, nextProps.columns, ColumnMetrics.sameColumn) || this.doesRowContainSelectedCell(this.props) || this.doesRowContainSelectedCell(nextProps) || this.willRowBeDraggedOver(nextProps) || nextProps.row !== this.props.row || this.hasRowBeenCopied() || this.props.isSelected !== nextProps.isSelected || nextProps.height !== this.props.height || this.props.forceUpdate === true;
},
handleDragEnter: function handleDragEnter() {
var handleDragEnterRow = this.props.cellMetaData.handleDragEnterRow;
if (handleDragEnterRow) {
handleDragEnterRow(this.props.idx);
}
},
getSelectedColumn: function getSelectedColumn() {
if (this.props.cellMetaData) {
var selected = this.props.cellMetaData.selected;
if (selected && selected.idx) {
return this.getColumn(this.props.columns, selected.idx);
}
}
},
getCellRenderer: function getCellRenderer(columnKey) {
var CellRenderer = this.props.cellRenderer;
if (this.props.subRowDetails && this.props.subRowDetails.field === columnKey) {
return CellExpander;
}
return CellRenderer;
},
getCells: function getCells() {
var _this = this;
var cells = [];
var lockedCells = [];
var selectedColumn = this.getSelectedColumn();
if (this.props.columns) {
this.props.columns.forEach(function (column, i) {
var CellRenderer = _this.props.cellRenderer;
var cell = React.createElement(CellRenderer, {
ref: i,
key: column.key + '-' + i,
idx: i,
rowIdx: _this.props.idx,
value: _this.getCellValue(column.key || i),
column: column,
height: _this.getRowHeight(),
formatter: column.formatter,
cellMetaData: _this.props.cellMetaData,
rowData: _this.props.row,
selectedColumn: selectedColumn,
isRowSelected: _this.props.isSelected,
expandableOptions: _this.getExpandableOptions(column.key) });
if (column.locked) {
lockedCells.push(cell);
} else {
cells.push(cell);
}
});
}
return cells.concat(lockedCells);
},
getRowHeight: function getRowHeight() {
var rows = this.props.expandedRows || null;
if (rows && this.props.idx) {
var row = rows[this.props.idx] || null;
if (row) {
return row.height;
}
}
return this.props.height;
},
getCellValue: function getCellValue(key) {
var val = void 0;
if (key === 'select-row') {
return this.props.isSelected;
} else if (typeof this.props.row.get === 'function') {
val = this.props.row.get(key);
} else {
val = this.props.row[key];
}
return val;
},
setScrollLeft: function setScrollLeft(scrollLeft) {
var _this2 = this;
this.props.columns.forEach(function (column, i) {
if (column.locked) {
if (!_this2.refs[i]) return;
_this2.refs[i].setScrollLeft(scrollLeft);
}
});
},
doesRowContainSelectedCell: function doesRowContainSelectedCell(props) {
var selected = props.cellMetaData.selected;
if (selected && selected.rowIdx === props.idx) {
return true;
}
return false;
},
isContextMenuDisplayed: function isContextMenuDisplayed() {
if (this.props.cellMetaData) {
var selected = this.props.cellMetaData.selected;
if (selected && selected.contextMenuDisplayed && selected.rowIdx === this.props.idx) {
return true;
}
}
return false;
},
willRowBeDraggedOver: function willRowBeDraggedOver(props) {
var dragged = props.cellMetaData.dragged;
return dragged != null && (dragged.rowIdx >= 0 || dragged.complete === true);
},
hasRowBeenCopied: function hasRowBeenCopied() {
var copied = this.props.cellMetaData.copied;
return copied != null && copied.rowIdx === this.props.idx;
},
getExpandableOptions: function getExpandableOptions(columnKey) {
return { canExpand: this.props.subRowDetails && this.props.subRowDetails.field === columnKey, expanded: this.props.subRowDetails && this.props.subRowDetails.expanded, children: this.props.subRowDetails && this.props.subRowDetails.children, treeDepth: this.props.subRowDetails ? this.props.subRowDetails.treeDepth : 0 };
},
renderCell: function renderCell(props) {
if (typeof this.props.cellRenderer === 'function') {
this.props.cellRenderer.call(this, props);
}
if (React.isValidElement(this.props.cellRenderer)) {
return React.cloneElement(this.props.cellRenderer, props);
}
return this.props.cellRenderer(props);
},
render: function render() {
var className = joinClasses('react-grid-Row', 'react-grid-Row--' + (this.props.idx % 2 === 0 ? 'even' : 'odd'), {
'row-selected': this.props.isSelected,
'row-context-menu': this.isContextMenuDisplayed()
}, this.props.extraClasses);
var style = {
height: this.getRowHeight(this.props),
overflow: 'hidden'
};
var cells = this.getCells();
return React.createElement(
'div',
_extends({}, this.props, { className: className, style: style, onDragEnter: this.handleDragEnter }),
React.isValidElement(this.props.row) ? this.props.row : cells
);
}
});
module.exports = Row;
/***/ },
/* 16 */
/***/ function(module, exports) {
"use strict";
function shallowCloneObject(obj) {
var result = {};
for (var k in obj) {
if (obj.hasOwnProperty(k)) {
result[k] = obj[k];
}
}
return result;
}
module.exports = shallowCloneObject;
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(7),
root = __webpack_require__(4);
/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map');
module.exports = Map;
/***/ },
/* 18 */
/***/ function(module, exports) {
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
module.exports = isObject;
/***/ },
/* 19 */
/***/ function(module, exports) {
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
module.exports = isObjectLike;
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _isEqual = __webpack_require__(122);
var _isEqual2 = _interopRequireDefault(_isEqual);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var React = __webpack_require__(1);
var ReactDOM = __webpack_require__(2);
var joinClasses = __webpack_require__(3);
var EditorContainer = __webpack_require__(60);
var ExcelColumn = __webpack_require__(6);
var isFunction = __webpack_require__(23);
var CellMetaDataShape = __webpack_require__(8);
var SimpleCellFormatter = __webpack_require__(62);
var ColumnUtils = __webpack_require__(5);
var Cell = React.createClass({
displayName: 'Cell',
propTypes: {
rowIdx: React.PropTypes.number.isRequired,
idx: React.PropTypes.number.isRequired,
selected: React.PropTypes.shape({
idx: React.PropTypes.number.isRequired
}),
selectedColumn: React.PropTypes.object,
height: React.PropTypes.number,
tabIndex: React.PropTypes.number,
ref: React.PropTypes.string,
column: React.PropTypes.shape(ExcelColumn).isRequired,
value: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number, React.PropTypes.object, React.PropTypes.bool]).isRequired,
isExpanded: React.PropTypes.bool,
isRowSelected: React.PropTypes.bool,
cellMetaData: React.PropTypes.shape(CellMetaDataShape).isRequired,
handleDragStart: React.PropTypes.func,
className: React.PropTypes.string,
cellControls: React.PropTypes.any,
rowData: React.PropTypes.object.isRequired,
forceUpdate: React.PropTypes.bool,
expandableOptions: React.PropTypes.object.isRequired
},
getDefaultProps: function getDefaultProps() {
return {
tabIndex: -1,
ref: 'cell',
isExpanded: false
};
},
getInitialState: function getInitialState() {
return {
isCellValueChanging: false
};
},
componentDidMount: function componentDidMount() {
this.checkFocus();
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
this.setState({
isCellValueChanging: this.props.value !== nextProps.value
});
},
componentDidUpdate: function componentDidUpdate() {
this.checkFocus();
var dragged = this.props.cellMetaData.dragged;
if (dragged && dragged.complete === true) {
this.props.cellMetaData.handleTerminateDrag();
}
if (this.state.isCellValueChanging && this.props.selectedColumn != null) {
this.applyUpdateClass();
}
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
return this.props.column.width !== nextProps.column.width || this.props.column.left !== nextProps.column.left || this.props.height !== nextProps.height || this.props.rowIdx !== nextProps.rowIdx || this.isCellSelectionChanging(nextProps) || this.isDraggedCellChanging(nextProps) || this.isCopyCellChanging(nextProps) || this.props.isRowSelected !== nextProps.isRowSelected || this.isSelected() || this.props.value !== nextProps.value || this.props.forceUpdate === true || this.props.className !== nextProps.className || this.hasChangedDependentValues(nextProps);
},
onCellClick: function onCellClick(e) {
var meta = this.props.cellMetaData;
if (meta != null && meta.onCellClick && typeof meta.onCellClick === 'function') {
meta.onCellClick({ rowIdx: this.props.rowIdx, idx: this.props.idx }, e);
}
},
onCellContextMenu: function onCellContextMenu() {
var meta = this.props.cellMetaData;
if (meta != null && meta.onCellContextMenu && typeof meta.onCellContextMenu === 'function') {
meta.onCellContextMenu({ rowIdx: this.props.rowIdx, idx: this.props.idx });
}
},
onCellDoubleClick: function onCellDoubleClick(e) {
var meta = this.props.cellMetaData;
if (meta != null && meta.onCellDoubleClick && typeof meta.onCellDoubleClick === 'function') {
meta.onCellDoubleClick({ rowIdx: this.props.rowIdx, idx: this.props.idx }, e);
}
},
onCellExpand: function onCellExpand(e) {
e.stopPropagation();
var meta = this.props.cellMetaData;
if (meta != null && meta.onCellExpand != null) {
meta.onCellExpand({ rowIdx: this.props.rowIdx, idx: this.props.idx, rowData: this.props.rowData, expandArgs: this.props.expandableOptions });
}
},
onCellKeyDown: function onCellKeyDown(e) {
if (this.canExpand() && e.key === 'Enter') {
this.onCellExpand(e);
}
},
onDragHandleDoubleClick: function onDragHandleDoubleClick(e) {
e.stopPropagation();
var meta = this.props.cellMetaData;
if (meta != null && meta.onDragHandleDoubleClick && typeof meta.onDragHandleDoubleClick === 'function') {
meta.onDragHandleDoubleClick({ rowIdx: this.props.rowIdx, idx: this.props.idx, rowData: this.getRowData(), e: e });
}
},
onDragOver: function onDragOver(e) {
e.preventDefault();
},
getStyle: function getStyle() {
var style = {
position: 'absolute',
width: this.props.column.width,
height: this.props.height,
left: this.props.column.left
};
return style;
},
getFormatter: function getFormatter() {
var col = this.props.column;
if (this.isActive()) {
return React.createElement(EditorContainer, { rowData: this.getRowData(), rowIdx: this.props.rowIdx, idx: this.props.idx, cellMetaData: this.props.cellMetaData, column: col, height: this.props.height });
}
return this.props.column.formatter;
},
getRowData: function getRowData() {
var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
return props.rowData.toJSON ? props.rowData.toJSON() : props.rowData;
},
getFormatterDependencies: function getFormatterDependencies() {
// convention based method to get corresponding Id or Name of any Name or Id property
if (typeof this.props.column.getRowMetaData === 'function') {
return this.props.column.getRowMetaData(this.getRowData(), this.props.column);
}
},
getCellClass: function getCellClass() {
var className = joinClasses(this.props.column.cellClass, 'react-grid-Cell', this.props.className, this.props.column.locked ? 'react-grid-Cell--locked' : null);
var extraClasses = joinClasses({
'row-selected': this.props.isRowSelected,
selected: this.isSelected() && !this.isActive() && this.isCellSelectEnabled(),
editing: this.isActive(),
copied: this.isCopied() || this.wasDraggedOver() || this.isDraggedOverUpwards() || this.isDraggedOverDownwards(),
'active-drag-cell': this.isSelected() || this.isDraggedOver(),
'is-dragged-over-up': this.isDraggedOverUpwards(),
'is-dragged-over-down': this.isDraggedOverDownwards(),
'was-dragged-over': this.wasDraggedOver()
});
return joinClasses(className, extraClasses);
},
getUpdateCellClass: function getUpdateCellClass() {
return this.props.column.getUpdateCellClass ? this.props.column.getUpdateCellClass(this.props.selectedColumn, this.props.column, this.state.isCellValueChanging) : '';
},
isColumnSelected: function isColumnSelected() {
var meta = this.props.cellMetaData;
if (meta == null) {
return false;
}
return meta.selected && meta.selected.idx === this.props.idx;
},
isSelected: function isSelected() {
var meta = this.props.cellMetaData;
if (meta == null) {
return false;
}
return meta.selected && meta.selected.rowIdx === this.props.rowIdx && meta.selected.idx === this.props.idx;
},
isActive: function isActive() {
var meta = this.props.cellMetaData;
if (meta == null) {
return false;
}
return this.isSelected() && meta.selected.active === true;
},
isCellSelectionChanging: function isCellSelectionChanging(nextProps) {
var meta = this.props.cellMetaData;
if (meta == null) {
return false;
}
var nextSelected = nextProps.cellMetaData.selected;
if (meta.selected && nextSelected) {
return this.props.idx === nextSelected.idx || this.props.idx === meta.selected.idx;
}
return true;
},
isCellSelectEnabled: function isCellSelectEnabled() {
var meta = this.props.cellMetaData;
if (meta == null) {
return false;
}
return meta.enableCellSelect;
},
hasChangedDependentValues: function hasChangedDependentValues(nextProps) {
var currentColumn = this.props.column;
var hasChangedDependentValues = false;
if (currentColumn.getRowMetaData) {
var currentRowMetaData = currentColumn.getRowMetaData(this.getRowData(), currentColumn);
var nextColumn = nextProps.column;
var nextRowMetaData = nextColumn.getRowMetaData(this.getRowData(nextProps), nextColumn);
hasChangedDependentValues = !(0, _isEqual2['default'])(currentRowMetaData, nextRowMetaData);
}
return hasChangedDependentValues;
},
applyUpdateClass: function applyUpdateClass() {
var updateCellClass = this.getUpdateCellClass();
// -> removing the class
if (updateCellClass != null && updateCellClass !== '') {
var cellDOMNode = ReactDOM.findDOMNode(this);
if (cellDOMNode.classList) {
cellDOMNode.classList.remove(updateCellClass);
// -> and re-adding the class
cellDOMNode.classList.add(updateCellClass);
} else if (cellDOMNode.className.indexOf(updateCellClass) === -1) {
// IE9 doesn't support classList, nor (I think) altering element.className
// without replacing it wholesale.
cellDOMNode.className = cellDOMNode.className + ' ' + updateCellClass;
}
}
},
setScrollLeft: function setScrollLeft(scrollLeft) {
var ctrl = this; // flow on windows has an outdated react declaration, once that gets updated, we can remove this
if (ctrl.isMounted()) {
var node = ReactDOM.findDOMNode(this);
var transform = 'translate3d(' + scrollLeft + 'px, 0px, 0px)';
node.style.webkitTransform = transform;
node.style.transform = transform;
}
},
isCopied: function isCopied() {
var copied = this.props.cellMetaData.copied;
return copied && copied.rowIdx === this.props.rowIdx && copied.idx === this.props.idx;
},
isDraggedOver: function isDraggedOver() {
var dragged = this.props.cellMetaData.dragged;
return dragged && dragged.overRowIdx === this.props.rowIdx && dragged.idx === this.props.idx;
},
wasDraggedOver: function wasDraggedOver() {
var dragged = this.props.cellMetaData.dragged;
return dragged && (dragged.overRowIdx < this.props.rowIdx && this.props.rowIdx < dragged.rowIdx || dragged.overRowIdx > this.props.rowIdx && this.props.rowIdx > dragged.rowIdx) && dragged.idx === this.props.idx;
},
isDraggedCellChanging: function isDraggedCellChanging(nextProps) {
var isChanging = void 0;
var dragged = this.props.cellMetaData.dragged;
var nextDragged = nextProps.cellMetaData.dragged;
if (dragged) {
isChanging = nextDragged && this.props.idx === nextDragged.idx || dragged && this.props.idx === dragged.idx;
return isChanging;
}
return false;
},
isCopyCellChanging: function isCopyCellChanging(nextProps) {
var isChanging = void 0;
var copied = this.props.cellMetaData.copied;
var nextCopied = nextProps.cellMetaData.copied;
if (copied) {
isChanging = nextCopied && this.props.idx === nextCopied.idx || copied && this.props.idx === copied.idx;
return isChanging;
}
return false;
},
isDraggedOverUpwards: function isDraggedOverUpwards() {
var dragged = this.props.cellMetaData.dragged;
return !this.isSelected() && this.isDraggedOver() && this.props.rowIdx < dragged.rowIdx;
},
isDraggedOverDownwards: function isDraggedOverDownwards() {
var dragged = this.props.cellMetaData.dragged;
return !this.isSelected() && this.isDraggedOver() && this.props.rowIdx > dragged.rowIdx;
},
checkFocus: function checkFocus() {
if (this.isSelected() && !this.isActive()) {
// determine the parent viewport element of this cell
var parentViewport = ReactDOM.findDOMNode(this);
while (parentViewport != null && parentViewport.className.indexOf('react-grid-Viewport') === -1) {
parentViewport = parentViewport.parentElement;
}
var focusInGrid = false;
// if the focus is on the body of the document, the user won't mind if we focus them on a cell
if (document.activeElement == null || document.activeElement.nodeName && typeof document.activeElement.nodeName === 'string' && document.activeElement.nodeName.toLowerCase() === 'body') {
focusInGrid = true;
// otherwise
} else {
// only pull focus if the currently focused element is contained within the viewport
if (parentViewport) {
var focusedParent = document.activeElement;
while (focusedParent != null) {
if (focusedParent === parentViewport) {
focusInGrid = true;
break;
}
focusedParent = focusedParent.parentElement;
}
}
}
if (focusInGrid) {
ReactDOM.findDOMNode(this).focus();
}
}
},
canEdit: function canEdit() {
return this.props.column.editor != null || this.props.column.editable;
},
canExpand: function canExpand() {
return this.props.expandableOptions && this.props.expandableOptions.canExpand;
},
createColumEventCallBack: function createColumEventCallBack(onColumnEvent, info) {
return function (e) {
onColumnEvent(e, info);
};
},
createCellEventCallBack: function createCellEventCallBack(gridEvent, columnEvent) {
return function (e) {
gridEvent(e);
columnEvent(e);
};
},
createEventDTO: function createEventDTO(gridEvents, columnEvents, onColumnEvent) {
var allEvents = Object.assign({}, gridEvents);
for (var eventKey in columnEvents) {
if (columnEvents.hasOwnProperty(eventKey)) {
var event = columnEvents[event];
var eventInfo = { rowIdx: this.props.rowIdx, idx: this.props.idx, name: eventKey };
var eventCallback = this.createColumEventCallBack(onColumnEvent, eventInfo);
if (allEvents.hasOwnProperty(eventKey)) {
var currentEvent = allEvents[eventKey];
allEvents[eventKey] = this.createCellEventCallBack(currentEvent, eventCallback);
} else {
allEvents[eventKey] = eventCallback;
}
}
}
return allEvents;
},
getEvents: function getEvents() {
var columnEvents = this.props.column ? Object.assign({}, this.props.column.events) : undefined;
var onColumnEvent = this.props.cellMetaData ? this.props.cellMetaData.onColumnEvent : undefined;
var gridEvents = {
onClick: this.onCellClick,
onDoubleClick: this.onCellDoubleClick,
onContextMenu: this.onCellContextMenu,
onDragOver: this.onDragOver
};
if (!columnEvents || !onColumnEvent) {
return gridEvents;
}
return this.createEventDTO(gridEvents, columnEvents, onColumnEvent);
},
renderCellContent: function renderCellContent(props) {
var CellContent = void 0;
var Formatter = this.getFormatter();
if (React.isValidElement(Formatter)) {
props.dependentValues = this.getFormatterDependencies();
CellContent = React.cloneElement(Formatter, props);
} else if (isFunction(Formatter)) {
CellContent = React.createElement(Formatter, { value: this.props.value, dependentValues: this.getFormatterDependencies() });
} else {
CellContent = React.createElement(SimpleCellFormatter, { value: this.props.value });
}
var cellExpander = void 0;
var marginLeft = this.props.expandableOptions ? this.props.expandableOptions.treeDepth * 30 : 0;
if (this.canExpand()) {
cellExpander = React.createElement(
'span',
{ style: { float: 'left', marginLeft: marginLeft }, onClick: this.onCellExpand },
this.props.expandableOptions.expanded ? String.fromCharCode('9660') : String.fromCharCode('9658')
);
}
return React.createElement(
'div',
{ ref: 'cell',
className: 'react-grid-Cell__value' },
cellExpander,
React.createElement(
'span',
null,
CellContent
),
' ',
this.props.cellControls,
' '
);
},
render: function render() {
var style = this.getStyle();
var className = this.getCellClass();
var cellContent = this.renderCellContent({
value: this.props.value,
column: this.props.column,
rowIdx: this.props.rowIdx,
isExpanded: this.props.isExpanded
});
var dragHandle = !this.isActive() && ColumnUtils.canEdit(this.props.column, this.props.rowData, this.props.cellMetaData.enableCellSelect) ? React.createElement(
'div',
{ className: 'drag-handle', draggable: 'true', onDoubleClick: this.onDragHandleDoubleClick },
React.createElement('span', { style: { display: 'none' } })
) : null;
var events = this.getEvents();
return React.createElement(
'div',
_extends({}, this.props, { className: className, style: style }, events),
cellContent,
dragHandle
);
}
});
module.exports = Cell;
/***/ },
/* 21 */
/***/ function(module, exports) {
'use strict';
var KeyboardHandlerMixin = {
onKeyDown: function onKeyDown(e) {
if (this.isCtrlKeyHeldDown(e)) {
this.checkAndCall('onPressKeyWithCtrl', e);
} else if (this.isKeyExplicitlyHandled(e.key)) {
// break up individual keyPress events to have their own specific callbacks
// this allows multiple mixins to listen to onKeyDown events and somewhat reduces methodName clashing
var callBack = 'onPress' + e.key;
this.checkAndCall(callBack, e);
} else if (this.isKeyPrintable(e.keyCode)) {
this.checkAndCall('onPressChar', e);
}
// Track which keys are currently down for shift clicking etc
this._keysDown = this._keysDown || {};
this._keysDown[e.keyCode] = true;
if (this.props.onGridKeyDown && typeof this.props.onGridKeyDown === 'function') {
this.props.onGridKeyDown(e);
}
},
onKeyUp: function onKeyUp(e) {
// Track which keys are currently down for shift clicking etc
this._keysDown = this._keysDown || {};
delete this._keysDown[e.keyCode];
if (this.props.onGridKeyUp && typeof this.props.onGridKeyUp === 'function') {
this.props.onGridKeyUp(e);
}
},
isKeyDown: function isKeyDown(keyCode) {
if (!this._keysDown) return false;
return keyCode in this._keysDown;
},
isSingleKeyDown: function isSingleKeyDown(keyCode) {
if (!this._keysDown) return false;
return keyCode in this._keysDown && Object.keys(this._keysDown).length === 1;
},
// taken from http://stackoverflow.com/questions/12467240/determine-if-javascript-e-keycode-is-a-printable-non-control-character
isKeyPrintable: function isKeyPrintable(keycode) {
var valid = keycode > 47 && keycode < 58 || // number keys
keycode === 32 || keycode === 13 || // spacebar & return key(s) (if you want to allow carriage returns)
keycode > 64 && keycode < 91 || // letter keys
keycode > 95 && keycode < 112 || // numpad keys
keycode > 185 && keycode < 193 || // ;=,-./` (in order)
keycode > 218 && keycode < 223; // [\]' (in order)
return valid;
},
isKeyExplicitlyHandled: function isKeyExplicitlyHandled(key) {
return typeof this['onPress' + key] === 'function';
},
isCtrlKeyHeldDown: function isCtrlKeyHeldDown(e) {
return e.ctrlKey === true && e.key !== 'Control';
},
checkAndCall: function checkAndCall(methodName, args) {
if (typeof this[methodName] === 'function') {
this[methodName](args);
}
}
};
module.exports = KeyboardHandlerMixin;
/***/ },
/* 22 */
/***/ function(module, exports) {
'use strict';
var RowUtils = {
get: function get(row, property) {
if (typeof row.get === 'function') {
return row.get(property);
}
return row[property];
},
isRowSelected: function isRowSelected(keys, indexes, isSelectedKey, rowData, rowIdx) {
if (indexes && Object.prototype.toString.call(indexes) === '[object Array]') {
return indexes.indexOf(rowIdx) > -1;
} else if (keys && keys.rowKey && keys.values && Object.prototype.toString.call(keys.values) === '[object Array]') {
return keys.values.indexOf(rowData[keys.rowKey]) > -1;
} else if (isSelectedKey && rowData && typeof isSelectedKey === 'string') {
return rowData[isSelectedKey];
}
return false;
}
};
module.exports = RowUtils;
/***/ },
/* 23 */
/***/ function(module, exports) {
'use strict';
var isFunction = function isFunction(functionToCheck) {
var getType = {};
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
};
module.exports = isFunction;
/***/ },
/* 24 */
/***/ function(module, exports) {
'use strict';
var size = void 0;
function getScrollbarSize() {
if (size === undefined) {
var outer = document.createElement('div');
outer.style.width = '50px';
outer.style.height = '50px';
outer.style.position = 'absolute';
outer.style.top = '-200px';
outer.style.left = '-200px';
var inner = document.createElement('div');
inner.style.height = '100px';
inner.style.width = '100%';
outer.appendChild(inner);
document.body.appendChild(outer);
var outerWidth = outer.clientWidth;
outer.style.overflowY = 'scroll';
var innerWidth = inner.clientWidth;
document.body.removeChild(outer);
size = outerWidth - innerWidth;
}
return size;
}
module.exports = getScrollbarSize;
/***/ },
/* 25 */
/***/ function(module, exports) {
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule shallowEqual
* @typechecks
*
*/
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
* Returns true when the values of all keys are strictly equal.
*/
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
var bHasOwnProperty = hasOwnProperty.bind(objB);
for (var i = 0; i < keysA.length; i++) {
if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
var mapCacheClear = __webpack_require__(103),
mapCacheDelete = __webpack_require__(104),
mapCacheGet = __webpack_require__(105),
mapCacheHas = __webpack_require__(106),
mapCacheSet = __webpack_require__(107);
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
module.exports = MapCache;
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
var SetCache = __webpack_require__(69),
arraySome = __webpack_require__(75);
/** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1,
PARTIAL_COMPARE_FLAG = 2;
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function(othValue, othIndex) {
if (!seen.has(othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
return seen.add(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, customizer, bitmask, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
module.exports = equalArrays;
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof (window) == 'object' && (window) && (window).Object === Object && (window);
module.exports = freeGlobal;
/***/ },
/* 29 */
/***/ function(module, exports) {
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false;
if (value != null && typeof value.toString != 'function') {
try {
result = !!(value + '');
} catch (e) {}
}
return result;
}
module.exports = isHostObject;
/***/ },
/* 30 */
/***/ function(module, exports) {
/** Used for built-in method references. */
var funcProto = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
module.exports = toSource;
/***/ },
/* 31 */
/***/ function(module, exports) {
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
module.exports = eq;
/***/ },
/* 32 */
/***/ function(module, exports) {
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
module.exports = isArray;
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
var isFunction = __webpack_require__(34),
isLength = __webpack_require__(35);
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
module.exports = isArrayLike;
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(18);
/** `Object#toString` result references. */
var funcTag = '[object Function]',
genTag = '[object GeneratorFunction]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
module.exports = isFunction;
/***/ },
/* 35 */
/***/ function(module, exports) {
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
module.exports = isLength;
/***/ },
/* 36 */
/***/ function(module, exports) {
'use strict';
function ToObject(val) {
if (val == null) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
module.exports = Object.assign || function (target, source) {
var from;
var keys;
var to = ToObject(target);
for (var s = 1; s < arguments.length; s++) {
from = arguments[s];
keys = Object.keys(Object(from));
for (var i = 0; i < keys.length; i++) {
to[keys[i]] = from[keys[i]];
}
}
return to;
};
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _keyMirror = __webpack_require__(64);
var _keyMirror2 = _interopRequireDefault(_keyMirror);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var constants = {
UpdateActions: (0, _keyMirror2['default'])({
CELL_UPDATE: null,
COLUMN_FILL: null,
COPY_PASTE: null,
CELL_DRAG: null
})
};
exports['default'] = constants;
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _shallowEqual = __webpack_require__(25);
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
var _RowsContainer = __webpack_require__(52);
var _RowsContainer2 = _interopRequireDefault(_RowsContainer);
var _RowGroup = __webpack_require__(51);
var _RowGroup2 = _interopRequireDefault(_RowGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var React = __webpack_require__(1);
var ReactDOM = __webpack_require__(2);
var joinClasses = __webpack_require__(3);
var PropTypes = React.PropTypes;
var ScrollShim = __webpack_require__(53);
var Row = __webpack_require__(15);
var cellMetaDataShape = __webpack_require__(8);
var RowUtils = __webpack_require__(22);
var Canvas = React.createClass({
displayName: 'Canvas',
mixins: [ScrollShim],
propTypes: {
rowRenderer: PropTypes.oneOfType([PropTypes.func, PropTypes.element]),
rowHeight: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
width: PropTypes.number,
totalWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
style: PropTypes.string,
className: PropTypes.string,
displayStart: PropTypes.number.isRequired,
displayEnd: PropTypes.number.isRequired,
rowsCount: PropTypes.number.isRequired,
rowGetter: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.array.isRequired]),
expandedRows: PropTypes.array,
onRows: PropTypes.func,
onScroll: PropTypes.func,
columns: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,
cellMetaData: PropTypes.shape(cellMetaDataShape).isRequired,
selectedRows: PropTypes.array,
rowKey: React.PropTypes.string,
rowScrollTimeout: React.PropTypes.number,
contextMenu: PropTypes.element,
getSubRowDetails: PropTypes.func,
rowSelection: React.PropTypes.oneOfType([React.PropTypes.shape({
indexes: React.PropTypes.arrayOf(React.PropTypes.number).isRequired
}), React.PropTypes.shape({
isSelectedKey: React.PropTypes.string.isRequired
}), React.PropTypes.shape({
keys: React.PropTypes.shape({
values: React.PropTypes.array.isRequired,
rowKey: React.PropTypes.string.isRequired
}).isRequired
})]),
rowGroupRenderer: React.PropTypes.func
},
getDefaultProps: function getDefaultProps() {
return {
rowRenderer: Row,
onRows: function onRows() {},
selectedRows: [],
rowScrollTimeout: 0
};
},
getInitialState: function getInitialState() {
return {
displayStart: this.props.displayStart,
displayEnd: this.props.displayEnd,
scrollingTimeout: null
};
},
componentWillMount: function componentWillMount() {
this._currentRowsLength = 0;
this._currentRowsRange = { start: 0, end: 0 };
this._scroll = { scrollTop: 0, scrollLeft: 0 };
},
componentDidMount: function componentDidMount() {
this.onRows();
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (nextProps.displayStart !== this.state.displayStart || nextProps.displayEnd !== this.state.displayEnd) {
this.setState({
displayStart: nextProps.displayStart,
displayEnd: nextProps.displayEnd
});
}
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
var shouldUpdate = nextState.displayStart !== this.state.displayStart || nextState.displayEnd !== this.state.displayEnd || nextState.scrollingTimeout !== this.state.scrollingTimeout || nextProps.rowsCount !== this.props.rowsCount || nextProps.rowHeight !== this.props.rowHeight || nextProps.columns !== this.props.columns || nextProps.width !== this.props.width || nextProps.cellMetaData !== this.props.cellMetaData || !(0, _shallowEqual2['default'])(nextProps.style, this.props.style);
return shouldUpdate;
},
componentWillUnmount: function componentWillUnmount() {
this._currentRowsLength = 0;
this._currentRowsRange = { start: 0, end: 0 };
this._scroll = { scrollTop: 0, scrollLeft: 0 };
},
componentDidUpdate: function componentDidUpdate() {
if (this._scroll.scrollTop !== 0 && this._scroll.scrollLeft !== 0) {
this.setScrollLeft(this._scroll.scrollLeft);
}
this.onRows();
},
onRows: function onRows() {
if (this._currentRowsRange !== { start: 0, end: 0 }) {
this.props.onRows(this._currentRowsRange);
this._currentRowsRange = { start: 0, end: 0 };
}
},
onScroll: function onScroll(e) {
var _this = this;
if (ReactDOM.findDOMNode(this) !== e.target) {
return;
}
this.appendScrollShim();
var scrollLeft = e.target.scrollLeft;
var scrollTop = e.target.scrollTop;
var scroll = { scrollTop: scrollTop, scrollLeft: scrollLeft };
// check how far we have scrolled, and if this means we are being taken out of range
var scrollYRange = Math.abs(this._scroll.scrollTop - scroll.scrollTop) / this.props.rowHeight;
var scrolledOutOfRange = scrollYRange > this.props.displayEnd - this.props.displayStart;
this._scroll = scroll;
this.props.onScroll(scroll);
// if we go out of range, we queue the actual render, just rendering cheap placeholders
// avoiding rendering anything expensive while a user scrolls down
if (scrolledOutOfRange && this.props.rowScrollTimeout > 0) {
var scrollTO = this.state.scrollingTimeout;
if (scrollTO) {
clearTimeout(scrollTO);
}
// queue up, and set state to clear the TO so we render the rows (not placeholders)
scrollTO = setTimeout(function () {
if (_this.state.scrollingTimeout !== null) {
_this.setState({ scrollingTimeout: null });
}
}, this.props.rowScrollTimeout);
this.setState({ scrollingTimeout: scrollTO });
}
},
getSubRows: function getSubRows(row) {
var subRowDetails = this.props.getSubRowDetails(row);
if (subRowDetails.expanded === true) {
return subRowDetails.children.map(function (r) {
return { row: r };
});
}
},
addSubRows: function addSubRows(rowsInput, row, i, displayEnd, treeDepth) {
var _this2 = this;
var subRowDetails = this.props.getSubRowDetails(row) || {};
var rows = rowsInput;
var increment = i;
if (increment < displayEnd) {
subRowDetails.treeDepth = treeDepth;
rows.push({ row: row, subRowDetails: subRowDetails });
increment++;
}
if (subRowDetails && subRowDetails.expanded) {
var subRows = this.getSubRows(row);
subRows.forEach(function (sr) {
var result = _this2.addSubRows(rows, sr.row, increment, displayEnd, treeDepth + 1);
rows = result.rows;
increment = result.increment;
});
}
return { rows: rows, increment: increment };
},
getRows: function getRows(displayStart, displayEnd) {
this._currentRowsRange = { start: displayStart, end: displayEnd };
if (Array.isArray(this.props.rowGetter)) {
return this.props.rowGetter.slice(displayStart, displayEnd);
}
var rows = [];
var rowFetchIndex = displayStart;
var i = displayStart;
while (i < displayEnd) {
var row = this.props.rowGetter(rowFetchIndex);
if (this.props.getSubRowDetails) {
var treeDepth = 0;
var result = this.addSubRows(rows, row, i, displayEnd, treeDepth);
rows = result.rows;
i = result.increment;
} else {
rows.push({ row: row });
i++;
}
rowFetchIndex++;
}
return rows;
},
getScrollbarWidth: function getScrollbarWidth() {
var scrollbarWidth = 0;
// Get the scrollbar width
var canvas = ReactDOM.findDOMNode(this);
scrollbarWidth = canvas.offsetWidth - canvas.clientWidth;
return scrollbarWidth;
},
getScroll: function getScroll() {
var _ReactDOM$findDOMNode = ReactDOM.findDOMNode(this);
var scrollTop = _ReactDOM$findDOMNode.scrollTop;
var scrollLeft = _ReactDOM$findDOMNode.scrollLeft;
return { scrollTop: scrollTop, scrollLeft: scrollLeft };
},
isRowSelected: function isRowSelected(idx, row) {
var _this3 = this;
// Use selectedRows if set
if (this.props.selectedRows !== null) {
var selectedRows = this.props.selectedRows.filter(function (r) {
var rowKeyValue = row.get ? row.get(_this3.props.rowKey) : row[_this3.props.rowKey];
return r[_this3.props.rowKey] === rowKeyValue;
});
return selectedRows.length > 0 && selectedRows[0].isSelected;
}
// Else use new rowSelection props
if (this.props.rowSelection) {
var _props$rowSelection = this.props.rowSelection;
var keys = _props$rowSelection.keys;
var indexes = _props$rowSelection.indexes;
var isSelectedKey = _props$rowSelection.isSelectedKey;
return RowUtils.isRowSelected(keys, indexes, isSelectedKey, row, idx);
}
return false;
},
_currentRowsLength: 0,
_currentRowsRange: { start: 0, end: 0 },
_scroll: { scrollTop: 0, scrollLeft: 0 },
setScrollLeft: function setScrollLeft(scrollLeft) {
if (this._currentRowsLength !== 0) {
if (!this.refs) return;
for (var i = 0, len = this._currentRowsLength; i < len; i++) {
if (this.refs[i] && this.refs[i].setScrollLeft) {
this.refs[i].setScrollLeft(scrollLeft);
}
}
}
},
renderRow: function renderRow(props) {
var row = props.row;
if (row.__metaData && row.__metaData.isGroup) {
return React.createElement(_RowGroup2['default'], _extends({ name: row.name }, row.__metaData, { row: props.row, idx: props.idx, cellMetaData: this.props.cellMetaData, renderer: this.props.rowGroupRenderer }));
}
if (this.state.scrollingTimeout !== null) {
// in the midst of a rapid scroll, so we render placeholders
// the actual render is then queued (through a timeout)
// this avoids us redering a bunch of rows that a user is trying to scroll past
return this.renderScrollingPlaceholder(props);
}
var RowsRenderer = this.props.rowRenderer;
if (typeof RowsRenderer === 'function') {
return React.createElement(RowsRenderer, props);
}
if (React.isValidElement(this.props.rowRenderer)) {
return React.cloneElement(this.props.rowRenderer, props);
}
},
renderScrollingPlaceholder: function renderScrollingPlaceholder(props) {
// here we are just rendering empty cells
// we may want to allow a user to inject this, and/or just render the cells that are in view
// for now though we essentially are doing a (very lightweight) row + cell with empty content
var styles = {
row: { height: props.height, overflow: 'hidden' },
cell: { height: props.height, position: 'absolute' },
placeholder: { backgroundColor: 'rgba(211, 211, 211, 0.45)', width: '60%', height: Math.floor(props.height * 0.3) }
};
return React.createElement(
'div',
{ key: props.key, style: styles.row, className: 'react-grid-Row' },
this.props.columns.map(function (col, idx) {
return React.createElement(
'div',
{ style: Object.assign(styles.cell, { width: col.width, left: col.left }), key: idx, className: 'react-grid-Cell' },
React.createElement('div', { style: Object.assign(styles.placeholder, { width: Math.floor(col.width * 0.6) }) })
);
})
);
},
renderPlaceholder: function renderPlaceholder(key, height) {
// just renders empty cells
// if we wanted to show gridlines, we'd need classes and position as with renderScrollingPlaceholder
return React.createElement(
'div',
{ key: key, style: { height: height } },
this.props.columns.map(function (column, idx) {
return React.createElement('div', { style: { width: column.width }, key: idx });
})
);
},
render: function render() {
var _this4 = this;
var displayStart = this.state.displayStart;
var displayEnd = this.state.displayEnd;
var rowHeight = this.props.rowHeight;
var length = this.props.rowsCount;
var rows = this.getRows(displayStart, displayEnd).map(function (r, idx) {
return _this4.renderRow({
key: displayStart + idx,
ref: idx,
idx: displayStart + idx,
row: r.row,
height: rowHeight,
onMouseOver: _this4.onMouseOver,
columns: _this4.props.columns,
isSelected: _this4.isRowSelected(displayStart + idx, r.row, displayStart, displayEnd),
expandedRows: _this4.props.expandedRows,
cellMetaData: _this4.props.cellMetaData,
subRowDetails: r.subRowDetails
});
});
this._currentRowsLength = rows.length;
if (displayStart > 0) {
rows.unshift(this.renderPlaceholder('top', displayStart * rowHeight));
}
if (length - displayEnd > 0) {
rows.push(this.renderPlaceholder('bottom', (length - displayEnd) * rowHeight));
}
var style = {
position: 'absolute',
top: 0,
left: 0,
overflowX: 'auto',
overflowY: 'scroll',
width: this.props.totalWidth,
height: this.props.height,
transform: 'translate3d(0, 0, 0)'
};
return React.createElement(
'div',
{
style: style,
onScroll: this.onScroll,
className: joinClasses('react-grid-Canvas', this.props.className, { opaque: this.props.cellMetaData.selected && this.props.cellMetaData.selected.active }) },
React.createElement(_RowsContainer2['default'], {
width: this.props.width,
rows: rows,
contextMenu: this.props.contextMenu,
rowIdx: this.props.cellMetaData.selected.rowIdx,
idx: this.props.cellMetaData.selected.idx })
);
}
});
module.exports = Canvas;
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var isValidElement = __webpack_require__(1).isValidElement;
module.exports = function sameColumn(a, b) {
var k = void 0;
for (k in a) {
if (a.hasOwnProperty(k)) {
if (typeof a[k] === 'function' && typeof b[k] === 'function' || isValidElement(a[k]) && isValidElement(b[k])) {
continue;
}
if (!b.hasOwnProperty(k) || a[k] !== b[k]) {
return false;
}
}
}
for (k in b) {
if (b.hasOwnProperty(k) && !a.hasOwnProperty(k)) {
return false;
}
}
return true;
};
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _reactDom = __webpack_require__(2);
var _reactDom2 = _interopRequireDefault(_reactDom);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var ColumnMetrics = __webpack_require__(14);
var DOMMetrics = __webpack_require__(9);
Object.assign = __webpack_require__(36);
var PropTypes = __webpack_require__(1).PropTypes;
var ColumnUtils = __webpack_require__(5);
var Column = function Column() {
_classCallCheck(this, Column);
};
module.exports = {
mixins: [DOMMetrics.MetricsMixin],
propTypes: {
columns: PropTypes.arrayOf(Column),
minColumnWidth: PropTypes.number,
columnEquality: PropTypes.func,
onColumnResize: PropTypes.func
},
DOMMetrics: {
gridWidth: function gridWidth() {
return _reactDom2['default'].findDOMNode(this).parentElement.offsetWidth;
}
},
getDefaultProps: function getDefaultProps() {
return {
minColumnWidth: 80,
columnEquality: ColumnMetrics.sameColumn
};
},
componentWillMount: function componentWillMount() {
this._mounted = true;
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (nextProps.columns) {
if (!ColumnMetrics.sameColumns(this.props.columns, nextProps.columns, this.props.columnEquality) || nextProps.minWidth !== this.props.minWidth) {
var columnMetrics = this.createColumnMetrics(nextProps);
this.setState({ columnMetrics: columnMetrics });
}
}
},
getTotalWidth: function getTotalWidth() {
var totalWidth = 0;
if (this._mounted) {
totalWidth = this.DOMMetrics.gridWidth();
} else {
totalWidth = ColumnUtils.getSize(this.props.columns) * this.props.minColumnWidth;
}
return totalWidth;
},
getColumnMetricsType: function getColumnMetricsType(metrics) {
var totalWidth = metrics.totalWidth || this.getTotalWidth();
var currentMetrics = {
columns: metrics.columns,
totalWidth: totalWidth,
minColumnWidth: metrics.minColumnWidth
};
var updatedMetrics = ColumnMetrics.recalculate(currentMetrics);
return updatedMetrics;
},
getColumn: function getColumn(idx) {
var columns = this.state.columnMetrics.columns;
if (Array.isArray(columns)) {
return columns[idx];
} else if (typeof Immutable !== 'undefined') {
return columns.get(idx);
}
},
getSize: function getSize() {
var columns = this.state.columnMetrics.columns;
if (Array.isArray(columns)) {
return columns.length;
} else if (typeof Immutable !== 'undefined') {
return columns.size;
}
},
metricsUpdated: function metricsUpdated() {
var columnMetrics = this.createColumnMetrics();
this.setState({ columnMetrics: columnMetrics });
},
createColumnMetrics: function createColumnMetrics() {
var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
var gridColumns = this.setupGridColumns(props);
return this.getColumnMetricsType({
columns: gridColumns,
minColumnWidth: this.props.minColumnWidth,
totalWidth: props.minWidth
});
},
onColumnResize: function onColumnResize(index, width) {
var columnMetrics = ColumnMetrics.resizeColumn(this.state.columnMetrics, index, width);
this.setState({ columnMetrics: columnMetrics });
if (this.props.onColumnResize) {
this.props.onColumnResize(index, width);
}
}
};
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var React = __webpack_require__(1);
var PropTypes = React.PropTypes;
var Draggable = React.createClass({
displayName: 'Draggable',
propTypes: {
onDragStart: PropTypes.func,
onDragEnd: PropTypes.func,
onDrag: PropTypes.func,
component: PropTypes.oneOfType([PropTypes.func, PropTypes.constructor])
},
getDefaultProps: function getDefaultProps() {
return {
onDragStart: function onDragStart() {
return true;
},
onDragEnd: function onDragEnd() {},
onDrag: function onDrag() {}
};
},
getInitialState: function getInitialState() {
return {
drag: null
};
},
componentWillUnmount: function componentWillUnmount() {
this.cleanUp();
},
onMouseDown: function onMouseDown(e) {
var drag = this.props.onDragStart(e);
if (drag === null && e.button !== 0) {
return;
}
window.addEventListener('mouseup', this.onMouseUp);
window.addEventListener('mousemove', this.onMouseMove);
window.addEventListener('touchend', this.onMouseUp);
window.addEventListener('touchmove', this.onMouseMove);
this.setState({ drag: drag });
},
onMouseMove: function onMouseMove(e) {
if (this.state.drag === null) {
return;
}
if (e.preventDefault) {
e.preventDefault();
}
this.props.onDrag(e);
},
onMouseUp: function onMouseUp(e) {
this.cleanUp();
this.props.onDragEnd(e, this.state.drag);
this.setState({ drag: null });
},
cleanUp: function cleanUp() {
window.removeEventListener('mouseup', this.onMouseUp);
window.removeEventListener('mousemove', this.onMouseMove);
window.removeEventListener('touchend', this.onMouseUp);
window.removeEventListener('touchmove', this.onMouseMove);
},
render: function render() {
return React.createElement('div', _extends({}, this.props, {
onMouseDown: this.onMouseDown,
onTouchStart: this.onMouseDown,
className: 'react-grid-HeaderCell__draggable' }));
}
});
module.exports = Draggable;
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var React = __webpack_require__(1);
var PropTypes = React.PropTypes;
var Header = __webpack_require__(44);
var Viewport = __webpack_require__(54);
var GridScrollMixin = __webpack_require__(43);
var DOMMetrics = __webpack_require__(9);
var cellMetaDataShape = __webpack_require__(8);
var Grid = React.createClass({
displayName: 'Grid',
propTypes: {
rowGetter: PropTypes.oneOfType([PropTypes.array, PropTypes.func]).isRequired,
columns: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
columnMetrics: PropTypes.object,
minHeight: PropTypes.number,
totalWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
headerRows: PropTypes.oneOfType([PropTypes.array, PropTypes.func]),
rowHeight: PropTypes.number,
rowRenderer: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
emptyRowsView: PropTypes.func,
expandedRows: PropTypes.oneOfType([PropTypes.array, PropTypes.func]),
selectedRows: PropTypes.oneOfType([PropTypes.array, PropTypes.func]),
rowSelection: React.PropTypes.oneOfType([React.PropTypes.shape({
indexes: React.PropTypes.arrayOf(React.PropTypes.number).isRequired
}), React.PropTypes.shape({
isSelectedKey: React.PropTypes.string.isRequired
}), React.PropTypes.shape({
keys: React.PropTypes.shape({
values: React.PropTypes.array.isRequired,
rowKey: React.PropTypes.string.isRequired
}).isRequired
})]),
rowsCount: PropTypes.number,
onRows: PropTypes.func,
sortColumn: React.PropTypes.string,
sortDirection: React.PropTypes.oneOf(['ASC', 'DESC', 'NONE']),
rowOffsetHeight: PropTypes.number.isRequired,
onViewportKeydown: PropTypes.func.isRequired,
onViewportKeyup: PropTypes.func,
onViewportDragStart: PropTypes.func.isRequired,
onViewportDragEnd: PropTypes.func.isRequired,
onViewportDoubleClick: PropTypes.func.isRequired,
onColumnResize: PropTypes.func,
onSort: PropTypes.func,
cellMetaData: PropTypes.shape(cellMetaDataShape),
rowKey: PropTypes.string.isRequired,
rowScrollTimeout: PropTypes.number,
contextMenu: PropTypes.element,
getSubRowDetails: PropTypes.func,
draggableHeaderCell: PropTypes.func,
getValidFilterValues: PropTypes.func,
rowGroupRenderer: PropTypes.func
},
mixins: [GridScrollMixin, DOMMetrics.MetricsComputatorMixin],
getDefaultProps: function getDefaultProps() {
return {
rowHeight: 35,
minHeight: 350
};
},
getStyle: function getStyle() {
return {
overflow: 'hidden',
outline: 0,
position: 'relative',
minHeight: this.props.minHeight
};
},
render: function render() {
var headerRows = this.props.headerRows || [{ ref: 'row' }];
var EmptyRowsView = this.props.emptyRowsView;
return React.createElement(
'div',
_extends({}, this.props, { style: this.getStyle(), className: 'react-grid-Grid' }),
React.createElement(Header, {
ref: 'header',
columnMetrics: this.props.columnMetrics,
onColumnResize: this.props.onColumnResize,
height: this.props.rowHeight,
totalWidth: this.props.totalWidth,
headerRows: headerRows,
sortColumn: this.props.sortColumn,
sortDirection: this.props.sortDirection,
draggableHeaderCell: this.props.draggableHeaderCell,
onSort: this.props.onSort,
onScroll: this.onHeaderScroll,
getValidFilterValues: this.props.getValidFilterValues
}),
this.props.rowsCount >= 1 || this.props.rowsCount === 0 && !this.props.emptyRowsView ? React.createElement(
'div',
{ ref: 'viewPortContainer', tabIndex: '0', onKeyDown: this.props.onViewportKeydown, onKeyUp: this.props.onViewportKeyup, onDoubleClick: this.props.onViewportDoubleClick, onDragStart: this.props.onViewportDragStart, onDragEnd: this.props.onViewportDragEnd },
React.createElement(Viewport, {
ref: 'viewport',
rowKey: this.props.rowKey,
width: this.props.columnMetrics.width,
rowHeight: this.props.rowHeight,
rowRenderer: this.props.rowRenderer,
rowGetter: this.props.rowGetter,
rowsCount: this.props.rowsCount,
selectedRows: this.props.selectedRows,
expandedRows: this.props.expandedRows,
columnMetrics: this.props.columnMetrics,
totalWidth: this.props.totalWidth,
onScroll: this.onScroll,
onRows: this.props.onRows,
cellMetaData: this.props.cellMetaData,
rowOffsetHeight: this.props.rowOffsetHeight || this.props.rowHeight * headerRows.length,
minHeight: this.props.minHeight,
rowScrollTimeout: this.props.rowScrollTimeout,
contextMenu: this.props.contextMenu,
rowSelection: this.props.rowSelection,
getSubRowDetails: this.props.getSubRowDetails,
rowGroupRenderer: this.props.rowGroupRenderer
})
) : React.createElement(
'div',
{ ref: 'emptyView', className: 'react-grid-Empty' },
React.createElement(EmptyRowsView, null)
)
);
}
});
module.exports = Grid;
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var ReactDOM = __webpack_require__(2);
module.exports = {
componentDidMount: function componentDidMount() {
this._scrollLeft = this.refs.viewport ? this.refs.viewport.getScroll().scrollLeft : 0;
this._onScroll();
},
componentDidUpdate: function componentDidUpdate() {
this._onScroll();
},
componentWillMount: function componentWillMount() {
this._scrollLeft = undefined;
},
componentWillUnmount: function componentWillUnmount() {
this._scrollLeft = undefined;
},
onScroll: function onScroll(props) {
if (this._scrollLeft !== props.scrollLeft) {
this._scrollLeft = props.scrollLeft;
this._onScroll();
}
},
onHeaderScroll: function onHeaderScroll(e) {
var scrollLeft = e.target.scrollLeft;
if (this._scrollLeft !== scrollLeft) {
this._scrollLeft = scrollLeft;
this.refs.header.setScrollLeft(scrollLeft);
var canvas = ReactDOM.findDOMNode(this.refs.viewport.refs.canvas);
canvas.scrollLeft = scrollLeft;
this.refs.viewport.refs.canvas.setScrollLeft(scrollLeft);
}
},
_onScroll: function _onScroll() {
if (this._scrollLeft !== undefined) {
this.refs.header.setScrollLeft(this._scrollLeft);
if (this.refs.viewport) {
this.refs.viewport.setScrollLeft(this._scrollLeft);
}
}
}
};
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var React = __webpack_require__(1);
var ReactDOM = __webpack_require__(2);
var joinClasses = __webpack_require__(3);
var shallowCloneObject = __webpack_require__(16);
var ColumnMetrics = __webpack_require__(14);
var ColumnUtils = __webpack_require__(5);
var HeaderRow = __webpack_require__(47);
var PropTypes = React.PropTypes;
var Header = React.createClass({
displayName: 'Header',
propTypes: {
columnMetrics: PropTypes.shape({ width: PropTypes.number.isRequired, columns: PropTypes.any }).isRequired,
totalWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
height: PropTypes.number.isRequired,
headerRows: PropTypes.array.isRequired,
sortColumn: PropTypes.string,
sortDirection: PropTypes.oneOf(['ASC', 'DESC', 'NONE']),
onSort: PropTypes.func,
onColumnResize: PropTypes.func,
onScroll: PropTypes.func,
draggableHeaderCell: PropTypes.func,
getValidFilterValues: PropTypes.func
},
getInitialState: function getInitialState() {
return { resizing: null };
},
componentWillReceiveProps: function componentWillReceiveProps() {
this.setState({ resizing: null });
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
var update = !ColumnMetrics.sameColumns(this.props.columnMetrics.columns, nextProps.columnMetrics.columns, ColumnMetrics.sameColumn) || this.props.totalWidth !== nextProps.totalWidth || this.props.headerRows.length !== nextProps.headerRows.length || this.state.resizing !== nextState.resizing || this.props.sortColumn !== nextProps.sortColumn || this.props.sortDirection !== nextProps.sortDirection;
return update;
},
onColumnResize: function onColumnResize(column, width) {
var state = this.state.resizing || this.props;
var pos = this.getColumnPosition(column);
if (pos != null) {
var _resizing = {
columnMetrics: shallowCloneObject(state.columnMetrics)
};
_resizing.columnMetrics = ColumnMetrics.resizeColumn(_resizing.columnMetrics, pos, width);
// we don't want to influence scrollLeft while resizing
if (_resizing.columnMetrics.totalWidth < state.columnMetrics.totalWidth) {
_resizing.columnMetrics.totalWidth = state.columnMetrics.totalWidth;
}
_resizing.column = ColumnUtils.getColumn(_resizing.columnMetrics.columns, pos);
this.setState({ resizing: _resizing });
}
},
onColumnResizeEnd: function onColumnResizeEnd(column, width) {
var pos = this.getColumnPosition(column);
if (pos !== null && this.props.onColumnResize) {
this.props.onColumnResize(pos, width || column.width);
}
},
getHeaderRows: function getHeaderRows() {
var _this = this;
var columnMetrics = this.getColumnMetrics();
var resizeColumn = void 0;
if (this.state.resizing) {
resizeColumn = this.state.resizing.column;
}
var headerRows = [];
this.props.headerRows.forEach(function (row, index) {
// To allow header filters to be visible
var rowHeight = 'auto';
if (row.rowType === 'filter') {
rowHeight = '500px';
}
var headerRowStyle = {
position: 'absolute',
top: _this.getCombinedHeaderHeights(index),
left: 0,
width: _this.props.totalWidth,
overflowX: 'hidden',
minHeight: rowHeight
};
headerRows.push(React.createElement(HeaderRow, {
key: row.ref,
ref: row.ref,
rowType: row.rowType,
style: headerRowStyle,
onColumnResize: _this.onColumnResize,
onColumnResizeEnd: _this.onColumnResizeEnd,
width: columnMetrics.width,
height: row.height || _this.props.height,
columns: columnMetrics.columns,
resizing: resizeColumn,
draggableHeaderCell: _this.props.draggableHeaderCell,
filterable: row.filterable,
onFilterChange: row.onFilterChange,
sortColumn: _this.props.sortColumn,
sortDirection: _this.props.sortDirection,
onSort: _this.props.onSort,
onScroll: _this.props.onScroll,
getValidFilterValues: _this.props.getValidFilterValues
}));
});
return headerRows;
},
getColumnMetrics: function getColumnMetrics() {
var columnMetrics = void 0;
if (this.state.resizing) {
columnMetrics = this.state.resizing.columnMetrics;
} else {
columnMetrics = this.props.columnMetrics;
}
return columnMetrics;
},
getColumnPosition: function getColumnPosition(column) {
var columnMetrics = this.getColumnMetrics();
var pos = -1;
columnMetrics.columns.forEach(function (c, idx) {
if (c.key === column.key) {
pos = idx;
}
});
return pos === -1 ? null : pos;
},
getCombinedHeaderHeights: function getCombinedHeaderHeights(until) {
var stopAt = this.props.headerRows.length;
if (typeof until !== 'undefined') {
stopAt = until;
}
var height = 0;
for (var index = 0; index < stopAt; index++) {
height += this.props.headerRows[index].height || this.props.height;
}
return height;
},
getStyle: function getStyle() {
return {
position: 'relative',
height: this.getCombinedHeaderHeights()
};
},
setScrollLeft: function setScrollLeft(scrollLeft) {
var node = ReactDOM.findDOMNode(this.refs.row);
node.scrollLeft = scrollLeft;
this.refs.row.setScrollLeft(scrollLeft);
if (this.refs.filterRow) {
var nodeFilters = ReactDOM.findDOMNode(this.refs.filterRow);
nodeFilters.scrollLeft = scrollLeft;
this.refs.filterRow.setScrollLeft(scrollLeft);
}
},
render: function render() {
var className = joinClasses({
'react-grid-Header': true,
'react-grid-Header--resizing': !!this.state.resizing
});
var headerRows = this.getHeaderRows();
return React.createElement(
'div',
_extends({}, this.props, { style: this.getStyle(), className: className }),
headerRows
);
}
});
module.exports = Header;
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(1);
var ReactDOM = __webpack_require__(2);
var joinClasses = __webpack_require__(3);
var ExcelColumn = __webpack_require__(6);
var ResizeHandle = __webpack_require__(50);
var PropTypes = React.PropTypes;
function simpleCellRenderer(objArgs) {
return React.createElement(
'div',
{ className: 'widget-HeaderCell__value' },
objArgs.column.name
);
}
var HeaderCell = React.createClass({
displayName: 'HeaderCell',
propTypes: {
renderer: PropTypes.oneOfType([PropTypes.func, PropTypes.element]).isRequired,
column: PropTypes.shape(ExcelColumn).isRequired,
onResize: PropTypes.func.isRequired,
height: PropTypes.number.isRequired,
onResizeEnd: PropTypes.func.isRequired,
className: PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
renderer: simpleCellRenderer
};
},
getInitialState: function getInitialState() {
return { resizing: false };
},
onDragStart: function onDragStart(e) {
this.setState({ resizing: true });
// need to set dummy data for FF
if (e && e.dataTransfer && e.dataTransfer.setData) e.dataTransfer.setData('text/plain', 'dummy');
},
onDrag: function onDrag(e) {
var resize = this.props.onResize || null; // for flows sake, doesnt recognise a null check direct
if (resize) {
var _width = this.getWidthFromMouseEvent(e);
if (_width > 0) {
resize(this.props.column, _width);
}
}
},
onDragEnd: function onDragEnd(e) {
var width = this.getWidthFromMouseEvent(e);
this.props.onResizeEnd(this.props.column, width);
this.setState({ resizing: false });
},
getWidthFromMouseEvent: function getWidthFromMouseEvent(e) {
var right = e.pageX || e.touches && e.touches[0] && e.touches[0].pageX || e.changedTouches && e.changedTouches[e.changedTouches.length - 1].pageX;
var left = ReactDOM.findDOMNode(this).getBoundingClientRect().left;
return right - left;
},
getCell: function getCell() {
if (React.isValidElement(this.props.renderer)) {
return React.cloneElement(this.props.renderer, { column: this.props.column, height: this.props.height });
}
return this.props.renderer({ column: this.props.column });
},
getStyle: function getStyle() {
return {
width: this.props.column.width,
left: this.props.column.left,
display: 'inline-block',
position: 'absolute',
height: this.props.height,
margin: 0,
textOverflow: 'ellipsis',
whiteSpace: 'nowrap'
};
},
setScrollLeft: function setScrollLeft(scrollLeft) {
var node = ReactDOM.findDOMNode(this);
node.style.webkitTransform = 'translate3d(' + scrollLeft + 'px, 0px, 0px)';
node.style.transform = 'translate3d(' + scrollLeft + 'px, 0px, 0px)';
},
render: function render() {
var resizeHandle = void 0;
if (this.props.column.resizable) {
resizeHandle = React.createElement(ResizeHandle, {
onDrag: this.onDrag,
onDragStart: this.onDragStart,
onDragEnd: this.onDragEnd
});
}
var className = joinClasses({
'react-grid-HeaderCell': true,
'react-grid-HeaderCell--resizing': this.state.resizing,
'react-grid-HeaderCell--locked': this.props.column.locked
});
className = joinClasses(className, this.props.className, this.props.column.cellClass);
var cell = this.getCell();
return React.createElement(
'div',
{ className: className, style: this.getStyle() },
cell,
resizeHandle
);
}
});
module.exports = HeaderCell;
/***/ },
/* 46 */
/***/ function(module, exports) {
"use strict";
var HeaderCellType = {
SORTABLE: 0,
FILTERABLE: 1,
NONE: 2,
CHECKBOX: 3
};
module.exports = HeaderCellType;
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var React = __webpack_require__(1);
var shallowEqual = __webpack_require__(25);
var BaseHeaderCell = __webpack_require__(45);
var getScrollbarSize = __webpack_require__(24);
var ExcelColumn = __webpack_require__(6);
var ColumnUtilsMixin = __webpack_require__(5);
var SortableHeaderCell = __webpack_require__(57);
var FilterableHeaderCell = __webpack_require__(56);
var HeaderCellType = __webpack_require__(46);
var PropTypes = React.PropTypes;
var HeaderRowStyle = {
overflow: React.PropTypes.string,
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
height: React.PropTypes.number,
position: React.PropTypes.string
};
var DEFINE_SORT = ['ASC', 'DESC', 'NONE'];
var HeaderRow = React.createClass({
displayName: 'HeaderRow',
propTypes: {
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
height: PropTypes.number.isRequired,
columns: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
onColumnResize: PropTypes.func,
onSort: PropTypes.func.isRequired,
onColumnResizeEnd: PropTypes.func,
style: PropTypes.shape(HeaderRowStyle),
sortColumn: PropTypes.string,
sortDirection: React.PropTypes.oneOf(DEFINE_SORT),
cellRenderer: PropTypes.func,
headerCellRenderer: PropTypes.func,
filterable: PropTypes.bool,
onFilterChange: PropTypes.func,
resizing: PropTypes.object,
onScroll: PropTypes.func,
rowType: PropTypes.string,
draggableHeaderCell: PropTypes.func
},
mixins: [ColumnUtilsMixin],
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
return nextProps.width !== this.props.width || nextProps.height !== this.props.height || nextProps.columns !== this.props.columns || !shallowEqual(nextProps.style, this.props.style) || this.props.sortColumn !== nextProps.sortColumn || this.props.sortDirection !== nextProps.sortDirection;
},
getHeaderCellType: function getHeaderCellType(column) {
if (column.filterable) {
if (this.props.filterable) return HeaderCellType.FILTERABLE;
}
if (column.sortable) return HeaderCellType.SORTABLE;
return HeaderCellType.NONE;
},
getFilterableHeaderCell: function getFilterableHeaderCell(column) {
var FilterRenderer = FilterableHeaderCell;
if (column.filterRenderer !== undefined) {
FilterRenderer = column.filterRenderer;
}
return React.createElement(FilterRenderer, _extends({}, this.props, { onChange: this.props.onFilterChange }));
},
getSortableHeaderCell: function getSortableHeaderCell(column) {
var sortDirection = this.props.sortColumn === column.key ? this.props.sortDirection : DEFINE_SORT.NONE;
return React.createElement(SortableHeaderCell, { columnKey: column.key, onSort: this.props.onSort, sortDirection: sortDirection });
},
getHeaderRenderer: function getHeaderRenderer(column) {
var renderer = void 0;
if (column.headerRenderer) {
renderer = column.headerRenderer;
} else {
var headerCellType = this.getHeaderCellType(column);
switch (headerCellType) {
case HeaderCellType.SORTABLE:
renderer = this.getSortableHeaderCell(column);
break;
case HeaderCellType.FILTERABLE:
renderer = this.getFilterableHeaderCell(column);
break;
default:
break;
}
}
return renderer;
},
getStyle: function getStyle() {
return {
overflow: 'hidden',
width: '100%',
height: this.props.height,
position: 'absolute'
};
},
getCells: function getCells() {
var cells = [];
var lockedCells = [];
for (var i = 0, len = this.getSize(this.props.columns); i < len; i++) {
var column = this.getColumn(this.props.columns, i);
var _renderer = this.getHeaderRenderer(column);
if (column.key === 'select-row' && this.props.rowType === 'filter') {
_renderer = React.createElement('div', null);
}
var _HeaderCell = column.draggable ? this.props.draggableHeaderCell : BaseHeaderCell;
var cell = React.createElement(_HeaderCell, {
ref: i,
key: i,
height: this.props.height,
column: column,
renderer: _renderer,
resizing: this.props.resizing === column,
onResize: this.props.onColumnResize,
onResizeEnd: this.props.onColumnResizeEnd
});
if (column.locked) {
lockedCells.push(cell);
} else {
cells.push(cell);
}
}
return cells.concat(lockedCells);
},
setScrollLeft: function setScrollLeft(scrollLeft) {
var _this = this;
this.props.columns.forEach(function (column, i) {
if (column.locked) {
_this.refs[i].setScrollLeft(scrollLeft);
}
});
},
render: function render() {
var cellsStyle = {
width: this.props.width ? this.props.width + getScrollbarSize() : '100%',
height: this.props.height,
whiteSpace: 'nowrap',
overflowX: 'hidden',
overflowY: 'hidden'
};
var cells = this.getCells();
return React.createElement(
'div',
_extends({}, this.props, { className: 'react-grid-HeaderRow', onScroll: this.props.onScroll }),
React.createElement(
'div',
{ style: cellsStyle },
cells
)
);
}
});
module.exports = HeaderRow;
/***/ },
/* 48 */
/***/ function(module, exports) {
"use strict";
module.exports = {
Backspace: 8,
Tab: 9,
Enter: 13,
Shift: 16,
Ctrl: 17,
Alt: 18,
PauseBreak: 19,
CapsLock: 20,
Escape: 27,
PageUp: 33,
PageDown: 34,
End: 35,
Home: 36,
LeftArrow: 37,
UpArrow: 38,
RightArrow: 39,
DownArrow: 40,
Insert: 45,
Delete: 46,
0: 48,
1: 49,
2: 50,
3: 51,
4: 52,
5: 53,
6: 54,
7: 55,
8: 56,
9: 57,
a: 65,
b: 66,
c: 67,
d: 68,
e: 69,
f: 70,
g: 71,
h: 72,
i: 73,
j: 74,
k: 75,
l: 76,
m: 77,
n: 78,
o: 79,
p: 80,
q: 81,
r: 82,
s: 83,
t: 84,
u: 85,
v: 86,
w: 87,
x: 88,
y: 89,
z: 90,
LeftWindowKey: 91,
RightWindowKey: 92,
SelectKey: 93,
NumPad0: 96,
NumPad1: 97,
NumPad2: 98,
NumPad3: 99,
NumPad4: 100,
NumPad5: 101,
NumPad6: 102,
NumPad7: 103,
NumPad8: 104,
NumPad9: 105,
Multiply: 106,
Add: 107,
Subtract: 109,
DecimalPoint: 110,
Divide: 111,
F1: 112,
F2: 113,
F3: 114,
F4: 115,
F5: 116,
F6: 117,
F7: 118,
F8: 119,
F9: 120,
F10: 121,
F12: 123,
NumLock: 144,
ScrollLock: 145,
SemiColon: 186,
EqualSign: 187,
Comma: 188,
Dash: 189,
Period: 190,
ForwardSlash: 191,
GraveAccent: 192,
OpenBracket: 219,
BackSlash: 220,
CloseBracket: 221,
SingleQuote: 222
};
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _AppConstants = __webpack_require__(37);
var _AppConstants2 = _interopRequireDefault(_AppConstants);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var React = __webpack_require__(1);
var ReactDOM = __webpack_require__(2);
var BaseGrid = __webpack_require__(42);
var Row = __webpack_require__(15);
var ExcelColumn = __webpack_require__(6);
var KeyboardHandlerMixin = __webpack_require__(21);
var CheckboxEditor = __webpack_require__(58);
var DOMMetrics = __webpack_require__(9);
var ColumnMetricsMixin = __webpack_require__(40);
var RowUtils = __webpack_require__(22);
var ColumnUtils = __webpack_require__(5);
var KeyCodes = __webpack_require__(48);
if (!Object.assign) {
Object.assign = __webpack_require__(36);
}
var ReactDataGrid = React.createClass({
displayName: 'ReactDataGrid',
mixins: [ColumnMetricsMixin, DOMMetrics.MetricsComputatorMixin, KeyboardHandlerMixin],
propTypes: {
rowHeight: React.PropTypes.number.isRequired,
headerRowHeight: React.PropTypes.number,
minHeight: React.PropTypes.number.isRequired,
minWidth: React.PropTypes.number,
enableRowSelect: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.string]),
onRowUpdated: React.PropTypes.func,
rowGetter: React.PropTypes.func.isRequired,
rowsCount: React.PropTypes.number.isRequired,
toolbar: React.PropTypes.element,
enableCellSelect: React.PropTypes.bool,
columns: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.array]).isRequired,
onFilter: React.PropTypes.func,
onCellCopyPaste: React.PropTypes.func,
onCellsDragged: React.PropTypes.func,
onAddFilter: React.PropTypes.func,
onGridSort: React.PropTypes.func,
onDragHandleDoubleClick: React.PropTypes.func,
onGridRowsUpdated: React.PropTypes.func,
onRowSelect: React.PropTypes.func,
rowKey: React.PropTypes.string,
rowScrollTimeout: React.PropTypes.number,
onClearFilters: React.PropTypes.func,
contextMenu: React.PropTypes.element,
cellNavigationMode: React.PropTypes.oneOf(['none', 'loopOverRow', 'changeRow']),
onCellSelected: React.PropTypes.func,
onCellDeSelected: React.PropTypes.func,
onCellExpand: React.PropTypes.func,
enableDragAndDrop: React.PropTypes.bool,
onRowExpandToggle: React.PropTypes.func,
draggableHeaderCell: React.PropTypes.func,
getValidFilterValues: React.PropTypes.func,
rowSelection: React.PropTypes.shape({
enableShiftSelect: React.PropTypes.bool,
onRowsSelected: React.PropTypes.func,
onRowsDeselected: React.PropTypes.func,
showCheckbox: React.PropTypes.bool,
selectBy: React.PropTypes.oneOfType([React.PropTypes.shape({
indexes: React.PropTypes.arrayOf(React.PropTypes.number).isRequired
}), React.PropTypes.shape({
isSelectedKey: React.PropTypes.string.isRequired
}), React.PropTypes.shape({
keys: React.PropTypes.shape({
values: React.PropTypes.array.isRequired,
rowKey: React.PropTypes.string.isRequired
}).isRequired
})]).isRequired
}),
onRowClick: React.PropTypes.func,
onGridKeyUp: React.PropTypes.func,
onGridKeyDown: React.PropTypes.func,
rowGroupRenderer: React.PropTypes.func,
rowActionsCell: React.PropTypes.func
},
getDefaultProps: function getDefaultProps() {
return {
enableCellSelect: false,
tabIndex: -1,
rowHeight: 35,
enableRowSelect: false,
minHeight: 350,
rowKey: 'id',
rowScrollTimeout: 0,
cellNavigationMode: 'none'
};
},
getInitialState: function getInitialState() {
var columnMetrics = this.createColumnMetrics();
var initialState = { columnMetrics: columnMetrics, selectedRows: [], copied: null, expandedRows: [], canFilter: false, columnFilters: {}, sortDirection: null, sortColumn: null, dragged: null, scrollOffset: 0, lastRowIdxUiSelected: -1 };
if (this.props.enableCellSelect) {
initialState.selected = { rowIdx: 0, idx: 0 };
} else {
initialState.selected = { rowIdx: -1, idx: -1 };
}
return initialState;
},
hasSelectedCellChanged: function hasSelectedCellChanged(selected) {
var previouslySelected = Object.assign({}, this.state.selected);
return previouslySelected.rowIdx !== selected.rowIdx || previouslySelected.idx !== selected.idx || previouslySelected.active === false;
},
onContextMenuHide: function onContextMenuHide() {
document.removeEventListener('click', this.onContextMenuHide);
var newSelected = Object.assign({}, this.state.selected, { contextMenuDisplayed: false });
this.setState({ selected: newSelected });
},
onColumnEvent: function onColumnEvent(ev, columnEvent) {
var idx = columnEvent.idx;
var name = columnEvent.name;
if (name && typeof idx !== 'undefined') {
var column = this.getColumn(idx);
if (column && column.events && column.events[name] && typeof column.events[name] === 'function') {
var eventArgs = {
rowIdx: columnEvent.rowIdx,
idx: idx,
column: column
};
column.events[name](ev, eventArgs);
}
}
},
onSelect: function onSelect(selected) {
var _this = this;
if (this.state.selected.rowIdx !== selected.rowIdx || this.state.selected.idx !== selected.idx || this.state.selected.active === false) {
var _idx = selected.idx;
var _rowIdx = selected.rowIdx;
if (_idx >= 0 && _rowIdx >= 0 && _idx < ColumnUtils.getSize(this.state.columnMetrics.columns) && _rowIdx < this.props.rowsCount) {
(function () {
var oldSelection = _this.state.selected;
_this.setState({ selected: selected }, function () {
if (typeof _this.props.onCellDeSelected === 'function') {
_this.props.onCellDeSelected(oldSelection);
}
if (typeof _this.props.onCellSelected === 'function') {
_this.props.onCellSelected(selected);
}
});
})();
}
}
},
onCellClick: function onCellClick(cell) {
this.onSelect({ rowIdx: cell.rowIdx, idx: cell.idx });
if (this.props.onRowClick && typeof this.props.onRowClick === 'function') {
this.props.onRowClick(cell.rowIdx, this.props.rowGetter(cell.rowIdx));
}
},
onCellContextMenu: function onCellContextMenu(cell) {
this.onSelect({ rowIdx: cell.rowIdx, idx: cell.idx, contextMenuDisplayed: this.props.contextMenu });
if (this.props.contextMenu) {
document.addEventListener('click', this.onContextMenuHide);
}
},
onCellDoubleClick: function onCellDoubleClick(cell) {
this.onSelect({ rowIdx: cell.rowIdx, idx: cell.idx });
this.setActive('Enter');
},
onViewportDoubleClick: function onViewportDoubleClick() {
this.setActive();
},
onPressArrowUp: function onPressArrowUp(e) {
this.moveSelectedCell(e, -1, 0);
},
onPressArrowDown: function onPressArrowDown(e) {
this.moveSelectedCell(e, 1, 0);
},
onPressArrowLeft: function onPressArrowLeft(e) {
this.moveSelectedCell(e, 0, -1);
},
onPressArrowRight: function onPressArrowRight(e) {
this.moveSelectedCell(e, 0, 1);
},
onPressTab: function onPressTab(e) {
this.moveSelectedCell(e, 0, e.shiftKey ? -1 : 1);
},
onPressEnter: function onPressEnter(e) {
this.setActive(e.key);
},
onPressDelete: function onPressDelete(e) {
this.setActive(e.key);
},
onPressEscape: function onPressEscape(e) {
this.setInactive(e.key);
},
onPressBackspace: function onPressBackspace(e) {
this.setActive(e.key);
},
onPressChar: function onPressChar(e) {
if (this.isKeyPrintable(e.keyCode)) {
this.setActive(e.keyCode);
}
},
onPressKeyWithCtrl: function onPressKeyWithCtrl(e) {
var keys = {
KeyCode_c: 99,
KeyCode_C: 67,
KeyCode_V: 86,
KeyCode_v: 118
};
var rowIdx = this.state.selected.rowIdx;
var row = this.props.rowGetter(rowIdx);
var idx = this.state.selected.idx;
var col = this.getColumn(idx);
if (ColumnUtils.canEdit(col, row, this.props.enableCellSelect)) {
if (e.keyCode === keys.KeyCode_c || e.keyCode === keys.KeyCode_C) {
var _value = this.getSelectedValue();
this.handleCopy({ value: _value });
} else if (e.keyCode === keys.KeyCode_v || e.keyCode === keys.KeyCode_V) {
this.handlePaste();
}
}
},
onGridRowsUpdated: function onGridRowsUpdated(cellKey, fromRow, toRow, updated, action) {
var rowIds = [];
for (var i = fromRow; i <= toRow; i++) {
rowIds.push(this.props.rowGetter(i)[this.props.rowKey]);
}
this.props.onGridRowsUpdated({ cellKey: cellKey, fromRow: fromRow, toRow: toRow, rowIds: rowIds, updated: updated, action: action });
},
onCellCommit: function onCellCommit(commit) {
var selected = Object.assign({}, this.state.selected);
selected.active = false;
if (commit.key === 'Tab') {
selected.idx += 1;
}
var expandedRows = this.state.expandedRows;
// if(commit.changed && commit.changed.expandedHeight){
// expandedRows = this.expandRow(commit.rowIdx, commit.changed.expandedHeight);
// }
this.setState({ selected: selected, expandedRows: expandedRows });
if (this.props.onRowUpdated) {
this.props.onRowUpdated(commit);
}
var targetRow = commit.rowIdx;
if (this.props.onGridRowsUpdated) {
this.onGridRowsUpdated(commit.cellKey, targetRow, targetRow, commit.updated, _AppConstants2['default'].UpdateActions.CELL_UPDATE);
}
},
onDragStart: function onDragStart(e) {
var idx = this.state.selected.idx;
if (idx > -1) {
var _value2 = this.getSelectedValue();
this.handleDragStart({ idx: this.state.selected.idx, rowIdx: this.state.selected.rowIdx, value: _value2 });
// need to set dummy data for FF
if (e && e.dataTransfer) {
if (e.dataTransfer.setData) {
e.dataTransfer.dropEffect = 'move';
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('text/plain', 'dummy');
}
}
}
},
onToggleFilter: function onToggleFilter() {
var _this2 = this;
// setState() does not immediately mutate this.state but creates a pending state transition.
// Therefore if you want to do something after the state change occurs, pass it in as a callback function.
this.setState({ canFilter: !this.state.canFilter }, function () {
if (_this2.state.canFilter === false && _this2.props.onClearFilters) {
_this2.props.onClearFilters();
}
});
},
onDragHandleDoubleClick: function onDragHandleDoubleClick(e) {
if (this.props.onDragHandleDoubleClick) {
this.props.onDragHandleDoubleClick(e);
}
if (this.props.onGridRowsUpdated) {
var _onGridRowsUpdated;
var cellKey = this.getColumn(e.idx).key;
this.onGridRowsUpdated(cellKey, e.rowIdx, this.props.rowsCount - 1, (_onGridRowsUpdated = {}, _onGridRowsUpdated[cellKey] = e.rowData[cellKey], _onGridRowsUpdated), _AppConstants2['default'].UpdateActions.COLUMN_FILL);
}
},
onCellExpand: function onCellExpand(args) {
if (this.props.onCellExpand) {
this.props.onCellExpand(args);
}
},
onRowExpandToggle: function onRowExpandToggle(args) {
if (typeof this.props.onRowExpandToggle === 'function') {
this.props.onRowExpandToggle(args);
}
},
handleDragStart: function handleDragStart(dragged) {
if (!this.dragEnabled()) {
return;
}
var idx = dragged.idx;
var rowIdx = dragged.rowIdx;
if (idx >= 0 && rowIdx >= 0 && idx < this.getSize() && rowIdx < this.props.rowsCount) {
this.setState({ dragged: dragged });
}
},
handleDragEnd: function handleDragEnd() {
if (!this.dragEnabled()) {
return;
}
var fromRow = void 0;
var toRow = void 0;
var selected = this.state.selected;
var dragged = this.state.dragged;
var cellKey = this.getColumn(this.state.selected.idx).key;
fromRow = selected.rowIdx < dragged.overRowIdx ? selected.rowIdx : dragged.overRowIdx;
toRow = selected.rowIdx > dragged.overRowIdx ? selected.rowIdx : dragged.overRowIdx;
if (this.props.onCellsDragged) {
this.props.onCellsDragged({ cellKey: cellKey, fromRow: fromRow, toRow: toRow, value: dragged.value });
}
if (this.props.onGridRowsUpdated) {
var _onGridRowsUpdated2;
this.onGridRowsUpdated(cellKey, fromRow, toRow, (_onGridRowsUpdated2 = {}, _onGridRowsUpdated2[cellKey] = dragged.value, _onGridRowsUpdated2), _AppConstants2['default'].UpdateActions.CELL_DRAG);
}
this.setState({ dragged: { complete: true } });
},
handleDragEnter: function handleDragEnter(row) {
if (!this.dragEnabled() || this.state.dragged == null) {
return;
}
var dragged = this.state.dragged;
dragged.overRowIdx = row;
this.setState({ dragged: dragged });
},
handleTerminateDrag: function handleTerminateDrag() {
if (!this.dragEnabled()) {
return;
}
this.setState({ dragged: null });
},
handlePaste: function handlePaste() {
if (!this.copyPasteEnabled()) {
return;
}
var selected = this.state.selected;
var cellKey = this.getColumn(this.state.selected.idx).key;
var textToCopy = this.state.textToCopy;
var toRow = selected.rowIdx;
if (this.props.onCellCopyPaste) {
this.props.onCellCopyPaste({ cellKey: cellKey, rowIdx: toRow, value: textToCopy, fromRow: this.state.copied.rowIdx, toRow: toRow });
}
if (this.props.onGridRowsUpdated) {
var _onGridRowsUpdated3;
this.onGridRowsUpdated(cellKey, toRow, toRow, (_onGridRowsUpdated3 = {}, _onGridRowsUpdated3[cellKey] = textToCopy, _onGridRowsUpdated3), _AppConstants2['default'].UpdateActions.COPY_PASTE);
}
this.setState({ copied: null });
},
handleCopy: function handleCopy(args) {
if (!this.copyPasteEnabled()) {
return;
}
var textToCopy = args.value;
var selected = this.state.selected;
var copied = { idx: selected.idx, rowIdx: selected.rowIdx };
this.setState({ textToCopy: textToCopy, copied: copied });
},
handleSort: function handleSort(columnKey, direction) {
this.setState({ sortDirection: direction, sortColumn: columnKey }, function () {
this.props.onGridSort(columnKey, direction);
});
},
getSelectedRow: function getSelectedRow(rows, key) {
var _this3 = this;
var selectedRow = rows.filter(function (r) {
if (r[_this3.props.rowKey] === key) {
return true;
}
return false;
});
if (selectedRow.length > 0) {
return selectedRow[0];
}
},
useNewRowSelection: function useNewRowSelection() {
return this.props.rowSelection && this.props.rowSelection.selectBy;
},
// return false if not a shift select so can be handled as normal row selection
handleShiftSelect: function handleShiftSelect(rowIdx) {
if (this.state.lastRowIdxUiSelected > -1 && this.isSingleKeyDown(KeyCodes.Shift)) {
var _props$rowSelection$s = this.props.rowSelection.selectBy;
var keys = _props$rowSelection$s.keys;
var indexes = _props$rowSelection$s.indexes;
var isSelectedKey = _props$rowSelection$s.isSelectedKey;
var isPreviouslySelected = RowUtils.isRowSelected(keys, indexes, isSelectedKey, this.props.rowGetter(rowIdx), rowIdx);
if (isPreviouslySelected) return false;
var handled = false;
if (rowIdx > this.state.lastRowIdxUiSelected) {
var rowsSelected = [];
for (var i = this.state.lastRowIdxUiSelected + 1; i <= rowIdx; i++) {
rowsSelected.push({ rowIdx: i, row: this.props.rowGetter(i) });
}
if (typeof this.props.rowSelection.onRowsSelected === 'function') {
this.props.rowSelection.onRowsSelected(rowsSelected);
}
handled = true;
} else if (rowIdx < this.state.lastRowIdxUiSelected) {
var _rowsSelected = [];
for (var _i = rowIdx; _i <= this.state.lastRowIdxUiSelected - 1; _i++) {
_rowsSelected.push({ rowIdx: _i, row: this.props.rowGetter(_i) });
}
if (typeof this.props.rowSelection.onRowsSelected === 'function') {
this.props.rowSelection.onRowsSelected(_rowsSelected);
}
handled = true;
}
if (handled) {
this.setState({ lastRowIdxUiSelected: rowIdx });
}
return handled;
}
return false;
},
handleNewRowSelect: function handleNewRowSelect(rowIdx, rowData) {
var _props$rowSelection$s2 = this.props.rowSelection.selectBy;
var keys = _props$rowSelection$s2.keys;
var indexes = _props$rowSelection$s2.indexes;
var isSelectedKey = _props$rowSelection$s2.isSelectedKey;
var isPreviouslySelected = RowUtils.isRowSelected(keys, indexes, isSelectedKey, rowData, rowIdx);
this.setState({ lastRowIdxUiSelected: isPreviouslySelected ? -1 : rowIdx, selected: { rowIdx: rowIdx, idx: 0 } });
if (isPreviouslySelected && typeof this.props.rowSelection.onRowsDeselected === 'function') {
this.props.rowSelection.onRowsDeselected([{ rowIdx: rowIdx, row: rowData }]);
} else if (!isPreviouslySelected && typeof this.props.rowSelection.onRowsSelected === 'function') {
this.props.rowSelection.onRowsSelected([{ rowIdx: rowIdx, row: rowData }]);
}
},
// columnKey not used here as this function will select the whole row,
// but needed to match the function signature in the CheckboxEditor
handleRowSelect: function handleRowSelect(rowIdx, columnKey, rowData, e) {
e.stopPropagation();
if (this.useNewRowSelection()) {
if (this.props.rowSelection.enableShiftSelect === true) {
if (!this.handleShiftSelect(rowIdx)) {
this.handleNewRowSelect(rowIdx, rowData);
}
} else {
this.handleNewRowSelect(rowIdx, rowData);
}
} else {
// Fallback to old onRowSelect handler
var _selectedRows = this.props.enableRowSelect === 'single' ? [] : this.state.selectedRows.slice(0);
var selectedRow = this.getSelectedRow(_selectedRows, rowData[this.props.rowKey]);
if (selectedRow) {
selectedRow.isSelected = !selectedRow.isSelected;
} else {
rowData.isSelected = true;
_selectedRows.push(rowData);
}
this.setState({ selectedRows: _selectedRows, selected: { rowIdx: rowIdx, idx: 0 } });
if (this.props.onRowSelect) {
this.props.onRowSelect(_selectedRows.filter(function (r) {
return r.isSelected === true;
}));
}
}
},
handleCheckboxChange: function handleCheckboxChange(e) {
var allRowsSelected = void 0;
if (e.currentTarget instanceof HTMLInputElement && e.currentTarget.checked === true) {
allRowsSelected = true;
} else {
allRowsSelected = false;
}
if (this.useNewRowSelection()) {
var _props$rowSelection$s3 = this.props.rowSelection.selectBy;
var keys = _props$rowSelection$s3.keys;
var indexes = _props$rowSelection$s3.indexes;
var isSelectedKey = _props$rowSelection$s3.isSelectedKey;
if (allRowsSelected && typeof this.props.rowSelection.onRowsSelected === 'function') {
var _selectedRows2 = [];
for (var i = 0; i < this.props.rowsCount; i++) {
var rowData = this.props.rowGetter(i);
if (!RowUtils.isRowSelected(keys, indexes, isSelectedKey, rowData, i)) {
_selectedRows2.push({ rowIdx: i, row: rowData });
}
}
if (_selectedRows2.length > 0) {
this.props.rowSelection.onRowsSelected(_selectedRows2);
}
} else if (!allRowsSelected && typeof this.props.rowSelection.onRowsDeselected === 'function') {
var deselectedRows = [];
for (var _i2 = 0; _i2 < this.props.rowsCount; _i2++) {
var _rowData = this.props.rowGetter(_i2);
if (RowUtils.isRowSelected(keys, indexes, isSelectedKey, _rowData, _i2)) {
deselectedRows.push({ rowIdx: _i2, row: _rowData });
}
}
if (deselectedRows.length > 0) {
this.props.rowSelection.onRowsDeselected(deselectedRows);
}
}
} else {
var _selectedRows3 = [];
for (var _i3 = 0; _i3 < this.props.rowsCount; _i3++) {
var row = Object.assign({}, this.props.rowGetter(_i3), { isSelected: allRowsSelected });
_selectedRows3.push(row);
}
this.setState({ selectedRows: _selectedRows3 });
if (typeof this.props.onRowSelect === 'function') {
this.props.onRowSelect(_selectedRows3.filter(function (r) {
return r.isSelected === true;
}));
}
}
},
getScrollOffSet: function getScrollOffSet() {
var scrollOffset = 0;
var canvas = ReactDOM.findDOMNode(this).querySelector('.react-grid-Canvas');
if (canvas) {
scrollOffset = canvas.offsetWidth - canvas.clientWidth;
}
this.setState({ scrollOffset: scrollOffset });
},
getRowOffsetHeight: function getRowOffsetHeight() {
var offsetHeight = 0;
this.getHeaderRows().forEach(function (row) {
return offsetHeight += parseFloat(row.height, 10);
});
return offsetHeight;
},
getHeaderRows: function getHeaderRows() {
var rows = [{ ref: 'row', height: this.props.headerRowHeight || this.props.rowHeight, rowType: 'header' }];
if (this.state.canFilter === true) {
rows.push({
ref: 'filterRow',
filterable: true,
onFilterChange: this.props.onAddFilter,
height: 45,
rowType: 'filter'
});
}
return rows;
},
getInitialSelectedRows: function getInitialSelectedRows() {
var selectedRows = [];
for (var i = 0; i < this.props.rowsCount; i++) {
selectedRows.push(false);
}
return selectedRows;
},
getRowSelectionProps: function getRowSelectionProps() {
if (this.props.rowSelection) {
return this.props.rowSelection.selectBy;
}
return null;
},
getSelectedRows: function getSelectedRows() {
if (this.props.rowSelection) {
return null;
}
return this.state.selectedRows.filter(function (r) {
return r.isSelected === true;
});
},
getSelectedValue: function getSelectedValue() {
var rowIdx = this.state.selected.rowIdx;
var idx = this.state.selected.idx;
var cellKey = this.getColumn(idx).key;
var row = this.props.rowGetter(rowIdx);
return RowUtils.get(row, cellKey);
},
moveSelectedCell: function moveSelectedCell(e, rowDelta, cellDelta) {
// we need to prevent default as we control grid scroll
// otherwise it moves every time you left/right which is janky
e.preventDefault();
var rowIdx = void 0;
var idx = void 0;
var cellNavigationMode = this.props.cellNavigationMode;
if (cellNavigationMode !== 'none') {
var _calculateNextSelecti = this.calculateNextSelectionPosition(cellNavigationMode, cellDelta, rowDelta);
idx = _calculateNextSelecti.idx;
rowIdx = _calculateNextSelecti.rowIdx;
} else {
rowIdx = this.state.selected.rowIdx + rowDelta;
idx = this.state.selected.idx + cellDelta;
}
this.onSelect({ idx: idx, rowIdx: rowIdx });
},
getNbrColumns: function getNbrColumns() {
var _props = this.props;
var columns = _props.columns;
var enableRowSelect = _props.enableRowSelect;
return enableRowSelect ? columns.length + 1 : columns.length;
},
calculateNextSelectionPosition: function calculateNextSelectionPosition(cellNavigationMode, cellDelta, rowDelta) {
var _rowDelta = rowDelta;
var idx = this.state.selected.idx + cellDelta;
var nbrColumns = this.getNbrColumns();
if (cellDelta > 0) {
if (this.isAtLastCellInRow(nbrColumns)) {
if (cellNavigationMode === 'changeRow') {
_rowDelta = this.isAtLastRow() ? rowDelta : rowDelta + 1;
idx = this.isAtLastRow() ? idx : 0;
} else {
idx = 0;
}
}
} else if (cellDelta < 0) {
if (this.isAtFirstCellInRow()) {
if (cellNavigationMode === 'changeRow') {
_rowDelta = this.isAtFirstRow() ? rowDelta : rowDelta - 1;
idx = this.isAtFirstRow() ? 0 : nbrColumns - 1;
} else {
idx = nbrColumns - 1;
}
}
}
var rowIdx = this.state.selected.rowIdx + _rowDelta;
return { idx: idx, rowIdx: rowIdx };
},
isAtLastCellInRow: function isAtLastCellInRow(nbrColumns) {
return this.state.selected.idx === nbrColumns - 1;
},
isAtLastRow: function isAtLastRow() {
return this.state.selected.rowIdx === this.props.rowsCount - 1;
},
isAtFirstCellInRow: function isAtFirstCellInRow() {
return this.state.selected.idx === 0;
},
isAtFirstRow: function isAtFirstRow() {
return this.state.selected.rowIdx === 0;
},
openCellEditor: function openCellEditor(rowIdx, idx) {
var _this4 = this;
var row = this.props.rowGetter(rowIdx);
var col = this.getColumn(idx);
if (!ColumnUtils.canEdit(col, row, this.props.enableCellSelect)) {
return;
}
var selected = { rowIdx: rowIdx, idx: idx };
if (this.hasSelectedCellChanged(selected)) {
this.setState({ selected: selected }, function () {
_this4.setActive('Enter');
});
} else {
this.setActive('Enter');
}
},
scrollToColumn: function scrollToColumn(colIdx) {
var canvas = ReactDOM.findDOMNode(this).querySelector('.react-grid-Canvas');
if (canvas) {
var left = 0;
var locked = 0;
for (var i = 0; i < colIdx; i++) {
var column = this.getColumn(i);
if (column) {
if (column.width) {
left += column.width;
}
if (column.locked) {
locked += column.width;
}
}
}
var selectedColumn = this.getColumn(colIdx);
if (selectedColumn) {
var scrollLeft = left - locked - canvas.scrollLeft;
var scrollRight = left + selectedColumn.width - canvas.scrollLeft;
if (scrollLeft < 0) {
canvas.scrollLeft += scrollLeft;
} else if (scrollRight > canvas.clientWidth) {
var scrollAmount = scrollRight - canvas.clientWidth;
canvas.scrollLeft += scrollAmount;
}
}
}
},
setActive: function setActive(keyPressed) {
var rowIdx = this.state.selected.rowIdx;
var row = this.props.rowGetter(rowIdx);
var idx = this.state.selected.idx;
var col = this.getColumn(idx);
if (ColumnUtils.canEdit(col, row, this.props.enableCellSelect) && !this.isActive()) {
var _selected = Object.assign(this.state.selected, { idx: idx, rowIdx: rowIdx, active: true, initialKeyCode: keyPressed });
this.setState({ selected: _selected }, this.scrollToColumn(idx));
}
},
setInactive: function setInactive() {
var rowIdx = this.state.selected.rowIdx;
var row = this.props.rowGetter(rowIdx);
var idx = this.state.selected.idx;
var col = this.getColumn(idx);
if (ColumnUtils.canEdit(col, row, this.props.enableCellSelect) && this.isActive()) {
var _selected2 = Object.assign(this.state.selected, { idx: idx, rowIdx: rowIdx, active: false });
this.setState({ selected: _selected2 });
}
},
isActive: function isActive() {
return this.state.selected.active === true;
},
setupGridColumns: function setupGridColumns() {
var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
var cols = props.columns.slice(0);
var unshiftedCols = {};
if (this.props.rowActionsCell || props.enableRowSelect && !this.props.rowSelection || props.rowSelection && props.rowSelection.showCheckbox !== false) {
var headerRenderer = props.enableRowSelect === 'single' ? null : React.createElement(
'div',
{ className: 'react-grid-checkbox-container' },
React.createElement('input', { className: 'react-grid-checkbox', type: 'checkbox', name: 'select-all-checkbox', id: 'select-all-checkbox', onChange: this.handleCheckboxChange }),
React.createElement('label', { htmlFor: 'select-all-checkbox', className: 'react-grid-checkbox-label' })
);
var Formatter = this.props.rowActionsCell ? this.props.rowActionsCell : CheckboxEditor;
var selectColumn = {
key: 'select-row',
name: '',
formatter: React.createElement(Formatter, { rowSelection: this.props.rowSelection }),
onCellChange: this.handleRowSelect,
filterable: false,
headerRenderer: headerRenderer,
width: 60,
locked: true,
getRowMetaData: function getRowMetaData(rowData) {
return rowData;
},
cellClass: 'rdg-row-actions-cell'
};
unshiftedCols = cols.unshift(selectColumn);
cols = unshiftedCols > 0 ? cols : unshiftedCols;
}
return cols;
},
copyPasteEnabled: function copyPasteEnabled() {
return this.props.onCellCopyPaste !== null;
},
dragEnabled: function dragEnabled() {
return this.props.onCellsDragged !== undefined;
},
renderToolbar: function renderToolbar() {
var Toolbar = this.props.toolbar;
if (React.isValidElement(Toolbar)) {
return React.cloneElement(Toolbar, { columns: this.props.columns, onToggleFilter: this.onToggleFilter, numberOfRows: this.props.rowsCount });
}
},
render: function render() {
var cellMetaData = {
selected: this.state.selected,
dragged: this.state.dragged,
hoveredRowIdx: this.state.hoveredRowIdx,
onCellClick: this.onCellClick,
onCellContextMenu: this.onCellContextMenu,
onCellDoubleClick: this.onCellDoubleClick,
onCommit: this.onCellCommit,
onCommitCancel: this.setInactive,
copied: this.state.copied,
handleDragEnterRow: this.handleDragEnter,
handleTerminateDrag: this.handleTerminateDrag,
enableCellSelect: this.props.enableCellSelect,
onColumnEvent: this.onColumnEvent,
openCellEditor: this.openCellEditor,
onDragHandleDoubleClick: this.onDragHandleDoubleClick,
onCellExpand: this.onCellExpand,
onRowExpandToggle: this.onRowExpandToggle,
onRowHover: this.onRowHover
};
var toolbar = this.renderToolbar();
var containerWidth = this.props.minWidth || this.DOMMetrics.gridWidth();
var gridWidth = containerWidth - this.state.scrollOffset;
// depending on the current lifecycle stage, gridWidth() may not initialize correctly
// this also handles cases where it always returns undefined -- such as when inside a div with display:none
// eg Bootstrap tabs and collapses
if (typeof containerWidth === 'undefined' || isNaN(containerWidth) || containerWidth === 0) {
containerWidth = '100%';
}
if (typeof gridWidth === 'undefined' || isNaN(gridWidth) || gridWidth === 0) {
gridWidth = '100%';
}
return React.createElement(
'div',
{ className: 'react-grid-Container', style: { width: containerWidth } },
toolbar,
React.createElement(
'div',
{ className: 'react-grid-Main' },
React.createElement(BaseGrid, _extends({
ref: 'base'
}, this.props, {
rowKey: this.props.rowKey,
headerRows: this.getHeaderRows(),
columnMetrics: this.state.columnMetrics,
rowGetter: this.props.rowGetter,
rowsCount: this.props.rowsCount,
rowHeight: this.props.rowHeight,
cellMetaData: cellMetaData,
selectedRows: this.getSelectedRows(),
rowSelection: this.getRowSelectionProps(),
expandedRows: this.state.expandedRows,
rowOffsetHeight: this.getRowOffsetHeight(),
sortColumn: this.state.sortColumn,
sortDirection: this.state.sortDirection,
onSort: this.handleSort,
minHeight: this.props.minHeight,
totalWidth: gridWidth,
onViewportKeydown: this.onKeyDown,
onViewportKeyup: this.onKeyUp,
onViewportDragStart: this.onDragStart,
onViewportDragEnd: this.handleDragEnd,
onViewportDoubleClick: this.onViewportDoubleClick,
onColumnResize: this.onColumnResize,
rowScrollTimeout: this.props.rowScrollTimeout,
contextMenu: this.props.contextMenu }))
)
);
}
});
module.exports = ReactDataGrid;
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var React = __webpack_require__(1);
var Draggable = __webpack_require__(41);
var ResizeHandle = React.createClass({
displayName: 'ResizeHandle',
style: {
position: 'absolute',
top: 0,
right: 0,
width: 6,
height: '100%'
},
render: function render() {
return React.createElement(Draggable, _extends({}, this.props, {
className: 'react-grid-HeaderCell__resizeHandle',
style: this.style
}));
}
});
module.exports = ResizeHandle;
/***/ },
/* 51 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(2);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _classnames = __webpack_require__(3);
var _classnames2 = _interopRequireDefault(_classnames);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var RowGroup = function (_Component) {
_inherits(RowGroup, _Component);
function RowGroup() {
_classCallCheck(this, RowGroup);
var _this = _possibleConstructorReturn(this, _Component.call(this));
_this.checkFocus = _this.checkFocus.bind(_this);
_this.isSelected = _this.isSelected.bind(_this);
_this.onClick = _this.onClick.bind(_this);
_this.onRowExpandToggle = _this.onRowExpandToggle.bind(_this);
_this.onKeyDown = _this.onKeyDown.bind(_this);
_this.onRowExpandClick = _this.onRowExpandClick.bind(_this);
return _this;
}
RowGroup.prototype.componentDidMount = function componentDidMount() {
this.checkFocus();
};
RowGroup.prototype.componentDidUpdate = function componentDidUpdate() {
this.checkFocus();
};
RowGroup.prototype.isSelected = function isSelected() {
var meta = this.props.cellMetaData;
if (meta == null) {
return false;
}
return meta.selected && meta.selected.rowIdx === this.props.idx;
};
RowGroup.prototype.onClick = function onClick(e) {
var meta = this.props.cellMetaData;
if (meta != null && meta.onCellClick && typeof meta.onCellClick === 'function') {
meta.onCellClick({ rowIdx: this.props.idx, idx: 0 }, e);
}
};
RowGroup.prototype.onKeyDown = function onKeyDown(e) {
if (e.key === 'ArrowLeft') {
this.onRowExpandToggle(false);
}
if (e.key === 'ArrowRight') {
this.onRowExpandToggle(true);
}
if (e.key === 'Enter') {
this.onRowExpandToggle(!this.props.isExpanded);
}
};
RowGroup.prototype.onRowExpandClick = function onRowExpandClick() {
this.onRowExpandToggle(!this.props.isExpanded);
};
RowGroup.prototype.onRowExpandToggle = function onRowExpandToggle(expand) {
var shouldExpand = expand == null ? !this.props.isExpanded : expand;
var meta = this.props.cellMetaData;
if (meta != null && meta.onRowExpandToggle && typeof meta.onRowExpandToggle === 'function') {
meta.onRowExpandToggle({ rowIdx: this.props.idx, shouldExpand: shouldExpand, columnGroupName: this.props.columnGroupName, name: this.props.name });
}
};
RowGroup.prototype.getClassName = function getClassName() {
return (0, _classnames2['default'])('react-grid-row-group', 'react-grid-Row', { 'row-selected': this.isSelected() });
};
RowGroup.prototype.checkFocus = function checkFocus() {
if (this.isSelected()) {
_reactDom2['default'].findDOMNode(this).focus();
}
};
RowGroup.prototype.render = function render() {
var style = {
height: '50px',
overflow: 'hidden',
border: '1px solid #dddddd',
paddingTop: '15px',
paddingLeft: '5px'
};
var rowGroupRendererProps = Object.assign({ onRowExpandClick: this.onRowExpandClick }, this.props);
return _react2['default'].createElement(
'div',
{ style: style, className: this.getClassName(), onClick: this.onClick, onKeyDown: this.onKeyDown, tabIndex: -1 },
_react2['default'].createElement(this.props.renderer, rowGroupRendererProps)
);
};
return RowGroup;
}(_react.Component);
RowGroup.propTypes = {
name: _react.PropTypes.string.isRequired,
columnGroupName: _react.PropTypes.string.isRequired,
isExpanded: _react.PropTypes.bool.isRequired,
treeDepth: _react.PropTypes.number.isRequired,
height: _react.PropTypes.number.isRequired,
cellMetaData: _react.PropTypes.object,
idx: _react.PropTypes.number.isRequired,
renderer: _react.PropTypes.func
};
var DefaultRowGroupRenderer = function DefaultRowGroupRenderer(props) {
var treeDepth = props.treeDepth || 0;
var marginLeft = treeDepth * 20;
return _react2['default'].createElement(
'div',
null,
_react2['default'].createElement(
'span',
{ className: 'row-expand-icon', style: { float: 'left', marginLeft: marginLeft, cursor: 'pointer' }, onClick: props.onRowExpandClick },
props.isExpanded ? String.fromCharCode('9660') : String.fromCharCode('9658')
),
_react2['default'].createElement(
'strong',
null,
props.columnGroupName,
' : ',
props.name
)
);
};
DefaultRowGroupRenderer.propTypes = {
onRowExpandClick: _react.PropTypes.func.isRequired,
isExpanded: _react.PropTypes.bool.isRequired,
treeDepth: _react.PropTypes.number.isRequired,
name: _react.PropTypes.string.isRequired,
columnGroupName: _react.PropTypes.string.isRequired
};
RowGroup.defaultProps = {
renderer: DefaultRowGroupRenderer
};
exports['default'] = RowGroup;
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.SimpleRowsContainer = undefined;
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var SimpleRowsContainer = function SimpleRowsContainer(props) {
return _react2['default'].createElement(
'div',
{ style: { overflow: 'hidden' } },
props.rows
);
};
SimpleRowsContainer.propTypes = {
width: _react.PropTypes.number,
rows: _react.PropTypes.array
};
var RowsContainer = function (_React$Component) {
_inherits(RowsContainer, _React$Component);
function RowsContainer(props) {
_classCallCheck(this, RowsContainer);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
_this.plugins = props.window ? props.window.ReactDataGridPlugins : window.ReactDataGridPlugins;
_this.hasContextMenu = _this.hasContextMenu.bind(_this);
_this.renderRowsWithContextMenu = _this.renderRowsWithContextMenu.bind(_this);
_this.getContextMenuContainer = _this.getContextMenuContainer.bind(_this);
_this.state = { ContextMenuContainer: _this.getContextMenuContainer(props) };
return _this;
}
RowsContainer.prototype.getContextMenuContainer = function getContextMenuContainer() {
if (this.hasContextMenu()) {
if (!this.plugins) {
throw new Error('You need to include ReactDataGrid UiPlugins in order to initialise context menu');
}
return this.plugins.Menu.ContextMenuLayer('reactDataGridContextMenu')(SimpleRowsContainer);
}
};
RowsContainer.prototype.hasContextMenu = function hasContextMenu() {
return this.props.contextMenu && _react2['default'].isValidElement(this.props.contextMenu);
};
RowsContainer.prototype.renderRowsWithContextMenu = function renderRowsWithContextMenu() {
var ContextMenuRowsContainer = this.state.ContextMenuContainer;
var newProps = { rowIdx: this.props.rowIdx, idx: this.props.idx };
var contextMenu = _react2['default'].cloneElement(this.props.contextMenu, newProps);
// Initialise the context menu if it is available
return _react2['default'].createElement(
'div',
null,
_react2['default'].createElement(ContextMenuRowsContainer, this.props),
contextMenu
);
};
RowsContainer.prototype.render = function render() {
return this.hasContextMenu() ? this.renderRowsWithContextMenu() : _react2['default'].createElement(SimpleRowsContainer, this.props);
};
return RowsContainer;
}(_react2['default'].Component);
RowsContainer.propTypes = {
contextMenu: _react.PropTypes.element,
rowIdx: _react.PropTypes.number,
idx: _react.PropTypes.number,
window: _react.PropTypes.object
};
exports['default'] = RowsContainer;
exports.SimpleRowsContainer = SimpleRowsContainer;
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _reactDom = __webpack_require__(2);
var _reactDom2 = _interopRequireDefault(_reactDom);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var ScrollShim = {
appendScrollShim: function appendScrollShim() {
if (!this._scrollShim) {
var size = this._scrollShimSize();
var shim = document.createElement('div');
if (shim.classList) {
shim.classList.add('react-grid-ScrollShim'); // flow - not compatible with HTMLElement
} else {
shim.className += ' react-grid-ScrollShim';
}
shim.style.position = 'absolute';
shim.style.top = 0;
shim.style.left = 0;
shim.style.width = size.width + 'px';
shim.style.height = size.height + 'px';
_reactDom2['default'].findDOMNode(this).appendChild(shim);
this._scrollShim = shim;
}
this._scheduleRemoveScrollShim();
},
_scrollShimSize: function _scrollShimSize() {
return {
width: this.props.width,
height: this.props.length * this.props.rowHeight
};
},
_scheduleRemoveScrollShim: function _scheduleRemoveScrollShim() {
if (this._scheduleRemoveScrollShimTimer) {
clearTimeout(this._scheduleRemoveScrollShimTimer);
}
this._scheduleRemoveScrollShimTimer = setTimeout(this._removeScrollShim, 200);
},
_removeScrollShim: function _removeScrollShim() {
if (this._scrollShim) {
this._scrollShim.parentNode.removeChild(this._scrollShim);
this._scrollShim = undefined;
}
}
};
module.exports = ScrollShim;
/***/ },
/* 54 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(1);
var Canvas = __webpack_require__(38);
var ViewportScroll = __webpack_require__(55);
var cellMetaDataShape = __webpack_require__(8);
var PropTypes = React.PropTypes;
var Viewport = React.createClass({
displayName: 'Viewport',
mixins: [ViewportScroll],
propTypes: {
rowOffsetHeight: PropTypes.number.isRequired,
totalWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
columnMetrics: PropTypes.object.isRequired,
rowGetter: PropTypes.oneOfType([PropTypes.array, PropTypes.func]).isRequired,
selectedRows: PropTypes.array,
rowSelection: React.PropTypes.oneOfType([React.PropTypes.shape({
indexes: React.PropTypes.arrayOf(React.PropTypes.number).isRequired
}), React.PropTypes.shape({
isSelectedKey: React.PropTypes.string.isRequired
}), React.PropTypes.shape({
keys: React.PropTypes.shape({
values: React.PropTypes.array.isRequired,
rowKey: React.PropTypes.string.isRequired
}).isRequired
})]),
expandedRows: PropTypes.array,
rowRenderer: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
rowsCount: PropTypes.number.isRequired,
rowHeight: PropTypes.number.isRequired,
onRows: PropTypes.func,
onScroll: PropTypes.func,
minHeight: PropTypes.number,
cellMetaData: PropTypes.shape(cellMetaDataShape),
rowKey: PropTypes.string.isRequired,
rowScrollTimeout: PropTypes.number,
contextMenu: PropTypes.element,
getSubRowDetails: PropTypes.func,
rowGroupRenderer: PropTypes.func
},
onScroll: function onScroll(scroll) {
this.updateScroll(scroll.scrollTop, scroll.scrollLeft, this.state.height, this.props.rowHeight, this.props.rowsCount);
if (this.props.onScroll) {
this.props.onScroll({ scrollTop: scroll.scrollTop, scrollLeft: scroll.scrollLeft });
}
},
getScroll: function getScroll() {
return this.refs.canvas.getScroll();
},
setScrollLeft: function setScrollLeft(scrollLeft) {
this.refs.canvas.setScrollLeft(scrollLeft);
},
render: function render() {
var style = {
padding: 0,
bottom: 0,
left: 0,
right: 0,
overflow: 'hidden',
position: 'absolute',
top: this.props.rowOffsetHeight
};
return React.createElement(
'div',
{
className: 'react-grid-Viewport',
style: style },
React.createElement(Canvas, {
ref: 'canvas',
rowKey: this.props.rowKey,
totalWidth: this.props.totalWidth,
width: this.props.columnMetrics.width,
rowGetter: this.props.rowGetter,
rowsCount: this.props.rowsCount,
selectedRows: this.props.selectedRows,
expandedRows: this.props.expandedRows,
columns: this.props.columnMetrics.columns,
rowRenderer: this.props.rowRenderer,
displayStart: this.state.displayStart,
displayEnd: this.state.displayEnd,
cellMetaData: this.props.cellMetaData,
height: this.state.height,
rowHeight: this.props.rowHeight,
onScroll: this.onScroll,
onRows: this.props.onRows,
rowScrollTimeout: this.props.rowScrollTimeout,
contextMenu: this.props.contextMenu,
rowSelection: this.props.rowSelection,
getSubRowDetails: this.props.getSubRowDetails,
rowGroupRenderer: this.props.rowGroupRenderer
})
);
}
});
module.exports = Viewport;
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(1);
var ReactDOM = __webpack_require__(2);
var DOMMetrics = __webpack_require__(9);
var min = Math.min;
var max = Math.max;
var floor = Math.floor;
var ceil = Math.ceil;
module.exports = {
mixins: [DOMMetrics.MetricsMixin],
DOMMetrics: {
viewportHeight: function viewportHeight() {
return ReactDOM.findDOMNode(this).offsetHeight;
}
},
propTypes: {
rowHeight: React.PropTypes.number,
rowsCount: React.PropTypes.number.isRequired
},
getDefaultProps: function getDefaultProps() {
return {
rowHeight: 30
};
},
getInitialState: function getInitialState() {
return this.getGridState(this.props);
},
getGridState: function getGridState(props) {
var canvasHeight = props.minHeight - props.rowOffsetHeight;
var renderedRowsCount = ceil((props.minHeight - props.rowHeight) / props.rowHeight);
var totalRowCount = min(renderedRowsCount * 2, props.rowsCount);
return {
displayStart: 0,
displayEnd: totalRowCount,
height: canvasHeight,
scrollTop: 0,
scrollLeft: 0
};
},
updateScroll: function updateScroll(scrollTop, scrollLeft, height, rowHeight, length) {
var renderedRowsCount = ceil(height / rowHeight);
var visibleStart = floor(scrollTop / rowHeight);
var visibleEnd = min(visibleStart + renderedRowsCount, length);
var displayStart = max(0, visibleStart - renderedRowsCount * 2);
var displayEnd = min(visibleStart + renderedRowsCount * 2, length);
var nextScrollState = {
visibleStart: visibleStart,
visibleEnd: visibleEnd,
displayStart: displayStart,
displayEnd: displayEnd,
height: height,
scrollTop: scrollTop,
scrollLeft: scrollLeft
};
this.setState(nextScrollState);
},
metricsUpdated: function metricsUpdated() {
var height = this.DOMMetrics.viewportHeight();
if (height) {
this.updateScroll(this.state.scrollTop, this.state.scrollLeft, height, this.props.rowHeight, this.props.rowsCount);
}
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (this.props.rowHeight !== nextProps.rowHeight || this.props.minHeight !== nextProps.minHeight) {
this.setState(this.getGridState(nextProps));
} else if (this.props.rowsCount !== nextProps.rowsCount) {
this.updateScroll(this.state.scrollTop, this.state.scrollLeft, this.state.height, nextProps.rowHeight, nextProps.rowsCount);
// Added to fix the hiding of the bottom scrollbar when showing the filters.
} else if (this.props.rowOffsetHeight !== nextProps.rowOffsetHeight) {
// The value of height can be positive or negative and will be added to the current height to cater for changes in the header height (due to the filer)
var _height = this.props.rowOffsetHeight - nextProps.rowOffsetHeight;
this.updateScroll(this.state.scrollTop, this.state.scrollLeft, this.state.height + _height, nextProps.rowHeight, nextProps.rowsCount);
}
}
};
/***/ },
/* 56 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(1);
var ExcelColumn = __webpack_require__(6);
var FilterableHeaderCell = React.createClass({
displayName: 'FilterableHeaderCell',
propTypes: {
onChange: React.PropTypes.func.isRequired,
column: React.PropTypes.shape(ExcelColumn)
},
getInitialState: function getInitialState() {
return { filterTerm: '' };
},
handleChange: function handleChange(e) {
var val = e.target.value;
this.setState({ filterTerm: val });
this.props.onChange({ filterTerm: val, column: this.props.column });
},
renderInput: function renderInput() {
if (this.props.column.filterable === false) {
return React.createElement('span', null);
}
var inputKey = 'header-filter-' + this.props.column.key;
return React.createElement('input', { key: inputKey, type: 'text', className: 'form-control input-sm', placeholder: 'Search', value: this.state.filterTerm, onChange: this.handleChange });
},
render: function render() {
return React.createElement(
'div',
null,
React.createElement(
'div',
{ className: 'form-group' },
this.renderInput()
)
);
}
});
module.exports = FilterableHeaderCell;
/***/ },
/* 57 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(1);
var joinClasses = __webpack_require__(3);
var DEFINE_SORT = {
ASC: 'ASC',
DESC: 'DESC',
NONE: 'NONE'
};
var SortableHeaderCell = React.createClass({
displayName: 'SortableHeaderCell',
propTypes: {
columnKey: React.PropTypes.string.isRequired,
column: React.PropTypes.shape({ name: React.PropTypes.node }),
onSort: React.PropTypes.func.isRequired,
sortDirection: React.PropTypes.oneOf(['ASC', 'DESC', 'NONE'])
},
onClick: function onClick() {
var direction = void 0;
switch (this.props.sortDirection) {
default:
case null:
case undefined:
case DEFINE_SORT.NONE:
direction = DEFINE_SORT.ASC;
break;
case DEFINE_SORT.ASC:
direction = DEFINE_SORT.DESC;
break;
case DEFINE_SORT.DESC:
direction = DEFINE_SORT.NONE;
break;
}
this.props.onSort(this.props.columnKey, direction);
},
getSortByText: function getSortByText() {
var unicodeKeys = {
ASC: '9650',
DESC: '9660',
NONE: ''
};
return String.fromCharCode(unicodeKeys[this.props.sortDirection]);
},
render: function render() {
var className = joinClasses({
'react-grid-HeaderCell-sortable': true,
'react-grid-HeaderCell-sortable--ascending': this.props.sortDirection === 'ASC',
'react-grid-HeaderCell-sortable--descending': this.props.sortDirection === 'DESC'
});
return React.createElement(
'div',
{ className: className,
onClick: this.onClick,
style: { cursor: 'pointer' } },
this.props.column.name,
React.createElement(
'span',
{ className: 'pull-right' },
this.getSortByText()
)
);
}
});
module.exports = SortableHeaderCell;
/***/ },
/* 58 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(1);
var CheckboxEditor = React.createClass({
displayName: 'CheckboxEditor',
propTypes: {
value: React.PropTypes.bool,
rowIdx: React.PropTypes.number,
column: React.PropTypes.shape({
key: React.PropTypes.string,
onCellChange: React.PropTypes.func
}),
dependentValues: React.PropTypes.object
},
handleChange: function handleChange(e) {
this.props.column.onCellChange(this.props.rowIdx, this.props.column.key, this.props.dependentValues, e);
},
render: function render() {
var checked = this.props.value != null ? this.props.value : false;
var checkboxName = 'checkbox' + this.props.rowIdx;
return React.createElement(
'div',
{ className: 'react-grid-checkbox-container', onClick: this.handleChange },
React.createElement('input', { className: 'react-grid-checkbox', type: 'checkbox', name: checkboxName, checked: checked }),
React.createElement('label', { htmlFor: checkboxName, className: 'react-grid-checkbox-label' })
);
}
});
module.exports = CheckboxEditor;
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
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 React = __webpack_require__(1);
var ReactDOM = __webpack_require__(2);
var ExcelColumn = __webpack_require__(6);
var EditorBase = function (_React$Component) {
_inherits(EditorBase, _React$Component);
function EditorBase() {
_classCallCheck(this, EditorBase);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
EditorBase.prototype.getStyle = function getStyle() {
return {
width: '100%'
};
};
EditorBase.prototype.getValue = function getValue() {
var updated = {};
updated[this.props.column.key] = this.getInputNode().value;
return updated;
};
EditorBase.prototype.getInputNode = function getInputNode() {
var domNode = ReactDOM.findDOMNode(this);
if (domNode.tagName === 'INPUT') {
return domNode;
}
return domNode.querySelector('input:not([type=hidden])');
};
EditorBase.prototype.inheritContainerStyles = function inheritContainerStyles() {
return true;
};
return EditorBase;
}(React.Component);
EditorBase.propTypes = {
onKeyDown: React.PropTypes.func.isRequired,
value: React.PropTypes.any.isRequired,
onBlur: React.PropTypes.func.isRequired,
column: React.PropTypes.shape(ExcelColumn).isRequired,
commit: React.PropTypes.func.isRequired
};
module.exports = EditorBase;
/***/ },
/* 60 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var React = __webpack_require__(1);
var joinClasses = __webpack_require__(3);
var keyboardHandlerMixin = __webpack_require__(21);
var SimpleTextEditor = __webpack_require__(61);
var isFunction = __webpack_require__(23);
var EditorContainer = React.createClass({
displayName: 'EditorContainer',
mixins: [keyboardHandlerMixin],
propTypes: {
rowIdx: React.PropTypes.number,
rowData: React.PropTypes.object.isRequired,
value: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number, React.PropTypes.object, React.PropTypes.bool]).isRequired,
cellMetaData: React.PropTypes.shape({
selected: React.PropTypes.object.isRequired,
copied: React.PropTypes.object,
dragged: React.PropTypes.object,
onCellClick: React.PropTypes.func,
onCellDoubleClick: React.PropTypes.func,
onCommitCancel: React.PropTypes.func,
onCommit: React.PropTypes.func
}).isRequired,
column: React.PropTypes.object.isRequired,
height: React.PropTypes.number.isRequired
},
changeCommitted: false,
getInitialState: function getInitialState() {
return { isInvalid: false };
},
componentDidMount: function componentDidMount() {
var inputNode = this.getInputNode();
if (inputNode !== undefined) {
this.setTextInputFocus();
if (!this.getEditor().disableContainerStyles) {
inputNode.className += ' editor-main';
inputNode.style.height = this.props.height - 1 + 'px';
}
}
},
componentWillUnmount: function componentWillUnmount() {
if (!this.changeCommitted && !this.hasEscapeBeenPressed()) {
this.commit({ key: 'Enter' });
}
},
createEditor: function createEditor() {
var _this = this;
var editorRef = function editorRef(c) {
return _this.editor = c;
};
var editorProps = {
ref: editorRef,
column: this.props.column,
value: this.getInitialValue(),
onCommit: this.commit,
rowMetaData: this.getRowMetaData(),
rowData: this.props.rowData,
height: this.props.height,
onBlur: this.commit,
onOverrideKeyDown: this.onKeyDown
};
var CustomEditor = this.props.column.editor;
// return custom column editor or SimpleEditor if none specified
if (React.isValidElement(CustomEditor)) {
return React.cloneElement(CustomEditor, editorProps);
}
if (isFunction(CustomEditor)) {
return React.createElement(CustomEditor, _extends({ ref: editorRef }, editorProps));
}
return React.createElement(SimpleTextEditor, { ref: editorRef, column: this.props.column, value: this.getInitialValue(), onBlur: this.commit, rowMetaData: this.getRowMetaData(), onKeyDown: function onKeyDown() {}, commit: function commit() {} });
},
onPressEnter: function onPressEnter() {
this.commit({ key: 'Enter' });
},
onPressTab: function onPressTab() {
this.commit({ key: 'Tab' });
},
onPressEscape: function onPressEscape(e) {
if (!this.editorIsSelectOpen()) {
this.props.cellMetaData.onCommitCancel();
} else {
// prevent event from bubbling if editor has results to select
e.stopPropagation();
}
},
onPressArrowDown: function onPressArrowDown(e) {
if (this.editorHasResults()) {
// dont want to propogate as that then moves us round the grid
e.stopPropagation();
} else {
this.commit(e);
}
},
onPressArrowUp: function onPressArrowUp(e) {
if (this.editorHasResults()) {
// dont want to propogate as that then moves us round the grid
e.stopPropagation();
} else {
this.commit(e);
}
},
onPressArrowLeft: function onPressArrowLeft(e) {
// prevent event propogation. this disables left cell navigation
if (!this.isCaretAtBeginningOfInput()) {
e.stopPropagation();
} else {
this.commit(e);
}
},
onPressArrowRight: function onPressArrowRight(e) {
// prevent event propogation. this disables right cell navigation
if (!this.isCaretAtEndOfInput()) {
e.stopPropagation();
} else {
this.commit(e);
}
},
editorHasResults: function editorHasResults() {
if (isFunction(this.getEditor().hasResults)) {
return this.getEditor().hasResults();
}
return false;
},
editorIsSelectOpen: function editorIsSelectOpen() {
if (isFunction(this.getEditor().isSelectOpen)) {
return this.getEditor().isSelectOpen();
}
return false;
},
getRowMetaData: function getRowMetaData() {
// clone row data so editor cannot actually change this
// convention based method to get corresponding Id or Name of any Name or Id property
if (typeof this.props.column.getRowMetaData === 'function') {
return this.props.column.getRowMetaData(this.props.rowData, this.props.column);
}
},
getEditor: function getEditor() {
return this.editor;
},
getInputNode: function getInputNode() {
return this.getEditor().getInputNode();
},
getInitialValue: function getInitialValue() {
var selected = this.props.cellMetaData.selected;
var keyCode = selected.initialKeyCode;
if (keyCode === 'Delete' || keyCode === 'Backspace') {
return '';
} else if (keyCode === 'Enter') {
return this.props.value;
}
var text = keyCode ? String.fromCharCode(keyCode) : this.props.value;
return text;
},
getContainerClass: function getContainerClass() {
return joinClasses({
'has-error': this.state.isInvalid === true
});
},
commit: function commit(args) {
var opts = args || {};
var updated = this.getEditor().getValue();
if (this.isNewValueValid(updated)) {
this.changeCommitted = true;
var cellKey = this.props.column.key;
this.props.cellMetaData.onCommit({ cellKey: cellKey, rowIdx: this.props.rowIdx, updated: updated, key: opts.key });
}
},
isNewValueValid: function isNewValueValid(value) {
if (isFunction(this.getEditor().validate)) {
var isValid = this.getEditor().validate(value);
this.setState({ isInvalid: !isValid });
return isValid;
}
return true;
},
setCaretAtEndOfInput: function setCaretAtEndOfInput() {
var input = this.getInputNode();
// taken from http://stackoverflow.com/questions/511088/use-javascript-to-place-cursor-at-end-of-text-in-text-input-element
var txtLength = input.value.length;
if (input.setSelectionRange) {
input.setSelectionRange(txtLength, txtLength);
} else if (input.createTextRange) {
var fieldRange = input.createTextRange();
fieldRange.moveStart('character', txtLength);
fieldRange.collapse();
fieldRange.select();
}
},
isCaretAtBeginningOfInput: function isCaretAtBeginningOfInput() {
var inputNode = this.getInputNode();
return inputNode.selectionStart === inputNode.selectionEnd && inputNode.selectionStart === 0;
},
isCaretAtEndOfInput: function isCaretAtEndOfInput() {
var inputNode = this.getInputNode();
return inputNode.selectionStart === inputNode.value.length;
},
setTextInputFocus: function setTextInputFocus() {
var selected = this.props.cellMetaData.selected;
var keyCode = selected.initialKeyCode;
var inputNode = this.getInputNode();
inputNode.focus();
if (inputNode.tagName === 'INPUT') {
if (!this.isKeyPrintable(keyCode)) {
inputNode.focus();
inputNode.select();
} else {
inputNode.select();
}
}
},
hasEscapeBeenPressed: function hasEscapeBeenPressed() {
var pressed = false;
var escapeKey = 27;
if (window.event) {
if (window.event.keyCode === escapeKey) {
pressed = true;
} else if (window.event.which === escapeKey) {
pressed = true;
}
}
return pressed;
},
renderStatusIcon: function renderStatusIcon() {
if (this.state.isInvalid === true) {
return React.createElement('span', { className: 'glyphicon glyphicon-remove form-control-feedback' });
}
},
render: function render() {
return React.createElement(
'div',
{ className: this.getContainerClass(), onKeyDown: this.onKeyDown, commit: this.commit },
this.createEditor(),
this.renderStatusIcon()
);
}
});
module.exports = EditorContainer;
/***/ },
/* 61 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
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 React = __webpack_require__(1);
var EditorBase = __webpack_require__(59);
var SimpleTextEditor = function (_EditorBase) {
_inherits(SimpleTextEditor, _EditorBase);
function SimpleTextEditor() {
_classCallCheck(this, SimpleTextEditor);
return _possibleConstructorReturn(this, _EditorBase.apply(this, arguments));
}
SimpleTextEditor.prototype.render = function render() {
return React.createElement('input', { ref: 'input', type: 'text', onBlur: this.props.onBlur, className: 'form-control', defaultValue: this.props.value });
};
return SimpleTextEditor;
}(EditorBase);
module.exports = SimpleTextEditor;
/***/ },
/* 62 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var React = __webpack_require__(1);
var SimpleCellFormatter = React.createClass({
displayName: 'SimpleCellFormatter',
propTypes: {
value: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number, React.PropTypes.object, React.PropTypes.bool]).isRequired
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
return nextProps.value !== this.props.value;
},
render: function render() {
return React.createElement(
'div',
{ title: this.props.value },
this.props.value
);
}
});
module.exports = SimpleCellFormatter;
/***/ },
/* 63 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule invariant
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
function invariant(condition, format, a, b, c, d, e, f) {
if (false) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
/***/ },
/* 64 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule keyMirror
* @typechecks static-only
*/
'use strict';
var invariant = __webpack_require__(63);
/**
* Constructs an enumeration with keys equal to their value.
*
* For example:
*
* var COLORS = keyMirror({blue: null, red: null});
* var myColor = COLORS.blue;
* var isColorValid = !!COLORS[myColor];
*
* The last line could not be performed if the values of the generated enum were
* not equal to their keys.
*
* Input: {key1: val1, key2: val2}
* Output: {key1: key1, key2: key2}
*
* @param {object} obj
* @return {object}
*/
var keyMirror = function (obj) {
var ret = {};
var key;
!(obj instanceof Object && !Array.isArray(obj)) ? false ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
for (key in obj) {
if (!obj.hasOwnProperty(key)) {
continue;
}
ret[key] = key;
}
return ret;
};
module.exports = keyMirror;
/***/ },
/* 65 */
/***/ function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(7),
root = __webpack_require__(4);
/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView');
module.exports = DataView;
/***/ },
/* 66 */
/***/ function(module, exports, __webpack_require__) {
var hashClear = __webpack_require__(89),
hashDelete = __webpack_require__(90),
hashGet = __webpack_require__(91),
hashHas = __webpack_require__(92),
hashSet = __webpack_require__(93);
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
module.exports = Hash;
/***/ },
/* 67 */
/***/ function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(7),
root = __webpack_require__(4);
/* Built-in method references that are verified to be native. */
var Promise = getNative(root, 'Promise');
module.exports = Promise;
/***/ },
/* 68 */
/***/ function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(7),
root = __webpack_require__(4);
/* Built-in method references that are verified to be native. */
var Set = getNative(root, 'Set');
module.exports = Set;
/***/ },
/* 69 */
/***/ function(module, exports, __webpack_require__) {
var MapCache = __webpack_require__(26),
setCacheAdd = __webpack_require__(112),
setCacheHas = __webpack_require__(113);
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values ? values.length : 0;
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
module.exports = SetCache;
/***/ },
/* 70 */
/***/ function(module, exports, __webpack_require__) {
var ListCache = __webpack_require__(10),
stackClear = __webpack_require__(115),
stackDelete = __webpack_require__(116),
stackGet = __webpack_require__(117),
stackHas = __webpack_require__(118),
stackSet = __webpack_require__(119);
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
this.__data__ = new ListCache(entries);
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
module.exports = Stack;
/***/ },
/* 71 */
/***/ function(module, exports, __webpack_require__) {
var root = __webpack_require__(4);
/** Built-in value references. */
var Symbol = root.Symbol;
module.exports = Symbol;
/***/ },
/* 72 */
/***/ function(module, exports, __webpack_require__) {
var root = __webpack_require__(4);
/** Built-in value references. */
var Uint8Array = root.Uint8Array;
module.exports = Uint8Array;
/***/ },
/* 73 */
/***/ function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(7),
root = __webpack_require__(4);
/* Built-in method references that are verified to be native. */
var WeakMap = getNative(root, 'WeakMap');
module.exports = WeakMap;
/***/ },
/* 74 */
/***/ function(module, exports, __webpack_require__) {
var baseTimes = __webpack_require__(82),
isArguments = __webpack_require__(120),
isArray = __webpack_require__(32),
isIndex = __webpack_require__(94);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
// Safari 9 makes `arguments.length` enumerable in strict mode.
var result = (isArray(value) || isArguments(value))
? baseTimes(value.length, String)
: [];
var length = result.length,
skipIndexes = !!length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
module.exports = arrayLikeKeys;
/***/ },
/* 75 */
/***/ function(module, exports) {
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array ? array.length : 0;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
module.exports = arraySome;
/***/ },
/* 76 */
/***/ function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `getTag`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
return objectToString.call(value);
}
module.exports = baseGetTag;
/***/ },
/* 77 */
/***/ function(module, exports, __webpack_require__) {
var baseIsEqualDeep = __webpack_require__(78),
isObject = __webpack_require__(18),
isObjectLike = __webpack_require__(19);
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons.
* @param {boolean} [bitmask] The bitmask of comparison flags.
* The bitmask may be composed of the following flags:
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, customizer, bitmask, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
}
module.exports = baseIsEqual;
/***/ },
/* 78 */
/***/ function(module, exports, __webpack_require__) {
var Stack = __webpack_require__(70),
equalArrays = __webpack_require__(27),
equalByTag = __webpack_require__(85),
equalObjects = __webpack_require__(86),
getTag = __webpack_require__(87),
isArray = __webpack_require__(32),
isHostObject = __webpack_require__(29),
isTypedArray = __webpack_require__(123);
/** Used to compose bitmasks for comparison styles. */
var PARTIAL_COMPARE_FLAG = 2;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
objectTag = '[object Object]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparisons.
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = arrayTag,
othTag = arrayTag;
if (!objIsArr) {
objTag = getTag(object);
objTag = objTag == argsTag ? objectTag : objTag;
}
if (!othIsArr) {
othTag = getTag(other);
othTag = othTag == argsTag ? objectTag : othTag;
}
var objIsObj = objTag == objectTag && !isHostObject(object),
othIsObj = othTag == objectTag && !isHostObject(other),
isSameTag = objTag == othTag;
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
return (objIsArr || isTypedArray(object))
? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
: equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
}
if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
}
module.exports = baseIsEqualDeep;
/***/ },
/* 79 */
/***/ function(module, exports, __webpack_require__) {
var isFunction = __webpack_require__(34),
isHostObject = __webpack_require__(29),
isMasked = __webpack_require__(96),
isObject = __webpack_require__(18),
toSource = __webpack_require__(30);
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for built-in method references. */
var funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
module.exports = baseIsNative;
/***/ },
/* 80 */
/***/ function(module, exports, __webpack_require__) {
var isLength = __webpack_require__(35),
isObjectLike = __webpack_require__(19);
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike(value) &&
isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
}
module.exports = baseIsTypedArray;
/***/ },
/* 81 */
/***/ function(module, exports, __webpack_require__) {
var isPrototype = __webpack_require__(97),
nativeKeys = __webpack_require__(109);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
module.exports = baseKeys;
/***/ },
/* 82 */
/***/ function(module, exports) {
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
module.exports = baseTimes;
/***/ },
/* 83 */
/***/ function(module, exports) {
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}
module.exports = baseUnary;
/***/ },
/* 84 */
/***/ function(module, exports, __webpack_require__) {
var root = __webpack_require__(4);
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
module.exports = coreJsData;
/***/ },
/* 85 */
/***/ function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(71),
Uint8Array = __webpack_require__(72),
eq = __webpack_require__(31),
equalArrays = __webpack_require__(27),
mapToArray = __webpack_require__(108),
setToArray = __webpack_require__(114);
/** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1,
PARTIAL_COMPARE_FLAG = 2;
/** `Object#toString` result references. */
var boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
mapTag = '[object Map]',
numberTag = '[object Number]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]';
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
switch (tag) {
case dataViewTag:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
case mapTag:
var convert = mapToArray;
case setTag:
var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= UNORDERED_COMPARE_FLAG;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
module.exports = equalByTag;
/***/ },
/* 86 */
/***/ function(module, exports, __webpack_require__) {
var keys = __webpack_require__(124);
/** Used to compose bitmasks for comparison styles. */
var PARTIAL_COMPARE_FLAG = 2;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
objProps = keys(object),
objLength = objProps.length,
othProps = keys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined
? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}
module.exports = equalObjects;
/***/ },
/* 87 */
/***/ function(module, exports, __webpack_require__) {
var DataView = __webpack_require__(65),
Map = __webpack_require__(17),
Promise = __webpack_require__(67),
Set = __webpack_require__(68),
WeakMap = __webpack_require__(73),
baseGetTag = __webpack_require__(76),
toSource = __webpack_require__(30);
/** `Object#toString` result references. */
var mapTag = '[object Map]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
setTag = '[object Set]',
weakMapTag = '[object WeakMap]';
var dataViewTag = '[object DataView]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11,
// for data views in Edge < 14, and promises in Node.js.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : undefined;
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
module.exports = getTag;
/***/ },
/* 88 */
/***/ function(module, exports) {
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
module.exports = getValue;
/***/ },
/* 89 */
/***/ function(module, exports, __webpack_require__) {
var nativeCreate = __webpack_require__(13);
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
module.exports = hashClear;
/***/ },
/* 90 */
/***/ function(module, exports) {
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
return this.has(key) && delete this.__data__[key];
}
module.exports = hashDelete;
/***/ },
/* 91 */
/***/ function(module, exports, __webpack_require__) {
var nativeCreate = __webpack_require__(13);
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
module.exports = hashGet;
/***/ },
/* 92 */
/***/ function(module, exports, __webpack_require__) {
var nativeCreate = __webpack_require__(13);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
}
module.exports = hashHas;
/***/ },
/* 93 */
/***/ function(module, exports, __webpack_require__) {
var nativeCreate = __webpack_require__(13);
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
}
module.exports = hashSet;
/***/ },
/* 94 */
/***/ function(module, exports) {
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
module.exports = isIndex;
/***/ },
/* 95 */
/***/ function(module, exports) {
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
module.exports = isKeyable;
/***/ },
/* 96 */
/***/ function(module, exports, __webpack_require__) {
var coreJsData = __webpack_require__(84);
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
module.exports = isMasked;
/***/ },
/* 97 */
/***/ function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
module.exports = isPrototype;
/***/ },
/* 98 */
/***/ function(module, exports) {
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
}
module.exports = listCacheClear;
/***/ },
/* 99 */
/***/ function(module, exports, __webpack_require__) {
var assocIndexOf = __webpack_require__(11);
/** Used for built-in method references. */
var arrayProto = Array.prototype;
/** Built-in value references. */
var splice = arrayProto.splice;
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
return true;
}
module.exports = listCacheDelete;
/***/ },
/* 100 */
/***/ function(module, exports, __webpack_require__) {
var assocIndexOf = __webpack_require__(11);
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
module.exports = listCacheGet;
/***/ },
/* 101 */
/***/ function(module, exports, __webpack_require__) {
var assocIndexOf = __webpack_require__(11);
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
module.exports = listCacheHas;
/***/ },
/* 102 */
/***/ function(module, exports, __webpack_require__) {
var assocIndexOf = __webpack_require__(11);
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
module.exports = listCacheSet;
/***/ },
/* 103 */
/***/ function(module, exports, __webpack_require__) {
var Hash = __webpack_require__(66),
ListCache = __webpack_require__(10),
Map = __webpack_require__(17);
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
module.exports = mapCacheClear;
/***/ },
/* 104 */
/***/ function(module, exports, __webpack_require__) {
var getMapData = __webpack_require__(12);
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
return getMapData(this, key)['delete'](key);
}
module.exports = mapCacheDelete;
/***/ },
/* 105 */
/***/ function(module, exports, __webpack_require__) {
var getMapData = __webpack_require__(12);
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
module.exports = mapCacheGet;
/***/ },
/* 106 */
/***/ function(module, exports, __webpack_require__) {
var getMapData = __webpack_require__(12);
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
module.exports = mapCacheHas;
/***/ },
/* 107 */
/***/ function(module, exports, __webpack_require__) {
var getMapData = __webpack_require__(12);
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
getMapData(this, key).set(key, value);
return this;
}
module.exports = mapCacheSet;
/***/ },
/* 108 */
/***/ function(module, exports) {
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
module.exports = mapToArray;
/***/ },
/* 109 */
/***/ function(module, exports, __webpack_require__) {
var overArg = __webpack_require__(111);
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
module.exports = nativeKeys;
/***/ },
/* 110 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(28);
/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding('util');
} catch (e) {}
}());
module.exports = nodeUtil;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(125)(module)))
/***/ },
/* 111 */
/***/ function(module, exports) {
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
module.exports = overArg;
/***/ },
/* 112 */
/***/ function(module, exports) {
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
module.exports = setCacheAdd;
/***/ },
/* 113 */
/***/ function(module, exports) {
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
module.exports = setCacheHas;
/***/ },
/* 114 */
/***/ function(module, exports) {
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
module.exports = setToArray;
/***/ },
/* 115 */
/***/ function(module, exports, __webpack_require__) {
var ListCache = __webpack_require__(10);
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
}
module.exports = stackClear;
/***/ },
/* 116 */
/***/ function(module, exports) {
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
return this.__data__['delete'](key);
}
module.exports = stackDelete;
/***/ },
/* 117 */
/***/ function(module, exports) {
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
module.exports = stackGet;
/***/ },
/* 118 */
/***/ function(module, exports) {
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
module.exports = stackHas;
/***/ },
/* 119 */
/***/ function(module, exports, __webpack_require__) {
var ListCache = __webpack_require__(10),
Map = __webpack_require__(17),
MapCache = __webpack_require__(26);
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var cache = this.__data__;
if (cache instanceof ListCache) {
var pairs = cache.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
return this;
}
cache = this.__data__ = new MapCache(pairs);
}
cache.set(key, value);
return this;
}
module.exports = stackSet;
/***/ },
/* 120 */
/***/ function(module, exports, __webpack_require__) {
var isArrayLikeObject = __webpack_require__(121);
/** `Object#toString` result references. */
var argsTag = '[object Arguments]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
module.exports = isArguments;
/***/ },
/* 121 */
/***/ function(module, exports, __webpack_require__) {
var isArrayLike = __webpack_require__(33),
isObjectLike = __webpack_require__(19);
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
module.exports = isArrayLikeObject;
/***/ },
/* 122 */
/***/ function(module, exports, __webpack_require__) {
var baseIsEqual = __webpack_require__(77);
/**
* Performs a deep comparison between two values to determine if they are
* equivalent.
*
* **Note:** This method supports comparing arrays, array buffers, booleans,
* date objects, error objects, maps, numbers, `Object` objects, regexes,
* sets, strings, symbols, and typed arrays. `Object` objects are compared
* by their own, not inherited, enumerable properties. Functions and DOM
* nodes are **not** supported.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
*
* object === other;
* // => false
*/
function isEqual(value, other) {
return baseIsEqual(value, other);
}
module.exports = isEqual;
/***/ },
/* 123 */
/***/ function(module, exports, __webpack_require__) {
var baseIsTypedArray = __webpack_require__(80),
baseUnary = __webpack_require__(83),
nodeUtil = __webpack_require__(110);
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
module.exports = isTypedArray;
/***/ },
/* 124 */
/***/ function(module, exports, __webpack_require__) {
var arrayLikeKeys = __webpack_require__(74),
baseKeys = __webpack_require__(81),
isArrayLike = __webpack_require__(33);
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
module.exports = keys;
/***/ },
/* 125 */
/***/ function(module, exports) {
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
module.children = [];
module.webpackPolyfill = 1;
}
return module;
}
/***/ }
/******/ ])
});
;
|
src/contract-details/ContractReceipt.js
|
binary-com/binary-next-gen
|
import React, { PureComponent } from 'react';
import { Button } from 'binary-components';
import ContractDetailsList from './ContractDetailsList';
import ContractWinLose from './ContractWinLose';
import SellAtMarketButton from './SellAtMarketButton';
import ContractValidationError from './ContractValidationError';
const openContractSubscriptionFailed = contract =>
contract.validation_error && Object.keys(contract).length < 3;
export default class ContractReceipt extends PureComponent {
props: {
contract: Contract,
onTradeAgainClicked: (e: SyntheticEvent) => void,
showLongcode: boolean,
};
render() {
const { contract, showLongcode, onTradeAgainClicked } = this.props;
const backendFailure = openContractSubscriptionFailed(contract);
return (backendFailure ?
<div className="contract-receipt">
<ContractValidationError contract={contract} />
{onTradeAgainClicked &&
<Button
className="buy-again-btn"
text="Trade Again"
onClick={onTradeAgainClicked}
/>
}
</div> :
<div className="contract-receipt">
{showLongcode && <h5>{contract.longcode}</h5>}
<ContractWinLose contract={contract} />
<ContractDetailsList contract={contract} />
<SellAtMarketButton contract={contract} />
{onTradeAgainClicked &&
<Button
className="buy-again-btn"
text="Trade Again"
onClick={onTradeAgainClicked}
/>}
</div>
);
}
}
|
client/containers/alternatives/groupAlternative.js
|
TecProgPurrsuit/TeamBasedLearningApp
|
/**
* This file is responsible for render a single question's alternative of a group answering.
*
* @summary Componente for a single alternative.
@class GroupAlternative
*/
import React, { Component } from 'react';
class GroupAlternative extends Component {
constructor(props) {
super(props);
this.state = { alternativeStyle: null, wasSelected: false };
// Finding the input and run the groupAnswerListener function
// ESLint requirement
this.groupAnswerListener = this.groupAnswerListener.bind(this);
}
showAnswerResults(alternative) {
const WRONG_ANSWER = 0;
const CORRECT_ANSWER_STYLE = {
backgroundColor: 'green',
};
const WRONG_ANSWER_STYLE = {
backgroundColor: 'red',
};
if (this.state.alternativeStyle) {
this.setState({ alternativeStyle: null });
} else if (alternative.alternativePoints !== WRONG_ANSWER) {
this.setState({ alternativeStyle: CORRECT_ANSWER_STYLE });
} else {
this.setState({ alternativeStyle: WRONG_ANSWER_STYLE });
}
}
groupAnswerListener(alternative) {
if (this.state.wasSelected) {
console.warn('Alternative was already selected.');
} else {
this.showAnswerResults(alternative);
this.state.wasSelected = true;
}
}
render() {
return (
<div
className="card-action"
key={this.props.alternative.alternativeDescription}
onClick={() => this.groupAnswerListener(this.props.alternative)}
style={this.state.alternativeStyle}
>
<a className="collection-item black-text">
{this.props.alternative.alternativeDescription}
</a>
</div>
);
}
}
// Especify the attributes type
GroupAlternative.propTypes = {
alternative: React.PropTypes.object.isRequired,
};
// Export GroupAlternative Component
export default GroupAlternative;
|
ajax/libs/react-nvd3/0.5.0/react-nvd3.min.js
|
CyrusSUEN/cdnjs
|
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("d3"),require("nvd3")):"function"==typeof define&&define.amd?define(["react","d3","nvd3"],e):"object"==typeof exports?exports.NVD3Chart=e(require("react"),require("d3"),require("nvd3")):t.NVD3Chart=e(t.React,t.d3,t.nv)}(this,function(t,e,n){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),u=r(o),i=n(17),c=r(i),s=n(21),f=r(s),a=n(22),p=r(a),l=n(25),d=r(l),h=n(48),y=r(h),v=n(55),g=r(v),b=n(56),m=r(b),_=n(57),x=r(_),O=n(58),j=["x","y","type","datum","configure"],w=["width","height"],S="margin",P="containerStyle",M=function(t){function e(){return(0,f["default"])(this,e),(0,d["default"])(this,(0,c["default"])(e).apply(this,arguments))}return(0,y["default"])(e,t),(0,p["default"])(e,[{key:"componentDidMount",value:function(){x["default"].addGraph(this.renderChart.bind(this),this.props.renderEnd)}},{key:"componentDidUpdate",value:function(){this.renderChart()}},{key:"componentWillUnmount",value:function(){this.resizeHandler&&this.resizeHandler.clear()}},{key:"renderChart",value:function(){var t=void 0;return this.chart=this.chart&&!this.rendering?this.chart:x["default"].models[this.props.type](),this.parsedProps=(0,O.bindFunctions)(this.props,this.props.context),this.chart.x((0,O.getValueFunction)(this.parsedProps.x,"x")).y((0,O.getValueFunction)(this.parsedProps.y,"y")).margin(this.options(S,O.pick).margin||(0,O.propsByPrefix)("margin",this.props)||{}),this.configureComponents(this.chart,this.options(j.concat(P),O.without)),!this.props.configure||this.props.configure(this.chart),this.selection=m["default"].select(this.refs.svg).datum(this.props.datum).call(this.chart),this.resizeHandler||(this.resizeHandler=x["default"].utils.windowResize(this.chart.update)),t="pieChart"===this.props.type?this.chart.pie:this.chart,t.dispatch.on("renderEnd",this.renderEnd),this.rendering=!0,this.chart}},{key:"renderEnd",value:function(t){this.rendering=!1}},{key:"configureComponents",value:function(t,e){for(var n in e){var r=e[n];t&&((0,O.isPlainObject)(r)?this.configureComponents(t[n],r):"function"==typeof t[n]&&t[n](r))}}},{key:"options",value:function(t,e){var n=this.parsedProps.options||this.parsedProps||this.props.chartOptions;return(e=e||O.pick)(n,t)}},{key:"render",value:function(){return g["default"].createElement("div",{ref:"root",className:"nv-chart",style:this.props.containerStyle},g["default"].createElement("svg",(0,u["default"])({ref:"svg"},(0,O.pick)(this.props,w))))}}]),e}(g["default"].Component);e["default"]=M,t.exports=M},function(t,e,n){"use strict";var r=n(2)["default"];e["default"]=r||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},e.__esModule=!0},function(t,e,n){t.exports={"default":n(3),__esModule:!0}},function(t,e,n){n(4),t.exports=n(7).Object.assign},function(t,e,n){var r=n(5);r(r.S+r.F,"Object",{assign:n(10)})},function(t,e,n){var r=n(6),o=n(7),u=n(8),i="prototype",c=function(t,e,n){var s,f,a,p=t&c.F,l=t&c.G,d=t&c.S,h=t&c.P,y=t&c.B,v=t&c.W,g=l?o:o[e]||(o[e]={}),b=l?r:d?r[e]:(r[e]||{})[i];l&&(n=e);for(s in n)f=!p&&b&&s in b,f&&s in g||(a=f?b[s]:n[s],g[s]=l&&"function"!=typeof b[s]?n[s]:y&&f?u(a,r):v&&b[s]==a?function(t){var e=function(e){return this instanceof t?new t(e):t(e)};return e[i]=t[i],e}(a):h&&"function"==typeof a?u(Function.call,a):a,h&&((g[i]||(g[i]={}))[s]=a))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,t.exports=c},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){var n=t.exports={version:"1.2.6"};"number"==typeof __e&&(__e=n)},function(t,e,n){var r=n(9);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var r=n(11),o=n(12),u=n(14);t.exports=n(16)(function(){var t=Object.assign,e={},n={},r=Symbol(),o="abcdefghijklmnopqrst";return e[r]=7,o.split("").forEach(function(t){n[t]=t}),7!=t({},e)[r]||Object.keys(t({},n)).join("")!=o})?function(t,e){for(var n=o(t),i=arguments,c=i.length,s=1,f=r.getKeys,a=r.getSymbols,p=r.isEnum;c>s;)for(var l,d=u(i[s++]),h=a?f(d).concat(a(d)):f(d),y=h.length,v=0;y>v;)p.call(d,l=h[v++])&&(n[l]=d[l]);return n}:Object.assign},function(t,e){var n=Object;t.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},function(t,e,n){var r=n(13);t.exports=function(t){return Object(r(t))}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(15);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},function(t,e,n){t.exports={"default":n(18),__esModule:!0}},function(t,e,n){n(19),t.exports=n(7).Object.getPrototypeOf},function(t,e,n){var r=n(12);n(20)("getPrototypeOf",function(t){return function(e){return t(r(e))}})},function(t,e,n){var r=n(5),o=n(7),u=n(16);t.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],i={};i[t]=e(n),r(r.S+r.F*u(function(){n(1)}),"Object",i)}},function(t,e){"use strict";e["default"]=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e.__esModule=!0},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var o=n(23),u=r(o);e["default"]=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,u["default"])(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),e.__esModule=!0},function(t,e,n){t.exports={"default":n(24),__esModule:!0}},function(t,e,n){var r=n(11);t.exports=function(t,e,n){return r.setDesc(t,e,n)}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var o=n(26),u=r(o);e["default"]=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==("undefined"==typeof e?"undefined":(0,u["default"])(e))&&"function"!=typeof e?t:e},e.__esModule=!0},function(t,e,n){"use strict";var r=n(27)["default"];e["default"]=function(t){return t&&t.constructor===r?"symbol":typeof t},e.__esModule=!0},function(t,e,n){t.exports={"default":n(28),__esModule:!0}},function(t,e,n){n(29),n(47),t.exports=n(7).Symbol},function(t,e,n){"use strict";var r=n(11),o=n(6),u=n(30),i=n(31),c=n(5),s=n(32),f=n(16),a=n(35),p=n(36),l=n(38),d=n(37),h=n(39),y=n(41),v=n(42),g=n(43),b=n(44),m=n(40),_=n(34),x=r.getDesc,O=r.setDesc,j=r.create,w=y.get,S=o.Symbol,P=o.JSON,M=P&&P.stringify,E=!1,k=d("_hidden"),D=r.isEnum,F=a("symbol-registry"),N=a("symbols"),C="function"==typeof S,T=Object.prototype,q=i&&f(function(){return 7!=j(O({},"a",{get:function(){return O(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=x(T,e);r&&delete T[e],O(t,e,n),r&&t!==T&&O(T,e,r)}:O,z=function(t){var e=N[t]=j(S.prototype);return e._k=t,i&&E&&q(T,t,{configurable:!0,set:function(e){u(this,k)&&u(this[k],t)&&(this[k][t]=!1),q(this,t,_(1,e))}}),e},A=function(t){return"symbol"==typeof t},V=function(t,e,n){return n&&u(N,e)?(n.enumerable?(u(t,k)&&t[k][e]&&(t[k][e]=!1),n=j(n,{enumerable:_(0,!1)})):(u(t,k)||O(t,k,_(1,{})),t[k][e]=!0),q(t,e,n)):O(t,e,n)},W=function(t,e){b(t);for(var n,r=v(e=m(e)),o=0,u=r.length;u>o;)V(t,n=r[o++],e[n]);return t},B=function(t,e){return void 0===e?j(t):W(j(t),e)},G=function(t){var e=D.call(this,t);return e||!u(this,t)||!u(N,t)||u(this,k)&&this[k][t]?e:!0},H=function(t,e){var n=x(t=m(t),e);return!n||!u(N,e)||u(t,k)&&t[k][e]||(n.enumerable=!0),n},I=function(t){for(var e,n=w(m(t)),r=[],o=0;n.length>o;)u(N,e=n[o++])||e==k||r.push(e);return r},J=function(t){for(var e,n=w(m(t)),r=[],o=0;n.length>o;)u(N,e=n[o++])&&r.push(N[e]);return r},K=function(t){if(void 0!==t&&!A(t)){for(var e,n,r=[t],o=1,u=arguments;u.length>o;)r.push(u[o++]);return e=r[1],"function"==typeof e&&(n=e),(n||!g(e))&&(e=function(t,e){return n&&(e=n.call(this,t,e)),A(e)?void 0:e}),r[1]=e,M.apply(P,r)}},R=f(function(){var t=S();return"[null]"!=M([t])||"{}"!=M({a:t})||"{}"!=M(Object(t))});C||(S=function(){if(A(this))throw TypeError("Symbol is not a constructor");return z(l(arguments.length>0?arguments[0]:void 0))},s(S.prototype,"toString",function(){return this._k}),A=function(t){return t instanceof S},r.create=B,r.isEnum=G,r.getDesc=H,r.setDesc=V,r.setDescs=W,r.getNames=y.get=I,r.getSymbols=J,i&&!n(46)&&s(T,"propertyIsEnumerable",G,!0));var U={"for":function(t){return u(F,t+="")?F[t]:F[t]=S(t)},keyFor:function(t){return h(F,t)},useSetter:function(){E=!0},useSimple:function(){E=!1}};r.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),function(t){var e=d(t);U[t]=C?e:z(e)}),E=!0,c(c.G+c.W,{Symbol:S}),c(c.S,"Symbol",U),c(c.S+c.F*!C,"Object",{create:B,defineProperty:V,defineProperties:W,getOwnPropertyDescriptor:H,getOwnPropertyNames:I,getOwnPropertySymbols:J}),P&&c(c.S+c.F*(!C||R),"JSON",{stringify:K}),p(S,"Symbol"),p(Math,"Math",!0),p(o.JSON,"JSON",!0)},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){t.exports=!n(16)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){t.exports=n(33)},function(t,e,n){var r=n(11),o=n(34);t.exports=n(31)?function(t,e,n){return r.setDesc(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){var r=n(6),o="__core-js_shared__",u=r[o]||(r[o]={});t.exports=function(t){return u[t]||(u[t]={})}},function(t,e,n){var r=n(11).setDesc,o=n(30),u=n(37)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,u)&&r(t,u,{configurable:!0,value:e})}},function(t,e,n){var r=n(35)("wks"),o=n(38),u=n(6).Symbol;t.exports=function(t){return r[t]||(r[t]=u&&u[t]||(u||o)("Symbol."+t))}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e,n){var r=n(11),o=n(40);t.exports=function(t,e){for(var n,u=o(t),i=r.getKeys(u),c=i.length,s=0;c>s;)if(u[n=i[s++]]===e)return n}},function(t,e,n){var r=n(14),o=n(13);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(40),o=n(11).getNames,u={}.toString,i="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],c=function(t){try{return o(t)}catch(e){return i.slice()}};t.exports.get=function(t){return i&&"[object Window]"==u.call(t)?c(t):o(r(t))}},function(t,e,n){var r=n(11);t.exports=function(t){var e=r.getKeys(t),n=r.getSymbols;if(n)for(var o,u=n(t),i=r.isEnum,c=0;u.length>c;)i.call(t,o=u[c++])&&e.push(o);return e}},function(t,e,n){var r=n(15);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){var r=n(45);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){t.exports=!0},function(t,e){},function(t,e,n){"use strict";var r=n(49)["default"],o=n(51)["default"];e["default"]=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=r(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(o?o(t,e):t.__proto__=e)},e.__esModule=!0},function(t,e,n){t.exports={"default":n(50),__esModule:!0}},function(t,e,n){var r=n(11);t.exports=function(t,e){return r.create(t,e)}},function(t,e,n){t.exports={"default":n(52),__esModule:!0}},function(t,e,n){n(53),t.exports=n(7).Object.setPrototypeOf},function(t,e,n){var r=n(5);r(r.S,"Object",{setPrototypeOf:n(54).set})},function(t,e,n){var r=n(11).getDesc,o=n(45),u=n(44),i=function(t,e){if(u(t),!o(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,o){try{o=n(8)(Function.call,r(Object.prototype,"__proto__").set,2),o(t,[]),e=!(t instanceof Array)}catch(u){e=!0}return function(t,n){return i(t,n),e?t.__proto__=n:o(t,n),t}}({},!1):void 0),check:i}},function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){return t.indexOf(e)>=0}function u(t){return function(){return!t.apply(this,arguments)}}function i(t,e,n){for(var r={},o=(0,b["default"])(t),u=0,i=o.length;i>u;u++){var c=o[u],s=t[c];n(e,c)&&(r[c]=s)}return r}function c(t,e){return i(t,e,o)}function s(t,e){return i(t,e,u(o))}function f(t){if("object"==("undefined"==typeof t?"undefined":(0,v["default"])(t))&&null!==t){if("function"==typeof h["default"]){var e=(0,h["default"])(t);return e===Object.prototype||null===e}return"[object Object]"==Object.prototype.toString.call(t)}return!1}function a(t,e){var n,r,o;n=Array.isArray(t)?[]:{};for(o in t)r=t[o],"object"===("undefined"==typeof r?"undefined":(0,v["default"])(r))&&null!==r&&"function"!==r.type?n[o]=a(r,e):"function"===r.type?n[o]=e[r.name]:n[o]=r;return n}function p(t,e){return"function"==typeof t?t:function(n){return"undefined"!=typeof n[t]?n[t]:n[e]}}function l(t,e){return console.warn("Set margin with prefixes is deprecated use an object instead"),t+="-",(0,b["default"])(e).reduce(function(n,r){return r.substr(0,t.length)===t&&(n[r.replace(t,"")]=e[r]),n},{})}Object.defineProperty(e,"__esModule",{value:!0}),e.includes=o,e.negate=u,e.filterObject=i,e.pick=c,e.without=s,e.isPlainObject=f,e.bindFunctions=a,e.getValueFunction=p,e.propsByPrefix=l;var d=n(17),h=r(d),y=n(26),v=r(y),g=n(59),b=r(g)},function(t,e,n){t.exports={"default":n(60),__esModule:!0}},function(t,e,n){n(61),t.exports=n(7).Object.keys},function(t,e,n){var r=n(12);n(20)("keys",function(t){return function(e){return t(r(e))}})}])});
|
src/js/components/ui/InputNumberRange/InputNumberRange.js
|
nekuno/client
|
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { createSliderWithTooltip } from 'rc-slider';
import Slider from 'rc-slider';
const Range = createSliderWithTooltip(Slider.Range);
import styles from './InputNumberRange.scss';
import 'rc-slider/assets/index.css';
export default class InputNumberRange extends Component {
static propTypes = {
title : PropTypes.string,
value : PropTypes.array,
minNum: PropTypes.number.isRequired,
maxNum: PropTypes.number.isRequired,
onChangeHandler : PropTypes.func.isRequired,
color : PropTypes.string,
};
handleChangeRange(range) {
this.props.onChangeHandler(range);
}
render() {
const {value, minNum, maxNum, color} = this.props;
let rangeProps = {
marks: {[minNum]: minNum, [Math.round((maxNum + minNum) / 2)]: Math.round((maxNum + minNum) / 2), [maxNum]: maxNum},
min: minNum,
max: maxNum,
defaultValue: value,
// handleStyle: [{background: color, color: color, borderColor: color, boxShadow: 'none'}],
// trackStyle: [{background: color, color: color, borderColor: color}],
handleStyle: [{background: color, color: color, borderColor: color, boxShadow: 'none'}],
trackStyle: [{background: color, color: color, borderColor: color}],
dotStyle: {background: 'transparent', borderColor: 'transparent'},
activeDotStyle: {background: 'transparent', borderColor: 'transparent'},
onAfterChange: this.handleChangeRange.bind(this)
};
if (!value) {
rangeProps.value = [minNum, minNum];
}
return (
<div className={styles.inputNumberRange}>
<div className={styles.title + ' small'}>
{this.props.title}
</div>
<div className={styles.range}>
<Range {...rangeProps}/>
</div>
</div>
);
}
}
|
ajax/libs/react-instantsearch/5.3.1/Connectors.js
|
joeyparrish/cdnjs
|
/*! React InstantSearch 5.3.1 | © Algolia, inc. | https://community.algolia.com/react-instantsearch */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
(factory((global.ReactInstantSearch = global.ReactInstantSearch || {}, global.ReactInstantSearch.Connectors = {}),global.React));
}(this, (function (exports,React) { 'use strict';
var React__default = 'default' in React ? React['default'] : React;
var global$1 = (typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {});
// shim for using process in browser
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
var cachedSetTimeout = defaultSetTimout;
var cachedClearTimeout = defaultClearTimeout;
if (typeof global$1.setTimeout === 'function') {
cachedSetTimeout = setTimeout;
}
if (typeof global$1.clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
}
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
function nextTick(fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
}
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
var title = 'browser';
var platform = 'browser';
var browser = true;
var env = {};
var argv = [];
var version = ''; // empty string to avoid regexp issues
var versions = {};
var release = {};
var config = {};
function noop() {}
var on = noop;
var addListener = noop;
var once = noop;
var off = noop;
var removeListener = noop;
var removeAllListeners = noop;
var emit = noop;
function binding(name) {
throw new Error('process.binding is not supported');
}
function cwd () { return '/' }
function chdir (dir) {
throw new Error('process.chdir is not supported');
}function umask() { return 0; }
// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
var performance = global$1.performance || {};
var performanceNow =
performance.now ||
performance.mozNow ||
performance.msNow ||
performance.oNow ||
performance.webkitNow ||
function(){ return (new Date()).getTime() };
// generate timestamp or delta
// see http://nodejs.org/api/process.html#process_process_hrtime
function hrtime(previousTimestamp){
var clocktime = performanceNow.call(performance)*1e-3;
var seconds = Math.floor(clocktime);
var nanoseconds = Math.floor((clocktime%1)*1e9);
if (previousTimestamp) {
seconds = seconds - previousTimestamp[0];
nanoseconds = nanoseconds - previousTimestamp[1];
if (nanoseconds<0) {
seconds--;
nanoseconds += 1e9;
}
}
return [seconds,nanoseconds]
}
var startTime = new Date();
function uptime() {
var currentTime = new Date();
var dif = currentTime - startTime;
return dif / 1000;
}
var process = {
nextTick: nextTick,
title: title,
browser: browser,
env: env,
argv: argv,
version: version,
versions: versions,
on: on,
addListener: addListener,
once: once,
off: off,
removeListener: removeListener,
removeAllListeners: removeAllListeners,
emit: emit,
binding: binding,
cwd: cwd,
chdir: chdir,
umask: umask,
hrtime: hrtime,
platform: platform,
release: release,
config: config,
uptime: uptime
};
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
var emptyFunction_1 = emptyFunction;
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var validateFormat = function validateFormat(format) {};
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
var invariant_1 = invariant;
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
var factoryWithThrowingShims = function() {
function shim(props, propName, componentName, location, propFullName, secret) {
if (secret === ReactPropTypesSecret_1) {
// It is still safe when called from React.
return;
}
invariant_1(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
} shim.isRequired = shim;
function getShim() {
return shim;
} // Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim
};
ReactPropTypes.checkPropTypes = emptyFunction_1;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
var propTypes = createCommonjsModule(function (module) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
{
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = factoryWithThrowingShims();
}
});
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
var _listCacheClear = listCacheClear;
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
var eq_1 = eq;
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq_1(array[length][0], key)) {
return length;
}
}
return -1;
}
var _assocIndexOf = assocIndexOf;
/** Used for built-in method references. */
var arrayProto = Array.prototype;
/** Built-in value references. */
var splice = arrayProto.splice;
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = _assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
var _listCacheDelete = listCacheDelete;
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = _assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
var _listCacheGet = listCacheGet;
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return _assocIndexOf(this.__data__, key) > -1;
}
var _listCacheHas = listCacheHas;
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = _assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
var _listCacheSet = listCacheSet;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = _listCacheClear;
ListCache.prototype['delete'] = _listCacheDelete;
ListCache.prototype.get = _listCacheGet;
ListCache.prototype.has = _listCacheHas;
ListCache.prototype.set = _listCacheSet;
var _ListCache = ListCache;
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new _ListCache;
this.size = 0;
}
var _stackClear = stackClear;
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
var data = this.__data__,
result = data['delete'](key);
this.size = data.size;
return result;
}
var _stackDelete = stackDelete;
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
var _stackGet = stackGet;
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
var _stackHas = stackHas;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var _freeGlobal = freeGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = _freeGlobal || freeSelf || Function('return this')();
var _root = root;
/** Built-in value references. */
var Symbol$1 = _root.Symbol;
var _Symbol = Symbol$1;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Built-in value references. */
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty$1.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
} catch (e) {}
var result = nativeObjectToString.call(value);
{
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
var _getRawTag = getRawTag;
/** Used for built-in method references. */
var objectProto$1 = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$1 = objectProto$1.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString$1.call(value);
}
var _objectToString = objectToString;
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag$1 && symToStringTag$1 in Object(value))
? _getRawTag(value)
: _objectToString(value);
}
var _baseGetTag = baseGetTag;
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
var isObject_1 = isObject;
/** `Object#toString` result references. */
var asyncTag = '[object AsyncFunction]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
proxyTag = '[object Proxy]';
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
if (!isObject_1(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = _baseGetTag(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
var isFunction_1 = isFunction;
/** Used to detect overreaching core-js shims. */
var coreJsData = _root['__core-js_shared__'];
var _coreJsData = coreJsData;
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
var _isMasked = isMasked;
/** Used for built-in method references. */
var funcProto = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to convert.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
var _toSource = toSource;
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for built-in method references. */
var funcProto$1 = Function.prototype,
objectProto$2 = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString$1 = funcProto$1.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString$1.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject_1(value) || _isMasked(value)) {
return false;
}
var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
return pattern.test(_toSource(value));
}
var _baseIsNative = baseIsNative;
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
var _getValue = getValue;
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = _getValue(object, key);
return _baseIsNative(value) ? value : undefined;
}
var _getNative = getNative;
/* Built-in method references that are verified to be native. */
var Map = _getNative(_root, 'Map');
var _Map = Map;
/* Built-in method references that are verified to be native. */
var nativeCreate = _getNative(Object, 'create');
var _nativeCreate = nativeCreate;
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
this.size = 0;
}
var _hashClear = hashClear;
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}
var _hashDelete = hashDelete;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used for built-in method references. */
var objectProto$3 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (_nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
}
var _hashGet = hashGet;
/** Used for built-in method references. */
var objectProto$4 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$4.call(data, key);
}
var _hashHas = hashHas;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
return this;
}
var _hashSet = hashSet;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `Hash`.
Hash.prototype.clear = _hashClear;
Hash.prototype['delete'] = _hashDelete;
Hash.prototype.get = _hashGet;
Hash.prototype.has = _hashHas;
Hash.prototype.set = _hashSet;
var _Hash = Hash;
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.size = 0;
this.__data__ = {
'hash': new _Hash,
'map': new (_Map || _ListCache),
'string': new _Hash
};
}
var _mapCacheClear = mapCacheClear;
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
var _isKeyable = isKeyable;
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return _isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
var _getMapData = getMapData;
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = _getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}
var _mapCacheDelete = mapCacheDelete;
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return _getMapData(this, key).get(key);
}
var _mapCacheGet = mapCacheGet;
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return _getMapData(this, key).has(key);
}
var _mapCacheHas = mapCacheHas;
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
var data = _getMapData(this, key),
size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
var _mapCacheSet = mapCacheSet;
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `MapCache`.
MapCache.prototype.clear = _mapCacheClear;
MapCache.prototype['delete'] = _mapCacheDelete;
MapCache.prototype.get = _mapCacheGet;
MapCache.prototype.has = _mapCacheHas;
MapCache.prototype.set = _mapCacheSet;
var _MapCache = MapCache;
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof _ListCache) {
var pairs = data.__data__;
if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new _MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
var _stackSet = stackSet;
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new _ListCache(entries);
this.size = data.size;
}
// Add methods to `Stack`.
Stack.prototype.clear = _stackClear;
Stack.prototype['delete'] = _stackDelete;
Stack.prototype.get = _stackGet;
Stack.prototype.has = _stackHas;
Stack.prototype.set = _stackSet;
var _Stack = Stack;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED$2);
return this;
}
var _setCacheAdd = setCacheAdd;
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
var _setCacheHas = setCacheHas;
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
this.__data__ = new _MapCache;
while (++index < length) {
this.add(values[index]);
}
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = _setCacheAdd;
SetCache.prototype.has = _setCacheHas;
var _SetCache = SetCache;
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
var _arraySome = arraySome;
/**
* Checks if a `cache` value for `key` exists.
*
* @private
* @param {Object} cache The cache to query.
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function cacheHas(cache, key) {
return cache.has(key);
}
var _cacheHas = cacheHas;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new _SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!_arraySome(other, function(othValue, othIndex) {
if (!_cacheHas(seen, othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, bitmask, customizer, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
var _equalArrays = equalArrays;
/** Built-in value references. */
var Uint8Array = _root.Uint8Array;
var _Uint8Array = Uint8Array;
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
var _mapToArray = mapToArray;
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
var _setToArray = setToArray;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$1 = 1,
COMPARE_UNORDERED_FLAG$1 = 2;
/** `Object#toString` result references. */
var boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
mapTag = '[object Map]',
numberTag = '[object Number]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]';
/** Used to convert symbols to primitives and strings. */
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new _Uint8Array(object), new _Uint8Array(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq_1(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
case mapTag:
var convert = _mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1;
convert || (convert = _setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG$1;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = _equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
var _equalByTag = equalByTag;
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
var _arrayPush = arrayPush;
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
var isArray_1 = isArray;
/**
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Function} keysFunc The function to get the keys of `object`.
* @param {Function} symbolsFunc The function to get the symbols of `object`.
* @returns {Array} Returns the array of property names and symbols.
*/
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
}
var _baseGetAllKeys = baseGetAllKeys;
/**
* A specialized version of `_.filter` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
var _arrayFilter = arrayFilter;
/**
* This method returns a new empty array.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Array} Returns the new empty array.
* @example
*
* var arrays = _.times(2, _.stubArray);
*
* console.log(arrays);
* // => [[], []]
*
* console.log(arrays[0] === arrays[1]);
* // => false
*/
function stubArray() {
return [];
}
var stubArray_1 = stubArray;
/** Used for built-in method references. */
var objectProto$5 = Object.prototype;
/** Built-in value references. */
var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols;
/**
* Creates an array of the own enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbols = !nativeGetSymbols ? stubArray_1 : function(object) {
if (object == null) {
return [];
}
object = Object(object);
return _arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
var _getSymbols = getSymbols;
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
var _baseTimes = baseTimes;
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
var isObjectLike_1 = isObjectLike;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]';
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
}
var _baseIsArguments = baseIsArguments;
/** Used for built-in method references. */
var objectProto$6 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
/** Built-in value references. */
var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
return isObjectLike_1(value) && hasOwnProperty$5.call(value, 'callee') &&
!propertyIsEnumerable$1.call(value, 'callee');
};
var isArguments_1 = isArguments;
/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}
var stubFalse_1 = stubFalse;
var isBuffer_1 = createCommonjsModule(function (module, exports) {
/** Detect free variable `exports`. */
var freeExports = exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Built-in value references. */
var Buffer = moduleExports ? _root.Buffer : undefined;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = nativeIsBuffer || stubFalse_1;
module.exports = isBuffer;
});
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
var type = typeof value;
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(type == 'number' ||
(type != 'symbol' && reIsUint.test(value))) &&
(value > -1 && value % 1 == 0 && value < length);
}
var _isIndex = isIndex;
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER$1 = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
}
var isLength_1 = isLength;
/** `Object#toString` result references. */
var argsTag$1 = '[object Arguments]',
arrayTag = '[object Array]',
boolTag$1 = '[object Boolean]',
dateTag$1 = '[object Date]',
errorTag$1 = '[object Error]',
funcTag$1 = '[object Function]',
mapTag$1 = '[object Map]',
numberTag$1 = '[object Number]',
objectTag = '[object Object]',
regexpTag$1 = '[object RegExp]',
setTag$1 = '[object Set]',
stringTag$1 = '[object String]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag$1 = '[object ArrayBuffer]',
dataViewTag$1 = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] =
typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag$1] =
typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] =
typedArrayTags[mapTag$1] = typedArrayTags[numberTag$1] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag$1] =
typedArrayTags[setTag$1] = typedArrayTags[stringTag$1] =
typedArrayTags[weakMapTag] = false;
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike_1(value) &&
isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
}
var _baseIsTypedArray = baseIsTypedArray;
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}
var _baseUnary = baseUnary;
var _nodeUtil = createCommonjsModule(function (module, exports) {
/** Detect free variable `exports`. */
var freeExports = exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && _freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}());
module.exports = nodeUtil;
});
/* Node.js helper references. */
var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
var isTypedArray_1 = isTypedArray;
/** Used for built-in method references. */
var objectProto$7 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var isArr = isArray_1(value),
isArg = !isArr && isArguments_1(value),
isBuff = !isArr && !isArg && isBuffer_1(value),
isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? _baseTimes(value.length, String) : [],
length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty$6.call(value, key)) &&
!(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' ||
// Node.js 0.10 has enumerable non-index properties on buffers.
(isBuff && (key == 'offset' || key == 'parent')) ||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
// Skip index properties.
_isIndex(key, length)
))) {
result.push(key);
}
}
return result;
}
var _arrayLikeKeys = arrayLikeKeys;
/** Used for built-in method references. */
var objectProto$8 = Object.prototype;
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8;
return value === proto;
}
var _isPrototype = isPrototype;
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
var _overArg = overArg;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = _overArg(Object.keys, Object);
var _nativeKeys = nativeKeys;
/** Used for built-in method references. */
var objectProto$9 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!_isPrototype(object)) {
return _nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty$7.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
var _baseKeys = baseKeys;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength_1(value.length) && !isFunction_1(value);
}
var isArrayLike_1 = isArrayLike;
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
}
var keys_1 = keys;
/**
* Creates an array of own enumerable property names and symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeys(object) {
return _baseGetAllKeys(object, keys_1, _getSymbols);
}
var _getAllKeys = getAllKeys;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$2 = 1;
/** Used for built-in method references. */
var objectProto$a = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2,
objProps = _getAllKeys(object),
objLength = objProps.length,
othProps = _getAllKeys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty$8.call(other, key))) {
return false;
}
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}
var _equalObjects = equalObjects;
/* Built-in method references that are verified to be native. */
var DataView = _getNative(_root, 'DataView');
var _DataView = DataView;
/* Built-in method references that are verified to be native. */
var Promise$1 = _getNative(_root, 'Promise');
var _Promise = Promise$1;
/* Built-in method references that are verified to be native. */
var Set = _getNative(_root, 'Set');
var _Set = Set;
/* Built-in method references that are verified to be native. */
var WeakMap = _getNative(_root, 'WeakMap');
var _WeakMap = WeakMap;
/** `Object#toString` result references. */
var mapTag$2 = '[object Map]',
objectTag$1 = '[object Object]',
promiseTag = '[object Promise]',
setTag$2 = '[object Set]',
weakMapTag$1 = '[object WeakMap]';
var dataViewTag$2 = '[object DataView]';
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = _toSource(_DataView),
mapCtorString = _toSource(_Map),
promiseCtorString = _toSource(_Promise),
setCtorString = _toSource(_Set),
weakMapCtorString = _toSource(_WeakMap);
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = _baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
(_Map && getTag(new _Map) != mapTag$2) ||
(_Promise && getTag(_Promise.resolve()) != promiseTag) ||
(_Set && getTag(new _Set) != setTag$2) ||
(_WeakMap && getTag(new _WeakMap) != weakMapTag$1)) {
getTag = function(value) {
var result = _baseGetTag(value),
Ctor = result == objectTag$1 ? value.constructor : undefined,
ctorString = Ctor ? _toSource(Ctor) : '';
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag$2;
case mapCtorString: return mapTag$2;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag$2;
case weakMapCtorString: return weakMapTag$1;
}
}
return result;
};
}
var _getTag = getTag;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$3 = 1;
/** `Object#toString` result references. */
var argsTag$2 = '[object Arguments]',
arrayTag$1 = '[object Array]',
objectTag$2 = '[object Object]';
/** Used for built-in method references. */
var objectProto$b = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray_1(object),
othIsArr = isArray_1(other),
objTag = objIsArr ? arrayTag$1 : _getTag(object),
othTag = othIsArr ? arrayTag$1 : _getTag(other);
objTag = objTag == argsTag$2 ? objectTag$2 : objTag;
othTag = othTag == argsTag$2 ? objectTag$2 : othTag;
var objIsObj = objTag == objectTag$2,
othIsObj = othTag == objectTag$2,
isSameTag = objTag == othTag;
if (isSameTag && isBuffer_1(object)) {
if (!isBuffer_1(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new _Stack);
return (objIsArr || isTypedArray_1(object))
? _equalArrays(object, other, bitmask, customizer, equalFunc, stack)
: _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG$3)) {
var objIsWrapped = objIsObj && hasOwnProperty$9.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty$9.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new _Stack);
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new _Stack);
return _equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}
var _baseIsEqualDeep = baseIsEqualDeep;
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {boolean} bitmask The bitmask flags.
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Function} [customizer] The function to customize comparisons.
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObjectLike_1(value) && !isObjectLike_1(other))) {
return value !== value && other !== other;
}
return _baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
var _baseIsEqual = baseIsEqual;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$4 = 1,
COMPARE_UNORDERED_FLAG$2 = 2;
/**
* The base implementation of `_.isMatch` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
* @param {Array} matchData The property names, values, and compare flags to match.
* @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = Object(object);
while (index--) {
var data = matchData[index];
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var stack = new _Stack;
if (customizer) {
var result = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result === undefined
? _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$4 | COMPARE_UNORDERED_FLAG$2, customizer, stack)
: result
)) {
return false;
}
}
}
return true;
}
var _baseIsMatch = baseIsMatch;
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject_1(value);
}
var _isStrictComparable = isStrictComparable;
/**
* Gets the property names, values, and compare flags of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the match data of `object`.
*/
function getMatchData(object) {
var result = keys_1(object),
length = result.length;
while (length--) {
var key = result[length],
value = object[key];
result[length] = [key, value, _isStrictComparable(value)];
}
return result;
}
var _getMatchData = getMatchData;
/**
* A specialized version of `matchesProperty` for source values suitable
* for strict equality comparisons, i.e. `===`.
*
* @private
* @param {string} key The key of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
}
return object[key] === srcValue &&
(srcValue !== undefined || (key in Object(object)));
};
}
var _matchesStrictComparable = matchesStrictComparable;
/**
* The base implementation of `_.matches` which doesn't clone `source`.
*
* @private
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatches(source) {
var matchData = _getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return _matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || _baseIsMatch(object, source, matchData);
};
}
var _baseMatches = baseMatches;
/** `Object#toString` result references. */
var symbolTag$1 = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag$1);
}
var isSymbol_1 = isSymbol;
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/;
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray_1(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol_1(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object));
}
var _isKey = isKey;
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
* var other = { 'c': 3, 'd': 4 };
*
* var values = _.memoize(_.values);
* values(object);
* // => [1, 2]
*
* values(other);
* // => [3, 4]
*
* object.a = 2;
* values(object);
* // => [1, 2]
*
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);
* values(object);
* // => ['a', 'b']
*
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;
*/
function memoize(func, resolver) {
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result) || cache;
return result;
};
memoized.cache = new (memoize.Cache || _MapCache);
return memoized;
}
// Expose `MapCache`.
memoize.Cache = _MapCache;
var memoize_1 = memoize;
/** Used as the maximum memoize cache size. */
var MAX_MEMOIZE_SIZE = 500;
/**
* A specialized version of `_.memoize` which clears the memoized function's
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
*
* @private
* @param {Function} func The function to have its output memoized.
* @returns {Function} Returns the new memoized function.
*/
function memoizeCapped(func) {
var result = memoize_1(func, function(key) {
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}
return key;
});
var cache = result.cache;
return result;
}
var _memoizeCapped = memoizeCapped;
/** Used to match property names within property paths. */
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/**
* Converts `string` to a property path array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
var stringToPath = _memoizeCapped(function(string) {
var result = [];
if (string.charCodeAt(0) === 46 /* . */) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, subString) {
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
});
return result;
});
var _stringToPath = stringToPath;
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
var _arrayMap = arrayMap;
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/** Used to convert symbols to primitives and strings. */
var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,
symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined;
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isArray_1(value)) {
// Recursively convert values (susceptible to call stack limits).
return _arrayMap(value, baseToString) + '';
}
if (isSymbol_1(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
var _baseToString = baseToString;
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : _baseToString(value);
}
var toString_1 = toString;
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @param {Object} [object] The object to query keys on.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value, object) {
if (isArray_1(value)) {
return value;
}
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
}
var _castPath = castPath;
/** Used as references for various `Number` constants. */
var INFINITY$1 = 1 / 0;
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol_1(value)) {
return value;
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
}
var _toKey = toKey;
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = _castPath(path, object);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[_toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
var _baseGet = baseGet;
/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : _baseGet(object, path);
return result === undefined ? defaultValue : result;
}
var get_1 = get;
/**
* The base implementation of `_.hasIn` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHasIn(object, key) {
return object != null && key in Object(object);
}
var _baseHasIn = baseHasIn;
/**
* Checks if `path` exists on `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @param {Function} hasFunc The function to check properties.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
*/
function hasPath(object, path, hasFunc) {
path = _castPath(path, object);
var index = -1,
length = path.length,
result = false;
while (++index < length) {
var key = _toKey(path[index]);
if (!(result = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result || ++index != length) {
return result;
}
length = object == null ? 0 : object.length;
return !!length && isLength_1(length) && _isIndex(key, length) &&
(isArray_1(object) || isArguments_1(object));
}
var _hasPath = hasPath;
/**
* Checks if `path` is a direct or inherited property of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.hasIn(object, 'a');
* // => true
*
* _.hasIn(object, 'a.b');
* // => true
*
* _.hasIn(object, ['a', 'b']);
* // => true
*
* _.hasIn(object, 'b');
* // => false
*/
function hasIn(object, path) {
return object != null && _hasPath(object, path, _baseHasIn);
}
var hasIn_1 = hasIn;
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG$5 = 1,
COMPARE_UNORDERED_FLAG$3 = 2;
/**
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
*
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatchesProperty(path, srcValue) {
if (_isKey(path) && _isStrictComparable(srcValue)) {
return _matchesStrictComparable(_toKey(path), srcValue);
}
return function(object) {
var objValue = get_1(object, path);
return (objValue === undefined && objValue === srcValue)
? hasIn_1(object, path)
: _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$5 | COMPARE_UNORDERED_FLAG$3);
};
}
var _baseMatchesProperty = baseMatchesProperty;
/**
* This method returns the first argument it receives.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {*} value Any value.
* @returns {*} Returns `value`.
* @example
*
* var object = { 'a': 1 };
*
* console.log(_.identity(object) === object);
* // => true
*/
function identity(value) {
return value;
}
var identity_1 = identity;
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
var _baseProperty = baseProperty;
/**
* A specialized version of `baseProperty` which supports deep paths.
*
* @private
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyDeep(path) {
return function(object) {
return _baseGet(object, path);
};
}
var _basePropertyDeep = basePropertyDeep;
/**
* Creates a function that returns the value at `path` of a given object.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
* @example
*
* var objects = [
* { 'a': { 'b': 2 } },
* { 'a': { 'b': 1 } }
* ];
*
* _.map(objects, _.property('a.b'));
* // => [2, 1]
*
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
* // => [1, 2]
*/
function property(path) {
return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path);
}
var property_1 = property;
/**
* The base implementation of `_.iteratee`.
*
* @private
* @param {*} [value=_.identity] The value to convert to an iteratee.
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity_1;
}
if (typeof value == 'object') {
return isArray_1(value)
? _baseMatchesProperty(value[0], value[1])
: _baseMatches(value);
}
return property_1(value);
}
var _baseIteratee = baseIteratee;
/**
* Creates a `_.find` or `_.findLast` function.
*
* @private
* @param {Function} findIndexFunc The function to find the collection index.
* @returns {Function} Returns the new find function.
*/
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object(collection);
if (!isArrayLike_1(collection)) {
var iteratee = _baseIteratee(predicate, 3);
collection = keys_1(collection);
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
}
var index = findIndexFunc(collection, predicate, fromIndex);
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
};
}
var _createFind = createFind;
/**
* The base implementation of `_.findIndex` and `_.findLastIndex` without
* support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} predicate The function invoked per iteration.
* @param {number} fromIndex The index to search from.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while ((fromRight ? index-- : ++index < length)) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
var _baseFindIndex = baseFindIndex;
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/** Used to match leading and trailing whitespace. */
var reTrim = /^\s+|\s+$/g;
/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;
/** Used to detect octal string values. */
var reIsOctal = /^0o[0-7]+$/i;
/** Built-in method references without a dependency on `root`. */
var freeParseInt = parseInt;
/**
* Converts `value` to a number.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
* @example
*
* _.toNumber(3.2);
* // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
*
* _.toNumber(Infinity);
* // => Infinity
*
* _.toNumber('3.2');
* // => 3.2
*/
function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol_1(value)) {
return NAN;
}
if (isObject_1(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject_1(other) ? (other + '') : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = value.replace(reTrim, '');
var isBinary = reIsBinary.test(value);
return (isBinary || reIsOctal.test(value))
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
: (reIsBadHex.test(value) ? NAN : +value);
}
var toNumber_1 = toNumber;
/** Used as references for various `Number` constants. */
var INFINITY$2 = 1 / 0,
MAX_INTEGER = 1.7976931348623157e+308;
/**
* Converts `value` to a finite number.
*
* @static
* @memberOf _
* @since 4.12.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted number.
* @example
*
* _.toFinite(3.2);
* // => 3.2
*
* _.toFinite(Number.MIN_VALUE);
* // => 5e-324
*
* _.toFinite(Infinity);
* // => 1.7976931348623157e+308
*
* _.toFinite('3.2');
* // => 3.2
*/
function toFinite(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber_1(value);
if (value === INFINITY$2 || value === -INFINITY$2) {
var sign = (value < 0 ? -1 : 1);
return sign * MAX_INTEGER;
}
return value === value ? value : 0;
}
var toFinite_1 = toFinite;
/**
* Converts `value` to an integer.
*
* **Note:** This method is loosely based on
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
* @example
*
* _.toInteger(3.2);
* // => 3
*
* _.toInteger(Number.MIN_VALUE);
* // => 0
*
* _.toInteger(Infinity);
* // => 1.7976931348623157e+308
*
* _.toInteger('3.2');
* // => 3
*/
function toInteger(value) {
var result = toFinite_1(value),
remainder = result % 1;
return result === result ? (remainder ? result - remainder : result) : 0;
}
var toInteger_1 = toInteger;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* This method is like `_.find` except that it returns the index of the first
* element `predicate` returns truthy for instead of the element itself.
*
* @static
* @memberOf _
* @since 1.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* _.findIndex(users, function(o) { return o.user == 'barney'; });
* // => 0
*
* // The `_.matches` iteratee shorthand.
* _.findIndex(users, { 'user': 'fred', 'active': false });
* // => 1
*
* // The `_.matchesProperty` iteratee shorthand.
* _.findIndex(users, ['active', false]);
* // => 0
*
* // The `_.property` iteratee shorthand.
* _.findIndex(users, 'active');
* // => 2
*/
function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger_1(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return _baseFindIndex(array, _baseIteratee(predicate, 3), index);
}
var findIndex_1 = findIndex;
/**
* Iterates over elements of `collection`, returning the first element
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to inspect.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false },
* { 'user': 'pebbles', 'age': 1, 'active': true }
* ];
*
* _.find(users, function(o) { return o.age < 40; });
* // => object for 'barney'
*
* // The `_.matches` iteratee shorthand.
* _.find(users, { 'age': 1, 'active': true });
* // => object for 'pebbles'
*
* // The `_.matchesProperty` iteratee shorthand.
* _.find(users, ['active', false]);
* // => object for 'fred'
*
* // The `_.property` iteratee shorthand.
* _.find(users, 'active');
* // => object for 'barney'
*/
var find = _createFind(findIndex_1);
var find_1 = find;
/** `Object#toString` result references. */
var mapTag$3 = '[object Map]',
setTag$3 = '[object Set]';
/** Used for built-in method references. */
var objectProto$c = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$a = objectProto$c.hasOwnProperty;
/**
* Checks if `value` is an empty object, collection, map, or set.
*
* Objects are considered empty if they have no own enumerable string keyed
* properties.
*
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
* jQuery-like collections are considered empty if they have a `length` of `0`.
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
* @example
*
* _.isEmpty(null);
* // => true
*
* _.isEmpty(true);
* // => true
*
* _.isEmpty(1);
* // => true
*
* _.isEmpty([1, 2, 3]);
* // => false
*
* _.isEmpty({ 'a': 1 });
* // => false
*/
function isEmpty(value) {
if (value == null) {
return true;
}
if (isArrayLike_1(value) &&
(isArray_1(value) || typeof value == 'string' || typeof value.splice == 'function' ||
isBuffer_1(value) || isTypedArray_1(value) || isArguments_1(value))) {
return !value.length;
}
var tag = _getTag(value);
if (tag == mapTag$3 || tag == setTag$3) {
return !value.size;
}
if (_isPrototype(value)) {
return !_baseKeys(value).length;
}
for (var key in value) {
if (hasOwnProperty$a.call(value, key)) {
return false;
}
}
return true;
}
var isEmpty_1 = isEmpty;
/**
* A specialized version of `_.forEach` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
var _arrayEach = arrayEach;
var defineProperty = (function() {
try {
var func = _getNative(Object, 'defineProperty');
func({}, '', {});
return func;
} catch (e) {}
}());
var _defineProperty = defineProperty;
/**
* The base implementation of `assignValue` and `assignMergeValue` without
* value checks.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function baseAssignValue(object, key, value) {
if (key == '__proto__' && _defineProperty) {
_defineProperty(object, key, {
'configurable': true,
'enumerable': true,
'value': value,
'writable': true
});
} else {
object[key] = value;
}
}
var _baseAssignValue = baseAssignValue;
/** Used for built-in method references. */
var objectProto$d = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$b = objectProto$d.hasOwnProperty;
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty$b.call(object, key) && eq_1(objValue, value)) ||
(value === undefined && !(key in object))) {
_baseAssignValue(object, key, value);
}
}
var _assignValue = assignValue;
/**
* Copies properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy properties from.
* @param {Array} props The property identifiers to copy.
* @param {Object} [object={}] The object to copy properties to.
* @param {Function} [customizer] The function to customize copied values.
* @returns {Object} Returns `object`.
*/
function copyObject(source, props, object, customizer) {
var isNew = !object;
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
: undefined;
if (newValue === undefined) {
newValue = source[key];
}
if (isNew) {
_baseAssignValue(object, key, newValue);
} else {
_assignValue(object, key, newValue);
}
}
return object;
}
var _copyObject = copyObject;
/**
* The base implementation of `_.assign` without support for multiple sources
* or `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssign(object, source) {
return object && _copyObject(source, keys_1(source), object);
}
var _baseAssign = baseAssign;
/**
* This function is like
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* except that it includes inherited enumerable properties.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function nativeKeysIn(object) {
var result = [];
if (object != null) {
for (var key in Object(object)) {
result.push(key);
}
}
return result;
}
var _nativeKeysIn = nativeKeysIn;
/** Used for built-in method references. */
var objectProto$e = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$c = objectProto$e.hasOwnProperty;
/**
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeysIn(object) {
if (!isObject_1(object)) {
return _nativeKeysIn(object);
}
var isProto = _isPrototype(object),
result = [];
for (var key in object) {
if (!(key == 'constructor' && (isProto || !hasOwnProperty$c.call(object, key)))) {
result.push(key);
}
}
return result;
}
var _baseKeysIn = baseKeysIn;
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn$1(object) {
return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
}
var keysIn_1 = keysIn$1;
/**
* The base implementation of `_.assignIn` without support for multiple sources
* or `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssignIn(object, source) {
return object && _copyObject(source, keysIn_1(source), object);
}
var _baseAssignIn = baseAssignIn;
var _cloneBuffer = createCommonjsModule(function (module, exports) {
/** Detect free variable `exports`. */
var freeExports = exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Built-in value references. */
var Buffer = moduleExports ? _root.Buffer : undefined,
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
/**
* Creates a clone of `buffer`.
*
* @private
* @param {Buffer} buffer The buffer to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Buffer} Returns the cloned buffer.
*/
function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var length = buffer.length,
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
buffer.copy(result);
return result;
}
module.exports = cloneBuffer;
});
/**
* Copies the values of `source` to `array`.
*
* @private
* @param {Array} source The array to copy values from.
* @param {Array} [array=[]] The array to copy values to.
* @returns {Array} Returns `array`.
*/
function copyArray(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
var _copyArray = copyArray;
/**
* Copies own symbols of `source` to `object`.
*
* @private
* @param {Object} source The object to copy symbols from.
* @param {Object} [object={}] The object to copy symbols to.
* @returns {Object} Returns `object`.
*/
function copySymbols(source, object) {
return _copyObject(source, _getSymbols(source), object);
}
var _copySymbols = copySymbols;
/** Built-in value references. */
var getPrototype = _overArg(Object.getPrototypeOf, Object);
var _getPrototype = getPrototype;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
/**
* Creates an array of the own and inherited enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbolsIn = !nativeGetSymbols$1 ? stubArray_1 : function(object) {
var result = [];
while (object) {
_arrayPush(result, _getSymbols(object));
object = _getPrototype(object);
}
return result;
};
var _getSymbolsIn = getSymbolsIn;
/**
* Copies own and inherited symbols of `source` to `object`.
*
* @private
* @param {Object} source The object to copy symbols from.
* @param {Object} [object={}] The object to copy symbols to.
* @returns {Object} Returns `object`.
*/
function copySymbolsIn(source, object) {
return _copyObject(source, _getSymbolsIn(source), object);
}
var _copySymbolsIn = copySymbolsIn;
/**
* Creates an array of own and inherited enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeysIn(object) {
return _baseGetAllKeys(object, keysIn_1, _getSymbolsIn);
}
var _getAllKeysIn = getAllKeysIn;
/** Used for built-in method references. */
var objectProto$f = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$d = objectProto$f.hasOwnProperty;
/**
* Initializes an array clone.
*
* @private
* @param {Array} array The array to clone.
* @returns {Array} Returns the initialized clone.
*/
function initCloneArray(array) {
var length = array.length,
result = new array.constructor(length);
// Add properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty$d.call(array, 'index')) {
result.index = array.index;
result.input = array.input;
}
return result;
}
var _initCloneArray = initCloneArray;
/**
* Creates a clone of `arrayBuffer`.
*
* @private
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer.
*/
function cloneArrayBuffer(arrayBuffer) {
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
return result;
}
var _cloneArrayBuffer = cloneArrayBuffer;
/**
* Creates a clone of `dataView`.
*
* @private
* @param {Object} dataView The data view to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned data view.
*/
function cloneDataView(dataView, isDeep) {
var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer;
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
var _cloneDataView = cloneDataView;
/** Used to match `RegExp` flags from their coerced string values. */
var reFlags = /\w*$/;
/**
* Creates a clone of `regexp`.
*
* @private
* @param {Object} regexp The regexp to clone.
* @returns {Object} Returns the cloned regexp.
*/
function cloneRegExp(regexp) {
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
result.lastIndex = regexp.lastIndex;
return result;
}
var _cloneRegExp = cloneRegExp;
/** Used to convert symbols to primitives and strings. */
var symbolProto$2 = _Symbol ? _Symbol.prototype : undefined,
symbolValueOf$1 = symbolProto$2 ? symbolProto$2.valueOf : undefined;
/**
* Creates a clone of the `symbol` object.
*
* @private
* @param {Object} symbol The symbol object to clone.
* @returns {Object} Returns the cloned symbol object.
*/
function cloneSymbol(symbol) {
return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
}
var _cloneSymbol = cloneSymbol;
/**
* Creates a clone of `typedArray`.
*
* @private
* @param {Object} typedArray The typed array to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned typed array.
*/
function cloneTypedArray(typedArray, isDeep) {
var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
var _cloneTypedArray = cloneTypedArray;
/** `Object#toString` result references. */
var boolTag$2 = '[object Boolean]',
dateTag$2 = '[object Date]',
mapTag$4 = '[object Map]',
numberTag$2 = '[object Number]',
regexpTag$2 = '[object RegExp]',
setTag$4 = '[object Set]',
stringTag$2 = '[object String]',
symbolTag$2 = '[object Symbol]';
var arrayBufferTag$2 = '[object ArrayBuffer]',
dataViewTag$3 = '[object DataView]',
float32Tag$1 = '[object Float32Array]',
float64Tag$1 = '[object Float64Array]',
int8Tag$1 = '[object Int8Array]',
int16Tag$1 = '[object Int16Array]',
int32Tag$1 = '[object Int32Array]',
uint8Tag$1 = '[object Uint8Array]',
uint8ClampedTag$1 = '[object Uint8ClampedArray]',
uint16Tag$1 = '[object Uint16Array]',
uint32Tag$1 = '[object Uint32Array]';
/**
* Initializes an object clone based on its `toStringTag`.
*
* **Note:** This function only supports cloning values with tags of
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
*
* @private
* @param {Object} object The object to clone.
* @param {string} tag The `toStringTag` of the object to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag$2:
return _cloneArrayBuffer(object);
case boolTag$2:
case dateTag$2:
return new Ctor(+object);
case dataViewTag$3:
return _cloneDataView(object, isDeep);
case float32Tag$1: case float64Tag$1:
case int8Tag$1: case int16Tag$1: case int32Tag$1:
case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
return _cloneTypedArray(object, isDeep);
case mapTag$4:
return new Ctor;
case numberTag$2:
case stringTag$2:
return new Ctor(object);
case regexpTag$2:
return _cloneRegExp(object);
case setTag$4:
return new Ctor;
case symbolTag$2:
return _cloneSymbol(object);
}
}
var _initCloneByTag = initCloneByTag;
/** Built-in value references. */
var objectCreate = Object.create;
/**
* The base implementation of `_.create` without support for assigning
* properties to the created object.
*
* @private
* @param {Object} proto The object to inherit from.
* @returns {Object} Returns the new object.
*/
var baseCreate = (function() {
function object() {}
return function(proto) {
if (!isObject_1(proto)) {
return {};
}
if (objectCreate) {
return objectCreate(proto);
}
object.prototype = proto;
var result = new object;
object.prototype = undefined;
return result;
};
}());
var _baseCreate = baseCreate;
/**
* Initializes an object clone.
*
* @private
* @param {Object} object The object to clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneObject(object) {
return (typeof object.constructor == 'function' && !_isPrototype(object))
? _baseCreate(_getPrototype(object))
: {};
}
var _initCloneObject = initCloneObject;
/** `Object#toString` result references. */
var mapTag$5 = '[object Map]';
/**
* The base implementation of `_.isMap` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
*/
function baseIsMap(value) {
return isObjectLike_1(value) && _getTag(value) == mapTag$5;
}
var _baseIsMap = baseIsMap;
/* Node.js helper references. */
var nodeIsMap = _nodeUtil && _nodeUtil.isMap;
/**
* Checks if `value` is classified as a `Map` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
* @example
*
* _.isMap(new Map);
* // => true
*
* _.isMap(new WeakMap);
* // => false
*/
var isMap = nodeIsMap ? _baseUnary(nodeIsMap) : _baseIsMap;
var isMap_1 = isMap;
/** `Object#toString` result references. */
var setTag$5 = '[object Set]';
/**
* The base implementation of `_.isSet` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
*/
function baseIsSet(value) {
return isObjectLike_1(value) && _getTag(value) == setTag$5;
}
var _baseIsSet = baseIsSet;
/* Node.js helper references. */
var nodeIsSet = _nodeUtil && _nodeUtil.isSet;
/**
* Checks if `value` is classified as a `Set` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
* @example
*
* _.isSet(new Set);
* // => true
*
* _.isSet(new WeakSet);
* // => false
*/
var isSet = nodeIsSet ? _baseUnary(nodeIsSet) : _baseIsSet;
var isSet_1 = isSet;
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_FLAT_FLAG = 2,
CLONE_SYMBOLS_FLAG = 4;
/** `Object#toString` result references. */
var argsTag$3 = '[object Arguments]',
arrayTag$2 = '[object Array]',
boolTag$3 = '[object Boolean]',
dateTag$3 = '[object Date]',
errorTag$2 = '[object Error]',
funcTag$2 = '[object Function]',
genTag$1 = '[object GeneratorFunction]',
mapTag$6 = '[object Map]',
numberTag$3 = '[object Number]',
objectTag$3 = '[object Object]',
regexpTag$3 = '[object RegExp]',
setTag$6 = '[object Set]',
stringTag$3 = '[object String]',
symbolTag$3 = '[object Symbol]',
weakMapTag$2 = '[object WeakMap]';
var arrayBufferTag$3 = '[object ArrayBuffer]',
dataViewTag$4 = '[object DataView]',
float32Tag$2 = '[object Float32Array]',
float64Tag$2 = '[object Float64Array]',
int8Tag$2 = '[object Int8Array]',
int16Tag$2 = '[object Int16Array]',
int32Tag$2 = '[object Int32Array]',
uint8Tag$2 = '[object Uint8Array]',
uint8ClampedTag$2 = '[object Uint8ClampedArray]',
uint16Tag$2 = '[object Uint16Array]',
uint32Tag$2 = '[object Uint32Array]';
/** Used to identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
cloneableTags[argsTag$3] = cloneableTags[arrayTag$2] =
cloneableTags[arrayBufferTag$3] = cloneableTags[dataViewTag$4] =
cloneableTags[boolTag$3] = cloneableTags[dateTag$3] =
cloneableTags[float32Tag$2] = cloneableTags[float64Tag$2] =
cloneableTags[int8Tag$2] = cloneableTags[int16Tag$2] =
cloneableTags[int32Tag$2] = cloneableTags[mapTag$6] =
cloneableTags[numberTag$3] = cloneableTags[objectTag$3] =
cloneableTags[regexpTag$3] = cloneableTags[setTag$6] =
cloneableTags[stringTag$3] = cloneableTags[symbolTag$3] =
cloneableTags[uint8Tag$2] = cloneableTags[uint8ClampedTag$2] =
cloneableTags[uint16Tag$2] = cloneableTags[uint32Tag$2] = true;
cloneableTags[errorTag$2] = cloneableTags[funcTag$2] =
cloneableTags[weakMapTag$2] = false;
/**
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
* traversed objects.
*
* @private
* @param {*} value The value to clone.
* @param {boolean} bitmask The bitmask flags.
* 1 - Deep clone
* 2 - Flatten inherited properties
* 4 - Clone symbols
* @param {Function} [customizer] The function to customize cloning.
* @param {string} [key] The key of `value`.
* @param {Object} [object] The parent object of `value`.
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
* @returns {*} Returns the cloned value.
*/
function baseClone(value, bitmask, customizer, key, object, stack) {
var result,
isDeep = bitmask & CLONE_DEEP_FLAG,
isFlat = bitmask & CLONE_FLAT_FLAG,
isFull = bitmask & CLONE_SYMBOLS_FLAG;
if (customizer) {
result = object ? customizer(value, key, object, stack) : customizer(value);
}
if (result !== undefined) {
return result;
}
if (!isObject_1(value)) {
return value;
}
var isArr = isArray_1(value);
if (isArr) {
result = _initCloneArray(value);
if (!isDeep) {
return _copyArray(value, result);
}
} else {
var tag = _getTag(value),
isFunc = tag == funcTag$2 || tag == genTag$1;
if (isBuffer_1(value)) {
return _cloneBuffer(value, isDeep);
}
if (tag == objectTag$3 || tag == argsTag$3 || (isFunc && !object)) {
result = (isFlat || isFunc) ? {} : _initCloneObject(value);
if (!isDeep) {
return isFlat
? _copySymbolsIn(value, _baseAssignIn(result, value))
: _copySymbols(value, _baseAssign(result, value));
}
} else {
if (!cloneableTags[tag]) {
return object ? value : {};
}
result = _initCloneByTag(value, tag, isDeep);
}
}
// Check for circular references and return its corresponding clone.
stack || (stack = new _Stack);
var stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result);
if (isSet_1(value)) {
value.forEach(function(subValue) {
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
});
return result;
}
if (isMap_1(value)) {
value.forEach(function(subValue, key) {
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
return result;
}
var keysFunc = isFull
? (isFlat ? _getAllKeysIn : _getAllKeys)
: (isFlat ? keysIn : keys_1);
var props = isArr ? undefined : keysFunc(value);
_arrayEach(props || value, function(subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
}
// Recursively populate clone (susceptible to call stack limits).
_assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
return result;
}
var _baseClone = baseClone;
/**
* Gets the last element of `array`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the last element of `array`.
* @example
*
* _.last([1, 2, 3]);
* // => 3
*/
function last(array) {
var length = array == null ? 0 : array.length;
return length ? array[length - 1] : undefined;
}
var last_1 = last;
/**
* The base implementation of `_.slice` without an iteratee call guard.
*
* @private
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function baseSlice(array, start, end) {
var index = -1,
length = array.length;
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : ((end - start) >>> 0);
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}
var _baseSlice = baseSlice;
/**
* Gets the parent value at `path` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} path The path to get the parent value of.
* @returns {*} Returns the parent value.
*/
function parent(object, path) {
return path.length < 2 ? object : _baseGet(object, _baseSlice(path, 0, -1));
}
var _parent = parent;
/**
* The base implementation of `_.unset`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The property path to unset.
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
path = _castPath(path, object);
object = _parent(object, path);
return object == null || delete object[_toKey(last_1(path))];
}
var _baseUnset = baseUnset;
/** `Object#toString` result references. */
var objectTag$4 = '[object Object]';
/** Used for built-in method references. */
var funcProto$2 = Function.prototype,
objectProto$g = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString$2 = funcProto$2.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$e = objectProto$g.hasOwnProperty;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString$2.call(Object);
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag$4) {
return false;
}
var proto = _getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty$e.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString$2.call(Ctor) == objectCtorString;
}
var isPlainObject_1 = isPlainObject;
/**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects.
*
* @private
* @param {*} value The value to inspect.
* @param {string} key The key of the property to inspect.
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
*/
function customOmitClone(value) {
return isPlainObject_1(value) ? undefined : value;
}
var _customOmitClone = customOmitClone;
/** Built-in value references. */
var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;
/**
* Checks if `value` is a flattenable `arguments` object or array.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenable(value) {
return isArray_1(value) || isArguments_1(value) ||
!!(spreadableSymbol && value && value[spreadableSymbol]);
}
var _isFlattenable = isFlattenable;
/**
* The base implementation of `_.flatten` with support for restricting flattening.
*
* @private
* @param {Array} array The array to flatten.
* @param {number} depth The maximum recursion depth.
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
* @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
predicate || (predicate = _isFlattenable);
result || (result = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
_arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
var _baseFlatten = baseFlatten;
/**
* Flattens `array` a single level deep.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flatten([1, [2, [3, [4]], 5]]);
* // => [1, 2, [3, [4]], 5]
*/
function flatten(array) {
var length = array == null ? 0 : array.length;
return length ? _baseFlatten(array, 1) : [];
}
var flatten_1 = flatten;
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
var _apply = apply;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$1 = Math.max;
/**
* A specialized version of `baseRest` which transforms the rest array.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @param {Function} transform The rest array transform.
* @returns {Function} Returns the new function.
*/
function overRest(func, start, transform) {
start = nativeMax$1(start === undefined ? (func.length - 1) : start, 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax$1(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = transform(array);
return _apply(func, this, otherArgs);
};
}
var _overRest = overRest;
/**
* Creates a function that returns `value`.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {*} value The value to return from the new function.
* @returns {Function} Returns the new constant function.
* @example
*
* var objects = _.times(2, _.constant({ 'a': 1 }));
*
* console.log(objects);
* // => [{ 'a': 1 }, { 'a': 1 }]
*
* console.log(objects[0] === objects[1]);
* // => true
*/
function constant(value) {
return function() {
return value;
};
}
var constant_1 = constant;
/**
* The base implementation of `setToString` without support for hot loop shorting.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
return _defineProperty(func, 'toString', {
'configurable': true,
'enumerable': false,
'value': constant_1(string),
'writable': true
});
};
var _baseSetToString = baseSetToString;
/** Used to detect hot functions by number of calls within a span of milliseconds. */
var HOT_COUNT = 800,
HOT_SPAN = 16;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeNow = Date.now;
/**
* Creates a function that'll short out and invoke `identity` instead
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
* milliseconds.
*
* @private
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new shortable function.
*/
function shortOut(func) {
var count = 0,
lastCalled = 0;
return function() {
var stamp = nativeNow(),
remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return arguments[0];
}
} else {
count = 0;
}
return func.apply(undefined, arguments);
};
}
var _shortOut = shortOut;
/**
* Sets the `toString` method of `func` to return `string`.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var setToString = _shortOut(_baseSetToString);
var _setToString = setToString;
/**
* A specialized version of `baseRest` which flattens the rest array.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @returns {Function} Returns the new function.
*/
function flatRest(func) {
return _setToString(_overRest(func, undefined, flatten_1), func + '');
}
var _flatRest = flatRest;
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG$1 = 1,
CLONE_FLAT_FLAG$1 = 2,
CLONE_SYMBOLS_FLAG$1 = 4;
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted.
*
* **Note:** This method is considerably slower than `_.pick`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to omit.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
var omit = _flatRest(function(object, paths) {
var result = {};
if (object == null) {
return result;
}
var isDeep = false;
paths = _arrayMap(paths, function(path) {
path = _castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
_copyObject(object, _getAllKeysIn(object), result);
if (isDeep) {
result = _baseClone(result, CLONE_DEEP_FLAG$1 | CLONE_FLAT_FLAG$1 | CLONE_SYMBOLS_FLAG$1, _customOmitClone);
}
var length = paths.length;
while (length--) {
_baseUnset(result, paths[length]);
}
return result;
});
var omit_1 = omit;
/**
* The base implementation of `_.isNaN` without support for number objects.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
*/
function baseIsNaN(value) {
return value !== value;
}
var _baseIsNaN = baseIsNaN;
/**
* A specialized version of `_.indexOf` which performs strict equality
* comparisons of values, i.e. `===`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
var _strictIndexOf = strictIndexOf;
/**
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOf(array, value, fromIndex) {
return value === value
? _strictIndexOf(array, value, fromIndex)
: _baseFindIndex(array, _baseIsNaN, fromIndex);
}
var _baseIndexOf = baseIndexOf;
/**
* A specialized version of `_.includes` for arrays without support for
* specifying an index to search from.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && _baseIndexOf(array, value, 0) > -1;
}
var _arrayIncludes = arrayIncludes;
/**
* This function is like `arrayIncludes` except that it accepts a comparator.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @param {Function} comparator The comparator invoked per element.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
var _arrayIncludesWith = arrayIncludesWith;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min;
/**
* The base implementation of methods like `_.intersection`, without support
* for iteratee shorthands, that accepts an array of arrays to inspect.
*
* @private
* @param {Array} arrays The arrays to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of shared values.
*/
function baseIntersection(arrays, iteratee, comparator) {
var includes = comparator ? _arrayIncludesWith : _arrayIncludes,
length = arrays[0].length,
othLength = arrays.length,
othIndex = othLength,
caches = Array(othLength),
maxLength = Infinity,
result = [];
while (othIndex--) {
var array = arrays[othIndex];
if (othIndex && iteratee) {
array = _arrayMap(array, _baseUnary(iteratee));
}
maxLength = nativeMin(array.length, maxLength);
caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
? new _SetCache(othIndex && array)
: undefined;
}
array = arrays[0];
var index = -1,
seen = caches[0];
outer:
while (++index < length && result.length < maxLength) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (!(seen
? _cacheHas(seen, computed)
: includes(result, computed, comparator)
)) {
othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
if (!(cache
? _cacheHas(cache, computed)
: includes(arrays[othIndex], computed, comparator))
) {
continue outer;
}
}
if (seen) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
var _baseIntersection = baseIntersection;
/**
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
*/
function baseRest(func, start) {
return _setToString(_overRest(func, start, identity_1), func + '');
}
var _baseRest = baseRest;
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike_1(value) && isArrayLike_1(value);
}
var isArrayLikeObject_1 = isArrayLikeObject;
/**
* Casts `value` to an empty array if it's not an array like object.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array|Object} Returns the cast array-like object.
*/
function castArrayLikeObject(value) {
return isArrayLikeObject_1(value) ? value : [];
}
var _castArrayLikeObject = castArrayLikeObject;
/**
* Creates an array of unique values that are included in all given arrays
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. The order and references of result values are
* determined by the first array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of intersecting values.
* @example
*
* _.intersection([2, 1], [2, 3]);
* // => [2]
*/
var intersection = _baseRest(function(arrays) {
var mapped = _arrayMap(arrays, _castArrayLikeObject);
return (mapped.length && mapped[0] === arrays[0])
? _baseIntersection(mapped)
: [];
});
var intersection_1 = intersection;
/**
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var index = -1,
iterable = Object(object),
props = keysFunc(object),
length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
var _createBaseFor = createBaseFor;
/**
* The base implementation of `baseForOwn` which iterates over `object`
* properties returned by `keysFunc` and invokes `iteratee` for each property.
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseFor = _createBaseFor();
var _baseFor = baseFor;
/**
* The base implementation of `_.forOwn` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return object && _baseFor(object, iteratee, keys_1);
}
var _baseForOwn = baseForOwn;
/**
* Casts `value` to `identity` if it's not a function.
*
* @private
* @param {*} value The value to inspect.
* @returns {Function} Returns cast function.
*/
function castFunction(value) {
return typeof value == 'function' ? value : identity_1;
}
var _castFunction = castFunction;
/**
* Iterates over own enumerable string keyed properties of an object and
* invokes `iteratee` for each property. The iteratee is invoked with three
* arguments: (value, key, object). Iteratee functions may exit iteration
* early by explicitly returning `false`.
*
* @static
* @memberOf _
* @since 0.3.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns `object`.
* @see _.forOwnRight
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.forOwn(new Foo, function(value, key) {
* console.log(key);
* });
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forOwn(object, iteratee) {
return object && _baseForOwn(object, _castFunction(iteratee));
}
var forOwn_1 = forOwn;
/**
* Creates a `baseEach` or `baseEachRight` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee) {
if (collection == null) {
return collection;
}
if (!isArrayLike_1(collection)) {
return eachFunc(collection, iteratee);
}
var length = collection.length,
index = fromRight ? length : -1,
iterable = Object(collection);
while ((fromRight ? index-- : ++index < length)) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}
var _createBaseEach = createBaseEach;
/**
* The base implementation of `_.forEach` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
*/
var baseEach = _createBaseEach(_baseForOwn);
var _baseEach = baseEach;
/**
* Iterates over elements of `collection` and invokes `iteratee` for each element.
* The iteratee is invoked with three arguments: (value, index|key, collection).
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
* **Note:** As with other "Collections" methods, objects with a "length"
* property are iterated like arrays. To avoid this behavior use `_.forIn`
* or `_.forOwn` for object iteration.
*
* @static
* @memberOf _
* @since 0.1.0
* @alias each
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
* @see _.forEachRight
* @example
*
* _.forEach([1, 2], function(value) {
* console.log(value);
* });
* // => Logs `1` then `2`.
*
* _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
* console.log(key);
* });
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forEach(collection, iteratee) {
var func = isArray_1(collection) ? _arrayEach : _baseEach;
return func(collection, _castFunction(iteratee));
}
var forEach_1 = forEach;
/**
* The base implementation of `_.filter` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function baseFilter(collection, predicate) {
var result = [];
_baseEach(collection, function(value, index, collection) {
if (predicate(value, index, collection)) {
result.push(value);
}
});
return result;
}
var _baseFilter = baseFilter;
/**
* Iterates over elements of `collection`, returning an array of all elements
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
* **Note:** Unlike `_.remove`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.reject
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* _.filter(users, function(o) { return !o.active; });
* // => objects for ['fred']
*
* // The `_.matches` iteratee shorthand.
* _.filter(users, { 'age': 36, 'active': true });
* // => objects for ['barney']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.filter(users, ['active', false]);
* // => objects for ['fred']
*
* // The `_.property` iteratee shorthand.
* _.filter(users, 'active');
* // => objects for ['barney']
*/
function filter(collection, predicate) {
var func = isArray_1(collection) ? _arrayFilter : _baseFilter;
return func(collection, _baseIteratee(predicate, 3));
}
var filter_1 = filter;
/**
* The base implementation of `_.map` without support for iteratee shorthands.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function baseMap(collection, iteratee) {
var index = -1,
result = isArrayLike_1(collection) ? Array(collection.length) : [];
_baseEach(collection, function(value, key, collection) {
result[++index] = iteratee(value, key, collection);
});
return result;
}
var _baseMap = baseMap;
/**
* Creates an array of values by running each element in `collection` thru
* `iteratee`. The iteratee is invoked with three arguments:
* (value, index|key, collection).
*
* Many lodash methods are guarded to work as iteratees for methods like
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
*
* The guarded methods are:
* `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
* `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
* `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
* `template`, `trim`, `trimEnd`, `trimStart`, and `words`
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
* @example
*
* function square(n) {
* return n * n;
* }
*
* _.map([4, 8], square);
* // => [16, 64]
*
* _.map({ 'a': 4, 'b': 8 }, square);
* // => [16, 64] (iteration order is not guaranteed)
*
* var users = [
* { 'user': 'barney' },
* { 'user': 'fred' }
* ];
*
* // The `_.property` iteratee shorthand.
* _.map(users, 'user');
* // => ['barney', 'fred']
*/
function map(collection, iteratee) {
var func = isArray_1(collection) ? _arrayMap : _baseMap;
return func(collection, _baseIteratee(iteratee, 3));
}
var map_1 = map;
/**
* A specialized version of `_.reduce` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @param {boolean} [initAccum] Specify using the first element of `array` as
* the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1,
length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[++index];
}
while (++index < length) {
accumulator = iteratee(accumulator, array[index], index, array);
}
return accumulator;
}
var _arrayReduce = arrayReduce;
/**
* The base implementation of `_.reduce` and `_.reduceRight`, without support
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} accumulator The initial value.
* @param {boolean} initAccum Specify using the first or last element of
* `collection` as the initial value.
* @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the accumulated value.
*/
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
eachFunc(collection, function(value, index, collection) {
accumulator = initAccum
? (initAccum = false, value)
: iteratee(accumulator, value, index, collection);
});
return accumulator;
}
var _baseReduce = baseReduce;
/**
* Reduces `collection` to a value which is the accumulated result of running
* each element in `collection` thru `iteratee`, where each successive
* invocation is supplied the return value of the previous. If `accumulator`
* is not given, the first element of `collection` is used as the initial
* value. The iteratee is invoked with four arguments:
* (accumulator, value, index|key, collection).
*
* Many lodash methods are guarded to work as iteratees for methods like
* `_.reduce`, `_.reduceRight`, and `_.transform`.
*
* The guarded methods are:
* `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
* and `sortBy`
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @returns {*} Returns the accumulated value.
* @see _.reduceRight
* @example
*
* _.reduce([1, 2], function(sum, n) {
* return sum + n;
* }, 0);
* // => 3
*
* _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
* (result[value] || (result[value] = [])).push(key);
* return result;
* }, {});
* // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
*/
function reduce(collection, iteratee, accumulator) {
var func = isArray_1(collection) ? _arrayReduce : _baseReduce,
initAccum = arguments.length < 3;
return func(collection, _baseIteratee(iteratee, 4), accumulator, initAccum, _baseEach);
}
var reduce_1 = reduce;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$2 = Math.max;
/**
* Gets the index at which the first occurrence of `value` is found in `array`
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. If `fromIndex` is negative, it's used as the
* offset from the end of `array`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
* @example
*
* _.indexOf([1, 2, 1, 2], 2);
* // => 1
*
* // Search from the `fromIndex`.
* _.indexOf([1, 2, 1, 2], 2, 2);
* // => 3
*/
function indexOf(array, value, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger_1(fromIndex);
if (index < 0) {
index = nativeMax$2(length + index, 0);
}
return _baseIndexOf(array, value, index);
}
var indexOf_1 = indexOf;
/** `Object#toString` result references. */
var numberTag$4 = '[object Number]';
/**
* Checks if `value` is classified as a `Number` primitive or object.
*
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
* classified as numbers, use the `_.isFinite` method.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a number, else `false`.
* @example
*
* _.isNumber(3);
* // => true
*
* _.isNumber(Number.MIN_VALUE);
* // => true
*
* _.isNumber(Infinity);
* // => true
*
* _.isNumber('3');
* // => false
*/
function isNumber(value) {
return typeof value == 'number' ||
(isObjectLike_1(value) && _baseGetTag(value) == numberTag$4);
}
var isNumber_1 = isNumber;
/**
* Checks if `value` is `NaN`.
*
* **Note:** This method is based on
* [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
* global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
* `undefined` and other non-number values.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
* @example
*
* _.isNaN(NaN);
* // => true
*
* _.isNaN(new Number(NaN));
* // => true
*
* isNaN(undefined);
* // => true
*
* _.isNaN(undefined);
* // => false
*/
function isNaN$1(value) {
// An `NaN` primitive is the only value that is not equal to itself.
// Perform the `toStringTag` check first to avoid errors with some
// ActiveX objects in IE.
return isNumber_1(value) && value != +value;
}
var _isNaN = isNaN$1;
/**
* Performs a deep comparison between two values to determine if they are
* equivalent.
*
* **Note:** This method supports comparing arrays, array buffers, booleans,
* date objects, error objects, maps, numbers, `Object` objects, regexes,
* sets, strings, symbols, and typed arrays. `Object` objects are compared
* by their own, not inherited, enumerable properties. Functions and DOM
* nodes are compared by strict equality, i.e. `===`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
*
* object === other;
* // => false
*/
function isEqual(value, other) {
return _baseIsEqual(value, other);
}
var isEqual_1 = isEqual;
/**
* Checks if `value` is `undefined`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
* @example
*
* _.isUndefined(void 0);
* // => true
*
* _.isUndefined(null);
* // => false
*/
function isUndefined(value) {
return value === undefined;
}
var isUndefined_1 = isUndefined;
/** `Object#toString` result references. */
var stringTag$4 = '[object String]';
/**
* Checks if `value` is classified as a `String` primitive or object.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
* @example
*
* _.isString('abc');
* // => true
*
* _.isString(1);
* // => false
*/
function isString(value) {
return typeof value == 'string' ||
(!isArray_1(value) && isObjectLike_1(value) && _baseGetTag(value) == stringTag$4);
}
var isString_1 = isString;
/**
* Casts `array` to a slice if it's needed.
*
* @private
* @param {Array} array The array to inspect.
* @param {number} start The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the cast slice.
*/
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined ? length : end;
return (!start && end >= length) ? array : _baseSlice(array, start, end);
}
var _castSlice = castSlice;
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the last unmatched string symbol.
*/
function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && _baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
var _charsEndIndex = charsEndIndex;
/**
* Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
* that is not found in the character symbols.
*
* @private
* @param {Array} strSymbols The string symbols to inspect.
* @param {Array} chrSymbols The character symbols to find.
* @returns {number} Returns the index of the first unmatched string symbol.
*/
function charsStartIndex(strSymbols, chrSymbols) {
var index = -1,
length = strSymbols.length;
while (++index < length && _baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
return index;
}
var _charsStartIndex = charsStartIndex;
/**
* Converts an ASCII `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function asciiToArray(string) {
return string.split('');
}
var _asciiToArray = asciiToArray;
/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
rsComboMarksRange = '\\u0300-\\u036f',
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
rsComboSymbolsRange = '\\u20d0-\\u20ff',
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
rsVarRange = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */
var rsZWJ = '\\u200d';
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
/**
* Checks if `string` contains Unicode symbols.
*
* @private
* @param {string} string The string to inspect.
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
*/
function hasUnicode(string) {
return reHasUnicode.test(string);
}
var _hasUnicode = hasUnicode;
/** Used to compose unicode character classes. */
var rsAstralRange$1 = '\\ud800-\\udfff',
rsComboMarksRange$1 = '\\u0300-\\u036f',
reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
rsVarRange$1 = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */
var rsAstral = '[' + rsAstralRange$1 + ']',
rsCombo = '[' + rsComboRange$1 + ']',
rsFitz = '\\ud83c[\\udffb-\\udfff]',
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
rsNonAstral = '[^' + rsAstralRange$1 + ']',
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
rsZWJ$1 = '\\u200d';
/** Used to compose unicode regexes. */
var reOptMod = rsModifier + '?',
rsOptVar = '[' + rsVarRange$1 + ']?',
rsOptJoin = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
rsSeq = rsOptVar + reOptMod + rsOptJoin,
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
/**
* Converts a Unicode `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function unicodeToArray(string) {
return string.match(reUnicode) || [];
}
var _unicodeToArray = unicodeToArray;
/**
* Converts `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function stringToArray(string) {
return _hasUnicode(string)
? _unicodeToArray(string)
: _asciiToArray(string);
}
var _stringToArray = stringToArray;
/** Used to match leading and trailing whitespace. */
var reTrim$1 = /^\s+|\s+$/g;
/**
* Removes leading and trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
* _.trim(' abc ');
* // => 'abc'
*
* _.trim('-_-abc-_-', '_-');
* // => 'abc'
*
* _.map([' foo ', ' bar '], _.trim);
* // => ['foo', 'bar']
*/
function trim(string, chars, guard) {
string = toString_1(string);
if (string && (guard || chars === undefined)) {
return string.replace(reTrim$1, '');
}
if (!string || !(chars = _baseToString(chars))) {
return string;
}
var strSymbols = _stringToArray(string),
chrSymbols = _stringToArray(chars),
start = _charsStartIndex(strSymbols, chrSymbols),
end = _charsEndIndex(strSymbols, chrSymbols) + 1;
return _castSlice(strSymbols, start, end).join('');
}
var trim_1 = trim;
/**
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
* else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject_1(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike_1(object) && _isIndex(index, object.length))
: (type == 'string' && index in object)
) {
return eq_1(object[index], value);
}
return false;
}
var _isIterateeCall = isIterateeCall;
/** Used for built-in method references. */
var objectProto$h = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$f = objectProto$h.hasOwnProperty;
/**
* Assigns own and inherited enumerable string keyed properties of source
* objects to the destination object for all destination properties that
* resolve to `undefined`. Source objects are applied from left to right.
* Once a property is set, additional values of the same property are ignored.
*
* **Note:** This method mutates `object`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.defaultsDeep
* @example
*
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var defaults = _baseRest(function(object, sources) {
object = Object(object);
var index = -1;
var length = sources.length;
var guard = length > 2 ? sources[2] : undefined;
if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
length = 1;
}
while (++index < length) {
var source = sources[index];
var props = keysIn_1(source);
var propsIndex = -1;
var propsLength = props.length;
while (++propsIndex < propsLength) {
var key = props[propsIndex];
var value = object[key];
if (value === undefined ||
(eq_1(value, objectProto$h[key]) && !hasOwnProperty$f.call(object, key))) {
object[key] = source[key];
}
}
}
return object;
});
var defaults_1 = defaults;
/**
* This function is like `assignValue` except that it doesn't assign
* `undefined` values.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignMergeValue(object, key, value) {
if ((value !== undefined && !eq_1(object[key], value)) ||
(value === undefined && !(key in object))) {
_baseAssignValue(object, key, value);
}
}
var _assignMergeValue = assignMergeValue;
/**
* Gets the value at `key`, unless `key` is "__proto__".
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function safeGet(object, key) {
return key == '__proto__'
? undefined
: object[key];
}
var _safeGet = safeGet;
/**
* Converts `value` to a plain object flattening inherited enumerable string
* keyed properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
* @example
*
* function Foo() {
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.assign({ 'a': 1 }, new Foo);
* // => { 'a': 1, 'b': 2 }
*
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
* // => { 'a': 1, 'b': 2, 'c': 3 }
*/
function toPlainObject(value) {
return _copyObject(value, keysIn_1(value));
}
var toPlainObject_1 = toPlainObject;
/**
* A specialized version of `baseMerge` for arrays and objects which performs
* deep merges and tracks traversed objects enabling objects with circular
* references to be merged.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {string} key The key of the value to merge.
* @param {number} srcIndex The index of `source`.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize assigned values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = _safeGet(object, key),
srcValue = _safeGet(source, key),
stacked = stack.get(srcValue);
if (stacked) {
_assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer
? customizer(objValue, srcValue, (key + ''), object, source, stack)
: undefined;
var isCommon = newValue === undefined;
if (isCommon) {
var isArr = isArray_1(srcValue),
isBuff = !isArr && isBuffer_1(srcValue),
isTyped = !isArr && !isBuff && isTypedArray_1(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {
if (isArray_1(objValue)) {
newValue = objValue;
}
else if (isArrayLikeObject_1(objValue)) {
newValue = _copyArray(objValue);
}
else if (isBuff) {
isCommon = false;
newValue = _cloneBuffer(srcValue, true);
}
else if (isTyped) {
isCommon = false;
newValue = _cloneTypedArray(srcValue, true);
}
else {
newValue = [];
}
}
else if (isPlainObject_1(srcValue) || isArguments_1(srcValue)) {
newValue = objValue;
if (isArguments_1(objValue)) {
newValue = toPlainObject_1(objValue);
}
else if (!isObject_1(objValue) || (srcIndex && isFunction_1(objValue))) {
newValue = _initCloneObject(srcValue);
}
}
else {
isCommon = false;
}
}
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack['delete'](srcValue);
}
_assignMergeValue(object, key, newValue);
}
var _baseMergeDeep = baseMergeDeep;
/**
* The base implementation of `_.merge` without support for multiple sources.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {number} srcIndex The index of `source`.
* @param {Function} [customizer] The function to customize merged values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
_baseFor(source, function(srcValue, key) {
if (isObject_1(srcValue)) {
stack || (stack = new _Stack);
_baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
}
else {
var newValue = customizer
? customizer(_safeGet(object, key), srcValue, (key + ''), object, source, stack)
: undefined;
if (newValue === undefined) {
newValue = srcValue;
}
_assignMergeValue(object, key, newValue);
}
}, keysIn_1);
}
var _baseMerge = baseMerge;
/**
* Creates a function like `_.assign`.
*
* @private
* @param {Function} assigner The function to assign values.
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
return _baseRest(function(object, sources) {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined,
guard = length > 2 ? sources[2] : undefined;
customizer = (assigner.length > 3 && typeof customizer == 'function')
? (length--, customizer)
: undefined;
if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined : customizer;
length = 1;
}
object = Object(object);
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, index, customizer);
}
}
return object;
});
}
var _createAssigner = createAssigner;
/**
* This method is like `_.assign` except that it recursively merges own and
* inherited enumerable string keyed properties of source objects into the
* destination object. Source properties that resolve to `undefined` are
* skipped if a destination value exists. Array and plain object properties
* are merged recursively. Other objects and value types are overridden by
* assignment. Source objects are applied from left to right. Subsequent
* sources overwrite property assignments of previous sources.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 0.5.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @example
*
* var object = {
* 'a': [{ 'b': 2 }, { 'd': 4 }]
* };
*
* var other = {
* 'a': [{ 'c': 3 }, { 'e': 5 }]
* };
*
* _.merge(object, other);
* // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
*/
var merge = _createAssigner(function(object, source, srcIndex) {
_baseMerge(object, source, srcIndex);
});
var merge_1 = merge;
function valToNumber(v) {
if (isNumber_1(v)) {
return v;
} else if (isString_1(v)) {
return parseFloat(v);
} else if (Array.isArray(v)) {
return map_1(v, valToNumber);
}
throw new Error('The value should be a number, a parseable string or an array of those.');
}
var valToNumber_1 = valToNumber;
function filterState(state, filters) {
var partialState = {};
var attributeFilters = filter_1(filters, function(f) { return f.indexOf('attribute:') !== -1; });
var attributes = map_1(attributeFilters, function(aF) { return aF.split(':')[1]; });
if (indexOf_1(attributes, '*') === -1) {
forEach_1(attributes, function(attr) {
if (state.isConjunctiveFacet(attr) && state.isFacetRefined(attr)) {
if (!partialState.facetsRefinements) partialState.facetsRefinements = {};
partialState.facetsRefinements[attr] = state.facetsRefinements[attr];
}
if (state.isDisjunctiveFacet(attr) && state.isDisjunctiveFacetRefined(attr)) {
if (!partialState.disjunctiveFacetsRefinements) partialState.disjunctiveFacetsRefinements = {};
partialState.disjunctiveFacetsRefinements[attr] = state.disjunctiveFacetsRefinements[attr];
}
if (state.isHierarchicalFacet(attr) && state.isHierarchicalFacetRefined(attr)) {
if (!partialState.hierarchicalFacetsRefinements) partialState.hierarchicalFacetsRefinements = {};
partialState.hierarchicalFacetsRefinements[attr] = state.hierarchicalFacetsRefinements[attr];
}
var numericRefinements = state.getNumericRefinements(attr);
if (!isEmpty_1(numericRefinements)) {
if (!partialState.numericRefinements) partialState.numericRefinements = {};
partialState.numericRefinements[attr] = state.numericRefinements[attr];
}
});
} else {
if (!isEmpty_1(state.numericRefinements)) {
partialState.numericRefinements = state.numericRefinements;
}
if (!isEmpty_1(state.facetsRefinements)) partialState.facetsRefinements = state.facetsRefinements;
if (!isEmpty_1(state.disjunctiveFacetsRefinements)) {
partialState.disjunctiveFacetsRefinements = state.disjunctiveFacetsRefinements;
}
if (!isEmpty_1(state.hierarchicalFacetsRefinements)) {
partialState.hierarchicalFacetsRefinements = state.hierarchicalFacetsRefinements;
}
}
var searchParameters = filter_1(
filters,
function(f) {
return f.indexOf('attribute:') === -1;
}
);
forEach_1(
searchParameters,
function(parameterKey) {
partialState[parameterKey] = state[parameterKey];
}
);
return partialState;
}
var filterState_1 = filterState;
/**
* Functions to manipulate refinement lists
*
* The RefinementList is not formally defined through a prototype but is based
* on a specific structure.
*
* @module SearchParameters.refinementList
*
* @typedef {string[]} SearchParameters.refinementList.Refinements
* @typedef {Object.<string, SearchParameters.refinementList.Refinements>} SearchParameters.refinementList.RefinementList
*/
var lib = {
/**
* Adds a refinement to a RefinementList
* @param {RefinementList} refinementList the initial list
* @param {string} attribute the attribute to refine
* @param {string} value the value of the refinement, if the value is not a string it will be converted
* @return {RefinementList} a new and updated refinement list
*/
addRefinement: function addRefinement(refinementList, attribute, value) {
if (lib.isRefined(refinementList, attribute, value)) {
return refinementList;
}
var valueAsString = '' + value;
var facetRefinement = !refinementList[attribute] ?
[valueAsString] :
refinementList[attribute].concat(valueAsString);
var mod = {};
mod[attribute] = facetRefinement;
return defaults_1({}, mod, refinementList);
},
/**
* Removes refinement(s) for an attribute:
* - if the value is specified removes the refinement for the value on the attribute
* - if no value is specified removes all the refinements for this attribute
* @param {RefinementList} refinementList the initial list
* @param {string} attribute the attribute to refine
* @param {string} [value] the value of the refinement
* @return {RefinementList} a new and updated refinement lst
*/
removeRefinement: function removeRefinement(refinementList, attribute, value) {
if (isUndefined_1(value)) {
return lib.clearRefinement(refinementList, attribute);
}
var valueAsString = '' + value;
return lib.clearRefinement(refinementList, function(v, f) {
return attribute === f && valueAsString === v;
});
},
/**
* Toggles the refinement value for an attribute.
* @param {RefinementList} refinementList the initial list
* @param {string} attribute the attribute to refine
* @param {string} value the value of the refinement
* @return {RefinementList} a new and updated list
*/
toggleRefinement: function toggleRefinement(refinementList, attribute, value) {
if (isUndefined_1(value)) throw new Error('toggleRefinement should be used with a value');
if (lib.isRefined(refinementList, attribute, value)) {
return lib.removeRefinement(refinementList, attribute, value);
}
return lib.addRefinement(refinementList, attribute, value);
},
/**
* Clear all or parts of a RefinementList. Depending on the arguments, three
* kinds of behavior can happen:
* - if no attribute is provided: clears the whole list
* - if an attribute is provided as a string: clears the list for the specific attribute
* - if an attribute is provided as a function: discards the elements for which the function returns true
* @param {RefinementList} refinementList the initial list
* @param {string} [attribute] the attribute or function to discard
* @param {string} [refinementType] optional parameter to give more context to the attribute function
* @return {RefinementList} a new and updated refinement list
*/
clearRefinement: function clearRefinement(refinementList, attribute, refinementType) {
if (isUndefined_1(attribute)) {
if (isEmpty_1(refinementList)) return refinementList;
return {};
} else if (isString_1(attribute)) {
if (isEmpty_1(refinementList[attribute])) return refinementList;
return omit_1(refinementList, attribute);
} else if (isFunction_1(attribute)) {
var hasChanged = false;
var newRefinementList = reduce_1(refinementList, function(memo, values, key) {
var facetList = filter_1(values, function(value) {
return !attribute(value, key, refinementType);
});
if (!isEmpty_1(facetList)) {
if (facetList.length !== values.length) hasChanged = true;
memo[key] = facetList;
}
else hasChanged = true;
return memo;
}, {});
if (hasChanged) return newRefinementList;
return refinementList;
}
},
/**
* Test if the refinement value is used for the attribute. If no refinement value
* is provided, test if the refinementList contains any refinement for the
* given attribute.
* @param {RefinementList} refinementList the list of refinement
* @param {string} attribute name of the attribute
* @param {string} [refinementValue] value of the filter/refinement
* @return {boolean}
*/
isRefined: function isRefined(refinementList, attribute, refinementValue) {
var indexOf = indexOf_1;
var containsRefinements = !!refinementList[attribute] &&
refinementList[attribute].length > 0;
if (isUndefined_1(refinementValue) || !containsRefinements) {
return containsRefinements;
}
var refinementValueAsString = '' + refinementValue;
return indexOf(refinementList[attribute], refinementValueAsString) !== -1;
}
};
var RefinementList = lib;
/**
* like _.find but using _.isEqual to be able to use it
* to find arrays.
* @private
* @param {any[]} array array to search into
* @param {any} searchedValue the value we're looking for
* @return {any} the searched value or undefined
*/
function findArray(array, searchedValue) {
return find_1(array, function(currentValue) {
return isEqual_1(currentValue, searchedValue);
});
}
/**
* The facet list is the structure used to store the list of values used to
* filter a single attribute.
* @typedef {string[]} SearchParameters.FacetList
*/
/**
* Structure to store numeric filters with the operator as the key. The supported operators
* are `=`, `>`, `<`, `>=`, `<=` and `!=`.
* @typedef {Object.<string, Array.<number|number[]>>} SearchParameters.OperatorList
*/
/**
* SearchParameters is the data structure that contains all the information
* usable for making a search to Algolia API. It doesn't do the search itself,
* nor does it contains logic about the parameters.
* It is an immutable object, therefore it has been created in a way that each
* changes does not change the object itself but returns a copy with the
* modification.
* This object should probably not be instantiated outside of the helper. It will
* be provided when needed. This object is documented for reference as you'll
* get it from events generated by the {@link AlgoliaSearchHelper}.
* If need be, instantiate the Helper from the factory function {@link SearchParameters.make}
* @constructor
* @classdesc contains all the parameters of a search
* @param {object|SearchParameters} newParameters existing parameters or partial object
* for the properties of a new SearchParameters
* @see SearchParameters.make
* @example <caption>SearchParameters of the first query in
* <a href="http://demos.algolia.com/instant-search-demo/">the instant search demo</a></caption>
{
"query": "",
"disjunctiveFacets": [
"customerReviewCount",
"category",
"salePrice_range",
"manufacturer"
],
"maxValuesPerFacet": 30,
"page": 0,
"hitsPerPage": 10,
"facets": [
"type",
"shipping"
]
}
*/
function SearchParameters(newParameters) {
var params = newParameters ? SearchParameters._parseNumbers(newParameters) : {};
/**
* Targeted index. This parameter is mandatory.
* @member {string}
*/
this.index = params.index || '';
// Query
/**
* Query string of the instant search. The empty string is a valid query.
* @member {string}
* @see https://www.algolia.com/doc/rest#param-query
*/
this.query = params.query || '';
// Facets
/**
* This attribute contains the list of all the conjunctive facets
* used. This list will be added to requested facets in the
* [facets attribute](https://www.algolia.com/doc/rest-api/search#param-facets) sent to algolia.
* @member {string[]}
*/
this.facets = params.facets || [];
/**
* This attribute contains the list of all the disjunctive facets
* used. This list will be added to requested facets in the
* [facets attribute](https://www.algolia.com/doc/rest-api/search#param-facets) sent to algolia.
* @member {string[]}
*/
this.disjunctiveFacets = params.disjunctiveFacets || [];
/**
* This attribute contains the list of all the hierarchical facets
* used. This list will be added to requested facets in the
* [facets attribute](https://www.algolia.com/doc/rest-api/search#param-facets) sent to algolia.
* Hierarchical facets are a sub type of disjunctive facets that
* let you filter faceted attributes hierarchically.
* @member {string[]|object[]}
*/
this.hierarchicalFacets = params.hierarchicalFacets || [];
// Refinements
/**
* This attribute contains all the filters that need to be
* applied on the conjunctive facets. Each facet must be properly
* defined in the `facets` attribute.
*
* The key is the name of the facet, and the `FacetList` contains all
* filters selected for the associated facet name.
*
* When querying algolia, the values stored in this attribute will
* be translated into the `facetFilters` attribute.
* @member {Object.<string, SearchParameters.FacetList>}
*/
this.facetsRefinements = params.facetsRefinements || {};
/**
* This attribute contains all the filters that need to be
* excluded from the conjunctive facets. Each facet must be properly
* defined in the `facets` attribute.
*
* The key is the name of the facet, and the `FacetList` contains all
* filters excluded for the associated facet name.
*
* When querying algolia, the values stored in this attribute will
* be translated into the `facetFilters` attribute.
* @member {Object.<string, SearchParameters.FacetList>}
*/
this.facetsExcludes = params.facetsExcludes || {};
/**
* This attribute contains all the filters that need to be
* applied on the disjunctive facets. Each facet must be properly
* defined in the `disjunctiveFacets` attribute.
*
* The key is the name of the facet, and the `FacetList` contains all
* filters selected for the associated facet name.
*
* When querying algolia, the values stored in this attribute will
* be translated into the `facetFilters` attribute.
* @member {Object.<string, SearchParameters.FacetList>}
*/
this.disjunctiveFacetsRefinements = params.disjunctiveFacetsRefinements || {};
/**
* This attribute contains all the filters that need to be
* applied on the numeric attributes.
*
* The key is the name of the attribute, and the value is the
* filters to apply to this attribute.
*
* When querying algolia, the values stored in this attribute will
* be translated into the `numericFilters` attribute.
* @member {Object.<string, SearchParameters.OperatorList>}
*/
this.numericRefinements = params.numericRefinements || {};
/**
* This attribute contains all the tags used to refine the query.
*
* When querying algolia, the values stored in this attribute will
* be translated into the `tagFilters` attribute.
* @member {string[]}
*/
this.tagRefinements = params.tagRefinements || [];
/**
* This attribute contains all the filters that need to be
* applied on the hierarchical facets. Each facet must be properly
* defined in the `hierarchicalFacets` attribute.
*
* The key is the name of the facet, and the `FacetList` contains all
* filters selected for the associated facet name. The FacetList values
* are structured as a string that contain the values for each level
* separated by the configured separator.
*
* When querying algolia, the values stored in this attribute will
* be translated into the `facetFilters` attribute.
* @member {Object.<string, SearchParameters.FacetList>}
*/
this.hierarchicalFacetsRefinements = params.hierarchicalFacetsRefinements || {};
/**
* Contains the numeric filters in the raw format of the Algolia API. Setting
* this parameter is not compatible with the usage of numeric filters methods.
* @see https://www.algolia.com/doc/javascript#numericFilters
* @member {string}
*/
this.numericFilters = params.numericFilters;
/**
* Contains the tag filters in the raw format of the Algolia API. Setting this
* parameter is not compatible with the of the add/remove/toggle methods of the
* tag api.
* @see https://www.algolia.com/doc/rest#param-tagFilters
* @member {string}
*/
this.tagFilters = params.tagFilters;
/**
* Contains the optional tag filters in the raw format of the Algolia API.
* @see https://www.algolia.com/doc/rest#param-tagFilters
* @member {string}
*/
this.optionalTagFilters = params.optionalTagFilters;
/**
* Contains the optional facet filters in the raw format of the Algolia API.
* @see https://www.algolia.com/doc/rest#param-tagFilters
* @member {string}
*/
this.optionalFacetFilters = params.optionalFacetFilters;
// Misc. parameters
/**
* Number of hits to be returned by the search API
* @member {number}
* @see https://www.algolia.com/doc/rest#param-hitsPerPage
*/
this.hitsPerPage = params.hitsPerPage;
/**
* Number of values for each faceted attribute
* @member {number}
* @see https://www.algolia.com/doc/rest#param-maxValuesPerFacet
*/
this.maxValuesPerFacet = params.maxValuesPerFacet;
/**
* The current page number
* @member {number}
* @see https://www.algolia.com/doc/rest#param-page
*/
this.page = params.page || 0;
/**
* How the query should be treated by the search engine.
* Possible values: prefixAll, prefixLast, prefixNone
* @see https://www.algolia.com/doc/rest#param-queryType
* @member {string}
*/
this.queryType = params.queryType;
/**
* How the typo tolerance behave in the search engine.
* Possible values: true, false, min, strict
* @see https://www.algolia.com/doc/rest#param-typoTolerance
* @member {string}
*/
this.typoTolerance = params.typoTolerance;
/**
* Number of characters to wait before doing one character replacement.
* @see https://www.algolia.com/doc/rest#param-minWordSizefor1Typo
* @member {number}
*/
this.minWordSizefor1Typo = params.minWordSizefor1Typo;
/**
* Number of characters to wait before doing a second character replacement.
* @see https://www.algolia.com/doc/rest#param-minWordSizefor2Typos
* @member {number}
*/
this.minWordSizefor2Typos = params.minWordSizefor2Typos;
/**
* Configure the precision of the proximity ranking criterion
* @see https://www.algolia.com/doc/rest#param-minProximity
*/
this.minProximity = params.minProximity;
/**
* Should the engine allow typos on numerics.
* @see https://www.algolia.com/doc/rest#param-allowTyposOnNumericTokens
* @member {boolean}
*/
this.allowTyposOnNumericTokens = params.allowTyposOnNumericTokens;
/**
* Should the plurals be ignored
* @see https://www.algolia.com/doc/rest#param-ignorePlurals
* @member {boolean}
*/
this.ignorePlurals = params.ignorePlurals;
/**
* Restrict which attribute is searched.
* @see https://www.algolia.com/doc/rest#param-restrictSearchableAttributes
* @member {string}
*/
this.restrictSearchableAttributes = params.restrictSearchableAttributes;
/**
* Enable the advanced syntax.
* @see https://www.algolia.com/doc/rest#param-advancedSyntax
* @member {boolean}
*/
this.advancedSyntax = params.advancedSyntax;
/**
* Enable the analytics
* @see https://www.algolia.com/doc/rest#param-analytics
* @member {boolean}
*/
this.analytics = params.analytics;
/**
* Tag of the query in the analytics.
* @see https://www.algolia.com/doc/rest#param-analyticsTags
* @member {string}
*/
this.analyticsTags = params.analyticsTags;
/**
* Enable the synonyms
* @see https://www.algolia.com/doc/rest#param-synonyms
* @member {boolean}
*/
this.synonyms = params.synonyms;
/**
* Should the engine replace the synonyms in the highlighted results.
* @see https://www.algolia.com/doc/rest#param-replaceSynonymsInHighlight
* @member {boolean}
*/
this.replaceSynonymsInHighlight = params.replaceSynonymsInHighlight;
/**
* Add some optional words to those defined in the dashboard
* @see https://www.algolia.com/doc/rest#param-optionalWords
* @member {string}
*/
this.optionalWords = params.optionalWords;
/**
* Possible values are "lastWords" "firstWords" "allOptional" "none" (default)
* @see https://www.algolia.com/doc/rest#param-removeWordsIfNoResults
* @member {string}
*/
this.removeWordsIfNoResults = params.removeWordsIfNoResults;
/**
* List of attributes to retrieve
* @see https://www.algolia.com/doc/rest#param-attributesToRetrieve
* @member {string}
*/
this.attributesToRetrieve = params.attributesToRetrieve;
/**
* List of attributes to highlight
* @see https://www.algolia.com/doc/rest#param-attributesToHighlight
* @member {string}
*/
this.attributesToHighlight = params.attributesToHighlight;
/**
* Code to be embedded on the left part of the highlighted results
* @see https://www.algolia.com/doc/rest#param-highlightPreTag
* @member {string}
*/
this.highlightPreTag = params.highlightPreTag;
/**
* Code to be embedded on the right part of the highlighted results
* @see https://www.algolia.com/doc/rest#param-highlightPostTag
* @member {string}
*/
this.highlightPostTag = params.highlightPostTag;
/**
* List of attributes to snippet
* @see https://www.algolia.com/doc/rest#param-attributesToSnippet
* @member {string}
*/
this.attributesToSnippet = params.attributesToSnippet;
/**
* Enable the ranking informations in the response, set to 1 to activate
* @see https://www.algolia.com/doc/rest#param-getRankingInfo
* @member {number}
*/
this.getRankingInfo = params.getRankingInfo;
/**
* Remove duplicates based on the index setting attributeForDistinct
* @see https://www.algolia.com/doc/rest#param-distinct
* @member {boolean|number}
*/
this.distinct = params.distinct;
/**
* Center of the geo search.
* @see https://www.algolia.com/doc/rest#param-aroundLatLng
* @member {string}
*/
this.aroundLatLng = params.aroundLatLng;
/**
* Center of the search, retrieve from the user IP.
* @see https://www.algolia.com/doc/rest#param-aroundLatLngViaIP
* @member {boolean}
*/
this.aroundLatLngViaIP = params.aroundLatLngViaIP;
/**
* Radius of the geo search.
* @see https://www.algolia.com/doc/rest#param-aroundRadius
* @member {number}
*/
this.aroundRadius = params.aroundRadius;
/**
* Precision of the geo search.
* @see https://www.algolia.com/doc/rest#param-aroundPrecision
* @member {number}
*/
this.minimumAroundRadius = params.minimumAroundRadius;
/**
* Precision of the geo search.
* @see https://www.algolia.com/doc/rest#param-minimumAroundRadius
* @member {number}
*/
this.aroundPrecision = params.aroundPrecision;
/**
* Geo search inside a box.
* @see https://www.algolia.com/doc/rest#param-insideBoundingBox
* @member {string}
*/
this.insideBoundingBox = params.insideBoundingBox;
/**
* Geo search inside a polygon.
* @see https://www.algolia.com/doc/rest#param-insidePolygon
* @member {string}
*/
this.insidePolygon = params.insidePolygon;
/**
* Allows to specify an ellipsis character for the snippet when we truncate the text
* (added before and after if truncated).
* The default value is an empty string and we recommend to set it to "…"
* @see https://www.algolia.com/doc/rest#param-insidePolygon
* @member {string}
*/
this.snippetEllipsisText = params.snippetEllipsisText;
/**
* Allows to specify some attributes name on which exact won't be applied.
* Attributes are separated with a comma (for example "name,address" ), you can also use a
* JSON string array encoding (for example encodeURIComponent('["name","address"]') ).
* By default the list is empty.
* @see https://www.algolia.com/doc/rest#param-disableExactOnAttributes
* @member {string|string[]}
*/
this.disableExactOnAttributes = params.disableExactOnAttributes;
/**
* Applies 'exact' on single word queries if the word contains at least 3 characters
* and is not a stop word.
* Can take two values: true or false.
* By default, its set to false.
* @see https://www.algolia.com/doc/rest#param-enableExactOnSingleWordQuery
* @member {boolean}
*/
this.enableExactOnSingleWordQuery = params.enableExactOnSingleWordQuery;
// Undocumented parameters, still needed otherwise we fail
this.offset = params.offset;
this.length = params.length;
var self = this;
forOwn_1(params, function checkForUnknownParameter(paramValue, paramName) {
if (SearchParameters.PARAMETERS.indexOf(paramName) === -1) {
self[paramName] = paramValue;
}
});
}
/**
* List all the properties in SearchParameters and therefore all the known Algolia properties
* This doesn't contain any beta/hidden features.
* @private
*/
SearchParameters.PARAMETERS = keys_1(new SearchParameters());
/**
* @private
* @param {object} partialState full or part of a state
* @return {object} a new object with the number keys as number
*/
SearchParameters._parseNumbers = function(partialState) {
// Do not reparse numbers in SearchParameters, they ought to be parsed already
if (partialState instanceof SearchParameters) return partialState;
var numbers = {};
var numberKeys = [
'aroundPrecision',
'aroundRadius',
'getRankingInfo',
'minWordSizefor2Typos',
'minWordSizefor1Typo',
'page',
'maxValuesPerFacet',
'distinct',
'minimumAroundRadius',
'hitsPerPage',
'minProximity'
];
forEach_1(numberKeys, function(k) {
var value = partialState[k];
if (isString_1(value)) {
var parsedValue = parseFloat(value);
numbers[k] = _isNaN(parsedValue) ? value : parsedValue;
}
});
// there's two formats of insideBoundingBox, we need to parse
// the one which is an array of float geo rectangles
if (Array.isArray(partialState.insideBoundingBox)) {
numbers.insideBoundingBox = partialState.insideBoundingBox.map(function(geoRect) {
return geoRect.map(function(value) {
return parseFloat(value);
});
});
}
if (partialState.numericRefinements) {
var numericRefinements = {};
forEach_1(partialState.numericRefinements, function(operators, attribute) {
numericRefinements[attribute] = {};
forEach_1(operators, function(values, operator) {
var parsedValues = map_1(values, function(v) {
if (Array.isArray(v)) {
return map_1(v, function(vPrime) {
if (isString_1(vPrime)) {
return parseFloat(vPrime);
}
return vPrime;
});
} else if (isString_1(v)) {
return parseFloat(v);
}
return v;
});
numericRefinements[attribute][operator] = parsedValues;
});
});
numbers.numericRefinements = numericRefinements;
}
return merge_1({}, partialState, numbers);
};
/**
* Factory for SearchParameters
* @param {object|SearchParameters} newParameters existing parameters or partial
* object for the properties of a new SearchParameters
* @return {SearchParameters} frozen instance of SearchParameters
*/
SearchParameters.make = function makeSearchParameters(newParameters) {
var instance = new SearchParameters(newParameters);
forEach_1(newParameters.hierarchicalFacets, function(facet) {
if (facet.rootPath) {
var currentRefinement = instance.getHierarchicalRefinement(facet.name);
if (currentRefinement.length > 0 && currentRefinement[0].indexOf(facet.rootPath) !== 0) {
instance = instance.clearRefinements(facet.name);
}
// get it again in case it has been cleared
currentRefinement = instance.getHierarchicalRefinement(facet.name);
if (currentRefinement.length === 0) {
instance = instance.toggleHierarchicalFacetRefinement(facet.name, facet.rootPath);
}
}
});
return instance;
};
/**
* Validates the new parameters based on the previous state
* @param {SearchParameters} currentState the current state
* @param {object|SearchParameters} parameters the new parameters to set
* @return {Error|null} Error if the modification is invalid, null otherwise
*/
SearchParameters.validate = function(currentState, parameters) {
var params = parameters || {};
if (currentState.tagFilters && params.tagRefinements && params.tagRefinements.length > 0) {
return new Error(
'[Tags] Cannot switch from the managed tag API to the advanced API. It is probably ' +
'an error, if it is really what you want, you should first clear the tags with clearTags method.');
}
if (currentState.tagRefinements.length > 0 && params.tagFilters) {
return new Error(
'[Tags] Cannot switch from the advanced tag API to the managed API. It is probably ' +
'an error, if it is not, you should first clear the tags with clearTags method.');
}
if (currentState.numericFilters && params.numericRefinements && !isEmpty_1(params.numericRefinements)) {
return new Error(
"[Numeric filters] Can't switch from the advanced to the managed API. It" +
' is probably an error, if this is really what you want, you have to first' +
' clear the numeric filters.');
}
if (!isEmpty_1(currentState.numericRefinements) && params.numericFilters) {
return new Error(
"[Numeric filters] Can't switch from the managed API to the advanced. It" +
' is probably an error, if this is really what you want, you have to first' +
' clear the numeric filters.');
}
return null;
};
SearchParameters.prototype = {
constructor: SearchParameters,
/**
* Remove all refinements (disjunctive + conjunctive + excludes + numeric filters)
* @method
* @param {undefined|string|SearchParameters.clearCallback} [attribute] optional string or function
* - If not given, means to clear all the filters.
* - If `string`, means to clear all refinements for the `attribute` named filter.
* - If `function`, means to clear all the refinements that return truthy values.
* @return {SearchParameters}
*/
clearRefinements: function clearRefinements(attribute) {
var clear = RefinementList.clearRefinement;
var patch = {
numericRefinements: this._clearNumericRefinements(attribute),
facetsRefinements: clear(this.facetsRefinements, attribute, 'conjunctiveFacet'),
facetsExcludes: clear(this.facetsExcludes, attribute, 'exclude'),
disjunctiveFacetsRefinements: clear(this.disjunctiveFacetsRefinements, attribute, 'disjunctiveFacet'),
hierarchicalFacetsRefinements: clear(this.hierarchicalFacetsRefinements, attribute, 'hierarchicalFacet')
};
if (patch.numericRefinements === this.numericRefinements &&
patch.facetsRefinements === this.facetsRefinements &&
patch.facetsExcludes === this.facetsExcludes &&
patch.disjunctiveFacetsRefinements === this.disjunctiveFacetsRefinements &&
patch.hierarchicalFacetsRefinements === this.hierarchicalFacetsRefinements) {
return this;
}
return this.setQueryParameters(patch);
},
/**
* Remove all the refined tags from the SearchParameters
* @method
* @return {SearchParameters}
*/
clearTags: function clearTags() {
if (this.tagFilters === undefined && this.tagRefinements.length === 0) return this;
return this.setQueryParameters({
tagFilters: undefined,
tagRefinements: []
});
},
/**
* Set the index.
* @method
* @param {string} index the index name
* @return {SearchParameters}
*/
setIndex: function setIndex(index) {
if (index === this.index) return this;
return this.setQueryParameters({
index: index
});
},
/**
* Query setter
* @method
* @param {string} newQuery value for the new query
* @return {SearchParameters}
*/
setQuery: function setQuery(newQuery) {
if (newQuery === this.query) return this;
return this.setQueryParameters({
query: newQuery
});
},
/**
* Page setter
* @method
* @param {number} newPage new page number
* @return {SearchParameters}
*/
setPage: function setPage(newPage) {
if (newPage === this.page) return this;
return this.setQueryParameters({
page: newPage
});
},
/**
* Facets setter
* The facets are the simple facets, used for conjunctive (and) faceting.
* @method
* @param {string[]} facets all the attributes of the algolia records used for conjunctive faceting
* @return {SearchParameters}
*/
setFacets: function setFacets(facets) {
return this.setQueryParameters({
facets: facets
});
},
/**
* Disjunctive facets setter
* Change the list of disjunctive (or) facets the helper chan handle.
* @method
* @param {string[]} facets all the attributes of the algolia records used for disjunctive faceting
* @return {SearchParameters}
*/
setDisjunctiveFacets: function setDisjunctiveFacets(facets) {
return this.setQueryParameters({
disjunctiveFacets: facets
});
},
/**
* HitsPerPage setter
* Hits per page represents the number of hits retrieved for this query
* @method
* @param {number} n number of hits retrieved per page of results
* @return {SearchParameters}
*/
setHitsPerPage: function setHitsPerPage(n) {
if (this.hitsPerPage === n) return this;
return this.setQueryParameters({
hitsPerPage: n
});
},
/**
* typoTolerance setter
* Set the value of typoTolerance
* @method
* @param {string} typoTolerance new value of typoTolerance ("true", "false", "min" or "strict")
* @return {SearchParameters}
*/
setTypoTolerance: function setTypoTolerance(typoTolerance) {
if (this.typoTolerance === typoTolerance) return this;
return this.setQueryParameters({
typoTolerance: typoTolerance
});
},
/**
* Add a numeric filter for a given attribute
* When value is an array, they are combined with OR
* When value is a single value, it will combined with AND
* @method
* @param {string} attribute attribute to set the filter on
* @param {string} operator operator of the filter (possible values: =, >, >=, <, <=, !=)
* @param {number | number[]} value value of the filter
* @return {SearchParameters}
* @example
* // for price = 50 or 40
* searchparameter.addNumericRefinement('price', '=', [50, 40]);
* @example
* // for size = 38 and 40
* searchparameter.addNumericRefinement('size', '=', 38);
* searchparameter.addNumericRefinement('size', '=', 40);
*/
addNumericRefinement: function(attribute, operator, v) {
var value = valToNumber_1(v);
if (this.isNumericRefined(attribute, operator, value)) return this;
var mod = merge_1({}, this.numericRefinements);
mod[attribute] = merge_1({}, mod[attribute]);
if (mod[attribute][operator]) {
// Array copy
mod[attribute][operator] = mod[attribute][operator].slice();
// Add the element. Concat can't be used here because value can be an array.
mod[attribute][operator].push(value);
} else {
mod[attribute][operator] = [value];
}
return this.setQueryParameters({
numericRefinements: mod
});
},
/**
* Get the list of conjunctive refinements for a single facet
* @param {string} facetName name of the attribute used for faceting
* @return {string[]} list of refinements
*/
getConjunctiveRefinements: function(facetName) {
if (!this.isConjunctiveFacet(facetName)) {
throw new Error(facetName + ' is not defined in the facets attribute of the helper configuration');
}
return this.facetsRefinements[facetName] || [];
},
/**
* Get the list of disjunctive refinements for a single facet
* @param {string} facetName name of the attribute used for faceting
* @return {string[]} list of refinements
*/
getDisjunctiveRefinements: function(facetName) {
if (!this.isDisjunctiveFacet(facetName)) {
throw new Error(
facetName + ' is not defined in the disjunctiveFacets attribute of the helper configuration'
);
}
return this.disjunctiveFacetsRefinements[facetName] || [];
},
/**
* Get the list of hierarchical refinements for a single facet
* @param {string} facetName name of the attribute used for faceting
* @return {string[]} list of refinements
*/
getHierarchicalRefinement: function(facetName) {
// we send an array but we currently do not support multiple
// hierarchicalRefinements for a hierarchicalFacet
return this.hierarchicalFacetsRefinements[facetName] || [];
},
/**
* Get the list of exclude refinements for a single facet
* @param {string} facetName name of the attribute used for faceting
* @return {string[]} list of refinements
*/
getExcludeRefinements: function(facetName) {
if (!this.isConjunctiveFacet(facetName)) {
throw new Error(facetName + ' is not defined in the facets attribute of the helper configuration');
}
return this.facetsExcludes[facetName] || [];
},
/**
* Remove all the numeric filter for a given (attribute, operator)
* @method
* @param {string} attribute attribute to set the filter on
* @param {string} [operator] operator of the filter (possible values: =, >, >=, <, <=, !=)
* @param {number} [number] the value to be removed
* @return {SearchParameters}
*/
removeNumericRefinement: function(attribute, operator, paramValue) {
if (paramValue !== undefined) {
var paramValueAsNumber = valToNumber_1(paramValue);
if (!this.isNumericRefined(attribute, operator, paramValueAsNumber)) return this;
return this.setQueryParameters({
numericRefinements: this._clearNumericRefinements(function(value, key) {
return key === attribute && value.op === operator && isEqual_1(value.val, paramValueAsNumber);
})
});
} else if (operator !== undefined) {
if (!this.isNumericRefined(attribute, operator)) return this;
return this.setQueryParameters({
numericRefinements: this._clearNumericRefinements(function(value, key) {
return key === attribute && value.op === operator;
})
});
}
if (!this.isNumericRefined(attribute)) return this;
return this.setQueryParameters({
numericRefinements: this._clearNumericRefinements(function(value, key) {
return key === attribute;
})
});
},
/**
* Get the list of numeric refinements for a single facet
* @param {string} facetName name of the attribute used for faceting
* @return {SearchParameters.OperatorList[]} list of refinements
*/
getNumericRefinements: function(facetName) {
return this.numericRefinements[facetName] || {};
},
/**
* Return the current refinement for the (attribute, operator)
* @param {string} attribute attribute in the record
* @param {string} operator operator applied on the refined values
* @return {Array.<number|number[]>} refined values
*/
getNumericRefinement: function(attribute, operator) {
return this.numericRefinements[attribute] && this.numericRefinements[attribute][operator];
},
/**
* Clear numeric filters.
* @method
* @private
* @param {string|SearchParameters.clearCallback} [attribute] optional string or function
* - If not given, means to clear all the filters.
* - If `string`, means to clear all refinements for the `attribute` named filter.
* - If `function`, means to clear all the refinements that return truthy values.
* @return {Object.<string, OperatorList>}
*/
_clearNumericRefinements: function _clearNumericRefinements(attribute) {
if (isUndefined_1(attribute)) {
if (isEmpty_1(this.numericRefinements)) return this.numericRefinements;
return {};
} else if (isString_1(attribute)) {
if (isEmpty_1(this.numericRefinements[attribute])) return this.numericRefinements;
return omit_1(this.numericRefinements, attribute);
} else if (isFunction_1(attribute)) {
var hasChanged = false;
var newNumericRefinements = reduce_1(this.numericRefinements, function(memo, operators, key) {
var operatorList = {};
forEach_1(operators, function(values, operator) {
var outValues = [];
forEach_1(values, function(value) {
var predicateResult = attribute({val: value, op: operator}, key, 'numeric');
if (!predicateResult) outValues.push(value);
});
if (!isEmpty_1(outValues)) {
if (outValues.length !== values.length) hasChanged = true;
operatorList[operator] = outValues;
}
else hasChanged = true;
});
if (!isEmpty_1(operatorList)) memo[key] = operatorList;
return memo;
}, {});
if (hasChanged) return newNumericRefinements;
return this.numericRefinements;
}
},
/**
* Add a facet to the facets attribute of the helper configuration, if it
* isn't already present.
* @method
* @param {string} facet facet name to add
* @return {SearchParameters}
*/
addFacet: function addFacet(facet) {
if (this.isConjunctiveFacet(facet)) {
return this;
}
return this.setQueryParameters({
facets: this.facets.concat([facet])
});
},
/**
* Add a disjunctive facet to the disjunctiveFacets attribute of the helper
* configuration, if it isn't already present.
* @method
* @param {string} facet disjunctive facet name to add
* @return {SearchParameters}
*/
addDisjunctiveFacet: function addDisjunctiveFacet(facet) {
if (this.isDisjunctiveFacet(facet)) {
return this;
}
return this.setQueryParameters({
disjunctiveFacets: this.disjunctiveFacets.concat([facet])
});
},
/**
* Add a hierarchical facet to the hierarchicalFacets attribute of the helper
* configuration.
* @method
* @param {object} hierarchicalFacet hierarchical facet to add
* @return {SearchParameters}
* @throws will throw an error if a hierarchical facet with the same name was already declared
*/
addHierarchicalFacet: function addHierarchicalFacet(hierarchicalFacet) {
if (this.isHierarchicalFacet(hierarchicalFacet.name)) {
throw new Error(
'Cannot declare two hierarchical facets with the same name: `' + hierarchicalFacet.name + '`');
}
return this.setQueryParameters({
hierarchicalFacets: this.hierarchicalFacets.concat([hierarchicalFacet])
});
},
/**
* Add a refinement on a "normal" facet
* @method
* @param {string} facet attribute to apply the faceting on
* @param {string} value value of the attribute (will be converted to string)
* @return {SearchParameters}
*/
addFacetRefinement: function addFacetRefinement(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
if (RefinementList.isRefined(this.facetsRefinements, facet, value)) return this;
return this.setQueryParameters({
facetsRefinements: RefinementList.addRefinement(this.facetsRefinements, facet, value)
});
},
/**
* Exclude a value from a "normal" facet
* @method
* @param {string} facet attribute to apply the exclusion on
* @param {string} value value of the attribute (will be converted to string)
* @return {SearchParameters}
*/
addExcludeRefinement: function addExcludeRefinement(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
if (RefinementList.isRefined(this.facetsExcludes, facet, value)) return this;
return this.setQueryParameters({
facetsExcludes: RefinementList.addRefinement(this.facetsExcludes, facet, value)
});
},
/**
* Adds a refinement on a disjunctive facet.
* @method
* @param {string} facet attribute to apply the faceting on
* @param {string} value value of the attribute (will be converted to string)
* @return {SearchParameters}
*/
addDisjunctiveFacetRefinement: function addDisjunctiveFacetRefinement(facet, value) {
if (!this.isDisjunctiveFacet(facet)) {
throw new Error(
facet + ' is not defined in the disjunctiveFacets attribute of the helper configuration');
}
if (RefinementList.isRefined(this.disjunctiveFacetsRefinements, facet, value)) return this;
return this.setQueryParameters({
disjunctiveFacetsRefinements: RefinementList.addRefinement(
this.disjunctiveFacetsRefinements, facet, value)
});
},
/**
* addTagRefinement adds a tag to the list used to filter the results
* @param {string} tag tag to be added
* @return {SearchParameters}
*/
addTagRefinement: function addTagRefinement(tag) {
if (this.isTagRefined(tag)) return this;
var modification = {
tagRefinements: this.tagRefinements.concat(tag)
};
return this.setQueryParameters(modification);
},
/**
* Remove a facet from the facets attribute of the helper configuration, if it
* is present.
* @method
* @param {string} facet facet name to remove
* @return {SearchParameters}
*/
removeFacet: function removeFacet(facet) {
if (!this.isConjunctiveFacet(facet)) {
return this;
}
return this.clearRefinements(facet).setQueryParameters({
facets: filter_1(this.facets, function(f) {
return f !== facet;
})
});
},
/**
* Remove a disjunctive facet from the disjunctiveFacets attribute of the
* helper configuration, if it is present.
* @method
* @param {string} facet disjunctive facet name to remove
* @return {SearchParameters}
*/
removeDisjunctiveFacet: function removeDisjunctiveFacet(facet) {
if (!this.isDisjunctiveFacet(facet)) {
return this;
}
return this.clearRefinements(facet).setQueryParameters({
disjunctiveFacets: filter_1(this.disjunctiveFacets, function(f) {
return f !== facet;
})
});
},
/**
* Remove a hierarchical facet from the hierarchicalFacets attribute of the
* helper configuration, if it is present.
* @method
* @param {string} facet hierarchical facet name to remove
* @return {SearchParameters}
*/
removeHierarchicalFacet: function removeHierarchicalFacet(facet) {
if (!this.isHierarchicalFacet(facet)) {
return this;
}
return this.clearRefinements(facet).setQueryParameters({
hierarchicalFacets: filter_1(this.hierarchicalFacets, function(f) {
return f.name !== facet;
})
});
},
/**
* Remove a refinement set on facet. If a value is provided, it will clear the
* refinement for the given value, otherwise it will clear all the refinement
* values for the faceted attribute.
* @method
* @param {string} facet name of the attribute used for faceting
* @param {string} [value] value used to filter
* @return {SearchParameters}
*/
removeFacetRefinement: function removeFacetRefinement(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
if (!RefinementList.isRefined(this.facetsRefinements, facet, value)) return this;
return this.setQueryParameters({
facetsRefinements: RefinementList.removeRefinement(this.facetsRefinements, facet, value)
});
},
/**
* Remove a negative refinement on a facet
* @method
* @param {string} facet name of the attribute used for faceting
* @param {string} value value used to filter
* @return {SearchParameters}
*/
removeExcludeRefinement: function removeExcludeRefinement(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
if (!RefinementList.isRefined(this.facetsExcludes, facet, value)) return this;
return this.setQueryParameters({
facetsExcludes: RefinementList.removeRefinement(this.facetsExcludes, facet, value)
});
},
/**
* Remove a refinement on a disjunctive facet
* @method
* @param {string} facet name of the attribute used for faceting
* @param {string} value value used to filter
* @return {SearchParameters}
*/
removeDisjunctiveFacetRefinement: function removeDisjunctiveFacetRefinement(facet, value) {
if (!this.isDisjunctiveFacet(facet)) {
throw new Error(
facet + ' is not defined in the disjunctiveFacets attribute of the helper configuration');
}
if (!RefinementList.isRefined(this.disjunctiveFacetsRefinements, facet, value)) return this;
return this.setQueryParameters({
disjunctiveFacetsRefinements: RefinementList.removeRefinement(
this.disjunctiveFacetsRefinements, facet, value)
});
},
/**
* Remove a tag from the list of tag refinements
* @method
* @param {string} tag the tag to remove
* @return {SearchParameters}
*/
removeTagRefinement: function removeTagRefinement(tag) {
if (!this.isTagRefined(tag)) return this;
var modification = {
tagRefinements: filter_1(this.tagRefinements, function(t) { return t !== tag; })
};
return this.setQueryParameters(modification);
},
/**
* Generic toggle refinement method to use with facet, disjunctive facets
* and hierarchical facets
* @param {string} facet the facet to refine
* @param {string} value the associated value
* @return {SearchParameters}
* @throws will throw an error if the facet is not declared in the settings of the helper
* @deprecated since version 2.19.0, see {@link SearchParameters#toggleFacetRefinement}
*/
toggleRefinement: function toggleRefinement(facet, value) {
return this.toggleFacetRefinement(facet, value);
},
/**
* Generic toggle refinement method to use with facet, disjunctive facets
* and hierarchical facets
* @param {string} facet the facet to refine
* @param {string} value the associated value
* @return {SearchParameters}
* @throws will throw an error if the facet is not declared in the settings of the helper
*/
toggleFacetRefinement: function toggleFacetRefinement(facet, value) {
if (this.isHierarchicalFacet(facet)) {
return this.toggleHierarchicalFacetRefinement(facet, value);
} else if (this.isConjunctiveFacet(facet)) {
return this.toggleConjunctiveFacetRefinement(facet, value);
} else if (this.isDisjunctiveFacet(facet)) {
return this.toggleDisjunctiveFacetRefinement(facet, value);
}
throw new Error('Cannot refine the undeclared facet ' + facet +
'; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets');
},
/**
* Switch the refinement applied over a facet/value
* @method
* @param {string} facet name of the attribute used for faceting
* @param {value} value value used for filtering
* @return {SearchParameters}
*/
toggleConjunctiveFacetRefinement: function toggleConjunctiveFacetRefinement(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
return this.setQueryParameters({
facetsRefinements: RefinementList.toggleRefinement(this.facetsRefinements, facet, value)
});
},
/**
* Switch the refinement applied over a facet/value
* @method
* @param {string} facet name of the attribute used for faceting
* @param {value} value value used for filtering
* @return {SearchParameters}
*/
toggleExcludeFacetRefinement: function toggleExcludeFacetRefinement(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
return this.setQueryParameters({
facetsExcludes: RefinementList.toggleRefinement(this.facetsExcludes, facet, value)
});
},
/**
* Switch the refinement applied over a facet/value
* @method
* @param {string} facet name of the attribute used for faceting
* @param {value} value value used for filtering
* @return {SearchParameters}
*/
toggleDisjunctiveFacetRefinement: function toggleDisjunctiveFacetRefinement(facet, value) {
if (!this.isDisjunctiveFacet(facet)) {
throw new Error(
facet + ' is not defined in the disjunctiveFacets attribute of the helper configuration');
}
return this.setQueryParameters({
disjunctiveFacetsRefinements: RefinementList.toggleRefinement(
this.disjunctiveFacetsRefinements, facet, value)
});
},
/**
* Switch the refinement applied over a facet/value
* @method
* @param {string} facet name of the attribute used for faceting
* @param {value} value value used for filtering
* @return {SearchParameters}
*/
toggleHierarchicalFacetRefinement: function toggleHierarchicalFacetRefinement(facet, value) {
if (!this.isHierarchicalFacet(facet)) {
throw new Error(
facet + ' is not defined in the hierarchicalFacets attribute of the helper configuration');
}
var separator = this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(facet));
var mod = {};
var upOneOrMultipleLevel = this.hierarchicalFacetsRefinements[facet] !== undefined &&
this.hierarchicalFacetsRefinements[facet].length > 0 && (
// remove current refinement:
// refinement was 'beer > IPA', call is toggleRefine('beer > IPA'), refinement should be `beer`
this.hierarchicalFacetsRefinements[facet][0] === value ||
// remove a parent refinement of the current refinement:
// - refinement was 'beer > IPA > Flying dog'
// - call is toggleRefine('beer > IPA')
// - refinement should be `beer`
this.hierarchicalFacetsRefinements[facet][0].indexOf(value + separator) === 0
);
if (upOneOrMultipleLevel) {
if (value.indexOf(separator) === -1) {
// go back to root level
mod[facet] = [];
} else {
mod[facet] = [value.slice(0, value.lastIndexOf(separator))];
}
} else {
mod[facet] = [value];
}
return this.setQueryParameters({
hierarchicalFacetsRefinements: defaults_1({}, mod, this.hierarchicalFacetsRefinements)
});
},
/**
* Adds a refinement on a hierarchical facet.
* @param {string} facet the facet name
* @param {string} path the hierarchical facet path
* @return {SearchParameter} the new state
* @throws Error if the facet is not defined or if the facet is refined
*/
addHierarchicalFacetRefinement: function(facet, path) {
if (this.isHierarchicalFacetRefined(facet)) {
throw new Error(facet + ' is already refined.');
}
var mod = {};
mod[facet] = [path];
return this.setQueryParameters({
hierarchicalFacetsRefinements: defaults_1({}, mod, this.hierarchicalFacetsRefinements)
});
},
/**
* Removes the refinement set on a hierarchical facet.
* @param {string} facet the facet name
* @return {SearchParameter} the new state
* @throws Error if the facet is not defined or if the facet is not refined
*/
removeHierarchicalFacetRefinement: function(facet) {
if (!this.isHierarchicalFacetRefined(facet)) {
throw new Error(facet + ' is not refined.');
}
var mod = {};
mod[facet] = [];
return this.setQueryParameters({
hierarchicalFacetsRefinements: defaults_1({}, mod, this.hierarchicalFacetsRefinements)
});
},
/**
* Switch the tag refinement
* @method
* @param {string} tag the tag to remove or add
* @return {SearchParameters}
*/
toggleTagRefinement: function toggleTagRefinement(tag) {
if (this.isTagRefined(tag)) {
return this.removeTagRefinement(tag);
}
return this.addTagRefinement(tag);
},
/**
* Test if the facet name is from one of the disjunctive facets
* @method
* @param {string} facet facet name to test
* @return {boolean}
*/
isDisjunctiveFacet: function(facet) {
return indexOf_1(this.disjunctiveFacets, facet) > -1;
},
/**
* Test if the facet name is from one of the hierarchical facets
* @method
* @param {string} facetName facet name to test
* @return {boolean}
*/
isHierarchicalFacet: function(facetName) {
return this.getHierarchicalFacetByName(facetName) !== undefined;
},
/**
* Test if the facet name is from one of the conjunctive/normal facets
* @method
* @param {string} facet facet name to test
* @return {boolean}
*/
isConjunctiveFacet: function(facet) {
return indexOf_1(this.facets, facet) > -1;
},
/**
* Returns true if the facet is refined, either for a specific value or in
* general.
* @method
* @param {string} facet name of the attribute for used for faceting
* @param {string} value, optional value. If passed will test that this value
* is filtering the given facet.
* @return {boolean} returns true if refined
*/
isFacetRefined: function isFacetRefined(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
return RefinementList.isRefined(this.facetsRefinements, facet, value);
},
/**
* Returns true if the facet contains exclusions or if a specific value is
* excluded.
*
* @method
* @param {string} facet name of the attribute for used for faceting
* @param {string} [value] optional value. If passed will test that this value
* is filtering the given facet.
* @return {boolean} returns true if refined
*/
isExcludeRefined: function isExcludeRefined(facet, value) {
if (!this.isConjunctiveFacet(facet)) {
throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');
}
return RefinementList.isRefined(this.facetsExcludes, facet, value);
},
/**
* Returns true if the facet contains a refinement, or if a value passed is a
* refinement for the facet.
* @method
* @param {string} facet name of the attribute for used for faceting
* @param {string} value optional, will test if the value is used for refinement
* if there is one, otherwise will test if the facet contains any refinement
* @return {boolean}
*/
isDisjunctiveFacetRefined: function isDisjunctiveFacetRefined(facet, value) {
if (!this.isDisjunctiveFacet(facet)) {
throw new Error(
facet + ' is not defined in the disjunctiveFacets attribute of the helper configuration');
}
return RefinementList.isRefined(this.disjunctiveFacetsRefinements, facet, value);
},
/**
* Returns true if the facet contains a refinement, or if a value passed is a
* refinement for the facet.
* @method
* @param {string} facet name of the attribute for used for faceting
* @param {string} value optional, will test if the value is used for refinement
* if there is one, otherwise will test if the facet contains any refinement
* @return {boolean}
*/
isHierarchicalFacetRefined: function isHierarchicalFacetRefined(facet, value) {
if (!this.isHierarchicalFacet(facet)) {
throw new Error(
facet + ' is not defined in the hierarchicalFacets attribute of the helper configuration');
}
var refinements = this.getHierarchicalRefinement(facet);
if (!value) {
return refinements.length > 0;
}
return indexOf_1(refinements, value) !== -1;
},
/**
* Test if the triple (attribute, operator, value) is already refined.
* If only the attribute and the operator are provided, it tests if the
* contains any refinement value.
* @method
* @param {string} attribute attribute for which the refinement is applied
* @param {string} [operator] operator of the refinement
* @param {string} [value] value of the refinement
* @return {boolean} true if it is refined
*/
isNumericRefined: function isNumericRefined(attribute, operator, value) {
if (isUndefined_1(value) && isUndefined_1(operator)) {
return !!this.numericRefinements[attribute];
}
var isOperatorDefined = this.numericRefinements[attribute] &&
!isUndefined_1(this.numericRefinements[attribute][operator]);
if (isUndefined_1(value) || !isOperatorDefined) {
return isOperatorDefined;
}
var parsedValue = valToNumber_1(value);
var isAttributeValueDefined = !isUndefined_1(
findArray(this.numericRefinements[attribute][operator], parsedValue)
);
return isOperatorDefined && isAttributeValueDefined;
},
/**
* Returns true if the tag refined, false otherwise
* @method
* @param {string} tag the tag to check
* @return {boolean}
*/
isTagRefined: function isTagRefined(tag) {
return indexOf_1(this.tagRefinements, tag) !== -1;
},
/**
* Returns the list of all disjunctive facets refined
* @method
* @param {string} facet name of the attribute used for faceting
* @param {value} value value used for filtering
* @return {string[]}
*/
getRefinedDisjunctiveFacets: function getRefinedDisjunctiveFacets() {
// attributes used for numeric filter can also be disjunctive
var disjunctiveNumericRefinedFacets = intersection_1(
keys_1(this.numericRefinements),
this.disjunctiveFacets
);
return keys_1(this.disjunctiveFacetsRefinements)
.concat(disjunctiveNumericRefinedFacets)
.concat(this.getRefinedHierarchicalFacets());
},
/**
* Returns the list of all disjunctive facets refined
* @method
* @param {string} facet name of the attribute used for faceting
* @param {value} value value used for filtering
* @return {string[]}
*/
getRefinedHierarchicalFacets: function getRefinedHierarchicalFacets() {
return intersection_1(
// enforce the order between the two arrays,
// so that refinement name index === hierarchical facet index
map_1(this.hierarchicalFacets, 'name'),
keys_1(this.hierarchicalFacetsRefinements)
);
},
/**
* Returned the list of all disjunctive facets not refined
* @method
* @return {string[]}
*/
getUnrefinedDisjunctiveFacets: function() {
var refinedFacets = this.getRefinedDisjunctiveFacets();
return filter_1(this.disjunctiveFacets, function(f) {
return indexOf_1(refinedFacets, f) === -1;
});
},
managedParameters: [
'index',
'facets', 'disjunctiveFacets', 'facetsRefinements',
'facetsExcludes', 'disjunctiveFacetsRefinements',
'numericRefinements', 'tagRefinements', 'hierarchicalFacets', 'hierarchicalFacetsRefinements'
],
getQueryParams: function getQueryParams() {
var managedParameters = this.managedParameters;
var queryParams = {};
forOwn_1(this, function(paramValue, paramName) {
if (indexOf_1(managedParameters, paramName) === -1 && paramValue !== undefined) {
queryParams[paramName] = paramValue;
}
});
return queryParams;
},
/**
* Let the user retrieve any parameter value from the SearchParameters
* @param {string} paramName name of the parameter
* @return {any} the value of the parameter
*/
getQueryParameter: function getQueryParameter(paramName) {
if (!this.hasOwnProperty(paramName)) {
throw new Error(
"Parameter '" + paramName + "' is not an attribute of SearchParameters " +
'(http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html)');
}
return this[paramName];
},
/**
* Let the user set a specific value for a given parameter. Will return the
* same instance if the parameter is invalid or if the value is the same as the
* previous one.
* @method
* @param {string} parameter the parameter name
* @param {any} value the value to be set, must be compliant with the definition
* of the attribute on the object
* @return {SearchParameters} the updated state
*/
setQueryParameter: function setParameter(parameter, value) {
if (this[parameter] === value) return this;
var modification = {};
modification[parameter] = value;
return this.setQueryParameters(modification);
},
/**
* Let the user set any of the parameters with a plain object.
* @method
* @param {object} params all the keys and the values to be updated
* @return {SearchParameters} a new updated instance
*/
setQueryParameters: function setQueryParameters(params) {
if (!params) return this;
var error = SearchParameters.validate(this, params);
if (error) {
throw error;
}
var parsedParams = SearchParameters._parseNumbers(params);
return this.mutateMe(function mergeWith(newInstance) {
var ks = keys_1(params);
forEach_1(ks, function(k) {
newInstance[k] = parsedParams[k];
});
return newInstance;
});
},
/**
* Returns an object with only the selected attributes.
* @param {string[]} filters filters to retrieve only a subset of the state. It
* accepts strings that can be either attributes of the SearchParameters (e.g. hitsPerPage)
* or attributes of the index with the notation 'attribute:nameOfMyAttribute'
* @return {object}
*/
filter: function(filters) {
return filterState_1(this, filters);
},
/**
* Helper function to make it easier to build new instances from a mutating
* function
* @private
* @param {function} fn newMutableState -> previousState -> () function that will
* change the value of the newMutable to the desired state
* @return {SearchParameters} a new instance with the specified modifications applied
*/
mutateMe: function mutateMe(fn) {
var newState = new this.constructor(this);
fn(newState, this);
return newState;
},
/**
* Helper function to get the hierarchicalFacet separator or the default one (`>`)
* @param {object} hierarchicalFacet
* @return {string} returns the hierarchicalFacet.separator or `>` as default
*/
_getHierarchicalFacetSortBy: function(hierarchicalFacet) {
return hierarchicalFacet.sortBy || ['isRefined:desc', 'name:asc'];
},
/**
* Helper function to get the hierarchicalFacet separator or the default one (`>`)
* @private
* @param {object} hierarchicalFacet
* @return {string} returns the hierarchicalFacet.separator or `>` as default
*/
_getHierarchicalFacetSeparator: function(hierarchicalFacet) {
return hierarchicalFacet.separator || ' > ';
},
/**
* Helper function to get the hierarchicalFacet prefix path or null
* @private
* @param {object} hierarchicalFacet
* @return {string} returns the hierarchicalFacet.rootPath or null as default
*/
_getHierarchicalRootPath: function(hierarchicalFacet) {
return hierarchicalFacet.rootPath || null;
},
/**
* Helper function to check if we show the parent level of the hierarchicalFacet
* @private
* @param {object} hierarchicalFacet
* @return {string} returns the hierarchicalFacet.showParentLevel or true as default
*/
_getHierarchicalShowParentLevel: function(hierarchicalFacet) {
if (typeof hierarchicalFacet.showParentLevel === 'boolean') {
return hierarchicalFacet.showParentLevel;
}
return true;
},
/**
* Helper function to get the hierarchicalFacet by it's name
* @param {string} hierarchicalFacetName
* @return {object} a hierarchicalFacet
*/
getHierarchicalFacetByName: function(hierarchicalFacetName) {
return find_1(
this.hierarchicalFacets,
{name: hierarchicalFacetName}
);
},
/**
* Get the current breadcrumb for a hierarchical facet, as an array
* @param {string} facetName Hierarchical facet name
* @return {array.<string>} the path as an array of string
*/
getHierarchicalFacetBreadcrumb: function(facetName) {
if (!this.isHierarchicalFacet(facetName)) {
throw new Error(
'Cannot get the breadcrumb of an unknown hierarchical facet: `' + facetName + '`');
}
var refinement = this.getHierarchicalRefinement(facetName)[0];
if (!refinement) return [];
var separator = this._getHierarchicalFacetSeparator(
this.getHierarchicalFacetByName(facetName)
);
var path = refinement.split(separator);
return map_1(path, trim_1);
},
toString: function() {
return JSON.stringify(this, null, 2);
}
};
/**
* Callback used for clearRefinement method
* @callback SearchParameters.clearCallback
* @param {OperatorList|FacetList} value the value of the filter
* @param {string} key the current attribute name
* @param {string} type `numeric`, `disjunctiveFacet`, `conjunctiveFacet`, `hierarchicalFacet` or `exclude`
* depending on the type of facet
* @return {boolean} `true` if the element should be removed. `false` otherwise.
*/
var SearchParameters_1 = SearchParameters;
/**
* Creates an array with all falsey values removed. The values `false`, `null`,
* `0`, `""`, `undefined`, and `NaN` are falsey.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to compact.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.compact([0, 1, false, 2, '', 3]);
* // => [1, 2, 3]
*/
function compact(array) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value) {
result[resIndex++] = value;
}
}
return result;
}
var compact_1 = compact;
/**
* The base implementation of `_.sum` and `_.sumBy` without support for
* iteratee shorthands.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {number} Returns the sum.
*/
function baseSum(array, iteratee) {
var result,
index = -1,
length = array.length;
while (++index < length) {
var current = iteratee(array[index]);
if (current !== undefined) {
result = result === undefined ? current : (result + current);
}
}
return result;
}
var _baseSum = baseSum;
/**
* This method is like `_.sum` except that it accepts `iteratee` which is
* invoked for each element in `array` to generate the value to be summed.
* The iteratee is invoked with one argument: (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {number} Returns the sum.
* @example
*
* var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
*
* _.sumBy(objects, function(o) { return o.n; });
* // => 20
*
* // The `_.property` iteratee shorthand.
* _.sumBy(objects, 'n');
* // => 20
*/
function sumBy(array, iteratee) {
return (array && array.length)
? _baseSum(array, _baseIteratee(iteratee, 2))
: 0;
}
var sumBy_1 = sumBy;
/**
* The base implementation of `_.values` and `_.valuesIn` which creates an
* array of `object` property values corresponding to the property names
* of `props`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} props The property names to get values for.
* @returns {Object} Returns the array of property values.
*/
function baseValues(object, props) {
return _arrayMap(props, function(key) {
return object[key];
});
}
var _baseValues = baseValues;
/**
* Creates an array of the own enumerable string keyed property values of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property values.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.values(new Foo);
* // => [1, 2] (iteration order is not guaranteed)
*
* _.values('hi');
* // => ['h', 'i']
*/
function values(object) {
return object == null ? [] : _baseValues(object, keys_1(object));
}
var values_1 = values;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$3 = Math.max;
/**
* Checks if `value` is in `collection`. If `collection` is a string, it's
* checked for a substring of `value`, otherwise
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* is used for equality comparisons. If `fromIndex` is negative, it's used as
* the offset from the end of `collection`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object|string} collection The collection to inspect.
* @param {*} value The value to search for.
* @param {number} [fromIndex=0] The index to search from.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
* @returns {boolean} Returns `true` if `value` is found, else `false`.
* @example
*
* _.includes([1, 2, 3], 1);
* // => true
*
* _.includes([1, 2, 3], 1, 2);
* // => false
*
* _.includes({ 'a': 1, 'b': 2 }, 1);
* // => true
*
* _.includes('abcd', 'bc');
* // => true
*/
function includes(collection, value, fromIndex, guard) {
collection = isArrayLike_1(collection) ? collection : values_1(collection);
fromIndex = (fromIndex && !guard) ? toInteger_1(fromIndex) : 0;
var length = collection.length;
if (fromIndex < 0) {
fromIndex = nativeMax$3(length + fromIndex, 0);
}
return isString_1(collection)
? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
: (!!length && _baseIndexOf(collection, value, fromIndex) > -1);
}
var includes_1 = includes;
/**
* The base implementation of `_.sortBy` which uses `comparer` to define the
* sort order of `array` and replaces criteria objects with their corresponding
* values.
*
* @private
* @param {Array} array The array to sort.
* @param {Function} comparer The function to define sort order.
* @returns {Array} Returns `array`.
*/
function baseSortBy(array, comparer) {
var length = array.length;
array.sort(comparer);
while (length--) {
array[length] = array[length].value;
}
return array;
}
var _baseSortBy = baseSortBy;
/**
* Compares values to sort them in ascending order.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {number} Returns the sort order indicator for `value`.
*/
function compareAscending(value, other) {
if (value !== other) {
var valIsDefined = value !== undefined,
valIsNull = value === null,
valIsReflexive = value === value,
valIsSymbol = isSymbol_1(value);
var othIsDefined = other !== undefined,
othIsNull = other === null,
othIsReflexive = other === other,
othIsSymbol = isSymbol_1(other);
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
(valIsNull && othIsDefined && othIsReflexive) ||
(!valIsDefined && othIsReflexive) ||
!valIsReflexive) {
return 1;
}
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
(othIsNull && valIsDefined && valIsReflexive) ||
(!othIsDefined && valIsReflexive) ||
!othIsReflexive) {
return -1;
}
}
return 0;
}
var _compareAscending = compareAscending;
/**
* Used by `_.orderBy` to compare multiple properties of a value to another
* and stable sort them.
*
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
* specify an order of "desc" for descending or "asc" for ascending sort order
* of corresponding values.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {boolean[]|string[]} orders The order to sort by for each property.
* @returns {number} Returns the sort order indicator for `object`.
*/
function compareMultiple(object, other, orders) {
var index = -1,
objCriteria = object.criteria,
othCriteria = other.criteria,
length = objCriteria.length,
ordersLength = orders.length;
while (++index < length) {
var result = _compareAscending(objCriteria[index], othCriteria[index]);
if (result) {
if (index >= ordersLength) {
return result;
}
var order = orders[index];
return result * (order == 'desc' ? -1 : 1);
}
}
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
// that causes it, under certain circumstances, to provide the same value for
// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
// for more details.
//
// This also ensures a stable sort in V8 and other engines.
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
return object.index - other.index;
}
var _compareMultiple = compareMultiple;
/**
* The base implementation of `_.orderBy` without param guards.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
* @param {string[]} orders The sort orders of `iteratees`.
* @returns {Array} Returns the new sorted array.
*/
function baseOrderBy(collection, iteratees, orders) {
var index = -1;
iteratees = _arrayMap(iteratees.length ? iteratees : [identity_1], _baseUnary(_baseIteratee));
var result = _baseMap(collection, function(value, key, collection) {
var criteria = _arrayMap(iteratees, function(iteratee) {
return iteratee(value);
});
return { 'criteria': criteria, 'index': ++index, 'value': value };
});
return _baseSortBy(result, function(object, other) {
return _compareMultiple(object, other, orders);
});
}
var _baseOrderBy = baseOrderBy;
/**
* This method is like `_.sortBy` except that it allows specifying the sort
* orders of the iteratees to sort by. If `orders` is unspecified, all values
* are sorted in ascending order. Otherwise, specify an order of "desc" for
* descending or "asc" for ascending sort order of corresponding values.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
* The iteratees to sort by.
* @param {string[]} [orders] The sort orders of `iteratees`.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
* @returns {Array} Returns the new sorted array.
* @example
*
* var users = [
* { 'user': 'fred', 'age': 48 },
* { 'user': 'barney', 'age': 34 },
* { 'user': 'fred', 'age': 40 },
* { 'user': 'barney', 'age': 36 }
* ];
*
* // Sort by `user` in ascending order and by `age` in descending order.
* _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*/
function orderBy(collection, iteratees, orders, guard) {
if (collection == null) {
return [];
}
if (!isArray_1(iteratees)) {
iteratees = iteratees == null ? [] : [iteratees];
}
orders = guard ? undefined : orders;
if (!isArray_1(orders)) {
orders = orders == null ? [] : [orders];
}
return _baseOrderBy(collection, iteratees, orders);
}
var orderBy_1 = orderBy;
/** Used to store function metadata. */
var metaMap = _WeakMap && new _WeakMap;
var _metaMap = metaMap;
/**
* The base implementation of `setData` without support for hot loop shorting.
*
* @private
* @param {Function} func The function to associate metadata with.
* @param {*} data The metadata.
* @returns {Function} Returns `func`.
*/
var baseSetData = !_metaMap ? identity_1 : function(func, data) {
_metaMap.set(func, data);
return func;
};
var _baseSetData = baseSetData;
/**
* Creates a function that produces an instance of `Ctor` regardless of
* whether it was invoked as part of a `new` expression or by `call` or `apply`.
*
* @private
* @param {Function} Ctor The constructor to wrap.
* @returns {Function} Returns the new wrapped function.
*/
function createCtor(Ctor) {
return function() {
// Use a `switch` statement to work with class constructors. See
// http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
// for more details.
var args = arguments;
switch (args.length) {
case 0: return new Ctor;
case 1: return new Ctor(args[0]);
case 2: return new Ctor(args[0], args[1]);
case 3: return new Ctor(args[0], args[1], args[2]);
case 4: return new Ctor(args[0], args[1], args[2], args[3]);
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
}
var thisBinding = _baseCreate(Ctor.prototype),
result = Ctor.apply(thisBinding, args);
// Mimic the constructor's `return` behavior.
// See https://es5.github.io/#x13.2.2 for more details.
return isObject_1(result) ? result : thisBinding;
};
}
var _createCtor = createCtor;
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1;
/**
* Creates a function that wraps `func` to invoke it with the optional `this`
* binding of `thisArg`.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createBind(func, bitmask, thisArg) {
var isBind = bitmask & WRAP_BIND_FLAG,
Ctor = _createCtor(func);
function wrapper() {
var fn = (this && this !== _root && this instanceof wrapper) ? Ctor : func;
return fn.apply(isBind ? thisArg : this, arguments);
}
return wrapper;
}
var _createBind = createBind;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$4 = Math.max;
/**
* Creates an array that is the composition of partially applied arguments,
* placeholders, and provided arguments into a single array of arguments.
*
* @private
* @param {Array} args The provided arguments.
* @param {Array} partials The arguments to prepend to those provided.
* @param {Array} holders The `partials` placeholder indexes.
* @params {boolean} [isCurried] Specify composing for a curried function.
* @returns {Array} Returns the new array of composed arguments.
*/
function composeArgs(args, partials, holders, isCurried) {
var argsIndex = -1,
argsLength = args.length,
holdersLength = holders.length,
leftIndex = -1,
leftLength = partials.length,
rangeLength = nativeMax$4(argsLength - holdersLength, 0),
result = Array(leftLength + rangeLength),
isUncurried = !isCurried;
while (++leftIndex < leftLength) {
result[leftIndex] = partials[leftIndex];
}
while (++argsIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result[holders[argsIndex]] = args[argsIndex];
}
}
while (rangeLength--) {
result[leftIndex++] = args[argsIndex++];
}
return result;
}
var _composeArgs = composeArgs;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$5 = Math.max;
/**
* This function is like `composeArgs` except that the arguments composition
* is tailored for `_.partialRight`.
*
* @private
* @param {Array} args The provided arguments.
* @param {Array} partials The arguments to append to those provided.
* @param {Array} holders The `partials` placeholder indexes.
* @params {boolean} [isCurried] Specify composing for a curried function.
* @returns {Array} Returns the new array of composed arguments.
*/
function composeArgsRight(args, partials, holders, isCurried) {
var argsIndex = -1,
argsLength = args.length,
holdersIndex = -1,
holdersLength = holders.length,
rightIndex = -1,
rightLength = partials.length,
rangeLength = nativeMax$5(argsLength - holdersLength, 0),
result = Array(rangeLength + rightLength),
isUncurried = !isCurried;
while (++argsIndex < rangeLength) {
result[argsIndex] = args[argsIndex];
}
var offset = argsIndex;
while (++rightIndex < rightLength) {
result[offset + rightIndex] = partials[rightIndex];
}
while (++holdersIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result[offset + holders[holdersIndex]] = args[argsIndex++];
}
}
return result;
}
var _composeArgsRight = composeArgsRight;
/**
* Gets the number of `placeholder` occurrences in `array`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} placeholder The placeholder to search for.
* @returns {number} Returns the placeholder count.
*/
function countHolders(array, placeholder) {
var length = array.length,
result = 0;
while (length--) {
if (array[length] === placeholder) {
++result;
}
}
return result;
}
var _countHolders = countHolders;
/**
* The function whose prototype chain sequence wrappers inherit from.
*
* @private
*/
function baseLodash() {
// No operation performed.
}
var _baseLodash = baseLodash;
/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295;
/**
* Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
*
* @private
* @constructor
* @param {*} value The value to wrap.
*/
function LazyWrapper(value) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__dir__ = 1;
this.__filtered__ = false;
this.__iteratees__ = [];
this.__takeCount__ = MAX_ARRAY_LENGTH;
this.__views__ = [];
}
// Ensure `LazyWrapper` is an instance of `baseLodash`.
LazyWrapper.prototype = _baseCreate(_baseLodash.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;
var _LazyWrapper = LazyWrapper;
/**
* This method returns `undefined`.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Util
* @example
*
* _.times(2, _.noop);
* // => [undefined, undefined]
*/
function noop$1() {
// No operation performed.
}
var noop_1 = noop$1;
/**
* Gets metadata for `func`.
*
* @private
* @param {Function} func The function to query.
* @returns {*} Returns the metadata for `func`.
*/
var getData = !_metaMap ? noop_1 : function(func) {
return _metaMap.get(func);
};
var _getData = getData;
/** Used to lookup unminified function names. */
var realNames = {};
var _realNames = realNames;
/** Used for built-in method references. */
var objectProto$i = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$g = objectProto$i.hasOwnProperty;
/**
* Gets the name of `func`.
*
* @private
* @param {Function} func The function to query.
* @returns {string} Returns the function name.
*/
function getFuncName(func) {
var result = (func.name + ''),
array = _realNames[result],
length = hasOwnProperty$g.call(_realNames, result) ? array.length : 0;
while (length--) {
var data = array[length],
otherFunc = data.func;
if (otherFunc == null || otherFunc == func) {
return data.name;
}
}
return result;
}
var _getFuncName = getFuncName;
/**
* The base constructor for creating `lodash` wrapper objects.
*
* @private
* @param {*} value The value to wrap.
* @param {boolean} [chainAll] Enable explicit method chain sequences.
*/
function LodashWrapper(value, chainAll) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__chain__ = !!chainAll;
this.__index__ = 0;
this.__values__ = undefined;
}
LodashWrapper.prototype = _baseCreate(_baseLodash.prototype);
LodashWrapper.prototype.constructor = LodashWrapper;
var _LodashWrapper = LodashWrapper;
/**
* Creates a clone of `wrapper`.
*
* @private
* @param {Object} wrapper The wrapper to clone.
* @returns {Object} Returns the cloned wrapper.
*/
function wrapperClone(wrapper) {
if (wrapper instanceof _LazyWrapper) {
return wrapper.clone();
}
var result = new _LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
result.__actions__ = _copyArray(wrapper.__actions__);
result.__index__ = wrapper.__index__;
result.__values__ = wrapper.__values__;
return result;
}
var _wrapperClone = wrapperClone;
/** Used for built-in method references. */
var objectProto$j = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$h = objectProto$j.hasOwnProperty;
/**
* Creates a `lodash` object which wraps `value` to enable implicit method
* chain sequences. Methods that operate on and return arrays, collections,
* and functions can be chained together. Methods that retrieve a single value
* or may return a primitive value will automatically end the chain sequence
* and return the unwrapped value. Otherwise, the value must be unwrapped
* with `_#value`.
*
* Explicit chain sequences, which must be unwrapped with `_#value`, may be
* enabled using `_.chain`.
*
* The execution of chained methods is lazy, that is, it's deferred until
* `_#value` is implicitly or explicitly called.
*
* Lazy evaluation allows several methods to support shortcut fusion.
* Shortcut fusion is an optimization to merge iteratee calls; this avoids
* the creation of intermediate arrays and can greatly reduce the number of
* iteratee executions. Sections of a chain sequence qualify for shortcut
* fusion if the section is applied to an array and iteratees accept only
* one argument. The heuristic for whether a section qualifies for shortcut
* fusion is subject to change.
*
* Chaining is supported in custom builds as long as the `_#value` method is
* directly or indirectly included in the build.
*
* In addition to lodash methods, wrappers have `Array` and `String` methods.
*
* The wrapper `Array` methods are:
* `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
*
* The wrapper `String` methods are:
* `replace` and `split`
*
* The wrapper methods that support shortcut fusion are:
* `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
* `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
* `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
*
* The chainable wrapper methods are:
* `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
* `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
* `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
* `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
* `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
* `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
* `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
* `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
* `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
* `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
* `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
* `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
* `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
* `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
* `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
* `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
* `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
* `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
* `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
* `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
* `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
* `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
* `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
* `zipObject`, `zipObjectDeep`, and `zipWith`
*
* The wrapper methods that are **not** chainable by default are:
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
* `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
* `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
* `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
* `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
* `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
* `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
* `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
* `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
* `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
* `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
* `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
* `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
* `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
* `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
* `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
* `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
* `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
* `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
* `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
* `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
* `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
* `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
* `upperFirst`, `value`, and `words`
*
* @name _
* @constructor
* @category Seq
* @param {*} value The value to wrap in a `lodash` instance.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* function square(n) {
* return n * n;
* }
*
* var wrapped = _([1, 2, 3]);
*
* // Returns an unwrapped value.
* wrapped.reduce(_.add);
* // => 6
*
* // Returns a wrapped value.
* var squares = wrapped.map(square);
*
* _.isArray(squares);
* // => false
*
* _.isArray(squares.value());
* // => true
*/
function lodash(value) {
if (isObjectLike_1(value) && !isArray_1(value) && !(value instanceof _LazyWrapper)) {
if (value instanceof _LodashWrapper) {
return value;
}
if (hasOwnProperty$h.call(value, '__wrapped__')) {
return _wrapperClone(value);
}
}
return new _LodashWrapper(value);
}
// Ensure wrappers are instances of `baseLodash`.
lodash.prototype = _baseLodash.prototype;
lodash.prototype.constructor = lodash;
var wrapperLodash = lodash;
/**
* Checks if `func` has a lazy counterpart.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` has a lazy counterpart,
* else `false`.
*/
function isLaziable(func) {
var funcName = _getFuncName(func),
other = wrapperLodash[funcName];
if (typeof other != 'function' || !(funcName in _LazyWrapper.prototype)) {
return false;
}
if (func === other) {
return true;
}
var data = _getData(other);
return !!data && func === data[0];
}
var _isLaziable = isLaziable;
/**
* Sets metadata for `func`.
*
* **Note:** If this function becomes hot, i.e. is invoked a lot in a short
* period of time, it will trip its breaker and transition to an identity
* function to avoid garbage collection pauses in V8. See
* [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
* for more details.
*
* @private
* @param {Function} func The function to associate metadata with.
* @param {*} data The metadata.
* @returns {Function} Returns `func`.
*/
var setData = _shortOut(_baseSetData);
var _setData = setData;
/** Used to match wrap detail comments. */
var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
reSplitDetails = /,? & /;
/**
* Extracts wrapper details from the `source` body comment.
*
* @private
* @param {string} source The source to inspect.
* @returns {Array} Returns the wrapper details.
*/
function getWrapDetails(source) {
var match = source.match(reWrapDetails);
return match ? match[1].split(reSplitDetails) : [];
}
var _getWrapDetails = getWrapDetails;
/** Used to match wrap detail comments. */
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
/**
* Inserts wrapper `details` in a comment at the top of the `source` body.
*
* @private
* @param {string} source The source to modify.
* @returns {Array} details The details to insert.
* @returns {string} Returns the modified source.
*/
function insertWrapDetails(source, details) {
var length = details.length;
if (!length) {
return source;
}
var lastIndex = length - 1;
details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
details = details.join(length > 2 ? ', ' : ' ');
return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
}
var _insertWrapDetails = insertWrapDetails;
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$1 = 1,
WRAP_BIND_KEY_FLAG = 2,
WRAP_CURRY_FLAG = 8,
WRAP_CURRY_RIGHT_FLAG = 16,
WRAP_PARTIAL_FLAG = 32,
WRAP_PARTIAL_RIGHT_FLAG = 64,
WRAP_ARY_FLAG = 128,
WRAP_REARG_FLAG = 256,
WRAP_FLIP_FLAG = 512;
/** Used to associate wrap methods with their bit flags. */
var wrapFlags = [
['ary', WRAP_ARY_FLAG],
['bind', WRAP_BIND_FLAG$1],
['bindKey', WRAP_BIND_KEY_FLAG],
['curry', WRAP_CURRY_FLAG],
['curryRight', WRAP_CURRY_RIGHT_FLAG],
['flip', WRAP_FLIP_FLAG],
['partial', WRAP_PARTIAL_FLAG],
['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
['rearg', WRAP_REARG_FLAG]
];
/**
* Updates wrapper `details` based on `bitmask` flags.
*
* @private
* @returns {Array} details The details to modify.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @returns {Array} Returns `details`.
*/
function updateWrapDetails(details, bitmask) {
_arrayEach(wrapFlags, function(pair) {
var value = '_.' + pair[0];
if ((bitmask & pair[1]) && !_arrayIncludes(details, value)) {
details.push(value);
}
});
return details.sort();
}
var _updateWrapDetails = updateWrapDetails;
/**
* Sets the `toString` method of `wrapper` to mimic the source of `reference`
* with wrapper details in a comment at the top of the source body.
*
* @private
* @param {Function} wrapper The function to modify.
* @param {Function} reference The reference function.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @returns {Function} Returns `wrapper`.
*/
function setWrapToString(wrapper, reference, bitmask) {
var source = (reference + '');
return _setToString(wrapper, _insertWrapDetails(source, _updateWrapDetails(_getWrapDetails(source), bitmask)));
}
var _setWrapToString = setWrapToString;
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$2 = 1,
WRAP_BIND_KEY_FLAG$1 = 2,
WRAP_CURRY_BOUND_FLAG = 4,
WRAP_CURRY_FLAG$1 = 8,
WRAP_PARTIAL_FLAG$1 = 32,
WRAP_PARTIAL_RIGHT_FLAG$1 = 64;
/**
* Creates a function that wraps `func` to continue currying.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {Function} wrapFunc The function to create the `func` wrapper.
* @param {*} placeholder The placeholder value.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to prepend to those provided to
* the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
var isCurry = bitmask & WRAP_CURRY_FLAG$1,
newHolders = isCurry ? holders : undefined,
newHoldersRight = isCurry ? undefined : holders,
newPartials = isCurry ? partials : undefined,
newPartialsRight = isCurry ? undefined : partials;
bitmask |= (isCurry ? WRAP_PARTIAL_FLAG$1 : WRAP_PARTIAL_RIGHT_FLAG$1);
bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$1 : WRAP_PARTIAL_FLAG$1);
if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
bitmask &= ~(WRAP_BIND_FLAG$2 | WRAP_BIND_KEY_FLAG$1);
}
var newData = [
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
newHoldersRight, argPos, ary, arity
];
var result = wrapFunc.apply(undefined, newData);
if (_isLaziable(func)) {
_setData(result, newData);
}
result.placeholder = placeholder;
return _setWrapToString(result, func, bitmask);
}
var _createRecurry = createRecurry;
/**
* Gets the argument placeholder value for `func`.
*
* @private
* @param {Function} func The function to inspect.
* @returns {*} Returns the placeholder value.
*/
function getHolder(func) {
var object = func;
return object.placeholder;
}
var _getHolder = getHolder;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin$1 = Math.min;
/**
* Reorder `array` according to the specified indexes where the element at
* the first index is assigned as the first element, the element at
* the second index is assigned as the second element, and so on.
*
* @private
* @param {Array} array The array to reorder.
* @param {Array} indexes The arranged array indexes.
* @returns {Array} Returns `array`.
*/
function reorder(array, indexes) {
var arrLength = array.length,
length = nativeMin$1(indexes.length, arrLength),
oldArray = _copyArray(array);
while (length--) {
var index = indexes[length];
array[length] = _isIndex(index, arrLength) ? oldArray[index] : undefined;
}
return array;
}
var _reorder = reorder;
/** Used as the internal argument placeholder. */
var PLACEHOLDER = '__lodash_placeholder__';
/**
* Replaces all `placeholder` elements in `array` with an internal placeholder
* and returns an array of their indexes.
*
* @private
* @param {Array} array The array to modify.
* @param {*} placeholder The placeholder to replace.
* @returns {Array} Returns the new array of placeholder indexes.
*/
function replaceHolders(array, placeholder) {
var index = -1,
length = array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value === placeholder || value === PLACEHOLDER) {
array[index] = PLACEHOLDER;
result[resIndex++] = index;
}
}
return result;
}
var _replaceHolders = replaceHolders;
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$3 = 1,
WRAP_BIND_KEY_FLAG$2 = 2,
WRAP_CURRY_FLAG$2 = 8,
WRAP_CURRY_RIGHT_FLAG$1 = 16,
WRAP_ARY_FLAG$1 = 128,
WRAP_FLIP_FLAG$1 = 512;
/**
* Creates a function that wraps `func` to invoke it with optional `this`
* binding of `thisArg`, partial application, and currying.
*
* @private
* @param {Function|string} func The function or method name to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to prepend to those provided to
* the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [partialsRight] The arguments to append to those provided
* to the new function.
* @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
var isAry = bitmask & WRAP_ARY_FLAG$1,
isBind = bitmask & WRAP_BIND_FLAG$3,
isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2,
isCurried = bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1),
isFlip = bitmask & WRAP_FLIP_FLAG$1,
Ctor = isBindKey ? undefined : _createCtor(func);
function wrapper() {
var length = arguments.length,
args = Array(length),
index = length;
while (index--) {
args[index] = arguments[index];
}
if (isCurried) {
var placeholder = _getHolder(wrapper),
holdersCount = _countHolders(args, placeholder);
}
if (partials) {
args = _composeArgs(args, partials, holders, isCurried);
}
if (partialsRight) {
args = _composeArgsRight(args, partialsRight, holdersRight, isCurried);
}
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = _replaceHolders(args, placeholder);
return _createRecurry(
func, bitmask, createHybrid, wrapper.placeholder, thisArg,
args, newHolders, argPos, ary, arity - length
);
}
var thisBinding = isBind ? thisArg : this,
fn = isBindKey ? thisBinding[func] : func;
length = args.length;
if (argPos) {
args = _reorder(args, argPos);
} else if (isFlip && length > 1) {
args.reverse();
}
if (isAry && ary < length) {
args.length = ary;
}
if (this && this !== _root && this instanceof wrapper) {
fn = Ctor || _createCtor(fn);
}
return fn.apply(thisBinding, args);
}
return wrapper;
}
var _createHybrid = createHybrid;
/**
* Creates a function that wraps `func` to enable currying.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {number} arity The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createCurry(func, bitmask, arity) {
var Ctor = _createCtor(func);
function wrapper() {
var length = arguments.length,
args = Array(length),
index = length,
placeholder = _getHolder(wrapper);
while (index--) {
args[index] = arguments[index];
}
var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
? []
: _replaceHolders(args, placeholder);
length -= holders.length;
if (length < arity) {
return _createRecurry(
func, bitmask, _createHybrid, wrapper.placeholder, undefined,
args, holders, undefined, undefined, arity - length);
}
var fn = (this && this !== _root && this instanceof wrapper) ? Ctor : func;
return _apply(fn, this, args);
}
return wrapper;
}
var _createCurry = createCurry;
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$4 = 1;
/**
* Creates a function that wraps `func` to invoke it with the `this` binding
* of `thisArg` and `partials` prepended to the arguments it receives.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} partials The arguments to prepend to those provided to
* the new function.
* @returns {Function} Returns the new wrapped function.
*/
function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & WRAP_BIND_FLAG$4,
Ctor = _createCtor(func);
function wrapper() {
var argsIndex = -1,
argsLength = arguments.length,
leftIndex = -1,
leftLength = partials.length,
args = Array(leftLength + argsLength),
fn = (this && this !== _root && this instanceof wrapper) ? Ctor : func;
while (++leftIndex < leftLength) {
args[leftIndex] = partials[leftIndex];
}
while (argsLength--) {
args[leftIndex++] = arguments[++argsIndex];
}
return _apply(fn, isBind ? thisArg : this, args);
}
return wrapper;
}
var _createPartial = createPartial;
/** Used as the internal argument placeholder. */
var PLACEHOLDER$1 = '__lodash_placeholder__';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$5 = 1,
WRAP_BIND_KEY_FLAG$3 = 2,
WRAP_CURRY_BOUND_FLAG$1 = 4,
WRAP_CURRY_FLAG$3 = 8,
WRAP_ARY_FLAG$2 = 128,
WRAP_REARG_FLAG$1 = 256;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin$2 = Math.min;
/**
* Merges the function metadata of `source` into `data`.
*
* Merging metadata reduces the number of wrappers used to invoke a function.
* This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
* may be applied regardless of execution order. Methods like `_.ary` and
* `_.rearg` modify function arguments, making the order in which they are
* executed important, preventing the merging of metadata. However, we make
* an exception for a safe combined case where curried functions have `_.ary`
* and or `_.rearg` applied.
*
* @private
* @param {Array} data The destination metadata.
* @param {Array} source The source metadata.
* @returns {Array} Returns `data`.
*/
function mergeData(data, source) {
var bitmask = data[1],
srcBitmask = source[1],
newBitmask = bitmask | srcBitmask,
isCommon = newBitmask < (WRAP_BIND_FLAG$5 | WRAP_BIND_KEY_FLAG$3 | WRAP_ARY_FLAG$2);
var isCombo =
((srcBitmask == WRAP_ARY_FLAG$2) && (bitmask == WRAP_CURRY_FLAG$3)) ||
((srcBitmask == WRAP_ARY_FLAG$2) && (bitmask == WRAP_REARG_FLAG$1) && (data[7].length <= source[8])) ||
((srcBitmask == (WRAP_ARY_FLAG$2 | WRAP_REARG_FLAG$1)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG$3));
// Exit early if metadata can't be merged.
if (!(isCommon || isCombo)) {
return data;
}
// Use source `thisArg` if available.
if (srcBitmask & WRAP_BIND_FLAG$5) {
data[2] = source[2];
// Set when currying a bound function.
newBitmask |= bitmask & WRAP_BIND_FLAG$5 ? 0 : WRAP_CURRY_BOUND_FLAG$1;
}
// Compose partial arguments.
var value = source[3];
if (value) {
var partials = data[3];
data[3] = partials ? _composeArgs(partials, value, source[4]) : value;
data[4] = partials ? _replaceHolders(data[3], PLACEHOLDER$1) : source[4];
}
// Compose partial right arguments.
value = source[5];
if (value) {
partials = data[5];
data[5] = partials ? _composeArgsRight(partials, value, source[6]) : value;
data[6] = partials ? _replaceHolders(data[5], PLACEHOLDER$1) : source[6];
}
// Use source `argPos` if available.
value = source[7];
if (value) {
data[7] = value;
}
// Use source `ary` if it's smaller.
if (srcBitmask & WRAP_ARY_FLAG$2) {
data[8] = data[8] == null ? source[8] : nativeMin$2(data[8], source[8]);
}
// Use source `arity` if one is not provided.
if (data[9] == null) {
data[9] = source[9];
}
// Use source `func` and merge bitmasks.
data[0] = source[0];
data[1] = newBitmask;
return data;
}
var _mergeData = mergeData;
/** Error message constants. */
var FUNC_ERROR_TEXT$1 = 'Expected a function';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$6 = 1,
WRAP_BIND_KEY_FLAG$4 = 2,
WRAP_CURRY_FLAG$4 = 8,
WRAP_CURRY_RIGHT_FLAG$2 = 16,
WRAP_PARTIAL_FLAG$2 = 32,
WRAP_PARTIAL_RIGHT_FLAG$2 = 64;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax$6 = Math.max;
/**
* Creates a function that either curries or invokes `func` with optional
* `this` binding and partially applied arguments.
*
* @private
* @param {Function|string} func The function or method name to wrap.
* @param {number} bitmask The bitmask flags.
* 1 - `_.bind`
* 2 - `_.bindKey`
* 4 - `_.curry` or `_.curryRight` of a bound function
* 8 - `_.curry`
* 16 - `_.curryRight`
* 32 - `_.partial`
* 64 - `_.partialRight`
* 128 - `_.rearg`
* 256 - `_.ary`
* 512 - `_.flip`
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to be partially applied.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
var isBindKey = bitmask & WRAP_BIND_KEY_FLAG$4;
if (!isBindKey && typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT$1);
}
var length = partials ? partials.length : 0;
if (!length) {
bitmask &= ~(WRAP_PARTIAL_FLAG$2 | WRAP_PARTIAL_RIGHT_FLAG$2);
partials = holders = undefined;
}
ary = ary === undefined ? ary : nativeMax$6(toInteger_1(ary), 0);
arity = arity === undefined ? arity : toInteger_1(arity);
length -= holders ? holders.length : 0;
if (bitmask & WRAP_PARTIAL_RIGHT_FLAG$2) {
var partialsRight = partials,
holdersRight = holders;
partials = holders = undefined;
}
var data = isBindKey ? undefined : _getData(func);
var newData = [
func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
argPos, ary, arity
];
if (data) {
_mergeData(newData, data);
}
func = newData[0];
bitmask = newData[1];
thisArg = newData[2];
partials = newData[3];
holders = newData[4];
arity = newData[9] = newData[9] === undefined
? (isBindKey ? 0 : func.length)
: nativeMax$6(newData[9] - length, 0);
if (!arity && bitmask & (WRAP_CURRY_FLAG$4 | WRAP_CURRY_RIGHT_FLAG$2)) {
bitmask &= ~(WRAP_CURRY_FLAG$4 | WRAP_CURRY_RIGHT_FLAG$2);
}
if (!bitmask || bitmask == WRAP_BIND_FLAG$6) {
var result = _createBind(func, bitmask, thisArg);
} else if (bitmask == WRAP_CURRY_FLAG$4 || bitmask == WRAP_CURRY_RIGHT_FLAG$2) {
result = _createCurry(func, bitmask, arity);
} else if ((bitmask == WRAP_PARTIAL_FLAG$2 || bitmask == (WRAP_BIND_FLAG$6 | WRAP_PARTIAL_FLAG$2)) && !holders.length) {
result = _createPartial(func, bitmask, thisArg, partials);
} else {
result = _createHybrid.apply(undefined, newData);
}
var setter = data ? _baseSetData : _setData;
return _setWrapToString(setter(result, newData), func, bitmask);
}
var _createWrap = createWrap;
/** Used to compose bitmasks for function metadata. */
var WRAP_PARTIAL_FLAG$3 = 32;
/**
* Creates a function that invokes `func` with `partials` prepended to the
* arguments it receives. This method is like `_.bind` except it does **not**
* alter the `this` binding.
*
* The `_.partial.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments.
*
* **Note:** This method doesn't set the "length" property of partially
* applied functions.
*
* @static
* @memberOf _
* @since 0.2.0
* @category Function
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new partially applied function.
* @example
*
* function greet(greeting, name) {
* return greeting + ' ' + name;
* }
*
* var sayHelloTo = _.partial(greet, 'hello');
* sayHelloTo('fred');
* // => 'hello fred'
*
* // Partially applied with placeholders.
* var greetFred = _.partial(greet, _, 'fred');
* greetFred('hi');
* // => 'hi fred'
*/
var partial = _baseRest(function(func, partials) {
var holders = _replaceHolders(partials, _getHolder(partial));
return _createWrap(func, WRAP_PARTIAL_FLAG$3, undefined, partials, holders);
});
// Assign default placeholders.
partial.placeholder = {};
var partial_1 = partial;
/** Used to compose bitmasks for function metadata. */
var WRAP_PARTIAL_RIGHT_FLAG$3 = 64;
/**
* This method is like `_.partial` except that partially applied arguments
* are appended to the arguments it receives.
*
* The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments.
*
* **Note:** This method doesn't set the "length" property of partially
* applied functions.
*
* @static
* @memberOf _
* @since 1.0.0
* @category Function
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new partially applied function.
* @example
*
* function greet(greeting, name) {
* return greeting + ' ' + name;
* }
*
* var greetFred = _.partialRight(greet, 'fred');
* greetFred('hi');
* // => 'hi fred'
*
* // Partially applied with placeholders.
* var sayHelloTo = _.partialRight(greet, 'hello', _);
* sayHelloTo('fred');
* // => 'hello fred'
*/
var partialRight = _baseRest(function(func, partials) {
var holders = _replaceHolders(partials, _getHolder(partialRight));
return _createWrap(func, WRAP_PARTIAL_RIGHT_FLAG$3, undefined, partials, holders);
});
// Assign default placeholders.
partialRight.placeholder = {};
var partialRight_1 = partialRight;
/**
* The base implementation of `_.clamp` which doesn't coerce arguments.
*
* @private
* @param {number} number The number to clamp.
* @param {number} [lower] The lower bound.
* @param {number} upper The upper bound.
* @returns {number} Returns the clamped number.
*/
function baseClamp(number, lower, upper) {
if (number === number) {
if (upper !== undefined) {
number = number <= upper ? number : upper;
}
if (lower !== undefined) {
number = number >= lower ? number : lower;
}
}
return number;
}
var _baseClamp = baseClamp;
/**
* Checks if `string` starts with the given target string.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to inspect.
* @param {string} [target] The string to search for.
* @param {number} [position=0] The position to search from.
* @returns {boolean} Returns `true` if `string` starts with `target`,
* else `false`.
* @example
*
* _.startsWith('abc', 'a');
* // => true
*
* _.startsWith('abc', 'b');
* // => false
*
* _.startsWith('abc', 'b', 1);
* // => true
*/
function startsWith(string, target, position) {
string = toString_1(string);
position = position == null
? 0
: _baseClamp(toInteger_1(position), 0, string.length);
target = _baseToString(target);
return string.slice(position, position + target.length) == target;
}
var startsWith_1 = startsWith;
/**
* Transform sort format from user friendly notation to lodash format
* @param {string[]} sortBy array of predicate of the form "attribute:order"
* @return {array.<string[]>} array containing 2 elements : attributes, orders
*/
var formatSort = function formatSort(sortBy, defaults) {
return reduce_1(sortBy, function preparePredicate(out, sortInstruction) {
var sortInstructions = sortInstruction.split(':');
if (defaults && sortInstructions.length === 1) {
var similarDefault = find_1(defaults, function(predicate) {
return startsWith_1(predicate, sortInstruction[0]);
});
if (similarDefault) {
sortInstructions = similarDefault.split(':');
}
}
out[0].push(sortInstructions[0]);
out[1].push(sortInstructions[1]);
return out;
}, [[], []]);
};
/**
* The base implementation of `_.set`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
* @param {*} value The value to set.
* @param {Function} [customizer] The function to customize path creation.
* @returns {Object} Returns `object`.
*/
function baseSet(object, path, value, customizer) {
if (!isObject_1(object)) {
return object;
}
path = _castPath(path, object);
var index = -1,
length = path.length,
lastIndex = length - 1,
nested = object;
while (nested != null && ++index < length) {
var key = _toKey(path[index]),
newValue = value;
if (index != lastIndex) {
var objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined;
if (newValue === undefined) {
newValue = isObject_1(objValue)
? objValue
: (_isIndex(path[index + 1]) ? [] : {});
}
}
_assignValue(nested, key, newValue);
nested = nested[key];
}
return object;
}
var _baseSet = baseSet;
/**
* The base implementation of `_.pickBy` without support for iteratee shorthands.
*
* @private
* @param {Object} object The source object.
* @param {string[]} paths The property paths to pick.
* @param {Function} predicate The function invoked per property.
* @returns {Object} Returns the new object.
*/
function basePickBy(object, paths, predicate) {
var index = -1,
length = paths.length,
result = {};
while (++index < length) {
var path = paths[index],
value = _baseGet(object, path);
if (predicate(value, path)) {
_baseSet(result, _castPath(path, object), value);
}
}
return result;
}
var _basePickBy = basePickBy;
/**
* Creates an object composed of the `object` properties `predicate` returns
* truthy for. The predicate is invoked with two arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pickBy(object, _.isNumber);
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = _arrayMap(_getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = _baseIteratee(predicate);
return _basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
var pickBy_1 = pickBy;
var generateHierarchicalTree_1 = generateTrees;
function generateTrees(state) {
return function generate(hierarchicalFacetResult, hierarchicalFacetIndex) {
var hierarchicalFacet = state.hierarchicalFacets[hierarchicalFacetIndex];
var hierarchicalFacetRefinement = state.hierarchicalFacetsRefinements[hierarchicalFacet.name] &&
state.hierarchicalFacetsRefinements[hierarchicalFacet.name][0] || '';
var hierarchicalSeparator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
var hierarchicalRootPath = state._getHierarchicalRootPath(hierarchicalFacet);
var hierarchicalShowParentLevel = state._getHierarchicalShowParentLevel(hierarchicalFacet);
var sortBy = formatSort(state._getHierarchicalFacetSortBy(hierarchicalFacet));
var generateTreeFn = generateHierarchicalTree(sortBy, hierarchicalSeparator, hierarchicalRootPath,
hierarchicalShowParentLevel, hierarchicalFacetRefinement);
var results = hierarchicalFacetResult;
if (hierarchicalRootPath) {
results = hierarchicalFacetResult.slice(hierarchicalRootPath.split(hierarchicalSeparator).length);
}
return reduce_1(results, generateTreeFn, {
name: state.hierarchicalFacets[hierarchicalFacetIndex].name,
count: null, // root level, no count
isRefined: true, // root level, always refined
path: null, // root level, no path
data: null
});
};
}
function generateHierarchicalTree(sortBy, hierarchicalSeparator, hierarchicalRootPath,
hierarchicalShowParentLevel, currentRefinement) {
return function generateTree(hierarchicalTree, hierarchicalFacetResult, currentHierarchicalLevel) {
var parent = hierarchicalTree;
if (currentHierarchicalLevel > 0) {
var level = 0;
parent = hierarchicalTree;
while (level < currentHierarchicalLevel) {
parent = parent && find_1(parent.data, {isRefined: true});
level++;
}
}
// we found a refined parent, let's add current level data under it
if (parent) {
// filter values in case an object has multiple categories:
// {
// categories: {
// level0: ['beers', 'bières'],
// level1: ['beers > IPA', 'bières > Belges']
// }
// }
//
// If parent refinement is `beers`, then we do not want to have `bières > Belges`
// showing up
var onlyMatchingValuesFn = filterFacetValues(parent.path || hierarchicalRootPath,
currentRefinement, hierarchicalSeparator, hierarchicalRootPath, hierarchicalShowParentLevel);
parent.data = orderBy_1(
map_1(
pickBy_1(hierarchicalFacetResult.data, onlyMatchingValuesFn),
formatHierarchicalFacetValue(hierarchicalSeparator, currentRefinement)
),
sortBy[0], sortBy[1]
);
}
return hierarchicalTree;
};
}
function filterFacetValues(parentPath, currentRefinement, hierarchicalSeparator, hierarchicalRootPath,
hierarchicalShowParentLevel) {
return function(facetCount, facetValue) {
// we want the facetValue is a child of hierarchicalRootPath
if (hierarchicalRootPath &&
(facetValue.indexOf(hierarchicalRootPath) !== 0 || hierarchicalRootPath === facetValue)) {
return false;
}
// we always want root levels (only when there is no prefix path)
return !hierarchicalRootPath && facetValue.indexOf(hierarchicalSeparator) === -1 ||
// if there is a rootPath, being root level mean 1 level under rootPath
hierarchicalRootPath &&
facetValue.split(hierarchicalSeparator).length - hierarchicalRootPath.split(hierarchicalSeparator).length === 1 ||
// if current refinement is a root level and current facetValue is a root level,
// keep the facetValue
facetValue.indexOf(hierarchicalSeparator) === -1 &&
currentRefinement.indexOf(hierarchicalSeparator) === -1 ||
// currentRefinement is a child of the facet value
currentRefinement.indexOf(facetValue) === 0 ||
// facetValue is a child of the current parent, add it
facetValue.indexOf(parentPath + hierarchicalSeparator) === 0 &&
(hierarchicalShowParentLevel || facetValue.indexOf(currentRefinement) === 0);
};
}
function formatHierarchicalFacetValue(hierarchicalSeparator, currentRefinement) {
return function format(facetCount, facetValue) {
return {
name: trim_1(last_1(facetValue.split(hierarchicalSeparator))),
path: facetValue,
count: facetCount,
isRefined: currentRefinement === facetValue || currentRefinement.indexOf(facetValue + hierarchicalSeparator) === 0,
data: null
};
};
}
/**
* @typedef SearchResults.Facet
* @type {object}
* @property {string} name name of the attribute in the record
* @property {object} data the faceting data: value, number of entries
* @property {object} stats undefined unless facet_stats is retrieved from algolia
*/
/**
* @typedef SearchResults.HierarchicalFacet
* @type {object}
* @property {string} name name of the current value given the hierarchical level, trimmed.
* If root node, you get the facet name
* @property {number} count number of objects matching this hierarchical value
* @property {string} path the current hierarchical value full path
* @property {boolean} isRefined `true` if the current value was refined, `false` otherwise
* @property {HierarchicalFacet[]} data sub values for the current level
*/
/**
* @typedef SearchResults.FacetValue
* @type {object}
* @property {string} name the facet value itself
* @property {number} count times this facet appears in the results
* @property {boolean} isRefined is the facet currently selected
* @property {boolean} isExcluded is the facet currently excluded (only for conjunctive facets)
*/
/**
* @typedef Refinement
* @type {object}
* @property {string} type the type of filter used:
* `numeric`, `facet`, `exclude`, `disjunctive`, `hierarchical`
* @property {string} attributeName name of the attribute used for filtering
* @property {string} name the value of the filter
* @property {number} numericValue the value as a number. Only for numeric filters.
* @property {string} operator the operator used. Only for numeric filters.
* @property {number} count the number of computed hits for this filter. Only on facets.
* @property {boolean} exhaustive if the count is exhaustive
*/
function getIndices(obj) {
var indices = {};
forEach_1(obj, function(val, idx) { indices[val] = idx; });
return indices;
}
function assignFacetStats(dest, facetStats, key) {
if (facetStats && facetStats[key]) {
dest.stats = facetStats[key];
}
}
function findMatchingHierarchicalFacetFromAttributeName(hierarchicalFacets, hierarchicalAttributeName) {
return find_1(
hierarchicalFacets,
function facetKeyMatchesAttribute(hierarchicalFacet) {
return includes_1(hierarchicalFacet.attributes, hierarchicalAttributeName);
}
);
}
/*eslint-disable */
/**
* Constructor for SearchResults
* @class
* @classdesc SearchResults contains the results of a query to Algolia using the
* {@link AlgoliaSearchHelper}.
* @param {SearchParameters} state state that led to the response
* @param {array.<object>} results the results from algolia client
* @example <caption>SearchResults of the first query in
* <a href="http://demos.algolia.com/instant-search-demo">the instant search demo</a></caption>
{
"hitsPerPage": 10,
"processingTimeMS": 2,
"facets": [
{
"name": "type",
"data": {
"HardGood": 6627,
"BlackTie": 550,
"Music": 665,
"Software": 131,
"Game": 456,
"Movie": 1571
},
"exhaustive": false
},
{
"exhaustive": false,
"data": {
"Free shipping": 5507
},
"name": "shipping"
}
],
"hits": [
{
"thumbnailImage": "http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_54x108_s.gif",
"_highlightResult": {
"shortDescription": {
"matchLevel": "none",
"value": "Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection",
"matchedWords": []
},
"category": {
"matchLevel": "none",
"value": "Computer Security Software",
"matchedWords": []
},
"manufacturer": {
"matchedWords": [],
"value": "Webroot",
"matchLevel": "none"
},
"name": {
"value": "Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows",
"matchedWords": [],
"matchLevel": "none"
}
},
"image": "http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_105x210_sc.jpg",
"shipping": "Free shipping",
"bestSellingRank": 4,
"shortDescription": "Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection",
"url": "http://www.bestbuy.com/site/webroot-secureanywhere-internet-security-3-devi…d=1219060687969&skuId=1688832&cmp=RMX&ky=2d3GfEmNIzjA0vkzveHdZEBgpPCyMnLTJ",
"name": "Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows",
"category": "Computer Security Software",
"salePrice_range": "1 - 50",
"objectID": "1688832",
"type": "Software",
"customerReviewCount": 5980,
"salePrice": 49.99,
"manufacturer": "Webroot"
},
....
],
"nbHits": 10000,
"disjunctiveFacets": [
{
"exhaustive": false,
"data": {
"5": 183,
"12": 112,
"7": 149,
...
},
"name": "customerReviewCount",
"stats": {
"max": 7461,
"avg": 157.939,
"min": 1
}
},
{
"data": {
"Printer Ink": 142,
"Wireless Speakers": 60,
"Point & Shoot Cameras": 48,
...
},
"name": "category",
"exhaustive": false
},
{
"exhaustive": false,
"data": {
"> 5000": 2,
"1 - 50": 6524,
"501 - 2000": 566,
"201 - 500": 1501,
"101 - 200": 1360,
"2001 - 5000": 47
},
"name": "salePrice_range"
},
{
"data": {
"Dynex™": 202,
"Insignia™": 230,
"PNY": 72,
...
},
"name": "manufacturer",
"exhaustive": false
}
],
"query": "",
"nbPages": 100,
"page": 0,
"index": "bestbuy"
}
**/
/*eslint-enable */
function SearchResults(state, results) {
var mainSubResponse = results[0];
this._rawResults = results;
/**
* query used to generate the results
* @member {string}
*/
this.query = mainSubResponse.query;
/**
* The query as parsed by the engine given all the rules.
* @member {string}
*/
this.parsedQuery = mainSubResponse.parsedQuery;
/**
* all the records that match the search parameters. Each record is
* augmented with a new attribute `_highlightResult`
* which is an object keyed by attribute and with the following properties:
* - `value` : the value of the facet highlighted (html)
* - `matchLevel`: full, partial or none depending on how the query terms match
* @member {object[]}
*/
this.hits = mainSubResponse.hits;
/**
* index where the results come from
* @member {string}
*/
this.index = mainSubResponse.index;
/**
* number of hits per page requested
* @member {number}
*/
this.hitsPerPage = mainSubResponse.hitsPerPage;
/**
* total number of hits of this query on the index
* @member {number}
*/
this.nbHits = mainSubResponse.nbHits;
/**
* total number of pages with respect to the number of hits per page and the total number of hits
* @member {number}
*/
this.nbPages = mainSubResponse.nbPages;
/**
* current page
* @member {number}
*/
this.page = mainSubResponse.page;
/**
* sum of the processing time of all the queries
* @member {number}
*/
this.processingTimeMS = sumBy_1(results, 'processingTimeMS');
/**
* The position if the position was guessed by IP.
* @member {string}
* @example "48.8637,2.3615",
*/
this.aroundLatLng = mainSubResponse.aroundLatLng;
/**
* The radius computed by Algolia.
* @member {string}
* @example "126792922",
*/
this.automaticRadius = mainSubResponse.automaticRadius;
/**
* String identifying the server used to serve this request.
* @member {string}
* @example "c7-use-2.algolia.net",
*/
this.serverUsed = mainSubResponse.serverUsed;
/**
* Boolean that indicates if the computation of the counts did time out.
* @deprecated
* @member {boolean}
*/
this.timeoutCounts = mainSubResponse.timeoutCounts;
/**
* Boolean that indicates if the computation of the hits did time out.
* @deprecated
* @member {boolean}
*/
this.timeoutHits = mainSubResponse.timeoutHits;
/**
* True if the counts of the facets is exhaustive
* @member {boolean}
*/
this.exhaustiveFacetsCount = mainSubResponse.exhaustiveFacetsCount;
/**
* True if the number of hits is exhaustive
* @member {boolean}
*/
this.exhaustiveNbHits = mainSubResponse.exhaustiveNbHits;
/**
* Contains the userData if they are set by a [query rule](https://www.algolia.com/doc/guides/query-rules/query-rules-overview/).
* @member {object[]}
*/
this.userData = mainSubResponse.userData;
/**
* queryID is the unique identifier of the query used to generate the current search results.
* This value is only available if the `clickAnalytics` search parameter is set to `true`.
* @member {string}
*/
this.queryID = mainSubResponse.queryID;
/**
* disjunctive facets results
* @member {SearchResults.Facet[]}
*/
this.disjunctiveFacets = [];
/**
* disjunctive facets results
* @member {SearchResults.HierarchicalFacet[]}
*/
this.hierarchicalFacets = map_1(state.hierarchicalFacets, function initFutureTree() {
return [];
});
/**
* other facets results
* @member {SearchResults.Facet[]}
*/
this.facets = [];
var disjunctiveFacets = state.getRefinedDisjunctiveFacets();
var facetsIndices = getIndices(state.facets);
var disjunctiveFacetsIndices = getIndices(state.disjunctiveFacets);
var nextDisjunctiveResult = 1;
var self = this;
// Since we send request only for disjunctive facets that have been refined,
// we get the facets informations from the first, general, response.
forEach_1(mainSubResponse.facets, function(facetValueObject, facetKey) {
var hierarchicalFacet = findMatchingHierarchicalFacetFromAttributeName(
state.hierarchicalFacets,
facetKey
);
if (hierarchicalFacet) {
// Place the hierarchicalFacet data at the correct index depending on
// the attributes order that was defined at the helper initialization
var facetIndex = hierarchicalFacet.attributes.indexOf(facetKey);
var idxAttributeName = findIndex_1(state.hierarchicalFacets, {name: hierarchicalFacet.name});
self.hierarchicalFacets[idxAttributeName][facetIndex] = {
attribute: facetKey,
data: facetValueObject,
exhaustive: mainSubResponse.exhaustiveFacetsCount
};
} else {
var isFacetDisjunctive = indexOf_1(state.disjunctiveFacets, facetKey) !== -1;
var isFacetConjunctive = indexOf_1(state.facets, facetKey) !== -1;
var position;
if (isFacetDisjunctive) {
position = disjunctiveFacetsIndices[facetKey];
self.disjunctiveFacets[position] = {
name: facetKey,
data: facetValueObject,
exhaustive: mainSubResponse.exhaustiveFacetsCount
};
assignFacetStats(self.disjunctiveFacets[position], mainSubResponse.facets_stats, facetKey);
}
if (isFacetConjunctive) {
position = facetsIndices[facetKey];
self.facets[position] = {
name: facetKey,
data: facetValueObject,
exhaustive: mainSubResponse.exhaustiveFacetsCount
};
assignFacetStats(self.facets[position], mainSubResponse.facets_stats, facetKey);
}
}
});
// Make sure we do not keep holes within the hierarchical facets
this.hierarchicalFacets = compact_1(this.hierarchicalFacets);
// aggregate the refined disjunctive facets
forEach_1(disjunctiveFacets, function(disjunctiveFacet) {
var result = results[nextDisjunctiveResult];
var hierarchicalFacet = state.getHierarchicalFacetByName(disjunctiveFacet);
// There should be only item in facets.
forEach_1(result.facets, function(facetResults, dfacet) {
var position;
if (hierarchicalFacet) {
position = findIndex_1(state.hierarchicalFacets, {name: hierarchicalFacet.name});
var attributeIndex = findIndex_1(self.hierarchicalFacets[position], {attribute: dfacet});
// previous refinements and no results so not able to find it
if (attributeIndex === -1) {
return;
}
self.hierarchicalFacets[position][attributeIndex].data = merge_1(
{},
self.hierarchicalFacets[position][attributeIndex].data,
facetResults
);
} else {
position = disjunctiveFacetsIndices[dfacet];
var dataFromMainRequest = mainSubResponse.facets && mainSubResponse.facets[dfacet] || {};
self.disjunctiveFacets[position] = {
name: dfacet,
data: defaults_1({}, facetResults, dataFromMainRequest),
exhaustive: result.exhaustiveFacetsCount
};
assignFacetStats(self.disjunctiveFacets[position], result.facets_stats, dfacet);
if (state.disjunctiveFacetsRefinements[dfacet]) {
forEach_1(state.disjunctiveFacetsRefinements[dfacet], function(refinementValue) {
// add the disjunctive refinements if it is no more retrieved
if (!self.disjunctiveFacets[position].data[refinementValue] &&
indexOf_1(state.disjunctiveFacetsRefinements[dfacet], refinementValue) > -1) {
self.disjunctiveFacets[position].data[refinementValue] = 0;
}
});
}
}
});
nextDisjunctiveResult++;
});
// if we have some root level values for hierarchical facets, merge them
forEach_1(state.getRefinedHierarchicalFacets(), function(refinedFacet) {
var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);
var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
var currentRefinement = state.getHierarchicalRefinement(refinedFacet);
// if we are already at a root refinement (or no refinement at all), there is no
// root level values request
if (currentRefinement.length === 0 || currentRefinement[0].split(separator).length < 2) {
return;
}
var result = results[nextDisjunctiveResult];
forEach_1(result.facets, function(facetResults, dfacet) {
var position = findIndex_1(state.hierarchicalFacets, {name: hierarchicalFacet.name});
var attributeIndex = findIndex_1(self.hierarchicalFacets[position], {attribute: dfacet});
// previous refinements and no results so not able to find it
if (attributeIndex === -1) {
return;
}
// when we always get root levels, if the hits refinement is `beers > IPA` (count: 5),
// then the disjunctive values will be `beers` (count: 100),
// but we do not want to display
// | beers (100)
// > IPA (5)
// We want
// | beers (5)
// > IPA (5)
var defaultData = {};
if (currentRefinement.length > 0) {
var root = currentRefinement[0].split(separator)[0];
defaultData[root] = self.hierarchicalFacets[position][attributeIndex].data[root];
}
self.hierarchicalFacets[position][attributeIndex].data = defaults_1(
defaultData,
facetResults,
self.hierarchicalFacets[position][attributeIndex].data
);
});
nextDisjunctiveResult++;
});
// add the excludes
forEach_1(state.facetsExcludes, function(excludes, facetName) {
var position = facetsIndices[facetName];
self.facets[position] = {
name: facetName,
data: mainSubResponse.facets[facetName],
exhaustive: mainSubResponse.exhaustiveFacetsCount
};
forEach_1(excludes, function(facetValue) {
self.facets[position] = self.facets[position] || {name: facetName};
self.facets[position].data = self.facets[position].data || {};
self.facets[position].data[facetValue] = 0;
});
});
this.hierarchicalFacets = map_1(this.hierarchicalFacets, generateHierarchicalTree_1(state));
this.facets = compact_1(this.facets);
this.disjunctiveFacets = compact_1(this.disjunctiveFacets);
this._state = state;
}
/**
* Get a facet object with its name
* @deprecated
* @param {string} name name of the faceted attribute
* @return {SearchResults.Facet} the facet object
*/
SearchResults.prototype.getFacetByName = function(name) {
var predicate = {name: name};
return find_1(this.facets, predicate) ||
find_1(this.disjunctiveFacets, predicate) ||
find_1(this.hierarchicalFacets, predicate);
};
/**
* Get the facet values of a specified attribute from a SearchResults object.
* @private
* @param {SearchResults} results the search results to search in
* @param {string} attribute name of the faceted attribute to search for
* @return {array|object} facet values. For the hierarchical facets it is an object.
*/
function extractNormalizedFacetValues(results, attribute) {
var predicate = {name: attribute};
if (results._state.isConjunctiveFacet(attribute)) {
var facet = find_1(results.facets, predicate);
if (!facet) return [];
return map_1(facet.data, function(v, k) {
return {
name: k,
count: v,
isRefined: results._state.isFacetRefined(attribute, k),
isExcluded: results._state.isExcludeRefined(attribute, k)
};
});
} else if (results._state.isDisjunctiveFacet(attribute)) {
var disjunctiveFacet = find_1(results.disjunctiveFacets, predicate);
if (!disjunctiveFacet) return [];
return map_1(disjunctiveFacet.data, function(v, k) {
return {
name: k,
count: v,
isRefined: results._state.isDisjunctiveFacetRefined(attribute, k)
};
});
} else if (results._state.isHierarchicalFacet(attribute)) {
return find_1(results.hierarchicalFacets, predicate);
}
}
/**
* Sort nodes of a hierarchical facet results
* @private
* @param {HierarchicalFacet} node node to upon which we want to apply the sort
*/
function recSort(sortFn, node) {
if (!node.data || node.data.length === 0) {
return node;
}
var children = map_1(node.data, partial_1(recSort, sortFn));
var sortedChildren = sortFn(children);
var newNode = merge_1({}, node, {data: sortedChildren});
return newNode;
}
SearchResults.DEFAULT_SORT = ['isRefined:desc', 'count:desc', 'name:asc'];
function vanillaSortFn(order, data) {
return data.sort(order);
}
/**
* Get a the list of values for a given facet attribute. Those values are sorted
* refinement first, descending count (bigger value on top), and name ascending
* (alphabetical order). The sort formula can overridden using either string based
* predicates or a function.
*
* This method will return all the values returned by the Algolia engine plus all
* the values already refined. This means that it can happen that the
* `maxValuesPerFacet` [configuration](https://www.algolia.com/doc/rest-api/search#param-maxValuesPerFacet)
* might not be respected if you have facet values that are already refined.
* @param {string} attribute attribute name
* @param {object} opts configuration options.
* @param {Array.<string> | function} opts.sortBy
* When using strings, it consists of
* the name of the [FacetValue](#SearchResults.FacetValue) or the
* [HierarchicalFacet](#SearchResults.HierarchicalFacet) attributes with the
* order (`asc` or `desc`). For example to order the value by count, the
* argument would be `['count:asc']`.
*
* If only the attribute name is specified, the ordering defaults to the one
* specified in the default value for this attribute.
*
* When not specified, the order is
* ascending. This parameter can also be a function which takes two facet
* values and should return a number, 0 if equal, 1 if the first argument is
* bigger or -1 otherwise.
*
* The default value for this attribute `['isRefined:desc', 'count:desc', 'name:asc']`
* @return {FacetValue[]|HierarchicalFacet} depending on the type of facet of
* the attribute requested (hierarchical, disjunctive or conjunctive)
* @example
* helper.on('results', function(content){
* //get values ordered only by name ascending using the string predicate
* content.getFacetValues('city', {sortBy: ['name:asc']});
* //get values ordered only by count ascending using a function
* content.getFacetValues('city', {
* // this is equivalent to ['count:asc']
* sortBy: function(a, b) {
* if (a.count === b.count) return 0;
* if (a.count > b.count) return 1;
* if (b.count > a.count) return -1;
* }
* });
* });
*/
SearchResults.prototype.getFacetValues = function(attribute, opts) {
var facetValues = extractNormalizedFacetValues(this, attribute);
if (!facetValues) throw new Error(attribute + ' is not a retrieved facet.');
var options = defaults_1({}, opts, {sortBy: SearchResults.DEFAULT_SORT});
if (Array.isArray(options.sortBy)) {
var order = formatSort(options.sortBy, SearchResults.DEFAULT_SORT);
if (Array.isArray(facetValues)) {
return orderBy_1(facetValues, order[0], order[1]);
}
// If facetValues is not an array, it's an object thus a hierarchical facet object
return recSort(partialRight_1(orderBy_1, order[0], order[1]), facetValues);
} else if (isFunction_1(options.sortBy)) {
if (Array.isArray(facetValues)) {
return facetValues.sort(options.sortBy);
}
// If facetValues is not an array, it's an object thus a hierarchical facet object
return recSort(partial_1(vanillaSortFn, options.sortBy), facetValues);
}
throw new Error(
'options.sortBy is optional but if defined it must be ' +
'either an array of string (predicates) or a sorting function'
);
};
/**
* Returns the facet stats if attribute is defined and the facet contains some.
* Otherwise returns undefined.
* @param {string} attribute name of the faceted attribute
* @return {object} The stats of the facet
*/
SearchResults.prototype.getFacetStats = function(attribute) {
if (this._state.isConjunctiveFacet(attribute)) {
return getFacetStatsIfAvailable(this.facets, attribute);
} else if (this._state.isDisjunctiveFacet(attribute)) {
return getFacetStatsIfAvailable(this.disjunctiveFacets, attribute);
}
throw new Error(attribute + ' is not present in `facets` or `disjunctiveFacets`');
};
function getFacetStatsIfAvailable(facetList, facetName) {
var data = find_1(facetList, {name: facetName});
return data && data.stats;
}
/**
* Returns all refinements for all filters + tags. It also provides
* additional information: count and exhausistivity for each filter.
*
* See the [refinement type](#Refinement) for an exhaustive view of the available
* data.
*
* @return {Array.<Refinement>} all the refinements
*/
SearchResults.prototype.getRefinements = function() {
var state = this._state;
var results = this;
var res = [];
forEach_1(state.facetsRefinements, function(refinements, attributeName) {
forEach_1(refinements, function(name) {
res.push(getRefinement(state, 'facet', attributeName, name, results.facets));
});
});
forEach_1(state.facetsExcludes, function(refinements, attributeName) {
forEach_1(refinements, function(name) {
res.push(getRefinement(state, 'exclude', attributeName, name, results.facets));
});
});
forEach_1(state.disjunctiveFacetsRefinements, function(refinements, attributeName) {
forEach_1(refinements, function(name) {
res.push(getRefinement(state, 'disjunctive', attributeName, name, results.disjunctiveFacets));
});
});
forEach_1(state.hierarchicalFacetsRefinements, function(refinements, attributeName) {
forEach_1(refinements, function(name) {
res.push(getHierarchicalRefinement(state, attributeName, name, results.hierarchicalFacets));
});
});
forEach_1(state.numericRefinements, function(operators, attributeName) {
forEach_1(operators, function(values, operator) {
forEach_1(values, function(value) {
res.push({
type: 'numeric',
attributeName: attributeName,
name: value,
numericValue: value,
operator: operator
});
});
});
});
forEach_1(state.tagRefinements, function(name) {
res.push({type: 'tag', attributeName: '_tags', name: name});
});
return res;
};
function getRefinement(state, type, attributeName, name, resultsFacets) {
var facet = find_1(resultsFacets, {name: attributeName});
var count = get_1(facet, 'data[' + name + ']');
var exhaustive = get_1(facet, 'exhaustive');
return {
type: type,
attributeName: attributeName,
name: name,
count: count || 0,
exhaustive: exhaustive || false
};
}
function getHierarchicalRefinement(state, attributeName, name, resultsFacets) {
var facet = find_1(resultsFacets, {name: attributeName});
var facetDeclaration = state.getHierarchicalFacetByName(attributeName);
var splitted = name.split(facetDeclaration.separator);
var configuredName = splitted[splitted.length - 1];
for (var i = 0; facet !== undefined && i < splitted.length; ++i) {
facet = find_1(facet.data, {name: splitted[i]});
}
var count = get_1(facet, 'count');
var exhaustive = get_1(facet, 'exhaustive');
return {
type: 'hierarchical',
attributeName: attributeName,
name: configuredName,
count: count || 0,
exhaustive: exhaustive || false
};
}
var SearchResults_1 = SearchResults;
var isBufferBrowser = function isBuffer(arg) {
return arg && typeof arg === 'object'
&& typeof arg.copy === 'function'
&& typeof arg.fill === 'function'
&& typeof arg.readUInt8 === 'function';
};
var inherits_browser = createCommonjsModule(function (module) {
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};
} else {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor;
var TempCtor = function () {};
TempCtor.prototype = superCtor.prototype;
ctor.prototype = new TempCtor();
ctor.prototype.constructor = ctor;
};
}
});
var util = createCommonjsModule(function (module, exports) {
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var formatRegExp = /%[sdj%]/g;
exports.format = function(f) {
if (!isString(f)) {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
objects.push(inspect(arguments[i]));
}
return objects.join(' ');
}
var i = 1;
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function(x) {
if (x === '%%') return '%';
if (i >= len) return x;
switch (x) {
case '%s': return String(args[i++]);
case '%d': return Number(args[i++]);
case '%j':
try {
return JSON.stringify(args[i++]);
} catch (_) {
return '[Circular]';
}
default:
return x;
}
});
for (var x = args[i]; i < len; x = args[++i]) {
if (isNull(x) || !isObject(x)) {
str += ' ' + x;
} else {
str += ' ' + inspect(x);
}
}
return str;
};
// Mark that a method should not be used.
// Returns a modified function which warns once by default.
// If --no-deprecation is set, then it is a no-op.
exports.deprecate = function(fn, msg) {
// Allow for deprecating things in the process of starting up.
if (isUndefined(commonjsGlobal.process)) {
return function() {
return exports.deprecate(fn, msg).apply(this, arguments);
};
}
var warned = false;
function deprecated() {
if (!warned) {
{
console.error(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
};
var debugs = {};
var debugEnviron;
exports.debuglog = function(set) {
if (isUndefined(debugEnviron))
debugEnviron = '';
set = set.toUpperCase();
if (!debugs[set]) {
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
var pid = process.pid;
debugs[set] = function() {
var msg = exports.format.apply(exports, arguments);
console.error('%s %d: %s', set, pid, msg);
};
} else {
debugs[set] = function() {};
}
}
return debugs[set];
};
/**
* Echos the value of a value. Trys to print the value out
* in the best way possible given the different types.
*
* @param {Object} obj The object to print out.
* @param {Object} opts Optional options object that alters the output.
*/
/* legacy: obj, showHidden, depth, colors*/
function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
};
// legacy...
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
// legacy...
ctx.showHidden = opts;
} else if (opts) {
// got an "options" object
exports._extend(ctx, opts);
}
// set default options
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
if (isUndefined(ctx.depth)) ctx.depth = 2;
if (isUndefined(ctx.colors)) ctx.colors = false;
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
if (ctx.colors) ctx.stylize = stylizeWithColor;
return formatValue(ctx, obj, ctx.depth);
}
exports.inspect = inspect;
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
inspect.colors = {
'bold' : [1, 22],
'italic' : [3, 23],
'underline' : [4, 24],
'inverse' : [7, 27],
'white' : [37, 39],
'grey' : [90, 39],
'black' : [30, 39],
'blue' : [34, 39],
'cyan' : [36, 39],
'green' : [32, 39],
'magenta' : [35, 39],
'red' : [31, 39],
'yellow' : [33, 39]
};
// Don't use 'blue' not visible on cmd.exe
inspect.styles = {
'special': 'cyan',
'number': 'yellow',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
'string': 'green',
'date': 'magenta',
// "name": intentionally not styling
'regexp': 'red'
};
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
'\u001b[' + inspect.colors[style][1] + 'm';
} else {
return str;
}
}
function stylizeNoColor(str, styleType) {
return str;
}
function arrayToHash(array) {
var hash = {};
array.forEach(function(val, idx) {
hash[val] = true;
});
return hash;
}
function formatValue(ctx, value, recurseTimes) {
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it
if (ctx.customInspect &&
value &&
isFunction(value.inspect) &&
// Filter out the util module, it's inspect function is special
value.inspect !== exports.inspect &&
// Also filter out any prototype objects using the circular check.
!(value.constructor && value.constructor.prototype === value)) {
var ret = value.inspect(recurseTimes, ctx);
if (!isString(ret)) {
ret = formatValue(ctx, ret, recurseTimes);
}
return ret;
}
// Primitive types cannot have properties
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
}
// Look up the keys of the object.
var keys = Object.keys(value);
var visibleKeys = arrayToHash(keys);
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
// IE doesn't make error fields non-enumerable
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
if (isError(value)
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
return formatError(value);
}
// Some type of object without properties can be shortcutted.
if (keys.length === 0) {
if (isFunction(value)) {
var name = value.name ? ': ' + value.name : '';
return ctx.stylize('[Function' + name + ']', 'special');
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
}
if (isDate(value)) {
return ctx.stylize(Date.prototype.toString.call(value), 'date');
}
if (isError(value)) {
return formatError(value);
}
}
var base = '', array = false, braces = ['{', '}'];
// Make Array say that they are Array
if (isArray(value)) {
array = true;
braces = ['[', ']'];
}
// Make functions say that they are functions
if (isFunction(value)) {
var n = value.name ? ': ' + value.name : '';
base = ' [Function' + n + ']';
}
// Make RegExps say that they are RegExps
if (isRegExp(value)) {
base = ' ' + RegExp.prototype.toString.call(value);
}
// Make dates with properties first say the date
if (isDate(value)) {
base = ' ' + Date.prototype.toUTCString.call(value);
}
// Make error with message first say the error
if (isError(value)) {
base = ' ' + formatError(value);
}
if (keys.length === 0 && (!array || value.length == 0)) {
return braces[0] + base + braces[1];
}
if (recurseTimes < 0) {
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
} else {
return ctx.stylize('[Object]', 'special');
}
}
ctx.seen.push(value);
var output;
if (array) {
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
} else {
output = keys.map(function(key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
});
}
ctx.seen.pop();
return reduceToSingleString(output, base, braces);
}
function formatPrimitive(ctx, value) {
if (isUndefined(value))
return ctx.stylize('undefined', 'undefined');
if (isString(value)) {
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
.replace(/'/g, "\\'")
.replace(/\\"/g, '"') + '\'';
return ctx.stylize(simple, 'string');
}
if (isNumber(value))
return ctx.stylize('' + value, 'number');
if (isBoolean(value))
return ctx.stylize('' + value, 'boolean');
// For some reason typeof null is "object", so special case here.
if (isNull(value))
return ctx.stylize('null', 'null');
}
function formatError(value) {
return '[' + Error.prototype.toString.call(value) + ']';
}
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
String(i), true));
} else {
output.push('');
}
}
keys.forEach(function(key) {
if (!key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, true));
}
});
return output;
}
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
if (desc.get) {
if (desc.set) {
str = ctx.stylize('[Getter/Setter]', 'special');
} else {
str = ctx.stylize('[Getter]', 'special');
}
} else {
if (desc.set) {
str = ctx.stylize('[Setter]', 'special');
}
}
if (!hasOwnProperty(visibleKeys, key)) {
name = '[' + key + ']';
}
if (!str) {
if (ctx.seen.indexOf(desc.value) < 0) {
if (isNull(recurseTimes)) {
str = formatValue(ctx, desc.value, null);
} else {
str = formatValue(ctx, desc.value, recurseTimes - 1);
}
if (str.indexOf('\n') > -1) {
if (array) {
str = str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n').substr(2);
} else {
str = '\n' + str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n');
}
}
} else {
str = ctx.stylize('[Circular]', 'special');
}
}
if (isUndefined(name)) {
if (array && key.match(/^\d+$/)) {
return str;
}
name = JSON.stringify('' + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.substr(1, name.length - 2);
name = ctx.stylize(name, 'name');
} else {
name = name.replace(/'/g, "\\'")
.replace(/\\"/g, '"')
.replace(/(^"|"$)/g, "'");
name = ctx.stylize(name, 'string');
}
}
return name + ': ' + str;
}
function reduceToSingleString(output, base, braces) {
var length = output.reduce(function(prev, cur) {
if (cur.indexOf('\n') >= 0) ;
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
}, 0);
if (length > 60) {
return braces[0] +
(base === '' ? '' : base + '\n ') +
' ' +
output.join(',\n ') +
' ' +
braces[1];
}
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
}
// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
function isArray(ar) {
return Array.isArray(ar);
}
exports.isArray = isArray;
function isBoolean(arg) {
return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === 'number';
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === 'string';
}
exports.isString = isString;
function isSymbol(arg) {
return typeof arg === 'symbol';
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
return isObject(re) && objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
return isObject(d) && objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
function isError(e) {
return isObject(e) &&
(objectToString(e) === '[object Error]' || e instanceof Error);
}
exports.isError = isError;
function isFunction(arg) {
return typeof arg === 'function';
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null ||
typeof arg === 'boolean' ||
typeof arg === 'number' ||
typeof arg === 'string' ||
typeof arg === 'symbol' || // ES6 symbol
typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = isBufferBrowser;
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
'Oct', 'Nov', 'Dec'];
// 26 Feb 16:19:34
function timestamp() {
var d = new Date();
var time = [pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())].join(':');
return [d.getDate(), months[d.getMonth()], time].join(' ');
}
// log is just a thin wrapper to console.log that prepends a timestamp
exports.log = function() {
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
};
/**
* Inherit the prototype methods from one constructor into another.
*
* The Function.prototype.inherits from lang.js rewritten as a standalone
* function (not on Function.prototype). NOTE: If this file is to be loaded
* during bootstrapping this function needs to be rewritten using some native
* functions as prototype setup using normal JavaScript does not work as
* expected during bootstrapping (see mirror.js in r114903).
*
* @param {function} ctor Constructor function which needs to inherit the
* prototype.
* @param {function} superCtor Constructor function to inherit prototype from.
*/
exports.inherits = inherits_browser;
exports._extend = function(origin, add) {
// Don't do anything if add isn't an object
if (!add || !isObject(add)) return origin;
var keys = Object.keys(add);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
}
return origin;
};
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
});
var util_1 = util.format;
var util_2 = util.deprecate;
var util_3 = util.debuglog;
var util_4 = util.inspect;
var util_5 = util.isArray;
var util_6 = util.isBoolean;
var util_7 = util.isNull;
var util_8 = util.isNullOrUndefined;
var util_9 = util.isNumber;
var util_10 = util.isString;
var util_11 = util.isSymbol;
var util_12 = util.isUndefined;
var util_13 = util.isRegExp;
var util_14 = util.isObject;
var util_15 = util.isDate;
var util_16 = util.isError;
var util_17 = util.isFunction;
var util_18 = util.isPrimitive;
var util_19 = util.isBuffer;
var util_20 = util.log;
var util_21 = util.inherits;
var util_22 = util._extend;
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
function EventEmitter() {
this._events = this._events || {};
this._maxListeners = this._maxListeners || undefined;
}
var events = EventEmitter;
// Backwards-compat with node 0.10.x
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.prototype._events = undefined;
EventEmitter.prototype._maxListeners = undefined;
// By default EventEmitters will print a warning if more than 10 listeners are
// added to it. This is a useful default which helps finding memory leaks.
EventEmitter.defaultMaxListeners = 10;
// Obviously not all Emitters should be limited to 10. This function allows
// that to be increased. Set to zero for unlimited.
EventEmitter.prototype.setMaxListeners = function(n) {
if (!isNumber$1(n) || n < 0 || isNaN(n))
throw TypeError('n must be a positive number');
this._maxListeners = n;
return this;
};
EventEmitter.prototype.emit = function(type) {
var er, handler, len, args, i, listeners;
if (!this._events)
this._events = {};
// If there is no 'error' event listener then throw.
if (type === 'error') {
if (!this._events.error ||
(isObject$1(this._events.error) && !this._events.error.length)) {
er = arguments[1];
if (er instanceof Error) {
throw er; // Unhandled 'error' event
} else {
// At least give some kind of context to the user
var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
err.context = er;
throw err;
}
}
}
handler = this._events[type];
if (isUndefined$1(handler))
return false;
if (isFunction$1(handler)) {
switch (arguments.length) {
// fast cases
case 1:
handler.call(this);
break;
case 2:
handler.call(this, arguments[1]);
break;
case 3:
handler.call(this, arguments[1], arguments[2]);
break;
// slower
default:
args = Array.prototype.slice.call(arguments, 1);
handler.apply(this, args);
}
} else if (isObject$1(handler)) {
args = Array.prototype.slice.call(arguments, 1);
listeners = handler.slice();
len = listeners.length;
for (i = 0; i < len; i++)
listeners[i].apply(this, args);
}
return true;
};
EventEmitter.prototype.addListener = function(type, listener) {
var m;
if (!isFunction$1(listener))
throw TypeError('listener must be a function');
if (!this._events)
this._events = {};
// To avoid recursion in the case that type === "newListener"! Before
// adding it to the listeners, first emit "newListener".
if (this._events.newListener)
this.emit('newListener', type,
isFunction$1(listener.listener) ?
listener.listener : listener);
if (!this._events[type])
// Optimize the case of one listener. Don't need the extra array object.
this._events[type] = listener;
else if (isObject$1(this._events[type]))
// If we've already got an array, just append.
this._events[type].push(listener);
else
// Adding the second element, need to change to array.
this._events[type] = [this._events[type], listener];
// Check for listener leak
if (isObject$1(this._events[type]) && !this._events[type].warned) {
if (!isUndefined$1(this._maxListeners)) {
m = this._maxListeners;
} else {
m = EventEmitter.defaultMaxListeners;
}
if (m && m > 0 && this._events[type].length > m) {
this._events[type].warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
this._events[type].length);
if (typeof console.trace === 'function') {
// not supported in IE 10
console.trace();
}
}
}
return this;
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.once = function(type, listener) {
if (!isFunction$1(listener))
throw TypeError('listener must be a function');
var fired = false;
function g() {
this.removeListener(type, g);
if (!fired) {
fired = true;
listener.apply(this, arguments);
}
}
g.listener = listener;
this.on(type, g);
return this;
};
// emits a 'removeListener' event iff the listener was removed
EventEmitter.prototype.removeListener = function(type, listener) {
var list, position, length, i;
if (!isFunction$1(listener))
throw TypeError('listener must be a function');
if (!this._events || !this._events[type])
return this;
list = this._events[type];
length = list.length;
position = -1;
if (list === listener ||
(isFunction$1(list.listener) && list.listener === listener)) {
delete this._events[type];
if (this._events.removeListener)
this.emit('removeListener', type, listener);
} else if (isObject$1(list)) {
for (i = length; i-- > 0;) {
if (list[i] === listener ||
(list[i].listener && list[i].listener === listener)) {
position = i;
break;
}
}
if (position < 0)
return this;
if (list.length === 1) {
list.length = 0;
delete this._events[type];
} else {
list.splice(position, 1);
}
if (this._events.removeListener)
this.emit('removeListener', type, listener);
}
return this;
};
EventEmitter.prototype.removeAllListeners = function(type) {
var key, listeners;
if (!this._events)
return this;
// not listening for removeListener, no need to emit
if (!this._events.removeListener) {
if (arguments.length === 0)
this._events = {};
else if (this._events[type])
delete this._events[type];
return this;
}
// emit removeListener for all listeners on all events
if (arguments.length === 0) {
for (key in this._events) {
if (key === 'removeListener') continue;
this.removeAllListeners(key);
}
this.removeAllListeners('removeListener');
this._events = {};
return this;
}
listeners = this._events[type];
if (isFunction$1(listeners)) {
this.removeListener(type, listeners);
} else if (listeners) {
// LIFO order
while (listeners.length)
this.removeListener(type, listeners[listeners.length - 1]);
}
delete this._events[type];
return this;
};
EventEmitter.prototype.listeners = function(type) {
var ret;
if (!this._events || !this._events[type])
ret = [];
else if (isFunction$1(this._events[type]))
ret = [this._events[type]];
else
ret = this._events[type].slice();
return ret;
};
EventEmitter.prototype.listenerCount = function(type) {
if (this._events) {
var evlistener = this._events[type];
if (isFunction$1(evlistener))
return 1;
else if (evlistener)
return evlistener.length;
}
return 0;
};
EventEmitter.listenerCount = function(emitter, type) {
return emitter.listenerCount(type);
};
function isFunction$1(arg) {
return typeof arg === 'function';
}
function isNumber$1(arg) {
return typeof arg === 'number';
}
function isObject$1(arg) {
return typeof arg === 'object' && arg !== null;
}
function isUndefined$1(arg) {
return arg === void 0;
}
/**
* A DerivedHelper is a way to create sub requests to
* Algolia from a main helper.
* @class
* @classdesc The DerivedHelper provides an event based interface for search callbacks:
* - search: when a search is triggered using the `search()` method.
* - result: when the response is retrieved from Algolia and is processed.
* This event contains a {@link SearchResults} object and the
* {@link SearchParameters} corresponding to this answer.
*/
function DerivedHelper(mainHelper, fn) {
this.main = mainHelper;
this.fn = fn;
this.lastResults = null;
}
util.inherits(DerivedHelper, events.EventEmitter);
/**
* Detach this helper from the main helper
* @return {undefined}
* @throws Error if the derived helper is already detached
*/
DerivedHelper.prototype.detach = function() {
this.removeAllListeners();
this.main.detachDerivedHelper(this);
};
DerivedHelper.prototype.getModifiedState = function(parameters) {
return this.fn(parameters);
};
var DerivedHelper_1 = DerivedHelper;
var requestBuilder = {
/**
* Get all the queries to send to the client, those queries can used directly
* with the Algolia client.
* @private
* @return {object[]} The queries
*/
_getQueries: function getQueries(index, state) {
var queries = [];
// One query for the hits
queries.push({
indexName: index,
params: requestBuilder._getHitsSearchParams(state)
});
// One for each disjunctive facets
forEach_1(state.getRefinedDisjunctiveFacets(), function(refinedFacet) {
queries.push({
indexName: index,
params: requestBuilder._getDisjunctiveFacetSearchParams(state, refinedFacet)
});
});
// maybe more to get the root level of hierarchical facets when activated
forEach_1(state.getRefinedHierarchicalFacets(), function(refinedFacet) {
var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);
var currentRefinement = state.getHierarchicalRefinement(refinedFacet);
// if we are deeper than level 0 (starting from `beer > IPA`)
// we want to get the root values
var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
if (currentRefinement.length > 0 && currentRefinement[0].split(separator).length > 1) {
queries.push({
indexName: index,
params: requestBuilder._getDisjunctiveFacetSearchParams(state, refinedFacet, true)
});
}
});
return queries;
},
/**
* Build search parameters used to fetch hits
* @private
* @return {object.<string, any>}
*/
_getHitsSearchParams: function(state) {
var facets = state.facets
.concat(state.disjunctiveFacets)
.concat(requestBuilder._getHitsHierarchicalFacetsAttributes(state));
var facetFilters = requestBuilder._getFacetFilters(state);
var numericFilters = requestBuilder._getNumericFilters(state);
var tagFilters = requestBuilder._getTagFilters(state);
var additionalParams = {
facets: facets,
tagFilters: tagFilters
};
if (facetFilters.length > 0) {
additionalParams.facetFilters = facetFilters;
}
if (numericFilters.length > 0) {
additionalParams.numericFilters = numericFilters;
}
return merge_1(state.getQueryParams(), additionalParams);
},
/**
* Build search parameters used to fetch a disjunctive facet
* @private
* @param {string} facet the associated facet name
* @param {boolean} hierarchicalRootLevel ?? FIXME
* @return {object}
*/
_getDisjunctiveFacetSearchParams: function(state, facet, hierarchicalRootLevel) {
var facetFilters = requestBuilder._getFacetFilters(state, facet, hierarchicalRootLevel);
var numericFilters = requestBuilder._getNumericFilters(state, facet);
var tagFilters = requestBuilder._getTagFilters(state);
var additionalParams = {
hitsPerPage: 1,
page: 0,
attributesToRetrieve: [],
attributesToHighlight: [],
attributesToSnippet: [],
tagFilters: tagFilters,
analytics: false,
clickAnalytics: false
};
var hierarchicalFacet = state.getHierarchicalFacetByName(facet);
if (hierarchicalFacet) {
additionalParams.facets = requestBuilder._getDisjunctiveHierarchicalFacetAttribute(
state,
hierarchicalFacet,
hierarchicalRootLevel
);
} else {
additionalParams.facets = facet;
}
if (numericFilters.length > 0) {
additionalParams.numericFilters = numericFilters;
}
if (facetFilters.length > 0) {
additionalParams.facetFilters = facetFilters;
}
return merge_1(state.getQueryParams(), additionalParams);
},
/**
* Return the numeric filters in an algolia request fashion
* @private
* @param {string} [facetName] the name of the attribute for which the filters should be excluded
* @return {string[]} the numeric filters in the algolia format
*/
_getNumericFilters: function(state, facetName) {
if (state.numericFilters) {
return state.numericFilters;
}
var numericFilters = [];
forEach_1(state.numericRefinements, function(operators, attribute) {
forEach_1(operators, function(values, operator) {
if (facetName !== attribute) {
forEach_1(values, function(value) {
if (Array.isArray(value)) {
var vs = map_1(value, function(v) {
return attribute + operator + v;
});
numericFilters.push(vs);
} else {
numericFilters.push(attribute + operator + value);
}
});
}
});
});
return numericFilters;
},
/**
* Return the tags filters depending
* @private
* @return {string}
*/
_getTagFilters: function(state) {
if (state.tagFilters) {
return state.tagFilters;
}
return state.tagRefinements.join(',');
},
/**
* Build facetFilters parameter based on current refinements. The array returned
* contains strings representing the facet filters in the algolia format.
* @private
* @param {string} [facet] if set, the current disjunctive facet
* @return {array.<string>}
*/
_getFacetFilters: function(state, facet, hierarchicalRootLevel) {
var facetFilters = [];
forEach_1(state.facetsRefinements, function(facetValues, facetName) {
forEach_1(facetValues, function(facetValue) {
facetFilters.push(facetName + ':' + facetValue);
});
});
forEach_1(state.facetsExcludes, function(facetValues, facetName) {
forEach_1(facetValues, function(facetValue) {
facetFilters.push(facetName + ':-' + facetValue);
});
});
forEach_1(state.disjunctiveFacetsRefinements, function(facetValues, facetName) {
if (facetName === facet || !facetValues || facetValues.length === 0) return;
var orFilters = [];
forEach_1(facetValues, function(facetValue) {
orFilters.push(facetName + ':' + facetValue);
});
facetFilters.push(orFilters);
});
forEach_1(state.hierarchicalFacetsRefinements, function(facetValues, facetName) {
var facetValue = facetValues[0];
if (facetValue === undefined) {
return;
}
var hierarchicalFacet = state.getHierarchicalFacetByName(facetName);
var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
var rootPath = state._getHierarchicalRootPath(hierarchicalFacet);
var attributeToRefine;
var attributesIndex;
// we ask for parent facet values only when the `facet` is the current hierarchical facet
if (facet === facetName) {
// if we are at the root level already, no need to ask for facet values, we get them from
// the hits query
if (facetValue.indexOf(separator) === -1 || (!rootPath && hierarchicalRootLevel === true) ||
(rootPath && rootPath.split(separator).length === facetValue.split(separator).length)) {
return;
}
if (!rootPath) {
attributesIndex = facetValue.split(separator).length - 2;
facetValue = facetValue.slice(0, facetValue.lastIndexOf(separator));
} else {
attributesIndex = rootPath.split(separator).length - 1;
facetValue = rootPath;
}
attributeToRefine = hierarchicalFacet.attributes[attributesIndex];
} else {
attributesIndex = facetValue.split(separator).length - 1;
attributeToRefine = hierarchicalFacet.attributes[attributesIndex];
}
if (attributeToRefine) {
facetFilters.push([attributeToRefine + ':' + facetValue]);
}
});
return facetFilters;
},
_getHitsHierarchicalFacetsAttributes: function(state) {
var out = [];
return reduce_1(
state.hierarchicalFacets,
// ask for as much levels as there's hierarchical refinements
function getHitsAttributesForHierarchicalFacet(allAttributes, hierarchicalFacet) {
var hierarchicalRefinement = state.getHierarchicalRefinement(hierarchicalFacet.name)[0];
// if no refinement, ask for root level
if (!hierarchicalRefinement) {
allAttributes.push(hierarchicalFacet.attributes[0]);
return allAttributes;
}
var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
var level = hierarchicalRefinement.split(separator).length;
var newAttributes = hierarchicalFacet.attributes.slice(0, level + 1);
return allAttributes.concat(newAttributes);
}, out);
},
_getDisjunctiveHierarchicalFacetAttribute: function(state, hierarchicalFacet, rootLevel) {
var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);
if (rootLevel === true) {
var rootPath = state._getHierarchicalRootPath(hierarchicalFacet);
var attributeIndex = 0;
if (rootPath) {
attributeIndex = rootPath.split(separator).length;
}
return [hierarchicalFacet.attributes[attributeIndex]];
}
var hierarchicalRefinement = state.getHierarchicalRefinement(hierarchicalFacet.name)[0] || '';
// if refinement is 'beers > IPA > Flying dog',
// then we want `facets: ['beers > IPA']` as disjunctive facet (parent level values)
var parentLevel = hierarchicalRefinement.split(separator).length - 1;
return hierarchicalFacet.attributes.slice(0, parentLevel + 1);
},
getSearchForFacetQuery: function(facetName, query, maxFacetHits, state) {
var stateForSearchForFacetValues = state.isDisjunctiveFacet(facetName) ?
state.clearRefinements(facetName) :
state;
var searchForFacetSearchParameters = {
facetQuery: query,
facetName: facetName
};
if (typeof maxFacetHits === 'number') {
searchForFacetSearchParameters.maxFacetHits = maxFacetHits;
}
var queries = merge_1(requestBuilder._getHitsSearchParams(stateForSearchForFacetValues), searchForFacetSearchParameters);
return queries;
}
};
var requestBuilder_1 = requestBuilder;
/**
* The base implementation of `_.invert` and `_.invertBy` which inverts
* `object` with values transformed by `iteratee` and set by `setter`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform values.
* @param {Object} accumulator The initial inverted object.
* @returns {Function} Returns `accumulator`.
*/
function baseInverter(object, setter, iteratee, accumulator) {
_baseForOwn(object, function(value, key, object) {
setter(accumulator, iteratee(value), key, object);
});
return accumulator;
}
var _baseInverter = baseInverter;
/**
* Creates a function like `_.invertBy`.
*
* @private
* @param {Function} setter The function to set accumulator values.
* @param {Function} toIteratee The function to resolve iteratees.
* @returns {Function} Returns the new inverter function.
*/
function createInverter(setter, toIteratee) {
return function(object, iteratee) {
return _baseInverter(object, setter, toIteratee(iteratee), {});
};
}
var _createInverter = createInverter;
/** Used for built-in method references. */
var objectProto$k = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$2 = objectProto$k.toString;
/**
* Creates an object composed of the inverted keys and values of `object`.
* If `object` contains duplicate values, subsequent values overwrite
* property assignments of previous values.
*
* @static
* @memberOf _
* @since 0.7.0
* @category Object
* @param {Object} object The object to invert.
* @returns {Object} Returns the new inverted object.
* @example
*
* var object = { 'a': 1, 'b': 2, 'c': 1 };
*
* _.invert(object);
* // => { '1': 'c', '2': 'b' }
*/
var invert = _createInverter(function(result, value, key) {
if (value != null &&
typeof value.toString != 'function') {
value = nativeObjectToString$2.call(value);
}
result[value] = key;
}, constant_1(identity_1));
var invert_1 = invert;
var keys2Short = {
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'
};
var short2Keys = invert_1(keys2Short);
var shortener = {
/**
* All the keys of the state, encoded.
* @const
*/
ENCODED_PARAMETERS: keys_1(short2Keys),
/**
* Decode a shorten attribute
* @param {string} shortKey the shorten attribute
* @return {string} the decoded attribute, undefined otherwise
*/
decode: function(shortKey) {
return short2Keys[shortKey];
},
/**
* Encode an attribute into a short version
* @param {string} key the attribute
* @return {string} the shorten attribute
*/
encode: function(key) {
return keys2Short[key];
}
};
var utils = createCommonjsModule(function (module, exports) {
var has = Object.prototype.hasOwnProperty;
var hexTable = (function () {
var array = [];
for (var i = 0; i < 256; ++i) {
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
}
return array;
}());
var compactQueue = function compactQueue(queue) {
var obj;
while (queue.length) {
var item = queue.pop();
obj = item.obj[item.prop];
if (Array.isArray(obj)) {
var compacted = [];
for (var j = 0; j < obj.length; ++j) {
if (typeof obj[j] !== 'undefined') {
compacted.push(obj[j]);
}
}
item.obj[item.prop] = compacted;
}
}
return obj;
};
exports.arrayToObject = function arrayToObject(source, options) {
var obj = options && options.plainObjects ? Object.create(null) : {};
for (var i = 0; i < source.length; ++i) {
if (typeof source[i] !== 'undefined') {
obj[i] = source[i];
}
}
return obj;
};
exports.merge = function merge(target, source, options) {
if (!source) {
return target;
}
if (typeof source !== 'object') {
if (Array.isArray(target)) {
target.push(source);
} else if (typeof target === 'object') {
if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {
target[source] = true;
}
} else {
return [target, source];
}
return target;
}
if (typeof target !== 'object') {
return [target].concat(source);
}
var mergeTarget = target;
if (Array.isArray(target) && !Array.isArray(source)) {
mergeTarget = exports.arrayToObject(target, options);
}
if (Array.isArray(target) && Array.isArray(source)) {
source.forEach(function (item, i) {
if (has.call(target, i)) {
if (target[i] && typeof target[i] === 'object') {
target[i] = exports.merge(target[i], item, options);
} else {
target.push(item);
}
} else {
target[i] = item;
}
});
return target;
}
return Object.keys(source).reduce(function (acc, key) {
var value = source[key];
if (has.call(acc, key)) {
acc[key] = exports.merge(acc[key], value, options);
} else {
acc[key] = value;
}
return acc;
}, mergeTarget);
};
exports.assign = function assignSingleSource(target, source) {
return Object.keys(source).reduce(function (acc, key) {
acc[key] = source[key];
return acc;
}, target);
};
exports.decode = function (str) {
try {
return decodeURIComponent(str.replace(/\+/g, ' '));
} catch (e) {
return str;
}
};
exports.encode = function encode(str) {
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
// It has been adapted here for stricter adherence to RFC 3986
if (str.length === 0) {
return str;
}
var string = typeof str === 'string' ? str : String(str);
var out = '';
for (var i = 0; i < string.length; ++i) {
var c = string.charCodeAt(i);
if (
c === 0x2D // -
|| c === 0x2E // .
|| c === 0x5F // _
|| c === 0x7E // ~
|| (c >= 0x30 && c <= 0x39) // 0-9
|| (c >= 0x41 && c <= 0x5A) // a-z
|| (c >= 0x61 && c <= 0x7A) // A-Z
) {
out += string.charAt(i);
continue;
}
if (c < 0x80) {
out = out + hexTable[c];
continue;
}
if (c < 0x800) {
out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
continue;
}
if (c < 0xD800 || c >= 0xE000) {
out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
continue;
}
i += 1;
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
out += hexTable[0xF0 | (c >> 18)]
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
+ hexTable[0x80 | (c & 0x3F)];
}
return out;
};
exports.compact = function compact(value) {
var queue = [{ obj: { o: value }, prop: 'o' }];
var refs = [];
for (var i = 0; i < queue.length; ++i) {
var item = queue[i];
var obj = item.obj[item.prop];
var keys = Object.keys(obj);
for (var j = 0; j < keys.length; ++j) {
var key = keys[j];
var val = obj[key];
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
queue.push({ obj: obj, prop: key });
refs.push(val);
}
}
}
return compactQueue(queue);
};
exports.isRegExp = function isRegExp(obj) {
return Object.prototype.toString.call(obj) === '[object RegExp]';
};
exports.isBuffer = function isBuffer(obj) {
if (obj === null || typeof obj === 'undefined') {
return false;
}
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
};
});
var utils_1 = utils.arrayToObject;
var utils_2 = utils.merge;
var utils_3 = utils.assign;
var utils_4 = utils.decode;
var utils_5 = utils.encode;
var utils_6 = utils.compact;
var utils_7 = utils.isRegExp;
var utils_8 = utils.isBuffer;
var replace = String.prototype.replace;
var percentTwenties = /%20/g;
var formats = {
'default': 'RFC3986',
formatters: {
RFC1738: function (value) {
return replace.call(value, percentTwenties, '+');
},
RFC3986: function (value) {
return value;
}
},
RFC1738: 'RFC1738',
RFC3986: 'RFC3986'
};
var arrayPrefixGenerators = {
brackets: function brackets(prefix) { // eslint-disable-line func-name-matching
return prefix + '[]';
},
indices: function indices(prefix, key) { // eslint-disable-line func-name-matching
return prefix + '[' + key + ']';
},
repeat: function repeat(prefix) { // eslint-disable-line func-name-matching
return prefix;
}
};
var toISO = Date.prototype.toISOString;
var defaults$1 = {
delimiter: '&',
encode: true,
encoder: utils.encode,
encodeValuesOnly: false,
serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching
return toISO.call(date);
},
skipNulls: false,
strictNullHandling: false
};
var stringify = function stringify( // eslint-disable-line func-name-matching
object,
prefix,
generateArrayPrefix,
strictNullHandling,
skipNulls,
encoder,
filter,
sort,
allowDots,
serializeDate,
formatter,
encodeValuesOnly
) {
var obj = object;
if (typeof filter === 'function') {
obj = filter(prefix, obj);
} else if (obj instanceof Date) {
obj = serializeDate(obj);
} else if (obj === null) {
if (strictNullHandling) {
return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder) : prefix;
}
obj = '';
}
if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {
if (encoder) {
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder);
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults$1.encoder))];
}
return [formatter(prefix) + '=' + formatter(String(obj))];
}
var values = [];
if (typeof obj === 'undefined') {
return values;
}
var objKeys;
if (Array.isArray(filter)) {
objKeys = filter;
} else {
var keys = Object.keys(obj);
objKeys = sort ? keys.sort(sort) : keys;
}
for (var i = 0; i < objKeys.length; ++i) {
var key = objKeys[i];
if (skipNulls && obj[key] === null) {
continue;
}
if (Array.isArray(obj)) {
values = values.concat(stringify(
obj[key],
generateArrayPrefix(prefix, key),
generateArrayPrefix,
strictNullHandling,
skipNulls,
encoder,
filter,
sort,
allowDots,
serializeDate,
formatter,
encodeValuesOnly
));
} else {
values = values.concat(stringify(
obj[key],
prefix + (allowDots ? '.' + key : '[' + key + ']'),
generateArrayPrefix,
strictNullHandling,
skipNulls,
encoder,
filter,
sort,
allowDots,
serializeDate,
formatter,
encodeValuesOnly
));
}
}
return values;
};
var stringify_1 = function (object, opts) {
var obj = object;
var options = opts ? utils.assign({}, opts) : {};
if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {
throw new TypeError('Encoder has to be a function.');
}
var delimiter = typeof options.delimiter === 'undefined' ? defaults$1.delimiter : options.delimiter;
var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults$1.strictNullHandling;
var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults$1.skipNulls;
var encode = typeof options.encode === 'boolean' ? options.encode : defaults$1.encode;
var encoder = typeof options.encoder === 'function' ? options.encoder : defaults$1.encoder;
var sort = typeof options.sort === 'function' ? options.sort : null;
var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;
var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults$1.serializeDate;
var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults$1.encodeValuesOnly;
if (typeof options.format === 'undefined') {
options.format = formats['default'];
} else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {
throw new TypeError('Unknown format option provided.');
}
var formatter = formats.formatters[options.format];
var objKeys;
var filter;
if (typeof options.filter === 'function') {
filter = options.filter;
obj = filter('', obj);
} else if (Array.isArray(options.filter)) {
filter = options.filter;
objKeys = filter;
}
var keys = [];
if (typeof obj !== 'object' || obj === null) {
return '';
}
var arrayFormat;
if (options.arrayFormat in arrayPrefixGenerators) {
arrayFormat = options.arrayFormat;
} else if ('indices' in options) {
arrayFormat = options.indices ? 'indices' : 'repeat';
} else {
arrayFormat = 'indices';
}
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
if (!objKeys) {
objKeys = Object.keys(obj);
}
if (sort) {
objKeys.sort(sort);
}
for (var i = 0; i < objKeys.length; ++i) {
var key = objKeys[i];
if (skipNulls && obj[key] === null) {
continue;
}
keys = keys.concat(stringify(
obj[key],
key,
generateArrayPrefix,
strictNullHandling,
skipNulls,
encode ? encoder : null,
filter,
sort,
allowDots,
serializeDate,
formatter,
encodeValuesOnly
));
}
var joined = keys.join(delimiter);
var prefix = options.addQueryPrefix === true ? '?' : '';
return joined.length > 0 ? prefix + joined : '';
};
var has = Object.prototype.hasOwnProperty;
var defaults$2 = {
allowDots: false,
allowPrototypes: false,
arrayLimit: 20,
decoder: utils.decode,
delimiter: '&',
depth: 5,
parameterLimit: 1000,
plainObjects: false,
strictNullHandling: false
};
var parseValues = function parseQueryStringValues(str, options) {
var obj = {};
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
var parts = cleanStr.split(options.delimiter, limit);
for (var i = 0; i < parts.length; ++i) {
var part = parts[i];
var bracketEqualsPos = part.indexOf(']=');
var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
var key, val;
if (pos === -1) {
key = options.decoder(part, defaults$2.decoder);
val = options.strictNullHandling ? null : '';
} else {
key = options.decoder(part.slice(0, pos), defaults$2.decoder);
val = options.decoder(part.slice(pos + 1), defaults$2.decoder);
}
if (has.call(obj, key)) {
obj[key] = [].concat(obj[key]).concat(val);
} else {
obj[key] = val;
}
}
return obj;
};
var parseObject = function (chain, val, options) {
var leaf = val;
for (var i = chain.length - 1; i >= 0; --i) {
var obj;
var root = chain[i];
if (root === '[]') {
obj = [];
obj = obj.concat(leaf);
} else {
obj = options.plainObjects ? Object.create(null) : {};
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
var index = parseInt(cleanRoot, 10);
if (
!isNaN(index)
&& root !== cleanRoot
&& String(index) === cleanRoot
&& index >= 0
&& (options.parseArrays && index <= options.arrayLimit)
) {
obj = [];
obj[index] = leaf;
} else {
obj[cleanRoot] = leaf;
}
}
leaf = obj;
}
return leaf;
};
var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
if (!givenKey) {
return;
}
// Transform dot notation to bracket notation
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
// The regex chunks
var brackets = /(\[[^[\]]*])/;
var child = /(\[[^[\]]*])/g;
// Get the parent
var segment = brackets.exec(key);
var parent = segment ? key.slice(0, segment.index) : key;
// Stash the parent if it exists
var keys = [];
if (parent) {
// If we aren't using plain objects, optionally prefix keys
// that would overwrite object prototype properties
if (!options.plainObjects && has.call(Object.prototype, parent)) {
if (!options.allowPrototypes) {
return;
}
}
keys.push(parent);
}
// Loop through children appending to the array until we hit depth
var i = 0;
while ((segment = child.exec(key)) !== null && i < options.depth) {
i += 1;
if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
if (!options.allowPrototypes) {
return;
}
}
keys.push(segment[1]);
}
// If there's a remainder, just add whatever is left
if (segment) {
keys.push('[' + key.slice(segment.index) + ']');
}
return parseObject(keys, val, options);
};
var parse = function (str, opts) {
var options = opts ? utils.assign({}, opts) : {};
if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') {
throw new TypeError('Decoder has to be a function.');
}
options.ignoreQueryPrefix = options.ignoreQueryPrefix === true;
options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults$2.delimiter;
options.depth = typeof options.depth === 'number' ? options.depth : defaults$2.depth;
options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults$2.arrayLimit;
options.parseArrays = options.parseArrays !== false;
options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults$2.decoder;
options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults$2.allowDots;
options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults$2.plainObjects;
options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults$2.allowPrototypes;
options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults$2.parameterLimit;
options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults$2.strictNullHandling;
if (str === '' || str === null || typeof str === 'undefined') {
return options.plainObjects ? Object.create(null) : {};
}
var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
var obj = options.plainObjects ? Object.create(null) : {};
// Iterate over the keys and setup the new object
var keys = Object.keys(tempObj);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
var newObj = parseKeys(key, tempObj[key], options);
obj = utils.merge(obj, newObj, options);
}
return utils.compact(obj);
};
var lib$1 = {
formats: formats,
parse: parse,
stringify: stringify_1
};
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG$7 = 1,
WRAP_PARTIAL_FLAG$4 = 32;
/**
* Creates a function that invokes `func` with the `this` binding of `thisArg`
* and `partials` prepended to the arguments it receives.
*
* The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
* may be used as a placeholder for partially applied arguments.
*
* **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
* property of bound functions.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to bind.
* @param {*} thisArg The `this` binding of `func`.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new bound function.
* @example
*
* function greet(greeting, punctuation) {
* return greeting + ' ' + this.user + punctuation;
* }
*
* var object = { 'user': 'fred' };
*
* var bound = _.bind(greet, object, 'hi');
* bound('!');
* // => 'hi fred!'
*
* // Bound with placeholders.
* var bound = _.bind(greet, object, _, '!');
* bound('hi');
* // => 'hi fred!'
*/
var bind = _baseRest(function(func, thisArg, partials) {
var bitmask = WRAP_BIND_FLAG$7;
if (partials.length) {
var holders = _replaceHolders(partials, _getHolder(bind));
bitmask |= WRAP_PARTIAL_FLAG$4;
}
return _createWrap(func, bitmask, thisArg, partials, holders);
});
// Assign default placeholders.
bind.placeholder = {};
var bind_1 = bind;
/**
* The base implementation of `_.pick` without support for individual
* property identifiers.
*
* @private
* @param {Object} object The source object.
* @param {string[]} paths The property paths to pick.
* @returns {Object} Returns the new object.
*/
function basePick(object, paths) {
return _basePickBy(object, paths, function(value, path) {
return hasIn_1(object, path);
});
}
var _basePick = basePick;
/**
* Creates an object composed of the picked `object` properties.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to pick.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pick(object, ['a', 'c']);
* // => { 'a': 1, 'c': 3 }
*/
var pick = _flatRest(function(object, paths) {
return object == null ? {} : _basePick(object, paths);
});
var pick_1 = pick;
/**
* The opposite of `_.mapValues`; this method creates an object with the
* same values as `object` and keys generated by running each own enumerable
* string keyed property of `object` thru `iteratee`. The iteratee is invoked
* with three arguments: (value, key, object).
*
* @static
* @memberOf _
* @since 3.8.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
* @see _.mapValues
* @example
*
* _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
* return key + value;
* });
* // => { 'a1': 1, 'b2': 2 }
*/
function mapKeys(object, iteratee) {
var result = {};
iteratee = _baseIteratee(iteratee, 3);
_baseForOwn(object, function(value, key, object) {
_baseAssignValue(result, iteratee(value, key, object), value);
});
return result;
}
var mapKeys_1 = mapKeys;
/**
* Creates an object with the same keys as `object` and values generated
* by running each own enumerable string keyed property of `object` thru
* `iteratee`. The iteratee is invoked with three arguments:
* (value, key, object).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
* @see _.mapKeys
* @example
*
* var users = {
* 'fred': { 'user': 'fred', 'age': 40 },
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
* };
*
* _.mapValues(users, function(o) { return o.age; });
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
*
* // The `_.property` iteratee shorthand.
* _.mapValues(users, 'age');
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
*/
function mapValues(object, iteratee) {
var result = {};
iteratee = _baseIteratee(iteratee, 3);
_baseForOwn(object, function(value, key, object) {
_baseAssignValue(result, key, iteratee(value, key, object));
});
return result;
}
var mapValues_1 = mapValues;
/**
* Module containing the functions to serialize and deserialize
* {SearchParameters} in the query string format
* @module algoliasearchHelper.url
*/
var encode = utils.encode;
function recursiveEncode(input) {
if (isPlainObject_1(input)) {
return mapValues_1(input, recursiveEncode);
}
if (Array.isArray(input)) {
return map_1(input, recursiveEncode);
}
if (isString_1(input)) {
return encode(input);
}
return input;
}
var refinementsParameters = ['dFR', 'fR', 'nR', 'hFR', 'tR'];
var stateKeys = shortener.ENCODED_PARAMETERS;
function sortQueryStringValues(prefixRegexp, invertedMapping, a, b) {
if (prefixRegexp !== null) {
a = a.replace(prefixRegexp, '');
b = b.replace(prefixRegexp, '');
}
a = invertedMapping[a] || a;
b = invertedMapping[b] || b;
if (stateKeys.indexOf(a) !== -1 || stateKeys.indexOf(b) !== -1) {
if (a === 'q') return -1;
if (b === 'q') return 1;
var isARefinements = refinementsParameters.indexOf(a) !== -1;
var isBRefinements = refinementsParameters.indexOf(b) !== -1;
if (isARefinements && !isBRefinements) {
return 1;
} else if (isBRefinements && !isARefinements) {
return -1;
}
}
return a.localeCompare(b);
}
/**
* Read a query string and return an object containing the state
* @param {string} queryString the query string that will be decoded
* @param {object} [options] accepted options :
* - prefix : the prefix used for the saved attributes, you have to provide the
* same that was used for serialization
* - mapping : map short attributes to another value e.g. {q: 'query'}
* @return {object} partial search parameters object (same properties than in the
* SearchParameters but not exhaustive)
*/
var getStateFromQueryString = function(queryString, options) {
var prefixForParameters = options && options.prefix || '';
var mapping = options && options.mapping || {};
var invertedMapping = invert_1(mapping);
var partialStateWithPrefix = lib$1.parse(queryString);
var prefixRegexp = new RegExp('^' + prefixForParameters);
var partialState = mapKeys_1(
partialStateWithPrefix,
function(v, k) {
var hasPrefix = prefixForParameters && prefixRegexp.test(k);
var unprefixedKey = hasPrefix ? k.replace(prefixRegexp, '') : k;
var decodedKey = shortener.decode(invertedMapping[unprefixedKey] || unprefixedKey);
return decodedKey || unprefixedKey;
}
);
var partialStateWithParsedNumbers = SearchParameters_1._parseNumbers(partialState);
return pick_1(partialStateWithParsedNumbers, SearchParameters_1.PARAMETERS);
};
/**
* Retrieve an object of all the properties that are not understandable as helper
* parameters.
* @param {string} queryString the query string to read
* @param {object} [options] the options
* - prefixForParameters : prefix used for the helper configuration keys
* - mapping : map short attributes to another value e.g. {q: 'query'}
* @return {object} the object containing the parsed configuration that doesn't
* to the helper
*/
var getUnrecognizedParametersInQueryString = function(queryString, options) {
var prefixForParameters = options && options.prefix;
var mapping = options && options.mapping || {};
var invertedMapping = invert_1(mapping);
var foreignConfig = {};
var config = lib$1.parse(queryString);
if (prefixForParameters) {
var prefixRegexp = new RegExp('^' + prefixForParameters);
forEach_1(config, function(v, key) {
if (!prefixRegexp.test(key)) foreignConfig[key] = v;
});
} else {
forEach_1(config, function(v, key) {
if (!shortener.decode(invertedMapping[key] || key)) foreignConfig[key] = v;
});
}
return foreignConfig;
};
/**
* Generate a query string for the state passed according to the options
* @param {SearchParameters} state state to serialize
* @param {object} [options] May contain the following parameters :
* - prefix : prefix in front of the keys
* - mapping : map short attributes to another value e.g. {q: 'query'}
* - moreAttributes : more values to be added in the query string. Those values
* won't be prefixed.
* - safe : get safe urls for use in emails, chat apps or any application auto linking urls.
* All parameters and values will be encoded in a way that it's safe to share them.
* Default to false for legacy reasons ()
* @return {string} the query string
*/
var getQueryStringFromState = function(state, options) {
var moreAttributes = options && options.moreAttributes;
var prefixForParameters = options && options.prefix || '';
var mapping = options && options.mapping || {};
var safe = options && options.safe || false;
var invertedMapping = invert_1(mapping);
var stateForUrl = safe ? state : recursiveEncode(state);
var encodedState = mapKeys_1(
stateForUrl,
function(v, k) {
var shortK = shortener.encode(k);
return prefixForParameters + (mapping[shortK] || shortK);
}
);
var prefixRegexp = prefixForParameters === '' ? null : new RegExp('^' + prefixForParameters);
var sort = bind_1(sortQueryStringValues, null, prefixRegexp, invertedMapping);
if (!isEmpty_1(moreAttributes)) {
var stateQs = lib$1.stringify(encodedState, {encode: safe, sort: sort});
var moreQs = lib$1.stringify(moreAttributes, {encode: safe});
if (!stateQs) return moreQs;
return stateQs + '&' + moreQs;
}
return lib$1.stringify(encodedState, {encode: safe, sort: sort});
};
var url = {
getStateFromQueryString: getStateFromQueryString,
getUnrecognizedParametersInQueryString: getUnrecognizedParametersInQueryString,
getQueryStringFromState: getQueryStringFromState
};
var version$1 = '2.26.0';
/**
* Event triggered when a parameter is set or updated
* @event AlgoliaSearchHelper#event:change
* @property {SearchParameters} state the current parameters with the latest changes applied
* @property {SearchResults} lastResults the previous results received from Algolia. `null` before
* the first request
* @example
* helper.on('change', function(state, lastResults) {
* console.log('The parameters have changed');
* });
*/
/**
* Event triggered when a main search is sent to Algolia
* @event AlgoliaSearchHelper#event:search
* @property {SearchParameters} state the parameters used for this search
* @property {SearchResults} lastResults the results from the previous search. `null` if
* it is the first search.
* @example
* helper.on('search', function(state, lastResults) {
* console.log('Search sent');
* });
*/
/**
* Event triggered when a search using `searchForFacetValues` is sent to Algolia
* @event AlgoliaSearchHelper#event:searchForFacetValues
* @property {SearchParameters} state the parameters used for this search
* it is the first search.
* @property {string} facet the facet searched into
* @property {string} query the query used to search in the facets
* @example
* helper.on('searchForFacetValues', function(state, facet, query) {
* console.log('searchForFacetValues sent');
* });
*/
/**
* Event triggered when a search using `searchOnce` is sent to Algolia
* @event AlgoliaSearchHelper#event:searchOnce
* @property {SearchParameters} state the parameters used for this search
* it is the first search.
* @example
* helper.on('searchOnce', function(state) {
* console.log('searchOnce sent');
* });
*/
/**
* Event triggered when the results are retrieved from Algolia
* @event AlgoliaSearchHelper#event:result
* @property {SearchResults} results the results received from Algolia
* @property {SearchParameters} state the parameters used to query Algolia. Those might
* be different from the one in the helper instance (for example if the network is unreliable).
* @example
* helper.on('result', function(results, state) {
* console.log('Search results received');
* });
*/
/**
* Event triggered when Algolia sends back an error. For example, if an unknown parameter is
* used, the error can be caught using this event.
* @event AlgoliaSearchHelper#event:error
* @property {Error} error the error returned by the Algolia.
* @example
* helper.on('error', function(error) {
* console.log('Houston we got a problem.');
* });
*/
/**
* Event triggered when the queue of queries have been depleted (with any result or outdated queries)
* @event AlgoliaSearchHelper#event:searchQueueEmpty
* @example
* helper.on('searchQueueEmpty', function() {
* console.log('No more search pending');
* // This is received before the result event if we're not expecting new results
* });
*
* helper.search();
*/
/**
* Initialize a new AlgoliaSearchHelper
* @class
* @classdesc The AlgoliaSearchHelper is a class that ease the management of the
* search. It provides an event based interface for search callbacks:
* - change: when the internal search state is changed.
* This event contains a {@link SearchParameters} object and the
* {@link SearchResults} of the last result if any.
* - search: when a search is triggered using the `search()` method.
* - result: when the response is retrieved from Algolia and is processed.
* This event contains a {@link SearchResults} object and the
* {@link SearchParameters} corresponding to this answer.
* - error: when the response is an error. This event contains the error returned by the server.
* @param {AlgoliaSearch} client an AlgoliaSearch client
* @param {string} index the index name to query
* @param {SearchParameters | object} options an object defining the initial
* config of the search. It doesn't have to be a {SearchParameters},
* just an object containing the properties you need from it.
*/
function AlgoliaSearchHelper(client, index, options) {
if (client.addAlgoliaAgent && !doesClientAgentContainsHelper(client)) {
client.addAlgoliaAgent('JS Helper ' + version$1);
}
this.setClient(client);
var opts = options || {};
opts.index = index;
this.state = SearchParameters_1.make(opts);
this.lastResults = null;
this._queryId = 0;
this._lastQueryIdReceived = -1;
this.derivedHelpers = [];
this._currentNbQueries = 0;
}
util.inherits(AlgoliaSearchHelper, events.EventEmitter);
/**
* Start the search with the parameters set in the state. When the
* method is called, it triggers a `search` event. The results will
* be available through the `result` event. If an error occurs, an
* `error` will be fired instead.
* @return {AlgoliaSearchHelper}
* @fires search
* @fires result
* @fires error
* @chainable
*/
AlgoliaSearchHelper.prototype.search = function() {
this._search();
return this;
};
/**
* Gets the search query parameters that would be sent to the Algolia Client
* for the hits
* @return {object} Query Parameters
*/
AlgoliaSearchHelper.prototype.getQuery = function() {
var state = this.state;
return requestBuilder_1._getHitsSearchParams(state);
};
/**
* Start a search using a modified version of the current state. This method does
* not trigger the helper lifecycle and does not modify the state kept internally
* by the helper. This second aspect means that the next search call will be the
* same as a search call before calling searchOnce.
* @param {object} options can contain all the parameters that can be set to SearchParameters
* plus the index
* @param {function} [callback] optional callback executed when the response from the
* server is back.
* @return {promise|undefined} if a callback is passed the method returns undefined
* otherwise it returns a promise containing an object with two keys :
* - content with a SearchResults
* - state with the state used for the query as a SearchParameters
* @example
* // Changing the number of records returned per page to 1
* // This example uses the callback API
* var state = helper.searchOnce({hitsPerPage: 1},
* function(error, content, state) {
* // if an error occurred it will be passed in error, otherwise its value is null
* // content contains the results formatted as a SearchResults
* // state is the instance of SearchParameters used for this search
* });
* @example
* // Changing the number of records returned per page to 1
* // This example uses the promise API
* var state1 = helper.searchOnce({hitsPerPage: 1})
* .then(promiseHandler);
*
* function promiseHandler(res) {
* // res contains
* // {
* // content : SearchResults
* // state : SearchParameters (the one used for this specific search)
* // }
* }
*/
AlgoliaSearchHelper.prototype.searchOnce = function(options, cb) {
var tempState = !options ? this.state : this.state.setQueryParameters(options);
var queries = requestBuilder_1._getQueries(tempState.index, tempState);
var self = this;
this._currentNbQueries++;
this.emit('searchOnce', tempState);
if (cb) {
this.client
.search(queries)
.then(function(content) {
self._currentNbQueries--;
if (self._currentNbQueries === 0) {
self.emit('searchQueueEmpty');
}
cb(null, new SearchResults_1(tempState, content.results), tempState);
})
.catch(function(err) {
self._currentNbQueries--;
if (self._currentNbQueries === 0) {
self.emit('searchQueueEmpty');
}
cb(err, null, tempState);
});
return undefined;
}
return this.client.search(queries).then(function(content) {
self._currentNbQueries--;
if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');
return {
content: new SearchResults_1(tempState, content.results),
state: tempState,
_originalResponse: content
};
}, function(e) {
self._currentNbQueries--;
if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');
throw e;
});
};
/**
* Structure of each result when using
* [`searchForFacetValues()`](reference.html#AlgoliaSearchHelper#searchForFacetValues)
* @typedef FacetSearchHit
* @type {object}
* @property {string} value the facet value
* @property {string} highlighted the facet value highlighted with the query string
* @property {number} count number of occurrence of this facet value
* @property {boolean} isRefined true if the value is already refined
*/
/**
* Structure of the data resolved by the
* [`searchForFacetValues()`](reference.html#AlgoliaSearchHelper#searchForFacetValues)
* promise.
* @typedef FacetSearchResult
* @type {object}
* @property {FacetSearchHit} facetHits the results for this search for facet values
* @property {number} processingTimeMS time taken by the query inside the engine
*/
/**
* Search for facet values based on an query and the name of a faceted attribute. This
* triggers a search and will return a promise. On top of using the query, it also sends
* the parameters from the state so that the search is narrowed down to only the possible values.
*
* See the description of [FacetSearchResult](reference.html#FacetSearchResult)
* @param {string} facet the name of the faceted attribute
* @param {string} query the string query for the search
* @param {number} [maxFacetHits] the maximum number values returned. Should be > 0 and <= 100
* @param {object} [userState] the set of custom parameters to use on top of the current state. Setting a property to `undefined` removes
* it in the generated query.
* @return {promise.<FacetSearchResult>} the results of the search
*/
AlgoliaSearchHelper.prototype.searchForFacetValues = function(facet, query, maxFacetHits, userState) {
var state = this.state.setQueryParameters(userState || {});
var isDisjunctive = state.isDisjunctiveFacet(facet);
var algoliaQuery = requestBuilder_1.getSearchForFacetQuery(facet, query, maxFacetHits, state);
this._currentNbQueries++;
var self = this;
this.emit('searchForFacetValues', state, facet, query);
var searchForFacetValuesPromise = typeof this.client.searchForFacetValues === 'function'
? this.client.searchForFacetValues([{indexName: state.index, params: algoliaQuery}])
: this.client.initIndex(state.index).searchForFacetValues(algoliaQuery);
return searchForFacetValuesPromise.then(function addIsRefined(content) {
self._currentNbQueries--;
if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');
content = Array.isArray(content) ? content[0] : content;
content.facetHits = forEach_1(content.facetHits, function(f) {
f.isRefined = isDisjunctive ?
state.isDisjunctiveFacetRefined(facet, f.value) :
state.isFacetRefined(facet, f.value);
});
return content;
}, function(e) {
self._currentNbQueries--;
if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');
throw e;
});
};
/**
* Sets the text query used for the search.
*
* This method resets the current page to 0.
* @param {string} q the user query
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.setQuery = function(q) {
this._change(this.state.setPage(0).setQuery(q));
return this;
};
/**
* Remove all the types of refinements except tags. A string can be provided to remove
* only the refinements of a specific attribute. For more advanced use case, you can
* provide a function instead. This function should follow the
* [clearCallback definition](#SearchParameters.clearCallback).
*
* This method resets the current page to 0.
* @param {string} [name] optional name of the facet / attribute on which we want to remove all refinements
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
* @example
* // Removing all the refinements
* helper.clearRefinements().search();
* @example
* // Removing all the filters on a the category attribute.
* helper.clearRefinements('category').search();
* @example
* // Removing only the exclude filters on the category facet.
* helper.clearRefinements(function(value, attribute, type) {
* return type === 'exclude' && attribute === 'category';
* }).search();
*/
AlgoliaSearchHelper.prototype.clearRefinements = function(name) {
this._change(this.state.setPage(0).clearRefinements(name));
return this;
};
/**
* Remove all the tag filters.
*
* This method resets the current page to 0.
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.clearTags = function() {
this._change(this.state.setPage(0).clearTags());
return this;
};
/**
* Adds a disjunctive filter to a faceted attribute with the `value` provided. If the
* filter is already set, it doesn't change the filters.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} value the associated value (will be converted to string)
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.addDisjunctiveFacetRefinement = function(facet, value) {
this._change(this.state.setPage(0).addDisjunctiveFacetRefinement(facet, value));
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addDisjunctiveFacetRefinement}
*/
AlgoliaSearchHelper.prototype.addDisjunctiveRefine = function() {
return this.addDisjunctiveFacetRefinement.apply(this, arguments);
};
/**
* Adds a refinement on a hierarchical facet. It will throw
* an exception if the facet is not defined or if the facet
* is already refined.
*
* This method resets the current page to 0.
* @param {string} facet the facet name
* @param {string} path the hierarchical facet path
* @return {AlgoliaSearchHelper}
* @throws Error if the facet is not defined or if the facet is refined
* @chainable
* @fires change
*/
AlgoliaSearchHelper.prototype.addHierarchicalFacetRefinement = function(facet, value) {
this._change(this.state.setPage(0).addHierarchicalFacetRefinement(facet, value));
return this;
};
/**
* Adds a an numeric filter to an attribute with the `operator` and `value` provided. If the
* filter is already set, it doesn't change the filters.
*
* This method resets the current page to 0.
* @param {string} attribute the attribute on which the numeric filter applies
* @param {string} operator the operator of the filter
* @param {number} value the value of the filter
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.addNumericRefinement = function(attribute, operator, value) {
this._change(this.state.setPage(0).addNumericRefinement(attribute, operator, value));
return this;
};
/**
* Adds a filter to a faceted attribute with the `value` provided. If the
* filter is already set, it doesn't change the filters.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} value the associated value (will be converted to string)
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.addFacetRefinement = function(facet, value) {
this._change(this.state.setPage(0).addFacetRefinement(facet, value));
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addFacetRefinement}
*/
AlgoliaSearchHelper.prototype.addRefine = function() {
return this.addFacetRefinement.apply(this, arguments);
};
/**
* Adds a an exclusion filter to a faceted attribute with the `value` provided. If the
* filter is already set, it doesn't change the filters.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} value the associated value (will be converted to string)
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.addFacetExclusion = function(facet, value) {
this._change(this.state.setPage(0).addExcludeRefinement(facet, value));
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addFacetExclusion}
*/
AlgoliaSearchHelper.prototype.addExclude = function() {
return this.addFacetExclusion.apply(this, arguments);
};
/**
* Adds a tag filter with the `tag` provided. If the
* filter is already set, it doesn't change the filters.
*
* This method resets the current page to 0.
* @param {string} tag the tag to add to the filter
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.addTag = function(tag) {
this._change(this.state.setPage(0).addTagRefinement(tag));
return this;
};
/**
* Removes an numeric filter to an attribute with the `operator` and `value` provided. If the
* filter is not set, it doesn't change the filters.
*
* Some parameters are optional, triggering different behavior:
* - if the value is not provided, then all the numeric value will be removed for the
* specified attribute/operator couple.
* - if the operator is not provided either, then all the numeric filter on this attribute
* will be removed.
*
* This method resets the current page to 0.
* @param {string} attribute the attribute on which the numeric filter applies
* @param {string} [operator] the operator of the filter
* @param {number} [value] the value of the filter
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.removeNumericRefinement = function(attribute, operator, value) {
this._change(this.state.setPage(0).removeNumericRefinement(attribute, operator, value));
return this;
};
/**
* Removes a disjunctive filter to a faceted attribute with the `value` provided. If the
* filter is not set, it doesn't change the filters.
*
* If the value is omitted, then this method will remove all the filters for the
* attribute.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} [value] the associated value
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.removeDisjunctiveFacetRefinement = function(facet, value) {
this._change(this.state.setPage(0).removeDisjunctiveFacetRefinement(facet, value));
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeDisjunctiveFacetRefinement}
*/
AlgoliaSearchHelper.prototype.removeDisjunctiveRefine = function() {
return this.removeDisjunctiveFacetRefinement.apply(this, arguments);
};
/**
* Removes the refinement set on a hierarchical facet.
* @param {string} facet the facet name
* @return {AlgoliaSearchHelper}
* @throws Error if the facet is not defined or if the facet is not refined
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.removeHierarchicalFacetRefinement = function(facet) {
this._change(this.state.setPage(0).removeHierarchicalFacetRefinement(facet));
return this;
};
/**
* Removes a filter to a faceted attribute with the `value` provided. If the
* filter is not set, it doesn't change the filters.
*
* If the value is omitted, then this method will remove all the filters for the
* attribute.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} [value] the associated value
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.removeFacetRefinement = function(facet, value) {
this._change(this.state.setPage(0).removeFacetRefinement(facet, value));
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeFacetRefinement}
*/
AlgoliaSearchHelper.prototype.removeRefine = function() {
return this.removeFacetRefinement.apply(this, arguments);
};
/**
* Removes an exclusion filter to a faceted attribute with the `value` provided. If the
* filter is not set, it doesn't change the filters.
*
* If the value is omitted, then this method will remove all the filters for the
* attribute.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} [value] the associated value
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.removeFacetExclusion = function(facet, value) {
this._change(this.state.setPage(0).removeExcludeRefinement(facet, value));
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeFacetExclusion}
*/
AlgoliaSearchHelper.prototype.removeExclude = function() {
return this.removeFacetExclusion.apply(this, arguments);
};
/**
* Removes a tag filter with the `tag` provided. If the
* filter is not set, it doesn't change the filters.
*
* This method resets the current page to 0.
* @param {string} tag tag to remove from the filter
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.removeTag = function(tag) {
this._change(this.state.setPage(0).removeTagRefinement(tag));
return this;
};
/**
* Adds or removes an exclusion filter to a faceted attribute with the `value` provided. If
* the value is set then it removes it, otherwise it adds the filter.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} value the associated value
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.toggleFacetExclusion = function(facet, value) {
this._change(this.state.setPage(0).toggleExcludeFacetRefinement(facet, value));
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#toggleFacetExclusion}
*/
AlgoliaSearchHelper.prototype.toggleExclude = function() {
return this.toggleFacetExclusion.apply(this, arguments);
};
/**
* Adds or removes a filter to a faceted attribute with the `value` provided. If
* the value is set then it removes it, otherwise it adds the filter.
*
* This method can be used for conjunctive, disjunctive and hierarchical filters.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} value the associated value
* @return {AlgoliaSearchHelper}
* @throws Error will throw an error if the facet is not declared in the settings of the helper
* @fires change
* @chainable
* @deprecated since version 2.19.0, see {@link AlgoliaSearchHelper#toggleFacetRefinement}
*/
AlgoliaSearchHelper.prototype.toggleRefinement = function(facet, value) {
return this.toggleFacetRefinement(facet, value);
};
/**
* Adds or removes a filter to a faceted attribute with the `value` provided. If
* the value is set then it removes it, otherwise it adds the filter.
*
* This method can be used for conjunctive, disjunctive and hierarchical filters.
*
* This method resets the current page to 0.
* @param {string} facet the facet to refine
* @param {string} value the associated value
* @return {AlgoliaSearchHelper}
* @throws Error will throw an error if the facet is not declared in the settings of the helper
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.toggleFacetRefinement = function(facet, value) {
this._change(this.state.setPage(0).toggleFacetRefinement(facet, value));
return this;
};
/**
* @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#toggleFacetRefinement}
*/
AlgoliaSearchHelper.prototype.toggleRefine = function() {
return this.toggleFacetRefinement.apply(this, arguments);
};
/**
* Adds or removes a tag filter with the `value` provided. If
* the value is set then it removes it, otherwise it adds the filter.
*
* This method resets the current page to 0.
* @param {string} tag tag to remove or add
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.toggleTag = function(tag) {
this._change(this.state.setPage(0).toggleTagRefinement(tag));
return this;
};
/**
* Increments the page number by one.
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
* @example
* helper.setPage(0).nextPage().getPage();
* // returns 1
*/
AlgoliaSearchHelper.prototype.nextPage = function() {
return this.setPage(this.state.page + 1);
};
/**
* Decrements the page number by one.
* @fires change
* @return {AlgoliaSearchHelper}
* @chainable
* @example
* helper.setPage(1).previousPage().getPage();
* // returns 0
*/
AlgoliaSearchHelper.prototype.previousPage = function() {
return this.setPage(this.state.page - 1);
};
/**
* @private
*/
function setCurrentPage(page) {
if (page < 0) throw new Error('Page requested below 0.');
this._change(this.state.setPage(page));
return this;
}
/**
* Change the current page
* @deprecated
* @param {number} page The page number
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.setCurrentPage = setCurrentPage;
/**
* Updates the current page.
* @function
* @param {number} page The page number
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.setPage = setCurrentPage;
/**
* Updates the name of the index that will be targeted by the query.
*
* This method resets the current page to 0.
* @param {string} name the index name
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.setIndex = function(name) {
this._change(this.state.setPage(0).setIndex(name));
return this;
};
/**
* Update a parameter of the search. This method reset the page
*
* The complete list of parameters is available on the
* [Algolia website](https://www.algolia.com/doc/rest#query-an-index).
* The most commonly used parameters have their own [shortcuts](#query-parameters-shortcuts)
* or benefit from higher-level APIs (all the kind of filters and facets have their own API)
*
* This method resets the current page to 0.
* @param {string} parameter name of the parameter to update
* @param {any} value new value of the parameter
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
* @example
* helper.setQueryParameter('hitsPerPage', 20).search();
*/
AlgoliaSearchHelper.prototype.setQueryParameter = function(parameter, value) {
this._change(this.state.setPage(0).setQueryParameter(parameter, value));
return this;
};
/**
* Set the whole state (warning: will erase previous state)
* @param {SearchParameters} newState the whole new state
* @return {AlgoliaSearchHelper}
* @fires change
* @chainable
*/
AlgoliaSearchHelper.prototype.setState = function(newState) {
this._change(SearchParameters_1.make(newState));
return this;
};
/**
* Get the current search state stored in the helper. This object is immutable.
* @param {string[]} [filters] optional filters to retrieve only a subset of the state
* @return {SearchParameters|object} if filters is specified a plain object is
* returned containing only the requested fields, otherwise return the unfiltered
* state
* @example
* // Get the complete state as stored in the helper
* helper.getState();
* @example
* // Get a part of the state with all the refinements on attributes and the query
* helper.getState(['query', 'attribute:category']);
*/
AlgoliaSearchHelper.prototype.getState = function(filters) {
if (filters === undefined) return this.state;
return this.state.filter(filters);
};
/**
* DEPRECATED Get part of the state as a query string. By default, the output keys will not
* be prefixed and will only take the applied refinements and the query.
* @deprecated
* @param {object} [options] May contain the following parameters :
*
* **filters** : possible values are all the keys of the [SearchParameters](#searchparameters), `index` for
* the index, all the refinements with `attribute:*` or for some specific attributes with
* `attribute:theAttribute`
*
* **prefix** : prefix in front of the keys
*
* **moreAttributes** : more values to be added in the query string. Those values
* won't be prefixed.
* @return {string} the query string
*/
AlgoliaSearchHelper.prototype.getStateAsQueryString = function getStateAsQueryString(options) {
var filters = options && options.filters || ['query', 'attribute:*'];
var partialState = this.getState(filters);
return url.getQueryStringFromState(partialState, options);
};
/**
* DEPRECATED Read a query string and return an object containing the state. Use
* url module.
* @deprecated
* @static
* @param {string} queryString the query string that will be decoded
* @param {object} options accepted options :
* - prefix : the prefix used for the saved attributes, you have to provide the
* same that was used for serialization
* @return {object} partial search parameters object (same properties than in the
* SearchParameters but not exhaustive)
* @see {@link url#getStateFromQueryString}
*/
AlgoliaSearchHelper.getConfigurationFromQueryString = url.getStateFromQueryString;
/**
* DEPRECATED Retrieve an object of all the properties that are not understandable as helper
* parameters. Use url module.
* @deprecated
* @static
* @param {string} queryString the query string to read
* @param {object} options the options
* - prefixForParameters : prefix used for the helper configuration keys
* @return {object} the object containing the parsed configuration that doesn't
* to the helper
*/
AlgoliaSearchHelper.getForeignConfigurationInQueryString = url.getUnrecognizedParametersInQueryString;
/**
* DEPRECATED Overrides part of the state with the properties stored in the provided query
* string.
* @deprecated
* @param {string} queryString the query string containing the informations to url the state
* @param {object} options optional parameters :
* - prefix : prefix used for the algolia parameters
* - triggerChange : if set to true the state update will trigger a change event
*/
AlgoliaSearchHelper.prototype.setStateFromQueryString = function(queryString, options) {
var triggerChange = options && options.triggerChange || false;
var configuration = url.getStateFromQueryString(queryString, options);
var updatedState = this.state.setQueryParameters(configuration);
if (triggerChange) this.setState(updatedState);
else this.overrideStateWithoutTriggeringChangeEvent(updatedState);
};
/**
* Override the current state without triggering a change event.
* Do not use this method unless you know what you are doing. (see the example
* for a legit use case)
* @param {SearchParameters} newState the whole new state
* @return {AlgoliaSearchHelper}
* @example
* helper.on('change', function(state){
* // In this function you might want to find a way to store the state in the url/history
* updateYourURL(state)
* })
* window.onpopstate = function(event){
* // This is naive though as you should check if the state is really defined etc.
* helper.overrideStateWithoutTriggeringChangeEvent(event.state).search()
* }
* @chainable
*/
AlgoliaSearchHelper.prototype.overrideStateWithoutTriggeringChangeEvent = function(newState) {
this.state = new SearchParameters_1(newState);
return this;
};
/**
* @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasRefinements}
*/
AlgoliaSearchHelper.prototype.isRefined = function(facet, value) {
if (this.state.isConjunctiveFacet(facet)) {
return this.state.isFacetRefined(facet, value);
} else if (this.state.isDisjunctiveFacet(facet)) {
return this.state.isDisjunctiveFacetRefined(facet, value);
}
throw new Error(facet +
' is not properly defined in this helper configuration' +
'(use the facets or disjunctiveFacets keys to configure it)');
};
/**
* Check if an attribute has any numeric, conjunctive, disjunctive or hierarchical filters.
* @param {string} attribute the name of the attribute
* @return {boolean} true if the attribute is filtered by at least one value
* @example
* // hasRefinements works with numeric, conjunctive, disjunctive and hierarchical filters
* helper.hasRefinements('price'); // false
* helper.addNumericRefinement('price', '>', 100);
* helper.hasRefinements('price'); // true
*
* helper.hasRefinements('color'); // false
* helper.addFacetRefinement('color', 'blue');
* helper.hasRefinements('color'); // true
*
* helper.hasRefinements('material'); // false
* helper.addDisjunctiveFacetRefinement('material', 'plastic');
* helper.hasRefinements('material'); // true
*
* helper.hasRefinements('categories'); // false
* helper.toggleFacetRefinement('categories', 'kitchen > knife');
* helper.hasRefinements('categories'); // true
*
*/
AlgoliaSearchHelper.prototype.hasRefinements = function(attribute) {
if (!isEmpty_1(this.state.getNumericRefinements(attribute))) {
return true;
} else if (this.state.isConjunctiveFacet(attribute)) {
return this.state.isFacetRefined(attribute);
} else if (this.state.isDisjunctiveFacet(attribute)) {
return this.state.isDisjunctiveFacetRefined(attribute);
} else if (this.state.isHierarchicalFacet(attribute)) {
return this.state.isHierarchicalFacetRefined(attribute);
}
// there's currently no way to know that the user did call `addNumericRefinement` at some point
// thus we cannot distinguish if there once was a numeric refinement that was cleared
// so we will return false in every other situations to be consistent
// while what we should do here is throw because we did not find the attribute in any type
// of refinement
return false;
};
/**
* Check if a value is excluded for a specific faceted attribute. If the value
* is omitted then the function checks if there is any excluding refinements.
*
* @param {string} facet name of the attribute for used for faceting
* @param {string} [value] optional value. If passed will test that this value
* is filtering the given facet.
* @return {boolean} true if refined
* @example
* helper.isExcludeRefined('color'); // false
* helper.isExcludeRefined('color', 'blue') // false
* helper.isExcludeRefined('color', 'red') // false
*
* helper.addFacetExclusion('color', 'red');
*
* helper.isExcludeRefined('color'); // true
* helper.isExcludeRefined('color', 'blue') // false
* helper.isExcludeRefined('color', 'red') // true
*/
AlgoliaSearchHelper.prototype.isExcluded = function(facet, value) {
return this.state.isExcludeRefined(facet, value);
};
/**
* @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasRefinements}
*/
AlgoliaSearchHelper.prototype.isDisjunctiveRefined = function(facet, value) {
return this.state.isDisjunctiveFacetRefined(facet, value);
};
/**
* Check if the string is a currently filtering tag.
* @param {string} tag tag to check
* @return {boolean}
*/
AlgoliaSearchHelper.prototype.hasTag = function(tag) {
return this.state.isTagRefined(tag);
};
/**
* @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasTag}
*/
AlgoliaSearchHelper.prototype.isTagRefined = function() {
return this.hasTagRefinements.apply(this, arguments);
};
/**
* Get the name of the currently used index.
* @return {string}
* @example
* helper.setIndex('highestPrice_products').getIndex();
* // returns 'highestPrice_products'
*/
AlgoliaSearchHelper.prototype.getIndex = function() {
return this.state.index;
};
function getCurrentPage() {
return this.state.page;
}
/**
* Get the currently selected page
* @deprecated
* @return {number} the current page
*/
AlgoliaSearchHelper.prototype.getCurrentPage = getCurrentPage;
/**
* Get the currently selected page
* @function
* @return {number} the current page
*/
AlgoliaSearchHelper.prototype.getPage = getCurrentPage;
/**
* Get all the tags currently set to filters the results.
*
* @return {string[]} The list of tags currently set.
*/
AlgoliaSearchHelper.prototype.getTags = function() {
return this.state.tagRefinements;
};
/**
* Get a parameter of the search by its name. It is possible that a parameter is directly
* defined in the index dashboard, but it will be undefined using this method.
*
* The complete list of parameters is
* available on the
* [Algolia website](https://www.algolia.com/doc/rest#query-an-index).
* The most commonly used parameters have their own [shortcuts](#query-parameters-shortcuts)
* or benefit from higher-level APIs (all the kind of filters have their own API)
* @param {string} parameterName the parameter name
* @return {any} the parameter value
* @example
* var hitsPerPage = helper.getQueryParameter('hitsPerPage');
*/
AlgoliaSearchHelper.prototype.getQueryParameter = function(parameterName) {
return this.state.getQueryParameter(parameterName);
};
/**
* Get the list of refinements for a given attribute. This method works with
* conjunctive, disjunctive, excluding and numerical filters.
*
* See also SearchResults#getRefinements
*
* @param {string} facetName attribute name used for faceting
* @return {Array.<FacetRefinement|NumericRefinement>} All Refinement are objects that contain a value, and
* a type. Numeric also contains an operator.
* @example
* helper.addNumericRefinement('price', '>', 100);
* helper.getRefinements('price');
* // [
* // {
* // "value": [
* // 100
* // ],
* // "operator": ">",
* // "type": "numeric"
* // }
* // ]
* @example
* helper.addFacetRefinement('color', 'blue');
* helper.addFacetExclusion('color', 'red');
* helper.getRefinements('color');
* // [
* // {
* // "value": "blue",
* // "type": "conjunctive"
* // },
* // {
* // "value": "red",
* // "type": "exclude"
* // }
* // ]
* @example
* helper.addDisjunctiveFacetRefinement('material', 'plastic');
* // [
* // {
* // "value": "plastic",
* // "type": "disjunctive"
* // }
* // ]
*/
AlgoliaSearchHelper.prototype.getRefinements = function(facetName) {
var refinements = [];
if (this.state.isConjunctiveFacet(facetName)) {
var conjRefinements = this.state.getConjunctiveRefinements(facetName);
forEach_1(conjRefinements, function(r) {
refinements.push({
value: r,
type: 'conjunctive'
});
});
var excludeRefinements = this.state.getExcludeRefinements(facetName);
forEach_1(excludeRefinements, function(r) {
refinements.push({
value: r,
type: 'exclude'
});
});
} else if (this.state.isDisjunctiveFacet(facetName)) {
var disjRefinements = this.state.getDisjunctiveRefinements(facetName);
forEach_1(disjRefinements, function(r) {
refinements.push({
value: r,
type: 'disjunctive'
});
});
}
var numericRefinements = this.state.getNumericRefinements(facetName);
forEach_1(numericRefinements, function(value, operator) {
refinements.push({
value: value,
operator: operator,
type: 'numeric'
});
});
return refinements;
};
/**
* Return the current refinement for the (attribute, operator)
* @param {string} attribute attribute in the record
* @param {string} operator operator applied on the refined values
* @return {Array.<number|number[]>} refined values
*/
AlgoliaSearchHelper.prototype.getNumericRefinement = function(attribute, operator) {
return this.state.getNumericRefinement(attribute, operator);
};
/**
* Get the current breadcrumb for a hierarchical facet, as an array
* @param {string} facetName Hierarchical facet name
* @return {array.<string>} the path as an array of string
*/
AlgoliaSearchHelper.prototype.getHierarchicalFacetBreadcrumb = function(facetName) {
return this.state.getHierarchicalFacetBreadcrumb(facetName);
};
// /////////// PRIVATE
/**
* Perform the underlying queries
* @private
* @return {undefined}
* @fires search
* @fires result
* @fires error
*/
AlgoliaSearchHelper.prototype._search = function() {
var state = this.state;
var mainQueries = requestBuilder_1._getQueries(state.index, state);
var states = [{
state: state,
queriesCount: mainQueries.length,
helper: this
}];
this.emit('search', state, this.lastResults);
var derivedQueries = map_1(this.derivedHelpers, function(derivedHelper) {
var derivedState = derivedHelper.getModifiedState(state);
var queries = requestBuilder_1._getQueries(derivedState.index, derivedState);
states.push({
state: derivedState,
queriesCount: queries.length,
helper: derivedHelper
});
derivedHelper.emit('search', derivedState, derivedHelper.lastResults);
return queries;
});
var queries = mainQueries.concat(flatten_1(derivedQueries));
var queryId = this._queryId++;
this._currentNbQueries++;
try {
this.client.search(queries)
.then(this._dispatchAlgoliaResponse.bind(this, states, queryId))
.catch(this._dispatchAlgoliaError.bind(this, queryId));
} catch (err) {
// If we reach this part, we're in an internal error state
this.emit('error', err);
}
};
/**
* Transform the responses as sent by the server and transform them into a user
* usable object that merge the results of all the batch requests. It will dispatch
* over the different helper + derived helpers (when there are some).
* @private
* @param {array.<{SearchParameters, AlgoliaQueries, AlgoliaSearchHelper}>}
* state state used for to generate the request
* @param {number} queryId id of the current request
* @param {object} content content of the response
* @return {undefined}
*/
AlgoliaSearchHelper.prototype._dispatchAlgoliaResponse = function(states, queryId, content) {
// FIXME remove the number of outdated queries discarded instead of just one
if (queryId < this._lastQueryIdReceived) {
// Outdated answer
return;
}
this._currentNbQueries -= (queryId - this._lastQueryIdReceived);
this._lastQueryIdReceived = queryId;
if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');
var results = content.results;
forEach_1(states, function(s) {
var state = s.state;
var queriesCount = s.queriesCount;
var helper = s.helper;
var specificResults = results.splice(0, queriesCount);
var formattedResponse = helper.lastResults = new SearchResults_1(state, specificResults);
helper.emit('result', formattedResponse, state);
});
};
AlgoliaSearchHelper.prototype._dispatchAlgoliaError = function(queryId, err) {
if (queryId < this._lastQueryIdReceived) {
// Outdated answer
return;
}
this._currentNbQueries -= queryId - this._lastQueryIdReceived;
this._lastQueryIdReceived = queryId;
this.emit('error', err);
if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');
};
AlgoliaSearchHelper.prototype.containsRefinement = function(query, facetFilters, numericFilters, tagFilters) {
return query ||
facetFilters.length !== 0 ||
numericFilters.length !== 0 ||
tagFilters.length !== 0;
};
/**
* Test if there are some disjunctive refinements on the facet
* @private
* @param {string} facet the attribute to test
* @return {boolean}
*/
AlgoliaSearchHelper.prototype._hasDisjunctiveRefinements = function(facet) {
return this.state.disjunctiveRefinements[facet] &&
this.state.disjunctiveRefinements[facet].length > 0;
};
AlgoliaSearchHelper.prototype._change = function(newState) {
if (newState !== this.state) {
this.state = newState;
this.emit('change', this.state, this.lastResults);
}
};
/**
* Clears the cache of the underlying Algolia client.
* @return {AlgoliaSearchHelper}
*/
AlgoliaSearchHelper.prototype.clearCache = function() {
this.client.clearCache && this.client.clearCache();
return this;
};
/**
* Updates the internal client instance. If the reference of the clients
* are equal then no update is actually done.
* @param {AlgoliaSearch} newClient an AlgoliaSearch client
* @return {AlgoliaSearchHelper}
*/
AlgoliaSearchHelper.prototype.setClient = function(newClient) {
if (this.client === newClient) return this;
if (newClient.addAlgoliaAgent && !doesClientAgentContainsHelper(newClient)) newClient.addAlgoliaAgent('JS Helper ' + version$1);
this.client = newClient;
return this;
};
/**
* Gets the instance of the currently used client.
* @return {AlgoliaSearch}
*/
AlgoliaSearchHelper.prototype.getClient = function() {
return this.client;
};
/**
* Creates an derived instance of the Helper. A derived helper
* is a way to request other indices synchronised with the lifecycle
* of the main Helper. This mechanism uses the multiqueries feature
* of Algolia to aggregate all the requests in a single network call.
*
* This method takes a function that is used to create a new SearchParameter
* that will be used to create requests to Algolia. Those new requests
* are created just before the `search` event. The signature of the function
* is `SearchParameters -> SearchParameters`.
*
* This method returns a new DerivedHelper which is an EventEmitter
* that fires the same `search`, `result` and `error` events. Those
* events, however, will receive data specific to this DerivedHelper
* and the SearchParameters that is returned by the call of the
* parameter function.
* @param {function} fn SearchParameters -> SearchParameters
* @return {DerivedHelper}
*/
AlgoliaSearchHelper.prototype.derive = function(fn) {
var derivedHelper = new DerivedHelper_1(this, fn);
this.derivedHelpers.push(derivedHelper);
return derivedHelper;
};
/**
* This method detaches a derived Helper from the main one. Prefer using the one from the
* derived helper itself, to remove the event listeners too.
* @private
* @return {undefined}
* @throws Error
*/
AlgoliaSearchHelper.prototype.detachDerivedHelper = function(derivedHelper) {
var pos = this.derivedHelpers.indexOf(derivedHelper);
if (pos === -1) throw new Error('Derived helper already detached');
this.derivedHelpers.splice(pos, 1);
};
/**
* This method returns true if there is currently at least one on-going search.
* @return {boolean} true if there is a search pending
*/
AlgoliaSearchHelper.prototype.hasPendingRequests = function() {
return this._currentNbQueries > 0;
};
/**
* @typedef AlgoliaSearchHelper.NumericRefinement
* @type {object}
* @property {number[]} value the numbers that are used for filtering this attribute with
* the operator specified.
* @property {string} operator the faceting data: value, number of entries
* @property {string} type will be 'numeric'
*/
/**
* @typedef AlgoliaSearchHelper.FacetRefinement
* @type {object}
* @property {string} value the string use to filter the attribute
* @property {string} type the type of filter: 'conjunctive', 'disjunctive', 'exclude'
*/
/*
* This function tests if the _ua parameter of the client
* already contains the JS Helper UA
*/
function doesClientAgentContainsHelper(client) {
// this relies on JS Client internal variable, this might break if implementation changes
var currentAgent = client._ua;
return !currentAgent ? false :
currentAgent.indexOf('JS Helper') !== -1;
}
var algoliasearch_helper = AlgoliaSearchHelper;
/**
* The algoliasearchHelper module is the function that will let its
* contains everything needed to use the Algoliasearch
* Helper. It is a also a function that instanciate the helper.
* To use the helper, you also need the Algolia JS client v3.
* @example
* //using the UMD build
* var client = algoliasearch('latency', '6be0576ff61c053d5f9a3225e2a90f76');
* var helper = algoliasearchHelper(client, 'bestbuy', {
* facets: ['shipping'],
* disjunctiveFacets: ['category']
* });
* helper.on('result', function(result) {
* console.log(result);
* });
* helper.toggleRefine('Movies & TV Shows')
* .toggleRefine('Free shipping')
* .search();
* @example
* // The helper is an event emitter using the node API
* helper.on('result', updateTheResults);
* helper.once('result', updateTheResults);
* helper.removeListener('result', updateTheResults);
* helper.removeAllListeners('result');
* @module algoliasearchHelper
* @param {AlgoliaSearch} client an AlgoliaSearch client
* @param {string} index the name of the index to query
* @param {SearchParameters|object} opts an object defining the initial config of the search. It doesn't have to be a {SearchParameters}, just an object containing the properties you need from it.
* @return {AlgoliaSearchHelper}
*/
function algoliasearchHelper(client, index, opts) {
return new algoliasearch_helper(client, index, opts);
}
/**
* The version currently used
* @member module:algoliasearchHelper.version
* @type {number}
*/
algoliasearchHelper.version = version$1;
/**
* Constructor for the Helper.
* @member module:algoliasearchHelper.AlgoliaSearchHelper
* @type {AlgoliaSearchHelper}
*/
algoliasearchHelper.AlgoliaSearchHelper = algoliasearch_helper;
/**
* Constructor for the object containing all the parameters of the search.
* @member module:algoliasearchHelper.SearchParameters
* @type {SearchParameters}
*/
algoliasearchHelper.SearchParameters = SearchParameters_1;
/**
* Constructor for the object containing the results of the search.
* @member module:algoliasearchHelper.SearchResults
* @type {SearchResults}
*/
algoliasearchHelper.SearchResults = SearchResults_1;
/**
* URL tools to generate query string and parse them from/into
* SearchParameters
* @member module:algoliasearchHelper.url
* @type {object} {@link url}
*
*/
algoliasearchHelper.url = url;
var algoliasearchHelper_1 = algoliasearchHelper;
var algoliasearchHelper_4 = algoliasearchHelper_1.SearchParameters;
// From https://github.com/reactjs/react-redux/blob/master/src/utils/shallowEqual.js
var shallowEqual = function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
var hasOwn = Object.prototype.hasOwnProperty;
for (var i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
}
return true;
};
var getDisplayName = function getDisplayName(Component) {
return Component.displayName || Component.name || 'UnknownComponent';
};
var resolved = Promise.resolve();
var defer = function defer(f) {
resolved.then(f);
};
var removeEmptyKey = function removeEmptyKey(obj) {
Object.keys(obj).forEach(function (key) {
var value = obj[key];
if (isEmpty_1(value) && isPlainObject_1(value)) {
delete obj[key];
} else if (isPlainObject_1(value)) {
removeEmptyKey(value);
}
});
return obj;
};
function createWidgetsManager(onWidgetsUpdate) {
var widgets = [];
// Is an update scheduled?
var scheduled = false;
// The state manager's updates need to be batched since more than one
// component can register or unregister widgets during the same tick.
function scheduleUpdate() {
if (scheduled) {
return;
}
scheduled = true;
defer(function () {
scheduled = false;
onWidgetsUpdate();
});
}
return {
registerWidget: function registerWidget(widget) {
widgets.push(widget);
scheduleUpdate();
return function unregisterWidget() {
widgets.splice(widgets.indexOf(widget), 1);
scheduleUpdate();
};
},
update: scheduleUpdate,
getWidgets: function getWidgets() {
return widgets;
}
};
}
function createStore(initialState) {
var state = initialState;
var listeners = [];
function dispatch() {
listeners.forEach(function (listener) {
return listener();
});
}
return {
getState: function getState() {
return state;
},
setState: function setState(nextState) {
state = nextState;
dispatch();
},
subscribe: function subscribe(listener) {
listeners.push(listener);
return function unsubcribe() {
listeners.splice(listeners.indexOf(listener), 1);
};
}
};
}
var HIGHLIGHT_TAGS = {
highlightPreTag: '<ais-highlight-0000000000>',
highlightPostTag: '</ais-highlight-0000000000>'
};
/**
* Parses an highlighted attribute into an array of objects with the string value, and
* a boolean that indicated if this part is highlighted.
*
* @param {string} preTag - string used to identify the start of an highlighted value
* @param {string} postTag - string used to identify the end of an highlighted value
* @param {string} highlightedValue - highlighted attribute as returned by Algolia highlight feature
* @return {object[]} - An array of {value: string, isHighlighted: boolean}.
*/
function parseHighlightedAttribute(_ref) {
var preTag = _ref.preTag,
postTag = _ref.postTag,
_ref$highlightedValue = _ref.highlightedValue,
highlightedValue = _ref$highlightedValue === undefined ? '' : _ref$highlightedValue;
var splitByPreTag = highlightedValue.split(preTag);
var firstValue = splitByPreTag.shift();
var elements = firstValue === '' ? [] : [{ value: firstValue, isHighlighted: false }];
if (postTag === preTag) {
var isHighlighted = true;
splitByPreTag.forEach(function (split) {
elements.push({ value: split, isHighlighted: isHighlighted });
isHighlighted = !isHighlighted;
});
} else {
splitByPreTag.forEach(function (split) {
var splitByPostTag = split.split(postTag);
elements.push({
value: splitByPostTag[0],
isHighlighted: true
});
if (splitByPostTag[1] !== '') {
elements.push({
value: splitByPostTag[1],
isHighlighted: false
});
}
});
}
return elements;
}
/**
* Find an highlighted attribute given an `attribute` and an `highlightProperty`, parses it,
* and provided an array of objects with the string value and a boolean if this
* value is highlighted.
*
* In order to use this feature, highlight must be activated in the configuration of
* the index. The `preTag` and `postTag` attributes are respectively highlightPreTag and
* highlightPostTag in Algolia configuration.
*
* @param {string} preTag - string used to identify the start of an highlighted value
* @param {string} postTag - string used to identify the end of an highlighted value
* @param {string} highlightProperty - the property that contains the highlight structure in the results
* @param {string} attribute - the highlighted attribute to look for
* @param {object} hit - the actual hit returned by Algolia.
* @return {object[]} - An array of {value: string, isHighlighted: boolean}.
*/
function parseAlgoliaHit(_ref2) {
var _ref2$preTag = _ref2.preTag,
preTag = _ref2$preTag === undefined ? '<em>' : _ref2$preTag,
_ref2$postTag = _ref2.postTag,
postTag = _ref2$postTag === undefined ? '</em>' : _ref2$postTag,
highlightProperty = _ref2.highlightProperty,
attribute = _ref2.attribute,
hit = _ref2.hit;
if (!hit) throw new Error('`hit`, the matching record, must be provided');
var highlightObject = get_1(hit[highlightProperty], attribute, {});
if (Array.isArray(highlightObject)) {
return highlightObject.map(function (item) {
return parseHighlightedAttribute({
preTag: preTag,
postTag: postTag,
highlightedValue: item.value
});
});
}
return parseHighlightedAttribute({
preTag: preTag,
postTag: postTag,
highlightedValue: highlightObject.value
});
}
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
function _defineProperty$1(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;
}
/**
* Creates a new instance of the InstantSearchManager which controls the widgets and
* trigger the search when the widgets are updated.
* @param {string} indexName - the main index name
* @param {object} initialState - initial widget state
* @param {object} SearchParameters - optional additional parameters to send to the algolia API
* @param {number} stalledSearchDelay - time (in ms) after the search is stalled
* @return {InstantSearchManager} a new instance of InstantSearchManager
*/
function createInstantSearchManager(_ref) {
var indexName = _ref.indexName,
_ref$initialState = _ref.initialState,
initialState = _ref$initialState === undefined ? {} : _ref$initialState,
searchClient = _ref.searchClient,
resultsState = _ref.resultsState,
stalledSearchDelay = _ref.stalledSearchDelay;
var baseSP = new algoliasearchHelper_4(_extends({
index: indexName
}, HIGHLIGHT_TAGS));
var stalledSearchTimer = null;
var helper = algoliasearchHelper_1(searchClient, indexName, baseSP);
helper.on('result', handleSearchSuccess);
helper.on('error', handleSearchError);
helper.on('search', handleNewSearch);
var derivedHelpers = {};
var indexMapping = {}; // keep track of the original index where the parameters applied when sortBy is used.
var initialSearchParameters = helper.state;
var widgetsManager = createWidgetsManager(onWidgetsUpdate);
var store = createStore({
widgets: initialState,
metadata: [],
results: resultsState || null,
error: null,
searching: false,
isSearchStalled: true,
searchingForFacetValues: false
});
var skip = false;
function skipSearch() {
skip = true;
}
function updateClient(client) {
helper.setClient(client);
search();
}
function clearCache() {
helper.clearCache();
search();
}
function getMetadata(state) {
return widgetsManager.getWidgets().filter(function (widget) {
return Boolean(widget.getMetadata);
}).map(function (widget) {
return widget.getMetadata(state);
});
}
function getSearchParameters() {
indexMapping = {};
var sharedParameters = widgetsManager.getWidgets().filter(function (widget) {
return Boolean(widget.getSearchParameters);
}).filter(function (widget) {
return !widget.context.multiIndexContext && (widget.props.indexName === indexName || !widget.props.indexName);
}).reduce(function (res, widget) {
return widget.getSearchParameters(res);
}, initialSearchParameters);
indexMapping[sharedParameters.index] = indexName;
var derivatedWidgets = widgetsManager.getWidgets().filter(function (widget) {
return Boolean(widget.getSearchParameters);
}).filter(function (widget) {
return widget.context.multiIndexContext && widget.context.multiIndexContext.targetedIndex !== indexName || widget.props.indexName && widget.props.indexName !== indexName;
}).reduce(function (indices, widget) {
var targetedIndex = widget.context.multiIndexContext ? widget.context.multiIndexContext.targetedIndex : widget.props.indexName;
var index = find_1(indices, function (i) {
return i.targetedIndex === targetedIndex;
});
if (index) {
index.widgets.push(widget);
} else {
indices.push({ targetedIndex: targetedIndex, widgets: [widget] });
}
return indices;
}, []);
var mainIndexParameters = widgetsManager.getWidgets().filter(function (widget) {
return Boolean(widget.getSearchParameters);
}).filter(function (widget) {
return widget.context.multiIndexContext && widget.context.multiIndexContext.targetedIndex === indexName || widget.props.indexName && widget.props.indexName === indexName;
}).reduce(function (res, widget) {
return widget.getSearchParameters(res);
}, sharedParameters);
indexMapping[mainIndexParameters.index] = indexName;
return { sharedParameters: sharedParameters, mainIndexParameters: mainIndexParameters, derivatedWidgets: derivatedWidgets };
}
function search() {
if (!skip) {
var _getSearchParameters = getSearchParameters(helper.state),
sharedParameters = _getSearchParameters.sharedParameters,
mainIndexParameters = _getSearchParameters.mainIndexParameters,
derivatedWidgets = _getSearchParameters.derivatedWidgets;
Object.keys(derivedHelpers).forEach(function (key) {
return derivedHelpers[key].detach();
});
derivedHelpers = {};
helper.setState(sharedParameters);
derivatedWidgets.forEach(function (derivatedSearchParameters) {
var index = derivatedSearchParameters.targetedIndex;
var derivedHelper = helper.derive(function () {
var parameters = derivatedSearchParameters.widgets.reduce(function (res, widget) {
return widget.getSearchParameters(res);
}, sharedParameters);
indexMapping[parameters.index] = index;
return parameters;
});
derivedHelper.on('result', handleSearchSuccess);
derivedHelper.on('error', handleSearchError);
derivedHelpers[index] = derivedHelper;
});
helper.setState(mainIndexParameters);
helper.search();
}
}
function handleSearchSuccess(content) {
var state = store.getState();
var results = state.results ? state.results : {};
/* if switching from mono index to multi index and vice versa,
results needs to reset to {}*/
results = !isEmpty_1(derivedHelpers) && results.getFacetByName ? {} : results;
if (!isEmpty_1(derivedHelpers)) {
results[indexMapping[content.index]] = content;
} else {
results = content;
}
var currentState = store.getState();
var nextIsSearchStalled = currentState.isSearchStalled;
if (!helper.hasPendingRequests()) {
clearTimeout(stalledSearchTimer);
stalledSearchTimer = null;
nextIsSearchStalled = false;
}
var nextState = omit_1(_extends({}, currentState, {
results: results,
isSearchStalled: nextIsSearchStalled,
searching: false,
error: null
}), 'resultsFacetValues');
store.setState(nextState);
}
function handleSearchError(error) {
var currentState = store.getState();
var nextIsSearchStalled = currentState.isSearchStalled;
if (!helper.hasPendingRequests()) {
clearTimeout(stalledSearchTimer);
nextIsSearchStalled = false;
}
var nextState = omit_1(_extends({}, currentState, {
isSearchStalled: nextIsSearchStalled,
error: error,
searching: false
}), 'resultsFacetValues');
store.setState(nextState);
}
function handleNewSearch() {
if (!stalledSearchTimer) {
stalledSearchTimer = setTimeout(function () {
var nextState = omit_1(_extends({}, store.getState(), {
isSearchStalled: true
}), 'resultsFacetValues');
store.setState(nextState);
}, stalledSearchDelay);
}
}
// Called whenever a widget has been rendered with new props.
function onWidgetsUpdate() {
var metadata = getMetadata(store.getState().widgets);
store.setState(_extends({}, store.getState(), {
metadata: metadata,
searching: true
}));
// Since the `getSearchParameters` method of widgets also depends on props,
// the result search parameters might have changed.
search();
}
function transitionState(nextSearchState) {
var searchState = store.getState().widgets;
return widgetsManager.getWidgets().filter(function (widget) {
return Boolean(widget.transitionState);
}).reduce(function (res, widget) {
return widget.transitionState(searchState, res);
}, nextSearchState);
}
function onExternalStateUpdate(nextSearchState) {
var metadata = getMetadata(nextSearchState);
store.setState(_extends({}, store.getState(), {
widgets: nextSearchState,
metadata: metadata,
searching: true
}));
search();
}
function onSearchForFacetValues(_ref2) {
var facetName = _ref2.facetName,
query = _ref2.query,
maxFacetHits = _ref2.maxFacetHits;
store.setState(_extends({}, store.getState(), {
searchingForFacetValues: true
}));
helper.searchForFacetValues(facetName, query, maxFacetHits).then(function (content) {
var _extends2;
store.setState(_extends({}, store.getState(), {
resultsFacetValues: _extends({}, store.getState().resultsFacetValues, (_extends2 = {}, _defineProperty$1(_extends2, facetName, content.facetHits), _defineProperty$1(_extends2, 'query', query), _extends2)),
searchingForFacetValues: false
}));
}, function (error) {
store.setState(_extends({}, store.getState(), {
error: error,
searchingForFacetValues: false
}));
}).catch(function (error) {
// Since setState is synchronous, any error that occurs in the render of a
// component will be swallowed by this promise.
// This is a trick to make the error show up correctly in the console.
// See http://stackoverflow.com/a/30741722/969302
setTimeout(function () {
throw error;
});
});
}
function updateIndex(newIndex) {
initialSearchParameters = initialSearchParameters.setIndex(newIndex);
search();
}
function getWidgetsIds() {
return store.getState().metadata.reduce(function (res, meta) {
return typeof meta.id !== 'undefined' ? res.concat(meta.id) : res;
}, []);
}
return {
store: store,
widgetsManager: widgetsManager,
getWidgetsIds: getWidgetsIds,
onExternalStateUpdate: onExternalStateUpdate,
transitionState: transitionState,
onSearchForFacetValues: onSearchForFacetValues,
updateClient: updateClient,
updateIndex: updateIndex,
clearCache: clearCache,
skipSearch: skipSearch
};
}
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var _extends$2 = 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;
};
}();
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 === "undefined" ? "undefined" : _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 === "undefined" ? "undefined" : _typeof(superClass)));
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
function validateNextProps(props, nextProps) {
if (!props.searchState && nextProps.searchState) {
throw new Error("You can't switch <InstantSearch> from being uncontrolled to controlled");
} else if (props.searchState && !nextProps.searchState) {
throw new Error("You can't switch <InstantSearch> from being controlled to uncontrolled");
}
}
/* eslint valid-jsdoc: 0 */
/**
* @description
* `<InstantSearch>` is the root component of all React InstantSearch implementations.
* It provides all the connected components (aka widgets) a means to interact
* with the searchState.
* @kind widget
* @name <InstantSearch>
* @requirements You will need to have an Algolia account to be able to use this widget.
* [Create one now](https://www.algolia.com/users/sign_up).
* @propType {string} appId - Your Algolia application id.
* @propType {string} apiKey - Your Algolia search-only API key.
* @propType {string} indexName - Main index in which to search.
* @propType {boolean} [refresh=false] - Flag to activate when the cache needs to be cleared so that the front-end is updated when a change occurs in the index.
* @propType {object} [algoliaClient] - Provide a custom Algolia client instead of the internal one (deprecated in favor of `searchClient`).
* @propType {object} [searchClient] - Provide a custom search client.
* @propType {func} [onSearchStateChange] - Function to be called everytime a new search is done. Useful for [URL Routing](guide/Routing.html).
* @propType {object} [searchState] - Object to inject some search state. Switches the InstantSearch component in controlled mode. Useful for [URL Routing](guide/Routing.html).
* @propType {func} [createURL] - Function to call when creating links, useful for [URL Routing](guide/Routing.html).
* @propType {SearchResults|SearchResults[]} [resultsState] - Use this to inject the results that will be used at first rendering. Those results are found by using the `findResultsState` function. Useful for [Server Side Rendering](guide/Server-side_rendering.html).
* @propType {number} [stalledSearchDelay=200] - The amount of time before considering that the search takes too much time. The time is expressed in milliseconds.
* @propType {{ Root: string|function, props: object }} [root] - Use this to customize the root element. Default value: `{ Root: 'div' }`
* @example
* import React from 'react';
* import { InstantSearch, SearchBox, Hits } from 'react-instantsearch-dom';
*
* const App = () => (
* <InstantSearch
* appId="latency"
* apiKey="6be0576ff61c053d5f9a3225e2a90f76"
* indexName="instant_search"
* >
* <SearchBox />
* <Hits />
* </InstantSearch>
* );
*/
var InstantSearch = function (_Component) {
_inherits(InstantSearch, _Component);
function InstantSearch(props) {
_classCallCheck(this, InstantSearch);
var _this = _possibleConstructorReturn(this, (InstantSearch.__proto__ || Object.getPrototypeOf(InstantSearch)).call(this, props));
_this.isControlled = Boolean(props.searchState);
var initialState = _this.isControlled ? props.searchState : {};
_this.isUnmounting = false;
_this.aisManager = createInstantSearchManager({
indexName: props.indexName,
searchClient: props.searchClient,
initialState: initialState,
resultsState: props.resultsState,
stalledSearchDelay: props.stalledSearchDelay
});
return _this;
}
_createClass(InstantSearch, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
validateNextProps(this.props, nextProps);
if (this.props.indexName !== nextProps.indexName) {
this.aisManager.updateIndex(nextProps.indexName);
}
if (this.props.refresh !== nextProps.refresh) {
if (nextProps.refresh) {
this.aisManager.clearCache();
}
}
if (this.props.searchClient !== nextProps.searchClient) {
this.aisManager.updateClient(nextProps.searchClient);
}
if (this.isControlled) {
this.aisManager.onExternalStateUpdate(nextProps.searchState);
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.isUnmounting = true;
this.aisManager.skipSearch();
}
}, {
key: 'getChildContext',
value: function getChildContext() {
// If not already cached, cache the bound methods so that we can forward them as part
// of the context.
if (!this._aisContextCache) {
this._aisContextCache = {
ais: {
onInternalStateUpdate: this.onWidgetsInternalStateUpdate.bind(this),
createHrefForState: this.createHrefForState.bind(this),
onSearchForFacetValues: this.onSearchForFacetValues.bind(this),
onSearchStateChange: this.onSearchStateChange.bind(this),
onSearchParameters: this.onSearchParameters.bind(this)
}
};
}
return {
ais: _extends$2({}, this._aisContextCache.ais, {
store: this.aisManager.store,
widgetsManager: this.aisManager.widgetsManager,
mainTargetedIndex: this.props.indexName
})
};
}
}, {
key: 'createHrefForState',
value: function createHrefForState(searchState) {
searchState = this.aisManager.transitionState(searchState);
return this.isControlled && this.props.createURL ? this.props.createURL(searchState, this.getKnownKeys()) : '#';
}
}, {
key: 'onWidgetsInternalStateUpdate',
value: function onWidgetsInternalStateUpdate(searchState) {
searchState = this.aisManager.transitionState(searchState);
this.onSearchStateChange(searchState);
if (!this.isControlled) {
this.aisManager.onExternalStateUpdate(searchState);
}
}
}, {
key: 'onSearchStateChange',
value: function onSearchStateChange(searchState) {
if (this.props.onSearchStateChange && !this.isUnmounting) {
this.props.onSearchStateChange(searchState);
}
}
}, {
key: 'onSearchParameters',
value: function onSearchParameters(getSearchParameters, context, props) {
if (this.props.onSearchParameters) {
var searchState = this.props.searchState ? this.props.searchState : {};
this.props.onSearchParameters(getSearchParameters, context, props, searchState);
}
}
}, {
key: 'onSearchForFacetValues',
value: function onSearchForFacetValues(searchState) {
this.aisManager.onSearchForFacetValues(searchState);
}
}, {
key: 'getKnownKeys',
value: function getKnownKeys() {
return this.aisManager.getWidgetsIds();
}
}, {
key: 'render',
value: function render() {
var childrenCount = React.Children.count(this.props.children);
var _props$root = this.props.root,
Root = _props$root.Root,
props = _props$root.props;
if (childrenCount === 0) return null;else return React__default.createElement(Root, props, this.props.children);
}
}]);
return InstantSearch;
}(React.Component);
InstantSearch.defaultProps = {
stalledSearchDelay: 200
};
InstantSearch.propTypes = {
// @TODO: These props are currently constant.
indexName: propTypes.string.isRequired,
searchClient: propTypes.object.isRequired,
createURL: propTypes.func,
refresh: propTypes.bool.isRequired,
searchState: propTypes.object,
onSearchStateChange: propTypes.func,
onSearchParameters: propTypes.func,
resultsState: propTypes.oneOfType([propTypes.object, propTypes.array]),
children: propTypes.node,
root: propTypes.shape({
Root: propTypes.oneOfType([propTypes.string, propTypes.func, propTypes.object]),
props: propTypes.object
}).isRequired,
stalledSearchDelay: propTypes.number
};
InstantSearch.childContextTypes = {
// @TODO: more precise widgets manager propType
ais: propTypes.object.isRequired
};
var _createClass$2 = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _classCallCheck$2(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn$2(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === "undefined" ? "undefined" : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}
function _inherits$2(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : _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;
}
/* eslint valid-jsdoc: 0 */
/**
* @description
* `<Index>` is the component that allows you to apply widgets to a dedicated index. It's
* useful if you want to build an interface that targets multiple indices.
* @kind widget
* @name <Index>
* @propType {string} indexName - index in which to search.
* @propType {{ Root: string|function, props: object }} [root] - Use this to customize the root element. Default value: `{ Root: 'div' }`
* @example
* import React from 'react';
* import { InstantSearch, Index, SearchBox, Hits, Configure } from 'react-instantsearch-dom';
*
* const App = () => (
* <InstantSearch
* appId="latency"
* apiKey="6be0576ff61c053d5f9a3225e2a90f76"
* indexName="instant_search"
* >
* <Configure hitsPerPage={5} />
* <SearchBox />
* <Index indexName="instant_search">
* <Hits />
* </Index>
* <Index indexName="bestbuy">
* <Hits />
* </Index>
* </InstantSearch>
* );
*/
var Index = function (_Component) {
_inherits$2(Index, _Component);
function Index(props, context) {
_classCallCheck$2(this, Index);
var _this = _possibleConstructorReturn$2(this, (Index.__proto__ || Object.getPrototypeOf(Index)).call(this, props));
var widgetsManager = context.ais.widgetsManager;
/*
we want <Index> to be seen as a regular widget.
It means that with only <Index> present a new query will be sent to Algolia.
That way you don't need a virtual hits widget to use the connectAutoComplete.
*/
_this.unregisterWidget = widgetsManager.registerWidget(_this);
return _this;
}
_createClass$2(Index, [{
key: 'componentWillMount',
value: function componentWillMount() {
this.context.ais.onSearchParameters(this.getSearchParameters.bind(this), this.getChildContext(), this.props);
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (this.props.indexName !== nextProps.indexName) {
this.context.ais.widgetsManager.update();
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.unregisterWidget();
}
}, {
key: 'getChildContext',
value: function getChildContext() {
return {
multiIndexContext: {
targetedIndex: this.props.indexName
}
};
}
}, {
key: 'getSearchParameters',
value: function getSearchParameters(searchParameters, props) {
return searchParameters.setIndex(this.props ? this.props.indexName : props.indexName);
}
}, {
key: 'render',
value: function render() {
var childrenCount = React.Children.count(this.props.children);
var _props$root = this.props.root,
Root = _props$root.Root,
props = _props$root.props;
if (childrenCount === 0) return null;else return React__default.createElement(Root, props, this.props.children);
}
}]);
return Index;
}(React.Component);
Index.propTypes = {
// @TODO: These props are currently constant.
indexName: propTypes.string.isRequired,
children: propTypes.node,
root: propTypes.shape({
Root: propTypes.oneOfType([propTypes.string, propTypes.func, propTypes.object]),
props: propTypes.object
}).isRequired
};
Index.childContextTypes = {
multiIndexContext: propTypes.object.isRequired
};
Index.contextTypes = {
// @TODO: more precise widgets manager propType
ais: propTypes.object.isRequired
};
/** Used for built-in method references. */
var objectProto$l = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$i = objectProto$l.hasOwnProperty;
/**
* The base implementation of `_.has` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHas(object, key) {
return object != null && hasOwnProperty$i.call(object, key);
}
var _baseHas = baseHas;
/**
* Checks if `path` is a direct property of `object`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = { 'a': { 'b': 2 } };
* var other = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.has(object, 'a');
* // => true
*
* _.has(object, 'a.b');
* // => true
*
* _.has(object, ['a', 'b']);
* // => true
*
* _.has(other, 'a');
* // => false
*/
function has$1(object, path) {
return object != null && _hasPath(object, path, _baseHas);
}
var has_1 = has$1;
var _extends$3 = 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$3 = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _classCallCheck$3(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn$3(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === 'undefined' ? 'undefined' : _typeof(call)) === "object" || typeof call === "function") ? call : self;
}
function _inherits$3(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === 'undefined' ? 'undefined' : _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;
}
/**
* @typedef {object} ConnectorDescription
* @property {string} displayName - the displayName used by the wrapper
* @property {function} refine - a function to filter the local state
* @property {function} getSearchParameters - function transforming the local state to a SearchParameters
* @property {function} getMetadata - metadata of the widget
* @property {function} transitionState - hook after the state has changed
* @property {function} getProvidedProps - transform the state into props passed to the wrapped component.
* Receives (props, widgetStates, searchState, metadata) and returns the local state.
* @property {function} getId - Receives props and return the id that will be used to identify the widget
* @property {function} cleanUp - hook when the widget will unmount. Receives (props, searchState) and return a cleaned state.
* @property {object} propTypes - PropTypes forwarded to the wrapped component.
* @property {object} defaultProps - default values for the props
*/
/**
* Connectors are the HOC used to transform React components
* into InstantSearch widgets.
* In order to simplify the construction of such connectors
* `createConnector` takes a description and transform it into
* a connector.
* @param {ConnectorDescription} connectorDesc the description of the connector
* @return {Connector} a function that wraps a component into
* an instantsearch connected one.
*/
function createConnector(connectorDesc) {
if (!connectorDesc.displayName) {
throw new Error('`createConnector` requires you to provide a `displayName` property.');
}
var hasRefine = has_1(connectorDesc, 'refine');
var hasSearchForFacetValues = has_1(connectorDesc, 'searchForFacetValues');
var hasSearchParameters = has_1(connectorDesc, 'getSearchParameters');
var hasMetadata = has_1(connectorDesc, 'getMetadata');
var hasTransitionState = has_1(connectorDesc, 'transitionState');
var hasCleanUp = has_1(connectorDesc, 'cleanUp');
var hasShouldComponentUpdate = has_1(connectorDesc, 'shouldComponentUpdate');
var isWidget = hasSearchParameters || hasMetadata || hasTransitionState;
return function (Composed) {
var _class, _temp, _initialiseProps;
return _temp = _class = function (_Component) {
_inherits$3(Connector, _Component);
function Connector(props, context) {
_classCallCheck$3(this, Connector);
var _this = _possibleConstructorReturn$3(this, (Connector.__proto__ || Object.getPrototypeOf(Connector)).call(this, props, context));
_initialiseProps.call(_this);
var _context$ais = context.ais,
store = _context$ais.store,
widgetsManager = _context$ais.widgetsManager;
var canRender = false;
_this.state = {
props: _this.getProvidedProps(_extends$3({}, props, { canRender: canRender })),
canRender: canRender // use to know if a component is rendered (browser), or not (server).
};
_this.unsubscribe = store.subscribe(function () {
if (_this.state.canRender) {
_this.setState({
props: _this.getProvidedProps(_extends$3({}, _this.props, {
canRender: _this.state.canRender
}))
});
}
});
if (isWidget) {
_this.unregisterWidget = widgetsManager.registerWidget(_this);
}
return _this;
}
_createClass$3(Connector, [{
key: 'getMetadata',
value: function getMetadata(nextWidgetsState) {
if (hasMetadata) {
return connectorDesc.getMetadata.call(this, this.props, nextWidgetsState);
}
return {};
}
}, {
key: 'getSearchParameters',
value: function getSearchParameters(searchParameters) {
if (hasSearchParameters) {
return connectorDesc.getSearchParameters.call(this, searchParameters, this.props, this.context.ais.store.getState().widgets);
}
return null;
}
}, {
key: 'transitionState',
value: function transitionState(prevWidgetsState, nextWidgetsState) {
if (hasTransitionState) {
return connectorDesc.transitionState.call(this, this.props, prevWidgetsState, nextWidgetsState);
}
return nextWidgetsState;
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this.setState({
canRender: true
});
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
if (connectorDesc.getSearchParameters) {
this.context.ais.onSearchParameters(connectorDesc.getSearchParameters.bind(this), this.context, this.props);
}
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (!isEqual_1(this.props, nextProps)) {
this.setState({
props: this.getProvidedProps(nextProps)
});
if (isWidget) {
// Since props might have changed, we need to re-run getSearchParameters
// and getMetadata with the new props.
this.context.ais.widgetsManager.update();
if (connectorDesc.transitionState) {
this.context.ais.onSearchStateChange(connectorDesc.transitionState.call(this, nextProps, this.context.ais.store.getState().widgets, this.context.ais.store.getState().widgets));
}
}
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.unsubscribe();
if (isWidget) {
this.unregisterWidget(); // will schedule an update
if (hasCleanUp) {
var newState = connectorDesc.cleanUp.call(this, this.props, this.context.ais.store.getState().widgets);
this.context.ais.store.setState(_extends$3({}, this.context.ais.store.getState(), {
widgets: newState
}));
this.context.ais.onSearchStateChange(removeEmptyKey(newState));
}
}
}
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
if (hasShouldComponentUpdate) {
return connectorDesc.shouldComponentUpdate.call(this, this.props, nextProps, this.state, nextState);
}
var propsEqual = shallowEqual(this.props, nextProps);
if (this.state.props === null || nextState.props === null) {
if (this.state.props === nextState.props) {
return !propsEqual;
}
return true;
}
return !propsEqual || !shallowEqual(this.state.props, nextState.props);
}
}, {
key: 'render',
value: function render() {
if (this.state.props === null) {
return null;
}
var refineProps = hasRefine ? { refine: this.refine, createURL: this.createURL } : {};
var searchForFacetValuesProps = hasSearchForFacetValues ? { searchForItems: this.searchForFacetValues } : {};
return React__default.createElement(Composed, _extends$3({}, this.props, this.state.props, refineProps, searchForFacetValuesProps));
}
}]);
return Connector;
}(React.Component), _class.displayName = connectorDesc.displayName + '(' + getDisplayName(Composed) + ')', _class.defaultClassNames = Composed.defaultClassNames, _class.propTypes = connectorDesc.propTypes, _class.defaultProps = connectorDesc.defaultProps, _class.contextTypes = {
// @TODO: more precise state manager propType
ais: propTypes.object.isRequired,
multiIndexContext: propTypes.object
}, _initialiseProps = function _initialiseProps() {
var _this2 = this;
this.getProvidedProps = function (props) {
var store = _this2.context.ais.store;
var _store$getState = store.getState(),
results = _store$getState.results,
searching = _store$getState.searching,
error = _store$getState.error,
widgets = _store$getState.widgets,
metadata = _store$getState.metadata,
resultsFacetValues = _store$getState.resultsFacetValues,
searchingForFacetValues = _store$getState.searchingForFacetValues,
isSearchStalled = _store$getState.isSearchStalled;
var searchResults = {
results: results,
searching: searching,
error: error,
searchingForFacetValues: searchingForFacetValues,
isSearchStalled: isSearchStalled
};
return connectorDesc.getProvidedProps.call(_this2, props, widgets, searchResults, metadata, resultsFacetValues);
};
this.refine = function () {
var _connectorDesc$refine;
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this2.context.ais.onInternalStateUpdate((_connectorDesc$refine = connectorDesc.refine).call.apply(_connectorDesc$refine, [_this2, _this2.props, _this2.context.ais.store.getState().widgets].concat(args)));
};
this.searchForFacetValues = function () {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
_this2.context.ais.onSearchForFacetValues(connectorDesc.searchForFacetValues.apply(connectorDesc, [_this2.props, _this2.context.ais.store.getState().widgets].concat(args)));
};
this.createURL = function () {
var _connectorDesc$refine2;
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
return _this2.context.ais.createHrefForState((_connectorDesc$refine2 = connectorDesc.refine).call.apply(_connectorDesc$refine2, [_this2, _this2.props, _this2.context.ais.store.getState().widgets].concat(args)));
};
this.cleanUp = function () {
var _connectorDesc$cleanU;
for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
return (_connectorDesc$cleanU = connectorDesc.cleanUp).call.apply(_connectorDesc$cleanU, [_this2].concat(args));
};
}, _temp;
};
}
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE$1 = 200;
/**
* The base implementation of methods like `_.difference` without support
* for excluding multiple arrays or iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Array} values The values to exclude.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of filtered values.
*/
function baseDifference(array, values, iteratee, comparator) {
var index = -1,
includes = _arrayIncludes,
isCommon = true,
length = array.length,
result = [],
valuesLength = values.length;
if (!length) {
return result;
}
if (iteratee) {
values = _arrayMap(values, _baseUnary(iteratee));
}
if (comparator) {
includes = _arrayIncludesWith;
isCommon = false;
}
else if (values.length >= LARGE_ARRAY_SIZE$1) {
includes = _cacheHas;
isCommon = false;
values = new _SetCache(values);
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee == null ? value : iteratee(value);
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
if (values[valuesIndex] === computed) {
continue outer;
}
}
result.push(value);
}
else if (!includes(values, computed, comparator)) {
result.push(value);
}
}
return result;
}
var _baseDifference = baseDifference;
/**
* Creates an array of `array` values not included in the other given arrays
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. The order and references of result values are
* determined by the first array.
*
* **Note:** Unlike `_.pullAll`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @see _.without, _.xor
* @example
*
* _.difference([2, 1], [2, 3]);
* // => [1]
*/
var difference = _baseRest(function(array, values) {
return isArrayLikeObject_1(array)
? _baseDifference(array, _baseFlatten(values, 1, isArrayLikeObject_1, true))
: [];
});
var difference_1 = difference;
var _extends$5 = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
function _defineProperty$2(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 getIndex(context) {
return context && context.multiIndexContext ? context.multiIndexContext.targetedIndex : context.ais.mainTargetedIndex;
}
function getResults(searchResults, context) {
if (searchResults.results && !searchResults.results.hits) {
return searchResults.results[getIndex(context)] ? searchResults.results[getIndex(context)] : null;
} else {
return searchResults.results ? searchResults.results : null;
}
}
function hasMultipleIndex(context) {
return context && context.multiIndexContext;
}
// eslint-disable-next-line max-params
function refineValue(searchState, nextRefinement, context, resetPage, namespace) {
if (hasMultipleIndex(context)) {
return namespace ? refineMultiIndexWithNamespace(searchState, nextRefinement, context, resetPage, namespace) : refineMultiIndex(searchState, nextRefinement, context, resetPage);
} else {
// When we have a multi index page with shared widgets we should also
// reset their page to 1 if the resetPage is provided. Otherwise the
// indices will always be reset
// see: https://github.com/algolia/react-instantsearch/issues/310
// see: https://github.com/algolia/react-instantsearch/issues/637
if (searchState.indices && resetPage) {
Object.keys(searchState.indices).forEach(function (targetedIndex) {
searchState = refineValue(searchState, { page: 1 }, { multiIndexContext: { targetedIndex: targetedIndex } }, true, namespace);
});
}
return namespace ? refineSingleIndexWithNamespace(searchState, nextRefinement, resetPage, namespace) : refineSingleIndex(searchState, nextRefinement, resetPage);
}
}
function refineMultiIndex(searchState, nextRefinement, context, resetPage) {
var page = resetPage ? { page: 1 } : undefined;
var index = getIndex(context);
var state = has_1(searchState, 'indices.' + index) ? _extends$5({}, searchState.indices, _defineProperty$2({}, index, _extends$5({}, searchState.indices[index], nextRefinement, page))) : _extends$5({}, searchState.indices, _defineProperty$2({}, index, _extends$5({}, nextRefinement, page)));
return _extends$5({}, searchState, { indices: state });
}
function refineSingleIndex(searchState, nextRefinement, resetPage) {
var page = resetPage ? { page: 1 } : undefined;
return _extends$5({}, searchState, nextRefinement, page);
}
// eslint-disable-next-line max-params
function refineMultiIndexWithNamespace(searchState, nextRefinement, context, resetPage, namespace) {
var _extends4;
var index = getIndex(context);
var page = resetPage ? { page: 1 } : undefined;
var state = has_1(searchState, 'indices.' + index) ? _extends$5({}, searchState.indices, _defineProperty$2({}, index, _extends$5({}, searchState.indices[index], (_extends4 = {}, _defineProperty$2(_extends4, namespace, _extends$5({}, searchState.indices[index][namespace], nextRefinement)), _defineProperty$2(_extends4, 'page', 1), _extends4)))) : _extends$5({}, searchState.indices, _defineProperty$2({}, index, _extends$5(_defineProperty$2({}, namespace, nextRefinement), page)));
return _extends$5({}, searchState, { indices: state });
}
function refineSingleIndexWithNamespace(searchState, nextRefinement, resetPage, namespace) {
var page = resetPage ? { page: 1 } : undefined;
return _extends$5({}, searchState, _defineProperty$2({}, namespace, _extends$5({}, searchState[namespace], nextRefinement)), page);
}
function getNamespaceAndAttributeName(id) {
var parts = id.match(/^([^.]*)\.(.*)/);
var namespace = parts && parts[1];
var attributeName = parts && parts[2];
return { namespace: namespace, attributeName: attributeName };
}
// eslint-disable-next-line max-params
function getCurrentRefinementValue(props, searchState, context, id, defaultValue) {
var refinementsCallback = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : function (x) {
return x;
};
var index = getIndex(context);
var _getNamespaceAndAttri = getNamespaceAndAttributeName(id),
namespace = _getNamespaceAndAttri.namespace,
attributeName = _getNamespaceAndAttri.attributeName;
var refinements = hasMultipleIndex(context) && searchState.indices && namespace && searchState.indices['' + index] && has_1(searchState.indices['' + index][namespace], '' + attributeName) || hasMultipleIndex(context) && searchState.indices && has_1(searchState, 'indices.' + index + '.' + id) || !hasMultipleIndex(context) && namespace && has_1(searchState[namespace], attributeName) || !hasMultipleIndex(context) && has_1(searchState, id);
if (refinements) {
var currentRefinement = void 0;
if (hasMultipleIndex(context)) {
currentRefinement = namespace ? get_1(searchState.indices['' + index][namespace], attributeName) : get_1(searchState.indices[index], id);
} else {
currentRefinement = namespace ? get_1(searchState[namespace], attributeName) : get_1(searchState, id);
}
return refinementsCallback(currentRefinement);
}
if (props.defaultRefinement) {
return props.defaultRefinement;
}
return defaultValue;
}
function cleanUpValue(searchState, context, id) {
var indexName = getIndex(context);
var _getNamespaceAndAttri2 = getNamespaceAndAttributeName(id),
namespace = _getNamespaceAndAttri2.namespace,
attributeName = _getNamespaceAndAttri2.attributeName;
if (hasMultipleIndex(context) && Boolean(searchState.indices)) {
return cleanUpValueWithMutliIndex({
attribute: attributeName,
searchState: searchState,
indexName: indexName,
id: id,
namespace: namespace
});
}
return cleanUpValueWithSingleIndex({
attribute: attributeName,
searchState: searchState,
id: id,
namespace: namespace
});
}
function cleanUpValueWithSingleIndex(_ref) {
var searchState = _ref.searchState,
id = _ref.id,
namespace = _ref.namespace,
attribute = _ref.attribute;
if (namespace) {
return _extends$5({}, searchState, _defineProperty$2({}, namespace, omit_1(searchState[namespace], attribute)));
}
return omit_1(searchState, id);
}
function cleanUpValueWithMutliIndex(_ref2) {
var searchState = _ref2.searchState,
indexName = _ref2.indexName,
id = _ref2.id,
namespace = _ref2.namespace,
attribute = _ref2.attribute;
var index = searchState.indices[indexName];
if (namespace && index) {
return _extends$5({}, searchState, {
indices: _extends$5({}, searchState.indices, _defineProperty$2({}, indexName, _extends$5({}, index, _defineProperty$2({}, namespace, omit_1(index[namespace], attribute)))))
});
}
return omit_1(searchState, 'indices.' + indexName + '.' + id);
}
var _extends$6 = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
function _defineProperty$3(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 getId() {
return 'configure';
}
var connectConfigure = createConnector({
displayName: 'AlgoliaConfigure',
getProvidedProps: function getProvidedProps() {
return {};
},
getSearchParameters: function getSearchParameters(searchParameters, props) {
var items = omit_1(props, 'children');
return searchParameters.setQueryParameters(items);
},
transitionState: function transitionState(props, prevSearchState, nextSearchState) {
var id = getId();
var items = omit_1(props, 'children');
var nonPresentKeys = this._props ? difference_1(keys_1(this._props), keys_1(props)) : [];
this._props = props;
var nextValue = _defineProperty$3({}, id, _extends$6({}, omit_1(nextSearchState[id], nonPresentKeys), items));
return refineValue(nextSearchState, nextValue, this.context);
},
cleanUp: function cleanUp(props, searchState) {
var id = getId();
var index = getIndex(this.context);
var subState = hasMultipleIndex(this.context) && searchState.indices ? searchState.indices[index] : searchState;
var configureKeys = subState && subState[id] ? Object.keys(subState[id]) : [];
var configureState = configureKeys.reduce(function (acc, item) {
if (!props[item]) {
acc[item] = subState[id][item];
}
return acc;
}, {});
var nextValue = _defineProperty$3({}, id, configureState);
return refineValue(searchState, nextValue, this.context);
}
});
/**
* Configure is a widget that lets you provide raw search parameters
* to the Algolia API.
*
* Any of the props added to this widget will be forwarded to Algolia. For more information
* on the different parameters that can be set, have a look at the
* [reference](https://www.algolia.com/doc/api-client/javascript/search#search-parameters).
*
* This widget can be used either with react-dom and react-native. It will not render anything
* on screen, only configure some parameters.
*
* Read more in the [Search parameters](guide/Search_parameters.html) guide.
* @name Configure
* @kind widget
* @example
* import React from 'react';
* import { InstantSearch, Configure, Hits } from 'react-instantsearch-dom';
*
* const App = () => (
* <InstantSearch
* appId="latency"
* apiKey="6be0576ff61c053d5f9a3225e2a90f76"
* indexName="instant_search"
* >
* <Configure hitsPerPage={5} />
* <Hits />
* </InstantSearch>
* );
*/
connectConfigure(function () {
return null;
});
function _defineProperty$4(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 _toConsumableArray(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}return arr2;
} else {
return Array.from(arr);
}
}
var getId$1 = function getId() {
return 'query';
};
function getCurrentRefinement(props, searchState, context) {
var id = getId$1();
return getCurrentRefinementValue(props, searchState, context, id, '', function (currentRefinement) {
if (currentRefinement) {
return currentRefinement;
}
return '';
});
}
function getHits(searchResults) {
if (searchResults.results) {
if (searchResults.results.hits && Array.isArray(searchResults.results.hits)) {
return searchResults.results.hits;
} else {
return Object.keys(searchResults.results).reduce(function (hits, index) {
return [].concat(_toConsumableArray(hits), [{
index: index,
hits: searchResults.results[index].hits
}]);
}, []);
}
} else {
return [];
}
}
function _refine(props, searchState, nextRefinement, context) {
var id = getId$1();
var nextValue = _defineProperty$4({}, id, nextRefinement);
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage);
}
function _cleanUp(props, searchState, context) {
return cleanUpValue(searchState, context, getId$1());
}
/**
* connectAutoComplete connector provides the logic to create connected
* components that will render the results retrieved from
* Algolia.
*
* To configure the number of hits retrieved, use [HitsPerPage widget](widgets/HitsPerPage.html),
* [connectHitsPerPage connector](connectors/connectHitsPerPage.html) or pass the hitsPerPage
* prop to a [Configure](guide/Search_parameters.html) widget.
* @name connectAutoComplete
* @kind connector
* @propType {string} [defaultRefinement] - Provide a default value for the query
* @providedPropType {array.<object>} hits - the records that matched the search state
* @providedPropType {function} refine - a function to change the query
* @providedPropType {string} currentRefinement - the query to search for
*/
var connectAutoComplete = createConnector({
displayName: 'AlgoliaAutoComplete',
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
return {
hits: getHits(searchResults),
currentRefinement: getCurrentRefinement(props, searchState, this.context)
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine(props, searchState, nextRefinement, this.context);
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp(props, searchState, this.context);
},
/* connectAutoComplete needs to be considered as a widget to trigger a search if no others widgets are used.
* To be considered as a widget you need either getSearchParameters, getMetadata or getTransitionState
* See createConnector.js
* */
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
return searchParameters.setQuery(getCurrentRefinement(props, searchState, this.context));
}
});
function _defineProperty$5(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}return obj;
}
var getId$2 = function getId(props) {
return props.attributes[0];
};
var namespace = 'hierarchicalMenu';
function _refine$1(props, searchState, nextRefinement, context) {
var id = getId$2(props);
var nextValue = _defineProperty$5({}, id, nextRefinement || '');
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage, namespace);
}
function transformValue(values) {
return values.reduce(function (acc, item) {
if (item.isRefined) {
acc.push({
label: item.name,
// If dealing with a nested "items", "value" is equal to the previous value concatenated with the current label
// If dealing with the first level, "value" is equal to the current label
value: item.path
});
// Create a variable in order to keep the same acc for the recursion, otherwise "reduce" returns a new one
if (item.data) {
acc = acc.concat(transformValue(item.data, acc));
}
}
return acc;
}, []);
}
/**
* The breadcrumb component is s a type of secondary navigation scheme that
* reveals the user’s location in a website or web application.
*
* @name connectBreadcrumb
* @requirements To use this widget, your attributes must be formatted in a specific way.
* If you want for example to have a Breadcrumb of categories, objects in your index
* should be formatted this way:
*
* ```json
* {
* "categories.lvl0": "products",
* "categories.lvl1": "products > fruits",
* "categories.lvl2": "products > fruits > citrus"
* }
* ```
*
* It's also possible to provide more than one path for each level:
*
* ```json
* {
* "categories.lvl0": ["products", "goods"],
* "categories.lvl1": ["products > fruits", "goods > to eat"]
* }
* ```
*
* All attributes passed to the `attributes` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
*
* @kind connector
* @propType {array.<string>} attributes - List of attributes to use to generate the hierarchy of the menu. See the example for the convention to follow.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @providedPropType {function} refine - a function to toggle a refinement
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {array.<{items: object, count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the Breadcrumb can display.
*/
var connectBreadcrumb = createConnector({
displayName: 'AlgoliaBreadcrumb',
propTypes: {
attributes: function attributes(props, propName, componentName) {
var isNotString = function isNotString(val) {
return typeof val !== 'string';
};
if (!Array.isArray(props[propName]) || props[propName].some(isNotString) || props[propName].length < 1) {
return new Error('Invalid prop ' + propName + ' supplied to ' + componentName + '. Expected an Array of Strings');
}
return undefined;
},
transformItems: propTypes.func
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var id = getId$2(props);
var results = getResults(searchResults, this.context);
var isFacetPresent = Boolean(results) && Boolean(results.getFacetByName(id));
if (!isFacetPresent) {
return {
items: [],
canRefine: false
};
}
var values = results.getFacetValues(id);
var items = values.data ? transformValue(values.data) : [];
var transformedItems = props.transformItems ? props.transformItems(items) : items;
return {
canRefine: transformedItems.length > 0,
items: transformedItems
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$1(props, searchState, nextRefinement, this.context);
}
});
var _extends$7 = 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;
};
/**
* connectCurrentRefinements connector provides the logic to build a widget that will
* give the user the ability to remove all or some of the filters that were
* set.
* @name connectCurrentRefinements
* @kind connector
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @propType {function} [clearsQuery=false] - Pass true to also clear the search query
* @providedPropType {function} refine - a function to remove a single filter
* @providedPropType {array.<{label: string, attribute: string, currentRefinement: string || object, items: array, value: function}>} items - all the filters, the `value` is to pass to the `refine` function for removing all currentrefinements, `label` is for the display. When existing several refinements for the same atribute name, then you get a nested `items` object that contains a `label` and a `value` function to use to remove a single filter. `attribute` and `currentRefinement` are metadata containing row values.
* @providedPropType {string} query - the search query
*/
var connectCurrentRefinements = createConnector({
displayName: 'AlgoliaCurrentRefinements',
propTypes: {
transformItems: propTypes.func
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults, metadata) {
var items = metadata.reduce(function (res, meta) {
if (typeof meta.items !== 'undefined') {
if (!props.clearsQuery && meta.id === 'query') {
return res;
} else {
if (props.clearsQuery && meta.id === 'query' && meta.items[0].currentRefinement === '') {
return res;
}
return res.concat(meta.items.map(function (item) {
return _extends$7({}, item, {
id: meta.id,
index: meta.index
});
}));
}
}
return res;
}, []);
var transformedItems = props.transformItems ? props.transformItems(items) : items;
return {
items: transformedItems,
canRefine: transformedItems.length > 0
};
},
refine: function refine(props, searchState, items) {
// `value` corresponds to our internal clear function computed in each connector metadata.
var refinementsToClear = items instanceof Array ? items.map(function (item) {
return item.value;
}) : [items];
return refinementsToClear.reduce(function (res, clear) {
return clear(res);
}, searchState);
}
});
function _defineProperty$6(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 _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;
}
/**
* The GeoSearch connector provides the logic to build a widget that will display the results on a map.
* It also provides a way to search for results based on their position. The connector provides function to manage the search experience (search on map interaction).
* @name connectGeoSearch
* @kind connector
* @requirements Note that the GeoSearch connector uses the [geosearch](https://www.algolia.com/doc/guides/searching/geo-search) capabilities of Algolia.
* Your hits **must** have a `_geoloc` attribute in order to be passed to the rendering function. Currently, the feature is not compatible with multiple values in the `_geoloc` attribute
* (e.g. a restaurant with multiple locations). In that case you can duplicate your records and use the [distinct](https://www.algolia.com/doc/guides/ranking/distinct) feature of Algolia to only retrieve unique results.
* @propType {{ northEast: { lat: number, lng: number }, southWest: { lat: number, lng: number } }} [defaultRefinement] - Default search state of the widget containing the bounds for the map
* @providedPropType {function({ northEast: { lat: number, lng: number }, southWest: { lat: number, lng: number } })} refine - a function to toggle the refinement
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {array.<object>} hits - the records that matched the search
* @providedPropType {boolean} isRefinedWithMap - true if the current refinement is set with the map bounds
* @providedPropType {{ northEast: { lat: number, lng: number }, southWest: { lat: number, lng: number } }} [currentRefinement] - the refinement currently applied
* @providedPropType {{ lat: number, lng: number }} [position] - the position of the search
*/
// To control the map with an external widget the other widget
// **must** write the value in the attribute `aroundLatLng`
var getBoundingBoxId = function getBoundingBoxId() {
return 'boundingBox';
};
var getAroundLatLngId = function getAroundLatLngId() {
return 'aroundLatLng';
};
var getConfigureAroundLatLngId = function getConfigureAroundLatLngId() {
return 'configure.aroundLatLng';
};
var currentRefinementToString = function currentRefinementToString(currentRefinement) {
return [currentRefinement.northEast.lat, currentRefinement.northEast.lng, currentRefinement.southWest.lat, currentRefinement.southWest.lng].join();
};
var stringToCurrentRefinement = function stringToCurrentRefinement(value) {
var values = value.split(',');
return {
northEast: {
lat: parseFloat(values[0]),
lng: parseFloat(values[1])
},
southWest: {
lat: parseFloat(values[2]),
lng: parseFloat(values[3])
}
};
};
var latLngRegExp = /^(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)$/;
var stringToPosition = function stringToPosition(value) {
var pattern = value.match(latLngRegExp);
return {
lat: parseFloat(pattern[1]),
lng: parseFloat(pattern[2])
};
};
var getCurrentRefinement$1 = function getCurrentRefinement(props, searchState, context) {
var refinement = getCurrentRefinementValue(props, searchState, context, getBoundingBoxId(), {});
if (isEmpty_1(refinement)) {
return;
}
// eslint-disable-next-line consistent-return
return {
northEast: {
lat: parseFloat(refinement.northEast.lat),
lng: parseFloat(refinement.northEast.lng)
},
southWest: {
lat: parseFloat(refinement.southWest.lat),
lng: parseFloat(refinement.southWest.lng)
}
};
};
var getCurrentPosition = function getCurrentPosition(props, searchState, context) {
var defaultRefinement = props.defaultRefinement,
propsWithoutDefaultRefinement = _objectWithoutProperties(props, ['defaultRefinement']);
var aroundLatLng = getCurrentRefinementValue(propsWithoutDefaultRefinement, searchState, context, getAroundLatLngId());
if (!aroundLatLng) {
// Fallback on `configure.aroundLatLng`
var configureAroundLatLng = getCurrentRefinementValue(propsWithoutDefaultRefinement, searchState, context, getConfigureAroundLatLngId());
return configureAroundLatLng && stringToPosition(configureAroundLatLng);
}
return aroundLatLng;
};
var _refine$2 = function _refine(searchState, nextValue, context) {
var resetPage = true;
var nextRefinement = _defineProperty$6({}, getBoundingBoxId(), nextValue);
return refineValue(searchState, nextRefinement, context, resetPage);
};
var connectGeoSearch = createConnector({
displayName: 'AlgoliaGeoSearch',
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var results = getResults(searchResults, this.context);
// We read it from both because the SearchParameters & the searchState are not always
// in sync. When we set the refinement the searchState is used but when we clear the refinement
// the SearchParameters is used. In the first case when we render, the results are not there
// so we can't find the value from the results. The most up to date value is the searchState.
// But when we clear the refinement the searchState is immediatly cleared even when the items
// retrieved are still the one from the previous query with the bounding box. It leads to some
// issue with the position of the map. We should rely on 1 source of truth or at least always
// be sync.
var currentRefinementFromSearchState = getCurrentRefinement$1(props, searchState, this.context);
var currentRefinementFromSearchParameters = results && results._state.insideBoundingBox && stringToCurrentRefinement(results._state.insideBoundingBox) || undefined;
var currentPositionFromSearchState = getCurrentPosition(props, searchState, this.context);
var currentPositionFromSearchParameters = results && results._state.aroundLatLng && stringToPosition(results._state.aroundLatLng) || undefined;
var currentRefinement = currentRefinementFromSearchState || currentRefinementFromSearchParameters;
var position = currentPositionFromSearchState || currentPositionFromSearchParameters;
return {
hits: !results ? [] : results.hits.filter(function (_) {
return Boolean(_._geoloc);
}),
isRefinedWithMap: Boolean(currentRefinement),
currentRefinement: currentRefinement,
position: position
};
},
refine: function refine(props, searchState, nextValue) {
return _refine$2(searchState, nextValue, this.context);
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var currentRefinement = getCurrentRefinement$1(props, searchState, this.context);
if (!currentRefinement) {
return searchParameters;
}
return searchParameters.setQueryParameter('insideBoundingBox', currentRefinementToString(currentRefinement));
},
cleanUp: function cleanUp(props, searchState) {
return cleanUpValue(searchState, this.context, getBoundingBoxId());
},
getMetadata: function getMetadata(props, searchState) {
var _this = this;
var items = [];
var id = getBoundingBoxId();
var index = getIndex(this.context);
var nextRefinement = {};
var currentRefinement = getCurrentRefinement$1(props, searchState, this.context);
if (currentRefinement) {
items.push({
label: id + ': ' + currentRefinementToString(currentRefinement),
value: function value(nextState) {
return _refine$2(nextState, nextRefinement, _this.context);
},
currentRefinement: currentRefinement
});
}
return {
id: id,
index: index,
items: items
};
},
shouldComponentUpdate: function shouldComponentUpdate() {
return true;
}
});
var _extends$8 = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
function _defineProperty$7(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}return obj;
}
var getId$3 = function getId(props) {
return props.attributes[0];
};
var namespace$1 = 'hierarchicalMenu';
function getCurrentRefinement$2(props, searchState, context) {
return getCurrentRefinementValue(props, searchState, context, namespace$1 + '.' + getId$3(props), null, function (currentRefinement) {
if (currentRefinement === '') {
return null;
}
return currentRefinement;
});
}
function getValue$1(path, props, searchState, context) {
var id = props.id,
attributes = props.attributes,
separator = props.separator,
rootPath = props.rootPath,
showParentLevel = props.showParentLevel;
var currentRefinement = getCurrentRefinement$2(props, searchState, context);
var nextRefinement = void 0;
if (currentRefinement === null) {
nextRefinement = path;
} else {
var tmpSearchParameters = new algoliasearchHelper_4({
hierarchicalFacets: [{
name: id,
attributes: attributes,
separator: separator,
rootPath: rootPath,
showParentLevel: showParentLevel
}]
});
nextRefinement = tmpSearchParameters.toggleHierarchicalFacetRefinement(id, currentRefinement).toggleHierarchicalFacetRefinement(id, path).getHierarchicalRefinement(id)[0];
}
return nextRefinement;
}
function transformValue$1(value, props, searchState, context) {
return value.map(function (v) {
return {
label: v.name,
value: getValue$1(v.path, props, searchState, context),
count: v.count,
isRefined: v.isRefined,
items: v.data && transformValue$1(v.data, props, searchState, context)
};
});
}
var truncate = function truncate() {
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
return items.slice(0, limit).map(function () {
var item = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return Array.isArray(item.items) ? _extends$8({}, item, {
items: truncate(item.items, limit)
}) : item;
});
};
function _refine$3(props, searchState, nextRefinement, context) {
var id = getId$3(props);
var nextValue = _defineProperty$7({}, id, nextRefinement || '');
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage, namespace$1);
}
function _cleanUp$1(props, searchState, context) {
return cleanUpValue(searchState, context, namespace$1 + '.' + getId$3(props));
}
var sortBy = ['name:asc'];
/**
* connectHierarchicalMenu connector provides the logic to build a widget that will
* give the user the ability to explore a tree-like structure.
* This is commonly used for multi-level categorization of products on e-commerce
* websites. From a UX point of view, we suggest not displaying more than two levels deep.
* @name connectHierarchicalMenu
* @requirements To use this widget, your attributes must be formatted in a specific way.
* If you want for example to have a hiearchical menu of categories, objects in your index
* should be formatted this way:
*
* ```json
* {
* "categories.lvl0": "products",
* "categories.lvl1": "products > fruits",
* "categories.lvl2": "products > fruits > citrus"
* }
* ```
*
* It's also possible to provide more than one path for each level:
*
* ```json
* {
* "categories.lvl0": ["products", "goods"],
* "categories.lvl1": ["products > fruits", "goods > to eat"]
* }
* ```
*
* All attributes passed to the `attributes` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
*
* @kind connector
* @propType {array.<string>} attributes - List of attributes to use to generate the hierarchy of the menu. See the example for the convention to follow.
* @propType {string} [defaultRefinement] - the item value selected by default
* @propType {boolean} [showMore=false] - Flag to activate the show more button, for toggling the number of items between limit and showMoreLimit.
* @propType {number} [limit=10] - The maximum number of items displayed.
* @propType {number} [showMoreLimit=20] - The maximum number of items displayed when the user triggers the show more. Not considered if `showMore` is false.
* @propType {string} [separator='>'] - Specifies the level separator used in the data.
* @propType {string[]} [rootPath=null] - The already selected and hidden path.
* @propType {boolean} [showParentLevel=true] - Flag to set if the parent level should be displayed.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @providedPropType {function} refine - a function to toggle a refinement
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string} currentRefinement - the refinement currently applied
* @providedPropType {array.<{items: object, count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the HierarchicalMenu can display. items has the same shape as parent items.
*/
var connectHierarchicalMenu = createConnector({
displayName: 'AlgoliaHierarchicalMenu',
propTypes: {
attributes: function attributes(props, propName, componentName) {
var isNotString = function isNotString(val) {
return typeof val !== 'string';
};
if (!Array.isArray(props[propName]) || props[propName].some(isNotString) || props[propName].length < 1) {
return new Error('Invalid prop ' + propName + ' supplied to ' + componentName + '. Expected an Array of Strings');
}
return undefined;
},
separator: propTypes.string,
rootPath: propTypes.string,
showParentLevel: propTypes.bool,
defaultRefinement: propTypes.string,
showMore: propTypes.bool,
limit: propTypes.number,
showMoreLimit: propTypes.number,
transformItems: propTypes.func
},
defaultProps: {
showMore: false,
limit: 10,
showMoreLimit: 20,
separator: ' > ',
rootPath: null,
showParentLevel: true
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var showMore = props.showMore,
limit = props.limit,
showMoreLimit = props.showMoreLimit;
var id = getId$3(props);
var results = getResults(searchResults, this.context);
var isFacetPresent = Boolean(results) && Boolean(results.getFacetByName(id));
if (!isFacetPresent) {
return {
items: [],
currentRefinement: getCurrentRefinement$2(props, searchState, this.context),
canRefine: false
};
}
var itemsLimit = showMore ? showMoreLimit : limit;
var value = results.getFacetValues(id, { sortBy: sortBy });
var items = value.data ? transformValue$1(value.data, props, searchState, this.context) : [];
var transformedItems = props.transformItems ? props.transformItems(items) : items;
return {
items: truncate(transformedItems, itemsLimit),
currentRefinement: getCurrentRefinement$2(props, searchState, this.context),
canRefine: transformedItems.length > 0
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$3(props, searchState, nextRefinement, this.context);
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$1(props, searchState, this.context);
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var attributes = props.attributes,
separator = props.separator,
rootPath = props.rootPath,
showParentLevel = props.showParentLevel,
showMore = props.showMore,
limit = props.limit,
showMoreLimit = props.showMoreLimit;
var id = getId$3(props);
var itemsLimit = showMore ? showMoreLimit : limit;
searchParameters = searchParameters.addHierarchicalFacet({
name: id,
attributes: attributes,
separator: separator,
rootPath: rootPath,
showParentLevel: showParentLevel
}).setQueryParameters({
maxValuesPerFacet: Math.max(searchParameters.maxValuesPerFacet || 0, itemsLimit)
});
var currentRefinement = getCurrentRefinement$2(props, searchState, this.context);
if (currentRefinement !== null) {
searchParameters = searchParameters.toggleHierarchicalFacetRefinement(id, currentRefinement);
}
return searchParameters;
},
getMetadata: function getMetadata(props, searchState) {
var _this = this;
var rootAttribute = props.attributes[0];
var id = getId$3(props);
var currentRefinement = getCurrentRefinement$2(props, searchState, this.context);
return {
id: id,
index: getIndex(this.context),
items: !currentRefinement ? [] : [{
label: rootAttribute + ': ' + currentRefinement,
attribute: rootAttribute,
value: function value(nextState) {
return _refine$3(props, nextState, '', _this.context);
},
currentRefinement: currentRefinement
}]
};
}
});
var highlight = function highlight(_ref) {
var attribute = _ref.attribute,
hit = _ref.hit,
highlightProperty = _ref.highlightProperty,
_ref$preTag = _ref.preTag,
preTag = _ref$preTag === undefined ? HIGHLIGHT_TAGS.highlightPreTag : _ref$preTag,
_ref$postTag = _ref.postTag,
postTag = _ref$postTag === undefined ? HIGHLIGHT_TAGS.highlightPostTag : _ref$postTag;
return parseAlgoliaHit({
attribute: attribute,
highlightProperty: highlightProperty,
hit: hit,
preTag: preTag,
postTag: postTag
});
};
/**
* connectHighlight connector provides the logic to create an highlighter
* component that will retrieve, parse and render an highlighted attribute
* from an Algolia hit.
* @name connectHighlight
* @kind connector
* @category connector
* @providedPropType {function} highlight - function to retrieve and parse an attribute from a hit. It takes a configuration object with 3 attributes: `highlightProperty` which is the property that contains the highlight structure from the records, `attribute` which is the name of the attribute (it can be either a string or an array of strings) to look for and `hit` which is the hit from Algolia. It returns an array of objects `{value: string, isHighlighted: boolean}`. If the element that corresponds to the attribute is an array of strings, it will return a nested array of objects.
* @example
* import React from 'react';
* import { InstantSearch, SearchBox, Hits, connectHighlight } from 'react-instantsearch-dom';
*
* const CustomHighlight = connectHighlight(
* ({ highlight, attribute, hit, highlightProperty }) => {
* const highlights = highlight({
* highlightProperty: '_highlightResult',
* attribute,
* hit
* });
*
* return highlights.map(part => part.isHighlighted ? (
* <mark>{part.value}</mark>
* ) : (
* <span>{part.value}</span>
* ));
* }
* );
*
* const Hit = ({ hit }) => (
* <p>
* <CustomHighlight attribute="name" hit={hit} />
* </p>
* );
*
* const App = () => (
* <InstantSearch
* appId="latency"
* apiKey="6be0576ff61c053d5f9a3225e2a90f76"
* indexName="instant_search"
* >
* <SearchBox defaultRefinement="pho" />
* <Hits hitComponent={Hit} />
* </InstantSearch>
* );
*/
var connectHighlight = createConnector({
displayName: 'AlgoliaHighlighter',
propTypes: {},
getProvidedProps: function getProvidedProps() {
return { highlight: highlight };
}
});
/**
* connectHits connector provides the logic to create connected
* components that will render the results retrieved from
* Algolia.
*
* To configure the number of hits retrieved, use [HitsPerPage widget](widgets/HitsPerPage.html),
* [connectHitsPerPage connector](connectors/connectHitsPerPage.html) or pass the hitsPerPage
* prop to a [Configure](guide/Search_parameters.html) widget.
*
* **Warning:** you will need to use the **objectID** property available on every hit as a key
* when iterating over them. This will ensure you have the best possible UI experience
* especially on slow networks.
* @name connectHits
* @kind connector
* @providedPropType {array.<object>} hits - the records that matched the search state
* @example
* import React from 'react';
* import { InstantSearch, Highlight, connectHits } from 'react-instantsearch-dom';
*
* const CustomHits = connectHits(({ hits }) => (
* <div>
* {hits.map(hit =>
* <p key={hit.objectID}>
* <Highlight attribute="name" hit={hit} />
* </p>
* )}
* </div>
* ));
*
* const App = () => (
* <InstantSearch
* appId="latency"
* apiKey="6be0576ff61c053d5f9a3225e2a90f76"
* indexName="instant_search"
* >
* <CustomHits />
* </InstantSearch>
* );
*/
var connectHits = createConnector({
displayName: 'AlgoliaHits',
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var results = getResults(searchResults, this.context);
var hits = results ? results.hits : [];
return { hits: hits };
},
/* Hits needs to be considered as a widget to trigger a search if no others widgets are used.
* To be considered as a widget you need either getSearchParameters, getMetadata or getTransitionState
* See createConnector.js
* */
getSearchParameters: function getSearchParameters(searchParameters) {
return searchParameters;
}
});
var _extends$9 = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
function _defineProperty$8(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 getId$4() {
return 'hitsPerPage';
}
function getCurrentRefinement$3(props, searchState, context) {
var id = getId$4();
return getCurrentRefinementValue(props, searchState, context, id, null, function (currentRefinement) {
if (typeof currentRefinement === 'string') {
return parseInt(currentRefinement, 10);
}
return currentRefinement;
});
}
/**
* connectHitsPerPage connector provides the logic to create connected
* components that will allow a user to choose to display more or less results from Algolia.
* @name connectHitsPerPage
* @kind connector
* @propType {number} defaultRefinement - The number of items selected by default
* @propType {{value: number, label: string}[]} items - List of hits per page options.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @providedPropType {function} refine - a function to remove a single filter
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string} currentRefinement - the refinement currently applied
* @providedPropType {array.<{isRefined: boolean, label?: string, value: number}>} items - the list of items the HitsPerPage can display. If no label provided, the value will be displayed.
*/
var connectHitsPerPage = createConnector({
displayName: 'AlgoliaHitsPerPage',
propTypes: {
defaultRefinement: propTypes.number.isRequired,
items: propTypes.arrayOf(propTypes.shape({
label: propTypes.string,
value: propTypes.number.isRequired
})).isRequired,
transformItems: propTypes.func
},
getProvidedProps: function getProvidedProps(props, searchState) {
var currentRefinement = getCurrentRefinement$3(props, searchState, this.context);
var items = props.items.map(function (item) {
return item.value === currentRefinement ? _extends$9({}, item, { isRefined: true }) : _extends$9({}, item, { isRefined: false });
});
return {
items: props.transformItems ? props.transformItems(items) : items,
currentRefinement: currentRefinement
};
},
refine: function refine(props, searchState, nextRefinement) {
var id = getId$4();
var nextValue = _defineProperty$8({}, id, nextRefinement);
var resetPage = true;
return refineValue(searchState, nextValue, this.context, resetPage);
},
cleanUp: function cleanUp(props, searchState) {
return cleanUpValue(searchState, this.context, getId$4());
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
return searchParameters.setHitsPerPage(getCurrentRefinement$3(props, searchState, this.context));
},
getMetadata: function getMetadata() {
return { id: getId$4() };
}
});
function _defineProperty$9(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 _toConsumableArray$1(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}return arr2;
} else {
return Array.from(arr);
}
}
function getId$5() {
return 'page';
}
function getCurrentRefinement$4(props, searchState, context) {
var id = getId$5();
var page = 1;
return getCurrentRefinementValue(props, searchState, context, id, page, function (currentRefinement) {
if (typeof currentRefinement === 'string') {
currentRefinement = parseInt(currentRefinement, 10);
}
return currentRefinement;
});
}
/**
* InfiniteHits connector provides the logic to create connected
* components that will render an continuous list of results retrieved from
* Algolia. This connector provides a function to load more results.
* @name connectInfiniteHits
* @kind connector
* @providedPropType {array.<object>} hits - the records that matched the search state
* @providedPropType {boolean} hasMore - indicates if there are more pages to load
* @providedPropType {function} refine - call to load more results
*/
var connectInfiniteHits = createConnector({
displayName: 'AlgoliaInfiniteHits',
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var results = getResults(searchResults, this.context);
this._allResults = this._allResults || [];
this._previousPage = this._previousPage || 0;
if (!results) {
return {
hits: [],
hasMore: false
};
}
var hits = results.hits,
page = results.page,
nbPages = results.nbPages;
if (page === 0) {
this._allResults = hits;
} else if (page > this._previousPage) {
this._allResults = [].concat(_toConsumableArray$1(this._allResults), _toConsumableArray$1(hits));
} else if (page < this._previousPage) {
this._allResults = hits;
}
var lastPageIndex = nbPages - 1;
var hasMore = page < lastPageIndex;
this._previousPage = page;
return {
hits: this._allResults,
hasMore: hasMore
};
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
return searchParameters.setQueryParameters({
page: getCurrentRefinement$4(props, searchState, this.context) - 1
});
},
refine: function refine(props, searchState) {
var id = getId$5();
var nextPage = getCurrentRefinement$4(props, searchState, this.context) + 1;
var nextValue = _defineProperty$9({}, id, nextPage);
var resetPage = false;
return refineValue(searchState, nextValue, this.context, resetPage);
}
});
function _defineProperty$a(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}return obj;
}
var namespace$2 = 'menu';
function getId$6(props) {
return props.attribute;
}
function getCurrentRefinement$5(props, searchState, context) {
return getCurrentRefinementValue(props, searchState, context, namespace$2 + '.' + getId$6(props), null, function (currentRefinement) {
if (currentRefinement === '') {
return null;
}
return currentRefinement;
});
}
function getValue$2(name, props, searchState, context) {
var currentRefinement = getCurrentRefinement$5(props, searchState, context);
return name === currentRefinement ? '' : name;
}
function getLimit(_ref) {
var showMore = _ref.showMore,
limit = _ref.limit,
showMoreLimit = _ref.showMoreLimit;
return showMore ? showMoreLimit : limit;
}
function _refine$4(props, searchState, nextRefinement, context) {
var id = getId$6(props);
var nextValue = _defineProperty$a({}, id, nextRefinement ? nextRefinement : '');
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage, namespace$2);
}
function _cleanUp$2(props, searchState, context) {
return cleanUpValue(searchState, context, namespace$2 + '.' + getId$6(props));
}
var sortBy$1 = ['count:desc', 'name:asc'];
/**
* connectMenu connector provides the logic to build a widget that will
* give the user the ability to choose a single value for a specific facet.
* @name connectMenu
* @requirements The attribute passed to the `attribute` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
* @kind connector
* @propType {string} attribute - the name of the attribute in the record
* @propType {boolean} [showMore=false] - true if the component should display a button that will expand the number of items
* @propType {number} [limit=10] - the minimum number of diplayed items
* @propType {number} [showMoreLimit=20] - the maximun number of displayed items. Only used when showMore is set to `true`
* @propType {string} [defaultRefinement] - the value of the item selected by default
* @propType {boolean} [searchable=false] - allow search inside values
* @providedPropType {function} refine - a function to toggle a refinement
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string} currentRefinement - the refinement currently applied
* @providedPropType {array.<{count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the Menu can display.
* @providedPropType {function} searchForItems - a function to toggle a search inside items values
* @providedPropType {boolean} isFromSearch - a boolean that says if the `items` props contains facet values from the global search or from the search inside items.
*/
var connectMenu = createConnector({
displayName: 'AlgoliaMenu',
propTypes: {
attribute: propTypes.string.isRequired,
showMore: propTypes.bool,
limit: propTypes.number,
showMoreLimit: propTypes.number,
defaultRefinement: propTypes.string,
transformItems: propTypes.func,
searchable: propTypes.bool
},
defaultProps: {
showMore: false,
limit: 10,
showMoreLimit: 20
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults, meta, searchForFacetValuesResults) {
var _this = this;
var attribute = props.attribute,
searchable = props.searchable;
var results = getResults(searchResults, this.context);
var canRefine = Boolean(results) && Boolean(results.getFacetByName(attribute));
var isFromSearch = Boolean(searchForFacetValuesResults && searchForFacetValuesResults[attribute] && searchForFacetValuesResults.query !== '');
// Search For Facet Values is not available with derived helper (used for multi index search)
if (searchable && this.context.multiIndexContext) {
throw new Error('react-instantsearch: searching in *List is not available when used inside a' + ' multi index context');
}
if (!canRefine) {
return {
items: [],
currentRefinement: getCurrentRefinement$5(props, searchState, this.context),
isFromSearch: isFromSearch,
searchable: searchable,
canRefine: canRefine
};
}
var items = isFromSearch ? searchForFacetValuesResults[attribute].map(function (v) {
return {
label: v.value,
value: getValue$2(v.value, props, searchState, _this.context),
_highlightResult: { label: { value: v.highlighted } },
count: v.count,
isRefined: v.isRefined
};
}) : results.getFacetValues(attribute, { sortBy: sortBy$1 }).map(function (v) {
return {
label: v.name,
value: getValue$2(v.name, props, searchState, _this.context),
count: v.count,
isRefined: v.isRefined
};
});
var sortedItems = searchable && !isFromSearch ? orderBy_1(items, ['isRefined', 'count', 'label'], ['desc', 'desc', 'asc']) : items;
var transformedItems = props.transformItems ? props.transformItems(sortedItems) : sortedItems;
return {
items: transformedItems.slice(0, getLimit(props)),
currentRefinement: getCurrentRefinement$5(props, searchState, this.context),
isFromSearch: isFromSearch,
searchable: searchable,
canRefine: transformedItems.length > 0
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$4(props, searchState, nextRefinement, this.context);
},
searchForFacetValues: function searchForFacetValues(props, searchState, nextRefinement) {
return {
facetName: props.attribute,
query: nextRefinement,
maxFacetHits: getLimit(props)
};
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$2(props, searchState, this.context);
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var attribute = props.attribute;
searchParameters = searchParameters.setQueryParameters({
maxValuesPerFacet: Math.max(searchParameters.maxValuesPerFacet || 0, getLimit(props))
});
searchParameters = searchParameters.addDisjunctiveFacet(attribute);
var currentRefinement = getCurrentRefinement$5(props, searchState, this.context);
if (currentRefinement !== null) {
searchParameters = searchParameters.addDisjunctiveFacetRefinement(attribute, currentRefinement);
}
return searchParameters;
},
getMetadata: function getMetadata(props, searchState) {
var _this2 = this;
var id = getId$6(props);
var currentRefinement = getCurrentRefinement$5(props, searchState, this.context);
return {
id: id,
index: getIndex(this.context),
items: currentRefinement === null ? [] : [{
label: props.attribute + ': ' + currentRefinement,
attribute: props.attribute,
value: function value(nextState) {
return _refine$4(props, nextState, '', _this2.context);
},
currentRefinement: currentRefinement
}]
};
}
});
var _slicedToArray = function () {
function sliceIterator(arr, i) {
var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}return _arr;
}return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
function _defineProperty$b(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 stringifyItem(item) {
if (typeof item.start === 'undefined' && typeof item.end === 'undefined') {
return '';
}
return (item.start ? item.start : '') + ':' + (item.end ? item.end : '');
}
function parseItem(value) {
if (value.length === 0) {
return { start: null, end: null };
}
var _value$split = value.split(':'),
_value$split2 = _slicedToArray(_value$split, 2),
startStr = _value$split2[0],
endStr = _value$split2[1];
return {
start: startStr.length > 0 ? parseInt(startStr, 10) : null,
end: endStr.length > 0 ? parseInt(endStr, 10) : null
};
}
var namespace$3 = 'multiRange';
function getId$7(props) {
return props.attribute;
}
function getCurrentRefinement$6(props, searchState, context) {
return getCurrentRefinementValue(props, searchState, context, namespace$3 + '.' + getId$7(props), '', function (currentRefinement) {
if (currentRefinement === '') {
return '';
}
return currentRefinement;
});
}
function isRefinementsRangeIncludesInsideItemRange(stats, start, end) {
return stats.min > start && stats.min < end || stats.max > start && stats.max < end;
}
function isItemRangeIncludedInsideRefinementsRange(stats, start, end) {
return start > stats.min && start < stats.max || end > stats.min && end < stats.max;
}
function itemHasRefinement(attribute, results, value) {
var stats = results.getFacetByName(attribute) ? results.getFacetStats(attribute) : null;
var range = value.split(':');
var start = Number(range[0]) === 0 || value === '' ? Number.NEGATIVE_INFINITY : Number(range[0]);
var end = Number(range[1]) === 0 || value === '' ? Number.POSITIVE_INFINITY : Number(range[1]);
return !(Boolean(stats) && (isRefinementsRangeIncludesInsideItemRange(stats, start, end) || isItemRangeIncludedInsideRefinementsRange(stats, start, end)));
}
function _refine$5(props, searchState, nextRefinement, context) {
var nextValue = _defineProperty$b({}, getId$7(props, searchState), nextRefinement);
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage, namespace$3);
}
function _cleanUp$3(props, searchState, context) {
return cleanUpValue(searchState, context, namespace$3 + '.' + getId$7(props));
}
/**
* connectNumericMenu connector provides the logic to build a widget that will
* give the user the ability to select a range value for a numeric attribute.
* Ranges are defined statically.
* @name connectNumericMenu
* @requirements The attribute passed to the `attribute` prop must be holding numerical values.
* @kind connector
* @propType {string} attribute - the name of the attribute in the records
* @propType {{label: string, start: number, end: number}[]} items - List of options. With a text label, and upper and lower bounds.
* @propType {string} [defaultRefinement] - the value of the item selected by default, follow the shape of a `string` with a pattern of `'{start}:{end}'`.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @providedPropType {function} refine - a function to select a range.
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string} currentRefinement - the refinement currently applied. follow the shape of a `string` with a pattern of `'{start}:{end}'` which corresponds to the current selected item. For instance, when the selected item is `{start: 10, end: 20}`, the searchState of the widget is `'10:20'`. When `start` isn't defined, the searchState of the widget is `':{end}'`, and the same way around when `end` isn't defined. However, when neither `start` nor `end` are defined, the searchState is an empty string.
* @providedPropType {array.<{isRefined: boolean, label: string, value: string, isRefined: boolean, noRefinement: boolean}>} items - the list of ranges the NumericMenu can display.
*/
var connectNumericMenu = createConnector({
displayName: 'AlgoliaNumericMenu',
propTypes: {
id: propTypes.string,
attribute: propTypes.string.isRequired,
items: propTypes.arrayOf(propTypes.shape({
label: propTypes.node,
start: propTypes.number,
end: propTypes.number
})).isRequired,
transformItems: propTypes.func
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var attribute = props.attribute;
var currentRefinement = getCurrentRefinement$6(props, searchState, this.context);
var results = getResults(searchResults, this.context);
var items = props.items.map(function (item) {
var value = stringifyItem(item);
return {
label: item.label,
value: value,
isRefined: value === currentRefinement,
noRefinement: results ? itemHasRefinement(getId$7(props), results, value) : false
};
});
var stats = results && results.getFacetByName(attribute) ? results.getFacetStats(attribute) : null;
var refinedItem = find_1(items, function (item) {
return item.isRefined === true;
});
if (!items.some(function (item) {
return item.value === '';
})) {
items.push({
value: '',
isRefined: isEmpty_1(refinedItem),
noRefinement: !stats,
label: 'All'
});
}
var transformedItems = props.transformItems ? props.transformItems(items) : items;
return {
items: transformedItems,
currentRefinement: currentRefinement,
canRefine: transformedItems.length > 0 && transformedItems.some(function (item) {
return item.noRefinement === false;
})
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$5(props, searchState, nextRefinement, this.context);
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$3(props, searchState, this.context);
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var attribute = props.attribute;
var _parseItem = parseItem(getCurrentRefinement$6(props, searchState, this.context)),
start = _parseItem.start,
end = _parseItem.end;
searchParameters = searchParameters.addDisjunctiveFacet(attribute);
if (start) {
searchParameters = searchParameters.addNumericRefinement(attribute, '>=', start);
}
if (end) {
searchParameters = searchParameters.addNumericRefinement(attribute, '<=', end);
}
return searchParameters;
},
getMetadata: function getMetadata(props, searchState) {
var _this = this;
var id = getId$7(props);
var value = getCurrentRefinement$6(props, searchState, this.context);
var items = [];
var index = getIndex(this.context);
if (value !== '') {
var _find2 = find_1(props.items, function (item) {
return stringifyItem(item) === value;
}),
label = _find2.label;
items.push({
label: props.attribute + ': ' + label,
attribute: props.attribute,
currentRefinement: label,
value: function value(nextState) {
return _refine$5(props, nextState, '', _this.context);
}
});
}
return { id: id, index: index, items: items };
}
});
function _defineProperty$c(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 getId$8() {
return 'page';
}
function getCurrentRefinement$7(props, searchState, context) {
var id = getId$8();
var page = 1;
return getCurrentRefinementValue(props, searchState, context, id, page, function (currentRefinement) {
if (typeof currentRefinement === 'string') {
return parseInt(currentRefinement, 10);
}
return currentRefinement;
});
}
function _refine$6(props, searchState, nextPage, context) {
var id = getId$8();
var nextValue = _defineProperty$c({}, id, nextPage);
var resetPage = false;
return refineValue(searchState, nextValue, context, resetPage);
}
/**
* connectPagination connector provides the logic to build a widget that will
* let the user displays hits corresponding to a certain page.
* @name connectPagination
* @kind connector
* @propType {boolean} [showFirst=true] - Display the first page link.
* @propType {boolean} [showLast=false] - Display the last page link.
* @propType {boolean} [showPrevious=true] - Display the previous page link.
* @propType {boolean} [showNext=true] - Display the next page link.
* @propType {number} [padding=3] - How many page links to display around the current page.
* @propType {number} [totalPages=Infinity] - Maximum number of pages to display.
* @providedPropType {function} refine - a function to remove a single filter
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {number} nbPages - the total of existing pages
* @providedPropType {number} currentRefinement - the page refinement currently applied
*/
var connectPagination = createConnector({
displayName: 'AlgoliaPagination',
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var results = getResults(searchResults, this.context);
if (!results) {
return null;
}
var nbPages = results.nbPages;
return {
nbPages: nbPages,
currentRefinement: getCurrentRefinement$7(props, searchState, this.context),
canRefine: nbPages > 1
};
},
refine: function refine(props, searchState, nextPage) {
return _refine$6(props, searchState, nextPage, this.context);
},
cleanUp: function cleanUp(props, searchState) {
return cleanUpValue(searchState, this.context, getId$8());
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
return searchParameters.setPage(getCurrentRefinement$7(props, searchState, this.context) - 1);
},
getMetadata: function getMetadata() {
return { id: getId$8() };
}
});
/**
* connectPoweredBy connector provides the logic to build a widget that
* will display a link to algolia.
* @name connectPoweredBy
* @kind connector
* @providedPropType {string} url - the url to redirect to algolia
*/
var connectPoweredBy = createConnector({
displayName: 'AlgoliaPoweredBy',
propTypes: {},
getProvidedProps: function getProvidedProps(props) {
var url = 'https://www.algolia.com/?' + 'utm_source=react-instantsearch&' + 'utm_medium=website&' + ('utm_content=' + (props.canRender ? location.hostname : '') + '&') + 'utm_campaign=poweredby';
return { url: url };
}
});
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeIsFinite = _root.isFinite;
/**
* Checks if `value` is a finite primitive number.
*
* **Note:** This method is based on
* [`Number.isFinite`](https://mdn.io/Number/isFinite).
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
* @example
*
* _.isFinite(3);
* // => true
*
* _.isFinite(Number.MIN_VALUE);
* // => true
*
* _.isFinite(Infinity);
* // => false
*
* _.isFinite('3');
* // => false
*/
function isFinite(value) {
return typeof value == 'number' && nativeIsFinite(value);
}
var _isFinite = isFinite;
function _defineProperty$d(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;
}
/**
* connectRange connector provides the logic to create connected
* components that will give the ability for a user to refine results using
* a numeric range.
* @name connectRange
* @kind connector
* @requirements The attribute passed to the `attribute` prop must be present in “attributes for faceting”
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
* The values inside the attribute must be JavaScript numbers (not strings).
* @propType {string} attribute - Name of the attribute for faceting
* @propType {{min?: number, max?: number}} [defaultRefinement] - Default searchState of the widget containing the start and the end of the range.
* @propType {number} [min] - Minimum value. When this isn't set, the minimum value will be automatically computed by Algolia using the data in the index.
* @propType {number} [max] - Maximum value. When this isn't set, the maximum value will be automatically computed by Algolia using the data in the index.
* @propType {number} [precision=0] - Number of digits after decimal point to use.
* @providedPropType {function} refine - a function to select a range.
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string} currentRefinement - the refinement currently applied
* @providedPropType {number} min - the minimum value available.
* @providedPropType {number} max - the maximum value available.
* @providedPropType {number} precision - Number of digits after decimal point to use.
*/
function getId$9(props) {
return props.attribute;
}
var namespace$4 = 'range';
function getCurrentRange(boundaries, stats, precision) {
var pow = Math.pow(10, precision);
var min = void 0;
if (_isFinite(boundaries.min)) {
min = boundaries.min;
} else if (_isFinite(stats.min)) {
min = stats.min;
} else {
min = undefined;
}
var max = void 0;
if (_isFinite(boundaries.max)) {
max = boundaries.max;
} else if (_isFinite(stats.max)) {
max = stats.max;
} else {
max = undefined;
}
return {
min: min !== undefined ? Math.floor(min * pow) / pow : min,
max: max !== undefined ? Math.ceil(max * pow) / pow : max
};
}
function getCurrentRefinement$8(props, searchState, currentRange, context) {
var refinement = getCurrentRefinementValue(props, searchState, context, namespace$4 + '.' + getId$9(props), {}, function (currentRefinement) {
var min = currentRefinement.min,
max = currentRefinement.max;
var isFloatPrecision = Boolean(props.precision);
var nextMin = min;
if (typeof nextMin === 'string') {
nextMin = isFloatPrecision ? parseFloat(nextMin) : parseInt(nextMin, 10);
}
var nextMax = max;
if (typeof nextMax === 'string') {
nextMax = isFloatPrecision ? parseFloat(nextMax) : parseInt(nextMax, 10);
}
return {
min: nextMin,
max: nextMax
};
});
var hasMinBound = props.min !== undefined;
var hasMaxBound = props.max !== undefined;
var hasMinRefinment = refinement.min !== undefined;
var hasMaxRefinment = refinement.max !== undefined;
if (hasMinBound && hasMinRefinment && refinement.min < currentRange.min) {
throw Error("You can't provide min value lower than range.");
}
if (hasMaxBound && hasMaxRefinment && refinement.max > currentRange.max) {
throw Error("You can't provide max value greater than range.");
}
if (hasMinBound && !hasMinRefinment) {
refinement.min = currentRange.min;
}
if (hasMaxBound && !hasMaxRefinment) {
refinement.max = currentRange.max;
}
return refinement;
}
function getCurrentRefinementWithRange(refinement, range) {
return {
min: refinement.min !== undefined ? refinement.min : range.min,
max: refinement.max !== undefined ? refinement.max : range.max
};
}
function nextValueForRefinement(hasBound, isReset, range, value) {
var next = void 0;
if (!hasBound && range === value) {
next = undefined;
} else if (hasBound && isReset) {
next = range;
} else {
next = value;
}
return next;
}
function _refine$7(props, searchState, nextRefinement, currentRange, context) {
var nextMin = nextRefinement.min,
nextMax = nextRefinement.max;
var currentMinRange = currentRange.min,
currentMaxRange = currentRange.max;
var isMinReset = nextMin === undefined || nextMin === '';
var isMaxReset = nextMax === undefined || nextMax === '';
var nextMinAsNumber = !isMinReset ? parseFloat(nextMin) : undefined;
var nextMaxAsNumber = !isMaxReset ? parseFloat(nextMax) : undefined;
var isNextMinValid = isMinReset || _isFinite(nextMinAsNumber);
var isNextMaxValid = isMaxReset || _isFinite(nextMaxAsNumber);
if (!isNextMinValid || !isNextMaxValid) {
throw Error("You can't provide non finite values to the range connector.");
}
if (nextMinAsNumber < currentMinRange) {
throw Error("You can't provide min value lower than range.");
}
if (nextMaxAsNumber > currentMaxRange) {
throw Error("You can't provide max value greater than range.");
}
var id = getId$9(props);
var resetPage = true;
var nextValue = _defineProperty$d({}, id, {
min: nextValueForRefinement(props.min !== undefined, isMinReset, currentMinRange, nextMinAsNumber),
max: nextValueForRefinement(props.max !== undefined, isMaxReset, currentMaxRange, nextMaxAsNumber)
});
return refineValue(searchState, nextValue, context, resetPage, namespace$4);
}
function _cleanUp$4(props, searchState, context) {
return cleanUpValue(searchState, context, namespace$4 + '.' + getId$9(props));
}
var connectRange = createConnector({
displayName: 'AlgoliaRange',
propTypes: {
id: propTypes.string,
attribute: propTypes.string.isRequired,
defaultRefinement: propTypes.shape({
min: propTypes.number,
max: propTypes.number
}),
min: propTypes.number,
max: propTypes.number,
precision: propTypes.number,
header: propTypes.node,
footer: propTypes.node
},
defaultProps: {
precision: 0
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var attribute = props.attribute,
precision = props.precision,
minBound = props.min,
maxBound = props.max;
var results = getResults(searchResults, this.context);
var hasFacet = results && results.getFacetByName(attribute);
var stats = hasFacet ? results.getFacetStats(attribute) || {} : {};
var facetValues = hasFacet ? results.getFacetValues(attribute) : [];
var count = facetValues.map(function (v) {
return {
value: v.name,
count: v.count
};
});
var _getCurrentRange = getCurrentRange({ min: minBound, max: maxBound }, stats, precision),
rangeMin = _getCurrentRange.min,
rangeMax = _getCurrentRange.max;
// The searchState is not always in sync with the helper state. For example
// when we set boundaries on the first render the searchState don't have
// the correct refinement. If this behaviour change in the upcoming version
// we could store the range inside the searchState instead of rely on `this`.
this._currentRange = {
min: rangeMin,
max: rangeMax
};
var currentRefinement = getCurrentRefinement$8(props, searchState, this._currentRange, this.context);
return {
min: rangeMin,
max: rangeMax,
canRefine: count.length > 0,
currentRefinement: getCurrentRefinementWithRange(currentRefinement, this._currentRange),
count: count,
precision: precision
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$7(props, searchState, nextRefinement, this._currentRange, this.context);
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$4(props, searchState, this.context);
},
getSearchParameters: function getSearchParameters(params, props, searchState) {
var attribute = props.attribute;
var _getCurrentRefinement = getCurrentRefinement$8(props, searchState, this._currentRange, this.context),
min = _getCurrentRefinement.min,
max = _getCurrentRefinement.max;
params = params.addDisjunctiveFacet(attribute);
if (min !== undefined) {
params = params.addNumericRefinement(attribute, '>=', min);
}
if (max !== undefined) {
params = params.addNumericRefinement(attribute, '<=', max);
}
return params;
},
getMetadata: function getMetadata(props, searchState) {
var _this = this;
var _currentRange = this._currentRange,
minRange = _currentRange.min,
maxRange = _currentRange.max;
var _getCurrentRefinement2 = getCurrentRefinement$8(props, searchState, this._currentRange, this.context),
minValue = _getCurrentRefinement2.min,
maxValue = _getCurrentRefinement2.max;
var items = [];
var hasMin = minValue !== undefined;
var hasMax = maxValue !== undefined;
var shouldDisplayMinLabel = hasMin && minValue !== minRange;
var shouldDisplayMaxLabel = hasMax && maxValue !== maxRange;
if (shouldDisplayMinLabel || shouldDisplayMaxLabel) {
var fragments = [hasMin ? minValue + ' <= ' : '', props.attribute, hasMax ? ' <= ' + maxValue : ''];
items.push({
label: fragments.join(''),
attribute: props.attribute,
value: function value(nextState) {
return _refine$7(props, nextState, {}, _this._currentRange, _this.context);
},
currentRefinement: getCurrentRefinementWithRange({ min: minValue, max: maxValue }, { min: minRange, max: maxRange })
});
}
return {
id: getId$9(props),
index: getIndex(this.context),
items: items
};
}
});
function _defineProperty$e(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}return obj;
}
var namespace$5 = 'refinementList';
function getId$a(props) {
return props.attribute;
}
function getCurrentRefinement$9(props, searchState, context) {
return getCurrentRefinementValue(props, searchState, context, namespace$5 + '.' + getId$a(props), [], function (currentRefinement) {
if (typeof currentRefinement === 'string') {
// All items were unselected
if (currentRefinement === '') {
return [];
}
// Only one item was in the searchState but we know it should be an array
return [currentRefinement];
}
return currentRefinement;
});
}
function getValue$3(name, props, searchState, context) {
var currentRefinement = getCurrentRefinement$9(props, searchState, context);
var isAnewValue = currentRefinement.indexOf(name) === -1;
var nextRefinement = isAnewValue ? currentRefinement.concat([name]) // cannot use .push(), it mutates
: currentRefinement.filter(function (selectedValue) {
return selectedValue !== name;
}); // cannot use .splice(), it mutates
return nextRefinement;
}
function getLimit$1(_ref) {
var showMore = _ref.showMore,
limit = _ref.limit,
showMoreLimit = _ref.showMoreLimit;
return showMore ? showMoreLimit : limit;
}
function _refine$8(props, searchState, nextRefinement, context) {
var id = getId$a(props);
// Setting the value to an empty string ensures that it is persisted in
// the URL as an empty value.
// This is necessary in the case where `defaultRefinement` contains one
// item and we try to deselect it. `nextSelected` would be an empty array,
// which would not be persisted to the URL.
// {foo: ['bar']} => "foo[0]=bar"
// {foo: []} => ""
var nextValue = _defineProperty$e({}, id, nextRefinement.length > 0 ? nextRefinement : '');
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage, namespace$5);
}
function _cleanUp$5(props, searchState, context) {
return cleanUpValue(searchState, context, namespace$5 + '.' + getId$a(props));
}
/**
* connectRefinementList connector provides the logic to build a widget that will
* give the user the ability to choose multiple values for a specific facet.
* @name connectRefinementList
* @kind connector
* @requirements The attribute passed to the `attribute` prop must be present in "attributes for faceting"
* on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
* @propType {string} attribute - the name of the attribute in the record
* @propType {boolean} [searchable=false] - allow search inside values
* @propType {string} [operator=or] - How to apply the refinements. Possible values: 'or' or 'and'.
* @propType {boolean} [showMore=false] - true if the component should display a button that will expand the number of items
* @propType {number} [limit=10] - the minimum number of displayed items
* @propType {number} [showMoreLimit=20] - the maximun number of displayed items. Only used when showMore is set to `true`
* @propType {string[]} defaultRefinement - the values of the items selected by default. The searchState of this widget takes the form of a list of `string`s, which correspond to the values of all selected refinements. However, when there are no refinements selected, the value of the searchState is an empty string.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @providedPropType {function} refine - a function to toggle a refinement
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string[]} currentRefinement - the refinement currently applied
* @providedPropType {array.<{count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the RefinementList can display.
* @providedPropType {function} searchForItems - a function to toggle a search inside items values
* @providedPropType {boolean} isFromSearch - a boolean that says if the `items` props contains facet values from the global search or from the search inside items.
*/
var sortBy$2 = ['isRefined', 'count:desc', 'name:asc'];
var connectRefinementList = createConnector({
displayName: 'AlgoliaRefinementList',
propTypes: {
id: propTypes.string,
attribute: propTypes.string.isRequired,
operator: propTypes.oneOf(['and', 'or']),
showMore: propTypes.bool,
limit: propTypes.number,
showMoreLimit: propTypes.number,
defaultRefinement: propTypes.arrayOf(propTypes.oneOfType([propTypes.string, propTypes.number])),
searchable: propTypes.bool,
transformItems: propTypes.func
},
defaultProps: {
operator: 'or',
showMore: false,
limit: 10,
showMoreLimit: 20
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults, metadata, searchForFacetValuesResults) {
var _this = this;
var attribute = props.attribute,
searchable = props.searchable;
var results = getResults(searchResults, this.context);
var canRefine = Boolean(results) && Boolean(results.getFacetByName(attribute));
var isFromSearch = Boolean(searchForFacetValuesResults && searchForFacetValuesResults[attribute] && searchForFacetValuesResults.query !== '');
// Search For Facet Values is not available with derived helper (used for multi index search)
if (searchable && this.context.multiIndexContext) {
throw new Error('react-instantsearch: searching in *List is not available when used inside a' + ' multi index context');
}
if (!canRefine) {
return {
items: [],
currentRefinement: getCurrentRefinement$9(props, searchState, this.context),
canRefine: canRefine,
isFromSearch: isFromSearch,
searchable: searchable
};
}
var items = isFromSearch ? searchForFacetValuesResults[attribute].map(function (v) {
return {
label: v.value,
value: getValue$3(v.value, props, searchState, _this.context),
_highlightResult: { label: { value: v.highlighted } },
count: v.count,
isRefined: v.isRefined
};
}) : results.getFacetValues(attribute, { sortBy: sortBy$2 }).map(function (v) {
return {
label: v.name,
value: getValue$3(v.name, props, searchState, _this.context),
count: v.count,
isRefined: v.isRefined
};
});
var transformedItems = props.transformItems ? props.transformItems(items) : items;
return {
items: transformedItems.slice(0, getLimit$1(props)),
currentRefinement: getCurrentRefinement$9(props, searchState, this.context),
isFromSearch: isFromSearch,
searchable: searchable,
canRefine: transformedItems.length > 0
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$8(props, searchState, nextRefinement, this.context);
},
searchForFacetValues: function searchForFacetValues(props, searchState, nextRefinement) {
return {
facetName: props.attribute,
query: nextRefinement,
maxFacetHits: getLimit$1(props)
};
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$5(props, searchState, this.context);
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var attribute = props.attribute,
operator = props.operator;
var addKey = operator === 'and' ? 'addFacet' : 'addDisjunctiveFacet';
var addRefinementKey = addKey + 'Refinement';
searchParameters = searchParameters.setQueryParameters({
maxValuesPerFacet: Math.max(searchParameters.maxValuesPerFacet || 0, getLimit$1(props))
});
searchParameters = searchParameters[addKey](attribute);
return getCurrentRefinement$9(props, searchState, this.context).reduce(function (res, val) {
return res[addRefinementKey](attribute, val);
}, searchParameters);
},
getMetadata: function getMetadata(props, searchState) {
var id = getId$a(props);
var context = this.context;
return {
id: id,
index: getIndex(this.context),
items: getCurrentRefinement$9(props, searchState, context).length > 0 ? [{
attribute: props.attribute,
label: props.attribute + ': ',
currentRefinement: getCurrentRefinement$9(props, searchState, context),
value: function value(nextState) {
return _refine$8(props, nextState, [], context);
},
items: getCurrentRefinement$9(props, searchState, context).map(function (item) {
return {
label: '' + item,
value: function value(nextState) {
var nextSelectedItems = getCurrentRefinement$9(props, nextState, context).filter(function (other) {
return other !== item;
});
return _refine$8(props, searchState, nextSelectedItems, context);
}
};
})
}] : []
};
}
});
/**
* connectScrollTo connector provides the logic to build a widget that will
* let the page scroll to a certain point.
* @name connectScrollTo
* @kind connector
* @propType {string} [scrollOn="page"] - Widget searchState key on which to listen for changes, default to the pagination widget.
* @providedPropType {any} value - the current refinement applied to the widget listened by scrollTo
* @providedPropType {boolean} hasNotChanged - indicates whether the refinement came from the scrollOn argument (for instance page by default)
*/
var connectScrollTo = createConnector({
displayName: 'AlgoliaScrollTo',
propTypes: {
scrollOn: propTypes.string
},
defaultProps: {
scrollOn: 'page'
},
getProvidedProps: function getProvidedProps(props, searchState) {
var id = props.scrollOn;
var value = getCurrentRefinementValue(props, searchState, this.context, id, null, function (currentRefinement) {
return currentRefinement;
});
if (!this._prevSearchState) {
this._prevSearchState = {};
}
/* Get the subpart of the state that interest us*/
if (hasMultipleIndex(this.context)) {
var index = getIndex(this.context);
searchState = searchState.indices ? searchState.indices[index] : {};
}
/*
if there is a change in the app that has been triggered by another element than
"props.scrollOn (id) or the Configure widget, we need to keep track of the search state to
know if there's a change in the app that was not triggered by the props.scrollOn (id)
or the Configure widget. This is useful when using ScrollTo in combination of Pagination.
As pagination can be change by every widget, we want to scroll only if it cames from the pagination
widget itself. We also remove the configure key from the search state to do this comparaison because for
now configure values are not present in the search state before a first refinement has been made
and will false the results.
See: https://github.com/algolia/react-instantsearch/issues/164
*/
var cleanedSearchState = omit_1(omit_1(searchState, 'configure'), id);
var hasNotChanged = shallowEqual(this._prevSearchState, cleanedSearchState);
this._prevSearchState = cleanedSearchState;
return { value: value, hasNotChanged: hasNotChanged };
}
});
function _defineProperty$f(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 getId$b() {
return 'query';
}
function getCurrentRefinement$a(props, searchState, context) {
var id = getId$b(props);
return getCurrentRefinementValue(props, searchState, context, id, '', function (currentRefinement) {
if (currentRefinement) {
return currentRefinement;
}
return '';
});
}
function _refine$9(props, searchState, nextRefinement, context) {
var id = getId$b();
var nextValue = _defineProperty$f({}, id, nextRefinement);
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage);
}
function _cleanUp$6(props, searchState, context) {
return cleanUpValue(searchState, context, getId$b());
}
/**
* connectSearchBox connector provides the logic to build a widget that will
* let the user search for a query
* @name connectSearchBox
* @kind connector
* @propType {string} [defaultRefinement] - Provide a default value for the query
* @providedPropType {function} refine - a function to change the current query
* @providedPropType {string} currentRefinement - the current query used
* @providedPropType {boolean} isSearchStalled - a flag that indicates if InstantSearch has detected that searches are stalled
*/
var connectSearchBox = createConnector({
displayName: 'AlgoliaSearchBox',
propTypes: {
defaultRefinement: propTypes.string
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
return {
currentRefinement: getCurrentRefinement$a(props, searchState, this.context),
isSearchStalled: searchResults.isSearchStalled
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$9(props, searchState, nextRefinement, this.context);
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$6(props, searchState, this.context);
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
return searchParameters.setQuery(getCurrentRefinement$a(props, searchState, this.context));
},
getMetadata: function getMetadata(props, searchState) {
var _this = this;
var id = getId$b(props);
var currentRefinement = getCurrentRefinement$a(props, searchState, this.context);
return {
id: id,
index: getIndex(this.context),
items: currentRefinement === null ? [] : [{
label: id + ': ' + currentRefinement,
value: function value(nextState) {
return _refine$9(props, nextState, '', _this.context);
},
currentRefinement: currentRefinement
}]
};
}
});
var _extends$a = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}return target;
};
function _defineProperty$g(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 getId$c() {
return 'sortBy';
}
function getCurrentRefinement$b(props, searchState, context) {
var id = getId$c(props);
return getCurrentRefinementValue(props, searchState, context, id, null, function (currentRefinement) {
if (currentRefinement) {
return currentRefinement;
}
return null;
});
}
/**
* The connectSortBy connector provides the logic to build a widget that will
* display a list of indices. This allows a user to change how the hits are being sorted.
* @name connectSortBy
* @requirements Algolia handles sorting by creating replica indices. [Read more about sorting](https://www.algolia.com/doc/guides/relevance/sorting/) on
* the Algolia website.
* @kind connector
* @propType {string} defaultRefinement - The default selected index.
* @propType {{value: string, label: string}[]} items - The list of indexes to search in.
* @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
* @providedPropType {function} refine - a function to remove a single filter
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
* @providedPropType {string[]} currentRefinement - the refinement currently applied
* @providedPropType {array.<{isRefined: boolean, label?: string, value: string}>} items - the list of items the HitsPerPage can display. If no label provided, the value will be displayed.
*/
var connectSortBy = createConnector({
displayName: 'AlgoliaSortBy',
propTypes: {
defaultRefinement: propTypes.string,
items: propTypes.arrayOf(propTypes.shape({
label: propTypes.string,
value: propTypes.string.isRequired
})).isRequired,
transformItems: propTypes.func
},
getProvidedProps: function getProvidedProps(props, searchState) {
var currentRefinement = getCurrentRefinement$b(props, searchState, this.context);
var items = props.items.map(function (item) {
return item.value === currentRefinement ? _extends$a({}, item, { isRefined: true }) : _extends$a({}, item, { isRefined: false });
});
return {
items: props.transformItems ? props.transformItems(items) : items,
currentRefinement: currentRefinement
};
},
refine: function refine(props, searchState, nextRefinement) {
var id = getId$c();
var nextValue = _defineProperty$g({}, id, nextRefinement);
var resetPage = true;
return refineValue(searchState, nextValue, this.context, resetPage);
},
cleanUp: function cleanUp(props, searchState) {
return cleanUpValue(searchState, this.context, getId$c());
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var selectedIndex = getCurrentRefinement$b(props, searchState, this.context);
return searchParameters.setIndex(selectedIndex);
},
getMetadata: function getMetadata() {
return { id: getId$c() };
}
});
/**
* The `connectStateResults` connector provides a way to access the `searchState` and the `searchResults`
* of InstantSearch.
* For instance this connector allows you to create results/noResults or query/noQuery pages.
* @name connectStateResults
* @kind connector
* @providedPropType {object} searchState - The search state of the instant search component. <br/><br/> See: [Search state structure](https://community.algolia.com/react-instantsearch/guide/Search_state.html)
* @providedPropType {object} searchResults - The search results. <br/><br/> In case of multiple indices: if used under `<Index>`, results will be those of the corresponding index otherwise it'll be those of the root index See: [Search results structure](https://community.algolia.com/algoliasearch-helper-js/reference.html#searchresults)
* @providedPropType {object} allSearchResults - In case of multiple indices you can retrieve all the results
* @providedPropType {string} error - If the search failed, the error will be logged here.
* @providedPropType {boolean} searching - If there is a search in progress.
* @providedPropType {boolean} isSearchStalled - Flag that indicates if React InstantSearch has detected that searches are stalled.
* @providedPropType {boolean} searchingForFacetValues - If there is a search in a list in progress.
* @providedPropType {object} props - component props.
* @example
* import React from 'react';
* import { InstantSearch, SearchBox, Hits, connectStateResults } from 'react-instantsearch-dom';
*
* const Content = connectStateResults(({ searchState, searchResults }) => {
* const hasResults = searchResults && searchResults.nbHits !== 0;
*
* return (
* <div>
* <div hidden={!hasResults}>
* <Hits />
* </div>
* <div hidden={hasResults}>
* <div>No results has been found for {searchState.query}</div>
* </div>
* </div>
* );
* });
*
* const App = () => (
* <InstantSearch
* appId="latency"
* apiKey="6be0576ff61c053d5f9a3225e2a90f76"
* indexName="instant_search"
* >
* <SearchBox />
* <Content />
* </InstantSearch>
* );
*/
var connectStateResults = createConnector({
displayName: 'AlgoliaStateResults',
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var results = getResults(searchResults, this.context);
return {
searchState: searchState,
searchResults: results,
allSearchResults: searchResults.results,
searching: searchResults.searching,
isSearchStalled: searchResults.isSearchStalled,
error: searchResults.error,
searchingForFacetValues: searchResults.searchingForFacetValues,
props: props
};
}
});
/**
* connectStats connector provides the logic to build a widget that will
* displays algolia search statistics (hits number and processing time).
* @name connectStats
* @kind connector
* @providedPropType {number} nbHits - number of hits returned by Algolia.
* @providedPropType {number} processingTimeMS - the time in ms took by Algolia to search for results.
*/
var connectStats = createConnector({
displayName: 'AlgoliaStats',
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var results = getResults(searchResults, this.context);
if (!results) {
return null;
}
return {
nbHits: results.nbHits,
processingTimeMS: results.processingTimeMS
};
}
});
function _defineProperty$h(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 getId$d(props) {
return props.attribute;
}
var namespace$6 = 'toggle';
function getCurrentRefinement$c(props, searchState, context) {
return getCurrentRefinementValue(props, searchState, context, namespace$6 + '.' + getId$d(props), false, function (currentRefinement) {
if (currentRefinement) {
return currentRefinement;
}
return false;
});
}
function _refine$a(props, searchState, nextRefinement, context) {
var id = getId$d(props);
var nextValue = _defineProperty$h({}, id, nextRefinement ? nextRefinement : false);
var resetPage = true;
return refineValue(searchState, nextValue, context, resetPage, namespace$6);
}
function _cleanUp$7(props, searchState, context) {
return cleanUpValue(searchState, context, namespace$6 + '.' + getId$d(props));
}
/**
* connectToggleRefinement connector provides the logic to build a widget that will
* provides an on/off filtering feature based on an attribute value.
* @name connectToggleRefinement
* @kind connector
* @requirements To use this widget, you'll need an attribute to toggle on.
*
* You can't toggle on null or not-null values. If you want to address this particular use-case you'll need to compute an
* extra boolean attribute saying if the value exists or not. See this [thread](https://discourse.algolia.com/t/how-to-create-a-toggle-for-the-absence-of-a-string-attribute/2460) for more details.
*
* @propType {string} attribute - Name of the attribute on which to apply the `value` refinement. Required when `value` is present.
* @propType {string} label - Label for the toggle.
* @propType {string} value - Value of the refinement to apply on `attribute`.
* @propType {boolean} [defaultRefinement=false] - Default searchState of the widget. Should the toggle be checked by default?
* @providedPropType {boolean} currentRefinement - `true` when the refinement is applied, `false` otherwise
* @providedPropType {object} count - an object that contains the count for `checked` and `unchecked` state
* @providedPropType {function} refine - a function to toggle a refinement
* @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
*/
var connectToggleRefinement = createConnector({
displayName: 'AlgoliaToggle',
propTypes: {
label: propTypes.string.isRequired,
attribute: propTypes.string.isRequired,
value: propTypes.any.isRequired,
filter: propTypes.func,
defaultRefinement: propTypes.bool
},
getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
var attribute = props.attribute,
value = props.value;
var results = getResults(searchResults, this.context);
var currentRefinement = getCurrentRefinement$c(props, searchState, this.context);
var allFacetValues = results && results.getFacetByName(attribute) ? results.getFacetValues(attribute) : null;
var facetValue =
// Use null to always be consistent with type of the value
// count: number | null
allFacetValues && allFacetValues.length ? find_1(allFacetValues, function (item) {
return item.name === value.toString();
}) : null;
var facetValueCount = facetValue && facetValue.count;
var allFacetValuesCount =
// Use null to always be consistent with type of the value
// count: number | null
allFacetValues && allFacetValues.length ? allFacetValues.reduce(function (acc, item) {
return acc + item.count;
}, 0) : null;
var canRefine = currentRefinement ? allFacetValuesCount !== null && allFacetValuesCount > 0 : facetValueCount !== null && facetValueCount > 0;
var count = {
checked: allFacetValuesCount,
unchecked: facetValueCount
};
return {
currentRefinement: currentRefinement,
canRefine: canRefine,
count: count
};
},
refine: function refine(props, searchState, nextRefinement) {
return _refine$a(props, searchState, nextRefinement, this.context);
},
cleanUp: function cleanUp(props, searchState) {
return _cleanUp$7(props, searchState, this.context);
},
getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
var attribute = props.attribute,
value = props.value,
filter = props.filter;
var checked = getCurrentRefinement$c(props, searchState, this.context);
var nextSearchParameters = searchParameters.addDisjunctiveFacet(attribute);
if (checked) {
nextSearchParameters = nextSearchParameters.addDisjunctiveFacetRefinement(attribute, value);
if (filter) {
nextSearchParameters = filter(nextSearchParameters);
}
}
return nextSearchParameters;
},
getMetadata: function getMetadata(props, searchState) {
var _this = this;
var id = getId$d(props);
var checked = getCurrentRefinement$c(props, searchState, this.context);
var items = [];
var index = getIndex(this.context);
if (checked) {
items.push({
label: props.label,
currentRefinement: checked,
attribute: props.attribute,
value: function value(nextState) {
return _refine$a(props, nextState, false, _this.context);
}
});
}
return { id: id, index: index, items: items };
}
});
// Core
exports.connectAutoComplete = connectAutoComplete;
exports.connectBreadcrumb = connectBreadcrumb;
exports.connectConfigure = connectConfigure;
exports.connectCurrentRefinements = connectCurrentRefinements;
exports.connectGeoSearch = connectGeoSearch;
exports.connectHierarchicalMenu = connectHierarchicalMenu;
exports.connectHighlight = connectHighlight;
exports.connectHits = connectHits;
exports.connectHitsPerPage = connectHitsPerPage;
exports.connectInfiniteHits = connectInfiniteHits;
exports.connectMenu = connectMenu;
exports.connectNumericMenu = connectNumericMenu;
exports.connectPagination = connectPagination;
exports.connectPoweredBy = connectPoweredBy;
exports.connectRange = connectRange;
exports.connectRefinementList = connectRefinementList;
exports.connectScrollTo = connectScrollTo;
exports.connectSearchBox = connectSearchBox;
exports.connectSortBy = connectSortBy;
exports.connectStateResults = connectStateResults;
exports.connectStats = connectStats;
exports.connectToggleRefinement = connectToggleRefinement;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=Connectors.js.map
|
ajax/libs/babel-core/6.1.17/browser.min.js
|
sympmarc/cdnjs
|
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.babel=t()}}(function(){var t,e,n;return function r(t,e,n){function i(a,o){if(!e[a]){if(!t[a]){var u="function"==typeof require&&require;if(!o&&u)return u(a,!0);if(s)return s(a,!0);var p=new Error("Cannot find module '"+a+"'");throw p.code="MODULE_NOT_FOUND",p}var l=e[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return i(n?n:e)},l,l.exports,r,t,e,n)}return e[a].exports}for(var s="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===a||e===c?62:e===o||e===f?63:u>e?-1:u+10>e?e-u+26+26:l+26>e?e-l:p+26>e?e-p+26:void 0}function n(t){function n(t){p[c++]=t}var r,i,a,o,u,p;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var l=t.length;u="="===t.charAt(l-2)?2:"="===t.charAt(l-1)?1:0,p=new s(3*t.length/4-u),a=u>0?t.length-4:t.length;var c=0;for(r=0,i=0;a>r;r+=4,i+=3)o=e(t.charAt(r))<<18|e(t.charAt(r+1))<<12|e(t.charAt(r+2))<<6|e(t.charAt(r+3)),n((16711680&o)>>16),n((65280&o)>>8),n(255&o);return 2===u?(o=e(t.charAt(r))<<2|e(t.charAt(r+1))>>4,n(255&o)):1===u&&(o=e(t.charAt(r))<<10|e(t.charAt(r+1))<<4|e(t.charAt(r+2))>>2,n(o>>8&255),n(255&o)),p}function i(t){function e(t){return r.charAt(t)}function n(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var i,s,a,o=t.length%3,u="";for(i=0,a=t.length-o;a>i;i+=3)s=(t[i]<<16)+(t[i+1]<<8)+t[i+2],u+=n(s);switch(o){case 1:s=t[t.length-1],u+=e(s>>2),u+=e(s<<4&63),u+="==";break;case 2:s=(t[t.length-2]<<8)+t[t.length-1],u+=e(s>>10),u+=e(s>>4&63),u+=e(s<<2&63),u+="="}return u}var s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="+".charCodeAt(0),o="/".charCodeAt(0),u="0".charCodeAt(0),p="a".charCodeAt(0),l="A".charCodeAt(0),c="-".charCodeAt(0),f="_".charCodeAt(0);t.toByteArray=n,t.fromByteArray=i}("undefined"==typeof n?this.base64js={}:n)},{}],2:[function(t,e,n){},{}],3:[function(t,e,n){(function(e){function r(){function t(){}try{var e=new Uint8Array(1);return e.foo=function(){return 42},e.constructor=t,42===e.foo()&&e.constructor===t&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(n){return!1}}function i(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t){return this instanceof s?(this.length=0,this.parent=void 0,"number"==typeof t?a(this,t):"string"==typeof t?o(this,t,arguments.length>1?arguments[1]:"utf8"):u(this,t)):arguments.length>1?new s(t,arguments[1]):new s(t)}function a(t,e){if(t=m(t,0>e?0:0|y(e)),!s.TYPED_ARRAY_SUPPORT)for(var n=0;e>n;n++)t[n]=0;return t}function o(t,e,n){("string"!=typeof n||""===n)&&(n="utf8");var r=0|v(e,n);return t=m(t,r),t.write(e,n),t}function u(t,e){if(s.isBuffer(e))return p(t,e);if(X(e))return l(t,e);if(null==e)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(e.buffer instanceof ArrayBuffer)return c(t,e);if(e instanceof ArrayBuffer)return f(t,e)}return e.length?h(t,e):d(t,e)}function p(t,e){var n=0|y(e.length);return t=m(t,n),e.copy(t,0,0,n),t}function l(t,e){var n=0|y(e.length);t=m(t,n);for(var r=0;n>r;r+=1)t[r]=255&e[r];return t}function c(t,e){var n=0|y(e.length);t=m(t,n);for(var r=0;n>r;r+=1)t[r]=255&e[r];return t}function f(t,e){return s.TYPED_ARRAY_SUPPORT?(e.byteLength,t=s._augment(new Uint8Array(e))):t=c(t,new Uint8Array(e)),t}function h(t,e){var n=0|y(e.length);t=m(t,n);for(var r=0;n>r;r+=1)t[r]=255&e[r];return t}function d(t,e){var n,r=0;"Buffer"===e.type&&X(e.data)&&(n=e.data,r=0|y(n.length)),t=m(t,r);for(var i=0;r>i;i+=1)t[i]=255&n[i];return t}function m(t,e){s.TYPED_ARRAY_SUPPORT?(t=s._augment(new Uint8Array(e)),t.__proto__=s.prototype):(t.length=e,t._isBuffer=!0);var n=0!==e&&e<=s.poolSize>>>1;return n&&(t.parent=z),t}function y(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function g(t,e){if(!(this instanceof g))return new g(t,e);var n=new s(t,e);return delete n.parent,n}function v(t,e){"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Y(t).length;default:if(r)return W(t).length;e=(""+e).toLowerCase(),r=!0}}function A(t,e,n){var r=!1;if(e=0|e,n=void 0===n||n===1/0?this.length:0|n,t||(t="utf8"),0>e&&(e=0),n>this.length&&(n=this.length),e>=n)return"";for(;;)switch(t){case"hex":return k(this,e,n);case"utf8":case"utf-8":return w(this,e,n);case"ascii":return T(this,e,n);case"binary":return _(this,e,n);case"base64":return F(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function E(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var s=e.length;if(s%2!==0)throw new Error("Invalid hex string");r>s/2&&(r=s/2);for(var a=0;r>a;a++){var o=parseInt(e.substr(2*a,2),16);if(isNaN(o))throw new Error("Invalid hex string");t[n+a]=o}return a}function b(t,e,n,r){return J(W(e,t.length-n),t,n,r)}function x(t,e,n,r){return J(q(e),t,n,r)}function D(t,e,n,r){return x(t,e,n,r)}function C(t,e,n,r){return J(Y(e),t,n,r)}function S(t,e,n,r){return J(H(e,t.length-n),t,n,r)}function F(t,e,n){return 0===e&&n===t.length?K.fromByteArray(t):K.fromByteArray(t.slice(e,n))}function w(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;n>i;){var s=t[i],a=null,o=s>239?4:s>223?3:s>191?2:1;if(n>=i+o){var u,p,l,c;switch(o){case 1:128>s&&(a=s);break;case 2:u=t[i+1],128===(192&u)&&(c=(31&s)<<6|63&u,c>127&&(a=c));break;case 3:u=t[i+1],p=t[i+2],128===(192&u)&&128===(192&p)&&(c=(15&s)<<12|(63&u)<<6|63&p,c>2047&&(55296>c||c>57343)&&(a=c));break;case 4:u=t[i+1],p=t[i+2],l=t[i+3],128===(192&u)&&128===(192&p)&&128===(192&l)&&(c=(15&s)<<18|(63&u)<<12|(63&p)<<6|63&l,c>65535&&1114112>c&&(a=c))}}null===a?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=o}return B(r)}function B(t){var e=t.length;if(Q>=e)return String.fromCharCode.apply(String,t);for(var n="",r=0;e>r;)n+=String.fromCharCode.apply(String,t.slice(r,r+=Q));return n}function T(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;n>i;i++)r+=String.fromCharCode(127&t[i]);return r}function _(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;n>i;i++)r+=String.fromCharCode(t[i]);return r}function k(t,e,n){var r=t.length;(!e||0>e)&&(e=0),(!n||0>n||n>r)&&(n=r);for(var i="",s=e;n>s;s++)i+=G(t[s]);return i}function P(t,e,n){for(var r=t.slice(e,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+256*r[s+1]);return i}function N(t,e,n){if(t%1!==0||0>t)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,n,r,i,a){if(!s.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");if(e>i||a>e)throw new RangeError("value is out of bounds");if(n+r>t.length)throw new RangeError("index out of range")}function L(t,e,n,r){0>e&&(e=65535+e+1);for(var i=0,s=Math.min(t.length-n,2);s>i;i++)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function O(t,e,n,r){0>e&&(e=4294967295+e+1);for(var i=0,s=Math.min(t.length-n,4);s>i;i++)t[n+i]=e>>>8*(r?i:3-i)&255}function M(t,e,n,r,i,s){if(e>i||s>e)throw new RangeError("value is out of bounds");if(n+r>t.length)throw new RangeError("index out of range");if(0>n)throw new RangeError("index out of range")}function R(t,e,n,r,i){return i||M(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(t,e,n,r,23,4),n+4}function j(t,e,n,r,i){return i||M(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(t,e,n,r,52,8),n+8}function V(t){if(t=U(t).replace(tt,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function U(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function G(t){return 16>t?"0"+t.toString(16):t.toString(16)}function W(t,e){e=e||1/0;for(var n,r=t.length,i=null,s=[],a=0;r>a;a++){if(n=t.charCodeAt(a),n>55295&&57344>n){if(!i){if(n>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(56320>n){(e-=3)>-1&&s.push(239,191,189),i=n;continue}n=i-55296<<10|n-56320|65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,128>n){if((e-=1)<0)break;s.push(n)}else if(2048>n){if((e-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(65536>n){if((e-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(1114112>n))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function q(t){for(var e=[],n=0;n<t.length;n++)e.push(255&t.charCodeAt(n));return e}function H(t,e){for(var n,r,i,s=[],a=0;a<t.length&&!((e-=2)<0);a++)n=t.charCodeAt(a),r=n>>8,i=n%256,s.push(i),s.push(r);return s}function Y(t){return K.toByteArray(V(t))}function J(t,e,n,r){for(var i=0;r>i&&!(i+n>=e.length||i>=t.length);i++)e[i+n]=t[i];return i}var K=t(1),$=t(4),X=t(6);n.Buffer=s,n.SlowBuffer=g,n.INSPECT_MAX_BYTES=50,s.poolSize=8192;var z={};s.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:r(),s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array),s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,e){if(!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,a=Math.min(n,r);a>i&&t[i]===e[i];)++i;return i!==a&&(n=t[i],r=e[i]),r>n?-1:n>r?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!X(t))throw new TypeError("list argument must be an Array of Buffers.");if(0===t.length)return new s(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;n++)e+=t[n].length;var r=new s(e),i=0;for(n=0;n<t.length;n++){var a=t[n];a.copy(r,i),i+=a.length}return r},s.byteLength=v,s.prototype.length=void 0,s.prototype.parent=void 0,s.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?w(this,0,t):A.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=n.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},s.prototype.compare=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?0:s.compare(this,t)},s.prototype.indexOf=function(t,e){function n(t,e,n){for(var r=-1,i=0;n+i<t.length;i++)if(t[n+i]===e[-1===r?0:i-r]){if(-1===r&&(r=i),i-r+1===e.length)return n+r}else r=-1;return-1}if(e>2147483647?e=2147483647:-2147483648>e&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(0>e&&(e=Math.max(this.length+e,0)),"string"==typeof t)return 0===t.length?-1:String.prototype.indexOf.call(this,t,e);if(s.isBuffer(t))return n(this,t,e);if("number"==typeof t)return s.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,t,e):n(this,[t],e);throw new TypeError("val must be string, number or Buffer")},s.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},s.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},s.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(n)?(n=0|n,void 0===r&&(r="utf8")):(r=n,n=void 0);else{var i=r;r=e,e=0|n,n=i}var s=this.length-e;if((void 0===n||n>s)&&(n=s),t.length>0&&(0>n||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return E(this,t,e,n);case"utf8":case"utf-8":return b(this,t,e,n);case"ascii":return x(this,t,e,n);case"binary":return D(this,t,e,n);case"base64":return C(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;s.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),t>e&&(e=t);var r;if(s.TYPED_ARRAY_SUPPORT)r=s._augment(this.subarray(t,e));else{var i=e-t;r=new s(i,void 0);for(var a=0;i>a;a++)r[a]=this[a+t]}return r.length&&(r.parent=this.parent||this),r},s.prototype.readUIntLE=function(t,e,n){t=0|t,e=0|e,n||N(t,e,this.length);for(var r=this[t],i=1,s=0;++s<e&&(i*=256);)r+=this[t+s]*i;return r},s.prototype.readUIntBE=function(t,e,n){t=0|t,e=0|e,n||N(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},s.prototype.readUInt8=function(t,e){return e||N(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return e||N(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return e||N(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,n){t=0|t,e=0|e,n||N(t,e,this.length);for(var r=this[t],i=1,s=0;++s<e&&(i*=256);)r+=this[t+s]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t=0|t,e=0|e,n||N(t,e,this.length);for(var r=e,i=1,s=this[t+--r];r>0&&(i*=256);)s+=this[t+--r]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*e)),s},s.prototype.readInt8=function(t,e){return e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){e||N(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){e||N(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return e||N(t,4,this.length),$.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return e||N(t,4,this.length),$.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return e||N(t,8,this.length),$.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return e||N(t,8,this.length),$.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,n,r){t=+t,e=0|e,n=0|n,r||I(this,t,e,n,Math.pow(2,8*n),0);var i=1,s=0;for(this[e]=255&t;++s<n&&(i*=256);)this[e+s]=t/i&255;return e+n},s.prototype.writeUIntBE=function(t,e,n,r){t=+t,e=0|e,n=0|n,r||I(this,t,e,n,Math.pow(2,8*n),0);var i=n-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+n},s.prototype.writeUInt8=function(t,e,n){return t=+t,e=0|e,n||I(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=0|e,n||I(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=0|e,n||I(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=0|e,n||I(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):O(this,t,e,!0),e+4},s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=0|e,n||I(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e=0|e,!r){var i=Math.pow(2,8*n-1);I(this,t,e,n,i-1,-i)}var s=0,a=1,o=0>t?1:0;for(this[e]=255&t;++s<n&&(a*=256);)this[e+s]=(t/a>>0)-o&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e=0|e,!r){var i=Math.pow(2,8*n-1);I(this,t,e,n,i-1,-i)}var s=n-1,a=1,o=0>t?1:0;for(this[e+s]=255&t;--s>=0&&(a*=256);)this[e+s]=(t/a>>0)-o&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e=0|e,n||I(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e=0|e,n||I(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e=0|e,n||I(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e=0|e,n||I(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):O(this,t,e,!0),e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e=0|e,n||I(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},s.prototype.writeFloatLE=function(t,e,n){return R(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return R(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return j(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return j(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&n>r&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,a=r-n;if(this===t&&e>n&&r>e)for(i=a-1;i>=0;i--)t[i+e]=this[i+n];else if(1e3>a||!s.TYPED_ARRAY_SUPPORT)for(i=0;a>i;i++)t[i+e]=this[i+n];else t._set(this.subarray(n,n+a),e);return a},s.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),e>n)throw new RangeError("end < start");if(n!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>n||n>this.length)throw new RangeError("end out of bounds");var r;if("number"==typeof t)for(r=e;n>r;r++)this[r]=t;else{var i=W(t.toString()),s=i.length;for(r=e;n>r;r++)this[r]=i[r%s]}return this}},s.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(s.TYPED_ARRAY_SUPPORT)return new s(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;n>e;e+=1)t[e]=this[e];return t.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var Z=s.prototype;s._augment=function(t){return t.constructor=s,t._isBuffer=!0,t._set=t.set,t.get=Z.get,t.set=Z.set,t.write=Z.write,t.toString=Z.toString,t.toLocaleString=Z.toString,t.toJSON=Z.toJSON,t.equals=Z.equals,t.compare=Z.compare,t.indexOf=Z.indexOf,t.copy=Z.copy,t.slice=Z.slice,t.readUIntLE=Z.readUIntLE,t.readUIntBE=Z.readUIntBE,t.readUInt8=Z.readUInt8,t.readUInt16LE=Z.readUInt16LE,t.readUInt16BE=Z.readUInt16BE,t.readUInt32LE=Z.readUInt32LE,t.readUInt32BE=Z.readUInt32BE,t.readIntLE=Z.readIntLE,t.readIntBE=Z.readIntBE,t.readInt8=Z.readInt8,t.readInt16LE=Z.readInt16LE,t.readInt16BE=Z.readInt16BE,t.readInt32LE=Z.readInt32LE,t.readInt32BE=Z.readInt32BE,t.readFloatLE=Z.readFloatLE,t.readFloatBE=Z.readFloatBE,t.readDoubleLE=Z.readDoubleLE,t.readDoubleBE=Z.readDoubleBE,t.writeUInt8=Z.writeUInt8,t.writeUIntLE=Z.writeUIntLE,t.writeUIntBE=Z.writeUIntBE,t.writeUInt16LE=Z.writeUInt16LE,t.writeUInt16BE=Z.writeUInt16BE,t.writeUInt32LE=Z.writeUInt32LE,t.writeUInt32BE=Z.writeUInt32BE,t.writeIntLE=Z.writeIntLE,t.writeIntBE=Z.writeIntBE,t.writeInt8=Z.writeInt8,t.writeInt16LE=Z.writeInt16LE,t.writeInt16BE=Z.writeInt16BE,t.writeInt32LE=Z.writeInt32LE,t.writeInt32BE=Z.writeInt32BE,t.writeFloatLE=Z.writeFloatLE,t.writeFloatBE=Z.writeFloatBE,t.writeDoubleLE=Z.writeDoubleLE,t.writeDoubleBE=Z.writeDoubleBE,t.fill=Z.fill,t.inspect=Z.inspect,t.toArrayBuffer=Z.toArrayBuffer,t};var tt=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{1:1,4:4,6:6}],4:[function(t,e,n){n.read=function(t,e,n,r,i){var s,a,o=8*i-r-1,u=(1<<o)-1,p=u>>1,l=-7,c=n?i-1:0,f=n?-1:1,h=t[e+c];for(c+=f,s=h&(1<<-l)-1,h>>=-l,l+=o;l>0;s=256*s+t[e+c],c+=f,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=r;l>0;a=256*a+t[e+c],c+=f,l-=8);if(0===s)s=1-p;else{if(s===u)return a?NaN:(h?-1:1)*(1/0);a+=Math.pow(2,r),s-=p}return(h?-1:1)*a*Math.pow(2,s-r)},n.write=function(t,e,n,r,i,s){var a,o,u,p=8*s-i-1,l=(1<<p)-1,c=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,d=r?1:-1,m=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),e+=a+c>=1?f/u:f*Math.pow(2,1-c),e*u>=2&&(a++,u/=2),a+c>=l?(o=0,a=l):a+c>=1?(o=(e*u-1)*Math.pow(2,i),a+=c):(o=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[n+h]=255&o,h+=d,o/=256,i-=8);for(a=a<<i|o,p+=i;p>0;t[n+h]=255&a,h+=d,a/=256,p-=8);t[n+h-d]|=128*m}},{}],5:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],6:[function(t,e,n){var r=Array.isArray,i=Object.prototype.toString;e.exports=r||function(t){return!!t&&"[object Array]"==i.call(t)}},{}],7:[function(t,e,n){(function(t){function e(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(t){return i.exec(t).slice(1)};n.resolve=function(){for(var n="",i=!1,s=arguments.length-1;s>=-1&&!i;s--){var a=s>=0?arguments[s]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(n=a+"/"+n,i="/"===a.charAt(0))}return n=e(r(n.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(t){var i=n.isAbsolute(t),s="/"===a(t,-1);return t=e(r(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&s&&(t+="/"),(i?"/":"")+t},n.isAbsolute=function(t){return"/"===t.charAt(0)},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},n.relative=function(t,e){function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var i=r(t.split("/")),s=r(e.split("/")),a=Math.min(i.length,s.length),o=a,u=0;a>u;u++)if(i[u]!==s[u]){o=u;break}for(var p=[],u=o;u<i.length;u++)p.push("..");return p=p.concat(s.slice(o)),p.join("/")},n.sep="/",n.delimiter=":",n.dirname=function(t){var e=s(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},n.basename=function(t,e){var n=s(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},n.extname=function(t){return s(t)[3]};var a="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return 0>e&&(e=t.length+e),t.substr(e,n)}}).call(this,t(8))},{8:8}],8:[function(t,e,n){function r(){l=!1,o.length?p=o.concat(p):c=-1,p.length&&i()}function i(){if(!l){var t=setTimeout(r);l=!0;for(var e=p.length;e;){for(o=p,p=[];++c<e;)o&&o[c].run();c=-1,e=p.length}o=null,l=!1,clearTimeout(t)}}function s(t,e){this.fun=t,this.array=e}function a(){}var o,u=e.exports={},p=[],l=!1,c=-1;u.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];p.push(new s(t,e)),1!==p.length||l||setTimeout(i,0)},s.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=a,u.addListener=a,u.once=a,u.off=a,u.removeListener=a,u.removeAllListeners=a,u.emit=a,u.binding=function(t){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(t){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},{}],9:[function(t,e,n){function r(){throw new Error("tty.ReadStream is not implemented")}function i(){throw new Error("tty.ReadStream is not implemented")}n.isatty=function(){return!1},n.ReadStream=r,n.WriteStream=i},{}],10:[function(t,e,n){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],11:[function(t,e,n){(function(e,r){function i(t,e){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(e)?r.showHidden=e:e&&n._extend(r,e),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=s),u(r,t,r.depth)}function s(t,e){var n=i.styles[e];return n?"["+i.colors[n][0]+"m"+t+"["+i.colors[n][1]+"m":t}function a(t,e){return t}function o(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}function u(t,e,r){if(t.customInspect&&e&&F(e.inspect)&&e.inspect!==n.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(r,t);return A(i)||(i=u(t,i,r)),i}var s=p(t,e);if(s)return s;var a=Object.keys(e),m=o(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),S(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(e);if(0===a.length){if(F(e)){var y=e.name?": "+e.name:"";return t.stylize("[Function"+y+"]","special")}if(x(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(C(e))return t.stylize(Date.prototype.toString.call(e),"date");if(S(e))return l(e)}var g="",v=!1,E=["{","}"];if(d(e)&&(v=!0,E=["[","]"]),F(e)){var b=e.name?": "+e.name:"";g=" [Function"+b+"]"}if(x(e)&&(g=" "+RegExp.prototype.toString.call(e)),C(e)&&(g=" "+Date.prototype.toUTCString.call(e)),S(e)&&(g=" "+l(e)),0===a.length&&(!v||0==e.length))return E[0]+g+E[1];if(0>r)return x(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var D;return D=v?c(t,e,r,m,a):a.map(function(n){return f(t,e,r,m,n,v)}),t.seen.pop(),h(D,g,E)}function p(t,e){if(b(e))return t.stylize("undefined","undefined");if(A(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return v(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):y(e)?t.stylize("null","null"):void 0}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function c(t,e,n,r,i){for(var s=[],a=0,o=e.length;o>a;++a)k(e,String(a))?s.push(f(t,e,n,r,String(a),!0)):s.push("");return i.forEach(function(i){i.match(/^\d+$/)||s.push(f(t,e,n,r,i,!0))}),s}function f(t,e,n,r,i,s){var a,o,p;if(p=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},p.get?o=p.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):p.set&&(o=t.stylize("[Setter]","special")),k(r,i)||(a="["+i+"]"),o||(t.seen.indexOf(p.value)<0?(o=y(n)?u(t,p.value,null):u(t,p.value,n-1),o.indexOf("\n")>-1&&(o=s?o.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+o.split("\n").map(function(t){return" "+t}).join("\n"))):o=t.stylize("[Circular]","special")),b(a)){if(s&&i.match(/^\d+$/))return o;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+o}function h(t,e,n){var r=0,i=t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function d(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function y(t){return null===t}function g(t){return null==t}function v(t){return"number"==typeof t}function A(t){return"string"==typeof t}function E(t){return"symbol"==typeof t}function b(t){return void 0===t}function x(t){return D(t)&&"[object RegExp]"===B(t)}function D(t){return"object"==typeof t&&null!==t}function C(t){return D(t)&&"[object Date]"===B(t)}function S(t){return D(t)&&("[object Error]"===B(t)||t instanceof Error)}function F(t){return"function"==typeof t}function w(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function B(t){return Object.prototype.toString.call(t)}function T(t){return 10>t?"0"+t.toString(10):t.toString(10)}function _(){var t=new Date,e=[T(t.getHours()),T(t.getMinutes()),T(t.getSeconds())].join(":");return[t.getDate(),L[t.getMonth()],e].join(" ")}function k(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var P=/%[sdj%]/g;n.format=function(t){if(!A(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(i(arguments[n]));return e.join(" ")}for(var n=1,r=arguments,s=r.length,a=String(t).replace(P,function(t){if("%%"===t)return"%";if(n>=s)return t;switch(t){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 t}}),o=r[n];s>n;o=r[++n])a+=y(o)||!D(o)?" "+o:" "+i(o);return a},n.deprecate=function(t,i){function s(){if(!a){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),a=!0}return t.apply(this,arguments)}if(b(r.process))return function(){return n.deprecate(t,i).apply(this,arguments)};if(e.noDeprecation===!0)return t;var a=!1;return s};var N,I={};n.debuglog=function(t){if(b(N)&&(N=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!I[t])if(new RegExp("\\b"+t+"\\b","i").test(N)){var r=e.pid;I[t]=function(){var e=n.format.apply(n,arguments);console.error("%s %d: %s",t,r,e)}}else I[t]=function(){};return I[t]},n.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"},n.isArray=d,n.isBoolean=m,n.isNull=y,n.isNullOrUndefined=g,n.isNumber=v,n.isString=A,n.isSymbol=E,n.isUndefined=b,n.isRegExp=x,n.isObject=D,n.isDate=C,n.isError=S,n.isFunction=F,n.isPrimitive=w,n.isBuffer=t(10);var L=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",_(),n.format.apply(n,arguments))},n.inherits=t(5),n._extend=function(t,e){if(!e||!D(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}).call(this,t(8),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10,5:5,8:8}],12:[function(t,e,n){"use strict";function r(t){var e=c["default"].matchToToken(t);if("name"===e.type&&h["default"].keyword.isReservedWordES6(e.value))return"keyword";if("punctuator"===e.type)switch(e.value){case"{":case"}":return"curly";
case"(":case")":return"parens";case"[":case"]":return"square"}return e.type}function i(t){return t.replace(c["default"],function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];var i=r(e),s=y[i];return s?e[0].split(g).map(function(t){return s(t)}).join("\n"):e[0]})}var s=t(15)["default"];n.__esModule=!0;var a=t(25),o=s(a),u=t(26),p=s(u),l=t(23),c=s(l),f=t(21),h=s(f),d=t(16),m=s(d),y={string:m["default"].red,punctuator:m["default"].bold,curly:m["default"].green,parens:m["default"].blue.bold,square:m["default"].yellow,keyword:m["default"].cyan,number:m["default"].magenta,regex:m["default"].magenta,comment:m["default"].grey,invalid:m["default"].inverse},g=/\r\n|[\n\r\u2028\u2029]/;n["default"]=function(t,e,n){var r=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];n=Math.max(n,0);var s=r.highlightCode&&m["default"].supportsColor;s&&(t=i(t));var a=t.split(g),u=Math.max(e-3,0),l=Math.min(a.length,e+3);e||n||(u=0,l=a.length);var c=o["default"](a.slice(u,l),{start:u+1,before:" ",after:" | ",transform:function(t){t.number===e&&(n&&(t.line+="\n"+t.before+p["default"](" ",t.width)+t.after+p["default"](" ",n-1)+"^"),t.before=t.before.replace(/^./,">"))}}).join("\n");return s?m["default"].reset(c):c},e.exports=n["default"]},{15:15,16:16,21:21,23:23,25:25,26:26}],13:[function(t,e,n){"use strict";e.exports=function(){return/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g}},{}],14:[function(t,e,n){"use strict";function r(){var t={modifiers:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},colors:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39]},bgColors:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49]}};return t.colors.grey=t.colors.gray,Object.keys(t).forEach(function(e){var n=t[e];Object.keys(n).forEach(function(e){var r=n[e];t[e]=n[e]={open:"["+r[0]+"m",close:"["+r[1]+"m"}}),Object.defineProperty(t,e,{value:n,enumerable:!1})}),t}Object.defineProperty(e,"exports",{enumerable:!0,get:r})},{}],15:[function(t,e,n){"use strict";n["default"]=function(t){return t&&t.__esModule?t:{"default":t}},n.__esModule=!0},{}],16:[function(t,e,n){(function(n){"use strict";function r(t){this.enabled=t&&void 0!==t.enabled?t.enabled:c}function i(t){var e=function(){return s.apply(e,arguments)};return e._styles=t,e.enabled=this.enabled,e.__proto__=m,e}function s(){var t=arguments,e=t.length,n=0!==e&&String(arguments[0]);if(e>1)for(var r=1;e>r;r++)n+=" "+t[r];if(!this.enabled||!n)return n;var i=this._styles,s=i.length,a=u.dim.open;for(!h||-1===i.indexOf("gray")&&-1===i.indexOf("grey")||(u.dim.open="");s--;){var o=u[i[s]];n=o.open+n.replace(o.closeRe,o.open)+o.close}return u.dim.open=a,n}function a(){var t={};return Object.keys(d).forEach(function(e){t[e]={get:function(){return i.call(this,[e])}}}),t}var o=t(17),u=t(14),p=t(29),l=t(22),c=t(30),f=Object.defineProperties,h="win32"===n.platform&&!/^xterm/i.test(n.env.TERM);h&&(u.blue.open="[94m");var d=function(){var t={};return Object.keys(u).forEach(function(e){u[e].closeRe=new RegExp(o(u[e].close),"g"),t[e]={get:function(){return i.call(this,this._styles.concat(e))}}}),t}(),m=f(function(){},d);f(r.prototype,a()),e.exports=new r,e.exports.styles=u,e.exports.hasColor=l,e.exports.stripColor=p,e.exports.supportsColor=c}).call(this,t(8))},{14:14,17:17,22:22,29:29,30:30,8:8}],17:[function(t,e,n){"use strict";var r=/[|\\{}()[\]^$+*?.]/g;e.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(r,"\\$&")}},{}],18:[function(t,e,n){!function(){"use strict";function t(t){if(null==t)return!1;switch(t.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return!0}return!1}function n(t){if(null==t)return!1;switch(t.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1}function r(t){if(null==t)return!1;switch(t.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return!0}return!1}function i(t){return r(t)||null!=t&&"FunctionDeclaration"===t.type}function s(t){switch(t.type){case"IfStatement":return null!=t.alternate?t.alternate:t.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return t.body}return null}function a(t){var e;if("IfStatement"!==t.type)return!1;if(null==t.alternate)return!1;e=t.consequent;do{if("IfStatement"===e.type&&null==e.alternate)return!0;e=s(e)}while(e);return!1}e.exports={isExpression:t,isStatement:r,isIterationStatement:n,isSourceElement:i,isProblematicIfStatement:a,trailingStatement:s}}()},{}],19:[function(t,e,n){!function(){"use strict";function t(t){return t>=48&&57>=t}function n(t){return t>=48&&57>=t||t>=97&&102>=t||t>=65&&70>=t}function r(t){return t>=48&&55>=t}function i(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&h.indexOf(t)>=0}function s(t){return 10===t||13===t||8232===t||8233===t}function a(t){if(65535>=t)return String.fromCharCode(t);var e=String.fromCharCode(Math.floor((t-65536)/1024)+55296),n=String.fromCharCode((t-65536)%1024+56320);return e+n}function o(t){return 128>t?d[t]:f.NonAsciiIdentifierStart.test(a(t))}function u(t){return 128>t?m[t]:f.NonAsciiIdentifierPart.test(a(t))}function p(t){return 128>t?d[t]:c.NonAsciiIdentifierStart.test(a(t))}function l(t){return 128>t?m[t]:c.NonAsciiIdentifierPart.test(a(t))}var c,f,h,d,m,y;for(f={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,NonAsciiIdentifierPart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/},c={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},h=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],d=new Array(128),y=0;128>y;++y)d[y]=y>=97&&122>=y||y>=65&&90>=y||36===y||95===y;for(m=new Array(128),y=0;128>y;++y)m[y]=y>=97&&122>=y||y>=65&&90>=y||y>=48&&57>=y||36===y||95===y;e.exports={isDecimalDigit:t,isHexDigit:n,isOctalDigit:r,isWhiteSpace:i,isLineTerminator:s,isIdentifierStartES5:o,isIdentifierPartES5:u,isIdentifierStartES6:p,isIdentifierPartES6:l}}()},{}],20:[function(t,e,n){!function(){"use strict";function n(t){switch(t){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}function r(t,e){return e||"yield"!==t?i(t,e):!1}function i(t,e){if(e&&n(t))return!0;switch(t.length){case 2:return"if"===t||"in"===t||"do"===t;case 3:return"var"===t||"for"===t||"new"===t||"try"===t;case 4:return"this"===t||"else"===t||"case"===t||"void"===t||"with"===t||"enum"===t;case 5:return"while"===t||"break"===t||"catch"===t||"throw"===t||"const"===t||"yield"===t||"class"===t||"super"===t;case 6:return"return"===t||"typeof"===t||"delete"===t||"switch"===t||"export"===t||"import"===t;case 7:return"default"===t||"finally"===t||"extends"===t;case 8:return"function"===t||"continue"===t||"debugger"===t;case 10:return"instanceof"===t;default:return!1}}function s(t,e){return"null"===t||"true"===t||"false"===t||r(t,e)}function a(t,e){return"null"===t||"true"===t||"false"===t||i(t,e)}function o(t){return"eval"===t||"arguments"===t}function u(t){var e,n,r;if(0===t.length)return!1;if(r=t.charCodeAt(0),!h.isIdentifierStartES5(r))return!1;for(e=1,n=t.length;n>e;++e)if(r=t.charCodeAt(e),!h.isIdentifierPartES5(r))return!1;return!0}function p(t,e){return 1024*(t-55296)+(e-56320)+65536}function l(t){var e,n,r,i,s;if(0===t.length)return!1;for(s=h.isIdentifierStartES6,e=0,n=t.length;n>e;++e){if(r=t.charCodeAt(e),r>=55296&&56319>=r){if(++e,e>=n)return!1;if(i=t.charCodeAt(e),!(i>=56320&&57343>=i))return!1;r=p(r,i)}if(!s(r))return!1;s=h.isIdentifierPartES6}return!0}function c(t,e){return u(t)&&!s(t,e)}function f(t,e){return l(t)&&!a(t,e)}var h=t(19);e.exports={isKeywordES5:r,isKeywordES6:i,isReservedWordES5:s,isReservedWordES6:a,isRestrictedWord:o,isIdentifierNameES5:u,isIdentifierNameES6:l,isIdentifierES5:c,isIdentifierES6:f}}()},{19:19}],21:[function(t,e,n){
!function(){"use strict";n.ast=t(18),n.code=t(19),n.keyword=t(20)}()},{18:18,19:19,20:20}],22:[function(t,e,n){"use strict";var r=t(13),i=new RegExp(r().source);e.exports=i.test.bind(i)},{13:13}],23:[function(t,e,n){e.exports=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|((?:0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?))|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]{1,6}\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-*\/%&|^]|<{1,2}|>{1,3}|!=?|={1,2})=?|[?:~]|[;,.[\](){}])|(\s+)|(^$|[\s\S])/g,e.exports.matchToToken=function(t){var e={type:"invalid",value:t[0]};return t[1]?(e.type="string",e.closed=!(!t[3]&&!t[4])):t[5]?e.type="comment":t[6]?(e.type="comment",e.closed=!!t[7]):t[8]?e.type="regex":t[9]?e.type="number":t[10]?e.type="name":t[11]?e.type="punctuator":t[12]&&(e.type="whitespace"),e}},{}],24:[function(t,e,n){function r(t,e,n){t=String(t);var r=-1;for(n||(n=" "),e-=t.length;++r<e;)t=n+t;return t}e.exports=r},{}],25:[function(t,e,n){function r(t,e,n){return e in t?t[e]:n}function i(t,e){var n=r.bind(null,e||{}),i=n("transform",Function.prototype),a=n("padding"," "),o=n("before"," "),u=n("after"," | "),p=n("start",1),l=Array.isArray(t),c=l?t:t.split("\n"),f=p+c.length-1,h=String(f).length,d=c.map(function(t,e){var n=p+e,r={before:o,number:n,width:h,after:u,line:t};return i(r),r.before+s(r.number,h,a)+r.after+r.line});return l?d:d.join("\n")}var s=t(24);e.exports=i},{24:24}],26:[function(t,e,n){"use strict";var r=t(27);e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("Expected a string as the first argument");if(0>e||!r(e))throw new TypeError("Expected a finite positive number");var n="";do 1&e&&(n+=t),t+=t;while(e>>=1);return n}},{27:27}],27:[function(t,e,n){"use strict";var r=t(28);e.exports=Number.isFinite||function(t){return!("number"!=typeof t||r(t)||t===1/0||t===-(1/0))}},{28:28}],28:[function(t,e,n){"use strict";e.exports=Number.isNaN||function(t){return t!==t}},{}],29:[function(t,e,n){"use strict";var r=t(13)();e.exports=function(t){return"string"==typeof t?t.replace(r,""):t}},{13:13}],30:[function(t,e,n){(function(t){"use strict";var n=t.argv,r=n.indexOf("--"),i=function(t){t="--"+t;var e=n.indexOf(t);return-1!==e&&(-1!==r?r>e:!0)};e.exports=function(){return"FORCE_COLOR"in t.env?!0:i("no-color")||i("no-colors")||i("color=false")?!1:i("color")||i("colors")||i("color=true")||i("color=always")?!0:t.stdout&&!t.stdout.isTTY?!1:"win32"===t.platform?!0:"COLORTERM"in t.env?!0:"dumb"===t.env.TERM?!1:/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(t.env.TERM)?!0:!1}()}).call(this,t(8))},{8:8}],31:[function(t,e,n){(function(e){"use strict";function r(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Function(u.transform(t,e).code)()}function i(t,n,i,s){void 0===i&&(i={}),i.filename=i.filename||t;var a=e.ActiveXObject?new e.ActiveXObject("Microsoft.XMLHTTP"):new e.XMLHttpRequest;a.open("GET",t,!0),"overrideMimeType"in a&&a.overrideMimeType("text/plain"),a.onreadystatechange=function(){if(4===a.readyState){var e=a.status;if(0!==e&&200!==e)throw new Error("Could not load "+t);var o=[a.responseText,i];s||r(o),n&&n(o)}},a.send(null)}function s(){function t(){var e=r[a];e instanceof Array&&(n(e,a),a++,t())}function n(e,n){var s={};e.src?i(e.src,function(e){r[n]=e,t()},s,!0):(s.filename="embedded",r[n]=[e.innerHTML,s])}for(var r=[],s=["text/ecmascript-6","text/6to5","text/babel","module"],a=0,o=e.document.getElementsByTagName("script"),u=0;u<o.length;++u){var p=o[u];s.indexOf(p.type)>=0&&r.push(p)}for(var u=0;u<r.length;u++)n(r[u],u);t()}var a=t(63)["default"],o=t(65)["default"];n.__esModule=!0,n.run=r,n.load=i;var u=t(32);a(n,o(u,a)),e.addEventListener?e.addEventListener("DOMContentLoaded",s,!1):e.attachEvent&&e.attachEvent("onload",s)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{32:32,63:63,65:65}],32:[function(t,e,n){"use strict";function r(t,e,n){p["default"](e)&&(n=e,e={}),e.filename=t,c["default"].readFile(t,function(t,r){var i=void 0;if(!t)try{i=_(r,e)}catch(s){t=s}t?n(t):n(null,i)})}function i(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return e.filename=t,_(c["default"].readFileSync(t,"utf8"),e)}var s=t(66)["default"],a=t(67)["default"],o=t(68)["default"];n.__esModule=!0,n.transformFile=r,n.transformFileSync=i;var u=t(213),p=s(u),l=t(2),c=s(l),f=t(50),h=a(f),d=t(54),m=a(d),y=t(71),g=a(y),v=t(70),A=s(v),E=t(43),b=s(E),x=t(47),D=s(x),C=t(38);n.File=o(C);var S=t(41);n.options=o(S);var F=t(37);n.buildExternalHelpers=o(F);var w=t(69);n.template=o(w);var B=t(249);n.version=B.version,n.util=h,n.messages=m,n.types=g,n.traverse=A["default"],n.OptionManager=b["default"],n.Pipeline=D["default"];var T=new D["default"],_=T.transform.bind(T);n.transform=_;var k=T.transformFromAst.bind(T);n.transformFromAst=k},{2:2,213:213,249:249,37:37,38:38,41:41,43:43,47:47,50:50,54:54,66:66,67:67,68:68,69:69,70:70,71:71}],33:[function(t,e,n){"use strict";var r=t(55)["default"],i=t(66)["default"];n.__esModule=!0;var s=t(225),a=i(s);n["default"]=function(t,e){return t&&e?a["default"](t,e,function(t,e){if(e&&Array.isArray(t)){for(var n=e.slice(0),i=t,s=Array.isArray(i),a=0,i=s?i:r(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if(a=i.next(),a.done)break;o=a.value}var u=o;n.indexOf(u)<0&&n.push(u)}return n}}):void 0},e.exports=n["default"]},{225:225,55:55,66:66}],34:[function(t,e,n){"use strict";var r=t(67)["default"];n.__esModule=!0;var i=t(71),s=r(i);n["default"]=function(t,e,n){if(t){if("Program"===t.type)return s.file(t,e||[],n||[]);if("File"===t.type)return t}throw new Error("Not a valid ast?")},e.exports=n["default"]},{67:67,71:71}],35:[function(t,e,n){(function(r){"use strict";var i=t(66)["default"];n.__esModule=!0;var s=t(2),a=i(s),o={};n["default"]=function(t){var e=arguments.length<=1||void 0===arguments[1]?r.cwd():arguments[1];if("object"==typeof a["default"])return null;var n=o[e];n||(n=new a["default"],n.paths=a["default"]._nodeModulePaths(e),o[e]=n);try{return a["default"]._resolveFilename(t,n)}catch(i){return null}},e.exports=n["default"]}).call(this,t(8))},{2:2,66:66,8:8}],36:[function(t,e,n){"use strict";var r=t(64)["default"],i=t(62)["default"],s=t(56)["default"];n.__esModule=!0;var a=function(t){function e(){i(this,e),t.call(this),this.dynamicData={}}return r(e,t),e.prototype.setDynamic=function(t,e){this.dynamicData[t]=e},e.prototype.get=function(e){if(this.has(e))return t.prototype.get.call(this,e);if(Object.prototype.hasOwnProperty.call(this.dynamicData,e)){var n=this.dynamicData[e]();return this.set(e,n),n}},e}(s);n["default"]=a,e.exports=n["default"]},{56:56,62:62,64:64}],37:[function(t,e,n){"use strict";function r(t,e){var n=[],r=E.functionExpression(null,[E.identifier("global")],E.blockStatement(n)),i=E.program([E.expressionStatement(E.callExpression(r,[l.get("selfGlobal")]))]);return n.push(E.variableDeclaration("var",[E.variableDeclarator(t,E.assignmentExpression("=",E.memberExpression(E.identifier("global"),t),E.objectExpression([])))])),e(n),i}function i(t,e){var n=[];return n.push(E.variableDeclaration("var",[E.variableDeclarator(t,E.identifier("global"))])),e(n),E.program([b({FACTORY_PARAMETERS:E.identifier("global"),BROWSER_ARGUMENTS:E.assignmentExpression("=",E.memberExpression(E.identifier("root"),t),E.objectExpression([])),COMMON_ARGUMENTS:E.identifier("exports"),AMD_ARGUMENTS:E.arrayExpression([E.stringLiteral("exports")]),FACTORY_BODY:n,UMD_ROOT:E.identifier("this")})])}function s(t,e){var n=[];return n.push(E.variableDeclaration("var",[E.variableDeclarator(t,E.objectExpression([]))])),e(n),n.push(E.expressionStatement(t)),E.program(n)}function a(t,e,n){v["default"](l.list,function(r){if(!(n&&n.indexOf(r)<0)){var i=E.identifier(r);t.push(E.expressionStatement(E.assignmentExpression("=",E.memberExpression(e,i),l.get(r))))}})}var o=t(67)["default"],u=t(66)["default"];n.__esModule=!0;var p=t(53),l=o(p),c=t(52),f=u(c),h=t(54),d=o(h),m=t(69),y=u(m),g=t(144),v=u(g),A=t(71),E=o(A),b=y["default"]('\n (function (root, factory) {\n if (typeof define === "function" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === "object") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n');n["default"]=function(t){var e=arguments.length<=1||void 0===arguments[1]?"global":arguments[1],n=E.identifier("babelHelpers"),o=function(e){return a(e,n,t)},u=void 0,p={global:r,umd:i,"var":s}[e];if(!p)throw new Error(d.get("unsupportedOutputType",e));return u=p(n,o),f["default"](u).code},e.exports=n["default"]},{144:144,52:52,53:53,54:54,66:66,67:67,69:69,71:71}],38:[function(t,e,n){(function(e){"use strict";var r=t(64)["default"],i=t(62)["default"],s=t(55)["default"],a=t(66)["default"],o=t(67)["default"];n.__esModule=!0;var u=t(53),p=a(u),l=t(40),c=o(l),f=t(76),h=a(f),d=t(43),m=a(d),y=t(48),g=a(y),v=t(236),A=a(v),E=t(70),b=t(248),x=a(b),D=t(52),C=a(D),S=t(51),F=a(S),w=t(222),B=a(w),T=a(E),_=t(39),k=a(_),P=t(36),N=a(P),I=t(72),L=t(50),O=o(L),M=t(7),R=a(M),j=t(71),V=o(j),U=t(45),G=a(U),W=t(46),q=a(W),H=[[G["default"]],[q["default"]]],Y={enter:function(t,e){var n=t.node.loc;n&&(e.loc=n,t.stop())}},J=function(t){function n(e,r){void 0===e&&(e={}),i(this,n),t.call(this),this.pipeline=r,this.log=new k["default"](this,e.filename||"unknown"),this.opts=this.initOptions(e),this.parserOpts={highlightCode:this.opts.highlightCode,nonStandard:this.opts.nonStandard,sourceType:this.opts.sourceType,filename:this.opts.filename,plugins:[]},this.pluginVisitors=[],this.pluginPasses=[],this.pluginStack=[],this.buildPlugins(),this.metadata={usedHelpers:[],marked:[],modules:{imports:[],exports:{exported:[],specifiers:[]}}},this.dynamicImportTypes={},this.dynamicImportIds={},this.dynamicImports=[],this.declarations={},this.usedHelpers={},this.path=null,this.ast={},this.code="",this.shebang="",this.hub=new E.Hub(this)}return r(n,t),n.prototype.getMetadata=function(){for(var t=!1,e=this.ast.program.body,n=Array.isArray(e),r=0,e=n?e:s(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var a=i;if(V.isModuleDeclaration(a)){t=!0;break}}t&&this.path.traverse(c,this)},n.prototype.initOptions=function(t){t=new m["default"](this.log,this.pipeline).init(t),t.inputSourceMap&&(t.sourceMaps=!0),t.moduleId&&(t.moduleIds=!0),t.basename=R["default"].basename(t.filename,R["default"].extname(t.filename)),t.ignore=O.arrayify(t.ignore,O.regexify),t.only&&(t.only=O.arrayify(t.only,O.regexify)),B["default"](t,{moduleRoot:t.sourceRoot}),B["default"](t,{sourceRoot:t.moduleRoot}),B["default"](t,{filenameRelative:t.filename});var e=R["default"].basename(t.filenameRelative);return B["default"](t,{sourceFileName:e,sourceMapTarget:e}),t},n.prototype.buildPlugins=function(){for(var t=this.opts.plugins.concat(H),e=t,n=Array.isArray(e),r=0,e=n?e:s(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var a=i,o=a[0],u=a[1];this.pluginStack.push(o),this.pluginVisitors.push(o.visitor),this.pluginPasses.push(new g["default"](this,o,u)),o.manipulateOptions&&o.manipulateOptions(this.opts,this.parserOpts,this)}},n.prototype.getModuleName=function(){var t=this.opts;if(!t.moduleIds)return null;if(null!=t.moduleId&&!t.getModuleId)return t.moduleId;var e=t.filenameRelative,n="";if(null!=t.moduleRoot&&(n=t.moduleRoot+"/"),!t.filenameRelative)return n+t.filename.replace(/^\//,"");if(null!=t.sourceRoot){var r=new RegExp("^"+t.sourceRoot+"/?");e=e.replace(r,"")}return e=e.replace(/\.(\w*?)$/,""),n+=e,n=n.replace(/\\/g,"/"),t.getModuleId?t.getModuleId(n)||n:n},n.prototype.resolveModuleSource=function a(t){var a=this.opts.resolveModuleSource;return a&&(t=a(t,this.opts.filename)),t},n.prototype.addImport=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?e:arguments[2];return function(){var r=t+":"+e,i=this.dynamicImportIds[r];if(!i){t=this.resolveModuleSource(t),i=this.dynamicImportIds[r]=this.scope.generateUidIdentifier(n);var s=[];"*"===e?s.push(V.importNamespaceSpecifier(i)):"default"===e?s.push(V.importDefaultSpecifier(i)):s.push(V.importSpecifier(i,V.identifier(e)));var a=V.importDeclaration(s,V.stringLiteral(t));a._blockHoist=3,this.path.unshiftContainer("body",a)}return i}.apply(this,arguments)},n.prototype.addHelper=function(t){var e=this.declarations[t];if(e)return e;this.usedHelpers[t]||(this.metadata.usedHelpers.push(t),this.usedHelpers[t]=!0);var n=this.get("helperGenerator"),r=this.get("helpersNamespace");if(n){var i=n(t);if(i)return i}else if(r)return V.memberExpression(r,V.identifier(t));var s=p["default"](t),a=this.declarations[t]=this.scope.generateUidIdentifier(t);return V.isFunctionExpression(s)&&!s.id?(s.body._compact=!0,s._generated=!0,s.id=a,s.type="FunctionDeclaration",this.path.unshiftContainer("body",s)):(s._compact=!0,this.scope.push({id:a,init:s,unique:!0})),a},n.prototype.addTemplateObject=function(t,e,n){var r=n.elements.map(function(t){return t.value}),i=t+"_"+n.elements.length+"_"+r.join(","),s=this.declarations[i];if(s)return s;var a=this.declarations[i]=this.scope.generateUidIdentifier("templateObject"),o=this.addHelper(t),u=V.callExpression(o,[e,n]);return u._compact=!0,this.scope.push({id:a,init:u,_blockHoist:1.9}),a},n.prototype.buildCodeFrameError=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?SyntaxError:arguments[2],r=t&&(t.loc||t._loc),i=new n(e);return r?i.loc=r.start:(T["default"](t,Y,this.scope,i),i.message+=" (This is an error on an internal node. Probably an internal error",i.loc&&(i.message+=". Location has been estimated."),i.message+=")"),i},n.prototype.mergeSourceMap=function(t){var e=this.opts.inputSourceMap;if(!e)return t;var n=function(){var n=new x["default"].SourceMapConsumer(e),r=new x["default"].SourceMapConsumer(t),i=new x["default"].SourceMapGenerator({file:n.file,sourceRoot:n.sourceRoot});n.eachMapping(function(t){i.addMapping({source:n.file,original:{line:t.originalLine,column:t.originalColumn},generated:r.generatedPositionFor({line:t.generatedLine,column:t.generatedColumn,source:r.file})})});var s=i.toJSON();return e.mappings=s.mappings,{v:e}}();return"object"==typeof n?n.v:void 0},n.prototype.parse=function(t){this.log.debug("Parse start");var e=I.parse(t,this.parserOpts);return this.log.debug("Parse stop"),e},n.prototype._addAst=function(t){this.path=E.NodePath.get({hub:this.hub,parentPath:null,parent:t,container:t,key:"program"}).setContext(),this.scope=this.path.scope,this.ast=t,this.getMetadata()},n.prototype.addAst=function(t){this.log.debug("Start set AST"),this._addAst(t),this.log.debug("End set AST")},n.prototype.transform=function(){return this.call("pre"),this.log.debug("Start transform traverse"),T["default"](this.ast,T["default"].visitors.merge(this.pluginVisitors,this.pluginPasses),this.scope),this.log.debug("End transform traverse"),this.call("post"),this.generate()},n.prototype.wrap=function(t,n){t+="";try{return this.shouldIgnore()?this.makeResult({code:t,ignored:!0}):n()}catch(r){if(r._babel)throw r;r._babel=!0;var i=r.message=this.opts.filename+": "+r.message,s=r.loc;if(s&&(r.codeFrame=F["default"](t,s.line,s.column+1,this.opts),i+="\n"+r.codeFrame),e.browser&&(r.message=i),r.stack){var a=r.stack.replace(r.message,i);r.stack=a}throw r}},n.prototype.addCode=function(t){t=(t||"")+"",t=this.parseInputSourceMap(t),this.code=t},n.prototype.parseCode=function(){this.parseShebang();var t=this.parse(this.code);this.addAst(t)},n.prototype.shouldIgnore=function(){var t=this.opts;return O.shouldIgnore(t.filename,t.ignore,t.only)},n.prototype.call=function(t){for(var e=this.pluginPasses,n=Array.isArray(e),r=0,e=n?e:s(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var a=i,o=a.plugin,u=o[t];u&&u.call(a,this)}},n.prototype.parseInputSourceMap=function(t){var e=this.opts;if(e.inputSourceMap!==!1){var n=h["default"].fromSource(t);n&&(e.inputSourceMap=n.toObject(),t=h["default"].removeComments(t))}return t},n.prototype.parseShebang=function(){var t=A["default"].exec(this.code);t&&(this.shebang=t[0],this.code=this.code.replace(A["default"],""))},n.prototype.makeResult=function(t){var e=t.code,n=t.map,r=t.ast,i=t.ignored,s={metadata:null,options:this.opts,ignored:!!i,code:null,ast:null,map:n||null};return this.opts.code&&(s.code=e),this.opts.ast&&(s.ast=r),this.opts.metadata&&(s.metadata=this.metadata),s},n.prototype.generate=function(){var t=this.opts,e=this.ast,n={ast:e};if(!t.code)return this.makeResult(n);this.log.debug("Generation start");var r=C["default"](e,t,this.code);return n.code=r.code,n.map=r.map,this.log.debug("Generation end"),this.shebang&&(n.code=this.shebang+"\n"+n.code),n.map&&(n.map=this.mergeSourceMap(n.map)),("inline"===t.sourceMaps||"both"===t.sourceMaps)&&(n.code+="\n"+h["default"].fromObject(n.map).toComment()),"inline"===t.sourceMaps&&(n.map=null),this.makeResult(n)},n}(N["default"]);n["default"]=J,n.File=J}).call(this,t(8))},{222:222,236:236,248:248,36:36,39:39,40:40,43:43,45:45,46:46,48:48,50:50,51:51,52:52,53:53,55:55,62:62,64:64,66:66,67:67,7:7,70:70,71:71,72:72,76:76,8:8}],39:[function(t,e,n){"use strict";var r=t(62)["default"],i=t(66)["default"];n.__esModule=!0;var s=t(140),a=i(s),o=a["default"]("babel:verbose"),u=a["default"]("babel"),p=[],l=function(){function t(e,n){r(this,t),this.filename=n,this.file=e}return t.prototype._buildMessage=function(t){var e="[BABEL] "+this.filename;return t&&(e+=": "+t),e},t.prototype.warn=function(t){console.warn(this._buildMessage(t))},t.prototype.error=function(t){var e=arguments.length<=1||void 0===arguments[1]?Error:arguments[1];throw new e(this._buildMessage(t))},t.prototype.deprecate=function(t){this.file.opts&&this.file.opts.suppressDeprecationMessages||(t=this._buildMessage(t),p.indexOf(t)>=0||(p.push(t),console.error(t)))},t.prototype.verbose=function(t){o.enabled&&o(this._buildMessage(t))},t.prototype.debug=function(t){u.enabled&&u(this._buildMessage(t))},t.prototype.deopt=function(t,e){this.debug(e)},t}();n["default"]=l,e.exports=n["default"]},{140:140,62:62,66:66}],40:[function(t,e,n){"use strict";function r(t,e){var n=t.node,r=n.source?n.source.value:null,i=e.metadata.modules.exports,a=t.get("declaration");if(a.isStatement()){var o=a.getBindingIdentifiers();for(var p in o)i.exported.push(p),i.specifiers.push({kind:"local",local:p,exported:t.isExportDefaultDeclaration()?"default":p})}if(t.isExportNamedDeclaration()&&n.specifiers)for(var l=n.specifiers,c=Array.isArray(l),f=0,l=c?l:s(l);;){var h;if(c){if(f>=l.length)break;h=l[f++]}else{if(f=l.next(),f.done)break;h=f.value}var d=h,m=d.exported.name;i.exported.push(m),u.isExportDefaultSpecifier(d)&&i.specifiers.push({kind:"external",local:m,exported:m,source:r}),u.isExportNamespaceSpecifier(d)&&i.specifiers.push({kind:"external-namespace",exported:m,source:r});var y=d.local;y&&(r&&i.specifiers.push({kind:"external",local:y.name,exported:m,source:r}),r||i.specifiers.push({kind:"local",local:y.name,exported:m}))}t.isExportAllDeclaration()&&i.specifiers.push({kind:"external-all",source:r})}function i(t){t.skip()}var s=t(55)["default"],a=t(67)["default"];n.__esModule=!0,n.ExportDeclaration=r,n.Scope=i;var o=t(71),u=a(o),p={enter:function(t,e){var n=t.node;n.source&&(n.source.value=e.resolveModuleSource(n.source.value))}};n.ModuleDeclaration=p;var l={exit:function(t,e){var n=t.node,r=[],i=[];e.metadata.modules.imports.push({source:n.source.value,imported:i,specifiers:r});for(var a=t.get("specifiers"),o=Array.isArray(a),u=0,a=o?a:s(a);;){var p;if(o){if(u>=a.length)break;p=a[u++]}else{if(u=a.next(),u.done)break;p=u.value}var l=p,c=l.node.local.name;if(l.isImportDefaultSpecifier()&&(i.push("default"),r.push({kind:"named",imported:"default",local:c})),l.isImportSpecifier()){var f=l.node.imported.name;i.push(f),r.push({kind:"named",imported:f,local:c})}l.isImportNamespaceSpecifier()&&(i.push("*"),r.push({kind:"namespace",local:c}))}}};n.ImportDeclaration=l},{55:55,67:67,71:71}],41:[function(t,e,n){"use strict";e.exports={filename:{type:"filename",description:"filename to use when reading from stdin - this will be used in source-maps, errors etc","default":"unknown",shorthand:"f"},filenameRelative:{hidden:!0,type:"string"},inputSourceMap:{hidden:!0},env:{hidden:!0,"default":{}},mode:{description:"",hidden:!0},retainLines:{type:"boolean","default":!1,description:"retain line numbers - will result in really ugly code"},highlightCode:{description:"enable/disable ANSI syntax highlighting of code frames (on by default)",type:"boolean","default":!0},suppressDeprecationMessages:{type:"boolean","default":!1,hidden:!0},presets:{type:"list",description:"","default":[]},plugins:{type:"list","default":[],description:""},ignore:{type:"list",description:"list of glob paths to **not** compile","default":[]},only:{type:"list",description:"list of glob paths to **only** compile"},code:{hidden:!0,"default":!0,type:"boolean"},metadata:{hidden:!0,"default":!0,type:"boolean"},ast:{hidden:!0,"default":!0,type:"boolean"},"extends":{type:"string",hidden:!0},comments:{type:"boolean","default":!0,description:"strip/output comments in generated output (on by default)"},shouldPrintComment:{hidden:!0,description:"optional callback to control whether a comment should be inserted, when this is used the comments option is ignored"},compact:{type:"booleanString","default":"auto",description:"do not include superfluous whitespace characters and line terminators [true|false|auto]"},sourceMap:{alias:"sourceMaps",hidden:!0},sourceMaps:{type:"booleanString",description:"[true|false|inline]","default":!1,shorthand:"s"},sourceMapTarget:{type:"string",description:"set `file` on returned source map"},sourceFileName:{type:"string",description:"set `sources[0]` on returned source map"},sourceRoot:{type:"filename",description:"the root from which all sources are relative"},babelrc:{description:"Whether or not to look up .babelrc and .babelignore files",type:"boolean","default":!0},sourceType:{description:"","default":"module"},auxiliaryCommentBefore:{type:"string",description:"print a comment before any injected non-user code"},auxiliaryCommentAfter:{type:"string",description:"print a comment after any injected non-user code"},resolveModuleSource:{hidden:!0},getModuleId:{hidden:!0},moduleRoot:{type:"filename",description:"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"},moduleIds:{type:"boolean","default":!1,shorthand:"M",description:"insert an explicit id for modules"},moduleId:{description:"specify a custom name for module ids",type:"string"}}},{}],42:[function(t,e,n){"use strict";function r(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];for(var e in t){var n=t[e];if(null!=n){var r=p["default"][e];if(r&&r.alias&&(r=p["default"][r.alias]),r){var i=o[r.type];i&&(n=i(n)),t[e]=n}}}return t}var i=t(67)["default"],s=t(66)["default"];n.__esModule=!0,n.normaliseOptions=r;var a=t(44),o=i(a),u=t(41),p=s(u);n.config=p["default"]},{41:41,44:44,66:66,67:67}],43:[function(t,e,n){(function(r){"use strict";function i(t){var e=O[t];return null==e?O[t]=D["default"].sync(t):e}var s=t(62)["default"],a=t(55)["default"],o=t(67)["default"],u=t(66)["default"];n.__esModule=!0;var p=t(32),l=o(p),c=t(49),f=u(c),h=t(54),d=o(h),m=t(42),y=t(35),g=u(y),v=t(141),A=u(v),E=t(235),b=u(E),x=t(234),D=u(x),C=t(209),S=u(C),F=t(208),w=u(F),B=t(33),T=u(B),_=t(41),k=u(_),P=t(7),N=u(P),I=t(2),L=u(I),O={},M={},R=".babelignore",j=".babelrc",V="package.json",U=function(){function e(t){s(this,e),this.resolvedConfigs=[],this.options=e.createBareOptions(),this.log=t}return e.memoisePluginContainer=function(t,n,r){for(var i=e.memoisedPlugins,s=Array.isArray(i),o=0,i=s?i:a(i);;){var u;if(s){if(o>=i.length)break;u=i[o++]}else{if(o=i.next(),o.done)break;u=o.value}var p=u;if(p.container===t)return p.plugin}var c=void 0;if(c="function"==typeof t?t(l):t,"object"==typeof c){var h=new f["default"](c);return e.memoisedPlugins.push({container:t,plugin:h}),h}throw new TypeError(d.get("pluginNotObject",n,r,typeof c)+n+r)},e.createBareOptions=function(){var t={};for(var e in k["default"]){var n=k["default"][e];t[e]=w["default"](n["default"])}return t},e.normalisePlugin=function(t,n,r){if(t=t.__esModule?t["default"]:t,!(t instanceof f["default"])){if("function"!=typeof t&&"object"!=typeof t)throw new TypeError(d.get("pluginNotFunction",n,r,typeof t));t=e.memoisePluginContainer(t,n,r)}return t.init(n,r),t},e.normalisePlugins=function(n,r,i){return i.map(function(i,s){var a=void 0,o=void 0;if(Array.isArray(i)?(a=i[0],o=i[1]):a=i,"string"==typeof a){var u=g["default"]("babel-plugin-"+a,r)||g["default"](a,r);if(!u)throw new ReferenceError(d.get("pluginUnknown",a,n,s));a=t(u)}return a=e.normalisePlugin(a,n,s),[a,o]})},e.prototype.addConfig=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?A["default"]:arguments[2];if(this.resolvedConfigs.indexOf(t)>=0)return!1;var r=L["default"].readFileSync(t,"utf8"),i=void 0;try{i=M[r]=M[r]||n.parse(r),e&&(i=i[e])}catch(s){throw s.message=t+": Error while parsing JSON - "+s.message,s}return this.mergeOptions(i,t),this.resolvedConfigs.push(t),!!i},e.prototype.mergeOptions=function(t,n,i,s){if(void 0===n&&(n="foreign"),t){("object"!=typeof t||Array.isArray(t))&&this.log.error("Invalid options type for "+n,TypeError);var a=S["default"](t,function(t){return t instanceof f["default"]?t:void 0});s=s||r.cwd(),i=i||n;for(var o in a){var u=k["default"][o];!u&&this.log&&this.log.error("Unknown option: "+n+"."+o,ReferenceError)}if(m.normaliseOptions(a),a.plugins&&(a.plugins=e.normalisePlugins(i,s,a.plugins)),a["extends"]){var p=g["default"](a["extends"],s);p?this.addConfig(p):this.log&&this.log.error("Couldn't resolve extends clause of "+a["extends"]+" in "+n),delete a["extends"]}a.presets&&(this.mergePresets(a.presets,s),delete a.presets);var l=void 0,c=r.env.BABEL_ENV||r.env.NODE_ENV||"development";a.env&&(l=a.env[c],delete a.env),T["default"](this.options,a),this.mergeOptions(l,n+".env."+c)}},e.prototype.mergePresets=function(e,n){for(var r=e,i=Array.isArray(r),s=0,r=i?r:a(r);;){var o;if(i){if(s>=r.length)break;o=r[s++]}else{if(s=r.next(),s.done)break;o=s.value}var u=o;if("string"==typeof u){var p=g["default"]("babel-preset-"+u,n)||g["default"](u,n);if(!p)throw new Error("Couldn't find preset "+JSON.stringify(u));var l=t(p);this.mergeOptions(l,p,p,N["default"].dirname(p))}else{if("object"!=typeof u)throw new Error("todo");this.mergeOptions(u)}}},e.prototype.addIgnoreConfig=function(t){var e=L["default"].readFileSync(t,"utf8"),n=e.split("\n");n=n.map(function(t){return t.replace(/#(.*?)$/,"").trim()}).filter(function(t){return!!t}),this.mergeOptions({ignore:n},t)},e.prototype.findConfigs=function(t){if(t){b["default"](t)||(t=N["default"].join(r.cwd(),t));for(var e=!1,n=!1;t!==(t=N["default"].dirname(t));){if(!e){var s=N["default"].join(t,j);i(s)&&(this.addConfig(s),e=!0);var a=N["default"].join(t,V);i(a)&&(e=this.addConfig(a,"babel",JSON))}if(!n){var o=N["default"].join(t,R);i(o)&&(this.addIgnoreConfig(o),n=!0)}if(n&&e)return}}},e.prototype.normaliseOptions=function(){var t=this.options;for(var e in k["default"]){var n=k["default"][e],r=t[e];(r||!n.optional)&&(n.alias?t[n.alias]=t[n.alias]||r:t[e]=r)}},e.prototype.init=function(t){return t.babelrc!==!1&&this.findConfigs(t.filename),this.mergeOptions(t,"base"),this.normaliseOptions(t),this.options},e}();n["default"]=U,U.memoisedPlugins=[],e.exports=n["default"]}).call(this,t(8))},{141:141,2:2,208:208,209:209,234:234,235:235,32:32,33:33,35:35,41:41,42:42,49:49,54:54,55:55,62:62,66:66,67:67,7:7,8:8}],44:[function(t,e,n){"use strict";function r(t){return!!t}function i(t){return c.booleanify(t)}function s(t){return c.list(t)}var a=t(66)["default"],o=t(67)["default"];n.__esModule=!0,n["boolean"]=r,n.booleanString=i,n.list=s;var u=t(237),p=a(u),l=t(50),c=o(l),f=p["default"];n.filename=f},{237:237,50:50,66:66,67:67}],45:[function(t,e,n){"use strict";var r=t(66)["default"];n.__esModule=!0;var i=t(49),s=r(i),a=t(147),o=r(a);n["default"]=new s["default"]({visitor:{Block:{exit:function(t){for(var e=t.node,n=!1,r=0;r<e.body.length;r++){var i=e.body[r];if(i&&null!=i._blockHoist){n=!0;break}}n&&(e.body=o["default"](e.body,function(t){var e=t&&t._blockHoist;return null==e&&(e=1),e===!0&&(e=2),-1*e}))}}}}),e.exports=n["default"]},{147:147,49:49,66:66}],46:[function(t,e,n){"use strict";function r(t,e){return t.is("_forceShadow")?!0:e&&!e.isArrowFunctionExpression()}function i(t,e,n){var i=t.inShadow(e);if(r(t,i)){var s=t.node._shadowedFunctionLiteral,a=void 0,o=t.findParent(function(t){return(t.isProgram()||t.isFunction())&&(a=a||t),t.isProgram()?!0:t.isFunction()?s?t===s||t.node===s.node:!t.is("shadow"):!1});if(o!==a){var u=o.getData(e);if(u)return t.replaceWith(u);var p=n(),l=t.scope.generateUidIdentifier(e);return o.setData(e,l),o.scope.push({id:l,init:p}),t.replaceWith(l)}}}var s=t(66)["default"],a=t(67)["default"];n.__esModule=!0;var o=t(49),u=s(o),p=t(71),l=a(p);n["default"]=new u["default"]({visitor:{ThisExpression:function(t){i(t,"this",function(){return l.thisExpression()})},ReferencedIdentifier:function(t){"arguments"===t.node.name&&i(t,"arguments",function(){return l.identifier("arguments")})}}}),e.exports=n["default"]},{49:49,66:66,67:67,71:71}],47:[function(t,e,n){"use strict";var r=t(62)["default"],i=t(66)["default"];n.__esModule=!0;var s=t(34),a=i(s),o=t(38),u=i(o),p=function(){function t(){r(this,t)}return t.prototype.lint=function(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return e.code=!1,e.mode="lint",this.transform(t,e)},t.prototype.pretransform=function(t,e){var n=new u["default"](e,this);return n.wrap(t,function(){return n.addCode(t),n.parseCode(t),n})},t.prototype.transform=function(t,e){var n=new u["default"](e,this);return n.wrap(t,function(){return n.addCode(t),n.parseCode(t),n.transform()})},t.prototype.transformFromAst=function(t,e,n){t=a["default"](t);var r=new u["default"](n,this);return r.wrap(e,function(){return r.addCode(e),r.addAst(t),r.transform()})},t}();n["default"]=p,e.exports=n["default"]},{34:34,38:38,62:62,66:66}],48:[function(t,e,n){"use strict";var r=t(64)["default"],i=t(62)["default"],s=t(66)["default"];n.__esModule=!0;var a=t(36),o=s(a),u=t(70),p=s(u),l=t(38),c=(s(l),function(t){function e(n,r){var s=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];i(this,e),t.call(this),this.plugin=r,this.file=n,this.opts=s}return r(e,t),e.prototype.transform=function(){var t=this.file;t.log.debug("Start transformer "+this.key),p["default"](t.ast,this.plugin.visitor,t.scope,t),t.log.debug("Finish transformer "+this.key)},e.prototype.addHelper=function(){var t;return(t=this.file).addHelper.apply(t,arguments)},e.prototype.addImport=function(){var t;return(t=this.file).addImport.apply(t,arguments)},e.prototype.getModuleName=function(){var t;return(t=this.file).getModuleName.apply(t,arguments)},e.prototype.buildCodeFrameError=function(){var t;return(t=this.file).buildCodeFrameError.apply(t,arguments)},e}(o["default"]));n["default"]=c,e.exports=n["default"]},{36:36,38:38,62:62,64:64,66:66,70:70}],49:[function(t,e,n){"use strict";var r=t(64)["default"],i=t(62)["default"],s=t(55)["default"],a=t(66)["default"],o=t(67)["default"];n.__esModule=!0;var u=t(43),p=a(u),l=t(54),c=o(l),f=t(36),h=a(f),d=t(70),m=a(d),y=t(221),g=a(y),v=t(208),A=a(v),E=["enter","exit"],b=function(t){function e(n){i(this,e),t.call(this),this.initialized=!1,this.raw=g["default"]({},n),this.manipulateOptions=this.take("manipulateOptions"),this.post=this.take("post"),this.pre=this.take("pre"),this.visitor=this.normaliseVisitor(A["default"](this.take("visitor"))||{});
}return r(e,t),e.prototype.take=function(t){var e=this.raw[t];return delete this.raw[t],e},e.prototype.chain=function(t,e){if(!t[e])return this[e];if(!this[e])return t[e];var n=[t[e],this[e]];return function(){for(var t=void 0,e=arguments.length,r=Array(e),i=0;e>i;i++)r[i]=arguments[i];for(var a=n,o=Array.isArray(a),u=0,a=o?a:s(a);;){var p;if(o){if(u>=a.length)break;p=a[u++]}else{if(u=a.next(),u.done)break;p=u.value}var l=p;if(l){var c=l.apply(this,r);null!=c&&(t=c)}}return t}},e.prototype.maybeInherit=function(t){var e=this.take("inherits");e&&(e=p["default"].normalisePlugin(e,t,"inherits"),this.manipulateOptions=this.chain(e,"manipulateOptions"),this.post=this.chain(e,"post"),this.pre=this.chain(e,"pre"),this.visitor=m["default"].visitors.merge([e.visitor,this.visitor]))},e.prototype.init=function(t,e){if(!this.initialized){this.initialized=!0,this.maybeInherit(t);for(var n in this.raw)throw new Error(c.get("pluginInvalidProperty",t,e,n))}},e.prototype.normaliseVisitor=function(t){for(var e=E,n=Array.isArray(e),r=0,e=n?e:s(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var a=i;if(t[a])throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. Please target individual nodes.")}return m["default"].explode(t),t},e}(h["default"]);n["default"]=b,e.exports=n["default"]},{208:208,221:221,36:36,43:43,54:54,55:55,62:62,64:64,66:66,67:67,70:70}],50:[function(t,e,n){"use strict";function r(t,e){var n=e||r.EXTENSIONS,i=w["default"].extname(t);return b["default"](n,i)}function i(t){return t?Array.isArray(t)?t:"string"==typeof t?t.split(","):[t]:[]}function s(t){if(!t)return new RegExp(/.^/);if(Array.isArray(t)&&(t=new RegExp(t.map(h["default"]).join("|"),"i")),"string"==typeof t){t=T["default"](t),(m["default"](t,"./")||m["default"](t,"*/"))&&(t=t.slice(2)),m["default"](t,"**/")&&(t=t.slice(3));var e=A["default"].makeRe(t,{nocase:!0});return new RegExp(e.source.slice(1,-1),"i")}if(S["default"](t))return t;throw new TypeError("illegal type for regexify")}function a(t,e){return t?g["default"](t)?a([t],e):D["default"](t)?a(i(t),e):Array.isArray(t)?(e&&(t=t.map(e)),t):[t]:[]}function o(t){return"true"===t||1==t?!0:"false"!==t&&0!=t&&t?t:!1}function u(t,e,n){if(void 0===e&&(e=[]),t=T["default"](t),n){for(var r=n,i=Array.isArray(r),s=0,r=i?r:l(r);;){var a;if(i){if(s>=r.length)break;a=r[s++]}else{if(s=r.next(),s.done)break;a=s.value}var o=a;if(p(o,t))return!1}return!0}if(e.length)for(var u=e,c=Array.isArray(u),f=0,u=c?u:l(u);;){var h;if(c){if(f>=u.length)break;h=u[f++]}else{if(f=u.next(),f.done)break;h=f.value}var o=h;if(p(o,t))return!0}return!1}function p(t,e){return"function"==typeof t?t(e):t.test(e)}var l=t(55)["default"],c=t(66)["default"];n.__esModule=!0,n.canCompile=r,n.list=i,n.regexify=s,n.arrayify=a,n.booleanify=o,n.shouldIgnore=u;var f=t(228),h=c(f),d=t(229),m=c(d),y=t(212),g=c(y),v=t(232),A=c(v),E=t(143),b=c(E),x=t(218),D=c(x),C=t(217),S=c(C),F=t(7),w=c(F),B=t(237),T=c(B),_=t(11);n.inherits=_.inherits,n.inspect=_.inspect,r.EXTENSIONS=[".js",".jsx",".es6",".es"]},{11:11,143:143,212:212,217:217,218:218,228:228,229:229,232:232,237:237,55:55,66:66,7:7}],51:[function(t,e,n){e.exports=t(12)},{12:12}],52:[function(t,e,n){e.exports=t(261)},{261:261}],53:[function(t,e,n){e.exports=t(403)},{403:403}],54:[function(t,e,n){e.exports=t(418)},{418:418}],55:[function(t,e,n){e.exports={"default":t(77),__esModule:!0}},{77:77}],56:[function(t,e,n){e.exports={"default":t(78),__esModule:!0}},{78:78}],57:[function(t,e,n){e.exports={"default":t(79),__esModule:!0}},{79:79}],58:[function(t,e,n){e.exports={"default":t(80),__esModule:!0}},{80:80}],59:[function(t,e,n){e.exports={"default":t(81),__esModule:!0}},{81:81}],60:[function(t,e,n){e.exports={"default":t(82),__esModule:!0}},{82:82}],61:[function(t,e,n){e.exports={"default":t(83),__esModule:!0}},{83:83}],62:[function(t,e,n){"use strict";n["default"]=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},n.__esModule=!0},{}],63:[function(t,e,n){"use strict";var r=t(60)["default"],i=t(59)["default"],s=t(58)["default"];n["default"]=function(t,e){for(var n=r(e),a=0;a<n.length;a++){var o=n[a],u=i(e,o);u&&u.configurable&&void 0===t[o]&&s(t,o,u)}return t},n.__esModule=!0},{58:58,59:59,60:60}],64:[function(t,e,n){"use strict";var r=t(57)["default"],i=t(61)["default"];n["default"]=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=r(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(i?i(t,e):t.__proto__=e)},n.__esModule=!0},{57:57,61:61}],65:[function(t,e,n){"use strict";n["default"]=function(t,e){var n=e({},t);return delete n["default"],n},n.__esModule=!0},{}],66:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{15:15}],67:[function(t,e,n){"use strict";n["default"]=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e},n.__esModule=!0},{}],68:[function(t,e,n){"use strict";n["default"]=function(t){return t&&t.__esModule?t["default"]:t},n.__esModule=!0},{}],69:[function(t,e,n){e.exports=t(420)},{420:420}],70:[function(t,e,n){e.exports=t(497)},{497:497}],71:[function(t,e,n){e.exports=t(645)},{645:645}],72:[function(t,e,n){e.exports=t(796)},{796:796}],73:[function(t,e,n){function r(t,e,n){for(var i=0,s={},a=!1,o=0;o<n.length;o++)if(t==n.substr(o,t.length))"start"in s||(s.start=o),i++;else if(e==n.substr(o,e.length)&&"start"in s&&(a=!0,i--,!i))return s.end=o,s.pre=n.substr(0,s.start),s.body=s.end-s.start>1?n.substring(s.start+t.length,s.end):"",s.post=n.slice(s.end+e.length),s;if(i&&a){var u=s.start+t.length;return s=r(t,e,n.substr(u)),s&&(s.start+=u,s.end+=u,s.pre=n.slice(0,u)+s.pre),s}}e.exports=r},{}],74:[function(t,e,n){function r(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function i(t){return t.split("\\\\").join(m).split("\\{").join(y).split("\\}").join(g).split("\\,").join(v).split("\\.").join(A)}function s(t){return t.split(m).join("\\").split(y).join("{").split(g).join("}").split(v).join(",").split(A).join(".")}function a(t){if(!t)return[""];var e=[],n=d("{","}",t);if(!n)return t.split(",");var r=n.pre,i=n.body,s=n.post,o=r.split(",");o[o.length-1]+="{"+i+"}";var u=a(s);return s.length&&(o[o.length-1]+=u.shift(),o.push.apply(o,u)),e.push.apply(e,o),e}function o(t){return t?f(i(t),!0).map(s):[]}function u(t){return"{"+t+"}"}function p(t){return/^-?0\d/.test(t)}function l(t,e){return e>=t}function c(t,e){return t>=e}function f(t,e){var n=[],i=d("{","}",t);if(!i||/\$$/.test(i.pre))return[t];var s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),m=s||o,y=/^(.*,)+(.+)?$/.test(i.body);if(!m&&!y)return i.post.match(/,.*}/)?(t=i.pre+"{"+i.body+g+i.post,f(t)):[t];var v;if(m)v=i.body.split(/\.\./);else if(v=a(i.body),1===v.length&&(v=f(v[0],!1).map(u),1===v.length)){var A=i.post.length?f(i.post,!1):[""];return A.map(function(t){return i.pre+v[0]+t})}var E,b=i.pre,A=i.post.length?f(i.post,!1):[""];if(m){var x=r(v[0]),D=r(v[1]),C=Math.max(v[0].length,v[1].length),S=3==v.length?Math.abs(r(v[2])):1,F=l,w=x>D;w&&(S*=-1,F=c);var B=v.some(p);E=[];for(var T=x;F(T,D);T+=S){var _;if(o)_=String.fromCharCode(T),"\\"===_&&(_="");else if(_=String(T),B){var k=C-_.length;if(k>0){var P=new Array(k+1).join("0");_=0>T?"-"+P+_.slice(1):P+_}}E.push(_)}}else E=h(v,function(t){return f(t,!1)});for(var N=0;N<E.length;N++)for(var I=0;I<A.length;I++){var L=b+E[N]+A[I];(!e||m||L)&&n.push(L)}return n}var h=t(75),d=t(73);e.exports=o;var m="\x00SLASH"+Math.random()+"\x00",y="\x00OPEN"+Math.random()+"\x00",g="\x00CLOSE"+Math.random()+"\x00",v="\x00COMMA"+Math.random()+"\x00",A="\x00PERIOD"+Math.random()+"\x00"},{73:73,75:75}],75:[function(t,e,n){e.exports=function(t,e){for(var n=[],i=0;i<t.length;i++){var s=e(t[i],i);r(s)?n.push.apply(n,s):n.push(s)}return n};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],76:[function(t,e,n){(function(e){"use strict";function r(t){return new e(t,"base64").toString()}function i(t){return t.split(",").pop()}function s(t,e){var n=c.exec(t);c.lastIndex=0;var r=n[1]||n[2],i=p.join(e,r);try{return u.readFileSync(i,"utf8")}catch(s){throw new Error("An error occurred while trying to read the map file at "+i+"\n"+s)}}function a(t,e){e=e||{},e.isFileComment&&(t=s(t,e.commentFileDir)),e.hasComment&&(t=i(t)),e.isEncoded&&(t=r(t)),(e.isJSON||e.isEncoded)&&(t=JSON.parse(t)),this.sourcemap=t}function o(t){for(var e,r=t.split("\n"),i=r.length-1;i>0;i--)if(e=r[i],~e.indexOf("sourceMappingURL=data:"))return n.fromComment(e)}var u=t(2),p=t(7),l=/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+;)?base64,(.*)$/gm,c=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/gm;a.prototype.toJSON=function(t){return JSON.stringify(this.sourcemap,null,t)},a.prototype.toBase64=function(){var t=this.toJSON();return new e(t).toString("base64")},a.prototype.toComment=function(t){var e=this.toBase64(),n="sourceMappingURL=data:application/json;base64,"+e;return t&&t.multiline?"/*# "+n+" */":"//# "+n},a.prototype.toObject=function(){return JSON.parse(this.toJSON())},a.prototype.addProperty=function(t,e){if(this.sourcemap.hasOwnProperty(t))throw new Error("property %s already exists on the sourcemap, use set property instead");return this.setProperty(t,e)},a.prototype.setProperty=function(t,e){return this.sourcemap[t]=e,this},a.prototype.getProperty=function(t){return this.sourcemap[t]},n.fromObject=function(t){return new a(t)},n.fromJSON=function(t){return new a(t,{isJSON:!0})},n.fromBase64=function(t){return new a(t,{isEncoded:!0})},n.fromComment=function(t){return t=t.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),new a(t,{isEncoded:!0,hasComment:!0})},n.fromMapFileComment=function(t,e){return new a(t,{commentFileDir:e,isFileComment:!0,isJSON:!0})},n.fromSource=function(t,e){if(e){var r=o(t);return r?r:null}var i=t.match(l);return l.lastIndex=0,i?n.fromComment(i.pop()):null},n.fromMapFileSource=function(t,e){var r=t.match(c);return c.lastIndex=0,r?n.fromMapFileComment(r.pop(),e):null},n.removeComments=function(t){return l.lastIndex=0,t.replace(l,"")},n.removeMapFileComments=function(t){return c.lastIndex=0,t.replace(c,"")},Object.defineProperty(n,"commentRegex",{get:function(){return l.lastIndex=0,l}}),Object.defineProperty(n,"mapFileCommentRegex",{get:function(){return c.lastIndex=0,c}})}).call(this,t(3).Buffer)},{2:2,3:3,7:7}],77:[function(t,e,n){t(138),t(136),e.exports=t(129)},{129:129,136:136,138:138}],78:[function(t,e,n){t(135),t(136),t(138),t(131),t(137),e.exports=t(92).Map},{131:131,135:135,136:136,137:137,138:138,92:92}],79:[function(t,e,n){var r=t(111);e.exports=function(t,e){return r.create(t,e)}},{111:111}],80:[function(t,e,n){var r=t(111);e.exports=function(t,e,n){return r.setDesc(t,e,n)}},{111:111}],81:[function(t,e,n){var r=t(111);t(132),e.exports=function(t,e){return r.getDesc(t,e)}},{111:111,132:132}],82:[function(t,e,n){var r=t(111);t(133),e.exports=function(t){return r.getNames(t)}},{111:111,133:133}],83:[function(t,e,n){t(134),e.exports=t(92).Object.setPrototypeOf},{134:134,92:92}],84:[function(t,e,n){e.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},{}],85:[function(t,e,n){e.exports=function(){}},{}],86:[function(t,e,n){var r=t(105);e.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},{105:105}],87:[function(t,e,n){var r=t(88),i=t(127)("toStringTag"),s="Arguments"==r(function(){return arguments}());e.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=(e=Object(t))[i])?n:s?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},{127:127,88:88}],88:[function(t,e,n){var r={}.toString;e.exports=function(t){return r.call(t).slice(8,-1)}},{}],89:[function(t,e,n){"use strict";var r=t(111),i=t(102),s=t(115),a=t(93),o=t(121),u=t(94),p=t(98),l=t(108),c=t(109),f=t(126)("id"),h=t(101),d=t(105),m=t(118),y=t(95),g=Object.isExtensible||d,v=y?"_s":"size",A=0,E=function(t,e){if(!d(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!h(t,f)){if(!g(t))return"F";if(!e)return"E";i(t,f,++A)}return"O"+t[f]},b=function(t,e){var n,r=E(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n};e.exports={getConstructor:function(t,e,n,i){var l=t(function(t,s){o(t,l,e),t._i=r.create(null),t._f=void 0,t._l=void 0,t[v]=0,void 0!=s&&p(s,n,t[i],t)});return s(l.prototype,{clear:function(){for(var t=this,e=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete e[n.i];t._f=t._l=void 0,t[v]=0},"delete":function(t){var e=this,n=b(e,t);if(n){var r=n.n,i=n.p;delete e._i[n.i],n.r=!0,i&&(i.n=r),r&&(r.p=i),e._f==n&&(e._f=r),e._l==n&&(e._l=i),e[v]--}return!!n},forEach:function(t){for(var e,n=a(t,arguments.length>1?arguments[1]:void 0,3);e=e?e.n:this._f;)for(n(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!b(this,t)}}),y&&r.setDesc(l.prototype,"size",{get:function(){return u(this[v])}}),l},def:function(t,e,n){var r,i,s=b(t,e);return s?s.v=n:(t._l=s={i:i=E(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=s),r&&(r.n=s),t[v]++,"F"!==i&&(t._i[i]=s)),t},getEntry:b,setStrong:function(t,e,n){l(t,e,function(t,e){this._t=t,this._k=e,this._l=void 0},function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?"keys"==e?c(0,n.k):"values"==e?c(0,n.v):c(0,[n.k,n.v]):(t._t=void 0,c(1))},n?"entries":"values",!n,!0),m(e)}}},{101:101,102:102,105:105,108:108,109:109,111:111,115:115,118:118,121:121,126:126,93:93,94:94,95:95,98:98}],90:[function(t,e,n){var r=t(98),i=t(87);e.exports=function(t){return function(){if(i(this)!=t)throw TypeError(t+"#toJSON isn't generic");var e=[];return r(this,!1,e.push,e),e}}},{87:87,98:98}],91:[function(t,e,n){"use strict";var r=t(111),i=t(100),s=t(96),a=t(97),o=t(102),u=t(115),p=t(98),l=t(121),c=t(105),f=t(119),h=t(95);e.exports=function(t,e,n,d,m,y){var g=i[t],v=g,A=m?"set":"add",E=v&&v.prototype,b={};return h&&"function"==typeof v&&(y||E.forEach&&!a(function(){(new v).entries().next()}))?(v=e(function(e,n){l(e,v,t),e._c=new g,void 0!=n&&p(n,m,e[A],e)}),r.each.call("add,clear,delete,forEach,get,has,set,keys,values,entries".split(","),function(t){var e="add"==t||"set"==t;t in E&&(!y||"clear"!=t)&&o(v.prototype,t,function(n,r){if(!e&&y&&!c(n))return"get"==t?void 0:!1;var i=this._c[t](0===n?0:n,r);return e?this:i})}),"size"in E&&r.setDesc(v.prototype,"size",{get:function(){return this._c.size}})):(v=d.getConstructor(e,t,m,A),u(v.prototype,n)),f(v,t),b[t]=v,s(s.G+s.W+s.F,b),y||d.setStrong(v,t,m),v}},{100:100,102:102,105:105,111:111,115:115,119:119,121:121,95:95,96:96,97:97,98:98}],92:[function(t,e,n){var r=e.exports={version:"1.2.6"};"number"==typeof __e&&(__e=r)},{}],93:[function(t,e,n){var r=t(84);e.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},{84:84}],94:[function(t,e,n){e.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},{}],95:[function(t,e,n){e.exports=!t(97)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{97:97}],96:[function(t,e,n){var r=t(100),i=t(92),s=t(93),a="prototype",o=function(t,e,n){var u,p,l,c=t&o.F,f=t&o.G,h=t&o.S,d=t&o.P,m=t&o.B,y=t&o.W,g=f?i:i[e]||(i[e]={}),v=f?r:h?r[e]:(r[e]||{})[a];f&&(n=e);for(u in n)p=!c&&v&&u in v,p&&u in g||(l=p?v[u]:n[u],g[u]=f&&"function"!=typeof v[u]?n[u]:m&&p?s(l,r):y&&v[u]==l?function(t){var e=function(e){return this instanceof t?new t(e):t(e)};return e[a]=t[a],e}(l):d&&"function"==typeof l?s(Function.call,l):l,d&&((g[a]||(g[a]={}))[u]=l))};o.F=1,o.G=2,o.S=4,o.P=8,o.B=16,o.W=32,e.exports=o},{100:100,92:92,93:93}],97:[function(t,e,n){e.exports=function(t){try{return!!t()}catch(e){return!0}}},{}],98:[function(t,e,n){var r=t(93),i=t(106),s=t(104),a=t(86),o=t(125),u=t(128);e.exports=function(t,e,n,p){var l,c,f,h=u(t),d=r(n,p,e?2:1),m=0;if("function"!=typeof h)throw TypeError(t+" is not iterable!");if(s(h))for(l=o(t.length);l>m;m++)e?d(a(c=t[m])[0],c[1]):d(t[m]);else for(f=h.call(t);!(c=f.next()).done;)i(f,d,c.value,e)}},{104:104,106:106,125:125,128:128,86:86,93:93}],99:[function(t,e,n){var r=t(124),i=t(111).getNames,s={}.toString,a="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],o=function(t){try{return i(t)}catch(e){return a.slice()}};e.exports.get=function(t){return a&&"[object Window]"==s.call(t)?o(t):i(r(t))}},{111:111,124:124}],100:[function(t,e,n){var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},{}],101:[function(t,e,n){var r={}.hasOwnProperty;e.exports=function(t,e){return r.call(t,e)}},{}],102:[function(t,e,n){var r=t(111),i=t(114);e.exports=t(95)?function(t,e,n){return r.setDesc(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},{111:111,114:114,95:95}],103:[function(t,e,n){var r=t(88);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},{88:88}],104:[function(t,e,n){var r=t(110),i=t(127)("iterator"),s=Array.prototype;e.exports=function(t){return void 0!==t&&(r.Array===t||s[i]===t)}},{110:110,127:127}],105:[function(t,e,n){e.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},{}],106:[function(t,e,n){var r=t(86);e.exports=function(t,e,n,i){try{return i?e(r(n)[0],n[1]):e(n)}catch(s){var a=t["return"];throw void 0!==a&&r(a.call(t)),s}}},{86:86}],107:[function(t,e,n){"use strict";var r=t(111),i=t(114),s=t(119),a={};t(102)(a,t(127)("iterator"),function(){return this}),e.exports=function(t,e,n){t.prototype=r.create(a,{next:i(1,n)}),s(t,e+" Iterator")}},{102:102,111:111,114:114,119:119,127:127}],108:[function(t,e,n){"use strict";var r=t(112),i=t(96),s=t(116),a=t(102),o=t(101),u=t(110),p=t(107),l=t(119),c=t(111).getProto,f=t(127)("iterator"),h=!([].keys&&"next"in[].keys()),d="@@iterator",m="keys",y="values",g=function(){return this};e.exports=function(t,e,n,v,A,E,b){p(n,e,v);var x,D,C=function(t){if(!h&&t in B)return B[t];switch(t){case m:return function(){return new n(this,t)};case y:return function(){return new n(this,t)}}return function(){return new n(this,t)}},S=e+" Iterator",F=A==y,w=!1,B=t.prototype,T=B[f]||B[d]||A&&B[A],_=T||C(A);if(T){var k=c(_.call(new t));l(k,S,!0),!r&&o(B,d)&&a(k,f,g),F&&T.name!==y&&(w=!0,_=function(){return T.call(this)})}if(r&&!b||!h&&!w&&B[f]||a(B,f,_),u[e]=_,u[S]=g,A)if(x={values:F?_:C(y),keys:E?_:C(m),entries:F?C("entries"):_},b)for(D in x)D in B||s(B,D,x[D]);else i(i.P+i.F*(h||w),e,x);return x}},{101:101,102:102,107:107,110:110,111:111,112:112,116:116,119:119,127:127,96:96}],109:[function(t,e,n){e.exports=function(t,e){return{value:e,done:!!t}}},{}],110:[function(t,e,n){e.exports={}},{}],111:[function(t,e,n){var r=Object;e.exports={create:r.create,getProto:r.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:r.getOwnPropertyDescriptor,setDesc:r.defineProperty,setDescs:r.defineProperties,getKeys:r.keys,getNames:r.getOwnPropertyNames,getSymbols:r.getOwnPropertySymbols,each:[].forEach}},{}],112:[function(t,e,n){e.exports=!0},{}],113:[function(t,e,n){var r=t(96),i=t(92),s=t(97);e.exports=function(t,e){var n=(i.Object||{})[t]||Object[t],a={};a[t]=e(n),r(r.S+r.F*s(function(){n(1)}),"Object",a)}},{92:92,96:96,97:97}],114:[function(t,e,n){e.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},{}],115:[function(t,e,n){var r=t(116);e.exports=function(t,e){for(var n in e)r(t,n,e[n]);return t}},{116:116}],116:[function(t,e,n){e.exports=t(102)},{102:102}],117:[function(t,e,n){var r=t(111).getDesc,i=t(105),s=t(86),a=function(t,e){if(s(t),!i(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,n,i){try{i=t(93)(Function.call,r(Object.prototype,"__proto__").set,2),i(e,[]),n=!(e instanceof Array)}catch(s){n=!0}return function(t,e){return a(t,e),n?t.__proto__=e:i(t,e),t}}({},!1):void 0),check:a}},{105:105,111:111,86:86,93:93}],118:[function(t,e,n){"use strict";var r=t(92),i=t(111),s=t(95),a=t(127)("species");e.exports=function(t){var e=r[t];s&&e&&!e[a]&&i.setDesc(e,a,{configurable:!0,get:function(){return this}})}},{111:111,127:127,92:92,95:95}],119:[function(t,e,n){var r=t(111).setDesc,i=t(101),s=t(127)("toStringTag");e.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,s)&&r(t,s,{configurable:!0,value:e})}},{101:101,111:111,127:127}],120:[function(t,e,n){var r=t(100),i="__core-js_shared__",s=r[i]||(r[i]={});e.exports=function(t){return s[t]||(s[t]={})}},{100:100}],121:[function(t,e,n){e.exports=function(t,e,n){if(!(t instanceof e))throw TypeError(n+": use the 'new' operator!");return t}},{}],122:[function(t,e,n){var r=t(123),i=t(94);e.exports=function(t){return function(e,n){var s,a,o=String(i(e)),u=r(n),p=o.length;return 0>u||u>=p?t?"":void 0:(s=o.charCodeAt(u),55296>s||s>56319||u+1===p||(a=o.charCodeAt(u+1))<56320||a>57343?t?o.charAt(u):s:t?o.slice(u,u+2):(s-55296<<10)+(a-56320)+65536)}}},{123:123,94:94}],123:[function(t,e,n){var r=Math.ceil,i=Math.floor;e.exports=function(t){return isNaN(t=+t)?0:(t>0?i:r)(t)}},{}],124:[function(t,e,n){var r=t(103),i=t(94);e.exports=function(t){return r(i(t))}},{103:103,94:94}],125:[function(t,e,n){var r=t(123),i=Math.min;e.exports=function(t){return t>0?i(r(t),9007199254740991):0}},{123:123}],126:[function(t,e,n){var r=0,i=Math.random();e.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+i).toString(36))}},{}],127:[function(t,e,n){var r=t(120)("wks"),i=t(126),s=t(100).Symbol;e.exports=function(t){return r[t]||(r[t]=s&&s[t]||(s||i)("Symbol."+t))}},{100:100,120:120,126:126}],128:[function(t,e,n){var r=t(87),i=t(127)("iterator"),s=t(110);e.exports=t(92).getIteratorMethod=function(t){return void 0!=t?t[i]||t["@@iterator"]||s[r(t)]:void 0}},{110:110,127:127,87:87,92:92}],129:[function(t,e,n){var r=t(86),i=t(128);e.exports=t(92).getIterator=function(t){var e=i(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return r(e.call(t))}},{128:128,86:86,92:92}],130:[function(t,e,n){"use strict";var r=t(85),i=t(109),s=t(110),a=t(124);e.exports=t(108)(Array,"Array",function(t,e){this._t=a(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,i(1)):"keys"==e?i(0,n):"values"==e?i(0,t[n]):i(0,[n,t[n]])},"values"),s.Arguments=s.Array,r("keys"),r("values"),r("entries")},{108:108,109:109,110:110,124:124,85:85}],131:[function(t,e,n){"use strict";var r=t(89);t(91)("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var e=r.getEntry(this,t);return e&&e.v},set:function(t,e){return r.def(this,0===t?0:t,e)}},r,!0)},{89:89,91:91}],132:[function(t,e,n){var r=t(124);t(113)("getOwnPropertyDescriptor",function(t){return function(e,n){return t(r(e),n)}})},{113:113,124:124}],133:[function(t,e,n){t(113)("getOwnPropertyNames",function(){return t(99).get})},{113:113,99:99}],134:[function(t,e,n){var r=t(96);r(r.S,"Object",{setPrototypeOf:t(117).set})},{117:117,96:96}],135:[function(t,e,n){arguments[4][2][0].apply(n,arguments)},{2:2}],136:[function(t,e,n){"use strict";var r=t(122)(!0);t(108)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},{108:108,122:122}],137:[function(t,e,n){var r=t(96);r(r.P,"Map",{toJSON:t(90)("Map")})},{90:90,96:96}],138:[function(t,e,n){t(130);var r=t(110);r.NodeList=r.HTMLCollection=r.Array},{110:110,130:130}],139:[function(t,e,n){function r(){return n.colors[l++%n.colors.length]}function i(t){function e(){}function i(){var t=i,e=+new Date,s=e-(p||e);t.diff=s,t.prev=p,t.curr=e,p=e,null==t.useColors&&(t.useColors=n.useColors()),null==t.color&&t.useColors&&(t.color=r());var a=Array.prototype.slice.call(arguments);a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var o=0;a[0]=a[0].replace(/%([a-z%])/g,function(e,r){if("%%"===e)return e;o++;var i=n.formatters[r];if("function"==typeof i){var s=a[o];e=i.call(t,s),a.splice(o,1),o--}return e}),"function"==typeof n.formatArgs&&(a=n.formatArgs.apply(t,a));var u=i.log||n.log||console.log.bind(console);u.apply(t,a)}e.enabled=!1,i.enabled=!0;var s=n.enabled(t)?i:e;return s.namespace=t,s}function s(t){n.save(t);for(var e=(t||"").split(/[\s,]+/),r=e.length,i=0;r>i;i++)e[i]&&(t=e[i].replace(/\*/g,".*?"),"-"===t[0]?n.skips.push(new RegExp("^"+t.substr(1)+"$")):n.names.push(new RegExp("^"+t+"$")))}function a(){n.enable("")}function o(t){var e,r;for(e=0,r=n.skips.length;r>e;e++)if(n.skips[e].test(t))return!1;for(e=0,r=n.names.length;r>e;e++)if(n.names[e].test(t))return!0;return!1}function u(t){return t instanceof Error?t.stack||t.message:t}n=e.exports=i,n.coerce=u,n.disable=a,n.enable=s,n.enabled=o,n.humanize=t(233),n.names=[],n.skips=[],n.formatters={};var p,l=0},{233:233}],140:[function(t,e,n){(function(r){function i(){var t=(r.env.DEBUG_COLORS||"").trim().toLowerCase();return 0===t.length?l.isatty(f):"0"!==t&&"no"!==t&&"false"!==t&&"disabled"!==t}function s(){var t=arguments,e=this.useColors,r=this.namespace;if(e){var i=this.color;t[0]=" [3"+i+";1m"+r+" [0m"+t[0]+"[3"+i+"m +"+n.humanize(this.diff)+"[0m"}else t[0]=(new Date).toUTCString()+" "+r+" "+t[0];return t}function a(){return h.write(c.format.apply(this,arguments)+"\n")}function o(t){null==t?delete r.env.DEBUG:r.env.DEBUG=t}function u(){return r.env.DEBUG}function p(e){var n,i=r.binding("tty_wrap");switch(i.guessHandleType(e)){case"TTY":n=new l.WriteStream(e),n._type="tty",n._handle&&n._handle.unref&&n._handle.unref();break;case"FILE":var s=t(2);n=new s.SyncWriteStream(e,{autoClose:!1}),n._type="fs";break;case"PIPE":case"TCP":var a=t(2);n=new a.Socket({fd:e,readable:!1,writable:!0}),n.readable=!1,n.read=null,n._type="pipe",n._handle&&n._handle.unref&&n._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return n.fd=e,n._isStdio=!0,n}var l=t(9),c=t(11);n=e.exports=t(139),n.log=a,n.formatArgs=s,n.save=o,n.load=u,n.useColors=i,n.colors=[6,2,3,4,5,1];var f=parseInt(r.env.DEBUG_FD,10)||2,h=1===f?r.stdout:2===f?r.stderr:p(f),d=4===c.inspect.length?function(t,e){return c.inspect(t,void 0,void 0,e)}:function(t,e){return c.inspect(t,{colors:e})};n.formatters.o=function(t){return d(t,this.useColors).replace(/\s*\n\s*/g," ")},n.enable(u())}).call(this,t(8))},{11:11,139:139,2:2,8:8,9:9}],141:[function(t,e,n){var r="object"==typeof n?n:{};r.parse=function(){"use strict";var t,e,n,r,i={"'":"'",'"':'"',"\\":"\\","/":"/","\n":"",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},s=[" "," ","\r","\n","","\f"," ","\ufeff"],a=function(e){var r=new SyntaxError;throw r.message=e,r.at=t,r.text=n,r},o=function(r){return r&&r!==e&&a("Expected '"+r+"' instead of '"+e+"'"),e=n.charAt(t),t+=1,e},u=function(){return n.charAt(t)},p=function(){var t=e;for("_"!==e&&"$"!==e&&("a">e||e>"z")&&("A">e||e>"Z")&&a("Bad identifier");o()&&("_"===e||"$"===e||e>="a"&&"z">=e||e>="A"&&"Z">=e||e>="0"&&"9">=e);)t+=e;return t},l=function(){var t,n="",r="",i=10;if(("-"===e||"+"===e)&&(n=e,o(e)),"I"===e)return t=y(),("number"!=typeof t||isNaN(t))&&a("Unexpected word for number"),"-"===n?-t:t;if("N"===e)return t=y(),isNaN(t)||a("expected word to be NaN"),t;switch("0"===e&&(r+=e,o(),"x"===e||"X"===e?(r+=e,o(),i=16):e>="0"&&"9">=e&&a("Octal literal")),i){case 10:for(;e>="0"&&"9">=e;)r+=e,o();if("."===e)for(r+=".";o()&&e>="0"&&"9">=e;)r+=e;if("e"===e||"E"===e)for(r+=e,o(),("-"===e||"+"===e)&&(r+=e,o());e>="0"&&"9">=e;)r+=e,o();break;case 16:for(;e>="0"&&"9">=e||e>="A"&&"F">=e||e>="a"&&"f">=e;)r+=e,o()}return t="-"===n?-r:+r,isFinite(t)?t:void a("Bad number")},c=function(){var t,n,r,s,p="";if('"'===e||"'"===e)for(r=e;o();){if(e===r)return o(),p;if("\\"===e)if(o(),"u"===e){for(s=0,n=0;4>n&&(t=parseInt(o(),16),isFinite(t));n+=1)s=16*s+t;p+=String.fromCharCode(s)}else if("\r"===e)"\n"===u()&&o();else{if("string"!=typeof i[e])break;p+=i[e]}else{if("\n"===e)break;p+=e}}a("Bad string")},f=function(){"/"!==e&&a("Not an inline comment");do if(o(),"\n"===e||"\r"===e)return void o();while(e)},h=function(){"*"!==e&&a("Not a block comment");do for(o();"*"===e;)if(o("*"),"/"===e)return void o("/");while(e);a("Unterminated block comment")},d=function(){"/"!==e&&a("Not a comment"),o("/"),"/"===e?f():"*"===e?h():a("Unrecognized comment")},m=function(){for(;e;)if("/"===e)d();else{if(!(s.indexOf(e)>=0))return;o()}},y=function(){switch(e){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null;case"I":return o("I"),o("n"),o("f"),o("i"),o("n"),o("i"),o("t"),o("y"),1/0;case"N":return o("N"),o("a"),o("N"),NaN}a("Unexpected '"+e+"'")},g=function(){var t=[];if("["===e)for(o("["),m();e;){if("]"===e)return o("]"),t;if(","===e?a("Missing array element"):t.push(r()),m(),","!==e)return o("]"),t;o(","),m()}a("Bad array")},v=function(){var t,n={};if("{"===e)for(o("{"),m();e;){if("}"===e)return o("}"),n;if(t='"'===e||"'"===e?c():p(),m(),o(":"),n[t]=r(),m(),","!==e)return o("}"),n;o(","),m()}a("Bad object")};return r=function(){switch(m(),e){case"{":return v();case"[":return g();case'"':case"'":return c();case"-":case"+":case".":return l();default:return e>="0"&&"9">=e?l():y()}},function(i,s){var o;return n=String(i),t=0,e=" ",o=r(),m(),e&&a("Syntax error"),"function"==typeof s?function u(t,e){var n,r,i=t[e];if(i&&"object"==typeof i)for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r=u(i,n),void 0!==r?i[n]=r:delete i[n]);return s.call(t,e,i)}({"":o},""):o}}(),r.stringify=function(t,e,n){function i(t){return t>="a"&&"z">=t||t>="A"&&"Z">=t||t>="0"&&"9">=t||"_"===t||"$"===t}function s(t){return t>="a"&&"z">=t||t>="A"&&"Z">=t||"_"===t||"$"===t}function a(t){if("string"!=typeof t)return!1;if(!s(t[0]))return!1;for(var e=1,n=t.length;n>e;){if(!i(t[e]))return!1;e++}return!0}function o(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}function u(t){return"[object Date]"===Object.prototype.toString.call(t)}function p(t){for(var e=0;e<m.length;e++)if(m[e]===t)throw new TypeError("Converting circular structure to JSON")}function l(t,e,n){if(!t)return"";t.length>10&&(t=t.substring(0,10));for(var r=n?"":"\n",i=0;e>i;i++)r+=t;return r}function c(t){return y.lastIndex=0,y.test(t)?'"'+t.replace(y,function(t){var e=g[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function f(t,e,n){var r,i,s=h(t,e,n);switch(s&&!u(s)&&(s=s.valueOf()),typeof s){case"boolean":return s.toString();case"number":return isNaN(s)||!isFinite(s)?"null":s.toString();case"string":return c(s.toString());case"object":if(null===s)return"null";if(o(s)){p(s),r="[",m.push(s);for(var y=0;y<s.length;y++)i=f(s,y,!1),r+=l(d,m.length),r+=null===i||"undefined"==typeof i?"null":i,y<s.length-1?r+=",":d&&(r+="\n");m.pop(),r+=l(d,m.length,!0)+"]"}else{p(s),r="{";var g=!1;m.push(s);for(var v in s)if(s.hasOwnProperty(v)){var A=f(s,v,!1);if(n=!1,"undefined"!=typeof A&&null!==A){r+=l(d,m.length),g=!0;var e=a(v)?v:c(v);r+=e+":"+(d?" ":"")+A+","}}m.pop(),r=g?r.substring(0,r.length-1)+l(d,m.length)+"}":"{}"}return r;default:return void 0}}if(e&&"function"!=typeof e&&!o(e))throw new Error("Replacer must be a function or an array");var h=function(t,n,r){var i=t[n];return i&&i.toJSON&&"function"==typeof i.toJSON&&(i=i.toJSON()),"function"==typeof e?e.call(t,n,i):e?r||o(t)||e.indexOf(n)>=0?i:void 0:i};r.isWord=a,isNaN=isNaN||function(t){return"number"==typeof t&&t!==t};var d,m=[];n&&("string"==typeof n?d=n:"number"==typeof n&&n>=0&&(d=l(" ",n,!0)));
var y=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},v={"":t};return void 0===t?h(v,"",!0):f(v,"",!0)}},{}],142:[function(t,e,n){function r(t){var e=t?t.length:0;return e?t[e-1]:void 0}e.exports=r},{}],143:[function(t,e,n){e.exports=t(146)},{146:146}],144:[function(t,e,n){e.exports=t(145)},{145:145}],145:[function(t,e,n){var r=t(150),i=t(159),s=t(186),a=s(r,i);e.exports=a},{150:150,159:159,186:186}],146:[function(t,e,n){function r(t,e,n,r){var f=t?s(t):0;return u(f)||(t=l(t),f=t.length),n="number"!=typeof n||r&&o(e,n,r)?0:0>n?c(f+n,0):n||0,"string"==typeof t||!a(t)&&p(t)?f>=n&&t.indexOf(e,n)>-1:!!f&&i(t,e,n)>-1}var i=t(164),s=t(191),a=t(211),o=t(200),u=t(202),p=t(218),l=t(227),c=Math.max;e.exports=r},{164:164,191:191,200:200,202:202,211:211,218:218,227:227}],147:[function(t,e,n){function r(t,e,n){if(null==t)return[];n&&u(t,e,n)&&(e=void 0);var r=-1;e=i(e,n,3);var p=s(t,function(t,n,i){return{criteria:e(t,n,i),index:++r,value:t}});return a(p,o)}var i=t(155),s=t(168),a=t(176),o=t(181),u=t(200);e.exports=r},{155:155,168:168,176:176,181:181,200:200}],148:[function(t,e,n){function r(t,e){if("function"!=typeof t)throw new TypeError(i);return e=s(void 0===e?t.length-1:+e||0,0),function(){for(var n=arguments,r=-1,i=s(n.length-e,0),a=Array(i);++r<i;)a[r]=n[e+r];switch(e){case 0:return t.call(this,a);case 1:return t.call(this,n[0],a);case 2:return t.call(this,n[0],n[1],a)}var o=Array(e+1);for(r=-1;++r<e;)o[r]=n[r];return o[e]=a,t.apply(this,o)}}var i="Expected a function",s=Math.max;e.exports=r},{}],149:[function(t,e,n){function r(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}e.exports=r},{}],150:[function(t,e,n){function r(t,e){for(var n=-1,r=t.length;++n<r&&e(t[n],n,t)!==!1;);return t}e.exports=r},{}],151:[function(t,e,n){function r(t,e){for(var n=-1,r=t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}e.exports=r},{}],152:[function(t,e,n){function r(t,e){return void 0===t?e:t}e.exports=r},{}],153:[function(t,e,n){function r(t,e,n){for(var r=-1,s=i(e),a=s.length;++r<a;){var o=s[r],u=t[o],p=n(u,e[o],o,t,e);(p===p?p===u:u!==u)&&(void 0!==u||o in t)||(t[o]=p)}return t}var i=t(223);e.exports=r},{223:223}],154:[function(t,e,n){function r(t,e){return null==e?t:i(e,s(e),t)}var i=t(158),s=t(223);e.exports=r},{158:158,223:223}],155:[function(t,e,n){function r(t,e,n){var r=typeof t;return"function"==r?void 0===e?t:a(t,e,n):null==t?o:"object"==r?i(t):void 0===e?u(t):s(t,e)}var i=t(169),s=t(170),a=t(179),o=t(230),u=t(231);e.exports=r},{169:169,170:170,179:179,230:230,231:231}],156:[function(t,e,n){function r(t,e,n,d,m,y,g){var A;if(n&&(A=m?n(t,d,m):n(t)),void 0!==A)return A;if(!f(t))return t;var E=c(t);if(E){if(A=u(t),!e)return i(t,A)}else{var x=R.call(t),D=x==v;if(x!=b&&x!=h&&(!D||m))return O[x]?p(t,x,e):m?t:{};if(A=l(D?{}:t),!e)return a(A,t)}y||(y=[]),g||(g=[]);for(var C=y.length;C--;)if(y[C]==t)return g[C];return y.push(t),g.push(A),(E?s:o)(t,function(i,s){A[s]=r(i,e,n,s,t,y,g)}),A}var i=t(149),s=t(150),a=t(154),o=t(162),u=t(195),p=t(196),l=t(197),c=t(211),f=t(215),h="[object Arguments]",d="[object Array]",m="[object Boolean]",y="[object Date]",g="[object Error]",v="[object Function]",A="[object Map]",E="[object Number]",b="[object Object]",x="[object RegExp]",D="[object Set]",C="[object String]",S="[object WeakMap]",F="[object ArrayBuffer]",w="[object Float32Array]",B="[object Float64Array]",T="[object Int8Array]",_="[object Int16Array]",k="[object Int32Array]",P="[object Uint8Array]",N="[object Uint8ClampedArray]",I="[object Uint16Array]",L="[object Uint32Array]",O={};O[h]=O[d]=O[F]=O[m]=O[y]=O[w]=O[B]=O[T]=O[_]=O[k]=O[E]=O[b]=O[x]=O[C]=O[P]=O[N]=O[I]=O[L]=!0,O[g]=O[v]=O[A]=O[D]=O[S]=!1;var M=Object.prototype,R=M.toString;e.exports=r},{149:149,150:150,154:154,162:162,195:195,196:196,197:197,211:211,215:215}],157:[function(t,e,n){function r(t,e){if(t!==e){var n=null===t,r=void 0===t,i=t===t,s=null===e,a=void 0===e,o=e===e;if(t>e&&!s||!i||n&&!a&&o||r&&o)return 1;if(e>t&&!n||!o||s&&!r&&i||a&&i)return-1}return 0}e.exports=r},{}],158:[function(t,e,n){function r(t,e,n){n||(n={});for(var r=-1,i=e.length;++r<i;){var s=e[r];n[s]=t[s]}return n}e.exports=r},{}],159:[function(t,e,n){var r=t(162),i=t(183),s=i(r);e.exports=s},{162:162,183:183}],160:[function(t,e,n){var r=t(184),i=r();e.exports=i},{184:184}],161:[function(t,e,n){function r(t,e){return i(t,e,s)}var i=t(160),s=t(224);e.exports=r},{160:160,224:224}],162:[function(t,e,n){function r(t,e){return i(t,e,s)}var i=t(160),s=t(223);e.exports=r},{160:160,223:223}],163:[function(t,e,n){function r(t,e,n){if(null!=t){void 0!==n&&n in i(t)&&(e=[n]);for(var r=0,s=e.length;null!=t&&s>r;)t=t[e[r++]];return r&&r==s?t:void 0}}var i=t(206);e.exports=r},{206:206}],164:[function(t,e,n){function r(t,e,n){if(e!==e)return i(t,n);for(var r=n-1,s=t.length;++r<s;)if(t[r]===e)return r;return-1}var i=t(194);e.exports=r},{194:194}],165:[function(t,e,n){function r(t,e,n,o,u,p){return t===e?!0:null==t||null==e||!s(t)&&!a(e)?t!==t&&e!==e:i(t,e,r,n,o,u,p)}var i=t(166),s=t(215),a=t(203);e.exports=r},{166:166,203:203,215:215}],166:[function(t,e,n){function r(t,e,n,r,f,m,y){var g=o(t),v=o(e),A=l,E=l;g||(A=d.call(t),A==p?A=c:A!=c&&(g=u(t))),v||(E=d.call(e),E==p?E=c:E!=c&&(v=u(e)));var b=A==c,x=E==c,D=A==E;if(D&&!g&&!b)return s(t,e,A);if(!f){var C=b&&h.call(t,"__wrapped__"),S=x&&h.call(e,"__wrapped__");if(C||S)return n(C?t.value():t,S?e.value():e,r,f,m,y)}if(!D)return!1;m||(m=[]),y||(y=[]);for(var F=m.length;F--;)if(m[F]==t)return y[F]==e;m.push(t),y.push(e);var w=(g?i:a)(t,e,n,r,f,m,y);return m.pop(),y.pop(),w}var i=t(187),s=t(188),a=t(189),o=t(211),u=t(219),p="[object Arguments]",l="[object Array]",c="[object Object]",f=Object.prototype,h=f.hasOwnProperty,d=f.toString;e.exports=r},{187:187,188:188,189:189,211:211,219:219}],167:[function(t,e,n){function r(t,e,n){var r=e.length,a=r,o=!n;if(null==t)return!a;for(t=s(t);r--;){var u=e[r];if(o&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++r<a;){u=e[r];var p=u[0],l=t[p],c=u[1];if(o&&u[2]){if(void 0===l&&!(p in t))return!1}else{var f=n?n(l,c,p):void 0;if(!(void 0===f?i(c,l,n,!0):f))return!1}}return!0}var i=t(165),s=t(206);e.exports=r},{165:165,206:206}],168:[function(t,e,n){function r(t,e){var n=-1,r=s(t)?Array(t.length):[];return i(t,function(t,i,s){r[++n]=e(t,i,s)}),r}var i=t(159),s=t(198);e.exports=r},{159:159,198:198}],169:[function(t,e,n){function r(t){var e=s(t);if(1==e.length&&e[0][2]){var n=e[0][0],r=e[0][1];return function(t){return null==t?!1:t[n]===r&&(void 0!==r||n in a(t))}}return function(t){return i(t,e)}}var i=t(167),s=t(192),a=t(206);e.exports=r},{167:167,192:192,206:206}],170:[function(t,e,n){function r(t,e){var n=o(t),r=u(t)&&p(e),h=t+"";return t=f(t),function(o){if(null==o)return!1;var u=h;if(o=c(o),(n||!r)&&!(u in o)){if(o=1==t.length?o:i(o,a(t,0,-1)),null==o)return!1;u=l(t),o=c(o)}return o[u]===e?void 0!==e||u in o:s(e,o[u],void 0,!0)}}var i=t(163),s=t(165),a=t(175),o=t(211),u=t(201),p=t(204),l=t(142),c=t(206),f=t(207);e.exports=r},{142:142,163:163,165:165,175:175,201:201,204:204,206:206,207:207,211:211}],171:[function(t,e,n){function r(t,e,n,f,h){if(!u(t))return t;var d=o(e)&&(a(e)||l(e)),m=d?void 0:c(e);return i(m||e,function(i,a){if(m&&(a=i,i=e[a]),p(i))f||(f=[]),h||(h=[]),s(t,e,a,r,n,f,h);else{var o=t[a],u=n?n(o,i,a,t,e):void 0,l=void 0===u;l&&(u=i),void 0===u&&(!d||a in t)||!l&&(u===u?u===o:o!==o)||(t[a]=u)}}),t}var i=t(150),s=t(172),a=t(211),o=t(198),u=t(215),p=t(203),l=t(219),c=t(223);e.exports=r},{150:150,172:172,198:198,203:203,211:211,215:215,219:219,223:223}],172:[function(t,e,n){function r(t,e,n,r,c,f,h){for(var d=f.length,m=e[n];d--;)if(f[d]==m)return void(t[n]=h[d]);var y=t[n],g=c?c(y,m,n,t,e):void 0,v=void 0===g;v&&(g=m,o(m)&&(a(m)||p(m))?g=a(y)?y:o(y)?i(y):[]:u(m)||s(m)?g=s(y)?l(y):u(y)?y:{}:v=!1),f.push(m),h.push(g),v?t[n]=r(g,m,c,f,h):(g===g?g!==y:y===y)&&(t[n]=g)}var i=t(149),s=t(210),a=t(211),o=t(198),u=t(216),p=t(219),l=t(220);e.exports=r},{149:149,198:198,210:210,211:211,216:216,219:219,220:220}],173:[function(t,e,n){function r(t){return function(e){return null==e?void 0:e[t]}}e.exports=r},{}],174:[function(t,e,n){function r(t){var e=t+"";return t=s(t),function(n){return i(n,t,e)}}var i=t(163),s=t(207);e.exports=r},{163:163,207:207}],175:[function(t,e,n){function r(t,e,n){var r=-1,i=t.length;e=null==e?0:+e||0,0>e&&(e=-e>i?0:i+e),n=void 0===n||n>i?i:+n||0,0>n&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}e.exports=r},{}],176:[function(t,e,n){function r(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}e.exports=r},{}],177:[function(t,e,n){function r(t){return null==t?"":t+""}e.exports=r},{}],178:[function(t,e,n){function r(t,e){for(var n=-1,r=e.length,i=Array(r);++n<r;)i[n]=t[e[n]];return i}e.exports=r},{}],179:[function(t,e,n){function r(t,e,n){if("function"!=typeof t)return i;if(void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 3:return function(n,r,i){return t.call(e,n,r,i)};case 4:return function(n,r,i,s){return t.call(e,n,r,i,s)};case 5:return function(n,r,i,s,a){return t.call(e,n,r,i,s,a)}}return function(){return t.apply(e,arguments)}}var i=t(230);e.exports=r},{230:230}],180:[function(t,e,n){(function(t){function n(t){var e=new r(t.byteLength),n=new i(e);return n.set(new i(t)),e}var r=t.ArrayBuffer,i=t.Uint8Array;e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],181:[function(t,e,n){function r(t,e){return i(t.criteria,e.criteria)||t.index-e.index}var i=t(157);e.exports=r},{157:157}],182:[function(t,e,n){function r(t){return a(function(e,n){var r=-1,a=null==e?0:n.length,o=a>2?n[a-2]:void 0,u=a>2?n[2]:void 0,p=a>1?n[a-1]:void 0;for("function"==typeof o?(o=i(o,p,5),a-=2):(o="function"==typeof p?p:void 0,a-=o?1:0),u&&s(n[0],n[1],u)&&(o=3>a?void 0:o,a=1);++r<a;){var l=n[r];l&&t(e,l,o)}return e})}var i=t(179),s=t(200),a=t(148);e.exports=r},{148:148,179:179,200:200}],183:[function(t,e,n){function r(t,e){return function(n,r){var o=n?i(n):0;if(!s(o))return t(n,r);for(var u=e?o:-1,p=a(n);(e?u--:++u<o)&&r(p[u],u,p)!==!1;);return n}}var i=t(191),s=t(202),a=t(206);e.exports=r},{191:191,202:202,206:206}],184:[function(t,e,n){function r(t){return function(e,n,r){for(var s=i(e),a=r(e),o=a.length,u=t?o:-1;t?u--:++u<o;){var p=a[u];if(n(s[p],p,s)===!1)break}return e}}var i=t(206);e.exports=r},{206:206}],185:[function(t,e,n){function r(t,e){return i(function(n){var r=n[0];return null==r?r:(n.push(e),t.apply(void 0,n))})}var i=t(148);e.exports=r},{148:148}],186:[function(t,e,n){function r(t,e){return function(n,r,a){return"function"==typeof r&&void 0===a&&s(n)?t(n,r):e(n,i(r,a,3))}}var i=t(179),s=t(211);e.exports=r},{179:179,211:211}],187:[function(t,e,n){function r(t,e,n,r,s,a,o){var u=-1,p=t.length,l=e.length;if(p!=l&&!(s&&l>p))return!1;for(;++u<p;){var c=t[u],f=e[u],h=r?r(s?f:c,s?c:f,u):void 0;if(void 0!==h){if(h)continue;return!1}if(s){if(!i(e,function(t){return c===t||n(c,t,r,s,a,o)}))return!1}else if(c!==f&&!n(c,f,r,s,a,o))return!1}return!0}var i=t(151);e.exports=r},{151:151}],188:[function(t,e,n){function r(t,e,n){switch(n){case i:case s:return+t==+e;case a:return t.name==e.name&&t.message==e.message;case o:return t!=+t?e!=+e:t==+e;case u:case p:return t==e+""}return!1}var i="[object Boolean]",s="[object Date]",a="[object Error]",o="[object Number]",u="[object RegExp]",p="[object String]";e.exports=r},{}],189:[function(t,e,n){function r(t,e,n,r,s,o,u){var p=i(t),l=p.length,c=i(e),f=c.length;if(l!=f&&!s)return!1;for(var h=l;h--;){var d=p[h];if(!(s?d in e:a.call(e,d)))return!1}for(var m=s;++h<l;){d=p[h];var y=t[d],g=e[d],v=r?r(s?g:y,s?y:g,d):void 0;if(!(void 0===v?n(y,g,r,s,o,u):v))return!1;m||(m="constructor"==d)}if(!m){var A=t.constructor,E=e.constructor;if(A!=E&&"constructor"in t&&"constructor"in e&&!("function"==typeof A&&A instanceof A&&"function"==typeof E&&E instanceof E))return!1}return!0}var i=t(223),s=Object.prototype,a=s.hasOwnProperty;e.exports=r},{223:223}],190:[function(t,e,n){function r(t,e,n){return e?t=i[t]:n&&(t=s[t]),"\\"+t}var i={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},s={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};e.exports=r},{}],191:[function(t,e,n){var r=t(173),i=r("length");e.exports=i},{173:173}],192:[function(t,e,n){function r(t){for(var e=s(t),n=e.length;n--;)e[n][2]=i(e[n][1]);return e}var i=t(204),s=t(226);e.exports=r},{204:204,226:226}],193:[function(t,e,n){function r(t,e){var n=null==t?void 0:t[e];return i(n)?n:void 0}var i=t(214);e.exports=r},{214:214}],194:[function(t,e,n){function r(t,e,n){for(var r=t.length,i=e+(n?0:-1);n?i--:++i<r;){var s=t[i];if(s!==s)return i}return-1}e.exports=r},{}],195:[function(t,e,n){function r(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&s.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var i=Object.prototype,s=i.hasOwnProperty;e.exports=r},{}],196:[function(t,e,n){function r(t,e,n){var r=t.constructor;switch(e){case l:return i(t);case s:case a:return new r(+t);case c:case f:case h:case d:case m:case y:case g:case v:case A:var b=t.buffer;return new r(n?i(b):b,t.byteOffset,t.length);case o:case p:return new r(t);case u:var x=new r(t.source,E.exec(t));x.lastIndex=t.lastIndex}return x}var i=t(180),s="[object Boolean]",a="[object Date]",o="[object Number]",u="[object RegExp]",p="[object String]",l="[object ArrayBuffer]",c="[object Float32Array]",f="[object Float64Array]",h="[object Int8Array]",d="[object Int16Array]",m="[object Int32Array]",y="[object Uint8Array]",g="[object Uint8ClampedArray]",v="[object Uint16Array]",A="[object Uint32Array]",E=/\w*$/;e.exports=r},{180:180}],197:[function(t,e,n){function r(t){var e=t.constructor;return"function"==typeof e&&e instanceof e||(e=Object),new e}e.exports=r},{}],198:[function(t,e,n){function r(t){return null!=t&&s(i(t))}var i=t(191),s=t(202);e.exports=r},{191:191,202:202}],199:[function(t,e,n){function r(t,e){return t="number"==typeof t||i.test(t)?+t:-1,e=null==e?s:e,t>-1&&t%1==0&&e>t}var i=/^\d+$/,s=9007199254740991;e.exports=r},{}],200:[function(t,e,n){function r(t,e,n){if(!a(n))return!1;var r=typeof e;if("number"==r?i(n)&&s(e,n.length):"string"==r&&e in n){var o=n[e];return t===t?t===o:o!==o}return!1}var i=t(198),s=t(199),a=t(215);e.exports=r},{198:198,199:199,215:215}],201:[function(t,e,n){function r(t,e){var n=typeof t;if("string"==n&&o.test(t)||"number"==n)return!0;if(i(t))return!1;var r=!a.test(t);return r||null!=e&&t in s(e)}var i=t(211),s=t(206),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,o=/^\w*$/;e.exports=r},{206:206,211:211}],202:[function(t,e,n){function r(t){return"number"==typeof t&&t>-1&&t%1==0&&i>=t}var i=9007199254740991;e.exports=r},{}],203:[function(t,e,n){function r(t){return!!t&&"object"==typeof t}e.exports=r},{}],204:[function(t,e,n){function r(t){return t===t&&!i(t)}var i=t(215);e.exports=r},{215:215}],205:[function(t,e,n){function r(t){for(var e=u(t),n=e.length,r=n&&t.length,p=!!r&&o(r)&&(s(t)||i(t)),c=-1,f=[];++c<n;){var h=e[c];(p&&a(h,r)||l.call(t,h))&&f.push(h)}return f}var i=t(210),s=t(211),a=t(199),o=t(202),u=t(224),p=Object.prototype,l=p.hasOwnProperty;e.exports=r},{199:199,202:202,210:210,211:211,224:224}],206:[function(t,e,n){function r(t){return i(t)?t:Object(t)}var i=t(215);e.exports=r},{215:215}],207:[function(t,e,n){function r(t){if(s(t))return t;var e=[];return i(t).replace(a,function(t,n,r,i){e.push(r?i.replace(o,"$1"):n||t)}),e}var i=t(177),s=t(211),a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,o=/\\(\\)?/g;e.exports=r},{177:177,211:211}],208:[function(t,e,n){function r(t,e,n,r){return e&&"boolean"!=typeof e&&a(t,e,n)?e=!1:"function"==typeof e&&(r=n,n=e,e=!1),"function"==typeof n?i(t,e,s(n,r,3)):i(t,e)}var i=t(156),s=t(179),a=t(200);e.exports=r},{156:156,179:179,200:200}],209:[function(t,e,n){function r(t,e,n){return"function"==typeof e?i(t,!0,s(e,n,3)):i(t,!0)}var i=t(156),s=t(179);e.exports=r},{156:156,179:179}],210:[function(t,e,n){function r(t){return s(t)&&i(t)&&o.call(t,"callee")&&!u.call(t,"callee")}var i=t(198),s=t(203),a=Object.prototype,o=a.hasOwnProperty,u=a.propertyIsEnumerable;e.exports=r},{198:198,203:203}],211:[function(t,e,n){var r=t(193),i=t(202),s=t(203),a="[object Array]",o=Object.prototype,u=o.toString,p=r(Array,"isArray"),l=p||function(t){return s(t)&&i(t.length)&&u.call(t)==a};e.exports=l},{193:193,202:202,203:203}],212:[function(t,e,n){function r(t){return t===!0||t===!1||i(t)&&o.call(t)==s}var i=t(203),s="[object Boolean]",a=Object.prototype,o=a.toString;e.exports=r},{203:203}],213:[function(t,e,n){function r(t){return i(t)&&o.call(t)==s}var i=t(215),s="[object Function]",a=Object.prototype,o=a.toString;e.exports=r},{215:215}],214:[function(t,e,n){function r(t){return null==t?!1:i(t)?l.test(u.call(t)):s(t)&&a.test(t)}var i=t(213),s=t(203),a=/^\[object .+?Constructor\]$/,o=Object.prototype,u=Function.prototype.toString,p=o.hasOwnProperty,l=RegExp("^"+u.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},{203:203,213:213}],215:[function(t,e,n){function r(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}e.exports=r},{}],216:[function(t,e,n){function r(t){var e;if(!a(t)||l.call(t)!=o||s(t)||!p.call(t,"constructor")&&(e=t.constructor,"function"==typeof e&&!(e instanceof e)))return!1;var n;return i(t,function(t,e){n=e}),void 0===n||p.call(t,n)}var i=t(161),s=t(210),a=t(203),o="[object Object]",u=Object.prototype,p=u.hasOwnProperty,l=u.toString;e.exports=r},{161:161,203:203,210:210}],217:[function(t,e,n){function r(t){return i(t)&&o.call(t)==s}var i=t(215),s="[object RegExp]",a=Object.prototype,o=a.toString;e.exports=r},{215:215}],218:[function(t,e,n){function r(t){return"string"==typeof t||i(t)&&o.call(t)==s}var i=t(203),s="[object String]",a=Object.prototype,o=a.toString;e.exports=r},{203:203}],219:[function(t,e,n){function r(t){return s(t)&&i(t.length)&&!!T[k.call(t)]}var i=t(202),s=t(203),a="[object Arguments]",o="[object Array]",u="[object Boolean]",p="[object Date]",l="[object Error]",c="[object Function]",f="[object Map]",h="[object Number]",d="[object Object]",m="[object RegExp]",y="[object Set]",g="[object String]",v="[object WeakMap]",A="[object ArrayBuffer]",E="[object Float32Array]",b="[object Float64Array]",x="[object Int8Array]",D="[object Int16Array]",C="[object Int32Array]",S="[object Uint8Array]",F="[object Uint8ClampedArray]",w="[object Uint16Array]",B="[object Uint32Array]",T={};T[E]=T[b]=T[x]=T[D]=T[C]=T[S]=T[F]=T[w]=T[B]=!0,T[a]=T[o]=T[A]=T[u]=T[p]=T[l]=T[c]=T[f]=T[h]=T[d]=T[m]=T[y]=T[g]=T[v]=!1;var _=Object.prototype,k=_.toString;e.exports=r},{202:202,203:203}],220:[function(t,e,n){function r(t){return i(t,s(t))}var i=t(158),s=t(224);e.exports=r},{158:158,224:224}],221:[function(t,e,n){var r=t(153),i=t(154),s=t(182),a=s(function(t,e,n){return n?r(t,e,n):i(t,e)});e.exports=a},{153:153,154:154,182:182}],222:[function(t,e,n){var r=t(221),i=t(152),s=t(185),a=s(r,i);e.exports=a},{152:152,185:185,221:221}],223:[function(t,e,n){var r=t(193),i=t(198),s=t(215),a=t(205),o=r(Object,"keys"),u=o?function(t){var e=null==t?void 0:t.constructor;return"function"==typeof e&&e.prototype===t||"function"!=typeof t&&i(t)?a(t):s(t)?o(t):[]}:a;e.exports=u},{193:193,198:198,205:205,215:215}],224:[function(t,e,n){function r(t){if(null==t)return[];u(t)||(t=Object(t));var e=t.length;e=e&&o(e)&&(s(t)||i(t))&&e||0;for(var n=t.constructor,r=-1,p="function"==typeof n&&n.prototype===t,c=Array(e),f=e>0;++r<e;)c[r]=r+"";for(var h in t)f&&a(h,e)||"constructor"==h&&(p||!l.call(t,h))||c.push(h);return c}var i=t(210),s=t(211),a=t(199),o=t(202),u=t(215),p=Object.prototype,l=p.hasOwnProperty;e.exports=r},{199:199,202:202,210:210,211:211,215:215}],225:[function(t,e,n){var r=t(171),i=t(182),s=i(r);e.exports=s},{171:171,182:182}],226:[function(t,e,n){function r(t){t=s(t);for(var e=-1,n=i(t),r=n.length,a=Array(r);++e<r;){var o=n[e];a[e]=[o,t[o]]}return a}var i=t(223),s=t(206);e.exports=r},{206:206,223:223}],227:[function(t,e,n){function r(t){return i(t,s(t))}var i=t(178),s=t(223);e.exports=r},{178:178,223:223}],228:[function(t,e,n){function r(t){return t=i(t),t&&o.test(t)?t.replace(a,s):t||"(?:)"}var i=t(177),s=t(190),a=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,o=RegExp(a.source);e.exports=r},{177:177,190:190}],229:[function(t,e,n){function r(t,e,n){return t=i(t),n=null==n?0:s(0>n?0:+n||0,t.length),t.lastIndexOf(e,n)==n}var i=t(177),s=Math.min;e.exports=r},{177:177}],230:[function(t,e,n){function r(t){return t}e.exports=r},{}],231:[function(t,e,n){function r(t){return a(t)?i(t):s(t)}var i=t(173),s=t(174),a=t(201);e.exports=r},{173:173,174:174,201:201}],232:[function(t,e,n){function r(t){return t.split("").reduce(function(t,e){return t[e]=!0,t},{})}function i(t,e){return e=e||{},function(n,r,i){return a(n,t,e)}}function s(t,e){t=t||{},e=e||{};var n={};return Object.keys(e).forEach(function(t){n[t]=e[t]}),Object.keys(t).forEach(function(e){n[e]=t[e]}),n}function a(t,e,n){if("string"!=typeof e)throw new TypeError("glob pattern string required");return n||(n={}),n.nocomment||"#"!==e.charAt(0)?""===e.trim()?""===t:new o(e,n).match(t):!1}function o(t,e){if(!(this instanceof o))return new o(t,e);if("string"!=typeof t)throw new TypeError("glob pattern string required");e||(e={}),t=t.trim(),"/"!==y.sep&&(t=t.split(y.sep).join("/")),this.options=e,this.set=[],this.pattern=t,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function u(){if(!this._made){var t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0))return void(this.comment=!0);if(!t)return void(this.empty=!0);this.parseNegate();var n=this.globSet=this.braceExpand();e.debug&&(this.debug=console.error),this.debug(this.pattern,n),n=this.globParts=n.map(function(t){return t.split(S)}),this.debug(this.pattern,n),n=n.map(function(t,e,n){return t.map(this.parse,this)},this),this.debug(this.pattern,n),n=n.filter(function(t){return-1===t.indexOf(!1)}),this.debug(this.pattern,n),this.set=n}}function p(){var t=this.pattern,e=!1,n=this.options,r=0;if(!n.nonegate){for(var i=0,s=t.length;s>i&&"!"===t.charAt(i);i++)e=!e,r++;r&&(this.pattern=t.substr(r)),this.negate=e}}function l(t,e){if(e||(e=this instanceof o?this.options:{}),t="undefined"==typeof t?this.pattern:t,"undefined"==typeof t)throw new Error("undefined pattern");return e.nobrace||!t.match(/\{.*\}/)?[t]:A(t)}function c(t,e){function n(){if(s){switch(s){case"*":o+=b,u=!0;break;case"?":o+=E,u=!0;break;default:o+="\\"+s}g.debug("clearStateChar %j %j",s,o),s=!1}}var r=this.options;if(!r.noglobstar&&"**"===t)return v;if(""===t)return"";for(var i,s,a,o="",u=!!r.nocase,p=!1,l=[],c=[],f=!1,h=-1,m=-1,y="."===t.charAt(0)?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",g=this,A=0,x=t.length;x>A&&(a=t.charAt(A));A++)if(this.debug("%s %s %s %j",t,A,o,a),p&&C[a])o+="\\"+a,p=!1;else switch(a){case"/":return!1;case"\\":n(),p=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",t,A,o,a),f){this.debug(" in class"),"!"===a&&A===m+1&&(a="^"),o+=a;continue}g.debug("call clearStateChar %j",s),n(),s=a,r.noext&&n();continue;case"(":if(f){o+="(";continue}if(!s){o+="\\(";continue}i=s,l.push({type:i,start:A-1,reStart:o.length}),o+="!"===s?"(?:(?!(?:":"(?:",this.debug("plType %j %j",s,o),s=!1;continue;case")":if(f||!l.length){o+="\\)";continue}n(),u=!0,o+=")";var D=l.pop();switch(i=D.type){case"!":c.push(D),o+=")[^/]*?)",D.reEnd=o.length;break;case"?":case"+":case"*":o+=i;break;case"@":}continue;case"|":if(f||!l.length||p){o+="\\|",p=!1;continue}n(),o+="|";continue;case"[":if(n(),f){o+="\\"+a;continue}f=!0,m=A,h=o.length,o+=a;continue;case"]":if(A===m+1||!f){o+="\\"+a,p=!1;continue}if(f){var S=t.substring(m+1,A);try{RegExp("["+S+"]")}catch(w){var B=this.parse(S,F);o=o.substr(0,h)+"\\["+B[0]+"\\]",u=u||B[1],f=!1;continue}}u=!0,f=!1,o+=a;continue;default:n(),p?p=!1:!C[a]||"^"===a&&f||(o+="\\"),o+=a}for(f&&(S=t.substr(m+1),B=this.parse(S,F),o=o.substr(0,h)+"\\["+B[0],u=u||B[1]),D=l.pop();D;D=l.pop()){var T=o.slice(D.reStart+3);T=T.replace(/((?:\\{2})*)(\\?)\|/g,function(t,e,n){return n||(n="\\"),e+e+n+"|"}),this.debug("tail=%j\n %s",T,T);var _="*"===D.type?b:"?"===D.type?E:"\\"+D.type;u=!0,o=o.slice(0,D.reStart)+_+"\\("+T}n(),p&&(o+="\\\\");var k=!1;switch(o.charAt(0)){case".":case"[":case"(":k=!0}for(var P=c.length-1;P>-1;P--){var N=c[P],I=o.slice(0,N.reStart),L=o.slice(N.reStart,N.reEnd-8),O=o.slice(N.reEnd-8,N.reEnd),M=o.slice(N.reEnd);O+=M;var R=I.split("(").length-1,j=M;for(A=0;R>A;A++)j=j.replace(/\)[+*?]?/,"");M=j;var V="";""===M&&e!==F&&(V="$");var U=I+L+M+V+O;o=U}if(""!==o&&u&&(o="(?=.)"+o),k&&(o=y+o),e===F)return[o,u];if(!u)return d(t);var G=r.nocase?"i":"",W=new RegExp("^"+o+"$",G);return W._glob=t,W._src=o,W}function f(){if(this.regexp||this.regexp===!1)return this.regexp;var t=this.set;if(!t.length)return this.regexp=!1,this.regexp;var e=this.options,n=e.noglobstar?b:e.dot?x:D,r=e.nocase?"i":"",i=t.map(function(t){return t.map(function(t){return t===v?n:"string"==typeof t?m(t):t._src}).join("\\/")}).join("|");i="^(?:"+i+")$",this.negate&&(i="^(?!"+i+").*$");try{this.regexp=new RegExp(i,r)}catch(s){this.regexp=!1}return this.regexp}function h(t,e){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return""===t;if("/"===t&&e)return!0;var n=this.options;"/"!==y.sep&&(t=t.split(y.sep).join("/")),t=t.split(S),this.debug(this.pattern,"split",t);var r=this.set;this.debug(this.pattern,"set",r);var i,s;for(s=t.length-1;s>=0&&!(i=t[s]);s--);for(s=0;s<r.length;s++){var a=r[s],o=t;n.matchBase&&1===a.length&&(o=[i]);var u=this.matchOne(o,a,e);if(u)return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}function d(t){return t.replace(/\\(.)/g,"$1")}function m(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}e.exports=a,a.Minimatch=o;var y={sep:"/"};try{y=t(7)}catch(g){}var v=a.GLOBSTAR=o.GLOBSTAR={},A=t(74),E="[^/]",b=E+"*?",x="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",D="(?:(?!(?:\\/|^)\\.).)*?",C=r("().*{}+?[]^$\\!"),S=/\/+/;a.filter=i,a.defaults=function(t){if(!t||!Object.keys(t).length)return a;var e=a,n=function(n,r,i){return e.minimatch(n,r,s(t,i))};return n.Minimatch=function(n,r){return new e.Minimatch(n,s(t,r))},n},o.defaults=function(t){return t&&Object.keys(t).length?a.defaults(t).Minimatch:o},o.prototype.debug=function(){},o.prototype.make=u,o.prototype.parseNegate=p,a.braceExpand=function(t,e){return l(t,e)},o.prototype.braceExpand=l,o.prototype.parse=c;var F={};a.makeRe=function(t,e){return new o(t,e||{}).makeRe()},o.prototype.makeRe=f,a.match=function(t,e,n){n=n||{};var r=new o(e,n);return t=t.filter(function(t){return r.match(t)}),r.options.nonull&&!t.length&&t.push(e),t},o.prototype.match=h,o.prototype.matchOne=function(t,e,n){var r=this.options;this.debug("matchOne",{"this":this,file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var i=0,s=0,a=t.length,o=e.length;a>i&&o>s;i++,s++){this.debug("matchOne loop");var u=e[s],p=t[i];if(this.debug(e,u,p),u===!1)return!1;if(u===v){this.debug("GLOBSTAR",[e,u,p]);var l=i,c=s+1;if(c===o){for(this.debug("** at the end");a>i;i++)if("."===t[i]||".."===t[i]||!r.dot&&"."===t[i].charAt(0))return!1;return!0}for(;a>l;){var f=t[l];if(this.debug("\nglobstar while",t,l,e,c,f),this.matchOne(t.slice(l),e.slice(c),n))return this.debug("globstar found match!",l,a,f),!0;if("."===f||".."===f||!r.dot&&"."===f.charAt(0)){this.debug("dot detected!",t,l,e,c);break}this.debug("globstar swallow a segment, and continue"),l++}return n&&(this.debug("\n>>> no match, partial?",t,l,e,c),l===a)?!0:!1}var h;if("string"==typeof u?(h=r.nocase?p.toLowerCase()===u.toLowerCase():p===u,this.debug("string match",u,p,h)):(h=p.match(u),this.debug("pattern match",u,p,h)),!h)return!1}if(i===a&&s===o)return!0;if(i===a)return n;if(s===o){var d=i===a-1&&""===t[i];return d}throw new Error("wtf?")}},{7:7,74:74}],233:[function(t,e,n){function r(t){if(t=""+t,!(t.length>1e4)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*c;case"days":case"day":case"d":return n*l;case"hours":case"hour":case"hrs":case"hr":case"h":return n*p;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function i(t){return t>=l?Math.round(t/l)+"d":t>=p?Math.round(t/p)+"h":t>=u?Math.round(t/u)+"m":t>=o?Math.round(t/o)+"s":t+"ms"}function s(t){return a(t,l,"day")||a(t,p,"hour")||a(t,u,"minute")||a(t,o,"second")||t+" ms"}function a(t,e,n){return e>t?void 0:1.5*e>t?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var o=1e3,u=60*o,p=60*u,l=24*p,c=365.25*l;e.exports=function(t,e){return e=e||{},"string"==typeof t?r(t):e["long"]?s(t):i(t)}},{}],234:[function(t,e,n){"use strict";var r=t(2);e.exports=function(t,e){var n="function"==typeof r.access?r.access:r.stat;n(t,function(t){e(null,!t)})},e.exports.sync=function(t){var e="function"==typeof r.accessSync?r.accessSync:r.statSync;try{return e(t),!0}catch(n){return!1}}},{2:2}],235:[function(t,e,n){(function(t){"use strict";function n(t){return"/"===t.charAt(0)}function r(t){var e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,n=e.exec(t),r=n[1]||"",i=!!r&&":"!==r.charAt(1);return!!n[2]||i}e.exports="win32"===t.platform?r:n,e.exports.posix=n,e.exports.win32=r}).call(this,t(8))},{8:8}],236:[function(t,e,n){"use strict";e.exports=/^#!.*/},{}],237:[function(t,e,n){"use strict";e.exports=function(t){var e=/^\\\\\?\\/.test(t),n=/[^\x00-\x80]+/.test(t);return e||n?t:t.replace(/\\/g,"/")}},{}],238:[function(t,e,n){function r(){this._array=[],this._set={}}var i=t(247);r.fromArray=function(t,e){for(var n=new r,i=0,s=t.length;s>i;i++)n.add(t[i],e);return n},r.prototype.size=function(){return Object.getOwnPropertyNames(this._set).length},r.prototype.add=function(t,e){var n=i.toSetString(t),r=this._set.hasOwnProperty(n),s=this._array.length;(!r||e)&&this._array.push(t),r||(this._set[n]=s)},r.prototype.has=function(t){var e=i.toSetString(t);return this._set.hasOwnProperty(e)},r.prototype.indexOf=function(t){var e=i.toSetString(t);if(this._set.hasOwnProperty(e))return this._set[e];throw new Error('"'+t+'" is not in the set.')},r.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)},r.prototype.toArray=function(){return this._array.slice()},n.ArraySet=r},{247:247}],239:[function(t,e,n){function r(t){return 0>t?(-t<<1)+1:(t<<1)+0}function i(t){var e=1===(1&t),n=t>>1;return e?-n:n}var s=t(240),a=5,o=1<<a,u=o-1,p=o;n.encode=function(t){var e,n="",i=r(t);do e=i&u,i>>>=a,i>0&&(e|=p),n+=s.encode(e);while(i>0);return n},n.decode=function(t,e,n){var r,o,l=t.length,c=0,f=0;do{if(e>=l)throw new Error("Expected more digits in base 64 VLQ value.");if(o=s.decode(t.charCodeAt(e++)),-1===o)throw new Error("Invalid base64 digit: "+t.charAt(e-1));r=!!(o&p),o&=u,c+=o<<f,f+=a}while(r);n.value=i(c),n.rest=e}},{240:240}],240:[function(t,e,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");n.encode=function(t){if(t>=0&&t<r.length)return r[t];throw new TypeError("Must be between 0 and 63: "+t)},n.decode=function(t){var e=65,n=90,r=97,i=122,s=48,a=57,o=43,u=47,p=26,l=52;return t>=e&&n>=t?t-e:t>=r&&i>=t?t-r+p:t>=s&&a>=t?t-s+l:t==o?62:t==u?63:-1}},{}],241:[function(t,e,n){function r(t,e,i,s,a,o){var u=Math.floor((e-t)/2)+t,p=a(i,s[u],!0);return 0===p?u:p>0?e-u>1?r(u,e,i,s,a,o):o==n.LEAST_UPPER_BOUND?e<s.length?e:-1:u:u-t>1?r(t,u,i,s,a,o):o==n.LEAST_UPPER_BOUND?u:0>t?-1:t;
}n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(t,e,i,s){if(0===e.length)return-1;var a=r(-1,e.length,t,e,i,s||n.GREATEST_LOWER_BOUND);if(0>a)return-1;for(;a-1>=0&&0===i(e[a],e[a-1],!0);)--a;return a}},{}],242:[function(t,e,n){function r(t,e){var n=t.generatedLine,r=e.generatedLine,i=t.generatedColumn,a=e.generatedColumn;return r>n||r==n&&a>=i||s.compareByGeneratedPositionsInflated(t,e)<=0}function i(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var s=t(247);i.prototype.unsortedForEach=function(t,e){this._array.forEach(t,e)},i.prototype.add=function(t){r(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(s.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},n.MappingList=i},{247:247}],243:[function(t,e,n){function r(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function i(t,e){return Math.round(t+Math.random()*(e-t))}function s(t,e,n,a){if(a>n){var o=i(n,a),u=n-1;r(t,o,a);for(var p=t[a],l=n;a>l;l++)e(t[l],p)<=0&&(u+=1,r(t,u,l));r(t,u+1,l);var c=u+1;s(t,e,n,c-1),s(t,e,c+1,a)}}n.quickSort=function(t,e){s(t,e,0,t.length-1)}},{}],244:[function(t,e,n){function r(t){var e=t;return"string"==typeof t&&(e=JSON.parse(t.replace(/^\)\]\}'/,""))),null!=e.sections?new a(e):new i(e)}function i(t){var e=t;"string"==typeof t&&(e=JSON.parse(t.replace(/^\)\]\}'/,"")));var n=o.getArg(e,"version"),r=o.getArg(e,"sources"),i=o.getArg(e,"names",[]),s=o.getArg(e,"sourceRoot",null),a=o.getArg(e,"sourcesContent",null),u=o.getArg(e,"mappings"),l=o.getArg(e,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);r=r.map(o.normalize).map(function(t){return s&&o.isAbsolute(s)&&o.isAbsolute(t)?o.relative(s,t):t}),this._names=p.fromArray(i,!0),this._sources=p.fromArray(r,!0),this.sourceRoot=s,this.sourcesContent=a,this._mappings=u,this.file=l}function s(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function a(t){var e=t;"string"==typeof t&&(e=JSON.parse(t.replace(/^\)\]\}'/,"")));var n=o.getArg(e,"version"),i=o.getArg(e,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new p,this._names=new p;var s={line:-1,column:0};this._sections=i.map(function(t){if(t.url)throw new Error("Support for url field in sections not implemented.");var e=o.getArg(t,"offset"),n=o.getArg(e,"line"),i=o.getArg(e,"column");if(n<s.line||n===s.line&&i<s.column)throw new Error("Section offsets must be ordered and non-overlapping.");return s=e,{generatedOffset:{generatedLine:n+1,generatedColumn:i+1},consumer:new r(o.getArg(t,"map"))}})}var o=t(247),u=t(241),p=t(238).ArraySet,l=t(239),c=t(243).quickSort;r.fromSourceMap=function(t){return i.fromSourceMap(t)},r.prototype._version=3,r.prototype.__generatedMappings=null,Object.defineProperty(r.prototype,"_generatedMappings",{get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),r.prototype.__originalMappings=null,Object.defineProperty(r.prototype,"_originalMappings",{get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),r.prototype._charIsMappingSeparator=function(t,e){var n=t.charAt(e);return";"===n||","===n},r.prototype._parseMappings=function(t,e){throw new Error("Subclasses must implement _parseMappings")},r.GENERATED_ORDER=1,r.ORIGINAL_ORDER=2,r.GREATEST_LOWER_BOUND=1,r.LEAST_UPPER_BOUND=2,r.prototype.eachMapping=function(t,e,n){var i,s=e||null,a=n||r.GENERATED_ORDER;switch(a){case r.GENERATED_ORDER:i=this._generatedMappings;break;case r.ORIGINAL_ORDER:i=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var u=this.sourceRoot;i.map(function(t){var e=null===t.source?null:this._sources.at(t.source);return null!=e&&null!=u&&(e=o.join(u,e)),{source:e,generatedLine:t.generatedLine,generatedColumn:t.generatedColumn,originalLine:t.originalLine,originalColumn:t.originalColumn,name:null===t.name?null:this._names.at(t.name)}},this).forEach(t,s)},r.prototype.allGeneratedPositionsFor=function(t){var e=o.getArg(t,"line"),n={source:o.getArg(t,"source"),originalLine:e,originalColumn:o.getArg(t,"column",0)};if(null!=this.sourceRoot&&(n.source=o.relative(this.sourceRoot,n.source)),!this._sources.has(n.source))return[];n.source=this._sources.indexOf(n.source);var r=[],i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,u.LEAST_UPPER_BOUND);if(i>=0){var s=this._originalMappings[i];if(void 0===t.column)for(var a=s.originalLine;s&&s.originalLine===a;)r.push({line:o.getArg(s,"generatedLine",null),column:o.getArg(s,"generatedColumn",null),lastColumn:o.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var p=s.originalColumn;s&&s.originalLine===e&&s.originalColumn==p;)r.push({line:o.getArg(s,"generatedLine",null),column:o.getArg(s,"generatedColumn",null),lastColumn:o.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return r},n.SourceMapConsumer=r,i.prototype=Object.create(r.prototype),i.prototype.consumer=r,i.fromSourceMap=function(t){var e=Object.create(i.prototype),n=e._names=p.fromArray(t._names.toArray(),!0),r=e._sources=p.fromArray(t._sources.toArray(),!0);e.sourceRoot=t._sourceRoot,e.sourcesContent=t._generateSourcesContent(e._sources.toArray(),e.sourceRoot),e.file=t._file;for(var a=t._mappings.toArray().slice(),u=e.__generatedMappings=[],l=e.__originalMappings=[],f=0,h=a.length;h>f;f++){var d=a[f],m=new s;m.generatedLine=d.generatedLine,m.generatedColumn=d.generatedColumn,d.source&&(m.source=r.indexOf(d.source),m.originalLine=d.originalLine,m.originalColumn=d.originalColumn,d.name&&(m.name=n.indexOf(d.name)),l.push(m)),u.push(m)}return c(e.__originalMappings,o.compareByOriginalPositions),e},i.prototype._version=3,Object.defineProperty(i.prototype,"sources",{get:function(){return this._sources.toArray().map(function(t){return null!=this.sourceRoot?o.join(this.sourceRoot,t):t},this)}}),i.prototype._parseMappings=function(t,e){for(var n,r,i,a,u,p=1,f=0,h=0,d=0,m=0,y=0,g=t.length,v=0,A={},E={},b=[],x=[];g>v;)if(";"===t.charAt(v))p++,v++,f=0;else if(","===t.charAt(v))v++;else{for(n=new s,n.generatedLine=p,a=v;g>a&&!this._charIsMappingSeparator(t,a);a++);if(r=t.slice(v,a),i=A[r])v+=r.length;else{for(i=[];a>v;)l.decode(t,v,E),u=E.value,v=E.rest,i.push(u);if(2===i.length)throw new Error("Found a source, but no line and column");if(3===i.length)throw new Error("Found a source and line, but no column");A[r]=i}n.generatedColumn=f+i[0],f=n.generatedColumn,i.length>1&&(n.source=m+i[1],m+=i[1],n.originalLine=h+i[2],h=n.originalLine,n.originalLine+=1,n.originalColumn=d+i[3],d=n.originalColumn,i.length>4&&(n.name=y+i[4],y+=i[4])),x.push(n),"number"==typeof n.originalLine&&b.push(n)}c(x,o.compareByGeneratedPositionsDeflated),this.__generatedMappings=x,c(b,o.compareByOriginalPositions),this.__originalMappings=b},i.prototype._findMapping=function(t,e,n,r,i,s){if(t[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+t[n]);if(t[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+t[r]);return u.search(t,e,i,s)},i.prototype.computeColumnSpans=function(){for(var t=0;t<this._generatedMappings.length;++t){var e=this._generatedMappings[t];if(t+1<this._generatedMappings.length){var n=this._generatedMappings[t+1];if(e.generatedLine===n.generatedLine){e.lastGeneratedColumn=n.generatedColumn-1;continue}}e.lastGeneratedColumn=1/0}},i.prototype.originalPositionFor=function(t){var e={generatedLine:o.getArg(t,"line"),generatedColumn:o.getArg(t,"column")},n=this._findMapping(e,this._generatedMappings,"generatedLine","generatedColumn",o.compareByGeneratedPositionsDeflated,o.getArg(t,"bias",r.GREATEST_LOWER_BOUND));if(n>=0){var i=this._generatedMappings[n];if(i.generatedLine===e.generatedLine){var s=o.getArg(i,"source",null);null!==s&&(s=this._sources.at(s),null!=this.sourceRoot&&(s=o.join(this.sourceRoot,s)));var a=o.getArg(i,"name",null);return null!==a&&(a=this._names.at(a)),{source:s,line:o.getArg(i,"originalLine",null),column:o.getArg(i,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},i.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(t){return null==t}):!1},i.prototype.sourceContentFor=function(t,e){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(t=o.relative(this.sourceRoot,t)),this._sources.has(t))return this.sourcesContent[this._sources.indexOf(t)];var n;if(null!=this.sourceRoot&&(n=o.urlParse(this.sourceRoot))){var r=t.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(r))return this.sourcesContent[this._sources.indexOf(r)];if((!n.path||"/"==n.path)&&this._sources.has("/"+t))return this.sourcesContent[this._sources.indexOf("/"+t)]}if(e)return null;throw new Error('"'+t+'" is not in the SourceMap.')},i.prototype.generatedPositionFor=function(t){var e=o.getArg(t,"source");if(null!=this.sourceRoot&&(e=o.relative(this.sourceRoot,e)),!this._sources.has(e))return{line:null,column:null,lastColumn:null};e=this._sources.indexOf(e);var n={source:e,originalLine:o.getArg(t,"line"),originalColumn:o.getArg(t,"column")},i=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,o.getArg(t,"bias",r.GREATEST_LOWER_BOUND));if(i>=0){var s=this._originalMappings[i];if(s.source===n.source)return{line:o.getArg(s,"generatedLine",null),column:o.getArg(s,"generatedColumn",null),lastColumn:o.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=i,a.prototype=Object.create(r.prototype),a.prototype.constructor=r,a.prototype._version=3,Object.defineProperty(a.prototype,"sources",{get:function(){for(var t=[],e=0;e<this._sections.length;e++)for(var n=0;n<this._sections[e].consumer.sources.length;n++)t.push(this._sections[e].consumer.sources[n]);return t}}),a.prototype.originalPositionFor=function(t){var e={generatedLine:o.getArg(t,"line"),generatedColumn:o.getArg(t,"column")},n=u.search(e,this._sections,function(t,e){var n=t.generatedLine-e.generatedOffset.generatedLine;return n?n:t.generatedColumn-e.generatedOffset.generatedColumn}),r=this._sections[n];return r?r.consumer.originalPositionFor({line:e.generatedLine-(r.generatedOffset.generatedLine-1),column:e.generatedColumn-(r.generatedOffset.generatedLine===e.generatedLine?r.generatedOffset.generatedColumn-1:0),bias:t.bias}):{source:null,line:null,column:null,name:null}},a.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(t){return t.consumer.hasContentsOfAllSources()})},a.prototype.sourceContentFor=function(t,e){for(var n=0;n<this._sections.length;n++){var r=this._sections[n],i=r.consumer.sourceContentFor(t,!0);if(i)return i}if(e)return null;throw new Error('"'+t+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(t){for(var e=0;e<this._sections.length;e++){var n=this._sections[e];if(-1!==n.consumer.sources.indexOf(o.getArg(t,"source"))){var r=n.consumer.generatedPositionFor(t);if(r){var i={line:r.line+(n.generatedOffset.generatedLine-1),column:r.column+(n.generatedOffset.generatedLine===r.line?n.generatedOffset.generatedColumn-1:0)};return i}}}return{line:null,column:null}},a.prototype._parseMappings=function(t,e){this.__generatedMappings=[],this.__originalMappings=[];for(var n=0;n<this._sections.length;n++)for(var r=this._sections[n],i=r.consumer._generatedMappings,s=0;s<i.length;s++){var a=i[s],u=r.consumer._sources.at(a.source);null!==r.consumer.sourceRoot&&(u=o.join(r.consumer.sourceRoot,u)),this._sources.add(u),u=this._sources.indexOf(u);var p=r.consumer._names.at(a.name);this._names.add(p),p=this._names.indexOf(p);var l={source:u,generatedLine:a.generatedLine+(r.generatedOffset.generatedLine-1),generatedColumn:a.generatedColumn+(r.generatedOffset.generatedLine===a.generatedLine?r.generatedOffset.generatedColumn-1:0),originalLine:a.originalLine,originalColumn:a.originalColumn,name:p};this.__generatedMappings.push(l),"number"==typeof l.originalLine&&this.__originalMappings.push(l)}c(this.__generatedMappings,o.compareByGeneratedPositionsDeflated),c(this.__originalMappings,o.compareByOriginalPositions)},n.IndexedSourceMapConsumer=a},{238:238,239:239,241:241,243:243,247:247}],245:[function(t,e,n){function r(t){t||(t={}),this._file=s.getArg(t,"file",null),this._sourceRoot=s.getArg(t,"sourceRoot",null),this._skipValidation=s.getArg(t,"skipValidation",!1),this._sources=new a,this._names=new a,this._mappings=new o,this._sourcesContents=null}var i=t(239),s=t(247),a=t(238).ArraySet,o=t(242).MappingList;r.prototype._version=3,r.fromSourceMap=function(t){var e=t.sourceRoot,n=new r({file:t.file,sourceRoot:e});return t.eachMapping(function(t){var r={generated:{line:t.generatedLine,column:t.generatedColumn}};null!=t.source&&(r.source=t.source,null!=e&&(r.source=s.relative(e,r.source)),r.original={line:t.originalLine,column:t.originalColumn},null!=t.name&&(r.name=t.name)),n.addMapping(r)}),t.sources.forEach(function(e){var r=t.sourceContentFor(e);null!=r&&n.setSourceContent(e,r)}),n},r.prototype.addMapping=function(t){var e=s.getArg(t,"generated"),n=s.getArg(t,"original",null),r=s.getArg(t,"source",null),i=s.getArg(t,"name",null);this._skipValidation||this._validateMapping(e,n,r,i),null==r||this._sources.has(r)||this._sources.add(r),null==i||this._names.has(i)||this._names.add(i),this._mappings.add({generatedLine:e.line,generatedColumn:e.column,originalLine:null!=n&&n.line,originalColumn:null!=n&&n.column,source:r,name:i})},r.prototype.setSourceContent=function(t,e){var n=t;null!=this._sourceRoot&&(n=s.relative(this._sourceRoot,n)),null!=e?(this._sourcesContents||(this._sourcesContents={}),this._sourcesContents[s.toSetString(n)]=e):this._sourcesContents&&(delete this._sourcesContents[s.toSetString(n)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},r.prototype.applySourceMap=function(t,e,n){var r=e;if(null==e){if(null==t.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');r=t.file}var i=this._sourceRoot;null!=i&&(r=s.relative(i,r));var o=new a,u=new a;this._mappings.unsortedForEach(function(e){if(e.source===r&&null!=e.originalLine){var a=t.originalPositionFor({line:e.originalLine,column:e.originalColumn});null!=a.source&&(e.source=a.source,null!=n&&(e.source=s.join(n,e.source)),null!=i&&(e.source=s.relative(i,e.source)),e.originalLine=a.line,e.originalColumn=a.column,null!=a.name&&(e.name=a.name))}var p=e.source;null==p||o.has(p)||o.add(p);var l=e.name;null==l||u.has(l)||u.add(l)},this),this._sources=o,this._names=u,t.sources.forEach(function(e){var r=t.sourceContentFor(e);null!=r&&(null!=n&&(e=s.join(n,e)),null!=i&&(e=s.relative(i,e)),this.setSourceContent(e,r))},this)},r.prototype._validateMapping=function(t,e,n,r){if((!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0)||e||n||r)&&!(t&&"line"in t&&"column"in t&&e&&"line"in e&&"column"in e&&t.line>0&&t.column>=0&&e.line>0&&e.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:n,original:e,name:r}))},r.prototype._serializeMappings=function(){for(var t,e,n,r=0,a=1,o=0,u=0,p=0,l=0,c="",f=this._mappings.toArray(),h=0,d=f.length;d>h;h++){if(t=f[h],t.generatedLine!==a)for(r=0;t.generatedLine!==a;)c+=";",a++;else if(h>0){if(!s.compareByGeneratedPositionsInflated(t,f[h-1]))continue;c+=","}c+=i.encode(t.generatedColumn-r),r=t.generatedColumn,null!=t.source&&(n=this._sources.indexOf(t.source),c+=i.encode(n-l),l=n,c+=i.encode(t.originalLine-1-u),u=t.originalLine-1,c+=i.encode(t.originalColumn-o),o=t.originalColumn,null!=t.name&&(e=this._names.indexOf(t.name),c+=i.encode(e-p),p=e))}return c},r.prototype._generateSourcesContent=function(t,e){return t.map(function(t){if(!this._sourcesContents)return null;null!=e&&(t=s.relative(e,t));var n=s.toSetString(t);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null},this)},r.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(t.file=this._file),null!=this._sourceRoot&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t},r.prototype.toString=function(){return JSON.stringify(this.toJSON())},n.SourceMapGenerator=r},{238:238,239:239,242:242,247:247}],246:[function(t,e,n){function r(t,e,n,r,i){this.children=[],this.sourceContents={},this.line=null==t?null:t,this.column=null==e?null:e,this.source=null==n?null:n,this.name=null==i?null:i,this[u]=!0,null!=r&&this.add(r)}var i=t(245).SourceMapGenerator,s=t(247),a=/(\r?\n)/,o=10,u="$$$isSourceNode$$$";r.fromStringWithSourceMap=function(t,e,n){function i(t,e){if(null===t||void 0===t.source)o.add(e);else{var i=n?s.join(n,t.source):t.source;o.add(new r(t.originalLine,t.originalColumn,i,e,t.name))}}var o=new r,u=t.split(a),p=function(){var t=u.shift(),e=u.shift()||"";return t+e},l=1,c=0,f=null;return e.eachMapping(function(t){if(null!==f){if(!(l<t.generatedLine)){var e=u[0],n=e.substr(0,t.generatedColumn-c);return u[0]=e.substr(t.generatedColumn-c),c=t.generatedColumn,i(f,n),void(f=t)}i(f,p()),l++,c=0}for(;l<t.generatedLine;)o.add(p()),l++;if(c<t.generatedColumn){var e=u[0];o.add(e.substr(0,t.generatedColumn)),u[0]=e.substr(t.generatedColumn),c=t.generatedColumn}f=t},this),u.length>0&&(f&&i(f,p()),o.add(u.join(""))),e.sources.forEach(function(t){var r=e.sourceContentFor(t);null!=r&&(null!=n&&(t=s.join(n,t)),o.setSourceContent(t,r))}),o},r.prototype.add=function(t){if(Array.isArray(t))t.forEach(function(t){this.add(t)},this);else{if(!t[u]&&"string"!=typeof t)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);t&&this.children.push(t)}return this},r.prototype.prepend=function(t){if(Array.isArray(t))for(var e=t.length-1;e>=0;e--)this.prepend(t[e]);else{if(!t[u]&&"string"!=typeof t)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);this.children.unshift(t)}return this},r.prototype.walk=function(t){for(var e,n=0,r=this.children.length;r>n;n++)e=this.children[n],e[u]?e.walk(t):""!==e&&t(e,{source:this.source,line:this.line,column:this.column,name:this.name})},r.prototype.join=function(t){var e,n,r=this.children.length;if(r>0){for(e=[],n=0;r-1>n;n++)e.push(this.children[n]),e.push(t);e.push(this.children[n]),this.children=e}return this},r.prototype.replaceRight=function(t,e){var n=this.children[this.children.length-1];return n[u]?n.replaceRight(t,e):"string"==typeof n?this.children[this.children.length-1]=n.replace(t,e):this.children.push("".replace(t,e)),this},r.prototype.setSourceContent=function(t,e){this.sourceContents[s.toSetString(t)]=e},r.prototype.walkSourceContents=function(t){for(var e=0,n=this.children.length;n>e;e++)this.children[e][u]&&this.children[e].walkSourceContents(t);for(var r=Object.keys(this.sourceContents),e=0,n=r.length;n>e;e++)t(s.fromSetString(r[e]),this.sourceContents[r[e]])},r.prototype.toString=function(){var t="";return this.walk(function(e){t+=e}),t},r.prototype.toStringWithSourceMap=function(t){var e={code:"",line:1,column:0},n=new i(t),r=!1,s=null,a=null,u=null,p=null;return this.walk(function(t,i){e.code+=t,null!==i.source&&null!==i.line&&null!==i.column?((s!==i.source||a!==i.line||u!==i.column||p!==i.name)&&n.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:e.line,column:e.column},name:i.name}),s=i.source,a=i.line,u=i.column,p=i.name,r=!0):r&&(n.addMapping({generated:{line:e.line,column:e.column}}),s=null,r=!1);for(var l=0,c=t.length;c>l;l++)t.charCodeAt(l)===o?(e.line++,e.column=0,l+1===c?(s=null,r=!1):r&&n.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:e.line,column:e.column},name:i.name})):e.column++}),this.walkSourceContents(function(t,e){n.setSourceContent(t,e)}),{code:e.code,map:n}},n.SourceNode=r},{245:245,247:247}],247:[function(t,e,n){function r(t,e,n){if(e in t)return t[e];if(3===arguments.length)return n;throw new Error('"'+e+'" is a required argument.')}function i(t){var e=t.match(m);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}function s(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}function a(t){var e=t,r=i(t);if(r){if(!r.path)return t;e=r.path}for(var a,o=n.isAbsolute(e),u=e.split(/\/+/),p=0,l=u.length-1;l>=0;l--)a=u[l],"."===a?u.splice(l,1):".."===a?p++:p>0&&(""===a?(u.splice(l+1,p),p=0):(u.splice(l,2),p--));return e=u.join("/"),""===e&&(e=o?"/":"."),r?(r.path=e,s(r)):e}function o(t,e){""===t&&(t="."),""===e&&(e=".");var n=i(e),r=i(t);if(r&&(t=r.path||"/"),n&&!n.scheme)return r&&(n.scheme=r.scheme),s(n);if(n||e.match(y))return e;if(r&&!r.host&&!r.path)return r.host=e,s(r);var o="/"===e.charAt(0)?e:a(t.replace(/\/+$/,"")+"/"+e);return r?(r.path=o,s(r)):o}function u(t,e){""===t&&(t="."),t=t.replace(/\/$/,"");for(var n=0;0!==e.indexOf(t+"/");){var r=t.lastIndexOf("/");if(0>r)return e;if(t=t.slice(0,r),t.match(/^([^\/]+:\/)?\/*$/))return e;++n}return Array(n+1).join("../")+e.substr(t.length+1)}function p(t){return"$"+t}function l(t){return t.substr(1)}function c(t,e,n){var r=t.source-e.source;return 0!==r?r:(r=t.originalLine-e.originalLine,0!==r?r:(r=t.originalColumn-e.originalColumn,0!==r||n?r:(r=t.generatedColumn-e.generatedColumn,0!==r?r:(r=t.generatedLine-e.generatedLine,0!==r?r:t.name-e.name))))}function f(t,e,n){var r=t.generatedLine-e.generatedLine;return 0!==r?r:(r=t.generatedColumn-e.generatedColumn,0!==r||n?r:(r=t.source-e.source,0!==r?r:(r=t.originalLine-e.originalLine,0!==r?r:(r=t.originalColumn-e.originalColumn,0!==r?r:t.name-e.name))))}function h(t,e){return t===e?0:t>e?1:-1}function d(t,e){var n=t.generatedLine-e.generatedLine;return 0!==n?n:(n=t.generatedColumn-e.generatedColumn,0!==n?n:(n=h(t.source,e.source),0!==n?n:(n=t.originalLine-e.originalLine,0!==n?n:(n=t.originalColumn-e.originalColumn,0!==n?n:h(t.name,e.name)))))}n.getArg=r;var m=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,y=/^data:.+\,.+$/;n.urlParse=i,n.urlGenerate=s,n.normalize=a,n.join=o,n.isAbsolute=function(t){return"/"===t.charAt(0)||!!t.match(m)},n.relative=u,n.toSetString=p,n.fromSetString=l,n.compareByOriginalPositions=c,n.compareByGeneratedPositionsDeflated=f,n.compareByGeneratedPositionsInflated=d},{}],248:[function(t,e,n){n.SourceMapGenerator=t(245).SourceMapGenerator,n.SourceMapConsumer=t(244).SourceMapConsumer,n.SourceNode=t(246).SourceNode},{244:244,245:245,246:246}],249:[function(t,e,n){e.exports={name:"babel-core",version:"6.1.17",description:"Babel compiler core.",author:"Sebastian McKenzie <sebmck@gmail.com>",homepage:"https://babeljs.io/",license:"MIT",repository:"https://github.com/babel/babel/tree/master/packages/babel-core",keywords:["6to5","babel","classes","const","es6","harmony","let","modules","transpile","transpiler","var"],scripts:{bench:"make bench",test:"make test"},dependencies:{"babel-code-frame":"^6.1.17","babel-generator":"^6.1.17","babel-helpers":"^6.1.17","babel-messages":"^6.1.17","babel-template":"^6.1.17","babel-runtime":"^5.0.0","babel-register":"^6.1.17","babel-traverse":"^6.1.17","babel-types":"^6.1.17",babylon:"^6.1.17","convert-source-map":"^1.1.0",debug:"^2.1.1",esutils:"^2.0.0","home-or-tmp":"^1.0.0",json5:"^0.4.0",lodash:"^3.10.0",minimatch:"^2.0.3","path-exists":"^1.0.0","path-is-absolute":"^1.0.0","private":"^0.1.6",regenerator:"0.8.35","shebang-regex":"^1.0.0",slash:"^1.0.0","source-map":"^0.5.0","source-map-support":"^0.2.10"},devDependencies:{"babel-helper-fixtures":"^6.1.17","babel-helper-transform-fixture-test-runner":"^6.1.17","babel-polyfill":"^6.1.17"}}},{}],250:[function(t,e,n){"use strict";var r=t(275)["default"],i=t(277)["default"];n.__esModule=!0;var s=t(389),a=i(s),o=t(401),u=i(o),p=function(){function t(e,n){r(this,t),this.printedCommentStarts={},this.parenPushNewlineState=null,this.position=e,this._indent=n.indent.base,this.format=n,this.buf=""}return t.prototype.catchUp=function(t){if(t.loc&&this.format.retainLines&&this.buf)for(;this.position.line<t.loc.start.line;)this._push("\n")},t.prototype.get=function(){return u["default"](this.buf)},t.prototype.getIndent=function(){return this.format.compact||this.format.concise?"":a["default"](this.format.indent.style,this._indent)},t.prototype.indentSize=function(){return this.getIndent().length},t.prototype.indent=function(){this._indent++},t.prototype.dedent=function(){this._indent--},t.prototype.semicolon=function(){this.push(";")},t.prototype.ensureSemicolon=function(){this.isLast(";")||this.semicolon()},t.prototype.rightBrace=function(){this.newline(!0),this.push("}")},t.prototype.keyword=function(t){this.push(t),this.space()},t.prototype.space=function(t){(t||!this.format.compact)&&(t||this.buf&&!this.isLast(" ")&&!this.isLast("\n"))&&this.push(" ")},t.prototype.removeLast=function(t){return this.format.compact?void 0:this._removeLast(t)},t.prototype._removeLast=function(t){this._isLast(t)&&(this.buf=this.buf.substr(0,this.buf.length-1),this.position.unshift(t))},t.prototype.startTerminatorless=function(){return this.parenPushNewlineState={printed:!1}},t.prototype.endTerminatorless=function(t){t.printed&&(this.dedent(),this.newline(),this.push(")"))},t.prototype.newline=function(t,e){if(!this.format.retainLines&&!this.format.compact){if(this.format.concise)return void this.space();if(e=e||!1,"number"!=typeof t)"boolean"==typeof t&&(e=t),this._newline(e);else{if(t=Math.min(2,t),(this.endsWith("{\n")||this.endsWith(":\n"))&&t--,0>=t)return;for(;t>0;)this._newline(e),t--}}},t.prototype._newline=function(t){this.endsWith("\n\n")||(t&&this.isLast("\n")&&this.removeLast("\n"),this.removeLast(" "),this._removeSpacesAfterLastNewline(),this._push("\n"))},t.prototype._removeSpacesAfterLastNewline=function(){var t=this.buf.lastIndexOf("\n");if(-1!==t){for(var e=this.buf.length-1;e>t&&" "===this.buf[e];)e--;e===t&&(this.buf=this.buf.substring(0,e+1))}},t.prototype.push=function(t,e){if(!this.format.compact&&this._indent&&!e&&"\n"!==t){var n=this.getIndent();t=t.replace(/\n/g,"\n"+n),this.isLast("\n")&&this._push(n)}this._push(t)},t.prototype._push=function(t){var e=this.parenPushNewlineState;if(e)for(var n=0;n<t.length;n++){var r=t[n];if(" "!==r){this.parenPushNewlineState=null,("\n"===r||"/"===r)&&(this._push("("),this.indent(),e.printed=!0);break}}this.position.push(t),this.buf+=t},t.prototype.endsWith=function(t){var e=arguments.length<=1||void 0===arguments[1]?this.buf:arguments[1];return 1===t.length?e[e.length-1]===t:e.slice(-t.length)===t},t.prototype.isLast=function(t){return this.format.compact?!1:this._isLast(t)},t.prototype._isLast=function(t){var e=this.buf,n=e[e.length-1];return Array.isArray(t)?t.indexOf(n)>=0:t===n},t}();n["default"]=p,e.exports=n["default"]},{275:275,277:277,389:389,401:401}],251:[function(t,e,n){"use strict";function r(t){this.print(t.program,t)}function i(t){this.printInnerComments(t,!1),this.printSequence(t.directives,t),t.directives&&t.directives.length&&this.newline(),this.printSequence(t.body,t)}function s(t){this.push("{"),this.printInnerComments(t),t.body.length?(this.newline(),this.printSequence(t.directives,t,{indent:!0}),t.directives&&t.directives.length&&this.newline(),this.printSequence(t.body,t,{indent:!0}),this.format.retainLines||this.removeLast("\n"),this.rightBrace()):this.push("}")}function a(){}function o(t){this.print(t.value,t),this.semicolon()}function u(t){this.push(this._stringLiteral(t.value))}n.__esModule=!0,n.File=r,n.Program=i,n.BlockStatement=s,n.Noop=a,n.Directive=o,n.DirectiveLiteral=u},{}],252:[function(t,e,n){"use strict";function r(t){this.printJoin(t.decorators,t,{separator:""}),this.push("class"),t.id&&(this.push(" "),this.print(t.id,t)),this.print(t.typeParameters,t),t.superClass&&(this.push(" extends "),this.print(t.superClass,t),this.print(t.superTypeParameters,t)),t["implements"]&&(this.push(" implements "),this.printJoin(t["implements"],t,{separator:", "})),this.space(),this.print(t.body,t)}function i(t){this.push("{"),this.printInnerComments(t),0===t.body.length?this.push("}"):(this.newline(),this.indent(),this.printSequence(t.body,t),this.dedent(),this.rightBrace())}function s(t){this.printJoin(t.decorators,t,{separator:""}),t["static"]&&this.push("static "),this.print(t.key,t),this.print(t.typeAnnotation,t),t.value&&(this.space(),this.push("="),this.space(),this.print(t.value,t)),this.semicolon()}function a(t){this.printJoin(t.decorators,t,{separator:""}),t["static"]&&this.push("static "),"constructorCall"===t.kind&&this.push("call "),this._method(t)}n.__esModule=!0,n.ClassDeclaration=r,n.ClassBody=i,n.ClassProperty=s,n.ClassMethod=a,n.ClassExpression=r},{}],253:[function(t,e,n){"use strict";function r(t){var e=/[a-z]$/.test(t.operator),n=t.argument;(T.isUpdateExpression(n)||T.isUnaryExpression(n))&&(e=!0),T.isUnaryExpression(n)&&"!"===n.operator&&(e=!1),this.push(t.operator),e&&this.push(" "),this.print(t.argument,t)}function i(t){this.push("do"),this.space(),this.print(t.body,t)}function s(t){this.push("("),this.print(t.expression,t),this.push(")")}function a(t){t.prefix?(this.push(t.operator),this.print(t.argument,t)):(this.print(t.argument,t),this.push(t.operator))}function o(t){this.print(t.test,t),this.space(),this.push("?"),this.space(),this.print(t.consequent,t),this.space(),this.push(":"),this.space(),this.print(t.alternate,t)}function u(t){this.push("new "),this.print(t.callee,t),this.push("("),this.printList(t.arguments,t),this.push(")")}function p(t){this.printList(t.expressions,t)}function l(){this.push("this")}function c(){this.push("super")}function f(t){this.push("@"),this.print(t.expression,t),this.newline()}function h(t){this.print(t.callee,t),this.push("(");var e=t._prettyCall&&!this.format.retainLines&&!this.format.compact,n=void 0;e&&(n=",\n",this.newline(),this.indent()),this.printList(t.arguments,t,{separator:n}),e&&(this.newline(),this.dedent()),this.push(")")}function d(t){return function(e){if(this.push(t),(e.delegate||e.all)&&this.push("*"),e.argument){this.push(" ");var n=this.startTerminatorless();this.print(e.argument,e),this.endTerminatorless(n)}}}function m(){this.semicolon()}function y(t){this.print(t.expression,t),this.semicolon()}function g(t){this.print(t.left,t),this.push(" = "),this.print(t.right,t)}function v(t,e){var n=this._inForStatementInit&&"in"===t.operator&&!k["default"].needsParens(t,e);n&&this.push("("),this.print(t.left,t);var r=!this.format.compact||"in"===t.operator||"instanceof"===t.operator;r=!0,r&&this.push(" "),this.push(t.operator),r||(r="<"===t.operator&&T.isUnaryExpression(t.right,{prefix:!0,operator:"!"})&&T.isUnaryExpression(t.right.argument,{prefix:!0,operator:"--"})),r&&this.push(" "),this.print(t.right,t),n&&this.push(")")}function A(t){this.print(t.object,t),this.push("::"),this.print(t.callee,t)}function E(t){if(this.print(t.object,t),!t.computed&&T.isMemberExpression(t.property))throw new TypeError("Got a MemberExpression for MemberExpression property");var e=t.computed;if(T.isLiteral(t.property)&&w["default"](t.property.value)&&(e=!0),e)this.push("["),this.print(t.property,t),this.push("]");else{if(T.isLiteral(t.object)&&!T.isTemplateLiteral(t.object)){var n=this.getPossibleRaw(t.object)||this._stringLiteral(t.object);!S["default"](+n)||P.test(n)||N.test(n)||this.endsWith(".")||this.push(".")}this.push("."),this.print(t.property,t)}}function b(t){this.print(t.meta,t),this.push("."),this.print(t.property,t)}var x=t(277)["default"],D=t(278)["default"];n.__esModule=!0,n.UnaryExpression=r,
n.DoExpression=i,n.ParenthesizedExpression=s,n.UpdateExpression=a,n.ConditionalExpression=o,n.NewExpression=u,n.SequenceExpression=p,n.ThisExpression=l,n.Super=c,n.Decorator=f,n.CallExpression=h,n.EmptyStatement=m,n.ExpressionStatement=y,n.AssignmentPattern=g,n.AssignmentExpression=v,n.BindExpression=A,n.MemberExpression=E,n.MetaProperty=b;var C=t(330),S=x(C),F=t(380),w=x(F),B=t(279),T=D(B),_=t(262),k=x(_),P=/e/i,N=/\.0+$/,I=d("yield");n.YieldExpression=I;var L=d("await");n.AwaitExpression=L,n.BinaryExpression=v,n.LogicalExpression=v},{262:262,277:277,278:278,279:279,330:330,380:380}],254:[function(t,e,n){"use strict";function r(){this.push("any")}function i(t){this.print(t.elementType,t),this.push("["),this.push("]")}function s(){this.push("bool")}function a(t){this.push(t.value?"true":"false")}function o(t){this.push("declare class "),this._interfaceish(t)}function u(t){this.push("declare function "),this.print(t.id,t),this.print(t.id.typeAnnotation.typeAnnotation,t),this.semicolon()}function p(t){this.push("declare module "),this.print(t.id,t),this.space(),this.print(t.body,t)}function l(t){this.push("declare var "),this.print(t.id,t),this.print(t.id.typeAnnotation,t),this.semicolon()}function c(){this.push("*")}function f(t,e){this.print(t.typeParameters,t),this.push("("),this.printList(t.params,t),t.rest&&(t.params.length&&(this.push(","),this.space()),this.push("..."),this.print(t.rest,t)),this.push(")"),"ObjectTypeProperty"===e.type||"ObjectTypeCallProperty"===e.type||"DeclareFunction"===e.type?this.push(":"):(this.space(),this.push("=>")),this.space(),this.print(t.returnType,t)}function h(t){this.print(t.name,t),t.optional&&this.push("?"),this.push(":"),this.space(),this.print(t.typeAnnotation,t)}function d(t){this.print(t.id,t),this.print(t.typeParameters,t)}function m(t){this.print(t.id,t),this.print(t.typeParameters,t),t["extends"].length&&(this.push(" extends "),this.printJoin(t["extends"],t,{separator:", "})),this.space(),this.print(t.body,t)}function y(t){this.push("interface "),this._interfaceish(t)}function g(t){this.printJoin(t.types,t,{separator:" & "})}function v(){this.push("mixed")}function A(t){this.push("?"),this.print(t.typeAnnotation,t)}function E(){this.push("number")}function b(t){this.push(this._stringLiteral(t.value))}function x(){this.push("string")}function D(t){this.push("["),this.printJoin(t.types,t,{separator:", "}),this.push("]")}function C(t){this.push("typeof "),this.print(t.argument,t)}function S(t){this.push("type "),this.print(t.id,t),this.print(t.typeParameters,t),this.space(),this.push("="),this.space(),this.print(t.right,t),this.semicolon()}function F(t){this.push(":"),this.space(),t.optional&&this.push("?"),this.print(t.typeAnnotation,t)}function w(t){var e=this;this.push("<"),this.printJoin(t.params,t,{separator:", ",iterator:function(t){e.print(t.typeAnnotation,t)}}),this.push(">")}function B(t){var e=this;this.push("{");var n=t.properties.concat(t.callProperties,t.indexers);n.length&&(this.space(),this.printJoin(n,t,{separator:!1,indent:!0,iterator:function(){1!==n.length&&(e.semicolon(),e.space())}}),this.space()),this.push("}")}function T(t){t["static"]&&this.push("static "),this.print(t.value,t)}function _(t){t["static"]&&this.push("static "),this.push("["),this.print(t.id,t),this.push(":"),this.space(),this.print(t.key,t),this.push("]"),this.push(":"),this.space(),this.print(t.value,t)}function k(t){t["static"]&&this.push("static "),this.print(t.key,t),t.optional&&this.push("?"),R.isFunctionTypeAnnotation(t.value)||(this.push(":"),this.space()),this.print(t.value,t)}function P(t){this.print(t.qualification,t),this.push("."),this.print(t.id,t)}function N(t){this.printJoin(t.types,t,{separator:" | "})}function I(t){this.push("("),this.print(t.expression,t),this.print(t.typeAnnotation,t),this.push(")")}function L(){this.push("void")}var O=t(278)["default"];n.__esModule=!0,n.AnyTypeAnnotation=r,n.ArrayTypeAnnotation=i,n.BooleanTypeAnnotation=s,n.BooleanLiteralTypeAnnotation=a,n.DeclareClass=o,n.DeclareFunction=u,n.DeclareModule=p,n.DeclareVariable=l,n.ExistentialTypeParam=c,n.FunctionTypeAnnotation=f,n.FunctionTypeParam=h,n.InterfaceExtends=d,n._interfaceish=m,n.InterfaceDeclaration=y,n.IntersectionTypeAnnotation=g,n.MixedTypeAnnotation=v,n.NullableTypeAnnotation=A,n.NumberTypeAnnotation=E,n.StringLiteralTypeAnnotation=b,n.StringTypeAnnotation=x,n.TupleTypeAnnotation=D,n.TypeofTypeAnnotation=C,n.TypeAlias=S,n.TypeAnnotation=F,n.TypeParameterInstantiation=w,n.ObjectTypeAnnotation=B,n.ObjectTypeCallProperty=T,n.ObjectTypeIndexer=_,n.ObjectTypeProperty=k,n.QualifiedTypeIdentifier=P,n.UnionTypeAnnotation=N,n.TypeCastExpression=I,n.VoidTypeAnnotation=L;var M=t(279),R=O(M);n.ClassImplements=d,n.GenericTypeAnnotation=d;var j=t(260);n.NumericLiteralTypeAnnotation=j.NumericLiteral,n.TypeParameterDeclaration=w},{260:260,278:278,279:279}],255:[function(t,e,n){"use strict";function r(t){this.print(t.name,t),t.value&&(this.push("="),this.print(t.value,t))}function i(t){this.push(t.name)}function s(t){this.print(t.namespace,t),this.push(":"),this.print(t.name,t)}function a(t){this.print(t.object,t),this.push("."),this.print(t.property,t)}function o(t){this.push("{..."),this.print(t.argument,t),this.push("}")}function u(t){this.push("{"),this.print(t.expression,t),this.push("}")}function p(t){this.push(t.value,!0)}function l(t){var e=t.openingElement;if(this.print(e,t),!e.selfClosing){this.indent();for(var n=t.children,r=Array.isArray(n),i=0,n=r?n:d(n);;){var s;if(r){if(i>=n.length)break;s=n[i++]}else{if(i=n.next(),i.done)break;s=i.value}var a=s;this.print(a,t)}this.dedent(),this.print(t.closingElement,t)}}function c(t){this.push("<"),this.print(t.name,t),t.attributes.length>0&&(this.push(" "),this.printJoin(t.attributes,t,{separator:" "})),this.push(t.selfClosing?" />":">")}function f(t){this.push("</"),this.print(t.name,t),this.push(">")}function h(){}var d=t(270)["default"];n.__esModule=!0,n.JSXAttribute=r,n.JSXIdentifier=i,n.JSXNamespacedName=s,n.JSXMemberExpression=a,n.JSXSpreadAttribute=o,n.JSXExpressionContainer=u,n.JSXText=p,n.JSXElement=l,n.JSXOpeningElement=c,n.JSXClosingElement=f,n.JSXEmptyExpression=h},{270:270}],256:[function(t,e,n){"use strict";function r(t){var e=this;this.print(t.typeParameters,t),this.push("("),this.printList(t.params,t,{iterator:function(t){t.optional&&e.push("?"),e.print(t.typeAnnotation,t)}}),this.push(")"),t.returnType&&this.print(t.returnType,t)}function i(t){var e=t.kind,n=t.key;("method"===e||"init"===e)&&t.generator&&this.push("*"),("get"===e||"set"===e)&&this.push(e+" "),t.async&&this.push("async "),t.computed?(this.push("["),this.print(n,t),this.push("]")):this.print(n,t),this._params(t),this.space(),this.print(t.body,t)}function s(t){t.async&&this.push("async "),this.push("function"),t.generator&&this.push("*"),t.id?(this.push(" "),this.print(t.id,t)):this.space(),this._params(t),this.space(),this.print(t.body,t)}function a(t){t.async&&this.push("async "),1===t.params.length&&p.isIdentifier(t.params[0])?this.print(t.params[0],t):this._params(t),this.push(" => ");var e=p.isObjectExpression(t.body);e&&this.push("("),this.print(t.body,t),e&&this.push(")")}var o=t(278)["default"];n.__esModule=!0,n._params=r,n._method=i,n.FunctionExpression=s,n.ArrowFunctionExpression=a;var u=t(279),p=o(u);n.FunctionDeclaration=s},{278:278,279:279}],257:[function(t,e,n){"use strict";function r(t){this.print(t.imported,t),t.local&&t.local.name!==t.imported.name&&(this.push(" as "),this.print(t.local,t))}function i(t){this.print(t.local,t)}function s(t){this.print(t.exported,t)}function a(t){this.print(t.local,t),t.exported&&t.local.name!==t.exported.name&&(this.push(" as "),this.print(t.exported,t))}function o(t){this.push("* as "),this.print(t.exported,t)}function u(t){this.push("export *"),t.exported&&(this.push(" as "),this.print(t.exported,t)),this.push(" from "),this.print(t.source,t),this.semicolon()}function p(){this.push("export "),c.apply(this,arguments)}function l(){this.push("export default "),c.apply(this,arguments)}function c(t){if(t.declaration){var e=t.declaration;if(this.print(e,t),y.isStatement(e)||y.isFunction(e)||y.isClass(e))return}else{"type"===t.exportKind&&this.push("type ");for(var n=t.specifiers.slice(0),r=!1;;){var i=n[0];if(!y.isExportDefaultSpecifier(i)&&!y.isExportNamespaceSpecifier(i))break;r=!0,this.print(n.shift(),t),n.length&&this.push(", ")}(n.length||!n.length&&!r)&&(this.push("{"),n.length&&(this.space(),this.printJoin(n,t,{separator:", "}),this.space()),this.push("}")),t.source&&(this.push(" from "),this.print(t.source,t))}this.ensureSemicolon()}function f(t){this.push("import "),("type"===t.importKind||"typeof"===t.importKind)&&this.push(t.importKind+" ");var e=t.specifiers.slice(0);if(e&&e.length){for(;;){var n=e[0];if(!y.isImportDefaultSpecifier(n)&&!y.isImportNamespaceSpecifier(n))break;this.print(e.shift(),t),e.length&&this.push(", ")}e.length&&(this.push("{"),this.space(),this.printJoin(e,t,{separator:", "}),this.space(),this.push("}")),this.push(" from ")}this.print(t.source,t),this.semicolon()}function h(t){this.push("* as "),this.print(t.local,t)}var d=t(278)["default"];n.__esModule=!0,n.ImportSpecifier=r,n.ImportDefaultSpecifier=i,n.ExportDefaultSpecifier=s,n.ExportSpecifier=a,n.ExportNamespaceSpecifier=o,n.ExportAllDeclaration=u,n.ExportNamedDeclaration=p,n.ExportDefaultDeclaration=l,n.ImportDeclaration=f,n.ImportNamespaceSpecifier=h;var m=t(279),y=d(m)},{278:278,279:279}],258:[function(t,e,n){"use strict";function r(t){this.keyword("with"),this.push("("),this.print(t.object,t),this.push(")"),this.printBlock(t)}function i(t){this.keyword("if"),this.push("("),this.print(t.test,t),this.push(")"),this.space(),this.printAndIndentOnComments(t.consequent,t),t.alternate&&(this.isLast("}")&&this.space(),this.push("else "),this.printAndIndentOnComments(t.alternate,t))}function s(t){this.keyword("for"),this.push("("),this._inForStatementInit=!0,this.print(t.init,t),this._inForStatementInit=!1,this.push(";"),t.test&&(this.space(),this.print(t.test,t)),this.push(";"),t.update&&(this.space(),this.print(t.update,t)),this.push(")"),this.printBlock(t)}function a(t){this.keyword("while"),this.push("("),this.print(t.test,t),this.push(")"),this.printBlock(t)}function o(t){this.push("do "),this.print(t.body,t),this.space(),this.keyword("while"),this.push("("),this.print(t.test,t),this.push(");")}function u(t){var e=arguments.length<=1||void 0===arguments[1]?"label":arguments[1];return function(n){this.push(t);var r=n[e];if(r){this.push(" ");var i=this.startTerminatorless();this.print(r,n),this.endTerminatorless(i)}this.semicolon()}}function p(t){this.print(t.label,t),this.push(": "),this.print(t.body,t)}function l(t){this.keyword("try"),this.print(t.block,t),this.space(),t.handlers?this.print(t.handlers[0],t):this.print(t.handler,t),t.finalizer&&(this.space(),this.push("finally "),this.print(t.finalizer,t))}function c(t){this.keyword("catch"),this.push("("),this.print(t.param,t),this.push(") "),this.print(t.body,t)}function f(t){this.keyword("switch"),this.push("("),this.print(t.discriminant,t),this.push(")"),this.space(),this.push("{"),this.printSequence(t.cases,t,{indent:!0,addNewlines:function(e,n){return e||t.cases[t.cases.length-1]!==n?void 0:-1}}),this.push("}")}function h(t){t.test?(this.push("case "),this.print(t.test,t),this.push(":")):this.push("default:"),t.consequent.length&&(this.newline(),this.printSequence(t.consequent,t,{indent:!0}))}function d(){this.push("debugger;")}function m(t,e){this.push(t.kind+" ");var n=!1;if(!D.isFor(e))for(var r=t.declarations,i=Array.isArray(r),s=0,r=i?r:g(r);;){var a;if(i){if(s>=r.length)break;a=r[s++]}else{if(s=r.next(),s.done)break;a=s.value}var o=a;o.init&&(n=!0)}var u=void 0;this.format.compact||this.format.concise||!n||this.format.retainLines||(u=",\n"+b["default"](" ",t.kind.length+1)),this.printList(t.declarations,t,{separator:u}),(!D.isFor(e)||e.left!==t&&e.init!==t)&&this.semicolon()}function y(t){this.print(t.id,t),this.print(t.id.typeAnnotation,t),t.init&&(this.space(),this.push("="),this.space(),this.print(t.init,t))}var g=t(270)["default"],v=t(277)["default"],A=t(278)["default"];n.__esModule=!0,n.WithStatement=r,n.IfStatement=i,n.ForStatement=s,n.WhileStatement=a,n.DoWhileStatement=o,n.LabeledStatement=p,n.TryStatement=l,n.CatchClause=c,n.SwitchStatement=f,n.SwitchCase=h,n.DebuggerStatement=d,n.VariableDeclaration=m,n.VariableDeclarator=y;var E=t(389),b=v(E),x=t(279),D=A(x),C=function(t){return function(e){this.keyword("for"),this.push("("),this.print(e.left,e),this.push(" "+t+" "),this.print(e.right,e),this.push(")"),this.printBlock(e)}},S=C("in");n.ForInStatement=S;var F=C("of");n.ForOfStatement=F;var w=u("continue");n.ContinueStatement=w;var B=u("return","argument");n.ReturnStatement=B;var T=u("break");n.BreakStatement=T;var _=u("throw","argument");n.ThrowStatement=_},{270:270,277:277,278:278,279:279,389:389}],259:[function(t,e,n){"use strict";function r(t){this.print(t.tag,t),this.print(t.quasi,t)}function i(t){this._push(t.value.raw)}function s(t){this.push("`");for(var e=t.quasis,n=0;n<e.length;n++)this.print(e[n],t),n+1<e.length&&(this._push("${ "),this.print(t.expressions[n],t),this.push(" }"));this._push("`")}n.__esModule=!0,n.TaggedTemplateExpression=r,n.TemplateElement=i,n.TemplateLiteral=s},{}],260:[function(t,e,n){"use strict";function r(t){this.push(t.name)}function i(t){this.push("..."),this.print(t.argument,t)}function s(t){var e=t.properties;this.push("{"),this.printInnerComments(t),e.length&&(this.space(),this.printList(e,t,{indent:!0}),this.space()),this.push("}")}function a(t){this.printJoin(t.decorators,t,{separator:""}),this._method(t)}function o(t){if(this.printJoin(t.decorators,t,{separator:""}),t.computed)this.push("["),this.print(t.key,t),this.push("]");else{if(g.isAssignmentPattern(t.value)&&g.isIdentifier(t.key)&&t.key.name===t.value.left.name)return void this.print(t.value,t);if(this.print(t.key,t),t.shorthand&&g.isIdentifier(t.key)&&g.isIdentifier(t.value)&&t.key.name===t.value.name)return}this.push(":"),this.space(),this.print(t.value,t)}function u(t){var e=t.elements,n=e.length;this.push("["),this.printInnerComments(t);for(var r=0;r<e.length;r++){var i=e[r];i?(r>0&&this.space(),this.print(i,t),n-1>r&&this.push(",")):this.push(",")}this.push("]")}function p(t){this.push("/"+t.pattern+"/"+t.flags)}function l(t){this.push(t.value?"true":"false")}function c(){this.push("null")}function f(t){this.push(t.value+"")}function h(t){this.push(this._stringLiteral(t.value))}function d(t){return t=JSON.stringify(t),t=t.replace(/[\u000A\u000D\u2028\u2029]/g,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)}),"single"===this.format.quotes&&(t=t.slice(1,-1),t=t.replace(/\\"/g,'"'),t=t.replace(/'/g,"\\'"),t="'"+t+"'"),t}var m=t(278)["default"];n.__esModule=!0,n.Identifier=r,n.RestElement=i,n.ObjectExpression=s,n.ObjectMethod=a,n.ObjectProperty=o,n.ArrayExpression=u,n.RegExpLiteral=p,n.BooleanLiteral=l,n.NullLiteral=c,n.NumericLiteral=f,n.StringLiteral=h,n._stringLiteral=d;var y=t(279),g=m(y);n.SpreadElement=i,n.SpreadProperty=i,n.RestProperty=i,n.ObjectPattern=s,n.ArrayPattern=u},{278:278,279:279}],261:[function(t,e,n){"use strict";var r=t(276)["default"],i=t(275)["default"],s=t(277)["default"],a=t(278)["default"];n.__esModule=!0;var o=t(328),u=s(o),p=t(268),l=s(p),c=t(267),f=s(c),h=t(265),d=s(h),m=t(269),y=a(m),g=t(266),v=s(g),A=function(t){function e(n,r,s){i(this,e),r=r||{};var a=n.comments||[],o=n.tokens||[],u=e.normalizeOptions(s,r,o),p=new d["default"];t.call(this,p,u),this.comments=a,this.position=p,this.tokens=o,this.format=u,this.opts=r,this.ast=n,this.whitespace=new l["default"](o),this.map=new f["default"](p,r,s)}return r(e,t),e.normalizeOptions=function(t,n,r){var i=" ";if(t){var s=u["default"](t).indent;s&&" "!==s&&(i=s)}var a={auxiliaryCommentBefore:n.auxiliaryCommentBefore,auxiliaryCommentAfter:n.auxiliaryCommentAfter,shouldPrintComment:n.shouldPrintComment,retainLines:n.retainLines,comments:null==n.comments||n.comments,compact:n.compact,concise:n.concise,quotes:e.findCommonStringDelimiter(t,r),indent:{adjustMultilineComment:!0,style:i,base:0}};return"auto"===a.compact&&(a.compact=t.length>1e5,a.compact&&console.error("[BABEL] "+y.get("codeGeneratorDeopt",n.filename,"100KB"))),a.compact&&(a.indent.adjustMultilineComment=!1),a},e.findCommonStringDelimiter=function(t,e){for(var n={single:0,"double":0},r=0,i=0;i<e.length;i++){var s=e[i];if("string"===s.type.label){var a=t.slice(s.start,s.end);if("'"===a[0]?n.single++:n["double"]++,r++,r>=3)break}}return n.single>n["double"]?"single":"double"},e.prototype.generate=function(){return this.print(this.ast),this.printAuxAfterComment(),{map:this.map.get(),code:this.get()}},e}(v["default"]);n.CodeGenerator=A,n["default"]=function(t,e,n){var r=new A(t,e,n);return r.generate()}},{265:265,266:266,267:267,268:268,269:269,275:275,276:276,277:277,278:278,328:328}],262:[function(t,e,n){"use strict";function r(t,e,n){if(t){for(var r=void 0,i=s(t),a=0;a<i.length;a++){var o=i[a];if(g.is(o,e)){var u=t[o];if(r=u(e,n),null!=r)break}}return r}}var i=t(275)["default"],s=t(273)["default"],a=t(277)["default"],o=t(278)["default"];n.__esModule=!0;var u=t(264),p=a(u),l=t(263),c=o(l),f=t(332),h=a(f),d=t(335),m=a(d),y=t(279),g=o(y),v=function(){function t(e,n){i(this,t),this.parent=n,this.node=e}return t.isUserWhitespacable=function(t){return g.isUserWhitespacable(t)},t.needsWhitespace=function(e,n,i){if(!e)return 0;g.isExpressionStatement(e)&&(e=e.expression);var s=r(p["default"].nodes,e,n);if(!s){var a=r(p["default"].list,e,n);if(a)for(var o=0;o<a.length&&!(s=t.needsWhitespace(a[o],e,i));o++);}return s&&s[i]||0},t.needsWhitespaceBefore=function(e,n){return t.needsWhitespace(e,n,"before")},t.needsWhitespaceAfter=function(e,n){return t.needsWhitespace(e,n,"after")},t.needsParens=function(t,e){if(!e)return!1;if(g.isNewExpression(e)&&e.callee===t){if(g.isCallExpression(t))return!0;var n=m["default"](t,function(t){return g.isCallExpression(t)});if(n)return!0}return r(c,t,e)},t}();n["default"]=v,h["default"](v,function(t,e){v.prototype[e]=function(){var t=new Array(arguments.length+2);t[0]=this.node,t[1]=this.parent;for(var n=0;n<t.length;n++)t[n+2]=arguments[n];return v[e].apply(null,t)}}),e.exports=n["default"]},{263:263,264:264,273:273,275:275,277:277,278:278,279:279,332:332,335:335}],263:[function(t,e,n){"use strict";function r(t,e){return v.isArrayTypeAnnotation(e)}function i(t,e){return v.isMemberExpression(e)&&e.object===t?!0:!1}function s(t,e){return v.isExpressionStatement(e)?!0:v.isMemberExpression(e)&&e.object===t?!0:!1}function a(t,e){if((v.isCallExpression(e)||v.isNewExpression(e))&&e.callee===t)return!0;if(v.isUnaryLike(e))return!0;if(v.isMemberExpression(e)&&e.object===t)return!0;if(v.isBinary(e)){var n=e.operator,r=A[n],i=t.operator,s=A[i];if(r>s)return!0;if(r===s&&e.right===t&&!v.isLogicalExpression(e))return!0}return!1}function o(t,e){if("in"===t.operator){if(v.isVariableDeclarator(e))return!0;if(v.isFor(e))return!0}return!1}function u(t,e){return v.isForStatement(e)?!1:v.isExpressionStatement(e)&&e.expression===t?!1:v.isReturnStatement(e)?!1:!0}function p(t,e){return v.isBinary(e)||v.isUnaryLike(e)||v.isCallExpression(e)||v.isMemberExpression(e)||v.isNewExpression(e)||v.isConditionalExpression(e)||v.isYieldExpression(e)}function l(t,e){return v.isExpressionStatement(e)?!0:v.isExportDeclaration(e)?!0:!1}function c(t,e){return v.isMemberExpression(e,{object:t})?!0:v.isCallExpression(e,{callee:t})||v.isNewExpression(e,{callee:t})?!0:!1}function f(t,e){return v.isExpressionStatement(e)?!0:h(t,e)}function h(t,e){return v.isExportDeclaration(e)?!0:c(t,e)}function d(t,e){return v.isUnaryLike(e)?!0:v.isBinary(e)?!0:v.isConditionalExpression(e,{test:t})?!0:c(t,e)}function m(t){return v.isObjectPattern(t.left)?!0:d.apply(void 0,arguments)}var y=t(278)["default"];n.__esModule=!0,n.NullableTypeAnnotation=r,n.UpdateExpression=i,n.ObjectExpression=s,n.Binary=a,n.BinaryExpression=o,n.SequenceExpression=u,n.YieldExpression=p,n.ClassExpression=l,n.UnaryLike=c,n.FunctionExpression=f,n.ArrowFunctionExpression=h,n.ConditionalExpression=d,n.AssignmentExpression=m;var g=t(279),v=y(g),A={"||":0,"&&":1,"|":2,"^":3,"&":4,"==":5,"===":5,"!=":5,"!==":5,"<":6,">":6,"<=":6,">=":6,"in":6,"instanceof":6,">>":7,"<<":7,">>>":7,"+":8,"-":8,"*":9,"/":9,"%":9,"**":10};n.FunctionTypeAnnotation=r},{278:278,279:279}],264:[function(t,e,n){"use strict";function r(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return m.isMemberExpression(t)?(r(t.object,e),t.computed&&r(t.property,e)):m.isBinary(t)||m.isAssignmentExpression(t)?(r(t.left,e),r(t.right,e)):m.isCallExpression(t)?(e.hasCall=!0,r(t.callee,e)):m.isFunction(t)?e.hasFunction=!0:m.isIdentifier(t)&&(e.hasHelper=e.hasHelper||i(t.callee)),e}function i(t){return m.isMemberExpression(t)?i(t.object)||i(t.property):m.isIdentifier(t)?"require"===t.name||"_"===t.name[0]:m.isCallExpression(t)?i(t.callee):m.isBinary(t)||m.isAssignmentExpression(t)?m.isIdentifier(t.left)&&i(t.left)||i(t.right):!1}function s(t){return m.isLiteral(t)||m.isObjectExpression(t)||m.isArrayExpression(t)||m.isIdentifier(t)||m.isMemberExpression(t)}var a=t(277)["default"],o=t(278)["default"],u=t(377),p=a(u),l=t(332),c=a(l),f=t(334),h=a(f),d=t(279),m=o(d);n.nodes={AssignmentExpression:function(t){var e=r(t.right);return e.hasCall&&e.hasHelper||e.hasFunction?{before:e.hasFunction,after:!0}:void 0},SwitchCase:function(t,e){return{before:t.consequent.length||e.cases[0]===t}},LogicalExpression:function(t){return m.isFunction(t.left)||m.isFunction(t.right)?{after:!0}:void 0},Literal:function(t){return"use strict"===t.value?{after:!0}:void 0},CallExpression:function(t){return m.isFunction(t.callee)||i(t)?{before:!0,after:!0}:void 0},VariableDeclaration:function(t){for(var e=0;e<t.declarations.length;e++){var n=t.declarations[e],a=i(n.id)&&!s(n.init);if(!a){var o=r(n.init);a=i(n.init)&&o.hasCall||o.hasFunction}if(a)return{before:!0,after:!0}}},IfStatement:function(t){return m.isBlockStatement(t.consequent)?{before:!0,after:!0}:void 0}},n.nodes.ObjectProperty=n.nodes.ObjectMethod=n.nodes.SpreadProperty=function(t,e){return e.properties[0]===t?{before:!0}:void 0},n.list={VariableDeclaration:function(t){return h["default"](t.declarations,"init")},ArrayExpression:function(t){return t.elements},ObjectExpression:function(t){return t.properties}},c["default"]({Function:!0,Class:!0,Loop:!0,LabeledStatement:!0,SwitchStatement:!0,TryStatement:!0},function(t,e){p["default"](t)&&(t={after:t,before:t}),c["default"]([e].concat(m.FLIPPED_ALIAS_KEYS[e]||[]),function(e){n.nodes[e]=function(){return t}})})},{277:277,278:278,279:279,332:332,334:334,377:377}],265:[function(t,e,n){"use strict";var r=t(275)["default"];n.__esModule=!0;var i=function(){function t(){r(this,t),this.line=1,this.column=0}return t.prototype.push=function(t){for(var e=0;e<t.length;e++)"\n"===t[e]?(this.line++,this.column=0):this.column++},t.prototype.unshift=function(t){for(var e=0;e<t.length;e++)"\n"===t[e]?this.line--:this.column--},t}();n["default"]=i,e.exports=n["default"]},{275:275}],266:[function(t,e,n){"use strict";var r=t(276)["default"],i=t(275)["default"],s=t(270)["default"],a=t(271)["default"],o=t(277)["default"],u=t(278)["default"];n.__esModule=!0;var p=t(389),l=o(p),c=t(250),f=o(c),h=t(262),d=o(h),m=t(279),y=u(m),g=function(t){function e(){i(this,e);for(var n=arguments.length,r=Array(n),s=0;n>s;s++)r[s]=arguments[s];t.call.apply(t,[this].concat(r)),this.insideAux=!1,this.printAuxAfterOnNextUserNode=!1}return r(e,t),e.prototype.print=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(t){e&&e._compact&&(t._compact=!0);var r=this.insideAux;this.insideAux=!t.loc;var i=this.format.concise;t._compact&&(this.format.concise=!0);var s=this[t.type];if(!s)throw new ReferenceError("unknown node of type "+JSON.stringify(t.type)+" with constructor "+JSON.stringify(t&&t.constructor.name));t.loc&&this.printAuxAfterComment(),this.printAuxBeforeComment(r);var a=d["default"].needsParens(t,e);a&&this.push("("),this.printLeadingComments(t,e),this.catchUp(t),this._printNewline(!0,t,e,n),n.before&&n.before(),this.map.mark(t,"start"),this._print(t,e),this.printTrailingComments(t,e),a&&this.push(")"),this.map.mark(t,"end"),n.after&&n.after(),this.format.concise=i,this.insideAux=r,this._printNewline(!1,t,e,n)}},e.prototype.printAuxBeforeComment=function(t){var e=this.format.auxiliaryCommentBefore;!t&&this.insideAux&&(this.printAuxAfterOnNextUserNode=!0,e&&this.printComment({type:"CommentBlock",value:e}))},e.prototype.printAuxAfterComment=function(){if(this.printAuxAfterOnNextUserNode){this.printAuxAfterOnNextUserNode=!1;var t=this.format.auxiliaryCommentAfter;t&&this.printComment({type:"CommentBlock",value:t})}},e.prototype.getPossibleRaw=function(t){var e=t.extra;return e&&null!=e.raw&&null!=e.rawValue&&t.value===e.rawValue?e.raw:void 0},e.prototype._print=function(t,e){var n=this.getPossibleRaw(t);if(n)this.push(""),this._push(n);else{var r=this[t.type];r.call(this,t,e)}},e.prototype.printJoin=function(t,e){var n=this,r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(t&&t.length){var i=t.length,s=void 0,a=void 0;r.indent&&this.indent();var o={statement:r.statement,addNewlines:r.addNewlines,after:function(){r.iterator&&r.iterator(s,a),r.separator&&i-1>a&&n.push(r.separator)}};for(a=0;a<t.length;a++)s=t[a],this.print(s,e,o);r.indent&&this.dedent()}},e.prototype.printAndIndentOnComments=function(t,e){var n=!!t.leadingComments;n&&this.indent(),this.print(t,e),n&&this.dedent()},e.prototype.printBlock=function(t){var e=t.body;y.isEmptyStatement(e)?this.semicolon():(this.push(" "),this.print(e,t))},e.prototype.generateComment=function(t){var e=t.value;return e="CommentLine"===t.type?"//"+e:"/*"+e+"*/"},e.prototype.printTrailingComments=function(t,e){this.printComments(this.getComments("trailingComments",t,e))},e.prototype.printLeadingComments=function(t,e){this.printComments(this.getComments("leadingComments",t,e))},e.prototype.printInnerComments=function(t){var e=arguments.length<=1||void 0===arguments[1]?!0:arguments[1];t.innerComments&&(e&&this.indent(),this.printComments(t.innerComments),e&&this.dedent())},e.prototype.printSequence=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return n.statement=!0,this.printJoin(t,e,n)},e.prototype.printList=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return null==n.separator&&(n.separator=",",this.format.compact||(n.separator+=" ")),this.printJoin(t,e,n)},e.prototype._printNewline=function(t,e,n,r){if(r.statement||d["default"].isUserWhitespacable(e,n)){var i=0;if(null==e.start||e._ignoreUserWhitespace){t||i++,r.addNewlines&&(i+=r.addNewlines(t,e)||0);var s=d["default"].needsWhitespaceAfter;t&&(s=d["default"].needsWhitespaceBefore),s(e,n)&&i++,this.buf||(i=0)}else i=t?this.whitespace.getNewlinesBefore(e):this.whitespace.getNewlinesAfter(e);this.newline(i)}},e.prototype.getComments=function(t,e){return e&&e[t]||[]},e.prototype.shouldPrintComment=function(t){return this.format.shouldPrintComment?this.format.shouldPrintComment(t.value):t.value.indexOf("@license")>=0||t.value.indexOf("@preserve")>=0?!0:this.format.comments},e.prototype.printComment=function(t){if(this.shouldPrintComment(t)&&!t.ignore){if(t.ignore=!0,null!=t.start){if(this.printedCommentStarts[t.start])return;this.printedCommentStarts[t.start]=!0}this.catchUp(t),this.newline(this.whitespace.getNewlinesBefore(t));var e=this.position.column,n=this.generateComment(t);if(e&&!this.isLast(["\n"," ","[","{"])&&(this._push(" "),e++),"CommentBlock"===t.type&&this.format.indent.adjustMultilineComment){var r=t.loc&&t.loc.start.column;if(r){var i=new RegExp("\\n\\s{1,"+r+"}","g");n=n.replace(i,"\n")}var s=Math.max(this.indentSize(),e);n=n.replace(/\n/g,"\n"+l["default"](" ",s))}0===e&&(n=this.getIndent()+n),(this.format.compact||this.format.retainLines)&&"CommentLine"===t.type&&(n+="\n"),this._push(n),this.newline(this.whitespace.getNewlinesAfter(t))}},e.prototype.printComments=function(t){if(t&&t.length)for(var e=t,n=Array.isArray(e),r=0,e=n?e:s(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var a=i;this.printComment(a)}},e}(f["default"]);n["default"]=g;for(var v=[t(259),t(253),t(258),t(252),t(256),t(257),t(260),t(254),t(251),t(255)],A=0;A<v.length;A++){var E=v[A];a(g.prototype,E)}e.exports=n["default"]},{250:250,251:251,252:252,253:253,254:254,255:255,256:256,257:257,258:258,259:259,260:260,262:262,270:270,271:271,275:275,276:276,277:277,278:278,279:279,389:389}],267:[function(t,e,n){"use strict";var r=t(275)["default"],i=t(277)["default"],s=t(278)["default"];n.__esModule=!0;var a=t(400),o=i(a),u=t(279),p=s(u),l=function(){function t(e,n,i){r(this,t),this.position=e,this.opts=n,n.sourceMaps?(this.map=new o["default"].SourceMapGenerator({file:n.sourceMapTarget,sourceRoot:n.sourceRoot}),this.map.setSourceContent(n.sourceFileName,i)):this.map=null}return t.prototype.get=function(){var t=this.map;return t?t.toJSON():t},t.prototype.mark=function(t,e){var n=t.loc;if(n){var r=this.map;if(r&&!p.isProgram(t)&&!p.isFile(t)){var i=this.position,s={line:i.line,column:i.column},a=n[e];r.addMapping({source:this.opts.sourceFileName,generated:s,original:a})}}},t}();n["default"]=l,e.exports=n["default"]},{275:275,277:277,278:278,279:279,400:400}],268:[function(t,e,n){"use strict";function r(t,e,n){return t+=e,t>=n&&(t-=n),t}var i=t(275)["default"];n.__esModule=!0;var s=function(){function t(e){i(this,t),this.tokens=e,this.used={},this._lastFoundIndex=0}return t.prototype.getNewlinesBefore=function(t){for(var e=void 0,n=void 0,i=this.tokens,s=0;s<i.length;s++){var a=r(s,this._lastFoundIndex,this.tokens.length),o=i[a];if(t.start===o.start){e=i[a-1],n=o,this._lastFoundIndex=a;break}}return this.getNewlinesBetween(e,n)},t.prototype.getNewlinesAfter=function(t){for(var e=void 0,n=void 0,i=this.tokens,s=0;s<i.length;s++){var a=r(s,this._lastFoundIndex,this.tokens.length),o=i[a];if(t.end===o.end){e=o,n=i[a+1],","===n.type.label&&(n=i[a+2]),this._lastFoundIndex=a;break}}if(n&&"eof"===n.type.label)return 1;var u=this.getNewlinesBetween(e,n);return"CommentLine"!==t.type||u?u:1},t.prototype.getNewlinesBetween=function(t,e){if(!e||!e.loc)return 0;for(var n=t?t.loc.end.line:1,r=e.loc.start.line,i=0,s=n;r>s;s++)"undefined"==typeof this.used[s]&&(this.used[s]=!0,i++);return i},t}();n["default"]=s,e.exports=n["default"]},{275:275}],269:[function(t,e,n){arguments[4][54][0].apply(n,arguments)},{418:418,54:54}],270:[function(t,e,n){arguments[4][55][0].apply(n,arguments)},{280:280,55:55}],271:[function(t,e,n){e.exports={"default":t(281),__esModule:!0}},{281:281}],272:[function(t,e,n){arguments[4][57][0].apply(n,arguments)},{282:282,57:57}],273:[function(t,e,n){e.exports={"default":t(283),__esModule:!0}},{283:283}],274:[function(t,e,n){arguments[4][61][0].apply(n,arguments)},{284:284,61:61}],275:[function(t,e,n){arguments[4][62][0].apply(n,arguments)},{62:62}],276:[function(t,e,n){arguments[4][64][0].apply(n,arguments)},{272:272,274:274,64:64}],277:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{15:15}],278:[function(t,e,n){arguments[4][67][0].apply(n,arguments)},{67:67}],279:[function(t,e,n){arguments[4][71][0].apply(n,arguments)},{645:645,71:71}],280:[function(t,e,n){arguments[4][77][0].apply(n,arguments)},{321:321,326:326,327:327,77:77}],281:[function(t,e,n){t(323),e.exports=t(290).Object.assign},{290:290,323:323}],282:[function(t,e,n){arguments[4][79][0].apply(n,arguments)},{305:305,79:79}],283:[function(t,e,n){t(324),e.exports=t(290).Object.keys},{290:290,324:324}],284:[function(t,e,n){arguments[4][83][0].apply(n,arguments)},{290:290,325:325,83:83}],285:[function(t,e,n){arguments[4][84][0].apply(n,arguments)},{84:84}],286:[function(t,e,n){arguments[4][85][0].apply(n,arguments)},{85:85}],287:[function(t,e,n){arguments[4][86][0].apply(n,arguments)},{300:300,86:86}],288:[function(t,e,n){arguments[4][87][0].apply(n,arguments);
},{289:289,319:319,87:87}],289:[function(t,e,n){arguments[4][88][0].apply(n,arguments)},{88:88}],290:[function(t,e,n){arguments[4][92][0].apply(n,arguments)},{92:92}],291:[function(t,e,n){arguments[4][93][0].apply(n,arguments)},{285:285,93:93}],292:[function(t,e,n){arguments[4][94][0].apply(n,arguments)},{94:94}],293:[function(t,e,n){arguments[4][95][0].apply(n,arguments)},{295:295,95:95}],294:[function(t,e,n){arguments[4][96][0].apply(n,arguments)},{290:290,291:291,296:296,96:96}],295:[function(t,e,n){arguments[4][97][0].apply(n,arguments)},{97:97}],296:[function(t,e,n){arguments[4][100][0].apply(n,arguments)},{100:100}],297:[function(t,e,n){arguments[4][101][0].apply(n,arguments)},{101:101}],298:[function(t,e,n){arguments[4][102][0].apply(n,arguments)},{102:102,293:293,305:305,309:309}],299:[function(t,e,n){arguments[4][103][0].apply(n,arguments)},{103:103,289:289}],300:[function(t,e,n){arguments[4][105][0].apply(n,arguments)},{105:105}],301:[function(t,e,n){arguments[4][107][0].apply(n,arguments)},{107:107,298:298,305:305,309:309,312:312,319:319}],302:[function(t,e,n){arguments[4][108][0].apply(n,arguments)},{108:108,294:294,297:297,298:298,301:301,304:304,305:305,306:306,310:310,312:312,319:319}],303:[function(t,e,n){arguments[4][109][0].apply(n,arguments)},{109:109}],304:[function(t,e,n){arguments[4][110][0].apply(n,arguments)},{110:110}],305:[function(t,e,n){arguments[4][111][0].apply(n,arguments)},{111:111}],306:[function(t,e,n){arguments[4][112][0].apply(n,arguments)},{112:112}],307:[function(t,e,n){var r=t(305),i=t(317),s=t(299);e.exports=t(295)(function(){var t=Object.assign,e={},n={},r=Symbol(),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach(function(t){n[t]=t}),7!=t({},e)[r]||Object.keys(t({},n)).join("")!=i})?function(t,e){for(var n=i(t),a=arguments,o=a.length,u=1,p=r.getKeys,l=r.getSymbols,c=r.isEnum;o>u;)for(var f,h=s(a[u++]),d=l?p(h).concat(l(h)):p(h),m=d.length,y=0;m>y;)c.call(h,f=d[y++])&&(n[f]=h[f]);return n}:Object.assign},{295:295,299:299,305:305,317:317}],308:[function(t,e,n){arguments[4][113][0].apply(n,arguments)},{113:113,290:290,294:294,295:295}],309:[function(t,e,n){arguments[4][114][0].apply(n,arguments)},{114:114}],310:[function(t,e,n){arguments[4][116][0].apply(n,arguments)},{116:116,298:298}],311:[function(t,e,n){arguments[4][117][0].apply(n,arguments)},{117:117,287:287,291:291,300:300,305:305}],312:[function(t,e,n){arguments[4][119][0].apply(n,arguments)},{119:119,297:297,305:305,319:319}],313:[function(t,e,n){arguments[4][120][0].apply(n,arguments)},{120:120,296:296}],314:[function(t,e,n){arguments[4][122][0].apply(n,arguments)},{122:122,292:292,315:315}],315:[function(t,e,n){arguments[4][123][0].apply(n,arguments)},{123:123}],316:[function(t,e,n){arguments[4][124][0].apply(n,arguments)},{124:124,292:292,299:299}],317:[function(t,e,n){var r=t(292);e.exports=function(t){return Object(r(t))}},{292:292}],318:[function(t,e,n){arguments[4][126][0].apply(n,arguments)},{126:126}],319:[function(t,e,n){arguments[4][127][0].apply(n,arguments)},{127:127,296:296,313:313,318:318}],320:[function(t,e,n){arguments[4][128][0].apply(n,arguments)},{128:128,288:288,290:290,304:304,319:319}],321:[function(t,e,n){arguments[4][129][0].apply(n,arguments)},{129:129,287:287,290:290,320:320}],322:[function(t,e,n){arguments[4][130][0].apply(n,arguments)},{130:130,286:286,302:302,303:303,304:304,316:316}],323:[function(t,e,n){var r=t(294);r(r.S+r.F,"Object",{assign:t(307)})},{294:294,307:307}],324:[function(t,e,n){var r=t(317);t(308)("keys",function(t){return function(e){return t(r(e))}})},{308:308,317:317}],325:[function(t,e,n){arguments[4][134][0].apply(n,arguments)},{134:134,294:294,311:311}],326:[function(t,e,n){arguments[4][136][0].apply(n,arguments)},{136:136,302:302,314:314}],327:[function(t,e,n){arguments[4][138][0].apply(n,arguments)},{138:138,304:304,322:322}],328:[function(t,e,n){"use strict";function r(t){var e=0,n=0,r=0;for(var i in t){var s=t[i],a=s[0],o=s[1];(a>n||a===n&&o>r)&&(n=a,r=o,e=+i)}return e}var i=t(389),s=/^(?:( )+|\t+)/;e.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected a string");var e,n,a=0,o=0,u=0,p={};t.split(/\n/g).forEach(function(t){if(t){var r,i=t.match(s);i?(r=i[0].length,i[1]?o++:a++):r=0;var l=r-u;u=r,l?(n=l>0,e=p[n?l:-l],e?e[0]++:e=p[l]=[1,0]):e&&(e[1]+=+n)}});var l,c,f=r(p);return f?o>=a?(l="space",c=i(" ",f)):(l="tab",c=i(" ",f)):(l=null,c=""),{amount:f,type:l,indent:c}}},{389:389}],329:[function(t,e,n){arguments[4][27][0].apply(n,arguments)},{27:27,388:388}],330:[function(t,e,n){var r=t(329);e.exports=Number.isInteger||function(t){return"number"==typeof t&&r(t)&&Math.floor(t)===t}},{329:329}],331:[function(t,e,n){arguments[4][142][0].apply(n,arguments)},{142:142}],332:[function(t,e,n){arguments[4][144][0].apply(n,arguments)},{144:144,333:333}],333:[function(t,e,n){arguments[4][145][0].apply(n,arguments)},{145:145,336:336,340:340,358:358}],334:[function(t,e,n){function r(t,e,n){var r=o(t)?i:a;return e=s(e,n,3),r(t,e)}var i=t(337),s=t(339),a=t(347),o=t(376);e.exports=r},{337:337,339:339,347:347,376:376}],335:[function(t,e,n){function r(t,e,n){var r=o(t)?i:a;return n&&u(t,e,n)&&(e=void 0),("function"!=typeof e||void 0!==n)&&(e=s(e,n,3)),r(t,e)}var i=t(338),s=t(339),a=t(353),o=t(376),u=t(367);e.exports=r},{338:338,339:339,353:353,367:367,376:376}],336:[function(t,e,n){arguments[4][150][0].apply(n,arguments)},{150:150}],337:[function(t,e,n){function r(t,e){for(var n=-1,r=t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}e.exports=r},{}],338:[function(t,e,n){arguments[4][151][0].apply(n,arguments)},{151:151}],339:[function(t,e,n){arguments[4][155][0].apply(n,arguments)},{155:155,348:348,349:349,355:355,386:386,387:387}],340:[function(t,e,n){arguments[4][159][0].apply(n,arguments)},{159:159,342:342,356:356}],341:[function(t,e,n){arguments[4][160][0].apply(n,arguments)},{160:160,357:357}],342:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{162:162,341:341,383:383}],343:[function(t,e,n){arguments[4][163][0].apply(n,arguments)},{163:163,373:373}],344:[function(t,e,n){arguments[4][165][0].apply(n,arguments)},{165:165,345:345,370:370,381:381}],345:[function(t,e,n){arguments[4][166][0].apply(n,arguments)},{166:166,359:359,360:360,361:361,376:376,382:382}],346:[function(t,e,n){arguments[4][167][0].apply(n,arguments)},{167:167,344:344,373:373}],347:[function(t,e,n){arguments[4][168][0].apply(n,arguments)},{168:168,340:340,365:365}],348:[function(t,e,n){arguments[4][169][0].apply(n,arguments)},{169:169,346:346,363:363,373:373}],349:[function(t,e,n){arguments[4][170][0].apply(n,arguments)},{170:170,331:331,343:343,344:344,352:352,368:368,371:371,373:373,374:374,376:376}],350:[function(t,e,n){arguments[4][173][0].apply(n,arguments)},{173:173}],351:[function(t,e,n){arguments[4][174][0].apply(n,arguments)},{174:174,343:343,374:374}],352:[function(t,e,n){arguments[4][175][0].apply(n,arguments)},{175:175}],353:[function(t,e,n){function r(t,e){var n;return i(t,function(t,r,i){return n=e(t,r,i),!n}),!!n}var i=t(340);e.exports=r},{340:340}],354:[function(t,e,n){arguments[4][177][0].apply(n,arguments)},{177:177}],355:[function(t,e,n){arguments[4][179][0].apply(n,arguments)},{179:179,386:386}],356:[function(t,e,n){arguments[4][183][0].apply(n,arguments)},{183:183,362:362,369:369,373:373}],357:[function(t,e,n){arguments[4][184][0].apply(n,arguments)},{184:184,373:373}],358:[function(t,e,n){arguments[4][186][0].apply(n,arguments)},{186:186,355:355,376:376}],359:[function(t,e,n){arguments[4][187][0].apply(n,arguments)},{187:187,338:338}],360:[function(t,e,n){arguments[4][188][0].apply(n,arguments)},{188:188}],361:[function(t,e,n){arguments[4][189][0].apply(n,arguments)},{189:189,383:383}],362:[function(t,e,n){arguments[4][191][0].apply(n,arguments)},{191:191,350:350}],363:[function(t,e,n){arguments[4][192][0].apply(n,arguments)},{192:192,371:371,385:385}],364:[function(t,e,n){arguments[4][193][0].apply(n,arguments)},{193:193,379:379}],365:[function(t,e,n){arguments[4][198][0].apply(n,arguments)},{198:198,362:362,369:369}],366:[function(t,e,n){arguments[4][199][0].apply(n,arguments)},{199:199}],367:[function(t,e,n){arguments[4][200][0].apply(n,arguments)},{200:200,365:365,366:366,381:381}],368:[function(t,e,n){arguments[4][201][0].apply(n,arguments)},{201:201,373:373,376:376}],369:[function(t,e,n){arguments[4][202][0].apply(n,arguments)},{202:202}],370:[function(t,e,n){arguments[4][203][0].apply(n,arguments)},{203:203}],371:[function(t,e,n){arguments[4][204][0].apply(n,arguments)},{204:204,381:381}],372:[function(t,e,n){arguments[4][205][0].apply(n,arguments)},{205:205,366:366,369:369,375:375,376:376,384:384}],373:[function(t,e,n){arguments[4][206][0].apply(n,arguments)},{206:206,381:381}],374:[function(t,e,n){arguments[4][207][0].apply(n,arguments)},{207:207,354:354,376:376}],375:[function(t,e,n){arguments[4][210][0].apply(n,arguments)},{210:210,365:365,370:370}],376:[function(t,e,n){arguments[4][211][0].apply(n,arguments)},{211:211,364:364,369:369,370:370}],377:[function(t,e,n){arguments[4][212][0].apply(n,arguments)},{212:212,370:370}],378:[function(t,e,n){arguments[4][213][0].apply(n,arguments)},{213:213,381:381}],379:[function(t,e,n){arguments[4][214][0].apply(n,arguments)},{214:214,370:370,378:378}],380:[function(t,e,n){function r(t){return"number"==typeof t||i(t)&&o.call(t)==s}var i=t(370),s="[object Number]",a=Object.prototype,o=a.toString;e.exports=r},{370:370}],381:[function(t,e,n){arguments[4][215][0].apply(n,arguments)},{215:215}],382:[function(t,e,n){arguments[4][219][0].apply(n,arguments)},{219:219,369:369,370:370}],383:[function(t,e,n){arguments[4][223][0].apply(n,arguments)},{223:223,364:364,365:365,372:372,381:381}],384:[function(t,e,n){arguments[4][224][0].apply(n,arguments)},{224:224,366:366,369:369,375:375,376:376,381:381}],385:[function(t,e,n){arguments[4][226][0].apply(n,arguments)},{226:226,373:373,383:383}],386:[function(t,e,n){arguments[4][230][0].apply(n,arguments)},{230:230}],387:[function(t,e,n){arguments[4][231][0].apply(n,arguments)},{231:231,350:350,351:351,368:368}],388:[function(t,e,n){arguments[4][28][0].apply(n,arguments)},{28:28}],389:[function(t,e,n){arguments[4][26][0].apply(n,arguments)},{26:26,329:329}],390:[function(t,e,n){arguments[4][238][0].apply(n,arguments)},{238:238,399:399}],391:[function(t,e,n){arguments[4][239][0].apply(n,arguments)},{239:239,392:392}],392:[function(t,e,n){arguments[4][240][0].apply(n,arguments)},{240:240}],393:[function(t,e,n){arguments[4][241][0].apply(n,arguments)},{241:241}],394:[function(t,e,n){arguments[4][242][0].apply(n,arguments)},{242:242,399:399}],395:[function(t,e,n){arguments[4][243][0].apply(n,arguments)},{243:243}],396:[function(t,e,n){arguments[4][244][0].apply(n,arguments)},{244:244,390:390,391:391,393:393,395:395,399:399}],397:[function(t,e,n){arguments[4][245][0].apply(n,arguments)},{245:245,390:390,391:391,394:394,399:399}],398:[function(t,e,n){arguments[4][246][0].apply(n,arguments)},{246:246,397:397,399:399}],399:[function(t,e,n){arguments[4][247][0].apply(n,arguments)},{247:247}],400:[function(t,e,n){arguments[4][248][0].apply(n,arguments)},{248:248,396:396,397:397,398:398}],401:[function(t,e,n){"use strict";e.exports=function(t){for(var e=t.length;/[\s\uFEFF\u00A0]/.test(t[e-1]);)e--;return t.slice(0,e)}},{}],402:[function(t,e,n){"use strict";var r=t(405)["default"];n.__esModule=!0;var i=t(406),s=r(i),a={};n["default"]=a,a["typeof"]=s["default"]('\n (function (obj) {\n return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;\n });\n'),a.createRawReactElement=s["default"]('\n (function () {\n var REACT_ELEMENT_TYPE = (typeof Symbol === "function" && Symbol.for && Symbol.for("react.element")) || 0xeac7;\n\n return function createRawReactElement (type, key, props) {\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n ref: null,\n props: props,\n _owner: null,\n };\n };\n\n })()\n'),a.asyncToGenerator=s["default"]('\n (function (fn) {\n return function () {\n var gen = fn.apply(this, arguments);\n\n return new Promise(function (resolve, reject) {\n var callNext = step.bind(null, "next");\n var callThrow = step.bind(null, "throw");\n\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(callNext, callThrow);\n }\n }\n\n callNext();\n });\n };\n })\n'),a.classCallCheck=s["default"]('\n (function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError("Cannot call a class as a function");\n }\n });\n'),a.createClass=s["default"]('\n (function() {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i ++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if ("value" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n })()\n'),a.defaultProps=s["default"]('\n (function (defaultProps, props) {\n if (defaultProps) {\n for (var propName in defaultProps) {\n if (typeof props[propName] === "undefined") {\n props[propName] = defaultProps[propName];\n }\n }\n }\n return props;\n })\n'),a.defineEnumerableProperties=s["default"]('\n (function (obj, descs) {\n for (var key in descs) {\n var desc = descs[key];\n desc.configurable = desc.enumerable = true;\n if ("value" in desc) desc.writable = true;\n Object.defineProperty(obj, key, desc);\n }\n return obj;\n })\n'),a.defaults=s["default"]("\n (function (obj, defaults) {\n var keys = Object.getOwnPropertyNames(defaults);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = Object.getOwnPropertyDescriptor(defaults, key);\n if (value && value.configurable && obj[key] === undefined) {\n Object.defineProperty(obj, key, value);\n }\n }\n return obj;\n })\n"),a.defineProperty=s["default"]("\n (function (obj, key, value) {\n // Shortcircuit the slow defineProperty path when possible.\n // We are trying to avoid issues where setters defined on the\n // prototype cause side effects under the fast path of simple\n // assignment. By checking for existence of the property with\n // the in operator, we can optimize most of this overhead away.\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n });\n"),a["extends"]=s["default"]("\n Object.assign || (function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n })\n"),a.get=s["default"]('\n (function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if ("value" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n });\n'),a.inherits=s["default"]('\n (function (subClass, superClass) {\n if (typeof superClass !== "function" && superClass !== null) {\n throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n })\n'),a["instanceof"]=s["default"]('\n (function (left, right) {\n if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {\n return right[Symbol.hasInstance](left);\n } else {\n return left instanceof right;\n }\n });\n'),a.interopRequireDefault=s["default"]("\n (function (obj) {\n return obj && obj.__esModule ? obj : { default: obj };\n })\n"),a.interopRequireWildcard=s["default"]("\n (function (obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n newObj.default = obj;\n return newObj;\n }\n })\n"),a.newArrowCheck=s["default"]('\n (function (innerThis, boundThis) {\n if (innerThis !== boundThis) {\n throw new TypeError("Cannot instantiate an arrow function");\n }\n });\n'),a.objectDestructuringEmpty=s["default"]('\n (function (obj) {\n if (obj == null) throw new TypeError("Cannot destructure undefined");\n });\n'),a.objectWithoutProperties=s["default"]("\n (function (obj, keys) {\n var target = {};\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) continue;\n if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n target[i] = obj[i];\n }\n return target;\n })\n"),a.possibleConstructorReturn=s["default"]('\n (function (self, call) {\n if (!self) {\n throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");\n }\n return call && (typeof call === "object" || typeof call === "function") ? call : self;\n });\n'),a.selfGlobal=s["default"]('\n typeof global === "undefined" ? self : global\n'),a.set=s["default"]('\n (function set(object, property, value, receiver) {\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent !== null) {\n set(parent, property, value, receiver);\n }\n } else if ("value" in desc && desc.writable) {\n desc.value = value;\n } else {\n var setter = desc.set;\n\n if (setter !== undefined) {\n setter.call(receiver, value);\n }\n }\n\n return value;\n });\n'),a.slicedToArray=s["default"]('\n (function () {\n // Broken out into a separate function to avoid deoptimizations due to the try/catch for the\n // array iterator case.\n function sliceIterator(arr, i) {\n // this is an expanded form of `for...of` that properly supports abrupt completions of\n // iterators etc. variable names have been minimised to reduce the size of this massive\n // helper. sometimes spec compliancy is annoying :(\n //\n // _n = _iteratorNormalCompletion\n // _d = _didIteratorError\n // _e = _iteratorError\n // _i = _iterator\n // _s = _step\n\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i["return"]) _i["return"]();\n } finally {\n if (_d) throw _e;\n }\n }\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError("Invalid attempt to destructure non-iterable instance");\n }\n };\n })();\n'),a.slicedToArrayLoose=s["default"]('\n (function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n var _arr = [];\n for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {\n _arr.push(_step.value);\n if (i && _arr.length === i) break;\n }\n return _arr;\n } else {\n throw new TypeError("Invalid attempt to destructure non-iterable instance");\n }\n });\n'),a.taggedTemplateLiteral=s["default"]("\n (function (strings, raw) {\n return Object.freeze(Object.defineProperties(strings, {\n raw: { value: Object.freeze(raw) }\n }));\n });\n"),a.taggedTemplateLiteralLoose=s["default"]("\n (function (strings, raw) {\n strings.raw = raw;\n return strings;\n });\n"),a.temporalRef=s["default"]('\n (function (val, name, undef) {\n if (val === undef) {\n throw new ReferenceError(name + " is not defined - temporal dead zone");\n } else {\n return val;\n }\n })\n'),a.temporalUndefined=s["default"]("\n ({})\n"),a.toArray=s["default"]("\n (function (arr) {\n return Array.isArray(arr) ? arr : Array.from(arr);\n });\n"),a.toConsumableArray=s["default"]("\n (function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n return arr2;\n } else {\n return Array.from(arr);\n }\n });\n"),e.exports=n["default"]},{405:405,406:406}],403:[function(t,e,n){"use strict";function r(t){var e=o["default"][t];if(!e)throw ReferenceError;return e().expression}var i=t(404)["default"],s=t(405)["default"];n.__esModule=!0,n.get=r;var a=t(402),o=s(a),u=i(o["default"]).map(function(t){return"_"===t[0]?t.slice(1):t}).filter(function(t){return"__esModule"!==t});n.list=u,n["default"]=r},{402:402,404:404,405:405}],404:[function(t,e,n){arguments[4][273][0].apply(n,arguments)},{273:273,407:407}],405:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{15:15}],406:[function(t,e,n){arguments[4][69][0].apply(n,arguments)},{420:420,69:69}],407:[function(t,e,n){arguments[4][283][0].apply(n,arguments)},{283:283,409:409,417:417}],408:[function(t,e,n){arguments[4][84][0].apply(n,arguments)},{84:84}],409:[function(t,e,n){arguments[4][92][0].apply(n,arguments)},{92:92}],410:[function(t,e,n){arguments[4][93][0].apply(n,arguments)},{408:408,93:93}],411:[function(t,e,n){arguments[4][94][0].apply(n,arguments)},{94:94}],412:[function(t,e,n){arguments[4][96][0].apply(n,arguments)},{409:409,410:410,414:414,96:96}],413:[function(t,e,n){arguments[4][97][0].apply(n,arguments)},{97:97}],414:[function(t,e,n){arguments[4][100][0].apply(n,arguments)},{100:100}],415:[function(t,e,n){arguments[4][113][0].apply(n,arguments)},{113:113,409:409,412:412,413:413}],416:[function(t,e,n){arguments[4][317][0].apply(n,arguments)},{317:317,411:411}],417:[function(t,e,n){arguments[4][324][0].apply(n,arguments)},{324:324,415:415,416:416}],418:[function(t,e,n){"use strict";function r(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];var s=u[t];if(!s)throw new ReferenceError("Unknown message "+JSON.stringify(t));return n=i(n),s.replace(/\$(\d+)/g,function(t,e){return n[e-1]})}function i(t){return t.map(function(t){if(null!=t&&t.inspect)return t.inspect();try{return JSON.stringify(t)||t+""}catch(e){return o.inspect(t)}})}var s=t(419)["default"];n.__esModule=!0,n.get=r,n.parseArgs=i;var a=t(11),o=s(a),u={tailCallReassignmentDeopt:"Function reference has been reassigned, so it will probably be dereferenced, therefore we can't optimise this with confidence",classesIllegalBareSuper:"Illegal use of bare super",classesIllegalSuperCall:"Direct super call is illegal in non-constructor, use super.$1() instead",scopeDuplicateDeclaration:"Duplicate declaration $1",settersNoRest:"Setters aren't allowed to have a rest",noAssignmentsInForHead:"No assignments allowed in for-in/of head",expectedMemberExpressionOrIdentifier:"Expected type MemberExpression or Identifier",invalidParentForThisNode:"We don't know how to handle this node within the current parent - please open an issue",readOnly:"$1 is read-only",unknownForHead:"Unknown node type $1 in ForStatement",didYouMean:"Did you mean $1?",codeGeneratorDeopt:"Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.",missingTemplatesDirectory:"no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues",unsupportedOutputType:"Unsupported output type $1",illegalMethodName:"Illegal method name $1",lostTrackNodePath:"We lost track of this node's position, likely because the AST was directly manipulated",modulesIllegalExportName:"Illegal export $1",modulesDuplicateDeclarations:"Duplicate module declarations with the same source but in different scopes",undeclaredVariable:"Reference to undeclared variable $1",undeclaredVariableType:"Referencing a type alias outside of a type annotation",undeclaredVariableSuggestion:"Reference to undeclared variable $1 - did you mean $2?",traverseNeedsParent:"You must pass a scope and parentPath unless traversing a Program/File got a $1 node",traverseVerifyRootFunction:"You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?",traverseVerifyVisitorProperty:"You passed `traverse()` a visitor object with the property $1 that has the invalid property $2",traverseVerifyNodeType:"You gave us a visitor for the node type $1 but it's not a valid type",pluginNotObject:"Plugin $2 specified in $1 was expected to return an object when invoked but returned $3",pluginNotFunction:"Plugin $2 specified in $1 was expected to return a function but returned $3",pluginUnknown:"Unknown plugin $1 specified in $2 at $3",pluginInvalidProperty:"Plugin $2 specified in $1 provided an invalid property of $3"};n.MESSAGES=u},{11:11,419:419}],419:[function(t,e,n){arguments[4][67][0].apply(n,arguments)},{67:67}],420:[function(t,e,n){"use strict";function r(t,e){t=u["default"](t);var n=t,r=n.program;return e.length&&f["default"](t,A,null,e),r.body.length>1?r.body:r.body[0]}var i=t(421)["default"],s=t(422)["default"],a=t(423)["default"];n.__esModule=!0;var o=t(485),u=s(o),p=t(491),l=s(p),c=t(424),f=s(c),h=t(426),d=a(h),m=t(425),y=a(m),g="_fromTemplate",v=i();n["default"]=function(t){var e=(new Error).stack.split("\n").slice(1).join("\n"),n=function(){var r=void 0;try{r=d.parse(t,{allowReturnOutsideFunction:!0,allowSuperOutsideMethod:!0}),r=f["default"].removeProperties(r),f["default"].cheap(r,function(t){t[g]=!0})}catch(i){throw i.stack=i.stack+"from\n"+e,i}return n=function(){return r},r};return function(){for(var t=arguments.length,e=Array(t),i=0;t>i;i++)e[i]=arguments[i];return r(n(),e)}};var A={noScope:!0,enter:function(t,e){var n=t.node;if(n[v])return t.skip();y.isExpressionStatement(n)&&(n=n.expression);var r=void 0;if(y.isIdentifier(n)&&n[g])if(l["default"](e[0],n.name))r=e[0][n.name];else if("$"===n.name[0]){var i=+n.name.slice(1);e[i]&&(r=e[i])}null===r&&t.remove(),r&&(r[v]=!0,t.replaceInline(r))},exit:function(t){var e=t.node;f["default"].clearNode(e)}};e.exports=n["default"]},{421:421,422:422,423:423,424:424,425:425,426:426,485:485,491:491}],421:[function(t,e,n){e.exports={"default":t(427),__esModule:!0}},{427:427}],422:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{15:15}],423:[function(t,e,n){arguments[4][67][0].apply(n,arguments)},{67:67}],424:[function(t,e,n){arguments[4][70][0].apply(n,arguments)},{497:497,70:70}],425:[function(t,e,n){arguments[4][71][0].apply(n,arguments)},{645:645,71:71}],426:[function(t,e,n){arguments[4][72][0].apply(n,arguments)},{72:72,796:796}],427:[function(t,e,n){t(456),t(455),e.exports=t(431).Symbol},{431:431,455:455,456:456}],428:[function(t,e,n){arguments[4][84][0].apply(n,arguments)},{84:84}],429:[function(t,e,n){arguments[4][86][0].apply(n,arguments)},{444:444,86:86}],430:[function(t,e,n){arguments[4][88][0].apply(n,arguments)},{88:88}],431:[function(t,e,n){arguments[4][92][0].apply(n,arguments)},{92:92}],432:[function(t,e,n){arguments[4][93][0].apply(n,arguments)},{428:428,93:93}],433:[function(t,e,n){arguments[4][94][0].apply(n,arguments)},{94:94}],434:[function(t,e,n){arguments[4][95][0].apply(n,arguments)},{437:437,95:95}],435:[function(t,e,n){var r=t(445);e.exports=function(t){var e=r.getKeys(t),n=r.getSymbols;if(n)for(var i,s=n(t),a=r.isEnum,o=0;s.length>o;)a.call(t,i=s[o++])&&e.push(i);return e}},{445:445}],436:[function(t,e,n){arguments[4][96][0].apply(n,arguments)},{431:431,432:432,439:439,96:96}],437:[function(t,e,n){arguments[4][97][0].apply(n,arguments)},{97:97}],438:[function(t,e,n){arguments[4][99][0].apply(n,arguments)},{445:445,452:452,99:99}],439:[function(t,e,n){arguments[4][100][0].apply(n,arguments)},{100:100}],440:[function(t,e,n){arguments[4][101][0].apply(n,arguments)},{101:101}],441:[function(t,e,n){arguments[4][102][0].apply(n,arguments)},{102:102,434:434,445:445,448:448}],442:[function(t,e,n){arguments[4][103][0].apply(n,arguments)},{103:103,430:430}],443:[function(t,e,n){var r=t(430);e.exports=Array.isArray||function(t){return"Array"==r(t)}},{430:430}],444:[function(t,e,n){arguments[4][105][0].apply(n,arguments)},{105:105}],445:[function(t,e,n){arguments[4][111][0].apply(n,arguments)},{111:111}],446:[function(t,e,n){var r=t(445),i=t(452);e.exports=function(t,e){for(var n,s=i(t),a=r.getKeys(s),o=a.length,u=0;o>u;)if(s[n=a[u++]]===e)return n}},{445:445,452:452}],447:[function(t,e,n){arguments[4][112][0].apply(n,arguments)},{112:112}],448:[function(t,e,n){arguments[4][114][0].apply(n,arguments)},{114:114}],449:[function(t,e,n){arguments[4][116][0].apply(n,arguments)},{116:116,441:441}],450:[function(t,e,n){arguments[4][119][0].apply(n,arguments)},{119:119,440:440,445:445,454:454}],451:[function(t,e,n){arguments[4][120][0].apply(n,arguments)},{120:120,439:439}],452:[function(t,e,n){arguments[4][124][0].apply(n,arguments)},{124:124,433:433,442:442}],453:[function(t,e,n){arguments[4][126][0].apply(n,arguments)},{126:126}],454:[function(t,e,n){arguments[4][127][0].apply(n,arguments)},{127:127,439:439,451:451,453:453}],455:[function(t,e,n){arguments[4][2][0].apply(n,arguments)},{2:2}],456:[function(t,e,n){"use strict";var r=t(445),i=t(439),s=t(440),a=t(434),o=t(436),u=t(449),p=t(437),l=t(451),c=t(450),f=t(453),h=t(454),d=t(446),m=t(438),y=t(435),g=t(443),v=t(429),A=t(452),E=t(448),b=r.getDesc,x=r.setDesc,D=r.create,C=m.get,S=i.Symbol,F=i.JSON,w=F&&F.stringify,B=!1,T=h("_hidden"),_=r.isEnum,k=l("symbol-registry"),P=l("symbols"),N="function"==typeof S,I=Object.prototype,L=a&&p(function(){return 7!=D(x({},"a",{get:function(){return x(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=b(I,e);r&&delete I[e],x(t,e,n),r&&t!==I&&x(I,e,r)}:x,O=function(t){var e=P[t]=D(S.prototype);return e._k=t,a&&B&&L(I,t,{configurable:!0,set:function(e){s(this,T)&&s(this[T],t)&&(this[T][t]=!1),L(this,t,E(1,e))}}),e},M=function(t){return"symbol"==typeof t},R=function(t,e,n){return n&&s(P,e)?(n.enumerable?(s(t,T)&&t[T][e]&&(t[T][e]=!1),n=D(n,{enumerable:E(0,!1)})):(s(t,T)||x(t,T,E(1,{})),t[T][e]=!0),L(t,e,n)):x(t,e,n)},j=function(t,e){v(t);for(var n,r=y(e=A(e)),i=0,s=r.length;s>i;)R(t,n=r[i++],e[n]);return t},V=function(t,e){return void 0===e?D(t):j(D(t),e);
},U=function(t){var e=_.call(this,t);return e||!s(this,t)||!s(P,t)||s(this,T)&&this[T][t]?e:!0},G=function(t,e){var n=b(t=A(t),e);return!n||!s(P,e)||s(t,T)&&t[T][e]||(n.enumerable=!0),n},W=function(t){for(var e,n=C(A(t)),r=[],i=0;n.length>i;)s(P,e=n[i++])||e==T||r.push(e);return r},q=function(t){for(var e,n=C(A(t)),r=[],i=0;n.length>i;)s(P,e=n[i++])&&r.push(P[e]);return r},H=function(t){if(void 0!==t&&!M(t)){for(var e,n,r=[t],i=1,s=arguments;s.length>i;)r.push(s[i++]);return e=r[1],"function"==typeof e&&(n=e),(n||!g(e))&&(e=function(t,e){return n&&(e=n.call(this,t,e)),M(e)?void 0:e}),r[1]=e,w.apply(F,r)}},Y=p(function(){var t=S();return"[null]"!=w([t])||"{}"!=w({a:t})||"{}"!=w(Object(t))});N||(S=function(){if(M(this))throw TypeError("Symbol is not a constructor");return O(f(arguments.length>0?arguments[0]:void 0))},u(S.prototype,"toString",function(){return this._k}),M=function(t){return t instanceof S},r.create=V,r.isEnum=U,r.getDesc=G,r.setDesc=R,r.setDescs=j,r.getNames=m.get=W,r.getSymbols=q,a&&!t(447)&&u(I,"propertyIsEnumerable",U,!0));var J={"for":function(t){return s(k,t+="")?k[t]:k[t]=S(t)},keyFor:function(t){return d(k,t)},useSetter:function(){B=!0},useSimple:function(){B=!1}};r.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),function(t){var e=h(t);J[t]=N?e:O(e)}),B=!0,o(o.G+o.W,{Symbol:S}),o(o.S,"Symbol",J),o(o.S+o.F*!N,"Object",{create:V,defineProperty:R,defineProperties:j,getOwnPropertyDescriptor:G,getOwnPropertyNames:W,getOwnPropertySymbols:q}),F&&o(o.S+o.F*(!N||Y),"JSON",{stringify:H}),c(S,"Symbol"),c(Math,"Math",!0),c(i.JSON,"JSON",!0)},{429:429,434:434,435:435,436:436,437:437,438:438,439:439,440:440,443:443,445:445,446:446,447:447,448:448,449:449,450:450,451:451,452:452,453:453,454:454}],457:[function(t,e,n){arguments[4][142][0].apply(n,arguments)},{142:142}],458:[function(t,e,n){arguments[4][149][0].apply(n,arguments)},{149:149}],459:[function(t,e,n){arguments[4][150][0].apply(n,arguments)},{150:150}],460:[function(t,e,n){arguments[4][154][0].apply(n,arguments)},{154:154,462:462,492:492}],461:[function(t,e,n){arguments[4][156][0].apply(n,arguments)},{156:156,458:458,459:459,460:460,464:464,474:474,475:475,476:476,487:487,490:490}],462:[function(t,e,n){arguments[4][158][0].apply(n,arguments)},{158:158}],463:[function(t,e,n){arguments[4][160][0].apply(n,arguments)},{160:160,471:471}],464:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{162:162,463:463,492:492}],465:[function(t,e,n){arguments[4][163][0].apply(n,arguments)},{163:163,483:483}],466:[function(t,e,n){arguments[4][173][0].apply(n,arguments)},{173:173}],467:[function(t,e,n){arguments[4][175][0].apply(n,arguments)},{175:175}],468:[function(t,e,n){arguments[4][177][0].apply(n,arguments)},{177:177}],469:[function(t,e,n){arguments[4][179][0].apply(n,arguments)},{179:179,494:494}],470:[function(t,e,n){arguments[4][180][0].apply(n,arguments)},{180:180}],471:[function(t,e,n){arguments[4][184][0].apply(n,arguments)},{184:184,483:483}],472:[function(t,e,n){arguments[4][191][0].apply(n,arguments)},{191:191,466:466}],473:[function(t,e,n){arguments[4][193][0].apply(n,arguments)},{193:193,489:489}],474:[function(t,e,n){arguments[4][195][0].apply(n,arguments)},{195:195}],475:[function(t,e,n){arguments[4][196][0].apply(n,arguments)},{196:196,470:470}],476:[function(t,e,n){arguments[4][197][0].apply(n,arguments)},{197:197}],477:[function(t,e,n){arguments[4][198][0].apply(n,arguments)},{198:198,472:472,480:480}],478:[function(t,e,n){arguments[4][199][0].apply(n,arguments)},{199:199}],479:[function(t,e,n){arguments[4][201][0].apply(n,arguments)},{201:201,483:483,487:487}],480:[function(t,e,n){arguments[4][202][0].apply(n,arguments)},{202:202}],481:[function(t,e,n){arguments[4][203][0].apply(n,arguments)},{203:203}],482:[function(t,e,n){arguments[4][205][0].apply(n,arguments)},{205:205,478:478,480:480,486:486,487:487,493:493}],483:[function(t,e,n){arguments[4][206][0].apply(n,arguments)},{206:206,490:490}],484:[function(t,e,n){arguments[4][207][0].apply(n,arguments)},{207:207,468:468,487:487}],485:[function(t,e,n){arguments[4][209][0].apply(n,arguments)},{209:209,461:461,469:469}],486:[function(t,e,n){arguments[4][210][0].apply(n,arguments)},{210:210,477:477,481:481}],487:[function(t,e,n){arguments[4][211][0].apply(n,arguments)},{211:211,473:473,480:480,481:481}],488:[function(t,e,n){arguments[4][213][0].apply(n,arguments)},{213:213,490:490}],489:[function(t,e,n){arguments[4][214][0].apply(n,arguments)},{214:214,481:481,488:488}],490:[function(t,e,n){arguments[4][215][0].apply(n,arguments)},{215:215}],491:[function(t,e,n){function r(t,e){if(null==t)return!1;var n=d.call(t,e);if(!n&&!p(e)){if(e=f(e),t=1==e.length?t:i(t,s(e,0,-1)),null==t)return!1;e=c(e),n=d.call(t,e)}return n||l(t.length)&&u(e,t.length)&&(o(t)||a(t))}var i=t(465),s=t(467),a=t(486),o=t(487),u=t(478),p=t(479),l=t(480),c=t(457),f=t(484),h=Object.prototype,d=h.hasOwnProperty;e.exports=r},{457:457,465:465,467:467,478:478,479:479,480:480,484:484,486:486,487:487}],492:[function(t,e,n){arguments[4][223][0].apply(n,arguments)},{223:223,473:473,477:477,482:482,490:490}],493:[function(t,e,n){arguments[4][224][0].apply(n,arguments)},{224:224,478:478,480:480,486:486,487:487,490:490}],494:[function(t,e,n){arguments[4][230][0].apply(n,arguments)},{230:230}],495:[function(t,e,n){(function(r){"use strict";var i=t(527)["default"],s=t(522)["default"],a=t(528)["default"],o=t(529)["default"];n.__esModule=!0;var u=t(505),p=a(u),l=t(531),c=o(l),f="test"===r.env.NODE_ENV,h=function(){function t(e,n,r,s){i(this,t),this.parentPath=s,this.scope=e,this.state=r,this.opts=n}return t.prototype.shouldVisit=function(t){var e=this.opts;if(e.enter||e.exit)return!0;if(e[t.type])return!0;var n=c.VISITOR_KEYS[t.type];if(!n||!n.length)return!1;for(var r=n,i=Array.isArray(r),a=0,r=i?r:s(r);;){var o;if(i){if(a>=r.length)break;o=r[a++]}else{if(a=r.next(),a.done)break;o=a.value}var u=o;if(t[u])return!0}return!1},t.prototype.create=function(t,e,n,r){return p["default"].get({parentPath:this.parentPath,parent:t,container:e,key:n,listKey:r})},t.prototype.maybeQueue=function(t){if(this.trap)throw new Error("Infinite cycle detected");this.queue&&this.priorityQueue.push(t)},t.prototype.visitMultiple=function(t,e,n){if(0===t.length)return!1;for(var r=[],i=0;i<t.length;i++){var s=t[i];s&&this.shouldVisit(s)&&r.push(this.create(e,t,i,n))}return this.visitQueue(r)},t.prototype.visitSingle=function(t,e){return this.shouldVisit(t[e])?this.visitQueue([this.create(t,t,e)]):!1},t.prototype.visitQueue=function(t){this.queue=t,this.priorityQueue=[];for(var e=[],n=!1,r=t,i=Array.isArray(r),a=0,r=i?r:s(r);;){var o;if(i){if(a>=r.length)break;o=r[a++]}else{if(a=r.next(),a.done)break;o=a.value}var u=o;if(u.resync(),u.pushContext(this),f&&t.length>=1e3&&(this.trap=!0),!(e.indexOf(u.node)>=0)){if(e.push(u.node),u.visit()){n=!0;break}if(this.priorityQueue.length&&(n=this.visitQueue(this.priorityQueue),this.priorityQueue=[],this.queue=t,n))break}}for(var p=t,l=Array.isArray(p),c=0,p=l?p:s(p);;){var h;if(l){if(c>=p.length)break;h=p[c++]}else{if(c=p.next(),c.done)break;h=c.value}var u=h;u.popContext()}return this.queue=null,n},t.prototype.visit=function(t,e){var n=t[e];return n?Array.isArray(n)?this.visitMultiple(n,t,e):this.visitSingle(t,e):!1},t}();n["default"]=h,e.exports=n["default"]}).call(this,t(8))},{505:505,522:522,527:527,528:528,529:529,531:531,8:8}],496:[function(t,e,n){"use strict";var r=t(527)["default"];n.__esModule=!0;var i=function s(t,e){r(this,s),this.file=t,this.options=e};n["default"]=i,e.exports=n["default"]},{527:527}],497:[function(t,e,n){"use strict";function r(t,e,n,i,s){if(t){if(e||(e={}),!e.noScope&&!n&&"Program"!==t.type&&"File"!==t.type)throw new Error(m.get("traverseNeedsParent",t.type));h.explode(e),r.node(t,e,n,i,s)}}function i(t,e){t.node.type===e.type&&(e.has=!0,t.skip())}var s=t(522)["default"],a=t(524)["default"],o=t(528)["default"],u=t(529)["default"],p=t(530)["default"];n.__esModule=!0,n["default"]=r;var l=t(495),c=o(l),f=t(519),h=u(f),d=t(521),m=u(d),y=t(587),g=o(y),v=t(531),A=u(v),E=t(505);n.NodePath=p(E);var b=t(517);n.Scope=p(b);var x=t(496);n.Hub=p(x),n.visitors=h,r.visitors=h,r.verify=h.verify,r.explode=h.explode,r.NodePath=t(505),r.Scope=t(517),r.Hub=t(496),r.cheap=function(t,e){if(t){var n=A.VISITOR_KEYS[t.type];if(n){e(t);for(var i=n,a=Array.isArray(i),o=0,i=a?i:s(i);;){var u;if(a){if(o>=i.length)break;u=i[o++]}else{if(o=i.next(),o.done)break;u=o.value}var p=u,l=t[p];if(Array.isArray(l))for(var c=l,f=Array.isArray(c),h=0,c=f?c:s(c);;){var d;if(f){if(h>=c.length)break;d=c[h++]}else{if(h=c.next(),h.done)break;d=h.value}var m=d;r.cheap(m,e)}else r.cheap(l,e)}}}},r.node=function(t,e,n,r,i,a){var o=A.VISITOR_KEYS[t.type];if(o)for(var u=new c["default"](n,e,r,i),p=o,l=Array.isArray(p),f=0,p=l?p:s(p);;){var h;if(l){if(f>=p.length)break;h=p[f++]}else{if(f=p.next(),f.done)break;h=f.value}var d=h;if((!a||!a[d])&&u.visit(t,d))return}};var D=A.COMMENT_KEYS.concat(["tokens","comments","start","end","loc","raw","rawValue"]);r.clearNode=function(t){for(var e=D,n=Array.isArray(e),r=0,e=n?e:s(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var o=i;null!=t[o]&&(t[o]=void 0)}for(var o in t)"_"===o[0]&&null!=t[o]&&(t[o]=void 0);for(var u=a(t),p=u,l=Array.isArray(p),c=0,p=l?p:s(p);;){var f;if(l){if(c>=p.length)break;f=p[c++]}else{if(c=p.next(),c.done)break;f=c.value}var h=f;t[h]=null}},r.removeProperties=function(t){return r.cheap(t,r.clearNode),t},r.hasType=function(t,e,n,s){if(g["default"](s,t.type))return!1;if(t.type===n)return!0;var a={has:!1,type:n};return r(t,{blacklist:s,enter:i},e,a),a.has}},{495:495,496:496,505:505,517:517,519:519,521:521,522:522,524:524,528:528,529:529,530:530,531:531,587:587}],498:[function(t,e,n){"use strict";function r(t){for(var e=this;e=e.parentPath;)if(t(e))return e;return null}function i(t){var e=this;do if(t(e))return e;while(e=e.parentPath);return null}function s(){return this.findParent(function(t){return t.isFunction()||t.isProgram()})}function a(){var t=this;do if(Array.isArray(t.container))return t;while(t=t.parentPath)}function o(t){return this.getDeepestCommonAncestorFrom(t,function(t,e,n){for(var r=void 0,i=y.VISITOR_KEYS[t.type],s=n,a=Array.isArray(s),o=0,s=a?s:f(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if(o=s.next(),o.done)break;u=o.value}var p=u,l=p[e+1];if(r)if(l.listKey&&r.listKey===l.listKey&&l.key<r.key)r=l;else{var c=i.indexOf(r.parentKey),h=i.indexOf(l.parentKey);c>h&&(r=l)}else r=l}return r})}function u(t,e){var n=this;if(!t.length)return this;if(1===t.length)return t[0];var r=1/0,i=void 0,s=void 0,a=t.map(function(t){var e=[];do e.unshift(t);while((t=t.parentPath)&&t!==n);return e.length<r&&(r=e.length),e}),o=a[0];t:for(var u=0;r>u;u++){for(var p=o[u],l=a,c=Array.isArray(l),h=0,l=c?l:f(l);;){var d;if(c){if(h>=l.length)break;d=l[h++]}else{if(h=l.next(),h.done)break;d=h.value}var m=d;if(m[u]!==p)break t}i=u,s=p}if(s)return e?e(s,i,a):s;throw new Error("Couldn't find intersection")}function p(){var t=this,e=[];do e.push(t);while(t=t.parentPath);return e}function l(){for(var t=this;t;){for(var e=arguments,n=Array.isArray(e),r=0,e=n?e:f(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var s=i;if(t.node.type===s)return!0}t=t.parentPath}return!1}function c(t){var e=this;do if(e.isFunction()){var n=e.node.shadow;if(n){if(!t||n[t]!==!1)return e}else if(e.isArrowFunctionExpression())return e;return null}while(e=e.parentPath);return null}var f=t(522)["default"],h=t(529)["default"],d=t(528)["default"];n.__esModule=!0,n.findParent=r,n.find=i,n.getFunctionParent=s,n.getStatementParent=a,n.getEarliestCommonAncestorFrom=o,n.getDeepestCommonAncestorFrom=u,n.getAncestry=p,n.inType=l,n.inShadow=c;var m=t(531),y=h(m),g=t(505);d(g)},{505:505,522:522,528:528,529:529,531:531}],499:[function(t,e,n){"use strict";function r(){var t=this.node;if(t){var e=t.trailingComments,n=t.leadingComments;if(e||n){var r=this.getSibling(this.key-1),i=this.getSibling(this.key+1);r.node||(r=i),i.node||(i=r),r.addComments("trailing",n),i.addComments("leading",e)}}}function i(t,e,n){this.addComments(t,[{type:n?"CommentLine":"CommentBlock",value:e}])}function s(t,e){if(e){var n=this.node;if(n){var r=t+"Comments";n[r]?n[r]=n[r].concat(e):n[r]=e}}}n.__esModule=!0,n.shareCommentsWithSiblings=r,n.addComment=i,n.addComments=s},{}],500:[function(t,e,n){"use strict";n.__esModule=!0;var r="_paths";n.PATH_CACHE_KEY=r},{}],501:[function(t,e,n){"use strict";function r(t){var e=this.opts;return this.node&&this._call(e[t])?!0:this.node?this._call(e[this.node.type]&&e[this.node.type][t]):!1}function i(t){if(!t)return!1;for(var e=t,n=Array.isArray(e),r=0,e=n?e:x(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var s=i;if(s){var a=this.node;if(!a)return!0;var o=s.call(this.state,this,this.state);if(o)throw new Error("Unexpected return value from visitor method "+s);if(this.node!==a)return!0;if(this.shouldStop||this.shouldSkip||this.removed)return!0}}return!1}function s(){var t=this.opts.blacklist;return t&&t.indexOf(this.node.type)>-1}function a(){return this.node?this.isBlacklisted()?!1:this.opts.shouldSkip&&this.opts.shouldSkip(this)?!1:this.call("enter")||this.shouldSkip?this.shouldStop:(S["default"].node(this.node,this.opts,this.scope,this.state,this,this.skipKeys),this.call("exit"),this.shouldStop):!1}function o(){this.shouldSkip=!0}function u(t){this.skipKeys[t]=!0}function p(){this.shouldStop=!0,this.shouldSkip=!0}function l(){if(!this.opts||!this.opts.noScope){var t=this.context&&this.context.scope;if(!t)for(var e=this.parentPath;e&&!t;){if(e.opts&&e.opts.noScope)return;t=e.scope,e=e.parentPath}this.scope=this.getScope(t),this.scope&&this.scope.init()}}function c(t){return this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.skipKeys={},t&&(this.context=t,this.state=t.state,this.opts=t.opts),this.setScope(),this}function f(){this.removed||(this._resyncParent(),this._resyncList(),this._resyncKey())}function h(){this.parentPath&&(this.parent=this.parentPath.node)}function d(){if(this.container&&this.node!==this.container[this.key]){if(Array.isArray(this.container)){for(var t=0;t<this.container.length;t++)if(this.container[t]===this.node)return this.setKey(t)}else for(var e in this.container)if(this.container[e]===this.node)return this.setKey(e);this.key=null}}function m(){if(this.parent&&this.inList){var t=this.parent[this.listKey];this.container!==t&&(this.container=t||null)}}function y(){null!=this.key&&this.container&&this.container[this.key]===this.node||this._markRemoved()}function g(){this.contexts.pop(),this.setContext(this.contexts[this.contexts.length-1])}function v(t){this.contexts.push(t),this.setContext(t)}function A(t,e,n,r){this.inList=!!n,this.listKey=n,this.parentKey=n||r,this.container=e,this.parentPath=t||this.parentPath,this.setKey(r)}function E(t){this.key=t,this.node=this.container[this.key],this.type=this.node&&this.node.type}function b(){var t=arguments.length<=0||void 0===arguments[0]?this:arguments[0];if(!t.removed)for(var e=this.contexts,n=Array.isArray(e),r=0,e=n?e:x(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var s=i;s.maybeQueue(t)}}var x=t(522)["default"],D=t(528)["default"];n.__esModule=!0,n.call=r,n._call=i,n.isBlacklisted=s,n.visit=a,n.skip=o,n.skipKey=u,n.stop=p,n.setScope=l,n.setContext=c,n.resync=f,n._resyncParent=h,n._resyncKey=d,n._resyncList=m,n._resyncRemoved=y,n.popContext=g,n.pushContext=v,n.setup=A,n.setKey=E,n.requeue=b;var C=t(497),S=D(C)},{497:497,522:522,528:528}],502:[function(t,e,n){"use strict";function r(){var t=this.node,e=void 0;if(this.isMemberExpression())e=t.property;else{if(!this.isProperty()&&!this.isMethod())throw new ReferenceError("todo");e=t.key}return t.computed||u.isIdentifier(e)&&(e=u.stringLiteral(e.name)),e}function i(){return u.ensureBlock(this.node)}function s(){if(this.isArrowFunctionExpression()){this.ensureBlock();var t=this.node;t.expression=!1,t.type="FunctionExpression",t.shadow=t.shadow||!0}}var a=t(529)["default"];n.__esModule=!0,n.toComputedKey=r,n.ensureBlock=i,n.arrowFunctionToShadowed=s;var o=t(531),u=a(o)},{529:529,531:531}],503:[function(t,e,n){(function(e){"use strict";function r(){var t=this.evaluate();return t.confident?!!t.value:void 0}function i(){function t(t){r&&(i=t,r=!1)}function n(i){if(r){var u=i.node;if(i.isSequenceExpression()){var p=i.get("expressions");return n(p[p.length-1])}if(i.isStringLiteral()||i.isNumericLiteral()||i.isBooleanLiteral())return u.value;if(i.isNullLiteral())return null;if(i.isTemplateLiteral()){for(var l="",c=0,p=i.get("expressions"),f=u.quasis,h=Array.isArray(f),d=0,f=h?f:s(f);;){var m;if(h){if(d>=f.length)break;m=f[d++]}else{if(d=f.next(),d.done)break;m=d.value}var y=m;if(!r)break;l+=y.value.cooked;var g=p[c++];g&&(l+=String(n(g)))}if(r)return l}if(i.isConditionalExpression())return n(n(i.get("test"))?i.get("consequent"):i.get("alternate"));if(i.isExpressionWrapper())return n(i.get("expression"));if(i.isMemberExpression()&&!i.parentPath.isCallExpression({callee:u})){var v=i.get("property"),A=i.get("object");if(A.isLiteral()&&v.isIdentifier()){var E=A.node.value,b=typeof E;if("number"===b||"string"===b)return E[v.node.name]}}if(i.isReferencedIdentifier()){var x=i.scope.getBinding(u.name);if(x&&x.hasValue)return x.value;if("undefined"===u.name)return void 0;if("Infinity"===u.name)return 1/0;if("NaN"===u.name)return NaN;var D=i.resolve();return D===i?t(i):n(D)}if(i.isUnaryExpression({prefix:!0})){if("void"===u.operator)return void 0;var C=i.get("argument");if("typeof"===u.operator&&(C.isFunction()||C.isClass()))return"function";var S=n(C);switch(u.operator){case"!":return!S;case"+":return+S;case"-":return-S;case"~":return~S;case"typeof":return typeof S}}if(i.isArrayExpression()){for(var F=[],w=i.get("elements"),B=w,T=Array.isArray(B),_=0,B=T?B:s(B);;){var k;if(T){if(_>=B.length)break;k=B[_++]}else{if(_=B.next(),_.done)break;k=_.value}var y=k;if(y=y.evaluate(),!y.confident)return t(y);F.push(y.value)}return F}if(i.isObjectExpression(),i.isLogicalExpression()){var P=r,N=n(i.get("left")),I=r;r=P;var L=n(i.get("right")),O=r,M=I!==O;switch(r=I&&O,u.operator){case"||":return(N||L)&&M&&(r=!0),N||L;case"&&":return(!N&&I||!L&&O)&&(r=!0),N&&L}}if(i.isBinaryExpression()){var N=n(i.get("left")),L=n(i.get("right"));switch(u.operator){case"-":return N-L;case"+":return N+L;case"/":return N/L;case"*":return N*L;case"%":return N%L;case"**":return Math.pow(N,L);case"<":return L>N;case">":return N>L;case"<=":return L>=N;case">=":return N>=L;case"==":return N==L;case"!=":return N!=L;case"===":return N===L;case"!==":return N!==L;case"|":return N|L;case"&":return N&L;case"^":return N^L;case"<<":return N<<L;case">>":return N>>L;case">>>":return N>>>L}}if(i.isCallExpression()){var R=i.get("callee"),j=void 0,V=void 0;if(R.isIdentifier()&&!i.scope.getBinding(R.node.name,!0)&&a.indexOf(R.node.name)>=0&&(V=e[u.callee.name]),R.isMemberExpression()){var A=R.get("object"),v=R.get("property");if(A.isIdentifier()&&v.isIdentifier()&&a.indexOf(A.node.name)>=0&&o.indexOf(v.node.name)<0&&(j=e[A.node.name],V=j[v.node.name]),A.isLiteral()&&v.isIdentifier()){var b=typeof A.node.value;("string"===b||"number"===b)&&(j=A.node.value,V=j[v.node.name])}}if(V){var U=i.get("arguments").map(n);if(!r)return;return V.apply(j,U)}}t(i)}}var r=!0,i=void 0,u=n(this);return r||(u=void 0),{confident:r,deopt:i,value:u}}var s=t(522)["default"];n.__esModule=!0,n.evaluateTruthy=r,n.evaluate=i;var a=["String","Number","Math"],o=["random"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{522:522}],504:[function(t,e,n){"use strict";function r(){var t=this;do{if(!t.parentPath||Array.isArray(t.container)&&t.isStatement())break;t=t.parentPath}while(t);if(t&&(t.isProgram()||t.isFile()))throw new Error("File/Program node, we can't possibly find a statement parent to this");return t}function i(){return"left"===this.key?this.getSibling("right"):"right"===this.key?this.getSibling("left"):void 0}function s(){var t=[],e=function(e){e&&(t=t.concat(e.getCompletionRecords()))};if(this.isIfStatement())e(this.get("consequent")),e(this.get("alternate"));else if(this.isDoExpression()||this.isFor()||this.isWhile())e(this.get("body"));else if(this.isProgram()||this.isBlockStatement())e(this.get("body").pop());else{if(this.isFunction())return this.get("body").getCompletionRecords();this.isTryStatement()?(e(this.get("block")),e(this.get("handler")),e(this.get("finalizer"))):t.push(this)}return t}function a(t){return y["default"].get({parentPath:this.parentPath,parent:this.parent,container:this.container,listKey:this.listKey,key:t})}function o(t,e){e===!0&&(e=this.context);var n=t.split(".");return 1===n.length?this._getKey(t,e):this._getPattern(n,e)}function u(t,e){var n=this,r=this.node,i=r[t];return Array.isArray(i)?i.map(function(s,a){return y["default"].get({listKey:t,parentPath:n,parent:r,container:i,key:a}).setContext(e)}):y["default"].get({parentPath:this,parent:r,container:r,key:t}).setContext(e)}function p(t,e){for(var n=this,r=t,i=Array.isArray(r),s=0,r=i?r:f(r);;){var a;if(i){if(s>=r.length)break;a=r[s++]}else{if(s=r.next(),s.done)break;a=s.value}var o=a;n="."===o?n.parentPath:Array.isArray(n)?n[o]:n.get(o,e)}return n}function l(t){return v.getBindingIdentifiers(this.node,t)}function c(t){return v.getOuterBindingIdentifiers(this.node,t)}var f=t(522)["default"],h=t(528)["default"],d=t(529)["default"];n.__esModule=!0,n.getStatementParent=r,n.getOpposite=i,n.getCompletionRecords=s,n.getSibling=a,n.get=o,n._getKey=u,n._getPattern=p,n.getBindingIdentifiers=l,n.getOuterBindingIdentifiers=c;var m=t(505),y=h(m),g=t(531),v=d(g)},{505:505,522:522,528:528,529:529,531:531}],505:[function(t,e,n){"use strict";var r=t(527)["default"],i=t(522)["default"],s=t(529)["default"],a=t(528)["default"];n.__esModule=!0;var o=t(512),u=s(o),p=t(500),l=t(585),c=a(l),f=t(497),h=a(f),d=t(626),m=a(d),y=t(517),g=a(y),v=t(531),A=s(v),E=function(){function t(e,n){r(this,t),this.parent=n,this.hub=e,this.contexts=[],this.data={},this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.state=null,this.opts=null,this.skipKeys=null,this.parentPath=null,this.context=null,this.container=null,this.listKey=null,this.inList=!1,this.parentKey=null,this.key=null,this.node=null,this.scope=null,this.type=null,this.typeAnnotation=null}return t.get=function(e){var n=e.hub,r=e.parentPath,i=e.parent,s=e.container,a=e.listKey,o=e.key;!n&&r&&(n=r.hub),c["default"](i,"To get a node path the parent needs to exist");for(var u=s[o],l=i[p.PATH_CACHE_KEY]=i[p.PATH_CACHE_KEY]||[],f=void 0,h=0;h<l.length;h++){var d=l[h];if(d.node===u){f=d;break}}if(f&&!(f instanceof t)){if("NodePath"!==f.constructor.name)throw new Error("We found a path that isn't a NodePath instance. Possiblly due to bad serialisation.");f=null}return f||(f=new t(n,i),l.push(f)),f.setup(r,s,a,o),f},t.prototype.getScope=function(t){var e=t;return this.isScope()&&(e=new g["default"](this,t)),e},t.prototype.setData=function(t,e){return this.data[t]=e},t.prototype.getData=function(t,e){var n=this.data[t];return!n&&e&&(n=this.data[t]=e),n},t.prototype.buildCodeFrameError=function(t){var e=arguments.length<=1||void 0===arguments[1]?SyntaxError:arguments[1];return this.hub.file.buildCodeFrameError(this.node,t,e)},t.prototype.traverse=function(t,e){h["default"](this.node,t,this.scope,e,this)},t.prototype.mark=function(t,e){this.hub.file.metadata.marked.push({type:t,message:e,loc:this.node.loc})},t.prototype.set=function(t,e){A.validate(this.node,t,e),this.node[t]=e},t.prototype.dump=function(){var t=[],e=this;do{var n=e.key;e.inList&&(n=e.listKey+"["+n+"]"),t.unshift(n)}while(e=e.parentPath);console.log(t.join("."))},t}();n["default"]=E,m["default"](E.prototype,t(498)),m["default"](E.prototype,t(506)),m["default"](E.prototype,t(515)),m["default"](E.prototype,t(503)),m["default"](E.prototype,t(502)),m["default"](E.prototype,t(509)),m["default"](E.prototype,t(501)),m["default"](E.prototype,t(514)),m["default"](E.prototype,t(513)),m["default"](E.prototype,t(504)),m["default"](E.prototype,t(499));for(var b=function(){if(D){if(C>=x.length)return"break";S=x[C++]}else{if(C=x.next(),C.done)return"break";S=C.value}var t=S,e="is"+t;E.prototype[e]=function(t){return A[e](this.node,t)},E.prototype["assert"+t]=function(n){if(!this[e](n))throw new TypeError("Expected node path of type "+t)}},x=A.TYPES,D=Array.isArray(x),C=0,x=D?x:i(x);;){var S,F=b();if("break"===F)break}var w=function(t){if("_"===t[0])return"continue";A.TYPES.indexOf(t)<0&&A.TYPES.push(t);var e=u[t];E.prototype["is"+t]=function(t){return e.checkPath(this,t)}};for(var B in u){w(B)}e.exports=n["default"]},{497:497,498:498,499:499,500:500,501:501,502:502,503:503,504:504,506:506,509:509,512:512,513:513,514:514,515:515,517:517,522:522,527:527,528:528,529:529,531:531,585:585,626:626}],506:[function(t,e,n){"use strict";function r(){if(this.typeAnnotation)return this.typeAnnotation;var t=this._getTypeAnnotation()||m.anyTypeAnnotation();return m.isTypeAnnotation(t)&&(t=t.typeAnnotation),this.typeAnnotation=t}function i(){var t=this.node;{if(t){if(t.typeAnnotation)return t.typeAnnotation;var e=h[t.type];return e?e.call(this,t):(e=h[this.parentPath.type],e&&e.validParent?this.parentPath.getTypeAnnotation():void 0)}if("init"===this.key&&this.parentPath.isVariableDeclarator()){var n=this.parentPath.parentPath,r=n.parentPath;return"left"===n.key&&r.isForInStatement()?m.stringTypeAnnotation():"left"===n.key&&r.isForOfStatement()?m.anyTypeAnnotation():m.voidTypeAnnotation()}}}function s(t,e){return a(t,this.getTypeAnnotation(),e)}function a(t,e,n){if("string"===t)return m.isStringTypeAnnotation(e);if("number"===t)return m.isNumberTypeAnnotation(e);if("boolean"===t)return m.isBooleanTypeAnnotation(e);if("any"===t)return m.isAnyTypeAnnotation(e);if("mixed"===t)return m.isMixedTypeAnnotation(e);if("void"===t)return m.isVoidTypeAnnotation(e);if(n)return!1;throw new Error("Unknown base type "+t)}function o(t){var e=this.getTypeAnnotation();if(m.isAnyTypeAnnotation(e))return!0;if(m.isUnionTypeAnnotation(e)){for(var n=e.types,r=Array.isArray(n),i=0,n=r?n:l(n);;){var s;if(r){if(i>=n.length)break;s=n[i++]}else{if(i=n.next(),i.done)break;s=i.value}var o=s;if(m.isAnyTypeAnnotation(o)||a(t,o,!0))return!0}return!1}return a(t,e,!0)}function u(t){var e=this.getTypeAnnotation();return t=t.getTypeAnnotation(),!m.isAnyTypeAnnotation(e)&&m.isFlowBaseAnnotation(e)?t.type===e.type:void 0}function p(t){var e=this.getTypeAnnotation();return m.isGenericTypeAnnotation(e)&&m.isIdentifier(e.id,{name:t})}var l=t(522)["default"],c=t(529)["default"];n.__esModule=!0,n.getTypeAnnotation=r,n._getTypeAnnotation=i,n.isBaseType=s,n.couldBeBaseType=o,n.baseTypeStrictlyMatches=u,n.isGenericType=p;var f=t(508),h=c(f),d=t(531),m=c(d)},{508:508,522:522,529:529,531:531}],507:[function(t,e,n){"use strict";function r(t,e){var n=t.scope.getBinding(e),r=[];t.typeAnnotation=c.unionTypeAnnotation(r);var s=[],a=i(n,t,s),p=o(t,e);if(p&&!function(){var t=i(n,p.ifStatement);a=a.filter(function(e){return t.indexOf(e)<0}),r.push(p.typeAnnotation)}(),a.length){var l=a.reverse(),f=[];a=[];for(var h=l,d=Array.isArray(h),m=0,h=d?h:u(h);;){var y;if(d){if(m>=h.length)break;y=h[m++]}else{if(m=h.next(),m.done)break;y=m.value}var g=y,v=g.scope;if(!(f.indexOf(v)>=0)&&(f.push(v),a.push(g),v===t.scope)){a=[g];break}}a=a.concat(s);for(var A=a,E=Array.isArray(A),b=0,A=E?A:u(A);;){var x;if(E){if(b>=A.length)break;x=A[b++]}else{if(b=A.next(),b.done)break;x=b.value}var g=x;r.push(g.getTypeAnnotation())}}return r.length?c.createUnionTypeAnnotation(r):void 0}function i(t,e,n){var r=t.constantViolations.slice();return r.unshift(t.path),r.filter(function(t){t=t.resolve();var r=t._guessExecutionStatusRelativeTo(e);return n&&"function"===r&&n.push(t),"before"===r})}function s(t,e){var n=e.node.operator,r=e.get("right").resolve(),i=e.get("left").resolve(),s=void 0;if(i.isIdentifier({name:t})?s=r:r.isIdentifier({name:t})&&(s=i),s)return"==="===n?s.getTypeAnnotation():c.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(n)>=0?c.numberTypeAnnotation():void 0;if("==="===n){var a=void 0,o=void 0;if(i.isUnaryExpression({operator:"typeof"})?(a=i,o=r):r.isUnaryExpression({operator:"typeof"})&&(a=r,o=i),(o||a)&&(o=o.resolve(),o.isLiteral())){var u=o.node.value;if("string"==typeof u&&a.get("argument").isIdentifier({name:t}))return c.createTypeAnnotationBasedOnTypeof(o.node.value)}}}function a(t){for(var e=void 0;e=t.parentPath;){if(e.isIfStatement()||e.isConditionalExpression())return"test"===t.key?void 0:e;t=e}}function o(t,e){var n=a(t);if(n){var r=n.get("test"),i=[r],u=[];do{var p=i.shift().resolve();if(p.isLogicalExpression()&&(i.push(p.get("left")),i.push(p.get("right"))),p.isBinaryExpression()){var l=s(e,p);l&&u.push(l)}}while(i.length);return u.length?{typeAnnotation:c.createUnionTypeAnnotation(u),ifStatement:n}:o(n,e)}}var u=t(522)["default"],p=t(529)["default"];n.__esModule=!0;var l=t(531),c=p(l);n["default"]=function(t){if(this.isReferenced()){var e=this.scope.getBinding(t.name);return e?e.identifier.typeAnnotation?e.identifier.typeAnnotation:r(this,t.name):"undefined"===t.name?c.voidTypeAnnotation():"NaN"===t.name||"Infinity"===t.name?c.numberTypeAnnotation():void("arguments"===t.name)}},e.exports=n["default"]},{522:522,529:529,531:531}],508:[function(t,e,n){"use strict";function r(){var t=this.get("id");return t.isIdentifier()?this.get("init").getTypeAnnotation():void 0}function i(t){return t.typeAnnotation}function s(t){return this.get("callee").isIdentifier()?T.genericTypeAnnotation(t.callee):void 0}function a(){return T.stringTypeAnnotation()}function o(t){var e=t.operator;return"void"===e?T.voidTypeAnnotation():T.NUMBER_UNARY_OPERATORS.indexOf(e)>=0?T.numberTypeAnnotation():T.STRING_UNARY_OPERATORS.indexOf(e)>=0?T.stringTypeAnnotation():T.BOOLEAN_UNARY_OPERATORS.indexOf(e)>=0?T.booleanTypeAnnotation():void 0}function u(t){var e=t.operator;if(T.NUMBER_BINARY_OPERATORS.indexOf(e)>=0)return T.numberTypeAnnotation();if(T.BOOLEAN_BINARY_OPERATORS.indexOf(e)>=0)return T.booleanTypeAnnotation();if("+"===e){var n=this.get("right"),r=this.get("left");return r.isBaseType("number")&&n.isBaseType("number")?T.numberTypeAnnotation():r.isBaseType("string")||n.isBaseType("string")?T.stringTypeAnnotation():T.unionTypeAnnotation([T.stringTypeAnnotation(),T.numberTypeAnnotation()])}}function p(){return T.createUnionTypeAnnotation([this.get("left").getTypeAnnotation(),this.get("right").getTypeAnnotation()])}function l(){return T.createUnionTypeAnnotation([this.get("consequent").getTypeAnnotation(),this.get("alternate").getTypeAnnotation()])}function c(){return this.get("expressions").pop().getTypeAnnotation()}function f(){return this.get("right").getTypeAnnotation()}function h(t){var e=t.operator;return"++"===e||"--"===e?T.numberTypeAnnotation():void 0}function d(){return T.stringTypeAnnotation()}function m(){return T.numberTypeAnnotation()}function y(){return T.booleanTypeAnnotation()}function g(){return T.voidTypeAnnotation()}function v(){return T.genericTypeAnnotation(T.identifier("RegExp"))}function A(){return T.genericTypeAnnotation(T.identifier("Object"))}function E(){return T.genericTypeAnnotation(T.identifier("Array"))}function b(){return E()}function x(){return T.genericTypeAnnotation(T.identifier("Function"))}function D(){return S(this.get("callee"))}function C(){return S(this.get("tag"))}function S(t){if(t=t.resolve(),t.isFunction()){if(t.is("async"))return t.is("generator")?T.genericTypeAnnotation(T.identifier("AsyncIterator")):T.genericTypeAnnotation(T.identifier("Promise"));if(t.node.returnType)return t.node.returnType}}var F=t(529)["default"],w=t(530)["default"];n.__esModule=!0,n.VariableDeclarator=r,n.TypeCastExpression=i,n.NewExpression=s,n.TemplateLiteral=a,n.UnaryExpression=o,n.BinaryExpression=u,n.LogicalExpression=p,n.ConditionalExpression=l,n.SequenceExpression=c,
n.AssignmentExpression=f,n.UpdateExpression=h,n.StringLiteral=d,n.NumericLiteral=m,n.BooleanLiteral=y,n.NullLiteral=g,n.RegExpLiteral=v,n.ObjectExpression=A,n.ArrayExpression=E,n.RestElement=b,n.CallExpression=D,n.TaggedTemplateExpression=C;var B=t(531),T=F(B),_=t(507);n.Identifier=w(_),i.validParent=!0,b.validParent=!0,n.Function=x,n.Class=x},{507:507,529:529,530:530,531:531}],509:[function(t,e,n){"use strict";function r(t,e){function n(t){var e=r[s];return"*"===e||t===e}if(!this.isMemberExpression())return!1;for(var r=t.split("."),i=[this.node],s=0;i.length;){var a=i.shift();if(e&&s===r.length)return!0;if(S.isIdentifier(a)){if(!n(a.name))return!1}else if(S.isLiteral(a)){if(!n(a.value))return!1}else{if(S.isMemberExpression(a)){if(a.computed&&!S.isLiteral(a.property))return!1;i.unshift(a.property),i.unshift(a.object);continue}if(!S.isThisExpression(a))return!1;if(!n("this"))return!1}if(++s>r.length)return!1}return s===r.length}function i(t){var e=this.node&&this.node[t];return e&&Array.isArray(e)?!!e.length:!!e}function s(){return this.scope.isStatic(this.node)}function a(t){return!this.has(t)}function o(t,e){return this.node[t]===e}function u(t){return S.isType(this.type,t)}function p(){return("init"===this.key||"left"===this.key)&&this.parentPath.isFor()}function l(t){var e=this,n=!0;do{var r=e.container;if(e.isFunction()&&!n)return!!t;if(n=!1,Array.isArray(r)&&e.key!==r.length-1)return!1}while((e=e.parentPath)&&!e.isProgram());return!0}function c(){return this.parentPath.isLabeledStatement()||S.isBlockStatement(this.container)?!1:D["default"](S.STATEMENT_OR_BLOCK_KEYS,this.key)}function f(t,e){if(!this.isReferencedIdentifier())return!1;var n=this.scope.getBinding(this.node.name);if(!n||"module"!==n.kind)return!1;var r=n.path,i=r.parentPath;return i.isImportDeclaration()?i.node.source.value!==t?!1:e?r.isImportDefaultSpecifier()&&"default"===e?!0:r.isImportNamespaceSpecifier()&&"*"===e?!0:r.isImportSpecifier()&&r.node.imported.name===e?!0:!1:!0:!1}function h(){var t=this.node;return t.end?this.hub.file.code.slice(t.start,t.end):""}function d(t){return"after"!==this._guessExecutionStatusRelativeTo(t)}function m(t){var e=t.scope.getFunctionParent(),n=this.scope.getFunctionParent();if(e!==n){var r=this._guessExecutionStatusRelativeToDifferentFunctions(e);if(r)return r;t=e.path}var i=t.getAncestry();if(i.indexOf(this)>=0)return"after";var s=this.getAncestry(),a=void 0,o=void 0,u=void 0;for(u=0;u<s.length;u++){var p=s[u];if(o=i.indexOf(p),o>=0){a=p;break}}if(!a)return"before";var l=i[o-1],c=s[u-1];if(!l||!c)return"before";if(l.listKey&&l.container===c.container)return l.key>c.key?"before":"after";var f=S.VISITOR_KEYS[l.type].indexOf(l.key),h=S.VISITOR_KEYS[c.type].indexOf(c.key);return f>h?"before":"after"}function y(t){var e=t.path;if(e.isFunctionDeclaration()){var n=e.scope.getBinding(e.node.id.name);if(!n.references)return"before";for(var r=n.referencePaths,i=r,s=Array.isArray(i),a=0,i=s?i:A(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if(a=i.next(),a.done)break;o=a.value}var u=o;if("callee"!==u.key||!u.parentPath.isCallExpression())return}for(var p=void 0,l=r,c=Array.isArray(l),f=0,l=c?l:A(l);;){var h;if(c){if(f>=l.length)break;h=l[f++]}else{if(f=l.next(),f.done)break;h=f.value}var u=h,d=!!u.find(function(t){return t.node===e.node});if(!d){var m=this._guessExecutionStatusRelativeTo(u);if(p){if(p!==m)return}else p=m}}return p}}function g(t,e){return this._resolve(t,e)||this}function v(t,e){if(!(e&&e.indexOf(this)>=0))if(e=e||[],e.push(this),this.isVariableDeclarator()){if(this.get("id").isIdentifier())return this.get("init").resolve(t,e)}else if(this.isReferencedIdentifier()){var n=this.scope.getBinding(this.node.name);if(!n)return;if(!n.constant)return;if("module"===n.kind)return;if(n.path!==this)return n.path.resolve(t,e)}else{if(this.isTypeCastExpression())return this.get("expression").resolve(t,e);if(t&&this.isMemberExpression()){var r=this.toComputedKey();if(!S.isLiteral(r))return;var i=r.value,s=this.get("object").resolve(t,e);if(s.isObjectExpression())for(var a=s.get("properties"),o=a,u=Array.isArray(o),p=0,o=u?o:A(o);;){var l;if(u){if(p>=o.length)break;l=o[p++]}else{if(p=o.next(),p.done)break;l=p.value}var c=l;if(c.isProperty()){var f=c.get("key"),h=c.isnt("computed")&&f.isIdentifier({name:i});if(h=h||f.isLiteral({value:i}))return c.get("value").resolve(t,e)}}else if(s.isArrayExpression()&&!isNaN(+i)){var d=s.get("elements"),m=d[i];if(m)return m.resolve(t,e)}}}}var A=t(522)["default"],E=t(528)["default"],b=t(529)["default"];n.__esModule=!0,n.matchesPattern=r,n.has=i,n.isStatic=s,n.isnt=a,n.equals=o,n.isNodeType=u,n.canHaveVariableDeclarationOrExpression=p,n.isCompletionRecord=l,n.isStatementOrBlock=c,n.referencesImport=f,n.getSource=h,n.willIMaybeExecuteBefore=d,n._guessExecutionStatusRelativeTo=m,n._guessExecutionStatusRelativeToDifferentFunctions=y,n.resolve=g,n._resolve=v;var x=t(587),D=E(x),C=t(531),S=b(C),F=i;n.is=F},{522:522,528:528,529:529,531:531,587:587}],510:[function(t,e,n){"use strict";var r=t(527)["default"],i=t(522)["default"],s=t(529)["default"];n.__esModule=!0;var a=t(531),o=s(a),u={ReferencedIdentifier:function(t,e){if(!t.isJSXIdentifier()||!a.react.isCompatTag(t.node.name)){var n=t.scope.getBinding(t.node.name);if(n&&n===e.scope.getBinding(t.node.name))if(n.constant)e.bindings[t.node.name]=n;else for(var r=n.constantViolations,s=Array.isArray(r),o=0,r=s?r:i(r);;){var u;if(s){if(o>=r.length)break;u=r[o++]}else{if(o=r.next(),o.done)break;u=o.value}var p=u;e.breakOnScopePaths=e.breakOnScopePaths.concat(p.getAncestry())}}}},p=function(){function t(e,n){r(this,t),this.breakOnScopePaths=[],this.bindings={},this.scopes=[],this.scope=n,this.path=e}return t.prototype.isCompatibleScope=function(t){for(var e in this.bindings){var n=this.bindings[e];if(!t.bindingIdentifierEquals(e,n.identifier))return!1}return!0},t.prototype.getCompatibleScopes=function(){var t=this.path.scope;do{if(!this.isCompatibleScope(t))break;if(this.scopes.push(t),this.breakOnScopePaths.indexOf(t.path)>=0)break}while(t=t.parent)},t.prototype.getAttachmentPath=function(){var t=this.scopes,e=t.pop();if(e){if(e.path.isFunction()){if(this.hasOwnParamBindings(e)){if(this.scope===e)return;return e.path.get("body").get("body")[0]}return this.getNextScopeStatementParent()}return e.path.isProgram()?this.getNextScopeStatementParent():void 0}},t.prototype.getNextScopeStatementParent=function(){var t=this.scopes.pop();return t?t.path.getStatementParent():void 0},t.prototype.hasOwnParamBindings=function(t){for(var e in this.bindings)if(t.hasOwnBinding(e)){var n=this.bindings[e];if("param"===n.kind)return!0}return!1},t.prototype.run=function(){var t=this.path.node;if(!t._hoisted){t._hoisted=!0,this.path.traverse(u,this),this.getCompatibleScopes();var e=this.getAttachmentPath();if(e&&e.getFunctionParent()!==this.path.getFunctionParent()){var n=e.scope.generateUidIdentifier("ref");e.insertBefore([o.variableDeclaration("var",[o.variableDeclarator(n,this.path.node)])]);var r=this.path.parentPath;r.isJSXElement()&&this.path.container===r.node.children&&(n=o.JSXExpressionContainer(n)),this.path.replaceWith(n)}}},t}();n["default"]=p,e.exports=n["default"]},{522:522,527:527,529:529,531:531}],511:[function(t,e,n){"use strict";n.__esModule=!0;var r=[function(t,e){return"body"===t.key&&e.isArrowFunctionExpression()?(t.replaceWith(t.scope.buildUndefinedNode()),!0):void 0},function(t,e){var n=!1;return n=n||"test"===t.key&&(e.isWhile()||e.isSwitchCase()),n=n||"declaration"===t.key&&e.isExportDeclaration(),n=n||"body"===t.key&&e.isLabeledStatement(),n=n||"declarations"===t.listKey&&e.isVariableDeclaration()&&1===e.node.declarations.length,n=n||"expression"===t.key&&e.isExpressionStatement(),n?(e.remove(),!0):void 0},function(t,e){return e.isSequenceExpression()&&1===e.node.expressions.length?(e.replaceWith(e.node.expressions[0]),!0):void 0},function(t,e){return e.isBinary()?("left"===t.key?e.replaceWith(e.node.right):e.replaceWith(e.node.left),!0):void 0}];n.hooks=r},{}],512:[function(t,e,n){"use strict";var r=t(529)["default"];n.__esModule=!0;var i=t(531),s=r(i),a={types:["Identifier","JSXIdentifier"],checkPath:function(t,e){var n=t.node,r=t.parent;if(!s.isIdentifier(n,e)){if(!s.isJSXIdentifier(n,e))return!1;if(i.react.isCompatTag(n.name))return!1}return s.isReferenced(n,r)}};n.ReferencedIdentifier=a;var o={types:["MemberExpression"],checkPath:function(t){var e=t.node,n=t.parent;return s.isMemberExpression(e)&&s.isReferenced(e,n)}};n.ReferencedMemberExpression=o;var u={types:["Identifier"],checkPath:function(t){var e=t.node,n=t.parent;return s.isIdentifier(e)&&s.isBinding(e,n)}};n.BindingIdentifier=u;var p={types:["Statement"],checkPath:function(t){var e=t.node,n=t.parent;if(s.isStatement(e)){if(s.isVariableDeclaration(e)){if(s.isForXStatement(n,{left:e}))return!1;if(s.isForStatement(n,{init:e}))return!1}return!0}return!1}};n.Statement=p;var l={types:["Expression"],checkPath:function(t){return t.isIdentifier()?t.isReferencedIdentifier():s.isExpression(t.node)}};n.Expression=l;var c={types:["Scopable"],checkPath:function(t){return s.isScope(t.node,t.parent)}};n.Scope=c;var f={checkPath:function(t){return s.isReferenced(t.node,t.parent)}};n.Referenced=f;var h={checkPath:function(t){return s.isBlockScoped(t.node)}};n.BlockScoped=h;var d={types:["VariableDeclaration"],checkPath:function(t){return s.isVar(t.node)}};n.Var=d;var m={checkPath:function(t){return t.node&&!!t.node.loc}};n.User=m;var y={checkPath:function(t){return!t.isUser()}};n.Generated=y;var g={checkPath:function(t,e){return t.scope.isPure(t.node,e)}};n.Pure=g;var v={types:["Flow","ImportDeclaration","ExportDeclaration"],checkPath:function(t){var e=t.node;return s.isFlow(e)?!0:s.isImportDeclaration(e)?"type"===e.importKind||"typeof"===e.importKind:s.isExportDeclaration(e)?"type"===e.exportKind:!1}};n.Flow=v},{529:529,531:531}],513:[function(t,e,n){"use strict";function r(t){if(this._assertUnremoved(),t=this._verifyNodeList(t),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertBefore(t);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key)this.node&&t.push(this.node),this.replaceExpressionWithStatements(t);else{if(this._maybePopFromStatements(t),Array.isArray(this.container))return this._containerInsertBefore(t);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&t.push(this.node),this._replaceWith(D.blockStatement(t))}return[this]}function i(t,e){this.updateSiblingKeys(t,e.length);for(var n=[],r=0;r<e.length;r++){var i=t+r,s=e[r];if(this.container.splice(i,0,s),this.context){var a=this.context.create(this.parent,this.container,i,this.listKey);n.push(a)}else n.push(b["default"].get({parentPath:this,parent:s,container:this.container,listKey:this.listKey,key:i}))}for(var o=this.contexts,u=this;!o.length;)u=u.parentPath,o=u.contexts;for(var p=n,l=Array.isArray(p),c=0,p=l?p:d(p);;){var f;if(l){if(c>=p.length)break;f=p[c++]}else{if(c=p.next(),c.done)break;f=c.value}var h=f;h.setScope();for(var m=o,y=Array.isArray(m),g=0,m=y?m:d(m);;){var v;if(y){if(g>=m.length)break;v=m[g++]}else{if(g=m.next(),g.done)break;v=g.value}var A=v;A.maybeQueue(h)}}return n}function s(t){return this._containerInsert(this.key,t)}function a(t){return this._containerInsert(this.key+1,t)}function o(t){var e=t[t.length-1],n=D.isIdentifier(e)||D.isExpressionStatement(e)&&D.isIdentifier(e.expression);n&&!this.isCompletionRecord()&&t.pop()}function u(t){if(this._assertUnremoved(),t=this._verifyNodeList(t),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertAfter(t);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key){if(this.node){var e=this.scope.generateDeclaredUidIdentifier();t.unshift(D.expressionStatement(D.assignmentExpression("=",e,this.node))),t.push(D.expressionStatement(e))}this.replaceExpressionWithStatements(t)}else{if(this._maybePopFromStatements(t),Array.isArray(this.container))return this._containerInsertAfter(t);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&t.unshift(this.node),this._replaceWith(D.blockStatement(t))}return[this]}function p(t,e){if(this.parent)for(var n=this.parent[g.PATH_CACHE_KEY],r=0;r<n.length;r++){var i=n[r];i.key>=t&&(i.key+=e)}}function l(t){if(!t)return[];t.constructor!==Array&&(t=[t]);for(var e=0;e<t.length;e++){var n=t[e],r=void 0;if(n?"object"!=typeof n?r="contains a non-object node":n.type?n instanceof b["default"]&&(r="has a NodePath when it expected a raw object"):r="without a type":r="has falsy node",r){var i=Array.isArray(n)?"array":typeof n;throw new Error("Node list "+r+" with the index of "+e+" and type of "+i)}}return t}function c(t,e){this._assertUnremoved(),e=this._verifyNodeList(e);var n=b["default"].get({parentPath:this,parent:this.node,container:this.node[t],listKey:t,key:0});return n.insertBefore(e)}function f(t,e){this._assertUnremoved(),e=this._verifyNodeList(e);var n=this.node[t],r=b["default"].get({parentPath:this,parent:this.node,container:n,listKey:t,key:n.length});return r.replaceWithMultiple(e)}function h(){var t=arguments.length<=0||void 0===arguments[0]?this.scope:arguments[0],e=new A["default"](this,t);return e.run()}var d=t(522)["default"],m=t(528)["default"],y=t(529)["default"];n.__esModule=!0,n.insertBefore=r,n._containerInsert=i,n._containerInsertBefore=s,n._containerInsertAfter=a,n._maybePopFromStatements=o,n.insertAfter=u,n.updateSiblingKeys=p,n._verifyNodeList=l,n.unshiftContainer=c,n.pushContainer=f,n.hoist=h;var g=t(500),v=t(510),A=m(v),E=t(505),b=m(E),x=t(531),D=y(x)},{500:500,505:505,510:510,522:522,528:528,529:529,531:531}],514:[function(t,e,n){"use strict";function r(){return this._assertUnremoved(),this.resync(),this._callRemovalHooks()?void this._markRemoved():(this.shareCommentsWithSiblings(),this._remove(),void this._markRemoved())}function i(){for(var t=p.hooks,e=Array.isArray(t),n=0,t=e?t:u(t);;){var r;if(e){if(n>=t.length)break;r=t[n++]}else{if(n=t.next(),n.done)break;r=n.value}var i=r;if(i(this,this.parentPath))return!0}}function s(){Array.isArray(this.container)?(this.container.splice(this.key,1),this.updateSiblingKeys(this.key,-1)):this._replaceWith(null)}function a(){this.shouldSkip=!0,this.removed=!0,this.node=null}function o(){if(this.removed)throw this.buildCodeFrameError("NodePath has been removed so is read-only.")}var u=t(522)["default"];n.__esModule=!0,n.remove=r,n._callRemovalHooks=i,n._remove=s,n._markRemoved=a,n._assertUnremoved=o;var p=t(511)},{511:511,522:522}],515:[function(t,e,n){"use strict";function r(t){this.resync(),t=this._verifyNodeList(t),E.inheritLeadingComments(t[0],this.node),E.inheritTrailingComments(t[t.length-1],this.node),this.node=this.container[this.key]=null,this.insertAfter(t),this.node?this.requeue():this.remove()}function i(t){this.resync();try{t="("+t+")",t=v.parse(t)}catch(e){var n=e.loc;throw n&&(e.message+=" - make sure this is an expression.",e.message+="\n"+h["default"](t,n.line,n.column+1)),e}return t=t.program.body[0].expression,m["default"].removeProperties(t),this.replaceWith(t)}function s(t){if(this.resync(),this.removed)throw new Error("You can't replace this node, we've already removed it");if(t instanceof g["default"]&&(t=t.node),!t)throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead");if(this.node!==t){if(this.isProgram()&&!E.isProgram(t))throw new Error("You can only replace a Program root node with another Program node");if(Array.isArray(t))throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`");if("string"==typeof t)throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`");if(this.isNodeType("Statement")&&E.isExpression(t)&&!this.canHaveVariableDeclarationOrExpression()&&(t=E.expressionStatement(t)),this.isNodeType("Expression")&&E.isStatement(t))return this.replaceExpressionWithStatements([t]);var e=this.node;e&&(E.inheritsComments(t,e),E.removeComments(e)),this._replaceWith(t),this.type=t.type,this.setScope(),this.requeue()}}function a(t){if(!this.container)throw new ReferenceError("Container is falsy");this.inList?E.validate(this.parent,this.key,[t]):E.validate(this.parent,this.key,t),this.node=this.container[this.key]=t}function o(t){this.resync();var e=E.toSequenceExpression(t,this.scope);if(E.isSequenceExpression(e)){var n=e.expressions;n.length>=2&&this.parentPath.isExpressionStatement()&&this._maybePopFromStatements(n),1===n.length?this.replaceWith(n[0]):this.replaceWith(e)}else{if(!e){var r=E.functionExpression(null,[],E.blockStatement(t));r.shadow=!0,this.replaceWith(E.callExpression(r,[])),this.traverse(b);for(var i=this.get("callee").getCompletionRecords(),s=i,a=Array.isArray(s),o=0,s=a?s:p(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if(o=s.next(),o.done)break;u=o.value}var l=u;if(l.isExpressionStatement()){var c=l.findParent(function(t){return t.isLoop()});if(c){var f=this.get("callee"),h=f.scope.generateDeclaredUidIdentifier("ret");f.get("body").pushContainer("body",E.returnStatement(h)),l.get("expression").replaceWith(E.assignmentExpression("=",h,l.node.expression))}else l.replaceWith(E.returnStatement(l.node.expression))}}return this.node}this.replaceWith(e)}}function u(t){return this.resync(),Array.isArray(t)?Array.isArray(this.container)?(t=this._verifyNodeList(t),this._containerInsertAfter(t),this.remove()):this.replaceWithMultiple(t):this.replaceWith(t)}var p=t(522)["default"],l=t(528)["default"],c=t(529)["default"];n.__esModule=!0,n.replaceWithMultiple=r,n.replaceWithSourceString=i,n.replaceWith=s,n._replaceWith=a,n.replaceExpressionWithStatements=o,n.replaceInline=u;var f=t(520),h=l(f),d=t(497),m=l(d),y=t(505),g=l(y),v=t(532),A=t(531),E=c(A),b={Function:function(t){t.skip()},VariableDeclaration:function(t){if("var"===t.node.kind){var e=t.getBindingIdentifiers();for(var n in e)t.scope.push({id:e[n]});for(var r=[],i=t.node.declarations,s=Array.isArray(i),a=0,i=s?i:p(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if(a=i.next(),a.done)break;o=a.value}var u=o;u.init&&r.push(E.expressionStatement(E.assignmentExpression("=",u.id,u.init)))}t.replaceWithMultiple(r)}}}},{497:497,505:505,520:520,522:522,528:528,529:529,531:531,532:532}],516:[function(t,e,n){"use strict";var r=t(527)["default"];n.__esModule=!0;var i=function(){function t(e){var n=e.existing,i=e.identifier,s=e.scope,a=e.path,o=e.kind;r(this,t),this.identifier=i,this.scope=s,this.path=a,this.kind=o,this.constantViolations=[],this.constant=!0,this.referencePaths=[],this.referenced=!1,this.references=0,this.clearValue(),n&&(this.constantViolations=[].concat(n.path,n.constantViolations,this.constantViolations))}return t.prototype.deoptValue=function(){this.clearValue(),this.hasDeoptedValue=!0},t.prototype.setValue=function(t){this.hasDeoptedValue||(this.hasValue=!0,this.value=t)},t.prototype.clearValue=function(){this.hasDeoptedValue=!1,this.hasValue=!1,this.value=null},t.prototype.reassign=function(t){this.constant=!1,this.constantViolations.push(t)},t.prototype.reference=function(t){this.referenced=!0,this.references++,this.referencePaths.push(t)},t.prototype.dereference=function(){this.references--,this.referenced=!!this.references},t}();n["default"]=i,e.exports=n["default"]},{527:527}],517:[function(t,e,n){"use strict";function r(t,e,n){var r=t[T];if(r){if(i(r,e))return r}else if(!t[_])return void(t[T]=n);return s(t,e,n,r)}function i(t,e){return t.parent===e?!0:void 0}function s(t,e,n,r){var s=t[_]=t[_]||[];r&&(s.push(r),t[T]=null);for(var a=s,o=Array.isArray(a),p=0,a=o?a:u(a);;){var l;if(o){if(p>=a.length)break;l=a[p++]}else{if(p=a.next(),p.done)break;l=p.value}var c=l;if(i(c,e))return c}s.push(n)}var a=t(527)["default"],o=t(526)["default"],u=t(522)["default"],p=t(523)["default"],l=t(528)["default"],c=t(529)["default"];n.__esModule=!0;var f=t(587),h=l(f),d=t(633),m=l(d),y=t(518),g=l(y),v=t(497),A=l(v),E=t(627),b=l(E),x=t(521),D=c(x),C=t(516),S=l(C),F=t(584),w=(l(F),t(531)),B=c(w),T=o(),_=o(),k={For:function(t){for(var e=B.FOR_INIT_KEYS,n=Array.isArray(e),r=0,e=n?e:u(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var s=i,a=t.get(s);a.isVar()&&t.scope.getFunctionParent().registerBinding("var",a)}},Declaration:function(t){t.isBlockScoped()||t.isExportDeclaration()&&t.get("declaration").isDeclaration()||t.scope.getFunctionParent().registerDeclaration(t)},ReferencedIdentifier:function(t,e){e.references.push(t)},ForXStatement:function(t,e){var n=t.get("left");(n.isPattern()||n.isIdentifier())&&e.constantViolations.push(n)},ExportDeclaration:{exit:function(t){var e=t.node,n=t.scope,r=e.declaration;if(B.isClassDeclaration(r)||B.isFunctionDeclaration(r)){var i=r.id;if(!i)return;var s=n.getBinding(i.name);s&&s.reference()}else if(B.isVariableDeclaration(r))for(var a=r.declarations,o=Array.isArray(a),p=0,a=o?a:u(a);;){var l;if(o){if(p>=a.length)break;l=a[p++]}else{if(p=a.next(),p.done)break;l=p.value}var c=l,f=B.getBindingIdentifiers(c);for(var h in f){var s=n.getBinding(h);s&&s.reference()}}}},LabeledStatement:function(t){t.scope.getProgramParent().addGlobal(t.node),t.scope.getBlockParent().registerDeclaration(t)},AssignmentExpression:function(t,e){e.assignments.push(t)},UpdateExpression:function(t,e){e.constantViolations.push(t.get("argument"))},UnaryExpression:function(t,e){"delete"===t.node.operator&&e.constantViolations.push(t.get("argument"))},BlockScoped:function(t){var e=t.scope;e.path===t&&(e=e.parent),e.getBlockParent().registerDeclaration(t)},ClassDeclaration:function(t){var e=t.node.id;if(e){var n=e.name;t.scope.bindings[n]=t.scope.getBinding(n)}},Block:function(t){for(var e=t.get("body"),n=e,r=Array.isArray(n),i=0,n=r?n:u(n);;){var s;if(r){if(i>=n.length)break;s=n[i++]}else{if(i=n.next(),i.done)break;s=i.value}var a=s;a.isFunctionDeclaration()&&t.scope.getBlockParent().registerDeclaration(a)}}},P=0,N=function(){function t(e,n){if(a(this,t),n&&n.block===e.node)return n;var i=r(e.node,n,this);return i?i:(this.uid=P++,this.parent=n,this.hub=e.hub,this.parentBlock=e.parent,this.block=e.node,void(this.path=e))}return t.prototype.traverse=function(t,e,n){A["default"](t,e,this,n,this.path)},t.prototype.generateDeclaredUidIdentifier=function(){var t=arguments.length<=0||void 0===arguments[0]?"temp":arguments[0],e=this.generateUidIdentifier(t);return this.push({id:e}),e},t.prototype.generateUidIdentifier=function(t){return B.identifier(this.generateUid(t))},t.prototype.generateUid=function(t){t=B.toIdentifier(t).replace(/^_+/,"").replace(/[0-9]+$/g,"");var e=void 0,n=0;do e=this._generateUid(t,n),n++;while(this.hasBinding(e)||this.hasGlobal(e)||this.hasReference(e));var r=this.getProgramParent();return r.references[e]=!0,r.uids[e]=!0,e},t.prototype._generateUid=function(t,e){var n=t;return e>1&&(n+=e),"_"+n},t.prototype.generateUidIdentifierBasedOnNode=function(t,e){var n=t;B.isAssignmentExpression(t)?n=t.left:B.isVariableDeclarator(t)?n=t.id:(B.isObjectProperty(n)||B.isObjectMethod(n))&&(n=n.key);var r=[],i=function a(t){if(B.isModuleDeclaration(t))if(t.source)a(t.source);else if(t.specifiers&&t.specifiers.length)for(var e=t.specifiers,n=Array.isArray(e),i=0,e=n?e:u(e);;){var s;if(n){if(i>=e.length)break;s=e[i++]}else{if(i=e.next(),i.done)break;s=i.value}var o=s;a(o)}else t.declaration&&a(t.declaration);else if(B.isModuleSpecifier(t))a(t.local);else if(B.isMemberExpression(t))a(t.object),a(t.property);else if(B.isIdentifier(t))r.push(t.name);else if(B.isLiteral(t))r.push(t.value);else if(B.isCallExpression(t))a(t.callee);else if(B.isObjectExpression(t)||B.isObjectPattern(t))for(var p=t.properties,l=Array.isArray(p),c=0,p=l?p:u(p);;){var f;if(l){if(c>=p.length)break;f=p[c++]}else{if(c=p.next(),c.done)break;f=c.value}var h=f;a(h.key||h.argument)}};i(n);var s=r.join("$");return s=s.replace(/^_/,"")||e||"ref",this.generateUidIdentifier(s.slice(0,20))},t.prototype.isStatic=function(t){if(B.isThisExpression(t)||B.isSuper(t))return!0;if(B.isIdentifier(t)){var e=this.getBinding(t.name);return e?e.constant:this.hasBinding(t.name)}return!1},t.prototype.maybeGenerateMemoised=function(t,e){if(this.isStatic(t))return null;var n=this.generateUidIdentifierBasedOnNode(t);return e||this.push({id:n}),n},t.prototype.checkBlockScopedCollisions=function(t,e,n,r){if("param"!==e&&("hoisted"!==e||"let"!==t.kind)){var i=!1;if(i||(i="let"===e||"let"===t.kind||"const"===t.kind||"module"===t.kind),i||(i="param"===t.kind&&("let"===e||"const"===e)),i)throw this.hub.file.buildCodeFrameError(r,D.get("scopeDuplicateDeclaration",n),TypeError)}},t.prototype.rename=function(t,e,n){var r=this.getBinding(t);return r?(e=e||this.generateUidIdentifier(t).name,new g["default"](r,t,e).rename(n)):void 0},t.prototype._renameFromMap=function(t,e,n,r){t[e]&&(t[n]=r,t[e]=null)},t.prototype.dump=function(){var t=m["default"]("-",60);console.log(t);var e=this;do{console.log("#",e.block.type);for(var n in e.bindings){var r=e.bindings[n];console.log(" -",n,{constant:r.constant,references:r.references,violations:r.constantViolations.length,kind:r.kind})}}while(e=e.parent);console.log(t)},t.prototype.toArray=function(t,e){var n=this.hub.file;if(B.isIdentifier(t)){var r=this.getBinding(t.name);if(r&&r.constant&&r.path.isGenericType("Array"))return t}if(B.isArrayExpression(t))return t;if(B.isIdentifier(t,{name:"arguments"}))return B.callExpression(B.memberExpression(B.memberExpression(B.memberExpression(B.identifier("Array"),B.identifier("prototype")),B.identifier("slice")),B.identifier("call")),[t]);var i="toArray",s=[t];return e===!0?i="toConsumableArray":e&&(s.push(B.numericLiteral(e)),i="slicedToArray"),B.callExpression(n.addHelper(i),s)},t.prototype.registerDeclaration=function(t){if(t.isLabeledStatement())this.registerBinding("label",t);else if(t.isFunctionDeclaration())this.registerBinding("hoisted",t.get("id"),t);else if(t.isVariableDeclaration())for(var e=t.get("declarations"),n=e,r=Array.isArray(n),i=0,n=r?n:u(n);;){var s;if(r){if(i>=n.length)break;s=n[i++]}else{if(i=n.next(),i.done)break;s=i.value}var a=s;this.registerBinding(t.node.kind,a)}else if(t.isClassDeclaration())this.registerBinding("let",t);else if(t.isImportDeclaration())for(var o=t.get("specifiers"),p=o,l=Array.isArray(p),c=0,p=l?p:u(p);;){var f;if(l){if(c>=p.length)break;f=p[c++]}else{if(c=p.next(),c.done)break;f=c.value}var h=f;this.registerBinding("module",h)}else if(t.isExportDeclaration()){var a=t.get("declaration");(a.isClassDeclaration()||a.isFunctionDeclaration()||a.isVariableDeclaration())&&this.registerDeclaration(a)}else this.registerBinding("unknown",t)},t.prototype.buildUndefinedNode=function(){return this.hasBinding("undefined")?B.unaryExpression("void",B.numericLiteral(0),!0):B.identifier("undefined")},t.prototype.registerConstantViolation=function(t){var e=t.getBindingIdentifiers();for(var n in e){var r=this.getBinding(n);r&&r.reassign(t)}},t.prototype.registerBinding=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?e:arguments[2];return function(){if(!t)throw new ReferenceError("no `kind`");if(e.isVariableDeclaration())for(var r=e.get("declarations"),i=r,s=Array.isArray(i),a=0,i=s?i:u(i);;){var o;if(s){if(a>=i.length)break;o=i[a++]}else{if(a=i.next(),a.done)break;o=a.value}var p=o;this.registerBinding(t,p)}else{var l=this.getProgramParent(),c=e.getBindingIdentifiers(!0);for(var f in c)for(var h=c[f],d=Array.isArray(h),m=0,h=d?h:u(h);;){var y;if(d){if(m>=h.length)break;y=h[m++]}else{if(m=h.next(),m.done)break;y=m.value}var g=y,v=this.getOwnBinding(f);if(v){if(v.identifier===g)continue;this.checkBlockScopedCollisions(v,t,f,g)}l.references[f]=!0,this.bindings[f]=new S["default"]({identifier:g,existing:v,scope:this,path:n,kind:t})}}}.apply(this,arguments)},t.prototype.addGlobal=function(t){this.globals[t.name]=t},t.prototype.hasUid=function(t){var e=this;do if(e.uids[t])return!0;while(e=e.parent);return!1},t.prototype.hasGlobal=function(t){var e=this;do if(e.globals[t])return!0;while(e=e.parent);return!1},t.prototype.hasReference=function(t){var e=this;do if(e.references[t])return!0;while(e=e.parent);return!1},t.prototype.isPure=function(t,e){if(B.isIdentifier(t)){var n=this.getBinding(t.name);return n?e?n.constant:!0:!1}if(B.isClass(t))return t.superClass&&!this.isPure(t.superClass,e)?!1:this.isPure(t.body,e);if(B.isClassBody(t)){for(var r=t.body,i=Array.isArray(r),s=0,r=i?r:u(r);;){var a;if(i){if(s>=r.length)break;a=r[s++]}else{if(s=r.next(),s.done)break;a=s.value}var o=a;if(!this.isPure(o,e))return!1}return!0}if(B.isBinary(t))return this.isPure(t.left,e)&&this.isPure(t.right,e);if(B.isArrayExpression(t)){for(var p=t.elements,l=Array.isArray(p),c=0,p=l?p:u(p);;){var f;if(l){if(c>=p.length)break;f=p[c++]}else{if(c=p.next(),c.done)break;f=c.value}var h=f;if(!this.isPure(h,e))return!1}return!0}if(B.isObjectExpression(t)){for(var d=t.properties,m=Array.isArray(d),y=0,d=m?d:u(d);;){var g;if(m){if(y>=d.length)break;g=d[y++]}else{if(y=d.next(),y.done)break;g=y.value}var v=g;if(!this.isPure(v,e))return!1}return!0}return B.isClassMethod(t)?t.computed&&!this.isPure(t.key,e)?!1:"get"===t.kind||"set"===t.kind?!1:!0:B.isClassProperty(t)?t.computed&&!this.isPure(t.key,e)?!1:this.isPure(t.value,e):B.isPureish(t)},t.prototype.setData=function(t,e){return this.data[t]=e},t.prototype.getData=function(t){var e=this;do{var n=e.data[t];if(null!=n)return n}while(e=e.parent)},t.prototype.removeData=function(t){var e=this;do{var n=e.data[t];null!=n&&(e.data[t]=null)}while(e=e.parent)},t.prototype.init=function(){this.references||this.crawl()},t.prototype.crawl=function(){var t=this.path;if(this.references=p(null),this.bindings=p(null),this.globals=p(null),this.uids=p(null),this.data=p(null),t.isLoop())for(var e=B.FOR_INIT_KEYS,n=Array.isArray(e),r=0,e=n?e:u(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var s=i,a=t.get(s);a.isBlockScoped()&&this.registerBinding(a.node.kind,a)}if(t.isFunctionExpression()&&t.has("id")&&this.registerBinding("local",t.get("id"),t),t.isClassExpression()&&t.has("id")&&this.registerBinding("local",t),t.isFunction())for(var o=t.get("params"),l=o,c=Array.isArray(l),f=0,l=c?l:u(l);;){var h;if(c){if(f>=l.length)break;h=l[f++]}else{if(f=l.next(),f.done)break;h=f.value}var d=h;this.registerBinding("param",d)}t.isCatchClause()&&this.registerBinding("let",t);var m=this.getProgramParent();if(!m.crawling){var y={references:[],constantViolations:[],assignments:[]};this.crawling=!0,t.traverse(k,y),this.crawling=!1;for(var g=y.assignments,v=Array.isArray(g),A=0,g=v?g:u(g);;){var E;if(v){if(A>=g.length)break;E=g[A++]}else{if(A=g.next(),A.done)break;E=A.value}var b=E,x=b.getBindingIdentifiers(),D=void 0;for(var C in x)b.scope.getBinding(C)||(D=D||b.scope.getProgramParent(),D.addGlobal(x[C]));b.scope.registerConstantViolation(b)}for(var S=y.references,F=Array.isArray(S),w=0,S=F?S:u(S);;){var T;if(F){if(w>=S.length)break;T=S[w++]}else{if(w=S.next(),w.done)break;T=w.value}var _=T,P=_.scope.getBinding(_.node.name);P?P.reference(_):_.scope.getProgramParent().addGlobal(_.node)}for(var N=y.constantViolations,I=Array.isArray(N),L=0,N=I?N:u(N);;){var O;if(I){if(L>=N.length)break;O=N[L++]}else{if(L=N.next(),L.done)break;O=L.value}var M=O;M.scope.registerConstantViolation(M)}}},t.prototype.push=function(t){var e=this.path;e.isSwitchStatement()&&(e=this.getFunctionParent().path),(e.isLoop()||e.isCatchClause()||e.isFunction())&&(B.ensureBlock(e.node),e=e.get("body")),e.isBlockStatement()||e.isProgram()||(e=this.getBlockParent().path);var n=t.unique,r=t.kind||"var",i=null==t._blockHoist?2:t._blockHoist,s="declaration:"+r+":"+i,a=!n&&e.getData(s);if(!a){var o=B.variableDeclaration(r,[]);o._generated=!0,o._blockHoist=i;var u=e.unshiftContainer("body",[o]);a=u[0],n||e.setData(s,a)}var p=B.variableDeclarator(t.id,t.init);a.node.declarations.push(p),
this.registerBinding(r,a.get("declarations").pop())},t.prototype.getProgramParent=function(){var t=this;do if(t.path.isProgram())return t;while(t=t.parent);throw new Error("We couldn't find a Function or Program...")},t.prototype.getFunctionParent=function(){var t=this;do if(t.path.isFunctionParent())return t;while(t=t.parent);throw new Error("We couldn't find a Function or Program...")},t.prototype.getBlockParent=function(){var t=this;do if(t.path.isBlockParent())return t;while(t=t.parent);throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...")},t.prototype.getAllBindings=function(){var t=p(null),e=this;do b["default"](t,e.bindings),e=e.parent;while(e);return t},t.prototype.getAllBindingsOfKind=function(){for(var t=p(null),e=arguments,n=Array.isArray(e),r=0,e=n?e:u(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var s=i,a=this;do{for(var o in a.bindings){var l=a.bindings[o];l.kind===s&&(t[o]=l)}a=a.parent}while(a)}return t},t.prototype.bindingIdentifierEquals=function(t,e){return this.getBindingIdentifier(t)===e},t.prototype.getBinding=function(t){var e=this;do{var n=e.getOwnBinding(t);if(n)return n}while(e=e.parent)},t.prototype.getOwnBinding=function(t){return this.bindings[t]},t.prototype.getBindingIdentifier=function(t){var e=this.getBinding(t);return e&&e.identifier},t.prototype.getOwnBindingIdentifier=function(t){var e=this.bindings[t];return e&&e.identifier},t.prototype.hasOwnBinding=function(t){return!!this.getOwnBinding(t)},t.prototype.hasBinding=function(e,n){return e?this.hasOwnBinding(e)?!0:this.parentHasBinding(e,n)?!0:this.hasUid(e)?!0:!n&&h["default"](t.globals,e)?!0:!n&&h["default"](t.contextVariables,e)?!0:!1:!1},t.prototype.parentHasBinding=function(t,e){return this.parent&&this.parent.hasBinding(t,e)},t.prototype.moveBindingTo=function(t,e){var n=this.getBinding(t);n&&(n.scope.removeOwnBinding(t),n.scope=e,e.bindings[t]=n)},t.prototype.removeOwnBinding=function(t){delete this.bindings[t]},t.prototype.removeBinding=function(t){var e=this.getBinding(t);e&&e.scope.removeOwnBinding(t);var n=this;do n.uids[t]&&(n.uids[t]=!1);while(n=n.parent)},t}();n["default"]=N,e.exports=n["default"]},{497:497,516:516,518:518,521:521,522:522,523:523,526:526,527:527,528:528,529:529,531:531,584:584,587:587,627:627,633:633}],518:[function(t,e,n){"use strict";var r=t(527)["default"],i=t(528)["default"],s=t(529)["default"];n.__esModule=!0;var a=t(516),o=(i(a),t(531)),u=s(o),p={ReferencedIdentifier:function(t,e){var n=t.node;n.name===e.oldName&&(n.name=e.newName)},Scope:function(t,e){t.scope.bindingIdentifierEquals(e.oldName,e.binding.identifier)||t.skip()},"AssignmentExpression|Declaration":function(t,e){var n=t.getBindingIdentifiers();for(var r in n)r===e.oldName&&(n[r].name=e.newName)}},l=function(){function t(e,n,i){r(this,t),this.newName=i,this.oldName=n,this.binding=e}return t.prototype.maybeConvertFromExportDeclaration=function(t){var e=t.parentPath.isExportDeclaration()&&t.parentPath;if(e){var n=e.isExportDefaultDeclaration(),r=t.getOuterBindingIdentifiers(),i=[];for(var s in r){var a=s===this.oldName?this.newName:s,o=n?"default":s;i.push(u.exportSpecifier(u.identifier(a),u.identifier(o)))}var p=u.exportNamedDeclaration(null,i);t.isFunctionDeclaration()&&(p._blockHoist=3),e.insertAfter(p),e.replaceWith(t.node)}},t.prototype.maybeConvertFromClassFunctionDeclaration=function(t){},t.prototype.maybeConvertFromClassFunctionExpression=function(t){},t.prototype.rename=function(t){var e=this.binding,n=this.oldName,r=this.newName,i=e.scope,s=e.path,a=s.find(function(t){return t.isDeclaration()||t.isFunctionExpression()});a&&this.maybeConvertFromExportDeclaration(a),i.traverse(t||i.block,p,this),t||(i.removeOwnBinding(n),i.bindings[r]=e,this.binding.identifier.name=r),"hoisted"===e.type,a&&(this.maybeConvertFromClassFunctionDeclaration(a),this.maybeConvertFromClassFunctionExpression(a))},t}();n["default"]=l,e.exports=n["default"]},{516:516,527:527,528:528,529:529,531:531}],519:[function(t,e,n){"use strict";function r(t){if(t._exploded)return t;t._exploded=!0;for(var e in t)if(!c(e)){var n=e.split("|");if(1!==n.length){var r=t[e];delete t[e];for(var s=n,a=Array.isArray(s),o=0,s=a?s:h(s);;){var m;if(a){if(o>=s.length)break;m=s[o++]}else{if(o=s.next(),o.done)break;m=o.value}var y=m;t[y]=r}}}i(t),delete t.__esModule,u(t),p(t);for(var g=d(t),A=Array.isArray(g),E=0,g=A?g:h(g);;){var b;if(A){if(E>=g.length)break;b=g[E++]}else{if(E=g.next(),E.done)break;b=E.value}var e=b;if(!c(e)){var D=v[e];if(D){var r=t[e];for(var S in r)r[S]=l(D,r[S]);if(delete t[e],D.types)for(var F=D.types,w=Array.isArray(F),B=0,F=w?F:h(F);;){var T;if(w){if(B>=F.length)break;T=F[B++]}else{if(B=F.next(),B.done)break;T=B.value}var S=T;t[S]?f(t[S],r):t[S]=r}else f(t,r)}}}for(var e in t)if(!c(e)){var r=t[e],_=x.FLIPPED_ALIAS_KEYS[e],k=x.DEPRECATED_KEYS[e];if(k&&(console.trace("Visitor defined for "+e+" but it has been renamed to "+k),_=[k]),_){delete t[e];for(var P=_,N=Array.isArray(P),I=0,P=N?P:h(P);;){var L;if(N){if(I>=P.length)break;L=P[I++]}else{if(I=P.next(),I.done)break;L=I.value}var O=L,M=t[O];M?f(M,r):t[O]=C["default"](r)}}}for(var e in t)c(e)||p(t[e]);return t}function i(t){if(!t._verified){if("function"==typeof t)throw new Error(E.get("traverseVerifyRootFunction"));for(var e in t)if(("enter"===e||"exit"===e)&&s(e,t[e]),!c(e)){if(x.TYPES.indexOf(e)<0)throw new Error(E.get("traverseVerifyNodeType",e));var n=t[e];if("object"==typeof n)for(var r in n){if("enter"!==r&&"exit"!==r)throw new Error(E.get("traverseVerifyVisitorProperty",e,r));s(e+"."+r,n[r])}}t._verified=!0}}function s(t,e){for(var n=[].concat(e),r=n,i=Array.isArray(r),s=0,r=i?r:h(r);;){var a;if(i){if(s>=r.length)break;a=r[s++]}else{if(s=r.next(),s.done)break;a=s.value}var o=a;if("function"!=typeof o)throw new TypeError("Non-function found defined in "+t+" with type "+typeof o)}}function a(t){for(var e=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],n={},i=0;i<t.length;i++){var s=t[i],a=e[i];r(s);for(var u in s){var p=s[u];a&&(p=o(p,a));var l=n[u]=n[u]||{};f(l,p)}}return n}function o(t,e){var n={};for(var r in t){var i=t[r];Array.isArray(i)&&(i=i.map(function(t){var n=function(n){return t.call(e,n,e)};return n.toString=function(){return t.toString()},n}),n[r]=i)}return n}function u(t){for(var e in t)if(!c(e)){var n=t[e];"function"==typeof n&&(t[e]={enter:n})}}function p(t){t.enter&&!Array.isArray(t.enter)&&(t.enter=[t.enter]),t.exit&&!Array.isArray(t.exit)&&(t.exit=[t.exit])}function l(t,e){var n=function(n){return t.checkPath(n)?e.apply(this,arguments):void 0};return n.toString=function(){return e.toString()},n}function c(t){return"_"===t[0]?!0:"enter"===t||"exit"===t||"shouldSkip"===t?!0:"blacklist"===t||"noScope"===t||"skipKeys"===t?!0:!1}function f(t,e){for(var n in e)t[n]=[].concat(t[n]||[],e[n])}var h=t(522)["default"],d=t(525)["default"],m=t(529)["default"],y=t(528)["default"];n.__esModule=!0,n.explode=r,n.verify=i,n.merge=a;var g=t(512),v=m(g),A=t(521),E=m(A),b=t(531),x=m(b),D=t(619),C=y(D)},{512:512,521:521,522:522,525:525,528:528,529:529,531:531,619:619}],520:[function(t,e,n){arguments[4][51][0].apply(n,arguments)},{12:12,51:51}],521:[function(t,e,n){arguments[4][54][0].apply(n,arguments)},{418:418,54:54}],522:[function(t,e,n){arguments[4][55][0].apply(n,arguments)},{533:533,55:55}],523:[function(t,e,n){arguments[4][57][0].apply(n,arguments)},{534:534,57:57}],524:[function(t,e,n){e.exports={"default":t(535),__esModule:!0}},{535:535}],525:[function(t,e,n){arguments[4][273][0].apply(n,arguments)},{273:273,536:536}],526:[function(t,e,n){arguments[4][421][0].apply(n,arguments)},{421:421,537:537}],527:[function(t,e,n){arguments[4][62][0].apply(n,arguments)},{62:62}],528:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{15:15}],529:[function(t,e,n){arguments[4][67][0].apply(n,arguments)},{67:67}],530:[function(t,e,n){arguments[4][68][0].apply(n,arguments)},{68:68}],531:[function(t,e,n){arguments[4][71][0].apply(n,arguments)},{645:645,71:71}],532:[function(t,e,n){arguments[4][72][0].apply(n,arguments)},{72:72,796:796}],533:[function(t,e,n){arguments[4][77][0].apply(n,arguments)},{576:576,580:580,582:582,77:77}],534:[function(t,e,n){arguments[4][79][0].apply(n,arguments)},{561:561,79:79}],535:[function(t,e,n){t(581),e.exports=t(543).Object.getOwnPropertySymbols},{543:543,581:581}],536:[function(t,e,n){arguments[4][283][0].apply(n,arguments)},{283:283,543:543,578:578}],537:[function(t,e,n){arguments[4][427][0].apply(n,arguments)},{427:427,543:543,579:579,581:581}],538:[function(t,e,n){arguments[4][84][0].apply(n,arguments)},{84:84}],539:[function(t,e,n){arguments[4][85][0].apply(n,arguments)},{85:85}],540:[function(t,e,n){arguments[4][86][0].apply(n,arguments)},{556:556,86:86}],541:[function(t,e,n){arguments[4][87][0].apply(n,arguments)},{542:542,574:574,87:87}],542:[function(t,e,n){arguments[4][88][0].apply(n,arguments)},{88:88}],543:[function(t,e,n){arguments[4][92][0].apply(n,arguments)},{92:92}],544:[function(t,e,n){arguments[4][93][0].apply(n,arguments)},{538:538,93:93}],545:[function(t,e,n){arguments[4][94][0].apply(n,arguments)},{94:94}],546:[function(t,e,n){arguments[4][95][0].apply(n,arguments)},{549:549,95:95}],547:[function(t,e,n){arguments[4][435][0].apply(n,arguments)},{435:435,561:561}],548:[function(t,e,n){arguments[4][96][0].apply(n,arguments)},{543:543,544:544,551:551,96:96}],549:[function(t,e,n){arguments[4][97][0].apply(n,arguments)},{97:97}],550:[function(t,e,n){arguments[4][99][0].apply(n,arguments)},{561:561,571:571,99:99}],551:[function(t,e,n){arguments[4][100][0].apply(n,arguments)},{100:100}],552:[function(t,e,n){arguments[4][101][0].apply(n,arguments)},{101:101}],553:[function(t,e,n){arguments[4][102][0].apply(n,arguments)},{102:102,546:546,561:561,565:565}],554:[function(t,e,n){arguments[4][103][0].apply(n,arguments)},{103:103,542:542}],555:[function(t,e,n){arguments[4][443][0].apply(n,arguments)},{443:443,542:542}],556:[function(t,e,n){arguments[4][105][0].apply(n,arguments)},{105:105}],557:[function(t,e,n){arguments[4][107][0].apply(n,arguments)},{107:107,553:553,561:561,565:565,567:567,574:574}],558:[function(t,e,n){arguments[4][108][0].apply(n,arguments)},{108:108,548:548,552:552,553:553,557:557,560:560,561:561,563:563,566:566,567:567,574:574}],559:[function(t,e,n){arguments[4][109][0].apply(n,arguments)},{109:109}],560:[function(t,e,n){arguments[4][110][0].apply(n,arguments)},{110:110}],561:[function(t,e,n){arguments[4][111][0].apply(n,arguments)},{111:111}],562:[function(t,e,n){arguments[4][446][0].apply(n,arguments)},{446:446,561:561,571:571}],563:[function(t,e,n){arguments[4][112][0].apply(n,arguments)},{112:112}],564:[function(t,e,n){arguments[4][113][0].apply(n,arguments)},{113:113,543:543,548:548,549:549}],565:[function(t,e,n){arguments[4][114][0].apply(n,arguments)},{114:114}],566:[function(t,e,n){arguments[4][116][0].apply(n,arguments)},{116:116,553:553}],567:[function(t,e,n){arguments[4][119][0].apply(n,arguments)},{119:119,552:552,561:561,574:574}],568:[function(t,e,n){arguments[4][120][0].apply(n,arguments)},{120:120,551:551}],569:[function(t,e,n){arguments[4][122][0].apply(n,arguments)},{122:122,545:545,570:570}],570:[function(t,e,n){arguments[4][123][0].apply(n,arguments)},{123:123}],571:[function(t,e,n){arguments[4][124][0].apply(n,arguments)},{124:124,545:545,554:554}],572:[function(t,e,n){arguments[4][317][0].apply(n,arguments)},{317:317,545:545}],573:[function(t,e,n){arguments[4][126][0].apply(n,arguments)},{126:126}],574:[function(t,e,n){arguments[4][127][0].apply(n,arguments)},{127:127,551:551,568:568,573:573}],575:[function(t,e,n){arguments[4][128][0].apply(n,arguments)},{128:128,541:541,543:543,560:560,574:574}],576:[function(t,e,n){arguments[4][129][0].apply(n,arguments)},{129:129,540:540,543:543,575:575}],577:[function(t,e,n){arguments[4][130][0].apply(n,arguments)},{130:130,539:539,558:558,559:559,560:560,571:571}],578:[function(t,e,n){arguments[4][324][0].apply(n,arguments)},{324:324,564:564,572:572}],579:[function(t,e,n){arguments[4][2][0].apply(n,arguments)},{2:2}],580:[function(t,e,n){arguments[4][136][0].apply(n,arguments)},{136:136,558:558,569:569}],581:[function(t,e,n){arguments[4][456][0].apply(n,arguments)},{456:456,540:540,546:546,547:547,548:548,549:549,550:550,551:551,552:552,555:555,561:561,562:562,563:563,565:565,566:566,567:567,568:568,571:571,573:573,574:574}],582:[function(t,e,n){arguments[4][138][0].apply(n,arguments)},{138:138,560:560,577:577}],583:[function(t,e,n){e.exports={builtin:{Array:!1,ArrayBuffer:!1,Boolean:!1,constructor:!1,DataView:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,escape:!1,eval:!1,EvalError:!1,Float32Array:!1,Float64Array:!1,Function:!1,hasOwnProperty:!1,Infinity:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,isFinite:!1,isNaN:!1,isPrototypeOf:!1,JSON:!1,Map:!1,Math:!1,NaN:!1,Number:!1,Object:!1,parseFloat:!1,parseInt:!1,Promise:!1,propertyIsEnumerable:!1,Proxy:!1,RangeError:!1,ReferenceError:!1,Reflect:!1,RegExp:!1,Set:!1,String:!1,Symbol:!1,SyntaxError:!1,System:!1,toLocaleString:!1,toString:!1,TypeError:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,undefined:!1,unescape:!1,URIError:!1,valueOf:!1,WeakMap:!1,WeakSet:!1},browser:{addEventListener:!1,alert:!1,AnalyserNode:!1,AnimationEvent:!1,applicationCache:!1,ApplicationCache:!1,ApplicationCacheErrorEvent:!1,atob:!1,Attr:!1,Audio:!1,AudioBuffer:!1,AudioBufferSourceNode:!1,AudioContext:!1,AudioDestinationNode:!1,AudioListener:!1,AudioNode:!1,AudioParam:!1,AudioProcessingEvent:!1,AutocompleteErrorEvent:!1,BarProp:!1,BatteryManager:!1,BeforeUnloadEvent:!1,BiquadFilterNode:!1,Blob:!1,blur:!1,btoa:!1,Cache:!1,caches:!1,CacheStorage:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,CDATASection:!1,ChannelMergerNode:!1,ChannelSplitterNode:!1,CharacterData:!1,clearInterval:!1,clearTimeout:!1,clientInformation:!1,ClientRect:!1,ClientRectList:!1,ClipboardEvent:!1,close:!1,closed:!1,CloseEvent:!1,Comment:!1,CompositionEvent:!1,confirm:!1,console:!1,ConvolverNode:!1,crypto:!1,Crypto:!1,CryptoKey:!1,CSS:!1,CSSFontFaceRule:!1,CSSImportRule:!1,CSSKeyframeRule:!1,CSSKeyframesRule:!1,CSSMediaRule:!1,CSSPageRule:!1,CSSRule:!1,CSSRuleList:!1,CSSStyleDeclaration:!1,CSSStyleRule:!1,CSSStyleSheet:!1,CSSSupportsRule:!1,CSSUnknownRule:!1,CSSViewportRule:!1,CustomEvent:!1,DataTransfer:!1,DataTransferItem:!1,DataTransferItemList:!1,Debug:!1,defaultStatus:!1,defaultstatus:!1,DelayNode:!1,DeviceMotionEvent:!1,DeviceOrientationEvent:!1,devicePixelRatio:!1,dispatchEvent:!1,document:!1,Document:!1,DocumentFragment:!1,DocumentType:!1,DOMError:!1,DOMException:!1,DOMImplementation:!1,DOMParser:!1,DOMSettableTokenList:!1,DOMStringList:!1,DOMStringMap:!1,DOMTokenList:!1,DragEvent:!1,DynamicsCompressorNode:!1,Element:!1,ElementTimeControl:!1,ErrorEvent:!1,event:!1,Event:!1,EventSource:!1,EventTarget:!1,external:!1,fetch:!1,File:!1,FileError:!1,FileList:!1,FileReader:!1,find:!1,focus:!1,FocusEvent:!1,FontFace:!1,FormData:!1,frameElement:!1,frames:!1,GainNode:!1,Gamepad:!1,GamepadButton:!1,GamepadEvent:!1,getComputedStyle:!1,getSelection:!1,HashChangeEvent:!1,Headers:!1,history:!1,History:!1,HTMLAllCollection:!1,HTMLAnchorElement:!1,HTMLAppletElement:!1,HTMLAreaElement:!1,HTMLAudioElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLCollection:!1,HTMLContentElement:!1,HTMLDataListElement:!1,HTMLDetailsElement:!1,HTMLDialogElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLDocument:!1,HTMLElement:!1,HTMLEmbedElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormControlsCollection:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLKeygenElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMarqueeElement:!1,HTMLMediaElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLMeterElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLOptionsCollection:!1,HTMLOutputElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPictureElement:!1,HTMLPreElement:!1,HTMLProgressElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLShadowElement:!1,HTMLSourceElement:!1,HTMLSpanElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTemplateElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLTrackElement:!1,HTMLUListElement:!1,HTMLUnknownElement:!1,HTMLVideoElement:!1,IDBCursor:!1,IDBCursorWithValue:!1,IDBDatabase:!1,IDBEnvironment:!1,IDBFactory:!1,IDBIndex:!1,IDBKeyRange:!1,IDBObjectStore:!1,IDBOpenDBRequest:!1,IDBRequest:!1,IDBTransaction:!1,IDBVersionChangeEvent:!1,Image:!1,ImageBitmap:!1,ImageData:!1,indexedDB:!1,innerHeight:!1,innerWidth:!1,InputEvent:!1,InputMethodContext:!1,Intl:!1,KeyboardEvent:!1,length:!1,localStorage:!1,location:!1,Location:!1,locationbar:!1,matchMedia:!1,MediaElementAudioSourceNode:!1,MediaEncryptedEvent:!1,MediaError:!1,MediaKeyError:!1,MediaKeyEvent:!1,MediaKeyMessageEvent:!1,MediaKeys:!1,MediaKeySession:!1,MediaKeyStatusMap:!1,MediaKeySystemAccess:!1,MediaList:!1,MediaQueryList:!1,MediaQueryListEvent:!1,MediaSource:!1,MediaStreamAudioDestinationNode:!1,MediaStreamAudioSourceNode:!1,MediaStreamEvent:!1,MediaStreamTrack:!1,menubar:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MIDIAccess:!1,MIDIConnectionEvent:!1,MIDIInput:!1,MIDIInputMap:!1,MIDIMessageEvent:!1,MIDIOutput:!1,MIDIOutputMap:!1,MIDIPort:!1,MimeType:!1,MimeTypeArray:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationEvent:!1,MutationObserver:!1,MutationRecord:!1,name:!1,NamedNodeMap:!1,navigator:!1,Navigator:!1,Node:!1,NodeFilter:!1,NodeIterator:!1,NodeList:!1,Notification:!1,OfflineAudioCompletionEvent:!1,OfflineAudioContext:!1,offscreenBuffering:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,opera:!1,Option:!1,OscillatorNode:!1,outerHeight:!1,outerWidth:!1,PageTransitionEvent:!1,pageXOffset:!1,pageYOffset:!1,parent:!1,Path2D:!1,performance:!1,Performance:!1,PerformanceEntry:!1,PerformanceMark:!1,PerformanceMeasure:!1,PerformanceNavigation:!1,PerformanceResourceTiming:!1,PerformanceTiming:!1,PeriodicWave:!1,Permissions:!1,PermissionStatus:!1,personalbar:!1,Plugin:!1,PluginArray:!1,PopStateEvent:!1,postMessage:!1,print:!1,ProcessingInstruction:!1,ProgressEvent:!1,prompt:!1,PushManager:!1,PushSubscription:!1,RadioNodeList:!1,Range:!1,ReadableByteStream:!1,ReadableStream:!1,removeEventListener:!1,Request:!1,requestAnimationFrame:!1,resizeBy:!1,resizeTo:!1,Response:!1,RTCIceCandidate:!1,RTCSessionDescription:!1,screen:!1,Screen:!1,screenLeft:!1,ScreenOrientation:!1,screenTop:!1,screenX:!1,screenY:!1,ScriptProcessorNode:!1,scroll:!1,scrollbars:!1,scrollBy:!1,scrollTo:!1,scrollX:!1,scrollY:!1,SecurityPolicyViolationEvent:!1,Selection:!1,self:!1,ServiceWorker:!1,ServiceWorkerContainer:!1,ServiceWorkerRegistration:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,ShadowRoot:!1,SharedWorker:!1,showModalDialog:!1,speechSynthesis:!1,SpeechSynthesisEvent:!1,SpeechSynthesisUtterance:!1,status:!1,statusbar:!1,stop:!1,Storage:!1,StorageEvent:!1,styleMedia:!1,StyleSheet:!1,StyleSheetList:!1,SubtleCrypto:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimationElement:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCSSRule:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDiscardElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGEvent:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEDropShadowElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGeometryElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGGraphicsElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLinearGradientElement:!1,SVGLineElement:!1,SVGLocatable:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGMPathElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSVGElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformable:!1,SVGTransformList:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGUnitTypes:!1,SVGURIReference:!1,SVGUseElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGVKernElement:!1,SVGZoomAndPan:!1,SVGZoomEvent:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TextEvent:!1,TextMetrics:!1,TextTrack:!1,TextTrackCue:!1,TextTrackCueList:!1,TextTrackList:!1,TimeEvent:!1,TimeRanges:!1,toolbar:!1,top:!1,Touch:!1,TouchEvent:!1,TouchList:!1,TrackEvent:!1,TransitionEvent:!1,TreeWalker:!1,UIEvent:!1,URL:!1,ValidityState:!1,VTTCue:!1,WaveShaperNode:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,WheelEvent:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLDocument:!1,XMLHttpRequest:!1,XMLHttpRequestEventTarget:!1,XMLHttpRequestProgressEvent:!1,XMLHttpRequestUpload:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1,XSLTProcessor:!1},worker:{applicationCache:!1,atob:!1,BroadcastChannel:!1,btoa:!1,Cache:!1,caches:!1,clearInterval:!1,clearTimeout:!1,close:!0,console:!1,fetch:!1,FileReaderSync:!1,FormData:!1,Headers:!1,IDBCursor:!1,IDBCursorWithValue:!1,IDBDatabase:!1,IDBFactory:!1,IDBIndex:!1,IDBKeyRange:!1,IDBObjectStore:!1,IDBOpenDBRequest:!1,IDBRequest:!1,IDBTransaction:!1,IDBVersionChangeEvent:!1,ImageData:!1,importScripts:!0,indexedDB:!1,location:!1,MessageChannel:!1,MessagePort:!1,name:!1,navigator:!1,Notification:!1,onclose:!0,onconnect:!0,onerror:!0,onlanguagechange:!0,onmessage:!0,onoffline:!0,ononline:!0,onrejectionhandled:!0,onunhandledrejection:!0,performance:!1,Performance:!1,PerformanceEntry:!1,PerformanceMark:!1,PerformanceMeasure:!1,PerformanceNavigation:!1,PerformanceResourceTiming:!1,PerformanceTiming:!1,postMessage:!0,Promise:!1,Request:!1,Response:!1,self:!0,ServiceWorkerRegistration:!1,setInterval:!1,setTimeout:!1,TextDecoder:!1,TextEncoder:!1,URL:!1,WebSocket:!1,Worker:!1,XMLHttpRequest:!1},node:{__dirname:!1,__filename:!1,arguments:!1,Buffer:!1,clearImmediate:!1,clearInterval:!1,clearTimeout:!1,console:!1,exports:!0,GLOBAL:!1,global:!1,module:!1,process:!1,require:!1,root:!1,setImmediate:!1,setInterval:!1,setTimeout:!1},commonjs:{exports:!0,module:!1,require:!1},amd:{define:!1,require:!1},mocha:{after:!1,afterEach:!1,before:!1,beforeEach:!1,context:!1,describe:!1,it:!1,mocha:!1,setup:!1,specify:!1,suite:!1,suiteSetup:!1,suiteTeardown:!1,teardown:!1,test:!1,xcontext:!1,xdescribe:!1,xit:!1,xspecify:!1},jasmine:{afterAll:!1,afterEach:!1,beforeAll:!1,beforeEach:!1,describe:!1,expect:!1,fail:!1,fdescribe:!1,fit:!1,it:!1,jasmine:!1,pending:!1,runs:!1,spyOn:!1,waits:!1,waitsFor:!1,xdescribe:!1,xit:!1},jest:{afterEach:!1,beforeEach:!1,describe:!1,expect:!1,it:!1,jest:!1,pit:!1,require:!1,xdescribe:!1,xit:!1},qunit:{asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,"throws":!1},phantomjs:{console:!0,exports:!0,phantom:!0,require:!0,WebPage:!0},couch:{emit:!1,exports:!1,getRow:!1,log:!1,module:!1,provides:!1,require:!1,respond:!1,send:!1,start:!1,sum:!1},rhino:{defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},nashorn:{__DIR__:!1,__FILE__:!1,__LINE__:!1,com:!1,edu:!1,exit:!1,Java:!1,java:!1,javafx:!1,JavaImporter:!1,javax:!1,JSAdapter:!1,load:!1,loadWithNewGlobal:!1,org:!1,Packages:!1,print:!1,quit:!1},wsh:{ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WScript:!0,WSH:!0,XDomainRequest:!0},jquery:{$:!1,jQuery:!1},yui:{Y:!1,YUI:!1,YUI_config:!1},shelljs:{cat:!1,cd:!1,chmod:!1,config:!1,cp:!1,dirs:!1,echo:!1,env:!1,error:!1,exec:!1,exit:!1,find:!1,grep:!1,ls:!1,mkdir:!1,mv:!1,popd:!1,pushd:!1,pwd:!1,rm:!1,sed:!1,target:!1,tempdir:!1,test:!1,which:!1},prototypejs:{$:!1,$$:!1,$A:!1,$break:!1,$continue:!1,$F:!1,$H:!1,$R:!1,$w:!1,Abstract:!1,Ajax:!1,Autocompleter:!1,Builder:!1,Class:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Element:!1,Enumerable:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Scriptaculous:!1,Selector:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Template:!1,Toggle:!1,Try:!1},meteor:{$:!1,_:!1,Accounts:!1,App:!1,Assets:!1,Blaze:!1,check:!1,Cordova:!1,DDP:!1,DDPServer:!1,Deps:!1,EJSON:!1,Email:!1,HTTP:!1,Log:!1,Match:!1,Meteor:!1,Mongo:!1,MongoInternals:!1,Npm:!1,Package:!1,Plugin:!1,process:!1,Random:!1,ReactiveDict:!1,ReactiveVar:!1,Router:!1,Session:!1,share:!1,Spacebars:!1,Template:!1,Tinytest:!1,Tracker:!1,UI:!1,Utils:!1,WebApp:!1,WebAppInternals:!1},mongo:{_isWindows:!1,_rand:!1,BulkWriteResult:!1,cat:!1,cd:!1,connect:!1,db:!1,getHostName:!1,getMemInfo:!1,hostname:!1,listFiles:!1,load:!1,ls:!1,md5sumFile:!1,mkdir:!1,Mongo:!1,ObjectId:!1,PlanCache:!1,pwd:!1,quit:!1,removeFile:!1,rs:!1,sh:!1,UUID:!1,version:!1,WriteResult:!1},applescript:{$:!1,Application:!1,Automation:!1,console:!1,delay:!1,Library:!1,ObjC:!1,ObjectSpecifier:!1,Path:!1,Progress:!1,Ref:!1},serviceworker:{caches:!1,Cache:!1,CacheStorage:!1,Client:!1,clients:!1,Clients:!1,ExtendableEvent:!1,ExtendableMessageEvent:!1,FetchEvent:!1,importScripts:!1,registration:!1,self:!1,ServiceWorker:!1,ServiceWorkerContainer:!1,ServiceWorkerGlobalScope:!1,ServiceWorkerMessageEvent:!1,ServiceWorkerRegistration:!1,skipWaiting:!1,WindowClient:!1},embertest:{andThen:!1,click:!1,currentPath:!1,currentRouteName:!1,currentUrl:!1,fillIn:!1,find:!1,keyEvent:!1,triggerEvent:!1,visit:!1},protractor:{$:!1,$$:!1,browser:!1,By:!1,by:!1,DartObject:!1,element:!1,protractor:!1},"shared-node-browser":{clearInterval:!1,clearTimeout:!1,console:!1,setInterval:!1,setTimeout:!1},webextensions:{browser:!1,chrome:!1,opr:!1}}},{}],584:[function(t,e,n){e.exports=t(583)},{583:583}],585:[function(t,e,n){"use strict";var r=function(t,e,n,r,i,s,a,o){if(void 0===e)throw new Error("invariant requires an error message argument");if(!t){var u;if(void 0===e)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,r,i,s,a,o],l=0;u=new Error("Invariant Violation: "+e.replace(/%s/g,function(){return p[l++]}))}throw u.framesToPop=1,u}};e.exports=r},{}],586:[function(t,e,n){arguments[4][27][0].apply(n,arguments)},{27:27,632:632}],587:[function(t,e,n){arguments[4][146][0].apply(n,arguments)},{146:146,598:598,606:606,614:614,615:615,621:621,625:625,630:630}],588:[function(t,e,n){arguments[4][148][0].apply(n,arguments)},{148:148}],589:[function(t,e,n){arguments[4][149][0].apply(n,arguments)},{149:149}],590:[function(t,e,n){arguments[4][150][0].apply(n,arguments)},{150:150}],591:[function(t,e,n){arguments[4][152][0].apply(n,arguments)},{152:152}],592:[function(t,e,n){arguments[4][153][0].apply(n,arguments)},{153:153,628:628}],593:[function(t,e,n){arguments[4][154][0].apply(n,arguments)},{154:154,595:595,628:628}],594:[function(t,e,n){arguments[4][156][0].apply(n,arguments)},{156:156,589:589,590:590,593:593,597:597,609:609,610:610,611:611,621:621,624:624}],595:[function(t,e,n){arguments[4][158][0].apply(n,arguments)},{158:158}],596:[function(t,e,n){arguments[4][160][0].apply(n,arguments)},{160:160,604:604}],597:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{162:162,596:596,628:628}],598:[function(t,e,n){arguments[4][164][0].apply(n,arguments)},{164:164,608:608}],599:[function(t,e,n){arguments[4][173][0].apply(n,arguments)},{173:173}],600:[function(t,e,n){arguments[4][178][0].apply(n,arguments)},{178:178}],601:[function(t,e,n){arguments[4][179][0].apply(n,arguments)},{179:179,631:631}],602:[function(t,e,n){arguments[4][180][0].apply(n,arguments)},{180:180}],603:[function(t,e,n){arguments[4][182][0].apply(n,arguments)},{182:182,588:588,601:601,614:614}],604:[function(t,e,n){arguments[4][184][0].apply(n,arguments)},{184:184,618:618}],605:[function(t,e,n){arguments[4][185][0].apply(n,arguments)},{185:185,588:588}],606:[function(t,e,n){arguments[4][191][0].apply(n,arguments)},{191:191,599:599}],607:[function(t,e,n){arguments[4][193][0].apply(n,arguments)},{193:193,623:623}],608:[function(t,e,n){arguments[4][194][0].apply(n,arguments)},{194:194}],609:[function(t,e,n){arguments[4][195][0].apply(n,arguments)},{195:195}],610:[function(t,e,n){arguments[4][196][0].apply(n,arguments)},{196:196,602:602}],611:[function(t,e,n){arguments[4][197][0].apply(n,arguments)},{197:197}],612:[function(t,e,n){arguments[4][198][0].apply(n,arguments)},{198:198,606:606,615:615}],613:[function(t,e,n){arguments[4][199][0].apply(n,arguments)},{199:199}],614:[function(t,e,n){arguments[4][200][0].apply(n,arguments);
},{200:200,612:612,613:613,624:624}],615:[function(t,e,n){arguments[4][202][0].apply(n,arguments)},{202:202}],616:[function(t,e,n){arguments[4][203][0].apply(n,arguments)},{203:203}],617:[function(t,e,n){arguments[4][205][0].apply(n,arguments)},{205:205,613:613,615:615,620:620,621:621,629:629}],618:[function(t,e,n){arguments[4][206][0].apply(n,arguments)},{206:206,624:624}],619:[function(t,e,n){arguments[4][208][0].apply(n,arguments)},{208:208,594:594,601:601,614:614}],620:[function(t,e,n){arguments[4][210][0].apply(n,arguments)},{210:210,612:612,616:616}],621:[function(t,e,n){arguments[4][211][0].apply(n,arguments)},{211:211,607:607,615:615,616:616}],622:[function(t,e,n){arguments[4][213][0].apply(n,arguments)},{213:213,624:624}],623:[function(t,e,n){arguments[4][214][0].apply(n,arguments)},{214:214,616:616,622:622}],624:[function(t,e,n){arguments[4][215][0].apply(n,arguments)},{215:215}],625:[function(t,e,n){arguments[4][218][0].apply(n,arguments)},{218:218,616:616}],626:[function(t,e,n){arguments[4][221][0].apply(n,arguments)},{221:221,592:592,593:593,603:603}],627:[function(t,e,n){arguments[4][222][0].apply(n,arguments)},{222:222,591:591,605:605,626:626}],628:[function(t,e,n){arguments[4][223][0].apply(n,arguments)},{223:223,607:607,612:612,617:617,624:624}],629:[function(t,e,n){arguments[4][224][0].apply(n,arguments)},{224:224,613:613,615:615,620:620,621:621,624:624}],630:[function(t,e,n){arguments[4][227][0].apply(n,arguments)},{227:227,600:600,628:628}],631:[function(t,e,n){arguments[4][230][0].apply(n,arguments)},{230:230}],632:[function(t,e,n){arguments[4][28][0].apply(n,arguments)},{28:28}],633:[function(t,e,n){arguments[4][26][0].apply(n,arguments)},{26:26,586:586}],634:[function(t,e,n){"use strict";var r=t(656)["default"];n.__esModule=!0;var i=["consequent","body","alternate"];n.STATEMENT_OR_BLOCK_KEYS=i;var s=["body","expressions"];n.FLATTENABLE_KEYS=s;var a=["left","init"];n.FOR_INIT_KEYS=a;var o=["leadingComments","trailingComments","innerComments"];n.COMMENT_KEYS=o;var u=["||","&&"];n.LOGICAL_OPERATORS=u;var p=["++","--"];n.UPDATE_OPERATORS=p;var l=[">","<",">=","<="];n.BOOLEAN_NUMBER_BINARY_OPERATORS=l;var c=["==","===","!=","!=="];n.EQUALITY_BINARY_OPERATORS=c;var f=[].concat(c,["in","instanceof"]);n.COMPARISON_BINARY_OPERATORS=f;var h=[].concat(f,l);n.BOOLEAN_BINARY_OPERATORS=h;var d=["-","/","*","**","&","|",">>",">>>","<<","^"];n.NUMBER_BINARY_OPERATORS=d;var m=["+"].concat(d,h);n.BINARY_OPERATORS=m;var y=["delete","!"];n.BOOLEAN_UNARY_OPERATORS=y;var g=["+","-","++","--","~"];n.NUMBER_UNARY_OPERATORS=g;var v=["typeof"];n.STRING_UNARY_OPERATORS=v;var A=["void"].concat(y,g,v);n.UNARY_OPERATORS=A;var E={optional:["typeAnnotation","typeParameters","returnType"],force:["start","loc","end"]};n.INHERIT_KEYS=E;var b=r("var used to be block scoped");n.BLOCK_SCOPED_SYMBOL=b},{656:656}],635:[function(t,e,n){"use strict";function r(t){var e=arguments.length<=1||void 0===arguments[1]?t.key||t.property:arguments[1];return function(){return t.computed||w.isIdentifier(e)&&(e=w.stringLiteral(e.name)),e}()}function i(t,e){function n(t){for(var s=!1,a=[],o=t,u=Array.isArray(o),p=0,o=u?o:f(o);;){var l;if(u){if(p>=o.length)break;l=o[p++]}else{if(p=o.next(),p.done)break;l=p.value}var c=l;if(w.isExpression(c))a.push(c);else if(w.isExpressionStatement(c))a.push(c.expression);else{if(w.isVariableDeclaration(c)){if("var"!==c.kind)return i=!0;for(var h=c.declarations,d=Array.isArray(h),m=0,h=d?h:f(h);;){var y;if(d){if(m>=h.length)break;y=h[m++]}else{if(m=h.next(),m.done)break;y=m.value}var g=y,v=w.getBindingIdentifiers(g);for(var A in v)r.push({kind:c.kind,id:v[A]});g.init&&a.push(w.assignmentExpression("=",g.id,g.init))}s=!0;continue}if(w.isIfStatement(c)){var E=c.consequent?n([c.consequent]):e.buildUndefinedNode(),b=c.alternate?n([c.alternate]):e.buildUndefinedNode();if(!E||!b)return i=!0;a.push(w.conditionalExpression(c.test,E,b))}else{if(!w.isBlockStatement(c)){if(w.isEmptyStatement(c)){s=!0;continue}return i=!0}a.push(n(c.body))}}s=!1}return(s||0===a.length)&&a.push(e.buildUndefinedNode()),1===a.length?a[0]:w.sequenceExpression(a)}if(t&&t.length){var r=[],i=!1,s=n(t);if(!i){for(var a=0;a<r.length;a++)e.push(r[a]);return s}}}function s(t){var e=arguments.length<=1||void 0===arguments[1]?t.key:arguments[1];return function(){var n=void 0;return"method"===t.kind?s.increment()+"":(n=w.isIdentifier(e)?e.name:w.isStringLiteral(e)?JSON.stringify(e.value):JSON.stringify(S["default"].removeProperties(w.cloneDeep(e))),t.computed&&(n="["+n+"]"),t["static"]&&(n="static:"+n),n)}()}function a(t){return t+="",t=t.replace(/[^a-zA-Z0-9$_]/g,"-"),t=t.replace(/^[-0-9]+/,""),t=t.replace(/[-\s]+(.)?/g,function(t,e){return e?e.toUpperCase():""}),w.isValidIdentifier(t)||(t="_"+t),t||"_"}function o(t){return t=a(t),("eval"===t||"arguments"===t)&&(t="_"+t),t}function u(t,e){if(w.isStatement(t))return t;var n=!1,r=void 0;if(w.isClass(t))n=!0,r="ClassDeclaration";else if(w.isFunction(t))n=!0,r="FunctionDeclaration";else if(w.isAssignmentExpression(t))return w.expressionStatement(t);if(n&&!t.id&&(r=!1),!r){if(e)return!1;throw new Error("cannot turn "+t.type+" to a statement")}return t.type=r,t}function p(t){if(w.isExpressionStatement(t)&&(t=t.expression),w.isClass(t)?t.type="ClassExpression":w.isFunction(t)&&(t.type="FunctionExpression"),w.isExpression(t))return t;throw new Error("cannot turn "+t.type+" to an expression")}function l(t,e){return w.isBlockStatement(t)?t:(w.isEmptyStatement(t)&&(t=[]),Array.isArray(t)||(w.isStatement(t)||(t=w.isFunction(e)?w.returnStatement(t):w.expressionStatement(t)),t=[t]),w.blockStatement(t))}function c(t){if(void 0===t)return w.identifier("undefined");if(t===!0||t===!1)return w.booleanLiteral(t);if(null===t)return w.nullLiteral();if(D["default"](t))return w.stringLiteral(t);if(A["default"](t))return w.numericLiteral(t);if(b["default"](t)){var e=t.source,n=t.toString().match(/\/([a-z]+|)$/)[1];return w.regExpLiteral(e,n)}if(Array.isArray(t))return w.arrayExpression(t.map(w.valueToNode));if(g["default"](t)){var r=[];for(var i in t){var s=void 0;s=w.isValidIdentifier(i)?w.identifier(i):w.literal(i),r.push(w.objectProperty(s,w.valueToNode(t[i])))}return w.objectExpression(r)}throw new Error("don't know how to turn this value into a node")}var f=t(649)["default"],h=t(650)["default"],d=t(659)["default"],m=t(660)["default"];n.__esModule=!0,n.toComputedKey=r,n.toSequenceExpression=i,n.toKeyAlias=s,n.toIdentifier=a,n.toBindingIdentifierName=o,n.toStatement=u,n.toExpression=p,n.toBlock=l,n.valueToNode=c;var y=t(786),g=d(y),v=t(784),A=d(v),E=t(787),b=d(E),x=t(788),D=d(x),C=t(661),S=d(C),F=t(645),w=m(F);s.uid=0,s.increment=function(){return s.uid>=h?s.uid=0:s.uid++}},{645:645,649:649,650:650,659:659,660:660,661:661,784:784,786:786,787:787,788:788}],636:[function(t,e,n){"use strict";var r=t(660)["default"],i=t(659)["default"],s=t(645),a=r(s),o=t(634),u=t(640),p=i(u);p["default"]("ArrayExpression",{fields:{elements:{validate:u.assertValueType("array")}},visitor:["elements"],aliases:["Expression"]}),p["default"]("AssignmentExpression",{fields:{operator:{validate:u.assertValueType("string")},left:{validate:u.assertNodeType("LVal")},right:{validate:u.assertNodeType("Expression")}},builder:["operator","left","right"],visitor:["left","right"],aliases:["Expression"]}),p["default"]("BinaryExpression",{builder:["operator","left","right"],fields:{operator:{validate:u.assertOneOf.apply(void 0,o.BINARY_OPERATORS)},left:{validate:u.assertNodeType("Expression")},right:{validate:u.assertNodeType("Expression")}},visitor:["left","right"],aliases:["Binary","Expression"]}),p["default"]("Directive",{visitor:["value"],fields:{value:{validate:u.assertNodeType("DirectiveLiteral")}}}),p["default"]("DirectiveLiteral",{builder:["value"],fields:{value:{validate:u.assertValueType("string")}}}),p["default"]("BlockStatement",{builder:["body","directives"],visitor:["directives","body"],fields:{directives:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("Directive"))),"default":[]},body:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("Statement")))}},aliases:["Scopable","BlockParent","Block","Statement"]}),p["default"]("BreakStatement",{visitor:["label"],fields:{label:{validate:u.assertNodeType("Identifier"),optional:!0}},aliases:["Statement","Terminatorless","CompletionStatement"]}),p["default"]("CallExpression",{visitor:["callee","arguments"],fields:{callee:{validate:u.assertNodeType("Expression")},arguments:{validate:u.assertValueType("array")}},aliases:["Expression"]}),p["default"]("CatchClause",{visitor:["param","body"],fields:{param:{validate:u.assertNodeType("Identifier")},body:{validate:u.assertNodeType("BlockStatement")}},aliases:["Scopable"]}),p["default"]("ConditionalExpression",{visitor:["test","consequent","alternate"],fields:{test:{validate:u.assertNodeType("Expression")},consequent:{validate:u.assertNodeType("Expression")},alternate:{validate:u.assertNodeType("Expression")}},aliases:["Expression","Conditional"]}),p["default"]("ContinueStatement",{visitor:["label"],fields:{label:{validate:u.assertNodeType("Identifier"),optional:!0}},aliases:["Statement","Terminatorless","CompletionStatement"]}),p["default"]("DebuggerStatement",{aliases:["Statement"]}),p["default"]("DoWhileStatement",{visitor:["test","body"],fields:{test:{validate:u.assertNodeType("Expression")},body:{validate:u.assertNodeType("BlockStatement")}},aliases:["Statement","BlockParent","Loop","While","Scopable"]}),p["default"]("EmptyStatement",{aliases:["Statement"]}),p["default"]("ExpressionStatement",{visitor:["expression"],fields:{expression:{validate:u.assertNodeType("Expression")}},aliases:["Statement","ExpressionWrapper"]}),p["default"]("File",{builder:["program","comments","tokens"],visitor:["program"],fields:{program:{validate:u.assertNodeType("Program")}}}),p["default"]("ForInStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:u.assertNodeType("VariableDeclaration","LVal")},right:{validate:u.assertNodeType("Expression")},body:{validate:u.assertNodeType("Statement")}}}),p["default"]("ForStatement",{visitor:["init","test","update","body"],aliases:["Scopable","Statement","For","BlockParent","Loop"],fields:{init:{validate:u.assertNodeType("VariableDeclaration","Expression"),optional:!0},test:{validate:u.assertNodeType("Expression"),optional:!0},update:{validate:u.assertNodeType("Expression"),optional:!0},body:{validate:u.assertNodeType("Statement")}}}),p["default"]("FunctionDeclaration",{builder:["id","params","body","generator","async"],visitor:["id","params","body","returnType","typeParameters"],fields:{id:{validate:u.assertNodeType("Identifier")},params:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("LVal")))},body:{validate:u.assertNodeType("BlockStatement")},generator:{"default":!1,validate:u.assertValueType("boolean")},async:{"default":!1,validate:u.assertValueType("boolean")}},aliases:["Scopable","Function","BlockParent","FunctionParent","Statement","Pureish","Declaration"]}),p["default"]("FunctionExpression",{inherits:"FunctionDeclaration",aliases:["Scopable","Function","BlockParent","FunctionParent","Expression","Pureish"],fields:{id:{validate:u.assertNodeType("Identifier"),optional:!0},params:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("LVal")))},body:{validate:u.assertNodeType("BlockStatement")},generator:{"default":!1,validate:u.assertValueType("boolean")},async:{"default":!1,validate:u.assertValueType("boolean")}}}),p["default"]("Identifier",{builder:["name"],visitor:["typeAnnotation"],aliases:["Expression","LVal"],fields:{name:{validate:function(t,e,n){!a.isValidIdentifier(n)}}}}),p["default"]("IfStatement",{visitor:["test","consequent","alternate"],aliases:["Statement","Conditional"],fields:{test:{validate:u.assertNodeType("Expression")},consequent:{validate:u.assertNodeType("Statement")},alternate:{optional:!0,validate:u.assertNodeType("Statement")}}}),p["default"]("LabeledStatement",{visitor:["label","body"],aliases:["Statement"],fields:{label:{validate:u.assertNodeType("Identifier")},body:{validate:u.assertNodeType("Statement")}}}),p["default"]("StringLiteral",{builder:["value"],fields:{value:{validate:u.assertValueType("string")}},aliases:["Expression","Pureish","Literal","Immutable"]}),p["default"]("NumericLiteral",{builder:["value"],deprecatedAlias:"NumberLiteral",fields:{value:{validate:u.assertValueType("number")}},aliases:["Expression","Pureish","Literal","Immutable"]}),p["default"]("NullLiteral",{aliases:["Expression","Pureish","Literal","Immutable"]}),p["default"]("BooleanLiteral",{builder:["value"],fields:{value:{validate:u.assertValueType("boolean")}},aliases:["Expression","Pureish","Literal","Immutable"]}),p["default"]("RegExpLiteral",{builder:["pattern","flags"],deprecatedAlias:"RegexLiteral",aliases:["Expression","Literal"],fields:{pattern:{validate:u.assertValueType("string")},flags:{validate:u.assertValueType("string"),"default":""}}}),p["default"]("LogicalExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Binary","Expression"],fields:{operator:{validate:u.assertOneOf.apply(void 0,o.LOGICAL_OPERATORS)},left:{validate:u.assertNodeType("Expression")},right:{validate:u.assertNodeType("Expression")}}}),p["default"]("MemberExpression",{builder:["object","property","computed"],visitor:["object","property"],aliases:["Expression","LVal"],fields:{object:{validate:u.assertNodeType("Expression")},property:{validate:function(t,e,n){var r=t.computed?"Expression":"Identifier";u.assertNodeType(r)(t,e,n)}},computed:{"default":!1}}}),p["default"]("NewExpression",{visitor:["callee","arguments"],aliases:["Expression"],fields:{callee:{validate:u.assertNodeType("Expression")},arguments:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("Expression")))}}}),p["default"]("Program",{visitor:["directives","body"],builder:["body","directives"],fields:{directives:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("Directive"))),"default":[]},body:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("Statement")))}},aliases:["Scopable","BlockParent","Block","FunctionParent"]}),p["default"]("ObjectExpression",{visitor:["properties"],aliases:["Expression"],fields:{properties:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("ObjectMethod","ObjectProperty","SpreadProperty")))}}}),p["default"]("ObjectMethod",{builder:["kind","key","params","body","computed"],fields:{kind:{validate:u.chain(u.assertValueType("string"),u.assertOneOf("method","get","set")),"default":"method"},computed:{validate:u.assertValueType("boolean"),"default":!1},key:{validate:function(t,e,n){var r=t.computed?["Expression"]:["Identifier","Literal"];u.assertNodeType.apply(void 0,r)(t,e,n)}},decorators:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("Decorator")))},body:{validate:u.assertNodeType("BlockStatement")},generator:{"default":!1,validate:u.assertValueType("boolean")},async:{"default":!1,validate:u.assertValueType("boolean")}},visitor:["key","params","body","decorators","returnType","typeParameters"],aliases:["UserWhitespacable","Function","Scopable","BlockParent","FunctionParent","Method"]}),p["default"]("ObjectProperty",{builder:["key","value","computed","shorthand","decorators"],fields:{computed:{validate:u.assertValueType("boolean"),"default":!1},key:{validate:function(t,e,n){var r=t.computed?["Expression"]:["Identifier","Literal"];u.assertNodeType.apply(void 0,r)(t,e,n)}},value:{validate:u.assertNodeType("Expression")},shorthand:{validate:u.assertValueType("boolean"),"default":!1},decorators:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("Decorator"))),optional:!0}},visitor:["key","value","decorators"],aliases:["UserWhitespacable","Property"]}),p["default"]("RestElement",{visitor:["argument","typeAnnotation"],aliases:["LVal"],fields:{argument:{validate:u.assertNodeType("LVal")}}}),p["default"]("ReturnStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:u.assertNodeType("Expression"),optional:!0}}}),p["default"]("SequenceExpression",{visitor:["expressions"],fields:{expressions:{validate:u.assertValueType("array")}},aliases:["Expression"]}),p["default"]("SwitchCase",{visitor:["test","consequent"],fields:{test:{validate:u.assertNodeType("Expression"),optional:!0},consequent:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("Statement")))}}}),p["default"]("SwitchStatement",{visitor:["discriminant","cases"],aliases:["Statement","BlockParent","Scopable"],fields:{discriminant:{validate:u.assertNodeType("Expression")},cases:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("SwitchCase")))}}}),p["default"]("ThisExpression",{aliases:["Expression"]}),p["default"]("ThrowStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:u.assertNodeType("Expression")}}}),p["default"]("TryStatement",{visitor:["block","handler","finalizer"],aliases:["Statement"],fields:{body:{validate:u.assertNodeType("BlockStatement")},handler:{optional:!0,handler:u.assertNodeType("BlockStatement")},finalizer:{optional:!0,validate:u.assertNodeType("BlockStatement")}}}),p["default"]("UnaryExpression",{builder:["operator","argument","prefix"],fields:{prefix:{"default":!1},argument:{validate:u.assertNodeType("Expression")},operator:{validate:u.assertOneOf.apply(void 0,o.UNARY_OPERATORS)}},visitor:["argument"],aliases:["UnaryLike","Expression"]}),p["default"]("UpdateExpression",{builder:["operator","argument","prefix"],fields:{prefix:{"default":!1},argument:{validate:u.assertNodeType("Expression")},operator:{validate:u.assertOneOf.apply(void 0,o.UPDATE_OPERATORS)}},visitor:["argument"],aliases:["Expression"]}),p["default"]("VariableDeclaration",{builder:["kind","declarations"],visitor:["declarations"],aliases:["Statement","Declaration"],fields:{kind:{validate:u.chain(u.assertValueType("string"),u.assertOneOf("var","let","const"))},declarations:{validate:u.chain(u.assertValueType("array"),u.assertEach(u.assertNodeType("VariableDeclarator")))}}}),p["default"]("VariableDeclarator",{visitor:["id","init"],fields:{id:{validate:u.assertNodeType("LVal")},init:{optional:!0,validate:u.assertNodeType("Expression")}}}),p["default"]("WhileStatement",{visitor:["test","body"],aliases:["Statement","BlockParent","Loop","While","Scopable"],fields:{test:{validate:u.assertNodeType("Expression")},body:{validate:u.assertNodeType("BlockStatement","Statement")}}}),p["default"]("WithStatement",{visitor:["object","body"],aliases:["Statement"],fields:{object:{object:u.assertNodeType("Expression")},body:{validate:u.assertNodeType("BlockStatement")}}})},{634:634,640:640,645:645,659:659,660:660}],637:[function(t,e,n){"use strict";var r=t(659)["default"],i=t(640),s=r(i);s["default"]("AssignmentPattern",{visitor:["left","right"],aliases:["Pattern","LVal"],fields:{left:{validate:i.assertNodeType("Identifier")},right:{validate:i.assertNodeType("Expression")}}}),s["default"]("ArrayPattern",{visitor:["elements","typeAnnotation"],aliases:["Pattern","LVal"],fields:{elements:{validate:i.chain(i.assertValueType("array"),i.assertEach(i.assertNodeType("Expression")))}}}),s["default"]("ArrowFunctionExpression",{builder:["params","body","async"],visitor:["params","body","returnType"],aliases:["Scopable","Function","BlockParent","FunctionParent","Expression","Pureish"],fields:{params:{validate:i.chain(i.assertValueType("array"),i.assertEach(i.assertNodeType("LVal")))},body:{validate:i.assertNodeType("BlockStatement","Expression")},async:{validate:i.assertValueType("boolean"),"default":!1}}}),s["default"]("ClassBody",{visitor:["body"],fields:{body:{validate:i.chain(i.assertValueType("array"),i.assertEach(i.assertNodeType("ClassMethod","ClassProperty")))}}}),s["default"]("ClassDeclaration",{builder:["id","superClass","body","decorators"],visitor:["id","body","superClass","typeParameters","superTypeParameters","implements","decorators"],aliases:["Scopable","Class","Statement","Declaration","Pureish"],fields:{id:{validate:i.assertNodeType("Identifier")},body:{validate:i.assertNodeType("ClassBody")},superClass:{optional:!0,validate:i.assertNodeType("Expression")},decorators:{validate:i.chain(i.assertValueType("array"),i.assertEach(i.assertNodeType("Decorator")))}}}),s["default"]("ClassExpression",{inherits:"ClassDeclaration",aliases:["Scopable","Class","Expression","Pureish"],fields:{id:{optional:!0,validate:i.assertNodeType("Identifier")},body:{validate:i.assertNodeType("ClassBody")},superClass:{optional:!0,validate:i.assertNodeType("Expression")},decorators:{validate:i.chain(i.assertValueType("array"),i.assertEach(i.assertNodeType("Decorator")))}}}),s["default"]("ExportAllDeclaration",{visitor:["source"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],fields:{source:{validate:i.assertNodeType("StringLiteral")}}}),s["default"]("ExportDefaultDeclaration",{visitor:["declaration"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],fields:{declaration:{validate:i.assertNodeType("FunctionDeclaration","ClassDeclaration","Expression")}}}),s["default"]("ExportNamedDeclaration",{visitor:["declaration","specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"],fields:{declaration:{validate:i.assertNodeType("Declaration"),optional:!0},specifiers:{validate:i.chain(i.assertValueType("array"),i.assertEach(i.assertNodeType("ExportSpecifier")))},source:{validate:i.assertNodeType("StringLiteral"),optional:!0}}}),s["default"]("ExportSpecifier",{visitor:["local","exported"],aliases:["ModuleSpecifier"],fields:{local:{validate:i.assertNodeType("Identifier")},imported:{validate:i.assertNodeType("Identifier")}}}),s["default"]("ForOfStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:i.assertNodeType("VariableDeclaration","LVal")},right:{validate:i.assertNodeType("Expression")},body:{validate:i.assertNodeType("Statement")}}}),s["default"]("ImportDeclaration",{visitor:["specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration"],fields:{specifiers:{validate:i.chain(i.assertValueType("array"),i.assertEach(i.assertNodeType("ImportSpecifier","ImportDefaultSpecifier","ImportNamespaceSpecifier")))},source:{validate:i.assertNodeType("StringLiteral")}}}),s["default"]("ImportDefaultSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:i.assertNodeType("Identifier")}}}),s["default"]("ImportNamespaceSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:i.assertNodeType("Identifier")}}}),s["default"]("ImportSpecifier",{visitor:["local","imported"],aliases:["ModuleSpecifier"],fields:{local:{validate:i.assertNodeType("Identifier")},imported:{validate:i.assertNodeType("Identifier")}}}),s["default"]("MetaProperty",{visitor:["meta","property"],aliases:["Expression"],fields:{meta:{validate:i.assertValueType("string")},property:{validate:i.assertValueType("string")}}}),s["default"]("ClassMethod",{aliases:["Function","Scopable","BlockParent","FunctionParent","Method"],builder:["kind","key","params","body","computed","static"],visitor:["key","params","body","decorators","returnType","typeParameters"],fields:{kind:{validate:i.chain(i.assertValueType("string"),i.assertOneOf("get","set","method","constructor")),"default":"method"},computed:{"default":!1,validate:i.assertValueType("boolean")},"static":{"default":!1,validate:i.assertValueType("boolean")},key:{validate:function(t,e,n){var r=t.computed?["Expression"]:["Identifier","Literal"];i.assertNodeType.apply(void 0,r)(t,e,n)}},params:{validate:i.chain(i.assertValueType("array"),i.assertEach(i.assertNodeType("LVal")))},body:{validate:i.assertNodeType("BlockStatement")},generator:{"default":!1,validate:i.assertValueType("boolean")},async:{"default":!1,validate:i.assertValueType("boolean")}}}),s["default"]("ObjectPattern",{visitor:["properties","typeAnnotation"],aliases:["Pattern","LVal"],fields:{properties:{validate:i.chain(i.assertValueType("array"),i.assertEach(i.assertNodeType("RestProperty","Property")))}}}),s["default"]("SpreadElement",{visitor:["argument"],aliases:["UnaryLike"],fields:{argument:{validate:i.assertNodeType("Expression")}}}),s["default"]("Super",{aliases:["Expression"]}),s["default"]("TaggedTemplateExpression",{visitor:["tag","quasi"],aliases:["Expression"],fields:{tag:{validate:i.assertNodeType("Expression")},quasi:{validate:i.assertNodeType("TemplateLiteral")}}}),s["default"]("TemplateElement",{builder:["value","tail"],fields:{value:{},tail:{validate:i.assertValueType("boolean"),"default":!1}}}),s["default"]("TemplateLiteral",{visitor:["quasis","expressions"],aliases:["Expression","Literal"],fields:{}}),s["default"]("YieldExpression",{builder:["argument","delegate"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{delegate:{validate:i.assertValueType("boolean"),"default":!1},argument:{optional:!0,validate:i.assertNodeType("Expression")}}})},{640:640,659:659}],638:[function(t,e,n){"use strict";var r=t(659)["default"],i=t(640),s=r(i);s["default"]("AwaitExpression",{builder:["argument"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{argument:{validate:i.assertNodeType("Expression")}}}),s["default"]("BindExpression",{visitor:["object","callee"],fields:{}}),s["default"]("Decorator",{visitor:["expression"],fields:{expression:{validate:i.assertNodeType("Expression")}}}),s["default"]("DoExpression",{visitor:["body"],aliases:["Expression"],fields:{body:{validate:i.assertNodeType("BlockStatement")}}}),s["default"]("ExportDefaultSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:i.assertNodeType("Identifier")}}}),s["default"]("ExportNamespaceSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:i.assertNodeType("Identifier")}}}),s["default"]("RestProperty",{visitor:["argument"],aliases:["UnaryLike"],fields:{argument:{validate:i.assertNodeType("LVal")}}}),s["default"]("SpreadProperty",{visitor:["argument"],aliases:["UnaryLike"],fields:{argument:{validate:i.assertNodeType("Expression")}}})},{640:640,659:659}],639:[function(t,e,n){"use strict";var r=t(659)["default"],i=t(640),s=r(i);s["default"]("AnyTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),s["default"]("ArrayTypeAnnotation",{visitor:["elementType"],aliases:["Flow"],fields:{}}),s["default"]("BooleanTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),s["default"]("BooleanLiteralTypeAnnotation",{aliases:["Flow"],fields:{}}),s["default"]("ClassImplements",{visitor:["id","typeParameters"],aliases:["Flow"],fields:{}}),s["default"]("ClassProperty",{visitor:["key","value","typeAnnotation","decorators"],aliases:["Flow","Property"],fields:{}}),s["default"]("DeclareClass",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),s["default"]("DeclareFunction",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),s["default"]("DeclareModule",{visitor:["id","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),s["default"]("DeclareVariable",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),s["default"]("ExistentialTypeParam",{aliases:["Flow"]}),s["default"]("FunctionTypeAnnotation",{visitor:["typeParameters","params","rest","returnType"],aliases:["Flow"],fields:{}}),s["default"]("FunctionTypeParam",{visitor:["name","typeAnnotation"],aliases:["Flow"],fields:{}}),s["default"]("GenericTypeAnnotation",{visitor:["id","typeParameters"],aliases:["Flow"],fields:{}}),s["default"]("InterfaceExtends",{visitor:["id","typeParameters"],aliases:["Flow"],fields:{}}),s["default"]("InterfaceDeclaration",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),s["default"]("IntersectionTypeAnnotation",{visitor:["types"],aliases:["Flow"],fields:{}}),s["default"]("MixedTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),s["default"]("NullableTypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"],fields:{}}),s["default"]("NumericLiteralTypeAnnotation",{aliases:["Flow"],fields:{}}),s["default"]("NumberTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),s["default"]("StringLiteralTypeAnnotation",{aliases:["Flow"],fields:{}}),s["default"]("StringTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}}),s["default"]("TupleTypeAnnotation",{visitor:["types"],aliases:["Flow"],fields:{}}),s["default"]("TypeofTypeAnnotation",{visitor:["argument"],aliases:["Flow"],fields:{}}),s["default"]("TypeAlias",{visitor:["id","typeParameters","right"],aliases:["Flow","FlowDeclaration","Statement","Declaration"],fields:{}}),s["default"]("TypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"],fields:{}}),s["default"]("TypeCastExpression",{visitor:["expression","typeAnnotation"],aliases:["Flow","ExpressionWrapper","Expression"],fields:{}}),s["default"]("TypeParameterDeclaration",{visitor:["params"],aliases:["Flow"],fields:{}}),s["default"]("TypeParameterInstantiation",{visitor:["params"],aliases:["Flow"],fields:{}}),s["default"]("ObjectTypeAnnotation",{visitor:["properties","indexers","callProperties"],aliases:["Flow"],fields:{}}),s["default"]("ObjectTypeCallProperty",{visitor:["value"],aliases:["Flow","UserWhitespacable"],fields:{}}),s["default"]("ObjectTypeIndexer",{visitor:["id","key","value"],aliases:["Flow","UserWhitespacable"],fields:{}}),s["default"]("ObjectTypeProperty",{visitor:["key","value"],aliases:["Flow","UserWhitespacable"],fields:{}}),s["default"]("QualifiedTypeIdentifier",{visitor:["id","qualification"],aliases:["Flow"],fields:{}}),s["default"]("UnionTypeAnnotation",{visitor:["types"],aliases:["Flow"],fields:{}}),s["default"]("VoidTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"],fields:{}})},{640:640,659:659}],640:[function(t,e,n){"use strict";function r(t){return Array.isArray(t)?"array":null===t?"null":void 0===t?"undefined":typeof t}function i(t){return function(e,n,r){if(Array.isArray(r))for(var i=0;i<r.length;i++)t(e,n+"["+i+"]",r[i])}}function s(){function t(t,e,r){if(n.indexOf(r)<0)throw new TypeError("Property "+e+" expected value to be one of "+JSON.stringify(n)+" but got "+JSON.stringify(r))}for(var e=arguments.length,n=Array(e),r=0;e>r;r++)n[r]=arguments[r];return t.oneOf=n,t}function a(){function t(t,e,r){for(var i=!1,s=n,a=Array.isArray(s),o=0,s=a?s:l(s);;){var u;if(a){if(o>=s.length)break;u=s[o++]}else{if(o=s.next(),o.done)break;u=o.value}var p=u;if(h.is(p,r)){i=!0;break}}if(!i)throw new TypeError("Property "+e+" of "+t.type+" expected node to be of a type "+JSON.stringify(n)+" but instead got "+JSON.stringify(r&&r.type))}for(var e=arguments.length,n=Array(e),r=0;e>r;r++)n[r]=arguments[r];return t.oneOfNodeTypes=n,t}function o(t){function e(e,n,i){var s=r(i)===t;if(!s)throw new TypeError("Property "+n+" expected type of "+t+" but got "+r(i))}return e.type=t,e}function u(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return function(){for(var t=e,n=Array.isArray(t),r=0,t=n?t:l(t);;){var i;if(n){if(r>=t.length)break;i=t[r++]}else{if(r=t.next(),r.done)break;i=r.value}var s=i;s.apply(void 0,arguments)}}}function p(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=e.inherits&&A[e.inherits]||{};e.fields=e.fields||n.fields||{},e.visitor=e.visitor||n.visitor||[],e.aliases=e.aliases||n.aliases||[],e.builder=e.builder||n.builder||e.visitor||[],e.deprecatedAlias&&(v[e.deprecatedAlias]=t);for(var i=e.visitor.concat(e.builder),s=Array.isArray(i),a=0,i=s?i:l(i);;){
var u;if(s){if(a>=i.length)break;u=i[a++]}else{if(a=i.next(),a.done)break;u=a.value}var p=u;e.fields[p]=e.fields[p]||{}}for(var p in e.fields){var c=e.fields[p];void 0===c["default"]?c["default"]=null:c.validate||(c.validate=o(r(c["default"])))}d[t]=e.visitor,g[t]=e.builder,y[t]=e.fields,m[t]=e.aliases,A[t]=e}var l=t(649)["default"],c=t(660)["default"];n.__esModule=!0,n.assertEach=i,n.assertOneOf=s,n.assertNodeType=a,n.assertValueType=o,n.chain=u,n["default"]=p;var f=t(645),h=c(f),d={};n.VISITOR_KEYS=d;var m={};n.ALIAS_KEYS=m;var y={};n.NODE_FIELDS=y;var g={};n.BUILDER_KEYS=g;var v={};n.DEPRECATED_KEYS=v;var A={}},{645:645,649:649,660:660}],641:[function(t,e,n){"use strict";t(640),t(636),t(637),t(639),t(642),t(643),t(638)},{636:636,637:637,638:638,639:639,640:640,642:642,643:643}],642:[function(t,e,n){"use strict";var r=t(659)["default"],i=t(640),s=r(i);s["default"]("JSXAttribute",{visitor:["name","value"],aliases:["JSX","Immutable"],fields:{name:{validate:i.assertNodeType("JSXIdentifier","JSXMemberExpression")},value:{optional:!0,validate:i.assertNodeType("JSXElement","StringLiteral","JSXExpressionContainer")}}}),s["default"]("JSXClosingElement",{visitor:["name"],aliases:["JSX","Immutable"],fields:{name:{validate:i.assertNodeType("JSXIdentifier","JSXMemberExpression")}}}),s["default"]("JSXElement",{builder:["openingElement","closingElement","children","selfClosing"],visitor:["openingElement","children","closingElement"],aliases:["JSX","Immutable","Expression"],fields:{openingElement:{validate:i.assertNodeType("JSXOpeningElement")},closingElement:{optional:!0,validate:i.assertNodeType("JSXClosingElement")},children:{}}}),s["default"]("JSXEmptyExpression",{aliases:["JSX","Expression"]}),s["default"]("JSXExpressionContainer",{visitor:["expression"],aliases:["JSX","Immutable"],fields:{expression:{validate:i.assertNodeType("Expression")}}}),s["default"]("JSXIdentifier",{builder:["name"],aliases:["JSX","Expression"],fields:{name:{validate:i.assertValueType("string")}}}),s["default"]("JSXMemberExpression",{visitor:["object","property"],aliases:["JSX","Expression"],fields:{object:{validate:i.assertNodeType("JSXIdentifier")},property:{validate:i.assertNodeType("JSXIdentifier")}}}),s["default"]("JSXNamespacedName",{visitor:["namespace","name"],aliases:["JSX"],fields:{namespace:{validate:i.assertNodeType("JSXIdentifier")},name:{validate:i.assertNodeType("JSXIdentifier")}}}),s["default"]("JSXOpeningElement",{builder:["name","attributes","selfClosing"],visitor:["name","attributes"],aliases:["JSX","Immutable"],fields:{name:{validate:i.assertNodeType("JSXIdentifier","JSXMemberExpression")},selfClosing:{"default":!1,validate:i.assertValueType("boolean")},attributes:{validate:i.chain(i.assertValueType("array"),i.assertEach(i.assertNodeType("JSXAttribute","JSXSpreadAttribute")))}}}),s["default"]("JSXSpreadAttribute",{visitor:["argument"],aliases:["JSX"],fields:{argument:{validate:i.assertNodeType("Expression")}}}),s["default"]("JSXText",{aliases:["JSX"],builder:["value"],fields:{value:{validate:i.assertValueType("string")}}})},{640:640,659:659}],643:[function(t,e,n){"use strict";var r=t(659)["default"],i=t(640),s=r(i);s["default"]("Noop",{visitor:[]}),s["default"]("ParenthesizedExpression",{visitor:["expression"],aliases:["Expression","ExpressionWrapper"],fields:{expression:{validate:i.assertNodeType("Expression")}}})},{640:640,659:659}],644:[function(t,e,n){"use strict";function r(t){var e=i(t);return 1===e.length?e[0]:u.unionTypeAnnotation(e)}function i(t){for(var e={},n={},r=[],s=[],a=0;a<t.length;a++){var o=t[a];if(o&&!(s.indexOf(o)>=0)){if(u.isAnyTypeAnnotation(o))return[o];if(u.isFlowBaseAnnotation(o))n[o.type]=o;else if(u.isUnionTypeAnnotation(o))r.indexOf(o.types)<0&&(t=t.concat(o.types),r.push(o.types));else if(u.isGenericTypeAnnotation(o)){var p=o.id.name;if(e[p]){var l=e[p];l.typeParameters?o.typeParameters&&(l.typeParameters.params=i(l.typeParameters.params.concat(o.typeParameters.params))):l=o.typeParameters}else e[p]=o}else s.push(o)}}for(var c in n)s.push(n[c]);for(var f in e)s.push(e[f]);return s}function s(t){if("string"===t)return u.stringTypeAnnotation();if("number"===t)return u.numberTypeAnnotation();if("undefined"===t)return u.voidTypeAnnotation();if("boolean"===t)return u.booleanTypeAnnotation();if("function"===t)return u.genericTypeAnnotation(u.identifier("Function"));if("object"===t)return u.genericTypeAnnotation(u.identifier("Object"));if("symbol"===t)return u.genericTypeAnnotation(u.identifier("Symbol"));throw new Error("Invalid typeof value")}var a=t(660)["default"];n.__esModule=!0,n.createUnionTypeAnnotation=r,n.removeTypeDuplicates=i,n.createTypeAnnotationBasedOnTypeof=s;var o=t(645),u=a(o)},{645:645,660:660}],645:[function(t,e,n){"use strict";function r(t){var e=G["is"+t]=function(e,n){return G.is(t,e,n)};G["assert"+t]=function(n,r){if(r=r||{},!e(n,r))throw new Error("Expected type "+JSON.stringify(t)+" with option "+JSON.stringify(r))}}function i(t,e,n){if(!e)return!1;var r=s(e.type,t);return r?"undefined"==typeof n?!0:G.shallowEqual(e,n):!1}function s(t,e){if(t===e)return!0;var n=G.FLIPPED_ALIAS_KEYS[e];if(n){if(n[0]===t)return!0;for(var r=n,i=Array.isArray(r),s=0,r=i?r:C(r);;){var a;if(i){if(s>=r.length)break;a=r[s++]}else{if(s=r.next(),s.done)break;a=s.value}var o=a;if(t===o)return!0}}return!1}function a(t,e,n){if(t){var r=G.NODE_FIELDS[t.type];if(r){var i=r[e];i&&i.validate&&(i.optional&&null==n||i.validate(t,e,n))}}}function o(t,e){for(var n=D(e),r=n,i=Array.isArray(r),s=0,r=i?r:C(r);;){var a;if(i){if(s>=r.length)break;a=r[s++]}else{if(s=r.next(),s.done)break;a=s.value}var o=a;if(t[o]!==e[o])return!1}return!0}function u(t,e,n){return t.object=G.memberExpression(t.object,t.property,t.computed),t.property=e,t.computed=!!n,t}function p(t,e){return t.object=G.memberExpression(e,t.object),t}function l(t){var e=arguments.length<=1||void 0===arguments[1]?"body":arguments[1];return t[e]=G.toBlock(t[e],t)}function c(t){var e={};for(var n in t)"_"!==n[0]&&(e[n]=t[n]);return e}function f(t){var e={};for(var n in t)if("_"!==n[0]){var r=t[n];r&&(r.type?r=G.cloneDeep(r):Array.isArray(r)&&(r=r.map(G.cloneDeep))),e[n]=r}return e}function h(t,e){var n=t.split(".");return function(t){if(!G.isMemberExpression(t))return!1;for(var r=[t],i=0;r.length;){var s=r.shift();if(e&&i===n.length)return!0;if(G.isIdentifier(s)){if(n[i]!==s.name)return!1}else{if(!G.isStringLiteral(s)){if(G.isMemberExpression(s)){if(s.computed&&!G.isStringLiteral(s.property))return!1;r.push(s.object),r.push(s.property);continue}return!1}if(n[i]!==s.value)return!1}if(++i>n.length)return!1}return!0}}function d(t){for(var e=G.COMMENT_KEYS,n=Array.isArray(e),r=0,e=n?e:C(e);;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if(r=e.next(),r.done)break;i=r.value}var s=i;delete t[s]}return t}function m(t,e){return y(t,e),g(t,e),v(t,e),t}function y(t,e){A("trailingComments",t,e)}function g(t,e){A("leadingComments",t,e)}function v(t,e){A("innerComments",t,e)}function A(t,e,n){e&&n&&(e[t]=R["default"](P["default"]([].concat(e[t],n[t]))))}function E(t,e){if(!t||!e)return t;for(var n=G.INHERIT_KEYS.optional,r=Array.isArray(n),i=0,n=r?n:C(n);;){var s;if(r){if(i>=n.length)break;s=n[i++]}else{if(i=n.next(),i.done)break;s=i.value}var a=s;null==t[a]&&(t[a]=e[a])}for(var a in e)"_"===a[0]&&(t[a]=e[a]);for(var o=G.INHERIT_KEYS.force,u=Array.isArray(o),p=0,o=u?o:C(o);;){var l;if(u){if(p>=o.length)break;l=o[p++]}else{if(p=o.next(),p.done)break;l=p.value}var a=l;t[a]=e[a]}return G.inheritsComments(t,e),t}function b(t){if(!x(t))throw new TypeError("Not a valid node "+(t&&t.type))}function x(t){return!(!t||!j.VISITOR_KEYS[t.type])}var D=t(655)["default"],C=t(649)["default"],S=t(659)["default"],F=t(660)["default"],w=t(657)["default"],B=t(658)["default"];n.__esModule=!0,n.is=i,n.isType=s,n.validate=a,n.shallowEqual=o,n.appendToMemberExpression=u,n.prependToMemberExpression=p,n.ensureBlock=l,n.clone=c,n.cloneDeep=f,n.buildMatchMemberExpression=h,n.removeComments=d,n.inheritsComments=m,n.inheritTrailingComments=y,n.inheritLeadingComments=g,n.inheritInnerComments=v,n.inherits=E,n.assertNode=b,n.isNode=x;var T=t(795),_=S(T),k=t(721),P=S(k),N=t(779),I=S(N),L=t(724),O=S(L),M=t(723),R=S(M);t(641);var j=t(640),V=t(646),U=F(V),G=n,W=t(634);w(n,B(W,w)),n.VISITOR_KEYS=j.VISITOR_KEYS,n.ALIAS_KEYS=j.ALIAS_KEYS,n.NODE_FIELDS=j.NODE_FIELDS,n.BUILDER_KEYS=j.BUILDER_KEYS,n.DEPRECATED_KEYS=j.DEPRECATED_KEYS,n.react=U;for(var q in G.VISITOR_KEYS)r(q);G.FLIPPED_ALIAS_KEYS={},O["default"](G.ALIAS_KEYS,function(t,e){O["default"](t,function(t){var n=G.FLIPPED_ALIAS_KEYS[t]=G.FLIPPED_ALIAS_KEYS[t]||[];n.push(e)})}),O["default"](G.FLIPPED_ALIAS_KEYS,function(t,e){G[e.toUpperCase()+"_TYPES"]=t,r(e)});var H=D(G.VISITOR_KEYS).concat(D(G.FLIPPED_ALIAS_KEYS)).concat(D(G.DEPRECATED_KEYS));n.TYPES=H,O["default"](G.BUILDER_KEYS,function(t,e){function n(){if(arguments.length>t.length)throw new Error("t."+e+": Too many arguments passed. Received "+arguments.length+" but can receive no more than "+t.length);var n={};n.type=e;for(var r=0,i=t,s=Array.isArray(i),o=0,i=s?i:C(i);;){var u;if(s){if(o>=i.length)break;u=i[o++]}else{if(o=i.next(),o.done)break;u=o.value}var p=u,l=G.NODE_FIELDS[e][p],c=arguments[r++];void 0===c&&(c=I["default"](l["default"])),n[p]=c}for(var p in n)a(n,p,n[p]);return n}G[e]=n,G[e[0].toLowerCase()+e.slice(1)]=n});var Y=function(t){var e=function(e){return function(){return console.trace("The node type "+t+" has been renamed to "+n),e.apply(this,arguments)}},n=G.DEPRECATED_KEYS[t];G[t]=G[t[0].toLowerCase()+t.slice(1)]=e(G[n]),G["is"+t]=e(G["is"+n]),G["assert"+t]=e(G["assert"+n])};for(var q in G.DEPRECATED_KEYS)Y(q);_["default"](G),_["default"](G.VISITOR_KEYS);var J=t(647);w(n,B(J,w));var K=t(648);w(n,B(K,w));var $=t(635);w(n,B($,w));var X=t(644);w(n,B(X,w))},{634:634,635:635,640:640,641:641,644:644,646:646,647:647,648:648,649:649,655:655,657:657,658:658,659:659,660:660,721:721,723:723,724:724,779:779,795:795}],646:[function(t,e,n){"use strict";function r(t){return!!t&&/^[a-z]|\-/.test(t)}function i(t,e){for(var n=t.value.split(/\r\n|\n|\r/),r=0,i=0;i<n.length;i++)n[i].match(/[^ \t]/)&&(r=i);for(var s="",i=0;i<n.length;i++){var a=n[i],o=0===i,p=i===n.length-1,l=i===r,c=a.replace(/\t/g," ");o||(c=c.replace(/^[ ]+/,"")),p||(c=c.replace(/[ ]+$/,"")),c&&(l||(c+=" "),s+=c)}s&&e.push(u.stringLiteral(s))}function s(t){for(var e=[],n=0;n<t.children.length;n++){var r=t.children[n];u.isJSXText(r)?i(r,e):(u.isJSXExpressionContainer(r)&&(r=r.expression),u.isJSXEmptyExpression(r)||e.push(r))}return e}var a=t(660)["default"];n.__esModule=!0,n.isCompatTag=r,n.buildChildren=s;var o=t(645),u=a(o),p=u.buildMatchMemberExpression("React.Component");n.isReactComponent=p},{645:645,660:660}],647:[function(t,e,n){"use strict";function r(t,e,n){for(var r=[].concat(t),i=s(null);r.length;){var a=r.shift();if(a){var o=u.getBindingIdentifiers.keys[a.type];if(u.isIdentifier(a))if(e){var p=i[a.name]=i[a.name]||[];p.push(a)}else i[a.name]=a;else if(u.isExportDeclaration(a))u.isDeclaration(t.declaration)&&r.push(t.declaration);else{if(n){if(u.isFunctionDeclaration(a)){r.push(a.id);continue}if(u.isFunctionExpression(a))continue}if(o)for(var l=0;l<o.length;l++){var c=o[l];a[c]&&(r=r.concat(a[c]))}}}}return i}function i(t,e){return r(t,e,!0)}var s=t(651)["default"],a=t(660)["default"];n.__esModule=!0,n.getBindingIdentifiers=r,n.getOuterBindingIdentifiers=i;var o=t(645),u=a(o);r.keys={DeclareClass:["id"],DeclareFunction:["id"],DeclareModule:["id"],DeclareVariable:["id"],InterfaceDeclaration:["id"],TypeAlias:["id"],CatchClause:["param"],LabeledStatement:["label"],UnaryExpression:["argument"],AssignmentExpression:["left"],ImportSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportDefaultSpecifier:["local"],ImportDeclaration:["specifiers"],ExportSpecifier:["exported"],ExportNamespaceSpecifier:["exported"],ExportDefaultSpecifier:["exported"],FunctionDeclaration:["id","params"],FunctionExpression:["id","params"],ClassDeclaration:["id"],ClassExpression:["id"],RestElement:["argument"],UpdateExpression:["argument"],SpreadProperty:["argument"],ObjectProperty:["value"],AssignmentPattern:["left"],ArrayPattern:["elements"],ObjectPattern:["properties"],VariableDeclaration:["declarations"],VariableDeclarator:["id"]}},{645:645,651:651,660:660}],648:[function(t,e,n){"use strict";function r(t,e){var n=m.getBindingIdentifiers.keys[e.type];if(n)for(var r=0;r<n.length;r++){var i=n[r],s=e[i];if(Array.isArray(s)){if(s.indexOf(t)>=0)return!0}else if(s===t)return!0}return!1}function i(t,e){switch(e.type){case"MemberExpression":case"JSXMemberExpression":case"BindExpression":return e.property===t&&e.computed?!0:e.object===t?!0:!1;case"MetaProperty":return!1;case"ObjectProperty":if(e.key===t)return e.computed;case"VariableDeclarator":return e.id!==t;case"ArrowFunctionExpression":case"FunctionDeclaration":case"FunctionExpression":for(var n=e.params,r=Array.isArray(n),i=0,n=r?n:f(n);;){var s;if(r){if(i>=n.length)break;s=n[i++]}else{if(i=n.next(),i.done)break;s=i.value}var a=s;if(a===t)return!1}return e.id!==t;case"ExportSpecifier":return e.source?!1:e.local===t;case"ExportNamespaceSpecifier":case"ExportDefaultSpecifier":return!1;case"JSXAttribute":return e.name!==t;case"ClassProperty":return e.value===t;case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"ImportSpecifier":return!1;case"ClassDeclaration":case"ClassExpression":return e.id!==t;case"ClassMethod":case"ObjectMethod":return e.key===t&&e.computed;case"LabeledStatement":return!1;case"CatchClause":return e.param!==t;case"RestElement":return!1;case"AssignmentExpression":return e.right===t;case"AssignmentPattern":return e.right===t;case"ObjectPattern":case"ArrayPattern":return!1}return!0}function s(t){return"string"!=typeof t||g["default"].keyword.isReservedWordES6(t,!0)?!1:g["default"].keyword.isIdentifierNameES6(t)}function a(t){return A.isVariableDeclaration(t)&&("var"!==t.kind||t[E.BLOCK_SCOPED_SYMBOL])}function o(t){return A.isFunctionDeclaration(t)||A.isClassDeclaration(t)||A.isLet(t)}function u(t){return A.isVariableDeclaration(t,{kind:"var"})&&!t[E.BLOCK_SCOPED_SYMBOL]}function p(t){return A.isImportDefaultSpecifier(t)||A.isIdentifier(t.imported||t.exported,{name:"default"})}function l(t,e){return A.isBlockStatement(t)&&A.isFunction(e,{body:t})?!1:A.isScopable(t)}function c(t){return A.isType(t.type,"Immutable")?!0:A.isIdentifier(t)&&"undefined"===t.name?!0:!1}var f=t(649)["default"],h=t(659)["default"],d=t(660)["default"];n.__esModule=!0,n.isBinding=r,n.isReferenced=i,n.isValidIdentifier=s,n.isLet=a,n.isBlockScoped=o,n.isVar=u,n.isSpecifierDefault=p,n.isScope=l,n.isImmutable=c;var m=t(647),y=t(720),g=h(y),v=t(645),A=d(v),E=t(634)},{634:634,645:645,647:647,649:649,659:659,660:660,720:720}],649:[function(t,e,n){arguments[4][55][0].apply(n,arguments)},{55:55,662:662}],650:[function(t,e,n){e.exports={"default":t(663),__esModule:!0}},{663:663}],651:[function(t,e,n){arguments[4][57][0].apply(n,arguments)},{57:57,664:664}],652:[function(t,e,n){arguments[4][58][0].apply(n,arguments)},{58:58,665:665}],653:[function(t,e,n){arguments[4][59][0].apply(n,arguments)},{59:59,666:666}],654:[function(t,e,n){arguments[4][60][0].apply(n,arguments)},{60:60,667:667}],655:[function(t,e,n){arguments[4][273][0].apply(n,arguments)},{273:273,668:668}],656:[function(t,e,n){e.exports={"default":t(669),__esModule:!0}},{669:669}],657:[function(t,e,n){arguments[4][63][0].apply(n,arguments)},{63:63,652:652,653:653,654:654}],658:[function(t,e,n){arguments[4][65][0].apply(n,arguments)},{65:65}],659:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{15:15}],660:[function(t,e,n){arguments[4][67][0].apply(n,arguments)},{67:67}],661:[function(t,e,n){arguments[4][70][0].apply(n,arguments)},{497:497,70:70}],662:[function(t,e,n){arguments[4][77][0].apply(n,arguments)},{708:708,714:714,716:716,77:77}],663:[function(t,e,n){t(710),e.exports=9007199254740991},{710:710}],664:[function(t,e,n){arguments[4][79][0].apply(n,arguments)},{693:693,79:79}],665:[function(t,e,n){arguments[4][80][0].apply(n,arguments)},{693:693,80:80}],666:[function(t,e,n){arguments[4][81][0].apply(n,arguments)},{693:693,711:711,81:81}],667:[function(t,e,n){arguments[4][82][0].apply(n,arguments)},{693:693,712:712,82:82}],668:[function(t,e,n){arguments[4][283][0].apply(n,arguments)},{283:283,675:675,713:713}],669:[function(t,e,n){t(715),e.exports=t(675).Symbol["for"]},{675:675,715:715}],670:[function(t,e,n){arguments[4][84][0].apply(n,arguments)},{84:84}],671:[function(t,e,n){arguments[4][85][0].apply(n,arguments)},{85:85}],672:[function(t,e,n){arguments[4][86][0].apply(n,arguments)},{688:688,86:86}],673:[function(t,e,n){arguments[4][87][0].apply(n,arguments)},{674:674,706:706,87:87}],674:[function(t,e,n){arguments[4][88][0].apply(n,arguments)},{88:88}],675:[function(t,e,n){arguments[4][92][0].apply(n,arguments)},{92:92}],676:[function(t,e,n){arguments[4][93][0].apply(n,arguments)},{670:670,93:93}],677:[function(t,e,n){arguments[4][94][0].apply(n,arguments)},{94:94}],678:[function(t,e,n){arguments[4][95][0].apply(n,arguments)},{681:681,95:95}],679:[function(t,e,n){arguments[4][435][0].apply(n,arguments)},{435:435,693:693}],680:[function(t,e,n){arguments[4][96][0].apply(n,arguments)},{675:675,676:676,683:683,96:96}],681:[function(t,e,n){arguments[4][97][0].apply(n,arguments)},{97:97}],682:[function(t,e,n){arguments[4][99][0].apply(n,arguments)},{693:693,703:703,99:99}],683:[function(t,e,n){arguments[4][100][0].apply(n,arguments)},{100:100}],684:[function(t,e,n){arguments[4][101][0].apply(n,arguments)},{101:101}],685:[function(t,e,n){arguments[4][102][0].apply(n,arguments)},{102:102,678:678,693:693,697:697}],686:[function(t,e,n){arguments[4][103][0].apply(n,arguments)},{103:103,674:674}],687:[function(t,e,n){arguments[4][443][0].apply(n,arguments)},{443:443,674:674}],688:[function(t,e,n){arguments[4][105][0].apply(n,arguments)},{105:105}],689:[function(t,e,n){arguments[4][107][0].apply(n,arguments)},{107:107,685:685,693:693,697:697,699:699,706:706}],690:[function(t,e,n){arguments[4][108][0].apply(n,arguments)},{108:108,680:680,684:684,685:685,689:689,692:692,693:693,695:695,698:698,699:699,706:706}],691:[function(t,e,n){arguments[4][109][0].apply(n,arguments)},{109:109}],692:[function(t,e,n){arguments[4][110][0].apply(n,arguments)},{110:110}],693:[function(t,e,n){arguments[4][111][0].apply(n,arguments)},{111:111}],694:[function(t,e,n){arguments[4][446][0].apply(n,arguments)},{446:446,693:693,703:703}],695:[function(t,e,n){arguments[4][112][0].apply(n,arguments)},{112:112}],696:[function(t,e,n){arguments[4][113][0].apply(n,arguments)},{113:113,675:675,680:680,681:681}],697:[function(t,e,n){arguments[4][114][0].apply(n,arguments)},{114:114}],698:[function(t,e,n){arguments[4][116][0].apply(n,arguments)},{116:116,685:685}],699:[function(t,e,n){arguments[4][119][0].apply(n,arguments)},{119:119,684:684,693:693,706:706}],700:[function(t,e,n){arguments[4][120][0].apply(n,arguments)},{120:120,683:683}],701:[function(t,e,n){arguments[4][122][0].apply(n,arguments)},{122:122,677:677,702:702}],702:[function(t,e,n){arguments[4][123][0].apply(n,arguments)},{123:123}],703:[function(t,e,n){arguments[4][124][0].apply(n,arguments)},{124:124,677:677,686:686}],704:[function(t,e,n){arguments[4][317][0].apply(n,arguments)},{317:317,677:677}],705:[function(t,e,n){arguments[4][126][0].apply(n,arguments)},{126:126}],706:[function(t,e,n){arguments[4][127][0].apply(n,arguments)},{127:127,683:683,700:700,705:705}],707:[function(t,e,n){arguments[4][128][0].apply(n,arguments)},{128:128,673:673,675:675,692:692,706:706}],708:[function(t,e,n){arguments[4][129][0].apply(n,arguments)},{129:129,672:672,675:675,707:707}],709:[function(t,e,n){arguments[4][130][0].apply(n,arguments)},{130:130,671:671,690:690,691:691,692:692,703:703}],710:[function(t,e,n){var r=t(680);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{680:680}],711:[function(t,e,n){arguments[4][132][0].apply(n,arguments)},{132:132,696:696,703:703}],712:[function(t,e,n){arguments[4][133][0].apply(n,arguments)},{133:133,682:682,696:696}],713:[function(t,e,n){arguments[4][324][0].apply(n,arguments)},{324:324,696:696,704:704}],714:[function(t,e,n){arguments[4][136][0].apply(n,arguments)},{136:136,690:690,701:701}],715:[function(t,e,n){arguments[4][456][0].apply(n,arguments)},{456:456,672:672,678:678,679:679,680:680,681:681,682:682,683:683,684:684,687:687,693:693,694:694,695:695,697:697,698:698,699:699,700:700,703:703,705:705,706:706}],716:[function(t,e,n){arguments[4][138][0].apply(n,arguments)},{138:138,692:692,709:709}],717:[function(t,e,n){arguments[4][18][0].apply(n,arguments)},{18:18}],718:[function(t,e,n){arguments[4][19][0].apply(n,arguments)},{19:19}],719:[function(t,e,n){arguments[4][20][0].apply(n,arguments)},{20:20,718:718}],720:[function(t,e,n){arguments[4][21][0].apply(n,arguments)},{21:21,717:717,718:718,719:719}],721:[function(t,e,n){function r(t){for(var e=-1,n=t?t.length:0,r=-1,i=[];++e<n;){var s=t[e];s&&(i[++r]=s)}return i}e.exports=r},{}],722:[function(t,e,n){arguments[4][142][0].apply(n,arguments)},{142:142}],723:[function(t,e,n){function r(t,e,n,r){var u=t?t.length:0;return u?(null!=e&&"boolean"!=typeof e&&(r=n,n=a(t,e,r)?void 0:e,e=!1),n=null==n?n:i(n,r,3),e?o(t,n):s(t,n)):[]}var i=t(731),s=t(749),a=t(770),o=t(776);e.exports=r},{731:731,749:749,770:770,776:776}],724:[function(t,e,n){arguments[4][144][0].apply(n,arguments)},{144:144,725:725}],725:[function(t,e,n){arguments[4][145][0].apply(n,arguments)},{145:145,728:728,734:734,757:757}],726:[function(t,e,n){(function(n){function r(t){var e=t?t.length:0;for(this.data={hash:o(null),set:new a};e--;)this.push(t[e])}var i=t(753),s=t(763),a=s(n,"Set"),o=s(Object,"create");r.prototype.push=i,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{753:753,763:763}],727:[function(t,e,n){arguments[4][149][0].apply(n,arguments)},{149:149}],728:[function(t,e,n){arguments[4][150][0].apply(n,arguments)},{150:150}],729:[function(t,e,n){arguments[4][151][0].apply(n,arguments)},{151:151}],730:[function(t,e,n){arguments[4][154][0].apply(n,arguments)},{154:154,733:733,790:790}],731:[function(t,e,n){arguments[4][155][0].apply(n,arguments)},{155:155,743:743,744:744,750:750,793:793,794:794}],732:[function(t,e,n){arguments[4][156][0].apply(n,arguments)},{156:156,727:727,728:728,730:730,737:737,765:765,766:766,767:767,781:781,785:785}],733:[function(t,e,n){arguments[4][158][0].apply(n,arguments)},{158:158}],734:[function(t,e,n){arguments[4][159][0].apply(n,arguments)},{159:159,737:737,754:754}],735:[function(t,e,n){arguments[4][160][0].apply(n,arguments)},{160:160,755:755}],736:[function(t,e,n){arguments[4][161][0].apply(n,arguments)},{161:161,735:735,791:791}],737:[function(t,e,n){arguments[4][162][0].apply(n,arguments)},{162:162,735:735,790:790}],738:[function(t,e,n){arguments[4][163][0].apply(n,arguments)},{163:163,777:777}],739:[function(t,e,n){arguments[4][164][0].apply(n,arguments)},{164:164,764:764}],740:[function(t,e,n){arguments[4][165][0].apply(n,arguments)},{165:165,741:741,773:773,785:785}],741:[function(t,e,n){arguments[4][166][0].apply(n,arguments)},{166:166,758:758,759:759,760:760,781:781,789:789}],742:[function(t,e,n){arguments[4][167][0].apply(n,arguments)},{167:167,740:740,777:777}],743:[function(t,e,n){arguments[4][169][0].apply(n,arguments)},{169:169,742:742,762:762,777:777}],744:[function(t,e,n){arguments[4][170][0].apply(n,arguments)},{170:170,722:722,738:738,740:740,747:747,771:771,774:774,777:777,778:778,781:781}],745:[function(t,e,n){arguments[4][173][0].apply(n,arguments)},{173:173}],746:[function(t,e,n){arguments[4][174][0].apply(n,arguments)},{174:174,738:738,778:778}],747:[function(t,e,n){arguments[4][175][0].apply(n,arguments)},{175:175}],748:[function(t,e,n){arguments[4][177][0].apply(n,arguments)},{177:177}],749:[function(t,e,n){function r(t,e){var n=-1,r=i,u=t.length,p=!0,l=p&&u>=o,c=l?a():null,f=[];c?(r=s,p=!1):(l=!1,c=e?[]:f);t:for(;++n<u;){var h=t[n],d=e?e(h,n,t):h;if(p&&h===h){for(var m=c.length;m--;)if(c[m]===d)continue t;e&&c.push(d),f.push(h)}else r(c,d,0)<0&&((e||l)&&c.push(d),f.push(h))}return f}var i=t(739),s=t(752),a=t(756),o=200;e.exports=r},{739:739,752:752,756:756}],750:[function(t,e,n){arguments[4][179][0].apply(n,arguments)},{179:179,793:793}],751:[function(t,e,n){arguments[4][180][0].apply(n,arguments)},{180:180}],752:[function(t,e,n){function r(t,e){var n=t.data,r="string"==typeof e||i(e)?n.set.has(e):n.hash[e];return r?0:-1}var i=t(785);e.exports=r},{785:785}],753:[function(t,e,n){function r(t){var e=this.data;"string"==typeof t||i(t)?e.set.add(t):e.hash[t]=!0}var i=t(785);e.exports=r},{785:785}],754:[function(t,e,n){arguments[4][183][0].apply(n,arguments)},{183:183,761:761,772:772,777:777}],755:[function(t,e,n){arguments[4][184][0].apply(n,arguments)},{184:184,777:777}],756:[function(t,e,n){(function(n){function r(t){return o&&a?new i(t):null}var i=t(726),s=t(763),a=s(n,"Set"),o=s(Object,"create");e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{726:726,763:763}],757:[function(t,e,n){arguments[4][186][0].apply(n,arguments)},{186:186,750:750,781:781}],758:[function(t,e,n){arguments[4][187][0].apply(n,arguments)},{187:187,729:729}],759:[function(t,e,n){arguments[4][188][0].apply(n,arguments)},{188:188}],760:[function(t,e,n){arguments[4][189][0].apply(n,arguments)},{189:189,790:790}],761:[function(t,e,n){arguments[4][191][0].apply(n,arguments)},{191:191,745:745}],762:[function(t,e,n){arguments[4][192][0].apply(n,arguments)},{192:192,774:774,792:792}],763:[function(t,e,n){arguments[4][193][0].apply(n,arguments)},{193:193,783:783}],764:[function(t,e,n){arguments[4][194][0].apply(n,arguments)},{194:194}],765:[function(t,e,n){arguments[4][195][0].apply(n,arguments)},{195:195}],766:[function(t,e,n){arguments[4][196][0].apply(n,arguments)},{196:196,751:751}],767:[function(t,e,n){arguments[4][197][0].apply(n,arguments)},{197:197}],768:[function(t,e,n){arguments[4][198][0].apply(n,arguments)},{198:198,761:761,772:772}],769:[function(t,e,n){arguments[4][199][0].apply(n,arguments)},{199:199}],770:[function(t,e,n){arguments[4][200][0].apply(n,arguments)},{200:200,768:768,769:769,785:785}],771:[function(t,e,n){arguments[4][201][0].apply(n,arguments)},{201:201,777:777,781:781}],772:[function(t,e,n){arguments[4][202][0].apply(n,arguments)},{202:202}],773:[function(t,e,n){arguments[4][203][0].apply(n,arguments)},{203:203}],774:[function(t,e,n){arguments[4][204][0].apply(n,arguments)},{204:204,785:785}],775:[function(t,e,n){arguments[4][205][0].apply(n,arguments)},{205:205,769:769,772:772,780:780,781:781,791:791}],776:[function(t,e,n){function r(t,e){for(var n,r=-1,i=t.length,s=-1,a=[];++r<i;){var o=t[r],u=e?e(o,r,t):o;r&&n===u||(n=u,a[++s]=o)}return a}e.exports=r},{}],777:[function(t,e,n){arguments[4][206][0].apply(n,arguments)},{206:206,785:785}],778:[function(t,e,n){arguments[4][207][0].apply(n,arguments)},{207:207,748:748,781:781}],779:[function(t,e,n){arguments[4][208][0].apply(n,arguments)},{208:208,732:732,750:750,770:770}],780:[function(t,e,n){arguments[4][210][0].apply(n,arguments)},{210:210,768:768,773:773}],781:[function(t,e,n){arguments[4][211][0].apply(n,arguments)},{211:211,763:763,772:772,773:773}],782:[function(t,e,n){arguments[4][213][0].apply(n,arguments)},{213:213,785:785}],783:[function(t,e,n){arguments[4][214][0].apply(n,arguments)},{214:214,773:773,782:782}],784:[function(t,e,n){arguments[4][380][0].apply(n,arguments)},{380:380,773:773}],785:[function(t,e,n){arguments[4][215][0].apply(n,arguments)},{215:215}],786:[function(t,e,n){arguments[4][216][0].apply(n,arguments)},{216:216,736:736,773:773,780:780}],787:[function(t,e,n){arguments[4][217][0].apply(n,arguments)},{217:217,785:785}],788:[function(t,e,n){arguments[4][218][0].apply(n,arguments)},{218:218,773:773}],789:[function(t,e,n){arguments[4][219][0].apply(n,arguments)},{219:219,772:772,773:773}],790:[function(t,e,n){arguments[4][223][0].apply(n,arguments)},{223:223,763:763,768:768,775:775,785:785}],791:[function(t,e,n){arguments[4][224][0].apply(n,arguments)},{224:224,769:769,772:772,780:780,781:781,785:785}],792:[function(t,e,n){arguments[4][226][0].apply(n,arguments)},{226:226,777:777,790:790}],793:[function(t,e,n){arguments[4][230][0].apply(n,arguments)},{230:230}],794:[function(t,e,n){arguments[4][231][0].apply(n,arguments)},{231:231,745:745,746:746,771:771}],795:[function(t,e,n){"use strict";e.exports=function r(t){function e(){}e.prototype=t,new e}},{}],796:[function(t,e,n){"use strict";function r(t,e){return new a["default"](e,t).parse()}var i=t(821)["default"];n.__esModule=!0,n.parse=r;var s=t(800),a=i(s);t(805),t(804),t(802),t(799),t(803),t(801),t(798);var o=t(812);t(810),t(809);var u=t(806),p=i(u),l=t(807),c=i(l);s.plugins.flow=p["default"],s.plugins.jsx=c["default"],n.tokTypes=o.types},{798:798,799:799,800:800,801:801,802:802,803:803,804:804,805:805,806:806,807:807,809:809,810:810,812:812,821:821}],797:[function(t,e,n){"use strict";function r(t){var e={};for(var n in i)e[n]=t&&n in t?t[n]:i[n];return e}n.__esModule=!0,n.getOptions=r;var i={sourceType:"script",allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,plugins:[],strictMode:null};n.defaultOptions=i},{}],798:[function(t,e,n){"use strict";function r(t){return t[t.length-1]}var i=t(821)["default"],s=t(800),a=i(s),o=a["default"].prototype;o.addComment=function(t){this.state.trailingComments.push(t),this.state.leadingComments.push(t)},o.processComment=function(t){if(!("Program"===t.type&&t.body.length>0)){var e=this.state.commentStack,n=void 0,i=void 0,s=void 0;if(this.state.trailingComments.length>0)this.state.trailingComments[0].start>=t.end?(i=this.state.trailingComments,this.state.trailingComments=[]):this.state.trailingComments.length=0;else{var a=r(e);e.length>0&&a.trailingComments&&a.trailingComments[0].start>=t.end&&(i=a.trailingComments,a.trailingComments=null)}for(;e.length>0&&r(e).start>=t.start;)n=e.pop();if(n){if(n.leadingComments)if(n!==t&&r(n.leadingComments).end<=t.start)t.leadingComments=n.leadingComments,n.leadingComments=null;else for(s=n.leadingComments.length-2;s>=0;--s)if(n.leadingComments[s].end<=t.start){t.leadingComments=n.leadingComments.splice(0,s+1);break}}else if(this.state.leadingComments.length>0)if(r(this.state.leadingComments).end<=t.start)t.leadingComments=this.state.leadingComments,this.state.leadingComments=[];else{for(s=0;s<this.state.leadingComments.length&&!(this.state.leadingComments[s].end>t.start);s++);t.leadingComments=this.state.leadingComments.slice(0,s),0===t.leadingComments.length&&(t.leadingComments=null),i=this.state.leadingComments.slice(s),0===i.length&&(i=null)}i&&(i.length&&i[0].start>=t.start&&r(i).end<=t.end?t.innerComments=i:t.trailingComments=i),e.push(t)}}},{800:800,821:821}],799:[function(t,e,n){"use strict";var r=t(817)["default"],i=t(816)["default"],s=t(821)["default"],a=t(812),o=t(800),u=s(o),p=t(813),l=u["default"].prototype;l.checkPropClash=function(t,e){if(!t.computed&&!t.method){var n=t.key,r=void 0;switch(n.type){case"Identifier":r=n.name;break;case"StringLiteral":case"NumericLiteral":r=String(n.value);break;default:return}"__proto__"===r&&"init"===t.kind&&(e.proto&&this.raise(n.start,"Redefinition of __proto__ property"),e.proto=!0)}},l.parseExpression=function(t,e){var n=this.state.start,r=this.state.startLoc,i=this.parseMaybeAssign(t,e);if(this.match(a.types.comma)){var s=this.startNodeAt(n,r);for(s.expressions=[i];this.eat(a.types.comma);)s.expressions.push(this.parseMaybeAssign(t,e));return this.toReferencedList(s.expressions),this.finishNode(s,"SequenceExpression")}return i},l.parseMaybeAssign=function(t,e,n){if(this.match(a.types._yield)&&this.state.inGenerator)return this.parseYield();var r=void 0;e?r=!1:(e={start:0},r=!0);var i=this.state.start,s=this.state.startLoc;(this.match(a.types.parenL)||this.match(a.types.name))&&(this.state.potentialArrowAt=this.state.start);var o=this.parseMaybeConditional(t,e);
if(n&&(o=n.call(this,o,i,s)),this.state.type.isAssign){var u=this.startNodeAt(i,s);if(u.operator=this.state.value,u.left=this.match(a.types.eq)?this.toAssignable(o):o,e.start=0,this.checkLVal(o),o.extra&&o.extra.parenthesized){var p=void 0;"ObjectPattern"===o.type?p="`({a}) = 0` use `({a} = 0)`":"ArrayPattern"===o.type&&(p="`([a]) = 0` use `([a] = 0)`"),p&&this.raise(o.start,"You're trying to assign to a parenthesized expression, eg. instead of "+p)}return this.next(),u.right=this.parseMaybeAssign(t),this.finishNode(u,"AssignmentExpression")}return r&&e.start&&this.unexpected(e.start),o},l.parseMaybeConditional=function(t,e){var n=this.state.start,r=this.state.startLoc,i=this.parseExprOps(t,e);if(e&&e.start)return i;if(this.eat(a.types.question)){var s=this.startNodeAt(n,r);return s.test=i,s.consequent=this.parseMaybeAssign(),this.expect(a.types.colon),s.alternate=this.parseMaybeAssign(t),this.finishNode(s,"ConditionalExpression")}return i},l.parseExprOps=function(t,e){var n=this.state.start,r=this.state.startLoc,i=this.parseMaybeUnary(e);return e&&e.start?i:this.parseExprOp(i,n,r,-1,t)},l.parseExprOp=function(t,e,n,r,i){var s=this.state.type.binop;if(!(null==s||i&&this.match(a.types._in))&&s>r){var o=this.startNodeAt(e,n);o.left=t,o.operator=this.state.value,"**"===o.operator&&"UnaryExpression"===t.type&&t.extra&&!t.extra.parenthesizedArgument&&this.raise(t.argument.start,"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.");var u=this.state.type;this.next();var p=this.state.start,l=this.state.startLoc;return o.right=this.parseExprOp(this.parseMaybeUnary(),p,l,u.rightAssociative?s-1:s,i),this.finishNode(o,u===a.types.logicalOR||u===a.types.logicalAND?"LogicalExpression":"BinaryExpression"),this.parseExprOp(o,e,n,r,i)}return t},l.parseMaybeUnary=function(t){if(this.state.type.prefix){var e=this.startNode(),n=this.match(a.types.incDec);e.operator=this.state.value,e.prefix=!0,this.next();var r=this.state.type;return this.addExtra(e,"parenthesizedArgument",r===a.types.parenL),e.argument=this.parseMaybeUnary(),t&&t.start&&this.unexpected(t.start),n?this.checkLVal(e.argument):this.state.strict&&"delete"===e.operator&&"Identifier"===e.argument.type&&this.raise(e.start,"Deleting local variable in strict mode"),this.finishNode(e,n?"UpdateExpression":"UnaryExpression")}var i=this.state.start,s=this.state.startLoc,o=this.parseExprSubscripts(t);if(t&&t.start)return o;for(;this.state.type.postfix&&!this.canInsertSemicolon();){var e=this.startNodeAt(i,s);e.operator=this.state.value,e.prefix=!1,e.argument=o,this.checkLVal(o),this.next(),o=this.finishNode(e,"UpdateExpression")}return o},l.parseExprSubscripts=function(t){var e=this.state.start,n=this.state.startLoc,r=this.state.potentialArrowAt,i=this.parseExprAtom(t);return"ArrowFunctionExpression"===i.type&&i.start===r?i:t&&t.start?i:this.parseSubscripts(i,e,n)},l.parseSubscripts=function(t,e,n,r){for(;;){if(!r&&this.eat(a.types.doubleColon)){var i=this.startNodeAt(e,n);return i.object=t,i.callee=this.parseNoCallExpr(),this.parseSubscripts(this.finishNode(i,"BindExpression"),e,n,r)}if(this.eat(a.types.dot)){var i=this.startNodeAt(e,n);i.object=t,i.property=this.parseIdentifier(!0),i.computed=!1,t=this.finishNode(i,"MemberExpression")}else if(this.eat(a.types.bracketL)){var i=this.startNodeAt(e,n);i.object=t,i.property=this.parseExpression(),i.computed=!0,this.expect(a.types.bracketR),t=this.finishNode(i,"MemberExpression")}else if(!r&&this.match(a.types.parenL)){var s=this.state.potentialArrowAt===t.start&&"Identifier"===t.type&&"async"===t.name&&!this.canInsertSemicolon();this.next();var i=this.startNodeAt(e,n);if(i.callee=t,i.arguments=this.parseCallExpressionArguments(a.types.parenR,this.hasPlugin("trailingFunctionCommas"),s),t=this.finishNode(i,"CallExpression"),s&&this.shouldParseAsyncArrow())return this.parseAsyncArrowFromCallExpression(this.startNodeAt(e,n),i);this.toReferencedList(i.arguments)}else{if(!this.match(a.types.backQuote))return t;var i=this.startNodeAt(e,n);i.tag=t,i.quasi=this.parseTemplate(),t=this.finishNode(i,"TaggedTemplateExpression")}}},l.parseCallExpressionArguments=function(t,e,n){for(var r=void 0,i=[],s=!0;!this.eat(t);){if(s)s=!1;else if(this.expect(a.types.comma),e&&this.eat(t))break;this.match(a.types.parenL)&&!r&&(r=this.state.start),i.push(this.parseExprListItem())}return n&&r&&this.shouldParseAsyncArrow()&&this.unexpected(),i},l.shouldParseAsyncArrow=function(){return this.match(a.types.arrow)},l.parseAsyncArrowFromCallExpression=function(t,e){return this.hasPlugin("asyncFunctions")||this.unexpected(),this.expect(a.types.arrow),this.parseArrowExpression(t,e.arguments,!0)},l.parseNoCallExpr=function(){var t=this.state.start,e=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),t,e,!0)},l.parseExprAtom=function(t){var e=void 0,n=this.state.potentialArrowAt===this.state.start;switch(this.state.type){case a.types._super:return this.state.inMethod||this.options.allowSuperOutsideMethod||this.raise(this.state.start,"'super' outside of function or class"),e=this.startNode(),this.next(),this.match(a.types.parenL)||this.match(a.types.bracketL)||this.match(a.types.dot)||this.unexpected(),this.match(a.types.parenL)&&"constructor"!==this.state.inMethod&&!this.options.allowSuperOutsideMethod&&this.raise(e.start,"super() outside of class constructor"),this.finishNode(e,"Super");case a.types._this:return e=this.startNode(),this.next(),this.finishNode(e,"ThisExpression");case a.types._yield:this.state.inGenerator&&this.unexpected();case a.types.name:e=this.startNode();var r=this.hasPlugin("asyncFunctions")&&"await"===this.state.value&&this.state.inAsync,i=this.shouldAllowYieldIdentifier(),s=this.parseIdentifier(r||i);if(this.hasPlugin("asyncFunctions"))if("await"===s.name){if(this.state.inAsync||this.inModule)return this.parseAwait(e)}else{if("async"===s.name&&this.match(a.types._function)&&!this.canInsertSemicolon())return this.next(),this.parseFunction(e,!1,!1,!0);if(n&&"async"===s.name&&this.match(a.types.name)){var o=[this.parseIdentifier()];return this.expect(a.types.arrow),this.parseArrowExpression(e,o,!0)}}return n&&!this.canInsertSemicolon()&&this.eat(a.types.arrow)?this.parseArrowExpression(e,[s]):s;case a.types._do:if(this.hasPlugin("doExpressions")){var u=this.startNode();this.next();var p=this.state.inFunction,l=this.state.labels;return this.state.labels=[],this.state.inFunction=!1,u.body=this.parseBlock(!1,!0),this.state.inFunction=p,this.state.labels=l,this.finishNode(u,"DoExpression")}case a.types.regexp:var c=this.state.value;return e=this.parseLiteral(c.value,"RegExpLiteral"),e.pattern=c.pattern,e.flags=c.flags,e;case a.types.num:return this.parseLiteral(this.state.value,"NumericLiteral");case a.types.string:return this.parseLiteral(this.state.value,"StringLiteral");case a.types._null:return e=this.startNode(),this.next(),this.finishNode(e,"NullLiteral");case a.types._true:case a.types._false:return e=this.startNode(),e.value=this.match(a.types._true),this.next(),this.finishNode(e,"BooleanLiteral");case a.types.parenL:return this.parseParenAndDistinguishExpression(null,null,n);case a.types.bracketL:return e=this.startNode(),this.next(),e.elements=this.parseExprList(a.types.bracketR,!0,!0,t),this.toReferencedList(e.elements),this.finishNode(e,"ArrayExpression");case a.types.braceL:return this.parseObj(!1,t);case a.types._function:return e=this.startNode(),this.next(),this.parseFunction(e,!1);case a.types.at:this.parseDecorators();case a.types._class:return e=this.startNode(),this.takeDecorators(e),this.parseClass(e,!1);case a.types._new:return this.parseNew();case a.types.backQuote:return this.parseTemplate();case a.types.doubleColon:e=this.startNode(),this.next(),e.object=null;var f=e.callee=this.parseNoCallExpr();if("MemberExpression"===f.type)return this.finishNode(e,"BindExpression");this.raise(f.start,"Binding should be performed on object property.");default:this.unexpected()}},l.parseLiteral=function(t,e){var n=this.startNode();return this.addExtra(n,"rawValue",t),this.addExtra(n,"raw",this.input.slice(this.state.start,this.state.end)),n.value=t,this.next(),this.finishNode(n,e)},l.parseParenExpression=function(){this.expect(a.types.parenL);var t=this.parseExpression();return this.expect(a.types.parenR),t},l.parseParenAndDistinguishExpression=function(t,e,n,r){t=t||this.state.start,e=e||this.state.startLoc;var i=void 0;this.next();for(var s=this.state.start,o=this.state.startLoc,u=[],p=!0,l={start:0},c=void 0,f=void 0;!this.match(a.types.parenR);){if(p)p=!1;else if(this.expect(a.types.comma),this.match(a.types.parenR)&&this.hasPlugin("trailingFunctionCommas")){f=this.state.start;break}if(this.match(a.types.ellipsis)){var h=this.state.start,d=this.state.startLoc;c=this.state.start,u.push(this.parseParenItem(this.parseRest(),d,h));break}u.push(this.parseMaybeAssign(!1,l,this.parseParenItem))}var m=this.state.start,y=this.state.startLoc;if(this.expect(a.types.parenR),n&&!this.canInsertSemicolon()&&this.eat(a.types.arrow)){for(var g=0;g<u.length;g++){var v=u[g];v.extra&&v.extra.parenthesized&&this.unexpected(v.extra.parenStart)}return this.parseArrowExpression(this.startNodeAt(t,e),u,r)}if(!u.length){if(r)return;this.unexpected(this.state.lastTokStart)}return f&&this.unexpected(f),c&&this.unexpected(c),l.start&&this.unexpected(l.start),u.length>1?(i=this.startNodeAt(s,o),i.expressions=u,this.toReferencedList(i.expressions),this.finishNodeAt(i,"SequenceExpression",m,y)):i=u[0],this.addExtra(i,"parenthesized",!0),this.addExtra(i,"parenStart",t),i},l.parseParenItem=function(t){return t},l.parseNew=function(){var t=this.startNode(),e=this.parseIdentifier(!0);return this.eat(a.types.dot)?(t.meta=e,t.property=this.parseIdentifier(!0),"target"!==t.property.name&&this.raise(t.property.start,"The only valid meta property for new is new.target"),this.finishNode(t,"MetaProperty")):(t.callee=this.parseNoCallExpr(),this.eat(a.types.parenL)?(t.arguments=this.parseExprList(a.types.parenR,this.hasPlugin("trailingFunctionCommas")),this.toReferencedList(t.arguments)):t.arguments=[],this.finishNode(t,"NewExpression"))},l.parseTemplateElement=function(){var t=this.startNode();return t.value={raw:this.input.slice(this.state.start,this.state.end).replace(/\r\n?/g,"\n"),cooked:this.state.value},this.next(),t.tail=this.match(a.types.backQuote),this.finishNode(t,"TemplateElement")},l.parseTemplate=function(){var t=this.startNode();this.next(),t.expressions=[];var e=this.parseTemplateElement();for(t.quasis=[e];!e.tail;)this.expect(a.types.dollarBraceL),t.expressions.push(this.parseExpression()),this.expect(a.types.braceR),t.quasis.push(e=this.parseTemplateElement());return this.next(),this.finishNode(t,"TemplateLiteral")},l.parseObj=function(t,e){var n=[],i=r(null),s=!0,o=this.startNode();for(o.properties=[],this.next();!this.eat(a.types.braceR);){if(s)s=!1;else if(this.expect(a.types.comma),this.eat(a.types.braceR))break;for(;this.match(a.types.at);)n.push(this.parseDecorator());var u=this.startNode(),p=!1,l=!1,c=void 0,f=void 0;if(n.length&&(u.decorators=n,n=[]),this.hasPlugin("objectRestSpread")&&this.match(a.types.ellipsis))u=this.parseSpread(),u.type=t?"RestProperty":"SpreadProperty",o.properties.push(u);else{if(u.method=!1,u.shorthand=!1,(t||e)&&(c=this.state.start,f=this.state.startLoc),t||(p=this.eat(a.types.star)),!t&&this.hasPlugin("asyncFunctions")&&this.isContextual("async")){p&&this.unexpected();var h=this.parseIdentifier();this.match(a.types.colon)||this.match(a.types.parenL)||this.match(a.types.braceR)?u.key=h:(l=!0,this.hasPlugin("asyncGenerators")&&(p=this.eat(a.types.star)),this.parsePropertyName(u))}else this.parsePropertyName(u);this.parseObjPropValue(u,c,f,p,l,t,e),this.checkPropClash(u,i),u.shorthand&&this.addExtra(u,"shorthand",!0),o.properties.push(u)}}return n.length&&this.raise(this.state.start,"You have trailing decorators with no property"),this.finishNode(o,t?"ObjectPattern":"ObjectExpression")},l.parseObjPropValue=function(t,e,n,r,i,s,o){if(i||r||this.match(a.types.parenL))return s&&this.unexpected(),t.kind="method",t.method=!0,this.parseMethod(t,r,i),this.finishNode(t,"ObjectMethod");if(this.eat(a.types.colon))return t.value=s?this.parseMaybeDefault(this.state.start,this.state.startLoc):this.parseMaybeAssign(!1,o),this.finishNode(t,"ObjectProperty");if(!(t.computed||"Identifier"!==t.key.type||"get"!==t.key.name&&"set"!==t.key.name||this.match(a.types.comma)||this.match(a.types.braceR))){(r||i||s)&&this.unexpected(),t.kind=t.key.name,this.parsePropertyName(t),this.parseMethod(t,!1);var u="get"===t.kind?0:1;if(t.params.length!==u){var l=t.start;"get"===t.kind?this.raise(l,"getter should have no params"):this.raise(l,"setter should have exactly one param")}return this.finishNode(t,"ObjectMethod")}if(!t.computed&&"Identifier"===t.key.type){if(s){var c=this.isKeyword(t.key.name);!c&&this.state.strict&&(c=p.reservedWords.strictBind(t.key.name)||p.reservedWords.strict(t.key.name)),c&&this.raise(t.key.start,"Binding "+t.key.name),t.value=this.parseMaybeDefault(e,n,t.key.__clone())}else this.match(a.types.eq)&&o?(o.start||(o.start=this.state.start),t.value=this.parseMaybeDefault(e,n,t.key.__clone())):t.value=t.key.__clone();return t.shorthand=!0,this.finishNode(t,"ObjectProperty")}this.unexpected()},l.parsePropertyName=function(t){return this.eat(a.types.bracketL)?(t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(a.types.bracketR),t.key):(t.computed=!1,t.key=this.match(a.types.num)||this.match(a.types.string)?this.parseExprAtom():this.parseIdentifier(!0))},l.initFunction=function(t,e){t.id=null,t.generator=!1,t.expression=!1,this.hasPlugin("asyncFunctions")&&(t.async=!!e)},l.parseMethod=function(t,e,n){var r=this.state.inMethod;return this.state.inMethod=t.kind||!0,this.initFunction(t,n),this.expect(a.types.parenL),t.params=this.parseBindingList(a.types.parenR,!1,this.hasPlugin("trailingFunctionCommas")),t.generator=e,this.parseFunctionBody(t),this.state.inMethod=r,t},l.parseArrowExpression=function(t,e,n){return this.initFunction(t,n),t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0),this.finishNode(t,"ArrowFunctionExpression")},l.parseFunctionBody=function(t,e){var n=e&&!this.match(a.types.braceL),s=this.state.inAsync;if(this.state.inAsync=t.async,n)t.body=this.parseMaybeAssign(),t.expression=!0;else{var o=this.state.inFunction,u=this.state.inGenerator,p=this.state.labels;this.state.inFunction=!0,this.state.inGenerator=t.generator,this.state.labels=[],t.body=this.parseBlock(!0),t.expression=!1,this.state.inFunction=o,this.state.inGenerator=u,this.state.labels=p}this.state.inAsync=s;var l=this.state.strict,c=!1,f=!1;if(e&&(l=!0),!n&&t.body.directives.length)for(var h=t.body.directives,d=Array.isArray(h),m=0,h=d?h:i(h);;){var y;if(d){if(m>=h.length)break;y=h[m++]}else{if(m=h.next(),m.done)break;y=m.value}var g=y;if("use strict"===g.value.value){f=!0,l=!0,c=!0;break}}if(f&&t.id&&"Identifier"===t.id.type&&"yield"===t.id.name&&this.raise(t.id.start,"Binding yield in strict mode"),l){var v=r(null),A=this.state.strict;c&&(this.state.strict=!0),t.id&&this.checkLVal(t.id,!0);for(var E=t.params,b=Array.isArray(E),x=0,E=b?E:i(E);;){var D;if(b){if(x>=E.length)break;D=E[x++]}else{if(x=E.next(),x.done)break;D=x.value}var C=D;this.checkLVal(C,!0,v)}this.state.strict=A}},l.parseExprList=function(t,e,n,r){for(var i=[],s=!0;!this.eat(t);){if(s)s=!1;else if(this.expect(a.types.comma),e&&this.eat(t))break;i.push(this.parseExprListItem(n,r))}return i},l.parseExprListItem=function(t,e){var n=void 0;return n=t&&this.match(a.types.comma)?null:this.match(a.types.ellipsis)?this.parseSpread(e):this.parseMaybeAssign(!1,e)},l.parseIdentifier=function(t){var e=this.startNode();return this.match(a.types.name)?(!t&&this.state.strict&&p.reservedWords.strict(this.state.value)&&this.raise(this.state.start,"The keyword '"+this.state.value+"' is reserved"),e.name=this.state.value):t&&this.state.type.keyword?e.name=this.state.type.keyword:this.unexpected(),!t&&"await"===e.name&&this.state.inAsync&&this.raise(e.start,"invalid use of await inside of an async function"),this.next(),this.finishNode(e,"Identifier")},l.parseAwait=function(t){return this.state.inAsync||this.unexpected(),this.isLineTerminator()&&this.unexpected(),t.all=this.eat(a.types.star),t.argument=this.parseMaybeUnary(),this.finishNode(t,"AwaitExpression")},l.parseYield=function(){var t=this.startNode();return this.next(),this.match(a.types.semi)||this.canInsertSemicolon()||!this.match(a.types.star)&&!this.state.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(a.types.star),t.argument=this.parseMaybeAssign()),this.finishNode(t,"YieldExpression")}},{800:800,812:812,813:813,816:816,817:817,821:821}],800:[function(t,e,n){"use strict";var r=t(820)["default"],i=t(819)["default"],s=t(816)["default"],a=t(821)["default"];n.__esModule=!0;var o=t(813),u=t(797),p=t(810),l=a(p),c={};n.plugins=c;var f=function(t){function e(n,r){i(this,e),n=u.getOptions(n),t.call(this,n,r),this.options=n,this.inModule="module"===this.options.sourceType,this.isReservedWord=o.reservedWords[6],this.input=r,this.plugins=this.loadPlugins(this.options.plugins),0===this.state.pos&&"#"===this.input[0]&&"!"===this.input[1]&&this.skipLineComment(2)}return r(e,t),e.prototype.hasPlugin=function(t){return!(!this.plugins["*"]&&!this.plugins[t])},e.prototype.extend=function(t,e){this[t]=e(this[t])},e.prototype.loadPlugins=function(t){var e={};t.indexOf("flow")>=0&&(t.splice(t.indexOf("flow"),1),t.push("flow"));for(var r=t,i=Array.isArray(r),a=0,r=i?r:s(r);;){var o;if(i){if(a>=r.length)break;o=r[a++]}else{if(a=r.next(),a.done)break;o=a.value}var u=o;e[u]=!0;var p=n.plugins[u];p&&p(this)}return e},e.prototype.parse=function(){var t=this.startNode(),e=this.startNode();return this.nextToken(),this.parseTopLevel(t,e)},e}(l["default"]);n["default"]=f},{797:797,810:810,813:813,816:816,819:819,820:820,821:821}],801:[function(t,e,n){"use strict";var r=t(821)["default"],i=t(814),s=t(800),a=r(s),o=a["default"].prototype;o.raise=function(t,e){var n=i.getLineInfo(this.input,t);e+=" ("+n.line+":"+n.column+")";var r=new SyntaxError(e);throw r.pos=t,r.loc=n,r}},{800:800,814:814,821:821}],802:[function(t,e,n){"use strict";var r=t(816)["default"],i=t(821)["default"],s=t(812),a=t(800),o=i(a),u=t(813),p=o["default"].prototype;p.toAssignable=function(t,e){if(t)switch(t.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":break;case"ObjectExpression":t.type="ObjectPattern";for(var n=t.properties,i=Array.isArray(n),s=0,n=i?n:r(n);;){var a;if(i){if(s>=n.length)break;a=n[s++]}else{if(s=n.next(),s.done)break;a=s.value}var o=a;"ObjectMethod"===o.type?"get"===o.kind||"set"===o.kind?this.raise(o.key.start,"Object pattern can't contain getter or setter"):this.raise(o.key.start,"Object pattern can't contain methods"):this.toAssignable(o,e)}break;case"ObjectProperty":this.toAssignable(t.value,e);break;case"SpreadProperty":t.type="RestProperty";break;case"ArrayExpression":t.type="ArrayPattern",this.toAssignableList(t.elements,e);break;case"AssignmentExpression":"="===t.operator?(t.type="AssignmentPattern",delete t.operator):this.raise(t.left.end,"Only '=' operator can be used for specifying default value.");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}return t},p.toAssignableList=function(t,e){var n=t.length;if(n){var r=t[n-1];if(r&&"RestElement"===r.type)--n;else if(r&&"SpreadElement"===r.type){r.type="RestElement";var i=r.argument;this.toAssignable(i,e),"Identifier"!==i.type&&"MemberExpression"!==i.type&&"ArrayPattern"!==i.type&&this.unexpected(i.start),--n}}for(var s=0;n>s;s++){var a=t[s];a&&this.toAssignable(a,e)}return t},p.toReferencedList=function(t){return t},p.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(t),this.finishNode(e,"SpreadElement")},p.parseRest=function(){var t=this.startNode();return this.next(),t.argument=this.parseBindingIdentifier(),this.finishNode(t,"RestElement")},p.shouldAllowYieldIdentifier=function(){return this.match(s.types._yield)&&!this.state.strict&&!this.state.inGenerator},p.parseBindingIdentifier=function(){return this.parseIdentifier(this.shouldAllowYieldIdentifier())},p.parseBindingAtom=function(){switch(this.state.type){case s.types._yield:(this.state.strict||this.state.inGenerator)&&this.unexpected();case s.types.name:return this.parseIdentifier(!0);case s.types.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(s.types.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case s.types.braceL:return this.parseObj(!0);default:this.unexpected()}},p.parseBindingList=function(t,e,n){for(var r=[],i=!0;!this.eat(t);)if(i?i=!1:this.expect(s.types.comma),e&&this.match(s.types.comma))r.push(null);else{if(n&&this.eat(t))break;if(this.match(s.types.ellipsis)){r.push(this.parseAssignableListItemTypes(this.parseRest())),this.expect(t);break}var a=this.parseMaybeDefault();this.parseAssignableListItemTypes(a),r.push(this.parseMaybeDefault(null,null,a))}return r},p.parseAssignableListItemTypes=function(t){return t},p.parseMaybeDefault=function(t,e,n){if(e=e||this.state.startLoc,t=t||this.state.start,n=n||this.parseBindingAtom(),!this.eat(s.types.eq))return n;var r=this.startNodeAt(t,e);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")},p.checkLVal=function(t,e,n){switch(t.type){case"Identifier":if(this.state.strict&&(u.reservedWords.strictBind(t.name)||u.reservedWords.strict(t.name))&&this.raise(t.start,(e?"Binding ":"Assigning to ")+t.name+" in strict mode"),n){var i="_"+t.name;n[i]?this.raise(t.start,"Argument name clash in strict mode"):n[i]=!0}break;case"MemberExpression":e&&this.raise(t.start,(e?"Binding":"Assigning to")+" member expression");break;case"ObjectPattern":for(var s=t.properties,a=Array.isArray(s),o=0,s=a?s:r(s);;){var p;if(a){if(o>=s.length)break;p=s[o++]}else{if(o=s.next(),o.done)break;p=o.value}var l=p;"ObjectProperty"===l.type&&(l=l.value),this.checkLVal(l,e,n)}break;case"ArrayPattern":for(var c=t.elements,f=Array.isArray(c),h=0,c=f?c:r(c);;){var d;if(f){if(h>=c.length)break;d=c[h++]}else{if(h=c.next(),h.done)break;d=h.value}var m=d;m&&this.checkLVal(m,e,n)}break;case"AssignmentPattern":this.checkLVal(t.left,e,n);break;case"RestProperty":case"RestElement":this.checkLVal(t.argument,e,n);break;default:this.raise(t.start,(e?"Binding":"Assigning to")+" rvalue")}}},{800:800,812:812,813:813,816:816,821:821}],803:[function(t,e,n){"use strict";function r(t,e,n,r){return t.type=e,t.end=n,t.loc.end=r,this.processComment(t),t}var i=t(819)["default"],s=t(821)["default"],a=t(800),o=s(a),u=t(814),p=o["default"].prototype,l=function(){function t(e,n){i(this,t),this.type="",this.start=e,this.end=0,this.loc=new u.SourceLocation(n)}return t.prototype.__clone=function(){var e=new t;for(var n in this)e[n]=this[n];return e},t}();p.startNode=function(){return new l(this.state.start,this.state.startLoc)},p.startNodeAt=function(t,e){return new l(t,e)},p.finishNode=function(t,e){return r.call(this,t,e,this.state.lastTokEnd,this.state.lastTokEndLoc)},p.finishNodeAt=function(t,e,n,i){return r.call(this,t,e,n,i)}},{800:800,814:814,819:819,821:821}],804:[function(t,e,n){"use strict";var r=t(817)["default"],i=t(816)["default"],s=t(821)["default"],a=t(812),o=t(800),u=s(o),p=t(815),l=u["default"].prototype;l.parseTopLevel=function(t,e){return e.sourceType=this.options.sourceType,this.parseBlockBody(e,!0,!0,a.types.eof),t.program=this.finishNode(e,"Program"),t.comments=this.state.comments,t.tokens=this.state.tokens,this.finishNode(t,"File")};var c={kind:"loop"},f={kind:"switch"};l.parseDirective=function(){var t=this.startNode(),e=this.startNode(),n=this.input.slice(this.state.start,this.state.end),r=t.value=n.slice(1,-1);return this.addExtra(t,"raw",n),this.addExtra(t,"rawValue",r),this.next(),e.value=this.finishNode(t,"DirectiveLiteral"),this.semicolon(),this.finishNode(e,"Directive")},l.parseStatement=function(t,e){this.match(a.types.at)&&this.parseDecorators(!0);var n=this.state.type,r=this.startNode();switch(n){case a.types._break:case a.types._continue:return this.parseBreakContinueStatement(r,n.keyword);case a.types._debugger:return this.parseDebuggerStatement(r);case a.types._do:return this.parseDoStatement(r);case a.types._for:return this.parseForStatement(r);case a.types._function:return t||this.unexpected(),this.parseFunctionStatement(r);case a.types._class:return t||this.unexpected(),this.takeDecorators(r),this.parseClass(r,!0);case a.types._if:return this.parseIfStatement(r);case a.types._return:return this.parseReturnStatement(r);case a.types._switch:return this.parseSwitchStatement(r);case a.types._throw:return this.parseThrowStatement(r);case a.types._try:return this.parseTryStatement(r);case a.types._let:case a.types._const:t||this.unexpected();case a.types._var:return this.parseVarStatement(r,n);case a.types._while:return this.parseWhileStatement(r);case a.types._with:return this.parseWithStatement(r);case a.types.braceL:return this.parseBlock();case a.types.semi:return this.parseEmptyStatement(r);case a.types._export:case a.types._import:return this.options.allowImportExportEverywhere||(e||this.raise(this.state.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.state.start,"'import' and 'export' may appear only with 'sourceType: module'")),n===a.types._import?this.parseImport(r):this.parseExport(r);case a.types.name:if(this.hasPlugin("asyncFunctions")&&"async"===this.state.value){var i=this.state.clone();if(this.next(),this.match(a.types._function)&&!this.canInsertSemicolon())return this.expect(a.types._function),this.parseFunction(r,!0,!1,!0);this.state=i}}var s=this.state.value,o=this.parseExpression();return n===a.types.name&&"Identifier"===o.type&&this.eat(a.types.colon)?this.parseLabeledStatement(r,s,o):this.parseExpressionStatement(r,o)},l.takeDecorators=function(t){this.state.decorators.length&&(t.decorators=this.state.decorators,this.state.decorators=[])},l.parseDecorators=function(t){for(;this.match(a.types.at);)this.state.decorators.push(this.parseDecorator());t&&this.match(a.types._export)||this.match(a.types._class)||this.raise(this.state.start,"Leading decorators must be attached to a class declaration")},l.parseDecorator=function(){this.hasPlugin("decorators")||this.unexpected();var t=this.startNode();return this.next(),t.expression=this.parseMaybeAssign(),this.finishNode(t,"Decorator")},l.parseBreakContinueStatement=function(t,e){var n="break"===e;this.next(),this.isLineTerminator()?t.label=null:this.match(a.types.name)?(t.label=this.parseIdentifier(),this.semicolon()):this.unexpected();var r=void 0;for(r=0;r<this.state.labels.length;++r){var i=this.state.labels[r];if(null==t.label||i.name===t.label.name){if(null!=i.kind&&(n||"loop"===i.kind))break;if(t.label&&n)break}}return r===this.state.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,n?"BreakStatement":"ContinueStatement")},l.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")},l.parseDoStatement=function(t){return this.next(),this.state.labels.push(c),t.body=this.parseStatement(!1),this.state.labels.pop(),this.expect(a.types._while),t.test=this.parseParenExpression(),this.eat(a.types.semi),this.finishNode(t,"DoWhileStatement")},l.parseForStatement=function(t){if(this.next(),this.state.labels.push(c),this.expect(a.types.parenL),this.match(a.types.semi))return this.parseFor(t,null);if(this.match(a.types._var)||this.match(a.types._let)||this.match(a.types._const)){var e=this.startNode(),n=this.state.type;return this.next(),this.parseVar(e,!0,n),this.finishNode(e,"VariableDeclaration"),!this.match(a.types._in)&&!this.isContextual("of")||1!==e.declarations.length||e.declarations[0].init?this.parseFor(t,e):this.parseForIn(t,e)}var r={start:0},i=this.parseExpression(!0,r);return this.match(a.types._in)||this.isContextual("of")?(this.toAssignable(i),this.checkLVal(i),this.parseForIn(t,i)):(r.start&&this.unexpected(r.start),this.parseFor(t,i))},l.parseFunctionStatement=function(t){return this.next(),this.parseFunction(t,!0)},l.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement(!1),t.alternate=this.eat(a.types._else)?this.parseStatement(!1):null,this.finishNode(t,"IfStatement")},l.parseReturnStatement=function(t){return this.state.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.state.start,"'return' outside of function"),this.next(),this.isLineTerminator()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")},l.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(a.types.braceL),this.state.labels.push(f);for(var e=void 0,n=void 0;!this.match(a.types.braceR);)if(this.match(a.types._case)||this.match(a.types._default)){var r=this.match(a.types._case);e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),r?e.test=this.parseExpression():(n&&this.raise(this.state.lastTokStart,"Multiple default clauses"),n=!0,e.test=null),this.expect(a.types.colon)}else e?e.consequent.push(this.parseStatement(!0)):this.unexpected();return e&&this.finishNode(e,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(t,"SwitchStatement")},l.parseThrowStatement=function(t){return this.next(),p.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.start))&&this.raise(this.state.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var h=[];l.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.match(a.types._catch)){var e=this.startNode();this.next(),this.expect(a.types.parenL),e.param=this.parseBindingAtom(),this.checkLVal(e.param,!0,r(null)),this.expect(a.types.parenR),e.body=this.parseBlock(),t.handler=this.finishNode(e,"CatchClause")}return t.guardedHandlers=h,t.finalizer=this.eat(a.types._finally)?this.parseBlock():null,t.handler||t.finalizer||this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")},l.parseVarStatement=function(t,e){return this.next(),this.parseVar(t,!1,e),this.semicolon(),this.finishNode(t,"VariableDeclaration")},l.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.state.labels.push(c),t.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(t,"WhileStatement")},l.parseWithStatement=function(t){return this.state.strict&&this.raise(this.state.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement(!1),this.finishNode(t,"WithStatement")},l.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")},l.parseLabeledStatement=function(t,e,n){for(var r=this.state.labels,s=Array.isArray(r),o=0,r=s?r:i(r);;){var u;if(s){if(o>=r.length)break;u=r[o++]}else{if(o=r.next(),o.done)break;u=o.value}var p=u;p.name===e&&this.raise(n.start,"Label '"+e+"' is already declared")}for(var l=this.state.type.isLoop?"loop":this.match(a.types._switch)?"switch":null,c=this.state.labels.length-1;c>=0;c--){var p=this.state.labels[c];if(p.statementStart!==t.start)break;p.statementStart=this.state.start,p.kind=l}return this.state.labels.push({name:e,kind:l,statementStart:this.state.start}),t.body=this.parseStatement(!0),this.state.labels.pop(),t.label=n,this.finishNode(t,"LabeledStatement")},l.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")},l.parseBlock=function(t){var e=this.startNode();return this.expect(a.types.braceL),this.parseBlockBody(e,t,!1,a.types.braceR),this.finishNode(e,"BlockStatement")},l.parseBlockBody=function(t,e,n,r){t.body=[],t.directives=[];for(var i=!1,s=void 0,o=void 0;!this.eat(r);){
if(e&&!i&&this.match(a.types.string)){var u=this.state,p=this.lookahead();this.state=p;var l=this.isLineTerminator();if(this.state=u,l){this.state.containsOctal&&!o&&(o=this.state.octalPosition);var c=this.parseDirective();t.directives.push(c),e&&"use strict"===c.value.value&&(s=this.state.strict,this.state.strict=!0,this.setStrict(!0),o&&this.raise(o,"Octal literal in strict mode"));continue}}i=!0,t.body.push(this.parseStatement(!0,n))}s===!1&&this.setStrict(!1)},l.parseFor=function(t,e){return t.init=e,this.expect(a.types.semi),t.test=this.match(a.types.semi)?null:this.parseExpression(),this.expect(a.types.semi),t.update=this.match(a.types.parenR)?null:this.parseExpression(),this.expect(a.types.parenR),t.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(t,"ForStatement")},l.parseForIn=function(t,e){var n=this.match(a.types._in)?"ForInStatement":"ForOfStatement";return this.next(),t.left=e,t.right=this.parseExpression(),this.expect(a.types.parenR),t.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(t,n)},l.parseVar=function(t,e,n){for(t.declarations=[],t.kind=n.keyword;;){var r=this.startNode();if(this.parseVarHead(r),this.eat(a.types.eq)?r.init=this.parseMaybeAssign(e):n!==a.types._const||this.match(a.types._in)||this.isContextual("of")?"Identifier"===r.id.type||e&&(this.match(a.types._in)||this.isContextual("of"))?r.init=null:this.raise(this.state.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),t.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(a.types.comma))break}return t},l.parseVarHead=function(t){t.id=this.parseBindingAtom(),this.checkLVal(t.id,!0)},l.parseFunction=function(t,e,n,r,i){var s=this.state.inMethod;return this.state.inMethod=!1,this.initFunction(t,r),this.match(a.types.star)&&(t.async&&!this.hasPlugin("asyncGenerators")?this.unexpected():(t.generator=!0,this.next())),!e||i||this.match(a.types.name)||this.match(a.types._yield)||this.unexpected(),(this.match(a.types.name)||this.match(a.types._yield))&&(t.id=this.parseBindingIdentifier()),this.parseFunctionParams(t),this.parseFunctionBody(t,n),this.state.inMethod=s,this.finishNode(t,e?"FunctionDeclaration":"FunctionExpression")},l.parseFunctionParams=function(t){this.expect(a.types.parenL),t.params=this.parseBindingList(a.types.parenR,!1,this.hasPlugin("trailingFunctionCommas"))},l.parseClass=function(t,e,n){return this.next(),this.parseClassId(t,e,n),this.parseClassSuper(t),this.parseClassBody(t),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")},l.isClassProperty=function(){return this.match(a.types.eq)||this.isLineTerminator()},l.parseClassBody=function(t){var e=this.state.strict;this.state.strict=!0;var n=!1,r=!1,i=[],s=this.startNode();for(s.body=[],this.expect(a.types.braceL);!this.eat(a.types.braceR);)if(!this.eat(a.types.semi))if(this.match(a.types.at))i.push(this.parseDecorator());else{var o=this.startNode();i.length&&(o.decorators=i,i=[]);var u=!1,p=this.match(a.types.name)&&"static"===this.state.value,l=this.eat(a.types.star),c=!1,f=!1;if(this.parsePropertyName(o),o["static"]=p&&!this.match(a.types.parenL),o["static"]&&(l&&this.unexpected(),l=this.eat(a.types.star),this.parsePropertyName(o)),!l&&"Identifier"===o.key.type&&!o.computed){if(this.isClassProperty()){s.body.push(this.parseClassProperty(o));continue}this.hasPlugin("classConstructorCall")&&"call"===o.key.name&&this.match(a.types.name)&&"constructor"===this.state.value&&(u=!0,this.parsePropertyName(o))}var h=this.hasPlugin("asyncFunctions")&&!this.match(a.types.parenL)&&!o.computed&&"Identifier"===o.key.type&&"async"===o.key.name;if(h&&(this.hasPlugin("asyncGenerators")&&this.eat(a.types.star)&&(l=!0),f=!0,this.parsePropertyName(o)),o.kind="method",!o.computed){var d=o.key;f||l||"Identifier"!==d.type||this.match(a.types.parenL)||"get"!==d.name&&"set"!==d.name||(c=!0,o.kind=d.name,d=this.parsePropertyName(o));var m=!u&&!o["static"]&&("Identifier"===d.type&&"constructor"===d.name||"StringLiteral"===d.type&&"constructor"===d.value);m&&(r&&this.raise(d.start,"Duplicate constructor in the same class"),c&&this.raise(d.start,"Constructor can't have get/set modifier"),l&&this.raise(d.start,"Constructor can't be a generator"),f&&this.raise(d.start,"Constructor can't be an async function"),o.kind="constructor",r=!0);var y=o["static"]&&("Identifier"===d.type&&"prototype"===d.name||"StringLiteral"===d.type&&"prototype"===d.value);y&&this.raise(d.start,"Classes may not have static property named prototype")}if(u&&(n&&this.raise(o.start,"Duplicate constructor call in the same class"),o.kind="constructorCall",n=!0),"constructor"!==o.kind&&"constructorCall"!==o.kind||!o.decorators||this.raise(o.start,"You can't attach decorators to a class constructor"),this.parseClassMethod(s,o,l,f),c){var g="get"===o.kind?0:1;if(o.params.length!==g){var v=o.start;"get"===o.kind?this.raise(v,"getter should have no params"):this.raise(v,"setter should have exactly one param")}}}i.length&&this.raise(this.state.start,"You have trailing decorators with no method"),t.body=this.finishNode(s,"ClassBody"),this.state.strict=e},l.parseClassProperty=function(t){return this.match(a.types.eq)?(this.hasPlugin("classProperties")||this.unexpected(),this.next(),t.value=this.parseMaybeAssign()):t.value=null,this.semicolon(),this.finishNode(t,"ClassProperty")},l.parseClassMethod=function(t,e,n,r){this.parseMethod(e,n,r),t.body.push(this.finishNode(e,"ClassMethod"))},l.parseClassId=function(t,e,n){this.match(a.types.name)?t.id=this.parseIdentifier():n||!e?t.id=null:this.unexpected()},l.parseClassSuper=function(t){t.superClass=this.eat(a.types._extends)?this.parseExprSubscripts():null},l.parseExport=function(t){if(this.next(),this.match(a.types.star)){var e=this.startNode();if(this.next(),!this.hasPlugin("exportExtensions")||!this.eatContextual("as"))return this.parseExportFrom(t,!0),this.finishNode(t,"ExportAllDeclaration");e.exported=this.parseIdentifier(),t.specifiers=[this.finishNode(e,"ExportNamespaceSpecifier")],this.parseExportSpecifiersMaybe(t),this.parseExportFrom(t,!0)}else if(this.hasPlugin("exportExtensions")&&this.isExportDefaultSpecifier()){var e=this.startNode();if(e.exported=this.parseIdentifier(!0),t.specifiers=[this.finishNode(e,"ExportDefaultSpecifier")],this.match(a.types.comma)&&this.lookahead().type===a.types.star){this.expect(a.types.comma);var n=this.startNode();this.expect(a.types.star),this.expectContextual("as"),n.exported=this.parseIdentifier(),t.specifiers.push(this.finishNode(n,"ExportNamespaceSpecifier"))}else this.parseExportSpecifiersMaybe(t);this.parseExportFrom(t,!0)}else{if(this.eat(a.types._default)){var r=this.startNode(),i=!1;return this.eat(a.types._function)?r=this.parseFunction(r,!0,!1,!1,!0):this.match(a.types._class)?r=this.parseClass(r,!0,!0):(i=!0,r=this.parseMaybeAssign()),t.declaration=r,i&&this.semicolon(),this.checkExport(t),this.finishNode(t,"ExportDefaultDeclaration")}this.state.type.keyword||this.shouldParseExportDeclaration()?(t.specifiers=[],t.source=null,t.declaration=this.parseExportDeclaration(t)):(t.declaration=null,t.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(t))}return this.checkExport(t),this.finishNode(t,"ExportNamedDeclaration")},l.parseExportDeclaration=function(){return this.parseStatement(!0)},l.isExportDefaultSpecifier=function(){if(this.match(a.types.name))return"type"!==this.state.value&&"async"!==this.state.value;if(!this.match(a.types._default))return!1;var t=this.lookahead();return t.type===a.types.comma||t.type===a.types.name&&"from"===t.value},l.parseExportSpecifiersMaybe=function(t){this.eat(a.types.comma)&&(t.specifiers=t.specifiers.concat(this.parseExportSpecifiers()))},l.parseExportFrom=function(t,e){this.eatContextual("from")?(t.source=this.match(a.types.string)?this.parseExprAtom():this.unexpected(),this.checkExport(t)):e?this.unexpected():t.source=null,this.semicolon()},l.shouldParseExportDeclaration=function(){return this.hasPlugin("asyncFunctions")&&this.isContextual("async")},l.checkExport=function(t){if(this.state.decorators.length){var e=t.declaration&&("ClassDeclaration"===t.declaration.type||"ClassExpression"===t.declaration.type);t.declaration&&e||this.raise(t.start,"You can only use decorators on an export when exporting a class"),this.takeDecorators(t.declaration)}},l.parseExportSpecifiers=function(){var t=[],e=!0,n=void 0;for(this.expect(a.types.braceL);!this.eat(a.types.braceR);){if(e)e=!1;else if(this.expect(a.types.comma),this.eat(a.types.braceR))break;var r=this.match(a.types._default);r&&!n&&(n=!0);var i=this.startNode();i.local=this.parseIdentifier(r),i.exported=this.eatContextual("as")?this.parseIdentifier(!0):i.local.__clone(),t.push(this.finishNode(i,"ExportSpecifier"))}return n&&!this.isContextual("from")&&this.unexpected(),t},l.parseImport=function(t){return this.next(),this.match(a.types.string)?(t.specifiers=[],t.source=this.parseExprAtom()):(t.specifiers=[],this.parseImportSpecifiers(t),this.expectContextual("from"),t.source=this.match(a.types.string)?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(t,"ImportDeclaration")},l.parseImportSpecifiers=function(t){var e=!0;if(this.match(a.types.name)){var n=this.state.start,r=this.state.startLoc;if(t.specifiers.push(this.parseImportSpecifierDefault(this.parseIdentifier(),n,r)),!this.eat(a.types.comma))return}if(this.match(a.types.star)){var i=this.startNode();return this.next(),this.expectContextual("as"),i.local=this.parseIdentifier(),this.checkLVal(i.local,!0),void t.specifiers.push(this.finishNode(i,"ImportNamespaceSpecifier"))}for(this.expect(a.types.braceL);!this.eat(a.types.braceR);){if(e)e=!1;else if(this.expect(a.types.comma),this.eat(a.types.braceR))break;var i=this.startNode();i.imported=this.parseIdentifier(!0),i.local=this.eatContextual("as")?this.parseIdentifier():i.imported.__clone(),this.checkLVal(i.local,!0),t.specifiers.push(this.finishNode(i,"ImportSpecifier"))}},l.parseImportSpecifierDefault=function(t,e,n){var r=this.startNodeAt(e,n);return r.local=t,this.checkLVal(r.local,!0),this.finishNode(r,"ImportDefaultSpecifier")}},{800:800,812:812,815:815,816:816,817:817,821:821}],805:[function(t,e,n){"use strict";var r=t(821)["default"],i=t(812),s=t(800),a=r(s),o=t(815),u=a["default"].prototype;u.addExtra=function(t,e,n){if(t){var r=t.extra=t.extra||{};r[e]=n}},u.isRelational=function(t){return this.match(i.types.relational)&&this.state.value===t},u.expectRelational=function(t){this.isRelational(t)?this.next():this.unexpected()},u.isContextual=function(t){return this.match(i.types.name)&&this.state.value===t},u.eatContextual=function(t){return this.state.value===t&&this.eat(i.types.name)},u.expectContextual=function(t){this.eatContextual(t)||this.unexpected()},u.canInsertSemicolon=function(){return this.match(i.types.eof)||this.match(i.types.braceR)||o.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.start))},u.isLineTerminator=function(){return this.eat(i.types.semi)||this.canInsertSemicolon()},u.semicolon=function(){this.isLineTerminator()||this.unexpected()},u.expect=function(t){return this.eat(t)||this.unexpected()},u.unexpected=function(t){this.raise(null!=t?t:this.state.start,"Unexpected token")}},{800:800,812:812,815:815,821:821}],806:[function(t,e,n){"use strict";var r=t(821)["default"];n.__esModule=!0;var i=t(812),s=t(800),a=r(s),o=a["default"].prototype;o.flowParseTypeInitialiser=function(t){var e=this.state.inType;this.state.inType=!0,this.expect(t||i.types.colon);var n=this.flowParseType();return this.state.inType=e,n},o.flowParseDeclareClass=function(t){return this.next(),this.flowParseInterfaceish(t,!0),this.finishNode(t,"DeclareClass")},o.flowParseDeclareFunction=function(t){this.next();var e=t.id=this.parseIdentifier(),n=this.startNode(),r=this.startNode();this.isRelational("<")?n.typeParameters=this.flowParseTypeParameterDeclaration():n.typeParameters=null,this.expect(i.types.parenL);var s=this.flowParseFunctionTypeParams();return n.params=s.params,n.rest=s.rest,this.expect(i.types.parenR),n.returnType=this.flowParseTypeInitialiser(),r.typeAnnotation=this.finishNode(n,"FunctionTypeAnnotation"),e.typeAnnotation=this.finishNode(r,"TypeAnnotation"),this.finishNode(e,e.type),this.semicolon(),this.finishNode(t,"DeclareFunction")},o.flowParseDeclare=function(t){return this.match(i.types._class)?this.flowParseDeclareClass(t):this.match(i.types._function)?this.flowParseDeclareFunction(t):this.match(i.types._var)?this.flowParseDeclareVariable(t):this.isContextual("module")?this.flowParseDeclareModule(t):void this.unexpected()},o.flowParseDeclareVariable=function(t){return this.next(),t.id=this.flowParseTypeAnnotatableIdentifier(),this.semicolon(),this.finishNode(t,"DeclareVariable")},o.flowParseDeclareModule=function(t){this.next(),this.match(i.types.string)?t.id=this.parseExprAtom():t.id=this.parseIdentifier();var e=t.body=this.startNode(),n=e.body=[];for(this.expect(i.types.braceL);!this.match(i.types.braceR);){var r=this.startNode();this.next(),n.push(this.flowParseDeclare(r))}return this.expect(i.types.braceR),this.finishNode(e,"BlockStatement"),this.finishNode(t,"DeclareModule")},o.flowParseInterfaceish=function(t,e){if(t.id=this.parseIdentifier(),this.isRelational("<")?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t["extends"]=[],this.eat(i.types._extends))do t["extends"].push(this.flowParseInterfaceExtends());while(this.eat(i.types.comma));t.body=this.flowParseObjectType(e)},o.flowParseInterfaceExtends=function(){var t=this.startNode();return t.id=this.parseIdentifier(),this.isRelational("<")?t.typeParameters=this.flowParseTypeParameterInstantiation():t.typeParameters=null,this.finishNode(t,"InterfaceExtends")},o.flowParseInterface=function(t){return this.flowParseInterfaceish(t,!1),this.finishNode(t,"InterfaceDeclaration")},o.flowParseTypeAlias=function(t){return t.id=this.parseIdentifier(),this.isRelational("<")?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.right=this.flowParseTypeInitialiser(i.types.eq),this.semicolon(),this.finishNode(t,"TypeAlias")},o.flowParseTypeParameterDeclaration=function(){var t=this.startNode();for(t.params=[],this.expectRelational("<");!this.isRelational(">");)t.params.push(this.flowParseExistentialTypeParam()||this.flowParseTypeAnnotatableIdentifier()),this.isRelational(">")||this.expect(i.types.comma);return this.expectRelational(">"),this.finishNode(t,"TypeParameterDeclaration")},o.flowParseExistentialTypeParam=function(){if(this.match(i.types.star)){var t=this.startNode();return this.next(),this.finishNode(t,"ExistentialTypeParam")}},o.flowParseTypeParameterInstantiation=function(){var t=this.startNode(),e=this.state.inType;for(t.params=[],this.state.inType=!0,this.expectRelational("<");!this.isRelational(">");)t.params.push(this.flowParseExistentialTypeParam()||this.flowParseType()),this.isRelational(">")||this.expect(i.types.comma);return this.expectRelational(">"),this.state.inType=e,this.finishNode(t,"TypeParameterInstantiation")},o.flowParseObjectPropertyKey=function(){return this.match(i.types.num)||this.match(i.types.string)?this.parseExprAtom():this.parseIdentifier(!0)},o.flowParseObjectTypeIndexer=function(t,e){return t["static"]=e,this.expect(i.types.bracketL),t.id=this.flowParseObjectPropertyKey(),t.key=this.flowParseTypeInitialiser(),this.expect(i.types.bracketR),t.value=this.flowParseTypeInitialiser(),this.flowObjectTypeSemicolon(),this.finishNode(t,"ObjectTypeIndexer")},o.flowParseObjectTypeMethodish=function(t){for(t.params=[],t.rest=null,t.typeParameters=null,this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(i.types.parenL);this.match(i.types.name);)t.params.push(this.flowParseFunctionTypeParam()),this.match(i.types.parenR)||this.expect(i.types.comma);return this.eat(i.types.ellipsis)&&(t.rest=this.flowParseFunctionTypeParam()),this.expect(i.types.parenR),t.returnType=this.flowParseTypeInitialiser(),this.finishNode(t,"FunctionTypeAnnotation")},o.flowParseObjectTypeMethod=function(t,e,n,r){var i=this.startNodeAt(t,e);return i.value=this.flowParseObjectTypeMethodish(this.startNodeAt(t,e)),i["static"]=n,i.key=r,i.optional=!1,this.flowObjectTypeSemicolon(),this.finishNode(i,"ObjectTypeProperty")},o.flowParseObjectTypeCallProperty=function(t,e){var n=this.startNode();return t["static"]=e,t.value=this.flowParseObjectTypeMethodish(n),this.flowObjectTypeSemicolon(),this.finishNode(t,"ObjectTypeCallProperty")},o.flowParseObjectType=function(t){var e=this.startNode(),n=void 0,r=void 0,s=void 0;for(e.callProperties=[],e.properties=[],e.indexers=[],this.expect(i.types.braceL);!this.match(i.types.braceR);){var a=!1,o=this.state.start,u=this.state.startLoc;n=this.startNode(),t&&this.isContextual("static")&&(this.next(),s=!0),this.match(i.types.bracketL)?e.indexers.push(this.flowParseObjectTypeIndexer(n,s)):this.match(i.types.parenL)||this.isRelational("<")?e.callProperties.push(this.flowParseObjectTypeCallProperty(n,t)):(r=s&&this.match(i.types.colon)?this.parseIdentifier():this.flowParseObjectPropertyKey(),this.isRelational("<")||this.match(i.types.parenL)?e.properties.push(this.flowParseObjectTypeMethod(o,u,s,r)):(this.eat(i.types.question)&&(a=!0),n.key=r,n.value=this.flowParseTypeInitialiser(),n.optional=a,n["static"]=s,this.flowObjectTypeSemicolon(),e.properties.push(this.finishNode(n,"ObjectTypeProperty"))))}return this.expect(i.types.braceR),this.finishNode(e,"ObjectTypeAnnotation")},o.flowObjectTypeSemicolon=function(){this.eat(i.types.semi)||this.eat(i.types.comma)||this.match(i.types.braceR)||this.unexpected()},o.flowParseGenericType=function(t,e,n){var r=this.startNodeAt(t,e);for(r.typeParameters=null,r.id=n;this.eat(i.types.dot);){var s=this.startNodeAt(t,e);s.qualification=r.id,s.id=this.parseIdentifier(),r.id=this.finishNode(s,"QualifiedTypeIdentifier")}return this.isRelational("<")&&(r.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(r,"GenericTypeAnnotation")},o.flowParseTypeofType=function(){var t=this.startNode();return this.expect(i.types._typeof),t.argument=this.flowParsePrimaryType(),this.finishNode(t,"TypeofTypeAnnotation")},o.flowParseTupleType=function(){var t=this.startNode();for(t.types=[],this.expect(i.types.bracketL);this.state.pos<this.input.length&&!this.match(i.types.bracketR)&&(t.types.push(this.flowParseType()),!this.match(i.types.bracketR));)this.expect(i.types.comma);return this.expect(i.types.bracketR),this.finishNode(t,"TupleTypeAnnotation")},o.flowParseFunctionTypeParam=function(){var t=!1,e=this.startNode();return e.name=this.parseIdentifier(),this.eat(i.types.question)&&(t=!0),e.optional=t,e.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeParam")},o.flowParseFunctionTypeParams=function(){for(var t={params:[],rest:null};this.match(i.types.name);)t.params.push(this.flowParseFunctionTypeParam()),this.match(i.types.parenR)||this.expect(i.types.comma);return this.eat(i.types.ellipsis)&&(t.rest=this.flowParseFunctionTypeParam()),t},o.flowIdentToTypeAnnotation=function(t,e,n,r){switch(r.name){case"any":return this.finishNode(n,"AnyTypeAnnotation");case"void":return this.finishNode(n,"VoidTypeAnnotation");case"bool":case"boolean":return this.finishNode(n,"BooleanTypeAnnotation");case"mixed":return this.finishNode(n,"MixedTypeAnnotation");case"number":return this.finishNode(n,"NumberTypeAnnotation");case"string":return this.finishNode(n,"StringTypeAnnotation");default:return this.flowParseGenericType(t,e,r)}},o.flowParsePrimaryType=function(){var t=this.state.start,e=this.state.startLoc,n=this.startNode(),r=void 0,s=void 0,a=!1;switch(this.state.type){case i.types.name:return this.flowIdentToTypeAnnotation(t,e,n,this.parseIdentifier());case i.types.braceL:return this.flowParseObjectType();case i.types.bracketL:return this.flowParseTupleType();case i.types.relational:if("<"===this.state.value)return n.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(i.types.parenL),r=this.flowParseFunctionTypeParams(),n.params=r.params,n.rest=r.rest,this.expect(i.types.parenR),this.expect(i.types.arrow),n.returnType=this.flowParseType(),this.finishNode(n,"FunctionTypeAnnotation");case i.types.parenL:if(this.next(),!this.match(i.types.parenR)&&!this.match(i.types.ellipsis))if(this.match(i.types.name)){var o=this.lookahead().type;a=o!==i.types.question&&o!==i.types.colon}else a=!0;return a?(s=this.flowParseType(),this.expect(i.types.parenR),this.eat(i.types.arrow)&&this.raise(n,"Unexpected token =>. It looks like you are trying to write a function type, but you ended up writing a grouped type followed by an =>, which is a syntax error. Remember, function type parameters are named so function types look like (name1: type1, name2: type2) => returnType. You probably wrote (type1) => returnType"),s):(r=this.flowParseFunctionTypeParams(),n.params=r.params,n.rest=r.rest,this.expect(i.types.parenR),this.expect(i.types.arrow),n.returnType=this.flowParseType(),n.typeParameters=null,this.finishNode(n,"FunctionTypeAnnotation"));case i.types.string:return n.value=this.state.value,this.addExtra(n,"rawValue",n.value),this.addExtra(n,"raw",this.input.slice(this.state.start,this.state.end)),this.next(),this.finishNode(n,"StringLiteralTypeAnnotation");case i.types._true:case i.types._false:return n.value=this.match(i.types._true),this.next(),this.finishNode(n,"BooleanLiteralTypeAnnotation");case i.types.num:return n.value=this.state.value,this.addExtra(n,"rawValue",n.value),this.addExtra(n,"raw",this.input.slice(this.state.start,this.state.end)),this.next(),this.finishNode(n,"NumericLiteralTypeAnnotation");default:if("typeof"===this.state.type.keyword)return this.flowParseTypeofType()}this.unexpected()},o.flowParsePostfixType=function(){var t=this.startNode(),e=t.elementType=this.flowParsePrimaryType();return this.match(i.types.bracketL)?(this.expect(i.types.bracketL),this.expect(i.types.bracketR),this.finishNode(t,"ArrayTypeAnnotation")):e},o.flowParsePrefixType=function(){var t=this.startNode();return this.eat(i.types.question)?(t.typeAnnotation=this.flowParsePrefixType(),this.finishNode(t,"NullableTypeAnnotation")):this.flowParsePostfixType()},o.flowParseIntersectionType=function(){var t=this.startNode(),e=this.flowParsePrefixType();for(t.types=[e];this.eat(i.types.bitwiseAND);)t.types.push(this.flowParsePrefixType());return 1===t.types.length?e:this.finishNode(t,"IntersectionTypeAnnotation")},o.flowParseUnionType=function(){var t=this.startNode(),e=this.flowParseIntersectionType();for(t.types=[e];this.eat(i.types.bitwiseOR);)t.types.push(this.flowParseIntersectionType());return 1===t.types.length?e:this.finishNode(t,"UnionTypeAnnotation")},o.flowParseType=function(){var t=this.state.inType;this.state.inType=!0;var e=this.flowParseUnionType();return this.state.inType=t,e},o.flowParseTypeAnnotation=function(){var t=this.startNode();return t.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(t,"TypeAnnotation")},o.flowParseTypeAnnotatableIdentifier=function(t,e){var n=this.parseIdentifier(),r=!1;return e&&this.eat(i.types.question)&&(this.expect(i.types.question),r=!0),(t||this.match(i.types.colon))&&(n.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(n,n.type)),r&&(n.optional=!0,this.finishNode(n,n.type)),n},n["default"]=function(t){function e(t){return t.expression.typeAnnotation=t.typeAnnotation,t.expression}t.extend("parseFunctionBody",function(t){return function(e,n){return this.match(i.types.colon)&&!n&&(e.returnType=this.flowParseTypeAnnotation()),t.call(this,e,n)}}),t.extend("parseStatement",function(t){return function(e,n){if(this.state.strict&&this.match(i.types.name)&&"interface"===this.state.value){var r=this.startNode();return this.next(),this.flowParseInterface(r)}return t.call(this,e,n)}}),t.extend("parseExpressionStatement",function(t){return function(e,n){if("Identifier"===n.type)if("declare"===n.name){if(this.match(i.types._class)||this.match(i.types.name)||this.match(i.types._function)||this.match(i.types._var))return this.flowParseDeclare(e)}else if(this.match(i.types.name)){if("interface"===n.name)return this.flowParseInterface(e);if("type"===n.name)return this.flowParseTypeAlias(e)}return t.call(this,e,n)}}),t.extend("shouldParseExportDeclaration",function(t){return function(){return this.isContextual("type")||t.call(this)}}),t.extend("parseParenItem",function(){return function(t,e,n,r){var s=this.state.potentialArrowAt=n;if(this.match(i.types.colon)){var a=this.startNodeAt(e,n);if(a.expression=t,a.typeAnnotation=this.flowParseTypeAnnotation(),r&&!this.match(i.types.arrow)&&this.unexpected(),s&&this.eat(i.types.arrow)){var o=this.parseArrowExpression(this.startNodeAt(e,n),[t]);return o.returnType=a.typeAnnotation,o}return this.finishNode(a,"TypeCastExpression")}return t}}),t.extend("parseExport",function(t){return function(e){return e=t.call(this,e),"ExportNamedDeclaration"===e.type&&(e.exportKind=e.exportKind||"value"),e}}),t.extend("parseExportDeclaration",function(t){return function(e){if(this.isContextual("type")){e.exportKind="type";var n=this.startNode();return this.next(),this.match(i.types.braceL)?(e.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(e),null):this.flowParseTypeAlias(n)}return t.call(this,e)}}),t.extend("parseClassId",function(t){return function(e){t.apply(this,arguments),this.isRelational("<")&&(e.typeParameters=this.flowParseTypeParameterDeclaration())}}),t.extend("isKeyword",function(t){return function(e){return this.state.inType&&"void"===e?!1:t.call(this,e)}}),t.extend("readToken",function(t){return function(e){return!this.state.inType||62!==e&&60!==e?t.call(this,e):this.finishOp(i.types.relational,1)}}),t.extend("jsx_readToken",function(t){return function(){return this.state.inType?void 0:t.call(this)}}),t.extend("toAssignable",function(t){return function(n){return"TypeCastExpression"===n.type?e(n):t.apply(this,arguments)}}),t.extend("toAssignableList",function(t){return function(n,r){for(var i=0;i<n.length;i++){var s=n[i];s&&"TypeCastExpression"===s.type&&(n[i]=e(s))}return t.call(this,n,r)}}),t.extend("toReferencedList",function(){return function(t){for(var e=0;e<t.length;e++){var n=t[e];n&&n._exprListItem&&"TypeCastExpression"===n.type&&this.raise(n.start,"Unexpected type cast")}return t}}),t.extend("parseExprListItem",function(t){return function(e,n){var r=this.startNode(),s=t.call(this,e,n);return this.match(i.types.colon)?(r._exprListItem=!0,r.expression=s,r.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(r,"TypeCastExpression")):s}}),t.extend("checkLVal",function(t){return function(e){return"TypeCastExpression"!==e.type?t.apply(this,arguments):void 0}}),t.extend("parseClassProperty",function(t){return function(e){return this.match(i.types.colon)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),t.call(this,e)}}),t.extend("isClassProperty",function(t){return function(){return this.match(i.types.colon)||t.call(this)}}),t.extend("parseClassMethod",function(){return function(t,e,n,r){this.isRelational("<")&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.parseMethod(e,n,r),t.body.push(this.finishNode(e,"ClassMethod"))}}),t.extend("parseClassSuper",function(t){return function(e,n){if(t.call(this,e,n),e.superClass&&this.isRelational("<")&&(e.superTypeParameters=this.flowParseTypeParameterInstantiation()),this.isContextual("implements")){this.next();var r=e["implements"]=[];do{var s=this.startNode();s.id=this.parseIdentifier(),this.isRelational("<")?s.typeParameters=this.flowParseTypeParameterInstantiation():s.typeParameters=null,r.push(this.finishNode(s,"ClassImplements"))}while(this.eat(i.types.comma))}}}),t.extend("parseObjPropValue",function(t){return function(e){var n=void 0;this.isRelational("<")&&(n=this.flowParseTypeParameterDeclaration(),this.match(i.types.parenL)||this.unexpected()),t.apply(this,arguments),n&&((e.value||e).typeParameters=n)}}),t.extend("parseAssignableListItemTypes",function(){return function(t){return this.eat(i.types.question)&&(t.optional=!0),this.match(i.types.colon)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),this.finishNode(t,t.type),t}}),t.extend("parseImportSpecifiers",function(t){return function(e){e.importKind="value";var n=null;if(this.match(i.types._typeof)?n="typeof":this.isContextual("type")&&(n="type"),n){var r=this.lookahead();(r.type===i.types.name&&"from"!==r.value||r.type===i.types.braceL||r.type===i.types.star)&&(this.next(),e.importKind=n)}t.call(this,e)}}),t.extend("parseFunctionParams",function(t){return function(e){this.isRelational("<")&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),t.call(this,e)}}),t.extend("parseVarHead",function(t){return function(e){t.call(this,e),this.match(i.types.colon)&&(e.id.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(e.id,e.id.type))}}),t.extend("parseAsyncArrowFromCallExpression",function(t){return function(e,n){return this.match(i.types.colon)&&(e.returnType=this.flowParseTypeAnnotation()),t.call(this,e,n)}}),t.extend("shouldParseAsyncArrow",function(t){return function(){return this.match(i.types.colon)||t.call(this)}}),t.extend("parseParenAndDistinguishExpression",function(t){return function(e,n,r,s){if(e=e||this.state.start,n=n||this.state.startLoc,r&&this.lookahead().type===i.types.parenR){this.expect(i.types.parenL),this.expect(i.types.parenR);var a=this.startNodeAt(e,n);return this.match(i.types.colon)&&(a.returnType=this.flowParseTypeAnnotation()),this.expect(i.types.arrow),this.parseArrowExpression(a,[],s)}var a=t.call(this,e,n,r,s);if(!this.match(i.types.colon))return a;var o=this.state.clone();try{return this.parseParenItem(a,e,n,!0)}catch(u){if(u instanceof SyntaxError)return this.state=o,a;throw u}}})},e.exports=n["default"]},{800:800,812:812,821:821}],807:[function(t,e,n){"use strict";function r(t){return"JSXIdentifier"===t.type?t.name:"JSXNamespacedName"===t.type?t.namespace.name+":"+t.name.name:"JSXMemberExpression"===t.type?r(t.object)+"."+r(t.property):void 0}var i=t(821)["default"];n.__esModule=!0;var s=t(808),a=i(s),o=t(812),u=t(809),p=t(800),l=i(p),c=t(813),f=t(815),h=/^[\da-fA-F]+$/,d=/^\d+$/;u.types.j_oTag=new u.TokContext("<tag",!1),u.types.j_cTag=new u.TokContext("</tag",!1),u.types.j_expr=new u.TokContext("<tag>...</tag>",!0,!0),o.types.jsxName=new o.TokenType("jsxName"),o.types.jsxText=new o.TokenType("jsxText",{beforeExpr:!0}),o.types.jsxTagStart=new o.TokenType("jsxTagStart"),o.types.jsxTagEnd=new o.TokenType("jsxTagEnd"),o.types.jsxTagStart.updateContext=function(){this.state.context.push(u.types.j_expr),this.state.context.push(u.types.j_oTag),this.state.exprAllowed=!1},o.types.jsxTagEnd.updateContext=function(t){var e=this.state.context.pop();e===u.types.j_oTag&&t===o.types.slash||e===u.types.j_cTag?(this.state.context.pop(),this.state.exprAllowed=this.curContext()===u.types.j_expr):this.state.exprAllowed=!0};var m=l["default"].prototype;m.jsxReadToken=function(){for(var t="",e=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated JSX contents");var n=this.input.charCodeAt(this.state.pos);switch(n){case 60:case 123:return this.state.pos===this.state.start?60===n&&this.state.exprAllowed?(++this.state.pos,this.finishToken(o.types.jsxTagStart)):this.getTokenFromCode(n):(t+=this.input.slice(e,this.state.pos),this.finishToken(o.types.jsxText,t));case 38:t+=this.input.slice(e,this.state.pos),t+=this.jsxReadEntity(),e=this.state.pos;break;default:f.isNewLine(n)?(t+=this.input.slice(e,this.state.pos),t+=this.jsxReadNewLine(!0),e=this.state.pos):++this.state.pos}}},m.jsxReadNewLine=function(t){var e=this.input.charCodeAt(this.state.pos),n=void 0;return++this.state.pos,13===e&&10===this.input.charCodeAt(this.state.pos)?(++this.state.pos,n=t?"\n":"\r\n"):n=String.fromCharCode(e),++this.state.curLine,this.state.lineStart=this.state.pos,n},m.jsxReadString=function(t){for(var e="",n=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");
var r=this.input.charCodeAt(this.state.pos);if(r===t)break;38===r?(e+=this.input.slice(n,this.state.pos),e+=this.jsxReadEntity(),n=this.state.pos):f.isNewLine(r)?(e+=this.input.slice(n,this.state.pos),e+=this.jsxReadNewLine(!1),n=this.state.pos):++this.state.pos}return e+=this.input.slice(n,this.state.pos++),this.finishToken(o.types.string,e)},m.jsxReadEntity=function(){for(var t="",e=0,n=void 0,r=this.input[this.state.pos],i=++this.state.pos;this.state.pos<this.input.length&&e++<10;){if(r=this.input[this.state.pos++],";"===r){"#"===t[0]?"x"===t[1]?(t=t.substr(2),h.test(t)&&(n=String.fromCharCode(parseInt(t,16)))):(t=t.substr(1),d.test(t)&&(n=String.fromCharCode(parseInt(t,10)))):n=a["default"][t];break}t+=r}return n?n:(this.state.pos=i,"&")},m.jsxReadWord=function(){var t=void 0,e=this.state.pos;do t=this.input.charCodeAt(++this.state.pos);while(c.isIdentifierChar(t)||45===t);return this.finishToken(o.types.jsxName,this.input.slice(e,this.state.pos))},m.jsxParseIdentifier=function(){var t=this.startNode();return this.match(o.types.jsxName)?t.name=this.state.value:this.state.type.keyword?t.name=this.state.type.keyword:this.unexpected(),this.next(),this.finishNode(t,"JSXIdentifier")},m.jsxParseNamespacedName=function(){var t=this.state.start,e=this.state.startLoc,n=this.jsxParseIdentifier();if(!this.eat(o.types.colon))return n;var r=this.startNodeAt(t,e);return r.namespace=n,r.name=this.jsxParseIdentifier(),this.finishNode(r,"JSXNamespacedName")},m.jsxParseElementName=function(){for(var t=this.state.start,e=this.state.startLoc,n=this.jsxParseNamespacedName();this.eat(o.types.dot);){var r=this.startNodeAt(t,e);r.object=n,r.property=this.jsxParseIdentifier(),n=this.finishNode(r,"JSXMemberExpression")}return n},m.jsxParseAttributeValue=function(){var t=void 0;switch(this.state.type){case o.types.braceL:if(t=this.jsxParseExpressionContainer(),"JSXEmptyExpression"!==t.expression.type)return t;this.raise(t.start,"JSX attributes must only be assigned a non-empty expression");case o.types.jsxTagStart:case o.types.string:return t=this.parseExprAtom(),t.extra=null,t;default:this.raise(this.state.start,"JSX value should be either an expression or a quoted JSX text")}},m.jsxParseEmptyExpression=function(){var t=this.startNodeAt(this.lastTokEnd,this.lastTokEndLoc);return this.finishNodeAt(t,"JSXEmptyExpression",this.start,this.startLoc)},m.jsxParseExpressionContainer=function(){var t=this.startNode();return this.next(),this.match(o.types.braceR)?t.expression=this.jsxParseEmptyExpression():t.expression=this.parseExpression(),this.expect(o.types.braceR),this.finishNode(t,"JSXExpressionContainer")},m.jsxParseAttribute=function(){var t=this.startNode();return this.eat(o.types.braceL)?(this.expect(o.types.ellipsis),t.argument=this.parseMaybeAssign(),this.expect(o.types.braceR),this.finishNode(t,"JSXSpreadAttribute")):(t.name=this.jsxParseNamespacedName(),t.value=this.eat(o.types.eq)?this.jsxParseAttributeValue():null,this.finishNode(t,"JSXAttribute"))},m.jsxParseOpeningElementAt=function(t,e){var n=this.startNodeAt(t,e);for(n.attributes=[],n.name=this.jsxParseElementName();!this.match(o.types.slash)&&!this.match(o.types.jsxTagEnd);)n.attributes.push(this.jsxParseAttribute());return n.selfClosing=this.eat(o.types.slash),this.expect(o.types.jsxTagEnd),this.finishNode(n,"JSXOpeningElement")},m.jsxParseClosingElementAt=function(t,e){var n=this.startNodeAt(t,e);return n.name=this.jsxParseElementName(),this.expect(o.types.jsxTagEnd),this.finishNode(n,"JSXClosingElement")},m.jsxParseElementAt=function(t,e){var n=this.startNodeAt(t,e),i=[],s=this.jsxParseOpeningElementAt(t,e),a=null;if(!s.selfClosing){t:for(;;)switch(this.state.type){case o.types.jsxTagStart:if(t=this.state.start,e=this.state.startLoc,this.next(),this.eat(o.types.slash)){a=this.jsxParseClosingElementAt(t,e);break t}i.push(this.jsxParseElementAt(t,e));break;case o.types.jsxText:i.push(this.parseExprAtom());break;case o.types.braceL:i.push(this.jsxParseExpressionContainer());break;default:this.unexpected()}r(a.name)!==r(s.name)&&this.raise(a.start,"Expected corresponding JSX closing tag for <"+r(s.name)+">")}return n.openingElement=s,n.closingElement=a,n.children=i,this.match(o.types.relational)&&"<"===this.state.value&&this.raise(this.state.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(n,"JSXElement")},m.jsxParseElement=function(){var t=this.state.start,e=this.state.startLoc;return this.next(),this.jsxParseElementAt(t,e)},n["default"]=function(t){t.extend("parseExprAtom",function(t){return function(e){if(this.match(o.types.jsxText)){var n=this.parseLiteral(this.state.value,"JSXText");return n.extra=null,n}return this.match(o.types.jsxTagStart)?this.jsxParseElement():t.call(this,e)}}),t.extend("readToken",function(t){return function(e){var n=this.curContext();if(n===u.types.j_expr)return this.jsxReadToken();if(n===u.types.j_oTag||n===u.types.j_cTag){if(c.isIdentifierStart(e))return this.jsxReadWord();if(62===e)return++this.state.pos,this.finishToken(o.types.jsxTagEnd);if((34===e||39===e)&&n===u.types.j_oTag)return this.jsxReadString(e)}return 60===e&&this.state.exprAllowed?(++this.state.pos,this.finishToken(o.types.jsxTagStart)):t.call(this,e)}}),t.extend("updateContext",function(t){return function(e){if(this.match(o.types.braceL)){var n=this.curContext();n===u.types.j_oTag?this.state.context.push(u.types.b_expr):n===u.types.j_expr?this.state.context.push(u.types.b_tmpl):t.call(this,e),this.state.exprAllowed=!0}else{if(!this.match(o.types.slash)||e!==o.types.jsxTagStart)return t.call(this,e);this.state.context.length-=2,this.state.context.push(u.types.j_cTag),this.state.exprAllowed=!1}}})},e.exports=n["default"]},{800:800,808:808,809:809,812:812,813:813,815:815,821:821}],808:[function(t,e,n){"use strict";n.__esModule=!0,n["default"]={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"},e.exports=n["default"]},{}],809:[function(t,e,n){"use strict";var r=t(819)["default"];n.__esModule=!0;var i=t(812),s=t(815),a=function u(t,e,n,i){r(this,u),this.token=t,this.isExpr=!!e,this.preserveSpace=!!n,this.override=i};n.TokContext=a;var o={b_stat:new a("{",!1),b_expr:new a("{",!0),b_tmpl:new a("${",!0),p_stat:new a("(",!1),p_expr:new a("(",!0),q_tmpl:new a("`",!0,!0,function(t){return t.readTmplToken()}),f_expr:new a("function",!0)};n.types=o,i.types.parenR.updateContext=i.types.braceR.updateContext=function(){if(1===this.state.context.length)return void(this.state.exprAllowed=!0);var t=this.state.context.pop();t===o.b_stat&&this.curContext()===o.f_expr?(this.state.context.pop(),this.state.exprAllowed=!1):t===o.b_tmpl?this.state.exprAllowed=!0:this.state.exprAllowed=!t.isExpr},i.types.name.updateContext=function(t){this.state.exprAllowed=!1,(t===i.types._let||t===i.types._const||t===i.types._var)&&s.lineBreak.test(this.input.slice(this.state.end))&&(this.state.exprAllowed=!0)},i.types.braceL.updateContext=function(t){this.state.context.push(this.braceIsBlock(t)?o.b_stat:o.b_expr),this.state.exprAllowed=!0},i.types.dollarBraceL.updateContext=function(){this.state.context.push(o.b_tmpl),this.state.exprAllowed=!0},i.types.parenL.updateContext=function(t){var e=t===i.types._if||t===i.types._for||t===i.types._with||t===i.types._while;this.state.context.push(e?o.p_stat:o.p_expr),this.state.exprAllowed=!0},i.types.incDec.updateContext=function(){},i.types._function.updateContext=function(){this.curContext()!==o.b_stat&&this.state.context.push(o.f_expr),this.state.exprAllowed=!1},i.types.backQuote.updateContext=function(){this.curContext()===o.q_tmpl?this.state.context.pop():this.state.context.push(o.q_tmpl),this.state.exprAllowed=!1}},{812:812,815:815,819:819}],810:[function(t,e,n){"use strict";function r(t){return 65535>=t?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}var i=t(819)["default"],s=t(821)["default"];n.__esModule=!0;var a=t(813),o=t(812),u=t(809),p=t(814),l=t(815),c=t(811),f=s(c),h=function m(t){i(this,m),this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,this.loc=new p.SourceLocation(t.startLoc,t.endLoc)};n.Token=h;var d=function(){function t(e,n){i(this,t),this.state=new f["default"],this.state.init(e,n)}return t.prototype.next=function(){this.isLookahead||this.state.tokens.push(new h(this.state)),this.state.lastTokEnd=this.state.end,this.state.lastTokStart=this.state.start,this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()},t.prototype.eat=function(t){return this.match(t)?(this.next(),!0):!1},t.prototype.match=function(t){return this.state.type===t},t.prototype.isKeyword=function(t){return a.isKeyword(t)},t.prototype.lookahead=function(){var t=this.state;this.state=t.clone(!0),this.isLookahead=!0,this.next(),this.isLookahead=!1;var e=this.state.clone(!0);return this.state=t,e},t.prototype.setStrict=function(t){if(this.state.strict=t,this.match(o.types.num)||this.match(o.types.string)){for(this.state.pos=this.state.start;this.state.pos<this.state.lineStart;)this.state.lineStart=this.input.lastIndexOf("\n",this.state.lineStart-2)+1,--this.state.curLine;this.nextToken()}},t.prototype.curContext=function(){return this.state.context[this.state.context.length-1]},t.prototype.nextToken=function(){var t=this.curContext();return t&&t.preserveSpace||this.skipSpace(),this.state.containsOctal=!1,this.state.octalPosition=null,this.state.start=this.state.pos,this.state.startLoc=this.state.curPosition(),this.state.pos>=this.input.length?this.finishToken(o.types.eof):t.override?t.override(this):this.readToken(this.fullCharCodeAtPos())},t.prototype.readToken=function(t){return a.isIdentifierStart(t,!0)||92===t?this.readWord():this.getTokenFromCode(t)},t.prototype.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.state.pos);if(55295>=t||t>=57344)return t;var e=this.input.charCodeAt(this.state.pos+1);return(t<<10)+e-56613888},t.prototype.pushComment=function(t,e,n,r,i,s){var a={type:t?"CommentBlock":"CommentLine",value:e,start:n,end:r,loc:new p.SourceLocation(i,s)};this.isLookahead||(this.state.tokens.push(a),this.state.comments.push(a)),this.addComment(a)},t.prototype.skipBlockComment=function(){var t=this.state.curPosition(),e=this.state.pos,n=this.input.indexOf("*/",this.state.pos+=2);-1===n&&this.raise(this.state.pos-2,"Unterminated comment"),this.state.pos=n+2,l.lineBreakG.lastIndex=e;for(var r=void 0;(r=l.lineBreakG.exec(this.input))&&r.index<this.state.pos;)++this.state.curLine,this.state.lineStart=r.index+r[0].length;this.pushComment(!0,this.input.slice(e+2,n),e,this.state.pos,t,this.state.curPosition())},t.prototype.skipLineComment=function(t){for(var e=this.state.pos,n=this.state.curPosition(),r=this.input.charCodeAt(this.state.pos+=t);this.state.pos<this.input.length&&10!==r&&13!==r&&8232!==r&&8233!==r;)++this.state.pos,r=this.input.charCodeAt(this.state.pos);this.pushComment(!1,this.input.slice(e+t,this.state.pos),e,this.state.pos,n,this.state.curPosition())},t.prototype.skipSpace=function(){t:for(;this.state.pos<this.input.length;){var t=this.input.charCodeAt(this.state.pos);switch(t){case 32:case 160:++this.state.pos;break;case 13:10===this.input.charCodeAt(this.state.pos+1)&&++this.state.pos;case 10:case 8232:case 8233:++this.state.pos,++this.state.curLine,this.state.lineStart=this.state.pos;break;case 47:switch(this.input.charCodeAt(this.state.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break t}break;default:if(!(t>8&&14>t||t>=5760&&l.nonASCIIwhitespace.test(String.fromCharCode(t))))break t;++this.state.pos}}},t.prototype.finishToken=function(t,e){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();var n=this.state.type;this.state.type=t,this.state.value=e,this.updateContext(n)},t.prototype.readToken_dot=function(){var t=this.input.charCodeAt(this.state.pos+1);if(t>=48&&57>=t)return this.readNumber(!0);var e=this.input.charCodeAt(this.state.pos+2);return 46===t&&46===e?(this.state.pos+=3,this.finishToken(o.types.ellipsis)):(++this.state.pos,this.finishToken(o.types.dot))},t.prototype.readToken_slash=function(){if(this.state.exprAllowed)return++this.state.pos,this.readRegexp();var t=this.input.charCodeAt(this.state.pos+1);return 61===t?this.finishOp(o.types.assign,2):this.finishOp(o.types.slash,1)},t.prototype.readToken_mult_modulo=function(t){var e=42===t?o.types.star:o.types.modulo,n=1,r=this.input.charCodeAt(this.state.pos+1);return 42===r&&this.hasPlugin("exponentiationOperator")&&(n++,r=this.input.charCodeAt(this.state.pos+2),e=o.types.exponent),61===r&&(n++,e=o.types.assign),this.finishOp(e,n)},t.prototype.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.state.pos+1);return e===t?this.finishOp(124===t?o.types.logicalOR:o.types.logicalAND,2):61===e?this.finishOp(o.types.assign,2):this.finishOp(124===t?o.types.bitwiseOR:o.types.bitwiseAND,1)},t.prototype.readToken_caret=function(){var t=this.input.charCodeAt(this.state.pos+1);return 61===t?this.finishOp(o.types.assign,2):this.finishOp(o.types.bitwiseXOR,1)},t.prototype.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.state.pos+1);return e===t?45===e&&62===this.input.charCodeAt(this.state.pos+2)&&l.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.pos))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(o.types.incDec,2):61===e?this.finishOp(o.types.assign,2):this.finishOp(o.types.plusMin,1)},t.prototype.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.state.pos+1),n=1;return e===t?(n=62===t&&62===this.input.charCodeAt(this.state.pos+2)?3:2,61===this.input.charCodeAt(this.state.pos+n)?this.finishOp(o.types.assign,n+1):this.finishOp(o.types.bitShift,n)):33===e&&60===t&&45===this.input.charCodeAt(this.state.pos+2)&&45===this.input.charCodeAt(this.state.pos+3)?(this.inModule&&this.unexpected(),this.skipLineComment(4),this.skipSpace(),this.nextToken()):(61===e&&(n=61===this.input.charCodeAt(this.state.pos+2)?3:2),this.finishOp(o.types.relational,n))},t.prototype.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.state.pos+1);return 61===e?this.finishOp(o.types.equality,61===this.input.charCodeAt(this.state.pos+2)?3:2):61===t&&62===e?(this.state.pos+=2,this.finishToken(o.types.arrow)):this.finishOp(61===t?o.types.eq:o.types.prefix,1)},t.prototype.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.state.pos,this.finishToken(o.types.parenL);case 41:return++this.state.pos,this.finishToken(o.types.parenR);case 59:return++this.state.pos,this.finishToken(o.types.semi);case 44:return++this.state.pos,this.finishToken(o.types.comma);case 91:return++this.state.pos,this.finishToken(o.types.bracketL);case 93:return++this.state.pos,this.finishToken(o.types.bracketR);case 123:return++this.state.pos,this.finishToken(o.types.braceL);case 125:return++this.state.pos,this.finishToken(o.types.braceR);case 58:return this.hasPlugin("functionBind")&&58===this.input.charCodeAt(this.state.pos+1)?this.finishOp(o.types.doubleColon,2):(++this.state.pos,this.finishToken(o.types.colon));case 63:return++this.state.pos,this.finishToken(o.types.question);case 64:return++this.state.pos,this.finishToken(o.types.at);case 96:return++this.state.pos,this.finishToken(o.types.backQuote);case 48:var e=this.input.charCodeAt(this.state.pos+1);if(120===e||88===e)return this.readRadixNumber(16);if(111===e||79===e)return this.readRadixNumber(8);if(98===e||66===e)return this.readRadixNumber(2);case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 126:return this.finishOp(o.types.prefix,1)}this.raise(this.state.pos,"Unexpected character '"+r(t)+"'")},t.prototype.finishOp=function(t,e){var n=this.input.slice(this.state.pos,this.state.pos+e);return this.state.pos+=e,this.finishToken(t,n)},t.prototype.readRegexp=function(){for(var t=void 0,e=void 0,n=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var r=this.input.charAt(this.state.pos);if(l.lineBreak.test(r)&&this.raise(n,"Unterminated regular expression"),t)t=!1;else{if("["===r)e=!0;else if("]"===r&&e)e=!1;else if("/"===r&&!e)break;t="\\"===r}++this.state.pos}var i=this.input.slice(n,this.state.pos);++this.state.pos;var s=this.readWord1();if(s){var a=/^[gmsiyu]*$/;a.test(s)||this.raise(n,"Invalid regular expression flag")}return this.finishToken(o.types.regexp,{pattern:i,flags:s})},t.prototype.readInt=function(t,e){for(var n=this.state.pos,r=0,i=0,s=null==e?1/0:e;s>i;++i){var a=this.input.charCodeAt(this.state.pos),o=void 0;if(o=a>=97?a-97+10:a>=65?a-65+10:a>=48&&57>=a?a-48:1/0,o>=t)break;++this.state.pos,r=r*t+o}return this.state.pos===n||null!=e&&this.state.pos-n!==e?null:r},t.prototype.readRadixNumber=function(t){this.state.pos+=2;var e=this.readInt(t);return null==e&&this.raise(this.state.start+2,"Expected number in radix "+t),a.isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number"),this.finishToken(o.types.num,e)},t.prototype.readNumber=function(t){var e=this.state.pos,n=!1,r=48===this.input.charCodeAt(this.state.pos);t||null!==this.readInt(10)||this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.state.pos);46===i&&(++this.state.pos,this.readInt(10),n=!0,i=this.input.charCodeAt(this.state.pos)),(69===i||101===i)&&(i=this.input.charCodeAt(++this.state.pos),(43===i||45===i)&&++this.state.pos,null===this.readInt(10)&&this.raise(e,"Invalid number"),n=!0),a.isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number");var s=this.input.slice(e,this.state.pos),u=void 0;return n?u=parseFloat(s):r&&1!==s.length?/[89]/.test(s)||this.state.strict?this.raise(e,"Invalid number"):u=parseInt(s,8):u=parseInt(s,10),this.finishToken(o.types.num,u)},t.prototype.readCodePoint=function(){var t=this.input.charCodeAt(this.state.pos),e=void 0;if(123===t){var n=++this.state.pos;e=this.readHexChar(this.input.indexOf("}",this.state.pos)-this.state.pos),++this.state.pos,e>1114111&&this.raise(n,"Code point out of bounds")}else e=this.readHexChar(4);return e},t.prototype.readString=function(t){for(var e="",n=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var r=this.input.charCodeAt(this.state.pos);if(r===t)break;92===r?(e+=this.input.slice(n,this.state.pos),e+=this.readEscapedChar(!1),n=this.state.pos):(l.isNewLine(r)&&this.raise(this.state.start,"Unterminated string constant"),++this.state.pos)}return e+=this.input.slice(n,this.state.pos++),this.finishToken(o.types.string,e)},t.prototype.readTmplToken=function(){for(var t="",e=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated template");var n=this.input.charCodeAt(this.state.pos);if(96===n||36===n&&123===this.input.charCodeAt(this.state.pos+1))return this.state.pos===this.state.start&&this.match(o.types.template)?36===n?(this.state.pos+=2,this.finishToken(o.types.dollarBraceL)):(++this.state.pos,this.finishToken(o.types.backQuote)):(t+=this.input.slice(e,this.state.pos),this.finishToken(o.types.template,t));if(92===n)t+=this.input.slice(e,this.state.pos),t+=this.readEscapedChar(!0),e=this.state.pos;else if(l.isNewLine(n)){switch(t+=this.input.slice(e,this.state.pos),++this.state.pos,n){case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:t+="\n";break;default:t+=String.fromCharCode(n)}++this.state.curLine,this.state.lineStart=this.state.pos,e=this.state.pos}else++this.state.pos}},t.prototype.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.state.pos);switch(++this.state.pos,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return r(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"";case 102:return"\f";case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:return this.state.lineStart=this.state.pos,++this.state.curLine,"";default:if(e>=48&&55>=e){var n=this.input.substr(this.state.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(n,8);return i>255&&(n=n.slice(0,-1),i=parseInt(n,8)),i>0&&(this.state.containsOctal||(this.state.containsOctal=!0,this.state.octalPosition=this.state.pos-2),(this.state.strict||t)&&this.raise(this.state.pos-2,"Octal literal in strict mode")),this.state.pos+=n.length-1,String.fromCharCode(i)}return String.fromCharCode(e)}},t.prototype.readHexChar=function(t){var e=this.state.pos,n=this.readInt(16,t);return null===n&&this.raise(e,"Bad character escape sequence"),n},t.prototype.readWord1=function(){this.state.containsEsc=!1;for(var t="",e=!0,n=this.state.pos;this.state.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(a.isIdentifierChar(i,!0))this.state.pos+=65535>=i?1:2;else{if(92!==i)break;this.state.containsEsc=!0,t+=this.input.slice(n,this.state.pos);var s=this.state.pos;117!==this.input.charCodeAt(++this.state.pos)&&this.raise(this.state.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.state.pos;var o=this.readCodePoint();(e?a.isIdentifierStart:a.isIdentifierChar)(o,!0)||this.raise(s,"Invalid Unicode escape"),t+=r(o),n=this.state.pos}e=!1}return t+this.input.slice(n,this.state.pos)},t.prototype.readWord=function(){var t=this.readWord1(),e=o.types.name;return!this.state.containsEsc&&this.isKeyword(t)&&(e=o.keywords[t]),this.finishToken(e,t)},t.prototype.braceIsBlock=function(t){if(t===o.types.colon){var e=this.curContext();if(e===u.types.b_stat||e===u.types.b_expr)return!e.isExpr}return t===o.types._return?l.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.start)):t===o.types._else||t===o.types.semi||t===o.types.eof||t===o.types.parenR?!0:t===o.types.braceL?this.curContext()===u.types.b_stat:!this.state.exprAllowed},t.prototype.updateContext=function(t){var e=void 0,n=this.state.type;n.keyword&&t===o.types.dot?this.state.exprAllowed=!1:(e=n.updateContext)?e.call(this,t):this.state.exprAllowed=n.beforeExpr},t}();n["default"]=d},{809:809,811:811,812:812,813:813,814:814,815:815,819:819,821:821}],811:[function(t,e,n){"use strict";var r=t(819)["default"];n.__esModule=!0;var i=t(814),s=t(809),a=t(812),o=function(){function t(){r(this,t)}return t.prototype.init=function(t,e){return this.strict=t.strictMode===!1?!1:"module"===t.sourceType,this.input=e,this.potentialArrowAt=-1,this.inMethod=this.inFunction=this.inGenerator=this.inAsync=!1,this.labels=[],this.decorators=[],this.tokens=[],this.comments=[],this.trailingComments=[],this.leadingComments=[],this.commentStack=[],this.pos=this.lineStart=0,this.curLine=1,this.type=a.types.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=[s.types.b_stat],this.exprAllowed=!0,this.containsEsc=this.containsOctal=!1,this.octalPosition=null,this},t.prototype.curPosition=function(){return new i.Position(this.curLine,this.pos-this.lineStart)},t.prototype.clone=function(e){var n=new t;for(var r in this){var i=this[r];e&&"context"!==r||!Array.isArray(i)||(i=i.slice()),n[r]=i}return n},t}();n["default"]=o,e.exports=n["default"]},{809:809,812:812,814:814,819:819}],812:[function(t,e,n){"use strict";function r(t,e){return new a(t,{beforeExpr:!0,binop:e})}function i(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];e.keyword=t,l[t]=p["_"+t]=new a(t,e)}var s=t(819)["default"];n.__esModule=!0;var a=function c(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];s(this,c),this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.rightAssociative=!!e.rightAssociative,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop||null,this.updateContext=null};n.TokenType=a;var o={beforeExpr:!0},u={startsExpr:!0},p={num:new a("num",u),regexp:new a("regexp",u),string:new a("string",u),name:new a("name",u),eof:new a("eof"),bracketL:new a("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new a("]"),braceL:new a("{",{beforeExpr:!0,startsExpr:!0}),braceR:new a("}"),parenL:new a("(",{beforeExpr:!0,startsExpr:!0}),parenR:new a(")"),comma:new a(",",o),semi:new a(";",o),colon:new a(":",o),doubleColon:new a("::",o),dot:new a("."),question:new a("?",o),arrow:new a("=>",o),template:new a("template"),ellipsis:new a("...",o),backQuote:new a("`",u),dollarBraceL:new a("${",{beforeExpr:!0,startsExpr:!0}),at:new a("@"),eq:new a("=",{beforeExpr:!0,isAssign:!0}),assign:new a("_=",{beforeExpr:!0,isAssign:!0}),incDec:new a("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new a("prefix",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:r("||",1),logicalAND:r("&&",2),bitwiseOR:r("|",3),bitwiseXOR:r("^",4),bitwiseAND:r("&",5),equality:r("==/!=",6),relational:r("</>",7),bitShift:r("<</>>",8),plusMin:new a("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:r("%",10),star:r("*",10),slash:r("/",10),exponent:new a("**",{beforeExpr:!0,binop:11,rightAssociative:!0})};n.types=p;var l={};n.keywords=l,i("break"),i("case",o),i("catch"),i("continue"),i("debugger"),i("default",o),i("do",{isLoop:!0,beforeExpr:!0}),i("else",o),i("finally"),i("for",{isLoop:!0}),i("function",u),i("if"),i("return",o),i("switch"),i("throw",o),i("try"),i("var"),i("let"),i("const"),i("while",{isLoop:!0}),i("with"),i("new",{beforeExpr:!0,startsExpr:!0}),i("this",u),i("super",u),i("class"),i("extends",o),i("export"),i("import"),i("yield",{beforeExpr:!0,startsExpr:!0}),i("null",u),i("true",u),i("false",u),i("in",{beforeExpr:!0,binop:7}),i("instanceof",{beforeExpr:!0,binop:7}),i("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),i("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),i("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},{819:819}],813:[function(t,e,n){"use strict";function r(t){return t=t.split(" "),function(e){return t.indexOf(e)>=0}}function i(t,e){for(var n=65536,r=0;r<e.length;r+=2){if(n+=e[r],n>t)return!1;if(n+=e[r+1],n>=t)return!0}}function s(t){return 65>t?36===t:91>t?!0:97>t?95===t:123>t?!0:65535>=t?t>=170&&c.test(String.fromCharCode(t)):i(t,h)}function a(t){return 48>t?36===t:58>t?!0:65>t?!1:91>t?!0:97>t?95===t:123>t?!0:65535>=t?t>=170&&f.test(String.fromCharCode(t)):i(t,h)||i(t,d)}n.__esModule=!0,n.isIdentifierStart=s,n.isIdentifierChar=a;var o={6:r("enum await"),strict:r("implements interface let package private protected public static yield"),strictBind:r("eval arguments")};n.reservedWords=o;var u=r("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super");n.isKeyword=u;var p="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",l="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_",c=new RegExp("["+p+"]"),f=new RegExp("["+p+l+"]");p=l=null;var h=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,99,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,98,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,955,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,38,17,2,24,133,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,32,4,287,47,21,1,2,0,185,46,82,47,21,0,60,42,502,63,32,0,449,56,1288,920,104,110,2962,1070,13266,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,16481,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,1340,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,16355,541],d=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,16,9,83,11,168,11,6,9,8,2,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,316,19,13,9,214,6,3,8,112,16,16,9,82,12,9,9,535,9,20855,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,4305,6,792618,239];
},{}],814:[function(t,e,n){"use strict";function r(t,e){for(var n=1,r=0;;){s.lineBreakG.lastIndex=r;var i=s.lineBreakG.exec(t);if(!(i&&i.index<e))return new a(n,e-r);++n,r=i.index+i[0].length}}var i=t(819)["default"];n.__esModule=!0,n.getLineInfo=r;var s=t(815),a=function u(t,e){i(this,u),this.line=t,this.column=e};n.Position=a;var o=function p(t,e){i(this,p),this.start=t,this.end=e};n.SourceLocation=o},{815:815,819:819}],815:[function(t,e,n){"use strict";function r(t){return 10===t||13===t||8232===t||8233===t}n.__esModule=!0,n.isNewLine=r;var i=/\r\n?|\n|\u2028|\u2029/;n.lineBreak=i;var s=new RegExp(i.source,"g");n.lineBreakG=s;var a=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;n.nonASCIIwhitespace=a},{}],816:[function(t,e,n){arguments[4][55][0].apply(n,arguments)},{55:55,822:822}],817:[function(t,e,n){arguments[4][57][0].apply(n,arguments)},{57:57,823:823}],818:[function(t,e,n){arguments[4][61][0].apply(n,arguments)},{61:61,824:824}],819:[function(t,e,n){arguments[4][62][0].apply(n,arguments)},{62:62}],820:[function(t,e,n){arguments[4][64][0].apply(n,arguments)},{64:64,817:817,818:818}],821:[function(t,e,n){arguments[4][15][0].apply(n,arguments)},{15:15}],822:[function(t,e,n){arguments[4][77][0].apply(n,arguments)},{77:77,858:858,861:861,862:862}],823:[function(t,e,n){arguments[4][79][0].apply(n,arguments)},{79:79,845:845}],824:[function(t,e,n){arguments[4][83][0].apply(n,arguments)},{83:83,830:830,860:860}],825:[function(t,e,n){arguments[4][84][0].apply(n,arguments)},{84:84}],826:[function(t,e,n){arguments[4][85][0].apply(n,arguments)},{85:85}],827:[function(t,e,n){arguments[4][86][0].apply(n,arguments)},{840:840,86:86}],828:[function(t,e,n){arguments[4][87][0].apply(n,arguments)},{829:829,856:856,87:87}],829:[function(t,e,n){arguments[4][88][0].apply(n,arguments)},{88:88}],830:[function(t,e,n){arguments[4][92][0].apply(n,arguments)},{92:92}],831:[function(t,e,n){arguments[4][93][0].apply(n,arguments)},{825:825,93:93}],832:[function(t,e,n){arguments[4][94][0].apply(n,arguments)},{94:94}],833:[function(t,e,n){arguments[4][95][0].apply(n,arguments)},{835:835,95:95}],834:[function(t,e,n){arguments[4][96][0].apply(n,arguments)},{830:830,831:831,836:836,96:96}],835:[function(t,e,n){arguments[4][97][0].apply(n,arguments)},{97:97}],836:[function(t,e,n){arguments[4][100][0].apply(n,arguments)},{100:100}],837:[function(t,e,n){arguments[4][101][0].apply(n,arguments)},{101:101}],838:[function(t,e,n){arguments[4][102][0].apply(n,arguments)},{102:102,833:833,845:845,847:847}],839:[function(t,e,n){arguments[4][103][0].apply(n,arguments)},{103:103,829:829}],840:[function(t,e,n){arguments[4][105][0].apply(n,arguments)},{105:105}],841:[function(t,e,n){arguments[4][107][0].apply(n,arguments)},{107:107,838:838,845:845,847:847,850:850,856:856}],842:[function(t,e,n){arguments[4][108][0].apply(n,arguments)},{108:108,834:834,837:837,838:838,841:841,844:844,845:845,846:846,848:848,850:850,856:856}],843:[function(t,e,n){arguments[4][109][0].apply(n,arguments)},{109:109}],844:[function(t,e,n){arguments[4][110][0].apply(n,arguments)},{110:110}],845:[function(t,e,n){arguments[4][111][0].apply(n,arguments)},{111:111}],846:[function(t,e,n){arguments[4][112][0].apply(n,arguments)},{112:112}],847:[function(t,e,n){arguments[4][114][0].apply(n,arguments)},{114:114}],848:[function(t,e,n){arguments[4][116][0].apply(n,arguments)},{116:116,838:838}],849:[function(t,e,n){arguments[4][117][0].apply(n,arguments)},{117:117,827:827,831:831,840:840,845:845}],850:[function(t,e,n){arguments[4][119][0].apply(n,arguments)},{119:119,837:837,845:845,856:856}],851:[function(t,e,n){arguments[4][120][0].apply(n,arguments)},{120:120,836:836}],852:[function(t,e,n){arguments[4][122][0].apply(n,arguments)},{122:122,832:832,853:853}],853:[function(t,e,n){arguments[4][123][0].apply(n,arguments)},{123:123}],854:[function(t,e,n){arguments[4][124][0].apply(n,arguments)},{124:124,832:832,839:839}],855:[function(t,e,n){arguments[4][126][0].apply(n,arguments)},{126:126}],856:[function(t,e,n){arguments[4][127][0].apply(n,arguments)},{127:127,836:836,851:851,855:855}],857:[function(t,e,n){arguments[4][128][0].apply(n,arguments)},{128:128,828:828,830:830,844:844,856:856}],858:[function(t,e,n){arguments[4][129][0].apply(n,arguments)},{129:129,827:827,830:830,857:857}],859:[function(t,e,n){arguments[4][130][0].apply(n,arguments)},{130:130,826:826,842:842,843:843,844:844,854:854}],860:[function(t,e,n){arguments[4][134][0].apply(n,arguments)},{134:134,834:834,849:849}],861:[function(t,e,n){arguments[4][136][0].apply(n,arguments)},{136:136,842:842,852:852}],862:[function(t,e,n){arguments[4][138][0].apply(n,arguments)},{138:138,844:844,859:859}]},{},[31])(31)});
|
ajax/libs/raven.js/3.25.0/console,require,vue/raven.js
|
cdnjs/cdnjs
|
/*! Raven.js 3.25.0 (80dffad) | github.com/getsentry/raven-js */
/*
* Includes TraceKit
* https://github.com/getsentry/TraceKit
*
* Copyright 2018 Matt Robenolt and other contributors
* Released under the BSD license
* https://github.com/getsentry/raven-js/blob/master/LICENSE
*
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Raven = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/**
* console plugin
*
* Monkey patches console.* calls into Sentry messages with
* their appropriate log levels. (Experimental)
*
* Options:
*
* `levels`: An array of levels (methods on `console`) to report to Sentry.
* Defaults to debug, info, warn, and error.
*/
var wrapConsoleMethod = _dereq_(5).wrapMethod;
function consolePlugin(Raven, console, pluginOptions) {
console = console || window.console || {};
pluginOptions = pluginOptions || {};
var logLevels = pluginOptions.levels || ['debug', 'info', 'warn', 'error'];
if ('assert' in console) logLevels.push('assert');
var callback = function(msg, data) {
Raven.captureMessage(msg, data);
};
var level = logLevels.pop();
while (level) {
wrapConsoleMethod(console, level, callback);
level = logLevels.pop();
}
}
module.exports = consolePlugin;
_dereq_(7).addPlugin(module.exports);
},{"5":5,"7":7}],2:[function(_dereq_,module,exports){
/*global define*/
/**
* require.js plugin
*
* Automatically wrap define/require callbacks. (Experimental)
*/
function requirePlugin(Raven) {
if (typeof define === 'function' && define.amd) {
window.define = Raven.wrap({deep: false}, define);
window.require = Raven.wrap({deep: false}, _dereq_);
}
}
module.exports = requirePlugin;
_dereq_(7).addPlugin(module.exports);
},{"7":7}],3:[function(_dereq_,module,exports){
/**
* Vue.js 2.0 plugin
*
*/
function formatComponentName(vm) {
if (vm.$root === vm) {
return 'root instance';
}
var name = vm._isVue ? vm.$options.name || vm.$options._componentTag : vm.name;
return (
(name ? 'component <' + name + '>' : 'anonymous component') +
(vm._isVue && vm.$options.__file ? ' at ' + vm.$options.__file : '')
);
}
function vuePlugin(Raven, Vue) {
Vue = Vue || window.Vue;
// quit if Vue isn't on the page
if (!Vue || !Vue.config) return;
var _oldOnError = Vue.config.errorHandler;
Vue.config.errorHandler = function VueErrorHandler(error, vm, info) {
var metaData = {};
// vm and lifecycleHook are not always available
if (Object.prototype.toString.call(vm) === '[object Object]') {
metaData.componentName = formatComponentName(vm);
metaData.propsData = vm.$options.propsData;
}
if (typeof info !== 'undefined') {
metaData.lifecycleHook = info;
}
Raven.captureException(error, {
extra: metaData
});
if (typeof _oldOnError === 'function') {
_oldOnError.call(this, error, vm, info);
}
};
}
module.exports = vuePlugin;
_dereq_(7).addPlugin(module.exports);
},{"7":7}],4:[function(_dereq_,module,exports){
function RavenConfigError(message) {
this.name = 'RavenConfigError';
this.message = message;
}
RavenConfigError.prototype = new Error();
RavenConfigError.prototype.constructor = RavenConfigError;
module.exports = RavenConfigError;
},{}],5:[function(_dereq_,module,exports){
var utils = _dereq_(8);
var wrapMethod = function(console, level, callback) {
var originalConsoleLevel = console[level];
var originalConsole = console;
if (!(level in console)) {
return;
}
var sentryLevel = level === 'warn' ? 'warning' : level;
console[level] = function() {
var args = [].slice.call(arguments);
var msg = utils.safeJoin(args, ' ');
var data = {level: sentryLevel, logger: 'console', extra: {arguments: args}};
if (level === 'assert') {
if (args[0] === false) {
// Default browsers message
msg =
'Assertion failed: ' + (utils.safeJoin(args.slice(1), ' ') || 'console.assert');
data.extra.arguments = args.slice(1);
callback && callback(msg, data);
}
} else {
callback && callback(msg, data);
}
// this fails for some browsers. :(
if (originalConsoleLevel) {
// IE9 doesn't allow calling apply on console functions directly
// See: https://stackoverflow.com/questions/5472938/does-ie9-support-console-log-and-is-it-a-real-function#answer-5473193
Function.prototype.apply.call(originalConsoleLevel, originalConsole, args);
}
};
};
module.exports = {
wrapMethod: wrapMethod
};
},{"8":8}],6:[function(_dereq_,module,exports){
(function (global){
/*global XDomainRequest:false */
var TraceKit = _dereq_(9);
var stringify = _dereq_(10);
var md5 = _dereq_(11);
var RavenConfigError = _dereq_(4);
var utils = _dereq_(8);
var isErrorEvent = utils.isErrorEvent;
var isDOMError = utils.isDOMError;
var isDOMException = utils.isDOMException;
var isError = utils.isError;
var isObject = utils.isObject;
var isPlainObject = utils.isPlainObject;
var isUndefined = utils.isUndefined;
var isFunction = utils.isFunction;
var isString = utils.isString;
var isArray = utils.isArray;
var isEmptyObject = utils.isEmptyObject;
var each = utils.each;
var objectMerge = utils.objectMerge;
var truncate = utils.truncate;
var objectFrozen = utils.objectFrozen;
var hasKey = utils.hasKey;
var joinRegExp = utils.joinRegExp;
var urlencode = utils.urlencode;
var uuid4 = utils.uuid4;
var htmlTreeAsString = utils.htmlTreeAsString;
var isSameException = utils.isSameException;
var isSameStacktrace = utils.isSameStacktrace;
var parseUrl = utils.parseUrl;
var fill = utils.fill;
var supportsFetch = utils.supportsFetch;
var supportsReferrerPolicy = utils.supportsReferrerPolicy;
var serializeKeysForMessage = utils.serializeKeysForMessage;
var serializeException = utils.serializeException;
var sanitize = utils.sanitize;
var wrapConsoleMethod = _dereq_(5).wrapMethod;
var dsnKeys = 'source protocol user pass host port path'.split(' '),
dsnPattern = /^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/;
function now() {
return +new Date();
}
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
var _window =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var _document = _window.document;
var _navigator = _window.navigator;
function keepOriginalCallback(original, callback) {
return isFunction(callback)
? function(data) {
return callback(data, original);
}
: callback;
}
// First, check for JSON support
// If there is no JSON, we no-op the core features of Raven
// since JSON is required to encode the payload
function Raven() {
this._hasJSON = !!(typeof JSON === 'object' && JSON.stringify);
// Raven can run in contexts where there's no document (react-native)
this._hasDocument = !isUndefined(_document);
this._hasNavigator = !isUndefined(_navigator);
this._lastCapturedException = null;
this._lastData = null;
this._lastEventId = null;
this._globalServer = null;
this._globalKey = null;
this._globalProject = null;
this._globalContext = {};
this._globalOptions = {
// SENTRY_RELEASE can be injected by https://github.com/getsentry/sentry-webpack-plugin
release: _window.SENTRY_RELEASE && _window.SENTRY_RELEASE.id,
logger: 'javascript',
ignoreErrors: [],
ignoreUrls: [],
whitelistUrls: [],
includePaths: [],
headers: null,
collectWindowErrors: true,
captureUnhandledRejections: true,
maxMessageLength: 0,
// By default, truncates URL values to 250 chars
maxUrlLength: 250,
stackTraceLimit: 50,
autoBreadcrumbs: true,
instrument: true,
sampleRate: 1,
sanitizeKeys: []
};
this._fetchDefaults = {
method: 'POST',
keepalive: true,
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default
// https://caniuse.com/#feat=referrer-policy
// It doesn't. And it throw exception instead of ignoring this parameter...
// REF: https://github.com/getsentry/raven-js/issues/1233
referrerPolicy: supportsReferrerPolicy() ? 'origin' : ''
};
this._ignoreOnError = 0;
this._isRavenInstalled = false;
this._originalErrorStackTraceLimit = Error.stackTraceLimit;
// capture references to window.console *and* all its methods first
// before the console plugin has a chance to monkey patch
this._originalConsole = _window.console || {};
this._originalConsoleMethods = {};
this._plugins = [];
this._startTime = now();
this._wrappedBuiltIns = [];
this._breadcrumbs = [];
this._lastCapturedEvent = null;
this._keypressTimeout;
this._location = _window.location;
this._lastHref = this._location && this._location.href;
this._resetBackoff();
// eslint-disable-next-line guard-for-in
for (var method in this._originalConsole) {
this._originalConsoleMethods[method] = this._originalConsole[method];
}
}
/*
* The core Raven singleton
*
* @this {Raven}
*/
Raven.prototype = {
// Hardcode version string so that raven source can be loaded directly via
// webpack (using a build step causes webpack #1617). Grunt verifies that
// this value matches package.json during build.
// See: https://github.com/getsentry/raven-js/issues/465
VERSION: '3.25.0',
debug: false,
TraceKit: TraceKit, // alias to TraceKit
/*
* Configure Raven with a DSN and extra options
*
* @param {string} dsn The public Sentry DSN
* @param {object} options Set of global options [optional]
* @return {Raven}
*/
config: function(dsn, options) {
var self = this;
if (self._globalServer) {
this._logDebug('error', 'Error: Raven has already been configured');
return self;
}
if (!dsn) return self;
var globalOptions = self._globalOptions;
// merge in options
if (options) {
each(options, function(key, value) {
// tags and extra are special and need to be put into context
if (key === 'tags' || key === 'extra' || key === 'user') {
self._globalContext[key] = value;
} else {
globalOptions[key] = value;
}
});
}
self.setDSN(dsn);
// "Script error." is hard coded into browsers for errors that it can't read.
// this is the result of a script being pulled in from an external domain and CORS.
globalOptions.ignoreErrors.push(/^Script error\.?$/);
globalOptions.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/);
// join regexp rules into one big rule
globalOptions.ignoreErrors = joinRegExp(globalOptions.ignoreErrors);
globalOptions.ignoreUrls = globalOptions.ignoreUrls.length
? joinRegExp(globalOptions.ignoreUrls)
: false;
globalOptions.whitelistUrls = globalOptions.whitelistUrls.length
? joinRegExp(globalOptions.whitelistUrls)
: false;
globalOptions.includePaths = joinRegExp(globalOptions.includePaths);
globalOptions.maxBreadcrumbs = Math.max(
0,
Math.min(globalOptions.maxBreadcrumbs || 100, 100)
); // default and hard limit is 100
var autoBreadcrumbDefaults = {
xhr: true,
console: true,
dom: true,
location: true,
sentry: true
};
var autoBreadcrumbs = globalOptions.autoBreadcrumbs;
if ({}.toString.call(autoBreadcrumbs) === '[object Object]') {
autoBreadcrumbs = objectMerge(autoBreadcrumbDefaults, autoBreadcrumbs);
} else if (autoBreadcrumbs !== false) {
autoBreadcrumbs = autoBreadcrumbDefaults;
}
globalOptions.autoBreadcrumbs = autoBreadcrumbs;
var instrumentDefaults = {
tryCatch: true
};
var instrument = globalOptions.instrument;
if ({}.toString.call(instrument) === '[object Object]') {
instrument = objectMerge(instrumentDefaults, instrument);
} else if (instrument !== false) {
instrument = instrumentDefaults;
}
globalOptions.instrument = instrument;
TraceKit.collectWindowErrors = !!globalOptions.collectWindowErrors;
// return for chaining
return self;
},
/*
* Installs a global window.onerror error handler
* to capture and report uncaught exceptions.
* At this point, install() is required to be called due
* to the way TraceKit is set up.
*
* @return {Raven}
*/
install: function() {
var self = this;
if (self.isSetup() && !self._isRavenInstalled) {
TraceKit.report.subscribe(function() {
self._handleOnErrorStackInfo.apply(self, arguments);
});
if (self._globalOptions.captureUnhandledRejections) {
self._attachPromiseRejectionHandler();
}
self._patchFunctionToString();
if (self._globalOptions.instrument && self._globalOptions.instrument.tryCatch) {
self._instrumentTryCatch();
}
if (self._globalOptions.autoBreadcrumbs) self._instrumentBreadcrumbs();
// Install all of the plugins
self._drainPlugins();
self._isRavenInstalled = true;
}
Error.stackTraceLimit = self._globalOptions.stackTraceLimit;
return this;
},
/*
* Set the DSN (can be called multiple time unlike config)
*
* @param {string} dsn The public Sentry DSN
*/
setDSN: function(dsn) {
var self = this,
uri = self._parseDSN(dsn),
lastSlash = uri.path.lastIndexOf('/'),
path = uri.path.substr(1, lastSlash);
self._dsn = dsn;
self._globalKey = uri.user;
self._globalSecret = uri.pass && uri.pass.substr(1);
self._globalProject = uri.path.substr(lastSlash + 1);
self._globalServer = self._getGlobalServer(uri);
self._globalEndpoint =
self._globalServer + '/' + path + 'api/' + self._globalProject + '/store/';
// Reset backoff state since we may be pointing at a
// new project/server
this._resetBackoff();
},
/*
* Wrap code within a context so Raven can capture errors
* reliably across domains that is executed immediately.
*
* @param {object} options A specific set of options for this context [optional]
* @param {function} func The callback to be immediately executed within the context
* @param {array} args An array of arguments to be called with the callback [optional]
*/
context: function(options, func, args) {
if (isFunction(options)) {
args = func || [];
func = options;
options = undefined;
}
return this.wrap(options, func).apply(this, args);
},
/*
* Wrap code within a context and returns back a new function to be executed
*
* @param {object} options A specific set of options for this context [optional]
* @param {function} func The function to be wrapped in a new context
* @param {function} func A function to call before the try/catch wrapper [optional, private]
* @return {function} The newly wrapped functions with a context
*/
wrap: function(options, func, _before) {
var self = this;
// 1 argument has been passed, and it's not a function
// so just return it
if (isUndefined(func) && !isFunction(options)) {
return options;
}
// options is optional
if (isFunction(options)) {
func = options;
options = undefined;
}
// At this point, we've passed along 2 arguments, and the second one
// is not a function either, so we'll just return the second argument.
if (!isFunction(func)) {
return func;
}
// We don't wanna wrap it twice!
try {
if (func.__raven__) {
return func;
}
// If this has already been wrapped in the past, return that
if (func.__raven_wrapper__) {
return func.__raven_wrapper__;
}
} catch (e) {
// Just accessing custom props in some Selenium environments
// can cause a "Permission denied" exception (see raven-js#495).
// Bail on wrapping and return the function as-is (defers to window.onerror).
return func;
}
function wrapped() {
var args = [],
i = arguments.length,
deep = !options || (options && options.deep !== false);
if (_before && isFunction(_before)) {
_before.apply(this, arguments);
}
// Recursively wrap all of a function's arguments that are
// functions themselves.
while (i--) args[i] = deep ? self.wrap(options, arguments[i]) : arguments[i];
try {
// Attempt to invoke user-land function
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it
// means Raven caught an error invoking your application code. This is
// expected behavior and NOT indicative of a bug with Raven.js.
return func.apply(this, args);
} catch (e) {
self._ignoreNextOnError();
self.captureException(e, options);
throw e;
}
}
// copy over properties of the old function
for (var property in func) {
if (hasKey(func, property)) {
wrapped[property] = func[property];
}
}
wrapped.prototype = func.prototype;
func.__raven_wrapper__ = wrapped;
// Signal that this function has been wrapped/filled already
// for both debugging and to prevent it to being wrapped/filled twice
wrapped.__raven__ = true;
wrapped.__orig__ = func;
return wrapped;
},
/**
* Uninstalls the global error handler.
*
* @return {Raven}
*/
uninstall: function() {
TraceKit.report.uninstall();
this._detachPromiseRejectionHandler();
this._unpatchFunctionToString();
this._restoreBuiltIns();
this._restoreConsole();
Error.stackTraceLimit = this._originalErrorStackTraceLimit;
this._isRavenInstalled = false;
return this;
},
/**
* Callback used for `unhandledrejection` event
*
* @param {PromiseRejectionEvent} event An object containing
* promise: the Promise that was rejected
* reason: the value with which the Promise was rejected
* @return void
*/
_promiseRejectionHandler: function(event) {
this._logDebug('debug', 'Raven caught unhandled promise rejection:', event);
this.captureException(event.reason, {
extra: {
unhandledPromiseRejection: true
}
});
},
/**
* Installs the global promise rejection handler.
*
* @return {raven}
*/
_attachPromiseRejectionHandler: function() {
this._promiseRejectionHandler = this._promiseRejectionHandler.bind(this);
_window.addEventListener &&
_window.addEventListener('unhandledrejection', this._promiseRejectionHandler);
return this;
},
/**
* Uninstalls the global promise rejection handler.
*
* @return {raven}
*/
_detachPromiseRejectionHandler: function() {
_window.removeEventListener &&
_window.removeEventListener('unhandledrejection', this._promiseRejectionHandler);
return this;
},
/**
* Manually capture an exception and send it over to Sentry
*
* @param {error} ex An exception to be logged
* @param {object} options A specific set of options for this error [optional]
* @return {Raven}
*/
captureException: function(ex, options) {
options = objectMerge({trimHeadFrames: 0}, options ? options : {});
if (isErrorEvent(ex) && ex.error) {
// If it is an ErrorEvent with `error` property, extract it to get actual Error
ex = ex.error;
} else if (isDOMError(ex) || isDOMException(ex)) {
// If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)
// then we just extract the name and message, as they don't provide anything else
// https://developer.mozilla.org/en-US/docs/Web/API/DOMError
// https://developer.mozilla.org/en-US/docs/Web/API/DOMException
var name = ex.name || (isDOMError(ex) ? 'DOMError' : 'DOMException');
var message = ex.message ? name + ': ' + ex.message : name;
return this.captureMessage(
message,
objectMerge(options, {
// neither DOMError or DOMException provide stack trace and we most likely wont get it this way as well
// but it's barely any overhead so we may at least try
stacktrace: true,
trimHeadFrames: options.trimHeadFrames + 1
})
);
} else if (isError(ex)) {
// we have a real Error object
ex = ex;
} else if (isPlainObject(ex)) {
// If it is plain Object, serialize it manually and extract options
// This will allow us to group events based on top-level keys
// which is much better than creating new group when any key/value change
options = this._getCaptureExceptionOptionsFromPlainObject(options, ex);
ex = new Error(options.message);
} else {
// If none of previous checks were valid, then it means that
// it's not a DOMError/DOMException
// it's not a plain Object
// it's not a valid ErrorEvent (one with an error property)
// it's not an Error
// So bail out and capture it as a simple message:
return this.captureMessage(
ex,
objectMerge(options, {
stacktrace: true, // if we fall back to captureMessage, default to attempting a new trace
trimHeadFrames: options.trimHeadFrames + 1
})
);
}
// Store the raw exception object for potential debugging and introspection
this._lastCapturedException = ex;
// TraceKit.report will re-raise any exception passed to it,
// which means you have to wrap it in try/catch. Instead, we
// can wrap it here and only re-raise if TraceKit.report
// raises an exception different from the one we asked to
// report on.
try {
var stack = TraceKit.computeStackTrace(ex);
this._handleStackInfo(stack, options);
} catch (ex1) {
if (ex !== ex1) {
throw ex1;
}
}
return this;
},
_getCaptureExceptionOptionsFromPlainObject: function(currentOptions, ex) {
var exKeys = Object.keys(ex).sort();
var options = objectMerge(currentOptions, {
message:
'Non-Error exception captured with keys: ' + serializeKeysForMessage(exKeys),
fingerprint: [md5(exKeys)],
extra: currentOptions.extra || {}
});
options.extra.__serialized__ = serializeException(ex);
return options;
},
/*
* Manually send a message to Sentry
*
* @param {string} msg A plain message to be captured in Sentry
* @param {object} options A specific set of options for this message [optional]
* @return {Raven}
*/
captureMessage: function(msg, options) {
// config() automagically converts ignoreErrors from a list to a RegExp so we need to test for an
// early call; we'll error on the side of logging anything called before configuration since it's
// probably something you should see:
if (
!!this._globalOptions.ignoreErrors.test &&
this._globalOptions.ignoreErrors.test(msg)
) {
return;
}
options = options || {};
msg = msg + ''; // Make sure it's actually a string
var data = objectMerge(
{
message: msg
},
options
);
var ex;
// Generate a "synthetic" stack trace from this point.
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it is NOT indicative
// of a bug with Raven.js. Sentry generates synthetic traces either by configuration,
// or if it catches a thrown object without a "stack" property.
try {
throw new Error(msg);
} catch (ex1) {
ex = ex1;
}
// null exception name so `Error` isn't prefixed to msg
ex.name = null;
var stack = TraceKit.computeStackTrace(ex);
// stack[0] is `throw new Error(msg)` call itself, we are interested in the frame that was just before that, stack[1]
var initialCall = isArray(stack.stack) && stack.stack[1];
// if stack[1] is `Raven.captureException`, it means that someone passed a string to it and we redirected that call
// to be handled by `captureMessage`, thus `initialCall` is the 3rd one, not 2nd
// initialCall => captureException(string) => captureMessage(string)
if (initialCall && initialCall.func === 'Raven.captureException') {
initialCall = stack.stack[2];
}
var fileurl = (initialCall && initialCall.url) || '';
if (
!!this._globalOptions.ignoreUrls.test &&
this._globalOptions.ignoreUrls.test(fileurl)
) {
return;
}
if (
!!this._globalOptions.whitelistUrls.test &&
!this._globalOptions.whitelistUrls.test(fileurl)
) {
return;
}
if (this._globalOptions.stacktrace || (options && options.stacktrace)) {
// fingerprint on msg, not stack trace (legacy behavior, could be revisited)
data.fingerprint = data.fingerprint == null ? msg : data.fingerprint;
options = objectMerge(
{
trimHeadFrames: 0
},
options
);
// Since we know this is a synthetic trace, the top frame (this function call)
// MUST be from Raven.js, so mark it for trimming
// We add to the trim counter so that callers can choose to trim extra frames, such
// as utility functions.
options.trimHeadFrames += 1;
var frames = this._prepareFrames(stack, options);
data.stacktrace = {
// Sentry expects frames oldest to newest
frames: frames.reverse()
};
}
// Make sure that fingerprint is always wrapped in an array
if (data.fingerprint) {
data.fingerprint = isArray(data.fingerprint)
? data.fingerprint
: [data.fingerprint];
}
// Fire away!
this._send(data);
return this;
},
captureBreadcrumb: function(obj) {
var crumb = objectMerge(
{
timestamp: now() / 1000
},
obj
);
if (isFunction(this._globalOptions.breadcrumbCallback)) {
var result = this._globalOptions.breadcrumbCallback(crumb);
if (isObject(result) && !isEmptyObject(result)) {
crumb = result;
} else if (result === false) {
return this;
}
}
this._breadcrumbs.push(crumb);
if (this._breadcrumbs.length > this._globalOptions.maxBreadcrumbs) {
this._breadcrumbs.shift();
}
return this;
},
addPlugin: function(plugin /*arg1, arg2, ... argN*/) {
var pluginArgs = [].slice.call(arguments, 1);
this._plugins.push([plugin, pluginArgs]);
if (this._isRavenInstalled) {
this._drainPlugins();
}
return this;
},
/*
* Set/clear a user to be sent along with the payload.
*
* @param {object} user An object representing user data [optional]
* @return {Raven}
*/
setUserContext: function(user) {
// Intentionally do not merge here since that's an unexpected behavior.
this._globalContext.user = user;
return this;
},
/*
* Merge extra attributes to be sent along with the payload.
*
* @param {object} extra An object representing extra data [optional]
* @return {Raven}
*/
setExtraContext: function(extra) {
this._mergeContext('extra', extra);
return this;
},
/*
* Merge tags to be sent along with the payload.
*
* @param {object} tags An object representing tags [optional]
* @return {Raven}
*/
setTagsContext: function(tags) {
this._mergeContext('tags', tags);
return this;
},
/*
* Clear all of the context.
*
* @return {Raven}
*/
clearContext: function() {
this._globalContext = {};
return this;
},
/*
* Get a copy of the current context. This cannot be mutated.
*
* @return {object} copy of context
*/
getContext: function() {
// lol javascript
return JSON.parse(stringify(this._globalContext));
},
/*
* Set environment of application
*
* @param {string} environment Typically something like 'production'.
* @return {Raven}
*/
setEnvironment: function(environment) {
this._globalOptions.environment = environment;
return this;
},
/*
* Set release version of application
*
* @param {string} release Typically something like a git SHA to identify version
* @return {Raven}
*/
setRelease: function(release) {
this._globalOptions.release = release;
return this;
},
/*
* Set the dataCallback option
*
* @param {function} callback The callback to run which allows the
* data blob to be mutated before sending
* @return {Raven}
*/
setDataCallback: function(callback) {
var original = this._globalOptions.dataCallback;
this._globalOptions.dataCallback = keepOriginalCallback(original, callback);
return this;
},
/*
* Set the breadcrumbCallback option
*
* @param {function} callback The callback to run which allows filtering
* or mutating breadcrumbs
* @return {Raven}
*/
setBreadcrumbCallback: function(callback) {
var original = this._globalOptions.breadcrumbCallback;
this._globalOptions.breadcrumbCallback = keepOriginalCallback(original, callback);
return this;
},
/*
* Set the shouldSendCallback option
*
* @param {function} callback The callback to run which allows
* introspecting the blob before sending
* @return {Raven}
*/
setShouldSendCallback: function(callback) {
var original = this._globalOptions.shouldSendCallback;
this._globalOptions.shouldSendCallback = keepOriginalCallback(original, callback);
return this;
},
/**
* Override the default HTTP transport mechanism that transmits data
* to the Sentry server.
*
* @param {function} transport Function invoked instead of the default
* `makeRequest` handler.
*
* @return {Raven}
*/
setTransport: function(transport) {
this._globalOptions.transport = transport;
return this;
},
/*
* Get the latest raw exception that was captured by Raven.
*
* @return {error}
*/
lastException: function() {
return this._lastCapturedException;
},
/*
* Get the last event id
*
* @return {string}
*/
lastEventId: function() {
return this._lastEventId;
},
/*
* Determine if Raven is setup and ready to go.
*
* @return {boolean}
*/
isSetup: function() {
if (!this._hasJSON) return false; // needs JSON support
if (!this._globalServer) {
if (!this.ravenNotConfiguredError) {
this.ravenNotConfiguredError = true;
this._logDebug('error', 'Error: Raven has not been configured.');
}
return false;
}
return true;
},
afterLoad: function() {
// TODO: remove window dependence?
// Attempt to initialize Raven on load
var RavenConfig = _window.RavenConfig;
if (RavenConfig) {
this.config(RavenConfig.dsn, RavenConfig.config).install();
}
},
showReportDialog: function(options) {
if (
!_document // doesn't work without a document (React native)
)
return;
options = options || {};
var lastEventId = options.eventId || this.lastEventId();
if (!lastEventId) {
throw new RavenConfigError('Missing eventId');
}
var dsn = options.dsn || this._dsn;
if (!dsn) {
throw new RavenConfigError('Missing DSN');
}
var encode = encodeURIComponent;
var qs = '';
qs += '?eventId=' + encode(lastEventId);
qs += '&dsn=' + encode(dsn);
var user = options.user || this._globalContext.user;
if (user) {
if (user.name) qs += '&name=' + encode(user.name);
if (user.email) qs += '&email=' + encode(user.email);
}
var globalServer = this._getGlobalServer(this._parseDSN(dsn));
var script = _document.createElement('script');
script.async = true;
script.src = globalServer + '/api/embed/error-page/' + qs;
(_document.head || _document.body).appendChild(script);
},
/**** Private functions ****/
_ignoreNextOnError: function() {
var self = this;
this._ignoreOnError += 1;
setTimeout(function() {
// onerror should trigger before setTimeout
self._ignoreOnError -= 1;
});
},
_triggerEvent: function(eventType, options) {
// NOTE: `event` is a native browser thing, so let's avoid conflicting wiht it
var evt, key;
if (!this._hasDocument) return;
options = options || {};
eventType = 'raven' + eventType.substr(0, 1).toUpperCase() + eventType.substr(1);
if (_document.createEvent) {
evt = _document.createEvent('HTMLEvents');
evt.initEvent(eventType, true, true);
} else {
evt = _document.createEventObject();
evt.eventType = eventType;
}
for (key in options)
if (hasKey(options, key)) {
evt[key] = options[key];
}
if (_document.createEvent) {
// IE9 if standards
_document.dispatchEvent(evt);
} else {
// IE8 regardless of Quirks or Standards
// IE9 if quirks
try {
_document.fireEvent('on' + evt.eventType.toLowerCase(), evt);
} catch (e) {
// Do nothing
}
}
},
/**
* Wraps addEventListener to capture UI breadcrumbs
* @param evtName the event name (e.g. "click")
* @returns {Function}
* @private
*/
_breadcrumbEventHandler: function(evtName) {
var self = this;
return function(evt) {
// reset keypress timeout; e.g. triggering a 'click' after
// a 'keypress' will reset the keypress debounce so that a new
// set of keypresses can be recorded
self._keypressTimeout = null;
// It's possible this handler might trigger multiple times for the same
// event (e.g. event propagation through node ancestors). Ignore if we've
// already captured the event.
if (self._lastCapturedEvent === evt) return;
self._lastCapturedEvent = evt;
// try/catch both:
// - accessing evt.target (see getsentry/raven-js#838, #768)
// - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly
// can throw an exception in some circumstances.
var target;
try {
target = htmlTreeAsString(evt.target);
} catch (e) {
target = '<unknown>';
}
self.captureBreadcrumb({
category: 'ui.' + evtName, // e.g. ui.click, ui.input
message: target
});
};
},
/**
* Wraps addEventListener to capture keypress UI events
* @returns {Function}
* @private
*/
_keypressEventHandler: function() {
var self = this,
debounceDuration = 1000; // milliseconds
// TODO: if somehow user switches keypress target before
// debounce timeout is triggered, we will only capture
// a single breadcrumb from the FIRST target (acceptable?)
return function(evt) {
var target;
try {
target = evt.target;
} catch (e) {
// just accessing event properties can throw an exception in some rare circumstances
// see: https://github.com/getsentry/raven-js/issues/838
return;
}
var tagName = target && target.tagName;
// only consider keypress events on actual input elements
// this will disregard keypresses targeting body (e.g. tabbing
// through elements, hotkeys, etc)
if (
!tagName ||
(tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !target.isContentEditable)
)
return;
// record first keypress in a series, but ignore subsequent
// keypresses until debounce clears
var timeout = self._keypressTimeout;
if (!timeout) {
self._breadcrumbEventHandler('input')(evt);
}
clearTimeout(timeout);
self._keypressTimeout = setTimeout(function() {
self._keypressTimeout = null;
}, debounceDuration);
};
},
/**
* Captures a breadcrumb of type "navigation", normalizing input URLs
* @param to the originating URL
* @param from the target URL
* @private
*/
_captureUrlChange: function(from, to) {
var parsedLoc = parseUrl(this._location.href);
var parsedTo = parseUrl(to);
var parsedFrom = parseUrl(from);
// because onpopstate only tells you the "new" (to) value of location.href, and
// not the previous (from) value, we need to track the value of the current URL
// state ourselves
this._lastHref = to;
// Use only the path component of the URL if the URL matches the current
// document (almost all the time when using pushState)
if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host)
to = parsedTo.relative;
if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host)
from = parsedFrom.relative;
this.captureBreadcrumb({
category: 'navigation',
data: {
to: to,
from: from
}
});
},
_patchFunctionToString: function() {
var self = this;
self._originalFunctionToString = Function.prototype.toString;
// eslint-disable-next-line no-extend-native
Function.prototype.toString = function() {
if (typeof this === 'function' && this.__raven__) {
return self._originalFunctionToString.apply(this.__orig__, arguments);
}
return self._originalFunctionToString.apply(this, arguments);
};
},
_unpatchFunctionToString: function() {
if (this._originalFunctionToString) {
// eslint-disable-next-line no-extend-native
Function.prototype.toString = this._originalFunctionToString;
}
},
/**
* Wrap timer functions and event targets to catch errors and provide
* better metadata.
*/
_instrumentTryCatch: function() {
var self = this;
var wrappedBuiltIns = self._wrappedBuiltIns;
function wrapTimeFn(orig) {
return function(fn, t) {
// preserve arity
// Make a copy of the arguments to prevent deoptimization
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
var args = new Array(arguments.length);
for (var i = 0; i < args.length; ++i) {
args[i] = arguments[i];
}
var originalCallback = args[0];
if (isFunction(originalCallback)) {
args[0] = self.wrap(originalCallback);
}
// IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it
// also supports only two arguments and doesn't care what this is, so we
// can just call the original function directly.
if (orig.apply) {
return orig.apply(this, args);
} else {
return orig(args[0], args[1]);
}
};
}
var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs;
function wrapEventTarget(global) {
var proto = _window[global] && _window[global].prototype;
if (proto && proto.hasOwnProperty && proto.hasOwnProperty('addEventListener')) {
fill(
proto,
'addEventListener',
function(orig) {
return function(evtName, fn, capture, secure) {
// preserve arity
try {
if (fn && fn.handleEvent) {
fn.handleEvent = self.wrap(fn.handleEvent);
}
} catch (err) {
// can sometimes get 'Permission denied to access property "handle Event'
}
// More breadcrumb DOM capture ... done here and not in `_instrumentBreadcrumbs`
// so that we don't have more than one wrapper function
var before, clickHandler, keypressHandler;
if (
autoBreadcrumbs &&
autoBreadcrumbs.dom &&
(global === 'EventTarget' || global === 'Node')
) {
// NOTE: generating multiple handlers per addEventListener invocation, should
// revisit and verify we can just use one (almost certainly)
clickHandler = self._breadcrumbEventHandler('click');
keypressHandler = self._keypressEventHandler();
before = function(evt) {
// need to intercept every DOM event in `before` argument, in case that
// same wrapped method is re-used for different events (e.g. mousemove THEN click)
// see #724
if (!evt) return;
var eventType;
try {
eventType = evt.type;
} catch (e) {
// just accessing event properties can throw an exception in some rare circumstances
// see: https://github.com/getsentry/raven-js/issues/838
return;
}
if (eventType === 'click') return clickHandler(evt);
else if (eventType === 'keypress') return keypressHandler(evt);
};
}
return orig.call(
this,
evtName,
self.wrap(fn, undefined, before),
capture,
secure
);
};
},
wrappedBuiltIns
);
fill(
proto,
'removeEventListener',
function(orig) {
return function(evt, fn, capture, secure) {
try {
fn = fn && (fn.__raven_wrapper__ ? fn.__raven_wrapper__ : fn);
} catch (e) {
// ignore, accessing __raven_wrapper__ will throw in some Selenium environments
}
return orig.call(this, evt, fn, capture, secure);
};
},
wrappedBuiltIns
);
}
}
fill(_window, 'setTimeout', wrapTimeFn, wrappedBuiltIns);
fill(_window, 'setInterval', wrapTimeFn, wrappedBuiltIns);
if (_window.requestAnimationFrame) {
fill(
_window,
'requestAnimationFrame',
function(orig) {
return function(cb) {
return orig(self.wrap(cb));
};
},
wrappedBuiltIns
);
}
// event targets borrowed from bugsnag-js:
// https://github.com/bugsnag/bugsnag-js/blob/master/src/bugsnag.js#L666
var eventTargets = [
'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 (var i = 0; i < eventTargets.length; i++) {
wrapEventTarget(eventTargets[i]);
}
},
/**
* Instrument browser built-ins w/ breadcrumb capturing
* - XMLHttpRequests
* - DOM interactions (click/typing)
* - window.location changes
* - console
*
* Can be disabled or individually configured via the `autoBreadcrumbs` config option
*/
_instrumentBreadcrumbs: function() {
var self = this;
var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs;
var wrappedBuiltIns = self._wrappedBuiltIns;
function wrapProp(prop, xhr) {
if (prop in xhr && isFunction(xhr[prop])) {
fill(xhr, prop, function(orig) {
return self.wrap(orig);
}); // intentionally don't track filled methods on XHR instances
}
}
if (autoBreadcrumbs.xhr && 'XMLHttpRequest' in _window) {
var xhrproto = _window.XMLHttpRequest && _window.XMLHttpRequest.prototype;
fill(
xhrproto,
'open',
function(origOpen) {
return function(method, url) {
// preserve arity
// if Sentry key appears in URL, don't capture
if (isString(url) && url.indexOf(self._globalKey) === -1) {
this.__raven_xhr = {
method: method,
url: url,
status_code: null
};
}
return origOpen.apply(this, arguments);
};
},
wrappedBuiltIns
);
fill(
xhrproto,
'send',
function(origSend) {
return function() {
// preserve arity
var xhr = this;
function onreadystatechangeHandler() {
if (xhr.__raven_xhr && xhr.readyState === 4) {
try {
// touching statusCode in some platforms throws
// an exception
xhr.__raven_xhr.status_code = xhr.status;
} catch (e) {
/* do nothing */
}
self.captureBreadcrumb({
type: 'http',
category: 'xhr',
data: xhr.__raven_xhr
});
}
}
var props = ['onload', 'onerror', 'onprogress'];
for (var j = 0; j < props.length; j++) {
wrapProp(props[j], xhr);
}
if ('onreadystatechange' in xhr && isFunction(xhr.onreadystatechange)) {
fill(
xhr,
'onreadystatechange',
function(orig) {
return self.wrap(orig, undefined, onreadystatechangeHandler);
} /* intentionally don't track this instrumentation */
);
} else {
// if onreadystatechange wasn't actually set by the page on this xhr, we
// are free to set our own and capture the breadcrumb
xhr.onreadystatechange = onreadystatechangeHandler;
}
return origSend.apply(this, arguments);
};
},
wrappedBuiltIns
);
}
if (autoBreadcrumbs.xhr && supportsFetch()) {
fill(
_window,
'fetch',
function(origFetch) {
return function() {
// preserve arity
// Make a copy of the arguments to prevent deoptimization
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
var args = new Array(arguments.length);
for (var i = 0; i < args.length; ++i) {
args[i] = arguments[i];
}
var fetchInput = args[0];
var method = 'GET';
var url;
if (typeof fetchInput === 'string') {
url = fetchInput;
} else if ('Request' in _window && fetchInput instanceof _window.Request) {
url = fetchInput.url;
if (fetchInput.method) {
method = fetchInput.method;
}
} else {
url = '' + fetchInput;
}
// if Sentry key appears in URL, don't capture, as it's our own request
if (url.indexOf(self._globalKey) !== -1) {
return origFetch.apply(this, args);
}
if (args[1] && args[1].method) {
method = args[1].method;
}
var fetchData = {
method: method,
url: url,
status_code: null
};
return origFetch
.apply(this, args)
.then(function(response) {
fetchData.status_code = response.status;
self.captureBreadcrumb({
type: 'http',
category: 'fetch',
data: fetchData
});
return response;
})
['catch'](function(err) {
// if there is an error performing the request
self.captureBreadcrumb({
type: 'http',
category: 'fetch',
data: fetchData,
level: 'error'
});
throw err;
});
};
},
wrappedBuiltIns
);
}
// Capture breadcrumbs from any click that is unhandled / bubbled up all the way
// to the document. Do this before we instrument addEventListener.
if (autoBreadcrumbs.dom && this._hasDocument) {
if (_document.addEventListener) {
_document.addEventListener('click', self._breadcrumbEventHandler('click'), false);
_document.addEventListener('keypress', self._keypressEventHandler(), false);
} else if (_document.attachEvent) {
// IE8 Compatibility
_document.attachEvent('onclick', self._breadcrumbEventHandler('click'));
_document.attachEvent('onkeypress', self._keypressEventHandler());
}
}
// record navigation (URL) changes
// NOTE: in Chrome App environment, touching history.pushState, *even inside
// a try/catch block*, will cause Chrome to output an error to console.error
// borrowed from: https://github.com/angular/angular.js/pull/13945/files
var chrome = _window.chrome;
var isChromePackagedApp = chrome && chrome.app && chrome.app.runtime;
var hasPushAndReplaceState =
!isChromePackagedApp &&
_window.history &&
history.pushState &&
history.replaceState;
if (autoBreadcrumbs.location && hasPushAndReplaceState) {
// TODO: remove onpopstate handler on uninstall()
var oldOnPopState = _window.onpopstate;
_window.onpopstate = function() {
var currentHref = self._location.href;
self._captureUrlChange(self._lastHref, currentHref);
if (oldOnPopState) {
return oldOnPopState.apply(this, arguments);
}
};
var historyReplacementFunction = function(origHistFunction) {
// note history.pushState.length is 0; intentionally not declaring
// params to preserve 0 arity
return function(/* state, title, url */) {
var url = arguments.length > 2 ? arguments[2] : undefined;
// url argument is optional
if (url) {
// coerce to string (this is what pushState does)
self._captureUrlChange(self._lastHref, url + '');
}
return origHistFunction.apply(this, arguments);
};
};
fill(history, 'pushState', historyReplacementFunction, wrappedBuiltIns);
fill(history, 'replaceState', historyReplacementFunction, wrappedBuiltIns);
}
if (autoBreadcrumbs.console && 'console' in _window && console.log) {
// console
var consoleMethodCallback = function(msg, data) {
self.captureBreadcrumb({
message: msg,
level: data.level,
category: 'console'
});
};
each(['debug', 'info', 'warn', 'error', 'log'], function(_, level) {
wrapConsoleMethod(console, level, consoleMethodCallback);
});
}
},
_restoreBuiltIns: function() {
// restore any wrapped builtins
var builtin;
while (this._wrappedBuiltIns.length) {
builtin = this._wrappedBuiltIns.shift();
var obj = builtin[0],
name = builtin[1],
orig = builtin[2];
obj[name] = orig;
}
},
_restoreConsole: function() {
// eslint-disable-next-line guard-for-in
for (var method in this._originalConsoleMethods) {
this._originalConsole[method] = this._originalConsoleMethods[method];
}
},
_drainPlugins: function() {
var self = this;
// FIX ME TODO
each(this._plugins, function(_, plugin) {
var installer = plugin[0];
var args = plugin[1];
installer.apply(self, [self].concat(args));
});
},
_parseDSN: function(str) {
var m = dsnPattern.exec(str),
dsn = {},
i = 7;
try {
while (i--) dsn[dsnKeys[i]] = m[i] || '';
} catch (e) {
throw new RavenConfigError('Invalid DSN: ' + str);
}
if (dsn.pass && !this._globalOptions.allowSecretKey) {
throw new RavenConfigError(
'Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key'
);
}
return dsn;
},
_getGlobalServer: function(uri) {
// assemble the endpoint from the uri pieces
var globalServer = '//' + uri.host + (uri.port ? ':' + uri.port : '');
if (uri.protocol) {
globalServer = uri.protocol + ':' + globalServer;
}
return globalServer;
},
_handleOnErrorStackInfo: function() {
// if we are intentionally ignoring errors via onerror, bail out
if (!this._ignoreOnError) {
this._handleStackInfo.apply(this, arguments);
}
},
_handleStackInfo: function(stackInfo, options) {
var frames = this._prepareFrames(stackInfo, options);
this._triggerEvent('handle', {
stackInfo: stackInfo,
options: options
});
this._processException(
stackInfo.name,
stackInfo.message,
stackInfo.url,
stackInfo.lineno,
frames,
options
);
},
_prepareFrames: function(stackInfo, options) {
var self = this;
var frames = [];
if (stackInfo.stack && stackInfo.stack.length) {
each(stackInfo.stack, function(i, stack) {
var frame = self._normalizeFrame(stack, stackInfo.url);
if (frame) {
frames.push(frame);
}
});
// e.g. frames captured via captureMessage throw
if (options && options.trimHeadFrames) {
for (var j = 0; j < options.trimHeadFrames && j < frames.length; j++) {
frames[j].in_app = false;
}
}
}
frames = frames.slice(0, this._globalOptions.stackTraceLimit);
return frames;
},
_normalizeFrame: function(frame, stackInfoUrl) {
// normalize the frames data
var normalized = {
filename: frame.url,
lineno: frame.line,
colno: frame.column,
function: frame.func || '?'
};
// Case when we don't have any information about the error
// E.g. throwing a string or raw object, instead of an `Error` in Firefox
// Generating synthetic error doesn't add any value here
//
// We should probably somehow let a user know that they should fix their code
if (!frame.url) {
normalized.filename = stackInfoUrl; // fallback to whole stacks url from onerror handler
}
normalized.in_app = !// determine if an exception came from outside of our app
// first we check the global includePaths list.
(
(!!this._globalOptions.includePaths.test &&
!this._globalOptions.includePaths.test(normalized.filename)) ||
// Now we check for fun, if the function name is Raven or TraceKit
/(Raven|TraceKit)\./.test(normalized['function']) ||
// finally, we do a last ditch effort and check for raven.min.js
/raven\.(min\.)?js$/.test(normalized.filename)
);
return normalized;
},
_processException: function(type, message, fileurl, lineno, frames, options) {
var prefixedMessage = (type ? type + ': ' : '') + (message || '');
if (
!!this._globalOptions.ignoreErrors.test &&
(this._globalOptions.ignoreErrors.test(message) ||
this._globalOptions.ignoreErrors.test(prefixedMessage))
) {
return;
}
var stacktrace;
if (frames && frames.length) {
fileurl = frames[0].filename || fileurl;
// Sentry expects frames oldest to newest
// and JS sends them as newest to oldest
frames.reverse();
stacktrace = {frames: frames};
} else if (fileurl) {
stacktrace = {
frames: [
{
filename: fileurl,
lineno: lineno,
in_app: true
}
]
};
}
if (
!!this._globalOptions.ignoreUrls.test &&
this._globalOptions.ignoreUrls.test(fileurl)
) {
return;
}
if (
!!this._globalOptions.whitelistUrls.test &&
!this._globalOptions.whitelistUrls.test(fileurl)
) {
return;
}
var data = objectMerge(
{
// sentry.interfaces.Exception
exception: {
values: [
{
type: type,
value: message,
stacktrace: stacktrace
}
]
},
culprit: fileurl
},
options
);
// Fire away!
this._send(data);
},
_trimPacket: function(data) {
// For now, we only want to truncate the two different messages
// but this could/should be expanded to just trim everything
var max = this._globalOptions.maxMessageLength;
if (data.message) {
data.message = truncate(data.message, max);
}
if (data.exception) {
var exception = data.exception.values[0];
exception.value = truncate(exception.value, max);
}
var request = data.request;
if (request) {
if (request.url) {
request.url = truncate(request.url, this._globalOptions.maxUrlLength);
}
if (request.Referer) {
request.Referer = truncate(request.Referer, this._globalOptions.maxUrlLength);
}
}
if (data.breadcrumbs && data.breadcrumbs.values)
this._trimBreadcrumbs(data.breadcrumbs);
return data;
},
/**
* Truncate breadcrumb values (right now just URLs)
*/
_trimBreadcrumbs: function(breadcrumbs) {
// known breadcrumb properties with urls
// TODO: also consider arbitrary prop values that start with (https?)?://
var urlProps = ['to', 'from', 'url'],
urlProp,
crumb,
data;
for (var i = 0; i < breadcrumbs.values.length; ++i) {
crumb = breadcrumbs.values[i];
if (
!crumb.hasOwnProperty('data') ||
!isObject(crumb.data) ||
objectFrozen(crumb.data)
)
continue;
data = objectMerge({}, crumb.data);
for (var j = 0; j < urlProps.length; ++j) {
urlProp = urlProps[j];
if (data.hasOwnProperty(urlProp) && data[urlProp]) {
data[urlProp] = truncate(data[urlProp], this._globalOptions.maxUrlLength);
}
}
breadcrumbs.values[i].data = data;
}
},
_getHttpData: function() {
if (!this._hasNavigator && !this._hasDocument) return;
var httpData = {};
if (this._hasNavigator && _navigator.userAgent) {
httpData.headers = {
'User-Agent': navigator.userAgent
};
}
// Check in `window` instead of `document`, as we may be in ServiceWorker environment
if (_window.location && _window.location.href) {
httpData.url = _window.location.href;
}
if (this._hasDocument && _document.referrer) {
if (!httpData.headers) httpData.headers = {};
httpData.headers.Referer = _document.referrer;
}
return httpData;
},
_resetBackoff: function() {
this._backoffDuration = 0;
this._backoffStart = null;
},
_shouldBackoff: function() {
return this._backoffDuration && now() - this._backoffStart < this._backoffDuration;
},
/**
* Returns true if the in-process data payload matches the signature
* of the previously-sent data
*
* NOTE: This has to be done at this level because TraceKit can generate
* data from window.onerror WITHOUT an exception object (IE8, IE9,
* other old browsers). This can take the form of an "exception"
* data object with a single frame (derived from the onerror args).
*/
_isRepeatData: function(current) {
var last = this._lastData;
if (
!last ||
current.message !== last.message || // defined for captureMessage
current.culprit !== last.culprit // defined for captureException/onerror
)
return false;
// Stacktrace interface (i.e. from captureMessage)
if (current.stacktrace || last.stacktrace) {
return isSameStacktrace(current.stacktrace, last.stacktrace);
} else if (current.exception || last.exception) {
// Exception interface (i.e. from captureException/onerror)
return isSameException(current.exception, last.exception);
}
return true;
},
_setBackoffState: function(request) {
// If we are already in a backoff state, don't change anything
if (this._shouldBackoff()) {
return;
}
var status = request.status;
// 400 - project_id doesn't exist or some other fatal
// 401 - invalid/revoked dsn
// 429 - too many requests
if (!(status === 400 || status === 401 || status === 429)) return;
var retry;
try {
// If Retry-After is not in Access-Control-Expose-Headers, most
// browsers will throw an exception trying to access it
if (supportsFetch()) {
retry = request.headers.get('Retry-After');
} else {
retry = request.getResponseHeader('Retry-After');
}
// Retry-After is returned in seconds
retry = parseInt(retry, 10) * 1000;
} catch (e) {
/* eslint no-empty:0 */
}
this._backoffDuration = retry
? // If Sentry server returned a Retry-After value, use it
retry
: // Otherwise, double the last backoff duration (starts at 1 sec)
this._backoffDuration * 2 || 1000;
this._backoffStart = now();
},
_send: function(data) {
var globalOptions = this._globalOptions;
var baseData = {
project: this._globalProject,
logger: globalOptions.logger,
platform: 'javascript'
},
httpData = this._getHttpData();
if (httpData) {
baseData.request = httpData;
}
// HACK: delete `trimHeadFrames` to prevent from appearing in outbound payload
if (data.trimHeadFrames) delete data.trimHeadFrames;
data = objectMerge(baseData, data);
// Merge in the tags and extra separately since objectMerge doesn't handle a deep merge
data.tags = objectMerge(objectMerge({}, this._globalContext.tags), data.tags);
data.extra = objectMerge(objectMerge({}, this._globalContext.extra), data.extra);
// Send along our own collected metadata with extra
data.extra['session:duration'] = now() - this._startTime;
if (this._breadcrumbs && this._breadcrumbs.length > 0) {
// intentionally make shallow copy so that additions
// to breadcrumbs aren't accidentally sent in this request
data.breadcrumbs = {
values: [].slice.call(this._breadcrumbs, 0)
};
}
if (this._globalContext.user) {
// sentry.interfaces.User
data.user = this._globalContext.user;
}
// Include the environment if it's defined in globalOptions
if (globalOptions.environment) data.environment = globalOptions.environment;
// Include the release if it's defined in globalOptions
if (globalOptions.release) data.release = globalOptions.release;
// Include server_name if it's defined in globalOptions
if (globalOptions.serverName) data.server_name = globalOptions.serverName;
data = this._sanitizeData(data);
// Cleanup empty properties before sending them to the server
Object.keys(data).forEach(function(key) {
if (data[key] == null || data[key] === '' || isEmptyObject(data[key])) {
delete data[key];
}
});
if (isFunction(globalOptions.dataCallback)) {
data = globalOptions.dataCallback(data) || data;
}
// Why??????????
if (!data || isEmptyObject(data)) {
return;
}
// Check if the request should be filtered or not
if (
isFunction(globalOptions.shouldSendCallback) &&
!globalOptions.shouldSendCallback(data)
) {
return;
}
// Backoff state: Sentry server previously responded w/ an error (e.g. 429 - too many requests),
// so drop requests until "cool-off" period has elapsed.
if (this._shouldBackoff()) {
this._logDebug('warn', 'Raven dropped error due to backoff: ', data);
return;
}
if (typeof globalOptions.sampleRate === 'number') {
if (Math.random() < globalOptions.sampleRate) {
this._sendProcessedPayload(data);
}
} else {
this._sendProcessedPayload(data);
}
},
_sanitizeData: function(data) {
return sanitize(data, this._globalOptions.sanitizeKeys);
},
_getUuid: function() {
return uuid4();
},
_sendProcessedPayload: function(data, callback) {
var self = this;
var globalOptions = this._globalOptions;
if (!this.isSetup()) return;
// Try and clean up the packet before sending by truncating long values
data = this._trimPacket(data);
// ideally duplicate error testing should occur *before* dataCallback/shouldSendCallback,
// but this would require copying an un-truncated copy of the data packet, which can be
// arbitrarily deep (extra_data) -- could be worthwhile? will revisit
if (!this._globalOptions.allowDuplicates && this._isRepeatData(data)) {
this._logDebug('warn', 'Raven dropped repeat event: ', data);
return;
}
// Send along an event_id if not explicitly passed.
// This event_id can be used to reference the error within Sentry itself.
// Set lastEventId after we know the error should actually be sent
this._lastEventId = data.event_id || (data.event_id = this._getUuid());
// Store outbound payload after trim
this._lastData = data;
this._logDebug('debug', 'Raven about to send:', data);
var auth = {
sentry_version: '7',
sentry_client: 'raven-js/' + this.VERSION,
sentry_key: this._globalKey
};
if (this._globalSecret) {
auth.sentry_secret = this._globalSecret;
}
var exception = data.exception && data.exception.values[0];
// only capture 'sentry' breadcrumb is autoBreadcrumbs is truthy
if (
this._globalOptions.autoBreadcrumbs &&
this._globalOptions.autoBreadcrumbs.sentry
) {
this.captureBreadcrumb({
category: 'sentry',
message: exception
? (exception.type ? exception.type + ': ' : '') + exception.value
: data.message,
event_id: data.event_id,
level: data.level || 'error' // presume error unless specified
});
}
var url = this._globalEndpoint;
(globalOptions.transport || this._makeRequest).call(this, {
url: url,
auth: auth,
data: data,
options: globalOptions,
onSuccess: function success() {
self._resetBackoff();
self._triggerEvent('success', {
data: data,
src: url
});
callback && callback();
},
onError: function failure(error) {
self._logDebug('error', 'Raven transport failed to send: ', error);
if (error.request) {
self._setBackoffState(error.request);
}
self._triggerEvent('failure', {
data: data,
src: url
});
error = error || new Error('Raven send failed (no additional details provided)');
callback && callback(error);
}
});
},
_makeRequest: function(opts) {
// Auth is intentionally sent as part of query string (NOT as custom HTTP header) to avoid preflight CORS requests
var url = opts.url + '?' + urlencode(opts.auth);
var evaluatedHeaders = null;
var evaluatedFetchParameters = {};
if (opts.options.headers) {
evaluatedHeaders = this._evaluateHash(opts.options.headers);
}
if (opts.options.fetchParameters) {
evaluatedFetchParameters = this._evaluateHash(opts.options.fetchParameters);
}
if (supportsFetch()) {
evaluatedFetchParameters.body = stringify(opts.data);
var defaultFetchOptions = objectMerge({}, this._fetchDefaults);
var fetchOptions = objectMerge(defaultFetchOptions, evaluatedFetchParameters);
if (evaluatedHeaders) {
fetchOptions.headers = evaluatedHeaders;
}
return _window
.fetch(url, fetchOptions)
.then(function(response) {
if (response.ok) {
opts.onSuccess && opts.onSuccess();
} else {
var error = new Error('Sentry error code: ' + response.status);
// It's called request only to keep compatibility with XHR interface
// and not add more redundant checks in setBackoffState method
error.request = response;
opts.onError && opts.onError(error);
}
})
['catch'](function() {
opts.onError &&
opts.onError(new Error('Sentry error code: network unavailable'));
});
}
var request = _window.XMLHttpRequest && new _window.XMLHttpRequest();
if (!request) return;
// if browser doesn't support CORS (e.g. IE7), we are out of luck
var hasCORS = 'withCredentials' in request || typeof XDomainRequest !== 'undefined';
if (!hasCORS) return;
if ('withCredentials' in request) {
request.onreadystatechange = function() {
if (request.readyState !== 4) {
return;
} else if (request.status === 200) {
opts.onSuccess && opts.onSuccess();
} else if (opts.onError) {
var err = new Error('Sentry error code: ' + request.status);
err.request = request;
opts.onError(err);
}
};
} else {
request = new XDomainRequest();
// xdomainrequest cannot go http -> https (or vice versa),
// so always use protocol relative
url = url.replace(/^https?:/, '');
// onreadystatechange not supported by XDomainRequest
if (opts.onSuccess) {
request.onload = opts.onSuccess;
}
if (opts.onError) {
request.onerror = function() {
var err = new Error('Sentry error code: XDomainRequest');
err.request = request;
opts.onError(err);
};
}
}
request.open('POST', url);
if (evaluatedHeaders) {
each(evaluatedHeaders, function(key, value) {
request.setRequestHeader(key, value);
});
}
request.send(stringify(opts.data));
},
_evaluateHash: function(hash) {
var evaluated = {};
for (var key in hash) {
if (hash.hasOwnProperty(key)) {
var value = hash[key];
evaluated[key] = typeof value === 'function' ? value() : value;
}
}
return evaluated;
},
_logDebug: function(level) {
// We allow `Raven.debug` and `Raven.config(DSN, { debug: true })` to not make backward incompatible API change
if (
this._originalConsoleMethods[level] &&
(this.debug || this._globalOptions.debug)
) {
// In IE<10 console methods do not have their own 'apply' method
Function.prototype.apply.call(
this._originalConsoleMethods[level],
this._originalConsole,
[].slice.call(arguments, 1)
);
}
},
_mergeContext: function(key, context) {
if (isUndefined(context)) {
delete this._globalContext[key];
} else {
this._globalContext[key] = objectMerge(this._globalContext[key] || {}, context);
}
}
};
// Deprecations
Raven.prototype.setUser = Raven.prototype.setUserContext;
Raven.prototype.setReleaseContext = Raven.prototype.setRelease;
module.exports = Raven;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"10":10,"11":11,"4":4,"5":5,"8":8,"9":9}],7:[function(_dereq_,module,exports){
(function (global){
/**
* Enforces a single instance of the Raven client, and the
* main entry point for Raven. If you are a consumer of the
* Raven library, you SHOULD load this file (vs raven.js).
**/
var RavenConstructor = _dereq_(6);
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
var _window =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var _Raven = _window.Raven;
var Raven = new RavenConstructor();
/*
* Allow multiple versions of Raven to be installed.
* Strip Raven from the global context and returns the instance.
*
* @return {Raven}
*/
Raven.noConflict = function() {
_window.Raven = _Raven;
return Raven;
};
Raven.afterLoad();
module.exports = Raven;
/**
* DISCLAIMER:
*
* Expose `Client` constructor for cases where user want to track multiple "sub-applications" in one larger app.
* It's not meant to be used by a wide audience, so pleaaase make sure that you know what you're doing before using it.
* Accidentally calling `install` multiple times, may result in an unexpected behavior that's very hard to debug.
*
* It's called `Client' to be in-line with Raven Node implementation.
*
* HOWTO:
*
* import Raven from 'raven-js';
*
* const someAppReporter = new Raven.Client();
* const someOtherAppReporter = new Raven.Client();
*
* someAppReporter.config('__DSN__', {
* ...config goes here
* });
*
* someOtherAppReporter.config('__OTHER_DSN__', {
* ...config goes here
* });
*
* someAppReporter.captureMessage(...);
* someAppReporter.captureException(...);
* someAppReporter.captureBreadcrumb(...);
*
* someOtherAppReporter.captureMessage(...);
* someOtherAppReporter.captureException(...);
* someOtherAppReporter.captureBreadcrumb(...);
*
* It should "just work".
*/
module.exports.Client = RavenConstructor;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"6":6}],8:[function(_dereq_,module,exports){
(function (global){
var stringify = _dereq_(10);
var _window =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function isObject(what) {
return typeof what === 'object' && what !== null;
}
// Yanked from https://git.io/vS8DV re-used under CC0
// with some tiny modifications
function isError(value) {
switch (Object.prototype.toString.call(value)) {
case '[object Error]':
return true;
case '[object Exception]':
return true;
case '[object DOMException]':
return true;
default:
return value instanceof Error;
}
}
function isErrorEvent(value) {
return Object.prototype.toString.call(value) === '[object ErrorEvent]';
}
function isDOMError(value) {
return Object.prototype.toString.call(value) === '[object DOMError]';
}
function isDOMException(value) {
return Object.prototype.toString.call(value) === '[object DOMException]';
}
function isUndefined(what) {
return what === void 0;
}
function isFunction(what) {
return typeof what === 'function';
}
function isPlainObject(what) {
return Object.prototype.toString.call(what) === '[object Object]';
}
function isString(what) {
return Object.prototype.toString.call(what) === '[object String]';
}
function isArray(what) {
return Object.prototype.toString.call(what) === '[object Array]';
}
function isEmptyObject(what) {
if (!isPlainObject(what)) return false;
for (var _ in what) {
if (what.hasOwnProperty(_)) {
return false;
}
}
return true;
}
function supportsErrorEvent() {
try {
new ErrorEvent(''); // eslint-disable-line no-new
return true;
} catch (e) {
return false;
}
}
function supportsDOMError() {
try {
new DOMError(''); // eslint-disable-line no-new
return true;
} catch (e) {
return false;
}
}
function supportsDOMException() {
try {
new DOMException(''); // eslint-disable-line no-new
return true;
} catch (e) {
return false;
}
}
function supportsFetch() {
if (!('fetch' in _window)) return false;
try {
new Headers(); // eslint-disable-line no-new
new Request(''); // eslint-disable-line no-new
new Response(); // eslint-disable-line no-new
return true;
} catch (e) {
return false;
}
}
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default
// https://caniuse.com/#feat=referrer-policy
// It doesn't. And it throw exception instead of ignoring this parameter...
// REF: https://github.com/getsentry/raven-js/issues/1233
function supportsReferrerPolicy() {
if (!supportsFetch()) return false;
try {
// eslint-disable-next-line no-new
new Request('pickleRick', {
referrerPolicy: 'origin'
});
return true;
} catch (e) {
return false;
}
}
function supportsPromiseRejectionEvent() {
return typeof PromiseRejectionEvent === 'function';
}
function wrappedCallback(callback) {
function dataCallback(data, original) {
var normalizedData = callback(data) || data;
if (original) {
return original(normalizedData) || normalizedData;
}
return normalizedData;
}
return dataCallback;
}
function each(obj, callback) {
var i, j;
if (isUndefined(obj.length)) {
for (i in obj) {
if (hasKey(obj, i)) {
callback.call(null, i, obj[i]);
}
}
} else {
j = obj.length;
if (j) {
for (i = 0; i < j; i++) {
callback.call(null, i, obj[i]);
}
}
}
}
function objectMerge(obj1, obj2) {
if (!obj2) {
return obj1;
}
each(obj2, function(key, value) {
obj1[key] = value;
});
return obj1;
}
/**
* This function is only used for react-native.
* react-native freezes object that have already been sent over the
* js bridge. We need this function in order to check if the object is frozen.
* So it's ok that objectFrozen returns false if Object.isFrozen is not
* supported because it's not relevant for other "platforms". See related issue:
* https://github.com/getsentry/react-native-sentry/issues/57
*/
function objectFrozen(obj) {
if (!Object.isFrozen) {
return false;
}
return Object.isFrozen(obj);
}
function truncate(str, max) {
if (typeof max !== 'number') {
throw new Error('2nd argument to `truncate` function should be a number');
}
if (typeof str !== 'string' || max === 0) {
return str;
}
return str.length <= max ? str : str.substr(0, max) + '\u2026';
}
/**
* hasKey, a better form of hasOwnProperty
* Example: hasKey(MainHostObject, property) === true/false
*
* @param {Object} host object to check property
* @param {string} key to check
*/
function hasKey(object, key) {
return Object.prototype.hasOwnProperty.call(object, key);
}
function joinRegExp(patterns) {
// Combine an array of regular expressions and strings into one large regexp
// Be mad.
var sources = [],
i = 0,
len = patterns.length,
pattern;
for (; i < len; i++) {
pattern = patterns[i];
if (isString(pattern)) {
// If it's a string, we need to escape it
// Taken from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
sources.push(pattern.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1'));
} else if (pattern && pattern.source) {
// If it's a regexp already, we want to extract the source
sources.push(pattern.source);
}
// Intentionally skip other cases
}
return new RegExp(sources.join('|'), 'i');
}
function urlencode(o) {
var pairs = [];
each(o, function(key, value) {
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
});
return pairs.join('&');
}
// borrowed from https://tools.ietf.org/html/rfc3986#appendix-B
// intentionally using regex and not <a/> href parsing trick because React Native and other
// environments where DOM might not be available
function parseUrl(url) {
if (typeof url !== 'string') return {};
var match = url.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);
// coerce to undefined values to empty string so we don't get 'undefined'
var query = match[6] || '';
var fragment = match[8] || '';
return {
protocol: match[2],
host: match[4],
path: match[5],
relative: match[5] + query + fragment // everything minus origin
};
}
function uuid4() {
var crypto = _window.crypto || _window.msCrypto;
if (!isUndefined(crypto) && crypto.getRandomValues) {
// Use window.crypto API if available
// eslint-disable-next-line no-undef
var arr = new Uint16Array(8);
crypto.getRandomValues(arr);
// set 4 in byte 7
arr[3] = (arr[3] & 0xfff) | 0x4000;
// set 2 most significant bits of byte 9 to '10'
arr[4] = (arr[4] & 0x3fff) | 0x8000;
var pad = function(num) {
var v = num.toString(16);
while (v.length < 4) {
v = '0' + v;
}
return v;
};
return (
pad(arr[0]) +
pad(arr[1]) +
pad(arr[2]) +
pad(arr[3]) +
pad(arr[4]) +
pad(arr[5]) +
pad(arr[6]) +
pad(arr[7])
);
} else {
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (Math.random() * 16) | 0,
v = c === 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}
}
/**
* Given a child DOM element, returns a query-selector statement describing that
* and its ancestors
* e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]
* @param elem
* @returns {string}
*/
function htmlTreeAsString(elem) {
/* eslint no-extra-parens:0*/
var MAX_TRAVERSE_HEIGHT = 5,
MAX_OUTPUT_LEN = 80,
out = [],
height = 0,
len = 0,
separator = ' > ',
sepLength = separator.length,
nextStr;
while (elem && height++ < MAX_TRAVERSE_HEIGHT) {
nextStr = htmlElementAsString(elem);
// bail out if
// - nextStr is the 'html' element
// - the length of the string that would be created exceeds MAX_OUTPUT_LEN
// (ignore this limit if we are on the first iteration)
if (
nextStr === 'html' ||
(height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)
) {
break;
}
out.push(nextStr);
len += nextStr.length;
elem = elem.parentNode;
}
return out.reverse().join(separator);
}
/**
* Returns a simple, query-selector representation of a DOM element
* e.g. [HTMLElement] => input#foo.btn[name=baz]
* @param HTMLElement
* @returns {string}
*/
function htmlElementAsString(elem) {
var out = [],
className,
classes,
key,
attr,
i;
if (!elem || !elem.tagName) {
return '';
}
out.push(elem.tagName.toLowerCase());
if (elem.id) {
out.push('#' + elem.id);
}
className = elem.className;
if (className && isString(className)) {
classes = className.split(/\s+/);
for (i = 0; i < classes.length; i++) {
out.push('.' + classes[i]);
}
}
var attrWhitelist = ['type', 'name', 'title', 'alt'];
for (i = 0; i < attrWhitelist.length; i++) {
key = attrWhitelist[i];
attr = elem.getAttribute(key);
if (attr) {
out.push('[' + key + '="' + attr + '"]');
}
}
return out.join('');
}
/**
* Returns true if either a OR b is truthy, but not both
*/
function isOnlyOneTruthy(a, b) {
return !!(!!a ^ !!b);
}
/**
* Returns true if both parameters are undefined
*/
function isBothUndefined(a, b) {
return isUndefined(a) && isUndefined(b);
}
/**
* Returns true if the two input exception interfaces have the same content
*/
function isSameException(ex1, ex2) {
if (isOnlyOneTruthy(ex1, ex2)) return false;
ex1 = ex1.values[0];
ex2 = ex2.values[0];
if (ex1.type !== ex2.type || ex1.value !== ex2.value) return false;
// in case both stacktraces are undefined, we can't decide so default to false
if (isBothUndefined(ex1.stacktrace, ex2.stacktrace)) return false;
return isSameStacktrace(ex1.stacktrace, ex2.stacktrace);
}
/**
* Returns true if the two input stack trace interfaces have the same content
*/
function isSameStacktrace(stack1, stack2) {
if (isOnlyOneTruthy(stack1, stack2)) return false;
var frames1 = stack1.frames;
var frames2 = stack2.frames;
// Exit early if frame count differs
if (frames1.length !== frames2.length) return false;
// Iterate through every frame; bail out if anything differs
var a, b;
for (var i = 0; i < frames1.length; i++) {
a = frames1[i];
b = frames2[i];
if (
a.filename !== b.filename ||
a.lineno !== b.lineno ||
a.colno !== b.colno ||
a['function'] !== b['function']
)
return false;
}
return true;
}
/**
* Polyfill a method
* @param obj object e.g. `document`
* @param name method name present on object e.g. `addEventListener`
* @param replacement replacement function
* @param track {optional} record instrumentation to an array
*/
function fill(obj, name, replacement, track) {
if (obj == null) return;
var orig = obj[name];
obj[name] = replacement(orig);
obj[name].__raven__ = true;
obj[name].__orig__ = orig;
if (track) {
track.push([obj, name, orig]);
}
}
/**
* Join values in array
* @param input array of values to be joined together
* @param delimiter string to be placed in-between values
* @returns {string}
*/
function safeJoin(input, delimiter) {
if (!isArray(input)) return '';
var output = [];
for (var i = 0; i < input.length; i++) {
try {
output.push(String(input[i]));
} catch (e) {
output.push('[value cannot be serialized]');
}
}
return output.join(delimiter);
}
// Default Node.js REPL depth
var MAX_SERIALIZE_EXCEPTION_DEPTH = 3;
// 50kB, as 100kB is max payload size, so half sounds reasonable
var MAX_SERIALIZE_EXCEPTION_SIZE = 50 * 1024;
var MAX_SERIALIZE_KEYS_LENGTH = 40;
function utf8Length(value) {
return ~-encodeURI(value).split(/%..|./).length;
}
function jsonSize(value) {
return utf8Length(JSON.stringify(value));
}
function serializeValue(value) {
if (typeof value === 'string') {
var maxLength = 40;
return truncate(value, maxLength);
} else if (
typeof value === 'number' ||
typeof value === 'boolean' ||
typeof value === 'undefined'
) {
return value;
}
var type = Object.prototype.toString.call(value);
// Node.js REPL notation
if (type === '[object Object]') return '[Object]';
if (type === '[object Array]') return '[Array]';
if (type === '[object Function]')
return value.name ? '[Function: ' + value.name + ']' : '[Function]';
return value;
}
function serializeObject(value, depth) {
if (depth === 0) return serializeValue(value);
if (isPlainObject(value)) {
return Object.keys(value).reduce(function(acc, key) {
acc[key] = serializeObject(value[key], depth - 1);
return acc;
}, {});
} else if (Array.isArray(value)) {
return value.map(function(val) {
return serializeObject(val, depth - 1);
});
}
return serializeValue(value);
}
function serializeException(ex, depth, maxSize) {
if (!isPlainObject(ex)) return ex;
depth = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_DEPTH : depth;
maxSize = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_SIZE : maxSize;
var serialized = serializeObject(ex, depth);
if (jsonSize(stringify(serialized)) > maxSize) {
return serializeException(ex, depth - 1);
}
return serialized;
}
function serializeKeysForMessage(keys, maxLength) {
if (typeof keys === 'number' || typeof keys === 'string') return keys.toString();
if (!Array.isArray(keys)) return '';
keys = keys.filter(function(key) {
return typeof key === 'string';
});
if (keys.length === 0) return '[object has no keys]';
maxLength = typeof maxLength !== 'number' ? MAX_SERIALIZE_KEYS_LENGTH : maxLength;
if (keys[0].length >= maxLength) return keys[0];
for (var usedKeys = keys.length; usedKeys > 0; usedKeys--) {
var serialized = keys.slice(0, usedKeys).join(', ');
if (serialized.length > maxLength) continue;
if (usedKeys === keys.length) return serialized;
return serialized + '\u2026';
}
return '';
}
function sanitize(input, sanitizeKeys) {
if (!isArray(sanitizeKeys) || (isArray(sanitizeKeys) && sanitizeKeys.length === 0))
return input;
var sanitizeRegExp = joinRegExp(sanitizeKeys);
var sanitizeMask = '********';
var safeInput;
try {
safeInput = JSON.parse(stringify(input));
} catch (o_O) {
return input;
}
function sanitizeWorker(workerInput) {
if (isArray(workerInput)) {
return workerInput.map(function(val) {
return sanitizeWorker(val);
});
}
if (isPlainObject(workerInput)) {
return Object.keys(workerInput).reduce(function(acc, k) {
if (sanitizeRegExp.test(k)) {
acc[k] = sanitizeMask;
} else {
acc[k] = sanitizeWorker(workerInput[k]);
}
return acc;
}, {});
}
return workerInput;
}
return sanitizeWorker(safeInput);
}
module.exports = {
isObject: isObject,
isError: isError,
isErrorEvent: isErrorEvent,
isDOMError: isDOMError,
isDOMException: isDOMException,
isUndefined: isUndefined,
isFunction: isFunction,
isPlainObject: isPlainObject,
isString: isString,
isArray: isArray,
isEmptyObject: isEmptyObject,
supportsErrorEvent: supportsErrorEvent,
supportsDOMError: supportsDOMError,
supportsDOMException: supportsDOMException,
supportsFetch: supportsFetch,
supportsReferrerPolicy: supportsReferrerPolicy,
supportsPromiseRejectionEvent: supportsPromiseRejectionEvent,
wrappedCallback: wrappedCallback,
each: each,
objectMerge: objectMerge,
truncate: truncate,
objectFrozen: objectFrozen,
hasKey: hasKey,
joinRegExp: joinRegExp,
urlencode: urlencode,
uuid4: uuid4,
htmlTreeAsString: htmlTreeAsString,
htmlElementAsString: htmlElementAsString,
isSameException: isSameException,
isSameStacktrace: isSameStacktrace,
parseUrl: parseUrl,
fill: fill,
safeJoin: safeJoin,
serializeException: serializeException,
serializeKeysForMessage: serializeKeysForMessage,
sanitize: sanitize
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"10":10}],9:[function(_dereq_,module,exports){
(function (global){
var utils = _dereq_(8);
/*
TraceKit - Cross brower stack traces
This was originally forked from github.com/occ/TraceKit, but has since been
largely re-written and is now maintained as part of raven-js. Tests for
this are in test/vendor.
MIT license
*/
var TraceKit = {
collectWindowErrors: true,
debug: false
};
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
var _window =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
// global reference to slice
var _slice = [].slice;
var UNKNOWN_FUNCTION = '?';
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types
var ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;
function getLocationHref() {
if (typeof document === 'undefined' || document.location == null) return '';
return document.location.href;
}
function getLocationOrigin() {
if (typeof document === 'undefined' || document.location == null) return '';
return document.location.origin;
}
/**
* TraceKit.report: cross-browser processing of unhandled exceptions
*
* Syntax:
* TraceKit.report.subscribe(function(stackInfo) { ... })
* TraceKit.report.unsubscribe(function(stackInfo) { ... })
* TraceKit.report(exception)
* try { ...code... } catch(ex) { TraceKit.report(ex); }
*
* Supports:
* - Firefox: full stack trace with line numbers, plus column number
* on top frame; column number is not guaranteed
* - Opera: full stack trace with line and column numbers
* - Chrome: full stack trace with line and column numbers
* - Safari: line and column number for the top frame only; some frames
* may be missing, and column number is not guaranteed
* - IE: line and column number for the top frame only; some frames
* may be missing, and column number is not guaranteed
*
* In theory, TraceKit should work on all of the following versions:
* - IE5.5+ (only 8.0 tested)
* - Firefox 0.9+ (only 3.5+ tested)
* - Opera 7+ (only 10.50 tested; versions 9 and earlier may require
* Exceptions Have Stacktrace to be enabled in opera:config)
* - Safari 3+ (only 4+ tested)
* - Chrome 1+ (only 5+ tested)
* - Konqueror 3.5+ (untested)
*
* Requires TraceKit.computeStackTrace.
*
* Tries to catch all unhandled exceptions and report them to the
* subscribed handlers. Please note that TraceKit.report will rethrow the
* exception. This is REQUIRED in order to get a useful stack trace in IE.
* If the exception does not reach the top of the browser, you will only
* get a stack trace from the point where TraceKit.report was called.
*
* Handlers receive a stackInfo object as described in the
* TraceKit.computeStackTrace docs.
*/
TraceKit.report = (function reportModuleWrapper() {
var handlers = [],
lastArgs = null,
lastException = null,
lastExceptionStack = null;
/**
* Add a crash handler.
* @param {Function} handler
*/
function subscribe(handler) {
installGlobalHandler();
handlers.push(handler);
}
/**
* Remove a crash handler.
* @param {Function} handler
*/
function unsubscribe(handler) {
for (var i = handlers.length - 1; i >= 0; --i) {
if (handlers[i] === handler) {
handlers.splice(i, 1);
}
}
}
/**
* Remove all crash handlers.
*/
function unsubscribeAll() {
uninstallGlobalHandler();
handlers = [];
}
/**
* Dispatch stack information to all handlers.
* @param {Object.<string, *>} stack
*/
function notifyHandlers(stack, isWindowError) {
var exception = null;
if (isWindowError && !TraceKit.collectWindowErrors) {
return;
}
for (var i in handlers) {
if (handlers.hasOwnProperty(i)) {
try {
handlers[i].apply(null, [stack].concat(_slice.call(arguments, 2)));
} catch (inner) {
exception = inner;
}
}
}
if (exception) {
throw exception;
}
}
var _oldOnerrorHandler, _onErrorHandlerInstalled;
/**
* Ensures all global unhandled exceptions are recorded.
* Supported by Gecko and IE.
* @param {string} msg Error message.
* @param {string} url URL of script that generated the exception.
* @param {(number|string)} lineNo The line number at which the error
* occurred.
* @param {?(number|string)} colNo The column number at which the error
* occurred.
* @param {?Error} ex The actual Error object.
*/
function traceKitWindowOnError(msg, url, lineNo, colNo, ex) {
var stack = null;
// If 'ex' is ErrorEvent, get real Error from inside
var exception = utils.isErrorEvent(ex) ? ex.error : ex;
// If 'msg' is ErrorEvent, get real message from inside
var message = utils.isErrorEvent(msg) ? msg.message : msg;
if (lastExceptionStack) {
TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(
lastExceptionStack,
url,
lineNo,
message
);
processLastException();
} else if (exception && utils.isError(exception)) {
// non-string `exception` arg; attempt to extract stack trace
// New chrome and blink send along a real error object
// Let's just report that like a normal error.
// See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror
stack = TraceKit.computeStackTrace(exception);
notifyHandlers(stack, true);
} else {
var location = {
url: url,
line: lineNo,
column: colNo
};
var name = undefined;
var groups;
if ({}.toString.call(message) === '[object String]') {
var groups = message.match(ERROR_TYPES_RE);
if (groups) {
name = groups[1];
message = groups[2];
}
}
location.func = UNKNOWN_FUNCTION;
stack = {
name: name,
message: message,
url: getLocationHref(),
stack: [location]
};
notifyHandlers(stack, true);
}
if (_oldOnerrorHandler) {
return _oldOnerrorHandler.apply(this, arguments);
}
return false;
}
function installGlobalHandler() {
if (_onErrorHandlerInstalled) {
return;
}
_oldOnerrorHandler = _window.onerror;
_window.onerror = traceKitWindowOnError;
_onErrorHandlerInstalled = true;
}
function uninstallGlobalHandler() {
if (!_onErrorHandlerInstalled) {
return;
}
_window.onerror = _oldOnerrorHandler;
_onErrorHandlerInstalled = false;
_oldOnerrorHandler = undefined;
}
function processLastException() {
var _lastExceptionStack = lastExceptionStack,
_lastArgs = lastArgs;
lastArgs = null;
lastExceptionStack = null;
lastException = null;
notifyHandlers.apply(null, [_lastExceptionStack, false].concat(_lastArgs));
}
/**
* Reports an unhandled Error to TraceKit.
* @param {Error} ex
* @param {?boolean} rethrow If false, do not re-throw the exception.
* Only used for window.onerror to not cause an infinite loop of
* rethrowing.
*/
function report(ex, rethrow) {
var args = _slice.call(arguments, 1);
if (lastExceptionStack) {
if (lastException === ex) {
return; // already caught by an inner catch block, ignore
} else {
processLastException();
}
}
var stack = TraceKit.computeStackTrace(ex);
lastExceptionStack = stack;
lastException = ex;
lastArgs = args;
// If the stack trace is incomplete, wait for 2 seconds for
// slow slow IE to see if onerror occurs or not before reporting
// this exception; otherwise, we will end up with an incomplete
// stack trace
setTimeout(function() {
if (lastException === ex) {
processLastException();
}
}, stack.incomplete ? 2000 : 0);
if (rethrow !== false) {
throw ex; // re-throw to propagate to the top level (and cause window.onerror)
}
}
report.subscribe = subscribe;
report.unsubscribe = unsubscribe;
report.uninstall = unsubscribeAll;
return report;
})();
/**
* TraceKit.computeStackTrace: cross-browser stack traces in JavaScript
*
* Syntax:
* s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below)
* Returns:
* s.name - exception name
* s.message - exception message
* s.stack[i].url - JavaScript or HTML file URL
* s.stack[i].func - function name, or empty for anonymous functions (if guessing did not work)
* s.stack[i].args - arguments passed to the function, if known
* s.stack[i].line - line number, if known
* s.stack[i].column - column number, if known
*
* Supports:
* - Firefox: full stack trace with line numbers and unreliable column
* number on top frame
* - Opera 10: full stack trace with line and column numbers
* - Opera 9-: full stack trace with line numbers
* - Chrome: full stack trace with line and column numbers
* - Safari: line and column number for the topmost stacktrace element
* only
* - IE: no line numbers whatsoever
*
* Tries to guess names of anonymous functions by looking for assignments
* in the source code. In IE and Safari, we have to guess source file names
* by searching for function bodies inside all page scripts. This will not
* work for scripts that are loaded cross-domain.
* Here be dragons: some function names may be guessed incorrectly, and
* duplicate functions may be mismatched.
*
* TraceKit.computeStackTrace should only be used for tracing purposes.
* Logging of unhandled exceptions should be done with TraceKit.report,
* which builds on top of TraceKit.computeStackTrace and provides better
* IE support by utilizing the window.onerror event to retrieve information
* about the top of the stack.
*
* Note: In IE and Safari, no stack trace is recorded on the Error object,
* so computeStackTrace instead walks its *own* chain of callers.
* This means that:
* * in Safari, some methods may be missing from the stack trace;
* * in IE, the topmost function in the stack trace will always be the
* caller of computeStackTrace.
*
* This is okay for tracing (because you are likely to be calling
* computeStackTrace from the function you want to be the topmost element
* of the stack trace anyway), but not okay for logging unhandled
* exceptions (because your catch block will likely be far away from the
* inner function that actually caused the exception).
*
*/
TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
// Contents of Exception in various browsers.
//
// SAFARI:
// ex.message = Can't find variable: qq
// ex.line = 59
// ex.sourceId = 580238192
// ex.sourceURL = http://...
// ex.expressionBeginOffset = 96
// ex.expressionCaretOffset = 98
// ex.expressionEndOffset = 98
// ex.name = ReferenceError
//
// FIREFOX:
// ex.message = qq is not defined
// ex.fileName = http://...
// ex.lineNumber = 59
// ex.columnNumber = 69
// ex.stack = ...stack trace... (see the example below)
// ex.name = ReferenceError
//
// CHROME:
// ex.message = qq is not defined
// ex.name = ReferenceError
// ex.type = not_defined
// ex.arguments = ['aa']
// ex.stack = ...stack trace...
//
// INTERNET EXPLORER:
// ex.message = ...
// ex.name = ReferenceError
//
// OPERA:
// ex.message = ...message... (see the example below)
// ex.name = ReferenceError
// ex.opera#sourceloc = 11 (pretty much useless, duplicates the info in ex.message)
// ex.stacktrace = n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'
/**
* Computes stack trace information from the stack property.
* Chrome and Gecko use this property.
* @param {Error} ex
* @return {?Object.<string, *>} Stack trace information.
*/
function computeStackTraceFromStackProp(ex) {
if (typeof ex.stack === 'undefined' || !ex.stack) return;
var chrome = /^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
var winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx(?:-web)|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
// NOTE: blob urls are now supposed to always have an origin, therefore it's format
// which is `blob:http://url/path/with-some-uuid`, is matched by `blob.*?:\/` as well
var gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i;
// Used to additionally parse URL/line/column from eval frames
var geckoEval = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
var chromeEval = /\((\S*)(?::(\d+))(?::(\d+))\)/;
var lines = ex.stack.split('\n');
var stack = [];
var submatch;
var parts;
var element;
var reference = /^(.*) is undefined$/.exec(ex.message);
for (var i = 0, j = lines.length; i < j; ++i) {
if ((parts = chrome.exec(lines[i]))) {
var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line
var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
if (isEval && (submatch = chromeEval.exec(parts[2]))) {
// throw out eval line/column and use top-most line/column number
parts[2] = submatch[1]; // url
parts[3] = submatch[2]; // line
parts[4] = submatch[3]; // column
}
element = {
url: !isNative ? parts[2] : null,
func: parts[1] || UNKNOWN_FUNCTION,
args: isNative ? [parts[2]] : [],
line: parts[3] ? +parts[3] : null,
column: parts[4] ? +parts[4] : null
};
} else if ((parts = winjs.exec(lines[i]))) {
element = {
url: parts[2],
func: parts[1] || UNKNOWN_FUNCTION,
args: [],
line: +parts[3],
column: parts[4] ? +parts[4] : null
};
} else if ((parts = gecko.exec(lines[i]))) {
var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
if (isEval && (submatch = geckoEval.exec(parts[3]))) {
// throw out eval line/column and use top-most line number
parts[3] = submatch[1];
parts[4] = submatch[2];
parts[5] = null; // no column when eval
} else if (i === 0 && !parts[5] && typeof ex.columnNumber !== 'undefined') {
// FireFox uses this awesome columnNumber property for its top frame
// Also note, Firefox's column number is 0-based and everything else expects 1-based,
// so adding 1
// NOTE: this hack doesn't work if top-most frame is eval
stack[0].column = ex.columnNumber + 1;
}
element = {
url: parts[3],
func: parts[1] || UNKNOWN_FUNCTION,
args: parts[2] ? parts[2].split(',') : [],
line: parts[4] ? +parts[4] : null,
column: parts[5] ? +parts[5] : null
};
} else {
continue;
}
if (!element.func && element.line) {
element.func = UNKNOWN_FUNCTION;
}
if (element.url && element.url.substr(0, 5) === 'blob:') {
// Special case for handling JavaScript loaded into a blob.
// We use a synchronous AJAX request here as a blob is already in
// memory - it's not making a network request. This will generate a warning
// in the browser console, but there has already been an error so that's not
// that much of an issue.
var xhr = new XMLHttpRequest();
xhr.open('GET', element.url, false);
xhr.send(null);
// If we failed to download the source, skip this patch
if (xhr.status === 200) {
var source = xhr.responseText || '';
// We trim the source down to the last 300 characters as sourceMappingURL is always at the end of the file.
// Why 300? To be in line with: https://github.com/getsentry/sentry/blob/4af29e8f2350e20c28a6933354e4f42437b4ba42/src/sentry/lang/javascript/processor.py#L164-L175
source = source.slice(-300);
// Now we dig out the source map URL
var sourceMaps = source.match(/\/\/# sourceMappingURL=(.*)$/);
// If we don't find a source map comment or we find more than one, continue on to the next element.
if (sourceMaps) {
var sourceMapAddress = sourceMaps[1];
// Now we check to see if it's a relative URL.
// If it is, convert it to an absolute one.
if (sourceMapAddress.charAt(0) === '~') {
sourceMapAddress = getLocationOrigin() + sourceMapAddress.slice(1);
}
// Now we strip the '.map' off of the end of the URL and update the
// element so that Sentry can match the map to the blob.
element.url = sourceMapAddress.slice(0, -4);
}
}
}
stack.push(element);
}
if (!stack.length) {
return null;
}
return {
name: ex.name,
message: ex.message,
url: getLocationHref(),
stack: stack
};
}
/**
* Adds information about the first frame to incomplete stack traces.
* Safari and IE require this to get complete data on the first frame.
* @param {Object.<string, *>} stackInfo Stack trace information from
* one of the compute* methods.
* @param {string} url The URL of the script that caused an error.
* @param {(number|string)} lineNo The line number of the script that
* caused an error.
* @param {string=} message The error generated by the browser, which
* hopefully contains the name of the object that caused the error.
* @return {boolean} Whether or not the stack information was
* augmented.
*/
function augmentStackTraceWithInitialElement(stackInfo, url, lineNo, message) {
var initial = {
url: url,
line: lineNo
};
if (initial.url && initial.line) {
stackInfo.incomplete = false;
if (!initial.func) {
initial.func = UNKNOWN_FUNCTION;
}
if (stackInfo.stack.length > 0) {
if (stackInfo.stack[0].url === initial.url) {
if (stackInfo.stack[0].line === initial.line) {
return false; // already in stack trace
} else if (
!stackInfo.stack[0].line &&
stackInfo.stack[0].func === initial.func
) {
stackInfo.stack[0].line = initial.line;
return false;
}
}
}
stackInfo.stack.unshift(initial);
stackInfo.partial = true;
return true;
} else {
stackInfo.incomplete = true;
}
return false;
}
/**
* Computes stack trace information by walking the arguments.caller
* chain at the time the exception occurred. This will cause earlier
* frames to be missed but is the only way to get any stack trace in
* Safari and IE. The top frame is restored by
* {@link augmentStackTraceWithInitialElement}.
* @param {Error} ex
* @return {?Object.<string, *>} Stack trace information.
*/
function computeStackTraceByWalkingCallerChain(ex, depth) {
var functionName = /function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,
stack = [],
funcs = {},
recursion = false,
parts,
item,
source;
for (
var curr = computeStackTraceByWalkingCallerChain.caller;
curr && !recursion;
curr = curr.caller
) {
if (curr === computeStackTrace || curr === TraceKit.report) {
// console.log('skipping internal function');
continue;
}
item = {
url: null,
func: UNKNOWN_FUNCTION,
line: null,
column: null
};
if (curr.name) {
item.func = curr.name;
} else if ((parts = functionName.exec(curr.toString()))) {
item.func = parts[1];
}
if (typeof item.func === 'undefined') {
try {
item.func = parts.input.substring(0, parts.input.indexOf('{'));
} catch (e) {}
}
if (funcs['' + curr]) {
recursion = true;
} else {
funcs['' + curr] = true;
}
stack.push(item);
}
if (depth) {
// console.log('depth is ' + depth);
// console.log('stack is ' + stack.length);
stack.splice(0, depth);
}
var result = {
name: ex.name,
message: ex.message,
url: getLocationHref(),
stack: stack
};
augmentStackTraceWithInitialElement(
result,
ex.sourceURL || ex.fileName,
ex.line || ex.lineNumber,
ex.message || ex.description
);
return result;
}
/**
* Computes a stack trace for an exception.
* @param {Error} ex
* @param {(string|number)=} depth
*/
function computeStackTrace(ex, depth) {
var stack = null;
depth = depth == null ? 0 : +depth;
try {
stack = computeStackTraceFromStackProp(ex);
if (stack) {
return stack;
}
} catch (e) {
if (TraceKit.debug) {
throw e;
}
}
try {
stack = computeStackTraceByWalkingCallerChain(ex, depth + 1);
if (stack) {
return stack;
}
} catch (e) {
if (TraceKit.debug) {
throw e;
}
}
return {
name: ex.name,
message: ex.message,
url: getLocationHref()
};
}
computeStackTrace.augmentStackTraceWithInitialElement = augmentStackTraceWithInitialElement;
computeStackTrace.computeStackTraceFromStackProp = computeStackTraceFromStackProp;
return computeStackTrace;
})();
module.exports = TraceKit;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"8":8}],10:[function(_dereq_,module,exports){
/*
json-stringify-safe
Like JSON.stringify, but doesn't throw on circular references.
Originally forked from https://github.com/isaacs/json-stringify-safe
version 5.0.1 on 3/8/2017 and modified to handle Errors serialization
and IE8 compatibility. Tests for this are in test/vendor.
ISC license: https://github.com/isaacs/json-stringify-safe/blob/master/LICENSE
*/
exports = module.exports = stringify;
exports.getSerialize = serializer;
function indexOf(haystack, needle) {
for (var i = 0; i < haystack.length; ++i) {
if (haystack[i] === needle) return i;
}
return -1;
}
function stringify(obj, replacer, spaces, cycleReplacer) {
return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);
}
// https://github.com/ftlabs/js-abbreviate/blob/fa709e5f139e7770a71827b1893f22418097fbda/index.js#L95-L106
function stringifyError(value) {
var err = {
// These properties are implemented as magical getters and don't show up in for in
stack: value.stack,
message: value.message,
name: value.name
};
for (var i in value) {
if (Object.prototype.hasOwnProperty.call(value, i)) {
err[i] = value[i];
}
}
return err;
}
function serializer(replacer, cycleReplacer) {
var stack = [];
var keys = [];
if (cycleReplacer == null) {
cycleReplacer = function(key, value) {
if (stack[0] === value) {
return '[Circular ~]';
}
return '[Circular ~.' + keys.slice(0, indexOf(stack, value)).join('.') + ']';
};
}
return function(key, value) {
if (stack.length > 0) {
var thisPos = indexOf(stack, this);
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
if (~indexOf(stack, value)) {
value = cycleReplacer.call(this, key, value);
}
} else {
stack.push(value);
}
return replacer == null
? value instanceof Error ? stringifyError(value) : value
: replacer.call(this, key, value);
};
}
},{}],11:[function(_dereq_,module,exports){
/*
* JavaScript MD5
* https://github.com/blueimp/JavaScript-MD5
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
*
* Based on
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safeAdd(x, y) {
var lsw = (x & 0xffff) + (y & 0xffff);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xffff);
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function bitRotateLeft(num, cnt) {
return (num << cnt) | (num >>> (32 - cnt));
}
/*
* These functions implement the four basic operations the algorithm uses.
*/
function md5cmn(q, a, b, x, s, t) {
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
}
function md5ff(a, b, c, d, x, s, t) {
return md5cmn((b & c) | (~b & d), a, b, x, s, t);
}
function md5gg(a, b, c, d, x, s, t) {
return md5cmn((b & d) | (c & ~d), a, b, x, s, t);
}
function md5hh(a, b, c, d, x, s, t) {
return md5cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5ii(a, b, c, d, x, s, t) {
return md5cmn(c ^ (b | ~d), a, b, x, s, t);
}
/*
* Calculate the MD5 of an array of little-endian words, and a bit length.
*/
function binlMD5(x, len) {
/* append padding */
x[len >> 5] |= 0x80 << (len % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len;
var i;
var olda;
var oldb;
var oldc;
var oldd;
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
for (i = 0; i < x.length; i += 16) {
olda = a;
oldb = b;
oldc = c;
oldd = d;
a = md5ff(a, b, c, d, x[i], 7, -680876936);
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
b = md5gg(b, c, d, a, x[i], 20, -373897302);
a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
d = md5hh(d, a, b, c, x[i], 11, -358537222);
c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
a = md5ii(a, b, c, d, x[i], 6, -198630844);
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
a = safeAdd(a, olda);
b = safeAdd(b, oldb);
c = safeAdd(c, oldc);
d = safeAdd(d, oldd);
}
return [a, b, c, d];
}
/*
* Convert an array of little-endian words to a string
*/
function binl2rstr(input) {
var i;
var output = '';
var length32 = input.length * 32;
for (i = 0; i < length32; i += 8) {
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff);
}
return output;
}
/*
* Convert a raw string to an array of little-endian words
* Characters >255 have their high-byte silently ignored.
*/
function rstr2binl(input) {
var i;
var output = [];
output[(input.length >> 2) - 1] = undefined;
for (i = 0; i < output.length; i += 1) {
output[i] = 0;
}
var length8 = input.length * 8;
for (i = 0; i < length8; i += 8) {
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32);
}
return output;
}
/*
* Calculate the MD5 of a raw string
*/
function rstrMD5(s) {
return binl2rstr(binlMD5(rstr2binl(s), s.length * 8));
}
/*
* Calculate the HMAC-MD5, of a key and some data (raw strings)
*/
function rstrHMACMD5(key, data) {
var i;
var bkey = rstr2binl(key);
var ipad = [];
var opad = [];
var hash;
ipad[15] = opad[15] = undefined;
if (bkey.length > 16) {
bkey = binlMD5(bkey, key.length * 8);
}
for (i = 0; i < 16; i += 1) {
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5c5c5c5c;
}
hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
return binl2rstr(binlMD5(opad.concat(hash), 512 + 128));
}
/*
* Convert a raw string to a hex string
*/
function rstr2hex(input) {
var hexTab = '0123456789abcdef';
var output = '';
var x;
var i;
for (i = 0; i < input.length; i += 1) {
x = input.charCodeAt(i);
output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f);
}
return output;
}
/*
* Encode a string as utf-8
*/
function str2rstrUTF8(input) {
return unescape(encodeURIComponent(input));
}
/*
* Take string arguments and return either raw or hex encoded strings
*/
function rawMD5(s) {
return rstrMD5(str2rstrUTF8(s));
}
function hexMD5(s) {
return rstr2hex(rawMD5(s));
}
function rawHMACMD5(k, d) {
return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d));
}
function hexHMACMD5(k, d) {
return rstr2hex(rawHMACMD5(k, d));
}
function md5(string, key, raw) {
if (!key) {
if (!raw) {
return hexMD5(string);
}
return rawMD5(string);
}
if (!raw) {
return hexHMACMD5(key, string);
}
return rawHMACMD5(key, string);
}
module.exports = md5;
},{}]},{},[7,1,2,3])(7)
});
|
ajax/libs/vega/3.0.0-beta.24/vega.js
|
jonobr1/cdnjs
|
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.vega = global.vega || {})));
}(this, (function (exports) { 'use strict';
var version = "3.0.0-beta.24";
function bin$1(_) {
// determine range
var maxb = _.maxbins || 20,
base = _.base || 10,
logb = Math.log(base),
div = _.divide || [5, 2],
min = _.extent[0],
max = _.extent[1],
span = max - min,
step, level, minstep, precision, v, i, n, eps;
if (_.step) {
// if step size is explicitly given, use that
step = _.step;
} else if (_.steps) {
// if provided, limit choice to acceptable step sizes
v = span / maxb;
for (i=0, n=_.steps.length; i < n && _.steps[i] < v; ++i);
step = _.steps[Math.max(0, i-1)];
} else {
// else use span to determine step size
level = Math.ceil(Math.log(maxb) / logb);
minstep = _.minstep || 0;
step = Math.max(
minstep,
Math.pow(base, Math.round(Math.log(span) / logb) - level)
);
// increase step size if too many bins
while (Math.ceil(span/step) > maxb) { step *= base; }
// decrease step size if allowed
for (i=0, n=div.length; i<n; ++i) {
v = step / div[i];
if (v >= minstep && span / v <= maxb) step = v;
}
}
// update precision, min and max
v = Math.log(step);
precision = v >= 0 ? 0 : ~~(-v / logb) + 1;
eps = Math.pow(base, -precision - 1);
if (_.nice || _.nice === undefined) {
min = Math.min(min, Math.floor(min / step + eps) * step);
max = Math.ceil(max / step) * step;
}
return {
start: min,
stop: max,
step: step
};
}
function numbers(array, f) {
var numbers = [],
n = array.length,
i = -1, a;
if (f == null) {
while (++i < n) if (!isNaN(a = number(array[i]))) numbers.push(a);
} else {
while (++i < n) if (!isNaN(a = number(f(array[i], i, array)))) numbers.push(a);
}
return numbers;
}
function number(x) {
return x === null ? NaN : +x;
}
function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
function bisector(compare) {
if (compare.length === 1) compare = ascendingComparator(compare);
return {
left: function(a, x, lo, hi) {
if (lo == null) lo = 0;
if (hi == null) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) < 0) lo = mid + 1;
else hi = mid;
}
return lo;
},
right: function(a, x, lo, hi) {
if (lo == null) lo = 0;
if (hi == null) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) > 0) hi = mid;
else lo = mid + 1;
}
return lo;
}
};
}
function ascendingComparator(f) {
return function(d, x) {
return ascending(f(d), x);
};
}
var ascendingBisect = bisector(ascending);
var bisectRight = ascendingBisect.right;
var bisectLeft = ascendingBisect.left;
function number$1(x) {
return x === null ? NaN : +x;
}
function variance(array, f) {
var n = array.length,
m = 0,
a,
d,
s = 0,
i = -1,
j = 0;
if (f == null) {
while (++i < n) {
if (!isNaN(a = number$1(array[i]))) {
d = a - m;
m += d / ++j;
s += d * (a - m);
}
}
}
else {
while (++i < n) {
if (!isNaN(a = number$1(f(array[i], i, array)))) {
d = a - m;
m += d / ++j;
s += d * (a - m);
}
}
}
if (j > 1) return s / (j - 1);
}
function extent(array, f) {
var i = -1,
n = array.length,
a,
b,
c;
if (f == null) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = c = b; break; }
while (++i < n) if ((b = array[i]) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
}
else {
while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = c = b; break; }
while (++i < n) if ((b = f(array[i], i, array)) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
}
return [a, c];
}
function sequence(start, stop, step) {
start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
var i = -1,
n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
range = new Array(n);
while (++i < n) {
range[i] = start + i * step;
}
return range;
}
var e10 = Math.sqrt(50);
var e5 = Math.sqrt(10);
var e2 = Math.sqrt(2);
function ticks(start, stop, count) {
var step = tickStep(start, stop, count);
return sequence(
Math.ceil(start / step) * step,
Math.floor(stop / step) * step + step / 2, // inclusive
step
);
}
function tickStep(start, stop, count) {
var step0 = Math.abs(stop - start) / Math.max(0, count),
step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),
error = step0 / step1;
if (error >= e10) step1 *= 10;
else if (error >= e5) step1 *= 5;
else if (error >= e2) step1 *= 2;
return stop < start ? -step1 : step1;
}
function threshold(array, p, f) {
if (f == null) f = number$1;
if (!(n = array.length)) return;
if ((p = +p) <= 0 || n < 2) return +f(array[0], 0, array);
if (p >= 1) return +f(array[n - 1], n - 1, array);
var n,
h = (n - 1) * p,
i = Math.floor(h),
a = +f(array[i], i, array),
b = +f(array[i + 1], i + 1, array);
return a + (b - a) * (h - i);
}
function max(array, f) {
var i = -1,
n = array.length,
a,
b;
if (f == null) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
}
else {
while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = f(array[i], i, array)) != null && b > a) a = b;
}
return a;
}
function mean(array, f) {
var s = 0,
n = array.length,
a,
i = -1,
j = n;
if (f == null) {
while (++i < n) if (!isNaN(a = number$1(array[i]))) s += a; else --j;
}
else {
while (++i < n) if (!isNaN(a = number$1(f(array[i], i, array)))) s += a; else --j;
}
if (j) return s / j;
}
function median(array, f) {
var numbers = [],
n = array.length,
a,
i = -1;
if (f == null) {
while (++i < n) if (!isNaN(a = number$1(array[i]))) numbers.push(a);
}
else {
while (++i < n) if (!isNaN(a = number$1(f(array[i], i, array)))) numbers.push(a);
}
return threshold(numbers.sort(ascending), 0.5);
}
function merge(arrays) {
var n = arrays.length,
m,
i = -1,
j = 0,
merged,
array;
while (++i < n) j += arrays[i].length;
merged = new Array(j);
while (--n >= 0) {
array = arrays[n];
m = array.length;
while (--m >= 0) {
merged[--j] = array[m];
}
}
return merged;
}
function min(array, f) {
var i = -1,
n = array.length,
a,
b;
if (f == null) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
}
else {
while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = b; break; }
while (++i < n) if ((b = f(array[i], i, array)) != null && a > b) a = b;
}
return a;
}
function permute(array, indexes) {
var i = indexes.length, permutes = new Array(i);
while (i--) permutes[i] = array[indexes[i]];
return permutes;
}
function sum(array, f) {
var s = 0,
n = array.length,
a,
i = -1;
if (f == null) {
while (++i < n) if (a = +array[i]) s += a; // Note: zero and null are equivalent.
}
else {
while (++i < n) if (a = +f(array[i], i, array)) s += a;
}
return s;
}
function bootstrapCI(array, samples, alpha, f) {
var values = numbers(array, f),
n = values.length,
m = samples,
a, i, j, mu;
for (j=0, mu=Array(m); j<m; ++j) {
for (a=0, i=0; i<n; ++i) {
a += values[~~(Math.random() * n)];
}
mu[j] = a / n;
}
return [
threshold(mu.sort(ascending), alpha/2),
threshold(mu, 1-(alpha/2))
];
}
function integer(min, max) {
if (max == null) {
max = min;
min = 0;
}
var dist = {},
a, b, d;
dist.min = function(_) {
return arguments.length
? (a = _ || 0, d = b - a, dist)
: a;
};
dist.max = function(_) {
return arguments.length
? (b = _ || 0, d = b - a, dist)
: b;
};
dist.sample = function() {
return a + Math.floor(d * Math.random());
};
dist.pdf = function(x) {
return (x === Math.floor(x) && x >= a && x < b) ? 1 / d : 0;
};
dist.cdf = function(x) {
var v = Math.floor(x);
return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d;
};
dist.icdf = function(p) {
return (p >= 0 && p <= 1) ? a - 1 + Math.floor(p * d) : NaN;
};
return dist.min(min).max(max);
}
function randomNormal(mean, stdev) {
var mu,
sigma,
next = NaN,
dist = {};
dist.mean = function(_) {
return arguments.length
? (mu = _ || 0, next = NaN, dist)
: mu;
};
dist.stdev = function(_) {
return arguments.length
? (sigma = (_==null ? 1 : _), next = NaN, dist)
: sigma;
};
dist.sample = function() {
var x = 0, y = 0, rds, c;
if (next === next) {
return x = next, next = NaN, x;
}
do {
x = Math.random() * 2 - 1;
y = Math.random() * 2 - 1;
rds = x * x + y * y;
} while (rds === 0 || rds > 1);
c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform
next = mu + y * c * sigma;
return mu + x * c * sigma;
};
dist.pdf = function(x) {
var exp = Math.exp(Math.pow(x-mu, 2) / (-2 * Math.pow(sigma, 2)));
return (1 / (sigma * Math.sqrt(2*Math.PI))) * exp;
};
// Approximation from West (2009)
// Better Approximations to Cumulative Normal Functions
dist.cdf = function(x) {
var cd,
z = (x - mu) / sigma,
Z = Math.abs(z);
if (Z > 37) {
cd = 0;
} else {
var sum, exp = Math.exp(-Z*Z/2);
if (Z < 7.07106781186547) {
sum = 3.52624965998911e-02 * Z + 0.700383064443688;
sum = sum * Z + 6.37396220353165;
sum = sum * Z + 33.912866078383;
sum = sum * Z + 112.079291497871;
sum = sum * Z + 221.213596169931;
sum = sum * Z + 220.206867912376;
cd = exp * sum;
sum = 8.83883476483184e-02 * Z + 1.75566716318264;
sum = sum * Z + 16.064177579207;
sum = sum * Z + 86.7807322029461;
sum = sum * Z + 296.564248779674;
sum = sum * Z + 637.333633378831;
sum = sum * Z + 793.826512519948;
sum = sum * Z + 440.413735824752;
cd = cd / sum;
} else {
sum = Z + 0.65;
sum = Z + 4 / sum;
sum = Z + 3 / sum;
sum = Z + 2 / sum;
sum = Z + 1 / sum;
cd = exp / sum / 2.506628274631;
}
}
return z > 0 ? 1 - cd : cd;
};
// Approximation of Probit function using inverse error function.
dist.icdf = function(p) {
if (p <= 0 || p >= 1) return NaN;
var x = 2*p - 1,
v = (8 * (Math.PI - 3)) / (3 * Math.PI * (4-Math.PI)),
a = (2 / (Math.PI*v)) + (Math.log(1 - Math.pow(x,2)) / 2),
b = Math.log(1 - (x*x)) / v,
s = (x > 0 ? 1 : -1) * Math.sqrt(Math.sqrt((a*a) - b) - a);
return mu + sigma * Math.SQRT2 * s;
};
return dist.mean(mean).stdev(stdev);
}
function quartiles(array, f) {
var values = numbers(array, f);
return [
threshold(values.sort(ascending), 0.25),
threshold(values, 0.50),
threshold(values, 0.75)
];
}
// TODO: support for additional kernels?
function randomKDE(support, bandwidth) {
var kernel = randomNormal(),
dist = {},
n = 0;
dist.data = function(_) {
return arguments.length
? (support = _, (n = _?_.length:0), dist.bandwidth(bandwidth))
: support;
};
dist.bandwidth = function(_) {
if (!arguments.length) return bandwidth;
bandwidth = _;
if (!bandwidth && support) bandwidth = estimateBandwidth(support);
return dist;
};
dist.sample = function() {
return support[~~(Math.random() * n)] + bandwidth * kernel.sample();
};
dist.pdf = function(x) {
for (var y=0, i=0; i<n; ++i) {
y += kernel.pdf((x - support[i]) / bandwidth);
}
return y / bandwidth / n;
};
dist.cdf = function(x) {
for (var y=0, i=0; i<n; ++i) {
y += kernel.cdf((x - support[i]) / bandwidth);
}
return y / n;
};
dist.icdf = function() {
throw Error('KDE icdf not supported.');
};
return dist.data(support);
}
// Scott, D. W. (1992) Multivariate Density Estimation:
// Theory, Practice, and Visualization. Wiley.
function estimateBandwidth(array) {
var n = array.length,
q = quartiles(array),
h = (q[2] - q[0]) / 1.34;
return 1.06 * Math.min(Math.sqrt(variance(array)), h) * Math.pow(n, -0.2);
}
function randomMixture(dists, weights) {
var dist = {}, m = 0, w;
function normalize(x) {
var w = [], sum = 0, i;
for (i=0; i<m; ++i) { sum += (w[i] = (x[i]==null ? 1 : +x[i])); }
for (i=0; i<m; ++i) { w[i] /= sum; }
return w;
}
dist.weights = function(_) {
if (arguments.length) {
w = normalize(weights = (_ || []));
return dist;
}
return weights;
};
dist.distributions = function(_) {
if (arguments.length) {
if (_) {
m = _.length;
dists = _;
} else {
m = 0;
dists = [];
}
return dist.weights(weights);
}
return dists;
};
dist.sample = function() {
var r = Math.random(),
d = dists[m-1],
v = w[0],
i = 0;
// first select distribution
for (; i<m-1; v += w[++i]) {
if (r < v) { d = dists[i]; break; }
}
// then sample from it
return d.sample();
};
dist.pdf = function(x) {
for (var p=0, i=0; i<m; ++i) {
p += w[i] * dists[i].pdf(x);
}
return p;
};
dist.cdf = function(x) {
for (var p=0, i=0; i<m; ++i) {
p += w[i] * dists[i].cdf(x);
}
return p;
};
dist.icdf = function() {
throw Error('Mixture icdf not supported.');
};
return dist.distributions(dists).weights(weights);
}
function randomUniform(min, max) {
if (max == null) {
max = (min == null ? 1 : min);
min = 0;
}
var dist = {},
a, b, d;
dist.min = function(_) {
return arguments.length
? (a = _ || 0, d = b - a, dist)
: a;
};
dist.max = function(_) {
return arguments.length
? (b = _ || 0, d = b - a, dist)
: b;
};
dist.sample = function() {
return a + d * Math.random();
};
dist.pdf = function(x) {
return (x >= a && x <= b) ? 1 / d : 0;
};
dist.cdf = function(x) {
return x < a ? 0 : x > b ? 1 : (x - a) / d;
};
dist.icdf = function(p) {
return (p >= 0 && p <= 1) ? a + p * d : NaN;
};
return dist.min(min).max(max);
}
function accessor(fn, fields, name) {
return (
fn.fields = fields || [],
fn.fname = name,
fn
);
}
function accessorName(fn) {
return fn == null ? null : fn.fname;
}
function accessorFields(fn) {
return fn == null ? null : fn.fields;
}
function error(message) {
throw Error(message);
}
function splitAccessPath(p) {
var path = [],
q = null,
b = 0,
n = p.length,
s = '',
i, j, c;
p = p + '';
function push() {
path.push(s + p.substring(i, j));
s = '';
i = j + 1;
}
for (i=j=0; j<n; ++j) {
c = p[j];
if (c === '\\') s += p.substring(i, j), i = ++j;
else if (c === q) push(), q = null, b = -1;
else if (q) continue;
else if (i === b && c === '"') i = j + 1, q = c;
else if (i === b && c === "'") i = j + 1, q = c;
else if (c === '.' && !b) (j > i) ? push() : (i = j + 1);
else if (c === '[') {
if (j > i) push();
b = i = j + 1;
}
else if (c === ']') {
if (!b) error('Access path missing open bracket: ' + p);
if (b > 0) push();
b = 0;
i = j + 1;
}
}
if (b) error('Access path missing closing bracket: ' + p);
if (q) error('Access path missing closing quote: ' + p);
if (j > i) ++j, push();
return path;
}
var isArray = Array.isArray;
function isObject(_) {
return _ === Object(_);
}
function isString(_) {
return typeof _ === 'string';
}
function $(x) {
return isArray(x) ? '[' + x.map($) + ']'
: isObject(x) || isString(x) ?
// Output valid JSON and JS source strings.
// See http://timelessrepo.com/json-isnt-a-javascript-subset
JSON.stringify(x).replace('\u2028','\\u2028').replace('\u2029', '\\u2029')
: x;
}
function field(field, name) {
var path = splitAccessPath(field),
code = 'return _[' + path.map($).join('][') + '];';
return accessor(
Function('_', code),
[(field = path.length===1 ? path[0] : field)],
name || field
);
}
var empty = [];
var id = field('id');
var identity$1 = accessor(function(_) { return _; }, empty, 'identity');
var zero = accessor(function() { return 0; }, empty, 'zero');
var one = accessor(function() { return 1; }, empty, 'one');
var truthy = accessor(function() { return true; }, empty, 'true');
var falsy = accessor(function() { return false; }, empty, 'false');
function log(method, level, input) {
var args = [level].concat([].slice.call(input));
console[method].apply(console, args); // eslint-disable-line no-console
}
var None = 0;
var Warn = 1;
var Info = 2;
var Debug = 3;
function logger(_) {
var level = _ || None;
return {
level: function(_) {
return arguments.length ? (level = +_, this) : level;
},
warn: function() {
if (level >= Warn) log('warn', 'WARN', arguments);
return this;
},
info: function() {
if (level >= Info) log('log', 'INFO', arguments);
return this;
},
debug: function() {
if (level >= Debug) log('log', 'DEBUG', arguments);
return this;
}
}
}
function array$1(_) {
return _ != null ? (isArray(_) ? _ : [_]) : [];
}
function compare(fields, orders) {
var idx = [],
cmp = (fields = array$1(fields)).map(function(f, i) {
return f == null ? null
: (idx.push(i), splitAccessPath(f).map($).join(']['));
}),
n = idx.length - 1,
ord = array$1(orders),
code = 'var u,v;return ',
i, j, f, u, v, d, lt, gt;
if (n < 0) return null;
for (j=0; j<=n; ++j) {
i = idx[j];
f = cmp[i];
u = '(u=a['+f+'])';
v = '(v=b['+f+'])';
d = '((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))';
lt = ord[i] !== 'descending' ? (gt=1, -1) : (gt=-1, 1);
code += '(' + u+'<'+v+'||u==null)&&v!=null?' + lt
+ ':(u>v||v==null)&&u!=null?' + gt
+ ':'+d+'!==u&&v===v?' + lt
+ ':v!==v&&u===u?' + gt
+ (i < n ? ':' : ':0');
}
return accessor(
Function('a', 'b', code + ';'),
fields.filter(function(_) { return _ != null; })
);
}
function isFunction(_) {
return typeof _ === 'function';
}
function constant$1(_) {
return isFunction(_) ? _ : function() { return _; };
}
function extend(_) {
for (var x, k, i=1, len=arguments.length; i<len; ++i) {
x = arguments[i];
for (k in x) { _[k] = x[k]; }
}
return _;
}
function extentIndex(array, f) {
var i = -1,
n = array.length,
a, b, c, u, v;
if (f == null) {
while (++i < n) if ((b = array[i]) != null && b >= b) { a = c = b; break; }
u = v = i;
while (++i < n) if ((b = array[i]) != null) {
if (a > b) a = b, u = i;
if (c < b) c = b, v = i;
}
} else {
while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = c = b; break; }
u = v = i;
while (++i < n) if ((b = f(array[i], i, array)) != null) {
if (a > b) a = b, u = i;
if (c < b) c = b, v = i;
}
}
return [u, v];
}
var NULL = {};
function fastmap(input) {
var obj = {},
map,
test;
function has(key) {
return obj.hasOwnProperty(key) && obj[key] !== NULL;
}
map = {
size: 0,
empty: 0,
object: obj,
has: has,
get: function(key) {
return has(key) ? obj[key] : undefined;
},
set: function(key, value) {
if (!has(key)) {
++map.size;
if (obj[key] === NULL) --map.empty;
}
obj[key] = value;
return this;
},
delete: function(key) {
if (has(key)) {
--map.size;
++map.empty;
obj[key] = NULL;
}
return this;
},
clear: function() {
map.size = map.empty = 0;
map.object = obj = {};
},
test: function(_) {
return arguments.length ? (test = _, map) : test;
},
clean: function() {
var next = {},
size = 0,
key, value;
for (key in obj) {
value = obj[key];
if (value !== NULL && (!test || !test(value))) {
next[key] = value;
++size;
}
}
map.size = size;
map.empty = 0;
map.object = (obj = next);
}
};
if (input) Object.keys(input).forEach(function(key) {
map.set(key, input[key]);
});
return map;
}
function inherits(child, parent) {
var proto = (child.prototype = Object.create(parent.prototype));
proto.constructor = child;
return proto;
}
function isNumber(_) {
return typeof _ === 'number';
}
function key(fields) {
fields = fields ? array$1(fields) : fields;
var fn = !(fields && fields.length)
? function() { return ''; }
: Function('_', 'return \'\'+' +
fields.map(function(f) {
return '_[' + splitAccessPath(f).map($).join('][') + ']';
}).join('+\'|\'+') + ';');
return accessor(fn, fields, 'key');
}
function merge$1(compare, array0, array1, output) {
var n0 = array0.length,
n1 = array1.length;
if (!n1) return array0;
if (!n0) return array1;
var merged = output || new array0.constructor(n0 + n1),
i0 = 0, i1 = 0, i = 0;
for (; i0<n0 && i1<n1; ++i) {
merged[i] = compare(array0[i0], array1[i1]) > 0
? array1[i1++]
: array0[i0++];
}
for (; i0<n0; ++i0, ++i) {
merged[i] = array0[i0];
}
for (; i1<n1; ++i1, ++i) {
merged[i] = array1[i1];
}
return merged;
}
function repeat(str, reps) {
var s = '';
while (--reps >= 0) s += str;
return s;
}
function pad(str, length, padchar, align) {
var c = padchar || ' ',
s = str + '',
n = length - s.length;
return n <= 0 ? s
: align === 'left' ? repeat(c, n) + s
: align === 'center' ? repeat(c, ~~(n/2)) + s + repeat(c, Math.ceil(n/2))
: s + repeat(c, n);
}
function peek(array) {
return array[array.length - 1];
}
function toSet(_) {
for (var s={}, i=0, n=_.length; i<n; ++i) s[_[i]] = 1;
return s;
}
function truncate(str, length, align, ellipsis) {
var e = ellipsis != null ? ellipsis : '\u2026',
s = str + '',
n = s.length,
l = Math.max(0, length - e.length);
return n <= length ? s
: align === 'left' ? e + s.slice(n - l)
: align === 'center' ? s.slice(0, Math.ceil(l/2)) + e + s.slice(n - ~~(l/2))
: s.slice(0, l) + e;
}
function visitArray(array, filter, visitor) {
if (array) {
var i = 0, n = array.length, t;
if (filter) {
for (; i<n; ++i) {
if (t = filter(array[i])) visitor(t, i, array);
}
} else {
array.forEach(visitor);
}
}
}
var prefix = "$";
function Map() {}
Map.prototype = map$1.prototype = {
constructor: Map,
has: function(key) {
return (prefix + key) in this;
},
get: function(key) {
return this[prefix + key];
},
set: function(key, value) {
this[prefix + key] = value;
return this;
},
remove: function(key) {
var property = prefix + key;
return property in this && delete this[property];
},
clear: function() {
for (var property in this) if (property[0] === prefix) delete this[property];
},
keys: function() {
var keys = [];
for (var property in this) if (property[0] === prefix) keys.push(property.slice(1));
return keys;
},
values: function() {
var values = [];
for (var property in this) if (property[0] === prefix) values.push(this[property]);
return values;
},
entries: function() {
var entries = [];
for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]});
return entries;
},
size: function() {
var size = 0;
for (var property in this) if (property[0] === prefix) ++size;
return size;
},
empty: function() {
for (var property in this) if (property[0] === prefix) return false;
return true;
},
each: function(f) {
for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this);
}
};
function map$1(object, f) {
var map = new Map;
// Copy constructor.
if (object instanceof Map) object.each(function(value, key) { map.set(key, value); });
// Index array by numeric index or specified key function.
else if (Array.isArray(object)) {
var i = -1,
n = object.length,
o;
if (f == null) while (++i < n) map.set(i, object[i]);
else while (++i < n) map.set(f(o = object[i], i, object), o);
}
// Convert object to map.
else if (object) for (var key in object) map.set(key, object[key]);
return map;
}
function nest() {
var keys = [],
sortKeys = [],
sortValues,
rollup,
nest;
function apply(array, depth, createResult, setResult) {
if (depth >= keys.length) return rollup != null
? rollup(array) : (sortValues != null
? array.sort(sortValues)
: array);
var i = -1,
n = array.length,
key = keys[depth++],
keyValue,
value,
valuesByKey = map$1(),
values,
result = createResult();
while (++i < n) {
if (values = valuesByKey.get(keyValue = key(value = array[i]) + "")) {
values.push(value);
} else {
valuesByKey.set(keyValue, [value]);
}
}
valuesByKey.each(function(values, key) {
setResult(result, key, apply(values, depth, createResult, setResult));
});
return result;
}
function entries(map, depth) {
if (++depth > keys.length) return map;
var array, sortKey = sortKeys[depth - 1];
if (rollup != null && depth >= keys.length) array = map.entries();
else array = [], map.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); });
return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array;
}
return nest = {
object: function(array) { return apply(array, 0, createObject, setObject); },
map: function(array) { return apply(array, 0, createMap, setMap); },
entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); },
key: function(d) { keys.push(d); return nest; },
sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; },
sortValues: function(order) { sortValues = order; return nest; },
rollup: function(f) { rollup = f; return nest; }
};
}
function createObject() {
return {};
}
function setObject(object, key, value) {
object[key] = value;
}
function createMap() {
return map$1();
}
function setMap(map, key, value) {
map.set(key, value);
}
var proto = map$1.prototype;
var noop = {value: function() {}};
function dispatch() {
for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
if (!(t = arguments[i] + "") || (t in _)) throw new Error("illegal type: " + t);
_[t] = [];
}
return new Dispatch(_);
}
function Dispatch(_) {
this._ = _;
}
function parseTypenames(typenames, types) {
return typenames.trim().split(/^|\s+/).map(function(t) {
var name = "", i = t.indexOf(".");
if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
return {type: t, name: name};
});
}
Dispatch.prototype = dispatch.prototype = {
constructor: Dispatch,
on: function(typename, callback) {
var _ = this._,
T = parseTypenames(typename + "", _),
t,
i = -1,
n = T.length;
// If no callback was specified, return the callback of the given type and name.
if (arguments.length < 2) {
while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;
return;
}
// If a type was specified, set the callback for the given type and name.
// Otherwise, if a null callback was specified, remove callbacks of the given name.
if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
while (++i < n) {
if (t = (typename = T[i]).type) _[t] = set$1(_[t], typename.name, callback);
else if (callback == null) for (t in _) _[t] = set$1(_[t], typename.name, null);
}
return this;
},
copy: function() {
var copy = {}, _ = this._;
for (var t in _) copy[t] = _[t].slice();
return new Dispatch(copy);
},
call: function(type, that) {
if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
},
apply: function(type, that, args) {
if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
}
};
function get(type, name) {
for (var i = 0, n = type.length, c; i < n; ++i) {
if ((c = type[i]).name === name) {
return c.value;
}
}
}
function set$1(type, name, callback) {
for (var i = 0, n = type.length; i < n; ++i) {
if (type[i].name === name) {
type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
break;
}
}
if (callback != null) type.push({name: name, value: callback});
return type;
}
function request(url, callback) {
var request,
event = dispatch("beforesend", "progress", "load", "error"),
mimeType,
headers = map$1(),
xhr = new XMLHttpRequest,
user = null,
password = null,
response,
responseType,
timeout = 0;
// If IE does not support CORS, use XDomainRequest.
if (typeof XDomainRequest !== "undefined"
&& !("withCredentials" in xhr)
&& /^(http(s)?:)?\/\//.test(url)) xhr = new XDomainRequest;
"onload" in xhr
? xhr.onload = xhr.onerror = xhr.ontimeout = respond
: xhr.onreadystatechange = function(o) { xhr.readyState > 3 && respond(o); };
function respond(o) {
var status = xhr.status, result;
if (!status && hasResponse(xhr)
|| status >= 200 && status < 300
|| status === 304) {
if (response) {
try {
result = response.call(request, xhr);
} catch (e) {
event.call("error", request, e);
return;
}
} else {
result = xhr;
}
event.call("load", request, result);
} else {
event.call("error", request, o);
}
}
xhr.onprogress = function(e) {
event.call("progress", request, e);
};
request = {
header: function(name, value) {
name = (name + "").toLowerCase();
if (arguments.length < 2) return headers.get(name);
if (value == null) headers.remove(name);
else headers.set(name, value + "");
return request;
},
// If mimeType is non-null and no Accept header is set, a default is used.
mimeType: function(value) {
if (!arguments.length) return mimeType;
mimeType = value == null ? null : value + "";
return request;
},
// Specifies what type the response value should take;
// for instance, arraybuffer, blob, document, or text.
responseType: function(value) {
if (!arguments.length) return responseType;
responseType = value;
return request;
},
timeout: function(value) {
if (!arguments.length) return timeout;
timeout = +value;
return request;
},
user: function(value) {
return arguments.length < 1 ? user : (user = value == null ? null : value + "", request);
},
password: function(value) {
return arguments.length < 1 ? password : (password = value == null ? null : value + "", request);
},
// Specify how to convert the response content to a specific type;
// changes the callback value on "load" events.
response: function(value) {
response = value;
return request;
},
// Alias for send("GET", …).
get: function(data, callback) {
return request.send("GET", data, callback);
},
// Alias for send("POST", …).
post: function(data, callback) {
return request.send("POST", data, callback);
},
// If callback is non-null, it will be used for error and load events.
send: function(method, data, callback) {
xhr.open(method, url, true, user, password);
if (mimeType != null && !headers.has("accept")) headers.set("accept", mimeType + ",*/*");
if (xhr.setRequestHeader) headers.each(function(value, name) { xhr.setRequestHeader(name, value); });
if (mimeType != null && xhr.overrideMimeType) xhr.overrideMimeType(mimeType);
if (responseType != null) xhr.responseType = responseType;
if (timeout > 0) xhr.timeout = timeout;
if (callback == null && typeof data === "function") callback = data, data = null;
if (callback != null && callback.length === 1) callback = fixCallback(callback);
if (callback != null) request.on("error", callback).on("load", function(xhr) { callback(null, xhr); });
event.call("beforesend", request, xhr);
xhr.send(data == null ? null : data);
return request;
},
abort: function() {
xhr.abort();
return request;
},
on: function() {
var value = event.on.apply(event, arguments);
return value === event ? request : value;
}
};
if (callback != null) {
if (typeof callback !== "function") throw new Error("invalid callback: " + callback);
return request.get(callback);
}
return request;
}
function fixCallback(callback) {
return function(error, xhr) {
callback(error == null ? xhr : null);
};
}
function hasResponse(xhr) {
var type = xhr.responseType;
return type && type !== "text"
? xhr.response // null on error
: xhr.responseText; // "" on error
}
function objectConverter(columns) {
return new Function("d", "return {" + columns.map(function(name, i) {
return JSON.stringify(name) + ": d[" + i + "]";
}).join(",") + "}");
}
function customConverter(columns, f) {
var object = objectConverter(columns);
return function(row, i) {
return f(object(row), i, columns);
};
}
// Compute unique columns in order of discovery.
function inferColumns(rows) {
var columnSet = Object.create(null),
columns = [];
rows.forEach(function(row) {
for (var column in row) {
if (!(column in columnSet)) {
columns.push(columnSet[column] = column);
}
}
});
return columns;
}
function dsvFormat(delimiter) {
var reFormat = new RegExp("[\"" + delimiter + "\n\r]"),
delimiterCode = delimiter.charCodeAt(0);
function parse(text, f) {
var convert, columns, rows = parseRows(text, function(row, i) {
if (convert) return convert(row, i - 1);
columns = row, convert = f ? customConverter(row, f) : objectConverter(row);
});
rows.columns = columns;
return rows;
}
function parseRows(text, f) {
var EOL = {}, // sentinel value for end-of-line
EOF = {}, // sentinel value for end-of-file
rows = [], // output rows
N = text.length,
I = 0, // current character index
n = 0, // the current line number
t, // the current token
eol; // is the current token followed by EOL?
function token() {
if (I >= N) return EOF; // special case: end of file
if (eol) return eol = false, EOL; // special case: end of line
// special case: quotes
var j = I, c;
if (text.charCodeAt(j) === 34) {
var i = j;
while (i++ < N) {
if (text.charCodeAt(i) === 34) {
if (text.charCodeAt(i + 1) !== 34) break;
++i;
}
}
I = i + 2;
c = text.charCodeAt(i + 1);
if (c === 13) {
eol = true;
if (text.charCodeAt(i + 2) === 10) ++I;
} else if (c === 10) {
eol = true;
}
return text.slice(j + 1, i).replace(/""/g, "\"");
}
// common case: find next delimiter or newline
while (I < N) {
var k = 1;
c = text.charCodeAt(I++);
if (c === 10) eol = true; // \n
else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \r|\r\n
else if (c !== delimiterCode) continue;
return text.slice(j, I - k);
}
// special case: last token before EOF
return text.slice(j);
}
while ((t = token()) !== EOF) {
var a = [];
while (t !== EOL && t !== EOF) {
a.push(t);
t = token();
}
if (f && (a = f(a, n++)) == null) continue;
rows.push(a);
}
return rows;
}
function format(rows, columns) {
if (columns == null) columns = inferColumns(rows);
return [columns.map(formatValue).join(delimiter)].concat(rows.map(function(row) {
return columns.map(function(column) {
return formatValue(row[column]);
}).join(delimiter);
})).join("\n");
}
function formatRows(rows) {
return rows.map(formatRow).join("\n");
}
function formatRow(row) {
return row.map(formatValue).join(delimiter);
}
function formatValue(text) {
return text == null ? ""
: reFormat.test(text += "") ? "\"" + text.replace(/\"/g, "\"\"") + "\""
: text;
}
return {
parse: parse,
parseRows: parseRows,
format: format,
formatRows: formatRows
};
}
var csv$1 = dsvFormat(",");
var tsv = dsvFormat("\t");
// Matches absolute URLs with optional protocol
// https://... file://... //...
var protocol_re = /^([A-Za-z]+:)?\/\//;
// Special treatment in node.js for the file: protocol
var fileProtocol = 'file://';
// Request options to check for d3-request
var requestOptions = [
'mimeType',
'responseType',
'user',
'password'
];
/**
* Creates a new loader instance that provides methods for requesting files
* from either the network or disk, and for sanitizing request URIs.
* @param {object} [options] - Optional default loading options to use.
* @return {object} - A new loader instance.
*/
function loader(options) {
return {
options: options || {},
sanitize: sanitize,
load: load,
file: file,
http: http
};
}
function marshall(loader, options) {
return extend({}, loader.options, options);
}
/**
* Load an external resource, typically either from the web or from the local
* filesystem. This function uses {@link sanitize} to first sanitize the uri,
* then calls either {@link http} (for web requests) or {@link file} (for
* filesystem loading).
* @param {string} uri - The resource indicator (e.g., URL or filename).
* @param {object} [options] - Optional loading options. These options will
* override any existing default options.
* @return {Promise} - A promise that resolves to the loaded content.
*/
function load(uri, options) {
var loader = this;
return loader.sanitize(uri, options)
.then(function(opt) {
var url = opt.href;
return (startsWith(url, fileProtocol))
? loader.file(url.slice(fileProtocol.length))
: loader.http(url, options);
});
}
/**
* URI sanitizer function.
* @param {string} uri - The uri (url or filename) to sanity check.
* @param {object} options - An options hash.
* @return {Promise} - A promise that resolves to an object containing
* sanitized uri data, or rejects it the input uri is deemed invalid.
* The properties of the resolved object are assumed to be
* valid attributes for an HTML 'a' tag. The sanitized uri *must* be
* provided by the 'href' property of the returned object.
*/
function sanitize(uri, options) {
options = marshall(this, options);
return new Promise(function(accept, reject) {
var isFile, hasProtocol, loadFile, base;
if (uri == null || typeof uri !== 'string') {
reject('Sanitize failure, invalid URI: ' + $(uri));
return;
}
hasProtocol = protocol_re.test(uri);
// if relative url (no protocol/host), prepend baseURL
if ((base = options.baseURL) && !hasProtocol) {
// Ensure that there is a slash between the baseURL (e.g. hostname) and url
if (!startsWith(uri, '/') && base[base.length-1] !== '/') {
uri = '/' + uri;
}
uri = base + uri;
}
// should we load from file system?
loadFile = (isFile = startsWith(uri, fileProtocol))
|| options.mode === 'file'
|| options.mode !== 'http' && !hasProtocol && fs();
if (loadFile) {
// prepend file protocol, if not already present
uri = (isFile ? '' : fileProtocol) + uri;
} else if (startsWith(uri, '//')) {
// if relative protocol (starts with '//'), prepend default protocol
uri = (options.defaultProtocol || 'http') + ':' + uri;
}
accept({href: uri});
});
}
/**
* HTTP request loader.
* @param {string} url - The url to request.
* @param {object} options - An options hash.
* @return {Promise} - A promise that resolves to the file contents.
*/
function http(url, options) {
options = marshall(this, options);
return new Promise(function(accept, reject) {
var req = request(url),
name;
for (name in options.headers) {
req.header(name, options.headers[name]);
}
requestOptions.forEach(function(name) {
if (options[name]) req[name](options[name]);
});
req.on('error', function(error) {
reject(error || 'Error loading URL: ' + url);
})
.on('load', function(result) {
var text = result && result.responseText;
(!result || result.status === 0)
? reject(text || 'Error')
: accept(text);
})
.get();
});
}
/**
* File system loader.
* @param {string} filename - The file system path to load.
* @return {Promise} - A promise that resolves to the file contents.
*/
function file(filename) {
return new Promise(function(accept, reject) {
var f = fs();
f ? f.readFile(filename, function(error, data) {
if (error) reject(error);
else accept(data);
})
: reject('No file system access for ' + filename);
});
}
function fs() {
var fs = typeof require === 'function' && require('fs');
return fs && isFunction(fs.readFile) ? fs : null;
}
function startsWith(string, query) {
return string == null ? false : string.lastIndexOf(query, 0) === 0;
}
var typeParsers = {
boolean: toBoolean,
integer: toNumber,
number: toNumber,
date: toDate,
string: toString
};
var typeTests = [
isBoolean,
isInteger,
isNumber$1,
isDate
];
var typeList = [
'boolean',
'integer',
'number',
'date'
];
function inferType(values, field) {
var tests = typeTests.slice(),
value, i, n, j;
for (i=0, n=values.length; i<n; ++i) {
value = field ? values[i][field] : values[i];
for (j=0; j<tests.length; ++j) {
if (isValid(value) && !tests[j](value)) {
tests.splice(j, 1); --j;
}
}
if (tests.length === 0) return 'string';
}
return typeList[typeTests.indexOf(tests[0])];
}
function inferTypes(data, fields) {
return fields.reduce(function(types, field) {
return types[field] = inferType(data, field), types;
}, {});
}
// -- Type Coercion ----
function toNumber(_) {
return _ == null || _ === '' ? null : +_;
}
function toBoolean(_) {
return _ == null || _ === '' ? null : !_ || _ === 'false' ? false : !!_;
}
function toDate(_, parser) {
return _ == null || _ === '' ? null
: (parser ? parser(_) : Date.parse(_));
}
function toString(_) {
return _ == null || _ === '' ? null : _ + '';
}
// -- Type Checks ----
function isValid(_) {
return _ != null && _ === _;
}
function isBoolean(_) {
return _ === 'true' || _ === 'false' || _ === true || _ === false;
}
function isDate(_) {
return !isNaN(Date.parse(_));
}
function isNumber$1(_) {
return !isNaN(+_) && !(_ instanceof Date);
}
function isInteger(_) {
return isNumber$1(_) && (_=+_) === ~~_;
}
function delimitedFormat(delimiter) {
return function(data, format) {
var delim = {delimiter: delimiter};
return dsv$1(data, format ? extend(format, delim) : delim);
};
}
function dsv$1(data, format) {
if (format.header) {
data = format.header
.map($)
.join(format.delimiter) + '\n' + data;
}
return dsvFormat(format.delimiter).parse(data+'');
}
function isBuffer(_) {
return (typeof Buffer === 'function' && isFunction(Buffer.isBuffer))
? Buffer.isBuffer(_) : false;
}
function json$1(data, format) {
data = isObject(data) && !isBuffer(data) ? data : JSON.parse(data);
return (format && format.property)
? field(format.property)(data)
: data;
}
function noop$1() {}
function transformAbsolute(transform) {
if (!transform) return noop$1;
var x0,
y0,
kx = transform.scale[0],
ky = transform.scale[1],
dx = transform.translate[0],
dy = transform.translate[1];
return function(point, i) {
if (!i) x0 = y0 = 0;
point[0] = (x0 += point[0]) * kx + dx;
point[1] = (y0 += point[1]) * ky + dy;
};
}
function reverse(array, n) {
var t, j = array.length, i = j - n;
while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;
}
function feature(topology, o) {
return o.type === "GeometryCollection" ? {
type: "FeatureCollection",
features: o.geometries.map(function(o) { return feature$1(topology, o); })
} : feature$1(topology, o);
}
function feature$1(topology, o) {
var f = {
type: "Feature",
id: o.id,
properties: o.properties || {},
geometry: object(topology, o)
};
if (o.id == null) delete f.id;
return f;
}
function object(topology, o) {
var absolute = transformAbsolute(topology.transform),
arcs = topology.arcs;
function arc(i, points) {
if (points.length) points.pop();
for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) {
points.push(p = a[k].slice());
absolute(p, k);
}
if (i < 0) reverse(points, n);
}
function point(p) {
p = p.slice();
absolute(p, 0);
return p;
}
function line(arcs) {
var points = [];
for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);
if (points.length < 2) points.push(points[0].slice());
return points;
}
function ring(arcs) {
var points = line(arcs);
while (points.length < 4) points.push(points[0].slice());
return points;
}
function polygon(arcs) {
return arcs.map(ring);
}
function geometry(o) {
var t = o.type;
return t === "GeometryCollection" ? {type: t, geometries: o.geometries.map(geometry)}
: t in geometryType ? {type: t, coordinates: geometryType[t](o)}
: null;
}
var geometryType = {
Point: function(o) { return point(o.coordinates); },
MultiPoint: function(o) { return o.coordinates.map(point); },
LineString: function(o) { return line(o.arcs); },
MultiLineString: function(o) { return o.arcs.map(line); },
Polygon: function(o) { return polygon(o.arcs); },
MultiPolygon: function(o) { return o.arcs.map(polygon); }
};
return geometry(o);
}
function stitchArcs(topology, arcs) {
var stitchedArcs = {},
fragmentByStart = {},
fragmentByEnd = {},
fragments = [],
emptyIndex = -1;
// Stitch empty arcs first, since they may be subsumed by other arcs.
arcs.forEach(function(i, j) {
var arc = topology.arcs[i < 0 ? ~i : i], t;
if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {
t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;
}
});
arcs.forEach(function(i) {
var e = ends(i),
start = e[0],
end = e[1],
f, g;
if (f = fragmentByEnd[start]) {
delete fragmentByEnd[f.end];
f.push(i);
f.end = end;
if (g = fragmentByStart[end]) {
delete fragmentByStart[g.start];
var fg = g === f ? f : f.concat(g);
fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;
} else {
fragmentByStart[f.start] = fragmentByEnd[f.end] = f;
}
} else if (f = fragmentByStart[end]) {
delete fragmentByStart[f.start];
f.unshift(i);
f.start = start;
if (g = fragmentByEnd[start]) {
delete fragmentByEnd[g.end];
var gf = g === f ? f : g.concat(f);
fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;
} else {
fragmentByStart[f.start] = fragmentByEnd[f.end] = f;
}
} else {
f = [i];
fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;
}
});
function ends(i) {
var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;
if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; });
else p1 = arc[arc.length - 1];
return i < 0 ? [p1, p0] : [p0, p1];
}
function flush(fragmentByEnd, fragmentByStart) {
for (var k in fragmentByEnd) {
var f = fragmentByEnd[k];
delete fragmentByStart[f.start];
delete f.start;
delete f.end;
f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });
fragments.push(f);
}
}
flush(fragmentByEnd, fragmentByStart);
flush(fragmentByStart, fragmentByEnd);
arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });
return fragments;
}
function mesh(topology) {
return object(topology, meshArcs.apply(this, arguments));
}
function meshArcs(topology, o, filter) {
var arcs = [];
function arc(i) {
var j = i < 0 ? ~i : i;
(geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom});
}
function line(arcs) {
arcs.forEach(arc);
}
function polygon(arcs) {
arcs.forEach(line);
}
function geometry(o) {
if (o.type === "GeometryCollection") o.geometries.forEach(geometry);
else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs);
}
if (arguments.length > 1) {
var geomsByArc = [],
geom;
var geometryType = {
LineString: line,
MultiLineString: polygon,
Polygon: polygon,
MultiPolygon: function(arcs) { arcs.forEach(polygon); }
};
geometry(o);
geomsByArc.forEach(arguments.length < 3
? function(geoms) { arcs.push(geoms[0].i); }
: function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });
} else {
for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i);
}
return {type: "MultiLineString", arcs: stitchArcs(topology, arcs)};
}
function topojson(data, format) {
var object, property;
data = json$1(data, format);
if (format && (property = format.feature)) {
return (object = data.objects[property])
? feature(data, object).features
: error('Invalid TopoJSON object: ' + property);
}
else if (format && (property = format.mesh)) {
return (object = data.objects[property])
? [mesh(data, object)]
: error('Invalid TopoJSON object: ' + property);
}
error('Missing TopoJSON feature or mesh parameter.');
}
var formats = {
dsv: dsv$1,
csv: delimitedFormat(','),
tsv: delimitedFormat('\t'),
json: json$1,
topojson: topojson
};
function formats$1(name, format) {
return arguments.length > 1 ? (formats[name] = format, this)
: formats.hasOwnProperty(name) ? formats[name] : null;
}
var t0 = new Date;
var t1 = new Date;
function newInterval(floori, offseti, count, field) {
function interval(date) {
return floori(date = new Date(+date)), date;
}
interval.floor = interval;
interval.ceil = function(date) {
return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
};
interval.round = function(date) {
var d0 = interval(date),
d1 = interval.ceil(date);
return date - d0 < d1 - date ? d0 : d1;
};
interval.offset = function(date, step) {
return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
};
interval.range = function(start, stop, step) {
var range = [];
start = interval.ceil(start);
step = step == null ? 1 : Math.floor(step);
if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date
do range.push(new Date(+start)); while (offseti(start, step), floori(start), start < stop)
return range;
};
interval.filter = function(test) {
return newInterval(function(date) {
if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
}, function(date, step) {
if (date >= date) while (--step >= 0) while (offseti(date, 1), !test(date)) {} // eslint-disable-line no-empty
});
};
if (count) {
interval.count = function(start, end) {
t0.setTime(+start), t1.setTime(+end);
floori(t0), floori(t1);
return Math.floor(count(t0, t1));
};
interval.every = function(step) {
step = Math.floor(step);
return !isFinite(step) || !(step > 0) ? null
: !(step > 1) ? interval
: interval.filter(field
? function(d) { return field(d) % step === 0; }
: function(d) { return interval.count(0, d) % step === 0; });
};
}
return interval;
}
var millisecond = newInterval(function() {
// noop
}, function(date, step) {
date.setTime(+date + step);
}, function(start, end) {
return end - start;
});
// An optimized implementation for this simple case.
millisecond.every = function(k) {
k = Math.floor(k);
if (!isFinite(k) || !(k > 0)) return null;
if (!(k > 1)) return millisecond;
return newInterval(function(date) {
date.setTime(Math.floor(date / k) * k);
}, function(date, step) {
date.setTime(+date + step * k);
}, function(start, end) {
return (end - start) / k;
});
};
var durationSecond = 1e3;
var durationMinute = 6e4;
var durationHour = 36e5;
var durationDay = 864e5;
var durationWeek = 6048e5;
var second = newInterval(function(date) {
date.setTime(Math.floor(date / durationSecond) * durationSecond);
}, function(date, step) {
date.setTime(+date + step * durationSecond);
}, function(start, end) {
return (end - start) / durationSecond;
}, function(date) {
return date.getUTCSeconds();
});
var minute = newInterval(function(date) {
date.setTime(Math.floor(date / durationMinute) * durationMinute);
}, function(date, step) {
date.setTime(+date + step * durationMinute);
}, function(start, end) {
return (end - start) / durationMinute;
}, function(date) {
return date.getMinutes();
});
var hour = newInterval(function(date) {
var offset = date.getTimezoneOffset() * durationMinute % durationHour;
if (offset < 0) offset += durationHour;
date.setTime(Math.floor((+date - offset) / durationHour) * durationHour + offset);
}, function(date, step) {
date.setTime(+date + step * durationHour);
}, function(start, end) {
return (end - start) / durationHour;
}, function(date) {
return date.getHours();
});
var day = newInterval(function(date) {
date.setHours(0, 0, 0, 0);
}, function(date, step) {
date.setDate(date.getDate() + step);
}, function(start, end) {
return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay;
}, function(date) {
return date.getDate() - 1;
});
function weekday(i) {
return newInterval(function(date) {
date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
date.setHours(0, 0, 0, 0);
}, function(date, step) {
date.setDate(date.getDate() + step * 7);
}, function(start, end) {
return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
});
}
var timeWeek = weekday(0);
var monday = weekday(1);
var month = newInterval(function(date) {
date.setDate(1);
date.setHours(0, 0, 0, 0);
}, function(date, step) {
date.setMonth(date.getMonth() + step);
}, function(start, end) {
return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
}, function(date) {
return date.getMonth();
});
var year = newInterval(function(date) {
date.setMonth(0, 1);
date.setHours(0, 0, 0, 0);
}, function(date, step) {
date.setFullYear(date.getFullYear() + step);
}, function(start, end) {
return end.getFullYear() - start.getFullYear();
}, function(date) {
return date.getFullYear();
});
// An optimized implementation for this simple case.
year.every = function(k) {
return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
date.setFullYear(Math.floor(date.getFullYear() / k) * k);
date.setMonth(0, 1);
date.setHours(0, 0, 0, 0);
}, function(date, step) {
date.setFullYear(date.getFullYear() + step * k);
});
};
var utcMinute = newInterval(function(date) {
date.setUTCSeconds(0, 0);
}, function(date, step) {
date.setTime(+date + step * durationMinute);
}, function(start, end) {
return (end - start) / durationMinute;
}, function(date) {
return date.getUTCMinutes();
});
var utcHour = newInterval(function(date) {
date.setUTCMinutes(0, 0, 0);
}, function(date, step) {
date.setTime(+date + step * durationHour);
}, function(start, end) {
return (end - start) / durationHour;
}, function(date) {
return date.getUTCHours();
});
var utcDay = newInterval(function(date) {
date.setUTCHours(0, 0, 0, 0);
}, function(date, step) {
date.setUTCDate(date.getUTCDate() + step);
}, function(start, end) {
return (end - start) / durationDay;
}, function(date) {
return date.getUTCDate() - 1;
});
function utcWeekday(i) {
return newInterval(function(date) {
date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
date.setUTCHours(0, 0, 0, 0);
}, function(date, step) {
date.setUTCDate(date.getUTCDate() + step * 7);
}, function(start, end) {
return (end - start) / durationWeek;
});
}
var utcWeek = utcWeekday(0);
var utcMonday = utcWeekday(1);
var utcMonth = newInterval(function(date) {
date.setUTCDate(1);
date.setUTCHours(0, 0, 0, 0);
}, function(date, step) {
date.setUTCMonth(date.getUTCMonth() + step);
}, function(start, end) {
return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
}, function(date) {
return date.getUTCMonth();
});
var utcYear = newInterval(function(date) {
date.setUTCMonth(0, 1);
date.setUTCHours(0, 0, 0, 0);
}, function(date, step) {
date.setUTCFullYear(date.getUTCFullYear() + step);
}, function(start, end) {
return end.getUTCFullYear() - start.getUTCFullYear();
}, function(date) {
return date.getUTCFullYear();
});
// An optimized implementation for this simple case.
utcYear.every = function(k) {
return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
date.setUTCMonth(0, 1);
date.setUTCHours(0, 0, 0, 0);
}, function(date, step) {
date.setUTCFullYear(date.getUTCFullYear() + step * k);
});
};
function localDate(d) {
if (0 <= d.y && d.y < 100) {
var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
date.setFullYear(d.y);
return date;
}
return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
}
function utcDate(d) {
if (0 <= d.y && d.y < 100) {
var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
date.setUTCFullYear(d.y);
return date;
}
return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
}
function newYear(y) {
return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};
}
function formatLocale(locale) {
var locale_dateTime = locale.dateTime,
locale_date = locale.date,
locale_time = locale.time,
locale_periods = locale.periods,
locale_weekdays = locale.days,
locale_shortWeekdays = locale.shortDays,
locale_months = locale.months,
locale_shortMonths = locale.shortMonths;
var periodRe = formatRe(locale_periods),
periodLookup = formatLookup(locale_periods),
weekdayRe = formatRe(locale_weekdays),
weekdayLookup = formatLookup(locale_weekdays),
shortWeekdayRe = formatRe(locale_shortWeekdays),
shortWeekdayLookup = formatLookup(locale_shortWeekdays),
monthRe = formatRe(locale_months),
monthLookup = formatLookup(locale_months),
shortMonthRe = formatRe(locale_shortMonths),
shortMonthLookup = formatLookup(locale_shortMonths);
var formats = {
"a": formatShortWeekday,
"A": formatWeekday,
"b": formatShortMonth,
"B": formatMonth,
"c": null,
"d": formatDayOfMonth,
"e": formatDayOfMonth,
"H": formatHour24,
"I": formatHour12,
"j": formatDayOfYear,
"L": formatMilliseconds,
"m": formatMonthNumber,
"M": formatMinutes,
"p": formatPeriod,
"S": formatSeconds,
"U": formatWeekNumberSunday,
"w": formatWeekdayNumber,
"W": formatWeekNumberMonday,
"x": null,
"X": null,
"y": formatYear,
"Y": formatFullYear,
"Z": formatZone,
"%": formatLiteralPercent
};
var utcFormats = {
"a": formatUTCShortWeekday,
"A": formatUTCWeekday,
"b": formatUTCShortMonth,
"B": formatUTCMonth,
"c": null,
"d": formatUTCDayOfMonth,
"e": formatUTCDayOfMonth,
"H": formatUTCHour24,
"I": formatUTCHour12,
"j": formatUTCDayOfYear,
"L": formatUTCMilliseconds,
"m": formatUTCMonthNumber,
"M": formatUTCMinutes,
"p": formatUTCPeriod,
"S": formatUTCSeconds,
"U": formatUTCWeekNumberSunday,
"w": formatUTCWeekdayNumber,
"W": formatUTCWeekNumberMonday,
"x": null,
"X": null,
"y": formatUTCYear,
"Y": formatUTCFullYear,
"Z": formatUTCZone,
"%": formatLiteralPercent
};
var parses = {
"a": parseShortWeekday,
"A": parseWeekday,
"b": parseShortMonth,
"B": parseMonth,
"c": parseLocaleDateTime,
"d": parseDayOfMonth,
"e": parseDayOfMonth,
"H": parseHour24,
"I": parseHour24,
"j": parseDayOfYear,
"L": parseMilliseconds,
"m": parseMonthNumber,
"M": parseMinutes,
"p": parsePeriod,
"S": parseSeconds,
"U": parseWeekNumberSunday,
"w": parseWeekdayNumber,
"W": parseWeekNumberMonday,
"x": parseLocaleDate,
"X": parseLocaleTime,
"y": parseYear,
"Y": parseFullYear,
"Z": parseZone,
"%": parseLiteralPercent
};
// These recursive directive definitions must be deferred.
formats.x = newFormat(locale_date, formats);
formats.X = newFormat(locale_time, formats);
formats.c = newFormat(locale_dateTime, formats);
utcFormats.x = newFormat(locale_date, utcFormats);
utcFormats.X = newFormat(locale_time, utcFormats);
utcFormats.c = newFormat(locale_dateTime, utcFormats);
function newFormat(specifier, formats) {
return function(date) {
var string = [],
i = -1,
j = 0,
n = specifier.length,
c,
pad,
format;
if (!(date instanceof Date)) date = new Date(+date);
while (++i < n) {
if (specifier.charCodeAt(i) === 37) {
string.push(specifier.slice(j, i));
if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);
else pad = c === "e" ? " " : "0";
if (format = formats[c]) c = format(date, pad);
string.push(c);
j = i + 1;
}
}
string.push(specifier.slice(j, i));
return string.join("");
};
}
function newParse(specifier, newDate) {
return function(string) {
var d = newYear(1900),
i = parseSpecifier(d, specifier, string += "", 0);
if (i != string.length) return null;
// The am-pm flag is 0 for AM, and 1 for PM.
if ("p" in d) d.H = d.H % 12 + d.p * 12;
// Convert day-of-week and week-of-year to day-of-year.
if ("W" in d || "U" in d) {
if (!("w" in d)) d.w = "W" in d ? 1 : 0;
var day = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay();
d.m = 0;
d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
}
// If a time zone is specified, all fields are interpreted as UTC and then
// offset according to the specified time zone.
if ("Z" in d) {
d.H += d.Z / 100 | 0;
d.M += d.Z % 100;
return utcDate(d);
}
// Otherwise, all fields are in local time.
return newDate(d);
};
}
function parseSpecifier(d, specifier, string, j) {
var i = 0,
n = specifier.length,
m = string.length,
c,
parse;
while (i < n) {
if (j >= m) return -1;
c = specifier.charCodeAt(i++);
if (c === 37) {
c = specifier.charAt(i++);
parse = parses[c in pads ? specifier.charAt(i++) : c];
if (!parse || ((j = parse(d, string, j)) < 0)) return -1;
} else if (c != string.charCodeAt(j++)) {
return -1;
}
}
return j;
}
function parsePeriod(d, string, i) {
var n = periodRe.exec(string.slice(i));
return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;
}
function parseShortWeekday(d, string, i) {
var n = shortWeekdayRe.exec(string.slice(i));
return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
}
function parseWeekday(d, string, i) {
var n = weekdayRe.exec(string.slice(i));
return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
}
function parseShortMonth(d, string, i) {
var n = shortMonthRe.exec(string.slice(i));
return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
}
function parseMonth(d, string, i) {
var n = monthRe.exec(string.slice(i));
return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
}
function parseLocaleDateTime(d, string, i) {
return parseSpecifier(d, locale_dateTime, string, i);
}
function parseLocaleDate(d, string, i) {
return parseSpecifier(d, locale_date, string, i);
}
function parseLocaleTime(d, string, i) {
return parseSpecifier(d, locale_time, string, i);
}
function formatShortWeekday(d) {
return locale_shortWeekdays[d.getDay()];
}
function formatWeekday(d) {
return locale_weekdays[d.getDay()];
}
function formatShortMonth(d) {
return locale_shortMonths[d.getMonth()];
}
function formatMonth(d) {
return locale_months[d.getMonth()];
}
function formatPeriod(d) {
return locale_periods[+(d.getHours() >= 12)];
}
function formatUTCShortWeekday(d) {
return locale_shortWeekdays[d.getUTCDay()];
}
function formatUTCWeekday(d) {
return locale_weekdays[d.getUTCDay()];
}
function formatUTCShortMonth(d) {
return locale_shortMonths[d.getUTCMonth()];
}
function formatUTCMonth(d) {
return locale_months[d.getUTCMonth()];
}
function formatUTCPeriod(d) {
return locale_periods[+(d.getUTCHours() >= 12)];
}
return {
format: function(specifier) {
var f = newFormat(specifier += "", formats);
f.toString = function() { return specifier; };
return f;
},
parse: function(specifier) {
var p = newParse(specifier += "", localDate);
p.toString = function() { return specifier; };
return p;
},
utcFormat: function(specifier) {
var f = newFormat(specifier += "", utcFormats);
f.toString = function() { return specifier; };
return f;
},
utcParse: function(specifier) {
var p = newParse(specifier, utcDate);
p.toString = function() { return specifier; };
return p;
}
};
}
var pads = {"-": "", "_": " ", "0": "0"};
var numberRe = /^\s*\d+/;
var percentRe = /^%/;
var requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
function pad$1(value, fill, width) {
var sign = value < 0 ? "-" : "",
string = (sign ? -value : value) + "",
length = string.length;
return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
}
function requote(s) {
return s.replace(requoteRe, "\\$&");
}
function formatRe(names) {
return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
}
function formatLookup(names) {
var map = {}, i = -1, n = names.length;
while (++i < n) map[names[i].toLowerCase()] = i;
return map;
}
function parseWeekdayNumber(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 1));
return n ? (d.w = +n[0], i + n[0].length) : -1;
}
function parseWeekNumberSunday(d, string, i) {
var n = numberRe.exec(string.slice(i));
return n ? (d.U = +n[0], i + n[0].length) : -1;
}
function parseWeekNumberMonday(d, string, i) {
var n = numberRe.exec(string.slice(i));
return n ? (d.W = +n[0], i + n[0].length) : -1;
}
function parseFullYear(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 4));
return n ? (d.y = +n[0], i + n[0].length) : -1;
}
function parseYear(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;
}
function parseZone(d, string, i) {
var n = /^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(string.slice(i, i + 6));
return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
}
function parseMonthNumber(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
}
function parseDayOfMonth(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.d = +n[0], i + n[0].length) : -1;
}
function parseDayOfYear(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 3));
return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
}
function parseHour24(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.H = +n[0], i + n[0].length) : -1;
}
function parseMinutes(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.M = +n[0], i + n[0].length) : -1;
}
function parseSeconds(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.S = +n[0], i + n[0].length) : -1;
}
function parseMilliseconds(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 3));
return n ? (d.L = +n[0], i + n[0].length) : -1;
}
function parseLiteralPercent(d, string, i) {
var n = percentRe.exec(string.slice(i, i + 1));
return n ? i + n[0].length : -1;
}
function formatDayOfMonth(d, p) {
return pad$1(d.getDate(), p, 2);
}
function formatHour24(d, p) {
return pad$1(d.getHours(), p, 2);
}
function formatHour12(d, p) {
return pad$1(d.getHours() % 12 || 12, p, 2);
}
function formatDayOfYear(d, p) {
return pad$1(1 + day.count(year(d), d), p, 3);
}
function formatMilliseconds(d, p) {
return pad$1(d.getMilliseconds(), p, 3);
}
function formatMonthNumber(d, p) {
return pad$1(d.getMonth() + 1, p, 2);
}
function formatMinutes(d, p) {
return pad$1(d.getMinutes(), p, 2);
}
function formatSeconds(d, p) {
return pad$1(d.getSeconds(), p, 2);
}
function formatWeekNumberSunday(d, p) {
return pad$1(timeWeek.count(year(d), d), p, 2);
}
function formatWeekdayNumber(d) {
return d.getDay();
}
function formatWeekNumberMonday(d, p) {
return pad$1(monday.count(year(d), d), p, 2);
}
function formatYear(d, p) {
return pad$1(d.getFullYear() % 100, p, 2);
}
function formatFullYear(d, p) {
return pad$1(d.getFullYear() % 10000, p, 4);
}
function formatZone(d) {
var z = d.getTimezoneOffset();
return (z > 0 ? "-" : (z *= -1, "+"))
+ pad$1(z / 60 | 0, "0", 2)
+ pad$1(z % 60, "0", 2);
}
function formatUTCDayOfMonth(d, p) {
return pad$1(d.getUTCDate(), p, 2);
}
function formatUTCHour24(d, p) {
return pad$1(d.getUTCHours(), p, 2);
}
function formatUTCHour12(d, p) {
return pad$1(d.getUTCHours() % 12 || 12, p, 2);
}
function formatUTCDayOfYear(d, p) {
return pad$1(1 + utcDay.count(utcYear(d), d), p, 3);
}
function formatUTCMilliseconds(d, p) {
return pad$1(d.getUTCMilliseconds(), p, 3);
}
function formatUTCMonthNumber(d, p) {
return pad$1(d.getUTCMonth() + 1, p, 2);
}
function formatUTCMinutes(d, p) {
return pad$1(d.getUTCMinutes(), p, 2);
}
function formatUTCSeconds(d, p) {
return pad$1(d.getUTCSeconds(), p, 2);
}
function formatUTCWeekNumberSunday(d, p) {
return pad$1(utcWeek.count(utcYear(d), d), p, 2);
}
function formatUTCWeekdayNumber(d) {
return d.getUTCDay();
}
function formatUTCWeekNumberMonday(d, p) {
return pad$1(utcMonday.count(utcYear(d), d), p, 2);
}
function formatUTCYear(d, p) {
return pad$1(d.getUTCFullYear() % 100, p, 2);
}
function formatUTCFullYear(d, p) {
return pad$1(d.getUTCFullYear() % 10000, p, 4);
}
function formatUTCZone() {
return "+0000";
}
function formatLiteralPercent() {
return "%";
}
var locale;
var d3_timeFormat;
var timeParse;
var d3_utcFormat;
var utcParse;
defaultLocale({
dateTime: "%x, %X",
date: "%-m/%-d/%Y",
time: "%-I:%M:%S %p",
periods: ["AM", "PM"],
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
});
function defaultLocale(definition) {
locale = formatLocale(definition);
d3_timeFormat = locale.format;
timeParse = locale.parse;
d3_utcFormat = locale.utcFormat;
utcParse = locale.utcParse;
return locale;
}
var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ";
function formatIsoNative(date) {
return date.toISOString();
}
var formatIso = Date.prototype.toISOString
? formatIsoNative
: d3_utcFormat(isoSpecifier);
function parseIsoNative(string) {
var date = new Date(string);
return isNaN(date) ? null : date;
}
var parseIso = +new Date("2000-01-01T00:00:00.000Z")
? parseIsoNative
: utcParse(isoSpecifier);
function read(data, schema, dateParse) {
schema = schema || {};
var reader = formats$1(schema.type || 'json');
if (!reader) error('Unknown data format type: ' + schema.type);
data = reader(data, schema);
if (schema.parse) parse(data, schema.parse, dateParse);
if (data.hasOwnProperty('columns')) delete data.columns;
return data;
}
function parse(data, types, dateParse) {
dateParse = dateParse || timeParse;
var fields = data.columns || Object.keys(data[0]),
parsers, datum, field, i, j, n, m;
if (types === 'auto') types = inferTypes(data, fields);
fields = Object.keys(types);
parsers = fields.map(function(field) {
var type = types[field],
parts, pattern;
if (type && type.indexOf('date:') === 0) {
parts = type.split(/:(.+)?/, 2); // split on first :
pattern = parts[1];
if ((pattern[0] === '\'' && pattern[pattern.length-1] === '\'') ||
(pattern[0] === '"' && pattern[pattern.length-1] === '"')) {
pattern = pattern.slice(1, -1);
}
return dateParse(pattern);
}
if (!typeParsers[type]) {
throw Error('Illegal format pattern: ' + field + ':' + type);
}
return typeParsers[type];
});
for (i=0, n=data.length, m=fields.length; i<n; ++i) {
datum = data[i];
for (j=0; j<m; ++j) {
field = fields[j];
datum[field] = parsers[j](datum[field]);
}
}
}
function Bounds(b) {
this.clear();
if (b) this.union(b);
}
var prototype = Bounds.prototype;
prototype.clone = function() {
return new Bounds(this);
};
prototype.clear = function() {
this.x1 = +Number.MAX_VALUE;
this.y1 = +Number.MAX_VALUE;
this.x2 = -Number.MAX_VALUE;
this.y2 = -Number.MAX_VALUE;
return this;
};
prototype.set = function(x1, y1, x2, y2) {
if (x2 < x1) {
this.x2 = x1;
this.x1 = x2;
} else {
this.x1 = x1;
this.x2 = x2;
}
if (y2 < y1) {
this.y2 = y1;
this.y1 = y2;
} else {
this.y1 = y1;
this.y2 = y2;
}
return this;
};
prototype.add = function(x, y) {
if (x < this.x1) this.x1 = x;
if (y < this.y1) this.y1 = y;
if (x > this.x2) this.x2 = x;
if (y > this.y2) this.y2 = y;
return this;
};
prototype.expand = function(d) {
this.x1 -= d;
this.y1 -= d;
this.x2 += d;
this.y2 += d;
return this;
};
prototype.round = function() {
this.x1 = Math.floor(this.x1);
this.y1 = Math.floor(this.y1);
this.x2 = Math.ceil(this.x2);
this.y2 = Math.ceil(this.y2);
return this;
};
prototype.translate = function(dx, dy) {
this.x1 += dx;
this.x2 += dx;
this.y1 += dy;
this.y2 += dy;
return this;
};
prototype.rotate = function(angle, x, y) {
var cos = Math.cos(angle),
sin = Math.sin(angle),
cx = x - x*cos + y*sin,
cy = y - x*sin - y*cos,
x1 = this.x1, x2 = this.x2,
y1 = this.y1, y2 = this.y2;
return this.clear()
.add(cos*x1 - sin*y1 + cx, sin*x1 + cos*y1 + cy)
.add(cos*x1 - sin*y2 + cx, sin*x1 + cos*y2 + cy)
.add(cos*x2 - sin*y1 + cx, sin*x2 + cos*y1 + cy)
.add(cos*x2 - sin*y2 + cx, sin*x2 + cos*y2 + cy);
};
prototype.union = function(b) {
if (b.x1 < this.x1) this.x1 = b.x1;
if (b.y1 < this.y1) this.y1 = b.y1;
if (b.x2 > this.x2) this.x2 = b.x2;
if (b.y2 > this.y2) this.y2 = b.y2;
return this;
};
prototype.encloses = function(b) {
return b && (
this.x1 <= b.x1 &&
this.x2 >= b.x2 &&
this.y1 <= b.y1 &&
this.y2 >= b.y2
);
};
prototype.alignsWith = function(b) {
return b && (
this.x1 == b.x1 ||
this.x2 == b.x2 ||
this.y1 == b.y1 ||
this.y2 == b.y2
);
};
prototype.intersects = function(b) {
return b && !(
this.x2 < b.x1 ||
this.x1 > b.x2 ||
this.y2 < b.y1 ||
this.y1 > b.y2
);
};
prototype.contains = function(x, y) {
return !(
x < this.x1 ||
x > this.x2 ||
y < this.y1 ||
y > this.y2
);
};
prototype.width = function() {
return this.x2 - this.x1;
};
prototype.height = function() {
return this.y2 - this.y1;
};
var gradient_id = 0;
function Gradient(p0, p1) {
var stops = [], gradient;
return gradient = {
id: 'gradient_' + (gradient_id++),
x1: p0 ? p0[0] : 0,
y1: p0 ? p0[1] : 0,
x2: p1 ? p1[0] : 1,
y2: p1 ? p1[1] : 0,
stops: stops,
stop: function(offset, color) {
stops.push({offset: offset, color: color});
return gradient;
}
};
}
function Item(mark) {
this.mark = mark;
this.bounds = (this.bounds || new Bounds());
this.bounds_prev = (this.bounds_prev || new Bounds());
}
function GroupItem(mark) {
Item.call(this, mark);
this.items = (this.items || []);
}
inherits(GroupItem, Item);
// create a new DOM element
function domCreate(doc, tag, ns) {
if (!doc && typeof document !== 'undefined' && document.createElement) {
doc = document;
}
return doc
? (ns ? doc.createElementNS(ns, tag) : doc.createElement(tag))
: null;
}
// find first child element with matching tag
function domFind(el, tag) {
tag = tag.toLowerCase();
var nodes = el.childNodes, i = 0, n = nodes.length;
for (; i<n; ++i) if (nodes[i].tagName.toLowerCase() === tag) {
return nodes[i];
}
}
// retrieve child element at given index
// create & insert if doesn't exist or if tags do not match
function domChild(el, index, tag, ns) {
var a = el.childNodes[index], b;
if (!a || a.tagName.toLowerCase() !== tag.toLowerCase()) {
b = a || null;
a = domCreate(el.ownerDocument, tag, ns);
el.insertBefore(a, b);
}
return a;
}
// remove all child elements at or above the given index
function domClear(el, index) {
var nodes = el.childNodes,
curr = nodes.length;
while (curr > index) el.removeChild(nodes[--curr]);
return el;
}
// generate css class name for mark
function cssClass(mark) {
return 'mark-' + mark.marktype
+ (mark.role ? ' role-' + mark.role : '')
+ (mark.name ? ' ' + mark.name : '');
}
var Canvas;
try { Canvas = require('canvas'); } catch (e) { Canvas = null; }
function Canvas$1(w, h) {
var canvas = domCreate(null, 'canvas');
if (canvas) {
canvas.width = w;
canvas.height = h;
} else if (Canvas) {
canvas = new Canvas(w, h);
}
return canvas;
}
var Image$1 = typeof Image !== 'undefined' ? Image
: (Canvas && Canvas.Image || null);
function ResourceLoader(customLoader) {
this._pending = 0;
this._loader = customLoader || loader();
}
var prototype$1 = ResourceLoader.prototype;
prototype$1.pending = function() {
return this._pending;
};
function increment(loader) {
loader._pending += 1;
}
function decrement(loader) {
loader._pending -= 1;
}
prototype$1.sanitizeURL = function(uri) {
var loader = this;
increment(loader);
return loader._loader.sanitize(uri, {context:'href'})
.then(function(opt) {
decrement(loader);
return opt;
})
.catch(function() {
decrement(loader);
return null;
});
};
prototype$1.loadImage = function(uri) {
var loader = this;
increment(loader);
return loader._loader.sanitize(uri, {context:'image'})
.then(function(opt) {
var url = opt.href;
if (!url || !Image$1) throw 'Image unsupported.';
var image = new Image$1();
image.onload = function() {
decrement(loader);
image.loaded = true;
};
image.onerror = function() {
decrement(loader);
image.loaded = false;
}
image.src = url;
return image;
})
.catch(function() {
decrement(loader);
return {loaded: false, width: 0, height: 0};
});
};
prototype$1.ready = function() {
var loader = this;
return new Promise(function(accept) {
function poll(value) {
if (!loader.pending()) accept(value);
else setTimeout(function() { poll(true); }, 10);
}
poll(false);
});
};
var pi = Math.PI;
var tau = 2 * pi;
var epsilon = 1e-6;
var tauEpsilon = tau - epsilon;
function Path() {
this._x0 = this._y0 = // start of current subpath
this._x1 = this._y1 = null; // end of current subpath
this._ = "";
}
function path() {
return new Path;
}
Path.prototype = path.prototype = {
constructor: Path,
moveTo: function(x, y) {
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
},
closePath: function() {
if (this._x1 !== null) {
this._x1 = this._x0, this._y1 = this._y0;
this._ += "Z";
}
},
lineTo: function(x, y) {
this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
},
quadraticCurveTo: function(x1, y1, x, y) {
this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
},
bezierCurveTo: function(x1, y1, x2, y2, x, y) {
this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
},
arcTo: function(x1, y1, x2, y2, r) {
x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
var x0 = this._x1,
y0 = this._y1,
x21 = x2 - x1,
y21 = y2 - y1,
x01 = x0 - x1,
y01 = y0 - y1,
l01_2 = x01 * x01 + y01 * y01;
// Is the radius negative? Error.
if (r < 0) throw new Error("negative radius: " + r);
// Is this path empty? Move to (x1,y1).
if (this._x1 === null) {
this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
}
// Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
else if (!(l01_2 > epsilon)) {}
// Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
// Equivalently, is (x1,y1) coincident with (x2,y2)?
// Or, is the radius zero? Line to (x1,y1).
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
}
// Otherwise, draw an arc!
else {
var x20 = x2 - x0,
y20 = y2 - y0,
l21_2 = x21 * x21 + y21 * y21,
l20_2 = x20 * x20 + y20 * y20,
l21 = Math.sqrt(l21_2),
l01 = Math.sqrt(l01_2),
l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
t01 = l / l01,
t21 = l / l21;
// If the start tangent is not coincident with (x0,y0), line to.
if (Math.abs(t01 - 1) > epsilon) {
this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
}
this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
}
},
arc: function(x, y, r, a0, a1, ccw) {
x = +x, y = +y, r = +r;
var dx = r * Math.cos(a0),
dy = r * Math.sin(a0),
x0 = x + dx,
y0 = y + dy,
cw = 1 ^ ccw,
da = ccw ? a0 - a1 : a1 - a0;
// Is the radius negative? Error.
if (r < 0) throw new Error("negative radius: " + r);
// Is this path empty? Move to (x0,y0).
if (this._x1 === null) {
this._ += "M" + x0 + "," + y0;
}
// Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
this._ += "L" + x0 + "," + y0;
}
// Is this arc empty? We’re done.
if (!r) return;
// Is this a complete circle? Draw two arcs to complete the circle.
if (da > tauEpsilon) {
this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
}
// Otherwise, draw an arc!
else {
if (da < 0) da = da % tau + tau;
this._ += "A" + r + "," + r + ",0," + (+(da >= pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
}
},
rect: function(x, y, w, h) {
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z";
},
toString: function() {
return this._;
}
};
function constant$2(x) {
return function constant() {
return x;
};
}
var abs = Math.abs;
var atan2 = Math.atan2;
var cos = Math.cos;
var max$1 = Math.max;
var min$1 = Math.min;
var sin = Math.sin;
var sqrt = Math.sqrt;
var epsilon$1 = 1e-12;
var pi$1 = Math.PI;
var halfPi = pi$1 / 2;
var tau$1 = 2 * pi$1;
function acos(x) {
return x > 1 ? 0 : x < -1 ? pi$1 : Math.acos(x);
}
function asin(x) {
return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
}
function arcInnerRadius(d) {
return d.innerRadius;
}
function arcOuterRadius(d) {
return d.outerRadius;
}
function arcStartAngle(d) {
return d.startAngle;
}
function arcEndAngle(d) {
return d.endAngle;
}
function arcPadAngle(d) {
return d && d.padAngle; // Note: optional!
}
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
var x10 = x1 - x0, y10 = y1 - y0,
x32 = x3 - x2, y32 = y3 - y2,
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / (y32 * x10 - x32 * y10);
return [x0 + t * x10, y0 + t * y10];
}
// Compute perpendicular offset line of length rc.
// http://mathworld.wolfram.com/Circle-LineIntersection.html
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
var x01 = x0 - x1,
y01 = y0 - y1,
lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),
ox = lo * y01,
oy = -lo * x01,
x11 = x0 + ox,
y11 = y0 + oy,
x10 = x1 + ox,
y10 = y1 + oy,
x00 = (x11 + x10) / 2,
y00 = (y11 + y10) / 2,
dx = x10 - x11,
dy = y10 - y11,
d2 = dx * dx + dy * dy,
r = r1 - rc,
D = x11 * y10 - x10 * y11,
d = (dy < 0 ? -1 : 1) * sqrt(max$1(0, r * r * d2 - D * D)),
cx0 = (D * dy - dx * d) / d2,
cy0 = (-D * dx - dy * d) / d2,
cx1 = (D * dy + dx * d) / d2,
cy1 = (-D * dx + dy * d) / d2,
dx0 = cx0 - x00,
dy0 = cy0 - y00,
dx1 = cx1 - x00,
dy1 = cy1 - y00;
// Pick the closer of the two intersection points.
// TODO Is there a faster way to determine which intersection to use?
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
return {
cx: cx0,
cy: cy0,
x01: -ox,
y01: -oy,
x11: cx0 * (r1 / r - 1),
y11: cy0 * (r1 / r - 1)
};
}
function d3_arc() {
var innerRadius = arcInnerRadius,
outerRadius = arcOuterRadius,
cornerRadius = constant$2(0),
padRadius = null,
startAngle = arcStartAngle,
endAngle = arcEndAngle,
padAngle = arcPadAngle,
context = null;
function arc() {
var buffer,
r,
r0 = +innerRadius.apply(this, arguments),
r1 = +outerRadius.apply(this, arguments),
a0 = startAngle.apply(this, arguments) - halfPi,
a1 = endAngle.apply(this, arguments) - halfPi,
da = abs(a1 - a0),
cw = a1 > a0;
if (!context) context = buffer = path();
// Ensure that the outer radius is always larger than the inner radius.
if (r1 < r0) r = r1, r1 = r0, r0 = r;
// Is it a point?
if (!(r1 > epsilon$1)) context.moveTo(0, 0);
// Or is it a circle or annulus?
else if (da > tau$1 - epsilon$1) {
context.moveTo(r1 * cos(a0), r1 * sin(a0));
context.arc(0, 0, r1, a0, a1, !cw);
if (r0 > epsilon$1) {
context.moveTo(r0 * cos(a1), r0 * sin(a1));
context.arc(0, 0, r0, a1, a0, cw);
}
}
// Or is it a circular or annular sector?
else {
var a01 = a0,
a11 = a1,
a00 = a0,
a10 = a1,
da0 = da,
da1 = da,
ap = padAngle.apply(this, arguments) / 2,
rp = (ap > epsilon$1) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),
rc = min$1(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
rc0 = rc,
rc1 = rc,
t0,
t1;
// Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
if (rp > epsilon$1) {
var p0 = asin(rp / r0 * sin(ap)),
p1 = asin(rp / r1 * sin(ap));
if ((da0 -= p0 * 2) > epsilon$1) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;
else da0 = 0, a00 = a10 = (a0 + a1) / 2;
if ((da1 -= p1 * 2) > epsilon$1) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;
else da1 = 0, a01 = a11 = (a0 + a1) / 2;
}
var x01 = r1 * cos(a01),
y01 = r1 * sin(a01),
x10 = r0 * cos(a10),
y10 = r0 * sin(a10);
// Apply rounded corners?
if (rc > epsilon$1) {
var x11 = r1 * cos(a11),
y11 = r1 * sin(a11),
x00 = r0 * cos(a00),
y00 = r0 * sin(a00);
// Restrict the corner radius according to the sector angle.
if (da < pi$1) {
var oc = da0 > epsilon$1 ? intersect(x01, y01, x00, y00, x11, y11, x10, y10) : [x10, y10],
ax = x01 - oc[0],
ay = y01 - oc[1],
bx = x11 - oc[0],
by = y11 - oc[1],
kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
rc0 = min$1(rc, (r0 - lc) / (kc - 1));
rc1 = min$1(rc, (r1 - lc) / (kc + 1));
}
}
// Is the sector collapsed to a line?
if (!(da1 > epsilon$1)) context.moveTo(x01, y01);
// Does the sector’s outer ring have rounded corners?
else if (rc1 > epsilon$1) {
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
// Have the corners merged?
if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
// Otherwise, draw the two corners and the ring.
else {
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
}
}
// Or is the outer ring just a circular arc?
else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
// Is there no inner ring, and it’s a circular sector?
// Or perhaps it’s an annular sector collapsed due to padding?
if (!(r0 > epsilon$1) || !(da0 > epsilon$1)) context.lineTo(x10, y10);
// Does the sector’s inner ring (or point) have rounded corners?
else if (rc0 > epsilon$1) {
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
// Have the corners merged?
if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
// Otherwise, draw the two corners and the ring.
else {
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
}
}
// Or is the inner ring just a circular arc?
else context.arc(0, 0, r0, a10, a00, cw);
}
context.closePath();
if (buffer) return context = null, buffer + "" || null;
}
arc.centroid = function() {
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,
a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$1 / 2;
return [cos(a) * r, sin(a) * r];
};
arc.innerRadius = function(_) {
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$2(+_), arc) : innerRadius;
};
arc.outerRadius = function(_) {
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$2(+_), arc) : outerRadius;
};
arc.cornerRadius = function(_) {
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$2(+_), arc) : cornerRadius;
};
arc.padRadius = function(_) {
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$2(+_), arc) : padRadius;
};
arc.startAngle = function(_) {
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$2(+_), arc) : startAngle;
};
arc.endAngle = function(_) {
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$2(+_), arc) : endAngle;
};
arc.padAngle = function(_) {
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$2(+_), arc) : padAngle;
};
arc.context = function(_) {
return arguments.length ? ((context = _ == null ? null : _), arc) : context;
};
return arc;
}
function Linear(context) {
this._context = context;
}
Linear.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._point = 0;
},
lineEnd: function() {
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
this._line = 1 - this._line;
},
point: function(x, y) {
x = +x, y = +y;
switch (this._point) {
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
case 1: this._point = 2; // proceed
default: this._context.lineTo(x, y); break;
}
}
};
function curveLinear(context) {
return new Linear(context);
}
function x$1(p) {
return p[0];
}
function y$1(p) {
return p[1];
}
function line$1() {
var x = x$1,
y = y$1,
defined = constant$2(true),
context = null,
curve = curveLinear,
output = null;
function line(data) {
var i,
n = data.length,
d,
defined0 = false,
buffer;
if (context == null) output = curve(buffer = path());
for (i = 0; i <= n; ++i) {
if (!(i < n && defined(d = data[i], i, data)) === defined0) {
if (defined0 = !defined0) output.lineStart();
else output.lineEnd();
}
if (defined0) output.point(+x(d, i, data), +y(d, i, data));
}
if (buffer) return output = null, buffer + "" || null;
}
line.x = function(_) {
return arguments.length ? (x = typeof _ === "function" ? _ : constant$2(+_), line) : x;
};
line.y = function(_) {
return arguments.length ? (y = typeof _ === "function" ? _ : constant$2(+_), line) : y;
};
line.defined = function(_) {
return arguments.length ? (defined = typeof _ === "function" ? _ : constant$2(!!_), line) : defined;
};
line.curve = function(_) {
return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
};
line.context = function(_) {
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
};
return line;
}
function area$1() {
var x0 = x$1,
x1 = null,
y0 = constant$2(0),
y1 = y$1,
defined = constant$2(true),
context = null,
curve = curveLinear,
output = null;
function area(data) {
var i,
j,
k,
n = data.length,
d,
defined0 = false,
buffer,
x0z = new Array(n),
y0z = new Array(n);
if (context == null) output = curve(buffer = path());
for (i = 0; i <= n; ++i) {
if (!(i < n && defined(d = data[i], i, data)) === defined0) {
if (defined0 = !defined0) {
j = i;
output.areaStart();
output.lineStart();
} else {
output.lineEnd();
output.lineStart();
for (k = i - 1; k >= j; --k) {
output.point(x0z[k], y0z[k]);
}
output.lineEnd();
output.areaEnd();
}
}
if (defined0) {
x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);
output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);
}
}
if (buffer) return output = null, buffer + "" || null;
}
function arealine() {
return line$1().defined(defined).curve(curve).context(context);
}
area.x = function(_) {
return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$2(+_), x1 = null, area) : x0;
};
area.x0 = function(_) {
return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$2(+_), area) : x0;
};
area.x1 = function(_) {
return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant$2(+_), area) : x1;
};
area.y = function(_) {
return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$2(+_), y1 = null, area) : y0;
};
area.y0 = function(_) {
return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$2(+_), area) : y0;
};
area.y1 = function(_) {
return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant$2(+_), area) : y1;
};
area.lineX0 =
area.lineY0 = function() {
return arealine().x(x0).y(y0);
};
area.lineY1 = function() {
return arealine().x(x0).y(y1);
};
area.lineX1 = function() {
return arealine().x(x1).y(y0);
};
area.defined = function(_) {
return arguments.length ? (defined = typeof _ === "function" ? _ : constant$2(!!_), area) : defined;
};
area.curve = function(_) {
return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;
};
area.context = function(_) {
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;
};
return area;
}
var circle = {
draw: function(context, size) {
var r = Math.sqrt(size / pi$1);
context.moveTo(r, 0);
context.arc(0, 0, r, 0, tau$1);
}
};
var kr = Math.sin(pi$1 / 10) / Math.sin(7 * pi$1 / 10);
var kx = Math.sin(tau$1 / 10) * kr;
var ky = -Math.cos(tau$1 / 10) * kr;
function d3_symbol() {
var type = constant$2(circle),
size = constant$2(64),
context = null;
function symbol() {
var buffer;
if (!context) context = buffer = path();
type.apply(this, arguments).draw(context, +size.apply(this, arguments));
if (buffer) return context = null, buffer + "" || null;
}
symbol.type = function(_) {
return arguments.length ? (type = typeof _ === "function" ? _ : constant$2(_), symbol) : type;
};
symbol.size = function(_) {
return arguments.length ? (size = typeof _ === "function" ? _ : constant$2(+_), symbol) : size;
};
symbol.context = function(_) {
return arguments.length ? (context = _ == null ? null : _, symbol) : context;
};
return symbol;
}
function noop$2() {}
function point(that, x, y) {
that._context.bezierCurveTo(
(2 * that._x0 + that._x1) / 3,
(2 * that._y0 + that._y1) / 3,
(that._x0 + 2 * that._x1) / 3,
(that._y0 + 2 * that._y1) / 3,
(that._x0 + 4 * that._x1 + x) / 6,
(that._y0 + 4 * that._y1 + y) / 6
);
}
function Basis(context) {
this._context = context;
}
Basis.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 =
this._y0 = this._y1 = NaN;
this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 3: point(this, this._x1, this._y1); // proceed
case 2: this._context.lineTo(this._x1, this._y1); break;
}
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
this._line = 1 - this._line;
},
point: function(x, y) {
x = +x, y = +y;
switch (this._point) {
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
case 1: this._point = 2; break;
case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed
default: point(this, x, y); break;
}
this._x0 = this._x1, this._x1 = x;
this._y0 = this._y1, this._y1 = y;
}
};
function curveBasis(context) {
return new Basis(context);
}
function Bundle(context, beta) {
this._basis = new Basis(context);
this._beta = beta;
}
Bundle.prototype = {
lineStart: function() {
this._x = [];
this._y = [];
this._basis.lineStart();
},
lineEnd: function() {
var x = this._x,
y = this._y,
j = x.length - 1;
if (j > 0) {
var x0 = x[0],
y0 = y[0],
dx = x[j] - x0,
dy = y[j] - y0,
i = -1,
t;
while (++i <= j) {
t = i / j;
this._basis.point(
this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),
this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)
);
}
}
this._x = this._y = null;
this._basis.lineEnd();
},
point: function(x, y) {
this._x.push(+x);
this._y.push(+y);
}
};
var curveBundle = (function custom(beta) {
function bundle(context) {
return beta === 1 ? new Basis(context) : new Bundle(context, beta);
}
bundle.beta = function(beta) {
return custom(+beta);
};
return bundle;
})(0.85);
function point$1(that, x, y) {
that._context.bezierCurveTo(
that._x1 + that._k * (that._x2 - that._x0),
that._y1 + that._k * (that._y2 - that._y0),
that._x2 + that._k * (that._x1 - x),
that._y2 + that._k * (that._y1 - y),
that._x2,
that._y2
);
}
function Cardinal(context, tension) {
this._context = context;
this._k = (1 - tension) / 6;
}
Cardinal.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._x2 =
this._y0 = this._y1 = this._y2 = NaN;
this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 2: this._context.lineTo(this._x2, this._y2); break;
case 3: point$1(this, this._x1, this._y1); break;
}
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
this._line = 1 - this._line;
},
point: function(x, y) {
x = +x, y = +y;
switch (this._point) {
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
case 1: this._point = 2; this._x1 = x, this._y1 = y; break;
case 2: this._point = 3; // proceed
default: point$1(this, x, y); break;
}
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
}
};
var curveCardinal = (function custom(tension) {
function cardinal(context) {
return new Cardinal(context, tension);
}
cardinal.tension = function(tension) {
return custom(+tension);
};
return cardinal;
})(0);
function CardinalClosed(context, tension) {
this._context = context;
this._k = (1 - tension) / 6;
}
CardinalClosed.prototype = {
areaStart: noop$2,
areaEnd: noop$2,
lineStart: function() {
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 1: {
this._context.moveTo(this._x3, this._y3);
this._context.closePath();
break;
}
case 2: {
this._context.lineTo(this._x3, this._y3);
this._context.closePath();
break;
}
case 3: {
this.point(this._x3, this._y3);
this.point(this._x4, this._y4);
this.point(this._x5, this._y5);
break;
}
}
},
point: function(x, y) {
x = +x, y = +y;
switch (this._point) {
case 0: this._point = 1; this._x3 = x, this._y3 = y; break;
case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;
case 2: this._point = 3; this._x5 = x, this._y5 = y; break;
default: point$1(this, x, y); break;
}
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
}
};
(function custom(tension) {
function cardinal(context) {
return new CardinalClosed(context, tension);
}
cardinal.tension = function(tension) {
return custom(+tension);
};
return cardinal;
})(0);
function CardinalOpen(context, tension) {
this._context = context;
this._k = (1 - tension) / 6;
}
CardinalOpen.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._x2 =
this._y0 = this._y1 = this._y2 = NaN;
this._point = 0;
},
lineEnd: function() {
if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
this._line = 1 - this._line;
},
point: function(x, y) {
x = +x, y = +y;
switch (this._point) {
case 0: this._point = 1; break;
case 1: this._point = 2; break;
case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;
case 3: this._point = 4; // proceed
default: point$1(this, x, y); break;
}
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
}
};
(function custom(tension) {
function cardinal(context) {
return new CardinalOpen(context, tension);
}
cardinal.tension = function(tension) {
return custom(+tension);
};
return cardinal;
})(0);
function point$2(that, x, y) {
var x1 = that._x1,
y1 = that._y1,
x2 = that._x2,
y2 = that._y2;
if (that._l01_a > epsilon$1) {
var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,
n = 3 * that._l01_a * (that._l01_a + that._l12_a);
x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;
y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;
}
if (that._l23_a > epsilon$1) {
var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,
m = 3 * that._l23_a * (that._l23_a + that._l12_a);
x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;
y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;
}
that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);
}
function CatmullRom(context, alpha) {
this._context = context;
this._alpha = alpha;
}
CatmullRom.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._x2 =
this._y0 = this._y1 = this._y2 = NaN;
this._l01_a = this._l12_a = this._l23_a =
this._l01_2a = this._l12_2a = this._l23_2a =
this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 2: this._context.lineTo(this._x2, this._y2); break;
case 3: this.point(this._x2, this._y2); break;
}
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
this._line = 1 - this._line;
},
point: function(x, y) {
x = +x, y = +y;
if (this._point) {
var x23 = this._x2 - x,
y23 = this._y2 - y;
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
}
switch (this._point) {
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
case 1: this._point = 2; break;
case 2: this._point = 3; // proceed
default: point$2(this, x, y); break;
}
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
}
};
var curveCatmullRom = (function custom(alpha) {
function catmullRom(context) {
return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);
}
catmullRom.alpha = function(alpha) {
return custom(+alpha);
};
return catmullRom;
})(0.5);
function CatmullRomClosed(context, alpha) {
this._context = context;
this._alpha = alpha;
}
CatmullRomClosed.prototype = {
areaStart: noop$2,
areaEnd: noop$2,
lineStart: function() {
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
this._l01_a = this._l12_a = this._l23_a =
this._l01_2a = this._l12_2a = this._l23_2a =
this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 1: {
this._context.moveTo(this._x3, this._y3);
this._context.closePath();
break;
}
case 2: {
this._context.lineTo(this._x3, this._y3);
this._context.closePath();
break;
}
case 3: {
this.point(this._x3, this._y3);
this.point(this._x4, this._y4);
this.point(this._x5, this._y5);
break;
}
}
},
point: function(x, y) {
x = +x, y = +y;
if (this._point) {
var x23 = this._x2 - x,
y23 = this._y2 - y;
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
}
switch (this._point) {
case 0: this._point = 1; this._x3 = x, this._y3 = y; break;
case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;
case 2: this._point = 3; this._x5 = x, this._y5 = y; break;
default: point$2(this, x, y); break;
}
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
}
};
(function custom(alpha) {
function catmullRom(context) {
return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);
}
catmullRom.alpha = function(alpha) {
return custom(+alpha);
};
return catmullRom;
})(0.5);
function CatmullRomOpen(context, alpha) {
this._context = context;
this._alpha = alpha;
}
CatmullRomOpen.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._x2 =
this._y0 = this._y1 = this._y2 = NaN;
this._l01_a = this._l12_a = this._l23_a =
this._l01_2a = this._l12_2a = this._l23_2a =
this._point = 0;
},
lineEnd: function() {
if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
this._line = 1 - this._line;
},
point: function(x, y) {
x = +x, y = +y;
if (this._point) {
var x23 = this._x2 - x,
y23 = this._y2 - y;
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
}
switch (this._point) {
case 0: this._point = 1; break;
case 1: this._point = 2; break;
case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;
case 3: this._point = 4; // proceed
default: point$2(this, x, y); break;
}
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
}
};
(function custom(alpha) {
function catmullRom(context) {
return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);
}
catmullRom.alpha = function(alpha) {
return custom(+alpha);
};
return catmullRom;
})(0.5);
function sign(x) {
return x < 0 ? -1 : 1;
}
// Calculate the slopes of the tangents (Hermite-type interpolation) based on
// the following paper: Steffen, M. 1990. A Simple Method for Monotonic
// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.
// NOV(II), P. 443, 1990.
function slope3(that, x2, y2) {
var h0 = that._x1 - that._x0,
h1 = x2 - that._x1,
s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),
s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),
p = (s0 * h1 + s1 * h0) / (h0 + h1);
return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
}
// Calculate a one-sided slope.
function slope2(that, t) {
var h = that._x1 - that._x0;
return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;
}
// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations
// "you can express cubic Hermite interpolation in terms of cubic Bézier curves
// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1".
function point$3(that, t0, t1) {
var x0 = that._x0,
y0 = that._y0,
x1 = that._x1,
y1 = that._y1,
dx = (x1 - x0) / 3;
that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);
}
function MonotoneX(context) {
this._context = context;
}
MonotoneX.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 =
this._y0 = this._y1 =
this._t0 = NaN;
this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 2: this._context.lineTo(this._x1, this._y1); break;
case 3: point$3(this, this._t0, slope2(this, this._t0)); break;
}
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
this._line = 1 - this._line;
},
point: function(x, y) {
var t1 = NaN;
x = +x, y = +y;
if (x === this._x1 && y === this._y1) return; // Ignore coincident points.
switch (this._point) {
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
case 1: this._point = 2; break;
case 2: this._point = 3; point$3(this, slope2(this, t1 = slope3(this, x, y)), t1); break;
default: point$3(this, this._t0, t1 = slope3(this, x, y)); break;
}
this._x0 = this._x1, this._x1 = x;
this._y0 = this._y1, this._y1 = y;
this._t0 = t1;
}
}
function MonotoneY(context) {
this._context = new ReflectContext(context);
}
(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {
MonotoneX.prototype.point.call(this, y, x);
};
function ReflectContext(context) {
this._context = context;
}
ReflectContext.prototype = {
moveTo: function(x, y) { this._context.moveTo(y, x); },
closePath: function() { this._context.closePath(); },
lineTo: function(x, y) { this._context.lineTo(y, x); },
bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }
};
function monotoneX(context) {
return new MonotoneX(context);
}
function monotoneY(context) {
return new MonotoneY(context);
}
function Natural(context) {
this._context = context;
}
Natural.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x = [];
this._y = [];
},
lineEnd: function() {
var x = this._x,
y = this._y,
n = x.length;
if (n) {
this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);
if (n === 2) {
this._context.lineTo(x[1], y[1]);
} else {
var px = controlPoints(x),
py = controlPoints(y);
for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {
this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);
}
}
}
if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();
this._line = 1 - this._line;
this._x = this._y = null;
},
point: function(x, y) {
this._x.push(+x);
this._y.push(+y);
}
};
// See https://www.particleincell.com/2012/bezier-splines/ for derivation.
function controlPoints(x) {
var i,
n = x.length - 1,
m,
a = new Array(n),
b = new Array(n),
r = new Array(n);
a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];
for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];
a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];
for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];
a[n - 1] = r[n - 1] / b[n - 1];
for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];
b[n - 1] = (x[n] + a[n - 1]) / 2;
for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];
return [a, b];
}
function curveNatural(context) {
return new Natural(context);
}
function Step(context, t) {
this._context = context;
this._t = t;
}
Step.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x = this._y = NaN;
this._point = 0;
},
lineEnd: function() {
if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;
},
point: function(x, y) {
x = +x, y = +y;
switch (this._point) {
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
case 1: this._point = 2; // proceed
default: {
if (this._t <= 0) {
this._context.lineTo(this._x, y);
this._context.lineTo(x, y);
} else {
var x1 = this._x * (1 - this._t) + x * this._t;
this._context.lineTo(x1, this._y);
this._context.lineTo(x1, y);
}
break;
}
}
this._x = x, this._y = y;
}
};
function curveStep(context) {
return new Step(context, 0.5);
}
function stepBefore(context) {
return new Step(context, 0);
}
function stepAfter(context) {
return new Step(context, 1);
}
var lookup = {
'basis': {
curve: curveBasis
},
'bundle': {
curve: curveBundle,
tension: 'beta',
value: 0.85
},
'cardinal': {
curve: curveCardinal,
tension: 'tension',
value: 0
},
'catmull-rom': {
curve: curveCatmullRom,
tension: 'alpha',
value: 0.5
},
'linear': {
curve: curveLinear
},
'monotone': {
horizontal: monotoneY,
vertical: monotoneX
},
'natural': {
curve: curveNatural
},
'step': {
curve: curveStep
},
'step-after': {
curve: stepAfter
},
'step-before': {
curve: stepBefore
}
};
function curves(type, orientation, tension) {
var entry = lookup.hasOwnProperty(type) && lookup[type],
curve = null;
if (entry) {
curve = entry.curve || entry[orientation || 'vertical'];
if (entry.tension && tension != null) {
curve = curve[entry.tension](tension);
}
}
return curve;
}
// Path parsing and rendering code adapted from fabric.js -- Thanks!
var cmdlen = { m:2, l:2, h:1, v:1, c:6, s:4, q:4, t:2, a:7 };
var regexp = [/([MLHVCSQTAZmlhvcsqtaz])/g, /###/, /(\d)([-+])/g, /\s|,|###/];
function pathParse(pathstr) {
var result = [],
path,
curr,
chunks,
parsed, param,
cmd, len, i, j, n, m;
// First, break path into command sequence
path = pathstr
.slice()
.replace(regexp[0], '###$1')
.split(regexp[1])
.slice(1);
// Next, parse each command in turn
for (i=0, n=path.length; i<n; ++i) {
curr = path[i];
chunks = curr
.slice(1)
.trim()
.replace(regexp[2],'$1###$2')
.split(regexp[3]);
cmd = curr.charAt(0);
parsed = [cmd];
for (j=0, m=chunks.length; j<m; ++j) {
if ((param = +chunks[j]) === param) { // not NaN
parsed.push(param);
}
}
len = cmdlen[cmd.toLowerCase()];
if (parsed.length-1 > len) {
for (j=1, m=parsed.length; j<m; j+=len) {
result.push([cmd].concat(parsed.slice(j, j+len)));
}
}
else {
result.push(parsed);
}
}
return result;
}
var segmentCache = {};
var bezierCache = {};
var join = [].join;
// Copied from Inkscape svgtopdf, thanks!
function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) {
var key = join.call(arguments);
if (segmentCache[key]) {
return segmentCache[key];
}
var th = rotateX * (Math.PI/180);
var sin_th = Math.sin(th);
var cos_th = Math.cos(th);
rx = Math.abs(rx);
ry = Math.abs(ry);
var px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5;
var py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5;
var pl = (px*px) / (rx*rx) + (py*py) / (ry*ry);
if (pl > 1) {
pl = Math.sqrt(pl);
rx *= pl;
ry *= pl;
}
var a00 = cos_th / rx;
var a01 = sin_th / rx;
var a10 = (-sin_th) / ry;
var a11 = (cos_th) / ry;
var x0 = a00 * ox + a01 * oy;
var y0 = a10 * ox + a11 * oy;
var x1 = a00 * x + a01 * y;
var y1 = a10 * x + a11 * y;
var d = (x1-x0) * (x1-x0) + (y1-y0) * (y1-y0);
var sfactor_sq = 1 / d - 0.25;
if (sfactor_sq < 0) sfactor_sq = 0;
var sfactor = Math.sqrt(sfactor_sq);
if (sweep == large) sfactor = -sfactor;
var xc = 0.5 * (x0 + x1) - sfactor * (y1-y0);
var yc = 0.5 * (y0 + y1) + sfactor * (x1-x0);
var th0 = Math.atan2(y0-yc, x0-xc);
var th1 = Math.atan2(y1-yc, x1-xc);
var th_arc = th1-th0;
if (th_arc < 0 && sweep === 1){
th_arc += 2 * Math.PI;
} else if (th_arc > 0 && sweep === 0) {
th_arc -= 2 * Math.PI;
}
var segs = Math.ceil(Math.abs(th_arc / (Math.PI * 0.5 + 0.001)));
var result = [];
for (var i=0; i<segs; ++i) {
var th2 = th0 + i * th_arc / segs;
var th3 = th0 + (i+1) * th_arc / segs;
result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th];
}
return (segmentCache[key] = result);
}
function bezier(params) {
var key = join.call(params);
if (bezierCache[key]) {
return bezierCache[key];
}
var cx = params[0],
cy = params[1],
th0 = params[2],
th1 = params[3],
rx = params[4],
ry = params[5],
sin_th = params[6],
cos_th = params[7];
var a00 = cos_th * rx;
var a01 = -sin_th * ry;
var a10 = sin_th * rx;
var a11 = cos_th * ry;
var cos_th0 = Math.cos(th0);
var sin_th0 = Math.sin(th0);
var cos_th1 = Math.cos(th1);
var sin_th1 = Math.sin(th1);
var th_half = 0.5 * (th1 - th0);
var sin_th_h2 = Math.sin(th_half * 0.5);
var t = (8/3) * sin_th_h2 * sin_th_h2 / Math.sin(th_half);
var x1 = cx + cos_th0 - t * sin_th0;
var y1 = cy + sin_th0 + t * cos_th0;
var x3 = cx + cos_th1;
var y3 = cy + sin_th1;
var x2 = x3 + t * sin_th1;
var y2 = y3 - t * cos_th1;
return (bezierCache[key] = [
a00 * x1 + a01 * y1, a10 * x1 + a11 * y1,
a00 * x2 + a01 * y2, a10 * x2 + a11 * y2,
a00 * x3 + a01 * y3, a10 * x3 + a11 * y3
]);
}
var temp = ['l', 0, 0, 0, 0, 0, 0, 0];
function scale(current, s) {
var c = (temp[0] = current[0]);
if (c === 'a' || c === 'A') {
temp[1] = s * current[1];
temp[2] = s * current[2];
temp[6] = s * current[6];
temp[7] = s * current[7];
} else {
for (var i=1, n=current.length; i<n; ++i) {
temp[i] = s * current[i];
}
}
return temp;
}
function pathRender(context, path, l, t, s) {
var current, // current instruction
previous = null,
x = 0, // current x
y = 0, // current y
controlX = 0, // current control point x
controlY = 0, // current control point y
tempX,
tempY,
tempControlX,
tempControlY;
if (l == null) l = 0;
if (t == null) t = 0;
if (s == null) s = 1;
if (context.beginPath) context.beginPath();
for (var i=0, len=path.length; i<len; ++i) {
current = path[i];
if (s !== 1) current = scale(current, s);
switch (current[0]) { // first letter
case 'l': // lineto, relative
x += current[1];
y += current[2];
context.lineTo(x + l, y + t);
break;
case 'L': // lineto, absolute
x = current[1];
y = current[2];
context.lineTo(x + l, y + t);
break;
case 'h': // horizontal lineto, relative
x += current[1];
context.lineTo(x + l, y + t);
break;
case 'H': // horizontal lineto, absolute
x = current[1];
context.lineTo(x + l, y + t);
break;
case 'v': // vertical lineto, relative
y += current[1];
context.lineTo(x + l, y + t);
break;
case 'V': // verical lineto, absolute
y = current[1];
context.lineTo(x + l, y + t);
break;
case 'm': // moveTo, relative
x += current[1];
y += current[2];
context.moveTo(x + l, y + t);
break;
case 'M': // moveTo, absolute
x = current[1];
y = current[2];
context.moveTo(x + l, y + t);
break;
case 'c': // bezierCurveTo, relative
tempX = x + current[5];
tempY = y + current[6];
controlX = x + current[3];
controlY = y + current[4];
context.bezierCurveTo(
x + current[1] + l, // x1
y + current[2] + t, // y1
controlX + l, // x2
controlY + t, // y2
tempX + l,
tempY + t
);
x = tempX;
y = tempY;
break;
case 'C': // bezierCurveTo, absolute
x = current[5];
y = current[6];
controlX = current[3];
controlY = current[4];
context.bezierCurveTo(
current[1] + l,
current[2] + t,
controlX + l,
controlY + t,
x + l,
y + t
);
break;
case 's': // shorthand cubic bezierCurveTo, relative
// transform to absolute x,y
tempX = x + current[3];
tempY = y + current[4];
// calculate reflection of previous control points
controlX = 2 * x - controlX;
controlY = 2 * y - controlY;
context.bezierCurveTo(
controlX + l,
controlY + t,
x + current[1] + l,
y + current[2] + t,
tempX + l,
tempY + t
);
// set control point to 2nd one of this command
// the first control point is assumed to be the reflection of
// the second control point on the previous command relative
// to the current point.
controlX = x + current[1];
controlY = y + current[2];
x = tempX;
y = tempY;
break;
case 'S': // shorthand cubic bezierCurveTo, absolute
tempX = current[3];
tempY = current[4];
// calculate reflection of previous control points
controlX = 2*x - controlX;
controlY = 2*y - controlY;
context.bezierCurveTo(
controlX + l,
controlY + t,
current[1] + l,
current[2] + t,
tempX + l,
tempY + t
);
x = tempX;
y = tempY;
// set control point to 2nd one of this command
// the first control point is assumed to be the reflection of
// the second control point on the previous command relative
// to the current point.
controlX = current[1];
controlY = current[2];
break;
case 'q': // quadraticCurveTo, relative
// transform to absolute x,y
tempX = x + current[3];
tempY = y + current[4];
controlX = x + current[1];
controlY = y + current[2];
context.quadraticCurveTo(
controlX + l,
controlY + t,
tempX + l,
tempY + t
);
x = tempX;
y = tempY;
break;
case 'Q': // quadraticCurveTo, absolute
tempX = current[3];
tempY = current[4];
context.quadraticCurveTo(
current[1] + l,
current[2] + t,
tempX + l,
tempY + t
);
x = tempX;
y = tempY;
controlX = current[1];
controlY = current[2];
break;
case 't': // shorthand quadraticCurveTo, relative
// transform to absolute x,y
tempX = x + current[1];
tempY = y + current[2];
if (previous[0].match(/[QqTt]/) === null) {
// If there is no previous command or if the previous command was not a Q, q, T or t,
// assume the control point is coincident with the current point
controlX = x;
controlY = y;
}
else if (previous[0] === 't') {
// calculate reflection of previous control points for t
controlX = 2 * x - tempControlX;
controlY = 2 * y - tempControlY;
}
else if (previous[0] === 'q') {
// calculate reflection of previous control points for q
controlX = 2 * x - controlX;
controlY = 2 * y - controlY;
}
tempControlX = controlX;
tempControlY = controlY;
context.quadraticCurveTo(
controlX + l,
controlY + t,
tempX + l,
tempY + t
);
x = tempX;
y = tempY;
controlX = x + current[1];
controlY = y + current[2];
break;
case 'T':
tempX = current[1];
tempY = current[2];
// calculate reflection of previous control points
controlX = 2 * x - controlX;
controlY = 2 * y - controlY;
context.quadraticCurveTo(
controlX + l,
controlY + t,
tempX + l,
tempY + t
);
x = tempX;
y = tempY;
break;
case 'a':
drawArc(context, x + l, y + t, [
current[1],
current[2],
current[3],
current[4],
current[5],
current[6] + x + l,
current[7] + y + t
]);
x += current[6];
y += current[7];
break;
case 'A':
drawArc(context, x + l, y + t, [
current[1],
current[2],
current[3],
current[4],
current[5],
current[6] + l,
current[7] + t
]);
x = current[6];
y = current[7];
break;
case 'z':
case 'Z':
context.closePath();
break;
}
previous = current;
}
}
function drawArc(context, x, y, coords) {
var seg = segments(
coords[5], // end x
coords[6], // end y
coords[0], // radius x
coords[1], // radius y
coords[3], // large flag
coords[4], // sweep flag
coords[2], // rotation
x, y
);
for (var i=0; i<seg.length; ++i) {
var bez = bezier(seg[i]);
context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]);
}
}
var tau$2 = 2 * Math.PI;
var halfSqrt3 = Math.sqrt(3) / 2;
var builtins = {
'circle': {
draw: function(context, size) {
var r = Math.sqrt(size) / 2;
context.moveTo(r, 0);
context.arc(0, 0, r, 0, tau$2);
}
},
'cross': {
draw: function(context, size) {
var r = Math.sqrt(size) / 2,
s = r / 2.5;
context.moveTo(-r, -s);
context.lineTo(-r, s);
context.lineTo(-s, s);
context.lineTo(-s, r);
context.lineTo(s, r);
context.lineTo(s, s);
context.lineTo(r, s);
context.lineTo(r, -s);
context.lineTo(s, -s);
context.lineTo(s, -r);
context.lineTo(-s, -r);
context.lineTo(-s, -s);
context.closePath();
}
},
'diamond': {
draw: function(context, size) {
var r = Math.sqrt(size) / 2;
context.moveTo(-r, 0);
context.lineTo(0, -r);
context.lineTo(r, 0);
context.lineTo(0, r);
context.closePath();
}
},
'square': {
draw: function(context, size) {
var w = Math.sqrt(size),
x = -w / 2;
context.rect(x, x, w, w);
}
},
'triangle-up': {
draw: function(context, size) {
var r = Math.sqrt(size) / 2,
h = halfSqrt3 * r;
context.moveTo(0, -h);
context.lineTo(-r, h);
context.lineTo(r, h);
context.closePath();
}
},
'triangle-down': {
draw: function(context, size) {
var r = Math.sqrt(size) / 2,
h = halfSqrt3 * r;
context.moveTo(0, h);
context.lineTo(-r, -h);
context.lineTo(r, -h);
context.closePath();
}
},
'triangle-right': {
draw: function(context, size) {
var r = Math.sqrt(size) / 2,
h = halfSqrt3 * r;
context.moveTo(h, 0);
context.lineTo(-h, -r);
context.lineTo(-h, r);
context.closePath();
}
},
'triangle-left': {
draw: function(context, size) {
var r = Math.sqrt(size) / 2,
h = halfSqrt3 * r;
context.moveTo(-h, 0);
context.lineTo(h, -r);
context.lineTo(h, r);
context.closePath();
}
}
};
function symbols$1(_) {
return builtins.hasOwnProperty(_) ? builtins[_] : customSymbol(_);
}
var custom = {};
function customSymbol(path) {
if (!custom.hasOwnProperty(path)) {
var parsed = pathParse(path);
custom[path] = {
draw: function(context, size) {
pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2);
}
};
}
return custom[path];
}
function rectangleX(d) {
return d.x;
}
function rectangleY(d) {
return d.y;
}
function rectangleWidth(d) {
return d.width;
}
function rectangleHeight(d) {
return d.height;
}
function constant$3(_) {
return function() { return _; };
}
function vg_rect() {
var x = rectangleX,
y = rectangleY,
width = rectangleWidth,
height = rectangleHeight,
cornerRadius = constant$3(0),
context = null;
function rectangle(_, x0, y0) {
var buffer,
x1 = x0 != null ? x0 : +x.call(this, _),
y1 = y0 != null ? y0 : +y.call(this, _),
w = +width.call(this, _),
h = +height.call(this, _),
cr = +cornerRadius.call(this, _);
if (!context) context = buffer = path();
if (cr <= 0) {
context.rect(x1, y1, w, h);
} else {
var x2 = x1 + w,
y2 = y1 + h;
context.moveTo(x1 + cr, y1);
context.lineTo(x2 - cr, y1);
context.quadraticCurveTo(x2, y1, x2, y1 + cr);
context.lineTo(x2, y2 - cr);
context.quadraticCurveTo(x2, y2, x2 - cr, y2);
context.lineTo(x1 + cr, y2);
context.quadraticCurveTo(x1, y2, x1, y2 - cr);
context.lineTo(x1, y1 + cr);
context.quadraticCurveTo(x1, y1, x1 + cr, y1);
context.closePath();
}
if (buffer) return context = null, buffer + '' || null;
}
rectangle.x = function(_) {
return arguments.length ? (x = typeof _ === 'function' ? _ : constant$3(+_), rectangle) : x;
};
rectangle.y = function(_) {
return arguments.length ? (y = typeof _ === 'function' ? _ : constant$3(+_), rectangle) : y;
};
rectangle.width = function(_) {
return arguments.length ? (width = typeof _ === 'function' ? _ : constant$3(+_), rectangle) : width;
};
rectangle.height = function(_) {
return arguments.length ? (height = typeof _ === 'function' ? _ : constant$3(+_), rectangle) : height;
};
rectangle.cornerRadius = function(_) {
return arguments.length ? (cornerRadius = typeof _ === 'function' ? _ : constant$3(+_), rectangle) : cornerRadius;
};
rectangle.context = function(_) {
return arguments.length ? (context = _ == null ? null : _, rectangle) : context;
};
return rectangle;
}
var pi$2 = Math.PI;
function vg_trail() {
var x,
y,
size,
defined,
context = null,
ready, x1, y1, r1;
function point(x2, y2, w2) {
var r2 = w2 / 2;
if (ready) {
// get normal vector
var ux = y1 - y2,
uy = x2 - x1,
ud = Math.sqrt(ux * ux + uy * uy),
rx = (ux /= ud) * r1,
ry = (uy /= ud) * r1,
t = Math.atan2(uy, ux);
// draw segment
context.moveTo(x1 - rx, y1 - ry);
context.lineTo(x2 - ux * r2, y2 - uy * r2);
context.arc(x2, y2, r2, t - pi$2, t);
context.lineTo(x1 + rx, y1 + ry);
context.arc(x1, y1, r1, t, t + pi$2);
context.closePath();
} else {
ready = 1;
}
x1 = x2, y1 = y2, r1 = r2;
}
function trail(data) {
var i,
n = data.length,
d,
defined0 = false,
buffer;
if (context == null) context = buffer = path();
for (i = 0; i <= n; ++i) {
if (!(i < n && defined(d = data[i], i, data)) === defined0) {
if (defined0 = !defined0) ready = 0;
}
if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data));
}
if (buffer) return context = null, buffer + '' || null;
}
trail.x = function(_) {
return arguments.length ? (x = _, trail) : x;
};
trail.y = function(_) {
return arguments.length ? (y = _, trail) : y;
};
trail.size = function(_) {
return arguments.length ? (size = _, trail) : size;
};
trail.defined = function(_) {
return arguments.length ? (defined = _, trail) : defined;
};
trail.context = function(_) {
return arguments.length ? (_ == null ? context = null : context = _, trail) : context;
};
return trail;
}
function x(item) { return item.x || 0; }
function y(item) { return item.y || 0; }
function w(item) { return item.width || 0; }
function ts(item) { return item.size || 1; }
function h(item) { return item.height || 0; }
function xw(item) { return (item.x || 0) + (item.width || 0); }
function yh(item) { return (item.y || 0) + (item.height || 0); }
function cr(item) { return item.cornerRadius || 0; }
function pa(item) { return item.padAngle || 0; }
function def(item) { return !(item.defined === false); }
function size(item) { return item.size == null ? 64 : item.size; }
function type$1(item) { return symbols$1(item.shape || 'circle'); }
var arcShape = d3_arc().cornerRadius(cr).padAngle(pa);
var areavShape = area$1().x(x).y1(y).y0(yh).defined(def);
var areahShape = area$1().y(y).x1(x).x0(xw).defined(def);
var lineShape = line$1().x(x).y(y).defined(def);
var rectShape = vg_rect().x(x).y(y).width(w).height(h).cornerRadius(cr);
var symbolShape = d3_symbol().type(type$1).size(size);
var trailShape = vg_trail().x(x).y(y).defined(def).size(ts);
function arc$1(context, item) {
return arcShape.context(context)(item);
}
function area(context, items) {
var item = items[0],
interp = item.interpolate || 'linear';
return (item.orient === 'horizontal' ? areahShape : areavShape)
.curve(curves(interp, item.orient, item.tension))
.context(context)(items);
}
function line(context, items) {
var item = items[0],
interp = item.interpolate || 'linear';
return lineShape.curve(curves(interp, item.orient, item.tension))
.context(context)(items);
}
function rectangle(context, item, x, y) {
return rectShape.context(context)(item, x, y);
}
function shape(context, item) {
return (item.mark.shape || item.shape)
.context(context)(item);
}
function symbol(context, item) {
return symbolShape.context(context)(item);
}
function trail(context, items) {
return trailShape.context(context)(items);
}
function boundStroke(bounds, item) {
if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) {
bounds.expand(item.strokeWidth != null ? +item.strokeWidth : 1);
}
return bounds;
}
var bounds;
var tau$3 = Math.PI * 2;
var halfPi$1 = tau$3 / 4;
var circleThreshold = tau$3 - 1e-8;
function context(_) {
return bounds = _, context;
}
function noop$3() {}
function add(x, y) { bounds.add(x, y); }
context.beginPath = noop$3;
context.closePath = noop$3;
context.moveTo = add;
context.lineTo = add;
context.rect = function(x, y, w, h) {
add(x, y);
add(x + w, y + h);
};
context.quadraticCurveTo = function(x1, y1, x2, y2) {
add(x1, y1);
add(x2, y2);
};
context.bezierCurveTo = function(x1, y1, x2, y2, x3, y3) {
add(x1, y1);
add(x2, y2);
add(x3, y3);
};
context.arc = function(cx, cy, r, sa, ea, ccw) {
if (Math.abs(ea - sa) > circleThreshold) {
add(cx - r, cy - r);
add(cx + r, cy + r);
return;
}
var xmin = Infinity, xmax = -Infinity,
ymin = Infinity, ymax = -Infinity,
s, i, x, y;
function update(a) {
x = r * Math.cos(a);
y = r * Math.sin(a);
if (x < xmin) xmin = x;
if (x > xmax) xmax = x;
if (y < ymin) ymin = y;
if (y > ymax) ymax = y;
}
// Sample end points and interior points aligned with 90 degrees
update(sa);
update(ea);
if (ea !== sa) {
sa = sa % tau$3; if (sa < 0) sa += tau$3;
ea = ea % tau$3; if (ea < 0) ea += tau$3;
if (ea < sa) {
ccw = !ccw; // flip direction
s = sa; sa = ea; ea = s; // swap end-points
}
if (ccw) {
ea -= tau$3;
s = sa - (sa % halfPi$1);
for (i=0; i<3 && s>ea; ++i, s-=halfPi$1) update(s);
} else {
s = sa - (sa % halfPi$1) + halfPi$1;
for (i=0; i<3 && s<ea; ++i, s=s+halfPi$1) update(s);
}
}
add(cx + xmin, cy + ymin);
add(cx + xmax, cy + ymax);
};
function gradient(context, gradient, bounds) {
var w = bounds.width(),
h = bounds.height(),
x1 = bounds.x1 + gradient.x1 * w,
y1 = bounds.y1 + gradient.y1 * h,
x2 = bounds.x1 + gradient.x2 * w,
y2 = bounds.y1 + gradient.y2 * h,
stop = gradient.stops,
i = 0,
n = stop.length,
linearGradient = context.createLinearGradient(x1, y1, x2, y2);
for (; i<n; ++i) {
linearGradient.addColorStop(stop[i].offset, stop[i].color);
}
return linearGradient;
}
function color(context, item, value) {
return (value.id) ?
gradient(context, value, item.bounds) :
value;
}
function fill(context, item, opacity) {
opacity *= (item.fillOpacity==null ? 1 : item.fillOpacity);
if (opacity > 0) {
context.globalAlpha = opacity;
context.fillStyle = color(context, item, item.fill);
return true;
} else {
return false;
}
}
var Empty = [];
function stroke(context, item, opacity) {
var lw = (lw = item.strokeWidth) != null ? lw : 1, lc;
if (lw <= 0) return false;
opacity *= (item.strokeOpacity==null ? 1 : item.strokeOpacity);
if (opacity > 0) {
context.globalAlpha = opacity;
context.strokeStyle = color(context, item, item.stroke);
context.lineWidth = lw;
context.lineCap = (lc = item.strokeCap) != null ? lc : 'butt';
if (context.setLineDash) {
context.setLineDash(item.strokeDash || Empty);
context.lineDashOffset = item.strokeDashOffset || 0;
}
return true;
} else {
return false;
}
}
function compare$1(a, b) {
return a.zindex - b.zindex || a.index - b.index;
}
function zorder(scene) {
if (!scene.zdirty) return scene.zitems;
var items = scene.items,
output = [], item, i, n;
for (i=0, n=items.length; i<n; ++i) {
item = items[i];
item.index = i;
if (item.zindex) output.push(item);
}
scene.zdirty = false;
return scene.zitems = output.sort(compare$1);
}
function visit(scene, visitor) {
var items = scene.items, i, n;
if (!items || !items.length) return;
var zitems = zorder(scene);
if (zitems && zitems.length) {
for (i=0, n=items.length; i<n; ++i) {
if (!items[i].zindex) visitor(items[i]);
}
items = zitems;
}
for (i=0, n=items.length; i<n; ++i) {
visitor(items[i]);
}
}
function pickVisit(scene, visitor) {
var items = scene.items, hit, i;
if (!items || !items.length) return null;
var zitems = zorder(scene);
if (zitems && zitems.length) items = zitems;
for (i=items.length; --i >= 0;) {
if (hit = visitor(items[i])) return hit;
}
if (items === zitems) {
for (items=scene.items, i=items.length; --i >= 0;) {
if (!items[i].zindex) {
if (hit = visitor(items[i])) return hit;
}
}
}
return null;
}
function drawAll(path) {
return function(context, scene, bounds) {
visit(scene, function(item) {
if (!bounds || bounds.intersects(item.bounds)) {
drawPath(path, context, item, item);
}
});
};
}
function drawOne(path) {
return function(context, scene, bounds) {
if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) {
drawPath(path, context, scene.items[0], scene.items);
}
};
}
function drawPath(path, context, item, items) {
var opacity = item.opacity == null ? 1 : item.opacity;
if (opacity === 0) return;
if (path(context, items)) return;
if (item.fill && fill(context, item, opacity)) {
context.fill();
}
if (item.stroke && stroke(context, item, opacity)) {
context.stroke();
}
}
var trueFunc = function() { return true; };
function pick(test) {
if (!test) test = trueFunc;
return function(context, scene, x, y, gx, gy) {
if (context.pixelRatio > 1) {
x *= context.pixelRatio;
y *= context.pixelRatio;
}
return pickVisit(scene, function(item) {
var b = item.bounds;
// first hit test against bounding box
if ((b && !b.contains(gx, gy)) || !b) return;
// if in bounding box, perform more careful test
if (test(context, item, x, y, gx, gy)) return item;
});
};
}
function hitPath(path, filled) {
return function(context, o, x, y) {
var item = Array.isArray(o) ? o[0] : o,
fill = (filled == null) ? item.fill : filled,
stroke = item.stroke && context.isPointInStroke, lw, lc;
if (stroke) {
lw = item.strokeWidth;
lc = item.strokeCap;
context.lineWidth = lw != null ? lw : 1;
context.lineCap = lc != null ? lc : 'butt';
}
return path(context, o) ? false :
(fill && context.isPointInPath(x, y)) ||
(stroke && context.isPointInStroke(x, y));
};
}
function pickPath(path) {
return pick(hitPath(path));
}
function translate(x, y) {
return 'translate(' + x + ',' + y + ')';
}
function translateItem(item) {
return translate(item.x || 0, item.y || 0);
}
function markItemPath(type, shape) {
function attr(emit, item) {
emit('transform', translateItem(item));
emit('d', shape(null, item));
}
function bound(bounds, item) {
shape(context(bounds), item);
return boundStroke(bounds, item)
.translate(item.x || 0, item.y || 0);
}
function draw(context, item) {
var x = item.x || 0,
y = item.y || 0;
context.translate(x, y);
context.beginPath();
shape(context, item);
context.translate(-x, -y);
}
return {
type: type,
tag: 'path',
nested: false,
attr: attr,
bound: bound,
draw: drawAll(draw),
pick: pickPath(draw)
};
}
var arc = markItemPath('arc', arc$1);
function markMultiItemPath(type, shape) {
function attr(emit, item) {
var items = item.mark.items;
if (items.length) emit('d', shape(null, items));
}
function bound(bounds, mark) {
var items = mark.items;
return items.length === 0 ? bounds
: (shape(context(bounds), items), boundStroke(bounds, items[0]));
}
function draw(context, items) {
context.beginPath();
shape(context, items);
}
var hit = hitPath(draw);
function pick(context, scene, x, y, gx, gy) {
var items = scene.items,
b = scene.bounds;
if (!items || !items.length || b && !b.contains(gx, gy)) {
return null;
}
if (context.pixelRatio > 1) {
x *= context.pixelRatio;
y *= context.pixelRatio;
}
return hit(context, items, x, y) ? items[0] : null;
}
return {
type: type,
tag: 'path',
nested: true,
attr: attr,
bound: bound,
draw: drawOne(draw),
pick: pick
};
}
var area$2 = markMultiItemPath('area', area);
function attr(emit, item) {
emit('transform', translateItem(item));
}
function background(emit, item) {
var offset = item.stroke ? 0.5 : 0;
emit('class', 'background');
emit('d', rectangle(null, item, offset, offset));
}
function foreground(emit, item, renderer) {
if (item.clip) {
var defs = renderer._defs,
id = item.clip_id || (item.clip_id = 'clip' + defs.clip_id++),
c = defs.clipping[id] || (defs.clipping[id] = {id: id});
c.width = item.width || 0;
c.height = item.height || 0;
}
emit('clip-path', id ? ('url(#' + id + ')') : null);
}
function bound(bounds, group) {
if (!group.clip && group.items) {
var items = group.items;
for (var j=0, m=items.length; j<m; ++j) {
bounds.union(items[j].bounds);
}
}
if (group.clip || group.width || group.height) {
boundStroke(
bounds.add(0, 0).add(group.width || 0, group.height || 0),
group
);
}
return bounds.translate(group.x || 0, group.y || 0);
}
function draw(context, scene, bounds) {
var renderer = this;
visit(scene, function(group) {
var gx = group.x || 0,
gy = group.y || 0,
w = group.width || 0,
h = group.height || 0,
offset, opacity;
// setup graphics context
context.save();
context.translate(gx, gy);
// draw group background
if (group.stroke || group.fill) {
opacity = group.opacity == null ? 1 : group.opacity;
if (opacity > 0) {
context.beginPath();
offset = group.stroke ? 0.5 : 0;
rectangle(context, group, offset, offset);
if (group.fill && fill(context, group, opacity)) {
context.fill();
}
if (group.stroke && stroke(context, group, opacity)) {
context.stroke();
}
}
}
// set clip and bounds
if (group.clip) {
context.beginPath();
context.rect(0, 0, w, h);
context.clip();
}
if (bounds) bounds.translate(-gx, -gy);
// draw group contents
visit(group, function(item) {
renderer.draw(context, item, bounds);
});
// restore graphics context
if (bounds) bounds.translate(gx, gy);
context.restore();
});
}
function pick$1(context, scene, x, y, gx, gy) {
if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) {
return null;
}
var handler = this;
return pickVisit(scene, function(group) {
var hit, dx, dy, b;
// first hit test against bounding box
// if a group is clipped, that should be handled by the bounds check.
b = group.bounds;
if (b && !b.contains(gx, gy)) return;
// passed bounds check, so test sub-groups
dx = (group.x || 0);
dy = (group.y || 0);
context.save();
context.translate(dx, dy);
dx = gx - dx;
dy = gy - dy;
hit = pickVisit(group, function(mark) {
return (mark.interactive !== false || mark.marktype === 'group')
? handler.pick(mark, x, y, dx, dy)
: null;
});
context.restore();
if (hit) return hit;
hit = scene.interactive !== false
&& (group.fill || group.stroke)
&& dx >= 0
&& dx <= group.width
&& dy >= 0
&& dy <= group.height;
return hit ? group : null;
});
}
var group = {
type: 'group',
tag: 'g',
nested: false,
attr: attr,
bound: bound,
draw: draw,
pick: pick$1,
background: background,
foreground: foreground
};
function getImage(item, renderer) {
var image = item.image;
if (!image || image.url !== item.url) {
image = {loaded: false, width: 0, height: 0};
renderer.loadImage(item.url).then(function(image) {
item.image = image;
item.image.url = item.url;
});
}
return image;
}
function imageXOffset(align, w) {
return align === 'center' ? w / 2 : align === 'right' ? w : 0;
}
function imageYOffset(baseline, h) {
return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0;
}
function attr$1(emit, item, renderer) {
var image = getImage(item, renderer),
x = item.x || 0,
y = item.y || 0,
w = (item.width != null ? item.width : image.width) || 0,
h = (item.height != null ? item.height : image.height) || 0,
a = item.aspect === false ? 'none' : 'xMidYMid';
x -= imageXOffset(item.align, w);
y -= imageYOffset(item.baseline, h);
emit('href', image.src || '', 'http://www.w3.org/1999/xlink', 'xlink:href');
emit('transform', translate(x, y));
emit('width', w);
emit('height', h);
emit('preserveAspectRatio', a);
}
function bound$1(bounds, item) {
var image = item.image,
x = item.x || 0,
y = item.y || 0,
w = (item.width != null ? item.width : (image && image.width)) || 0,
h = (item.height != null ? item.height : (image && image.height)) || 0;
x -= imageXOffset(item.align, w);
y -= imageYOffset(item.baseline, h);
return bounds.set(x, y, x + w, y + h);
}
function draw$1(context, scene, bounds) {
var renderer = this;
visit(scene, function(item) {
if (bounds && !bounds.intersects(item.bounds)) return; // bounds check
var image = getImage(item, renderer),
x = item.x || 0,
y = item.y || 0,
w = (item.width != null ? item.width : image.width) || 0,
h = (item.height != null ? item.height : image.height) || 0,
opacity, ar0, ar1, t;
x -= imageXOffset(item.align, w);
y -= imageYOffset(item.baseline, h);
if (item.aspect !== false) {
ar0 = image.width / image.height;
ar1 = item.width / item.height;
if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) {
if (ar1 < ar0) {
t = w / ar0;
y += (h - t) / 2;
h = t;
} else {
t = h * ar0;
x += (w - t) / 2;
w = t;
}
}
}
if (image.loaded) {
context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1;
context.drawImage(image, x, y, w, h);
}
});
}
var image = {
type: 'image',
tag: 'image',
nested: false,
attr: attr$1,
bound: bound$1,
draw: draw$1,
pick: pick(),
get: getImage,
xOffset: imageXOffset,
yOffset: imageYOffset
};
var line$2 = markMultiItemPath('line', line);
function attr$2(emit, item) {
emit('transform', translateItem(item));
emit('d', item.path);
}
function path$1(context, item) {
var path = item.path;
if (path == null) return true;
var cache = item.pathCache;
if (!cache || cache.path !== path) {
(item.pathCache = cache = pathParse(path)).path = path;
}
pathRender(context, cache, item.x, item.y);
}
function bound$2(bounds, item) {
return path$1(context(bounds), item)
? bounds.set(0, 0, 0, 0)
: boundStroke(bounds, item);
}
var path$2 = {
type: 'path',
tag: 'path',
nested: false,
attr: attr$2,
bound: bound$2,
draw: drawAll(path$1),
pick: pickPath(path$1)
};
function attr$3(emit, item) {
emit('d', rectangle(null, item));
}
function bound$3(bounds, item) {
var x, y;
return boundStroke(bounds.set(
x = item.x || 0,
y = item.y || 0,
(x + item.width) || 0,
(y + item.height) || 0
), item);
}
function draw$2(context, item) {
context.beginPath();
rectangle(context, item);
}
var rect = {
type: 'rect',
tag: 'path',
nested: false,
attr: attr$3,
bound: bound$3,
draw: drawAll(draw$2),
pick: pickPath(draw$2)
};
function attr$4(emit, item) {
emit('transform', translateItem(item));
emit('x2', item.x2 != null ? item.x2 - (item.x||0) : 0);
emit('y2', item.y2 != null ? item.y2 - (item.y||0) : 0);
}
function bound$4(bounds, item) {
var x1, y1;
return boundStroke(bounds.set(
x1 = item.x || 0,
y1 = item.y || 0,
item.x2 != null ? item.x2 : x1,
item.y2 != null ? item.y2 : y1
), item);
}
function path$3(context, item, opacity) {
var x1, y1, x2, y2;
if (item.stroke && stroke(context, item, opacity)) {
x1 = item.x || 0;
y1 = item.y || 0;
x2 = item.x2 != null ? item.x2 : x1;
y2 = item.y2 != null ? item.y2 : y1;
context.beginPath();
context.moveTo(x1, y1);
context.lineTo(x2, y2);
return true;
}
return false;
}
function draw$3(context, scene, bounds) {
visit(scene, function(item) {
if (bounds && !bounds.intersects(item.bounds)) return; // bounds check
var opacity = item.opacity == null ? 1 : item.opacity;
if (opacity && path$3(context, item, opacity)) {
context.stroke();
}
});
}
function hit(context, item, x, y) {
if (!context.isPointInStroke) return false;
return path$3(context, item, 1) && context.isPointInStroke(x, y);
}
var rule = {
type: 'rule',
tag: 'line',
nested: false,
attr: attr$4,
bound: bound$4,
draw: draw$3,
pick: pick(hit)
};
var shape$1 = markItemPath('shape', shape);
var symbol$1 = markItemPath('symbol', symbol);
var context$1;
var fontHeight;
var textMetrics = {
height: height,
measureWidth: measureWidth,
estimateWidth: estimateWidth,
width: estimateWidth,
canvas: canvas
};
canvas(true);
// make dumb, simple estimate if no canvas is available
function estimateWidth(item) {
return fontHeight = height(item), estimate(textValue(item));
}
function estimate(text) {
return ~~(0.8 * text.length * fontHeight);
}
// measure text width if canvas is available
function measureWidth(item) {
return context$1.font = font(item), measure(textValue(item));
}
function measure(text) {
return context$1.measureText(text).width;
}
function height(item) {
return item.fontSize != null ? item.fontSize : 11;
}
function canvas(_) {
context$1 = _
? (context$1 = Canvas$1(1,1)) ? context$1.getContext('2d') : null
: null;
textMetrics.width = context$1 ? measureWidth : estimateWidth
}
function textValue(item) {
var s = item.text;
return s == null ? '' : item.limit > 0 ? truncate$1(item) : s + '';
}
function truncate$1(item) {
var limit = +item.limit,
text = item.text + '',
width = context$1
? (context$1.font = font(item), measure)
: (fontHeight = height(item), estimate);
if (width(text) < limit) return text;
var ellipsis = item.ellipsis || '\u2026',
rtl = item.dir === 'rtl',
lo = 0,
hi = text.length, mid;
limit -= width(ellipsis);
if (rtl) {
while (lo < hi) {
mid = (lo + hi >>> 1);
if (width(text.slice(mid)) > limit) lo = mid + 1;
else hi = mid;
}
return ellipsis + text.slice(lo);
} else {
while (lo < hi) {
mid = 1 + (lo + hi >>> 1);
if (width(text.slice(0, mid)) < limit) lo = mid;
else hi = mid - 1;
}
return text.slice(0, lo) + ellipsis;
}
}
function font(item, quote) {
var font = item.font;
if (quote && font) {
font = String(font).replace(/\"/g, '\'');
}
return '' +
(item.fontStyle ? item.fontStyle + ' ' : '') +
(item.fontVariant ? item.fontVariant + ' ' : '') +
(item.fontWeight ? item.fontWeight + ' ' : '') +
height(item) + 'px ' +
(font || 'sans-serif');
}
function offset(item) {
// perform our own font baseline calculation
// why? not all browsers support SVG 1.1 'alignment-baseline' :(
var baseline = item.baseline,
h = height(item);
return Math.round(
baseline === 'top' ? 0.93*h :
baseline === 'middle' ? 0.30*h :
baseline === 'bottom' ? -0.21*h : 0
);
}
var textAlign = {
'left': 'start',
'center': 'middle',
'right': 'end'
};
var tempBounds = new Bounds();
function attr$5(emit, item) {
var dx = item.dx || 0,
dy = (item.dy || 0) + offset(item),
x = item.x || 0,
y = item.y || 0,
a = item.angle || 0,
r = item.radius || 0, t;
if (r) {
t = (item.theta || 0) - Math.PI/2;
x += r * Math.cos(t);
y += r * Math.sin(t);
}
emit('text-anchor', textAlign[item.align] || 'start');
if (a) {
t = translate(x, y) + ' rotate('+a+')';
if (dx || dy) t += ' ' + translate(dx, dy);
} else {
t = translate(x + dx, y + dy);
}
emit('transform', t);
}
function bound$5(bounds, item, noRotate) {
var h = textMetrics.height(item),
a = item.align,
r = item.radius || 0,
x = item.x || 0,
y = item.y || 0,
dx = item.dx || 0,
dy = (item.dy || 0) + offset(item) - Math.round(0.8*h), // use 4/5 offset
w, t;
if (r) {
t = (item.theta || 0) - Math.PI/2;
x += r * Math.cos(t);
y += r * Math.sin(t);
}
// horizontal alignment
w = textMetrics.width(item);
if (a === 'center') {
dx -= (w / 2);
} else if (a === 'right') {
dx -= w;
} else {
// left by default, do nothing
}
bounds.set(dx+=x, dy+=y, dx+w, dy+h);
if (item.angle && !noRotate) {
bounds.rotate(item.angle*Math.PI/180, x, y);
}
return bounds.expand(noRotate ? 0 : 1);
}
function draw$4(context, scene, bounds) {
visit(scene, function(item) {
var opacity, x, y, r, t, str;
if (bounds && !bounds.intersects(item.bounds)) return; // bounds check
if (!(str = textValue(item))) return; // get text string
opacity = item.opacity == null ? 1 : item.opacity;
if (opacity === 0) return;
context.font = font(item);
context.textAlign = item.align || 'left';
x = item.x || 0;
y = item.y || 0;
if ((r = item.radius)) {
t = (item.theta || 0) - Math.PI/2;
x += r * Math.cos(t);
y += r * Math.sin(t);
}
if (item.angle) {
context.save();
context.translate(x, y);
context.rotate(item.angle * Math.PI/180);
x = y = 0; // reset x, y
}
x += (item.dx || 0);
y += (item.dy || 0) + offset(item);
if (item.fill && fill(context, item, opacity)) {
context.fillText(str, x, y);
}
if (item.stroke && stroke(context, item, opacity)) {
context.strokeText(str, x, y);
}
if (item.angle) context.restore();
});
}
function hit$1(context, item, x, y, gx, gy) {
if (item.fontSize <= 0) return false;
if (!item.angle) return true; // bounds sufficient if no rotation
// project point into space of unrotated bounds
var b = bound$5(tempBounds, item, true),
a = -item.angle * Math.PI / 180,
cos = Math.cos(a),
sin = Math.sin(a),
ix = item.x,
iy = item.y,
px = cos*gx - sin*gy + (ix - ix*cos + iy*sin),
py = sin*gx + cos*gy + (iy - ix*sin - iy*cos);
return b.contains(px, py);
}
var text$1 = {
type: 'text',
tag: 'text',
nested: false,
attr: attr$5,
bound: bound$5,
draw: draw$4,
pick: pick(hit$1)
};
var trail$1 = markMultiItemPath('trail', trail);
var Marks = {
arc: arc,
area: area$2,
group: group,
image: image,
line: line$2,
path: path$2,
rect: rect,
rule: rule,
shape: shape$1,
symbol: symbol$1,
text: text$1,
trail: trail$1
};
function boundItem(item, func, opt) {
var type = Marks[item.mark.marktype],
bound = func || type.bound;
if (type.nested) item = item.mark;
var curr = item.bounds,
prev = item.bounds_prev || (item.bounds_prev = new Bounds());
if (curr) {
prev.clear().union(curr);
curr.clear();
} else {
item.bounds = new Bounds();
}
bound(item.bounds, item, opt);
if (!curr) prev.clear().union(item.bounds);
return item.bounds;
}
var DUMMY = {mark: null};
function boundMark(mark, bounds, opt) {
var type = Marks[mark.marktype],
bound = type.bound,
items = mark.items,
hasItems = items && items.length,
i, n, item, b;
if (type.nested) {
item = hasItems ? items[0] : (DUMMY.mark = mark, DUMMY); // no items, fake it
b = boundItem(item, bound, opt);
bounds = bounds && bounds.union(b) || b;
return bounds;
}
bounds = bounds
|| mark.bounds && mark.bounds.clear()
|| new Bounds();
if (hasItems) {
for (i=0, n=items.length; i<n; ++i) {
bounds.union(boundItem(items[i], bound, opt));
}
}
return mark.bounds = bounds;
}
var keys$1 = [
'marktype', 'name', 'role', 'interactive', 'clip', 'items', 'zindex',
'x', 'y', 'width', 'height', 'align', 'baseline', // layout
'fill', 'fillOpacity', 'opacity', // fill
'stroke', 'strokeOpacity', 'strokeWidth', 'strokeCap', // stroke
'strokeDash', 'strokeDashOffset', // stroke dash
'startAngle', 'endAngle', 'innerRadius', 'outerRadius', // arc
'cornerRadius', 'padAngle', // arc, rect
'interpolate', 'tension', 'orient', 'defined', // area, line
'url', // image
'path', // path
'x2', 'y2', // rule
'size', 'shape', // symbol
'text', 'angle', 'theta', 'radius', 'dx', 'dy', // text
'font', 'fontSize', 'fontWeight', 'fontStyle', 'fontVariant' // font
];
function sceneToJSON(scene, indent) {
return JSON.stringify(scene, keys$1, indent);
}
function sceneFromJSON(json) {
var scene = (typeof json === 'string' ? JSON.parse(json) : json);
return initialize(scene);
}
function initialize(scene) {
var type = scene.marktype,
items = scene.items,
parent, i, n;
if (items) {
for (i=0, n=items.length; i<n; ++i) {
parent = type ? 'mark' : 'group';
items[i][parent] = scene;
if (items[i].zindex) items[i][parent].zdirty = true;
if ('group' === (type || parent)) initialize(items[i]);
}
}
if (type) boundMark(scene);
return scene;
}
function Scenegraph(scene) {
if (arguments.length) {
this.root = sceneFromJSON(scene);
} else {
this.root = createMark({
marktype: 'group',
name: 'root',
role: 'frame'
});
this.root.items = [new GroupItem(this.root)];
}
}
var prototype$2 = Scenegraph.prototype;
prototype$2.toJSON = function(indent) {
return sceneToJSON(this.root, indent || 0);
};
prototype$2.mark = function(scenepath, markdef) {
var markpath = scenepath.marks,
itempath = scenepath.items,
item = this.root.items[0],
mark, index, i, n;
try {
for (i=0, n=markpath.length; i<n; ++i) {
mark = item.items[markpath[i]];
if (!mark) break;
index = itempath[i] || 0;
item = mark.items[index] || mark.items[mark.items.length-1];
}
if (!mark) {
mark = createMark(markdef, item);
item.items[markpath[i]] = mark;
if (mark.zindex) mark.group.zdirty = true;
return mark;
}
throw n;
} catch (err) {
error$1('Invalid scenegraph path: ' + scenepath.marks + ' : ' + scenepath.items);
}
};
function error$1(msg) {
throw Error(msg);
}
function createMark(def, group) {
return {
bounds: new Bounds(),
bounds_prev: new Bounds(),
clip: !!def.clip,
group: group,
interactive: def.interactive === false ? false : true,
items: [],
marktype: def.marktype,
name: def.name || undefined,
role: def.role || undefined,
zindex: def.zindex || 0
};
}
function Handler(customLoader) {
this._active = null;
this._handlers = {};
this._loader = customLoader || loader();
}
var prototype$3 = Handler.prototype;
prototype$3.initialize = function(el, origin, obj) {
this._el = el;
this._obj = obj || null;
return this.origin(origin);
};
prototype$3.element = function() {
return this._el;
};
prototype$3.origin = function(origin) {
this._origin = origin || [0, 0];
return this;
};
prototype$3.scene = function(scene) {
if (!arguments.length) return this._scene;
this._scene = scene;
return this;
};
// add an event handler
// subclasses should override
prototype$3.on = function(/*type, handler*/) {};
// remove an event handler
// subclasses should override
prototype$3.off = function(/*type, handler*/) {};
// return an array with all registered event handlers
prototype$3.handlers = function() {
var h = this._handlers, a = [], k;
for (k in h) { a.push.apply(a, h[k]); }
return a;
};
prototype$3.eventName = function(name) {
var i = name.indexOf('.');
return i < 0 ? name : name.slice(0,i);
};
prototype$3.handleHref = function(event, item, href) {
this._loader
.sanitize(href, {context:'href'})
.then(function(opt) {
var e = new MouseEvent(event.type, event),
a = domCreate(null, 'a');
for (var name in opt) a.setAttribute(name, opt[name]);
a.dispatchEvent(e);
})
.catch(function() { /* do nothing */ });
};
prototype$3.handleTooltip = function(event, item, tooltipText) {
this._el.setAttribute('title', tooltipText || '');
};
/**
* Create a new Renderer instance.
* @param {object} [loader] - Optional loader instance for
* image and href URL sanitization. If not specified, a
* standard loader instance will be generated.
* @constructor
*/
function Renderer(loader) {
this._el = null;
this._bgcolor = null;
this._loader = new ResourceLoader(loader);
}
var prototype$4 = Renderer.prototype;
/**
* Initialize a new Renderer instance.
* @param {DOMElement} el - The containing DOM element for the display.
* @param {number} width - The width of the display, in pixels.
* @param {number} height - The height of the display, in pixels.
* @param {Array<number>} origin - The origin of the display, in pixels.
* The coordinate system will be translated to this point.
* @return {Renderer} - This renderer instance;
*/
prototype$4.initialize = function(el, width, height, origin) {
this._el = el;
return this.resize(width, height, origin);
};
/**
* Returns the parent container element for a visualization.
* @return {DOMElement} - The containing DOM element.
*/
prototype$4.element = function() {
return this._el;
};
/**
* Returns the scene element (e.g., canvas or SVG) of the visualization
* Subclasses must override if the first child is not the scene element.
* @return {DOMElement} - The scene (e.g., canvas or SVG) element.
*/
prototype$4.scene = function() {
return this._el && this._el.firstChild;
};
/**
* Get / set the background color.
*/
prototype$4.background = function(bgcolor) {
if (arguments.length === 0) return this._bgcolor;
this._bgcolor = bgcolor;
return this;
};
/**
* Resize the display.
* @param {number} width - The new width of the display, in pixels.
* @param {number} height - The new height of the display, in pixels.
* @param {Array<number>} origin - The new origin of the display, in pixels.
* The coordinate system will be translated to this point.
* @return {Renderer} - This renderer instance;
*/
prototype$4.resize = function(width, height, origin) {
this._width = width;
this._height = height;
this._origin = origin || [0, 0];
return this;
};
/**
* Render an input scenegraph, potentially with a set of dirty items.
* This method will perform an immediate rendering with available resources.
* The renderer may also need to perform image loading to perform a complete
* render. This process can lead to asynchronous re-rendering of the scene
* after this method returns. To receive notification when rendering is
* complete, use the renderAsync method instead.
* @param {object} scene - The root mark of a scenegraph to render.
* @param {Array<object>} [items] - An optional array of dirty items.
* If provided, the renderer may optimize the redraw of these items.
* @return {Renderer} - This renderer instance.
*/
prototype$4.render = function(scene, items) {
var r = this;
// bind arguments into a render call, and cache it
// this function may be subsequently called for async redraw
r._call = function() { r._render(scene, items); };
// invoke the renderer
r._call();
// clear the cached call for garbage collection
// async redraws will stash their own copy
r._call = null;
return r;
};
/**
* Internal rendering method. Renderer subclasses should override this
* method to actually perform rendering.
* @param {object} scene - The root mark of a scenegraph to render.
* @param {Array<object>} [items] - An optional array of dirty items.
* If provided, the renderer may optimize the redraw of these items.
*/
prototype$4._render = function(/*scene, items*/) {
// subclasses to override
};
/**
* Asynchronous rendering method. Similar to render, but returns a Promise
* that resolves when all rendering is completed. Sometimes a renderer must
* perform image loading to get a complete rendering. The returned
* Promise will not resolve until this process completes.
* @param {object} scene - The root mark of a scenegraph to render.
* @param {Array<object>} [items] - An optional array of dirty items.
* If provided, the renderer may optimize the redraw of these items.
* @return {Promise} - A Promise that resolves when rendering is complete.
*/
prototype$4.renderAsync = function(scene, items) {
var r = this.render(scene, items);
return this._ready
? this._ready.then(function() { return r; })
: Promise.resolve(r);
};
/**
* Internal method for asynchronous resource loading.
* Proxies method calls to the ImageLoader, and tracks loading
* progress to invoke a re-render once complete.
* @param {string} method - The method name to invoke on the ImageLoader.
* @param {string} uri - The URI for the requested resource.
* @return {Promise} - A Promise that resolves to the requested resource.
*/
prototype$4._load = function(method, uri) {
var r = this,
p = r._loader[method](uri);
if (!r._ready) {
// re-render the scene when loading completes
var call = r._call;
r._ready = r._loader.ready()
.then(function(redraw) {
if (redraw) call();
r._ready = null;
});
}
return p;
};
/**
* Sanitize a URL to include as a hyperlink in the rendered scene.
* This method proxies a call to ImageLoader.sanitizeURL, but also tracks
* image loading progress and invokes a re-render once complete.
* @param {string} uri - The URI string to sanitize.
* @return {Promise} - A Promise that resolves to the sanitized URL.
*/
prototype$4.sanitizeURL = function(uri) {
return this._load('sanitizeURL', uri);
};
/**
* Requests an image to include in the rendered scene.
* This method proxies a call to ImageLoader.loadImage, but also tracks
* image loading progress and invokes a re-render once complete.
* @param {string} uri - The URI string of the image.
* @return {Promise} - A Promise that resolves to the loaded Image.
*/
prototype$4.loadImage = function(uri) {
return this._load('loadImage', uri);
};
function point$4(event, el) {
var rect = el.getBoundingClientRect();
return [
event.clientX - rect.left - (el.clientLeft || 0),
event.clientY - rect.top - (el.clientTop || 0)
];
}
function CanvasHandler(loader) {
Handler.call(this, loader);
this._down = null;
this._touch = null;
this._first = true;
}
var prototype$5 = inherits(CanvasHandler, Handler);
prototype$5.initialize = function(el, origin, obj) {
// add event listeners
var canvas = this._canvas = el && domFind(el, 'canvas');
if (canvas) {
var that = this;
this.events.forEach(function(type) {
canvas.addEventListener(type, function(evt) {
if (prototype$5[type]) {
prototype$5[type].call(that, evt);
} else {
that.fire(type, evt);
}
});
});
}
return Handler.prototype.initialize.call(this, el, origin, obj);
};
prototype$5.canvas = function() {
return this._canvas;
};
// retrieve the current canvas context
prototype$5.context = function() {
return this._canvas.getContext('2d');
};
// supported events
prototype$5.events = [
'keydown',
'keypress',
'keyup',
'dragenter',
'dragleave',
'dragover',
'mousedown',
'mouseup',
'mousemove',
'mouseout',
'mouseover',
'click',
'dblclick',
'wheel',
'mousewheel',
'touchstart',
'touchmove',
'touchend'
];
// to keep old versions of firefox happy
prototype$5.DOMMouseScroll = function(evt) {
this.fire('mousewheel', evt);
};
function move(moveEvent, overEvent, outEvent) {
return function(evt) {
var a = this._active,
p = this.pickEvent(evt);
if (p === a) {
// active item and picked item are the same
this.fire(moveEvent, evt); // fire move
} else {
// active item and picked item are different
if (!a || !a.exit) {
// fire out for prior active item
// suppress if active item was removed from scene
this.fire(outEvent, evt);
}
this._active = p; // set new active item
this.fire(overEvent, evt); // fire over for new active item
this.fire(moveEvent, evt); // fire move for new active item
}
};
}
function inactive(type) {
return function(evt) {
this.fire(type, evt);
this._active = null;
};
}
prototype$5.mousemove = move('mousemove', 'mouseover', 'mouseout');
prototype$5.dragover = move('dragover', 'dragenter', 'dragleave');
prototype$5.mouseout = inactive('mouseout');
prototype$5.dragleave = inactive('dragleave');
prototype$5.mousedown = function(evt) {
this._down = this._active;
this.fire('mousedown', evt);
};
prototype$5.click = function(evt) {
if (this._down === this._active) {
this.fire('click', evt);
this._down = null;
}
};
prototype$5.touchstart = function(evt) {
this._touch = this.pickEvent(evt.changedTouches[0]);
if (this._first) {
this._active = this._touch;
this._first = false;
}
this.fire('touchstart', evt, true);
};
prototype$5.touchmove = function(evt) {
this.fire('touchmove', evt, true);
};
prototype$5.touchend = function(evt) {
this.fire('touchend', evt, true);
this._touch = null;
};
// fire an event
prototype$5.fire = function(type, evt, touch) {
var a = touch ? this._touch : this._active,
h = this._handlers[type], i, len;
// if hyperlinked, handle link first
if (type === 'click' && a && a.href) {
this.handleHref(evt, a, a.href);
} else if ((type === 'mouseover' || type === 'mouseout') && a && a.tooltip) {
this.handleTooltip(evt, a, type === 'mouseover' ? a.tooltip : null);
}
// invoke all registered handlers
if (h) {
evt.vegaType = type;
for (i=0, len=h.length; i<len; ++i) {
h[i].handler.call(this._obj, evt, a);
}
}
};
// add an event handler
prototype$5.on = function(type, handler) {
var name = this.eventName(type),
h = this._handlers;
(h[name] || (h[name] = [])).push({
type: type,
handler: handler
});
return this;
};
// remove an event handler
prototype$5.off = function(type, handler) {
var name = this.eventName(type),
h = this._handlers[name], i;
if (!h) return;
for (i=h.length; --i>=0;) {
if (h[i].type !== type) continue;
if (!handler || h[i].handler === handler) h.splice(i, 1);
}
return this;
};
prototype$5.pickEvent = function(evt) {
var p = point$4(evt, this._canvas),
o = this._origin;
return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]);
};
// find the scenegraph item at the current mouse position
// x, y -- the absolute x, y mouse coordinates on the canvas element
// gx, gy -- the relative coordinates within the current group
prototype$5.pick = function(scene, x, y, gx, gy) {
var g = this.context(),
mark = Marks[scene.marktype];
return mark.pick.call(this, g, scene, x, y, gx, gy);
};
var devicePixelRatio = typeof window !== 'undefined'
? window.devicePixelRatio || 1 : 1;
function resize(canvas, width, height, origin) {
var scale = typeof HTMLElement !== 'undefined'
&& canvas instanceof HTMLElement
&& canvas.parentNode != null;
var context = canvas.getContext('2d'),
ratio = scale ? devicePixelRatio : 1;
canvas.width = width * ratio;
canvas.height = height * ratio;
if (ratio !== 1) {
canvas.style.width = width + 'px';
canvas.style.height = height + 'px';
}
context.pixelRatio = ratio;
context.setTransform(
ratio, 0, 0, ratio,
ratio * origin[0],
ratio * origin[1]
);
return canvas;
}
function CanvasRenderer(loader) {
Renderer.call(this, loader);
this._redraw = false;
}
var prototype$6 = inherits(CanvasRenderer, Renderer);
var base = Renderer.prototype;
var tempBounds$1 = new Bounds();
prototype$6.initialize = function(el, width, height, origin) {
this._canvas = Canvas$1(1, 1); // instantiate a small canvas
if (el) {
domClear(el, 0).appendChild(this._canvas);
this._canvas.setAttribute('class', 'marks');
}
// this method will invoke resize to size the canvas appropriately
return base.initialize.call(this, el, width, height, origin);
};
prototype$6.resize = function(width, height, origin) {
base.resize.call(this, width, height, origin);
resize(this._canvas, this._width, this._height, this._origin);
return this._redraw = true, this;
};
prototype$6.canvas = function() {
return this._canvas;
};
prototype$6.context = function() {
return this._canvas ? this._canvas.getContext('2d') : null;
};
function clipToBounds(g, items) {
var b = new Bounds(), i, n, item, mark, group;
for (i=0, n=items.length; i<n; ++i) {
item = items[i];
mark = item.mark;
group = mark.group;
item = Marks[mark.marktype].nested ? mark : item;
b.union(translate$1(item.bounds, group));
if (item.bounds_prev) {
b.union(translate$1(item.bounds_prev, group));
}
}
b.expand(1).round();
g.beginPath();
g.rect(b.x1, b.y1, b.width(), b.height());
g.clip();
return b;
}
function translate$1(bounds, group) {
if (group == null) return bounds;
var b = tempBounds$1.clear().union(bounds);
for (; group != null; group = group.mark.group) {
b.translate(group.x || 0, group.y || 0);
}
return b;
}
prototype$6._render = function(scene, items) {
var g = this.context(),
o = this._origin,
w = this._width,
h = this._height,
b;
// setup
g.save();
b = (!items || this._redraw)
? (this._redraw = false, null)
: clipToBounds(g, items);
this.clear(-o[0], -o[1], w, h);
// render
this.draw(g, scene, b);
// takedown
g.restore();
return this;
};
prototype$6.draw = function(ctx, scene, bounds) {
var mark = Marks[scene.marktype];
mark.draw.call(this, ctx, scene, bounds);
};
prototype$6.clear = function(x, y, w, h) {
var g = this.context();
g.clearRect(x, y, w, h);
if (this._bgcolor != null) {
g.fillStyle = this._bgcolor;
g.fillRect(x, y, w, h);
}
};
function SVGHandler(loader) {
Handler.call(this, loader);
var h = this;
h._hrefHandler = listener(h, function(evt, item) {
if (item && item.href) h.handleHref(evt, item, item.href);
});
h._tooltipHandler = listener(h, function(evt, item) {
if (item && item.tooltip) {
h.handleTooltip(evt, item, evt.type === 'mouseover' ? item.tooltip : null);
}
});
}
var prototype$7 = inherits(SVGHandler, Handler);
prototype$7.initialize = function(el, origin, obj) {
var svg = this._svg;
if (svg) {
svg.removeEventListener('click', this._hrefHandler);
svg.removeEventListener('mouseover', this._tooltipHandler);
svg.removeEventListener('mouseout', this._tooltipHandler);
}
this._svg = svg = el && domFind(el, 'svg');
if (svg) {
svg.addEventListener('click', this._hrefHandler);
svg.addEventListener('mouseover', this._tooltipHandler);
svg.addEventListener('mouseout', this._tooltipHandler);
}
return Handler.prototype.initialize.call(this, el, origin, obj);
};
prototype$7.svg = function() {
return this._svg;
};
// wrap an event listener for the SVG DOM
function listener(context, handler) {
return function(evt) {
var target = evt.target,
item = target.__data__;
evt.vegaType = evt.type;
item = Array.isArray(item) ? item[0] : item;
handler.call(context._obj, evt, item);
};
}
// add an event handler
prototype$7.on = function(type, handler) {
var name = this.eventName(type),
h = this._handlers,
x = {
type: type,
handler: handler,
listener: listener(this, handler)
};
(h[name] || (h[name] = [])).push(x);
if (this._svg) {
this._svg.addEventListener(name, x.listener);
}
return this;
};
// remove an event handler
prototype$7.off = function(type, handler) {
var name = this.eventName(type),
svg = this._svg,
h = this._handlers[name], i;
if (!h) return;
for (i=h.length; --i>=0;) {
if (h[i].type === type && !handler || h[i].handler === handler) {
if (this._svg) {
svg.removeEventListener(name, h[i].listener);
}
h.splice(i, 1);
}
}
return this;
};
// generate string for an opening xml tag
// tag: the name of the xml tag
// attr: hash of attribute name-value pairs to include
// raw: additional raw string to include in tag markup
function openTag(tag, attr, raw) {
var s = '<' + tag, key, val;
if (attr) {
for (key in attr) {
val = attr[key];
if (val != null) {
s += ' ' + key + '="' + val + '"';
}
}
}
if (raw) s += ' ' + raw;
return s + '>';
}
// generate string for closing xml tag
// tag: the name of the xml tag
function closeTag(tag) {
return '</' + tag + '>';
}
var metadata = {
'version': '1.1',
'xmlns': 'http://www.w3.org/2000/svg',
'xmlns:xlink': 'http://www.w3.org/1999/xlink'
};
var styles = {
'fill': 'fill',
'fillOpacity': 'fill-opacity',
'stroke': 'stroke',
'strokeWidth': 'stroke-width',
'strokeOpacity': 'stroke-opacity',
'strokeCap': 'stroke-linecap',
'strokeDash': 'stroke-dasharray',
'strokeDashOffset': 'stroke-dashoffset',
'opacity': 'opacity'
};
var styleProperties = Object.keys(styles);
var ns = metadata.xmlns;
function SVGRenderer(loader) {
Renderer.call(this, loader);
this._dirtyID = 0;
this._svg = null;
this._root = null;
this._defs = null;
}
var prototype$8 = inherits(SVGRenderer, Renderer);
var base$1 = Renderer.prototype;
prototype$8.initialize = function(el, width, height, padding) {
if (el) {
this._svg = domChild(el, 0, 'svg', ns);
this._svg.setAttribute('class', 'marks');
domClear(el, 1);
// set the svg root group
this._root = domChild(this._svg, 0, 'g', ns);
domClear(this._svg, 1);
}
// create the svg definitions cache
this._defs = {
clip_id: 1,
gradient: {},
clipping: {}
};
// set background color if defined
this.background(this._bgcolor);
return base$1.initialize.call(this, el, width, height, padding);
};
prototype$8.background = function(bgcolor) {
if (arguments.length && this._svg) {
this._svg.style.setProperty('background-color', bgcolor);
}
return base$1.background.apply(this, arguments);
};
prototype$8.resize = function(width, height, origin) {
base$1.resize.call(this, width, height, origin);
if (this._svg) {
this._svg.setAttribute('width', this._width);
this._svg.setAttribute('height', this._height);
this._svg.setAttribute('viewBox', '0 0 ' + this._width + ' ' + this._height);
this._root.setAttribute('transform', 'translate(' + this._origin + ')');
}
return this;
};
prototype$8.svg = function() {
if (!this._svg) return null;
var attr = {
'class': 'marks',
'width': this._width,
'height': this._height,
'viewBox': '0 0 ' + this._width + ' ' + this._height
};
for (var key in metadata) {
attr[key] = metadata[key];
}
return openTag('svg', attr) + this._svg.innerHTML + closeTag('svg');
};
// -- Render entry point --
prototype$8._render = function(scene, items) {
// perform spot updates and re-render markup
if (this._dirtyCheck(items)) {
if (this._dirtyAll) this._resetDefs();
this.draw(this._root, scene);
domClear(this._root, 1);
}
this.updateDefs();
return this;
};
// -- Manage SVG definitions ('defs') block --
prototype$8.updateDefs = function() {
var svg = this._svg,
defs = this._defs,
el = defs.el,
index = 0, id;
for (id in defs.gradient) {
if (!el) defs.el = (el = domChild(svg, 0, 'defs', ns));
updateGradient(el, defs.gradient[id], index++);
}
for (id in defs.clipping) {
if (!el) defs.el = (el = domChild(svg, 0, 'defs', ns));
updateClipping(el, defs.clipping[id], index++);
}
// clean-up
if (el) {
if (index === 0) {
svg.removeChild(el);
defs.el = null;
} else {
domClear(el, index);
}
}
};
function updateGradient(el, grad, index) {
var i, n, stop;
el = domChild(el, index, 'linearGradient', ns);
el.setAttribute('id', grad.id);
el.setAttribute('x1', grad.x1);
el.setAttribute('x2', grad.x2);
el.setAttribute('y1', grad.y1);
el.setAttribute('y2', grad.y2);
for (i=0, n=grad.stops.length; i<n; ++i) {
stop = domChild(el, i, 'stop', ns);
stop.setAttribute('offset', grad.stops[i].offset);
stop.setAttribute('stop-color', grad.stops[i].color);
}
domClear(el, i);
}
function updateClipping(el, clip, index) {
var rect;
el = domChild(el, index, 'clipPath', ns);
el.setAttribute('id', clip.id);
rect = domChild(el, 0, 'rect', ns);
rect.setAttribute('x', 0);
rect.setAttribute('y', 0);
rect.setAttribute('width', clip.width);
rect.setAttribute('height', clip.height);
}
prototype$8._resetDefs = function() {
var def = this._defs;
def.clip_id = 1;
def.gradient = {};
def.clipping = {};
};
// -- Manage rendering of items marked as dirty --
prototype$8.isDirty = function(item) {
return this._dirtyAll
|| !item._svg
|| item.dirty === this._dirtyID;
};
prototype$8._dirtyCheck = function(items) {
this._dirtyAll = true;
if (!items) return true;
var id = ++this._dirtyID,
item, mark, type, mdef, i, n, o;
for (i=0, n=items.length; i<n; ++i) {
item = items[i];
mark = item.mark;
if (mark.marktype !== type) {
// memoize mark instance lookup
type = mark.marktype;
mdef = Marks[type];
}
if (mark.zdirty && mark.dirty !== id) {
this._dirtyAll = false;
mark.dirty = id;
dirtyParents(mark.group, id);
}
if (item.exit) { // EXIT
if (mdef.nested && mark.items.length) {
// if nested mark with remaining points, update instead
o = mark.items[0];
if (o._svg) this._update(mdef, o._svg, o);
} else if (item._svg) {
// otherwise remove from DOM
item._svg.remove();
}
item._svg = null;
continue;
}
item = (mdef.nested ? mark.items[0] : item);
if (item._update === id) continue; // already visited
if (!item._svg || !item._svg.ownerSVGElement) {
// ENTER
this._dirtyAll = false;
dirtyParents(item, id);
} else {
// IN-PLACE UPDATE
this._update(mdef, item._svg, item);
}
item._update = id;
}
return !this._dirtyAll;
};
function dirtyParents(item, id) {
for (; item && item.dirty !== id; item=item.mark.group) {
item.dirty = id;
if (item.mark && item.mark.dirty !== id) {
item.mark.dirty = id;
} else return;
}
}
// -- Construct & maintain scenegraph to SVG mapping ---
// Draw a mark container.
prototype$8.draw = function(el, scene, prev) {
if (!this.isDirty(scene)) return scene._svg;
var renderer = this,
mdef = Marks[scene.marktype],
events = scene.interactive === false ? 'none' : null,
isGroup = mdef.tag === 'g',
sibling = null,
i = 0,
parent;
parent = bind(scene, el, prev, 'g');
parent.setAttribute('class', cssClass(scene));
if (!isGroup && events) {
parent.style.setProperty('pointer-events', events);
}
function process(item) {
var dirty = renderer.isDirty(item),
node = bind(item, parent, sibling, mdef.tag);
if (dirty) {
renderer._update(mdef, node, item);
if (isGroup) recurse(renderer, node, item);
}
sibling = node;
++i;
}
if (mdef.nested) {
if (scene.items.length) process(scene.items[0]);
} else {
visit(scene, process);
}
domClear(parent, i);
return parent;
};
// Recursively process group contents.
function recurse(renderer, el, group) {
el = el.lastChild;
var prev, idx = 0;
visit(group, function(item) {
prev = renderer.draw(el, item, prev);
++idx;
});
// remove any extraneous DOM elements
domClear(el, 1 + idx);
}
// Bind a scenegraph item to an SVG DOM element.
// Create new SVG elements as needed.
function bind(item, el, sibling, tag) {
var node = item._svg, doc;
// create a new dom node if needed
if (!node) {
doc = el.ownerDocument;
node = domCreate(doc, tag, ns);
item._svg = node;
if (item.mark) {
node.__data__ = item;
node.__values__ = {fill: 'default'};
// if group, create background and foreground elements
if (tag === 'g') {
var bg = domCreate(doc, 'path', ns);
bg.setAttribute('class', 'background');
node.appendChild(bg);
bg.__data__ = item;
var fg = domCreate(doc, 'g', ns);
node.appendChild(fg);
fg.__data__ = item;
}
}
}
if (doc || node.previousSibling !== sibling) {
el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild);
}
return node;
}
// -- Set attributes & styles on SVG elements ---
var element = null;
var values$1 = null;
// temp var for current values hash
// Extra configuration for certain mark types
var mark_extras = {
group: function(mdef, el, item) {
values$1 = el.__values__; // use parent's values hash
element = el.childNodes[1];
mdef.foreground(emit, item, this);
element = el.childNodes[0];
mdef.background(emit, item, this);
var value = item.mark.interactive === false ? 'none' : null;
if (value !== values$1.events) {
element.style.setProperty('pointer-events', value);
values$1.events = value;
}
},
text: function(mdef, el, item) {
var str = textValue(item);
if (str !== values$1.text) {
el.textContent = str;
values$1.text = str;
}
str = font(item);
if (str !== values$1.font) {
el.style.setProperty('font', str);
values$1.font = str;
}
}
};
prototype$8._update = function(mdef, el, item) {
// set dom element and values cache
// provides access to emit method
element = el;
values$1 = el.__values__;
// apply svg attributes
mdef.attr(emit, item, this);
// some marks need special treatment
var extra = mark_extras[mdef.type];
if (extra) extra.call(this, mdef, el, item);
// apply svg css styles
// note: element may be modified by 'extra' method
this.style(element, item);
};
function emit(name, value, ns) {
// early exit if value is unchanged
if (value === values$1[name]) return;
if (value != null) {
// if value is provided, update DOM attribute
if (ns) {
element.setAttributeNS(ns, name, value);
} else {
element.setAttribute(name, value);
}
} else {
// else remove DOM attribute
if (ns) {
element.removeAttributeNS(ns, name);
} else {
element.removeAttribute(name);
}
}
// note current value for future comparison
values$1[name] = value;
}
prototype$8.style = function(el, o) {
if (o == null) return;
var i, n, prop, name, value;
for (i=0, n=styleProperties.length; i<n; ++i) {
prop = styleProperties[i];
value = o[prop];
if (value === values$1[prop]) continue;
name = styles[prop];
if (value == null) {
if (name === 'fill') {
el.style.setProperty(name, 'none');
} else {
el.style.removeProperty(name);
}
} else {
if (value.id) {
// ensure definition is included
this._defs.gradient[value.id] = value;
value = 'url(' + href() + '#' + value.id + ')';
}
el.style.setProperty(name, value+'');
}
values$1[prop] = value;
}
};
function href() {
return typeof window !== 'undefined' ? window.location.href : '';
}
function SVGStringRenderer(loader) {
Renderer.call(this, loader);
this._text = {
head: '',
root: '',
foot: '',
defs: '',
body: ''
};
this._defs = {
clip_id: 1,
gradient: {},
clipping: {}
};
}
var prototype$9 = inherits(SVGStringRenderer, Renderer);
var base$2 = Renderer.prototype;
prototype$9.resize = function(width, height, origin) {
base$2.resize.call(this, width, height, origin);
var o = this._origin,
t = this._text;
var attr = {
'class': 'marks',
'width': this._width,
'height': this._height,
'viewBox': '0 0 ' + this._width + ' ' + this._height
};
for (var key in metadata) {
attr[key] = metadata[key];
}
t.head = openTag('svg', attr);
t.root = openTag('g', {
transform: 'translate(' + o + ')'
});
t.foot = closeTag('g') + closeTag('svg');
return this;
};
prototype$9.svg = function() {
var t = this._text;
return t.head + t.defs + t.root + t.body + t.foot;
};
prototype$9._render = function(scene) {
this._text.body = this.mark(scene);
this._text.defs = this.buildDefs();
return this;
};
prototype$9.reset = function() {
this._defs.clip_id = 0;
return this;
};
prototype$9.buildDefs = function() {
var all = this._defs,
defs = '',
i, id, def, stops;
for (id in all.gradient) {
def = all.gradient[id];
stops = def.stops;
defs += openTag('linearGradient', {
id: id,
x1: def.x1,
x2: def.x2,
y1: def.y1,
y2: def.y2
});
for (i=0; i<stops.length; ++i) {
defs += openTag('stop', {
offset: stops[i].offset,
'stop-color': stops[i].color
}) + closeTag('stop');
}
defs += closeTag('linearGradient');
}
for (id in all.clipping) {
def = all.clipping[id];
defs += openTag('clipPath', {id: id});
defs += openTag('rect', {
x: 0,
y: 0,
width: def.width,
height: def.height
}) + closeTag('rect');
defs += closeTag('clipPath');
}
return (defs.length > 0) ? openTag('defs') + defs + closeTag('defs') : '';
};
var object$1;
function emit$1(name, value, ns, prefixed) {
object$1[prefixed || name] = value;
}
prototype$9.attributes = function(attr, item) {
object$1 = {};
attr(emit$1, item, this);
return object$1;
};
prototype$9.href = function(item) {
var that = this,
href = item.href,
attr;
if (href) {
if (attr = that._hrefs && that._hrefs[href]) {
return attr;
} else {
that.sanitizeURL(href).then(function(attr) {
// rewrite to use xlink namespace
// note that this will be deprecated in SVG 2.0
attr['xlink:href'] = attr.href;
attr.href = null;
(that._hrefs || (that._hrefs = {}))[href] = attr;
});
}
}
return null;
};
prototype$9.mark = function(scene) {
var renderer = this,
mdef = Marks[scene.marktype],
tag = mdef.tag,
defs = this._defs,
str = '',
style;
if (tag !== 'g' && scene.interactive === false) {
style = 'style="pointer-events: none;"';
}
// render opening group tag
str += openTag('g', {
'class': cssClass(scene)
}, style);
// render contained elements
function process(item) {
var href = renderer.href(item);
if (href) str += openTag('a', href);
style = (tag !== 'g') ? applyStyles(item, scene, tag, defs) : null;
str += openTag(tag, renderer.attributes(mdef.attr, item), style);
if (tag === 'text') {
str += escape_text(textValue(item));
} else if (tag === 'g') {
str += openTag('path', renderer.attributes(mdef.background, item),
applyStyles(item, scene, 'bgrect', defs)) + closeTag('path');
str += openTag('g', renderer.attributes(mdef.foreground, item))
+ renderer.markGroup(item)
+ closeTag('g');
}
str += closeTag(tag);
if (href) str += closeTag('a');
}
if (mdef.nested) {
if (scene.items && scene.items.length) process(scene.items[0]);
} else {
visit(scene, process);
}
// render closing group tag
return str + closeTag('g');
};
prototype$9.markGroup = function(scene) {
var renderer = this,
str = '';
visit(scene, function(item) {
str += renderer.mark(item);
});
return str;
};
function applyStyles(o, mark, tag, defs) {
if (o == null) return '';
var i, n, prop, name, value, s = '';
if (tag === 'bgrect' && mark.interactive === false) {
s += 'pointer-events: none;';
}
if (tag === 'text') {
s += 'font: ' + font(o) + ';';
}
for (i=0, n=styleProperties.length; i<n; ++i) {
prop = styleProperties[i];
name = styles[prop];
value = o[prop];
if (value == null) {
if (name === 'fill') {
s += (s.length ? ' ' : '') + 'fill: none;';
}
} else {
if (value.id) {
// ensure definition is included
defs.gradient[value.id] = value;
value = 'url(#' + value.id + ')';
}
s += (s.length ? ' ' : '') + name + ': ' + value + ';';
}
}
return s ? 'style="' + s + '"' : null;
}
function escape_text(s) {
return s.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>');
}
var Canvas$2 = 'canvas';
var PNG = 'png';
var SVG = 'svg';
var None$1 = 'none';
var RenderType = {
Canvas: Canvas$2,
PNG: PNG,
SVG: SVG,
None: None$1
};
var modules = {};
modules[Canvas$2] = modules[PNG] = {
renderer: CanvasRenderer,
headless: CanvasRenderer,
handler: CanvasHandler
};
modules[SVG] = {
renderer: SVGRenderer,
headless: SVGStringRenderer,
handler: SVGHandler
};
modules[None$1] = {};
function renderModule(name, _) {
name = String(name || '').toLowerCase();
return arguments.length > 1 ? (modules[name] = _, this) : modules[name];
}
var TOLERANCE = 1e-9;
function sceneEqual(a, b, key) {
return (a === b) ? true
: (key === 'path') ? pathEqual(a, b)
: (a instanceof Date && b instanceof Date) ? +a === +b
: (isNumber(a) && isNumber(b)) ? Math.abs(a - b) <= TOLERANCE
: (!a || !b || !isObject(a) && !isObject(b)) ? a == b
: (a == null || b == null) ? false
: objectEqual(a, b);
}
function pathEqual(a, b) {
return sceneEqual(pathParse(a), pathParse(b));
}
function objectEqual(a, b) {
var ka = Object.keys(a),
kb = Object.keys(b),
key, i;
if (ka.length !== kb.length) return false;
ka.sort();
kb.sort();
for (i = ka.length - 1; i >= 0; i--) {
if (ka[i] != kb[i]) return false;
}
for (i = ka.length - 1; i >= 0; i--) {
key = ka[i];
if (!sceneEqual(a[key], b[key], key)) return false;
}
return typeof a === typeof b;
}
function UniqueList(idFunc) {
var $ = idFunc || identity$1,
list = [],
ids = {};
list.add = function(_) {
var id = $(_);
if (!ids[id]) {
ids[id] = 1;
list.push(_);
}
return list;
};
list.remove = function(_) {
var id = $(_), idx;
if (ids[id]) {
ids[id] = 0;
if ((idx = list.indexOf(_)) >= 0) {
list.splice(idx, 1);
}
}
return list;
};
return list;
}
var TUPLE_ID = 1;
/**
* Returns the id of a tuple.
* @param {Tuple} t - The input tuple.
* @return the tuple id.
*/
function tupleid(t) {
return t._id;
}
/**
* Copy the values of one tuple to another (ignoring id and prev fields).
* @param {Tuple} t - The tuple to copy from.
* @param {Tuple} c - The tuple to write to.
* @return The re-written tuple, same as the argument 'c'.
*/
function copy(t, c) {
for (var k in t) {
if (k !== '_id') c[k] = t[k];
}
return c;
}
/**
* Ingest an object or value as a data tuple.
* If the input value is an object, an id field will be added to it. For
* efficiency, the input object is modified directly. A copy is not made.
* If the input value is a literal, it will be wrapped in a new object
* instance, with the value accessible as the 'data' property.
* @param datum - The value to ingest.
* @return {Tuple} The ingested data tuple.
*/
function ingest(datum) {
var tuple = (datum === Object(datum)) ? datum : {data: datum};
if (!tuple._id) tuple._id = ++TUPLE_ID;
return tuple;
}
/**
* Given a source tuple, return a derived copy.
* @param {object} t - The source tuple.
* @return {object} The derived tuple.
*/
function derive(t) {
return ingest(copy(t, {}));
}
/**
* Rederive a derived tuple by copying values from the source tuple.
* @param {object} t - The source tuple.
* @param {object} d - The derived tuple.
* @return {object} The derived tuple.
*/
function rederive(t, d) {
return copy(t, d);
}
/**
* Replace an existing tuple with a new tuple.
* The existing tuple will become the previous value of the new.
* @param {object} t - The existing data tuple.
* @param {object} d - The new tuple that replaces the old.
* @return {object} The new tuple.
*/
function replace(t, d) {
return d._id = t._id, d;
}
function isChangeSet(v) {
return v && v.constructor === changeset;
}
function changeset() {
var add = [], // insert tuples
rem = [], // remove tuples
mod = [], // modify tuples
remp = [], // remove by predicate
modp = []; // modify by predicate
return {
constructor: changeset,
insert: function(t) {
var d = array$1(t), i = 0, n = d.length;
for (; i<n; ++i) add.push(d[i]);
return this;
},
remove: function(t) {
var a = isFunction(t) ? remp : rem,
d = array$1(t), i = 0, n = d.length;
for (; i<n; ++i) a.push(d[i]);
return this;
},
modify: function(t, field, value) {
var m = {field: field, value: constant$1(value)};
if (isFunction(t)) m.filter = t, modp.push(m);
else m.tuple = t, mod.push(m);
return this;
},
encode: function(t, set) {
mod.push({tuple: t, field: set});
return this;
},
pulse: function(pulse, tuples) {
var out, i, n, m, f, t, id;
// add
for (i=0, n=add.length; i<n; ++i) {
pulse.add.push(ingest(add[i]));
}
// remove
for (out={}, i=0, n=rem.length; i<n; ++i) {
t = rem[i];
out[t._id] = t;
}
for (i=0, n=remp.length; i<n; ++i) {
f = remp[i];
tuples.forEach(function(t) {
if (f(t)) out[t._id] = t;
});
}
for (id in out) pulse.rem.push(out[id]);
// modify
function modify(t, f, v) {
if (v) t[f] = v(t); else pulse.encode = f;
out[t._id] = t;
}
for (out={}, i=0, n=mod.length; i<n; ++i) {
m = mod[i];
modify(m.tuple, m.field, m.value);
pulse.modifies(m.field);
}
for (i=0, n=modp.length; i<n; ++i) {
m = modp[i];
f = m.filter;
tuples.forEach(function(t) {
if (f(t)) modify(t, m.field, m.value);
});
pulse.modifies(m.field);
}
for (id in out) pulse.mod.push(out[id]);
return pulse;
}
};
}
var CACHE = '_:mod:_';
/**
* Hash that tracks modifications to assigned values.
* Callers *must* use the set method to update values.
*/
function Parameters() {
Object.defineProperty(this, CACHE, {writable:true, value: {}});
}
var prototype$12 = Parameters.prototype;
/**
* Set a parameter value. If the parameter value changes, the parameter
* will be recorded as modified.
* @param {string} name - The parameter name.
* @param {number} index - The index into an array-value parameter. Ignored if
* the argument is undefined, null or less than zero.
* @param {*} value - The parameter value to set.
* @param {boolean} [force=false] - If true, records the parameter as modified
* even if the value is unchanged.
* @return {Parameters} - This parameter object.
*/
prototype$12.set = function(name, index, value, force) {
var o = this,
v = o[name],
mod = o[CACHE];
if (index != null && index >= 0) {
if (v[index] !== value || force) {
v[index] = value;
mod[index + ':' + name] = -1;
mod[name] = -1;
}
} else if (v !== value || force) {
o[name] = value;
mod[name] = isArray(value) ? value.length : -1;
}
return o;
};
/**
* Tests if one or more parameters has been modified. If invoked with no
* arguments, returns true if any parameter value has changed. If the first
* argument is array, returns trues if any parameter name in the array has
* changed. Otherwise, tests if the given name and optional array index has
* changed.
* @param {string} name - The parameter name to test.
* @param {number} [index=undefined] - The parameter array index to test.
* @return {boolean} - Returns true if a queried parameter was modified.
*/
prototype$12.modified = function(name, index) {
var mod = this[CACHE], k;
if (!arguments.length) {
for (k in mod) { if (mod[k]) return true; }
return false;
} else if (isArray(name)) {
for (k=0; k<name.length; ++k) {
if (mod[name[k]]) return true;
}
return false;
}
return (index != null && index >= 0)
? (index < mod[name] || !!mod[index + ':' + name])
: !!mod[name];
};
/**
* Clears the modification records. After calling this method,
* all parameters are considered unmodified.
*/
prototype$12.clear = function() {
return this[CACHE] = {}, this;
};
var OP_ID = 0;
var PULSE = 'pulse';
var NO_PARAMS = new Parameters();
// Boolean Flags
var SKIP = 1;
var MODIFIED = 2;
/**
* An Operator is a processing node in a dataflow graph.
* Each operator stores a value and an optional value update function.
* Operators can accept a hash of named parameters. Parameter values can
* either be direct (JavaScript literals, arrays, objects) or indirect
* (other operators whose values will be pulled dynamically). Operators
* included as parameters will have this operator added as a dependency.
* @constructor
* @param {*} [init] - The initial value for this operator.
* @param {function(object, Pulse)} [update] - An update function. Upon
* evaluation of this operator, the update function will be invoked and the
* return value will be used as the new value of this operator.
* @param {object} [params] - The parameters for this operator.
* @param {boolean} [react=true] - Flag indicating if this operator should
* listen for changes to upstream operators included as parameters.
* @see parameters
*/
function Operator(init, update, params, react) {
this.id = ++OP_ID;
this.value = init;
this.stamp = -1;
this.rank = -1;
this.qrank = -1;
this.flags = 0;
if (update) {
this._update = update;
}
if (params) this.parameters(params, react);
}
var prototype$11 = Operator.prototype;
/**
* Returns a list of target operators dependent on this operator.
* If this list does not exist, it is created and then returned.
* @return {UniqueList}
*/
prototype$11.targets = function() {
return this._targets || (this._targets = UniqueList(id));
};
/**
* Sets the value of this operator.
* @param {*} value - the value to set.
* @return {Number} Returns 1 if the operator value has changed
* according to strict equality, returns 0 otherwise.
*/
prototype$11.set = function(value) {
return this.value !== value ? (this.value = value, 1) : 0;
};
function flag(bit) {
return function(state) {
var f = this.flags;
if (arguments.length === 0) return !!(f & bit);
this.flags = state ? (f | bit) : (f & ~bit);
return this;
};
}
/**
* Indicates that operator evaluation should be skipped on the next pulse.
* This operator will still propagate incoming pulses, but its update function
* will not be invoked. The skip flag is reset after every pulse, so calling
* this method will affect processing of the next pulse only.
*/
prototype$11.skip = flag(SKIP);
/**
* Indicates that this operator's value has been modified on its most recent
* pulse. Normally modification is checked via strict equality; however, in
* some cases it is more efficient to update the internal state of an object.
* In those cases, the modified flag can be used to trigger propagation. Once
* set, the modification flag persists across pulses until unset. The flag can
* be used with the last timestamp to test if a modification is recent.
*/
prototype$11.modified = flag(MODIFIED);
/**
* Sets the parameters for this operator. The parameter values are analyzed for
* operator instances. If found, this operator will be added as a dependency
* of the parameterizing operator. Operator values are dynamically marshalled
* from each operator parameter prior to evaluation. If a parameter value is
* an array, the array will also be searched for Operator instances. However,
* the search does not recurse into sub-arrays or object properties.
* @param {object} params - A hash of operator parameters.
* @param {boolean} [react=true] - A flag indicating if this operator should
* automatically update (react) when parameter values change. In other words,
* this flag determines if the operator registers itself as a listener on
* any upstream operators included in the parameters.
* @return {Operator[]} - An array of upstream dependencies.
*/
prototype$11.parameters = function(params, react) {
react = react !== false;
var self = this,
argval = (self._argval = self._argval || new Parameters()),
argops = (self._argops = self._argops || []),
deps = [],
name, value, n, i;
function add(name, index, value) {
if (value instanceof Operator) {
if (value !== self) {
if (react) value.targets().add(self);
deps.push(value);
}
argops.push({op:value, name:name, index:index});
} else {
argval.set(name, index, value);
}
}
for (name in params) {
value = params[name];
if (name === PULSE) {
array$1(value).forEach(function(op) {
if (!(op instanceof Operator)) {
error('Pulse parameters must be operator instances.');
} else if (op !== self) {
op.targets().add(self);
deps.push(op);
}
});
self.source = value;
} else if (isArray(value)) {
argval.set(name, -1, Array(n = value.length));
for (i=0; i<n; ++i) add(name, i, value[i]);
} else {
add(name, -1, value);
}
}
this.marshall().clear(); // initialize values
return deps;
};
/**
* Internal method for marshalling parameter values.
* Visits each operator dependency to pull the latest value.
* @return {Parameters} A Parameters object to pass to the update function.
*/
prototype$11.marshall = function(stamp) {
var argval = this._argval || NO_PARAMS,
argops = this._argops, item, i, n, op, mod;
if (argops && (n = argops.length)) {
for (i=0; i<n; ++i) {
item = argops[i];
op = item.op;
mod = op.modified() && op.stamp === stamp;
argval.set(item.name, item.index, op.value, mod);
}
}
return argval;
};
/**
* Delegate method to perform operator processing.
* Subclasses can override this method to perform custom processing.
* By default, it marshalls parameters and calls the update function
* if that function is defined. If the update function does not
* change the operator value then StopPropagation is returned.
* If no update function is defined, this method does nothing.
* @param {Pulse} pulse - the current dataflow pulse.
* @return The output pulse or StopPropagation. A falsy return value
* (including undefined) will let the input pulse pass through.
*/
prototype$11.evaluate = function(pulse) {
if (this._update) {
var params = this.marshall(pulse.stamp),
v = this._update(params, pulse);
params.clear();
if (v !== this.value) {
this.value = v;
} else if (!this.modified()) {
return pulse.StopPropagation;
}
}
};
/**
* Run this operator for the current pulse. If this operator has already
* been run at (or after) the pulse timestamp, returns StopPropagation.
* Internally, this method calls {@link evaluate} to perform processing.
* If {@link evaluate} returns a falsy value, the input pulse is returned.
* This method should NOT be overridden, instead overrride {@link evaluate}.
* @param {Pulse} pulse - the current dataflow pulse.
* @return the output pulse for this operator (or StopPropagation)
*/
prototype$11.run = function(pulse) {
if (pulse.stamp <= this.stamp) return pulse.StopPropagation;
var rv = this.skip() ? (this.skip(false), 0) : this.evaluate(pulse);
return this.stamp = pulse.stamp, this.pulse = rv || pulse;
};
/**
* Add an operator to the dataflow graph. This function accepts a
* variety of input argument types. The basic signature supports an
* initial value, update function and parameters. If the first parameter
* is an Operator instance, it will be added directly. If it is a
* constructor for an Operator subclass, a new instance will be instantiated.
* Otherwise, if the first parameter is a function instance, it will be used
* as the update function and a null initial value is assumed.
* @param {*} init - One of: the operator to add, the initial value of
* the operator, an operator class to instantiate, or an update function.
* @param {function} [update] - The operator update function.
* @param {object} [params] - The operator parameters.
* @param {boolean} [react=true] - Flag indicating if this operator should
* listen for changes to upstream operators included as parameters.
* @return {Operator} - The added operator.
*/
function add$1(init, update, params, react) {
var shift = 1,
op = (init instanceof Operator) ? init
: init && init.prototype instanceof Operator ? new init()
: isFunction(init) ? new Operator(null, init)
: (shift = 0, new Operator(init, update));
this.rank(op);
if (shift) react = params, params = update;
if (params) this.connect(op, op.parameters(params, react));
this.touch(op);
return op;
}
/**
* Connect a target operator as a dependent of source operators.
* If necessary, this method will rerank the target operator and its
* dependents to ensure propagation proceeds in a topologically sorted order.
* @param {Operator} target - The target operator.
* @param {Array<Operator>} - The source operators that should propagate
* to the target operator.
*/
function connect(target, sources) {
var targetRank = target.rank, i, n;
for (i=0, n=sources.length; i<n; ++i) {
if (targetRank < sources[i].rank) {
this.rerank(target);
return;
}
}
}
var STREAM_ID = 0;
/**
* Models an event stream.
* @constructor
* @param {function(Object, number): boolean} [filter] - Filter predicate.
* Events pass through when truthy, events are suppressed when falsy.
* @param {function(Object): *} [apply] - Applied to input events to produce
* new event values.
* @param {function(Object)} [receive] - Event callback function to invoke
* upon receipt of a new event. Use to override standard event processing.
*/
function EventStream(filter, apply, receive) {
this.id = ++STREAM_ID;
this.value = null;
if (receive) this.receive = receive;
if (filter) this._filter = filter;
if (apply) this._apply = apply;
}
/**
* Creates a new event stream instance with the provided
* (optional) filter, apply and receive functions.
* @param {function(Object, number): boolean} [filter] - Filter predicate.
* Events pass through when truthy, events are suppressed when falsy.
* @param {function(Object): *} [apply] - Applied to input events to produce
* new event values.
* @see EventStream
*/
function stream(filter, apply, receive) {
return new EventStream(filter, apply, receive);
}
var prototype$13 = EventStream.prototype;
prototype$13._filter = truthy;
prototype$13._apply = identity$1;
prototype$13.targets = function() {
return this._targets || (this._targets = UniqueList(id));
};
prototype$13.consume = function(_) {
if (!arguments.length) return !!this._consume;
return (this._consume = !!_, this);
};
prototype$13.receive = function(evt) {
if (this._filter(evt)) {
var val = (this.value = this._apply(evt)),
trg = this._targets,
n = trg ? trg.length : 0,
i = 0;
for (; i<n; ++i) trg[i].receive(val);
if (this._consume) {
evt.preventDefault();
evt.stopPropagation();
}
}
};
prototype$13.filter = function(filter) {
var s = stream(filter);
return (this.targets().add(s), s);
};
prototype$13.apply = function(apply) {
var s = stream(null, apply);
return (this.targets().add(s), s);
};
prototype$13.merge = function() {
var s = stream();
this.targets().add(s);
for (var i=0, n=arguments.length; i<n; ++i) {
arguments[i].targets().add(s);
}
return s;
};
prototype$13.throttle = function(pause) {
var t = -1;
return this.filter(function() {
var now = Date.now();
return (now - t) > pause ? (t = now, 1) : 0;
});
};
prototype$13.debounce = function(delay) {
var s = stream(), evt = null, tid = null;
function callback() {
var df = evt.dataflow;
s.receive(evt);
evt = null; tid = null;
if (df && df.run) df.run();
}
this.targets().add(stream(null, null, function(e) {
evt = e;
if (tid) clearTimeout(tid);
tid = setTimeout(callback, delay);
}));
return s;
};
prototype$13.between = function(a, b) {
var active = false;
a.targets().add(stream(null, null, function() { active = true; }));
b.targets().add(stream(null, null, function() { active = false; }));
return this.filter(function() { return active; });
};
/**
* Create a new event stream from an event source.
* @param {object} source - The event source to monitor. The input must
* support the addEventListener method.
* @param {string} type - The event type.
* @param {function(object): boolean} [filter] - Event filter function.
* @param {function(object): *} [apply] - Event application function.
* If provided, this function will be invoked and the result will be
* used as the downstream event value.
* @return {EventStream}
*/
function events(source, type, filter, apply) {
var df = this,
s = stream(filter, apply),
send = function(e) {
e.dataflow = df;
s.receive(e);
df.run();
},
sources;
if (typeof source === 'string' && typeof document !== 'undefined') {
sources = document.querySelectorAll(source);
} else {
sources = array$1(source);
}
for (var i=0, n=sources.length; i<n; ++i) {
sources[i].addEventListener(type, send);
}
return s;
}
var SKIP$1 = {skip: true};
/**
* Perform operator updates in response to events. Applies an
* update function to compute a new operator value. If the update function
* returns a {@link ChangeSet}, the operator will be pulsed with those tuple
* changes. Otherwise, the operator value will be updated to the return value.
* @param {EventStream|Operator} source - The event source to react to.
* This argument can be either an EventStream or an Operator.
* @param {Operator|function(object):Operator} target - The operator to update.
* This argument can either be an Operator instance or (if the source
* argument is an EventStream), a function that accepts an event object as
* input and returns an Operator to target.
* @param {function(Parameters,Event): *} [update] - Optional update function
* to compute the new operator value, or a literal value to set. Update
* functions expect to receive a parameter object and event as arguments.
* This function can either return a new operator value or (if the source
* argument is an EventStream) a {@link ChangeSet} instance to pulse
* the target operator with tuple changes.
* @param {object} [params] - The update function parameters.
* @param {object} [options] - Additional options hash. If not overridden,
* updated operators will be skipped by default.
* @param {boolean} [options.skip] - If true, the operator will
* be skipped: it will not be evaluated, but its dependents will be.
* @param {boolean} [options.force] - If true, the operator will
* be re-evaluated even if its value has not changed.
* @return {Dataflow}
*/
function on(source, target, update, params, options) {
var fn = source instanceof Operator ? onOperator : onStream;
return fn(this, source, target, update, params, options), this;
}
function onStream(df, stream, target, update, params, options) {
var opt = extend({}, options, SKIP$1), func, op;
if (!isFunction(target)) target = constant$1(target);
if (update === undefined) {
func = function(e) {
df.touch(target(e));
};
} else if (isFunction(update)) {
op = new Operator(null, update, params, false);
func = function(e) {
var t = target(e),
v = (op.evaluate(e), op.value);
isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt);
};
} else {
func = function(e) {
df.update(target(e), update, opt);
};
}
stream.apply(func);
}
function onOperator(df, source, target, update, params, options) {
var func, op;
if (update === undefined) {
op = target;
} else {
func = isFunction(update) ? update : constant$1(update);
update = !target ? func : function(_, pulse) {
var value = func(_, pulse);
return target.skip()
? value
: (target.skip(true).value = value);
};
op = new Operator(null, update, params, false);
op.modified(options && options.force);
op.rank = 0;
if (target) {
op.skip(true); // skip first invocation
op.value = target.value;
op.targets().add(target);
}
}
source.targets().add(op);
}
/**
* Assigns a rank to an operator. Ranks are assigned in increasing order
* by incrementing an internal rank counter.
* @param {Operator} op - The operator to assign a rank.
*/
function rank(op) {
op.rank = ++this._rank;
}
/**
* Re-ranks an operator and all downstream target dependencies. This
* is necessary when upstream depencies of higher rank are added to
* a target operator.
* @param {Operator} op - The operator to re-rank.
*/
function rerank(op) {
var queue = [op],
cur, list, i;
while (queue.length) {
this.rank(cur = queue.pop());
if (list = cur._targets) {
for (i=list.length; --i >= 0;) {
queue.push(list[i]);
}
}
}
}
/**
* Sentinel value indicating pulse propagation should stop.
*/
var StopPropagation = {};
// Pulse visit type flags
var ADD = (1 << 0);
var REM = (1 << 1);
var MOD = (1 << 2);
var ADD_REM = ADD | REM;
var ADD_MOD = ADD | MOD;
var ALL = ADD | REM | MOD;
var REFLOW = (1 << 3);
var SOURCE = (1 << 4);
var NO_SOURCE = (1 << 5);
var NO_FIELDS = (1 << 6);
/**
* A Pulse enables inter-operator communication during a run of the
* dataflow graph. In addition to the current timestamp, a pulse may also
* contain a change-set of added, removed or modified data tuples, as well as
* a pointer to a full backing data source. Tuple change sets may not
* be fully materialized; for example, to prevent needless array creation
* a change set may include larger arrays and corresponding filter functions.
* The pulse provides a {@link visit} method to enable proper and efficient
* iteration over requested data tuples.
*
* In addition, each pulse can track modification flags for data tuple fields.
* Responsible transform operators should call the {@link modifies} method to
* indicate changes to data fields. The {@link modified} method enables
* querying of this modification state.
*
* @constructor
* @param {Dataflow} dataflow - The backing dataflow instance.
* @param {number} stamp - The current propagation timestamp.
* @param {string} [encode] - An optional encoding set name, which is then
* accessible as Pulse.encode. Operators can respond to (or ignore) this
* setting as appropriate. This parameter can be used in conjunction with
* the Encode transform in the vega-encode module.
*/
function Pulse(dataflow, stamp, encode) {
this.dataflow = dataflow;
this.stamp = stamp == null ? -1 : stamp;
this.add = [];
this.rem = [];
this.mod = [];
this.fields = null;
this.encode = encode || null;
}
var prototype$14 = Pulse.prototype;
/**
* Sentinel value indicating pulse propagation should stop.
*/
prototype$14.StopPropagation = StopPropagation;
/**
* Boolean flag indicating ADD (added) tuples.
*/
prototype$14.ADD = ADD;
/**
* Boolean flag indicating REM (removed) tuples.
*/
prototype$14.REM = REM;
/**
* Boolean flag indicating MOD (modified) tuples.
*/
prototype$14.MOD = MOD;
/**
* Boolean flag indicating ADD (added) and REM (removed) tuples.
*/
prototype$14.ADD_REM = ADD_REM;
/**
* Boolean flag indicating ADD (added) and MOD (modified) tuples.
*/
prototype$14.ADD_MOD = ADD_MOD;
/**
* Boolean flag indicating ADD, REM and MOD tuples.
*/
prototype$14.ALL = ALL;
/**
* Boolean flag indicating all tuples in a data source
* except for the ADD, REM and MOD tuples.
*/
prototype$14.REFLOW = REFLOW;
/**
* Boolean flag indicating a 'pass-through' to a
* backing data source, ignoring ADD, REM and MOD tuples.
*/
prototype$14.SOURCE = SOURCE;
/**
* Boolean flag indicating that source data should be
* suppressed when creating a forked pulse.
*/
prototype$14.NO_SOURCE = NO_SOURCE;
/**
* Boolean flag indicating that field modifications should be
* suppressed when creating a forked pulse.
*/
prototype$14.NO_FIELDS = NO_FIELDS;
/**
* Creates a new pulse based on the values of this pulse.
* The dataflow, time stamp and field modification values are copied over.
* By default, new empty ADD, REM and MOD arrays are created.
* @param {number} flags - Integer of boolean flags indicating which (if any)
* tuple arrays should be copied to the new pulse. The supported flag values
* are ADD, REM and MOD. Array references are copied directly: new array
* instances are not created.
* @return {Pulse} - The forked pulse instance.
* @see init
*/
prototype$14.fork = function(flags) {
return new Pulse(this.dataflow).init(this, flags);
};
/**
* Returns a pulse that adds all tuples from a backing source. This is
* useful for cases where operators are added to a dataflow after an
* upstream data pipeline has already been processed, ensuring that
* new operators can observe all tuples within a stream.
* @return {Pulse} - A pulse instance with all source tuples included
* in the add array. If the current pulse already has all source
* tuples in its add array, it is returned directly. If the current
* pulse does not have a backing source, it is returned directly.
*/
prototype$14.addAll = function() {
var p = this;
return (!this.source || this.source.length === this.add.length) ? p
: (p = new Pulse(this.dataflow).init(this), p.add = p.source, p);
};
/**
* Initialize this pulse based on the values of another pulse. This method
* is used internally by {@link fork} to initialize a new forked tuple.
* The dataflow, time stamp and field modification values are copied over.
* By default, new empty ADD, REM and MOD arrays are created.
* @param {Pulse} src - The source pulse to copy from.
* @param {number} flags - Integer of boolean flags indicating which (if any)
* tuple arrays should be copied to the new pulse. The supported flag values
* are ADD, REM and MOD. Array references are copied directly: new array
* instances are not created. By default, source data arrays are copied
* to the new pulse. Use the NO_SOURCE flag to enforce a null source.
* @return {Pulse} - Returns this Pulse instance.
*/
prototype$14.init = function(src, flags) {
var p = this;
p.stamp = src.stamp;
p.encode = src.encode;
if (src.fields && !(flags & NO_FIELDS)) p.fields = src.fields;
p.add = (flags & ADD) ? (p.addF = src.addF, src.add) : (p.addF = null, []);
p.rem = (flags & REM) ? (p.remF = src.remF, src.rem) : (p.remF = null, []);
p.mod = (flags & MOD) ? (p.modF = src.modF, src.mod) : (p.modF = null, []);
p.source = (flags & NO_SOURCE)
? (p.srcF = null, null)
: (p.srcF = src.srcF, src.source);
return p;
};
/**
* Schedules a function to run after pulse propagation completes.
* @param {function} func - The function to run.
*/
prototype$14.runAfter = function(func) {
this.dataflow.runAfter(func);
};
/**
* Indicates if tuples have been added, removed or modified.
* @param {number} [flags] - The tuple types (ADD, REM or MOD) to query.
* Defaults to ALL, returning true if any tuple type has changed.
* @return {boolean} - Returns true if one or more queried tuple types have
* changed, false otherwise.
*/
prototype$14.changed = function(flags) {
var f = flags || ALL;
return ((f & ADD) && this.add.length)
|| ((f & REM) && this.rem.length)
|| ((f & MOD) && this.mod.length);
};
/**
* Forces a "reflow" of tuple values, such that all tuples in the backing
* source are added to the MOD set, unless already present in the ADD set.
* @param {boolean} [fork=false] - If true, returns a forked copy of this
* pulse, and invokes reflow on that derived pulse.
* @return {Pulse} - The reflowed pulse instance.
*/
prototype$14.reflow = function(fork) {
if (fork) return this.fork(ALL).reflow();
var len = this.add.length,
src = this.source && this.source.length;
if (src && src !== len) {
this.mod = this.source;
if (len) this.filter(MOD, filter(this, ADD));
}
return this;
};
/**
* Marks one or more data field names as modified to assist dependency
* tracking and incremental processing by transform operators.
* @param {string|Array<string>} _ - The field(s) to mark as modified.
* @return {Pulse} - This pulse instance.
*/
prototype$14.modifies = function(_) {
var fields = array$1(_),
hash = this.fields || (this.fields = {});
fields.forEach(function(f) { hash[f] = true; });
return this;
};
/**
* Checks if one or more data fields have been modified during this pulse
* propagation timestamp.
* @param {string|Array<string>} _ - The field(s) to check for modified.
* @return {boolean} - Returns true if any of the provided fields has been
* marked as modified, false otherwise.
*/
prototype$14.modified = function(_) {
var fields = this.fields;
return !(this.mod.length && fields) ? false
: !arguments.length ? !!fields
: isArray(_) ? _.some(function(f) { return fields[f]; })
: fields[_];
};
/**
* Adds a filter function to one more tuple sets. Filters are applied to
* backing tuple arrays, to determine the actual set of tuples considered
* added, removed or modified. They can be used to delay materialization of
* a tuple set in order to avoid expensive array copies. In addition, the
* filter functions can serve as value transformers: unlike standard predicate
* function (which return boolean values), Pulse filters should return the
* actual tuple value to process. If a tuple set is already filtered, the
* new filter value will be appended into a conjuntive ('and') query.
* @param {number} flags - Flags indicating the tuple set(s) to filter.
* @param {function(*):object} filter - Filter function that will be applied
* to the tuple set array, and should return a data tuple if the value
* should be included in the tuple set, and falsy (or null) otherwise.
* @return {Pulse} - Returns this pulse instance.
*/
prototype$14.filter = function(flags, filter) {
var p = this;
if (flags & ADD) p.addF = addFilter(p.addF, filter);
if (flags & REM) p.remF = addFilter(p.remF, filter);
if (flags & MOD) p.modF = addFilter(p.modF, filter);
if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter);
return p;
};
function addFilter(a, b) {
return a ? function(t,i) { return a(t,i) && b(t,i); } : b;
}
/**
* Materialize one or more tuple sets in this pulse. If the tuple set(s) have
* a registered filter function, it will be applied and the tuple set(s) will
* be replaced with materialized tuple arrays.
* @param {number} flags - Flags indicating the tuple set(s) to materialize.
* @return {Pulse} - Returns this pulse instance.
*/
prototype$14.materialize = function(flags) {
flags = flags || ALL;
var p = this;
if ((flags & ADD) && p.addF) { p.add = p.add.filter(p.addF); p.addF = null; }
if ((flags & REM) && p.remF) { p.rem = p.rem.filter(p.remF); p.remF = null; }
if ((flags & MOD) && p.modF) { p.mod = p.mod.filter(p.modF); p.modF = null; }
if ((flags & SOURCE) && p.srcF) {
p.source = p.source.filter(p.srcF); p.srcF = null;
}
return p;
};
function filter(pulse, flags) {
var map = {};
pulse.visit(flags, function(t) { map[t._id] = 1; });
return function(t) { return map[t._id] ? null : t; };
}
/**
* Visit one or more tuple sets in this pulse.
* @param {number} flags - Flags indicating the tuple set(s) to visit.
* Legal values are ADD, REM, MOD and SOURCE (if a backing data source
* has been set).
* @param {function(object):*} - Visitor function invoked per-tuple.
* @return {Pulse} - Returns this pulse instance.
*/
prototype$14.visit = function(flags, visitor) {
var v = visitor, src, sum;
if (flags & SOURCE) {
visitArray(this.source, this.srcF, v);
return this;
}
if (flags & ADD) visitArray(this.add, this.addF, v);
if (flags & REM) visitArray(this.rem, this.remF, v);
if (flags & MOD) visitArray(this.mod, this.modF, v);
if ((flags & REFLOW) && (src = this.source)) {
sum = this.add.length + this.mod.length;
if (sum === src.length) {
// do nothing
} else if (sum) {
visitArray(src, filter(this, ADD_MOD), v);
} else {
// if no add/rem/mod tuples, visit source
visitArray(src, this.srcF, v);
}
}
return this;
};
var NO_OPT = {skip: false, force: false};
/**
* Touches an operator, scheduling it to be evaluated. If invoked outside of
* a pulse propagation, the operator will be evaluated the next time this
* dataflow is run. If invoked in the midst of pulse propagation, the operator
* will be queued for evaluation if and only if the operator has not yet been
* evaluated on the current propagation timestamp.
* @param {Operator} op - The operator to touch.
* @param {object} [options] - Additional options hash.
* @param {boolean} [options.skip] - If true, the operator will
* be skipped: it will not be evaluated, but its dependents will be.
* @return {Dataflow}
*/
function touch(op, options) {
var opt = options || NO_OPT;
if (this._pulse) {
this._enqueue(op);
} else {
this._touched.add(op);
}
if (opt.skip) op.skip(true);
return this;
}
/**
* Updates the value of the given operator.
* @param {Operator} op - The operator to update.
* @param {*} value - The value to set.
* @param {object} [options] - Additional options hash.
* @param {boolean} [options.force] - If true, the operator will
* be re-evaluated even if its value has not changed.
* @param {boolean} [options.skip] - If true, the operator will
* be skipped: it will not be evaluated, but its dependents will be.
* @return {Dataflow}
*/
function update(op, value, options) {
var opt = options || NO_OPT;
if (op.set(value) || opt.force) {
this.touch(op, opt);
}
return this;
}
/**
* Pulses an operator with a changeset of tuples. If invoked outside of
* a pulse propagation, the pulse will be applied the next time this
* dataflow is run. If invoked in the midst of pulse propagation, the pulse
* will be added to the set of active pulses and will be applied if and
* only if the target operator has not yet been evaluated on the current
* propagation timestamp.
* @param {Operator} op - The operator to pulse.
* @param {ChangeSet} value - The tuple changeset to apply.
* @param {object} [options] - Additional options hash.
* @param {boolean} [options.skip] - If true, the operator will
* be skipped: it will not be evaluated, but its dependents will be.
* @return {Dataflow}
*/
function pulse(op, changeset, options) {
var p = new Pulse(this, this._clock + (this._pulse ? 0 : 1));
p.target = op;
this._pulses[op.id] = changeset.pulse(p, op.value);
return this.touch(op, options || NO_OPT);
}
function ingest$1(target, data, format) {
return this.pulse(target, this.changeset().insert(read(data, format)));
}
function loadPending(df) {
var accept, reject,
pending = new Promise(function(a, r) {
accept = a;
reject = r;
});
pending.requests = 0;
pending.done = function() {
if (--pending.requests === 0) {
df.runAfter(function() {
df._pending = null;
try {
df.run();
accept(df);
} catch (err) {
reject(err);
}
});
}
}
return (df._pending = pending);
}
function request$1(target, url, format) {
var df = this,
pending = df._pending || loadPending(df);
pending.requests += 1;
df.loader()
.load(url, {context:'dataflow'})
.then(
function(data) {
df.ingest(target, data, format);
},
function(error) {
df.warn('Loading failed: ' + url, error);
pending.done();
})
.then(pending.done)
.catch(function(error) { df.warn(error); });
}
/**
* Represents a set of multiple pulses. Used as input for operators
* that accept multiple pulses at a time. Contained pulses are
* accessible via the public "pulses" array property. This pulse doe
* not carry added, removed or modified tuples directly. However,
* the visit method can be used to traverse all such tuples contained
* in sub-pulses with a timestamp matching this parent multi-pulse.
* @constructor
* @param {Dataflow} dataflow - The backing dataflow instance.
* @param {number} stamp - The timestamp.
* @param {Array<Pulse>} pulses - The sub-pulses for this multi-pulse.
*/
function MultiPulse(dataflow, stamp, pulses, encode) {
var p = this,
c = 0,
pulse, hash, i, n, f;
this.dataflow = dataflow;
this.stamp = stamp;
this.fields = null;
this.encode = encode || null;
this.pulses = pulses;
for (i=0, n=pulses.length; i<n; ++i) {
pulse = pulses[i];
if (pulse.stamp !== stamp) continue;
if (pulse.fields) {
hash = p.fields || (p.fields = {});
for (f in pulse.fields) { hash[f] = 1; }
}
if (pulse.changed(p.ADD)) c |= p.ADD;
if (pulse.changed(p.REM)) c |= p.REM;
if (pulse.changed(p.MOD)) c |= p.MOD;
}
this.changes = c;
}
var prototype$15 = inherits(MultiPulse, Pulse);
/**
* Creates a new pulse based on the values of this pulse.
* The dataflow, time stamp and field modification values are copied over.
* @return {Pulse}
*/
prototype$15.fork = function() {
if (arguments.length && (arguments[0] & Pulse.prototype.ALL)) {
error('MultiPulse fork does not support tuple change sets.');
}
return new Pulse(this.dataflow).init(this, 0);
};
prototype$15.changed = function(flags) {
return this.changes & flags;
};
prototype$15.modified = function(_) {
var p = this, fields = p.fields;
return !(fields && (p.changes & p.MOD)) ? 0
: isArray(_) ? _.some(function(f) { return fields[f]; })
: fields[_];
};
prototype$15.filter = function() {
error('MultiPulse does not support filtering.');
};
prototype$15.materialize = function() {
error('MultiPulse does not support materialization.');
};
prototype$15.visit = function(flags, visitor) {
var pulses = this.pulses, i, n;
for (i=0, n=pulses.length; i<n; ++i) {
if (pulses[i].stamp === this.stamp) {
pulses[i].visit(flags, visitor);
}
}
return this;
};
/**
* Runs the dataflow. This method will increment the current timestamp
* and process all updated, pulsed and touched operators. When run for
* the first time, all registered operators will be processed. If there
* are pending data loading operations, this method will return immediately
* without evaluating the dataflow. Instead, the dataflow will be
* asynchronously invoked when data loading completes. To track when dataflow
* evaluation completes, use the {@link runAsync} method instead.
* @param {string} [encode] - The name of an encoding set to invoke during
* propagation. This value is added to generated Pulse instances;
* operators can then respond to (or ignore) this setting as appropriate.
* This parameter can be used in conjunction with the Encode transform in
* the vega-encode module.
*/
function run(encode) {
if (!this._touched.length) {
return 0; // nothing to do!
}
if (this._pending) {
this.info('Awaiting requests, delaying dataflow run.');
return 0;
}
var df = this,
count = 0,
level = df.logLevel(),
op, next, dt;
df._pulse = new Pulse(df, ++df._clock, encode);
if (level >= Info) {
dt = Date.now();
df.debug('-- START PROPAGATION (' + df._clock + ') -----');
}
// initialize queue, reset touched operators
df._touched.forEach(function(op) { df._enqueue(op, true); });
df._touched = UniqueList(id);
try {
while (df._heap.size() > 0) {
op = df._heap.pop();
// re-queue if rank changes
if (op.rank !== op.qrank) { df._enqueue(op, true); continue; }
// otherwise, evaluate the operator
next = op.run(df._getPulse(op, encode));
if (level >= Debug) {
df.debug(op.id, next === StopPropagation ? 'STOP' : next, op);
}
// propagate the pulse
if (next !== StopPropagation) {
df._pulse = next;
if (op._targets) op._targets.forEach(function(op) { df._enqueue(op); });
}
// increment visit counter
++count;
}
} catch (err) {
df.error(err);
}
// reset pulse map
df._pulses = {};
df._pulse = null;
if (level >= Info) {
dt = Date.now() - dt;
df.info('> Pulse ' + df._clock + ': ' + count + ' operators; ' + dt + 'ms');
}
// invoke callbacks queued via runAfter
if (df._postrun.length) {
var postrun = df._postrun;
df._postrun = [];
postrun.forEach(function(f) {
try { f(df); } catch (err) { df.error(err); }
});
}
return count;
}
/**
* Runs the dataflow and returns a Promise that resolves when the
* propagation cycle completes. The standard run method may exit early
* if there are pending data loading operations. In contrast, this
* method returns a Promise to allow callers to receive notification
* when dataflow evaluation completes.
* @return {Promise} - A promise that resolves to this dataflow.
*/
function runAsync() {
return this._pending || Promise.resolve(this.run());
}
/**
* Schedules a callback function to be invoked after the current pulse
* propagation completes. If no propagation is currently occurring,
* the function is invoked immediately.
* @param {function(Dataflow)} callback - The callback function to run.
* The callback will be invoked with this Dataflow instance as its
* sole argument.
*/
function runAfter(callback) {
if (this._pulse) {
// pulse propagation is currently running, queue to run after
this._postrun.push(callback);
} else {
// pulse propagation already complete, invoke immediately
try { callback(this); } catch (err) { this.error(err); }
}
}
/**
* Enqueue an operator into the priority queue for evaluation. The operator
* will be enqueued if it has no registered pulse for the current cycle, or if
* the force argument is true. Upon enqueue, this method also sets the
* operator's qrank to the current rank value.
* @param {Operator} op - The operator to enqueue.
* @param {boolean} [force] - A flag indicating if the operator should be
* forceably added to the queue, even if it has already been previously
* enqueued during the current pulse propagation. This is useful when the
* dataflow graph is dynamically modified and the operator rank changes.
*/
function enqueue(op, force) {
var p = !this._pulses[op.id];
if (p) this._pulses[op.id] = this._pulse;
if (p || force) {
op.qrank = op.rank;
this._heap.push(op);
}
}
/**
* Provide a correct pulse for evaluating an operator. If the operator has an
* explicit source operator, we will try to pull the pulse(s) from it.
* If there is an array of source operators, we build a multi-pulse.
* Otherwise, we return a current pulse with correct source data.
* If the pulse is the pulse map has an explicit target set, we use that.
* Else if the pulse on the upstream source operator is current, we use that.
* Else we use the pulse from the pulse map, but copy the source tuple array.
* @param {Operator} op - The operator for which to get an input pulse.
* @param {string} [encode] - An (optional) encoding set name with which to
* annotate the returned pulse. See {@link run} for more information.
*/
function getPulse(op, encode) {
var s = op.source,
stamp = this._clock,
p;
if (s && isArray(s)) {
p = s.map(function(_) { return _.pulse; });
return new MultiPulse(this, stamp, p, encode);
} else {
s = s && s.pulse;
p = this._pulses[op.id];
if (s && s !== StopPropagation) {
if (s.stamp === stamp && p.target !== op) p = s;
else p.source = s.source;
}
return p;
}
}
function Heap(comparator) {
this.cmp = comparator;
this.nodes = [];
}
var prototype$16 = Heap.prototype;
prototype$16.size = function() {
return this.nodes.length;
};
prototype$16.clear = function() {
return (this.nodes = [], this);
};
prototype$16.peek = function() {
return this.nodes[0];
};
prototype$16.push = function(x) {
var array = this.nodes;
array.push(x);
return siftdown(array, 0, array.length-1, this.cmp);
};
prototype$16.pop = function() {
var array = this.nodes,
last = array.pop(),
item;
if (array.length) {
item = array[0];
array[0] = last;
siftup(array, 0, this.cmp);
} else {
item = last;
}
return item;
};
prototype$16.replace = function(item) {
var array = this.nodes,
retval = array[0];
array[0] = item;
siftup(array, 0, this.cmp);
return retval;
};
prototype$16.pushpop = function(item) {
var array = this.nodes, ref = array[0];
if (array.length && this.cmp(ref, item) < 0) {
array[0] = item;
item = ref;
siftup(array, 0, this.cmp);
}
return item;
};
function siftdown(array, start, idx, cmp) {
var item, parent, pidx;
item = array[idx];
while (idx > start) {
pidx = (idx - 1) >> 1;
parent = array[pidx];
if (cmp(item, parent) < 0) {
array[idx] = parent;
idx = pidx;
continue;
}
break;
}
return (array[idx] = item);
}
function siftup(array, idx, cmp) {
var start = idx,
end = array.length,
item = array[idx],
cidx = 2 * idx + 1, ridx;
while (cidx < end) {
ridx = cidx + 1;
if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) {
cidx = ridx;
}
array[idx] = array[cidx];
idx = cidx;
cidx = 2 * idx + 1;
}
array[idx] = item;
return siftdown(array, start, idx, cmp);
}
/**
* A dataflow graph for reactive processing of data streams.
* @constructor
*/
function Dataflow() {
this._log = logger();
this._clock = 0;
this._rank = 0;
this._loader = loader();
this._touched = UniqueList(id);
this._pulses = {};
this._pulse = null;
this._heap = new Heap(function(a, b) { return a.qrank - b.qrank; });
this._postrun = [];
}
var prototype$10 = Dataflow.prototype;
/**
* The current timestamp of this dataflow. This value reflects the
* timestamp of the previous dataflow run. The dataflow is initialized
* with a stamp value of 0. The initial run of the dataflow will have
* a timestap of 1, and so on. This value will match the
* {@link Pulse.stamp} property.
* @return {number} - The current timestamp value.
*/
prototype$10.stamp = function() {
return this._clock;
};
/**
* Gets or sets the loader instance to use for data file loading. A
* loader object must provide a "load" method for loading files and a
* "sanitize" method for checking URL/filename validity. Both methods
* should accept a URI and options hash as arguments, and return a Promise
* that resolves to the loaded file contents (load) or a hash containing
* sanitized URI data with the sanitized url assigned to the "href" property
* (sanitize).
* @param {object} _ - The loader instance to use.
* @return {object|Dataflow} - If no arguments are provided, returns
* the current loader instance. Otherwise returns this Dataflow instance.
*/
prototype$10.loader = function(_) {
return arguments.length ? (this._loader = _, this) : this._loader;
};
/**
* Empty entry threshold for garbage cleaning. Map data structures will
* perform cleaning once the number of empty entries exceeds this value.
*/
prototype$10.cleanThreshold = 1e4;
// OPERATOR REGISTRATION
prototype$10.add = add$1;
prototype$10.connect = connect;
prototype$10.rank = rank;
prototype$10.rerank = rerank;
// OPERATOR UPDATES
prototype$10.pulse = pulse;
prototype$10.touch = touch;
prototype$10.update = update;
prototype$10.changeset = changeset;
// DATA LOADING
prototype$10.ingest = ingest$1;
prototype$10.request = request$1;
// EVENT HANDLING
prototype$10.events = events;
prototype$10.on = on;
// PULSE PROPAGATION
prototype$10.run = run;
prototype$10.runAsync = runAsync;
prototype$10.runAfter = runAfter;
prototype$10._enqueue = enqueue;
prototype$10._getPulse = getPulse;
// LOGGING AND ERROR HANDLING
function logMethod(method) {
return function() {
return this._log[method].apply(this, arguments);
};
}
/**
* Logs a warning message. By default, logged messages are written to console
* output. The message will only be logged if the current log level is high
* enough to permit warning messages.
*/
prototype$10.warn = logMethod('warn');
/**
* Logs a information message. By default, logged messages are written to
* console output. The message will only be logged if the current log level is
* high enough to permit information messages.
*/
prototype$10.info = logMethod('info');
/**
* Logs a debug message. By default, logged messages are written to console
* output. The message will only be logged if the current log level is high
* enough to permit debug messages.
*/
prototype$10.debug = logMethod('debug');
/**
* Get or set the current log level. If an argument is provided, it
* will be used as the new log level.
* @param {number} [level] - Should be one of None, Warn, Info
* @return {number} - The current log level.
*/
prototype$10.logLevel = logMethod('level');
/**
* Handle an error. By default, this method re-throws the input error.
* This method can be overridden for custom error handling.
*/
prototype$10.error = function(err) {
throw err;
};
/**
* Abstract class for operators that process data tuples.
* Subclasses must provide a {@link transform} method for operator processing.
* @constructor
* @param {*} [init] - The initial value for this operator.
* @param {object} [params] - The parameters for this operator.
* @param {Operator} [source] - The operator from which to receive pulses.
*/
function Transform(init, params) {
Operator.call(this, init, null, params);
}
var prototype$17 = inherits(Transform, Operator);
/**
* Overrides {@link Operator.evaluate} for transform operators.
* Marshalls parameter values and then invokes {@link transform}.
* @param {Pulse} pulse - the current dataflow pulse.
* @return {Pulse} The output pulse (or StopPropagation). A falsy return
value (including undefined) will let the input pulse pass through.
*/
prototype$17.evaluate = function(pulse) {
var params = this.marshall(pulse.stamp),
out = this.transform(params, pulse);
params.clear();
return out;
};
/**
* Process incoming pulses.
* Subclasses should override this method to implement transforms.
* @param {Parameters} _ - The operator parameter values.
* @param {Pulse} pulse - The current dataflow pulse.
* @return {Pulse} The output pulse (or StopPropagation). A falsy return
* value (including undefined) will let the input pulse pass through.
*/
prototype$17.transform = function() {};
var transforms = {};
var definitions = {};
function register(def, constructor) {
var type = def.type;
definition(type, def);
transform(type, constructor);
}
function definition(type, def) {
type = type && type.toLowerCase();
return arguments.length > 1 ? (definitions[type] = def, this)
: definitions.hasOwnProperty(type) ? definitions[type] : null;
}
function transform(type, constructor) {
return arguments.length > 1 ? (transforms[type] = constructor, this)
: transforms.hasOwnProperty(type) ? transforms[type] : null;
}
function TupleStore(key) {
this._key = key || '_id';
this._add = [];
this._rem = [];
this._ext = null;
this._get = null;
this._q = null;
}
var prototype$19 = TupleStore.prototype;
prototype$19.add = function(v) {
this._add.push(v);
};
prototype$19.rem = function(v) {
this._rem.push(v);
};
prototype$19.values = function() {
this._get = null;
if (this._rem.length === 0) return this._add;
var a = this._add,
r = this._rem,
k = this._key,
n = a.length,
m = r.length,
x = Array(n - m),
map = {}, i, j, v;
// use unique key field to clear removed values
for (i=0; i<m; ++i) {
map[r[i][k]] = 1;
}
for (i=0, j=0; i<n; ++i) {
if (map[(v = a[i])[k]]) {
map[v[k]] = 0;
} else {
x[j++] = v;
}
}
this._rem = [];
return (this._add = x);
};
// memoizing statistics methods
prototype$19.distinct = function(get) {
var v = this.values(),
n = v.length,
map = {},
count = 0, s;
while (--n >= 0) {
s = get(v[n]) + '';
if (!map.hasOwnProperty(s)) {
map[s] = 1;
++count;
}
}
return count;
};
prototype$19.extent = function(get) {
if (this._get !== get || !this._ext) {
var v = this.values(),
i = extentIndex(v, get);
this._ext = [v[i[0]], v[i[1]]];
this._get = get;
}
return this._ext;
};
prototype$19.argmin = function(get) {
return this.extent(get)[0] || {};
};
prototype$19.argmax = function(get) {
return this.extent(get)[1] || {};
};
prototype$19.min = function(get) {
var m = this.extent(get)[0];
return m != null ? get(m) : +Infinity;
};
prototype$19.max = function(get) {
var m = this.extent(get)[1];
return m != null ? get(m) : -Infinity;
};
prototype$19.quartile = function(get) {
if (this._get !== get || !this._q) {
this._q = quartiles(this.values(), get);
this._get = get;
}
return this._q;
};
prototype$19.q1 = function(get) {
return this.quartile(get)[0];
};
prototype$19.q2 = function(get) {
return this.quartile(get)[1];
};
prototype$19.q3 = function(get) {
return this.quartile(get)[2];
};
prototype$19.ci = function(get) {
if (this._get !== get || !this._ci) {
this._ci = bootstrapCI(this.values(), 1000, 0.05, get);
this._get = get;
}
return this._ci;
};
prototype$19.ci0 = function(get) {
return this.ci(get)[0];
};
prototype$19.ci1 = function(get) {
return this.ci(get)[1];
};
var Aggregates = {
'values': measure$1({
name: 'values',
init: 'cell.store = true;',
set: 'cell.data.values()', idx: -1
}),
'count': measure$1({
name: 'count',
set: 'cell.num'
}),
'missing': measure$1({
name: 'missing',
set: 'this.missing'
}),
'valid': measure$1({
name: 'valid',
set: 'this.valid'
}),
'sum': measure$1({
name: 'sum',
init: 'this.sum = 0;',
add: 'this.sum += v;',
rem: 'this.sum -= v;',
set: 'this.sum'
}),
'mean': measure$1({
name: 'mean',
init: 'this.mean = 0;',
add: 'var d = v - this.mean; this.mean += d / this.valid;',
rem: 'var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;',
set: 'this.mean'
}),
'average': measure$1({
name: 'average',
set: 'this.mean',
req: ['mean'], idx: 1
}),
'variance': measure$1({
name: 'variance',
init: 'this.dev = 0;',
add: 'this.dev += d * (v - this.mean);',
rem: 'this.dev -= d * (v - this.mean);',
set: 'this.valid > 1 ? this.dev / (this.valid-1) : 0',
req: ['mean'], idx: 1
}),
'variancep': measure$1({
name: 'variancep',
set: 'this.valid > 1 ? this.dev / this.valid : 0',
req: ['variance'], idx: 2
}),
'stdev': measure$1({
name: 'stdev',
set: 'this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0',
req: ['variance'], idx: 2
}),
'stdevp': measure$1({
name: 'stdevp',
set: 'this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0',
req: ['variance'], idx: 2
}),
'stderr': measure$1({
name: 'stderr',
set: 'this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : 0',
req: ['variance'], idx: 2
}),
'distinct': measure$1({
name: 'distinct',
set: 'cell.data.distinct(this.get)',
req: ['values'], idx: 3
}),
'ci0': measure$1({
name: 'ci0',
set: 'cell.data.ci0(this.get)',
req: ['values'], idx: 3
}),
'ci1': measure$1({
name: 'ci1',
set: 'cell.data.ci1(this.get)',
req: ['values'], idx: 3
}),
'median': measure$1({
name: 'median',
set: 'cell.data.q2(this.get)',
req: ['values'], idx: 3
}),
'q1': measure$1({
name: 'q1',
set: 'cell.data.q1(this.get)',
req: ['values'], idx: 3
}),
'q3': measure$1({
name: 'q3',
set: 'cell.data.q3(this.get)',
req: ['values'], idx: 3
}),
'argmin': measure$1({
name: 'argmin',
add: 'if (v < this.min) this.argmin = t;',
rem: 'if (v <= this.min) this.argmin = null;',
set: 'this.argmin || cell.data.argmin(this.get)',
req: ['min'], str: ['values'], idx: 3
}),
'argmax': measure$1({
name: 'argmax',
add: 'if (v > this.max) this.argmax = t;',
rem: 'if (v >= this.max) this.argmax = null;',
set: 'this.argmax || cell.data.argmax(this.get)',
req: ['max'], str: ['values'], idx: 3
}),
'min': measure$1({
name: 'min',
init: 'this.min = null;',
add: 'if (v < this.min || this.min === null) this.min = v;',
rem: 'if (v <= this.min) this.min = NaN;',
set: 'this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)',
str: ['values'], idx: 4
}),
'max': measure$1({
name: 'max',
init: 'this.max = null;',
add: 'if (v > this.max || this.max === null) this.max = v;',
rem: 'if (v >= this.max) this.max = NaN;',
set: 'this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)',
str: ['values'], idx: 4
})
};
function createMeasure(op, name) {
return Aggregates[op](name);
}
function measure$1(base) {
return function(out) {
var m = extend({init:'', add:'', rem:'', idx:0}, base);
m.out = out || base.name;
return m;
};
}
function compareIndex(a, b) {
return a.idx - b.idx;
}
function resolve(agg, stream) {
function collect(m, a) {
function helper(r) { if (!m[r]) collect(m, m[r] = Aggregates[r]()); }
if (a.req) a.req.forEach(helper);
if (stream && a.str) a.str.forEach(helper);
return m;
}
var map = agg.reduce(
collect,
agg.reduce(function(m, a) { return (m[a.name] = a, m); }, {})
);
var values = [], key;
for (key in map) values.push(map[key]);
return values.sort(compareIndex);
}
function compileMeasures(agg, field) {
var get = field || identity$1,
all = resolve(agg, true), // assume streaming removes may occur
ctr = 'this.cell = cell; this.tuple = t; this.valid = 0; this.missing = 0;',
add = 'if(v==null){++this.missing; return;} if(v!==v) return; ++this.valid;',
rem = 'if(v==null){--this.missing; return;} if(v!==v) return; --this.valid;',
set = 'var t = this.tuple; var cell = this.cell;';
all.forEach(function(a) {
if (a.idx < 0) {
ctr = a.init + ctr;
add = a.add + add;
rem = a.rem + rem;
} else {
ctr += a.init;
add += a.add;
rem += a.rem;
}
});
agg.slice().sort(compareIndex).forEach(function(a) {
set += 't[\'' + a.out + '\']=' + a.set + ';';
});
set += 'return t;';
ctr = Function('cell', 't', ctr);
ctr.prototype.add = Function('v', 't', add);
ctr.prototype.rem = Function('v', 't', rem);
ctr.prototype.set = Function(set);
ctr.prototype.get = get;
ctr.fields = agg.map(function(_) { return _.out; });
return ctr;
}
/**
* Group-by aggregation operator.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {Array<function(object): *>} params.groupby - An array of accessors to groupby.
* @param {Array<function(object): *>} params.fields - An array of accessors to aggregate.
* @param {Array<string>} params.ops - An array of strings indicating aggregation operations.
* @param {Array<string>} [params.as] - An array of output field names for aggregated values.
* @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed.
*/
function Aggregate(params) {
Transform.call(this, null, params);
this._adds = []; // array of added output tuples
this._mods = []; // array of modified output tuples
this._alen = 0; // number of active added tuples
this._mlen = 0; // number of active modified tuples
this._drop = true; // should empty aggregation cells be removed
this._dims = []; // group-by dimension accessors
this._dnames = []; // group-by dimension names
this._measures = []; // collection of aggregation monoids
this._countOnly = false; // flag indicating only count aggregation
this._counts = null; // collection of count fields
this._prev = null; // previous aggregation cells
this._inputs = null; // array of dependent input tuple field names
this._outputs = null; // array of output tuple field names
}
var prototype$18 = inherits(Aggregate, Transform);
prototype$18.transform = function(_, pulse) {
var aggr = this,
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
mod;
this.stamp = out.stamp;
if (this.value && ((mod = _.modified()) || pulse.modified(this._inputs))) {
this._prev = this.value;
this.value = mod ? this.init(_) : {};
pulse.visit(pulse.SOURCE, function(t) { aggr.add(t); });
} else {
this.value = this.value || this.init(_);
pulse.visit(pulse.REM, function(t) { aggr.rem(t); });
pulse.visit(pulse.ADD, function(t) { aggr.add(t); });
}
// Indicate output fields and return aggregate tuples.
out.modifies(this._outputs);
aggr._drop = _.drop !== false;
return aggr.changes(out);
};
prototype$18.init = function(_) {
// initialize input and output fields
var inputs = (this._inputs = []),
outputs = (this._outputs = []),
inputMap = {};
function inputVisit(get) {
var fields = get.fields, i = 0, n = fields.length, f;
for (; i<n; ++i) {
if (!inputMap[f=fields[i]]) {
inputMap[f] = 1;
inputs.push(f);
}
}
}
// initialize group-by dimensions
this._dims = array$1(_.groupby);
this._dnames = this._dims.map(function(d) {
var dname = accessorName(d)
return (inputVisit(d), outputs.push(dname), dname);
});
this.cellkey = _.key ? _.key
: this._dims.length === 0 ? function() { return ''; }
: this._dims.length === 1 ? this._dims[0]
: cellkey;
// initialize aggregate measures
this._countOnly = true;
this._counts = [];
this._measures = [];
var fields = _.fields || [null],
ops = _.ops || ['count'],
as = _.as || [],
n = fields.length,
map = {},
field, op, m, mname, outname, i;
if (n !== ops.length) {
error('Unmatched number of fields and aggregate ops.');
}
for (i=0; i<n; ++i) {
field = fields[i];
op = ops[i];
if (field == null && op !== 'count') {
error('Null aggregate field specified.');
}
mname = accessorName(field);
outname = measureName(op, mname, as[i]);
outputs.push(outname);
if (op === 'count') {
this._counts.push(outname);
continue;
}
m = map[mname];
if (!m) {
inputVisit(field);
m = (map[mname] = []);
m.field = field;
this._measures.push(m);
}
if (op !== 'count') this._countOnly = false;
m.push(createMeasure(op, outname));
}
this._measures = this._measures.map(function(m) {
return compileMeasures(m, m.field);
});
return {}; // aggregation cells (this.value)
};
function measureName(op, mname, as) {
return as || (op + (!mname ? '' : '_' + mname));
}
// -- Cell Management -----
function cellkey(x) {
var d = this._dims,
n = d.length, i,
k = String(d[0](x));
for (i=1; i<n; ++i) {
k += '|' + d[i](x);
}
return k;
}
prototype$18.cellkey = cellkey;
prototype$18.cell = function(key, t) {
var cell = this.value[key];
if (!cell) {
cell = this.value[key] = this.newcell(key, t);
this._adds[this._alen++] = cell;
} else if (cell.num === 0 && this._drop && cell.stamp < this.stamp) {
cell.stamp = this.stamp;
this._adds[this._alen++] = cell;
} else if (cell.stamp < this.stamp) {
cell.stamp = this.stamp;
this._mods[this._mlen++] = cell;
}
return cell;
};
prototype$18.newcell = function(key, t) {
var cell = {
key: key,
num: 0,
agg: null,
tuple: this.newtuple(t, this._prev && this._prev[key]),
stamp: this.stamp,
store: false
};
if (!this._countOnly) {
var measures = this._measures,
n = measures.length, i;
cell.agg = Array(n);
for (i=0; i<n; ++i) {
cell.agg[i] = new measures[i](cell, cell.tuple);
}
}
if (cell.store) {
cell.data = new TupleStore();
}
return cell;
};
prototype$18.newtuple = function(t, p) {
var names = this._dnames,
dims = this._dims,
x = {}, i, n;
for (i=0, n=dims.length; i<n; ++i) {
x[names[i]] = dims[i](t);
}
return p ? replace(p.tuple, x) : ingest(x);
};
// -- Process Tuples -----
prototype$18.add = function(t) {
var key = this.cellkey(t),
cell = this.cell(key, t),
agg, i, n;
cell.num += 1;
if (this._countOnly) return;
if (cell.store) cell.data.add(t);
agg = cell.agg;
for (i=0, n=agg.length; i<n; ++i) {
agg[i].add(agg[i].get(t), t);
}
};
prototype$18.rem = function(t) {
var key = this.cellkey(t),
cell = this.cell(key, t),
agg, i, n;
cell.num -= 1;
if (this._countOnly) return;
if (cell.store) cell.data.rem(t);
agg = cell.agg;
for (i=0, n=agg.length; i<n; ++i) {
agg[i].rem(agg[i].get(t), t);
}
};
prototype$18.celltuple = function(cell) {
var tuple = cell.tuple,
counts = this._counts,
agg, i, n;
// consolidate stored values
if (cell.store) {
cell.data.values();
}
// update tuple properties
for (i=0, n=counts.length; i<n; ++i) {
tuple[counts[i]] = cell.num;
}
if (!this._countOnly) {
agg = cell.agg;
for (i=0, n=agg.length; i<n; ++i) {
agg[i].set();
}
}
return tuple;
};
prototype$18.changes = function(out) {
var adds = this._adds,
mods = this._mods,
prev = this._prev,
drop = this._drop,
add = out.add,
rem = out.rem,
mod = out.mod,
cell, key, i, n;
if (prev) for (key in prev) {
rem.push(prev[key].tuple);
}
for (i=0, n=this._alen; i<n; ++i) {
add.push(this.celltuple(adds[i]));
adds[i] = null; // for garbage collection
}
for (i=0, n=this._mlen; i<n; ++i) {
cell = mods[i];
(cell.num === 0 && drop ? rem : mod).push(this.celltuple(cell));
mods[i] = null; // for garbage collection
}
this._alen = this._mlen = 0; // reset list of active cells
this._prev = null;
return out;
};
/**
* Generates a binning function for discretizing data.
* @constructor
* @param {object} params - The parameters for this operator. The
* provided values should be valid options for the {@link bin} function.
* @param {function(object): *} params.field - The data field to bin.
*/
function Bin(params) {
Transform.call(this, null, params);
}
var prototype$20 = inherits(Bin, Transform);
prototype$20.transform = function(_, pulse) {
var bins = this._bins(_),
step = bins.step,
as = _.as || ['bin0', 'bin1'],
b0 = as[0],
b1 = as[1],
flag = _.modified() ? (pulse = pulse.reflow(true), pulse.SOURCE)
: pulse.modified(accessorFields(_.field)) ? pulse.ADD_MOD
: pulse.ADD;
pulse.visit(flag, function(t) {
var v = bins(t);
t[b0] = v;
t[b1] = v != null ? v + step : null;
});
return pulse.modifies(as);
};
prototype$20._bins = function(_) {
if (this.value && !_.modified()) {
return this.value;
}
var field = _.field,
bins = bin$1(_),
start = bins.start,
stop = bins.stop,
step = bins.step;
var f = function(t) {
var v = field(t);
return v == null ? null
: start + step * Math.floor((+v - start) / step);
};
f.start = start;
f.stop = stop;
f.step = step;
return this.value = accessor(
f,
accessorFields(field),
_.name || 'bin_' + accessorName(field)
);
};
/**
* Collects all data tuples that pass through this operator.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(*,*): number} [params.sort] - An optional
* comparator function for additionally sorting the collected tuples.
*/
function Collect(params) {
Transform.call(this, [], params);
}
var prototype$21 = inherits(Collect, Transform);
prototype$21.transform = function(_, pulse) {
var out = pulse.fork(pulse.ALL),
add = pulse.changed(pulse.ADD),
mod = pulse.changed(),
sort = _.sort,
data = this.value,
push = function(t) { data.push(t); },
n = 0, map;
if (out.rem.length) { // build id map and filter data array
map = {};
out.visit(out.REM, function(t) { map[t._id] = 1; ++n; });
data = data.filter(function(t) { return !map[t._id]; });
}
if (sort) {
// if sort criteria change, re-sort the full data array
if (_.modified('sort') || pulse.modified(sort.fields)) {
data.sort(sort);
mod = true;
}
// if added tuples, sort them in place and then merge
if (add) {
data = merge$1(sort, data, out.add.sort(sort));
}
} else if (add) {
// no sort, so simply add new tuples
out.visit(out.ADD, push);
}
this.modified(mod);
this.value = out.source = data;
return out;
};
/**
* Generates a comparator function.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {Array<string>} params.fields - The fields to compare.
* @param {Array<string>} [params.orders] - The sort orders.
* Each entry should be one of "ascending" (default) or "descending".
*/
function Compare(params) {
Operator.call(this, null, update$1, params);
}
inherits(Compare, Operator);
function update$1(_) {
return (this.value && !_.modified())
? this.value
: compare(_.fields, _.orders);
}
/**
* Count regexp-defined pattern occurrences in a text field.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - An accessor for the text field.
* @param {string} [params.pattern] - RegExp string defining the text pattern.
* @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case.
* @param {string} [params.stopwords] - RegExp string of words to ignore.
*/
function CountPattern(params) {
Transform.call(this, null, params);
}
function tokenize(text, tcase, match) {
switch (tcase) {
case 'upper': text = text.toUpperCase(); break;
case 'lower': text = text.toLowerCase(); break;
}
return text.match(match);
}
var prototype$22 = inherits(CountPattern, Transform);
prototype$22.transform = function(_, pulse) {
function process(update) {
return function(tuple) {
var tokens = tokenize(get(tuple), _.case, match) || [], t;
for (var i=0, n=tokens.length; i<n; ++i) {
if (!stop.test(t = tokens[i])) update(t);
}
};
}
var init = this._parameterCheck(_, pulse),
counts = this._counts,
match = this._match,
stop = this._stop,
get = _.field,
as = _.as || ['text', 'count'],
add = process(function(t) { counts[t] = 1 + (counts[t] || 0); }),
rem = process(function(t) { counts[t] -= 1; });
if (init) {
pulse.visit(pulse.SOURCE, add);
} else {
pulse.visit(pulse.ADD, add);
pulse.visit(pulse.REM, rem);
}
return this._finish(pulse, as); // generate output tuples
};
prototype$22._parameterCheck = function(_, pulse) {
var init = false;
if (_.modified('stopwords') || !this._stop) {
this._stop = new RegExp('^' + (_.stopwords || '') + '$', 'i');
init = true;
}
if (_.modified('pattern') || !this._match) {
this._match = new RegExp((_.pattern || '[\\w\']+'), 'g');
init = true;
}
if (_.modified('field') || pulse.modified(_.field.fields)) {
init = true;
}
if (init) this._counts = {};
return init;
}
prototype$22._finish = function(pulse, as) {
var counts = this._counts,
tuples = this._tuples || (this._tuples = {}),
text = as[0],
count = as[1],
out = pulse.fork(),
w, t, c;
for (w in counts) {
t = tuples[w];
c = counts[w] || 0;
if (!t && c) {
tuples[w] = (t = ingest({}));
t[text] = w;
t[count] = c;
out.add.push(t);
} else if (c === 0) {
if (t) out.rem.push(t);
counts[w] = null;
tuples[w] = null;
} else if (t[count] !== c) {
t[count] = c;
out.mod.push(t);
}
}
return out.modifies(as);
};
/**
* Perform a cross-product of a tuple stream with itself.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object):boolean} [params.filter] - An optional filter
* function for selectively including tuples in the cross product.
* @param {Array<string>} [params.as] - The names of the output fields.
*/
function Cross(params) {
Transform.call(this, null, params);
}
var prototype$23 = inherits(Cross, Transform);
prototype$23.transform = function(_, pulse) {
var out = pulse.fork(pulse.NO_SOURCE),
data = this.value,
as = _.as || ['a', 'b'],
a = as[0], b = as[1],
reset = !data
|| pulse.changed(pulse.ADD_REM)
|| _.modified('as')
|| _.modified('filter');
if (reset) {
if (data) out.rem = data;
out.add = this.value = cross$2(pulse.source, a, b, _.filter || truthy);
} else {
out.mod = data;
}
return out.source = this.value, out.modifies(as);
};
function cross$2(input, a, b, filter) {
var data = [],
t = {},
n = input.length,
i = 0,
j, left;
for (; i<n; ++i) {
t[a] = left = input[i];
for (j=0; j<n; ++j) {
t[b] = input[j];
if (filter(t)) {
data.push(ingest(t));
t = {};
t[a] = left;
}
}
}
return data;
}
var Distributions = {
kde: randomKDE,
mixture: randomMixture,
normal: randomNormal,
uniform: randomUniform
};
var DISTRIBUTIONS = 'distributions';
var FUNCTION = 'function';
var FIELD = 'field';
/**
* Parse a parameter object for a probability distribution.
* @param {object} def - The distribution parameter object.
* @param {function():Array<object>} - A method for requesting
* source data. Used for distributions (such as KDE) that
* require sample data points. This method will only be
* invoked if the 'from' parameter for a target data source
* is not provided. Typically this method returns backing
* source data for a Pulse object.
* @return {object} - The output distribution object.
*/
function parse$1(def, data) {
var func = def[FUNCTION];
if (!Distributions.hasOwnProperty(func)) {
error('Unknown distribution function: ' + func);
}
var d = Distributions[func]();
for (var name in def) {
// if data field, extract values
if (name === FIELD) {
d.data((def.from || data()).map(def[name]));
}
// if distribution mixture, recurse to parse each definition
else if (name === DISTRIBUTIONS) {
d[name](def[name].map(function(_) { return parse$1(_, data); }));
}
// otherwise, simply set the parameter
else if (typeof d[name] === FUNCTION) {
d[name](def[name]);
}
}
return d;
}
/**
* Grid sample points for a probability density. Given a distribution and
* a sampling extent, will generate points suitable for plotting either
* PDF (probability density function) or CDF (cumulative distribution
* function) curves.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {object} params.distribution - The probability distribution. This
* is an object parameter dependent on the distribution type.
* @param {string} [params.method='pdf'] - The distribution method to sample.
* One of 'pdf' or 'cdf'.
* @param {Array<number>} [params.extent] - The [min, max] extent over which
* to sample the distribution. This argument is required in most cases, but
* can be omitted if the distribution (e.g., 'kde') supports a 'data' method
* that returns numerical sample points from which the extent can be deduced.
* @param {number} [params.steps=100] - The number of sampling steps.
*/
function Density(params) {
Transform.call(this, null, params);
}
var prototype$24 = inherits(Density, Transform);
prototype$24.transform = function(_, pulse) {
var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
if (!this.value || pulse.changed() || _.modified()) {
var dist = parse$1(_.distribution, source(pulse)),
method = _.method || 'pdf';
if (method !== 'pdf' && method !== 'cdf') {
error('Invalid density method: ' + method);
}
if (!_.extent && !dist.data) {
error('Missing density extent parameter.');
}
method = dist[method];
var as = _.as || ['value', 'density'],
domain = _.extent || extent(dist.data()),
step = (domain[1] - domain[0]) / (_.steps || 100),
values = sequence(domain[0], domain[1] + step/2, step)
.map(function(v) {
var tuple = {};
tuple[as[0]] = v;
tuple[as[1]] = method(v);
return ingest(tuple);
});
if (this.value) out.rem = this.value;
this.value = out.add = out.source = values;
}
return out;
};
function source(pulse) {
return function() { return pulse.materialize(pulse.SOURCE).source; };
}
/**
* Computes extents (min/max) for a data field.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The field over which to compute extends.
*/
function Extent(params) {
Transform.call(this, [+Infinity, -Infinity], params);
}
var prototype$25 = inherits(Extent, Transform);
prototype$25.transform = function(_, pulse) {
var extent = this.value,
field = _.field,
min = extent[0],
max = extent[1],
flag = pulse.ADD,
mod;
mod = pulse.changed()
|| pulse.modified(field.fields)
|| _.modified('field');
if (mod) {
flag = pulse.SOURCE;
min = +Infinity;
max = -Infinity;
}
pulse.visit(flag, function(t) {
var v = field(t);
if (v < min) min = v;
if (v > max) max = v;
});
this.value = [min, max];
};
/**
* Provides a bridge between a parent transform and a target subflow that
* consumes only a subset of the tuples that pass through the parent.
* @constructor
* @param {Pulse} pulse - A pulse to use as the value of this operator.
* @param {Transform} parent - The parent transform (typically a Facet instance).
* @param {Transform} target - A transform that receives the subflow of tuples.
*/
function Subflow(pulse, parent) {
Operator.call(this, pulse);
this.parent = parent;
}
var prototype$27 = inherits(Subflow, Operator);
prototype$27.connect = function(target) {
this.targets().add(target);
return (target.source = this);
};
/**
* Add an 'add' tuple to the subflow pulse.
* @param {Tuple} t - The tuple being added.
*/
prototype$27.add = function(t) {
this.value.add.push(t);
};
/**
* Add a 'rem' tuple to the subflow pulse.
* @param {Tuple} t - The tuple being removed.
*/
prototype$27.rem = function(t) {
this.value.rem.push(t);
};
/**
* Add a 'mod' tuple to the subflow pulse.
* @param {Tuple} t - The tuple being modified.
*/
prototype$27.mod = function(t) {
this.value.mod.push(t);
};
/**
* Re-initialize this operator's pulse value.
* @param {Pulse} pulse - The pulse to copy from.
* @see Pulse.init
*/
prototype$27.init = function(pulse) {
this.value.init(pulse, pulse.NO_SOURCE);
};
/**
* Evaluate this operator. This method overrides the
* default behavior to simply return the contained pulse value.
* @return {Pulse}
*/
prototype$27.evaluate = function() {
// assert: this.value.stamp === pulse.stamp
return this.value;
};
/**
* Facets a dataflow into a set of subflows based on a key.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(Dataflow, string): Operator} params.subflow - A function
* that generates a subflow of operators and returns its root operator.
* @param {function(object): *} params.key - The key field to facet by.
*/
function Facet(params) {
Transform.call(this, {}, params);
this._keys = fastmap(); // cache previously calculated key values
this._count = 0; // count of subflows
// keep track of active subflows, use as targets array for listeners
// this allows us to limit propagation to only updated subflows
var a = this._targets = [];
a.active = 0;
a.forEach = function(f) {
for (var i=0, n=a.active; i<n; ++i) f(a[i], i, a);
};
}
var prototype$26 = inherits(Facet, Transform);
prototype$26.activate = function(flow) {
this._targets[this._targets.active++] = flow;
};
prototype$26.subflow = function(key, flow, pulse, parent) {
var flows = this.value,
sf = flows.hasOwnProperty(key) && flows[key],
df, p;
if (!sf) {
p = parent || (p = this._group[key]) && p.tuple;
df = pulse.dataflow;
sf = df.add(new Subflow(pulse.fork(pulse.NO_SOURCE), this))
.connect(flow(df, key, this._count++, p));
flows[key] = sf;
this.activate(sf);
} else if (sf.value.stamp < pulse.stamp) {
sf.init(pulse);
this.activate(sf);
}
return sf;
};
prototype$26.transform = function(_, pulse) {
var df = pulse.dataflow,
self = this,
key = _.key,
flow = _.subflow,
cache = this._keys,
rekey = _.modified('key');
function subflow(key) {
return self.subflow(key, flow, pulse);
}
this._group = _.group || {};
this._targets.active = 0; // reset list of active subflows
pulse.visit(pulse.ADD, function(t) {
var k = key(t);
cache.set(t._id, k);
subflow(k).add(t);
});
pulse.visit(pulse.REM, function(t) {
var k = cache.get(t._id);
cache.delete(t._id);
subflow(k).rem(t);
});
if (rekey || pulse.modified(key.fields)) {
pulse.visit(pulse.MOD, function(t) {
var k0 = cache.get(t._id),
k1 = key(t);
if (k0 === k1) {
subflow(k1).mod(t);
} else {
cache.set(t._id, k1);
subflow(k0).rem(t);
subflow(k1).add(t);
}
});
} else if (pulse.changed(pulse.MOD)) {
pulse.visit(pulse.MOD, function(t) {
subflow(cache.get(t._id)).mod(t);
});
}
if (rekey) {
pulse.visit(pulse.REFLOW, function(t) {
var k0 = cache.get(t._id),
k1 = key(t);
if (k0 !== k1) {
cache.set(t._id, k1);
subflow(k0).rem(t);
subflow(k1).add(t);
}
});
}
if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean);
return pulse;
};
/**
* Generates one or more field accessor functions.
* If the 'name' parameter is an array, an array of field accessors
* will be created and the 'as' parameter will be ignored.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {string} params.name - The field name(s) to access.
* @param {string} params.as - The accessor function name.
*/
function Field(params) {
Operator.call(this, null, update$2, params);
}
inherits(Field, Operator);
function update$2(_) {
return (this.value && !_.modified()) ? this.value
: isArray(_.name) ? array$1(_.name).map(function(f) { return field(f); })
: field(_.name, _.as);
}
/**
* Filters data tuples according to a predicate function.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.expr - The predicate expression function
* that determines a tuple's filter status. Truthy values pass the filter.
*/
function Filter(params) {
Transform.call(this, fastmap(), params);
}
var prototype$28 = inherits(Filter, Transform);
prototype$28.transform = function(_, pulse) {
var df = pulse.dataflow,
cache = this.value, // cache ids of filtered tuples
output = pulse.fork(),
add = output.add,
rem = output.rem,
mod = output.mod,
test = _.expr,
isMod = true;
pulse.visit(pulse.REM, function(t) {
if (!cache.has(t._id)) rem.push(t);
else cache.delete(t._id);
});
pulse.visit(pulse.ADD, function(t) {
if (test(t, _)) add.push(t);
else cache.set(t._id, 1);
});
function revisit(t) {
var b = test(t, _),
s = cache.get(t._id);
if (b && s) {
cache.delete(t._id);
add.push(t);
} else if (!b && !s) {
cache.set(t._id, 1);
rem.push(t);
} else if (isMod && b && !s) {
mod.push(t);
}
}
pulse.visit(pulse.MOD, revisit);
if (_.modified()) {
isMod = false;
pulse.visit(pulse.REFLOW, revisit);
}
if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean);
return output;
};
/**
* Folds one more tuple fields into multiple tuples in which the field
* name and values are available under new 'key' and 'value' fields.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.fields - An array of field accessors
* for the tuple fields that should be folded.
*/
function Fold(params) {
Transform.call(this, {}, params);
}
var prototype$29 = inherits(Fold, Transform);
function keyFunction(f) {
return f.fields.join('|');
}
prototype$29.transform = function(_, pulse) {
var cache = this.value,
reset = _.modified('fields'),
fields = _.fields,
as = _.as || ['key', 'value'],
key = as[0],
value = as[1],
keys = fields.map(keyFunction),
n = fields.length,
stamp = pulse.stamp,
out = pulse.fork(pulse.NO_SOURCE),
i = 0, mask = 0, id;
function add(t) {
var f = (cache[t._id] = Array(n)); // create cache of folded tuples
for (var i=0, ft; i<n; ++i) { // for each key, derive folds
ft = (f[i] = derive(t));
ft[key] = keys[i];
ft[value] = fields[i](t);
out.add.push(ft);
}
}
function mod(t) {
var f = cache[t._id]; // get cache of folded tuples
for (var i=0, ft; i<n; ++i) { // for each key, rederive folds
if (!(mask & (1 << i))) continue; // field is unchanged
ft = rederive(t, f[i], stamp);
ft[key] = keys[i];
ft[value] = fields[i](t);
out.mod.push(ft);
}
}
if (reset) {
// on reset, remove all folded tuples and clear cache
for (id in cache) out.rem.push.apply(out.rem, cache[id]);
cache = this.value = {};
pulse.visit(pulse.SOURCE, add);
} else {
pulse.visit(pulse.ADD, add);
for (; i<n; ++i) {
if (pulse.modified(fields[i].fields)) mask |= (1 << i);
}
if (mask) pulse.visit(pulse.MOD, mod);
pulse.visit(pulse.REM, function(t) {
out.rem.push.apply(out.rem, cache[t._id]);
cache[t._id] = null;
});
}
return out.modifies(as);
};
/**
* Invokes a function for each data tuple and saves the results as a new field.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.expr - The formula function to invoke for each tuple.
* @param {string} params.as - The field name under which to save the result.
* @param {boolean} [params.initonly=false] - If true, the formula is applied to
* added tuples only, and does not update in response to modifications.
*/
function Formula(params) {
Transform.call(this, null, params);
}
var prototype$30 = inherits(Formula, Transform);
prototype$30.transform = function(_, pulse) {
var func = _.expr,
as = _.as,
mod = _.modified(),
flag = _.initonly ? pulse.ADD
: mod ? pulse.SOURCE
: pulse.modified(func.fields) ? pulse.ADD_MOD
: pulse.ADD;
function set(t) {
t[as] = func(t, _);
}
if (mod) {
// parameters updated, need to reflow
pulse = pulse.materialize().reflow(true);
}
return pulse.visit(flag, set).modifies(as);
};
/**
* Generates data tuples using a provided generator function.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(Parameters): object} params.generator - A tuple generator
* function. This function is given the operator parameters as input.
* Changes to any additional parameters will not trigger re-calculation
* of previously generated tuples. Only future tuples are affected.
* @param {number} params.size - The number of tuples to produce.
*/
function Generate(params) {
Transform.call(this, [], params);
}
var prototype$31 = inherits(Generate, Transform);
prototype$31.transform = function(_, pulse) {
var data = this.value,
out = pulse.fork(pulse.ALL),
num = _.size - data.length,
gen = _.generator,
add, rem, t;
if (num > 0) {
// need more tuples, generate and add
for (add=[]; --num >= 0;) {
add.push(t = ingest(gen(_)));
data.push(t);
}
out.add = out.add.length
? out.materialize(out.ADD).add.concat(add)
: add;
} else {
// need fewer tuples, remove
rem = data.slice(0, -num);
out.rem = out.rem.length
? out.materialize(out.REM).rem.concat(rem)
: rem;
data = data.slice(-num);
}
out.source = this.value = data;
return out;
};
var Methods = {
value: 'value',
median: median,
mean: mean,
min: min,
max: max
};
var Empty$1 = [];
/**
* Impute missing values.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The value field to impute.
* @param {Array<function(object): *>} [params.groupby] - An array of
* accessors to determine series within which to perform imputation.
* @param {Array<function(object): *>} [params.orderby] - An array of
* accessors to determine the ordering within a series.
* @param {string} [method='value'] - The imputation method to use. One of
* 'value', 'mean', 'median', 'max', 'min'.
* @param {*} [value=0] - The constant value to use for imputation
* when using method 'value'.
*/
function Impute(params) {
Transform.call(this, [], params);
}
var prototype$32 = inherits(Impute, Transform);
function getValue(_) {
var m = _.method || Methods.value, v;
if (Methods[m] == null) {
error('Unrecognized imputation method: ' + m);
} else if (m === Methods.value) {
v = _.value !== undefined ? _.value : 0;
return function() { return v; };
} else {
return Methods[m];
}
}
function getField(_) {
var f = _.field;
return function(t) { return t ? f(t) : NaN; };
}
prototype$32.transform = function(_, pulse) {
var out = pulse.fork(pulse.ALL),
impute = getValue(_),
field = getField(_),
fName = accessorName(_.field),
gNames = _.groupby.map(accessorName),
oNames = _.orderby.map(accessorName),
groups = partition(pulse.source, _.groupby, _.orderby),
curr = [],
prev = this.value,
m = groups.domain.length,
group, value, gVals, oVals, g, i, j, l, n, t;
for (g=0, l=groups.length; g<l; ++g) {
group = groups[g];
gVals = group.values;
value = NaN;
// add tuples for missing values
for (j=0; j<m; ++j) {
if (group[j] != null) continue;
oVals = groups.domain[j];
t = {_impute: true};
for (i=0, n=gVals.length; i<n; ++i) t[gNames[i]] = gVals[i];
for (i=0, n=oVals.length; i<n; ++i) t[oNames[i]] = oVals[i];
t[fName] = isNaN(value) ? (value = impute(group, field)) : value;
curr.push(ingest(t));
}
}
// update pulse with imputed tuples
if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr);
if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev);
this.value = curr;
return out;
};
function partition(data, groupby, orderby) {
var get = function(f) { return f(t); },
groups = [],
domain = [],
oMap = {}, oVals, oKey,
gMap = {}, gVals, gKey,
group, i, j, n, t;
for (i=0, n=data.length; i<n; ++i) {
t = data[i];
oKey = (oVals = orderby.map(get)) + '';
j = oMap[oKey] || (oMap[oKey] = domain.push(oVals));
gKey = (gVals = groupby ? groupby.map(get) : Empty$1) + '';
if (!(group = gMap[gKey])) {
group = (gMap[gKey] = []);
groups.push(group);
group.values = gVals;
}
group[j-1] = t;
}
return (groups.domain = domain, groups);
}
/**
* Generates a key function.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {Array<string>} params.fields - The field name(s) for the key function.
*/
function Key(params) {
Operator.call(this, null, update$3, params);
}
inherits(Key, Operator);
function update$3(_) {
return (this.value && !_.modified()) ? this.value : key(_.fields);
}
/**
* Extend tuples by joining them with values from a lookup table.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {Map} params.index - The lookup table map.
* @param {Array<function(object): *} params.fields - The fields to lookup.
* @param {Array<string>} params.as - Output field names for each lookup value.
* @param {*} [params.default] - A default value to use if lookup fails.
*/
function Lookup(params) {
Transform.call(this, {}, params);
}
var prototype$33 = inherits(Lookup, Transform);
prototype$33.transform = function(_, pulse) {
var out = pulse,
as = _.as,
keys = _.fields,
index = _.index,
defaultValue = _.default==null ? null : _.default,
reset = _.modified(),
flag = pulse.ADD,
set, key, field, mods;
if (keys.length === 1) {
key = keys[0];
field = as[0];
set = function(t) {
var v = index.get(key(t));
t[field] = v==null ? defaultValue : v;
};
} else {
set = function(t) {
for (var i=0, n=keys.length, v; i<n; ++i) {
v = index.get(keys[i](t));
t[as[i]] = v==null ? defaultValue : v;
}
};
}
if (reset) {
flag = pulse.SOURCE;
out = pulse.reflow(true);
} else {
mods = keys.some(function(k) { return pulse.modified(k.fields); });
flag |= (mods ? pulse.MOD : 0);
}
pulse.visit(flag, set);
return out.modifies(as);
};
/**
* Computes global min/max extents over a collection of extents.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {Array<Array<number>>} params.extents - The input extents.
*/
function MultiExtent(params) {
Operator.call(this, null, update$4, params);
}
inherits(MultiExtent, Operator);
function update$4(_) {
if (this.value && !_.modified()) {
return this.value;
}
var min = +Infinity,
max = -Infinity,
ext = _.extents,
i, n, e;
for (i=0, n=ext.length; i<n; ++i) {
e = ext[i];
if (e[0] < min) min = e[0];
if (e[1] > max) max = e[1];
}
return [min, max];
}
/**
* Merge a collection of value arrays.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {Array<Array<*>>} params.values - The input value arrrays.
*/
function MultiValues(params) {
Operator.call(this, null, update$5, params);
}
inherits(MultiValues, Operator);
function update$5(_) {
return (this.value && !_.modified())
? this.value
: _.values.reduce(function(data, _) { return data.concat(_); }, []);
}
/**
* Operator whose value is simply its parameter hash. This operator is
* useful for enabling reactive updates to values of nested objects.
* @constructor
* @param {object} params - The parameters for this operator.
*/
function Params(params) {
Transform.call(this, null, params);
}
inherits(Params, Transform);
Params.prototype.transform = function(_, pulse) {
this.modified(_.modified());
this.value = _;
return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples
};
/**
* Partitions pre-faceted data into tuple subflows.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(Dataflow, string): Operator} params.subflow - A function
* that generates a subflow of operators and returns its root operator.
* @param {function(object): Array<object>} params.field - The field
* accessor for an array of subflow tuple objects.
*/
function PreFacet(params) {
Facet.call(this, params);
}
var prototype$34 = inherits(PreFacet, Facet);
prototype$34.transform = function(_, pulse) {
var self = this,
flow = _.subflow,
field = _.field;
if (_.modified('field')) {
error('PreFacet does not support field modification.');
}
this._targets.active = 0; // reset list of active subflows
pulse.visit(pulse.MOD, function(t) {
var sf = self.subflow(t._id, flow, pulse, t);
field ? field(t).forEach(function(_) { sf.mod(_); }) : sf.mod(t);
});
pulse.visit(pulse.ADD, function(t) {
var sf = self.subflow(t._id, flow, pulse, t);
field ? field(t).forEach(function(_) { sf.add(ingest(_)); }) : sf.add(t);
});
pulse.visit(pulse.REM, function(t) {
var sf = self.subflow(t._id, flow, pulse, t);
field ? field(t).forEach(function(_) { sf.rem(_); }) : sf.rem(t);
});
return pulse;
};
/**
* Proxy the value of another operator as a pure signal value.
* Ensures no tuples are propagated.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {*} params.value - The value to proxy, becomes the value of this operator.
*/
function Proxy(params) {
Transform.call(this, null, params);
}
var prototype$35 = inherits(Proxy, Transform);
prototype$35.transform = function(_, pulse) {
this.value = _.value;
return _.modified('value')
? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS)
: pulse.StopPropagation;
};
/**
* Compute rank order scores for tuples. The tuples are assumed to have been
* sorted in the desired rank order by an upstream data source.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - An accessor for the field to rank.
* @param {boolean} params.normalize - Boolean flag for normalizing rank values.
* If true, the integer rank scores are normalized to range [0, 1].
*/
function Rank(params) {
Transform.call(this, null, params);
}
var prototype$36 = inherits(Rank, Transform);
prototype$36.transform = function(_, pulse) {
if (!pulse.source) {
error('Rank transform requires an upstream data source.');
}
var norm = _.normalize,
field = _.field,
as = _.as || 'rank',
ranks = {},
n = -1, rank;
if (field) {
// If we have a field accessor, first compile distinct keys.
pulse.visit(pulse.SOURCE, function(t) {
var v = field(t);
if (ranks[v] == null) ranks[v] = ++n;
});
pulse.visit(pulse.SOURCE, norm && --n
? function(t) { t[as] = ranks[field(t)] / n; }
: function(t) { t[as] = ranks[field(t)]; }
);
} else {
n += pulse.source.length;
rank = -1;
// Otherwise rank all the tuples together.
pulse.visit(pulse.SOURCE, norm && n
? function(t) { t[as] = ++rank / n; }
: function(t) { t[as] = ++rank; }
);
}
return pulse.reflow(_.modified()).modifies(as);
};
/**
* Relays a data stream between data processing pipelines.
* If the derive parameter is set, this transform will create derived
* copies of observed tuples. This provides derived data streams in which
* modifications to the tuples do not pollute an upstream data source.
* @param {object} params - The parameters for this operator.
* @param {number} [params.derive=false] - Boolean flag indicating if
* the transform should make derived copies of incoming tuples.
* @constructor
*/
function Relay(params) {
Transform.call(this, null, params);
}
var prototype$37 = inherits(Relay, Transform);
prototype$37.transform = function(_, pulse) {
var out,
lut = this.value || (out = pulse = pulse.addAll(), this.value = {});
if (_.derive) {
out = pulse.fork();
pulse.visit(pulse.ADD, function(t) {
var dt = derive(t);
lut[t._id] = dt;
out.add.push(dt);
});
pulse.visit(pulse.MOD, function(t) {
out.mod.push(rederive(t, lut[t._id]));
});
pulse.visit(pulse.REM, function(t) {
out.rem.push(lut[t._id]);
lut[t._id] = null;
});
}
return out;
};
/**
* Samples tuples passing through this operator.
* Uses reservoir sampling to maintain a representative sample.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {number} [params.size=1000] - The maximum number of samples.
*/
function Sample(params) {
Transform.call(this, [], params);
this.count = 0;
}
var prototype$38 = inherits(Sample, Transform);
prototype$38.transform = function(_, pulse) {
var out = pulse.fork(),
mod = _.modified('size'),
num = _.size,
res = this.value,
cnt = this.count,
cap = 0,
map = res.reduce(function(m, t) { return (m[t._id] = 1, m); }, {});
// sample reservoir update function
function update(t) {
var p, idx;
if (res.length < num) {
res.push(t);
} else {
idx = ~~(cnt * Math.random());
if (idx < res.length && idx >= cap) {
p = res[idx];
if (map[p._id]) out.rem.push(p); // eviction
res[idx] = t;
}
}
++cnt;
}
if (pulse.rem.length) {
// find all tuples that should be removed, add to output
pulse.visit(pulse.REM, function(t) {
if (map[t._id]) {
map[t._id] = -1;
out.rem.push(t);
}
--cnt;
});
// filter removed tuples out of the sample reservoir
res = res.filter(function(t) { return map[t._id] !== -1; });
}
if ((pulse.rem.length || mod) && res.length < num && pulse.source) {
// replenish sample if backing data source is available
cap = cnt = res.length;
pulse.visit(pulse.SOURCE, function(t) {
// update, but skip previously sampled tuples
if (!map[t._id]) update(t);
});
cap = -1;
}
if (mod && res.length > num) {
for (var i=0, n=res.length-num; i<n; ++i) {
map[res[i]._id] = -1;
out.rem.push(res[i]);
}
res = res.slice(n);
}
if (pulse.mod.length) {
// propagate modified tuples in the sample reservoir
pulse.visit(pulse.MOD, function(t) {
if (map[t._id]) out.mod.push(t);
});
}
if (pulse.add.length) {
// update sample reservoir
pulse.visit(pulse.ADD, update);
}
if (pulse.add.length || cap < 0) {
// output newly added tuples
out.add = res.filter(function(t) { return !map[t._id]; });
}
this.count = cnt;
this.value = out.source = res;
return out;
};
/**
* Generates data tuples for a specified sequence range of numbers.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {number} params.start - The first number in the sequence.
* @param {number} params.stop - The last number (exclusive) in the sequence.
* @param {number} [params.step=1] - The step size between numbers in the sequence.
*/
function Sequence(params) {
Transform.call(this, [], params);
}
var prototype$39 = inherits(Sequence, Transform);
prototype$39.transform = function(_, pulse) {
if (!_.modified()) return;
var out = pulse.materialize().fork(pulse.MOD);
out.rem = pulse.rem.concat(this.value);
out.source = this.value = sequence(_.start, _.stop, _.step).map(ingest);
out.add = pulse.add.concat(this.value);
return out;
};
/**
* Propagates a new pulse without any tuples so long as the input
* pulse contains some added, removed or modified tuples.
* @param {object} params - The parameters for this operator.
* @constructor
*/
function Sieve(params) {
Transform.call(this, null, params);
this.modified(true); // always treat as modified
}
var prototype$40 = inherits(Sieve, Transform);
prototype$40.transform = function(_, pulse) {
this.value = pulse.source;
return pulse.changed()
? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS)
: pulse.StopPropagation;
};
/**
* An index that maps from unique, string-coerced, field values to tuples.
* Assumes that the field serves as a unique key with no duplicate values.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The field accessor to index.
*/
function TupleIndex(params) {
Transform.call(this, fastmap(), params);
}
var prototype$41 = inherits(TupleIndex, Transform);
prototype$41.transform = function(_, pulse) {
var df = pulse.dataflow,
field = _.field,
index = this.value,
mod = true;
function set(t) { index.set(field(t), t); }
if (_.modified('field') || pulse.modified(field.fields)) {
index.clear();
pulse.visit(pulse.SOURCE, set);
} else if (pulse.changed()) {
pulse.visit(pulse.REM, function(t) { index.delete(field(t)); });
pulse.visit(pulse.ADD, set);
} else {
mod = false;
}
this.modified(mod);
if (index.empty > df.cleanThreshold) df.runAfter(index.clean);
return pulse.fork();
};
/**
* Extracts an array of values. Assumes the source data has already been
* reduced as needed (e.g., by an upstream Aggregate transform).
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The domain field to extract.
* @param {function(*,*): number} [params.sort] - An optional
* comparator function for sorting the values. The comparator will be
* applied to backing tuples prior to value extraction.
*/
function Values(params) {
Transform.call(this, null, params);
}
var prototype$42 = inherits(Values, Transform);
prototype$42.transform = function(_, pulse) {
var run = !this.value
|| _.modified('field')
|| _.modified('sort')
|| pulse.changed()
|| (_.sort && pulse.modified(_.sort.fields));
if (run) {
this.value = (_.sort
? pulse.source.slice().sort(_.sort)
: pulse.source).map(_.field);
}
};
var AggregateDefinition = {
"type": "Aggregate",
"metadata": {"generates": true, "changes": true},
"params": [
{ "name": "groupby", "type": "field", "array": true },
{ "name": "fields", "type": "field", "array": true },
{ "name": "ops", "type": "enum", "array": true,
"values": [
"count", "valid", "missing", "distinct",
"sum", "mean", "average",
"variance", "variancep", "stdev", "stdevp", "stderr",
"median", "q1", "q3", "ci0", "ci1",
"min", "max", "argmin", "argmax" ] },
{ "name": "as", "type": "string", "array": true },
{ "name": "drop", "type": "boolean", "default": true },
{ "name": "key", "type": "field" }
]
};
var BinDefinition = {
"type": "Bin",
"metadata": {"modifies": true},
"params": [
{ "name": "field", "type": "field", "required": true },
{ "name": "maxbins", "type": "number", "default": 20 },
{ "name": "base", "type": "number", "default": 10 },
{ "name": "divide", "type": "number", "array": true, "default": [5, 2] },
{ "name": "extent", "type": "number", "array": true, "length": 2, "required": true },
{ "name": "step", "type": "number" },
{ "name": "steps", "type": "number", "array": true },
{ "name": "minstep", "type": "number", "default": 0 },
{ "name": "nice", "type": "boolean", "default": true },
{ "name": "name", "type": "string" },
{ "name": "as", "type": "string", "array": true, "length": 2, "default": ["bin0", "bin1"] }
]
};
var CollectDefinition = {
"type": "Collect",
"metadata": {"source": true},
"params": [
{ "name": "sort", "type": "compare" }
]
};
var CountPatternDefinition = {
"type": "CountPattern",
"metadata": {"generates": true, "changes": true},
"params": [
{ "name": "field", "type": "field", "required": true },
{ "name": "case", "type": "enum", "values": ["upper", "lower", "mixed"], "default": "mixed" },
{ "name": "pattern", "type": "string", "default": "[\\w\"]+" },
{ "name": "stopwords", "type": "string", "default": "" },
{ "name": "as", "type": "string", "array": true, "length": 2, "default": ["text", "count"] }
]
};
var CrossDefinition = {
"type": "Cross",
"metadata": {"source": true, "generates": true, "changes": true},
"params": [
{ "name": "filter", "type": "expr" },
{ "name": "as", "type": "string", "array": true, "length": 2, "default": ["a", "b"] }
]
};
var distributions = [
{
"key": {"function": "normal"},
"params": [
{ "name": "mean", "type": "number", "default": 0 },
{ "name": "stdev", "type": "number", "default": 1 }
]
},
{
"key": {"function": "uniform"},
"params": [
{ "name": "min", "type": "number", "default": 0 },
{ "name": "max", "type": "number", "default": 1 }
]
},
{
"key": {"function": "kde"},
"params": [
{ "name": "field", "type": "field", "required": true },
{ "name": "from", "type": "data" },
{ "name": "bandwidth", "type": "number", "default": 0 }
]
}
];
var mixture = {
"key": {"function": "mixture"},
"params": [
{ "name": "distributions", "type": "param", "array": true,
"params": distributions },
{ "name": "weights", "type": "number", "array": true }
]
};
var DensityDefinition = {
"type": "Density",
"metadata": {"generates": true, "source": true},
"params": [
{ "name": "extent", "type": "number", "array": true, "length": 2 },
{ "name": "steps", "type": "number", "default": 100 },
{ "name": "method", "type": "string", "default": "pdf",
"values": ["pdf", "cdf"] },
{ "name": "distribution", "type": "param",
"params": distributions.concat(mixture) },
{ "name": "as", "type": "string", "array": true,
"default": ["value", "density"] }
]
};
var ExtentDefinition = {
"type": "Extent",
"metadata": {},
"params": [
{ "name": "field", "type": "field", "required": true }
]
};
var FilterDefinition = {
"type": "Filter",
"metadata": {"changes": true},
"params": [
{ "name": "expr", "type": "expr", "required": true }
]
};
var FoldDefinition = {
"type": "Fold",
"metadata": {"generates": true, "changes": true},
"params": [
{ "name": "fields", "type": "field", "array": true, "required": true },
{ "name": "as", "type": "string", "array": true, "length": 2, "default": ["key", "value"] }
]
};
var FormulaDefinition = {
"type": "Formula",
"metadata": {"modifies": true},
"params": [
{ "name": "expr", "type": "expr", "required": true },
{ "name": "as", "type": "string", "required": true },
{ "name": "initonly", "type": "boolean" }
]
};
var ImputeDefinition = {
"type": "Impute",
"metadata": {"changes": true},
"params": [
{ "name": "field", "type": "field", "required": true },
{ "name": "groupby", "type": "field", "array": true },
{ "name": "orderby", "type": "field", "array": true },
{ "name": "method", "type": "enum", "default": "value",
"values": ["value", "mean", "median", "max", "min"] },
{ "name": "value", "default": 0 }
]
};
var LookupDefinition = {
"type": "Lookup",
"metadata": {"modifies": true},
"params": [
{ "name": "index", "type": "index", "params": [
{"name": "from", "type": "data", "required": true },
{"name": "key", "type": "field", "required": true }
] },
{ "name": "fields", "type": "field", "array": true, "required": true },
{ "name": "as", "type": "string", "array": true, "required": true },
{ "name": "default", "default": null }
]
};
var RankDefinition = {
"type": "Rank",
"metadata": {"modifies": true},
"params": [
{ "name": "field", "type": "field" },
{ "name": "normalize", "type": "boolean", "default": false },
{ "name": "as", "type": "string", "default": "rank" }
]
};
var SampleDefinition = {
"type": "Sample",
"metadata": {"source": true, "changes": true},
"params": [
{ "name": "size", "type": "number", "default": 1000 }
]
};
var SequenceDefinition = {
"type": "Range",
"metadata": {"generates": true, "source": true},
"params": [
{ "name": "start", "type": "number", "required": true },
{ "name": "stop", "type": "number", "required": true },
{ "name": "step", "type": "number", "default": 1 }
],
"output": ["value"]
};
// Data Transforms
register(AggregateDefinition, Aggregate);
register(BinDefinition, Bin);
register(CollectDefinition, Collect);
register(CountPatternDefinition, CountPattern);
register(CrossDefinition, Cross);
register(DensityDefinition, Density);
register(ExtentDefinition, Extent);
register(FilterDefinition, Filter);
register(FoldDefinition, Fold);
register(FormulaDefinition, Formula);
register(ImputeDefinition, Impute);
register(LookupDefinition, Lookup);
register(RankDefinition, Rank);
register(SampleDefinition, Sample);
register(SequenceDefinition, Sequence);
transform('Compare', Compare);
transform('Facet', Facet);
transform('Field', Field);
transform('Generate', Generate);
transform('Key', Key);
transform('MultiExtent', MultiExtent);
transform('MultiValues', MultiValues);
transform('Params', Params);
transform('PreFacet', PreFacet);
transform('Proxy', Proxy);
transform('Relay', Relay);
transform('Sieve', Sieve);
transform('Subflow', Subflow);
transform('TupleIndex', TupleIndex);
transform('Values', Values);
function invertRange(scale) {
return function(_) {
var lo = _[0],
hi = _[1],
t;
if (hi < lo) t = lo, lo = hi, hi = t;
return [
scale.invert(lo),
scale.invert(hi)
];
}
}
function invertRangeExtent(scale) {
return function(_) {
var range = scale.range(),
lo = _[0],
hi = _[1],
min = -1, max, t, i, n;
if (hi < lo) t = lo, lo = hi, hi = t;
for (i=0, n=range.length; i<n; ++i) {
if (range[i] >= lo && range[i] <= hi) {
if (min < 0) min = i;
max = i;
}
}
if (min < 0) return undefined;
lo = scale.invertExtent(range[min]);
hi = scale.invertExtent(range[max]);
return [
lo[0] === undefined ? lo[1] : lo[0],
hi[1] === undefined ? hi[0] : hi[1]
];
}
}
function bandSpace(count, paddingInner, paddingOuter) {
var space = count - paddingInner + paddingOuter * 2;
return count ? (space > 0 ? space : 1) : 0;
}
var array$2 = Array.prototype;
var map$2 = array$2.map;
var slice$2 = array$2.slice;
var implicit = {name: "implicit"};
function ordinal(range) {
var index = map$1(),
domain = [],
unknown = implicit;
range = range == null ? [] : slice$2.call(range);
function scale(d) {
var key = d + "", i = index.get(key);
if (!i) {
if (unknown !== implicit) return unknown;
index.set(key, i = domain.push(d));
}
return range[(i - 1) % range.length];
}
scale.domain = function(_) {
if (!arguments.length) return domain.slice();
domain = [], index = map$1();
var i = -1, n = _.length, d, key;
while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d));
return scale;
};
scale.range = function(_) {
return arguments.length ? (range = slice$2.call(_), scale) : range.slice();
};
scale.unknown = function(_) {
return arguments.length ? (unknown = _, scale) : unknown;
};
scale.copy = function() {
return ordinal()
.domain(domain)
.range(range)
.unknown(unknown);
};
return scale;
}
function define(constructor, factory, prototype) {
constructor.prototype = factory.prototype = prototype;
prototype.constructor = constructor;
}
function extend$1(parent, definition) {
var prototype = Object.create(parent.prototype);
for (var key in definition) prototype[key] = definition[key];
return prototype;
}
function Color() {}
var darker = 0.7;
var brighter = 1 / darker;
var reI = "\\s*([+-]?\\d+)\\s*";
var reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*";
var reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
var reHex3 = /^#([0-9a-f]{3})$/;
var reHex6 = /^#([0-9a-f]{6})$/;
var reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$");
var reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$");
var reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$");
var reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$");
var reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$");
var reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
var named = {
aliceblue: 0xf0f8ff,
antiquewhite: 0xfaebd7,
aqua: 0x00ffff,
aquamarine: 0x7fffd4,
azure: 0xf0ffff,
beige: 0xf5f5dc,
bisque: 0xffe4c4,
black: 0x000000,
blanchedalmond: 0xffebcd,
blue: 0x0000ff,
blueviolet: 0x8a2be2,
brown: 0xa52a2a,
burlywood: 0xdeb887,
cadetblue: 0x5f9ea0,
chartreuse: 0x7fff00,
chocolate: 0xd2691e,
coral: 0xff7f50,
cornflowerblue: 0x6495ed,
cornsilk: 0xfff8dc,
crimson: 0xdc143c,
cyan: 0x00ffff,
darkblue: 0x00008b,
darkcyan: 0x008b8b,
darkgoldenrod: 0xb8860b,
darkgray: 0xa9a9a9,
darkgreen: 0x006400,
darkgrey: 0xa9a9a9,
darkkhaki: 0xbdb76b,
darkmagenta: 0x8b008b,
darkolivegreen: 0x556b2f,
darkorange: 0xff8c00,
darkorchid: 0x9932cc,
darkred: 0x8b0000,
darksalmon: 0xe9967a,
darkseagreen: 0x8fbc8f,
darkslateblue: 0x483d8b,
darkslategray: 0x2f4f4f,
darkslategrey: 0x2f4f4f,
darkturquoise: 0x00ced1,
darkviolet: 0x9400d3,
deeppink: 0xff1493,
deepskyblue: 0x00bfff,
dimgray: 0x696969,
dimgrey: 0x696969,
dodgerblue: 0x1e90ff,
firebrick: 0xb22222,
floralwhite: 0xfffaf0,
forestgreen: 0x228b22,
fuchsia: 0xff00ff,
gainsboro: 0xdcdcdc,
ghostwhite: 0xf8f8ff,
gold: 0xffd700,
goldenrod: 0xdaa520,
gray: 0x808080,
green: 0x008000,
greenyellow: 0xadff2f,
grey: 0x808080,
honeydew: 0xf0fff0,
hotpink: 0xff69b4,
indianred: 0xcd5c5c,
indigo: 0x4b0082,
ivory: 0xfffff0,
khaki: 0xf0e68c,
lavender: 0xe6e6fa,
lavenderblush: 0xfff0f5,
lawngreen: 0x7cfc00,
lemonchiffon: 0xfffacd,
lightblue: 0xadd8e6,
lightcoral: 0xf08080,
lightcyan: 0xe0ffff,
lightgoldenrodyellow: 0xfafad2,
lightgray: 0xd3d3d3,
lightgreen: 0x90ee90,
lightgrey: 0xd3d3d3,
lightpink: 0xffb6c1,
lightsalmon: 0xffa07a,
lightseagreen: 0x20b2aa,
lightskyblue: 0x87cefa,
lightslategray: 0x778899,
lightslategrey: 0x778899,
lightsteelblue: 0xb0c4de,
lightyellow: 0xffffe0,
lime: 0x00ff00,
limegreen: 0x32cd32,
linen: 0xfaf0e6,
magenta: 0xff00ff,
maroon: 0x800000,
mediumaquamarine: 0x66cdaa,
mediumblue: 0x0000cd,
mediumorchid: 0xba55d3,
mediumpurple: 0x9370db,
mediumseagreen: 0x3cb371,
mediumslateblue: 0x7b68ee,
mediumspringgreen: 0x00fa9a,
mediumturquoise: 0x48d1cc,
mediumvioletred: 0xc71585,
midnightblue: 0x191970,
mintcream: 0xf5fffa,
mistyrose: 0xffe4e1,
moccasin: 0xffe4b5,
navajowhite: 0xffdead,
navy: 0x000080,
oldlace: 0xfdf5e6,
olive: 0x808000,
olivedrab: 0x6b8e23,
orange: 0xffa500,
orangered: 0xff4500,
orchid: 0xda70d6,
palegoldenrod: 0xeee8aa,
palegreen: 0x98fb98,
paleturquoise: 0xafeeee,
palevioletred: 0xdb7093,
papayawhip: 0xffefd5,
peachpuff: 0xffdab9,
peru: 0xcd853f,
pink: 0xffc0cb,
plum: 0xdda0dd,
powderblue: 0xb0e0e6,
purple: 0x800080,
rebeccapurple: 0x663399,
red: 0xff0000,
rosybrown: 0xbc8f8f,
royalblue: 0x4169e1,
saddlebrown: 0x8b4513,
salmon: 0xfa8072,
sandybrown: 0xf4a460,
seagreen: 0x2e8b57,
seashell: 0xfff5ee,
sienna: 0xa0522d,
silver: 0xc0c0c0,
skyblue: 0x87ceeb,
slateblue: 0x6a5acd,
slategray: 0x708090,
slategrey: 0x708090,
snow: 0xfffafa,
springgreen: 0x00ff7f,
steelblue: 0x4682b4,
tan: 0xd2b48c,
teal: 0x008080,
thistle: 0xd8bfd8,
tomato: 0xff6347,
turquoise: 0x40e0d0,
violet: 0xee82ee,
wheat: 0xf5deb3,
white: 0xffffff,
whitesmoke: 0xf5f5f5,
yellow: 0xffff00,
yellowgreen: 0x9acd32
};
define(Color, color$1, {
displayable: function() {
return this.rgb().displayable();
},
toString: function() {
return this.rgb() + "";
}
});
function color$1(format) {
var m;
format = (format + "").trim().toLowerCase();
return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00
: (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000
: (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
: (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
: (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
: (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
: (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
: (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
: named.hasOwnProperty(format) ? rgbn(named[format])
: format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
: null;
}
function rgbn(n) {
return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
}
function rgba(r, g, b, a) {
if (a <= 0) r = g = b = NaN;
return new Rgb(r, g, b, a);
}
function rgbConvert(o) {
if (!(o instanceof Color)) o = color$1(o);
if (!o) return new Rgb;
o = o.rgb();
return new Rgb(o.r, o.g, o.b, o.opacity);
}
function rgb(r, g, b, opacity) {
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
}
function Rgb(r, g, b, opacity) {
this.r = +r;
this.g = +g;
this.b = +b;
this.opacity = +opacity;
}
define(Rgb, rgb, extend$1(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
rgb: function() {
return this;
},
displayable: function() {
return (0 <= this.r && this.r <= 255)
&& (0 <= this.g && this.g <= 255)
&& (0 <= this.b && this.b <= 255)
&& (0 <= this.opacity && this.opacity <= 1);
},
toString: function() {
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
return (a === 1 ? "rgb(" : "rgba(")
+ Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.b) || 0))
+ (a === 1 ? ")" : ", " + a + ")");
}
}));
function hsla(h, s, l, a) {
if (a <= 0) h = s = l = NaN;
else if (l <= 0 || l >= 1) h = s = NaN;
else if (s <= 0) h = NaN;
return new Hsl(h, s, l, a);
}
function hslConvert(o) {
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
if (!(o instanceof Color)) o = color$1(o);
if (!o) return new Hsl;
if (o instanceof Hsl) return o;
o = o.rgb();
var r = o.r / 255,
g = o.g / 255,
b = o.b / 255,
min = Math.min(r, g, b),
max = Math.max(r, g, b),
h = NaN,
s = max - min,
l = (max + min) / 2;
if (s) {
if (r === max) h = (g - b) / s + (g < b) * 6;
else if (g === max) h = (b - r) / s + 2;
else h = (r - g) / s + 4;
s /= l < 0.5 ? max + min : 2 - max - min;
h *= 60;
} else {
s = l > 0 && l < 1 ? 0 : h;
}
return new Hsl(h, s, l, o.opacity);
}
function hsl(h, s, l, opacity) {
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
}
function Hsl(h, s, l, opacity) {
this.h = +h;
this.s = +s;
this.l = +l;
this.opacity = +opacity;
}
define(Hsl, hsl, extend$1(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
rgb: function() {
var h = this.h % 360 + (this.h < 0) * 360,
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
l = this.l,
m2 = l + (l < 0.5 ? l : 1 - l) * s,
m1 = 2 * l - m2;
return new Rgb(
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
hsl2rgb(h, m1, m2),
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
this.opacity
);
},
displayable: function() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
&& (0 <= this.l && this.l <= 1)
&& (0 <= this.opacity && this.opacity <= 1);
}
}));
/* From FvD 13.37, CSS Color Module Level 3 */
function hsl2rgb(h, m1, m2) {
return (h < 60 ? m1 + (m2 - m1) * h / 60
: h < 180 ? m2
: h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
: m1) * 255;
}
var deg2rad = Math.PI / 180;
var rad2deg = 180 / Math.PI;
var Kn = 18;
var Xn = 0.950470;
var Yn = 1;
var Zn = 1.088830;
var t0$1 = 4 / 29;
var t1$1 = 6 / 29;
var t2 = 3 * t1$1 * t1$1;
var t3 = t1$1 * t1$1 * t1$1;
function labConvert(o) {
if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
if (o instanceof Hcl) {
var h = o.h * deg2rad;
return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
}
if (!(o instanceof Rgb)) o = rgbConvert(o);
var b = rgb2xyz(o.r),
a = rgb2xyz(o.g),
l = rgb2xyz(o.b),
x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn),
y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn),
z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn);
return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
}
function lab(l, a, b, opacity) {
return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
}
function Lab(l, a, b, opacity) {
this.l = +l;
this.a = +a;
this.b = +b;
this.opacity = +opacity;
}
define(Lab, lab, extend$1(Color, {
brighter: function(k) {
return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
darker: function(k) {
return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
rgb: function() {
var y = (this.l + 16) / 116,
x = isNaN(this.a) ? y : y + this.a / 500,
z = isNaN(this.b) ? y : y - this.b / 200;
y = Yn * lab2xyz(y);
x = Xn * lab2xyz(x);
z = Zn * lab2xyz(z);
return new Rgb(
xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB
xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z),
this.opacity
);
}
}));
function xyz2lab(t) {
return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0$1;
}
function lab2xyz(t) {
return t > t1$1 ? t * t * t : t2 * (t - t0$1);
}
function xyz2rgb(x) {
return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
}
function rgb2xyz(x) {
return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
}
function hclConvert(o) {
if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
if (!(o instanceof Lab)) o = labConvert(o);
var h = Math.atan2(o.b, o.a) * rad2deg;
return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
}
function hcl(h, c, l, opacity) {
return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
}
function Hcl(h, c, l, opacity) {
this.h = +h;
this.c = +c;
this.l = +l;
this.opacity = +opacity;
}
define(Hcl, hcl, extend$1(Color, {
brighter: function(k) {
return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);
},
darker: function(k) {
return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);
},
rgb: function() {
return labConvert(this).rgb();
}
}));
var A = -0.14861;
var B = +1.78277;
var C = -0.29227;
var D = -0.90649;
var E = +1.97294;
var ED = E * D;
var EB = E * B;
var BC_DA = B * C - D * A;
function cubehelixConvert(o) {
if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
if (!(o instanceof Rgb)) o = rgbConvert(o);
var r = o.r / 255,
g = o.g / 255,
b = o.b / 255,
l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
bl = b - l,
k = (E * (g - l) - C * bl) / D,
s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1
h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;
return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
}
function cubehelix(h, s, l, opacity) {
return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
}
function Cubehelix(h, s, l, opacity) {
this.h = +h;
this.s = +s;
this.l = +l;
this.opacity = +opacity;
}
define(Cubehelix, cubehelix, extend$1(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
rgb: function() {
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
l = +this.l,
a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
cosh = Math.cos(h),
sinh = Math.sin(h);
return new Rgb(
255 * (l + a * (A * cosh + B * sinh)),
255 * (l + a * (C * cosh + D * sinh)),
255 * (l + a * (E * cosh)),
this.opacity
);
}
}));
function basis(t1, v0, v1, v2, v3) {
var t2 = t1 * t1, t3 = t2 * t1;
return ((1 - 3 * t1 + 3 * t2 - t3) * v0
+ (4 - 6 * t2 + 3 * t3) * v1
+ (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
+ t3 * v3) / 6;
}
function interpolateBasis(values) {
var n = values.length - 1;
return function(t) {
var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
v1 = values[i],
v2 = values[i + 1],
v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
return basis((t - i / n) * n, v0, v1, v2, v3);
};
}
function interpolateBasisClosed(values) {
var n = values.length;
return function(t) {
var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
v0 = values[(i + n - 1) % n],
v1 = values[i % n],
v2 = values[(i + 1) % n],
v3 = values[(i + 2) % n];
return basis((t - i / n) * n, v0, v1, v2, v3);
};
}
function constant$4(x) {
return function() {
return x;
};
}
function linear$1(a, d) {
return function(t) {
return a + t * d;
};
}
function exponential(a, b, y) {
return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
return Math.pow(a + t * b, y);
};
}
function hue(a, b) {
var d = b - a;
return d ? linear$1(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$4(isNaN(a) ? b : a);
}
function gamma(y) {
return (y = +y) === 1 ? nogamma : function(a, b) {
return b - a ? exponential(a, b, y) : constant$4(isNaN(a) ? b : a);
};
}
function nogamma(a, b) {
var d = b - a;
return d ? linear$1(a, d) : constant$4(isNaN(a) ? b : a);
}
var interpolateRgb = (function rgbGamma(y) {
var color = gamma(y);
function rgb$$(start, end) {
var r = color((start = rgb(start)).r, (end = rgb(end)).r),
g = color(start.g, end.g),
b = color(start.b, end.b),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.r = r(t);
start.g = g(t);
start.b = b(t);
start.opacity = opacity(t);
return start + "";
};
}
rgb$$.gamma = rgbGamma;
return rgb$$;
})(1);
function rgbSpline(spline) {
return function(colors) {
var n = colors.length,
r = new Array(n),
g = new Array(n),
b = new Array(n),
i, color;
for (i = 0; i < n; ++i) {
color = rgb(colors[i]);
r[i] = color.r || 0;
g[i] = color.g || 0;
b[i] = color.b || 0;
}
r = spline(r);
g = spline(g);
b = spline(b);
color.opacity = 1;
return function(t) {
color.r = r(t);
color.g = g(t);
color.b = b(t);
return color + "";
};
};
}
var interpolateRgbBasis = rgbSpline(interpolateBasis);
var interpolateRgbBasisClosed = rgbSpline(interpolateBasisClosed);
function interpolateArray(a, b) {
var nb = b ? b.length : 0,
na = a ? Math.min(nb, a.length) : 0,
x = new Array(nb),
c = new Array(nb),
i;
for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]);
for (; i < nb; ++i) c[i] = b[i];
return function(t) {
for (i = 0; i < na; ++i) c[i] = x[i](t);
return c;
};
}
function interpolateDate(a, b) {
var d = new Date;
return a = +a, b -= a, function(t) {
return d.setTime(a + b * t), d;
};
}
function interpolateNumber(a, b) {
return a = +a, b -= a, function(t) {
return a + b * t;
};
}
function interpolateObject(a, b) {
var i = {},
c = {},
k;
if (a === null || typeof a !== "object") a = {};
if (b === null || typeof b !== "object") b = {};
for (k in b) {
if (k in a) {
i[k] = interpolate(a[k], b[k]);
} else {
c[k] = b[k];
}
}
return function(t) {
for (k in i) c[k] = i[k](t);
return c;
};
}
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
var reB = new RegExp(reA.source, "g");
function zero$1(b) {
return function() {
return b;
};
}
function one$1(b) {
return function(t) {
return b(t) + "";
};
}
function interpolateString(a, b) {
var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
am, // current match in a
bm, // current match in b
bs, // string preceding current number in b, if any
i = -1, // index in s
s = [], // string constants and placeholders
q = []; // number interpolators
// Coerce inputs to strings.
a = a + "", b = b + "";
// Interpolate pairs of numbers in a & b.
while ((am = reA.exec(a))
&& (bm = reB.exec(b))) {
if ((bs = bm.index) > bi) { // a string precedes the next number in b
bs = b.slice(bi, bs);
if (s[i]) s[i] += bs; // coalesce with previous string
else s[++i] = bs;
}
if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
if (s[i]) s[i] += bm; // coalesce with previous string
else s[++i] = bm;
} else { // interpolate non-matching numbers
s[++i] = null;
q.push({i: i, x: interpolateNumber(am, bm)});
}
bi = reB.lastIndex;
}
// Add remains of b.
if (bi < b.length) {
bs = b.slice(bi);
if (s[i]) s[i] += bs; // coalesce with previous string
else s[++i] = bs;
}
// Special optimization for only a single match.
// Otherwise, interpolate each of the numbers and rejoin the string.
return s.length < 2 ? (q[0]
? one$1(q[0].x)
: zero$1(b))
: (b = q.length, function(t) {
for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
return s.join("");
});
}
function interpolate(a, b) {
var t = typeof b, c;
return b == null || t === "boolean" ? constant$4(b)
: (t === "number" ? interpolateNumber
: t === "string" ? ((c = color$1(b)) ? (b = c, interpolateRgb) : interpolateString)
: b instanceof color$1 ? interpolateRgb
: b instanceof Date ? interpolateDate
: Array.isArray(b) ? interpolateArray
: isNaN(b) ? interpolateObject
: interpolateNumber)(a, b);
}
function interpolateRound(a, b) {
return a = +a, b -= a, function(t) {
return Math.round(a + b * t);
};
}
var degrees = 180 / Math.PI;
var identity$4 = {
translateX: 0,
translateY: 0,
rotate: 0,
skewX: 0,
scaleX: 1,
scaleY: 1
};
function decompose(a, b, c, d, e, f) {
var scaleX, scaleY, skewX;
if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
return {
translateX: e,
translateY: f,
rotate: Math.atan2(b, a) * degrees,
skewX: Math.atan(skewX) * degrees,
scaleX: scaleX,
scaleY: scaleY
};
}
var cssNode;
var cssRoot;
var cssView;
var svgNode;
function parseCss(value) {
if (value === "none") return identity$4;
if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView;
cssNode.style.transform = value;
value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform");
cssRoot.removeChild(cssNode);
value = value.slice(7, -1).split(",");
return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);
}
function parseSvg(value) {
if (value == null) return identity$4;
if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
svgNode.setAttribute("transform", value);
if (!(value = svgNode.transform.baseVal.consolidate())) return identity$4;
value = value.matrix;
return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
}
function interpolateTransform(parse, pxComma, pxParen, degParen) {
function pop(s) {
return s.length ? s.pop() + " " : "";
}
function translate(xa, ya, xb, yb, s, q) {
if (xa !== xb || ya !== yb) {
var i = s.push("translate(", null, pxComma, null, pxParen);
q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interpolateNumber(ya, yb)});
} else if (xb || yb) {
s.push("translate(" + xb + pxComma + yb + pxParen);
}
}
function rotate(a, b, s, q) {
if (a !== b) {
if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path
q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: interpolateNumber(a, b)});
} else if (b) {
s.push(pop(s) + "rotate(" + b + degParen);
}
}
function skewX(a, b, s, q) {
if (a !== b) {
q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: interpolateNumber(a, b)});
} else if (b) {
s.push(pop(s) + "skewX(" + b + degParen);
}
}
function scale(xa, ya, xb, yb, s, q) {
if (xa !== xb || ya !== yb) {
var i = s.push(pop(s) + "scale(", null, ",", null, ")");
q.push({i: i - 4, x: interpolateNumber(xa, xb)}, {i: i - 2, x: interpolateNumber(ya, yb)});
} else if (xb !== 1 || yb !== 1) {
s.push(pop(s) + "scale(" + xb + "," + yb + ")");
}
}
return function(a, b) {
var s = [], // string constants and placeholders
q = []; // number interpolators
a = parse(a), b = parse(b);
translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
rotate(a.rotate, b.rotate, s, q);
skewX(a.skewX, b.skewX, s, q);
scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
a = b = null; // gc
return function(t) {
var i = -1, n = q.length, o;
while (++i < n) s[(o = q[i]).i] = o.x(t);
return s.join("");
};
};
}
var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
var rho = Math.SQRT2;
var rho2 = 2;
var rho4 = 4;
var epsilon2 = 1e-12;
function cosh(x) {
return ((x = Math.exp(x)) + 1 / x) / 2;
}
function sinh(x) {
return ((x = Math.exp(x)) - 1 / x) / 2;
}
function tanh(x) {
return ((x = Math.exp(2 * x)) - 1) / (x + 1);
}
// p0 = [ux0, uy0, w0]
// p1 = [ux1, uy1, w1]
function interpolateZoom(p0, p1) {
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
dx = ux1 - ux0,
dy = uy1 - uy0,
d2 = dx * dx + dy * dy,
i,
S;
// Special case for u0 ≅ u1.
if (d2 < epsilon2) {
S = Math.log(w1 / w0) / rho;
i = function(t) {
return [
ux0 + t * dx,
uy0 + t * dy,
w0 * Math.exp(rho * t * S)
];
}
}
// General case.
else {
var d1 = Math.sqrt(d2),
b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
S = (r1 - r0) / rho;
i = function(t) {
var s = t * S,
coshr0 = cosh(r0),
u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
return [
ux0 + u * dx,
uy0 + u * dy,
w0 * coshr0 / cosh(rho * s + r0)
];
}
}
i.duration = S * 1000;
return i;
}
function hsl$1(hue) {
return function(start, end) {
var h = hue((start = hsl(start)).h, (end = hsl(end)).h),
s = nogamma(start.s, end.s),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.h = h(t);
start.s = s(t);
start.l = l(t);
start.opacity = opacity(t);
return start + "";
};
}
}
var interpolateHsl = hsl$1(hue);
var interpolateHslLong = hsl$1(nogamma);
function lab$1(start, end) {
var l = nogamma((start = lab(start)).l, (end = lab(end)).l),
a = nogamma(start.a, end.a),
b = nogamma(start.b, end.b),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.l = l(t);
start.a = a(t);
start.b = b(t);
start.opacity = opacity(t);
return start + "";
};
}
function hcl$1(hue) {
return function(start, end) {
var h = hue((start = hcl(start)).h, (end = hcl(end)).h),
c = nogamma(start.c, end.c),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.h = h(t);
start.c = c(t);
start.l = l(t);
start.opacity = opacity(t);
return start + "";
};
}
}
var interpolateHcl = hcl$1(hue);
var interpolateHclLong = hcl$1(nogamma);
function cubehelix$1(hue) {
return (function cubehelixGamma(y) {
y = +y;
function cubehelix$$(start, end) {
var h = hue((start = cubehelix(start)).h, (end = cubehelix(end)).h),
s = nogamma(start.s, end.s),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function(t) {
start.h = h(t);
start.s = s(t);
start.l = l(Math.pow(t, y));
start.opacity = opacity(t);
return start + "";
};
}
cubehelix$$.gamma = cubehelixGamma;
return cubehelix$$;
})(1);
}
var interpolateCubehelix = cubehelix$1(hue);
var interpolateCubehelixLong = cubehelix$1(nogamma);
function quantize(interpolator, n) {
var samples = new Array(n);
for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
return samples;
}
var $$1 = Object.freeze({
interpolate: interpolate,
interpolateArray: interpolateArray,
interpolateBasis: interpolateBasis,
interpolateBasisClosed: interpolateBasisClosed,
interpolateDate: interpolateDate,
interpolateNumber: interpolateNumber,
interpolateObject: interpolateObject,
interpolateRound: interpolateRound,
interpolateString: interpolateString,
interpolateTransformCss: interpolateTransformCss,
interpolateTransformSvg: interpolateTransformSvg,
interpolateZoom: interpolateZoom,
interpolateRgb: interpolateRgb,
interpolateRgbBasis: interpolateRgbBasis,
interpolateRgbBasisClosed: interpolateRgbBasisClosed,
interpolateHsl: interpolateHsl,
interpolateHslLong: interpolateHslLong,
interpolateLab: lab$1,
interpolateHcl: interpolateHcl,
interpolateHclLong: interpolateHclLong,
interpolateCubehelix: interpolateCubehelix,
interpolateCubehelixLong: interpolateCubehelixLong,
quantize: quantize
});
function constant$5(x) {
return function() {
return x;
};
}
function number$2(x) {
return +x;
}
var unit = [0, 1];
function deinterpolate(a, b) {
return (b -= (a = +a))
? function(x) { return (x - a) / b; }
: constant$5(b);
}
function deinterpolateClamp(deinterpolate) {
return function(a, b) {
var d = deinterpolate(a = +a, b = +b);
return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); };
};
}
function reinterpolateClamp(reinterpolate) {
return function(a, b) {
var r = reinterpolate(a = +a, b = +b);
return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); };
};
}
function bimap(domain, range, deinterpolate, reinterpolate) {
var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0);
else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1);
return function(x) { return r0(d0(x)); };
}
function polymap(domain, range, deinterpolate, reinterpolate) {
var j = Math.min(domain.length, range.length) - 1,
d = new Array(j),
r = new Array(j),
i = -1;
// Reverse descending domains.
if (domain[j] < domain[0]) {
domain = domain.slice().reverse();
range = range.slice().reverse();
}
while (++i < j) {
d[i] = deinterpolate(domain[i], domain[i + 1]);
r[i] = reinterpolate(range[i], range[i + 1]);
}
return function(x) {
var i = bisectRight(domain, x, 1, j) - 1;
return r[i](d[i](x));
};
}
function copy$1(source, target) {
return target
.domain(source.domain())
.range(source.range())
.interpolate(source.interpolate())
.clamp(source.clamp());
}
// deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
// reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b].
function continuous(deinterpolate$$, reinterpolate) {
var domain = unit,
range = unit,
interpolate$$ = interpolate,
clamp = false,
piecewise,
output,
input;
function rescale() {
piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap;
output = input = null;
return scale;
}
function scale(x) {
return (output || (output = piecewise(domain, range, clamp ? deinterpolateClamp(deinterpolate$$) : deinterpolate$$, interpolate$$)))(+x);
}
scale.invert = function(y) {
return (input || (input = piecewise(range, domain, deinterpolate, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y);
};
scale.domain = function(_) {
return arguments.length ? (domain = map$2.call(_, number$2), rescale()) : domain.slice();
};
scale.range = function(_) {
return arguments.length ? (range = slice$2.call(_), rescale()) : range.slice();
};
scale.rangeRound = function(_) {
return range = slice$2.call(_), interpolate$$ = interpolateRound, rescale();
};
scale.clamp = function(_) {
return arguments.length ? (clamp = !!_, rescale()) : clamp;
};
scale.interpolate = function(_) {
return arguments.length ? (interpolate$$ = _, rescale()) : interpolate$$;
};
return rescale();
}
// Computes the decimal coefficient and exponent of the specified number x with
// significant digits p, where x is positive and p is in [1, 21] or undefined.
// For example, formatDecimal(1.23) returns ["123", 0].
function formatDecimal(x, p) {
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity
var i, coefficient = x.slice(0, i);
// The string returned by toExponential either has the form \d\.\d+e[-+]\d+
// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3).
return [
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
+x.slice(i + 1)
];
}
function exponent(x) {
return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;
}
function formatGroup(grouping, thousands) {
return function(value, width) {
var i = value.length,
t = [],
j = 0,
g = grouping[0],
length = 0;
while (i > 0 && g > 0) {
if (length + g + 1 > width) g = Math.max(1, width - length);
t.push(value.substring(i -= g, i + g));
if ((length += g + 1) > width) break;
g = grouping[j = (j + 1) % grouping.length];
}
return t.reverse().join(thousands);
};
}
function formatNumerals(numerals) {
return function(value) {
return value.replace(/[0-9]/g, function(i) {
return numerals[+i];
});
};
}
function formatDefault(x, p) {
x = x.toPrecision(p);
out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {
switch (x[i]) {
case ".": i0 = i1 = i; break;
case "0": if (i0 === 0) i0 = i; i1 = i; break;
case "e": break out;
default: if (i0 > 0) i0 = 0; break;
}
}
return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;
}
var prefixExponent;
function formatPrefixAuto(x, p) {
var d = formatDecimal(x, p);
if (!d) return x + "";
var coefficient = d[0],
exponent = d[1],
i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,
n = coefficient.length;
return i === n ? coefficient
: i > n ? coefficient + new Array(i - n + 1).join("0")
: i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i)
: "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y!
}
function formatRounded(x, p) {
var d = formatDecimal(x, p);
if (!d) return x + "";
var coefficient = d[0],
exponent = d[1];
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient
: coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1)
: coefficient + new Array(exponent - coefficient.length + 2).join("0");
}
var formatTypes = {
"": formatDefault,
"%": function(x, p) { return (x * 100).toFixed(p); },
"b": function(x) { return Math.round(x).toString(2); },
"c": function(x) { return x + ""; },
"d": function(x) { return Math.round(x).toString(10); },
"e": function(x, p) { return x.toExponential(p); },
"f": function(x, p) { return x.toFixed(p); },
"g": function(x, p) { return x.toPrecision(p); },
"o": function(x) { return Math.round(x).toString(8); },
"p": function(x, p) { return formatRounded(x * 100, p); },
"r": formatRounded,
"s": formatPrefixAuto,
"X": function(x) { return Math.round(x).toString(16).toUpperCase(); },
"x": function(x) { return Math.round(x).toString(16); }
};
// [[fill]align][sign][symbol][0][width][,][.precision][type]
var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;
function formatSpecifier(specifier) {
return new FormatSpecifier(specifier);
}
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof
function FormatSpecifier(specifier) {
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
var match,
fill = match[1] || " ",
align = match[2] || ">",
sign = match[3] || "-",
symbol = match[4] || "",
zero = !!match[5],
width = match[6] && +match[6],
comma = !!match[7],
precision = match[8] && +match[8].slice(1),
type = match[9] || "";
// The "n" type is an alias for ",g".
if (type === "n") comma = true, type = "g";
// Map invalid types to the default format.
else if (!formatTypes[type]) type = "";
// If zero fill is specified, padding goes after sign and before digits.
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "=";
this.fill = fill;
this.align = align;
this.sign = sign;
this.symbol = symbol;
this.zero = zero;
this.width = width;
this.comma = comma;
this.precision = precision;
this.type = type;
}
FormatSpecifier.prototype.toString = function() {
return this.fill
+ this.align
+ this.sign
+ this.symbol
+ (this.zero ? "0" : "")
+ (this.width == null ? "" : Math.max(1, this.width | 0))
+ (this.comma ? "," : "")
+ (this.precision == null ? "" : "." + Math.max(0, this.precision | 0))
+ this.type;
};
function identity$5(x) {
return x;
}
var prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
function formatLocale$1(locale) {
var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity$5,
currency = locale.currency,
decimal = locale.decimal,
numerals = locale.numerals ? formatNumerals(locale.numerals) : identity$5;
function newFormat(specifier) {
specifier = formatSpecifier(specifier);
var fill = specifier.fill,
align = specifier.align,
sign = specifier.sign,
symbol = specifier.symbol,
zero = specifier.zero,
width = specifier.width,
comma = specifier.comma,
precision = specifier.precision,
type = specifier.type;
// Compute the prefix and suffix.
// For SI-prefix, the suffix is lazily computed.
var prefix = symbol === "$" ? currency[0] : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "",
suffix = symbol === "$" ? currency[1] : /[%p]/.test(type) ? "%" : "";
// What format function should we use?
// Is this an integer type?
// Can this type generate exponential notation?
var formatType = formatTypes[type],
maybeSuffix = !type || /[defgprs%]/.test(type);
// Set the default precision if not specified,
// or clamp the specified precision to the supported range.
// For significant precision, it must be in [1, 21].
// For fixed precision, it must be in [0, 20].
precision = precision == null ? (type ? 6 : 12)
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))
: Math.max(0, Math.min(20, precision));
function format(value) {
var valuePrefix = prefix,
valueSuffix = suffix,
i, n, c;
if (type === "c") {
valueSuffix = formatType(value) + valueSuffix;
value = "";
} else {
value = +value;
// Perform the initial formatting.
var valueNegative = value < 0;
value = formatType(Math.abs(value), precision);
// If a negative value rounds to zero during formatting, treat as positive.
if (valueNegative && +value === 0) valueNegative = false;
// Compute the prefix and suffix.
valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
valueSuffix = valueSuffix + (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + (valueNegative && sign === "(" ? ")" : "");
// Break the formatted value into the integer “value” part that can be
// grouped, and fractional or exponential “suffix” part that is not.
if (maybeSuffix) {
i = -1, n = value.length;
while (++i < n) {
if (c = value.charCodeAt(i), 48 > c || c > 57) {
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;
value = value.slice(0, i);
break;
}
}
}
}
// If the fill character is not "0", grouping is applied before padding.
if (comma && !zero) value = group(value, Infinity);
// Compute the padding.
var length = valuePrefix.length + value.length + valueSuffix.length,
padding = length < width ? new Array(width - length + 1).join(fill) : "";
// If the fill character is "0", grouping is applied after padding.
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
// Reconstruct the final output based on the desired alignment.
switch (align) {
case "<": value = valuePrefix + value + valueSuffix + padding; break;
case "=": value = valuePrefix + padding + value + valueSuffix; break;
case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;
default: value = padding + valuePrefix + value + valueSuffix; break;
}
return numerals(value);
}
format.toString = function() {
return specifier + "";
};
return format;
}
function formatPrefix(specifier, value) {
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)),
e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,
k = Math.pow(10, -e),
prefix = prefixes[8 + e / 3];
return function(value) {
return f(k * value) + prefix;
};
}
return {
format: newFormat,
formatPrefix: formatPrefix
};
}
var locale$1;
var d3_format;
var formatPrefix;
defaultLocale$1({
decimal: ".",
thousands: ",",
grouping: [3],
currency: ["$", ""]
});
function defaultLocale$1(definition) {
locale$1 = formatLocale$1(definition);
d3_format = locale$1.format;
formatPrefix = locale$1.formatPrefix;
return locale$1;
}
function precisionFixed(step) {
return Math.max(0, -exponent(Math.abs(step)));
}
function precisionPrefix(step, value) {
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));
}
function precisionRound(step, max) {
step = Math.abs(step), max = Math.abs(max) - step;
return Math.max(0, exponent(max) - exponent(step)) + 1;
}
function tickFormat(domain, count, specifier) {
var start = domain[0],
stop = domain[domain.length - 1],
step = tickStep(start, stop, count == null ? 10 : count),
precision;
specifier = formatSpecifier(specifier == null ? ",f" : specifier);
switch (specifier.type) {
case "s": {
var value = Math.max(Math.abs(start), Math.abs(stop));
if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;
return formatPrefix(specifier, value);
}
case "":
case "e":
case "g":
case "p":
case "r": {
if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
break;
}
case "f":
case "%": {
if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
break;
}
}
return d3_format(specifier);
}
function linearish(scale) {
var domain = scale.domain;
scale.ticks = function(count) {
var d = domain();
return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
};
scale.tickFormat = function(count, specifier) {
return tickFormat(domain(), count, specifier);
};
scale.nice = function(count) {
var d = domain(),
i = d.length - 1,
n = count == null ? 10 : count,
start = d[0],
stop = d[i],
step = tickStep(start, stop, n);
if (step) {
step = tickStep(Math.floor(start / step) * step, Math.ceil(stop / step) * step, n);
d[0] = Math.floor(start / step) * step;
d[i] = Math.ceil(stop / step) * step;
domain(d);
}
return scale;
};
return scale;
}
function linear() {
var scale = continuous(deinterpolate, interpolateNumber);
scale.copy = function() {
return copy$1(scale, linear());
};
return linearish(scale);
}
function identity$3() {
var domain = [0, 1];
function scale(x) {
return +x;
}
scale.invert = scale;
scale.domain = scale.range = function(_) {
return arguments.length ? (domain = map$2.call(_, number$2), scale) : domain.slice();
};
scale.copy = function() {
return identity$3().domain(domain);
};
return linearish(scale);
}
function nice(domain, interval) {
domain = domain.slice();
var i0 = 0,
i1 = domain.length - 1,
x0 = domain[i0],
x1 = domain[i1],
t;
if (x1 < x0) {
t = i0, i0 = i1, i1 = t;
t = x0, x0 = x1, x1 = t;
}
domain[i0] = interval.floor(x0);
domain[i1] = interval.ceil(x1);
return domain;
}
function deinterpolate$1(a, b) {
return (b = Math.log(b / a))
? function(x) { return Math.log(x / a) / b; }
: constant$5(b);
}
function reinterpolate(a, b) {
return a < 0
? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); }
: function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); };
}
function pow10(x) {
return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x;
}
function powp(base) {
return base === 10 ? pow10
: base === Math.E ? Math.exp
: function(x) { return Math.pow(base, x); };
}
function logp(base) {
return base === Math.E ? Math.log
: base === 10 && Math.log10
|| base === 2 && Math.log2
|| (base = Math.log(base), function(x) { return Math.log(x) / base; });
}
function reflect(f) {
return function(x) {
return -f(-x);
};
}
function log$1() {
var scale = continuous(deinterpolate$1, reinterpolate).domain([1, 10]),
domain = scale.domain,
base = 10,
logs = logp(10),
pows = powp(10);
function rescale() {
logs = logp(base), pows = powp(base);
if (domain()[0] < 0) logs = reflect(logs), pows = reflect(pows);
return scale;
}
scale.base = function(_) {
return arguments.length ? (base = +_, rescale()) : base;
};
scale.domain = function(_) {
return arguments.length ? (domain(_), rescale()) : domain();
};
scale.ticks = function(count) {
var d = domain(),
u = d[0],
v = d[d.length - 1],
r;
if (r = v < u) i = u, u = v, v = i;
var i = logs(u),
j = logs(v),
p,
k,
t,
n = count == null ? 10 : +count,
z = [];
if (!(base % 1) && j - i < n) {
i = Math.round(i) - 1, j = Math.round(j) + 1;
if (u > 0) for (; i < j; ++i) {
for (k = 1, p = pows(i); k < base; ++k) {
t = p * k;
if (t < u) continue;
if (t > v) break;
z.push(t);
}
} else for (; i < j; ++i) {
for (k = base - 1, p = pows(i); k >= 1; --k) {
t = p * k;
if (t < u) continue;
if (t > v) break;
z.push(t);
}
}
} else {
z = ticks(i, j, Math.min(j - i, n)).map(pows);
}
return r ? z.reverse() : z;
};
scale.tickFormat = function(count, specifier) {
if (specifier == null) specifier = base === 10 ? ".0e" : ",";
if (typeof specifier !== "function") specifier = d3_format(specifier);
if (count === Infinity) return specifier;
if (count == null) count = 10;
var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
return function(d) {
var i = d / pows(Math.round(logs(d)));
if (i * base < base - 0.5) i *= base;
return i <= k ? specifier(d) : "";
};
};
scale.nice = function() {
return domain(nice(domain(), {
floor: function(x) { return pows(Math.floor(logs(x))); },
ceil: function(x) { return pows(Math.ceil(logs(x))); }
}));
};
scale.copy = function() {
return copy$1(scale, log$1().base(base));
};
return scale;
}
function raise(x, exponent) {
return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
}
function pow() {
var exponent = 1,
scale = continuous(deinterpolate, reinterpolate),
domain = scale.domain;
function deinterpolate(a, b) {
return (b = raise(b, exponent) - (a = raise(a, exponent)))
? function(x) { return (raise(x, exponent) - a) / b; }
: constant$5(b);
}
function reinterpolate(a, b) {
b = raise(b, exponent) - (a = raise(a, exponent));
return function(t) { return raise(a + b * t, 1 / exponent); };
}
scale.exponent = function(_) {
return arguments.length ? (exponent = +_, domain(domain())) : exponent;
};
scale.copy = function() {
return copy$1(scale, pow().exponent(exponent));
};
return linearish(scale);
}
function sqrt$1() {
return pow().exponent(0.5);
}
function quantile() {
var domain = [],
range = [],
thresholds = [];
function rescale() {
var i = 0, n = Math.max(1, range.length);
thresholds = new Array(n - 1);
while (++i < n) thresholds[i - 1] = threshold(domain, i / n);
return scale;
}
function scale(x) {
if (!isNaN(x = +x)) return range[bisectRight(thresholds, x)];
}
scale.invertExtent = function(y) {
var i = range.indexOf(y);
return i < 0 ? [NaN, NaN] : [
i > 0 ? thresholds[i - 1] : domain[0],
i < thresholds.length ? thresholds[i] : domain[domain.length - 1]
];
};
scale.domain = function(_) {
if (!arguments.length) return domain.slice();
domain = [];
for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);
domain.sort(ascending);
return rescale();
};
scale.range = function(_) {
return arguments.length ? (range = slice$2.call(_), rescale()) : range.slice();
};
scale.quantiles = function() {
return thresholds.slice();
};
scale.copy = function() {
return quantile()
.domain(domain)
.range(range);
};
return scale;
}
function quantize$1() {
var x0 = 0,
x1 = 1,
n = 1,
domain = [0.5],
range = [0, 1];
function scale(x) {
if (x <= x) return range[bisectRight(domain, x, 0, n)];
}
function rescale() {
var i = -1;
domain = new Array(n);
while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
return scale;
}
scale.domain = function(_) {
return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1];
};
scale.range = function(_) {
return arguments.length ? (n = (range = slice$2.call(_)).length - 1, rescale()) : range.slice();
};
scale.invertExtent = function(y) {
var i = range.indexOf(y);
return i < 0 ? [NaN, NaN]
: i < 1 ? [x0, domain[0]]
: i >= n ? [domain[n - 1], x1]
: [domain[i - 1], domain[i]];
};
scale.copy = function() {
return quantize$1()
.domain([x0, x1])
.range(range);
};
return linearish(scale);
}
function threshold$1() {
var domain = [0.5],
range = [0, 1],
n = 1;
function scale(x) {
if (x <= x) return range[bisectRight(domain, x, 0, n)];
}
scale.domain = function(_) {
return arguments.length ? (domain = slice$2.call(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();
};
scale.range = function(_) {
return arguments.length ? (range = slice$2.call(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();
};
scale.invertExtent = function(y) {
var i = range.indexOf(y);
return [domain[i - 1], domain[i]];
};
scale.copy = function() {
return threshold$1()
.domain(domain)
.range(range);
};
return scale;
}
var durationSecond$1 = 1000;
var durationMinute$1 = durationSecond$1 * 60;
var durationHour$1 = durationMinute$1 * 60;
var durationDay$1 = durationHour$1 * 24;
var durationWeek$1 = durationDay$1 * 7;
var durationMonth = durationDay$1 * 30;
var durationYear = durationDay$1 * 365;
function date(t) {
return new Date(t);
}
function number$3(t) {
return t instanceof Date ? +t : +new Date(+t);
}
function calendar(year, month, week, day, hour, minute, second, millisecond, format) {
var scale = continuous(deinterpolate, interpolateNumber),
invert = scale.invert,
domain = scale.domain;
var formatMillisecond = format(".%L"),
formatSecond = format(":%S"),
formatMinute = format("%I:%M"),
formatHour = format("%I %p"),
formatDay = format("%a %d"),
formatWeek = format("%b %d"),
formatMonth = format("%B"),
formatYear = format("%Y");
var tickIntervals = [
[second, 1, durationSecond$1],
[second, 5, 5 * durationSecond$1],
[second, 15, 15 * durationSecond$1],
[second, 30, 30 * durationSecond$1],
[minute, 1, durationMinute$1],
[minute, 5, 5 * durationMinute$1],
[minute, 15, 15 * durationMinute$1],
[minute, 30, 30 * durationMinute$1],
[ hour, 1, durationHour$1 ],
[ hour, 3, 3 * durationHour$1 ],
[ hour, 6, 6 * durationHour$1 ],
[ hour, 12, 12 * durationHour$1 ],
[ day, 1, durationDay$1 ],
[ day, 2, 2 * durationDay$1 ],
[ week, 1, durationWeek$1 ],
[ month, 1, durationMonth ],
[ month, 3, 3 * durationMonth ],
[ year, 1, durationYear ]
];
function tickFormat(date) {
return (second(date) < date ? formatMillisecond
: minute(date) < date ? formatSecond
: hour(date) < date ? formatMinute
: day(date) < date ? formatHour
: month(date) < date ? (week(date) < date ? formatDay : formatWeek)
: year(date) < date ? formatMonth
: formatYear)(date);
}
function tickInterval(interval, start, stop, step) {
if (interval == null) interval = 10;
// If a desired tick count is specified, pick a reasonable tick interval
// based on the extent of the domain and a rough estimate of tick size.
// Otherwise, assume interval is already a time interval and use it.
if (typeof interval === "number") {
var target = Math.abs(stop - start) / interval,
i = bisector(function(i) { return i[2]; }).right(tickIntervals, target);
if (i === tickIntervals.length) {
step = tickStep(start / durationYear, stop / durationYear, interval);
interval = year;
} else if (i) {
i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
step = i[1];
interval = i[0];
} else {
step = tickStep(start, stop, interval);
interval = millisecond;
}
}
return step == null ? interval : interval.every(step);
}
scale.invert = function(y) {
return new Date(invert(y));
};
scale.domain = function(_) {
return arguments.length ? domain(map$2.call(_, number$3)) : domain().map(date);
};
scale.ticks = function(interval, step) {
var d = domain(),
t0 = d[0],
t1 = d[d.length - 1],
r = t1 < t0,
t;
if (r) t = t0, t0 = t1, t1 = t;
t = tickInterval(interval, t0, t1, step);
t = t ? t.range(t0, t1 + 1) : []; // inclusive stop
return r ? t.reverse() : t;
};
scale.tickFormat = function(count, specifier) {
return specifier == null ? tickFormat : format(specifier);
};
scale.nice = function(interval, step) {
var d = domain();
return (interval = tickInterval(interval, d[0], d[d.length - 1], step))
? domain(nice(d, interval))
: scale;
};
scale.copy = function() {
return copy$1(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format));
};
return scale;
}
function scaleTime() {
return calendar(year, month, timeWeek, day, hour, minute, second, millisecond, d3_timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]);
}
function scaleUtc() {
return calendar(utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, second, millisecond, d3_utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]);
}
function colors(s) {
return s.match(/.{6}/g).map(function(x) {
return "#" + x;
});
}
var schemeCategory10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
var schemeCategory20b = colors("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6");
var schemeCategory20c = colors("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9");
var schemeCategory20 = colors("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5");
interpolateCubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0));
var warm = interpolateCubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));
var cool = interpolateCubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));
var rainbow = cubehelix();
function ramp(range) {
var n = range.length;
return function(t) {
return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
};
}
var interpolateViridis = ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));
var interpolateMagma = ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));
var interpolateInferno = ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));
var interpolatePlasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
function band() {
var scale = ordinal().unknown(undefined),
domain = scale.domain,
ordinalRange = scale.range,
range = [0, 1],
step,
bandwidth,
round = false,
paddingInner = 0,
paddingOuter = 0,
align = 0.5;
delete scale.unknown;
function rescale() {
var n = domain().length,
reverse = range[1] < range[0],
start = range[reverse - 0],
stop = range[1 - reverse],
space = bandSpace(n, paddingInner, paddingOuter);
step = (stop - start) / (space || 1);
if (round) step = Math.floor(step);
start += (stop - start - step * (n - paddingInner)) * align;
bandwidth = step * (1 - paddingInner);
if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
var values = sequence(n).map(function(i) { return start + step * i; });
return ordinalRange(reverse ? values.reverse() : values);
}
scale.domain = function(_) {
return arguments.length ? (domain(_), rescale()) : domain();
};
scale.range = function(_) {
return arguments.length ? (range = [+_[0], +_[1]], rescale()) : range.slice();
};
scale.rangeRound = function(_) {
return range = [+_[0], +_[1]], round = true, rescale();
};
scale.bandwidth = function() {
return bandwidth;
};
scale.step = function() {
return step;
};
scale.round = function(_) {
return arguments.length ? (round = !!_, rescale()) : round;
};
scale.padding = function(_) {
return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;
};
scale.paddingInner = function(_) {
return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;
};
scale.paddingOuter = function(_) {
return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter;
};
scale.align = function(_) {
return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
};
scale.invertRange = function(_) {
var lo = +_[0],
hi = +_[1],
reverse = range[1] < range[0],
values = reverse ? ordinalRange().reverse() : ordinalRange(),
n = values.length - 1, a, b, t;
// order range inputs, bail if outside of scale range
if (hi < lo) t = lo, lo = hi, hi = t;
if (hi < values[0] || lo > range[1-reverse]) return undefined;
// binary search to index into scale range
a = Math.max(0, bisectRight(values, lo) - 1);
b = lo===hi ? a : bisectRight(values, hi) - 1;
// increment index a if lo is within padding gap
if (lo - values[a] > bandwidth + 1e-10) ++a;
if (reverse) t = a, a = n - b, b = n - t; // map + swap
return (a > b) ? undefined : domain().slice(a, b+1);
};
scale.invert = function(_) {
var value = scale.invertRange([_, _]);
return value ? value[0] : value;
};
scale.copy = function() {
return band()
.domain(domain())
.range(range)
.round(round)
.paddingInner(paddingInner)
.paddingOuter(paddingOuter)
.align(align);
};
return rescale();
}
function pointish(scale) {
var copy = scale.copy;
scale.padding = scale.paddingOuter;
delete scale.paddingInner;
scale.copy = function() {
return pointish(copy());
};
return scale;
}
function point$5() {
return pointish(band().paddingInner(1));
}
var map$3 = Array.prototype.map;
var slice$3 = Array.prototype.slice;
function numbers$1(_) {
return map$3.call(_, function(x) { return +x; });
}
function binLinear() {
var linear$$ = linear(),
domain = [];
function scale(x) {
return x == null || x !== x
? undefined
: linear$$(domain[Math.max(bisectRight(domain, x), 1)-1]);
}
function setDomain(_) {
domain = numbers$1(_);
linear$$.domain([domain[0], peek(domain)]);
}
scale.domain = function(_) {
return arguments.length ? (setDomain(_), scale) : domain.slice();
};
scale.range = function(_) {
return arguments.length ? (linear$$.range(_), scale) : linear$$.range();
};
scale.rangeRound = function(_) {
return arguments.length ? (linear$$.rangeRound(_), scale) : linear$$.rangeRound();
};
scale.interpolate = function(_) {
return arguments.length ? (linear$$.interpolate(_), scale) : linear$$.interpolate();
};
scale.ticks = function(count) {
var n = domain.length,
stride = ~~(n / (count || n));
return stride < 2
? scale.domain()
: domain.filter(function(x, i) { return !(i % stride); });
};
scale.tickFormat = function() {
return linear$$.tickFormat.apply(linear$$, arguments);
};
scale.copy = function() {
return binLinear().domain(scale.domain()).range(scale.range());
};
return scale;
}
function binOrdinal() {
var domain = [],
range = [];
function scale(x) {
return x == null || x !== x
? undefined
: range[(bisectRight(domain, x) - 1) % range.length];
}
scale.domain = function(_) {
return arguments.length ? (domain = numbers$1(_), scale) : domain.slice();
};
scale.range = function(_) {
return arguments.length ? (range = slice$3.call(_), scale) : range.slice();
};
scale.copy = function() {
return binOrdinal().domain(scale.domain()).range(scale.range());
};
return scale;
}
function sequential$1(interpolator) {
var linear$$ = linear(),
x0 = 0,
dx = 1,
clamp = false;
function update() {
var domain = linear$$.domain();
x0 = domain[0];
dx = peek(domain) - x0;
}
function scale(x) {
var t = (x - x0) / dx;
return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t);
}
scale.clamp = function(_) {
return arguments.length ? (clamp = !!_, scale) : clamp;
};
scale.domain = function(_) {
return arguments.length ? (linear$$.domain(_), update(), scale) : linear$$.domain();
};
scale.interpolator = function(_) {
return arguments.length ? (interpolator = _, scale) : interpolator;
};
scale.copy = function() {
return sequential$1().domain(linear$$.domain()).clamp(clamp).interpolator(interpolator);
};
scale.ticks = function(count) {
return linear$$.ticks(count);
};
scale.tickFormat = function(count, specifier) {
return linear$$.tickFormat(count, specifier);
};
scale.nice = function(count) {
return linear$$.nice(count), update(), scale;
};
return scale;
}
/**
* Augment scales with their type and needed inverse methods.
*/
function create(type, constructor) {
return function scale() {
var s = constructor();
if (!s.invertRange) {
s.invertRange = s.invert ? invertRange(s)
: s.invertExtent ? invertRangeExtent(s)
: undefined;
}
return s.type = type, s;
};
}
function scale$1(type, scale) {
return arguments.length > 1 ? (scales[type] = create(type, scale), this)
: scales.hasOwnProperty(type) ? scales[type] : undefined;
}
var scales = {
// base scale types
identity: identity$3,
linear: linear,
log: log$1,
ordinal: ordinal,
pow: pow,
sqrt: sqrt$1,
quantile: quantile,
quantize: quantize$1,
threshold: threshold$1,
time: scaleTime,
utc: scaleUtc,
// extended scale types
band: band,
point: point$5,
sequential: sequential$1,
'bin-linear': binLinear,
'bin-ordinal': binOrdinal
};
for (var key$1 in scales) {
scale$1(key$1, scales[key$1]);
}
function colors$1(specifier) {
var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;
while (i < n) colors[i] = "#" + specifier.slice(i * 6, ++i * 6);
return colors;
}
var tableau10 = colors$1(
'4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac'
);
var tableau20 = colors$1(
'4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5'
);
var blueOrange = new Array(3).concat(
"67a9cff7f7f7f1a340",
"0571b092c5defdb863e66101",
"0571b092c5def7f7f7fdb863e66101",
"2166ac67a9cfd1e5f0fee0b6f1a340b35806",
"2166ac67a9cfd1e5f0f7f7f7fee0b6f1a340b35806",
"2166ac4393c392c5ded1e5f0fee0b6fdb863e08214b35806",
"2166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b35806",
"0530612166ac4393c392c5ded1e5f0fee0b6fdb863e08214b358067f3b08",
"0530612166ac4393c392c5ded1e5f0f7f7f7fee0b6fdb863e08214b358067f3b08"
).map(colors$1);
function colors$2(specifier) {
var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;
while (i < n) colors[i] = "#" + specifier.slice(i * 6, ++i * 6);
return colors;
}
var schemeAccent = colors$2("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");
var schemeDark2 = colors$2("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");
var schemePaired = colors$2("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");
var schemePastel1 = colors$2("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");
var schemePastel2 = colors$2("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");
var schemeSet1 = colors$2("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");
var schemeSet2 = colors$2("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");
var schemeSet3 = colors$2("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");
function ramp$1(scheme) {
return interpolateRgbBasis(scheme[scheme.length - 1]);
}
var scheme = new Array(3).concat(
"d8b365f5f5f55ab4ac",
"a6611adfc27d80cdc1018571",
"a6611adfc27df5f5f580cdc1018571",
"8c510ad8b365f6e8c3c7eae55ab4ac01665e",
"8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e",
"8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e",
"8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e",
"5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30",
"5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30"
).map(colors$2);
var interpolateBrBG = ramp$1(scheme);
var scheme$1 = new Array(3).concat(
"af8dc3f7f7f77fbf7b",
"7b3294c2a5cfa6dba0008837",
"7b3294c2a5cff7f7f7a6dba0008837",
"762a83af8dc3e7d4e8d9f0d37fbf7b1b7837",
"762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837",
"762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837",
"762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837",
"40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b",
"40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b"
).map(colors$2);
var interpolatePRGn = ramp$1(scheme$1);
var scheme$2 = new Array(3).concat(
"e9a3c9f7f7f7a1d76a",
"d01c8bf1b6dab8e1864dac26",
"d01c8bf1b6daf7f7f7b8e1864dac26",
"c51b7de9a3c9fde0efe6f5d0a1d76a4d9221",
"c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221",
"c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221",
"c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221",
"8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419",
"8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419"
).map(colors$2);
var interpolatePiYG = ramp$1(scheme$2);
var scheme$3 = new Array(3).concat(
"998ec3f7f7f7f1a340",
"5e3c99b2abd2fdb863e66101",
"5e3c99b2abd2f7f7f7fdb863e66101",
"542788998ec3d8daebfee0b6f1a340b35806",
"542788998ec3d8daebf7f7f7fee0b6f1a340b35806",
"5427888073acb2abd2d8daebfee0b6fdb863e08214b35806",
"5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806",
"2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08",
"2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08"
).map(colors$2);
var interpolatePuOr = ramp$1(scheme$3);
var scheme$4 = new Array(3).concat(
"ef8a62f7f7f767a9cf",
"ca0020f4a58292c5de0571b0",
"ca0020f4a582f7f7f792c5de0571b0",
"b2182bef8a62fddbc7d1e5f067a9cf2166ac",
"b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac",
"b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac",
"b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac",
"67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061",
"67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061"
).map(colors$2);
var interpolateRdBu = ramp$1(scheme$4);
var scheme$5 = new Array(3).concat(
"ef8a62ffffff999999",
"ca0020f4a582bababa404040",
"ca0020f4a582ffffffbababa404040",
"b2182bef8a62fddbc7e0e0e09999994d4d4d",
"b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d",
"b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d",
"b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d",
"67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a",
"67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a"
).map(colors$2);
var interpolateRdGy = ramp$1(scheme$5);
var scheme$6 = new Array(3).concat(
"fc8d59ffffbf91bfdb",
"d7191cfdae61abd9e92c7bb6",
"d7191cfdae61ffffbfabd9e92c7bb6",
"d73027fc8d59fee090e0f3f891bfdb4575b4",
"d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4",
"d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4",
"d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4",
"a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695",
"a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695"
).map(colors$2);
var interpolateRdYlBu = ramp$1(scheme$6);
var scheme$7 = new Array(3).concat(
"fc8d59ffffbf91cf60",
"d7191cfdae61a6d96a1a9641",
"d7191cfdae61ffffbfa6d96a1a9641",
"d73027fc8d59fee08bd9ef8b91cf601a9850",
"d73027fc8d59fee08bffffbfd9ef8b91cf601a9850",
"d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850",
"d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850",
"a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837",
"a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837"
).map(colors$2);
var interpolateRdYlGn = ramp$1(scheme$7);
var scheme$8 = new Array(3).concat(
"fc8d59ffffbf99d594",
"d7191cfdae61abdda42b83ba",
"d7191cfdae61ffffbfabdda42b83ba",
"d53e4ffc8d59fee08be6f59899d5943288bd",
"d53e4ffc8d59fee08bffffbfe6f59899d5943288bd",
"d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd",
"d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd",
"9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2",
"9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2"
).map(colors$2);
var interpolateSpectral = ramp$1(scheme$8);
var scheme$9 = new Array(3).concat(
"e5f5f999d8c92ca25f",
"edf8fbb2e2e266c2a4238b45",
"edf8fbb2e2e266c2a42ca25f006d2c",
"edf8fbccece699d8c966c2a42ca25f006d2c",
"edf8fbccece699d8c966c2a441ae76238b45005824",
"f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824",
"f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b"
).map(colors$2);
var interpolateBuGn = ramp$1(scheme$9);
var scheme$10 = new Array(3).concat(
"e0ecf49ebcda8856a7",
"edf8fbb3cde38c96c688419d",
"edf8fbb3cde38c96c68856a7810f7c",
"edf8fbbfd3e69ebcda8c96c68856a7810f7c",
"edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b",
"f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b",
"f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b"
).map(colors$2);
var interpolateBuPu = ramp$1(scheme$10);
var scheme$11 = new Array(3).concat(
"e0f3dba8ddb543a2ca",
"f0f9e8bae4bc7bccc42b8cbe",
"f0f9e8bae4bc7bccc443a2ca0868ac",
"f0f9e8ccebc5a8ddb57bccc443a2ca0868ac",
"f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e",
"f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e",
"f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081"
).map(colors$2);
var interpolateGnBu = ramp$1(scheme$11);
var scheme$12 = new Array(3).concat(
"fee8c8fdbb84e34a33",
"fef0d9fdcc8afc8d59d7301f",
"fef0d9fdcc8afc8d59e34a33b30000",
"fef0d9fdd49efdbb84fc8d59e34a33b30000",
"fef0d9fdd49efdbb84fc8d59ef6548d7301f990000",
"fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000",
"fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000"
).map(colors$2);
var interpolateOrRd = ramp$1(scheme$12);
var scheme$13 = new Array(3).concat(
"ece2f0a6bddb1c9099",
"f6eff7bdc9e167a9cf02818a",
"f6eff7bdc9e167a9cf1c9099016c59",
"f6eff7d0d1e6a6bddb67a9cf1c9099016c59",
"f6eff7d0d1e6a6bddb67a9cf3690c002818a016450",
"fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450",
"fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636"
).map(colors$2);
var interpolatePuBuGn = ramp$1(scheme$13);
var scheme$14 = new Array(3).concat(
"ece7f2a6bddb2b8cbe",
"f1eef6bdc9e174a9cf0570b0",
"f1eef6bdc9e174a9cf2b8cbe045a8d",
"f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d",
"f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b",
"fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b",
"fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858"
).map(colors$2);
var interpolatePuBu = ramp$1(scheme$14);
var scheme$15 = new Array(3).concat(
"e7e1efc994c7dd1c77",
"f1eef6d7b5d8df65b0ce1256",
"f1eef6d7b5d8df65b0dd1c77980043",
"f1eef6d4b9dac994c7df65b0dd1c77980043",
"f1eef6d4b9dac994c7df65b0e7298ace125691003f",
"f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f",
"f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f"
).map(colors$2);
var interpolatePuRd = ramp$1(scheme$15);
var scheme$16 = new Array(3).concat(
"fde0ddfa9fb5c51b8a",
"feebe2fbb4b9f768a1ae017e",
"feebe2fbb4b9f768a1c51b8a7a0177",
"feebe2fcc5c0fa9fb5f768a1c51b8a7a0177",
"feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177",
"fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177",
"fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a"
).map(colors$2);
var interpolateRdPu = ramp$1(scheme$16);
var scheme$17 = new Array(3).concat(
"edf8b17fcdbb2c7fb8",
"ffffcca1dab441b6c4225ea8",
"ffffcca1dab441b6c42c7fb8253494",
"ffffccc7e9b47fcdbb41b6c42c7fb8253494",
"ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84",
"ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84",
"ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58"
).map(colors$2);
var interpolateYlGnBu = ramp$1(scheme$17);
var scheme$18 = new Array(3).concat(
"f7fcb9addd8e31a354",
"ffffccc2e69978c679238443",
"ffffccc2e69978c67931a354006837",
"ffffccd9f0a3addd8e78c67931a354006837",
"ffffccd9f0a3addd8e78c67941ab5d238443005a32",
"ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32",
"ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529"
).map(colors$2);
var interpolateYlGn = ramp$1(scheme$18);
var scheme$19 = new Array(3).concat(
"fff7bcfec44fd95f0e",
"ffffd4fed98efe9929cc4c02",
"ffffd4fed98efe9929d95f0e993404",
"ffffd4fee391fec44ffe9929d95f0e993404",
"ffffd4fee391fec44ffe9929ec7014cc4c028c2d04",
"ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04",
"ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506"
).map(colors$2);
var interpolateYlOrBr = ramp$1(scheme$19);
var scheme$20 = new Array(3).concat(
"ffeda0feb24cf03b20",
"ffffb2fecc5cfd8d3ce31a1c",
"ffffb2fecc5cfd8d3cf03b20bd0026",
"ffffb2fed976feb24cfd8d3cf03b20bd0026",
"ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026",
"ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026",
"ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026"
).map(colors$2);
var interpolateYlOrRd = ramp$1(scheme$20);
var scheme$21 = new Array(3).concat(
"deebf79ecae13182bd",
"eff3ffbdd7e76baed62171b5",
"eff3ffbdd7e76baed63182bd08519c",
"eff3ffc6dbef9ecae16baed63182bd08519c",
"eff3ffc6dbef9ecae16baed64292c62171b5084594",
"f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594",
"f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b"
).map(colors$2);
var interpolateBlues = ramp$1(scheme$21);
var scheme$22 = new Array(3).concat(
"e5f5e0a1d99b31a354",
"edf8e9bae4b374c476238b45",
"edf8e9bae4b374c47631a354006d2c",
"edf8e9c7e9c0a1d99b74c47631a354006d2c",
"edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32",
"f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32",
"f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b"
).map(colors$2);
var interpolateGreens = ramp$1(scheme$22);
var scheme$23 = new Array(3).concat(
"f0f0f0bdbdbd636363",
"f7f7f7cccccc969696525252",
"f7f7f7cccccc969696636363252525",
"f7f7f7d9d9d9bdbdbd969696636363252525",
"f7f7f7d9d9d9bdbdbd969696737373525252252525",
"fffffff0f0f0d9d9d9bdbdbd969696737373525252252525",
"fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000"
).map(colors$2);
var interpolateGreys = ramp$1(scheme$23);
var scheme$24 = new Array(3).concat(
"efedf5bcbddc756bb1",
"f2f0f7cbc9e29e9ac86a51a3",
"f2f0f7cbc9e29e9ac8756bb154278f",
"f2f0f7dadaebbcbddc9e9ac8756bb154278f",
"f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486",
"fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486",
"fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d"
).map(colors$2);
var interpolatePurples = ramp$1(scheme$24);
var scheme$25 = new Array(3).concat(
"fee0d2fc9272de2d26",
"fee5d9fcae91fb6a4acb181d",
"fee5d9fcae91fb6a4ade2d26a50f15",
"fee5d9fcbba1fc9272fb6a4ade2d26a50f15",
"fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d",
"fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d",
"fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d"
).map(colors$2);
var interpolateReds = ramp$1(scheme$25);
var scheme$26 = new Array(3).concat(
"fee6cefdae6be6550d",
"feeddefdbe85fd8d3cd94701",
"feeddefdbe85fd8d3ce6550da63603",
"feeddefdd0a2fdae6bfd8d3ce6550da63603",
"feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04",
"fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04",
"fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704"
).map(colors$2);
var interpolateOranges = ramp$1(scheme$26);
var _ = Object.freeze({
schemeAccent: schemeAccent,
schemeDark2: schemeDark2,
schemePaired: schemePaired,
schemePastel1: schemePastel1,
schemePastel2: schemePastel2,
schemeSet1: schemeSet1,
schemeSet2: schemeSet2,
schemeSet3: schemeSet3,
interpolateBrBG: interpolateBrBG,
schemeBrBG: scheme,
interpolatePRGn: interpolatePRGn,
schemePRGn: scheme$1,
interpolatePiYG: interpolatePiYG,
schemePiYG: scheme$2,
interpolatePuOr: interpolatePuOr,
schemePuOr: scheme$3,
interpolateRdBu: interpolateRdBu,
schemeRdBu: scheme$4,
interpolateRdGy: interpolateRdGy,
schemeRdGy: scheme$5,
interpolateRdYlBu: interpolateRdYlBu,
schemeRdYlBu: scheme$6,
interpolateRdYlGn: interpolateRdYlGn,
schemeRdYlGn: scheme$7,
interpolateSpectral: interpolateSpectral,
schemeSpectral: scheme$8,
interpolateBuGn: interpolateBuGn,
schemeBuGn: scheme$9,
interpolateBuPu: interpolateBuPu,
schemeBuPu: scheme$10,
interpolateGnBu: interpolateGnBu,
schemeGnBu: scheme$11,
interpolateOrRd: interpolateOrRd,
schemeOrRd: scheme$12,
interpolatePuBuGn: interpolatePuBuGn,
schemePuBuGn: scheme$13,
interpolatePuBu: interpolatePuBu,
schemePuBu: scheme$14,
interpolatePuRd: interpolatePuRd,
schemePuRd: scheme$15,
interpolateRdPu: interpolateRdPu,
schemeRdPu: scheme$16,
interpolateYlGnBu: interpolateYlGnBu,
schemeYlGnBu: scheme$17,
interpolateYlGn: interpolateYlGn,
schemeYlGn: scheme$18,
interpolateYlOrBr: interpolateYlOrBr,
schemeYlOrBr: scheme$19,
interpolateYlOrRd: interpolateYlOrRd,
schemeYlOrRd: scheme$20,
interpolateBlues: interpolateBlues,
schemeBlues: scheme$21,
interpolateGreens: interpolateGreens,
schemeGreens: scheme$22,
interpolateGreys: interpolateGreys,
schemeGreys: scheme$23,
interpolatePurples: interpolatePurples,
schemePurples: scheme$24,
interpolateReds: interpolateReds,
schemeReds: scheme$25,
interpolateOranges: interpolateOranges,
schemeOranges: scheme$26
});
var discrete = {
blueorange: blueOrange
};
var schemes = {
// d3 built-in categorical palettes
category10: schemeCategory10,
category20: schemeCategory20,
category20b: schemeCategory20b,
category20c: schemeCategory20c,
// extended categorical palettes
accent: schemeAccent,
dark2: schemeDark2,
paired: schemePaired,
pastel1: schemePastel1,
pastel2: schemePastel2,
set1: schemeSet1,
set2: schemeSet2,
set3: schemeSet3,
tableau10: tableau10,
tableau20: tableau20,
// d3 built-in interpolators
viridis: interpolateViridis,
magma: interpolateMagma,
inferno: interpolateInferno,
plasma: interpolatePlasma,
// extended interpolators
blueorange: interpolateRgbBasis(peek(blueOrange))
};
function add$2(name, suffix) {
schemes[name] = _['interpolate' + suffix];
discrete[name] = _['scheme' + suffix];
}
// sequential single-hue
add$2('blues', 'Blues');
add$2('greens', 'Greens');
add$2('greys', 'Greys');
add$2('purples', 'Purples');
add$2('reds', 'Reds');
add$2('oranges', 'Oranges');
// diverging
add$2('brownbluegreen', 'BrBG');
add$2('purplegreen', 'PRGn');
add$2('pinkyellowgreen', 'PiYG');
add$2('purpleorange', 'PuOr');
add$2('redblue', 'RdBu');
add$2('redgrey', 'RdGy');
add$2('redyellowblue', 'RdYlBu');
add$2('redyellowgreen', 'RdYlGn');
add$2('spectral', 'Spectral');
// sequential multi-hue
add$2('bluegreen', 'BuGn');
add$2('bluepurple', 'BuPu');
add$2('greenblue', 'GnBu');
add$2('orangered', 'OrRd');
add$2('purplebluegreen', 'PuBuGn');
add$2('purpleblue', 'PuBu');
add$2('purplered', 'PuRd');
add$2('redpurple', 'RdPu');
add$2('yellowgreenblue', 'YlGnBu');
add$2('yellowgreen', 'YlGn');
add$2('yelloworangebrown', 'YlOrBr');
add$2('yelloworangered', 'YlOrRd');
function getScheme(name, scheme) {
if (arguments.length > 1) return (schemes[name] = scheme, this);
var part = name.split('-');
name = part[0];
part = +part[1] + 1;
return part && discrete.hasOwnProperty(name) ? discrete[name][part-1]
: !part && schemes.hasOwnProperty(name) ? schemes[name]
: undefined;
}
function interpolateRange(interpolator, range) {
var start = range[0],
span = peek(range) - start;
return function(i) { return interpolator(start + i * span); };
}
function scaleFraction(scale, min, max) {
return scale.type === 'linear' || scale.type === 'sequential'
? function(_) { return (_ - min) / (max - min); }
: scale.copy().domain([min, max]).range([0, 1]).interpolate(lerp);
}
function lerp(a, b) {
var span = b - a;
return function(i) { return a + i * span; }
}
function getInterpolate(type, gamma) {
var interp = $$1[method(type)];
return (gamma != null && interp && interp.gamma)
? interp.gamma(gamma)
: interp;
}
function method(type) {
return 'interpolate' + type.toLowerCase()
.split('-')
.map(function(s) { return s[0].toUpperCase() + s.slice(1); })
.join('');
}
/**
* Map GeoJSON data to an SVG path string.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(number, number): *} params.projection - The cartographic
* projection to apply.
* @param {function(object): *} [params.field] - The field with GeoJSON data,
* or null if the tuple itself is a GeoJSON feature.
* @param {string} [params.as='path'] - The output field in which to store
* the generated path data (default 'path').
*/
function GeoPath(params) {
Transform.call(this, null, params);
}
var prototype$43 = inherits(GeoPath, Transform);
prototype$43.transform = function(_, pulse) {
var out = pulse.fork(pulse.ALL),
path = this.value,
field = _.field || identity$1,
as = _.as || 'path',
mod;
function set(t) { t[as] = path(field(t)); }
if (!path || _.modified()) {
// parameters updated, reset and reflow
this.value = path = _.projection.path;
out.materialize().reflow().visit(out.SOURCE, set);
} else {
mod = field === identity$1 || pulse.modified(field.fields);
out.visit(mod ? out.ADD_MOD : out.ADD, set);
}
return out.modifies(as);
};
/**
* Geo-code a longitude/latitude point to an x/y coordinate.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(number, number): *} params.projection - The cartographic
* projection to apply.
* @param {Array<function(object): *>} params.fields - A two-element array of
* field accessors for the longitude and latitude values.
* @param {Array<string>} [params.as] - A two-element array of field names
* under which to store the result. Defaults to ['x','y'].
*/
function GeoPoint(params) {
Transform.call(this, null, params);
}
var prototype$44 = inherits(GeoPoint, Transform);
prototype$44.transform = function(_, pulse) {
var proj = _.projection,
lon = _.fields[0],
lat = _.fields[1],
as = _.as || ['x', 'y'],
x = as[0],
y = as[1],
mod;
function set(t) {
var xy = proj([lon(t), lat(t)]);
if (xy) t[x] = xy[0], t[y] = xy[1];
else t[x] = undefined, t[y] = undefined;
}
if (_.modified()) {
// parameters updated, reflow
pulse.materialize().reflow(true).visit(pulse.SOURCE, set);
} else {
mod = pulse.modified(lon.fields) || pulse.modified(lat.fields);
pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set);
}
return pulse.modifies(as);
};
/**
* Annotate items with a geopath shape generator.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(number, number): *} params.projection - The cartographic
* projection to apply.
* @param {function(object): *} [params.field] - The field with GeoJSON data,
* or null if the tuple itself is a GeoJSON feature.
* @param {string} [params.as='path'] - The output field in which to store
* the generated path data (default 'path').
*/
function GeoShape(params) {
Transform.call(this, null, params);
}
var prototype$45 = inherits(GeoShape, Transform);
prototype$45.transform = function(_, pulse) {
var out = pulse.fork(pulse.ALL),
shape = this.value,
datum = _.field || field('datum'),
as = _.as || 'shape',
flag = out.ADD_MOD;
if (!shape || _.modified()) {
// parameters updated, reset and reflow
this.value = shape = shapeGenerator(_.projection.path, datum);
out.materialize().reflow();
flag = out.SOURCE;
}
out.visit(flag, function(t) { t[as] = shape; });
return out.modifies(as);
};
function shapeGenerator(path, field) {
var shape = function(_) { return path(field(_)); };
shape.context = function(_) { return path.context(_), shape; };
return shape;
}
// Adds floating point numbers with twice the normal precision.
// Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and
// Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3)
// 305–363 (1997).
// Code adapted from GeographicLib by Charles F. F. Karney,
// http://geographiclib.sourceforge.net/
function adder() {
return new Adder;
}
function Adder() {
this.reset();
}
Adder.prototype = {
constructor: Adder,
reset: function() {
this.s = // rounded value
this.t = 0; // exact error
},
add: function(y) {
add$3(temp$1, y, this.t);
add$3(this, temp$1.s, this.s);
if (this.s) this.t += temp$1.t;
else this.s = temp$1.t;
},
valueOf: function() {
return this.s;
}
};
var temp$1 = new Adder;
function add$3(adder, a, b) {
var x = adder.s = a + b,
bv = x - a,
av = x - bv;
adder.t = (a - av) + (b - bv);
}
var epsilon$2 = 1e-6;
var pi$3 = Math.PI;
var halfPi$2 = pi$3 / 2;
var quarterPi = pi$3 / 4;
var tau$4 = pi$3 * 2;
var degrees$1 = 180 / pi$3;
var radians = pi$3 / 180;
var abs$1 = Math.abs;
var atan = Math.atan;
var atan2$1 = Math.atan2;
var cos$1 = Math.cos;
var ceil = Math.ceil;
var exp = Math.exp;
var log$2 = Math.log;
var pow$1 = Math.pow;
var sin$1 = Math.sin;
var sign$1 = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; };
var sqrt$2 = Math.sqrt;
var tan = Math.tan;
function acos$1(x) {
return x > 1 ? 0 : x < -1 ? pi$3 : Math.acos(x);
}
function asin$1(x) {
return x > 1 ? halfPi$2 : x < -1 ? -halfPi$2 : Math.asin(x);
}
function noop$4() {}
function streamGeometry(geometry, stream) {
if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
streamGeometryType[geometry.type](geometry, stream);
}
}
var streamObjectType = {
Feature: function(object, stream) {
streamGeometry(object.geometry, stream);
},
FeatureCollection: function(object, stream) {
var features = object.features, i = -1, n = features.length;
while (++i < n) streamGeometry(features[i].geometry, stream);
}
};
var streamGeometryType = {
Sphere: function(object, stream) {
stream.sphere();
},
Point: function(object, stream) {
object = object.coordinates;
stream.point(object[0], object[1], object[2]);
},
MultiPoint: function(object, stream) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]);
},
LineString: function(object, stream) {
streamLine(object.coordinates, stream, 0);
},
MultiLineString: function(object, stream) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) streamLine(coordinates[i], stream, 0);
},
Polygon: function(object, stream) {
streamPolygon(object.coordinates, stream);
},
MultiPolygon: function(object, stream) {
var coordinates = object.coordinates, i = -1, n = coordinates.length;
while (++i < n) streamPolygon(coordinates[i], stream);
},
GeometryCollection: function(object, stream) {
var geometries = object.geometries, i = -1, n = geometries.length;
while (++i < n) streamGeometry(geometries[i], stream);
}
};
function streamLine(coordinates, stream, closed) {
var i = -1, n = coordinates.length - closed, coordinate;
stream.lineStart();
while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);
stream.lineEnd();
}
function streamPolygon(coordinates, stream) {
var i = -1, n = coordinates.length;
stream.polygonStart();
while (++i < n) streamLine(coordinates[i], stream, 1);
stream.polygonEnd();
}
function geoStream(object, stream) {
if (object && streamObjectType.hasOwnProperty(object.type)) {
streamObjectType[object.type](object, stream);
} else {
streamGeometry(object, stream);
}
}
var areaRingSum = adder();
var areaSum = adder();
var lambda00;
var phi00;
var lambda0;
var cosPhi0;
var sinPhi0;
var areaStream = {
point: noop$4,
lineStart: noop$4,
lineEnd: noop$4,
polygonStart: function() {
areaRingSum.reset();
areaStream.lineStart = areaRingStart;
areaStream.lineEnd = areaRingEnd;
},
polygonEnd: function() {
var areaRing = +areaRingSum;
areaSum.add(areaRing < 0 ? tau$4 + areaRing : areaRing);
this.lineStart = this.lineEnd = this.point = noop$4;
},
sphere: function() {
areaSum.add(tau$4);
}
};
function areaRingStart() {
areaStream.point = areaPointFirst;
}
function areaRingEnd() {
areaPoint(lambda00, phi00);
}
function areaPointFirst(lambda, phi) {
areaStream.point = areaPoint;
lambda00 = lambda, phi00 = phi;
lambda *= radians, phi *= radians;
lambda0 = lambda, cosPhi0 = cos$1(phi = phi / 2 + quarterPi), sinPhi0 = sin$1(phi);
}
function areaPoint(lambda, phi) {
lambda *= radians, phi *= radians;
phi = phi / 2 + quarterPi; // half the angular distance from south pole
// Spherical excess E for a spherical triangle with vertices: south pole,
// previous point, current point. Uses a formula derived from Cagnoli’s
// theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2).
var dLambda = lambda - lambda0,
sdLambda = dLambda >= 0 ? 1 : -1,
adLambda = sdLambda * dLambda,
cosPhi = cos$1(phi),
sinPhi = sin$1(phi),
k = sinPhi0 * sinPhi,
u = cosPhi0 * cosPhi + k * cos$1(adLambda),
v = k * sdLambda * sin$1(adLambda);
areaRingSum.add(atan2$1(v, u));
// Advance the previous points.
lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
}
function spherical(cartesian) {
return [atan2$1(cartesian[1], cartesian[0]), asin$1(cartesian[2])];
}
function cartesian(spherical) {
var lambda = spherical[0], phi = spherical[1], cosPhi = cos$1(phi);
return [cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi)];
}
function cartesianDot(a, b) {
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}
function cartesianCross(a, b) {
return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
}
// TODO return a
function cartesianAddInPlace(a, b) {
a[0] += b[0], a[1] += b[1], a[2] += b[2];
}
function cartesianScale(vector, k) {
return [vector[0] * k, vector[1] * k, vector[2] * k];
}
// TODO return d
function cartesianNormalizeInPlace(d) {
var l = sqrt$2(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
d[0] /= l, d[1] /= l, d[2] /= l;
}
var lambda0$1;
var phi0;
var lambda1;
var phi1;
var lambda2;
var lambda00$1;
var phi00$1;
var p0;
var deltaSum = adder();
var ranges;
var range;
var boundsStream = {
point: boundsPoint,
lineStart: boundsLineStart,
lineEnd: boundsLineEnd,
polygonStart: function() {
boundsStream.point = boundsRingPoint;
boundsStream.lineStart = boundsRingStart;
boundsStream.lineEnd = boundsRingEnd;
deltaSum.reset();
areaStream.polygonStart();
},
polygonEnd: function() {
areaStream.polygonEnd();
boundsStream.point = boundsPoint;
boundsStream.lineStart = boundsLineStart;
boundsStream.lineEnd = boundsLineEnd;
if (areaRingSum < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90);
else if (deltaSum > epsilon$2) phi1 = 90;
else if (deltaSum < -epsilon$2) phi0 = -90;
range[0] = lambda0$1, range[1] = lambda1;
}
};
function boundsPoint(lambda, phi) {
ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]);
if (phi < phi0) phi0 = phi;
if (phi > phi1) phi1 = phi;
}
function linePoint(lambda, phi) {
var p = cartesian([lambda * radians, phi * radians]);
if (p0) {
var normal = cartesianCross(p0, p),
equatorial = [normal[1], -normal[0], 0],
inflection = cartesianCross(equatorial, normal);
cartesianNormalizeInPlace(inflection);
inflection = spherical(inflection);
var delta = lambda - lambda2,
sign = delta > 0 ? 1 : -1,
lambdai = inflection[0] * degrees$1 * sign,
phii,
antimeridian = abs$1(delta) > 180;
if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) {
phii = inflection[1] * degrees$1;
if (phii > phi1) phi1 = phii;
} else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) {
phii = -inflection[1] * degrees$1;
if (phii < phi0) phi0 = phii;
} else {
if (phi < phi0) phi0 = phi;
if (phi > phi1) phi1 = phi;
}
if (antimeridian) {
if (lambda < lambda2) {
if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda;
} else {
if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda;
}
} else {
if (lambda1 >= lambda0$1) {
if (lambda < lambda0$1) lambda0$1 = lambda;
if (lambda > lambda1) lambda1 = lambda;
} else {
if (lambda > lambda2) {
if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda;
} else {
if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda;
}
}
}
} else {
ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]);
}
if (phi < phi0) phi0 = phi;
if (phi > phi1) phi1 = phi;
p0 = p, lambda2 = lambda;
}
function boundsLineStart() {
boundsStream.point = linePoint;
}
function boundsLineEnd() {
range[0] = lambda0$1, range[1] = lambda1;
boundsStream.point = boundsPoint;
p0 = null;
}
function boundsRingPoint(lambda, phi) {
if (p0) {
var delta = lambda - lambda2;
deltaSum.add(abs$1(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
} else {
lambda00$1 = lambda, phi00$1 = phi;
}
areaStream.point(lambda, phi);
linePoint(lambda, phi);
}
function boundsRingStart() {
areaStream.lineStart();
}
function boundsRingEnd() {
boundsRingPoint(lambda00$1, phi00$1);
areaStream.lineEnd();
if (abs$1(deltaSum) > epsilon$2) lambda0$1 = -(lambda1 = 180);
range[0] = lambda0$1, range[1] = lambda1;
p0 = null;
}
// Finds the left-right distance between two longitudes.
// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want
// the distance between ±180° to be 360°.
function angle(lambda0, lambda1) {
return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1;
}
var W0;
var W1;
var X0;
var Y0;
var Z0;
var X1;
var Y1;
var Z1;
var X2;
var Y2;
var Z2;
var lambda00$2;
var phi00$2;
var x0;
var y0;
var z0;
// previous point
var centroidStream = {
sphere: noop$4,
point: centroidPoint,
lineStart: centroidLineStart,
lineEnd: centroidLineEnd,
polygonStart: function() {
centroidStream.lineStart = centroidRingStart;
centroidStream.lineEnd = centroidRingEnd;
},
polygonEnd: function() {
centroidStream.lineStart = centroidLineStart;
centroidStream.lineEnd = centroidLineEnd;
}
};
// Arithmetic mean of Cartesian vectors.
function centroidPoint(lambda, phi) {
lambda *= radians, phi *= radians;
var cosPhi = cos$1(phi);
centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi));
}
function centroidPointCartesian(x, y, z) {
++W0;
X0 += (x - X0) / W0;
Y0 += (y - Y0) / W0;
Z0 += (z - Z0) / W0;
}
function centroidLineStart() {
centroidStream.point = centroidLinePointFirst;
}
function centroidLinePointFirst(lambda, phi) {
lambda *= radians, phi *= radians;
var cosPhi = cos$1(phi);
x0 = cosPhi * cos$1(lambda);
y0 = cosPhi * sin$1(lambda);
z0 = sin$1(phi);
centroidStream.point = centroidLinePoint;
centroidPointCartesian(x0, y0, z0);
}
function centroidLinePoint(lambda, phi) {
lambda *= radians, phi *= radians;
var cosPhi = cos$1(phi),
x = cosPhi * cos$1(lambda),
y = cosPhi * sin$1(lambda),
z = sin$1(phi),
w = atan2$1(sqrt$2((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);
W1 += w;
X1 += w * (x0 + (x0 = x));
Y1 += w * (y0 + (y0 = y));
Z1 += w * (z0 + (z0 = z));
centroidPointCartesian(x0, y0, z0);
}
function centroidLineEnd() {
centroidStream.point = centroidPoint;
}
// See J. E. Brock, The Inertia Tensor for a Spherical Triangle,
// J. Applied Mechanics 42, 239 (1975).
function centroidRingStart() {
centroidStream.point = centroidRingPointFirst;
}
function centroidRingEnd() {
centroidRingPoint(lambda00$2, phi00$2);
centroidStream.point = centroidPoint;
}
function centroidRingPointFirst(lambda, phi) {
lambda00$2 = lambda, phi00$2 = phi;
lambda *= radians, phi *= radians;
centroidStream.point = centroidRingPoint;
var cosPhi = cos$1(phi);
x0 = cosPhi * cos$1(lambda);
y0 = cosPhi * sin$1(lambda);
z0 = sin$1(phi);
centroidPointCartesian(x0, y0, z0);
}
function centroidRingPoint(lambda, phi) {
lambda *= radians, phi *= radians;
var cosPhi = cos$1(phi),
x = cosPhi * cos$1(lambda),
y = cosPhi * sin$1(lambda),
z = sin$1(phi),
cx = y0 * z - z0 * y,
cy = z0 * x - x0 * z,
cz = x0 * y - y0 * x,
m = sqrt$2(cx * cx + cy * cy + cz * cz),
w = asin$1(m), // line weight = angle
v = m && -w / m; // area weight multiplier
X2 += v * cx;
Y2 += v * cy;
Z2 += v * cz;
W1 += w;
X1 += w * (x0 + (x0 = x));
Y1 += w * (y0 + (y0 = y));
Z1 += w * (z0 + (z0 = z));
centroidPointCartesian(x0, y0, z0);
}
function compose(a, b) {
function compose(x, y) {
return x = a(x, y), b(x[0], x[1]);
}
if (a.invert && b.invert) compose.invert = function(x, y) {
return x = b.invert(x, y), x && a.invert(x[0], x[1]);
};
return compose;
}
function rotationIdentity(lambda, phi) {
return [lambda > pi$3 ? lambda - tau$4 : lambda < -pi$3 ? lambda + tau$4 : lambda, phi];
}
rotationIdentity.invert = rotationIdentity;
function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
return (deltaLambda %= tau$4) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma))
: rotationLambda(deltaLambda))
: (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma)
: rotationIdentity);
}
function forwardRotationLambda(deltaLambda) {
return function(lambda, phi) {
return lambda += deltaLambda, [lambda > pi$3 ? lambda - tau$4 : lambda < -pi$3 ? lambda + tau$4 : lambda, phi];
};
}
function rotationLambda(deltaLambda) {
var rotation = forwardRotationLambda(deltaLambda);
rotation.invert = forwardRotationLambda(-deltaLambda);
return rotation;
}
function rotationPhiGamma(deltaPhi, deltaGamma) {
var cosDeltaPhi = cos$1(deltaPhi),
sinDeltaPhi = sin$1(deltaPhi),
cosDeltaGamma = cos$1(deltaGamma),
sinDeltaGamma = sin$1(deltaGamma);
function rotation(lambda, phi) {
var cosPhi = cos$1(phi),
x = cos$1(lambda) * cosPhi,
y = sin$1(lambda) * cosPhi,
z = sin$1(phi),
k = z * cosDeltaPhi + x * sinDeltaPhi;
return [
atan2$1(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi),
asin$1(k * cosDeltaGamma + y * sinDeltaGamma)
];
}
rotation.invert = function(lambda, phi) {
var cosPhi = cos$1(phi),
x = cos$1(lambda) * cosPhi,
y = sin$1(lambda) * cosPhi,
z = sin$1(phi),
k = z * cosDeltaGamma - y * sinDeltaGamma;
return [
atan2$1(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi),
asin$1(k * cosDeltaPhi - x * sinDeltaPhi)
];
};
return rotation;
}
// Generates a circle centered at [0°, 0°], with a given radius and precision.
function circleStream(stream, radius, delta, direction, t0, t1) {
if (!delta) return;
var cosRadius = cos$1(radius),
sinRadius = sin$1(radius),
step = direction * delta;
if (t0 == null) {
t0 = radius + direction * tau$4;
t1 = radius - step / 2;
} else {
t0 = circleRadius(cosRadius, t0);
t1 = circleRadius(cosRadius, t1);
if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau$4;
}
for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {
point = spherical([cosRadius, -sinRadius * cos$1(t), -sinRadius * sin$1(t)]);
stream.point(point[0], point[1]);
}
}
// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0].
function circleRadius(cosRadius, point) {
point = cartesian(point), point[0] -= cosRadius;
cartesianNormalizeInPlace(point);
var radius = acos$1(-point[1]);
return ((-point[2] < 0 ? -radius : radius) + tau$4 - epsilon$2) % tau$4;
}
function clipBuffer() {
var lines = [],
line;
return {
point: function(x, y) {
line.push([x, y]);
},
lineStart: function() {
lines.push(line = []);
},
lineEnd: noop$4,
rejoin: function() {
if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
},
result: function() {
var result = lines;
lines = [];
line = null;
return result;
}
};
}
function clipLine(a, b, x0, y0, x1, y1) {
var ax = a[0],
ay = a[1],
bx = b[0],
by = b[1],
t0 = 0,
t1 = 1,
dx = bx - ax,
dy = by - ay,
r;
r = x0 - ax;
if (!dx && r > 0) return;
r /= dx;
if (dx < 0) {
if (r < t0) return;
if (r < t1) t1 = r;
} else if (dx > 0) {
if (r > t1) return;
if (r > t0) t0 = r;
}
r = x1 - ax;
if (!dx && r < 0) return;
r /= dx;
if (dx < 0) {
if (r > t1) return;
if (r > t0) t0 = r;
} else if (dx > 0) {
if (r < t0) return;
if (r < t1) t1 = r;
}
r = y0 - ay;
if (!dy && r > 0) return;
r /= dy;
if (dy < 0) {
if (r < t0) return;
if (r < t1) t1 = r;
} else if (dy > 0) {
if (r > t1) return;
if (r > t0) t0 = r;
}
r = y1 - ay;
if (!dy && r < 0) return;
r /= dy;
if (dy < 0) {
if (r > t1) return;
if (r > t0) t0 = r;
} else if (dy > 0) {
if (r < t0) return;
if (r < t1) t1 = r;
}
if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy;
if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy;
return true;
}
function pointEqual(a, b) {
return abs$1(a[0] - b[0]) < epsilon$2 && abs$1(a[1] - b[1]) < epsilon$2;
}
function Intersection(point, points, other, entry) {
this.x = point;
this.z = points;
this.o = other; // another intersection
this.e = entry; // is an entry?
this.v = false; // visited
this.n = this.p = null; // next & previous
}
// A generalized polygon clipping algorithm: given a polygon that has been cut
// into its visible line segments, and rejoins the segments by interpolating
// along the clip edge.
function clipPolygon(segments, compareIntersection, startInside, interpolate, stream) {
var subject = [],
clip = [],
i,
n;
segments.forEach(function(segment) {
if ((n = segment.length - 1) <= 0) return;
var n, p0 = segment[0], p1 = segment[n], x;
// If the first and last points of a segment are coincident, then treat as a
// closed ring. TODO if all rings are closed, then the winding order of the
// exterior ring should be checked.
if (pointEqual(p0, p1)) {
stream.lineStart();
for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);
stream.lineEnd();
return;
}
subject.push(x = new Intersection(p0, segment, null, true));
clip.push(x.o = new Intersection(p0, null, x, false));
subject.push(x = new Intersection(p1, segment, null, false));
clip.push(x.o = new Intersection(p1, null, x, true));
});
if (!subject.length) return;
clip.sort(compareIntersection);
link(subject);
link(clip);
for (i = 0, n = clip.length; i < n; ++i) {
clip[i].e = startInside = !startInside;
}
var start = subject[0],
points,
point;
while (1) {
// Find first unvisited intersection.
var current = start,
isSubject = true;
while (current.v) if ((current = current.n) === start) return;
points = current.z;
stream.lineStart();
do {
current.v = current.o.v = true;
if (current.e) {
if (isSubject) {
for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);
} else {
interpolate(current.x, current.n.x, 1, stream);
}
current = current.n;
} else {
if (isSubject) {
points = current.p.z;
for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);
} else {
interpolate(current.x, current.p.x, -1, stream);
}
current = current.p;
}
current = current.o;
points = current.z;
isSubject = !isSubject;
} while (!current.v);
stream.lineEnd();
}
}
function link(array) {
if (!(n = array.length)) return;
var n,
i = 0,
a = array[0],
b;
while (++i < n) {
a.n = b = array[i];
b.p = a;
a = b;
}
a.n = b = array[0];
b.p = a;
}
var clipMax = 1e9;
var clipMin = -clipMax;
// TODO Use d3-polygon’s polygonContains here for the ring check?
// TODO Eliminate duplicate buffering in clipBuffer and polygon.push?
function clipExtent(x0, y0, x1, y1) {
function visible(x, y) {
return x0 <= x && x <= x1 && y0 <= y && y <= y1;
}
function interpolate(from, to, direction, stream) {
var a = 0, a1 = 0;
if (from == null
|| (a = corner(from, direction)) !== (a1 = corner(to, direction))
|| comparePoint(from, to) < 0 ^ direction > 0) {
do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);
while ((a = (a + direction + 4) % 4) !== a1);
} else {
stream.point(to[0], to[1]);
}
}
function corner(p, direction) {
return abs$1(p[0] - x0) < epsilon$2 ? direction > 0 ? 0 : 3
: abs$1(p[0] - x1) < epsilon$2 ? direction > 0 ? 2 : 1
: abs$1(p[1] - y0) < epsilon$2 ? direction > 0 ? 1 : 0
: direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon
}
function compareIntersection(a, b) {
return comparePoint(a.x, b.x);
}
function comparePoint(a, b) {
var ca = corner(a, 1),
cb = corner(b, 1);
return ca !== cb ? ca - cb
: ca === 0 ? b[1] - a[1]
: ca === 1 ? a[0] - b[0]
: ca === 2 ? a[1] - b[1]
: b[0] - a[0];
}
return function(stream) {
var activeStream = stream,
bufferStream = clipBuffer(),
segments,
polygon,
ring,
x__, y__, v__, // first point
x_, y_, v_, // previous point
first,
clean;
var clipStream = {
point: point,
lineStart: lineStart,
lineEnd: lineEnd,
polygonStart: polygonStart,
polygonEnd: polygonEnd
};
function point(x, y) {
if (visible(x, y)) activeStream.point(x, y);
}
function polygonInside() {
var winding = 0;
for (var i = 0, n = polygon.length; i < n; ++i) {
for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) {
a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1];
if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; }
else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; }
}
}
return winding;
}
// Buffer geometry within a polygon and then clip it en masse.
function polygonStart() {
activeStream = bufferStream, segments = [], polygon = [], clean = true;
}
function polygonEnd() {
var startInside = polygonInside(),
cleanInside = clean && startInside,
visible = (segments = merge(segments)).length;
if (cleanInside || visible) {
stream.polygonStart();
if (cleanInside) {
stream.lineStart();
interpolate(null, null, 1, stream);
stream.lineEnd();
}
if (visible) {
clipPolygon(segments, compareIntersection, startInside, interpolate, stream);
}
stream.polygonEnd();
}
activeStream = stream, segments = polygon = ring = null;
}
function lineStart() {
clipStream.point = linePoint;
if (polygon) polygon.push(ring = []);
first = true;
v_ = false;
x_ = y_ = NaN;
}
// TODO rather than special-case polygons, simply handle them separately.
// Ideally, coincident intersection points should be jittered to avoid
// clipping issues.
function lineEnd() {
if (segments) {
linePoint(x__, y__);
if (v__ && v_) bufferStream.rejoin();
segments.push(bufferStream.result());
}
clipStream.point = point;
if (v_) activeStream.lineEnd();
}
function linePoint(x, y) {
var v = visible(x, y);
if (polygon) ring.push([x, y]);
if (first) {
x__ = x, y__ = y, v__ = v;
first = false;
if (v) {
activeStream.lineStart();
activeStream.point(x, y);
}
} else {
if (v && v_) activeStream.point(x, y);
else {
var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))],
b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))];
if (clipLine(a, b, x0, y0, x1, y1)) {
if (!v_) {
activeStream.lineStart();
activeStream.point(a[0], a[1]);
}
activeStream.point(b[0], b[1]);
if (!v) activeStream.lineEnd();
clean = false;
} else if (v) {
activeStream.lineStart();
activeStream.point(x, y);
clean = false;
}
}
}
x_ = x, y_ = y, v_ = v;
}
return clipStream;
};
}
var sum$2 = adder();
function polygonContains(polygon, point) {
var lambda = point[0],
phi = point[1],
normal = [sin$1(lambda), -cos$1(lambda), 0],
angle = 0,
winding = 0;
sum$2.reset();
for (var i = 0, n = polygon.length; i < n; ++i) {
if (!(m = (ring = polygon[i]).length)) continue;
var ring,
m,
point0 = ring[m - 1],
lambda0 = point0[0],
phi0 = point0[1] / 2 + quarterPi,
sinPhi0 = sin$1(phi0),
cosPhi0 = cos$1(phi0);
for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {
var point1 = ring[j],
lambda1 = point1[0],
phi1 = point1[1] / 2 + quarterPi,
sinPhi1 = sin$1(phi1),
cosPhi1 = cos$1(phi1),
delta = lambda1 - lambda0,
sign = delta >= 0 ? 1 : -1,
absDelta = sign * delta,
antimeridian = absDelta > pi$3,
k = sinPhi0 * sinPhi1;
sum$2.add(atan2$1(k * sign * sin$1(absDelta), cosPhi0 * cosPhi1 + k * cos$1(absDelta)));
angle += antimeridian ? delta + sign * tau$4 : delta;
// Are the longitudes either side of the point’s meridian (lambda),
// and are the latitudes smaller than the parallel (phi)?
if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {
var arc = cartesianCross(cartesian(point0), cartesian(point1));
cartesianNormalizeInPlace(arc);
var intersection = cartesianCross(normal, arc);
cartesianNormalizeInPlace(intersection);
var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin$1(intersection[2]);
if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
winding += antimeridian ^ delta >= 0 ? 1 : -1;
}
}
}
}
// First, determine whether the South pole is inside or outside:
//
// It is inside if:
// * the polygon winds around it in a clockwise direction.
// * the polygon does not (cumulatively) wind around it, but has a negative
// (counter-clockwise) area.
//
// Second, count the (signed) number of times a segment crosses a lambda
// from the point to the South pole. If it is zero, then the point is the
// same side as the South pole.
return (angle < -epsilon$2 || angle < epsilon$2 && sum$2 < -epsilon$2) ^ (winding & 1);
}
var lengthSum = adder();
var lambda0$2;
var sinPhi0$1;
var cosPhi0$1;
var lengthStream = {
sphere: noop$4,
point: noop$4,
lineStart: lengthLineStart,
lineEnd: noop$4,
polygonStart: noop$4,
polygonEnd: noop$4
};
function lengthLineStart() {
lengthStream.point = lengthPointFirst;
lengthStream.lineEnd = lengthLineEnd;
}
function lengthLineEnd() {
lengthStream.point = lengthStream.lineEnd = noop$4;
}
function lengthPointFirst(lambda, phi) {
lambda *= radians, phi *= radians;
lambda0$2 = lambda, sinPhi0$1 = sin$1(phi), cosPhi0$1 = cos$1(phi);
lengthStream.point = lengthPoint;
}
function lengthPoint(lambda, phi) {
lambda *= radians, phi *= radians;
var sinPhi = sin$1(phi),
cosPhi = cos$1(phi),
delta = abs$1(lambda - lambda0$2),
cosDelta = cos$1(delta),
sinDelta = sin$1(delta),
x = cosPhi * sinDelta,
y = cosPhi0$1 * sinPhi - sinPhi0$1 * cosPhi * cosDelta,
z = sinPhi0$1 * sinPhi + cosPhi0$1 * cosPhi * cosDelta;
lengthSum.add(atan2$1(sqrt$2(x * x + y * y), z));
lambda0$2 = lambda, sinPhi0$1 = sinPhi, cosPhi0$1 = cosPhi;
}
function graticuleX(y0, y1, dy) {
var y = sequence(y0, y1 - epsilon$2, dy).concat(y1);
return function(x) { return y.map(function(y) { return [x, y]; }); };
}
function graticuleY(x0, x1, dx) {
var x = sequence(x0, x1 - epsilon$2, dx).concat(x1);
return function(y) { return x.map(function(x) { return [x, y]; }); };
}
function graticule() {
var x1, x0, X1, X0,
y1, y0, Y1, Y0,
dx = 10, dy = dx, DX = 90, DY = 360,
x, y, X, Y,
precision = 2.5;
function graticule() {
return {type: "MultiLineString", coordinates: lines()};
}
function lines() {
return sequence(ceil(X0 / DX) * DX, X1, DX).map(X)
.concat(sequence(ceil(Y0 / DY) * DY, Y1, DY).map(Y))
.concat(sequence(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return abs$1(x % DX) > epsilon$2; }).map(x))
.concat(sequence(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return abs$1(y % DY) > epsilon$2; }).map(y));
}
graticule.lines = function() {
return lines().map(function(coordinates) { return {type: "LineString", coordinates: coordinates}; });
};
graticule.outline = function() {
return {
type: "Polygon",
coordinates: [
X(X0).concat(
Y(Y1).slice(1),
X(X1).reverse().slice(1),
Y(Y0).reverse().slice(1))
]
};
};
graticule.extent = function(_) {
if (!arguments.length) return graticule.extentMinor();
return graticule.extentMajor(_).extentMinor(_);
};
graticule.extentMajor = function(_) {
if (!arguments.length) return [[X0, Y0], [X1, Y1]];
X0 = +_[0][0], X1 = +_[1][0];
Y0 = +_[0][1], Y1 = +_[1][1];
if (X0 > X1) _ = X0, X0 = X1, X1 = _;
if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _;
return graticule.precision(precision);
};
graticule.extentMinor = function(_) {
if (!arguments.length) return [[x0, y0], [x1, y1]];
x0 = +_[0][0], x1 = +_[1][0];
y0 = +_[0][1], y1 = +_[1][1];
if (x0 > x1) _ = x0, x0 = x1, x1 = _;
if (y0 > y1) _ = y0, y0 = y1, y1 = _;
return graticule.precision(precision);
};
graticule.step = function(_) {
if (!arguments.length) return graticule.stepMinor();
return graticule.stepMajor(_).stepMinor(_);
};
graticule.stepMajor = function(_) {
if (!arguments.length) return [DX, DY];
DX = +_[0], DY = +_[1];
return graticule;
};
graticule.stepMinor = function(_) {
if (!arguments.length) return [dx, dy];
dx = +_[0], dy = +_[1];
return graticule;
};
graticule.precision = function(_) {
if (!arguments.length) return precision;
precision = +_;
x = graticuleX(y0, y1, 90);
y = graticuleY(x0, x1, precision);
X = graticuleX(Y0, Y1, 90);
Y = graticuleY(X0, X1, precision);
return graticule;
};
return graticule
.extentMajor([[-180, -90 + epsilon$2], [180, 90 - epsilon$2]])
.extentMinor([[-180, -80 - epsilon$2], [180, 80 + epsilon$2]]);
}
function identity$6(x) {
return x;
}
var areaSum$1 = adder();
var areaRingSum$1 = adder();
var x00;
var y00;
var x0$1;
var y0$1;
var areaStream$1 = {
point: noop$4,
lineStart: noop$4,
lineEnd: noop$4,
polygonStart: function() {
areaStream$1.lineStart = areaRingStart$1;
areaStream$1.lineEnd = areaRingEnd$1;
},
polygonEnd: function() {
areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop$4;
areaSum$1.add(abs$1(areaRingSum$1));
areaRingSum$1.reset();
},
result: function() {
var area = areaSum$1 / 2;
areaSum$1.reset();
return area;
}
};
function areaRingStart$1() {
areaStream$1.point = areaPointFirst$1;
}
function areaPointFirst$1(x, y) {
areaStream$1.point = areaPoint$1;
x00 = x0$1 = x, y00 = y0$1 = y;
}
function areaPoint$1(x, y) {
areaRingSum$1.add(y0$1 * x - x0$1 * y);
x0$1 = x, y0$1 = y;
}
function areaRingEnd$1() {
areaPoint$1(x00, y00);
}
var x0$2 = Infinity;
var y0$2 = x0$2;
var x1 = -x0$2;
var y1 = x1;
var boundsStream$1 = {
point: boundsPoint$1,
lineStart: noop$4,
lineEnd: noop$4,
polygonStart: noop$4,
polygonEnd: noop$4,
result: function() {
var bounds = [[x0$2, y0$2], [x1, y1]];
x1 = y1 = -(y0$2 = x0$2 = Infinity);
return bounds;
}
};
function boundsPoint$1(x, y) {
if (x < x0$2) x0$2 = x;
if (x > x1) x1 = x;
if (y < y0$2) y0$2 = y;
if (y > y1) y1 = y;
}
var X0$1 = 0;
var Y0$1 = 0;
var Z0$1 = 0;
var X1$1 = 0;
var Y1$1 = 0;
var Z1$1 = 0;
var X2$1 = 0;
var Y2$1 = 0;
var Z2$1 = 0;
var x00$1;
var y00$1;
var x0$3;
var y0$3;
var centroidStream$1 = {
point: centroidPoint$1,
lineStart: centroidLineStart$1,
lineEnd: centroidLineEnd$1,
polygonStart: function() {
centroidStream$1.lineStart = centroidRingStart$1;
centroidStream$1.lineEnd = centroidRingEnd$1;
},
polygonEnd: function() {
centroidStream$1.point = centroidPoint$1;
centroidStream$1.lineStart = centroidLineStart$1;
centroidStream$1.lineEnd = centroidLineEnd$1;
},
result: function() {
var centroid = Z2$1 ? [X2$1 / Z2$1, Y2$1 / Z2$1]
: Z1$1 ? [X1$1 / Z1$1, Y1$1 / Z1$1]
: Z0$1 ? [X0$1 / Z0$1, Y0$1 / Z0$1]
: [NaN, NaN];
X0$1 = Y0$1 = Z0$1 =
X1$1 = Y1$1 = Z1$1 =
X2$1 = Y2$1 = Z2$1 = 0;
return centroid;
}
};
function centroidPoint$1(x, y) {
X0$1 += x;
Y0$1 += y;
++Z0$1;
}
function centroidLineStart$1() {
centroidStream$1.point = centroidPointFirstLine;
}
function centroidPointFirstLine(x, y) {
centroidStream$1.point = centroidPointLine;
centroidPoint$1(x0$3 = x, y0$3 = y);
}
function centroidPointLine(x, y) {
var dx = x - x0$3, dy = y - y0$3, z = sqrt$2(dx * dx + dy * dy);
X1$1 += z * (x0$3 + x) / 2;
Y1$1 += z * (y0$3 + y) / 2;
Z1$1 += z;
centroidPoint$1(x0$3 = x, y0$3 = y);
}
function centroidLineEnd$1() {
centroidStream$1.point = centroidPoint$1;
}
function centroidRingStart$1() {
centroidStream$1.point = centroidPointFirstRing;
}
function centroidRingEnd$1() {
centroidPointRing(x00$1, y00$1);
}
function centroidPointFirstRing(x, y) {
centroidStream$1.point = centroidPointRing;
centroidPoint$1(x00$1 = x0$3 = x, y00$1 = y0$3 = y);
}
function centroidPointRing(x, y) {
var dx = x - x0$3,
dy = y - y0$3,
z = sqrt$2(dx * dx + dy * dy);
X1$1 += z * (x0$3 + x) / 2;
Y1$1 += z * (y0$3 + y) / 2;
Z1$1 += z;
z = y0$3 * x - x0$3 * y;
X2$1 += z * (x0$3 + x);
Y2$1 += z * (y0$3 + y);
Z2$1 += z * 3;
centroidPoint$1(x0$3 = x, y0$3 = y);
}
function PathContext(context) {
this._context = context;
}
PathContext.prototype = {
_radius: 4.5,
pointRadius: function(_) {
return this._radius = _, this;
},
polygonStart: function() {
this._line = 0;
},
polygonEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._point = 0;
},
lineEnd: function() {
if (this._line === 0) this._context.closePath();
this._point = NaN;
},
point: function(x, y) {
switch (this._point) {
case 0: {
this._context.moveTo(x, y);
this._point = 1;
break;
}
case 1: {
this._context.lineTo(x, y);
break;
}
default: {
this._context.moveTo(x + this._radius, y);
this._context.arc(x, y, this._radius, 0, tau$4);
break;
}
}
},
result: noop$4
};
var lengthSum$1 = adder();
var lengthRing;
var x00$2;
var y00$2;
var x0$4;
var y0$4;
var lengthStream$1 = {
point: noop$4,
lineStart: function() {
lengthStream$1.point = lengthPointFirst$1;
},
lineEnd: function() {
if (lengthRing) lengthPoint$1(x00$2, y00$2);
lengthStream$1.point = noop$4;
},
polygonStart: function() {
lengthRing = true;
},
polygonEnd: function() {
lengthRing = null;
},
result: function() {
var length = +lengthSum$1;
lengthSum$1.reset();
return length;
}
};
function lengthPointFirst$1(x, y) {
lengthStream$1.point = lengthPoint$1;
x00$2 = x0$4 = x, y00$2 = y0$4 = y;
}
function lengthPoint$1(x, y) {
x0$4 -= x, y0$4 -= y;
lengthSum$1.add(sqrt$2(x0$4 * x0$4 + y0$4 * y0$4));
x0$4 = x, y0$4 = y;
}
function PathString() {
this._string = [];
}
PathString.prototype = {
_circle: circle$2(4.5),
pointRadius: function(_) {
return this._circle = circle$2(_), this;
},
polygonStart: function() {
this._line = 0;
},
polygonEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._point = 0;
},
lineEnd: function() {
if (this._line === 0) this._string.push("Z");
this._point = NaN;
},
point: function(x, y) {
switch (this._point) {
case 0: {
this._string.push("M", x, ",", y);
this._point = 1;
break;
}
case 1: {
this._string.push("L", x, ",", y);
break;
}
default: {
this._string.push("M", x, ",", y, this._circle);
break;
}
}
},
result: function() {
if (this._string.length) {
var result = this._string.join("");
this._string = [];
return result;
}
}
};
function circle$2(radius) {
return "m0," + radius
+ "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius
+ "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius
+ "z";
}
function geoPath(projection, context) {
var pointRadius = 4.5,
projectionStream,
contextStream;
function path(object) {
if (object) {
if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
geoStream(object, projectionStream(contextStream));
}
return contextStream.result();
}
path.area = function(object) {
geoStream(object, projectionStream(areaStream$1));
return areaStream$1.result();
};
path.measure = function(object) {
geoStream(object, projectionStream(lengthStream$1));
return lengthStream$1.result();
};
path.bounds = function(object) {
geoStream(object, projectionStream(boundsStream$1));
return boundsStream$1.result();
};
path.centroid = function(object) {
geoStream(object, projectionStream(centroidStream$1));
return centroidStream$1.result();
};
path.projection = function(_) {
return arguments.length ? (projectionStream = _ == null ? (projection = null, identity$6) : (projection = _).stream, path) : projection;
};
path.context = function(_) {
if (!arguments.length) return context;
contextStream = _ == null ? (context = null, new PathString) : new PathContext(context = _);
if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
return path;
};
path.pointRadius = function(_) {
if (!arguments.length) return pointRadius;
pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
return path;
};
return path.projection(projection).context(context);
}
function clip(pointVisible, clipLine, interpolate, start) {
return function(rotate, sink) {
var line = clipLine(sink),
rotatedStart = rotate.invert(start[0], start[1]),
ringBuffer = clipBuffer(),
ringSink = clipLine(ringBuffer),
polygonStarted = false,
polygon,
segments,
ring;
var clip = {
point: point,
lineStart: lineStart,
lineEnd: lineEnd,
polygonStart: function() {
clip.point = pointRing;
clip.lineStart = ringStart;
clip.lineEnd = ringEnd;
segments = [];
polygon = [];
},
polygonEnd: function() {
clip.point = point;
clip.lineStart = lineStart;
clip.lineEnd = lineEnd;
segments = merge(segments);
var startInside = polygonContains(polygon, rotatedStart);
if (segments.length) {
if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
clipPolygon(segments, compareIntersection, startInside, interpolate, sink);
} else if (startInside) {
if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
sink.lineStart();
interpolate(null, null, 1, sink);
sink.lineEnd();
}
if (polygonStarted) sink.polygonEnd(), polygonStarted = false;
segments = polygon = null;
},
sphere: function() {
sink.polygonStart();
sink.lineStart();
interpolate(null, null, 1, sink);
sink.lineEnd();
sink.polygonEnd();
}
};
function point(lambda, phi) {
var point = rotate(lambda, phi);
if (pointVisible(lambda = point[0], phi = point[1])) sink.point(lambda, phi);
}
function pointLine(lambda, phi) {
var point = rotate(lambda, phi);
line.point(point[0], point[1]);
}
function lineStart() {
clip.point = pointLine;
line.lineStart();
}
function lineEnd() {
clip.point = point;
line.lineEnd();
}
function pointRing(lambda, phi) {
ring.push([lambda, phi]);
var point = rotate(lambda, phi);
ringSink.point(point[0], point[1]);
}
function ringStart() {
ringSink.lineStart();
ring = [];
}
function ringEnd() {
pointRing(ring[0][0], ring[0][1]);
ringSink.lineEnd();
var clean = ringSink.clean(),
ringSegments = ringBuffer.result(),
i, n = ringSegments.length, m,
segment,
point;
ring.pop();
polygon.push(ring);
ring = null;
if (!n) return;
// No intersections.
if (clean & 1) {
segment = ringSegments[0];
if ((m = segment.length - 1) > 0) {
if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
sink.lineStart();
for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]);
sink.lineEnd();
}
return;
}
// Rejoin connected segments.
// TODO reuse ringBuffer.rejoin()?
if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
segments.push(ringSegments.filter(validSegment));
}
return clip;
};
}
function validSegment(segment) {
return segment.length > 1;
}
// Intersections are sorted along the clip edge. For both antimeridian cutting
// and circle clipping, the same comparison is used.
function compareIntersection(a, b) {
return ((a = a.x)[0] < 0 ? a[1] - halfPi$2 - epsilon$2 : halfPi$2 - a[1])
- ((b = b.x)[0] < 0 ? b[1] - halfPi$2 - epsilon$2 : halfPi$2 - b[1]);
}
var clipAntimeridian = clip(
function() { return true; },
clipAntimeridianLine,
clipAntimeridianInterpolate,
[-pi$3, -halfPi$2]
);
// Takes a line and cuts into visible segments. Return values: 0 - there were
// intersections or the line was empty; 1 - no intersections; 2 - there were
// intersections, and the first and last segments should be rejoined.
function clipAntimeridianLine(stream) {
var lambda0 = NaN,
phi0 = NaN,
sign0 = NaN,
clean; // no intersections
return {
lineStart: function() {
stream.lineStart();
clean = 1;
},
point: function(lambda1, phi1) {
var sign1 = lambda1 > 0 ? pi$3 : -pi$3,
delta = abs$1(lambda1 - lambda0);
if (abs$1(delta - pi$3) < epsilon$2) { // line crosses a pole
stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi$2 : -halfPi$2);
stream.point(sign0, phi0);
stream.lineEnd();
stream.lineStart();
stream.point(sign1, phi0);
stream.point(lambda1, phi0);
clean = 0;
} else if (sign0 !== sign1 && delta >= pi$3) { // line crosses antimeridian
if (abs$1(lambda0 - sign0) < epsilon$2) lambda0 -= sign0 * epsilon$2; // handle degeneracies
if (abs$1(lambda1 - sign1) < epsilon$2) lambda1 -= sign1 * epsilon$2;
phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);
stream.point(sign0, phi0);
stream.lineEnd();
stream.lineStart();
stream.point(sign1, phi0);
clean = 0;
}
stream.point(lambda0 = lambda1, phi0 = phi1);
sign0 = sign1;
},
lineEnd: function() {
stream.lineEnd();
lambda0 = phi0 = NaN;
},
clean: function() {
return 2 - clean; // if intersections, rejoin first and last segments
}
};
}
function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {
var cosPhi0,
cosPhi1,
sinLambda0Lambda1 = sin$1(lambda0 - lambda1);
return abs$1(sinLambda0Lambda1) > epsilon$2
? atan((sin$1(phi0) * (cosPhi1 = cos$1(phi1)) * sin$1(lambda1)
- sin$1(phi1) * (cosPhi0 = cos$1(phi0)) * sin$1(lambda0))
/ (cosPhi0 * cosPhi1 * sinLambda0Lambda1))
: (phi0 + phi1) / 2;
}
function clipAntimeridianInterpolate(from, to, direction, stream) {
var phi;
if (from == null) {
phi = direction * halfPi$2;
stream.point(-pi$3, phi);
stream.point(0, phi);
stream.point(pi$3, phi);
stream.point(pi$3, 0);
stream.point(pi$3, -phi);
stream.point(0, -phi);
stream.point(-pi$3, -phi);
stream.point(-pi$3, 0);
stream.point(-pi$3, phi);
} else if (abs$1(from[0] - to[0]) > epsilon$2) {
var lambda = from[0] < to[0] ? pi$3 : -pi$3;
phi = direction * lambda / 2;
stream.point(-lambda, phi);
stream.point(0, phi);
stream.point(lambda, phi);
} else {
stream.point(to[0], to[1]);
}
}
function clipCircle(radius, delta) {
var cr = cos$1(radius),
smallRadius = cr > 0,
notHemisphere = abs$1(cr) > epsilon$2; // TODO optimise for this common case
function interpolate(from, to, direction, stream) {
circleStream(stream, radius, delta, direction, from, to);
}
function visible(lambda, phi) {
return cos$1(lambda) * cos$1(phi) > cr;
}
// Takes a line and cuts into visible segments. Return values used for polygon
// clipping: 0 - there were intersections or the line was empty; 1 - no
// intersections 2 - there were intersections, and the first and last segments
// should be rejoined.
function clipLine(stream) {
var point0, // previous point
c0, // code for previous point
v0, // visibility of previous point
v00, // visibility of first point
clean; // no intersections
return {
lineStart: function() {
v00 = v0 = false;
clean = 1;
},
point: function(lambda, phi) {
var point1 = [lambda, phi],
point2,
v = visible(lambda, phi),
c = smallRadius
? v ? 0 : code(lambda, phi)
: v ? code(lambda + (lambda < 0 ? pi$3 : -pi$3), phi) : 0;
if (!point0 && (v00 = v0 = v)) stream.lineStart();
// Handle degeneracies.
// TODO ignore if not clipping polygons.
if (v !== v0) {
point2 = intersect(point0, point1);
if (pointEqual(point0, point2) || pointEqual(point1, point2)) {
point1[0] += epsilon$2;
point1[1] += epsilon$2;
v = visible(point1[0], point1[1]);
}
}
if (v !== v0) {
clean = 0;
if (v) {
// outside going in
stream.lineStart();
point2 = intersect(point1, point0);
stream.point(point2[0], point2[1]);
} else {
// inside going out
point2 = intersect(point0, point1);
stream.point(point2[0], point2[1]);
stream.lineEnd();
}
point0 = point2;
} else if (notHemisphere && point0 && smallRadius ^ v) {
var t;
// If the codes for two points are different, or are both zero,
// and there this segment intersects with the small circle.
if (!(c & c0) && (t = intersect(point1, point0, true))) {
clean = 0;
if (smallRadius) {
stream.lineStart();
stream.point(t[0][0], t[0][1]);
stream.point(t[1][0], t[1][1]);
stream.lineEnd();
} else {
stream.point(t[1][0], t[1][1]);
stream.lineEnd();
stream.lineStart();
stream.point(t[0][0], t[0][1]);
}
}
}
if (v && (!point0 || !pointEqual(point0, point1))) {
stream.point(point1[0], point1[1]);
}
point0 = point1, v0 = v, c0 = c;
},
lineEnd: function() {
if (v0) stream.lineEnd();
point0 = null;
},
// Rejoin first and last segments if there were intersections and the first
// and last points were visible.
clean: function() {
return clean | ((v00 && v0) << 1);
}
};
}
// Intersects the great circle between a and b with the clip circle.
function intersect(a, b, two) {
var pa = cartesian(a),
pb = cartesian(b);
// We have two planes, n1.p = d1 and n2.p = d2.
// Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).
var n1 = [1, 0, 0], // normal
n2 = cartesianCross(pa, pb),
n2n2 = cartesianDot(n2, n2),
n1n2 = n2[0], // cartesianDot(n1, n2),
determinant = n2n2 - n1n2 * n1n2;
// Two polar points.
if (!determinant) return !two && a;
var c1 = cr * n2n2 / determinant,
c2 = -cr * n1n2 / determinant,
n1xn2 = cartesianCross(n1, n2),
A = cartesianScale(n1, c1),
B = cartesianScale(n2, c2);
cartesianAddInPlace(A, B);
// Solve |p(t)|^2 = 1.
var u = n1xn2,
w = cartesianDot(A, u),
uu = cartesianDot(u, u),
t2 = w * w - uu * (cartesianDot(A, A) - 1);
if (t2 < 0) return;
var t = sqrt$2(t2),
q = cartesianScale(u, (-w - t) / uu);
cartesianAddInPlace(q, A);
q = spherical(q);
if (!two) return q;
// Two intersection points.
var lambda0 = a[0],
lambda1 = b[0],
phi0 = a[1],
phi1 = b[1],
z;
if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;
var delta = lambda1 - lambda0,
polar = abs$1(delta - pi$3) < epsilon$2,
meridian = polar || delta < epsilon$2;
if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z;
// Check that the first point is between a and b.
if (meridian
? polar
? phi0 + phi1 > 0 ^ q[1] < (abs$1(q[0] - lambda0) < epsilon$2 ? phi0 : phi1)
: phi0 <= q[1] && q[1] <= phi1
: delta > pi$3 ^ (lambda0 <= q[0] && q[0] <= lambda1)) {
var q1 = cartesianScale(u, (-w + t) / uu);
cartesianAddInPlace(q1, A);
return [q, spherical(q1)];
}
}
// Generates a 4-bit vector representing the location of a point relative to
// the small circle's bounding box.
function code(lambda, phi) {
var r = smallRadius ? radius : pi$3 - radius,
code = 0;
if (lambda < -r) code |= 1; // left
else if (lambda > r) code |= 2; // right
if (phi < -r) code |= 4; // below
else if (phi > r) code |= 8; // above
return code;
}
return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$3, radius - pi$3]);
}
function transformer(methods) {
return function(stream) {
var s = new TransformStream;
for (var key in methods) s[key] = methods[key];
s.stream = stream;
return s;
};
}
function TransformStream() {}
TransformStream.prototype = {
constructor: TransformStream,
point: function(x, y) { this.stream.point(x, y); },
sphere: function() { this.stream.sphere(); },
lineStart: function() { this.stream.lineStart(); },
lineEnd: function() { this.stream.lineEnd(); },
polygonStart: function() { this.stream.polygonStart(); },
polygonEnd: function() { this.stream.polygonEnd(); }
};
function fitExtent(projection, extent, object) {
var w = extent[1][0] - extent[0][0],
h = extent[1][1] - extent[0][1],
clip = projection.clipExtent && projection.clipExtent();
projection
.scale(150)
.translate([0, 0]);
if (clip != null) projection.clipExtent(null);
geoStream(object, projection.stream(boundsStream$1));
var b = boundsStream$1.result(),
k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),
x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,
y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
if (clip != null) projection.clipExtent(clip);
return projection
.scale(k * 150)
.translate([x, y]);
}
function fitSize(projection, size, object) {
return fitExtent(projection, [[0, 0], size], object);
}
var maxDepth = 16;
var cosMinDistance = cos$1(30 * radians);
// cos(minimum angular distance)
function resample(project, delta2) {
return +delta2 ? resample$1(project, delta2) : resampleNone(project);
}
function resampleNone(project) {
return transformer({
point: function(x, y) {
x = project(x, y);
this.stream.point(x[0], x[1]);
}
});
}
function resample$1(project, delta2) {
function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) {
var dx = x1 - x0,
dy = y1 - y0,
d2 = dx * dx + dy * dy;
if (d2 > 4 * delta2 && depth--) {
var a = a0 + a1,
b = b0 + b1,
c = c0 + c1,
m = sqrt$2(a * a + b * b + c * c),
phi2 = asin$1(c /= m),
lambda2 = abs$1(abs$1(c) - 1) < epsilon$2 || abs$1(lambda0 - lambda1) < epsilon$2 ? (lambda0 + lambda1) / 2 : atan2$1(b, a),
p = project(lambda2, phi2),
x2 = p[0],
y2 = p[1],
dx2 = x2 - x0,
dy2 = y2 - y0,
dz = dy * dx2 - dx * dy2;
if (dz * dz / d2 > delta2 // perpendicular projected distance
|| abs$1((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end
|| a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { // angular distance
resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream);
stream.point(x2, y2);
resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream);
}
}
}
return function(stream) {
var lambda00, x00, y00, a00, b00, c00, // first point
lambda0, x0, y0, a0, b0, c0; // previous point
var resampleStream = {
point: point,
lineStart: lineStart,
lineEnd: lineEnd,
polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; },
polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; }
};
function point(x, y) {
x = project(x, y);
stream.point(x[0], x[1]);
}
function lineStart() {
x0 = NaN;
resampleStream.point = linePoint;
stream.lineStart();
}
function linePoint(lambda, phi) {
var c = cartesian([lambda, phi]), p = project(lambda, phi);
resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
stream.point(x0, y0);
}
function lineEnd() {
resampleStream.point = point;
stream.lineEnd();
}
function ringStart() {
lineStart();
resampleStream.point = ringPoint;
resampleStream.lineEnd = ringEnd;
}
function ringPoint(lambda, phi) {
linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;
resampleStream.point = linePoint;
}
function ringEnd() {
resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream);
resampleStream.lineEnd = lineEnd;
lineEnd();
}
return resampleStream;
};
}
var transformRadians = transformer({
point: function(x, y) {
this.stream.point(x * radians, y * radians);
}
});
function projection(project) {
return projectionMutator(function() { return project; })();
}
function projectionMutator(projectAt) {
var project,
k = 150, // scale
x = 480, y = 250, // translate
dx, dy, lambda = 0, phi = 0, // center
deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, projectRotate, // rotate
theta = null, preclip = clipAntimeridian, // clip angle
x0 = null, y0, x1, y1, postclip = identity$6, // clip extent
delta2 = 0.5, projectResample = resample(projectTransform, delta2), // precision
cache,
cacheStream;
function projection(point) {
point = projectRotate(point[0] * radians, point[1] * radians);
return [point[0] * k + dx, dy - point[1] * k];
}
function invert(point) {
point = projectRotate.invert((point[0] - dx) / k, (dy - point[1]) / k);
return point && [point[0] * degrees$1, point[1] * degrees$1];
}
function projectTransform(x, y) {
return x = project(x, y), [x[0] * k + dx, dy - x[1] * k];
}
projection.stream = function(stream) {
return cache && cacheStream === stream ? cache : cache = transformRadians(preclip(rotate, projectResample(postclip(cacheStream = stream))));
};
projection.clipAngle = function(_) {
return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians, 6 * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees$1;
};
projection.clipExtent = function(_) {
return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$6) : clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
};
projection.scale = function(_) {
return arguments.length ? (k = +_, recenter()) : k;
};
projection.translate = function(_) {
return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];
};
projection.center = function(_) {
return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees$1, phi * degrees$1];
};
projection.rotate = function(_) {
return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees$1, deltaPhi * degrees$1, deltaGamma * degrees$1];
};
projection.precision = function(_) {
return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt$2(delta2);
};
projection.fitExtent = function(extent, object) {
return fitExtent(projection, extent, object);
};
projection.fitSize = function(size, object) {
return fitSize(projection, size, object);
};
function recenter() {
projectRotate = compose(rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma), project);
var center = project(lambda, phi);
dx = x - center[0] * k;
dy = y + center[1] * k;
return reset();
}
function reset() {
cache = cacheStream = null;
return projection;
}
return function() {
project = projectAt.apply(this, arguments);
projection.invert = project.invert && invert;
return recenter();
};
}
function conicProjection(projectAt) {
var phi0 = 0,
phi1 = pi$3 / 3,
m = projectionMutator(projectAt),
p = m(phi0, phi1);
p.parallels = function(_) {
return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees$1, phi1 * degrees$1];
};
return p;
}
function cylindricalEqualAreaRaw(phi0) {
var cosPhi0 = cos$1(phi0);
function forward(lambda, phi) {
return [lambda * cosPhi0, sin$1(phi) / cosPhi0];
}
forward.invert = function(x, y) {
return [x / cosPhi0, asin$1(y * cosPhi0)];
};
return forward;
}
function conicEqualAreaRaw(y0, y1) {
var sy0 = sin$1(y0), n = (sy0 + sin$1(y1)) / 2;
// Are the parallels symmetrical around the Equator?
if (abs$1(n) < epsilon$2) return cylindricalEqualAreaRaw(y0);
var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt$2(c) / n;
function project(x, y) {
var r = sqrt$2(c - 2 * n * sin$1(y)) / n;
return [r * sin$1(x *= n), r0 - r * cos$1(x)];
}
project.invert = function(x, y) {
var r0y = r0 - y;
return [atan2$1(x, abs$1(r0y)) / n * sign$1(r0y), asin$1((c - (x * x + r0y * r0y) * n * n) / (2 * n))];
};
return project;
}
function geoConicEqualArea() {
return conicProjection(conicEqualAreaRaw)
.scale(155.424)
.center([0, 33.6442]);
}
function geoAlbers() {
return geoConicEqualArea()
.parallels([29.5, 45.5])
.scale(1070)
.translate([480, 250])
.rotate([96, 0])
.center([-0.6, 38.7]);
}
// The projections must have mutually exclusive clip regions on the sphere,
// as this will avoid emitting interleaving lines and polygons.
function multiplex(streams) {
var n = streams.length;
return {
point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); },
sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); },
lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); },
lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); },
polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); },
polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); }
};
}
// A composite projection for the United States, configured by default for
// 960×500. The projection also works quite well at 960×600 if you change the
// scale to 1285 and adjust the translate accordingly. The set of standard
// parallels for each region comes from USGS, which is published here:
// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers
function geoAlbersUsa() {
var cache,
cacheStream,
lower48 = geoAlbers(), lower48Point,
alaska = geoConicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338
hawaii = geoConicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007
point, pointStream = {point: function(x, y) { point = [x, y]; }};
function albersUsa(coordinates) {
var x = coordinates[0], y = coordinates[1];
return point = null,
(lower48Point.point(x, y), point)
|| (alaskaPoint.point(x, y), point)
|| (hawaiiPoint.point(x, y), point);
}
albersUsa.invert = function(coordinates) {
var k = lower48.scale(),
t = lower48.translate(),
x = (coordinates[0] - t[0]) / k,
y = (coordinates[1] - t[1]) / k;
return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska
: y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii
: lower48).invert(coordinates);
};
albersUsa.stream = function(stream) {
return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);
};
albersUsa.precision = function(_) {
if (!arguments.length) return lower48.precision();
lower48.precision(_), alaska.precision(_), hawaii.precision(_);
return reset();
};
albersUsa.scale = function(_) {
if (!arguments.length) return lower48.scale();
lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_);
return albersUsa.translate(lower48.translate());
};
albersUsa.translate = function(_) {
if (!arguments.length) return lower48.translate();
var k = lower48.scale(), x = +_[0], y = +_[1];
lower48Point = lower48
.translate(_)
.clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]])
.stream(pointStream);
alaskaPoint = alaska
.translate([x - 0.307 * k, y + 0.201 * k])
.clipExtent([[x - 0.425 * k + epsilon$2, y + 0.120 * k + epsilon$2], [x - 0.214 * k - epsilon$2, y + 0.234 * k - epsilon$2]])
.stream(pointStream);
hawaiiPoint = hawaii
.translate([x - 0.205 * k, y + 0.212 * k])
.clipExtent([[x - 0.214 * k + epsilon$2, y + 0.166 * k + epsilon$2], [x - 0.115 * k - epsilon$2, y + 0.234 * k - epsilon$2]])
.stream(pointStream);
return reset();
};
albersUsa.fitExtent = function(extent, object) {
return fitExtent(albersUsa, extent, object);
};
albersUsa.fitSize = function(size, object) {
return fitSize(albersUsa, size, object);
};
function reset() {
cache = cacheStream = null;
return albersUsa;
}
return albersUsa.scale(1070);
}
function azimuthalRaw(scale) {
return function(x, y) {
var cx = cos$1(x),
cy = cos$1(y),
k = scale(cx * cy);
return [
k * cy * sin$1(x),
k * sin$1(y)
];
}
}
function azimuthalInvert(angle) {
return function(x, y) {
var z = sqrt$2(x * x + y * y),
c = angle(z),
sc = sin$1(c),
cc = cos$1(c);
return [
atan2$1(x * sc, z * cc),
asin$1(z && y * sc / z)
];
}
}
var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) {
return sqrt$2(2 / (1 + cxcy));
});
azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) {
return 2 * asin$1(z / 2);
});
function geoAzimuthalEqualArea() {
return projection(azimuthalEqualAreaRaw)
.scale(124.75)
.clipAngle(180 - 1e-3);
}
var azimuthalEquidistantRaw = azimuthalRaw(function(c) {
return (c = acos$1(c)) && c / sin$1(c);
});
azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) {
return z;
});
function geoAzimuthalEquidistant() {
return projection(azimuthalEquidistantRaw)
.scale(79.4188)
.clipAngle(180 - 1e-3);
}
function mercatorRaw(lambda, phi) {
return [lambda, log$2(tan((halfPi$2 + phi) / 2))];
}
mercatorRaw.invert = function(x, y) {
return [x, 2 * atan(exp(y)) - halfPi$2];
};
function geoMercator() {
return mercatorProjection(mercatorRaw)
.scale(961 / tau$4);
}
function mercatorProjection(project) {
var m = projection(project),
scale = m.scale,
translate = m.translate,
clipExtent = m.clipExtent,
clipAuto;
m.scale = function(_) {
return arguments.length ? (scale(_), clipAuto && m.clipExtent(null), m) : scale();
};
m.translate = function(_) {
return arguments.length ? (translate(_), clipAuto && m.clipExtent(null), m) : translate();
};
m.clipExtent = function(_) {
if (!arguments.length) return clipAuto ? null : clipExtent();
if (clipAuto = _ == null) {
var k = pi$3 * scale(),
t = translate();
_ = [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]];
}
clipExtent(_);
return m;
};
return m.clipExtent(null);
}
function tany(y) {
return tan((halfPi$2 + y) / 2);
}
function conicConformalRaw(y0, y1) {
var cy0 = cos$1(y0),
n = y0 === y1 ? sin$1(y0) : log$2(cy0 / cos$1(y1)) / log$2(tany(y1) / tany(y0)),
f = cy0 * pow$1(tany(y0), n) / n;
if (!n) return mercatorRaw;
function project(x, y) {
if (f > 0) { if (y < -halfPi$2 + epsilon$2) y = -halfPi$2 + epsilon$2; }
else { if (y > halfPi$2 - epsilon$2) y = halfPi$2 - epsilon$2; }
var r = f / pow$1(tany(y), n);
return [r * sin$1(n * x), f - r * cos$1(n * x)];
}
project.invert = function(x, y) {
var fy = f - y, r = sign$1(n) * sqrt$2(x * x + fy * fy);
return [atan2$1(x, abs$1(fy)) / n * sign$1(fy), 2 * atan(pow$1(f / r, 1 / n)) - halfPi$2];
};
return project;
}
function geoConicConformal() {
return conicProjection(conicConformalRaw)
.scale(109.5)
.parallels([30, 30]);
}
function equirectangularRaw(lambda, phi) {
return [lambda, phi];
}
equirectangularRaw.invert = equirectangularRaw;
function geoEquirectangular() {
return projection(equirectangularRaw)
.scale(152.63);
}
function conicEquidistantRaw(y0, y1) {
var cy0 = cos$1(y0),
n = y0 === y1 ? sin$1(y0) : (cy0 - cos$1(y1)) / (y1 - y0),
g = cy0 / n + y0;
if (abs$1(n) < epsilon$2) return equirectangularRaw;
function project(x, y) {
var gy = g - y, nx = n * x;
return [gy * sin$1(nx), g - gy * cos$1(nx)];
}
project.invert = function(x, y) {
var gy = g - y;
return [atan2$1(x, abs$1(gy)) / n * sign$1(gy), g - sign$1(n) * sqrt$2(x * x + gy * gy)];
};
return project;
}
function geoConicEquidistant() {
return conicProjection(conicEquidistantRaw)
.scale(131.154)
.center([0, 13.9389]);
}
function gnomonicRaw(x, y) {
var cy = cos$1(y), k = cos$1(x) * cy;
return [cy * sin$1(x) / k, sin$1(y) / k];
}
gnomonicRaw.invert = azimuthalInvert(atan);
function geoGnomonic() {
return projection(gnomonicRaw)
.scale(144.049)
.clipAngle(60);
}
function orthographicRaw(x, y) {
return [cos$1(y) * sin$1(x), sin$1(y)];
}
orthographicRaw.invert = azimuthalInvert(asin$1);
function geoOrthographic() {
return projection(orthographicRaw)
.scale(249.5)
.clipAngle(90 + epsilon$2);
}
function stereographicRaw(x, y) {
var cy = cos$1(y), k = 1 + cos$1(x) * cy;
return [cy * sin$1(x) / k, sin$1(y) / k];
}
stereographicRaw.invert = azimuthalInvert(function(z) {
return 2 * atan(z);
});
function geoStereographic() {
return projection(stereographicRaw)
.scale(250)
.clipAngle(142);
}
function transverseMercatorRaw(lambda, phi) {
return [log$2(tan((halfPi$2 + phi) / 2)), -lambda];
}
transverseMercatorRaw.invert = function(x, y) {
return [-y, 2 * atan(exp(x)) - halfPi$2];
};
function geoTransverseMercator() {
var m = mercatorProjection(transverseMercatorRaw),
center = m.center,
rotate = m.rotate;
m.center = function(_) {
return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]);
};
m.rotate = function(_) {
return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]);
};
return rotate([0, 0, 90])
.scale(159.155);
}
/**
* GeoJSON feature generator for creating graticules.
* @constructor
*/
function Graticule(params) {
Transform.call(this, [], params);
this.generator = graticule();
}
var prototype$46 = inherits(Graticule, Transform);
prototype$46.transform = function(_, pulse) {
var out = pulse.fork(),
src = this.value,
gen = this.generator, t;
if (!src.length || _.modified()) {
for (var prop in _) {
if (isFunction(gen[prop])) {
gen[prop](_[prop]);
}
}
}
t = gen();
if (src.length) {
t._id = src[0]._id;
out.mod.push(t);
} else {
out.add.push(ingest(t));
}
src[0] = t;
return out.source = src, out;
};
var properties = [
// standard properties in d3-geo
'clipAngle',
'clipExtent',
'scale',
'translate',
'center',
'rotate',
'parallels',
'precision',
// extended properties in d3-geo-projections
'coefficient',
'distance',
'fraction',
'lobes',
'parallel',
'radius',
'ratio',
'spacing',
'tilt'
];
/**
* Augment projections with their type and a copy method.
*/
function create$2(type, constructor) {
return function projection() {
var p = constructor();
p.type = type;
p.path = geoPath().projection(p);
p.copy = p.copy || function() {
var c = projection();
properties.forEach(function(prop) {
if (p.hasOwnProperty(prop)) c[prop](p[prop]());
});
c.path.pointRadius(p.path.pointRadius());
return c;
};
return p;
};
}
function projection$1(type, proj) {
return arguments.length > 1 ? (projections[type] = create$2(type, proj), this)
: projections.hasOwnProperty(type) ? projections[type] : null;
}
var projections = {
// base d3-geo projection types
albers: geoAlbers,
albersusa: geoAlbersUsa,
azimuthalequalarea: geoAzimuthalEqualArea,
azimuthalequidistant: geoAzimuthalEquidistant,
conicconformal: geoConicConformal,
conicequalarea: geoConicEqualArea,
conicequidistant: geoConicEquidistant,
equirectangular: geoEquirectangular,
gnomonic: geoGnomonic,
mercator: geoMercator,
orthographic: geoOrthographic,
stereographic: geoStereographic,
transversemercator: geoTransverseMercator
};
for (var key$2 in projections) {
projection$1(key$2, projections[key$2]);
}
/**
* Maintains a cartographic projection.
* @constructor
* @param {object} params - The parameters for this operator.
*/
function Projection(params) {
Transform.call(this, null, params);
this.modified(true); // always treat as modified
}
var prototype$47 = inherits(Projection, Transform);
prototype$47.transform = function(_) {
var proj = this.value;
if (!proj || _.modified('type')) {
this.value = (proj = create$1(_.type));
properties.forEach(function(prop) {
if (_[prop] != null) set$2(proj, prop, _[prop]);
});
} else {
properties.forEach(function(prop) {
if (_.modified(prop)) set$2(proj, prop, _[prop]);
});
}
if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius);
};
function create$1(type) {
var constructor = projection$1((type || 'mercator').toLowerCase());
if (!constructor) error('Unrecognized projection type: ' + type);
return constructor();
}
function set$2(proj, key, value) {
if (isFunction(proj[key])) proj[key](value);
}
var GeoPathDefinition = {
"type": "GeoPath",
"metadata": {"modifies": true},
"params": [
{ "name": "projection", "type": "projection", "required": true },
{ "name": "field", "type": "field" },
{ "name": "as", "type": "string", "default": "path" }
]
}
var GeoPointDefinition = {
"type": "GeoPoint",
"metadata": {"modifies": true},
"params": [
{ "name": "projection", "type": "projection", "required": true },
{ "name": "fields", "type": "field", "array": true, "required": true, "length": 2 },
{ "name": "as", "type": "string", "array": true, "length": 2, "default": ["x", "y"] }
]
}
var GeoShapeDefinition = {
"type": "GeoShape",
"metadata": {"modifies": true},
"params": [
{ "name": "projection", "type": "projection", "required": true },
{ "name": "field", "type": "field", "default": "datum" },
{ "name": "as", "type": "string", "default": "shape" }
]
}
var GraticuleDefinition = {
"type": "Graticule",
"metadata": {"source": true, "generates": true, "changes": true},
"params": [
{ "name": "extent", "type": "array", "array": true, "length": 2,
"content": {"type": "number", "array": true, "length": 2} },
{ "name": "extentMajor", "type": "array", "array": true, "length": 2,
"content": {"type": "number", "array": true, "length": 2} },
{ "name": "extentMinor", "type": "array", "array": true, "length": 2,
"content": {"type": "number", "array": true, "length": 2} },
{ "name": "step", "type": "number", "array": true, "length": 2 },
{ "name": "stepMajor", "type": "number", "array": true, "length": 2, "default": [90, 360] },
{ "name": "stepMinor", "type": "number", "array": true, "length": 2, "default": [10, 10] },
{ "name": "precision", "type": "number", "default": 2.5 }
]
}
register(GeoPathDefinition, GeoPath);
register(GeoPointDefinition, GeoPoint);
register(GeoShapeDefinition, GeoShape);
register(GraticuleDefinition, Graticule);
transform('Projection', Projection);
var Log = 'log';
var Pow = 'pow';
var Sqrt = 'sqrt';
var Band = 'band';
var Point = 'point';
var Linear$1 = 'linear';
var Ordinal = 'ordinal';
var Quantile = 'quantile';
var Quantize = 'quantize';
var Threshold = 'threshold';
var BinLinear = 'bin-linear';
var BinOrdinal = 'bin-ordinal';
var Sequential = 'sequential';
/**
* Generate tick values for the given scale and approximate tick count or
* interval value. If the scale has a 'ticks' method, it will be used to
* generate the ticks, with the count argument passed as a parameter. If the
* scale lacks a 'ticks' method, the full scale domain will be returned.
* @param {Scale} scale - The scale for which to generate tick values.
* @param {*} [count] - The approximate number of desired ticks.
* @return {Array<*>} - The generated tick values.
*/
function tickValues(scale, count) {
return scale.ticks ? scale.ticks(count) : scale.domain();
}
/**
* Generate a label format function for a scale. If the scale has a
* 'tickFormat' method, it will be used to generate the formatter, with the
* count and specifier arguments passed as parameters. If the scale lacks a
* 'tickFormat' method, the returned formatter performs simple string coercion.
* If the input scale is a logarithmic scale and the format specifier does not
* indicate a desired decimal precision, a special variable precision formatter
* that automatically trims trailing zeroes will be generated.
* @param {Scale} scale - The scale for which to generate the label formatter.
* @param {*} [count] - The approximate number of desired ticks.
* @param {string} [specifier] - The format specifier. Must be a legal d3 4.0
* specifier string (see https://github.com/d3/d3-format#formatSpecifier).
* @return {function(*):string} - The generated label formatter.
*/
function tickFormat$1(scale, count, specifier) {
var format = scale.tickFormat
? scale.tickFormat(count, specifier)
: String;
return (scale.type === Log)
? filter$1(format, variablePrecision(specifier))
: format;
}
function filter$1(sourceFormat, targetFormat) {
return function(_) {
return sourceFormat(_) ? targetFormat(_) : '';
};
}
function variablePrecision(specifier) {
var s = formatSpecifier(specifier || ',');
if (s.precision == null) {
s.precision = 12;
switch (s.type) {
case '%': s.precision -= 2; break;
case 'e': s.precision -= 1; break;
}
return trimZeroes(
d3_format(s), // number format
d3_format('.1f')(1)[1] // decimal point character
);
} else {
return d3_format(s);
}
}
function trimZeroes(format, decimalChar) {
return function(x) {
var str = format(x),
dec = str.indexOf(decimalChar),
idx, end;
if (dec < 0) return str;
idx = rightmostDigit(str, dec);
end = idx < str.length ? str.slice(idx) : '';
while (--idx > dec) if (str[idx] !== '0') { ++idx; break; }
return str.slice(0, idx) + end;
};
}
function rightmostDigit(str, dec) {
var i = str.lastIndexOf('e'), c;
if (i > 0) return i;
for (i=str.length; --i > dec;) {
c = str.charCodeAt(i);
if (c >= 48 && c <= 57) return i + 1; // is digit
}
}
/**
* Generates axis ticks for visualizing a spatial scale.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {Scale} params.scale - The scale to generate ticks for.
* @param {*} [params.count=10] - The approximate number of ticks, or
* desired tick interval, to use.
* @param {Array<*>} [params.values] - The exact tick values to use.
* These must be legal domain values for the provided scale.
* If provided, the count argument is ignored.
* @param {function(*):string} [params.formatSpecifier] - A format specifier
* to use in conjunction with scale.tickFormat. Legal values are
* any valid d3 4.0 format specifier.
* @param {function(*):string} [params.format] - The format function to use.
* If provided, the formatSpecifier argument is ignored.
*/
function AxisTicks(params) {
Transform.call(this, [], params);
}
var prototype$48 = inherits(AxisTicks, Transform);
prototype$48.transform = function(_, pulse) {
if (this.value != null && !_.modified()) {
return pulse.StopPropagation;
}
var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
ticks = this.value,
scale = _.scale,
count = _.count,
format = _.format || tickFormat$1(scale, count, _.formatSpecifier),
values = _.values || tickValues(scale, count);
if (ticks) out.rem = ticks;
ticks = values.map(function(value) {
return ingest({value: value, label: format(value)})
});
if (_.extra) {
// add an extra tick pegged to the initial domain value
// this is used to generate axes with 'binned' domains
ticks.push(ingest({
extra: {value: ticks[0].value},
label: ''
}));
}
return (out.source = out.add = this.value = ticks), out;
};
/**
* Joins a set of data elements against a set of visual items.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): object} [params.item] - An item generator function.
* @param {function(object): *} [params.key] - The key field associating data and visual items.
*/
function DataJoin(params) {
Transform.call(this, null, params);
}
var prototype$49 = inherits(DataJoin, Transform);
function defaultItemCreate() {
return ingest({});
}
function isExit(t) {
return t.exit;
}
prototype$49.transform = function(_, pulse) {
var df = pulse.dataflow,
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
item = _.item || defaultItemCreate,
key = _.key || tupleid,
map = this.value;
if (!map) {
pulse = pulse.addAll();
this.value = map = fastmap().test(isExit);
}
if (_.modified('key') || pulse.modified(key)) {
error('DataJoin does not support modified key function or fields.');
}
pulse.visit(pulse.ADD, function(t) {
var k = key(t),
x = map.get(k);
if (x) {
(x.exit ? (--map.empty, out.add) : out.mod).push(x);
} else {
map.set(k, (x = item(t)));
out.add.push(x);
}
x.datum = t;
x.exit = false;
});
pulse.visit(pulse.MOD, function(t) {
var k = key(t),
x = map.get(k);
if (x) {
x.datum = t;
out.mod.push(x);
}
});
pulse.visit(pulse.REM, function(t) {
var k = key(t),
x = map.get(k);
if (t === x.datum && !x.exit) {
out.rem.push(x);
x.exit = true;
++map.empty;
}
});
if (_.clean && map.empty > df.cleanThreshold) df.runAfter(map.clean);
return out;
};
/**
* Invokes encoding functions for visual items.
* @constructor
* @param {object} params - The parameters to the encoding functions. This
* parameter object will be passed through to all invoked encoding functions.
* @param {object} param.encoders - The encoding functions
* @param {function(object, object): boolean} [param.encoders.update] - Update encoding set
* @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set
* @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set
*/
function Encode(params) {
Transform.call(this, null, params);
}
var prototype$50 = inherits(Encode, Transform);
prototype$50.transform = function(_, pulse) {
var out = pulse.fork(pulse.ADD_REM),
encode = pulse.encode,
reenter = encode === 'enter',
update = _.encoders.update || falsy,
enter = _.encoders.enter || falsy,
exit = _.encoders.exit || falsy,
set = (encode && !reenter ? _.encoders[encode] : update) || falsy;
if (pulse.changed(pulse.ADD)) {
pulse.visit(pulse.ADD, function(t) {
enter(t, _);
update(t, _);
if (set !== falsy && set !== update) set(t, _);
});
out.modifies(enter.output);
out.modifies(update.output);
if (set !== falsy && set !== update) out.modifies(set.output);
}
if (pulse.changed(pulse.REM) && exit !== falsy) {
pulse.visit(pulse.REM, function(t) { exit(t, _); });
out.modifies(exit.output);
}
if (reenter || set !== falsy) {
var flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0);
if (reenter) {
pulse.visit(flag, function(t) {
var mod = enter(t, _);
if (set(t, _) || mod) out.mod.push(t);
});
if (out.mod.length) out.modifies(enter.output);
} else {
pulse.visit(flag, function(t) {
if (set(t, _)) out.mod.push(t);
});
}
if (out.mod.length) out.modifies(set.output);
}
return out;
};
var discrete$1 = {}
discrete$1[Quantile] = quantile$1;
discrete$1[Quantize] = quantize$2;
discrete$1[Threshold] = threshold$2;
discrete$1[BinLinear] = bin$2;
discrete$1[BinOrdinal] = bin$2;
function labelValues(scale, count, gradient) {
if (gradient) return scale.domain();
var values = discrete$1[scale.type];
return values ? values(scale) : tickValues(scale, count);
}
function quantize$2(scale) {
var domain = scale.domain(),
x0 = domain[0],
x1 = peek(domain),
n = scale.range().length,
values = new Array(n),
i = 0;
values[0] = x0;
while (++i < n) values[i] = (i * x1 - (i - n) * x0) / n;
return values.max = x1, values;
}
function quantile$1(scale) {
var domain = scale.domain(),
values = [domain[0]].concat(scale.quantiles());
return values.max = peek(domain), values;
}
function threshold$2(scale) {
var values = [-Infinity].concat(scale.domain());
return values.max = +Infinity, values;
}
function bin$2(scale) {
var values = scale.domain();
return values.max = values.pop(), values;
}
function labelFormat(scale, format) {
return discrete$1[scale.type] ? formatRange(format) : formatPoint(format);
}
function formatRange(format) {
return function(value, index, array) {
var limit = array[index + 1] || array.max || +Infinity,
lo = formatValue(value, format),
hi = formatValue(limit, format);
return lo && hi ? lo + '\u2013' + hi : hi ? '< ' + hi : '\u2265 ' + lo;
};
}
function formatValue(value, format) {
return isFinite(value) ? format(value) : null;
}
function formatPoint(format) {
return function(value) {
return format(value);
};
}
/**
* Generates legend entries for visualizing a scale.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {Scale} params.scale - The scale to generate items for.
* @param {*} [params.count=10] - The approximate number of items, or
* desired tick interval, to use.
* @param {Array<*>} [params.values] - The exact tick values to use.
* These must be legal domain values for the provided scale.
* If provided, the count argument is ignored.
* @param {function(*):string} [params.formatSpecifier] - A format specifier
* to use in conjunction with scale.tickFormat. Legal values are
* any valid d3 4.0 format specifier.
* @param {function(*):string} [params.format] - The format function to use.
* If provided, the formatSpecifier argument is ignored.
*/
function LegendEntries(params) {
Transform.call(this, [], params);
}
var prototype$51 = inherits(LegendEntries, Transform);
prototype$51.transform = function(_, pulse) {
if (this.value != null && !_.modified()) {
return pulse.StopPropagation;
}
var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
total = 0,
items = this.value,
grad = _.type === 'gradient',
scale = _.scale,
count = _.count == null ? 5 : _.count,
format = _.format || tickFormat$1(scale, count, _.formatSpecifier),
values = _.values || labelValues(scale, count, grad);
format = labelFormat(scale, format);
if (items) out.rem = items;
if (grad) {
var domain = _.values ? scale.domain() : values,
fraction = scaleFraction(scale, domain[0], peek(domain));
} else {
var size = _.size,
offset;
if (isFunction(size)) {
// if first value maps to size zero, remove from list (vega#717)
if (!_.values && scale(values[0]) === 0) {
values = values.slice(1);
}
// compute size offset for legend entries
offset = values.reduce(function(max, value) {
return Math.max(max, size(value, _));
}, 0);
} else {
size = constant$1(offset = size || 8);
}
}
items = values.map(function(value, index) {
var t = ingest({
index: index,
label: format(value, index, values),
value: value
});
if (grad) {
t.perc = fraction(value);
} else {
t.offset = offset;
t.size = size(value, _);
t.total = Math.round(total);
total += t.size;
}
return t;
});
return (out.source = out.add = this.value = items), out;
};
var Paths = fastmap({
'line': line$3,
'line-radial': lineR,
'curve': curve,
'curve-radial': curveR,
'orthogonal-horizontal': orthoX,
'orthogonal-vertical': orthoY,
'orthogonal-radial': orthoR,
'diagonal-horizontal': diagonalX,
'diagonal-vertical': diagonalY,
'diagonal-radial': diagonalR
});
function sourceX(t) { return t.source.x; }
function sourceY(t) { return t.source.y; }
function targetX(t) { return t.target.x; }
function targetY(t) { return t.target.y; }
/**
* Layout paths linking source and target elements.
* @constructor
* @param {object} params - The parameters for this operator.
*/
function LinkPath(params) {
Transform.call(this, {}, params);
}
var prototype$52 = inherits(LinkPath, Transform);
prototype$52.transform = function(_, pulse) {
var sx = _.sourceX || sourceX,
sy = _.sourceY || sourceY,
tx = _.targetX || targetX,
ty = _.targetY || targetY,
as = _.as || 'path',
orient = _.orient || 'vertical',
shape = _.shape || 'line',
path = Paths.get(shape + '-' + orient) || Paths.get(shape);
if (!path) {
error('LinkPath unsupported type: ' + _.shape + '-' + _.orient);
}
pulse.visit(pulse.SOURCE, function(t) {
t[as] = path(sx(t), sy(t), tx(t), ty(t));
});
return pulse.reflow(_.modified()).modifies(as);
};
// -- Link Path Generation Methods -----
function line$3(sx, sy, tx, ty) {
return 'M' + sx + ',' + sy +
'L' + tx + ',' + ty;
}
function lineR(sa, sr, ta, tr) {
return line$3(
sr * Math.cos(sa), sr * Math.sin(sa),
tr * Math.cos(ta), tr * Math.sin(ta)
);
}
function curve(sx, sy, tx, ty) {
var dx = tx - sx,
dy = ty - sy,
ix = 0.2 * (dx + dy),
iy = 0.2 * (dy - dx);
return 'M' + sx + ',' + sy +
'C' + (sx+ix) + ',' + (sy+iy) +
' ' + (tx+iy) + ',' + (ty-ix) +
' ' + tx + ',' + ty;
}
function curveR(sa, sr, ta, tr) {
return curve(
sr * Math.cos(sa), sr * Math.sin(sa),
tr * Math.cos(ta), tr * Math.sin(ta)
);
}
function orthoX(sx, sy, tx, ty) {
return 'M' + sx + ',' + sy +
'V' + ty + 'H' + tx;
}
function orthoY(sx, sy, tx, ty) {
return 'M' + sx + ',' + sy +
'H' + tx + 'V' + ty;
}
function orthoR(sa, sr, ta, tr) {
var sc = Math.cos(sa),
ss = Math.sin(sa),
tc = Math.cos(ta),
ts = Math.sin(ta),
sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa;
return 'M' + (sr*sc) + ',' + (sr*ss) +
'A' + sr + ',' + sr + ' 0 0,' + (sf?1:0) +
' ' + (sr*tc) + ',' + (sr*ts) +
'L' + (tr*tc) + ',' + (tr*ts);
}
function diagonalX(sx, sy, tx, ty) {
var m = (sx + tx) / 2;
return 'M' + sx + ',' + sy +
'C' + m + ',' + sy +
' ' + m + ',' + ty +
' ' + tx + ',' + ty;
}
function diagonalY(sx, sy, tx, ty) {
var m = (sy + ty) / 2;
return 'M' + sx + ',' + sy +
'C' + sx + ',' + m +
' ' + tx + ',' + m +
' ' + tx + ',' + ty;
}
function diagonalR(sa, sr, ta, tr) {
var sc = Math.cos(sa),
ss = Math.sin(sa),
tc = Math.cos(ta),
ts = Math.sin(ta),
mr = (sr + tr) / 2;
return 'M' + (sr*sc) + ',' + (sr*ss) +
'C' + (mr*sc) + ',' + (mr*ss) +
' ' + (mr*tc) + ',' + (mr*ts) +
' ' + (tr*tc) + ',' + (tr*ts);
}
/**
* Pie and donut chart layout.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The value field to size pie segments.
* @param {number} [params.startAngle=0] - The start angle (in radians) of the layout.
* @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout.
* @param {boolean} [params.sort] - Boolean flag for sorting sectors by value.
*/
function Pie(params) {
Transform.call(this, null, params);
}
var prototype$53 = inherits(Pie, Transform);
prototype$53.transform = function(_, pulse) {
var as = _.as || ['startAngle', 'endAngle'],
startAngle = as[0],
endAngle = as[1],
field = _.field || one,
start = _.startAngle || 0,
stop = _.endAngle != null ? _.endAngle : 2 * Math.PI,
data = pulse.source,
values = data.map(field),
n = values.length,
a = start,
k = (stop - start) / sum(values),
index = sequence(n),
i, t, v;
if (_.sort) {
index.sort(function(a, b) {
return values[a] - values[b];
});
}
for (i=0; i<n; ++i) {
v = values[index[i]];
t = data[index[i]];
t[startAngle] = a;
t[endAngle] = (a += v * k);
}
this.value = values;
return pulse.reflow(_.modified()).modifies(as);
};
var DEFAULT_COUNT = 5;
var INCLUDE_ZERO = toSet([Linear$1, Pow, Sqrt]);
var SKIP$2 = toSet([
'set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount',
'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'nice', 'zero',
'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma'
]);
/**
* Maintains a scale function mapping data values to visual channels.
* @constructor
* @param {object} params - The parameters for this operator.
*/
function Scale(params) {
Transform.call(this, null, params);
this.modified(true); // always treat as modified
}
var prototype$54 = inherits(Scale, Transform);
prototype$54.transform = function(_, pulse) {
var df = pulse.dataflow,
scale = this.value,
prop;
if (!scale || _.modified('type')) {
this.value = scale = scale$1((_.type || Linear$1).toLowerCase())();
}
for (prop in _) if (!SKIP$2[prop]) {
isFunction(scale[prop])
? scale[prop](_[prop])
: df.warn('Unsupported scale property: ' + prop);
}
configureRange(scale, _, configureDomain(scale, _), df);
return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
};
function configureDomain(scale, _, df) {
// check raw domain, if provided use that and exit early
var raw = rawDomain(scale, _.domainRaw);
if (raw > -1) return raw;
var domain = _.domain,
zero = _.zero || (_.zero === undefined && INCLUDE_ZERO[scale.type]),
n, mid;
if (!domain) return 0;
// adjust domain based on zero, min, max settings
if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) {
n = ((domain = domain.slice()).length - 1) || 1;
if (zero) {
if (domain[0] > 0) domain[0] = 0;
if (domain[n] < 0) domain[n] = 0;
}
if (_.domainMin != null) domain[0] = _.domainMin;
if (_.domainMax != null) domain[n] = _.domainMax;
if (_.domainMid != null) {
mid = _.domainMid;
if (mid < domain[0] || mid > domain[n]) {
df.warn('Scale domainMid exceeds domain min or max.', mid);
}
domain.splice(n, 0, mid);
}
}
// set the scale domain
scale.domain(domain);
// perform 'nice' adjustment as requested
if (_.nice && scale.nice) scale.nice((_.nice !== true && +_.nice) || null);
// return the cardinality of the domain
return domain.length;
}
function rawDomain(scale, raw) {
return raw ? (scale.domain(raw), raw.length) : -1;
}
function configureRange(scale, _, count) {
var round = _.round || false,
range = _.range;
// if range step specified, calculate full range extent
if (_.rangeStep != null) {
range = configureRangeStep(scale.type, _, count);
}
// else if a range scheme is defined, use that
else if (_.scheme) {
range = configureScheme(scale.type, _, count);
if (isFunction(range)) return scale.interpolator(range);
}
// given a range array for a sequential scale, convert to interpolator
else if (range && scale.type === Sequential) {
return scale.interpolator(interpolateRgbBasis(flip(range, _.reverse)));
}
// configure rounding / interpolation
if (range && _.interpolate && scale.interpolate) {
scale.interpolate(getInterpolate(_.interpolate, _.interpolateGamma));
} else if (isFunction(scale.round)) {
scale.round(round);
} else if (isFunction(scale.rangeRound)) {
scale.interpolate(round ? interpolateRound : interpolate);
}
if (range) scale.range(flip(range, _.reverse));
}
function configureRangeStep(type, _, count) {
if (type !== Band && type !== Point) {
error('Only band and point scales support rangeStep.');
}
// calculate full range based on requested step size and padding
var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0,
inner = type === Point ? 1
: ((_.paddingInner != null ? _.paddingInner : _.padding) || 0);
return [0, _.rangeStep * bandSpace(count, inner, outer)];
}
function configureScheme(type, _, count) {
var name = _.scheme.toLowerCase(),
scheme = getScheme(name),
extent = _.schemeExtent,
discrete;
if (!scheme) {
error('Unrecognized scheme name: ' + _.scheme);
}
// determine size for potential discrete range
count = (type === Threshold) ? count + 1
: (type === BinOrdinal) ? count - 1
: (type === Quantile || type === Quantize) ? (+_.schemeCount || DEFAULT_COUNT)
: count;
// adjust and/or quantize scheme as appropriate
return type === Sequential ? adjustScheme(scheme, extent, _.reverse)
: !extent && (discrete = getScheme(name + '-' + count)) ? discrete
: isFunction(scheme) ? quantize$3(adjustScheme(scheme, extent), count)
: type === Ordinal ? scheme : scheme.slice(0, count);
}
function adjustScheme(scheme, extent, reverse) {
return (isFunction(scheme) && (extent || reverse))
? interpolateRange(scheme, flip(extent || [0, 1], reverse))
: scheme;
}
function flip(array, reverse) {
return reverse ? array.slice().reverse() : array;
}
function quantize$3(interpolator, count) {
var samples = new Array(count),
n = (count - 1) || 1;
for (var i = 0; i < count; ++i) samples[i] = interpolator(i / n);
return samples;
}
var Center = 'center';
var Normalize = 'normalize';
/**
* Stack layout for visualization elements.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The value field to stack.
* @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby.
* @param {function(object,object): number} [params.sort] - A comparator for stack sorting.
* @param {string} [offset='zero'] - One of 'zero', 'center', 'normalize'.
*/
function Stack(params) {
Transform.call(this, null, params);
}
var prototype$55 = inherits(Stack, Transform);
prototype$55.transform = function(_, pulse) {
var as = _.as || ['y0', 'y1'],
y0 = as[0],
y1 = as[1],
field = _.field || one,
offset = _.offset,
groups, group, i, j, n, m,
max, off, scale, t, a, b, v;
// partition, sum, and sort the stack groups
groups = partition$1(pulse.source, _.groupby, _.sort, field);
// compute stack layouts per group
for (i=0, n=groups.length, max=groups.max; i<n; ++i) {
group = groups[i];
off = offset === Center ? (max - group.sum)/2 : 0;
scale = offset === Normalize ? (1/group.sum) : 1;
// set stack coordinates for each datum in group
for (b=off, v=0, j=0, m=group.length; j<m; ++j) {
t = group[j];
a = b; // use previous value for start point
v += field(t);
b = scale * v + off; // compute end point
t[y0] = a;
t[y1] = b;
}
}
return pulse.reflow(_.modified()).modifies(as);
};
function partition$1(data, groupby, sort, field) {
var groups = [],
get = function(f) { return f(t); },
map, i, n, m, t, k, g, s, max;
// partition data points into stack groups
if (groupby == null) {
groups.push(data.slice());
} else {
for (map={}, i=0, n=data.length; i<n; ++i) {
t = data[i];
k = groupby.map(get);
g = map[k] || (groups.push(map[k] = []), map[k]);
g.push(t);
}
}
// compute sums of groups, sort groups as needed
for (k=0, max=0, m=groups.length; k<m; ++k) {
g = groups[k];
for (i=0, s=0, n=g.length; i<n; ++i) {
s += field(g[i]);
}
g.sum = s;
if (s > max) max = s;
if (sort) g.sort(sort);
}
groups.max = max;
return groups;
}
var LinkPathDefinition = {
"type": "LinkPath",
"metadata": {"modifies": true},
"params": [
{ "name": "sourceX", "type": "field", "default": "source.x" },
{ "name": "sourceY", "type": "field", "default": "source.y" },
{ "name": "targetX", "type": "field", "default": "target.x" },
{ "name": "targetY", "type": "field", "default": "target.y" },
{ "name": "orient", "type": "enum", "default": "vertical",
"values": ["horizontal", "vertical", "radial"] },
{ "name": "shape", "type": "enum", "default": "line",
"values": ["line", "curve", "diagonal", "orthogonal"] },
{ "name": "as", "type": "string", "default": "path" }
]
};
var PieDefinition = {
"type": "Pie",
"metadata": {"modifies": true},
"params": [
{ "name": "field", "type": "field" },
{ "name": "startAngle", "type": "number", "default": 0 },
{ "name": "endAngle", "type": "number", "default": 6.283185307179586 },
{ "name": "sort", "type": "boolean", "default": false },
{ "name": "as", "type": "string", "array": true, "length": 2, "default": ["startAngle", "endAngle"] }
]
};
var StackDefinition = {
"type": "Stack",
"metadata": {"modifies": true},
"params": [
{ "name": "field", "type": "field" },
{ "name": "groupby", "type": "field", "array": true },
{ "name": "sort", "type": "compare" },
{ "name": "offset", "type": "enum", "default": "zero", "values": ["zero", "center", "normalize"] },
{ "name": "as", "type": "string", "array": true, "length": 2, "default": ["y0", "y1"] }
]
};
register(LinkPathDefinition, LinkPath);
register(PieDefinition, Pie);
register(StackDefinition, Stack);
transform('AxisTicks', AxisTicks);
transform('DataJoin', DataJoin);
transform('Encode', Encode);
transform('LegendEntries', LegendEntries);
transform('Scale', Scale);
function forceCenter(x, y) {
var nodes;
if (x == null) x = 0;
if (y == null) y = 0;
function force() {
var i,
n = nodes.length,
node,
sx = 0,
sy = 0;
for (i = 0; i < n; ++i) {
node = nodes[i], sx += node.x, sy += node.y;
}
for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) {
node = nodes[i], node.x -= sx, node.y -= sy;
}
}
force.initialize = function(_) {
nodes = _;
};
force.x = function(_) {
return arguments.length ? (x = +_, force) : x;
};
force.y = function(_) {
return arguments.length ? (y = +_, force) : y;
};
return force;
}
function constant$7(x) {
return function() {
return x;
};
}
function jiggle() {
return (Math.random() - 0.5) * 1e-6;
}
function tree_add(d) {
var x = +this._x.call(null, d),
y = +this._y.call(null, d);
return add$4(this.cover(x, y), x, y, d);
}
function add$4(tree, x, y, d) {
if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points
var parent,
node = tree._root,
leaf = {data: d},
x0 = tree._x0,
y0 = tree._y0,
x1 = tree._x1,
y1 = tree._y1,
xm,
ym,
xp,
yp,
right,
bottom,
i,
j;
// If the tree is empty, initialize the root as a leaf.
if (!node) return tree._root = leaf, tree;
// Find the existing leaf for the new point, or add it.
while (node.length) {
if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree;
}
// Is the new point is exactly coincident with the existing point?
xp = +tree._x.call(null, node.data);
yp = +tree._y.call(null, node.data);
if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree;
// Otherwise, split the leaf node until the old and new point are separated.
do {
parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4);
if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
} while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm)));
return parent[j] = node, parent[i] = leaf, tree;
}
function addAll(data) {
var d, i, n = data.length,
x,
y,
xz = new Array(n),
yz = new Array(n),
x0 = Infinity,
y0 = Infinity,
x1 = -Infinity,
y1 = -Infinity;
// Compute the points and their extent.
for (i = 0; i < n; ++i) {
if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue;
xz[i] = x;
yz[i] = y;
if (x < x0) x0 = x;
if (x > x1) x1 = x;
if (y < y0) y0 = y;
if (y > y1) y1 = y;
}
// If there were no (valid) points, inherit the existing extent.
if (x1 < x0) x0 = this._x0, x1 = this._x1;
if (y1 < y0) y0 = this._y0, y1 = this._y1;
// Expand the tree to cover the new points.
this.cover(x0, y0).cover(x1, y1);
// Add the new points.
for (i = 0; i < n; ++i) {
add$4(this, xz[i], yz[i], data[i]);
}
return this;
}
function tree_cover(x, y) {
if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points
var x0 = this._x0,
y0 = this._y0,
x1 = this._x1,
y1 = this._y1;
// If the quadtree has no extent, initialize them.
// Integer extent are necessary so that if we later double the extent,
// the existing quadrant boundaries don’t change due to floating point error!
if (isNaN(x0)) {
x1 = (x0 = Math.floor(x)) + 1;
y1 = (y0 = Math.floor(y)) + 1;
}
// Otherwise, double repeatedly to cover.
else if (x0 > x || x > x1 || y0 > y || y > y1) {
var z = x1 - x0,
node = this._root,
parent,
i;
switch (i = (y < (y0 + y1) / 2) << 1 | (x < (x0 + x1) / 2)) {
case 0: {
do parent = new Array(4), parent[i] = node, node = parent;
while (z *= 2, x1 = x0 + z, y1 = y0 + z, x > x1 || y > y1);
break;
}
case 1: {
do parent = new Array(4), parent[i] = node, node = parent;
while (z *= 2, x0 = x1 - z, y1 = y0 + z, x0 > x || y > y1);
break;
}
case 2: {
do parent = new Array(4), parent[i] = node, node = parent;
while (z *= 2, x1 = x0 + z, y0 = y1 - z, x > x1 || y0 > y);
break;
}
case 3: {
do parent = new Array(4), parent[i] = node, node = parent;
while (z *= 2, x0 = x1 - z, y0 = y1 - z, x0 > x || y0 > y);
break;
}
}
if (this._root && this._root.length) this._root = node;
}
// If the quadtree covers the point already, just return.
else return this;
this._x0 = x0;
this._y0 = y0;
this._x1 = x1;
this._y1 = y1;
return this;
}
function tree_data() {
var data = [];
this.visit(function(node) {
if (!node.length) do data.push(node.data); while (node = node.next)
});
return data;
}
function tree_extent(_) {
return arguments.length
? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1])
: isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]];
}
function Quad(node, x0, y0, x1, y1) {
this.node = node;
this.x0 = x0;
this.y0 = y0;
this.x1 = x1;
this.y1 = y1;
}
function tree_find(x, y, radius) {
var data,
x0 = this._x0,
y0 = this._y0,
x1,
y1,
x2,
y2,
x3 = this._x1,
y3 = this._y1,
quads = [],
node = this._root,
q,
i;
if (node) quads.push(new Quad(node, x0, y0, x3, y3));
if (radius == null) radius = Infinity;
else {
x0 = x - radius, y0 = y - radius;
x3 = x + radius, y3 = y + radius;
radius *= radius;
}
while (q = quads.pop()) {
// Stop searching if this quadrant can’t contain a closer node.
if (!(node = q.node)
|| (x1 = q.x0) > x3
|| (y1 = q.y0) > y3
|| (x2 = q.x1) < x0
|| (y2 = q.y1) < y0) continue;
// Bisect the current quadrant.
if (node.length) {
var xm = (x1 + x2) / 2,
ym = (y1 + y2) / 2;
quads.push(
new Quad(node[3], xm, ym, x2, y2),
new Quad(node[2], x1, ym, xm, y2),
new Quad(node[1], xm, y1, x2, ym),
new Quad(node[0], x1, y1, xm, ym)
);
// Visit the closest quadrant first.
if (i = (y >= ym) << 1 | (x >= xm)) {
q = quads[quads.length - 1];
quads[quads.length - 1] = quads[quads.length - 1 - i];
quads[quads.length - 1 - i] = q;
}
}
// Visit this point. (Visiting coincident points isn’t necessary!)
else {
var dx = x - +this._x.call(null, node.data),
dy = y - +this._y.call(null, node.data),
d2 = dx * dx + dy * dy;
if (d2 < radius) {
var d = Math.sqrt(radius = d2);
x0 = x - d, y0 = y - d;
x3 = x + d, y3 = y + d;
data = node.data;
}
}
}
return data;
}
function tree_remove(d) {
if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points
var parent,
node = this._root,
retainer,
previous,
next,
x0 = this._x0,
y0 = this._y0,
x1 = this._x1,
y1 = this._y1,
x,
y,
xm,
ym,
right,
bottom,
i,
j;
// If the tree is empty, initialize the root as a leaf.
if (!node) return this;
// Find the leaf node for the point.
// While descending, also retain the deepest parent with a non-removed sibling.
if (node.length) while (true) {
if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm;
if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym;
if (!(parent = node, node = node[i = bottom << 1 | right])) return this;
if (!node.length) break;
if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i;
}
// Find the point to remove.
while (node.data !== d) if (!(previous = node, node = node.next)) return this;
if (next = node.next) delete node.next;
// If there are multiple coincident points, remove just the point.
if (previous) return (next ? previous.next = next : delete previous.next), this;
// If this is the root point, remove it.
if (!parent) return this._root = next, this;
// Remove this leaf.
next ? parent[i] = next : delete parent[i];
// If the parent now contains exactly one leaf, collapse superfluous parents.
if ((node = parent[0] || parent[1] || parent[2] || parent[3])
&& node === (parent[3] || parent[2] || parent[1] || parent[0])
&& !node.length) {
if (retainer) retainer[j] = node;
else this._root = node;
}
return this;
}
function removeAll(data) {
for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);
return this;
}
function tree_root() {
return this._root;
}
function tree_size() {
var size = 0;
this.visit(function(node) {
if (!node.length) do ++size; while (node = node.next)
});
return size;
}
function tree_visit(callback) {
var quads = [], q, node = this._root, child, x0, y0, x1, y1;
if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1));
while (q = quads.pop()) {
if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {
var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));
if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));
if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));
if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));
}
}
return this;
}
function tree_visitAfter(callback) {
var quads = [], next = [], q;
if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1));
while (q = quads.pop()) {
var node = q.node;
if (node.length) {
var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));
if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));
if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));
if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));
}
next.push(q);
}
while (q = next.pop()) {
callback(q.node, q.x0, q.y0, q.x1, q.y1);
}
return this;
}
function defaultX(d) {
return d[0];
}
function tree_x(_) {
return arguments.length ? (this._x = _, this) : this._x;
}
function defaultY(d) {
return d[1];
}
function tree_y(_) {
return arguments.length ? (this._y = _, this) : this._y;
}
function quadtree(nodes, x, y) {
var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN);
return nodes == null ? tree : tree.addAll(nodes);
}
function Quadtree(x, y, x0, y0, x1, y1) {
this._x = x;
this._y = y;
this._x0 = x0;
this._y0 = y0;
this._x1 = x1;
this._y1 = y1;
this._root = undefined;
}
function leaf_copy(leaf) {
var copy = {data: leaf.data}, next = copy;
while (leaf = leaf.next) next = next.next = {data: leaf.data};
return copy;
}
var treeProto = quadtree.prototype = Quadtree.prototype;
treeProto.copy = function() {
var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1),
node = this._root,
nodes,
child;
if (!node) return copy;
if (!node.length) return copy._root = leaf_copy(node), copy;
nodes = [{source: node, target: copy._root = new Array(4)}];
while (node = nodes.pop()) {
for (var i = 0; i < 4; ++i) {
if (child = node.source[i]) {
if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)});
else node.target[i] = leaf_copy(child);
}
}
}
return copy;
};
treeProto.add = tree_add;
treeProto.addAll = addAll;
treeProto.cover = tree_cover;
treeProto.data = tree_data;
treeProto.extent = tree_extent;
treeProto.find = tree_find;
treeProto.remove = tree_remove;
treeProto.removeAll = removeAll;
treeProto.root = tree_root;
treeProto.size = tree_size;
treeProto.visit = tree_visit;
treeProto.visitAfter = tree_visitAfter;
treeProto.x = tree_x;
treeProto.y = tree_y;
function x$2(d) {
return d.x + d.vx;
}
function y$2(d) {
return d.y + d.vy;
}
function forceCollide(radius) {
var nodes,
radii,
strength = 1,
iterations = 1;
if (typeof radius !== "function") radius = constant$7(radius == null ? 1 : +radius);
function force() {
var i, n = nodes.length,
tree,
node,
xi,
yi,
ri,
ri2;
for (var k = 0; k < iterations; ++k) {
tree = quadtree(nodes, x$2, y$2).visitAfter(prepare);
for (i = 0; i < n; ++i) {
node = nodes[i];
ri = radii[node.index], ri2 = ri * ri;
xi = node.x + node.vx;
yi = node.y + node.vy;
tree.visit(apply);
}
}
function apply(quad, x0, y0, x1, y1) {
var data = quad.data, rj = quad.r, r = ri + rj;
if (data) {
if (data.index > node.index) {
var x = xi - data.x - data.vx,
y = yi - data.y - data.vy,
l = x * x + y * y;
if (l < r * r) {
if (x === 0) x = jiggle(), l += x * x;
if (y === 0) y = jiggle(), l += y * y;
l = (r - (l = Math.sqrt(l))) / l * strength;
node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));
node.vy += (y *= l) * r;
data.vx -= x * (r = 1 - r);
data.vy -= y * r;
}
}
return;
}
return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;
}
}
function prepare(quad) {
if (quad.data) return quad.r = radii[quad.data.index];
for (var i = quad.r = 0; i < 4; ++i) {
if (quad[i] && quad[i].r > quad.r) {
quad.r = quad[i].r;
}
}
}
function initialize() {
if (!nodes) return;
var i, n = nodes.length, node;
radii = new Array(n);
for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);
}
force.initialize = function(_) {
nodes = _;
initialize();
};
force.iterations = function(_) {
return arguments.length ? (iterations = +_, force) : iterations;
};
force.strength = function(_) {
return arguments.length ? (strength = +_, force) : strength;
};
force.radius = function(_) {
return arguments.length ? (radius = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : radius;
};
return force;
}
function index(d) {
return d.index;
}
function find(nodeById, nodeId) {
var node = nodeById.get(nodeId);
if (!node) throw new Error("missing: " + nodeId);
return node;
}
function forceLink(links) {
var id = index,
strength = defaultStrength,
strengths,
distance = constant$7(30),
distances,
nodes,
count,
bias,
iterations = 1;
if (links == null) links = [];
function defaultStrength(link) {
return 1 / Math.min(count[link.source.index], count[link.target.index]);
}
function force(alpha) {
for (var k = 0, n = links.length; k < iterations; ++k) {
for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) {
link = links[i], source = link.source, target = link.target;
x = target.x + target.vx - source.x - source.vx || jiggle();
y = target.y + target.vy - source.y - source.vy || jiggle();
l = Math.sqrt(x * x + y * y);
l = (l - distances[i]) / l * alpha * strengths[i];
x *= l, y *= l;
target.vx -= x * (b = bias[i]);
target.vy -= y * b;
source.vx += x * (b = 1 - b);
source.vy += y * b;
}
}
}
function initialize() {
if (!nodes) return;
var i,
n = nodes.length,
m = links.length,
nodeById = map$1(nodes, id),
link;
for (i = 0, count = new Array(n); i < m; ++i) {
link = links[i], link.index = i;
if (typeof link.source !== "object") link.source = find(nodeById, link.source);
if (typeof link.target !== "object") link.target = find(nodeById, link.target);
count[link.source.index] = (count[link.source.index] || 0) + 1;
count[link.target.index] = (count[link.target.index] || 0) + 1;
}
for (i = 0, bias = new Array(m); i < m; ++i) {
link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);
}
strengths = new Array(m), initializeStrength();
distances = new Array(m), initializeDistance();
}
function initializeStrength() {
if (!nodes) return;
for (var i = 0, n = links.length; i < n; ++i) {
strengths[i] = +strength(links[i], i, links);
}
}
function initializeDistance() {
if (!nodes) return;
for (var i = 0, n = links.length; i < n; ++i) {
distances[i] = +distance(links[i], i, links);
}
}
force.initialize = function(_) {
nodes = _;
initialize();
};
force.links = function(_) {
return arguments.length ? (links = _, initialize(), force) : links;
};
force.id = function(_) {
return arguments.length ? (id = _, force) : id;
};
force.iterations = function(_) {
return arguments.length ? (iterations = +_, force) : iterations;
};
force.strength = function(_) {
return arguments.length ? (strength = typeof _ === "function" ? _ : constant$7(+_), initializeStrength(), force) : strength;
};
force.distance = function(_) {
return arguments.length ? (distance = typeof _ === "function" ? _ : constant$7(+_), initializeDistance(), force) : distance;
};
return force;
}
var frame = 0;
var timeout = 0;
var interval = 0;
var pokeDelay = 1000;
var taskHead;
var taskTail;
var clockLast = 0;
var clockNow = 0;
var clockSkew = 0;
var clock = typeof performance === "object" && performance.now ? performance : Date;
var setFrame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : function(f) { setTimeout(f, 17); };
function now() {
return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
}
function clearNow() {
clockNow = 0;
}
function Timer() {
this._call =
this._time =
this._next = null;
}
Timer.prototype = timer.prototype = {
constructor: Timer,
restart: function(callback, delay, time) {
if (typeof callback !== "function") throw new TypeError("callback is not a function");
time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
if (!this._next && taskTail !== this) {
if (taskTail) taskTail._next = this;
else taskHead = this;
taskTail = this;
}
this._call = callback;
this._time = time;
sleep();
},
stop: function() {
if (this._call) {
this._call = null;
this._time = Infinity;
sleep();
}
}
};
function timer(callback, delay, time) {
var t = new Timer;
t.restart(callback, delay, time);
return t;
}
function timerFlush() {
now(); // Get the current time, if not already set.
++frame; // Pretend we’ve set an alarm, if we haven’t already.
var t = taskHead, e;
while (t) {
if ((e = clockNow - t._time) >= 0) t._call.call(null, e);
t = t._next;
}
--frame;
}
function wake() {
clockNow = (clockLast = clock.now()) + clockSkew;
frame = timeout = 0;
try {
timerFlush();
} finally {
frame = 0;
nap();
clockNow = 0;
}
}
function poke() {
var now = clock.now(), delay = now - clockLast;
if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
}
function nap() {
var t0, t1 = taskHead, t2, time = Infinity;
while (t1) {
if (t1._call) {
if (time > t1._time) time = t1._time;
t0 = t1, t1 = t1._next;
} else {
t2 = t1._next, t1._next = null;
t1 = t0 ? t0._next = t2 : taskHead = t2;
}
}
taskTail = t0;
sleep(time);
}
function sleep(time) {
if (frame) return; // Soonest alarm already set, or will be.
if (timeout) timeout = clearTimeout(timeout);
var delay = time - clockNow;
if (delay > 24) {
if (time < Infinity) timeout = setTimeout(wake, delay);
if (interval) interval = clearInterval(interval);
} else {
if (!interval) clockLast = clockNow, interval = setInterval(poke, pokeDelay);
frame = 1, setFrame(wake);
}
}
function x$3(d) {
return d.x;
}
function y$3(d) {
return d.y;
}
var initialRadius = 10;
var initialAngle = Math.PI * (3 - Math.sqrt(5));
function forceSimulation(nodes) {
var simulation,
alpha = 1,
alphaMin = 0.001,
alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),
alphaTarget = 0,
velocityDecay = 0.6,
forces = map$1(),
stepper = timer(step),
event = dispatch("tick", "end");
if (nodes == null) nodes = [];
function step() {
tick();
event.call("tick", simulation);
if (alpha < alphaMin) {
stepper.stop();
event.call("end", simulation);
}
}
function tick() {
var i, n = nodes.length, node;
alpha += (alphaTarget - alpha) * alphaDecay;
forces.each(function(force) {
force(alpha);
});
for (i = 0; i < n; ++i) {
node = nodes[i];
if (node.fx == null) node.x += node.vx *= velocityDecay;
else node.x = node.fx, node.vx = 0;
if (node.fy == null) node.y += node.vy *= velocityDecay;
else node.y = node.fy, node.vy = 0;
}
}
function initializeNodes() {
for (var i = 0, n = nodes.length, node; i < n; ++i) {
node = nodes[i], node.index = i;
if (isNaN(node.x) || isNaN(node.y)) {
var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle;
node.x = radius * Math.cos(angle);
node.y = radius * Math.sin(angle);
}
if (isNaN(node.vx) || isNaN(node.vy)) {
node.vx = node.vy = 0;
}
}
}
function initializeForce(force) {
if (force.initialize) force.initialize(nodes);
return force;
}
initializeNodes();
return simulation = {
tick: tick,
restart: function() {
return stepper.restart(step), simulation;
},
stop: function() {
return stepper.stop(), simulation;
},
nodes: function(_) {
return arguments.length ? (nodes = _, initializeNodes(), forces.each(initializeForce), simulation) : nodes;
},
alpha: function(_) {
return arguments.length ? (alpha = +_, simulation) : alpha;
},
alphaMin: function(_) {
return arguments.length ? (alphaMin = +_, simulation) : alphaMin;
},
alphaDecay: function(_) {
return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;
},
alphaTarget: function(_) {
return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;
},
velocityDecay: function(_) {
return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;
},
force: function(name, _) {
return arguments.length > 1 ? ((_ == null ? forces.remove(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name);
},
find: function(x, y, radius) {
var i = 0,
n = nodes.length,
dx,
dy,
d2,
node,
closest;
if (radius == null) radius = Infinity;
else radius *= radius;
for (i = 0; i < n; ++i) {
node = nodes[i];
dx = x - node.x;
dy = y - node.y;
d2 = dx * dx + dy * dy;
if (d2 < radius) closest = node, radius = d2;
}
return closest;
},
on: function(name, _) {
return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
}
};
}
function forceManyBody() {
var nodes,
node,
alpha,
strength = constant$7(-30),
strengths,
distanceMin2 = 1,
distanceMax2 = Infinity,
theta2 = 0.81;
function force(_) {
var i, n = nodes.length, tree = quadtree(nodes, x$3, y$3).visitAfter(accumulate);
for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);
}
function initialize() {
if (!nodes) return;
var i, n = nodes.length, node;
strengths = new Array(n);
for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);
}
function accumulate(quad) {
var strength = 0, q, c, x, y, i;
// For internal nodes, accumulate forces from child quadrants.
if (quad.length) {
for (x = y = i = 0; i < 4; ++i) {
if ((q = quad[i]) && (c = q.value)) {
strength += c, x += c * q.x, y += c * q.y;
}
}
quad.x = x / strength;
quad.y = y / strength;
}
// For leaf nodes, accumulate forces from coincident quadrants.
else {
q = quad;
q.x = q.data.x;
q.y = q.data.y;
do strength += strengths[q.data.index];
while (q = q.next);
}
quad.value = strength;
}
function apply(quad, x1, _, x2) {
if (!quad.value) return true;
var x = quad.x - node.x,
y = quad.y - node.y,
w = x2 - x1,
l = x * x + y * y;
// Apply the Barnes-Hut approximation if possible.
// Limit forces for very close nodes; randomize direction if coincident.
if (w * w / theta2 < l) {
if (l < distanceMax2) {
if (x === 0) x = jiggle(), l += x * x;
if (y === 0) y = jiggle(), l += y * y;
if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
node.vx += x * quad.value * alpha / l;
node.vy += y * quad.value * alpha / l;
}
return true;
}
// Otherwise, process points directly.
else if (quad.length || l >= distanceMax2) return;
// Limit forces for very close nodes; randomize direction if coincident.
if (quad.data !== node || quad.next) {
if (x === 0) x = jiggle(), l += x * x;
if (y === 0) y = jiggle(), l += y * y;
if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
}
do if (quad.data !== node) {
w = strengths[quad.data.index] * alpha / l;
node.vx += x * w;
node.vy += y * w;
} while (quad = quad.next);
}
force.initialize = function(_) {
nodes = _;
initialize();
};
force.strength = function(_) {
return arguments.length ? (strength = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : strength;
};
force.distanceMin = function(_) {
return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);
};
force.distanceMax = function(_) {
return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);
};
force.theta = function(_) {
return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);
};
return force;
}
function forceX(x) {
var strength = constant$7(0.1),
nodes,
strengths,
xz;
if (typeof x !== "function") x = constant$7(x == null ? 0 : +x);
function force(alpha) {
for (var i = 0, n = nodes.length, node; i < n; ++i) {
node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;
}
}
function initialize() {
if (!nodes) return;
var i, n = nodes.length;
strengths = new Array(n);
xz = new Array(n);
for (i = 0; i < n; ++i) {
strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
}
}
force.initialize = function(_) {
nodes = _;
initialize();
};
force.strength = function(_) {
return arguments.length ? (strength = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : strength;
};
force.x = function(_) {
return arguments.length ? (x = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : x;
};
return force;
}
function forceY(y) {
var strength = constant$7(0.1),
nodes,
strengths,
yz;
if (typeof y !== "function") y = constant$7(y == null ? 0 : +y);
function force(alpha) {
for (var i = 0, n = nodes.length, node; i < n; ++i) {
node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;
}
}
function initialize() {
if (!nodes) return;
var i, n = nodes.length;
strengths = new Array(n);
yz = new Array(n);
for (i = 0; i < n; ++i) {
strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
}
}
force.initialize = function(_) {
nodes = _;
initialize();
};
force.strength = function(_) {
return arguments.length ? (strength = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : strength;
};
force.y = function(_) {
return arguments.length ? (y = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : y;
};
return force;
}
var ForceMap = {
center: forceCenter,
collide: forceCollide,
nbody: forceManyBody,
link: forceLink,
x: forceX,
y: forceY
};
var Forces = 'forces';
var ForceParams = [
'alpha', 'alphaMin', 'alphaTarget',
'velocityDecay', 'forces'
];
var ForceConfig = ['static', 'iterations'];
var ForceOutput = ['x', 'y', 'vx', 'vy'];
/**
* Force simulation layout.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {Array<object>} params.forces - The forces to apply.
*/
function Force(params) {
Transform.call(this, null, params);
}
var prototype$56 = inherits(Force, Transform);
prototype$56.transform = function(_, pulse) {
var sim = this.value,
change = pulse.changed(pulse.ADD_REM),
params = _.modified(ForceParams),
iters = _.iterations || 300;
// configure simulation
if (!sim) {
this.value = sim = simulation(pulse.source, _);
sim.on('tick', rerun(pulse.dataflow, this));
if (!_.static) change = true, sim.tick(); // ensure we run on init
pulse.modifies('index');
} else {
if (change) pulse.modifies('index'), sim.nodes(pulse.source);
if (params) setup(sim, _);
}
// run simulation
if (params || change || _.modified(ForceConfig)
|| (pulse.changed() && _.restart))
{
sim.alpha(Math.max(sim.alpha(), _.alpha || 1))
.alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters));
if (_.static) {
for (sim.stop(); --iters >= 0;) sim.tick();
} else {
if (sim.stopped()) sim.restart();
if (!change) return pulse.StopPropagation; // defer to sim ticks
}
}
return this.finish(_, pulse);
};
prototype$56.finish = function(_, pulse) {
var dataflow = pulse.dataflow;
// inspect dependencies, touch link source data
for (var args=this._argops, j=0, m=args.length, arg; j<m; ++j) {
arg = args[j];
if (arg.name !== Forces || arg.op._argval.force !== 'link') {
continue;
}
for (var ops=arg.op._argops, i=0, n=ops.length, op; i<n; ++i) {
if (ops[i].name === 'links' && (op = ops[i].op.source)) {
dataflow.touch(op); break;
}
}
}
// reflow all nodes
return pulse.reflow(_.modified()).modifies(ForceOutput);
};
function rerun(df, op) {
return function() { df.touch(op).run(); }
}
function simulation(nodes, _) {
var sim = forceSimulation(nodes),
stopped = false,
stop = sim.stop,
restart = sim.restart;
sim.stopped = function() { return stopped; };
sim.restart = function() { return stopped = false, restart(); };
sim.stop = function() { return stopped = true, stop(); };
return setup(sim, _, true).on('end', function() { stopped = true; });
}
function setup(sim, _, init) {
var f = array$1(_.forces), i, n, p;
for (i=0, n=ForceParams.length; i<n; ++i) {
p = ForceParams[i];
if (p !== Forces && _.modified(p)) sim[p](_[p]);
}
for (i=0, n=f.length; i<n; ++i) {
if (init || _.modified(Forces, i)) {
sim.force(Forces + i, getForce(f[i]));
}
}
for (n=(sim.numForces || 0); i<n; ++i) {
sim.force(Forces + i, null); // remove
}
return sim.numForces = f.length, sim;
}
function getForce(_) {
var f, p;
if (!ForceMap.hasOwnProperty(_.force)) {
error('Unrecognized force: ' + _.force);
}
f = ForceMap[_.force]();
for (p in _) if (isFunction(f[p])) f[p](_[p]);
return f;
}
var ForceDefinition = {
"type": "Force",
"metadata": {"modifies": true},
"params": [
{ "name": "static", "type": "boolean", "default": false },
{ "name": "restart", "type": "boolean", "default": false },
{ "name": "iterations", "type": "number", "default": 300 },
{ "name": "alpha", "type": "number", "default": 1 },
{ "name": "alphaMin", "type": "number", "default": 0.001 },
{ "name": "alphaTarget", "type": "number", "default": 0 },
{ "name": "velocityDecay", "type": "number", "default": 0.4 },
{ "name": "forces", "type": "param", "array": true,
"params": [
{
"key": {"force": "center"},
"params": [
{ "name": "x", "type": "number", "default": 0 },
{ "name": "y", "type": "number", "default": 0 }
]
},
{
"key": {"force": "collide"},
"params": [
{ "name": "radius", "type": "number", "expr": true },
{ "name": "strength", "type": "number", "default": 0.7 },
{ "name": "iterations", "type": "number", "default": 1 }
]
},
{
"key": {"force": "nbody"},
"params": [
{ "name": "strength", "type": "number", "default": -30 },
{ "name": "theta", "type": "number", "default": 0.9 },
{ "name": "distanceMin", "type": "number", "default": 1 },
{ "name": "distanceMax", "type": "number" }
]
},
{
"key": {"force": "link"},
"params": [
{ "name": "links", "type": "data" },
{ "name": "id", "type": "field" },
{ "name": "distance", "type": "number", "default": 30, "expr": true },
{ "name": "strength", "type": "number", "expr": true },
{ "name": "iterations", "type": "number", "default": 1 }
]
},
{
"key": {"force": "x"},
"params": [
{ "name": "strength", "type": "number", "default": 0.1 },
{ "name": "x", "type": "field" }
]
},
{
"key": {"force": "y"},
"params": [
{ "name": "strength", "type": "number", "default": 0.1 },
{ "name": "y", "type": "field" }
]
}
] },
{
"name": "as", "type": "string", "array": true, "modify": false,
"default": ["x", "y", "vx", "vy"]
}
]
};
register(ForceDefinition, Force);
function defaultSeparation(a, b) {
return a.parent === b.parent ? 1 : 2;
}
function meanX(children) {
return children.reduce(meanXReduce, 0) / children.length;
}
function meanXReduce(x, c) {
return x + c.x;
}
function maxY(children) {
return 1 + children.reduce(maxYReduce, 0);
}
function maxYReduce(y, c) {
return Math.max(y, c.y);
}
function leafLeft(node) {
var children;
while (children = node.children) node = children[0];
return node;
}
function leafRight(node) {
var children;
while (children = node.children) node = children[children.length - 1];
return node;
}
function cluster() {
var separation = defaultSeparation,
dx = 1,
dy = 1,
nodeSize = false;
function cluster(root) {
var previousNode,
x = 0;
// First walk, computing the initial x & y values.
root.eachAfter(function(node) {
var children = node.children;
if (children) {
node.x = meanX(children);
node.y = maxY(children);
} else {
node.x = previousNode ? x += separation(node, previousNode) : 0;
node.y = 0;
previousNode = node;
}
});
var left = leafLeft(root),
right = leafRight(root),
x0 = left.x - separation(left, right) / 2,
x1 = right.x + separation(right, left) / 2;
// Second walk, normalizing x & y to the desired size.
return root.eachAfter(nodeSize ? function(node) {
node.x = (node.x - root.x) * dx;
node.y = (root.y - node.y) * dy;
} : function(node) {
node.x = (node.x - x0) / (x1 - x0) * dx;
node.y = (1 - (root.y ? node.y / root.y : 1)) * dy;
});
}
cluster.separation = function(x) {
return arguments.length ? (separation = x, cluster) : separation;
};
cluster.size = function(x) {
return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? null : [dx, dy]);
};
cluster.nodeSize = function(x) {
return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null);
};
return cluster;
}
function count(node) {
var sum = 0,
children = node.children,
i = children && children.length;
if (!i) sum = 1;
else while (--i >= 0) sum += children[i].value;
node.value = sum;
}
function node_count() {
return this.eachAfter(count);
}
function node_each(callback) {
var node = this, current, next = [node], children, i, n;
do {
current = next.reverse(), next = [];
while (node = current.pop()) {
callback(node), children = node.children;
if (children) for (i = 0, n = children.length; i < n; ++i) {
next.push(children[i]);
}
}
} while (next.length);
return this;
}
function node_eachBefore(callback) {
var node = this, nodes = [node], children, i;
while (node = nodes.pop()) {
callback(node), children = node.children;
if (children) for (i = children.length - 1; i >= 0; --i) {
nodes.push(children[i]);
}
}
return this;
}
function node_eachAfter(callback) {
var node = this, nodes = [node], next = [], children, i, n;
while (node = nodes.pop()) {
next.push(node), children = node.children;
if (children) for (i = 0, n = children.length; i < n; ++i) {
nodes.push(children[i]);
}
}
while (node = next.pop()) {
callback(node);
}
return this;
}
function node_sum(value) {
return this.eachAfter(function(node) {
var sum = +value(node.data) || 0,
children = node.children,
i = children && children.length;
while (--i >= 0) sum += children[i].value;
node.value = sum;
});
}
function node_sort(compare) {
return this.eachBefore(function(node) {
if (node.children) {
node.children.sort(compare);
}
});
}
function node_path(end) {
var start = this,
ancestor = leastCommonAncestor(start, end),
nodes = [start];
while (start !== ancestor) {
start = start.parent;
nodes.push(start);
}
var k = nodes.length;
while (end !== ancestor) {
nodes.splice(k, 0, end);
end = end.parent;
}
return nodes;
}
function leastCommonAncestor(a, b) {
if (a === b) return a;
var aNodes = a.ancestors(),
bNodes = b.ancestors(),
c = null;
a = aNodes.pop();
b = bNodes.pop();
while (a === b) {
c = a;
a = aNodes.pop();
b = bNodes.pop();
}
return c;
}
function node_ancestors() {
var node = this, nodes = [node];
while (node = node.parent) {
nodes.push(node);
}
return nodes;
}
function node_descendants() {
var nodes = [];
this.each(function(node) {
nodes.push(node);
});
return nodes;
}
function node_leaves() {
var leaves = [];
this.eachBefore(function(node) {
if (!node.children) {
leaves.push(node);
}
});
return leaves;
}
function node_links() {
var root = this, links = [];
root.each(function(node) {
if (node !== root) { // Don’t include the root’s parent, if any.
links.push({source: node.parent, target: node});
}
});
return links;
}
function hierarchy(data, children) {
var root = new Node(data),
valued = +data.value && (root.value = data.value),
node,
nodes = [root],
child,
childs,
i,
n;
if (children == null) children = defaultChildren;
while (node = nodes.pop()) {
if (valued) node.value = +node.data.value;
if ((childs = children(node.data)) && (n = childs.length)) {
node.children = new Array(n);
for (i = n - 1; i >= 0; --i) {
nodes.push(child = node.children[i] = new Node(childs[i]));
child.parent = node;
child.depth = node.depth + 1;
}
}
}
return root.eachBefore(computeHeight);
}
function node_copy() {
return hierarchy(this).eachBefore(copyData);
}
function defaultChildren(d) {
return d.children;
}
function copyData(node) {
node.data = node.data.data;
}
function computeHeight(node) {
var height = 0;
do node.height = height;
while ((node = node.parent) && (node.height < ++height));
}
function Node(data) {
this.data = data;
this.depth =
this.height = 0;
this.parent = null;
}
Node.prototype = hierarchy.prototype = {
constructor: Node,
count: node_count,
each: node_each,
eachAfter: node_eachAfter,
eachBefore: node_eachBefore,
sum: node_sum,
sort: node_sort,
path: node_path,
ancestors: node_ancestors,
descendants: node_descendants,
leaves: node_leaves,
links: node_links,
copy: node_copy
};
function Node$2(value) {
this._ = value;
this.next = null;
}
function shuffle$1(array) {
var i,
n = (array = array.slice()).length,
head = null,
node = head;
while (n) {
var next = new Node$2(array[n - 1]);
if (node) node = node.next = next;
else node = head = next;
array[i] = array[--n];
}
return {
head: head,
tail: node
};
}
function enclose(circles) {
return encloseN(shuffle$1(circles), []);
}
function encloses(a, b) {
var dx = b.x - a.x,
dy = b.y - a.y,
dr = a.r - b.r;
return dr * dr + 1e-6 > dx * dx + dy * dy;
}
// Returns the smallest circle that contains circles L and intersects circles B.
function encloseN(L, B) {
var circle,
l0 = null,
l1 = L.head,
l2,
p1;
switch (B.length) {
case 1: circle = enclose1(B[0]); break;
case 2: circle = enclose2(B[0], B[1]); break;
case 3: circle = enclose3(B[0], B[1], B[2]); break;
}
while (l1) {
p1 = l1._, l2 = l1.next;
if (!circle || !encloses(circle, p1)) {
// Temporarily truncate L before l1.
if (l0) L.tail = l0, l0.next = null;
else L.head = L.tail = null;
B.push(p1);
circle = encloseN(L, B); // Note: reorders L!
B.pop();
// Move l1 to the front of L and reconnect the truncated list L.
if (L.head) l1.next = L.head, L.head = l1;
else l1.next = null, L.head = L.tail = l1;
l0 = L.tail, l0.next = l2;
} else {
l0 = l1;
}
l1 = l2;
}
L.tail = l0;
return circle;
}
function enclose1(a) {
return {
x: a.x,
y: a.y,
r: a.r
};
}
function enclose2(a, b) {
var x1 = a.x, y1 = a.y, r1 = a.r,
x2 = b.x, y2 = b.y, r2 = b.r,
x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1,
l = Math.sqrt(x21 * x21 + y21 * y21);
return {
x: (x1 + x2 + x21 / l * r21) / 2,
y: (y1 + y2 + y21 / l * r21) / 2,
r: (l + r1 + r2) / 2
};
}
function enclose3(a, b, c) {
var x1 = a.x, y1 = a.y, r1 = a.r,
x2 = b.x, y2 = b.y, r2 = b.r,
x3 = c.x, y3 = c.y, r3 = c.r,
a2 = 2 * (x1 - x2),
b2 = 2 * (y1 - y2),
c2 = 2 * (r2 - r1),
d2 = x1 * x1 + y1 * y1 - r1 * r1 - x2 * x2 - y2 * y2 + r2 * r2,
a3 = 2 * (x1 - x3),
b3 = 2 * (y1 - y3),
c3 = 2 * (r3 - r1),
d3 = x1 * x1 + y1 * y1 - r1 * r1 - x3 * x3 - y3 * y3 + r3 * r3,
ab = a3 * b2 - a2 * b3,
xa = (b2 * d3 - b3 * d2) / ab - x1,
xb = (b3 * c2 - b2 * c3) / ab,
ya = (a3 * d2 - a2 * d3) / ab - y1,
yb = (a2 * c3 - a3 * c2) / ab,
A = xb * xb + yb * yb - 1,
B = 2 * (xa * xb + ya * yb + r1),
C = xa * xa + ya * ya - r1 * r1,
r = (-B - Math.sqrt(B * B - 4 * A * C)) / (2 * A);
return {
x: xa + xb * r + x1,
y: ya + yb * r + y1,
r: r
};
}
function place(a, b, c) {
var ax = a.x,
ay = a.y,
da = b.r + c.r,
db = a.r + c.r,
dx = b.x - ax,
dy = b.y - ay,
dc = dx * dx + dy * dy;
if (dc) {
var x = 0.5 + ((db *= db) - (da *= da)) / (2 * dc),
y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
c.x = ax + x * dx + y * dy;
c.y = ay + x * dy - y * dx;
} else {
c.x = ax + db;
c.y = ay;
}
}
function intersects(a, b) {
var dx = b.x - a.x,
dy = b.y - a.y,
dr = a.r + b.r;
return dr * dr - 1e-6 > dx * dx + dy * dy;
}
function distance1(a, b) {
var l = a._.r;
while (a !== b) l += 2 * (a = a.next)._.r;
return l - b._.r;
}
function distance2(node, x, y) {
var a = node._,
b = node.next._,
ab = a.r + b.r,
dx = (a.x * b.r + b.x * a.r) / ab - x,
dy = (a.y * b.r + b.y * a.r) / ab - y;
return dx * dx + dy * dy;
}
function Node$1(circle) {
this._ = circle;
this.next = null;
this.previous = null;
}
function packEnclose(circles) {
if (!(n = circles.length)) return 0;
var a, b, c, n;
// Place the first circle.
a = circles[0], a.x = 0, a.y = 0;
if (!(n > 1)) return a.r;
// Place the second circle.
b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0;
if (!(n > 2)) return a.r + b.r;
// Place the third circle.
place(b, a, c = circles[2]);
// Initialize the weighted centroid.
var aa = a.r * a.r,
ba = b.r * b.r,
ca = c.r * c.r,
oa = aa + ba + ca,
ox = aa * a.x + ba * b.x + ca * c.x,
oy = aa * a.y + ba * b.y + ca * c.y,
cx, cy, i, j, k, sj, sk;
// Initialize the front-chain using the first three circles a, b and c.
a = new Node$1(a), b = new Node$1(b), c = new Node$1(c);
a.next = c.previous = b;
b.next = a.previous = c;
c.next = b.previous = a;
// Attempt to place each remaining circle…
pack: for (i = 3; i < n; ++i) {
place(a._, b._, c = circles[i]), c = new Node$1(c);
// Find the closest intersecting circle on the front-chain, if any.
// “Closeness” is determined by linear distance along the front-chain.
// “Ahead” or “behind” is likewise determined by linear distance.
j = b.next, k = a.previous, sj = b._.r, sk = a._.r;
do {
if (sj <= sk) {
if (intersects(j._, c._)) {
if (sj + a._.r + b._.r > distance1(j, b)) a = j; else b = j;
a.next = b, b.previous = a, --i;
continue pack;
}
sj += j._.r, j = j.next;
} else {
if (intersects(k._, c._)) {
if (distance1(a, k) > sk + a._.r + b._.r) a = k; else b = k;
a.next = b, b.previous = a, --i;
continue pack;
}
sk += k._.r, k = k.previous;
}
} while (j !== k.next);
// Success! Insert the new circle c between a and b.
c.previous = a, c.next = b, a.next = b.previous = b = c;
// Update the weighted centroid.
oa += ca = c._.r * c._.r;
ox += ca * c._.x;
oy += ca * c._.y;
// Compute the new closest circle pair to the centroid.
aa = distance2(a, cx = ox / oa, cy = oy / oa);
while ((c = c.next) !== b) {
if ((ca = distance2(c, cx, cy)) < aa) {
a = c, aa = ca;
}
}
b = a.next;
}
// Compute the enclosing circle of the front chain.
a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = enclose(a);
// Translate the circles to put the enclosing circle around the origin.
for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y;
return c.r;
}
function optional(f) {
return f == null ? null : required(f);
}
function required(f) {
if (typeof f !== "function") throw new Error;
return f;
}
function constantZero() {
return 0;
}
function constant$8(x) {
return function() {
return x;
};
}
function defaultRadius(d) {
return Math.sqrt(d.value);
}
function pack$1() {
var radius = null,
dx = 1,
dy = 1,
padding = constantZero;
function pack(root) {
root.x = dx / 2, root.y = dy / 2;
if (radius) {
root.eachBefore(radiusLeaf(radius))
.eachAfter(packChildren(padding, 0.5))
.eachBefore(translateChild(1));
} else {
root.eachBefore(radiusLeaf(defaultRadius))
.eachAfter(packChildren(constantZero, 1))
.eachAfter(packChildren(padding, root.r / Math.min(dx, dy)))
.eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r)));
}
return root;
}
pack.radius = function(x) {
return arguments.length ? (radius = optional(x), pack) : radius;
};
pack.size = function(x) {
return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy];
};
pack.padding = function(x) {
return arguments.length ? (padding = typeof x === "function" ? x : constant$8(+x), pack) : padding;
};
return pack;
}
function radiusLeaf(radius) {
return function(node) {
if (!node.children) {
node.r = Math.max(0, +radius(node) || 0);
}
};
}
function packChildren(padding, k) {
return function(node) {
if (children = node.children) {
var children,
i,
n = children.length,
r = padding(node) * k || 0,
e;
if (r) for (i = 0; i < n; ++i) children[i].r += r;
e = packEnclose(children);
if (r) for (i = 0; i < n; ++i) children[i].r -= r;
node.r = e + r;
}
};
}
function translateChild(k) {
return function(node) {
var parent = node.parent;
node.r *= k;
if (parent) {
node.x = parent.x + k * node.x;
node.y = parent.y + k * node.y;
}
};
}
function roundNode(node) {
node.x0 = Math.round(node.x0);
node.y0 = Math.round(node.y0);
node.x1 = Math.round(node.x1);
node.y1 = Math.round(node.y1);
}
function treemapDice(parent, x0, y0, x1, y1) {
var nodes = parent.children,
node,
i = -1,
n = nodes.length,
k = parent.value && (x1 - x0) / parent.value;
while (++i < n) {
node = nodes[i], node.y0 = y0, node.y1 = y1;
node.x0 = x0, node.x1 = x0 += node.value * k;
}
}
function partition$2() {
var dx = 1,
dy = 1,
padding = 0,
round = false;
function partition(root) {
var n = root.height + 1;
root.x0 =
root.y0 = padding;
root.x1 = dx;
root.y1 = dy / n;
root.eachBefore(positionNode(dy, n));
if (round) root.eachBefore(roundNode);
return root;
}
function positionNode(dy, n) {
return function(node) {
if (node.children) {
treemapDice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n);
}
var x0 = node.x0,
y0 = node.y0,
x1 = node.x1 - padding,
y1 = node.y1 - padding;
if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
node.x0 = x0;
node.y0 = y0;
node.x1 = x1;
node.y1 = y1;
};
}
partition.round = function(x) {
return arguments.length ? (round = !!x, partition) : round;
};
partition.size = function(x) {
return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy];
};
partition.padding = function(x) {
return arguments.length ? (padding = +x, partition) : padding;
};
return partition;
}
var keyPrefix = "$";
var preroot = {depth: -1};
var ambiguous = {};
function defaultId(d) {
return d.id;
}
function defaultParentId(d) {
return d.parentId;
}
function stratify() {
var id = defaultId,
parentId = defaultParentId;
function stratify(data) {
var d,
i,
n = data.length,
root,
parent,
node,
nodes = new Array(n),
nodeId,
nodeKey,
nodeByKey = {};
for (i = 0; i < n; ++i) {
d = data[i], node = nodes[i] = new Node(d);
if ((nodeId = id(d, i, data)) != null && (nodeId += "")) {
nodeKey = keyPrefix + (node.id = nodeId);
nodeByKey[nodeKey] = nodeKey in nodeByKey ? ambiguous : node;
}
}
for (i = 0; i < n; ++i) {
node = nodes[i], nodeId = parentId(data[i], i, data);
if (nodeId == null || !(nodeId += "")) {
if (root) throw new Error("multiple roots");
root = node;
} else {
parent = nodeByKey[keyPrefix + nodeId];
if (!parent) throw new Error("missing: " + nodeId);
if (parent === ambiguous) throw new Error("ambiguous: " + nodeId);
if (parent.children) parent.children.push(node);
else parent.children = [node];
node.parent = parent;
}
}
if (!root) throw new Error("no root");
root.parent = preroot;
root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);
root.parent = null;
if (n > 0) throw new Error("cycle");
return root;
}
stratify.id = function(x) {
return arguments.length ? (id = required(x), stratify) : id;
};
stratify.parentId = function(x) {
return arguments.length ? (parentId = required(x), stratify) : parentId;
};
return stratify;
}
function defaultSeparation$1(a, b) {
return a.parent === b.parent ? 1 : 2;
}
// function radialSeparation(a, b) {
// return (a.parent === b.parent ? 1 : 2) / a.depth;
// }
// This function is used to traverse the left contour of a subtree (or
// subforest). It returns the successor of v on this contour. This successor is
// either given by the leftmost child of v or by the thread of v. The function
// returns null if and only if v is on the highest level of its subtree.
function nextLeft(v) {
var children = v.children;
return children ? children[0] : v.t;
}
// This function works analogously to nextLeft.
function nextRight(v) {
var children = v.children;
return children ? children[children.length - 1] : v.t;
}
// Shifts the current subtree rooted at w+. This is done by increasing
// prelim(w+) and mod(w+) by shift.
function moveSubtree(wm, wp, shift) {
var change = shift / (wp.i - wm.i);
wp.c -= change;
wp.s += shift;
wm.c += change;
wp.z += shift;
wp.m += shift;
}
// All other shifts, applied to the smaller subtrees between w- and w+, are
// performed by this function. To prepare the shifts, we have to adjust
// change(w+), shift(w+), and change(w-).
function executeShifts(v) {
var shift = 0,
change = 0,
children = v.children,
i = children.length,
w;
while (--i >= 0) {
w = children[i];
w.z += shift;
w.m += shift;
shift += w.s + (change += w.c);
}
}
// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise,
// returns the specified (default) ancestor.
function nextAncestor(vim, v, ancestor) {
return vim.a.parent === v.parent ? vim.a : ancestor;
}
function TreeNode(node, i) {
this._ = node;
this.parent = null;
this.children = null;
this.A = null; // default ancestor
this.a = this; // ancestor
this.z = 0; // prelim
this.m = 0; // mod
this.c = 0; // change
this.s = 0; // shift
this.t = null; // thread
this.i = i; // number
}
TreeNode.prototype = Object.create(Node.prototype);
function treeRoot(root) {
var tree = new TreeNode(root, 0),
node,
nodes = [tree],
child,
children,
i,
n;
while (node = nodes.pop()) {
if (children = node._.children) {
node.children = new Array(n = children.length);
for (i = n - 1; i >= 0; --i) {
nodes.push(child = node.children[i] = new TreeNode(children[i], i));
child.parent = node;
}
}
}
(tree.parent = new TreeNode(null, 0)).children = [tree];
return tree;
}
// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
function tree() {
var separation = defaultSeparation$1,
dx = 1,
dy = 1,
nodeSize = null;
function tree(root) {
var t = treeRoot(root);
// Compute the layout using Buchheim et al.’s algorithm.
t.eachAfter(firstWalk), t.parent.m = -t.z;
t.eachBefore(secondWalk);
// If a fixed node size is specified, scale x and y.
if (nodeSize) root.eachBefore(sizeNode);
// If a fixed tree size is specified, scale x and y based on the extent.
// Compute the left-most, right-most, and depth-most nodes for extents.
else {
var left = root,
right = root,
bottom = root;
root.eachBefore(function(node) {
if (node.x < left.x) left = node;
if (node.x > right.x) right = node;
if (node.depth > bottom.depth) bottom = node;
});
var s = left === right ? 1 : separation(left, right) / 2,
tx = s - left.x,
kx = dx / (right.x + s + tx),
ky = dy / (bottom.depth || 1);
root.eachBefore(function(node) {
node.x = (node.x + tx) * kx;
node.y = node.depth * ky;
});
}
return root;
}
// Computes a preliminary x-coordinate for v. Before that, FIRST WALK is
// applied recursively to the children of v, as well as the function
// APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the
// node v is placed to the midpoint of its outermost children.
function firstWalk(v) {
var children = v.children,
siblings = v.parent.children,
w = v.i ? siblings[v.i - 1] : null;
if (children) {
executeShifts(v);
var midpoint = (children[0].z + children[children.length - 1].z) / 2;
if (w) {
v.z = w.z + separation(v._, w._);
v.m = v.z - midpoint;
} else {
v.z = midpoint;
}
} else if (w) {
v.z = w.z + separation(v._, w._);
}
v.parent.A = apportion(v, w, v.parent.A || siblings[0]);
}
// Computes all real x-coordinates by summing up the modifiers recursively.
function secondWalk(v) {
v._.x = v.z + v.parent.m;
v.m += v.parent.m;
}
// The core of the algorithm. Here, a new subtree is combined with the
// previous subtrees. Threads are used to traverse the inside and outside
// contours of the left and right subtree up to the highest common level. The
// vertices used for the traversals are vi+, vi-, vo-, and vo+, where the
// superscript o means outside and i means inside, the subscript - means left
// subtree and + means right subtree. For summing up the modifiers along the
// contour, we use respective variables si+, si-, so-, and so+. Whenever two
// nodes of the inside contours conflict, we compute the left one of the
// greatest uncommon ancestors using the function ANCESTOR and call MOVE
// SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.
// Finally, we add a new thread (if necessary).
function apportion(v, w, ancestor) {
if (w) {
var vip = v,
vop = v,
vim = w,
vom = vip.parent.children[0],
sip = vip.m,
sop = vop.m,
sim = vim.m,
som = vom.m,
shift;
while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {
vom = nextLeft(vom);
vop = nextRight(vop);
vop.a = v;
shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);
if (shift > 0) {
moveSubtree(nextAncestor(vim, v, ancestor), v, shift);
sip += shift;
sop += shift;
}
sim += vim.m;
sip += vip.m;
som += vom.m;
sop += vop.m;
}
if (vim && !nextRight(vop)) {
vop.t = vim;
vop.m += sim - sop;
}
if (vip && !nextLeft(vom)) {
vom.t = vip;
vom.m += sip - som;
ancestor = v;
}
}
return ancestor;
}
function sizeNode(node) {
node.x *= dx;
node.y = node.depth * dy;
}
tree.separation = function(x) {
return arguments.length ? (separation = x, tree) : separation;
};
tree.size = function(x) {
return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);
};
tree.nodeSize = function(x) {
return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);
};
return tree;
}
function treemapSlice(parent, x0, y0, x1, y1) {
var nodes = parent.children,
node,
i = -1,
n = nodes.length,
k = parent.value && (y1 - y0) / parent.value;
while (++i < n) {
node = nodes[i], node.x0 = x0, node.x1 = x1;
node.y0 = y0, node.y1 = y0 += node.value * k;
}
}
var phi = (1 + Math.sqrt(5)) / 2;
function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
var rows = [],
nodes = parent.children,
row,
nodeValue,
i0 = 0,
i1 = 0,
n = nodes.length,
dx, dy,
value = parent.value,
sumValue,
minValue,
maxValue,
newRatio,
minRatio,
alpha,
beta;
while (i0 < n) {
dx = x1 - x0, dy = y1 - y0;
// Find the next non-empty node.
do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);
minValue = maxValue = sumValue;
alpha = Math.max(dy / dx, dx / dy) / (value * ratio);
beta = sumValue * sumValue * alpha;
minRatio = Math.max(maxValue / beta, beta / minValue);
// Keep adding nodes while the aspect ratio maintains or improves.
for (; i1 < n; ++i1) {
sumValue += nodeValue = nodes[i1].value;
if (nodeValue < minValue) minValue = nodeValue;
if (nodeValue > maxValue) maxValue = nodeValue;
beta = sumValue * sumValue * alpha;
newRatio = Math.max(maxValue / beta, beta / minValue);
if (newRatio > minRatio) { sumValue -= nodeValue; break; }
minRatio = newRatio;
}
// Position and record the row orientation.
rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});
if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);
else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);
value -= sumValue, i0 = i1;
}
return rows;
}
var treemapSquarify = (function custom(ratio) {
function squarify(parent, x0, y0, x1, y1) {
squarifyRatio(ratio, parent, x0, y0, x1, y1);
}
squarify.ratio = function(x) {
return custom((x = +x) > 1 ? x : 1);
};
return squarify;
})(phi);
function treemap() {
var tile = treemapSquarify,
round = false,
dx = 1,
dy = 1,
paddingStack = [0],
paddingInner = constantZero,
paddingTop = constantZero,
paddingRight = constantZero,
paddingBottom = constantZero,
paddingLeft = constantZero;
function treemap(root) {
root.x0 =
root.y0 = 0;
root.x1 = dx;
root.y1 = dy;
root.eachBefore(positionNode);
paddingStack = [0];
if (round) root.eachBefore(roundNode);
return root;
}
function positionNode(node) {
var p = paddingStack[node.depth],
x0 = node.x0 + p,
y0 = node.y0 + p,
x1 = node.x1 - p,
y1 = node.y1 - p;
if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
node.x0 = x0;
node.y0 = y0;
node.x1 = x1;
node.y1 = y1;
if (node.children) {
p = paddingStack[node.depth + 1] = paddingInner(node) / 2;
x0 += paddingLeft(node) - p;
y0 += paddingTop(node) - p;
x1 -= paddingRight(node) - p;
y1 -= paddingBottom(node) - p;
if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
tile(node, x0, y0, x1, y1);
}
}
treemap.round = function(x) {
return arguments.length ? (round = !!x, treemap) : round;
};
treemap.size = function(x) {
return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];
};
treemap.tile = function(x) {
return arguments.length ? (tile = required(x), treemap) : tile;
};
treemap.padding = function(x) {
return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();
};
treemap.paddingInner = function(x) {
return arguments.length ? (paddingInner = typeof x === "function" ? x : constant$8(+x), treemap) : paddingInner;
};
treemap.paddingOuter = function(x) {
return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();
};
treemap.paddingTop = function(x) {
return arguments.length ? (paddingTop = typeof x === "function" ? x : constant$8(+x), treemap) : paddingTop;
};
treemap.paddingRight = function(x) {
return arguments.length ? (paddingRight = typeof x === "function" ? x : constant$8(+x), treemap) : paddingRight;
};
treemap.paddingBottom = function(x) {
return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant$8(+x), treemap) : paddingBottom;
};
treemap.paddingLeft = function(x) {
return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant$8(+x), treemap) : paddingLeft;
};
return treemap;
}
function treemapBinary(parent, x0, y0, x1, y1) {
var nodes = parent.children,
i, n = nodes.length,
sum, sums = new Array(n + 1);
for (sums[0] = sum = i = 0; i < n; ++i) {
sums[i + 1] = sum += nodes[i].value;
}
partition(0, n, parent.value, x0, y0, x1, y1);
function partition(i, j, value, x0, y0, x1, y1) {
if (i >= j - 1) {
var node = nodes[i];
node.x0 = x0, node.y0 = y0;
node.x1 = x1, node.y1 = y1;
return;
}
var valueOffset = sums[i],
valueTarget = (value / 2) + valueOffset,
k = i + 1,
hi = j - 1;
while (k < hi) {
var mid = k + hi >>> 1;
if (sums[mid] < valueTarget) k = mid + 1;
else hi = mid;
}
var valueLeft = sums[k] - valueOffset,
valueRight = value - valueLeft;
if ((y1 - y0) > (x1 - x0)) {
var yk = (y0 * valueRight + y1 * valueLeft) / value;
partition(i, k, valueLeft, x0, y0, x1, yk);
partition(k, j, valueRight, x0, yk, x1, y1);
} else {
var xk = (x0 * valueRight + x1 * valueLeft) / value;
partition(i, k, valueLeft, x0, y0, xk, y1);
partition(k, j, valueRight, xk, y0, x1, y1);
}
}
}
function treemapSliceDice(parent, x0, y0, x1, y1) {
(parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1);
}
var treemapResquarify = (function custom(ratio) {
function resquarify(parent, x0, y0, x1, y1) {
if ((rows = parent._squarify) && (rows.ratio === ratio)) {
var rows,
row,
nodes,
i,
j = -1,
n,
m = rows.length,
value = parent.value;
while (++j < m) {
row = rows[j], nodes = row.children;
for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;
if (row.dice) treemapDice(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value);
else treemapSlice(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1);
value -= row.value;
}
} else {
parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);
rows.ratio = ratio;
}
}
resquarify.ratio = function(x) {
return custom((x = +x) > 1 ? x : 1);
};
return resquarify;
})(phi);
/**
* Nest tuples into a tree structure, grouped by key values.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {Array<function(object): *>} params.keys - The key fields to nest by, in order.
* @param {function(object): *} [params.key] - Unique key field for each tuple.
* If not provided, the tuple id field is used.
*/
function Nest(params) {
Transform.call(this, null, params);
}
var prototype$57 = inherits(Nest, Transform);
function children(n) {
return n.values;
}
prototype$57.transform = function(_, pulse) {
if (!pulse.source) {
error('Nest transform requires an upstream data source.');
}
var key = _.key || tupleid,
root, tree, map, mod;
if (!this.value || (mod = _.modified()) || pulse.changed()) {
root = array$1(_.keys)
.reduce(function(n, k) { return (n.key(k), n)}, nest())
.entries(pulse.source);
tree = hierarchy({values: root}, children);
map = tree.lookup = {};
tree.each(function(node) {
if (tupleid(node.data) != null) map[key(node.data)] = node;
});
this.value = tree;
}
pulse.source.root = this.value;
return mod ? pulse.fork(pulse.ALL) : pulse;
};
/**
* Stratify a collection of tuples into a tree structure based on
* id and parent id fields.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.key - Unique key field for each tuple.
* @param {function(object): *} params.parentKey - Field with key for parent tuple.
*/
function Stratify(params) {
Transform.call(this, null, params);
}
var prototype$58 = inherits(Stratify, Transform);
prototype$58.transform = function(_, pulse) {
if (!pulse.source) {
error('Stratify transform requires an upstream data source.');
}
var mod = _.modified(), tree, map,
run = !this.value
|| mod
|| pulse.changed(pulse.ADD_REM)
|| pulse.modified(_.key.fields)
|| pulse.modified(_.parentKey.fields);
if (run) {
tree = stratify().id(_.key).parentId(_.parentKey)(pulse.source);
map = tree.lookup = {};
tree.each(function(node) { map[_.key(node.data)] = node; });
this.value = tree;
}
pulse.source.root = this.value;
return mod ? pulse.fork(pulse.ALL) : pulse;
};
/**
* Generate tuples representing links between tree nodes.
* The resulting tuples will contain 'source' and 'target' fields,
* which point to parent and child node tuples, respectively.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} [params.key] - Unique key field for each tuple.
* If not provided, the tuple id field is used.
*/
function TreeLinks(params) {
Transform.call(this, {}, params);
}
var prototype$59 = inherits(TreeLinks, Transform);
function parentTuple(node) {
var p;
return node.parent
&& (p=node.parent.data)
&& (tupleid(p) != null) && p;
}
prototype$59.transform = function(_, pulse) {
if (!pulse.source || !pulse.source.root) {
error('TreeLinks transform requires a backing tree data source.');
}
var root = pulse.source.root,
nodes = root.lookup,
links = this.value,
key = _.key || tupleid,
mods = {},
out = pulse.fork();
function modify(id) {
var link = links[id];
if (link) mods[id] = 1, out.mod.push(link);
}
// process removed tuples
// assumes that if a parent node is removed the child will be, too.
pulse.visit(pulse.REM, function(t) {
var id = key(t),
link = links[id];
if (link) delete links[id], out.rem.push(link);
});
// create new link instances for added nodes with valid parents
pulse.visit(pulse.ADD, function(t) {
var id = key(t), p;
if (p = parentTuple(nodes[id])) {
out.add.push(links[id] = ingest({source: p, target: t}));
mods[id] = 1;
}
});
// process modified nodes and their children
pulse.visit(pulse.MOD, function(t) {
var id = key(t),
node = nodes[id],
kids = node.children;
modify(id);
if (kids) for (var i=0, n=kids.length; i<n; ++i) {
if (!mods[(id=key(kids[i].data))]) modify(id);
}
});
return out;
};
var Tiles = {
binary: treemapBinary,
dice: treemapDice,
slice: treemapSlice,
slicedice: treemapSliceDice,
squarify: treemapSquarify,
resquarify: treemapResquarify
};
var Layouts = {
tidy: tree,
cluster: cluster
};
/**
* Tree layout generator. Supports both 'tidy' and 'cluster' layouts.
*/
function treeLayout(method) {
var m = method || 'tidy';
if (Layouts.hasOwnProperty(m)) return Layouts[m]();
else error('Unrecognized Tree layout method: ' + m);
}
/**
* Treemap layout generator. Adds 'method' and 'ratio' parameters
* to configure the underlying tile method.
*/
function treemapLayout() {
var x = treemap();
x.ratio = function(_) {
var t = x.tile();
if (t.ratio) x.tile(t.ratio(_));
};
x.method = function(_) {
if (Tiles.hasOwnProperty(_)) x.tile(Tiles[_]);
else error('Unrecognized Treemap layout method: ' + _);
};
return x;
}
/**
* Abstract class for tree layout.
* @constructor
* @param {object} params - The parameters for this operator.
*/
function HierarchyLayout(params) {
Transform.call(this, null, params);
}
var prototype$60 = inherits(HierarchyLayout, Transform);
prototype$60.transform = function(_, pulse) {
if (!pulse.source || !pulse.source.root) {
error(this.constructor.name
+ ' transform requires a backing tree data source.');
}
var layout = this.layout(_.method),
fields = this.fields,
root = pulse.source.root,
as = _.as || fields;
if (_.field) root.sum(_.field);
if (_.sort) root.sort(_.sort);
setParams(layout, this.params, _);
try {
this.value = layout(root);
} catch (err) {
error(err);
}
root.each(function(node) { setFields(node, fields, as); });
return pulse.reflow(_.modified()).modifies(as).modifies('leaf');
};
function setParams(layout, params, _) {
for (var p, i=0, n=params.length; i<n; ++i) {
p = params[i];
if (p in _) layout[p](_[p]);
}
}
function setFields(node, fields, as) {
var t = node.data;
for (var i=0, n=fields.length-1; i<n; ++i) {
t[as[i]] = node[fields[i]];
}
t[as[n]] = node.children ? node.children.length : 0;
}
/**
* Tree layout. Depending on the method parameter, performs either
* Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout.
* @constructor
* @param {object} params - The parameters for this operator.
*/
function Tree(params) {
HierarchyLayout.call(this, params);
}
inherits(Tree, HierarchyLayout);
Tree.prototype.layout = treeLayout;
Tree.prototype.params = ['size', 'nodeSize', 'separation'];
Tree.prototype.fields = ['x', 'y', 'depth', 'children'];
/**
* Treemap layout.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The value field to size nodes.
*/
function Treemap(params) {
HierarchyLayout.call(this, params);
}
inherits(Treemap, HierarchyLayout);
Treemap.prototype.layout = treemapLayout;
Treemap.prototype.params = [
'method', 'ratio', 'size', 'round',
'padding', 'paddingInner', 'paddingOuter',
'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'
];
Treemap.prototype.fields = ['x0', 'y0', 'x1', 'y1', 'depth', 'children'];
/**
* Partition tree layout.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The value field to size nodes.
*/
function Partition(params) {
HierarchyLayout.call(this, params);
}
inherits(Partition, HierarchyLayout);
Partition.prototype.layout = partition$2;
Partition.prototype.params = ['size', 'round', 'padding'];
Partition.prototype.fields = Treemap.prototype.fields;
/**
* Packed circle tree layout.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The value field to size nodes.
*/
function Pack(params) {
HierarchyLayout.call(this, params);
}
inherits(Pack, HierarchyLayout);
Pack.prototype.layout = pack$1;
Pack.prototype.params = ['size', 'padding'];
Pack.prototype.fields = ['x', 'y', 'r', 'depth', 'children'];
var NestDefinition = {
"type": "Nest",
"metadata": {"treesource": true},
"params": [
{ "name": "keys", "type": "field", "array": true },
{ "name": "key", "type": "field" }
]
};
var StratifyDefinition = {
"type": "Stratify",
"metadata": {"treesource": true},
"params": [
{ "name": "key", "type": "field", "required": true },
{ "name": "parentKey", "type": "field", "required": true }
]
};
var TreeLinksDefinition = {
"type": "TreeLinks",
"metadata": {"tree": true, "generates": true, "changes": true},
"params": [
{ "name": "key", "type": "field" }
]
}
var PackDefinition = {
"type": "Pack",
"metadata": {"tree": true, "modifies": true},
"params": [
{ "name": "field", "type": "field" },
{ "name": "sort", "type": "compare" },
{ "name": "padding", "type": "number", "default": 0 },
{ "name": "radius", "type": "field", "default": null },
{ "name": "size", "type": "number", "array": true, "length": 2 },
{ "name": "as", "type": "string", "array": true, "length": 3, "default": ["x", "y", "r", "depth", "children"] }
]
};
var PartitionDefinition = {
"type": "Partition",
"metadata": {"tree": true, "modifies": true},
"params": [
{ "name": "field", "type": "field" },
{ "name": "sort", "type": "compare" },
{ "name": "padding", "type": "number", "default": 0 },
{ "name": "round", "type": "boolean", "default": false },
{ "name": "size", "type": "number", "array": true, "length": 2 },
{ "name": "as", "type": "string", "array": true, "length": 4, "default": ["x0", "y0", "x1", "y1", "depth", "children"] }
]
};
var TreeDefinition = {
"type": "Tree",
"metadata": {"tree": true, "modifies": true},
"params": [
{ "name": "field", "type": "field" },
{ "name": "sort", "type": "compare" },
{ "name": "method", "type": "enum", "default": "tidy", "values": ["tidy", "cluster"] },
{ "name": "size", "type": "number", "array": true, "length": 2 },
{ "name": "nodeSize", "type": "number", "array": true, "length": 2 },
{ "name": "as", "type": "string", "array": true, "length": 4, "default": ["x", "y", "depth", "children"] }
]
};
var TreemapDefinition = {
"type": "Treemap",
"metadata": {"tree": true, "modifies": true},
"params": [
{ "name": "field", "type": "field" },
{ "name": "sort", "type": "compare" },
{ "name": "method", "type": "enum", "default": "squarify",
"values": ["squarify", "resquarify", "binary", "dice", "slice", "slicedice"] },
{ "name": "padding", "type": "number", "default": 0 },
{ "name": "paddingInner", "type": "number", "default": 0 },
{ "name": "paddingOuter", "type": "number", "default": 0 },
{ "name": "paddingTop", "type": "number", "default": 0 },
{ "name": "paddingRight", "type": "number", "default": 0 },
{ "name": "paddingBottom", "type": "number", "default": 0 },
{ "name": "paddingLeft", "type": "number", "default": 0 },
{ "name": "ratio", "type": "number", "default": 1.618033988749895 },
{ "name": "round", "type": "boolean", "default": false },
{ "name": "size", "type": "number", "array": true, "length": 2 },
{ "name": "as", "type": "string", "array": true, "length": 4, "default": ["x0", "y0", "x1", "y1", "depth", "children"] }
]
};
register(NestDefinition, Nest);
register(StratifyDefinition, Stratify);
register(TreeLinksDefinition, TreeLinks);
register(PackDefinition, Pack);
register(PartitionDefinition, Partition);
register(TreeDefinition, Tree);
register(TreemapDefinition, Treemap);
function constant$9(x) {
return function() {
return x;
};
}
function x$4(d) {
return d[0];
}
function y$4(d) {
return d[1];
}
function RedBlackTree() {
this._ = null; // root node
}
function RedBlackNode(node) {
node.U = // parent node
node.C = // color - true for red, false for black
node.L = // left node
node.R = // right node
node.P = // previous node
node.N = null; // next node
}
RedBlackTree.prototype = {
constructor: RedBlackTree,
insert: function(after, node) {
var parent, grandpa, uncle;
if (after) {
node.P = after;
node.N = after.N;
if (after.N) after.N.P = node;
after.N = node;
if (after.R) {
after = after.R;
while (after.L) after = after.L;
after.L = node;
} else {
after.R = node;
}
parent = after;
} else if (this._) {
after = RedBlackFirst(this._);
node.P = null;
node.N = after;
after.P = after.L = node;
parent = after;
} else {
node.P = node.N = null;
this._ = node;
parent = null;
}
node.L = node.R = null;
node.U = parent;
node.C = true;
after = node;
while (parent && parent.C) {
grandpa = parent.U;
if (parent === grandpa.L) {
uncle = grandpa.R;
if (uncle && uncle.C) {
parent.C = uncle.C = false;
grandpa.C = true;
after = grandpa;
} else {
if (after === parent.R) {
RedBlackRotateLeft(this, parent);
after = parent;
parent = after.U;
}
parent.C = false;
grandpa.C = true;
RedBlackRotateRight(this, grandpa);
}
} else {
uncle = grandpa.L;
if (uncle && uncle.C) {
parent.C = uncle.C = false;
grandpa.C = true;
after = grandpa;
} else {
if (after === parent.L) {
RedBlackRotateRight(this, parent);
after = parent;
parent = after.U;
}
parent.C = false;
grandpa.C = true;
RedBlackRotateLeft(this, grandpa);
}
}
parent = after.U;
}
this._.C = false;
},
remove: function(node) {
if (node.N) node.N.P = node.P;
if (node.P) node.P.N = node.N;
node.N = node.P = null;
var parent = node.U,
sibling,
left = node.L,
right = node.R,
next,
red;
if (!left) next = right;
else if (!right) next = left;
else next = RedBlackFirst(right);
if (parent) {
if (parent.L === node) parent.L = next;
else parent.R = next;
} else {
this._ = next;
}
if (left && right) {
red = next.C;
next.C = node.C;
next.L = left;
left.U = next;
if (next !== right) {
parent = next.U;
next.U = node.U;
node = next.R;
parent.L = node;
next.R = right;
right.U = next;
} else {
next.U = parent;
parent = next;
node = next.R;
}
} else {
red = node.C;
node = next;
}
if (node) node.U = parent;
if (red) return;
if (node && node.C) { node.C = false; return; }
do {
if (node === this._) break;
if (node === parent.L) {
sibling = parent.R;
if (sibling.C) {
sibling.C = false;
parent.C = true;
RedBlackRotateLeft(this, parent);
sibling = parent.R;
}
if ((sibling.L && sibling.L.C)
|| (sibling.R && sibling.R.C)) {
if (!sibling.R || !sibling.R.C) {
sibling.L.C = false;
sibling.C = true;
RedBlackRotateRight(this, sibling);
sibling = parent.R;
}
sibling.C = parent.C;
parent.C = sibling.R.C = false;
RedBlackRotateLeft(this, parent);
node = this._;
break;
}
} else {
sibling = parent.L;
if (sibling.C) {
sibling.C = false;
parent.C = true;
RedBlackRotateRight(this, parent);
sibling = parent.L;
}
if ((sibling.L && sibling.L.C)
|| (sibling.R && sibling.R.C)) {
if (!sibling.L || !sibling.L.C) {
sibling.R.C = false;
sibling.C = true;
RedBlackRotateLeft(this, sibling);
sibling = parent.L;
}
sibling.C = parent.C;
parent.C = sibling.L.C = false;
RedBlackRotateRight(this, parent);
node = this._;
break;
}
}
sibling.C = true;
node = parent;
parent = parent.U;
} while (!node.C);
if (node) node.C = false;
}
};
function RedBlackRotateLeft(tree, node) {
var p = node,
q = node.R,
parent = p.U;
if (parent) {
if (parent.L === p) parent.L = q;
else parent.R = q;
} else {
tree._ = q;
}
q.U = parent;
p.U = q;
p.R = q.L;
if (p.R) p.R.U = p;
q.L = p;
}
function RedBlackRotateRight(tree, node) {
var p = node,
q = node.L,
parent = p.U;
if (parent) {
if (parent.L === p) parent.L = q;
else parent.R = q;
} else {
tree._ = q;
}
q.U = parent;
p.U = q;
p.L = q.R;
if (p.L) p.L.U = p;
q.R = p;
}
function RedBlackFirst(node) {
while (node.L) node = node.L;
return node;
}
function createEdge(left, right, v0, v1) {
var edge = [null, null],
index = edges.push(edge) - 1;
edge.left = left;
edge.right = right;
if (v0) setEdgeEnd(edge, left, right, v0);
if (v1) setEdgeEnd(edge, right, left, v1);
cells[left.index].halfedges.push(index);
cells[right.index].halfedges.push(index);
return edge;
}
function createBorderEdge(left, v0, v1) {
var edge = [v0, v1];
edge.left = left;
return edge;
}
function setEdgeEnd(edge, left, right, vertex) {
if (!edge[0] && !edge[1]) {
edge[0] = vertex;
edge.left = left;
edge.right = right;
} else if (edge.left === right) {
edge[1] = vertex;
} else {
edge[0] = vertex;
}
}
// Liang–Barsky line clipping.
function clipEdge(edge, x0, y0, x1, y1) {
var a = edge[0],
b = edge[1],
ax = a[0],
ay = a[1],
bx = b[0],
by = b[1],
t0 = 0,
t1 = 1,
dx = bx - ax,
dy = by - ay,
r;
r = x0 - ax;
if (!dx && r > 0) return;
r /= dx;
if (dx < 0) {
if (r < t0) return;
if (r < t1) t1 = r;
} else if (dx > 0) {
if (r > t1) return;
if (r > t0) t0 = r;
}
r = x1 - ax;
if (!dx && r < 0) return;
r /= dx;
if (dx < 0) {
if (r > t1) return;
if (r > t0) t0 = r;
} else if (dx > 0) {
if (r < t0) return;
if (r < t1) t1 = r;
}
r = y0 - ay;
if (!dy && r > 0) return;
r /= dy;
if (dy < 0) {
if (r < t0) return;
if (r < t1) t1 = r;
} else if (dy > 0) {
if (r > t1) return;
if (r > t0) t0 = r;
}
r = y1 - ay;
if (!dy && r < 0) return;
r /= dy;
if (dy < 0) {
if (r > t1) return;
if (r > t0) t0 = r;
} else if (dy > 0) {
if (r < t0) return;
if (r < t1) t1 = r;
}
if (!(t0 > 0) && !(t1 < 1)) return true; // TODO Better check?
if (t0 > 0) edge[0] = [ax + t0 * dx, ay + t0 * dy];
if (t1 < 1) edge[1] = [ax + t1 * dx, ay + t1 * dy];
return true;
}
function connectEdge(edge, x0, y0, x1, y1) {
var v1 = edge[1];
if (v1) return true;
var v0 = edge[0],
left = edge.left,
right = edge.right,
lx = left[0],
ly = left[1],
rx = right[0],
ry = right[1],
fx = (lx + rx) / 2,
fy = (ly + ry) / 2,
fm,
fb;
if (ry === ly) {
if (fx < x0 || fx >= x1) return;
if (lx > rx) {
if (!v0) v0 = [fx, y0];
else if (v0[1] >= y1) return;
v1 = [fx, y1];
} else {
if (!v0) v0 = [fx, y1];
else if (v0[1] < y0) return;
v1 = [fx, y0];
}
} else {
fm = (lx - rx) / (ry - ly);
fb = fy - fm * fx;
if (fm < -1 || fm > 1) {
if (lx > rx) {
if (!v0) v0 = [(y0 - fb) / fm, y0];
else if (v0[1] >= y1) return;
v1 = [(y1 - fb) / fm, y1];
} else {
if (!v0) v0 = [(y1 - fb) / fm, y1];
else if (v0[1] < y0) return;
v1 = [(y0 - fb) / fm, y0];
}
} else {
if (ly < ry) {
if (!v0) v0 = [x0, fm * x0 + fb];
else if (v0[0] >= x1) return;
v1 = [x1, fm * x1 + fb];
} else {
if (!v0) v0 = [x1, fm * x1 + fb];
else if (v0[0] < x0) return;
v1 = [x0, fm * x0 + fb];
}
}
}
edge[0] = v0;
edge[1] = v1;
return true;
}
function clipEdges(x0, y0, x1, y1) {
var i = edges.length,
edge;
while (i--) {
if (!connectEdge(edge = edges[i], x0, y0, x1, y1)
|| !clipEdge(edge, x0, y0, x1, y1)
|| !(Math.abs(edge[0][0] - edge[1][0]) > epsilon$3
|| Math.abs(edge[0][1] - edge[1][1]) > epsilon$3)) {
delete edges[i];
}
}
}
function createCell(site) {
return cells[site.index] = {
site: site,
halfedges: []
};
}
function cellHalfedgeAngle(cell, edge) {
var site = cell.site,
va = edge.left,
vb = edge.right;
if (site === vb) vb = va, va = site;
if (vb) return Math.atan2(vb[1] - va[1], vb[0] - va[0]);
if (site === va) va = edge[1], vb = edge[0];
else va = edge[0], vb = edge[1];
return Math.atan2(va[0] - vb[0], vb[1] - va[1]);
}
function cellHalfedgeStart(cell, edge) {
return edge[+(edge.left !== cell.site)];
}
function cellHalfedgeEnd(cell, edge) {
return edge[+(edge.left === cell.site)];
}
function sortCellHalfedges() {
for (var i = 0, n = cells.length, cell, halfedges, j, m; i < n; ++i) {
if ((cell = cells[i]) && (m = (halfedges = cell.halfedges).length)) {
var index = new Array(m),
array = new Array(m);
for (j = 0; j < m; ++j) index[j] = j, array[j] = cellHalfedgeAngle(cell, edges[halfedges[j]]);
index.sort(function(i, j) { return array[j] - array[i]; });
for (j = 0; j < m; ++j) array[j] = halfedges[index[j]];
for (j = 0; j < m; ++j) halfedges[j] = array[j];
}
}
}
function clipCells(x0, y0, x1, y1) {
var nCells = cells.length,
iCell,
cell,
site,
iHalfedge,
halfedges,
nHalfedges,
start,
startX,
startY,
end,
endX,
endY,
cover = true;
for (iCell = 0; iCell < nCells; ++iCell) {
if (cell = cells[iCell]) {
site = cell.site;
halfedges = cell.halfedges;
iHalfedge = halfedges.length;
// Remove any dangling clipped edges.
while (iHalfedge--) {
if (!edges[halfedges[iHalfedge]]) {
halfedges.splice(iHalfedge, 1);
}
}
// Insert any border edges as necessary.
iHalfedge = 0, nHalfedges = halfedges.length;
while (iHalfedge < nHalfedges) {
end = cellHalfedgeEnd(cell, edges[halfedges[iHalfedge]]), endX = end[0], endY = end[1];
start = cellHalfedgeStart(cell, edges[halfedges[++iHalfedge % nHalfedges]]), startX = start[0], startY = start[1];
if (Math.abs(endX - startX) > epsilon$3 || Math.abs(endY - startY) > epsilon$3) {
halfedges.splice(iHalfedge, 0, edges.push(createBorderEdge(site, end,
Math.abs(endX - x0) < epsilon$3 && y1 - endY > epsilon$3 ? [x0, Math.abs(startX - x0) < epsilon$3 ? startY : y1]
: Math.abs(endY - y1) < epsilon$3 && x1 - endX > epsilon$3 ? [Math.abs(startY - y1) < epsilon$3 ? startX : x1, y1]
: Math.abs(endX - x1) < epsilon$3 && endY - y0 > epsilon$3 ? [x1, Math.abs(startX - x1) < epsilon$3 ? startY : y0]
: Math.abs(endY - y0) < epsilon$3 && endX - x0 > epsilon$3 ? [Math.abs(startY - y0) < epsilon$3 ? startX : x0, y0]
: null)) - 1);
++nHalfedges;
}
}
if (nHalfedges) cover = false;
}
}
// If there weren’t any edges, have the closest site cover the extent.
// It doesn’t matter which corner of the extent we measure!
if (cover) {
var dx, dy, d2, dc = Infinity;
for (iCell = 0, cover = null; iCell < nCells; ++iCell) {
if (cell = cells[iCell]) {
site = cell.site;
dx = site[0] - x0;
dy = site[1] - y0;
d2 = dx * dx + dy * dy;
if (d2 < dc) dc = d2, cover = cell;
}
}
if (cover) {
var v00 = [x0, y0], v01 = [x0, y1], v11 = [x1, y1], v10 = [x1, y0];
cover.halfedges.push(
edges.push(createBorderEdge(site = cover.site, v00, v01)) - 1,
edges.push(createBorderEdge(site, v01, v11)) - 1,
edges.push(createBorderEdge(site, v11, v10)) - 1,
edges.push(createBorderEdge(site, v10, v00)) - 1
);
}
}
// Lastly delete any cells with no edges; these were entirely clipped.
for (iCell = 0; iCell < nCells; ++iCell) {
if (cell = cells[iCell]) {
if (!cell.halfedges.length) {
delete cells[iCell];
}
}
}
}
var circlePool = [];
var firstCircle;
function Circle() {
RedBlackNode(this);
this.x =
this.y =
this.arc =
this.site =
this.cy = null;
}
function attachCircle(arc) {
var lArc = arc.P,
rArc = arc.N;
if (!lArc || !rArc) return;
var lSite = lArc.site,
cSite = arc.site,
rSite = rArc.site;
if (lSite === rSite) return;
var bx = cSite[0],
by = cSite[1],
ax = lSite[0] - bx,
ay = lSite[1] - by,
cx = rSite[0] - bx,
cy = rSite[1] - by;
var d = 2 * (ax * cy - ay * cx);
if (d >= -epsilon2$2) return;
var ha = ax * ax + ay * ay,
hc = cx * cx + cy * cy,
x = (cy * ha - ay * hc) / d,
y = (ax * hc - cx * ha) / d;
var circle = circlePool.pop() || new Circle;
circle.arc = arc;
circle.site = cSite;
circle.x = x + bx;
circle.y = (circle.cy = y + by) + Math.sqrt(x * x + y * y); // y bottom
arc.circle = circle;
var before = null,
node = circles._;
while (node) {
if (circle.y < node.y || (circle.y === node.y && circle.x <= node.x)) {
if (node.L) node = node.L;
else { before = node.P; break; }
} else {
if (node.R) node = node.R;
else { before = node; break; }
}
}
circles.insert(before, circle);
if (!before) firstCircle = circle;
}
function detachCircle(arc) {
var circle = arc.circle;
if (circle) {
if (!circle.P) firstCircle = circle.N;
circles.remove(circle);
circlePool.push(circle);
RedBlackNode(circle);
arc.circle = null;
}
}
var beachPool = [];
function Beach() {
RedBlackNode(this);
this.edge =
this.site =
this.circle = null;
}
function createBeach(site) {
var beach = beachPool.pop() || new Beach;
beach.site = site;
return beach;
}
function detachBeach(beach) {
detachCircle(beach);
beaches.remove(beach);
beachPool.push(beach);
RedBlackNode(beach);
}
function removeBeach(beach) {
var circle = beach.circle,
x = circle.x,
y = circle.cy,
vertex = [x, y],
previous = beach.P,
next = beach.N,
disappearing = [beach];
detachBeach(beach);
var lArc = previous;
while (lArc.circle
&& Math.abs(x - lArc.circle.x) < epsilon$3
&& Math.abs(y - lArc.circle.cy) < epsilon$3) {
previous = lArc.P;
disappearing.unshift(lArc);
detachBeach(lArc);
lArc = previous;
}
disappearing.unshift(lArc);
detachCircle(lArc);
var rArc = next;
while (rArc.circle
&& Math.abs(x - rArc.circle.x) < epsilon$3
&& Math.abs(y - rArc.circle.cy) < epsilon$3) {
next = rArc.N;
disappearing.push(rArc);
detachBeach(rArc);
rArc = next;
}
disappearing.push(rArc);
detachCircle(rArc);
var nArcs = disappearing.length,
iArc;
for (iArc = 1; iArc < nArcs; ++iArc) {
rArc = disappearing[iArc];
lArc = disappearing[iArc - 1];
setEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex);
}
lArc = disappearing[0];
rArc = disappearing[nArcs - 1];
rArc.edge = createEdge(lArc.site, rArc.site, null, vertex);
attachCircle(lArc);
attachCircle(rArc);
}
function addBeach(site) {
var x = site[0],
directrix = site[1],
lArc,
rArc,
dxl,
dxr,
node = beaches._;
while (node) {
dxl = leftBreakPoint(node, directrix) - x;
if (dxl > epsilon$3) node = node.L; else {
dxr = x - rightBreakPoint(node, directrix);
if (dxr > epsilon$3) {
if (!node.R) {
lArc = node;
break;
}
node = node.R;
} else {
if (dxl > -epsilon$3) {
lArc = node.P;
rArc = node;
} else if (dxr > -epsilon$3) {
lArc = node;
rArc = node.N;
} else {
lArc = rArc = node;
}
break;
}
}
}
createCell(site);
var newArc = createBeach(site);
beaches.insert(lArc, newArc);
if (!lArc && !rArc) return;
if (lArc === rArc) {
detachCircle(lArc);
rArc = createBeach(lArc.site);
beaches.insert(newArc, rArc);
newArc.edge = rArc.edge = createEdge(lArc.site, newArc.site);
attachCircle(lArc);
attachCircle(rArc);
return;
}
if (!rArc) { // && lArc
newArc.edge = createEdge(lArc.site, newArc.site);
return;
}
// else lArc !== rArc
detachCircle(lArc);
detachCircle(rArc);
var lSite = lArc.site,
ax = lSite[0],
ay = lSite[1],
bx = site[0] - ax,
by = site[1] - ay,
rSite = rArc.site,
cx = rSite[0] - ax,
cy = rSite[1] - ay,
d = 2 * (bx * cy - by * cx),
hb = bx * bx + by * by,
hc = cx * cx + cy * cy,
vertex = [(cy * hb - by * hc) / d + ax, (bx * hc - cx * hb) / d + ay];
setEdgeEnd(rArc.edge, lSite, rSite, vertex);
newArc.edge = createEdge(lSite, site, null, vertex);
rArc.edge = createEdge(site, rSite, null, vertex);
attachCircle(lArc);
attachCircle(rArc);
}
function leftBreakPoint(arc, directrix) {
var site = arc.site,
rfocx = site[0],
rfocy = site[1],
pby2 = rfocy - directrix;
if (!pby2) return rfocx;
var lArc = arc.P;
if (!lArc) return -Infinity;
site = lArc.site;
var lfocx = site[0],
lfocy = site[1],
plby2 = lfocy - directrix;
if (!plby2) return lfocx;
var hl = lfocx - rfocx,
aby2 = 1 / pby2 - 1 / plby2,
b = hl / plby2;
if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx;
return (rfocx + lfocx) / 2;
}
function rightBreakPoint(arc, directrix) {
var rArc = arc.N;
if (rArc) return leftBreakPoint(rArc, directrix);
var site = arc.site;
return site[1] === directrix ? site[0] : Infinity;
}
var epsilon$3 = 1e-6;
var epsilon2$2 = 1e-12;
var beaches;
var cells;
var circles;
var edges;
function triangleArea(a, b, c) {
return (a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]);
}
function lexicographic(a, b) {
return b[1] - a[1]
|| b[0] - a[0];
}
function Diagram(sites, extent) {
var site = sites.sort(lexicographic).pop(),
x,
y,
circle;
edges = [];
cells = new Array(sites.length);
beaches = new RedBlackTree;
circles = new RedBlackTree;
while (true) {
circle = firstCircle;
if (site && (!circle || site[1] < circle.y || (site[1] === circle.y && site[0] < circle.x))) {
if (site[0] !== x || site[1] !== y) {
addBeach(site);
x = site[0], y = site[1];
}
site = sites.pop();
} else if (circle) {
removeBeach(circle.arc);
} else {
break;
}
}
sortCellHalfedges();
if (extent) {
var x0 = +extent[0][0],
y0 = +extent[0][1],
x1 = +extent[1][0],
y1 = +extent[1][1];
clipEdges(x0, y0, x1, y1);
clipCells(x0, y0, x1, y1);
}
this.edges = edges;
this.cells = cells;
beaches =
circles =
edges =
cells = null;
}
Diagram.prototype = {
constructor: Diagram,
polygons: function() {
var edges = this.edges;
return this.cells.map(function(cell) {
var polygon = cell.halfedges.map(function(i) { return cellHalfedgeStart(cell, edges[i]); });
polygon.data = cell.site.data;
return polygon;
});
},
triangles: function() {
var triangles = [],
edges = this.edges;
this.cells.forEach(function(cell, i) {
if (!(m = (halfedges = cell.halfedges).length)) return;
var site = cell.site,
halfedges,
j = -1,
m,
s0,
e1 = edges[halfedges[m - 1]],
s1 = e1.left === site ? e1.right : e1.left;
while (++j < m) {
s0 = s1;
e1 = edges[halfedges[j]];
s1 = e1.left === site ? e1.right : e1.left;
if (s0 && s1 && i < s0.index && i < s1.index && triangleArea(site, s0, s1) < 0) {
triangles.push([site.data, s0.data, s1.data]);
}
}
});
return triangles;
},
links: function() {
return this.edges.filter(function(edge) {
return edge.right;
}).map(function(edge) {
return {
source: edge.left.data,
target: edge.right.data
};
});
},
find: function(x, y, radius) {
var that = this, i0, i1 = that._found || 0, n = that.cells.length, cell;
// Use the previously-found cell, or start with an arbitrary one.
while (!(cell = that.cells[i1])) if (++i1 >= n) return null;
var dx = x - cell.site[0], dy = y - cell.site[1], d2 = dx * dx + dy * dy;
// Traverse the half-edges to find a closer cell, if any.
do {
cell = that.cells[i0 = i1], i1 = null;
cell.halfedges.forEach(function(e) {
var edge = that.edges[e], v = edge.left;
if ((v === cell.site || !v) && !(v = edge.right)) return;
var vx = x - v[0], vy = y - v[1], v2 = vx * vx + vy * vy;
if (v2 < d2) d2 = v2, i1 = v.index;
});
} while (i1 !== null);
that._found = i0;
return radius == null || d2 <= radius * radius ? cell.site : null;
}
}
function voronoi() {
var x = x$4,
y = y$4,
extent = null;
function voronoi(data) {
return new Diagram(data.map(function(d, i) {
var s = [Math.round(x(d, i, data) / epsilon$3) * epsilon$3, Math.round(y(d, i, data) / epsilon$3) * epsilon$3];
s.index = i;
s.data = d;
return s;
}), extent);
}
voronoi.polygons = function(data) {
return voronoi(data).polygons();
};
voronoi.links = function(data) {
return voronoi(data).links();
};
voronoi.triangles = function(data) {
return voronoi(data).triangles();
};
voronoi.x = function(_) {
return arguments.length ? (x = typeof _ === "function" ? _ : constant$9(+_), voronoi) : x;
};
voronoi.y = function(_) {
return arguments.length ? (y = typeof _ === "function" ? _ : constant$9(+_), voronoi) : y;
};
voronoi.extent = function(_) {
return arguments.length ? (extent = _ == null ? null : [[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]], voronoi) : extent && [[extent[0][0], extent[0][1]], [extent[1][0], extent[1][1]]];
};
voronoi.size = function(_) {
return arguments.length ? (extent = _ == null ? null : [[0, 0], [+_[0], +_[1]]], voronoi) : extent && [extent[1][0] - extent[0][0], extent[1][1] - extent[0][1]];
};
return voronoi;
}
function Voronoi(params) {
Transform.call(this, null, params);
}
var prototype$61 = inherits(Voronoi, Transform);
var defaultExtent = [[-1e5, -1e5], [1e5, 1e5]];
prototype$61.transform = function(_, pulse) {
var as = _.as || 'path',
data = pulse.source,
diagram, polygons, i, n;
// configure and construct voronoi diagram
diagram = voronoi().x(_.x).y(_.y);
if (_.size) diagram.size(_.size);
else diagram.extent(_.extent || defaultExtent);
this.value = (diagram = diagram(data));
// map polygons to paths
polygons = diagram.polygons();
for (i=0, n=data.length; i<n; ++i) {
data[i][as] = polygons[i]
? 'M' + polygons[i].join('L') + 'Z'
: null;
}
return pulse.reflow(_.modified()).modifies(as);
};
var VoronoiDefinition = {
"type": "Voronoi",
"metadata": {"modifies": true},
"params": [
{ "name": "x", "type": "field", "required": true },
{ "name": "y", "type": "field", "required": true },
{ "name": "size", "type": "number", "array": true, "length": 2 },
{ "name": "extent", "type": "array", "array": true, "length": 2,
"default": [[-1e5, -1e5], [1e5, 1e5]],
"content": {"type": "number", "array": true, "length": 2} },
{ "name": "as", "type": "string", "default": "path" }
]
};
register(VoronoiDefinition, Voronoi);
var cloudRadians = Math.PI / 180;
var cw = 1 << 11 >> 5;
var ch = 1 << 11;
function cloud() {
var size = [256, 256],
text,
font,
fontSize,
fontStyle,
fontWeight,
rotate,
padding,
spiral = archimedeanSpiral,
words = [],
random = Math.random,
cloud = {},
canvas = cloudCanvas;
cloud.layout = function() {
var contextAndRatio = getContext(canvas()),
board = zeroArray((size[0] >> 5) * size[1]),
bounds = null,
n = words.length,
i = -1,
tags = [],
data = words.map(function(d) {
return {
text: text(d),
font: font(d),
style: fontStyle(d),
weight: fontWeight(d),
rotate: rotate(d),
size: ~~fontSize(d),
padding: padding(d),
xoff: 0,
yoff: 0,
x1: 0,
y1: 0,
x0: 0,
y0: 0,
hasText: false,
sprite: null,
datum: d
};
}).sort(function(a, b) { return b.size - a.size; });
while (++i < n) {
var d = data[i];
d.x = (size[0] * (random() + .5)) >> 1;
d.y = (size[1] * (random() + .5)) >> 1;
cloudSprite(contextAndRatio, d, data, i);
if (d.hasText && place(board, d, bounds)) {
tags.push(d);
if (bounds) cloudBounds(bounds, d);
else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}];
// Temporary hack
d.x -= size[0] >> 1;
d.y -= size[1] >> 1;
}
}
return tags;
}
function getContext(canvas) {
canvas.width = canvas.height = 1;
var ratio = Math.sqrt(canvas.getContext("2d").getImageData(0, 0, 1, 1).data.length >> 2);
canvas.width = (cw << 5) / ratio;
canvas.height = ch / ratio;
var context = canvas.getContext("2d");
context.fillStyle = context.strokeStyle = "red";
context.textAlign = "center";
return {context: context, ratio: ratio};
}
function place(board, tag, bounds) {
var startX = tag.x,
startY = tag.y,
maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]),
s = spiral(size),
dt = random() < .5 ? 1 : -1,
t = -dt,
dxdy,
dx,
dy;
while (dxdy = s(t += dt)) {
dx = ~~dxdy[0];
dy = ~~dxdy[1];
if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break;
tag.x = startX + dx;
tag.y = startY + dy;
if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 ||
tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue;
// TODO only check for collisions within current bounds.
if (!bounds || !cloudCollide(tag, board, size[0])) {
if (!bounds || collideRects(tag, bounds)) {
var sprite = tag.sprite,
w = tag.width >> 5,
sw = size[0] >> 5,
lx = tag.x - (w << 4),
sx = lx & 0x7f,
msx = 32 - sx,
h = tag.y1 - tag.y0,
x = (tag.y + tag.y0) * sw + (lx >> 5),
last;
for (var j = 0; j < h; j++) {
last = 0;
for (var i = 0; i <= w; i++) {
board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0);
}
x += sw;
}
tag.sprite = null;
return true;
}
}
}
return false;
}
cloud.words = function(_) {
return arguments.length ? (words = _, cloud) : words;
};
cloud.size = function(_) {
return arguments.length ? (size = [+_[0], +_[1]], cloud) : size;
};
cloud.font = function(_) {
return arguments.length ? (font = functor(_), cloud) : font;
};
cloud.fontStyle = function(_) {
return arguments.length ? (fontStyle = functor(_), cloud) : fontStyle;
};
cloud.fontWeight = function(_) {
return arguments.length ? (fontWeight = functor(_), cloud) : fontWeight;
};
cloud.rotate = function(_) {
return arguments.length ? (rotate = functor(_), cloud) : rotate;
};
cloud.text = function(_) {
return arguments.length ? (text = functor(_), cloud) : text;
};
cloud.spiral = function(_) {
return arguments.length ? (spiral = spirals[_] || _, cloud) : spiral;
};
cloud.fontSize = function(_) {
return arguments.length ? (fontSize = functor(_), cloud) : fontSize;
};
cloud.padding = function(_) {
return arguments.length ? (padding = functor(_), cloud) : padding;
};
cloud.random = function(_) {
return arguments.length ? (random = _, cloud) : random;
};
return cloud;
}
// Fetches a monochrome sprite bitmap for the specified text.
// Load in batches for speed.
function cloudSprite(contextAndRatio, d, data, di) {
if (d.sprite) return;
var c = contextAndRatio.context,
ratio = contextAndRatio.ratio;
c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio);
var x = 0,
y = 0,
maxh = 0,
n = data.length,
w, w32, h, i, j;
--di;
while (++di < n) {
d = data[di];
c.save();
c.font = d.style + " " + d.weight + " " + ~~((d.size + 1) / ratio) + "px " + d.font;
w = c.measureText(d.text + "m").width * ratio;
h = d.size << 1;
if (d.rotate) {
var sr = Math.sin(d.rotate * cloudRadians),
cr = Math.cos(d.rotate * cloudRadians),
wcr = w * cr,
wsr = w * sr,
hcr = h * cr,
hsr = h * sr;
w = (Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5 << 5;
h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr));
} else {
w = (w + 0x1f) >> 5 << 5;
}
if (h > maxh) maxh = h;
if (x + w >= (cw << 5)) {
x = 0;
y += maxh;
maxh = 0;
}
if (y + h >= ch) break;
c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio);
if (d.rotate) c.rotate(d.rotate * cloudRadians);
c.fillText(d.text, 0, 0);
if (d.padding) c.lineWidth = 2 * d.padding, c.strokeText(d.text, 0, 0);
c.restore();
d.width = w;
d.height = h;
d.xoff = x;
d.yoff = y;
d.x1 = w >> 1;
d.y1 = h >> 1;
d.x0 = -d.x1;
d.y0 = -d.y1;
d.hasText = true;
x += w;
}
var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data,
sprite = [];
while (--di >= 0) {
d = data[di];
if (!d.hasText) continue;
w = d.width;
w32 = w >> 5;
h = d.y1 - d.y0;
// Zero the buffer
for (i = 0; i < h * w32; i++) sprite[i] = 0;
x = d.xoff;
if (x == null) return;
y = d.yoff;
var seen = 0,
seenRow = -1;
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
var k = w32 * j + (i >> 5),
m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0;
sprite[k] |= m;
seen |= m;
}
if (seen) seenRow = j;
else {
d.y0++;
h--;
j--;
y++;
}
}
d.y1 = d.y0 + seenRow;
d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32);
}
}
// Use mask-based collision detection.
function cloudCollide(tag, board, sw) {
sw >>= 5;
var sprite = tag.sprite,
w = tag.width >> 5,
lx = tag.x - (w << 4),
sx = lx & 0x7f,
msx = 32 - sx,
h = tag.y1 - tag.y0,
x = (tag.y + tag.y0) * sw + (lx >> 5),
last;
for (var j = 0; j < h; j++) {
last = 0;
for (var i = 0; i <= w; i++) {
if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0))
& board[x + i]) return true;
}
x += sw;
}
return false;
}
function cloudBounds(bounds, d) {
var b0 = bounds[0],
b1 = bounds[1];
if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0;
if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0;
if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1;
if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1;
}
function collideRects(a, b) {
return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y;
}
function archimedeanSpiral(size) {
var e = size[0] / size[1];
return function(t) {
return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)];
};
}
function rectangularSpiral(size) {
var dy = 4,
dx = dy * size[0] / size[1],
x = 0,
y = 0;
return function(t) {
var sign = t < 0 ? -1 : 1;
// See triangular numbers: T_n = n * (n + 1) / 2.
switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) {
case 0: x += dx; break;
case 1: y += dy; break;
case 2: x -= dx; break;
default: y -= dy; break;
}
return [x, y];
};
}
// TODO reuse arrays?
function zeroArray(n) {
var a = [],
i = -1;
while (++i < n) a[i] = 0;
return a;
}
function cloudCanvas() {
try {
return typeof document !== 'undefined' && document.createElement
? document.createElement('canvas')
: new (require('canvas'))();
} catch (e) {
error('Canvas unavailable. Run in browser or install node-canvas.');
}
}
function functor(d) {
return typeof d === "function" ? d : function() { return d; };
}
var spirals = {
archimedean: archimedeanSpiral,
rectangular: rectangularSpiral
};
var output = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle'];
var params = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight'];
function Wordcloud(params) {
Transform.call(this, cloud(), params);
}
var prototype$62 = inherits(Wordcloud, Transform);
prototype$62.transform = function(_, pulse) {
function modp(param) {
var p = _[param];
return isFunction(p) && pulse.modified(p.fields);
}
var mod = _.modified();
if (!(mod || pulse.changed(pulse.ADD_REM) || params.some(modp))) return;
var layout = this.value,
as = _.as || output,
fontSize = _.fontSize || 14,
range;
isFunction(fontSize)
? (range = _.fontSizeRange)
: (fontSize = constant$1(fontSize));
// create font size scaling function as needed
if (range) {
var fsize = fontSize,
sizeScale = scale$1('sqrt')()
.domain(extent$2(fsize, pulse))
.range(range);
fontSize = function(x) { return sizeScale(fsize(x)); };
}
var data = pulse.materialize(pulse.SOURCE).source;
data.forEach(function(t) {
t[as[0]] = NaN;
t[as[1]] = NaN;
t[as[3]] = 0;
});
// configure layout
var words = layout
.words(data)
.text(_.text)
.size(_.size || [500, 500])
.padding(_.padding || 1)
.spiral(_.spiral || 'archimedean')
.rotate(_.rotate || 0)
.font(_.font || 'sans-serif')
.fontStyle(_.fontStyle || 'normal')
.fontWeight(_.fontWeight || 'normal')
.fontSize(fontSize)
.layout();
var size = layout.size(),
dx = size[0] >> 1,
dy = size[1] >> 1,
i = 0,
n = words.length,
w, t;
for (; i<n; ++i) {
w = words[i];
t = w.datum;
t[as[0]] = w.x + dx;
t[as[1]] = w.y + dy;
t[as[2]] = w.font;
t[as[3]] = w.size;
t[as[4]] = w.style;
t[as[5]] = w.weight;
t[as[6]] = w.rotate;
}
return pulse.reflow(mod).modifies(as);
};
function extent$2(size, pulse) {
var e = new transforms.Extent();
e.transform({field: size, modified: truthy}, pulse);
return e.value;
}
var WordcloudDefinition = {
"type": "Wordcloud",
"metadata": {"modifies": true},
"params": [
{ "name": "size", "type": "number", "array": true, "length": 2 },
{ "name": "font", "type": "string", "expr": true, "default": "sans-serif" },
{ "name": "fontStyle", "type": "string", "expr": true, "default": "normal" },
{ "name": "fontWeight", "type": "string", "expr": true, "default": "normal" },
{ "name": "fontSize", "type": "number", "expr": true, "default": 14 },
{ "name": "fontSizeRange", "type": "number", "array": true, "null": true, "default": [10, 50] },
{ "name": "rotate", "type": "number", "expr": true, "default": 0 },
{ "name": "text", "type": "field" },
{ "name": "spiral", "type": "string", "values": ["archimedean", "rectangular"] },
{ "name": "padding", "type": "number", "expr": true },
{ "name": "as", "type": "string", "array": true, "length": 7,
"default": ["x", "y", "font", "fontSize", "fontStyle", "fontWeight", "angle"] }
]
};
register(WordcloudDefinition, Wordcloud);
function array8(n) { return new Uint8Array(n); }
function array16(n) { return new Uint16Array(n); }
function array32(n) { return new Uint32Array(n); }
/**
* Maintains CrossFilter state.
*/
function Bitmaps() {
var width = 8,
data = [],
seen = array32(0),
curr = array$3(0, width),
prev = array$3(0, width);
return {
data: function() { return data; },
seen: function() {
return (seen = lengthen(seen, data.length));
},
add: function(array) {
for (var i=0, j=data.length, n=array.length, t; i<n; ++i) {
t = array[i];
t._index = j++;
data.push(t);
}
},
remove: function(num, map) { // map: index -> boolean (true => remove)
var n = data.length,
copy = Array(n - num),
reindex = data, // reuse old data array for index map
t, i, j;
// seek forward to first removal
for (i=0; !map[i] && i<n; ++i) {
copy[i] = data[i];
reindex[i] = i;
}
// condense arrays
for (j=i; i<n; ++i) {
t = data[i];
if (!map[i]) {
reindex[i] = j;
curr[j] = curr[i];
prev[j] = prev[i];
copy[j] = t;
t._index = j++;
} else {
reindex[i] = -1;
}
curr[i] = 0; // clear unused bits
}
return (data = copy, reindex);
},
size: function() { return data.length; },
curr: function() { return curr; },
prev: function() { return prev; },
reset: function(k) { prev[k] = curr[k]; },
all: function() {
return width < 0x101 ? 0xff : width < 0x10001 ? 0xffff : 0xffffffff;
},
set: function(k, one) { curr[k] |= one; },
clear: function(k, one) { curr[k] &= ~one; },
resize: function(n, m) {
var k = curr.length;
if (n > k || m > width) {
width = Math.max(m, width);
curr = array$3(n, width, curr);
prev = array$3(n, width);
}
}
};
}
function lengthen(array, length, copy) {
if (array.length >= length) return array;
copy = copy || new array.constructor(length);
copy.set(array);
return copy;
}
function array$3(n, m, array) {
var copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n);
if (array) copy.set(array);
return copy;
}
function Dimension(index, i, query) {
var bit = (1 << i);
return {
one: bit,
zero: ~bit,
range: query.slice(),
bisect: index.bisect,
index: index.index,
size: index.size,
onAdd: function(added, curr) {
var dim = this,
range = dim.bisect(dim.range, added.value),
idx = added.index,
lo = range[0],
hi = range[1],
n1 = idx.length, i;
for (i=0; i<lo; ++i) curr[idx[i]] |= bit;
for (i=hi; i<n1; ++i) curr[idx[i]] |= bit;
return dim;
}
};
}
/**
* Maintains a list of values, sorted by key.
*/
function SortedIndex() {
var index = array32(0),
value = [],
size = 0;
function insert(key, data, base) {
if (!data.length) return [];
var n0 = size,
n1 = data.length,
addv = Array(n1),
addi = array32(n1),
oldv, oldi, i;
for (i=0; i<n1; ++i) {
addv[i] = key(data[i]);
addi[i] = i;
}
addv = sort(addv, addi);
if (n0) {
oldv = value;
oldi = index;
value = Array(n0 + n1);
index = array32(n0 + n1);
merge$3(base, oldv, oldi, n0, addv, addi, n1, value, index);
} else {
if (base > 0) for (i=0; i<n1; ++i) {
addi[i] += base;
}
value = addv;
index = addi;
}
size = n0 + n1;
return {index: addi, value: addv};
}
function remove(num, map) {
// map: index -> remove
var n = size,
idx, i, j;
// seek forward to first removal
for (i=0; !map[index[i]] && i<n; ++i);
// condense index and value arrays
for (j=i; i<n; ++i) {
if (!map[idx=index[i]]) {
index[j] = idx;
value[j] = value[i];
++j;
}
}
size = n - num;
}
function reindex(map) {
for (var i=0, n=size; i<n; ++i) {
index[i] = map[index[i]];
}
}
function bisect(range, array) {
var n = array ? array.length : (array = value, size);
return [
bisectLeft(array, range[0], 0, n),
bisectRight(array, range[1], 0, n)
];
}
return {
insert: insert,
remove: remove,
bisect: bisect,
reindex: reindex,
index: function() { return index; },
size: function() { return size; }
};
}
function sort(values, index) {
values.sort.call(index, function(a, b) {
var x = values[a],
y = values[b];
return x < y ? -1 : x > y ? 1 : 0;
});
return permute(values, index);
}
function merge$3(base, value0, index0, n0, value1, index1, n1, value, index) {
var i0 = 0, i1 = 0, i;
for (i=0; i0 < n0 && i1 < n1; ++i) {
if (value0[i0] < value1[i1]) {
value[i] = value0[i0];
index[i] = index0[i0++];
} else {
value[i] = value1[i1];
index[i] = index1[i1++] + base;
}
}
for (; i0 < n0; ++i0, ++i) {
value[i] = value0[i0];
index[i] = index0[i0];
}
for (; i1 < n1; ++i1, ++i) {
value[i] = value1[i1];
index[i] = index1[i1] + base;
}
}
/**
* An indexed multi-dimensional filter.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {Array<function(object): *>} params.fields - An array of dimension accessors to filter.
* @param {Array} params.query - An array of per-dimension range queries.
*/
function CrossFilter(params) {
Transform.call(this, Bitmaps(), params);
this._indices = null;
this._dims = null;
}
var prototype$63 = inherits(CrossFilter, Transform);
prototype$63.transform = function(_, pulse) {
if (!this._dims) {
return this.init(_, pulse);
} else {
var init = _.modified('fields')
|| _.fields.some(function(f) { return pulse.modified(f.fields); });
return init
? this.reinit(_, pulse)
: this.eval(_, pulse);
}
};
prototype$63.init = function(_, pulse) {
var fields = _.fields,
query = _.query,
indices = this._indices = {},
dims = this._dims = [],
m = query.length,
i = 0, key, index;
// instantiate indices and dimensions
for (; i<m; ++i) {
key = fields[i].fname;
index = indices[key] || (indices[key] = SortedIndex());
dims.push(Dimension(index, i, query[i]));
}
return this.eval(_, pulse);
};
prototype$63.reinit = function(_, pulse) {
var output = pulse.materialize().fork(),
fields = _.fields,
query = _.query,
indices = this._indices,
dims = this._dims,
bits = this.value,
curr = bits.curr(),
prev = bits.prev(),
all = bits.all(),
out = (output.rem = output.add),
mod = output.mod,
m = query.length,
adds = {}, add, index, key,
mods, remMap, modMap, i, n, f;
// set prev to current state
prev.set(curr);
// if pulse has remove tuples, process them first
if (pulse.rem.length) {
remMap = this.remove(_, pulse, output);
}
// if pulse has added tuples, add them to state
if (pulse.add.length) {
bits.add(pulse.add);
}
// if pulse has modified tuples, create an index map
if (pulse.mod.length) {
modMap = {};
for (mods=pulse.mod, i=0, n=mods.length; i<n; ++i) {
modMap[mods[i]._index] = 1;
}
}
// re-initialize indices as needed, update curr bitmap
for (i=0; i<m; ++i) {
f = fields[i];
if (!dims[i] || _.modified('fields', i) || pulse.modified(f.fields)) {
key = f.fname;
if (!(add = adds[key])) {
indices[key] = index = SortedIndex();
adds[key] = add = index.insert(f, pulse.source, 0);
}
dims[i] = Dimension(index, i, query[i]).onAdd(add, curr);
}
}
// visit each tuple
// if filter state changed, push index to add/rem
// else if in mod and passes a filter, push index to mod
for (i=0, n=bits.data().length; i<n; ++i) {
if (remMap[i]) { // skip if removed tuple
continue;
} else if (prev[i] !== curr[i]) { // add if state changed
out.push(i);
} else if (modMap[i] && curr[i] !== all) { // otherwise, pass mods through
mod.push(i);
}
}
bits.mask = (1 << m) - 1;
return output;
};
prototype$63.eval = function(_, pulse) {
var output = pulse.materialize().fork(),
m = this._dims.length,
mask = 0;
if (pulse.rem.length) {
this.remove(_, pulse, output);
mask |= (1 << m) - 1;
}
if (_.modified('query') && !_.modified('fields')) {
mask |= this.update(_, pulse, output);
}
if (pulse.add.length) {
this.insert(_, pulse, output);
mask |= (1 << m) - 1;
}
if (pulse.mod.length) {
this.modify(pulse, output);
mask |= (1 << m) - 1;
}
this.value.mask = mask;
return output;
};
prototype$63.insert = function(_, pulse, output) {
var tuples = pulse.add,
bits = this.value,
dims = this._dims,
indices = this._indices,
fields = _.fields,
adds = {},
out = output.add,
k = bits.size(),
n = k + tuples.length,
m = dims.length, j, key, add;
// resize bitmaps and add tuples as needed
bits.resize(n, m);
bits.add(tuples);
var curr = bits.curr(),
prev = bits.prev(),
all = bits.all();
// add to dimensional indices
for (j=0; j<m; ++j) {
key = fields[j].fname;
add = adds[key] || (adds[key] = indices[key].insert(fields[j], tuples, k));
dims[j].onAdd(add, curr);
}
// set previous filters, output if passes at least one filter
for (; k<n; ++k) {
prev[k] = all;
if (curr[k] !== all) out.push(k);
}
};
prototype$63.modify = function(pulse, output) {
var out = output.mod,
bits = this.value,
curr = bits.curr(),
all = bits.all(),
tuples = pulse.mod,
i, n, k;
for (i=0, n=tuples.length; i<n; ++i) {
k = tuples[i]._index;
if (curr[k] !== all) out.push(k);
}
};
prototype$63.remove = function(_, pulse, output) {
var indices = this._indices,
bits = this.value,
curr = bits.curr(),
prev = bits.prev(),
all = bits.all(),
map = {},
out = output.rem,
tuples = pulse.rem,
i, n, k, f;
// process tuples, output if passes at least one filter
for (i=0, n=tuples.length; i<n; ++i) {
k = tuples[i]._index;
map[k] = 1; // build index map
prev[k] = (f = curr[k]);
curr[k] = all;
if (f !== all) out.push(k);
}
// remove from dimensional indices
for (k in indices) {
indices[k].remove(n, map);
}
return (this.reindex(pulse, n, map), map);
};
// reindex filters and indices after propagation completes
prototype$63.reindex = function(pulse, num, map) {
var indices = this._indices,
bits = this.value;
pulse.runAfter(function() {
var indexMap = bits.remove(num, map);
for (var key in indices) indices[key].reindex(indexMap);
});
};
prototype$63.update = function(_, pulse, output) {
var dims = this._dims,
query = _.query,
stamp = pulse.stamp,
m = dims.length,
mask = 0, i, q;
// survey how many queries have changed
output.filters = 0;
for (q=0; q<m; ++q) {
if (_.modified('query', q)) { i = q; ++mask; }
}
if (mask === 1) {
// only one query changed, use more efficient update
mask = dims[i].one;
this.incrementOne(dims[i], query[i], output.add, output.rem);
} else {
// multiple queries changed, perform full record keeping
for (q=0, mask=0; q<m; ++q) {
if (!_.modified('query', q)) continue;
mask |= dims[q].one;
this.incrementAll(dims[q], query[q], stamp, output.add);
output.rem = output.add; // duplicate add/rem for downstream resolve
}
}
return mask;
};
prototype$63.incrementAll = function(dim, query, stamp, out) {
var bits = this.value,
seen = bits.seen(),
curr = bits.curr(),
prev = bits.prev(),
index = dim.index(),
old = dim.bisect(dim.range),
range = dim.bisect(query),
lo1 = range[0],
hi1 = range[1],
lo0 = old[0],
hi0 = old[1],
one = dim.one,
i, j, k;
// Fast incremental update based on previous lo index.
if (lo1 < lo0) {
for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {
k = index[i];
if (seen[k] !== stamp) {
prev[k] = curr[k];
seen[k] = stamp;
out.push(k);
}
curr[k] ^= one;
}
} else if (lo1 > lo0) {
for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {
k = index[i];
if (seen[k] !== stamp) {
prev[k] = curr[k];
seen[k] = stamp;
out.push(k);
}
curr[k] ^= one;
}
}
// Fast incremental update based on previous hi index.
if (hi1 > hi0) {
for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {
k = index[i];
if (seen[k] !== stamp) {
prev[k] = curr[k];
seen[k] = stamp;
out.push(k);
}
curr[k] ^= one;
}
} else if (hi1 < hi0) {
for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {
k = index[i];
if (seen[k] !== stamp) {
prev[k] = curr[k];
seen[k] = stamp;
out.push(k);
}
curr[k] ^= one;
}
}
dim.range = query.slice();
};
prototype$63.incrementOne = function(dim, query, add, rem) {
var bits = this.value,
curr = bits.curr(),
index = dim.index(),
old = dim.bisect(dim.range),
range = dim.bisect(query),
lo1 = range[0],
hi1 = range[1],
lo0 = old[0],
hi0 = old[1],
one = dim.one,
i, j, k;
// Fast incremental update based on previous lo index.
if (lo1 < lo0) {
for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {
k = index[i];
curr[k] ^= one;
add.push(k);
}
} else if (lo1 > lo0) {
for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {
k = index[i];
curr[k] ^= one;
rem.push(k);
}
}
// Fast incremental update based on previous hi index.
if (hi1 > hi0) {
for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {
k = index[i];
curr[k] ^= one;
add.push(k);
}
} else if (hi1 < hi0) {
for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {
k = index[i];
curr[k] ^= one;
rem.push(k);
}
}
dim.range = query.slice();
};
var CrossFilterDefinition = {
"type": "CrossFilter",
"metadata": {},
"params": [
{ "name": "fields", "type": "field", "array": true, "required": true },
{ "name": "query", "type": "array", "array": true, "required": true,
"content": {"type": "number", "array": true, "length": 2} }
]
};
/**
* Selectively filters tuples by resolving against a filter bitmap.
* Useful for processing the output of a cross-filter transform.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {object} params.ignore - A bit mask indicating which filters to ignore.
* @param {object} params.filter - The per-tuple filter bitmaps. Typically this
* parameter value is a reference to a {@link CrossFilter} transform.
*/
function ResolveFilter(params) {
Transform.call(this, null, params);
}
var prototype$64 = inherits(ResolveFilter, Transform);
prototype$64.transform = function(_, pulse) {
var ignore = ~(_.ignore || 0), // bit mask where zeros -> dims to ignore
bitmap = _.filter,
mask = bitmap.mask;
// exit early if no relevant filter changes
if ((mask & ignore) === 0) return pulse.StopPropagation;
var output = pulse.fork(pulse.ALL),
data = bitmap.data(),
curr = bitmap.curr(),
prev = bitmap.prev(),
pass = function(k) {
return !(curr[k] & ignore) ? data[k] : null;
};
// propagate all mod tuples that pass the filter
output.filter(output.MOD, pass);
// determine add & rem tuples via filter functions
// for efficiency, we do *not* populate new arrays,
// instead we add filter functions applied downstream
if (!(mask & (mask-1))) { // only one filter changed
output.filter(output.ADD, pass);
output.filter(output.REM, function(k) {
return (curr[k] & ignore) === mask ? data[k] : null;
});
} else { // multiple filters changed
output.filter(output.ADD, function(k) {
var c = curr[k] & ignore,
f = !c && (c ^ (prev[k] & ignore));
return f ? data[k] : null;
});
output.filter(output.REM, function(k) {
var c = curr[k] & ignore,
f = c && !(c ^ (c ^ (prev[k] & ignore)));
return f ? data[k] : null;
});
}
// add filter to source data in case of reflow...
return output.filter(output.SOURCE, function(t) { return pass(t._index); });
};
var ResolveFilterDefinition = {
"type": "ResolveFilter",
"metadata": {},
"params": [
{ "name": "ignore", "type": "number", "required": true,
"description": "A bit mask indicating which filters to ignore." },
{ "name": "filter", "type": "object", "required": true,
"description": "Per-tuple filter bitmaps from a CrossFilter transform." }
]
};
register(CrossFilterDefinition, CrossFilter);
register(ResolveFilterDefinition, ResolveFilter);
/**
* Calculate bounding boxes for scenegraph items.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {object} params.mark - The scenegraph mark instance to bound.
*/
function Bound(params) {
Transform.call(this, null, params);
}
var prototype$65 = inherits(Bound, Transform);
prototype$65.transform = function(_, pulse) {
var mark = _.mark,
type = mark.marktype,
entry = Marks[type],
bound = entry.bound,
markBounds = mark.bounds, rebound;
mark.bounds_prev.clear().union(markBounds);
if (entry.nested) {
// multi-item marks have a single bounds instance
boundItem$1(mark, bound);
}
else if (type === 'group' || _.modified()) {
// operator parameters modified -> re-bound all items
// updates group bounds in response to modified group content
markBounds.clear();
mark.items.forEach(function(item) {
markBounds.union(boundItem$1(item, bound));
});
}
else {
// incrementally update bounds, re-bound mark as needed
rebound = pulse.changed(pulse.REM);
pulse.visit(pulse.ADD, function(item) {
markBounds.union(boundItem$1(item, bound));
});
pulse.visit(pulse.MOD, function(item) {
rebound = rebound || markBounds.alignsWith(item.bounds);
markBounds.union(boundItem$1(item, bound));
});
if (rebound) {
markBounds.clear();
mark.items.forEach(function(item) { markBounds.union(item.bounds); });
}
}
return pulse.modifies('bounds');
};
function boundItem$1(item, bound, opt) {
item.bounds_prev.clear().union(item.bounds);
return bound(item.bounds.clear(), item, opt);
}
/**
* Bind scenegraph items to a scenegraph mark instance.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {object} params.markdef - The mark definition for creating the mark.
* This is an object of legal scenegraph mark properties which *must* include
* the 'marktype' property.
* @param {Array<number>} params.scenepath - Scenegraph tree coordinates for the mark.
* The path is an array of integers, each indicating the index into
* a successive chain of items arrays.
*/
function Mark(params) {
Transform.call(this, null, params);
}
var prototype$66 = inherits(Mark, Transform);
prototype$66.transform = function(_, pulse) {
var mark = this.value, group, context;
// acquire mark on first invocation, bind context and group
if (!mark) {
mark = pulse.dataflow.scenegraph().mark(_.scenepath, _.markdef);
mark.source = this;
this.value = mark;
context = _.scenepath.context;
group = mark.group;
group.context = context;
if (!context.group) context.group = group;
}
// initialize entering items
var Init = mark.marktype === 'group' ? GroupItem : Item;
pulse.visit(pulse.ADD, function(item) { Init.call(item, mark); });
// bind items array to scenegraph mark
return (mark.items = pulse.source, pulse);
};
/**
* Queue modified scenegraph items for rendering.
* @constructor
*/
function Render(params) {
Transform.call(this, null, params);
}
var prototype$67 = inherits(Render, Transform);
prototype$67.transform = function(_, pulse) {
var view = pulse.dataflow;
if (pulse.changed(pulse.REM)) {
view.enqueue(pulse.materialize(pulse.REM).rem);
}
if (pulse.changed(pulse.ADD)) {
view.enqueue(pulse.materialize(pulse.ADD).add);
}
if (pulse.changed(pulse.MOD)) {
view.enqueue(pulse.materialize(pulse.MOD).mod);
}
// set z-index dirty flag as needed
if (pulse.fields && pulse.fields['zindex']) {
var item = pulse.source && pulse.source[0];
if (item) item.mark.zdirty = true;
}
};
var Fit = 'fit';
var Pad = 'pad';
var None$2 = 'none';
var AxisRole = 'axis';
var FrameRole = 'frame';
var LegendRole = 'legend';
var ScopeRole = 'scope';
/**
* Layout view elements such as axes and legends.
* Also performs size adjustments.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {object} params.mark - Scenegraph mark of groups to layout.
*/
function ViewLayout(params) {
Transform.call(this, null, params);
}
var prototype$68 = inherits(ViewLayout, Transform);
prototype$68.transform = function(_, pulse) {
// TODO incremental update, output?
var view = pulse.dataflow;
_.mark.items.forEach(function(group) {
layoutGroup(view, group, _);
});
return pulse;
};
function layoutGroup(view, group, _) {
var items = group.items,
width = Math.max(0, group.width || 0),
height = Math.max(0, group.height || 0),
viewBounds = new Bounds().set(0, 0, width, height),
axisBounds = viewBounds.clone(),
legends = [],
mark, flow, b, i, n;
// layout axes, gather legends, collect bounds
for (i=0, n=items.length; i<n; ++i) {
mark = items[i];
switch (mark.role) {
case AxisRole:
b = layoutAxis(view, mark, width, height);
(isYAxis(mark) ? axisBounds : viewBounds).union(b);
break;
case LegendRole:
legends.push(mark); break;
case FrameRole:
case ScopeRole:
axisBounds.union(mark.bounds); break;
default:
viewBounds.union(mark.bounds);
}
}
// layout legends, extending viewBounds
if (legends.length) {
flow = {left: 0, right: 0, margin: _.legendMargin || 8};
for (i=0, n=legends.length; i<n; ++i) {
b = layoutLegend(view, legends[i], flow, axisBounds, width, height);
(_.autosize && _.autosize.type === Fit)
? viewBounds.add(b.x1, 0).add(b.x2, 0)
: viewBounds.union(b);
}
}
// perform size adjustment
layoutSize(view, group, viewBounds.union(axisBounds), _);
}
function isYAxis(axisMark) {
var orient = axisMark.items[0].datum.orient;
return orient === 'left' || orient === 'right';
}
function axisIndices(datum) {
var index = +datum.grid;
return [
datum.ticks ? index++ : -1, // ticks index
datum.labels ? index++ : -1, // labels index
index + (+datum.domain) // title index
];
}
function layoutAxis(view, axis, width, height) {
var item = axis.items[0],
datum = item.datum,
orient = datum.orient,
indices = axisIndices(datum),
range = item.range,
offset = item.offset,
position = item.position,
minExtent = item.minExtent,
maxExtent = item.maxExtent,
title = datum.title && item.items[indices[2]].items[0],
titlePadding = item.titlePadding,
titleSize = title ? title.fontSize + titlePadding : 0,
bounds = item.bounds,
x = 0, y = 0, i, s;
bounds.clear();
if ((i=indices[0]) > -1) bounds.union(item.items[i].bounds);
if ((i=indices[1]) > -1) bounds.union(item.items[i].bounds);
// position axis group and title
switch (orient) {
case 'top':
x = position || 0;
y = -offset;
s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1));
if (title) title.auto
? (title.y = -(titlePadding + s), s += titleSize)
: bounds.union(title.bounds);
bounds.add(0, -s).add(range, 0);
break;
case 'left':
x = -offset;
y = position || 0;
s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1));
if (title) title.auto
? (title.x = -(titlePadding + s), s += titleSize)
: bounds.union(title.bounds);
bounds.add(-s, 0).add(0, range);
break;
case 'right':
x = width + offset;
y = position || 0;
s = Math.max(minExtent, Math.min(maxExtent, bounds.x2));
if (title) title.auto
? (title.x = titlePadding + s, s += titleSize)
: bounds.union(title.bounds);
bounds.add(0, 0).add(s, range);
break;
case 'bottom':
x = position || 0;
y = height + offset;
s = Math.max(minExtent, Math.min(maxExtent, bounds.y2));
if (title) title.auto
? (title.y = titlePadding + s, s += titleSize)
: bounds.union(title.bounds);
bounds.add(0, 0).add(range, s);
break;
default:
x = item.x;
y = item.y;
}
if (set$3(item, 'x', x + 0.5) | set$3(item, 'y', y + 0.5)) {
view.enqueue([item]);
}
// update bounds
boundStroke(bounds.translate(x, y), item);
item.mark.bounds.clear().union(bounds);
return bounds;
}
function set$3(item, property, value) {
return item[property] === value ? 0
: (item[property] = value, 1);
}
function layoutLegend(view, legend, flow, axisBounds, width, height) {
var item = legend.items[0],
datum = item.datum,
orient = datum.orient,
offset = item.offset,
bounds = item.bounds.clear(),
x = 0,
y = (flow[orient] || 0),
w, h;
// aggregate bounds to determine size
// shave off 1 pixel because it looks better...
item.items.forEach(function(_) { bounds.union(_.bounds); });
w = Math.round(bounds.width()) + 2 * item.padding - 1;
h = Math.round(bounds.height()) + 2 * item.padding - 1;
switch (orient) {
case 'left':
x -= w + offset - Math.floor(axisBounds.x1);
flow.left += h + flow.margin;
break;
case 'right':
x += offset + Math.ceil(axisBounds.x2);
flow.right += h + flow.margin;
break;
case 'top-left':
x += offset;
y += offset;
break;
case 'top-right':
x += width - w - offset;
y += offset;
break;
case 'bottom-left':
x += offset;
y += height - h - offset;
break;
case 'bottom-right':
x += width - w - offset;
y += height - h - offset;
break;
default:
x = item.x;
y = item.y;
}
// update legend layout
if (set$3(item, 'x', x) | set$3(item, 'width', w) |
set$3(item, 'y', y) | set$3(item, 'height', h)) {
view.enqueue([item]);
}
// update bounds
boundStroke(bounds.set(x, y, x + w, y + h), item);
item.mark.bounds.clear().union(bounds);
return bounds;
}
function layoutSize(view, group, viewBounds, _) {
var type = _.autosize && _.autosize.type,
auto = _.autosize && _.autosize.resize,
viewWidth = view._width,
viewHeight = view._height;
if (view._autosize < 1 || !type) return;
var width = Math.max(0, group.width || 0),
left = Math.max(0, Math.ceil(-viewBounds.x1)),
right = Math.max(0, Math.ceil(viewBounds.x2 - width)),
height = Math.max(0, group.height || 0),
top = Math.max(0, Math.ceil(-viewBounds.y1)),
bottom = Math.max(0, Math.ceil(viewBounds.y2 - height));
if (type === None$2) {
viewWidth = width;
viewHeight = height;
left = 0;
top = 0;
}
else if (type === Fit) {
width = Math.max(0, viewWidth - left - right);
height = Math.max(0, viewHeight - top - bottom);
}
else if (type === Pad) {
viewWidth = width + left + right;
viewHeight = height + top + bottom;
}
view.autosize(viewWidth, viewHeight, width, height, [left, top], auto);
}
var Default = 'default';
function cursor(view) {
var cursor = view._signals.cursor;
// add cursor signal to dataflow, if needed
if (!cursor) {
view._signals.cursor = (cursor = view.add({user: Default, item: null}));
}
// evaluate cursor on each mousemove event
view.on(view.events('view', 'mousemove'), cursor,
function(_, event) {
var value = cursor.value,
user = value ? (isString(value) ? value : value.user) : Default,
item = event.item && event.item.cursor || null;
return (value && user === value.user && item == value.item) ? value
: {user: user, item: item};
}
);
// when cursor signal updates, set visible cursor
view.add(null, function(_) {
var user = _.cursor,
item = this.value;
if (!isString(user)) {
item = user.item;
user = user.user;
}
setCursor(user && user !== Default ? user : (item || user));
return item;
}, {cursor: cursor});
}
function setCursor(cursor) {
// set cursor on document body
// this ensures cursor applies even if dragging out of view
if (typeof document !== 'undefined' && document.body) {
document.body.style.cursor = cursor;
}
}
function dataref(view, name) {
var data = view._runtime.data;
if (!data.hasOwnProperty(name)) {
view.error('Unrecognized data set: ' + name);
}
return data[name];
}
function data(name) {
return dataref(this, name).values.value;
}
function change(name, changes) {
if (!isChangeSet(changes)) {
this.error('Second argument to changes must be a changeset.');
}
var dataset = dataref(this, name);
dataset.modified = true;
return this.pulse(dataset.input, changes);
}
function insert(name, _) {
return change.call(this, name, changeset().insert(_));
}
function remove(name, _) {
return change.call(this, name, changeset().remove(_));
}
function width(view) {
var padding = view.padding();
return Math.max(0, view._width + padding.left + padding.right);
}
function height$1(view) {
var padding = view.padding();
return Math.max(0, view._height + padding.top + padding.bottom);
}
function offset$1(view) {
var padding = view.padding(),
origin = view._origin;
return [
padding.left + origin[0],
padding.top + origin[1]
];
}
function resizeRenderer(view) {
var origin = offset$1(view);
view._renderer.background(view._background);
view._renderer.resize(width(view), height$1(view), origin);
view._handler.origin(origin);
}
/**
* Extend an event with additional view-specific methods.
* Adds a new property ('vega') to an event that provides a number
* of methods for querying information about the current interaction.
* The vega object provides the following methods:
* view - Returns the backing View instance.
* item - Returns the currently active scenegraph item (if any).
* group - Returns the currently active scenegraph group (if any).
* This method accepts a single string-typed argument indicating the name
* of the desired parent group. The scenegraph will be traversed from
* the item up towards the root to search for a matching group. If no
* argument is provided the enclosing group for the active item is
* returned, unless the item it itself a group, in which case it is
* returned directly.
* xy - Returns a two-element array containing the x and y coordinates for
* mouse or touch events. For touch events, this is based on the first
* elements in the changedTouches array. This method accepts a single
* argument: either an item instance or mark name that should serve as
* the reference coordinate system. If no argument is provided the
* top-level view coordinate system is assumed.
* x - Returns the current x-coordinate, accepts the same arguments as xy.
* y - Returns the current y-coordinate, accepts the same arguments as xy.
* @param {Event} event - The input event to extend.
* @param {Item} item - The currently active scenegraph item (if any).
* @return {Event} - The extended input event.
*/
function eventExtend(view, event, item) {
var el = view._renderer.element(),
p, e, translate;
if (el) {
translate = offset$1(view);
e = event.changedTouches ? event.changedTouches[0] : event;
p = point$4(e, el);
p[0] -= translate[0];
p[1] -= translate[1];
}
return event.vega = extension(view, item, p), event.item = item, event;
}
function extension(view, item, point) {
var itemGroup = item
? item.mark.marktype === 'group' ? item : item.mark.group
: null;
function group(name) {
var g = itemGroup, i;
if (name) for (i = item; i; i = i.mark.group) {
if (i.mark.name === name) { g = i; break; }
}
return g && g.mark && g.mark.interactive ? g : {};
}
function xy(item) {
if (!item) return point;
if (isString(item)) item = group(item);
var p = point.slice();
while (item) {
p[0] -= item.x || 0;
p[1] -= item.y || 0;
item = item.mark && item.mark.group;
}
return p;
}
return {
view: constant$1(view),
item: constant$1(item || {}),
group: group,
xy: xy,
x: function(item) { return xy(item)[0]; },
y: function(item) { return xy(item)[1]; }
};
}
var VIEW = 'view';
var WINDOW = 'window';
/**
* Create a new event stream from an event source.
* @param {object} source - The event source to monitor.
* @param {string} type - The event type.
* @param {function(object): boolean} [filter] - Event filter function.
* @return {EventStream}
*/
function events$1(source, type, filter) {
var view = this,
s = new EventStream(filter),
send = function(e, item) {
if (view.preventDefault() && source === VIEW) {
e.preventDefault();
}
s.receive(eventExtend(view, e, item));
view.run();
},
sources;
if (source === VIEW) {
view.addEventListener(type, send);
return s;
}
if (source === WINDOW) {
if (typeof window !== 'undefined') sources = [window];
} else if (typeof document !== 'undefined') {
sources = document.querySelectorAll(source);
}
if (!sources) {
view.warn('Can not resolve event source: ' + source);
return s;
}
for (var i=0, n=sources.length; i<n; ++i) {
sources[i].addEventListener(type, send);
}
view._eventListeners.push({
type: type,
sources: sources,
handler: send
});
return s;
}
function itemFilter(event) {
return event.item;
}
function markTarget(event) {
// grab upstream collector feeding the mark operator
var source = event.item.mark.source;
return source.source || source;
}
function invoke(name) {
return function(_, event) {
return event.vega.view()
.changeset()
.encode(event.item, name);
};
}
function hover(hoverSet, leaveSet) {
// invoke hover set upon mouseover
this.on(
this.events('view', 'mouseover', itemFilter),
markTarget,
invoke(hoverSet || 'hover')
);
// invoke leave set upon mouseout
this.on(
this.events('view', 'mouseout', itemFilter),
markTarget,
invoke(leaveSet || 'update')
);
return this;
}
/**
* Remove all external event listeners.
*/
function finalize() {
var listeners = this._eventListeners,
n = listeners.length, m, e;
while (--n >= 0) {
e = listeners[n];
m = e.sources.length;
while (--m >= 0) {
e.sources[m].removeEventListener(e.type, e.handler);
}
}
}
function element$1(tag, attr, text) {
var el = document.createElement(tag);
for (var key in attr) el.setAttribute(key, attr[key]);
if (text != null) el.textContent = text;
return el;
}
var BindClass = 'vega-bind';
var NameClass = 'vega-bind-name';
var RadioClass = 'vega-bind-radio';
var OptionClass = 'vega-option-';
/**
* Bind a signal to an external HTML input element. The resulting two-way
* binding will propagate input changes to signals, and propagate signal
* changes to the input element state. If this view instance has no parent
* element, we assume the view is headless and no bindings are created.
* @param {Element|string} el - The parent DOM element to which the input
* element should be appended as a child. If string-valued, this argument
* will be treated as a CSS selector. If null or undefined, the parent
* element of this view will be used as the element.
* @param {object} param - The binding parameters which specify the signal
* to bind to, the input element type, and type-specific configuration.
* @return {View} - This view instance.
*/
function bind$1(view, el, binding) {
var param = binding.param;
var bind = binding.state || (binding.state = {
elements: null,
set: null,
update: function(value) {
bind.source = true;
view.signal(param.signal, value).run();
},
active: false
});
if (isString(el)) el = document.querySelector(el);
generate(bind, el, param, view.signal(param.signal));
if (!bind.active) {
view.on(view._signals[param.signal], null, function() {
bind.source
? (bind.source = false)
: bind.set(view.signal(param.signal));
});
bind.active = true;
}
return bind;
}
/**
* Generate an HTML input form element and bind it to a signal.
*/
function generate(bind, el, param, value) {
var div = element$1('div', {'class': BindClass});
div.appendChild(element$1('span',
{'class': NameClass},
(param.name || param.signal)
));
el.appendChild(div);
var input = form;
switch (param.input) {
case 'checkbox': input = checkbox; break;
case 'select': input = select; break;
case 'radio': input = radio; break;
case 'range': input = range$1; break;
}
input(bind, div, param, value);
}
/**
* Generates an arbitrary input form element.
* The input type is controlled via user-provided parameters.
*/
function form(bind, el, param, value) {
var node = element$1('input');
for (var key in param) {
if (key !== 'signal' && key !== 'element') {
node.setAttribute(key === 'input' ? 'type' : key, param[key]);
}
}
node.setAttribute('name', param.signal);
node.setAttribute('value', value);
el.appendChild(node);
node.addEventListener('input', function() {
bind.update(node.value);
});
bind.elements = [node];
bind.set = function(value) { node.value = value; };
}
/**
* Generates a checkbox input element.
*/
function checkbox(bind, el, param, value) {
var attr = {type: 'checkbox', name: param.signal};
if (value) attr.checked = true;
var node = element$1('input', attr);
el.appendChild(node);
node.addEventListener('change', function() {
bind.update(node.checked);
});
bind.elements = [node];
bind.set = function(value) { node.checked = !!value || null; }
}
/**
* Generates a selection list input element.
*/
function select(bind, el, param, value) {
var node = element$1('select', {name: param.signal});
param.options.forEach(function(option) {
var attr = {value: option};
if (valuesEqual(option, value)) attr.selected = true;
node.appendChild(element$1('option', attr, option+''));
});
el.appendChild(node);
node.addEventListener('change', function() {
bind.update(param.options[node.selectedIndex]);
});
bind.elements = [node];
bind.set = function(value) {
for (var i=0, n=param.options.length; i<n; ++i) {
if (valuesEqual(param.options[i], value)) {
node.selectedIndex = i; return;
}
}
};
}
/**
* Generates a radio button group.
*/
function radio(bind, el, param, value) {
var group = element$1('span', {'class': RadioClass});
el.appendChild(group);
bind.elements = param.options.map(function(option) {
var id = OptionClass + param.signal + '-' + option;
var attr = {
id: id,
type: 'radio',
name: param.signal,
value: option
};
if (valuesEqual(option, value)) attr.checked = true;
var input = element$1('input', attr);
input.addEventListener('change', function() {
bind.update(option);
});
group.appendChild(input);
group.appendChild(element$1('label', {'for': id}, option+''));
return input;
});
bind.set = function(value) {
var nodes = bind.elements,
i = 0,
n = nodes.length;
for (; i<n; ++i) {
if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true;
}
};
}
/**
* Generates a slider input element.
*/
function range$1(bind, el, param, value) {
value = value !== undefined ? value : ((+param.max) + (+param.min)) / 2;
var min = param.min || Math.min(0, +value) || 0,
max = param.max || Math.max(100, +value) || 100,
step = param.step || tickStep(min, max, 100);
var node = element$1('input', {
type: 'range',
value: value,
name: param.signal,
min: min,
max: max,
step: step
});
var label = element$1('label', {}, +value);
el.appendChild(node);
el.appendChild(label);
node.addEventListener('input', function() {
label.textContent = node.value;
bind.update(+node.value);
});
bind.elements = [node];
bind.set = function(value) {
node.value = value;
label.textContent = value;
};
}
function valuesEqual(a, b) {
return a === b || (a+'' === b+'');
}
function initializeRenderer(view, r, el, constructor) {
r = r || new constructor(view.loader());
return r
.initialize(el, width(view), height$1(view), offset$1(view))
.background(view._background);
}
function initializeHandler(view, prevHandler, el, constructor) {
var handler = new constructor()
.scene(view.scenegraph().root)
.initialize(el, offset$1(view), view);
if (prevHandler) {
handler.handleTooltip = prevHandler.handleTooltip;
prevHandler.handlers().forEach(function(h) {
handler.on(h.type, h.handler);
});
}
return handler;
}
function initialize$1(el, elBind) {
var view = this,
type = view._renderType,
module = renderModule(type),
Handler, Renderer;
// containing dom element
el = view._el = el ? lookup$1(view, el) : null;
// select appropriate renderer & handler
if (!module) view.error('Unrecognized renderer type: ' + type);
Handler = module.handler || CanvasHandler;
Renderer = (el ? module.renderer : module.headless);
// initialize renderer and input handler
view._renderer = !Renderer ? null
: initializeRenderer(view, view._renderer, el, Renderer);
view._handler = initializeHandler(view, view._handler, el, Handler);
// initialize signal bindings
if (el) {
elBind = elBind ? lookup$1(view, elBind)
: el.appendChild(element$1('div', {'class': 'vega-bindings'}));
view._bind.forEach(function(_) {
bind$1(view, _.param.element || elBind, _);
});
}
return view;
}
function lookup$1(view, el) {
if (typeof el === 'string') {
el = typeof document !== 'undefined'
? document.querySelector(el)
: view.error('DOM document instance not found.');
}
return el.innerHTML = '', el;
}
/**
* Render the current scene in a headless fashion.
* This method is asynchronous, returning a Promise instance.
* @return {Promise} - A Promise that resolves to a renderer.
*/
function renderHeadless(view, type) {
var module = renderModule(type);
return !(module && module.headless)
? Promise.reject('Unrecognized renderer type: ' + type)
: view.runAsync().then(function() {
return initializeRenderer(view, null, null, module.headless)
.renderAsync(view._scenegraph.root);
});
}
/**
* Produce an image URL for the visualization. Depending on the type
* parameter, the generated URL contains data for either a PNG or SVG image.
* The URL can be used (for example) to download images of the visualization.
* This method is asynchronous, returning a Promise instance.
* @param {string} type - The image type. One of 'svg', 'png' or 'canvas'.
* The 'canvas' and 'png' types are synonyms for a PNG image.
* @return {Promise} - A promise that resolves to an image URL.
*/
function renderToImageURL(type) {
return (type !== RenderType.Canvas && type !== RenderType.SVG && type !== RenderType.PNG)
? Promise.reject('Unrecognized image type: ' + type)
: renderHeadless(this, type).then(function(renderer) {
return type === RenderType.SVG
? toBlobURL(renderer.svg(), 'image/svg+xml')
: renderer.canvas().toDataURL('image/png');
});
}
function toBlobURL(data, mime) {
var blob = new Blob([data], {type: mime});
return window.URL.createObjectURL(blob);
}
/**
* Produce a Canvas instance containing a rendered visualization.
* This method is asynchronous, returning a Promise instance.
* @return {Promise} - A promise that resolves to a Canvas instance.
*/
function renderToCanvas() {
return renderHeadless(this, RenderType.Canvas)
.then(function(renderer) { return renderer.canvas(); });
}
/**
* Produce a rendered SVG string of the visualization.
* This method is asynchronous, returning a Promise instance.
* @return {Promise} - A promise that resolves to an SVG string.
*/
function renderToSVG() {
return renderHeadless(this, RenderType.SVG)
.then(function(renderer) { return renderer.svg(); });
}
function parseAutosize(spec, config) {
spec = spec || config.autosize;
return isObject(spec) ? spec
: (spec = spec || 'pad', {type: spec});
}
function parsePadding(spec, config) {
spec = spec || config.padding;
return isObject(spec) ? spec
: (spec = +spec || 0, {top:spec, bottom:spec, left:spec, right:spec});
}
var OUTER = 'outer';
var OUTER_INVALID = ['value', 'update', 'react', 'bind'];
function outerError(prefix, name) {
error(prefix + ' for "outer" push: ' + $(name));
}
function parseSignal(signal, scope) {
var name = signal.name;
if (signal.push === OUTER) {
// signal must already be defined, raise error if not
if (!scope.signals[name]) outerError('No prior signal definition', name);
// signal push must not use properties reserved for standard definition
OUTER_INVALID.forEach(function(prop) {
if (signal[prop] !== undefined) outerError('Invalid property ', prop);
});
} else {
// define a new signal in the current scope
var op = scope.addSignal(name, signal.value);
if (signal.react === false) op.react = false;
if (signal.bind) scope.addBinding(name, signal.bind);
}
}
function ASTNode(type) {
this.type = type;
}
ASTNode.prototype.visit = function(visitor) {
var node = this, c, i, n;
if (visitor(node)) return 1;
for (c=children$1(node), i=0, n=c.length; i<n; ++i) {
if (c[i].visit(visitor)) return 1;
}
}
function children$1(node) {
switch (node.type) {
case 'ArrayExpression':
return node.elements;
case 'BinaryExpression':
case 'LogicalExpression':
return [node.left, node.right];
case 'CallExpression':
var args = node.arguments.slice();
args.unshift(node.callee);
return args;
case 'ConditionalExpression':
return [node.test, node.consequent, node.alternate];
case 'MemberExpression':
return [node.object, node.property];
case 'ObjectExpression':
return node.properties;
case 'Property':
return [node.key, node.value];
case 'UnaryExpression':
return [node.argument];
case 'Identifier':
case 'Literal':
case 'RawCode':
default:
return [];
}
}
/*
The following expression parser is based on Esprima (http://esprima.org/).
Original header comment and license for Esprima is included here:
Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be>
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var source$1;
var index$1;
var length$2;
var lookahead;
var TokenBooleanLiteral = 1;
var TokenEOF = 2;
var TokenIdentifier = 3;
var TokenKeyword = 4;
var TokenNullLiteral = 5;
var TokenNumericLiteral = 6;
var TokenPunctuator = 7;
var TokenStringLiteral = 8;
var SyntaxArrayExpression = 'ArrayExpression';
var SyntaxBinaryExpression = 'BinaryExpression';
var SyntaxCallExpression = 'CallExpression';
var SyntaxConditionalExpression = 'ConditionalExpression';
var SyntaxIdentifier = 'Identifier';
var SyntaxLiteral = 'Literal';
var SyntaxLogicalExpression = 'LogicalExpression';
var SyntaxMemberExpression = 'MemberExpression';
var SyntaxObjectExpression = 'ObjectExpression';
var SyntaxProperty = 'Property';
var SyntaxUnaryExpression = 'UnaryExpression';
var MessageUnexpectedToken = 'Unexpected token %0';
var MessageUnexpectedNumber = 'Unexpected number';
var MessageUnexpectedString = 'Unexpected string';
var MessageUnexpectedIdentifier = 'Unexpected identifier';
var MessageUnexpectedReserved = 'Unexpected reserved word';
var MessageUnexpectedEOS = 'Unexpected end of input';
var MessageInvalidRegExp = 'Invalid regular expression';
var MessageUnterminatedRegExp = 'Invalid regular expression: missing /';
var MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.';
var MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode';
var ILLEGAL = 'ILLEGAL';
var DISABLED = 'Disabled.';
var RegexNonAsciiIdentifierStart = new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]');
var RegexNonAsciiIdentifierPart = new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]');
// Ensure the condition is true, otherwise throw an error.
// This is only to have a better contract semantic, i.e. another safety net
// to catch a logic error. The condition shall be fulfilled in normal case.
// Do NOT use this to enforce a certain condition on any user input.
function assert(condition, message) {
/* istanbul ignore next */
if (!condition) {
throw new Error('ASSERT: ' + message);
}
}
function isDecimalDigit(ch) {
return (ch >= 0x30 && ch <= 0x39); // 0..9
}
function isHexDigit(ch) {
return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
}
function isOctalDigit(ch) {
return '01234567'.indexOf(ch) >= 0;
}
// 7.2 White Space
function isWhiteSpace(ch) {
return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) ||
(ch >= 0x1680 && [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(ch) >= 0);
}
// 7.3 Line Terminators
function isLineTerminator(ch) {
return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);
}
// 7.6 Identifier Names and Identifiers
function isIdentifierStart(ch) {
return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore)
(ch >= 0x41 && ch <= 0x5A) || // A..Z
(ch >= 0x61 && ch <= 0x7A) || // a..z
(ch === 0x5C) || // \ (backslash)
((ch >= 0x80) && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch)));
}
function isIdentifierPart(ch) {
return (ch === 0x24) || (ch === 0x5F) || // $ (dollar) and _ (underscore)
(ch >= 0x41 && ch <= 0x5A) || // A..Z
(ch >= 0x61 && ch <= 0x7A) || // a..z
(ch >= 0x30 && ch <= 0x39) || // 0..9
(ch === 0x5C) || // \ (backslash)
((ch >= 0x80) && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch)));
}
// 7.6.1.1 Keywords
var keywords$1 = {
'if':1, 'in':1, 'do':1,
'var':1, 'for':1, 'new':1, 'try':1, 'let':1,
'this':1, 'else':1, 'case':1, 'void':1, 'with':1, 'enum':1,
'while':1, 'break':1, 'catch':1, 'throw':1, 'const':1, 'yield':1, 'class':1, 'super':1,
'return':1, 'typeof':1, 'delete':1, 'switch':1, 'export':1, 'import':1, 'public':1, 'static':1,
'default':1, 'finally':1, 'extends':1, 'package':1, 'private':1,
'function':1, 'continue':1, 'debugger':1,
'interface':1, 'protected':1,
'instanceof':1, 'implements':1
};
function skipComment() {
var ch;
while (index$1 < length$2) {
ch = source$1.charCodeAt(index$1);
if (isWhiteSpace(ch) || isLineTerminator(ch)) {
++index$1;
} else {
break;
}
}
}
function scanHexEscape(prefix) {
var i, len, ch, code = 0;
len = (prefix === 'u') ? 4 : 2;
for (i = 0; i < len; ++i) {
if (index$1 < length$2 && isHexDigit(source$1[index$1])) {
ch = source$1[index$1++];
code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
} else {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
}
return String.fromCharCode(code);
}
function scanUnicodeCodePointEscape() {
var ch, code, cu1, cu2;
ch = source$1[index$1];
code = 0;
// At least, one hex digit is required.
if (ch === '}') {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
while (index$1 < length$2) {
ch = source$1[index$1++];
if (!isHexDigit(ch)) {
break;
}
code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
}
if (code > 0x10FFFF || ch !== '}') {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
// UTF-16 Encoding
if (code <= 0xFFFF) {
return String.fromCharCode(code);
}
cu1 = ((code - 0x10000) >> 10) + 0xD800;
cu2 = ((code - 0x10000) & 1023) + 0xDC00;
return String.fromCharCode(cu1, cu2);
}
function getEscapedIdentifier() {
var ch, id;
ch = source$1.charCodeAt(index$1++);
id = String.fromCharCode(ch);
// '\u' (U+005C, U+0075) denotes an escaped character.
if (ch === 0x5C) {
if (source$1.charCodeAt(index$1) !== 0x75) {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
++index$1;
ch = scanHexEscape('u');
if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
id = ch;
}
while (index$1 < length$2) {
ch = source$1.charCodeAt(index$1);
if (!isIdentifierPart(ch)) {
break;
}
++index$1;
id += String.fromCharCode(ch);
// '\u' (U+005C, U+0075) denotes an escaped character.
if (ch === 0x5C) {
id = id.substr(0, id.length - 1);
if (source$1.charCodeAt(index$1) !== 0x75) {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
++index$1;
ch = scanHexEscape('u');
if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
id += ch;
}
}
return id;
}
function getIdentifier() {
var start, ch;
start = index$1++;
while (index$1 < length$2) {
ch = source$1.charCodeAt(index$1);
if (ch === 0x5C) {
// Blackslash (U+005C) marks Unicode escape sequence.
index$1 = start;
return getEscapedIdentifier();
}
if (isIdentifierPart(ch)) {
++index$1;
} else {
break;
}
}
return source$1.slice(start, index$1);
}
function scanIdentifier() {
var start, id, type;
start = index$1;
// Backslash (U+005C) starts an escaped character.
id = (source$1.charCodeAt(index$1) === 0x5C) ? getEscapedIdentifier() : getIdentifier();
// There is no keyword or literal with only one character.
// Thus, it must be an identifier.
if (id.length === 1) {
type = TokenIdentifier;
} else if (keywords$1.hasOwnProperty(id)) {
type = TokenKeyword;
} else if (id === 'null') {
type = TokenNullLiteral;
} else if (id === 'true' || id === 'false') {
type = TokenBooleanLiteral;
} else {
type = TokenIdentifier;
}
return {
type: type,
value: id,
start: start,
end: index$1
};
}
// 7.7 Punctuators
function scanPunctuator() {
var start = index$1,
code = source$1.charCodeAt(index$1),
code2,
ch1 = source$1[index$1],
ch2,
ch3,
ch4;
switch (code) {
// Check for most common single-character punctuators.
case 0x2E: // . dot
case 0x28: // ( open bracket
case 0x29: // ) close bracket
case 0x3B: // ; semicolon
case 0x2C: // , comma
case 0x7B: // { open curly brace
case 0x7D: // } close curly brace
case 0x5B: // [
case 0x5D: // ]
case 0x3A: // :
case 0x3F: // ?
case 0x7E: // ~
++index$1;
return {
type: TokenPunctuator,
value: String.fromCharCode(code),
start: start,
end: index$1
};
default:
code2 = source$1.charCodeAt(index$1 + 1);
// '=' (U+003D) marks an assignment or comparison operator.
if (code2 === 0x3D) {
switch (code) {
case 0x2B: // +
case 0x2D: // -
case 0x2F: // /
case 0x3C: // <
case 0x3E: // >
case 0x5E: // ^
case 0x7C: // |
case 0x25: // %
case 0x26: // &
case 0x2A: // *
index$1 += 2;
return {
type: TokenPunctuator,
value: String.fromCharCode(code) + String.fromCharCode(code2),
start: start,
end: index$1
};
case 0x21: // !
case 0x3D: // =
index$1 += 2;
// !== and ===
if (source$1.charCodeAt(index$1) === 0x3D) {
++index$1;
}
return {
type: TokenPunctuator,
value: source$1.slice(start, index$1),
start: start,
end: index$1
};
}
}
}
// 4-character punctuator: >>>=
ch4 = source$1.substr(index$1, 4);
if (ch4 === '>>>=') {
index$1 += 4;
return {
type: TokenPunctuator,
value: ch4,
start: start,
end: index$1
};
}
// 3-character punctuators: === !== >>> <<= >>=
ch3 = ch4.substr(0, 3);
if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') {
index$1 += 3;
return {
type: TokenPunctuator,
value: ch3,
start: start,
end: index$1
};
}
// Other 2-character punctuators: ++ -- << >> && ||
ch2 = ch3.substr(0, 2);
if ((ch1 === ch2[1] && ('+-<>&|'.indexOf(ch1) >= 0)) || ch2 === '=>') {
index$1 += 2;
return {
type: TokenPunctuator,
value: ch2,
start: start,
end: index$1
};
}
// 1-character punctuators: < > = ! + - * % & | ^ /
if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
++index$1;
return {
type: TokenPunctuator,
value: ch1,
start: start,
end: index$1
};
}
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
// 7.8.3 Numeric Literals
function scanHexLiteral(start) {
var number = '';
while (index$1 < length$2) {
if (!isHexDigit(source$1[index$1])) {
break;
}
number += source$1[index$1++];
}
if (number.length === 0) {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
if (isIdentifierStart(source$1.charCodeAt(index$1))) {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
return {
type: TokenNumericLiteral,
value: parseInt('0x' + number, 16),
start: start,
end: index$1
};
}
function scanOctalLiteral(start) {
var number = '0' + source$1[index$1++];
while (index$1 < length$2) {
if (!isOctalDigit(source$1[index$1])) {
break;
}
number += source$1[index$1++];
}
if (isIdentifierStart(source$1.charCodeAt(index$1)) || isDecimalDigit(source$1.charCodeAt(index$1))) {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
return {
type: TokenNumericLiteral,
value: parseInt(number, 8),
octal: true,
start: start,
end: index$1
};
}
function scanNumericLiteral() {
var number, start, ch;
ch = source$1[index$1];
assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
'Numeric literal must start with a decimal digit or a decimal point');
start = index$1;
number = '';
if (ch !== '.') {
number = source$1[index$1++];
ch = source$1[index$1];
// Hex number starts with '0x'.
// Octal number starts with '0'.
if (number === '0') {
if (ch === 'x' || ch === 'X') {
++index$1;
return scanHexLiteral(start);
}
if (isOctalDigit(ch)) {
return scanOctalLiteral(start);
}
// decimal number starts with '0' such as '09' is illegal.
if (ch && isDecimalDigit(ch.charCodeAt(0))) {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
}
while (isDecimalDigit(source$1.charCodeAt(index$1))) {
number += source$1[index$1++];
}
ch = source$1[index$1];
}
if (ch === '.') {
number += source$1[index$1++];
while (isDecimalDigit(source$1.charCodeAt(index$1))) {
number += source$1[index$1++];
}
ch = source$1[index$1];
}
if (ch === 'e' || ch === 'E') {
number += source$1[index$1++];
ch = source$1[index$1];
if (ch === '+' || ch === '-') {
number += source$1[index$1++];
}
if (isDecimalDigit(source$1.charCodeAt(index$1))) {
while (isDecimalDigit(source$1.charCodeAt(index$1))) {
number += source$1[index$1++];
}
} else {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
}
if (isIdentifierStart(source$1.charCodeAt(index$1))) {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
return {
type: TokenNumericLiteral,
value: parseFloat(number),
start: start,
end: index$1
};
}
// 7.8.4 String Literals
function scanStringLiteral() {
var str = '',
quote, start, ch, code, octal = false;
quote = source$1[index$1];
assert((quote === '\'' || quote === '"'),
'String literal must starts with a quote');
start = index$1;
++index$1;
while (index$1 < length$2) {
ch = source$1[index$1++];
if (ch === quote) {
quote = '';
break;
} else if (ch === '\\') {
ch = source$1[index$1++];
if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'u':
case 'x':
if (source$1[index$1] === '{') {
++index$1;
str += scanUnicodeCodePointEscape();
} else {
str += scanHexEscape(ch);
}
break;
case 'n':
str += '\n';
break;
case 'r':
str += '\r';
break;
case 't':
str += '\t';
break;
case 'b':
str += '\b';
break;
case 'f':
str += '\f';
break;
case 'v':
str += '\x0B';
break;
default:
if (isOctalDigit(ch)) {
code = '01234567'.indexOf(ch);
// \0 is not octal escape sequence
if (code !== 0) {
octal = true;
}
if (index$1 < length$2 && isOctalDigit(source$1[index$1])) {
octal = true;
code = code * 8 + '01234567'.indexOf(source$1[index$1++]);
// 3 digits are only allowed when string starts
// with 0, 1, 2, 3
if ('0123'.indexOf(ch) >= 0 &&
index$1 < length$2 &&
isOctalDigit(source$1[index$1])) {
code = code * 8 + '01234567'.indexOf(source$1[index$1++]);
}
}
str += String.fromCharCode(code);
} else {
str += ch;
}
break;
}
} else {
if (ch === '\r' && source$1[index$1] === '\n') {
++index$1;
}
}
} else if (isLineTerminator(ch.charCodeAt(0))) {
break;
} else {
str += ch;
}
}
if (quote !== '') {
throwError({}, MessageUnexpectedToken, ILLEGAL);
}
return {
type: TokenStringLiteral,
value: str,
octal: octal,
start: start,
end: index$1
};
}
function testRegExp(pattern, flags) {
var tmp = pattern;
if (flags.indexOf('u') >= 0) {
// Replace each astral symbol and every Unicode code point
// escape sequence with a single ASCII symbol to avoid throwing on
// regular expressions that are only valid in combination with the
// `/u` flag.
// Note: replacing with the ASCII symbol `x` might cause false
// negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
// perfectly valid pattern that is equivalent to `[a-b]`, but it
// would be replaced by `[x-b]` which throws an error.
tmp = tmp
.replace(/\\u\{([0-9a-fA-F]+)\}/g, function($0, $1) {
if (parseInt($1, 16) <= 0x10FFFF) {
return 'x';
}
throwError({}, MessageInvalidRegExp);
})
.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x');
}
// First, detect invalid regular expressions.
try {
new RegExp(tmp);
} catch (e) {
throwError({}, MessageInvalidRegExp);
}
// Return a regular expression object for this pattern-flag pair, or
// `null` in case the current environment doesn't support the flags it
// uses.
try {
return new RegExp(pattern, flags);
} catch (exception) {
return null;
}
}
function scanRegExpBody() {
var ch, str, classMarker, terminated, body;
ch = source$1[index$1];
assert(ch === '/', 'Regular expression literal must start with a slash');
str = source$1[index$1++];
classMarker = false;
terminated = false;
while (index$1 < length$2) {
ch = source$1[index$1++];
str += ch;
if (ch === '\\') {
ch = source$1[index$1++];
// ECMA-262 7.8.5
if (isLineTerminator(ch.charCodeAt(0))) {
throwError({}, MessageUnterminatedRegExp);
}
str += ch;
} else if (isLineTerminator(ch.charCodeAt(0))) {
throwError({}, MessageUnterminatedRegExp);
} else if (classMarker) {
if (ch === ']') {
classMarker = false;
}
} else {
if (ch === '/') {
terminated = true;
break;
} else if (ch === '[') {
classMarker = true;
}
}
}
if (!terminated) {
throwError({}, MessageUnterminatedRegExp);
}
// Exclude leading and trailing slash.
body = str.substr(1, str.length - 2);
return {
value: body,
literal: str
};
}
function scanRegExpFlags() {
var ch, str, flags;
str = '';
flags = '';
while (index$1 < length$2) {
ch = source$1[index$1];
if (!isIdentifierPart(ch.charCodeAt(0))) {
break;
}
++index$1;
if (ch === '\\' && index$1 < length$2) {
throwError({}, MessageUnexpectedToken, ILLEGAL);
} else {
flags += ch;
str += ch;
}
}
if (flags.search(/[^gimuy]/g) >= 0) {
throwError({}, MessageInvalidRegExp, flags);
}
return {
value: flags,
literal: str
};
}
function scanRegExp() {
var start, body, flags, value;
lookahead = null;
skipComment();
start = index$1;
body = scanRegExpBody();
flags = scanRegExpFlags();
value = testRegExp(body.value, flags.value);
return {
literal: body.literal + flags.literal,
value: value,
regex: {
pattern: body.value,
flags: flags.value
},
start: start,
end: index$1
};
}
function isIdentifierName(token) {
return token.type === TokenIdentifier ||
token.type === TokenKeyword ||
token.type === TokenBooleanLiteral ||
token.type === TokenNullLiteral;
}
function advance() {
var ch;
skipComment();
if (index$1 >= length$2) {
return {
type: TokenEOF,
start: index$1,
end: index$1
};
}
ch = source$1.charCodeAt(index$1);
if (isIdentifierStart(ch)) {
return scanIdentifier();
}
// Very common: ( and ) and ;
if (ch === 0x28 || ch === 0x29 || ch === 0x3B) {
return scanPunctuator();
}
// String literal starts with single quote (U+0027) or double quote (U+0022).
if (ch === 0x27 || ch === 0x22) {
return scanStringLiteral();
}
// Dot (.) U+002E can also start a floating-point number, hence the need
// to check the next character.
if (ch === 0x2E) {
if (isDecimalDigit(source$1.charCodeAt(index$1 + 1))) {
return scanNumericLiteral();
}
return scanPunctuator();
}
if (isDecimalDigit(ch)) {
return scanNumericLiteral();
}
return scanPunctuator();
}
function lex() {
var token;
token = lookahead;
index$1 = token.end;
lookahead = advance();
index$1 = token.end;
return token;
}
function peek$1() {
var pos;
pos = index$1;
lookahead = advance();
index$1 = pos;
}
function finishArrayExpression(elements) {
var node = new ASTNode(SyntaxArrayExpression);
node.elements = elements;
return node;
}
function finishBinaryExpression(operator, left, right) {
var node = new ASTNode((operator === '||' || operator === '&&') ? SyntaxLogicalExpression : SyntaxBinaryExpression);
node.operator = operator;
node.left = left;
node.right = right;
return node;
}
function finishCallExpression(callee, args) {
var node = new ASTNode(SyntaxCallExpression);
node.callee = callee;
node.arguments = args;
return node;
}
function finishConditionalExpression(test, consequent, alternate) {
var node = new ASTNode(SyntaxConditionalExpression);
node.test = test;
node.consequent = consequent;
node.alternate = alternate;
return node;
}
function finishIdentifier(name) {
var node = new ASTNode(SyntaxIdentifier);
node.name = name;
return node;
}
function finishLiteral(token) {
var node = new ASTNode(SyntaxLiteral);
node.value = token.value;
node.raw = source$1.slice(token.start, token.end);
if (token.regex) {
if (node.raw === '//') {
node.raw = '/(?:)/';
}
node.regex = token.regex;
}
return node;
}
function finishMemberExpression(accessor, object, property) {
var node = new ASTNode(SyntaxMemberExpression);
node.computed = accessor === '[';
node.object = object;
node.property = property;
if (!node.computed) property.member = true;
return node;
}
function finishObjectExpression(properties) {
var node = new ASTNode(SyntaxObjectExpression);
node.properties = properties;
return node;
}
function finishProperty(kind, key, value) {
var node = new ASTNode(SyntaxProperty);
node.key = key;
node.value = value;
node.kind = kind;
return node;
}
function finishUnaryExpression(operator, argument) {
var node = new ASTNode(SyntaxUnaryExpression);
node.operator = operator;
node.argument = argument;
node.prefix = true;
return node;
}
// Throw an exception
function throwError(token, messageFormat) {
var error,
args = Array.prototype.slice.call(arguments, 2),
msg = messageFormat.replace(
/%(\d)/g,
function(whole, index) {
assert(index < args.length, 'Message reference must be in range');
return args[index];
}
);
error = new Error(msg);
error.index = index$1;
error.description = msg;
throw error;
}
// Throw an exception because of the token.
function throwUnexpected(token) {
if (token.type === TokenEOF) {
throwError(token, MessageUnexpectedEOS);
}
if (token.type === TokenNumericLiteral) {
throwError(token, MessageUnexpectedNumber);
}
if (token.type === TokenStringLiteral) {
throwError(token, MessageUnexpectedString);
}
if (token.type === TokenIdentifier) {
throwError(token, MessageUnexpectedIdentifier);
}
if (token.type === TokenKeyword) {
throwError(token, MessageUnexpectedReserved);
}
// BooleanLiteral, NullLiteral, or Punctuator.
throwError(token, MessageUnexpectedToken, token.value);
}
// Expect the next token to match the specified punctuator.
// If not, an exception will be thrown.
function expect(value) {
var token = lex();
if (token.type !== TokenPunctuator || token.value !== value) {
throwUnexpected(token);
}
}
// Return true if the next token matches the specified punctuator.
function match(value) {
return lookahead.type === TokenPunctuator && lookahead.value === value;
}
// Return true if the next token matches the specified keyword
function matchKeyword(keyword) {
return lookahead.type === TokenKeyword && lookahead.value === keyword;
}
// 11.1.4 Array Initialiser
function parseArrayInitialiser() {
var elements = [];
index$1 = lookahead.start;
expect('[');
while (!match(']')) {
if (match(',')) {
lex();
elements.push(null);
} else {
elements.push(parseConditionalExpression());
if (!match(']')) {
expect(',');
}
}
}
lex();
return finishArrayExpression(elements);
}
// 11.1.5 Object Initialiser
function parseObjectPropertyKey() {
var token;
index$1 = lookahead.start;
token = lex();
// Note: This function is called only from parseObjectProperty(), where
// EOF and Punctuator tokens are already filtered out.
if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) {
if (token.octal) {
throwError(token, MessageStrictOctalLiteral);
}
return finishLiteral(token);
}
return finishIdentifier(token.value);
}
function parseObjectProperty() {
var token, key, id, value;
index$1 = lookahead.start;
token = lookahead;
if (token.type === TokenIdentifier) {
id = parseObjectPropertyKey();
expect(':');
value = parseConditionalExpression();
return finishProperty('init', id, value);
}
if (token.type === TokenEOF || token.type === TokenPunctuator) {
throwUnexpected(token);
} else {
key = parseObjectPropertyKey();
expect(':');
value = parseConditionalExpression();
return finishProperty('init', key, value);
}
}
function parseObjectInitialiser() {
var properties = [],
property, name, key, map = {},
toString = String;
index$1 = lookahead.start;
expect('{');
while (!match('}')) {
property = parseObjectProperty();
if (property.key.type === SyntaxIdentifier) {
name = property.key.name;
} else {
name = toString(property.key.value);
}
key = '$' + name;
if (Object.prototype.hasOwnProperty.call(map, key)) {
throwError({}, MessageStrictDuplicateProperty);
} else {
map[key] = true;
}
properties.push(property);
if (!match('}')) {
expect(',');
}
}
expect('}');
return finishObjectExpression(properties);
}
// 11.1.6 The Grouping Operator
function parseGroupExpression() {
var expr;
expect('(');
expr = parseExpression$1();
expect(')');
return expr;
}
// 11.1 Primary Expressions
var legalKeywords = {
"if": 1,
"this": 1
};
function parsePrimaryExpression() {
var type, token, expr;
if (match('(')) {
return parseGroupExpression();
}
if (match('[')) {
return parseArrayInitialiser();
}
if (match('{')) {
return parseObjectInitialiser();
}
type = lookahead.type;
index$1 = lookahead.start;
if (type === TokenIdentifier || legalKeywords[lookahead.value]) {
expr = finishIdentifier(lex().value);
} else if (type === TokenStringLiteral || type === TokenNumericLiteral) {
if (lookahead.octal) {
throwError(lookahead, MessageStrictOctalLiteral);
}
expr = finishLiteral(lex());
} else if (type === TokenKeyword) {
throw new Error(DISABLED);
} else if (type === TokenBooleanLiteral) {
token = lex();
token.value = (token.value === 'true');
expr = finishLiteral(token);
} else if (type === TokenNullLiteral) {
token = lex();
token.value = null;
expr = finishLiteral(token);
} else if (match('/') || match('/=')) {
expr = finishLiteral(scanRegExp());
peek$1();
} else {
throwUnexpected(lex());
}
return expr;
}
// 11.2 Left-Hand-Side Expressions
function parseArguments() {
var args = [];
expect('(');
if (!match(')')) {
while (index$1 < length$2) {
args.push(parseConditionalExpression());
if (match(')')) {
break;
}
expect(',');
}
}
expect(')');
return args;
}
function parseNonComputedProperty() {
var token;
index$1 = lookahead.start;
token = lex();
if (!isIdentifierName(token)) {
throwUnexpected(token);
}
return finishIdentifier(token.value);
}
function parseNonComputedMember() {
expect('.');
return parseNonComputedProperty();
}
function parseComputedMember() {
var expr;
expect('[');
expr = parseExpression$1();
expect(']');
return expr;
}
function parseLeftHandSideExpressionAllowCall() {
var expr, args, property;
expr = parsePrimaryExpression();
for (;;) {
if (match('.')) {
property = parseNonComputedMember();
expr = finishMemberExpression('.', expr, property);
} else if (match('(')) {
args = parseArguments();
expr = finishCallExpression(expr, args);
} else if (match('[')) {
property = parseComputedMember();
expr = finishMemberExpression('[', expr, property);
} else {
break;
}
}
return expr;
}
// 11.3 Postfix Expressions
function parsePostfixExpression() {
var expr = parseLeftHandSideExpressionAllowCall();
if (lookahead.type === TokenPunctuator) {
if ((match('++') || match('--'))) {
throw new Error(DISABLED);
}
}
return expr;
}
// 11.4 Unary Operators
function parseUnaryExpression() {
var token, expr;
if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) {
expr = parsePostfixExpression();
} else if (match('++') || match('--')) {
throw new Error(DISABLED);
} else if (match('+') || match('-') || match('~') || match('!')) {
token = lex();
expr = parseUnaryExpression();
expr = finishUnaryExpression(token.value, expr);
} else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
throw new Error(DISABLED);
} else {
expr = parsePostfixExpression();
}
return expr;
}
function binaryPrecedence(token) {
var prec = 0;
if (token.type !== TokenPunctuator && token.type !== TokenKeyword) {
return 0;
}
switch (token.value) {
case '||':
prec = 1;
break;
case '&&':
prec = 2;
break;
case '|':
prec = 3;
break;
case '^':
prec = 4;
break;
case '&':
prec = 5;
break;
case '==':
case '!=':
case '===':
case '!==':
prec = 6;
break;
case '<':
case '>':
case '<=':
case '>=':
case 'instanceof':
case 'in':
prec = 7;
break;
case '<<':
case '>>':
case '>>>':
prec = 8;
break;
case '+':
case '-':
prec = 9;
break;
case '*':
case '/':
case '%':
prec = 11;
break;
default:
break;
}
return prec;
}
// 11.5 Multiplicative Operators
// 11.6 Additive Operators
// 11.7 Bitwise Shift Operators
// 11.8 Relational Operators
// 11.9 Equality Operators
// 11.10 Binary Bitwise Operators
// 11.11 Binary Logical Operators
function parseBinaryExpression() {
var marker, markers, expr, token, prec, stack, right, operator, left, i;
marker = lookahead;
left = parseUnaryExpression();
token = lookahead;
prec = binaryPrecedence(token);
if (prec === 0) {
return left;
}
token.prec = prec;
lex();
markers = [marker, lookahead];
right = parseUnaryExpression();
stack = [left, token, right];
while ((prec = binaryPrecedence(lookahead)) > 0) {
// Reduce: make a binary expression from the three topmost entries.
while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {
right = stack.pop();
operator = stack.pop().value;
left = stack.pop();
markers.pop();
expr = finishBinaryExpression(operator, left, right);
stack.push(expr);
}
// Shift.
token = lex();
token.prec = prec;
stack.push(token);
markers.push(lookahead);
expr = parseUnaryExpression();
stack.push(expr);
}
// Final reduce to clean-up the stack.
i = stack.length - 1;
expr = stack[i];
markers.pop();
while (i > 1) {
markers.pop()
expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
i -= 2;
}
return expr;
}
// 11.12 Conditional Operator
function parseConditionalExpression() {
var expr, consequent, alternate;
expr = parseBinaryExpression();
if (match('?')) {
lex();
consequent = parseConditionalExpression();
expect(':');
alternate = parseConditionalExpression();
expr = finishConditionalExpression(expr, consequent, alternate);
}
return expr;
}
// 11.14 Comma Operator
function parseExpression$1() {
var expr = parseConditionalExpression();
if (match(',')) {
throw new Error(DISABLED); // no sequence expressions
}
return expr;
}
function parse$3(code) {
source$1 = code;
index$1 = 0;
length$2 = source$1.length;
lookahead = null;
peek$1();
var expr = parseExpression$1();
if (lookahead.type !== TokenEOF) {
throw new Error("Unexpect token after expression.");
}
return expr;
}
var Constants = {
NaN: 'NaN',
E: 'Math.E',
LN2: 'Math.LN2',
LN10: 'Math.LN10',
LOG2E: 'Math.LOG2E',
LOG10E: 'Math.LOG10E',
PI: 'Math.PI',
SQRT1_2: 'Math.SQRT1_2',
SQRT2: 'Math.SQRT2'
};
function Functions(codegen) {
function fncall(name, args, cast, type) {
var obj = codegen(args[0]);
if (cast) {
obj = cast + '(' + obj + ')';
if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')';
}
return obj + '.' + name + (type < 0 ? '' : type === 0 ?
'()' :
'(' + args.slice(1).map(codegen).join(',') + ')');
}
function fn(name, cast, type) {
return function(args) {
return fncall(name, args, cast, type);
};
}
var DATE = 'new Date',
STRING = 'String',
REGEXP = 'RegExp';
return {
// MATH functions
isNaN: 'isNaN',
isFinite: 'isFinite',
abs: 'Math.abs',
acos: 'Math.acos',
asin: 'Math.asin',
atan: 'Math.atan',
atan2: 'Math.atan2',
ceil: 'Math.ceil',
cos: 'Math.cos',
exp: 'Math.exp',
floor: 'Math.floor',
log: 'Math.log',
max: 'Math.max',
min: 'Math.min',
pow: 'Math.pow',
random: 'Math.random',
round: 'Math.round',
sin: 'Math.sin',
sqrt: 'Math.sqrt',
tan: 'Math.tan',
clamp: function(args) {
if (args.length < 3) error('Missing arguments to clamp function.');
if (args.length > 3) error('Too many arguments to clamp function.');
var a = args.map(codegen);
return 'Math.max('+a[1]+', Math.min('+a[2]+','+a[0]+'))';
},
// DATE functions
now: 'Date.now',
utc: 'Date.UTC',
datetime: DATE,
date: fn('getDate', DATE, 0),
day: fn('getDay', DATE, 0),
year: fn('getFullYear', DATE, 0),
month: fn('getMonth', DATE, 0),
hours: fn('getHours', DATE, 0),
minutes: fn('getMinutes', DATE, 0),
seconds: fn('getSeconds', DATE, 0),
milliseconds: fn('getMilliseconds', DATE, 0),
time: fn('getTime', DATE, 0),
timezoneoffset: fn('getTimezoneOffset', DATE, 0),
utcdate: fn('getUTCDate', DATE, 0),
utcday: fn('getUTCDay', DATE, 0),
utcyear: fn('getUTCFullYear', DATE, 0),
utcmonth: fn('getUTCMonth', DATE, 0),
utchours: fn('getUTCHours', DATE, 0),
utcminutes: fn('getUTCMinutes', DATE, 0),
utcseconds: fn('getUTCSeconds', DATE, 0),
utcmilliseconds: fn('getUTCMilliseconds', DATE, 0),
// shared sequence functions
length: fn('length', null, -1),
indexof: fn('indexOf', null),
lastindexof: fn('lastIndexOf', null),
slice: fn('slice', null),
// STRING functions
parseFloat: 'parseFloat',
parseInt: 'parseInt',
upper: fn('toUpperCase', STRING, 0),
lower: fn('toLowerCase', STRING, 0),
substring: fn('substring', STRING),
replace: fn('replace', STRING),
// REGEXP functions
regexp: REGEXP,
test: fn('test', REGEXP),
// Control Flow functions
if: function(args) {
if (args.length < 3) error('Missing arguments to if function.');
if (args.length > 3) error('Too many arguments to if function.');
var a = args.map(codegen);
return a[0]+'?'+a[1]+':'+a[2];
}
};
}
function codegen(opt) {
opt = opt || {};
var whitelist = opt.whitelist ? toSet(opt.whitelist) : {},
blacklist = opt.blacklist ? toSet(opt.blacklist) : {},
constants = opt.constants || Constants,
functions = (opt.functions || Functions)(visit),
globalvar = opt.globalvar,
fieldvar = opt.fieldvar,
globals = {},
fields = {},
memberDepth = 0;
var outputGlobal = isFunction(globalvar)
? globalvar
: function (id) { return globalvar + '["' + id + '"]'; };
function visit(ast) {
if (isString(ast)) return ast;
var generator = Generators[ast.type];
if (generator == null) error('Unsupported type: ' + ast.type);
return generator(ast);
}
var Generators = {
Literal: function(n) {
return n.raw;
},
Identifier: function(n) {
var id = n.name;
return memberDepth > 0 ? id
: blacklist.hasOwnProperty(id) ? error('Illegal identifier: ' + id)
: constants.hasOwnProperty(id) ? constants[id]
: whitelist.hasOwnProperty(id) ? id
: (globals[id] = 1, outputGlobal(id));
},
MemberExpression: function(n) {
var d = !n.computed;
var o = visit(n.object);
if (d) memberDepth += 1;
var p = visit(n.property);
if (o === fieldvar) { fields[p] = 1; } // HACKish...
if (d) memberDepth -= 1;
return o + (d ? '.'+p : '['+p+']');
},
CallExpression: function(n) {
if (n.callee.type !== 'Identifier') {
error('Illegal callee type: ' + n.callee.type);
}
var callee = n.callee.name;
var args = n.arguments;
var fn = functions.hasOwnProperty(callee) && functions[callee];
if (!fn) error('Unrecognized function: ' + callee);
return isFunction(fn)
? fn(args)
: fn + '(' + args.map(visit).join(',') + ')';
},
ArrayExpression: function(n) {
return '[' + n.elements.map(visit).join(',') + ']';
},
BinaryExpression: function(n) {
return '(' + visit(n.left) + n.operator + visit(n.right) + ')';
},
UnaryExpression: function(n) {
return '(' + n.operator + visit(n.argument) + ')';
},
ConditionalExpression: function(n) {
return '(' + visit(n.test) +
'?' + visit(n.consequent) +
':' + visit(n.alternate) +
')';
},
LogicalExpression: function(n) {
return '(' + visit(n.left) + n.operator + visit(n.right) + ')';
},
ObjectExpression: function(n) {
return '{' + n.properties.map(visit).join(',') + '}';
},
Property: function(n) {
memberDepth += 1;
var k = visit(n.key);
memberDepth -= 1;
return k + ':' + visit(n.value);
}
};
function codegen(ast) {
var result = {
code: visit(ast),
globals: Object.keys(globals),
fields: Object.keys(fields)
};
globals = {};
fields = {};
return result;
}
codegen.functions = functions;
codegen.constants = constants;
return codegen;
}
function formatter(method) {
var cache = {};
return function(_, specifier) {
var f = cache[specifier] || (cache[specifier] = method(specifier));
return f(_);
};
}
var format = formatter(d3_format);
var utcFormat = formatter(d3_utcFormat);
var timeFormat = formatter(d3_timeFormat);
var dateObj = new Date(2000, 0, 1);
function time(month, day, specifier) {
dateObj.setMonth(month);
dateObj.setDate(day);
return timeFormat(dateObj, specifier);
}
function monthFormat(month) {
return time(month, 1, '%B');
}
function monthAbbrevFormat(month) {
return time(month, 1, '%b');
}
function dayFormat(day) {
return time(0, 2 + day, '%A');
}
function dayAbbrevFormat(day) {
return time(0, 2 + day, '%a');
}
function quarter(date) {
return 1 + ~~(new Date(date).getMonth() / 3);
}
function utcquarter(date) {
return 1 + ~~(new Date(date).getUTCMonth() / 3);
}
function log$3(df, method, args) {
try {
df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args)));
} catch (err) {
df.warn(err);
}
return args[args.length-1];
}
function warn() {
return log$3(this.context.dataflow, 'warn', arguments);
}
function info() {
return log$3(this.context.dataflow, 'info', arguments);
}
function debug() {
return log$3(this.context.dataflow, 'debug', arguments);
}
function inScope(item) {
var group = this.context.group,
value = false;
if (group) while (item) {
if (item === group) { value = true; break; }
item = item.mark.group;
}
return value;
}
/**
* Span-preserving range clamp. If the span of the input range is less
* than (max - min) and an endpoint exceeds either the min or max value,
* the range is translated such that the span is preserved and one
* endpoint touches the boundary of the min/max range.
* If the span exceeds (max - min), the range [min, max] is returned.
*/
function clampRange(range, min, max) {
var lo = range[0],
hi = range[1],
span;
if (hi < lo) span = hi, hi = lo, lo = span;
span = hi - lo;
return span >= (max - min)
? [min, max]
: [
Math.min(Math.max(lo, min), max - span),
Math.min(Math.max(hi, span), max)
];
}
function pinchDistance() {
return 'Math.sqrt('
+ 'Math.pow(event.touches[0].clientX - event.touches[1].clientX, 2) + '
+ 'Math.pow(event.touches[0].clientY - event.touches[1].clientY, 2)'
+ ')';
}
function pinchAngle() {
return 'Math.atan2('
+ 'event.touches[1].clientY - event.touches[0].clientY,'
+ 'event.touches[1].clientX - event.touches[0].clientX'
+ ')';
}
var _window = (typeof window !== 'undefined' && window) || null;
function open(uri, name) {
var df = this.context.dataflow;
if (_window && _window.open) {
df.loader().sanitize(uri, {context:'open', name:name})
.then(function(url) { _window.open(url, name); })
.catch(function(e) { df.warn('Open url failed: ' + e); });
} else {
df.warn('Open function can only be invoked in a browser.');
}
}
function screen() {
return _window ? _window.screen : {};
}
function windowsize() {
return _window
? [_window.innerWidth, _window.innerHeight]
: [undefined, undefined];
}
function span(array) {
return (array[array.length-1] - array[0]) || 0;
}
var Literal = 'Literal';
var Identifier = 'Identifier';
var indexPrefix = '@';
var scalePrefix = '%';
var dataPrefix = ':';
function getScale(name, ctx) {
var s = isString(name) ? ctx.scales[name]
: isObject(name) && name.signal ? ctx.signals[name.signal]
: undefined;
return s && s.value;
}
function scaleVisitor(name, args, scope, params) {
if (args[0].type === Literal) { // scale dependency
name = args[0].value;
var scaleName = scalePrefix + name;
if (!params.hasOwnProperty(scaleName)) {
try {
params[scaleName] = scope.scaleRef(name);
} catch (err) {
// TODO: error handling? warning?
}
}
}
else if (args[0].type === Identifier) { // forward reference to signal
name = args[0].name;
args[0] = new ASTNode(Literal);
args[0].raw = '{signal:"' + name + '"}';
}
}
function range$2(name, group) {
var s = getScale(name, (group || this).context);
return s && s.range ? s.range() : [];
}
function domain(name, group) {
var s = getScale(name, (group || this).context);
return s ? s.domain() : [];
}
function bandwidth(name, group) {
var s = getScale(name, (group || this).context);
return s && s.bandwidth ? s.bandwidth() : 0;
}
function bandspace(count, paddingInner, paddingOuter) {
return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0);
}
function copy$2(name, group) {
var s = getScale(name, (group || this).context);
return s ? s.copy() : undefined;
}
function scale$2(name, value, group) {
var s = getScale(name, (group || this).context);
return s ? s(value) : undefined;
}
function invert(name, range, group) {
var s = getScale(name, (group || this).context);
return !s ? undefined
: isArray(range) ? (s.invertRange || s.invert)(range)
: (s.invert || s.invertExtent)(range);
}
function scaleGradient(scale, p0, p1, count) {
var gradient = Gradient(p0, p1),
stops = scale.domain(),
min = stops[0],
max = stops[stops.length-1],
fraction = scaleFraction(scale, min, max);
if (scale.ticks) {
stops = scale.ticks(+count || 15);
if (min !== stops[0]) stops.unshift(min);
if (max !== stops[stops.length-1]) stops.push(max);
}
for (var i=0, n=stops.length; i<n; ++i) {
gradient.stop(fraction(stops[i]), scale(stops[i]));
}
return gradient;
}
function geoMethod(method) {
return function(projection, geojson, group) {
var p = getScale(projection, (group || this).context);
return p && p.path[method](geojson);
};
}
var geoArea = geoMethod('area');
var geoBounds = geoMethod('bounds');
var geoCentroid = geoMethod('centroid');
function data$1(name) {
var data = this.context.data[name];
return data ? data.values.value : [];
}
function dataVisitor(name, args, scope, params) {
if (args[0].type !== Literal) {
error('First argument to data functions must be a string literal.');
}
var data = args[0].value,
dataName = dataPrefix + data;
if (!params.hasOwnProperty(dataName)) {
params[dataName] = scope.getData(data).tuplesRef();
}
}
function indata(name, field, value) {
var index = this.context.data[name]['index:' + field],
entry = index ? index.value.get(value) : undefined;
return entry ? entry.count : entry;
}
function indataVisitor(name, args, scope, params) {
if (args[0].type !== Literal) error('First argument to indata must be a string literal.');
if (args[1].type !== Literal) error('Second argument to indata must be a string literal.');
var data = args[0].value,
field = args[1].value,
indexName = indexPrefix + field;
if (!params.hasOwnProperty(indexName)) {
params[indexName] = scope.getData(data).indataRef(scope, field);
}
}
var EMPTY = {};
function datum(d) { return d.data; }
function treeNodes(name, context) {
var tree = data$1.call(context, name);
return tree.root && tree.root.lookup || EMPTY;
}
function treePath(name, source, target) {
var nodes = treeNodes(name, this),
s = nodes[source],
t = nodes[target];
return s && t ? s.path(t).map(datum) : undefined;
}
function treeAncestors(name, node) {
var n = treeNodes(name, this)[node];
return n ? n.ancestors().map(datum) : undefined;
}
function inrange(value, range) {
var r0 = range[0], r1 = range[range.length-1], t;
if (r0 > r1) t = r0, r0 = r1, r1 = t;
return r0 <= value && value <= r1;
}
function encode(item, name, retval) {
if (item) {
var df = this.context.dataflow,
target = item.mark.source;
df.pulse(target, df.changeset().encode(item, name));
}
return retval !== undefined ? retval : item;
}
function removePredicate(props) {
return function(_) {
for (var key in props) {
if (key !== '_id' && _[key] !== props[key]) return false;
}
return true;
};
}
function modify(name, insert, remove, toggle, modify, values) {
var df = this.context.dataflow,
data = this.context.data[name],
input = data.input,
changes = data.changes,
stamp = df.stamp(),
predicate, key;
if (df._trigger === false || !(input.value.length || insert || toggle)) {
// nothing to do!
return 0;
}
if (!changes || changes.stamp < stamp) {
data.changes = (changes = df.changeset());
changes.stamp = stamp;
df.runAfter(function() {
data.modified = true;
df.pulse(input, changes).run();
});
}
if (remove) {
predicate = remove === true ? truthy
: (isArray(remove) || remove._id != null) ? remove
: removePredicate(remove);
changes.remove(predicate);
}
if (insert) {
changes.insert(insert);
}
if (toggle) {
predicate = removePredicate(toggle);
if (input.value.some(predicate)) {
changes.remove(predicate);
} else {
changes.insert(toggle);
}
}
if (modify) {
for (key in values) {
changes.modify(modify, key, values[key]);
}
}
return 1;
}
var UNION = 'union';
var UNIT = 'unit';
var OTHERS = 'others';
function testPoint(datum, entry) {
var fields = entry.fields,
values = entry.values,
getter = entry.getter || (entry.getter = []),
n = fields.length,
i = 0;
for (; i<n; ++i) {
getter[i] = getter[i] || field(fields[i]);
if (getter[i](datum) !== values[i]) return false;
}
return true;
}
function testInterval(datum, entry) {
var ivals = entry.intervals,
n = ivals.length,
i = 0,
getter;
for (; i<n; ++i) {
getter = ivals[i].getter || (ivals[i].getter = field(ivals[i].field));
if (!inrange(getter(datum), ivals[i].extent)) return false;
}
return true;
}
/**
* Tests if a tuple is contained within an interactive selection.
* @param {string} name - The name of the data set representing the selection.
* @param {*} unit - A unique key value indicating the current unit chart.
* @param {object} datum - The tuple to test for inclusion.
* @param {string} op - The set operation for combining selections.
* One of 'intersect' (default) or 'union'.
* @param {string} scope - The scope within which to resolve the selection.
* One of 'all' (default, resolve against active selections across all unit charts),
* 'unit' (consider only selections in the current unit chart),
* 'others' (resolve against all units *except* the current unit).
* @param {function(object,object):boolean} test - A boolean-valued test
* predicate for determining selection status within a single unit chart.
* @return {boolean} - True if the datum is in the selection, false otherwise.
*/
function vlSelection(name, unit, datum, op, scope, test) {
var data = this.context.data[name],
entries = data ? data.values.value : [],
intersect = op !== UNION,
n = entries.length,
i = 0,
entry, b;
for (; i<n; ++i) {
entry = entries[i];
// is the selection entry from the current unit?
b = unit === entry.unit;
// perform test if source unit is a valid selection source
if (!(scope === OTHERS && b || scope === UNIT && !b)) {
b = test(datum, entry);
// if we find a match and we don't require intersection return true
// if we find a miss and we do require intersection return false
if (intersect ^ b) return b;
}
}
// if intersecting and we made it here, then we saw no misses
// if not intersecting, then we saw no matches
// if no active selections, return true
return !n || intersect;
}
// Assumes point selection tuples are of the form:
// {unit: string, fields: array<string>, values: array<*>, }
function vlPoint(name, unit, datum, op, scope) {
return vlSelection.call(this, name, unit, datum, op, scope, testPoint);
}
// Assumes interval selection typles are of the form:
// {unit: string, intervals: array<{field:string, extent:array<number>}>}
function vlInterval(name, unit, datum, op, scope) {
return vlSelection.call(this, name, unit, datum, op, scope, testInterval);
}
// Expression function context object
var functionContext = {
pad: pad,
truncate: truncate,
rgb: rgb,
lab: lab,
hcl: hcl,
hsl: hsl,
sequence: sequence,
format: format,
utcFormat: utcFormat,
timeFormat: timeFormat,
monthFormat: monthFormat,
monthAbbrevFormat: monthAbbrevFormat,
dayFormat: dayFormat,
dayAbbrevFormat: dayAbbrevFormat,
quarter: quarter,
utcquarter: utcquarter,
warn: warn,
info: info,
debug: debug,
inScope: inScope,
clampRange: clampRange,
pinchDistance: pinchDistance,
pinchAngle: pinchAngle,
open: open,
screen: screen,
windowsize: windowsize,
span: span,
bandspace: bandspace,
inrange: inrange,
encode: encode,
modify: modify
};
var eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'];
var eventPrefix = 'event.vega.';
var thisPrefix = 'this.';
var astVisitors = {};
// AST visitors for dependency analysis
function expressionFunction(name, fn, visitor) {
if (arguments.length === 1) {
return functionContext[name];
}
// register with the functionContext
functionContext[name] = fn;
// if there is an astVisitor register that, too
if (visitor) astVisitors[name] = visitor;
// if the code generator has already been initialized,
// we need to also register the function with it
if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name;
return this;
}
// register expression functions with ast visitors
expressionFunction('bandwidth', bandwidth, scaleVisitor);
expressionFunction('copy', copy$2, scaleVisitor);
expressionFunction('domain', domain, scaleVisitor);
expressionFunction('range', range$2, scaleVisitor);
expressionFunction('invert', invert, scaleVisitor);
expressionFunction('scale', scale$2, scaleVisitor);
expressionFunction('gradient', scaleGradient, scaleVisitor);
expressionFunction('geoArea', geoArea, scaleVisitor);
expressionFunction('geoBounds', geoBounds, scaleVisitor);
expressionFunction('geoCentroid', geoCentroid, scaleVisitor);
expressionFunction('indata', indata, indataVisitor);
expressionFunction('data', data$1, dataVisitor);
expressionFunction('vlPoint', vlPoint, dataVisitor);
expressionFunction('vlInterval', vlInterval, dataVisitor);
expressionFunction('treePath', treePath, dataVisitor);
expressionFunction('treeAncestors', treeAncestors, dataVisitor);
// Build expression function registry
function buildFunctions(codegen) {
var fn = Functions(codegen);
eventFunctions.forEach(function(name) { fn[name] = eventPrefix + name; });
for (var name in functionContext) { fn[name] = thisPrefix + name; }
return fn;
}
// Export code generator and parameters
var codegenParams = {
blacklist: ['_'],
whitelist: ['datum', 'event'],
fieldvar: 'datum',
globalvar: function(id) { return '_[' + $('$' + id) + ']'; },
functions: buildFunctions,
constants: Constants,
visitors: astVisitors
};
var codeGenerator = codegen(codegenParams);
var signalPrefix = '$';
function parseExpression(expr, scope, preamble) {
var params = {}, ast, gen;
// parse the expression to an abstract syntax tree (ast)
try {
ast = parse$3(expr);
} catch (err) {
error('Expression parse error: ' + $(expr));
}
// analyze ast function calls for dependencies
ast.visit(function visitor(node) {
if (node.type !== 'CallExpression') return;
var name = node.callee.name,
visit = codegenParams.visitors[name];
if (visit) visit(name, node.arguments, scope, params);
});
// perform code generation
gen = codeGenerator(ast);
// collect signal dependencies
gen.globals.forEach(function(name) {
var signalName = signalPrefix + name;
if (!params.hasOwnProperty(signalName) && scope.getSignal(name)) {
params[signalName] = scope.signalRef(name);
}
});
// return generated expression code and dependencies
return {
$expr: preamble ? preamble + 'return(' + gen.code + ');' : gen.code,
$fields: gen.fields,
$params: params
};
}
var GroupMark = 'group';
var RectMark = 'rect';
var RuleMark = 'rule';
var SymbolMark = 'symbol';
var TextMark = 'text';
var marktypes = toSet([
'*',
'arc',
'area',
'group',
'image',
'line',
'path',
'rect',
'rule',
'shape',
'symbol',
'text'
]);
function isMarkType(type) {
return marktypes.hasOwnProperty(type);
}
/**
* Parse an event selector string.
* Returns an array of event stream definitions.
*/
function parseSelector(selector, source) {
DEFAULT_SOURCE = source || VIEW$1;
return parseMerge(selector.trim()).map(parseSelector$1);
}
var VIEW$1 = 'view';
var LBRACK = '[';
var RBRACK = ']';
var LBRACE = '{';
var RBRACE = '}';
var COLON = ':';
var COMMA = ',';
var NAME = '@';
var GT = '>';
var ILLEGAL$1 = /[\[\]\{\}]/;
var DEFAULT_SOURCE;
function find$1(s, i, endChar, pushChar, popChar) {
var count = 0,
n = s.length,
c;
for (; i<n; ++i) {
c = s[i];
if (!count && c === endChar) return i;
else if (popChar && popChar.indexOf(c) >= 0) --count;
else if (pushChar && pushChar.indexOf(c) >= 0) ++count;
}
return i;
}
function parseMerge(s) {
var output = [],
start = 0,
n = s.length,
i = 0;
while (i < n) {
i = find$1(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE);
output.push(s.substring(start, i).trim());
start = ++i;
}
if (output.length === 0) {
throw 'Empty event selector: ' + s;
}
return output;
}
function parseSelector$1(s) {
return s[0] === '['
? parseBetween(s)
: parseStream(s);
}
function parseBetween(s) {
var start = 1,
n = s.length,
i = 1,
b, stream;
i = find$1(s, i, RBRACK, LBRACK, RBRACK);
if (i === n) {
throw 'Empty between selector: ' + s;
}
b = parseMerge(s.substring(start, i));
if (b.length !== 2) {
throw 'Between selector must have two elements: ' + s;
}
s = s.slice(i + 1).trim();
if (s[0] !== GT) {
throw 'Expected \'>\' after between selector: ' + s;
}
b = b.map(parseSelector$1);
stream = parseSelector$1(s.slice(1).trim());
if (stream.between) {
return {
between: b,
stream: stream
};
} else {
stream.between = b;
}
return stream;
}
function parseStream(s) {
var stream = {source: DEFAULT_SOURCE},
source = [],
throttle = [0, 0],
markname = 0,
start = 0,
n = s.length,
i = 0, j,
filter;
// extract throttle from end
if (s[n-1] === RBRACE) {
i = s.lastIndexOf(LBRACE);
if (i >= 0) {
try {
throttle = parseThrottle(s.substring(i+1, n-1));
} catch (e) {
throw 'Invalid throttle specification: ' + s;
}
s = s.slice(0, i).trim();
n = s.length;
} else throw 'Unmatched right brace: ' + s;
i = 0;
}
if (!n) throw s;
// set name flag based on first char
if (s[0] === NAME) markname = ++i;
// extract first part of multi-part stream selector
j = find$1(s, i, COLON);
if (j < n) {
source.push(s.substring(start, j).trim());
start = i = ++j;
}
// extract remaining part of stream selector
i = find$1(s, i, LBRACK);
if (i === n) {
source.push(s.substring(start, n).trim());
} else {
source.push(s.substring(start, i).trim());
filter = [];
start = ++i;
if (start === n) throw 'Unmatched left bracket: ' + s;
}
// extract filters
while (i < n) {
i = find$1(s, i, RBRACK);
if (i === n) throw 'Unmatched left bracket: ' + s;
filter.push(s.substring(start, i).trim());
if (i < n-1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s;
start = ++i;
}
// marshall event stream specification
if (!(n = source.length) || ILLEGAL$1.test(source[n-1])) {
throw 'Invalid event selector: ' + s;
}
if (n > 1) {
stream.type = source[1];
if (markname) {
stream.markname = source[0].slice(1);
} else if (isMarkType(source[0])) {
stream.marktype = source[0];
} else {
stream.source = source[0];
}
} else {
stream.type = source[0];
}
if (stream.type.slice(-1) === '!') {
stream.consume = true;
stream.type = stream.type.slice(0, -1)
}
if (filter != null) stream.filter = filter;
if (throttle[0]) stream.throttle = throttle[0];
if (throttle[1]) stream.debounce = throttle[1];
return stream;
}
function parseThrottle(s) {
var a = s.split(COMMA);
if (!s.length || a.length > 2) throw s;
return a.map(function(_) {
var x = +_;
if (x !== x) throw s;
return x;
});
}
var VIEW$2 = 'view';
var SCOPE = 'scope';
function parseStream$1(stream, scope) {
return stream.signal
? scope.getSignal(stream.signal).id
: parseStream$2(stream, scope);
}
function eventSource(source) {
return source === SCOPE ? VIEW$2 : (source || VIEW$2);
}
function parseStream$2(stream, scope) {
var method = stream.merge ? mergeStream
: stream.stream ? nestedStream
: stream.type ? eventStream
: error('Invalid stream specification: ' + $(stream));
return method(stream, scope);
}
function mergeStream(stream, scope) {
var list = stream.merge.map(function(s) {
return parseStream$2(s, scope);
});
var entry = streamParameters({merge: list}, stream, scope);
return scope.addStream(entry).id;
}
function nestedStream(stream, scope) {
var id = parseStream$2(stream.stream, scope),
entry = streamParameters({stream: id}, stream, scope);
return scope.addStream(entry).id;
}
function eventStream(stream, scope) {
var id = scope.event(eventSource(stream.source), stream.type),
entry = streamParameters({stream: id}, stream, scope);
return Object.keys(entry).length === 1 ? id
: scope.addStream(entry).id;
}
function streamParameters(entry, stream, scope) {
var param = stream.between;
if (param) {
if (param.length !== 2) {
error('Stream "between" parameter must have 2 entries: ' + $(stream));
}
entry.between = [
parseStream$2(param[0], scope),
parseStream$2(param[1], scope)
];
}
param = stream.filter ? array$1(stream.filter) : [];
if (stream.marktype || stream.markname || stream.markrole) {
// add filter for mark type, name and/or role
param.push(filterMark(stream.marktype, stream.markname, stream.markrole));
}
if (stream.source === SCOPE) {
// add filter to limit events from sub-scope only
param.push('inScope(event.item)');
}
if (param.length) {
entry.filter = parseExpression('(' + param.join(')&&(') + ')').$expr;
}
if ((param = stream.throttle) != null) {
entry.throttle = +param;
}
if ((param = stream.debounce) != null) {
entry.debounce = +param;
}
if (stream.consume) {
entry.consume = true;
}
return entry;
}
function filterMark(type, name, role) {
var item = 'event.item';
return item
+ (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '')
+ (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '')
+ (name ? '&&' + item + '.mark.name===\'' + name + '\'' : '');
}
var preamble = 'var datum=event.item&&event.item.datum;';
function parseUpdate(spec, scope, target) {
var events = spec.events,
update = spec.update,
encode = spec.encode,
sources = [],
value = '', entry;
if (!events) {
error('Signal update missing events specification.');
}
// interpret as an event selector string
if (isString(events)) {
events = parseSelector(events);
}
// separate event streams from signal updates
events = array$1(events).filter(function(stream) {
return stream.signal ? (sources.push(stream), 0) : 1;
});
// merge event streams, include as source
if (events.length) {
sources.push(events.length > 1 ? {merge: events} : events[0]);
}
if (encode != null) {
if (update) error('Signal encode and update are mutually exclusive.');
update = 'encode(item(),' + $(encode) + ')';
}
// resolve update value
value = isString(update) ? parseExpression(update, scope, preamble)
: update.expr != null ? parseExpression(update.expr, scope, preamble)
: update.value != null ? update.value
: update.signal != null ? {
$expr: '_.value',
$params: {value: scope.signalRef(update.signal)}
}
: error('Invalid signal update specification.');
entry = {
target: target,
update: value
};
if (spec.force) {
entry.options = {force: true};
}
sources.forEach(function(source) {
source = {source: parseStream$1(source, scope)};
scope.addUpdate(extend(source, entry));
});
}
function parseSignalUpdates(signal, scope) {
var op = scope.getSignal(signal.name);
if (signal.update) {
var expr = parseExpression(signal.update, scope);
op.update = expr.$expr;
op.params = expr.$params;
}
if (signal.on) {
signal.on.forEach(function(_) {
parseUpdate(_, scope, op.id);
});
}
}
function parseProjection(proj, scope) {
var params = {};
for (var name in proj) {
if (name === 'name') continue;
params[name] = parseParameter(proj[name], scope);
}
scope.addProjection(proj.name, params);
}
function parseParameter(_, scope) {
return isArray(_) ? _.map(function(_) { return parseParameter(_, scope); })
: !isObject(_) ? _
: _.signal ? scope.signalRef(_.signal)
: error('Unsupported parameter object: ' + $(_));
}
var Skip = toSet(['rule']);
var Swap = toSet(['group', 'image', 'rect']);
function adjustSpatial(encode, marktype) {
var code = '';
if (Skip[marktype]) return code;
if (encode.x2) {
if (encode.x) {
if (Swap[marktype]) {
code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;';
}
code += 'o.width=o.x2-o.x;';
} else if (encode.width) {
code += 'o.x=o.x2-o.width;';
} else {
code += 'o.x=o.x2;';
}
}
if (encode.xc) {
if (encode.width) {
code += 'o.x=o.xc-o.width/2;';
} else {
code += 'o.x=o.xc;';
}
}
if (encode.y2) {
if (encode.y) {
if (Swap[marktype]) {
code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;';
}
code += 'o.height=o.y2-o.y;';
} else if (encode.height) {
code += 'o.y=o.y2-o.height;';
} else {
code += 'o.y=o.y2;';
}
}
if (encode.yc) {
if (encode.height) {
code += 'o.y=o.yc-o.height/2;';
} else {
code += 'o.y=o.yc;';
}
}
return code;
}
function color$2(enc, scope, params, fields) {
function color(type, x, y, z) {
var a = entry(null, x, scope, params, fields),
b = entry(null, y, scope, params, fields),
c = entry(null, z, scope, params, fields);
return 'this.' + type + '(' + [a, b, c].join(',') + ').toString()';
}
return (enc.c) ? color('hcl', enc.h, enc.c, enc.l)
: (enc.h || enc.s) ? color('hsl', enc.h, enc.s, enc.l)
: (enc.l || enc.a) ? color('lab', enc.l, enc.a, enc.b)
: (enc.r || enc.g || enc.b) ? color('rgb', enc.r, enc.g, enc.b)
: null;
}
function expression(code, scope, params, fields) {
var expr = parseExpression(code, scope);
expr.$fields.forEach(function(name) { fields[name] = 1; });
extend(params, expr.$params);
return expr.$expr;
}
function field$1(ref, scope, params, fields) {
return resolve$1(isObject(ref) ? ref : {datum: ref}, scope, params, fields);
}
function resolve$1(ref, scope, params, fields) {
var object, level, field;
if (ref.signal) {
object = 'datum';
field = expression(ref.signal, scope, params, fields);
} else if (ref.group || ref.parent) {
level = Math.max(1, ref.level || 1);
object = 'item';
while (level-- > 0) {
object += '.mark.group';
}
if (ref.parent) {
field = ref.parent;
object += '.datum';
} else {
field = ref.group;
}
} else if (ref.datum) {
object = 'datum';
field = ref.datum;
} else {
error('Invalid field reference: ' + $(ref));
}
if (!ref.signal) {
if (isString(field)) {
fields[field] = 1; // TODO review field tracking?
field = splitAccessPath(field).map($).join('][');
} else {
field = resolve$1(field, scope, params, fields);
}
}
return object + '[' + field + ']';
}
function scale$3(enc, value, scope, params, fields) {
var scale = getScale$1(enc.scale, scope, params, fields),
interp, func, flag;
if (enc.range != null) {
// pull value from scale range
interp = +enc.range;
func = scale + '.range()';
value = (interp === 0) ? (func + '[0]')
: '($=' + func + ',' + ((interp === 1) ? '$[$.length-1]'
: '$[0]+' + interp + '*($[$.length-1]-$[0])') + ')';
} else {
// run value through scale and/or pull scale bandwidth
if (value !== undefined) value = scale + '(' + value + ')';
if (enc.band && (flag = hasBandwidth(enc.scale, scope))) {
func = scale + '.bandwidth';
interp = +enc.band;
interp = func + '()' + (interp===1 ? '' : '*' + interp);
// if we don't know the scale type, check for bandwidth
if (flag < 0) interp = '(' + func + '?' + interp + ':0)';
value = (value ? value + '+' : '') + interp;
if (enc.extra) {
// include logic to handle extraneous elements
value = '(datum.extra?' + scale + '(datum.extra.value):' + value + ')';
}
}
if (value == null) value = '0';
}
return value;
}
function hasBandwidth(name, scope) {
if (!isString(name)) return -1;
var type = scope.scaleType(name);
return type === 'band' || type === 'point' ? 1 : 0;
}
function getScale$1(name, scope, params, fields) {
var scaleName;
if (isString(name)) {
// direct scale lookup; add scale as parameter
scaleName = scalePrefix + name;
if (!params.hasOwnProperty(scaleName)) {
params[scaleName] = scope.scaleRef(name);
}
scaleName = $(scaleName);
} else {
// indirect scale lookup; add all scales as parameters
for (scaleName in scope.scales) {
params[scalePrefix + scaleName] = scope.scaleRef(scaleName);
}
scaleName = $(scalePrefix) + '+'
+ field$1(name, scope, params, fields);
}
return '_[' + scaleName + ']';
}
function gradient$1(enc, scope, params, fields) {
return 'this.gradient('
+ getScale$1(enc.gradient, scope, params, fields)
+ ',' + $(enc.start)
+ ',' + $(enc.stop)
+ ',' + $(enc.count)
+ ')';
}
function property(property, scope, params, fields) {
return isObject(property)
? '(' + entry(null, property, scope, params, fields) + ')'
: property;
}
function entry(channel, enc, scope, params, fields) {
if (enc.gradient != null) {
return gradient$1(enc, scope, params, fields);
}
var value = enc.signal ? expression(enc.signal, scope, params, fields)
: enc.color ? color$2(enc.color, scope, params, fields)
: enc.field != null ? field$1(enc.field, scope, params, fields)
: enc.value !== undefined ? $(enc.value)
: undefined;
if (enc.scale != null) {
value = scale$3(enc, value, scope, params, fields);
}
if (value === undefined) {
value = null;
}
if (enc.exponent != null) {
value = 'Math.pow(' + value + ','
+ property(enc.exponent, scope, params, fields) + ')';
}
if (enc.mult != null) {
value += '*' + property(enc.mult, scope, params, fields);
}
if (enc.offset != null) {
value += '+' + property(enc.offset, scope, params, fields);
}
if (enc.round) {
value = 'Math.round(' + value + ')';
}
return value;
}
function set$4(obj, key, value) {
return obj + '[' + $(key) + ']=' + value + ';';
}
function rule$1(channel, rules, scope, params, fields) {
var code = '';
rules.forEach(function(rule) {
var value = entry(channel, rule, scope, params, fields);
code += rule.test
? expression(rule.test, scope, params, fields) + '?' + value + ':'
: value;
});
return set$4('o', channel, code);
}
function parseEncode(encode, marktype, params, scope) {
var fields = {},
code = 'var o=item,datum=o.datum,$;',
channel, enc, value;
for (channel in encode) {
enc = encode[channel];
if (isArray(enc)) { // rule
code += rule$1(channel, enc, scope, params, fields);
} else {
value = entry(channel, enc, scope, params, fields);
code += set$4('o', channel, value);
}
}
code += adjustSpatial(encode, marktype);
code += 'return 1;';
return {
$expr: code,
$fields: Object.keys(fields),
$output: Object.keys(encode)
};
}
var MarkRole = 'mark';
var FrameRole$1 = 'frame';
var ScopeRole$1 = 'scope';
var AxisRole$1 = 'axis';
var AxisDomainRole = 'axis-domain';
var AxisGridRole = 'axis-grid';
var AxisLabelRole = 'axis-label';
var AxisTickRole = 'axis-tick';
var AxisTitleRole = 'axis-title';
var LegendRole$1 = 'legend';
var LegendEntryRole = 'legend-entry';
var LegendGradientRole = 'legend-gradient';
var LegendLabelRole = 'legend-label';
var LegendSymbolRole = 'legend-symbol';
var LegendTitleRole = 'legend-title';
function encoder(_) {
return isObject(_) ? _ : {value: _};
}
function addEncode(object, name, value) {
return value != null ? (object[name] = {value: value}, 1) : 0;
}
function extendEncode(encode, extra, skip) {
for (var name in extra) {
if (skip && skip.hasOwnProperty(name)) continue;
encode[name] = extend(encode[name] || {}, extra[name]);
}
return encode;
}
function encoders(encode, type, role, scope, params) {
var enc, key;
params = params || {};
params.encoders = {$encode: (enc = {})};
encode = applyDefaults(encode, type, role, scope.config);
for (key in encode) {
enc[key] = parseEncode(encode[key], type, params, scope);
}
return params;
}
function applyDefaults(encode, type, role, config) {
var enter, key, skip;
// ignore legend and axis
if (role == 'legend' || String(role).indexOf('axis') === 0) {
role = null;
}
config = role === FrameRole$1 ? config.group
: (role === MarkRole || config[type = role]) ? extend({}, config.mark, config[type])
: {};
enter = {};
for (key in config) {
// do not apply defaults if relevant fields are defined
skip = has(key, encode)
|| (key === 'fill' || key === 'stroke')
&& (has('fill', encode) || has('stroke', encode));
if (!skip) enter[key] = {value: config[key]};
}
encode = extend({}, encode); // defensive copy
encode.enter = extend(enter, encode.enter);
return encode;
}
function has(key, encode) {
return (encode.enter && encode.enter[key])
|| (encode.update && encode.update[key]);
}
var skip = {name: 1, interactive: 1};
function guideMark(type, role, key, dataRef, encode, extras) {
return {
type: type,
name: extras ? extras.name : undefined,
role: role,
key: key,
from: dataRef,
interactive: !!(extras && extras.interactive),
encode: extendEncode(encode, extras, skip)
};
}
function legendGradient(scale, config, userEncode) {
var zero = {value: 0},
encode = {}, enter, update;
encode.enter = enter = {
opacity: zero,
x: zero,
y: zero
};
addEncode(enter, 'width', config.gradientWidth);
addEncode(enter, 'height', config.gradientHeight);
addEncode(enter, 'stroke', config.gradientStrokeColor);
addEncode(enter, 'strokeWidth', config.gradientStrokeWidth);
encode.exit = {
opacity: zero
};
encode.update = update = {
x: zero,
y: zero,
fill: {gradient: scale},
opacity: {value: 1}
};
addEncode(update, 'width', config.gradientWidth);
addEncode(update, 'height', config.gradientHeight);
return guideMark(RectMark, LegendGradientRole, undefined, undefined, encode, userEncode);
}
var Top = 'top';
var Left = 'left';
var Right = 'right';
var Bottom = 'bottom';
var Index = 'index';
var Label = 'label';
var Offset = 'offset';
var Perc = 'perc';
var Size = 'size';
var Total = 'total';
var Value = 'value';
var LegendScales = [
'shape',
'size',
'fill',
'stroke',
'strokeDash',
'opacity'
];
var alignExpr = 'datum.' + Perc + '<=0?"left"'
+ ':datum.' + Perc + '>=1?"right":"center"';
function legendGradientLabels(spec, config, userEncode, dataRef) {
var zero = {value: 0},
encode = {}, enter, update;
encode.enter = enter = {
opacity: zero,
text: {field: Label}
};
addEncode(enter, 'fill', config.labelColor);
addEncode(enter, 'font', config.labelFont);
addEncode(enter, 'fontSize', config.labelFontSize);
addEncode(enter, 'baseline', config.gradientLabelBaseline);
addEncode(enter, 'limit', config.gradientLabelLimit);
encode.exit = {
opacity: zero
};
encode.update = update = {
opacity: {value: 1}
};
enter.x = update.x = {
field: Perc,
mult: config.gradientWidth
};
enter.y = update.y = {
value: config.gradientHeight,
offset: config.gradientLabelOffset
};
enter.align = update.align = {signal: alignExpr};
return guideMark(TextMark, LegendLabelRole, Perc, dataRef, encode, userEncode);
}
function legendLabels(spec, config, userEncode, dataRef) {
var zero = {value: 0},
encode = {}, enter, update;
encode.enter = enter = {
opacity: zero,
text: {field: Label}
};
addEncode(enter, 'align', config.labelAlign);
addEncode(enter, 'baseline', config.labelBaseline);
addEncode(enter, 'fill', config.labelColor);
addEncode(enter, 'font', config.labelFont);
addEncode(enter, 'fontSize', config.labelFontSize);
addEncode(enter, 'limit', config.labelLimit);
encode.exit = {
opacity: zero
};
encode.update = update = {
opacity: {value: 1}
};
enter.x = update.x = {
field: Offset,
offset: config.labelOffset
};
enter.y = update.y = {
field: Size,
mult: 0.5,
offset: {
field: Total,
offset: {
field: {group: 'entryPadding'},
mult: {field: Index}
}
}
};
return guideMark(TextMark, LegendLabelRole, Value, dataRef, encode, userEncode);
}
function legendSymbols(spec, config, userEncode, dataRef) {
var zero = {value: 0},
encode = {}, enter, update;
encode.enter = enter = {
opacity: zero
};
addEncode(enter, 'shape', config.symbolType);
addEncode(enter, 'size', config.symbolSize);
addEncode(enter, 'strokeWidth', config.symbolStrokeWidth);
if (!spec.fill) addEncode(enter, 'stroke', config.symbolColor);
encode.exit = {
opacity: zero
};
encode.update = update = {
opacity: {value: 1}
};
enter.x = update.x = {
field: Offset,
mult: 0.5
};
enter.y = update.y = {
field: Size,
mult: 0.5,
offset: {
field: Total,
offset: {
field: {group: 'entryPadding'},
mult: {field: Index}
}
}
};
LegendScales.forEach(function(scale) {
if (spec[scale]) {
update[scale] = enter[scale] = {scale: spec[scale], field: Value};
}
});
return guideMark(SymbolMark, LegendSymbolRole, Value, dataRef, encode, userEncode);
}
function legendTitle(spec, config, userEncode, dataRef) {
var zero = {value: 0},
title = spec.title,
encode = {}, enter;
encode.enter = enter = {
x: {field: {group: 'padding'}},
y: {field: {group: 'padding'}},
opacity: zero
};
addEncode(enter, 'align', config.titleAlign);
addEncode(enter, 'baseline', config.titleBaseline);
addEncode(enter, 'fill', config.titleColor);
addEncode(enter, 'font', config.titleFont);
addEncode(enter, 'fontSize', config.titleFontSize);
addEncode(enter, 'fontWeight', config.titleFontWeight);
addEncode(enter, 'limit', config.titleLimit);
encode.exit = {
opacity: zero
};
encode.update = {
opacity: {value: 1},
text: title && title.signal ? {signal: title.signal} : {value: title + ''}
};
return guideMark(TextMark, LegendTitleRole, null, dataRef, encode, userEncode);
}
function guideGroup(role, name, dataRef, interactive, encode, marks) {
return {
type: GroupMark,
name: name,
role: role,
from: dataRef,
interactive: interactive,
encode: encode,
marks: marks
};
}
function role(spec) {
return spec.role ||
(spec.type === GroupMark && (spec.legends || spec.axes)
? ScopeRole$1
: MarkRole);
}
function definition$1(spec) {
return {
clip: spec.clip || false,
interactive: spec.interactive === false ? false : true,
marktype: spec.type,
name: spec.name || undefined,
role: role(spec),
zindex: +spec.zindex || undefined
};
}
function dataName(name) {
return name;
}
function Entry(type, value, params, parent) {
this.id = -1,
this.type = type;
this.value = value;
this.params = params;
if (parent) this.parent = parent;
}
function entry$1(type, value, params, parent) {
return new Entry(type, value, params, parent);
}
function operator(value, params) {
return entry$1('Operator', value, params);
}
// -----
function ref(op) {
var ref = {$ref: op.id};
// if operator not yet registered, cache ref to resolve later
if (op.id < 0) (op.refs = op.refs || []).push(ref);
return ref;
}
function fieldRef(field, name) {
return name ? {$field: field, $name: name} : {$field: field};
}
var keyFieldRef = fieldRef('key');
function compareRef(fields, orders) {
return {$compare: fields, $order: orders};
}
function keyRef(fields) {
return {$key: fields};
}
// -----
var Ascending = 'ascending';
var Descending = 'descending';
function sortKey(sort) {
return !isObject(sort) ? ''
: (sort.order === Descending ? '-' : '+')
+ aggrField(sort.op, sort.field);
}
function aggrField(op, field) {
return (op && op.signal ? '$' + op.signal : op || '')
+ (op && field ? '_' : '')
+ (field && field.signal ? '$' + field.signal : field || '');
}
// -----
function isSignal(_) {
return _ && _.signal;
}
function transform$2(name) {
return function(params, value, parent) {
return entry$1(name, value, params || undefined, parent);
};
}
var Aggregate$1 = transform$2('Aggregate');
var AxisTicks$1 = transform$2('AxisTicks');
var Bound$1 = transform$2('Bound');
var Collect$1 = transform$2('Collect');
var Compare$1 = transform$2('Compare');
var DataJoin$1 = transform$2('DataJoin');
var Encode$1 = transform$2('Encode');
var Facet$1 = transform$2('Facet');
var Field$1 = transform$2('Field');
var Key$1 = transform$2('Key');
var LegendEntries$1 = transform$2('LegendEntries');
var Mark$1 = transform$2('Mark');
var MultiExtent$1 = transform$2('MultiExtent');
var MultiValues$1 = transform$2('MultiValues');
var Params$1 = transform$2('Params');
var PreFacet$1 = transform$2('PreFacet');
var Projection$1 = transform$2('Projection');
var Proxy$1 = transform$2('Proxy');
var Relay$1 = transform$2('Relay');
var Render$1 = transform$2('Render');
var Scale$1 = transform$2('Scale');
var Sieve$1 = transform$2('Sieve');
var ViewLayout$1 = transform$2('ViewLayout');
var Values$1 = transform$2('Values');
/**
* Parse a data transform specification.
*/
function parseTransform(spec, scope) {
var def = definition(spec.type);
if (!def) error('Unrecognized transform type: ' + $(spec.type));
var t = entry$1(def.type, null, parseParameters(def, spec, scope));
if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t));
return t.metadata = def.metadata || {}, t;
}
/**
* Parse all parameters of a data transform.
*/
function parseParameters(def, spec, scope) {
var params = {}, pdef, i, n;
for (i=0, n=def.params.length; i<n; ++i) {
pdef = def.params[i];
params[pdef.name] = parseParameter$1(pdef, spec, scope);
}
return params;
}
/**
* Parse a data transform parameter.
*/
function parseParameter$1(def, spec, scope) {
var type = def.type, value;
if (type === 'index') {
return parseIndexParameter(def, spec, scope);
} else if (type === 'param') {
return parseSubParameters(def, spec, scope);
} else if (type === 'projection') {
return scope.projectionRef(spec[def.name]);
} else {
value = spec[def.name];
if (value === undefined) {
if (def.required) {
error('Missing required ' + $(spec.type)
+ ' parameter: ' + $(def.name));
}
return;
}
return def.array && !isSignal(value)
? value.map(function(v) { return parameterValue(def, v, scope); })
: parameterValue(def, value, scope);
}
}
/**
* Parse a single parameter value.
*/
function parameterValue(def, value, scope) {
var type = def.type;
if (isSignal(value)) {
return isExpr(type) ? error('Expression references can not be signals.')
: isField(type) ? scope.fieldRef(value)
: isCompare(type) ? scope.compareRef(value)
: scope.signalRef(value.signal);
} else {
var expr = def.expr || isField(type);
return expr && outerExpr(value) ? parseExpression(value.expr, scope)
: expr && outerField(value) ? fieldRef(value.field)
: isExpr(type) ? parseExpression(value, scope)
: isData(type) ? ref(scope.getData(value).values)
: isField(type) ? fieldRef(value)
: isCompare(type) ? scope.compareRef(value)
: value;
}
}
/**
* Parse parameter for accessing an index of another data set.
*/
function parseIndexParameter(def, spec, scope) {
if (!isString(spec.from)) {
error('Lookup "from" parameter must be a string literal.');
}
return scope.getData(spec.from).lookupRef(scope, spec.key);
}
/**
* Parse a parameter that contains one or more sub-parameter objects.
*/
function parseSubParameters(def, spec, scope) {
var value = spec[def.name];
if (def.array) {
if (!isArray(value)) { // signals not allowed!
error('Expected an array of sub-parameters. Instead: ' + $(value));
}
return value.map(function(v) {
return parseSubParameter(def, v, scope);
});
} else {
return parseSubParameter(def, value, scope);
}
}
/**
* Parse a sub-parameter object.
*/
function parseSubParameter(def, value, scope) {
var params, pdef, k, i, n;
// loop over defs to find matching key
for (i=0, n=def.params.length; i<n; ++i) {
pdef = def.params[i];
for (k in pdef.key) {
if (pdef.key[k] !== value[k]) { pdef = null; break; }
}
if (pdef) break;
}
// raise error if matching key not found
if (!pdef) error('Unsupported parameter: ' + $(value));
// parse params, create Params transform, return ref
params = extend(parseParameters(pdef, value, scope), pdef.key);
return ref(scope.add(Params$1(params)));
}
// -- Utilities -----
function outerExpr(_) {
return _ && _.expr;
}
function outerField(_) {
return _ && _.field;
}
function isData(_) {
return _ === 'data';
}
function isExpr(_) {
return _ === 'expr';
}
function isField(_) {
return _ === 'field';
}
function isCompare(_) {
return _ === 'compare'
}
function parseData(from, group, scope) {
var facet, key, op, dataRef, parent;
// if no source data, generate singleton datum
if (!from) {
dataRef = ref(scope.add(Collect$1(null, [{}])));
}
// if faceted, process facet specification
else if (facet = from.facet) {
if (!group) error('Only group marks can be faceted.');
// use pre-faceted source data, if available
if (facet.field != null) {
dataRef = parent = ref(scope.getData(facet.data).output);
} else {
key = scope.keyRef(facet.groupby);
// generate facet aggregates if no direct data specification
if (!from.data) {
op = parseTransform(extend({
type: 'aggregate',
groupby: array$1(facet.groupby)
}, facet.aggregate));
op.params.key = key;
op.params.pulse = ref(scope.getData(facet.data).output);
dataRef = parent = ref(scope.add(op));
} else {
parent = ref(scope.getData(from.data).aggregate);
}
}
}
// if not yet defined, get source data reference
if (!dataRef) {
dataRef = from.$ref ? from
: from.mark ? ref(scope.getData(dataName(from.mark)).output)
: ref(scope.getData(from.data).output);
}
return {
key: key,
pulse: dataRef,
parent: parent
};
}
function DataScope(scope, input, output, values, aggr) {
this.scope = scope; // parent scope object
this.input = input; // first operator in pipeline (tuple input)
this.output = output; // last operator in pipeline (tuple output)
this.values = values; // operator for accessing tuples (but not tuple flow)
// last aggregate in transform pipeline
this.aggregate = aggr;
// lookup table of field indices
this.index = {};
}
DataScope.fromEntries = function(scope, entries) {
var n = entries.length,
i = 1,
input = entries[0],
values = entries[n-1],
output = entries[n-2],
aggr = null;
// add operator entries to this scope, wire up pulse chain
scope.add(entries[0]);
for (; i<n; ++i) {
entries[i].params.pulse = ref(entries[i-1]);
scope.add(entries[i]);
if (entries[i].type === 'Aggregate') aggr = entries[i];
}
return new DataScope(scope, input, output, values, aggr);
};
var prototype$70 = DataScope.prototype;
prototype$70.countsRef = function(scope, field, sort) {
var ds = this,
cache = ds.counts || (ds.counts = {}),
k = fieldKey(field), v, a, p;
if (k != null) {
scope = ds.scope;
v = cache[k];
}
if (!v) {
p = {
groupby: scope.fieldRef(field, 'key'),
pulse: ref(ds.output)
};
if (sort && sort.field) addSortField(scope, p, sort);
a = scope.add(Aggregate$1(p));
v = scope.add(Collect$1({pulse: ref(a)}));
v = {agg: a, ref: ref(v)};
if (k != null) cache[k] = v;
} else if (sort && sort.field) {
addSortField(scope, v.agg.params, sort);
}
return v.ref;
};
function fieldKey(field) {
return isString(field) ? field : null;
}
function addSortField(scope, p, sort) {
var as = aggrField(sort.op, sort.field), s;
if (p.ops) {
for (var i=0, n=p.as.length; i<n; ++i) {
if (p.as[i] === as) return;
}
} else {
p.ops = ['count'];
p.fields = [null];
p.as = ['count'];
}
if (sort.op) {
p.ops.push((s=sort.op.signal) ? scope.signalRef(s) : sort.op);
p.fields.push(scope.fieldRef(sort.field));
p.as.push(as);
}
}
function cache(scope, ds, name, optype, field, counts, index) {
var cache = ds[name] || (ds[name] = {}),
sort = sortKey(counts),
k = fieldKey(field), v, op;
if (k != null) {
scope = ds.scope;
k = k + (sort ? '|' + sort : '');
v = cache[k];
}
if (!v) {
var params = counts
? {field: keyFieldRef, pulse: ds.countsRef(scope, field, counts)}
: {field: scope.fieldRef(field), pulse: ref(ds.output)};
if (sort) params.sort = scope.sortRef(counts);
op = scope.add(entry$1(optype, undefined, params));
if (index) ds.index[field] = op;
v = ref(op);
if (k != null) cache[k] = v;
}
return v;
}
prototype$70.tuplesRef = function() {
return ref(this.values);
};
prototype$70.extentRef = function(scope, field) {
return cache(scope, this, 'extent', 'Extent', field, false);
};
prototype$70.domainRef = function(scope, field) {
return cache(scope, this, 'domain', 'Values', field, false);
};
prototype$70.valuesRef = function(scope, field, sort) {
return cache(scope, this, 'vals', 'Values', field, sort || true);
};
prototype$70.lookupRef = function(scope, field) {
return cache(scope, this, 'lookup', 'TupleIndex', field, false);
};
prototype$70.indataRef = function(scope, field) {
return cache(scope, this, 'indata', 'TupleIndex', field, true, true);
};
function parseFacet(spec, scope, group) {
var facet = spec.from.facet,
name = facet.name,
data = ref(scope.getData(facet.data).output),
subscope, source, values, op;
if (!facet.name) {
error('Facet must have a name: ' + $(facet));
}
if (!facet.data) {
error('Facet must reference a data set: ' + $(facet));
}
if (facet.field) {
op = scope.add(PreFacet$1({
field: scope.fieldRef(facet.field),
pulse: data
}));
} else if (facet.groupby) {
op = scope.add(Facet$1({
key: scope.keyRef(facet.groupby),
group: ref(scope.proxy(group.parent)),
pulse: data
}));
} else {
error('Facet must specify groupby or field: ' + $(facet));
}
// initialize facet subscope
subscope = scope.fork();
source = subscope.add(Collect$1());
values = subscope.add(Sieve$1({pulse: ref(source)}));
subscope.addData(name, new DataScope(subscope, source, source, values));
subscope.addSignal('parent', null);
// parse faceted subflow
op.params.subflow = {
$subflow: parseSpec(spec, subscope).toRuntime()
};
}
function parseSubflow(spec, scope, input) {
var op = scope.add(PreFacet$1({pulse: input.pulse})),
subscope = scope.fork();
subscope.add(Sieve$1());
subscope.addSignal('parent', null);
// parse group mark subflow
op.params.subflow = {
$subflow: parseSpec(spec, subscope).toRuntime()
};
}
function parseTrigger(spec, scope, name) {
var remove = spec.remove,
insert = spec.insert,
toggle = spec.toggle,
modify = spec.modify,
values = spec.values,
op = scope.add(operator()),
update, expr;
update = 'if(' + spec.trigger + ',modify("'
+ name + '",'
+ [insert, remove, toggle, modify, values]
.map(function(_) { return _ == null ? 'null' : _; })
.join(',')
+ '),0)';
expr = parseExpression(update, scope);
op.update = expr.$expr;
op.params = expr.$params;
}
function parseMark(spec, scope) {
var role$$ = role(spec),
group = spec.type === GroupMark,
facet = spec.from && spec.from.facet,
layout = role$$ === ScopeRole$1 || role$$ === FrameRole$1,
op, input, store, bound, render, sieve, name,
markRef, encodeRef, boundRef;
// resolve input data
input = parseData(spec.from, group, scope);
// data join to map tuples to visual items
op = scope.add(DataJoin$1({
key: input.key || (spec.key ? fieldRef(spec.key) : undefined),
pulse: input.pulse,
clean: !group
}));
// collect visual items
op = store = scope.add(Collect$1({pulse: ref(op)}));
// connect visual items to scenegraph
op = scope.add(Mark$1({
markdef: definition$1(spec),
scenepath: {$itempath: scope.markpath()},
pulse: ref(op)
}));
markRef = ref(op);
// add visual encoders
op = scope.add(Encode$1(
encoders(spec.encode, spec.type, role$$, scope, {pulse: markRef})
));
// monitor parent marks to propagate changes
op.params.parent = scope.encode();
// add post-encoding transforms, if defined
if (spec.transform) {
spec.transform.forEach(function(_) {
var tx = parseTransform(_, scope);
if (tx.metadata.generates || tx.metadata.changes) {
error('Mark transforms should not generate new data.');
}
tx.params.pulse = ref(op);
scope.add(op = tx);
});
}
encodeRef = ref(op);
// if group is faceted or requires view layout, recurse here
if (facet || layout) {
op = scope.add(ViewLayout$1({
legendMargin: scope.config.legendMargin,
mark: markRef,
pulse: encodeRef
}));
// we juggle the layout operator as we want it in our scope state,
// but we also want it to be run *after* any faceting transforms
scope.operators.pop();
scope.pushState(encodeRef, ref(op));
(facet ? parseFacet(spec, scope, input) : parseSubflow(spec, scope, input));
scope.popState();
scope.operators.push(op);
}
// compute bounding boxes
bound = scope.add(Bound$1({mark: markRef, pulse: ref(op)}));
boundRef = ref(bound);
if (group && !facet && !layout) {
if (role$$ === MarkRole) {
// if a normal group mark, we must generate nested subflows
scope.operators.pop();
scope.pushState(encodeRef, boundRef);
parseSubflow(spec, scope, input);
scope.popState();
scope.operators.push(bound);
} else {
// otherwise, we know the group is a guide with only one group item
// as a result we can simplify the dataflow to avoid nested scopes
scope.pushState(encodeRef, boundRef);
parseSpec(spec, scope);
scope.popState();
}
}
// render / sieve items
render = scope.add(Render$1({pulse: boundRef}));
sieve = scope.add(Sieve$1({pulse: boundRef}, undefined, scope.parent()));
// if mark is named, make accessible as reactive geometry
// add trigger updates if defined
if (spec.name != null) {
name = dataName(spec.name);
scope.addData(name, new DataScope(scope, store, render, sieve));
if (spec.on) spec.on.forEach(function(on) {
if (on.insert || on.remove || on.toggle) {
error('Marks only support modify triggers.');
}
parseTrigger(on, scope, name);
});
}
}
function parseLegend(spec, scope) {
var type = spec.type || 'symbol',
config = scope.config.legend,
name = spec.name || undefined,
encode = spec.encode || {},
interactive = !!spec.interactive,
datum, dataRef, entryRef, group, title,
legendEncode, entryEncode, children;
// resolve 'canonical' scale name
var scale = spec.size || spec.shape || spec.fill || spec.stroke
|| spec.strokeDash || spec.opacity;
if (!scale) {
error('Missing valid scale for legend.');
}
// single-element data source for axis group
datum = {
orient: value(spec.orient, config.orient),
title: spec.title != null
};
dataRef = ref(scope.add(Collect$1(null, [datum])));
// encoding properties for legend group
legendEncode = extendEncode({
enter: legendEnter(config),
update: {
offset: encoder(value(spec.offset, config.offset)),
padding: encoder(value(spec.padding, config.padding)),
titlePadding: encoder(value(spec.titlePadding, config.titlePadding))
}
}, encode.legend);
// encoding properties for legend entry sub-group
entryEncode = {
update: {
x: {field: {group: 'padding'}},
y: {field: {group: 'padding'}},
entryPadding: encoder(value(spec.entryPadding, config.entryPadding))
}
};
if (type === 'gradient') {
// data source for gradient labels
entryRef = ref(scope.add(LegendEntries$1({
type: 'gradient',
scale: scope.scaleRef(scale),
count: scope.property(spec.tickCount),
values: scope.property(spec.values),
formatSpecifier: scope.property(spec.format)
})));
children = [
legendGradient(scale, config, encode.gradient),
legendGradientLabels(spec, config, encode.labels, entryRef)
];
}
else {
// data source for legend entries
entryRef = ref(scope.add(LegendEntries$1({
size: sizeExpression(spec, config, encode.labels),
scale: scope.scaleRef(scale),
count: scope.property(spec.tickCount),
values: scope.property(spec.values),
formatSpecifier: scope.property(spec.format)
})));
children = [
legendSymbols(spec, config, encode.symbols, entryRef),
legendLabels(spec, config, encode.labels, entryRef)
];
}
// generate legend marks
children = [
guideGroup(LegendEntryRole, null, dataRef, interactive, entryEncode, children)
];
// include legend title if defined
if (datum.title) {
title = legendTitle(spec, config, encode.title, dataRef);
entryEncode.update.y.offset = {
field: {group: 'titlePadding'},
offset: title.encode.update.fontSize || title.encode.enter.fontSize
};
children.push(title);
}
// build legend specification
group = guideGroup(LegendRole$1, name, dataRef, interactive, legendEncode, children);
if (spec.zindex) group.zindex = spec.zindex;
// parse legend specification
return parseMark(group, scope);
}
function value(value, defaultValue) {
return value != null ? value : defaultValue;
}
function sizeExpression(spec, config, encode) {
// TODO get override for symbolSize?
var symbolSize = +config.symbolSize, fontSize;
fontSize = encode && encode.update && encode.update.fontSize;
if (!fontSize) fontSize = encode && encode.enter && encode.enter.fontSize;
if (fontSize) fontSize = fontSize.value; // TODO support signal?
if (!fontSize) fontSize = +config.labelFontSize;
return spec.size
? {$expr: 'Math.max(Math.ceil(Math.sqrt(_.scale(datum))),' + fontSize + ')'}
: Math.max(Math.ceil(Math.sqrt(symbolSize)), fontSize);
}
function legendEnter(config) {
var enter = {},
count = addEncode(enter, 'fill', config.fillColor)
+ addEncode(enter, 'stroke', config.strokeColor)
+ addEncode(enter, 'strokeWidth', config.strokeWidth)
+ addEncode(enter, 'strokeDash', config.strokeDash)
+ addEncode(enter, 'cornerRadius', config.cornerRadius)
return count ? enter : undefined;
}
var FIELD_REF_ID = 0;
var types = [
'identity',
'ordinal', 'band', 'point',
'linear', 'pow', 'sqrt', 'log', 'sequential',
'time', 'utc',
'quantize', 'quantile', 'threshold',
'bin-linear', 'bin-ordinal'
];
var allTypes = toSet(types);
var ordinalTypes = toSet(types.slice(1, 4));
function isOrdinal(type) {
return ordinalTypes.hasOwnProperty(type);
}
function isQuantile(type) {
return type === 'quantile';
}
function parseScale(spec, scope) {
var type = spec.type || 'linear',
params, key;
if (!allTypes.hasOwnProperty(type)) {
error('Unrecognized scale type: ' + $(type));
}
params = {
type: type,
domain: parseScaleDomain(spec.domain, spec, scope)
};
if (spec.range != null) {
params.range = parseScaleRange(spec, scope, params);
}
if (spec.interpolate != null) {
parseScaleInterpolate(spec.interpolate, params);
}
for (key in spec) {
if (params.hasOwnProperty(key) || key === 'name') continue;
params[key] = parseLiteral(spec[key], scope);
}
scope.addScale(spec.name, params);
}
function parseLiteral(v, scope) {
return !isObject(v) ? v
: v.signal ? scope.signalRef(v.signal)
: error('Unsupported object: ' + $(v));
}
function parseArray(v, scope) {
return v.signal
? scope.signalRef(v.signal)
: v.map(function(v) { return parseLiteral(v, scope); });
}
function dataLookupError(name) {
error('Can not find data set: ' + $(name));
}
// -- SCALE DOMAIN ----
function parseScaleDomain(domain, spec, scope) {
if (!domain) {
if (spec.domainMin != null || spec.domainMax != null) {
error('No scale domain defined for domainMin/domainMax to override.');
}
return; // default domain
}
return domain.signal ? scope.signalRef(domain.signal)
: (isArray(domain) ? explicitDomain
: domain.fields ? multipleDomain
: singularDomain)(domain, spec, scope);
}
function explicitDomain(domain, spec, scope) {
return domain.map(function(v) {
return parseLiteral(v, scope);
});
}
function singularDomain(domain, spec, scope) {
var data = scope.getData(domain.data);
if (!data) dataLookupError(domain.data);
return isOrdinal(spec.type)
? data.valuesRef(scope, domain.field, parseSort(domain.sort, false))
: isQuantile(spec.type) ? data.domainRef(scope, domain.field)
: data.extentRef(scope, domain.field);
}
function multipleDomain(domain, spec, scope) {
var data = domain.data,
fields = domain.fields.reduce(function(dom, d) {
d = isString(d) ? {data: data, field: d}
: (isArray(d) || d.signal) ? fieldRef$1(d, scope)
: d;
return dom.push(d), dom;
}, []);
return (isOrdinal(spec.type) ? ordinalMultipleDomain
: isQuantile(spec.type) ? quantileMultipleDomain
: numericMultipleDomain)(domain, scope, fields);
}
function fieldRef$1(data, scope) {
var name = '_:vega:_' + (FIELD_REF_ID++),
coll = Collect$1({});
if (isArray(data)) {
coll.value = {$ingest: data};
} else if (data.signal) {
scope.signalRef('modify(' + $(name)
+ ',' + data.signal + ', true)');
}
scope.addDataPipeline(name, [coll, Sieve$1({})]);
return {data: name, field: 'data'};
}
function ordinalMultipleDomain(domain, scope, fields) {
var counts, a, c, v;
// get value counts for each domain field
counts = fields.map(function(f) {
var data = scope.getData(f.data);
if (!data) dataLookupError(f.data);
return data.countsRef(scope, f.field);
});
// sum counts from all fields
a = scope.add(Aggregate$1({
groupby: keyFieldRef,
ops:['sum'], fields: [scope.fieldRef('count')], as:['count'],
pulse: counts
}));
// collect aggregate output
c = scope.add(Collect$1({pulse: ref(a)}));
// extract values for combined domain
v = scope.add(Values$1({
field: keyFieldRef,
sort: scope.sortRef(parseSort(domain.sort, true)),
pulse: ref(c)
}));
return ref(v);
}
function parseSort(sort, multidomain) {
if (sort) {
if (!sort.field && !sort.op) {
if (isObject(sort)) sort.field = 'key';
else sort = {field: 'key'};
} else if (!sort.field && sort.op !== 'count') {
error('No field provided for sort aggregate op: ' + sort.op);
} else if (multidomain && sort.field) {
error('Multiple domain scales can not sort by field.');
} else if (multidomain && sort.op && sort.op !== 'count') {
error('Multiple domain scales support op count only.');
}
}
return sort;
}
function quantileMultipleDomain(domain, scope, fields) {
// get value arrays for each domain field
var values = fields.map(function(f) {
var data = scope.getData(f.data);
if (!data) dataLookupError(f.data);
return data.domainRef(scope, f.field);
});
// combine value arrays
return ref(scope.add(MultiValues$1({values: values})));
}
function numericMultipleDomain(domain, scope, fields) {
// get extents for each domain field
var extents = fields.map(function(f) {
var data = scope.getData(f.data);
if (!data) dataLookupError(f.data);
return data.extentRef(scope, f.field);
});
// combine extents
return ref(scope.add(MultiExtent$1({extents: extents})));
}
// -- SCALE INTERPOLATION -----
function parseScaleInterpolate(interpolate, params) {
params.interpolate = parseLiteral(interpolate.type || interpolate);
if (interpolate.gamma != null) {
params.interpolateGamma = parseLiteral(interpolate.gamma);
}
}
// -- SCALE RANGE -----
function parseScaleRange(spec, scope, params) {
var range = spec.range,
config = scope.config.range;
if (range.signal) {
return scope.signalRef(range.signal);
} else if (isString(range)) {
if (config && config.hasOwnProperty(range)) {
spec = extend({}, spec, {range: config[range]});
return parseScaleRange(spec, scope, params);
} else if (range === 'width') {
range = [0, {signal: 'width'}]
} else if (range === 'height') {
range = isOrdinal(spec.type)
? [0, {signal: 'height'}]
: [{signal: 'height'}, 0]
} else {
error('Unrecognized scale range value: ' + $(range));
}
} else if (range.scheme) {
params.scheme = parseLiteral(range.scheme, scope);
if (range.extent) params.schemeExtent = parseArray(range.extent, scope);
if (range.count) params.schemeCount = parseLiteral(range.count, scope);
return;
} else if (range.step) {
params.rangeStep = parseLiteral(range.step, scope);
return;
} else if (isOrdinal(spec.type) && !isArray(range)) {
return parseScaleDomain(range, spec, scope);
} else if (!isArray(range)) {
error('Unsupported range type: ' + $(range));
}
return range.map(function(v) {
return parseLiteral(v, scope);
});
}
function parseData$1(data, scope) {
var transforms = [];
if (data.transform) {
data.transform.forEach(function(tx) {
transforms.push(parseTransform(tx, scope));
});
}
if (data.on) {
data.on.forEach(function(on) {
parseTrigger(on, scope, data.name);
});
}
scope.addDataPipeline(data.name, analyze(data, scope, transforms));
}
/**
* Analyze a data pipeline, add needed operators.
*/
function analyze(data, scope, ops) {
// POSSIBLE TODOs:
// - error checking for treesource on tree operators (BUT what if tree is upstream?)
// - this is local analysis, perhaps some tasks better for global analysis...
var output = [],
source = null,
modify = false,
generate = false,
upstream, i, n, t, m;
if (data.values) {
// hard-wired input data set
output.push(source = collect({$ingest: data.values, $format: data.format}));
} else if (data.url) {
// load data from external source
output.push(source = collect({$request: data.url, $format: data.format}));
} else if (data.source) {
// derives from another data set
upstream = scope.getData(data.source);
source = upstream.output;
output.push(null); // populate later
}
// scan data transforms, add collectors as needed
for (i=0, n=ops.length; i<n; ++i) {
t = ops[i];
m = t.metadata;
if (!source && !m.source) {
output.push(source = collect());
}
output.push(t);
if (m.generates) generate = true;
if (m.modifies && !generate) modify = true;
if (m.source) source = t;
else if (m.changes) source = null;
}
if (upstream) {
output[0] = Relay$1({derive: modify, pulse: ref(upstream.output)});
if (modify) output.splice(1, 0, collect()); // collect derived tuples
}
if (!source) output.push(collect());
output.push(Sieve$1({}));
return output;
}
function collect(values) {
var s = Collect$1({}, values);
return s.metadata = {source: true}, s;
}
function axisConfig(spec, scope) {
var config = scope.config,
orient = spec.orient,
xy = (orient === Top || orient === Bottom) ? config.axisX : config.axisY,
or = config['axis' + orient[0].toUpperCase() + orient.slice(1)],
band = scope.scaleType(spec.scale) === 'band' && config.axisBand;
return (xy || or || band)
? extend({}, config.axis, xy, or, band)
: config.axis;
}
function axisDomain(spec, config, userEncode, dataRef) {
var orient = spec.orient,
zero = {value: 0},
encode = {}, enter, update, u, u2, v;
encode.enter = enter = {
opacity: zero
};
addEncode(enter, 'stroke', config.tickColor);
addEncode(enter, 'strokeWidth', config.tickWidth);
encode.exit = {
opacity: zero
};
encode.update = update = {
opacity: {value: 1}
};
(orient === Top || orient === Bottom)
? (u = 'x', v = 'y')
: (u = 'y', v = 'x');
u2 = u + '2',
enter[v] = zero;
update[u] = enter[u] = position(spec, 0);
update[u2] = enter[u2] = position(spec, 1);
return guideMark(RuleMark, AxisDomainRole, null, dataRef, encode, userEncode);
}
function position(spec, pos) {
return {scale: spec.scale, range: pos};
}
function axisGrid(spec, config, userEncode, dataRef) {
var orient = spec.orient,
vscale = spec.gridScale,
sign = (orient === Left || orient === Top) ? 1 : -1,
offset = sign * spec.offset || 0,
zero = {value: 0},
encode = {}, enter, exit, update, tickPos, u, v, v2, s;
encode.enter = enter = {
opacity: zero
};
addEncode(enter, 'stroke', config.gridColor);
addEncode(enter, 'strokeWidth', config.gridWidth);
addEncode(enter, 'strokeDash', config.gridDash);
encode.exit = exit = {
opacity: zero
};
encode.update = update = {};
addEncode(update, 'opacity', config.gridOpacity);
tickPos = {
scale: spec.scale,
field: Value,
band: config.bandPosition,
round: config.tickRound,
extra: config.tickExtra
};
(orient === Top || orient === Bottom)
? (u = 'x', v = 'y', s = 'height')
: (u = 'y', v = 'x', s = 'width');
v2 = v + '2',
update[u] = enter[u] = exit[u] = tickPos;
if (vscale) {
enter[v] = {scale: vscale, range: 0, mult: sign, offset: offset};
update[v2] = enter[v2] = {scale: vscale, range: 1, mult: sign, offset: offset};
} else {
enter[v] = {value: offset};
update[v2] = enter[v2] = {signal: s, mult: sign, offset: offset};
}
return guideMark(RuleMark, AxisGridRole, Value, dataRef, encode, userEncode);
}
function axisTicks(spec, config, userEncode, dataRef, size) {
var orient = spec.orient,
sign = (orient === Left || orient === Top) ? -1 : 1,
zero = {value: 0},
encode = {}, enter, exit, update, tickSize, tickPos;
encode.enter = enter = {
opacity: zero
};
addEncode(enter, 'stroke', config.tickColor);
addEncode(enter, 'strokeWidth', config.tickWidth);
encode.exit = exit = {
opacity: zero
};
encode.update = update = {
opacity: {value: 1}
};
tickSize = encoder(size);
tickSize.mult = sign;
tickPos = {
scale: spec.scale,
field: Value,
band: config.bandPosition,
round: config.tickRound,
extra: config.tickExtra
};
if (orient === Top || orient === Bottom) {
update.y = enter.y = zero;
update.y2 = enter.y2 = tickSize;
update.x = enter.x = exit.x = tickPos;
} else {
update.x = enter.x = zero;
update.x2 = enter.x2 = tickSize;
update.y = enter.y = exit.y = tickPos;
}
return guideMark(RuleMark, AxisTickRole, Value, dataRef, encode, userEncode);
}
function axisLabels(spec, config, userEncode, dataRef, size) {
var orient = spec.orient,
sign = (orient === Left || orient === Top) ? -1 : 1,
pad = spec.labelPadding != null ? spec.labelPadding : config.labelPadding,
zero = {value: 0},
encode = {}, enter, exit, update, tickSize, tickPos;
encode.enter = enter = {
opacity: zero,
text: {field: Label}
};
addEncode(enter, 'angle', config.labelAngle);
addEncode(enter, 'fill', config.labelColor);
addEncode(enter, 'font', config.labelFont);
addEncode(enter, 'fontSize', config.labelFontSize);
addEncode(enter, 'limit', config.labelLimit);
encode.exit = exit = {
opacity: zero
};
encode.update = update = {
opacity: {value: 1}
};
tickSize = encoder(size);
tickSize.mult = sign;
tickSize.offset = encoder(pad);
tickSize.offset.mult = sign;
tickPos = {
scale: spec.scale,
field: Value,
band: 0.5
};
if (orient === Top || orient === Bottom) {
update.y = enter.y = tickSize;
update.x = enter.x = exit.x = tickPos;
addEncode(update, 'align', 'center');
addEncode(update, 'baseline', orient === Top ? 'bottom' : 'top');
} else {
update.x = enter.x = tickSize;
update.y = enter.y = exit.y = tickPos;
addEncode(update, 'align', orient === Right ? 'left' : 'right');
addEncode(update, 'baseline', 'middle');
}
return guideMark(TextMark, AxisLabelRole, Value, dataRef, encode, userEncode);
}
function axisTitle(spec, config, userEncode, dataRef) {
var orient = spec.orient,
title = spec.title,
sign = (orient === Left || orient === Top) ? -1 : 1,
horizontal = (orient === Top || orient === Bottom),
encode = {}, enter, update, titlePos;
encode.enter = enter = {
opacity: {value: 0}
};
addEncode(enter, 'align', config.titleAlign);
addEncode(enter, 'fill', config.titleColor);
addEncode(enter, 'font', config.titleFont);
addEncode(enter, 'fontSize', config.titleFontSize);
addEncode(enter, 'fontWeight', config.titleFontWeight);
addEncode(enter, 'limit', config.titleLimit);
encode.exit = {
opacity: {value: 0}
};
encode.update = update = {
opacity: {value: 1},
text: title && title.signal ? {signal: title.signal} : {value: title + ''}
};
titlePos = {
scale: spec.scale,
range: 0.5
};
if (horizontal) {
update.x = titlePos;
update.angle = {value: 0};
update.baseline = {value: orient === Top ? 'bottom' : 'top'};
} else {
update.y = titlePos;
update.angle = {value: sign * 90};
update.baseline = {value: 'bottom'};
}
addEncode(update, 'angle', config.titleAngle);
addEncode(update, 'baseline', config.titleBaseline);
!addEncode(update, 'x', config.titleX)
&& horizontal && !has(userEncode, 'x')
&& (encode.enter.auto = {value: true});
!addEncode(update, 'y', config.titleY)
&& !horizontal && !has(userEncode, 'y')
&& (encode.enter.auto = {value: true});
return guideMark(TextMark, AxisTitleRole, null, dataRef, encode, userEncode);
}
function parseAxis(spec, scope) {
var config = axisConfig(spec, scope),
name = spec.name || undefined,
encode = spec.encode || {},
interactive = !!spec.interactive,
datum, dataRef, ticksRef, size, group, axisEncode, children;
// single-element data source for axis group
datum = {
orient: spec.orient,
ticks: spec.ticks != null ? !!spec.ticks : config.ticks,
labels: spec.labels != null ? !!spec.labels : config.labels,
grid: spec.grid != null ? !!spec.grid : config.grid,
domain: spec.domain != null ? !!spec.domain : config.domain,
title: spec.title != null
};
dataRef = ref(scope.add(Collect$1({}, [datum])));
// encoding properties for axis group item
axisEncode = extendEncode({
update: {
range: {signal: 'abs(span(range("' + spec.scale + '")))'},
offset: encoder(spec.offset || 0),
position: encoder(spec.position || 0),
titlePadding: encoder(spec.titlePadding || config.titlePadding),
minExtent: encoder(spec.minExtent || config.minExtent),
maxExtent: encoder(spec.maxExtent || config.maxExtent)
}
}, encode.axis);
// data source for axis ticks
ticksRef = ref(scope.add(AxisTicks$1({
scale: scope.scaleRef(spec.scale),
extra: config.tickExtra,
count: scope.property(spec.tickCount),
values: scope.property(spec.values),
formatSpecifier: scope.property(spec.format)
})));
// generate axis marks
children = [];
// include axis gridlines if requested
if (datum.grid) {
children.push(axisGrid(spec, config, encode.grid, ticksRef));
}
// include axis ticks if requested
if (datum.ticks) {
size = spec.tickSize != null ? spec.tickSize : config.tickSize;
children.push(axisTicks(spec, config, encode.ticks, ticksRef, size));
}
// include axis labels if requested
if (datum.labels) {
size = datum.ticks ? size : 0;
children.push(axisLabels(spec, config, encode.labels, ticksRef, size));
}
// include axis domain path if requested
if (datum.domain) {
children.push(axisDomain(spec, config, encode.domain, dataRef));
}
// include axis title if defined
if (datum.title) {
children.push(axisTitle(spec, config, encode.title, dataRef));
}
// build axis specification
group = guideGroup(AxisRole$1, name, dataRef, interactive, axisEncode, children);
if (spec.zindex) group.zindex = spec.zindex;
// parse axis specification
return parseMark(group, scope);
}
function parseSpec(spec, scope, preprocessed) {
var signals = array$1(spec.signals);
if (!preprocessed) signals.forEach(function(_) {
parseSignal(_, scope);
});
array$1(spec.projections).forEach(function(_) {
parseProjection(_, scope);
});
array$1(spec.data).forEach(function(_) {
parseData$1(_, scope);
});
array$1(spec.scales).forEach(function(_) {
parseScale(_, scope);
});
signals.forEach(function(_) {
parseSignalUpdates(_, scope);
});
scope.parseLambdas();
array$1(spec.axes).forEach(function(_) {
parseAxis(_, scope);
});
array$1(spec.marks).forEach(function(_) {
parseMark(_, scope);
});
array$1(spec.legends).forEach(function(_) {
parseLegend(_, scope);
});
return scope;
}
var defined = toSet(['width', 'height', 'padding']);
function parseView(spec, scope) {
var config = scope.config,
op, input, encode, parent, root;
scope.background = spec.background || config.background;
root = ref(scope.root = scope.add(operator()));
scope.addSignal('width', spec.width || -1);
scope.addSignal('height', spec.height || -1);
scope.addSignal('padding', parsePadding(spec.padding, config));
array$1(spec.signals).forEach(function(_) {
if (!defined[_.name]) parseSignal(_, scope);
});
// Store root group item
input = scope.add(Collect$1());
// Encode root group item
encode = extendEncode({
enter: { x: {value: 0}, y: {value: 0} },
update: { width: {signal: 'width'}, height: {signal: 'height'} }
}, spec.encode);
encode = scope.add(Encode$1(
encoders(encode, GroupMark, FrameRole$1, scope, {pulse: ref(input)}))
);
// Perform view layout
parent = scope.add(ViewLayout$1({
legendMargin: config.legendMargin,
autosize: parseAutosize(spec.autosize, config),
mark: root,
pulse: ref(encode)
}));
// Parse remainder of specification
scope.pushState(ref(encode), ref(parent));
parseSpec(spec, scope, true);
// Bound / render / sieve root item
op = scope.add(Bound$1({mark: root, pulse: ref(parent)}));
op = scope.add(Render$1({pulse: ref(op)}));
op = scope.add(Sieve$1({pulse: ref(op)}));
// Track metadata for root item
scope.addData('root', new DataScope(scope, input, input, op));
return scope;
}
function Scope(config) {
this.config = config;
this.bindings = [];
this.field = {};
this.signals = {};
this.lambdas = {};
this.scales = {};
this.events = {};
this.data = {};
this.streams = [];
this.updates = [];
this.operators = [];
this.background = null;
this._id = 0;
this._subid = 0;
this._nextsub = [0];
this._parent = [];
this._encode = [];
this._markpath = [];
}
function Subscope(scope) {
this.config = scope.config;
this.field = Object.create(scope.field);
this.signals = Object.create(scope.signals);
this.lambdas = Object.create(scope.lambdas);
this.scales = Object.create(scope.scales);
this.events = Object.create(scope.events);
this.data = Object.create(scope.data);
this.streams = [];
this.updates = [];
this.operators = [];
this._id = 0;
this._subid = ++scope._nextsub[0];
this._nextsub = scope._nextsub;
this._parent = scope._parent.slice();
this._encode = scope._encode.slice();
this._markpath = scope._markpath;
}
var prototype$71 = Scope.prototype = Subscope.prototype;
// ----
prototype$71.fork = function() {
return new Subscope(this);
};
prototype$71.toRuntime = function() {
return this.finish(), {
background: this.background,
operators: this.operators,
streams: this.streams,
updates: this.updates,
bindings: this.bindings
};
};
prototype$71.id = function() {
return (this._subid ? this._subid + ':' : 0) + this._id++;
};
prototype$71.add = function(op) {
this.operators.push(op);
op.id = this.id();
// if pre-registration references exist, resolve them now
if (op.refs) {
op.refs.forEach(function(ref) { ref.$ref = op.id; });
op.refs = null;
}
return op;
};
prototype$71.proxy = function(op) {
var vref = op instanceof Entry ? ref(op) : op;
return this.add(Proxy$1({value: vref}));
};
prototype$71.addStream = function(stream) {
return this.streams.push(stream), stream.id = this.id(), stream;
};
prototype$71.addUpdate = function(update) {
return this.updates.push(update), update;
};
// Apply metadata
prototype$71.finish = function() {
var name, ds;
// annotate root
if (this.root) this.root.root = true;
// annotate signals
for (name in this.signals) {
this.signals[name].signal = name;
}
// annotate scales
for (name in this.scales) {
this.scales[name].scale = name;
}
// annotate data sets
function annotate(op, name, type) {
var data, list;
if (op) {
data = op.data || (op.data = {});
list = data[name] || (data[name] = []);
list.push(type);
}
}
for (name in this.data) {
ds = this.data[name];
annotate(ds.input, name, 'input');
annotate(ds.output, name, 'output');
annotate(ds.values, name, 'values');
for (var field in ds.index) {
annotate(ds.index[field], name, 'index:' + field);
}
}
return this;
};
// ----
prototype$71.pushState = function(encode, parent) {
this._encode.push(ref(this.add(Sieve$1({pulse: encode}))));
this._parent.push(parent);
this._markpath.push(-1);
};
prototype$71.popState = function() {
this._encode.pop();
this._parent.pop();
this._markpath.pop();
};
prototype$71.parent = function() {
return peek(this._parent);
};
prototype$71.encode = function() {
return peek(this._encode);
};
prototype$71.markpath = function() {
var p = this._markpath;
return ++p[p.length-1], p.slice();
};
// ----
prototype$71.fieldRef = function(field, name) {
if (isString(field)) return fieldRef(field, name);
if (!field.signal) {
error('Unsupported field reference: ' + $(field));
}
var s = field.signal,
f = this.field[s],
params;
if (!f) { // TODO: replace with update signalRef?
params = {name: this.signalRef(s)}
if (name) params.as = name;
this.field[s] = f = ref(this.add(Field$1(params)));
}
return f;
};
prototype$71.compareRef = function(cmp) {
function check(_) {
return isSignal(_) ? (signal = true, ref(sig[_.signal])) : _;
}
var sig = this.signals,
signal = false,
fields = array$1(cmp.field).map(check),
orders = array$1(cmp.order).map(check);
return signal
? ref(this.add(Compare$1({fields: fields, orders: orders})))
: compareRef(fields, orders);
};
prototype$71.keyRef = function(fields) {
function check(_) {
return isSignal(_) ? (signal = true, ref(sig[_.signal])) : _;
}
var sig = this.signals,
signal = false;
fields = array$1(fields).map(check);
return signal
? ref(this.add(Key$1({fields: fields})))
: keyRef(fields);
};
prototype$71.sortRef = function(sort) {
if (!sort) return sort;
// including id ensures stable sorting
// TODO review? enable multi-field sorts?
var a = [aggrField(sort.op, sort.field), '_id'],
o = sort.order || Ascending;
return o.signal
? ref(this.add(Compare$1({
fields: a,
orders: [o = this.signalRef(o.signal), o]
})))
: compareRef(a, [o, o]);
};
// ----
prototype$71.event = function(source, type) {
var key = source + ':' + type;
if (!this.events[key]) {
var id = this.id();
this.streams.push({
id: id,
source: source,
type: type
});
this.events[key] = id;
}
return this.events[key];
};
// ----
prototype$71.addSignal = function(name, value) {
if (this.signals.hasOwnProperty(name)) {
error('Duplicate signal name: ' + $(name));
}
var op = value instanceof Entry ? value : this.add(operator(value));
return this.signals[name] = op;
};
prototype$71.getSignal = function(name) {
if (!this.signals[name]) {
error('Unrecognized signal name: ' + $(name));
}
return this.signals[name];
};
prototype$71.signalRef = function(s) {
if (this.signals[s]) {
return ref(this.signals[s]);
} else if (!this.lambdas[s]) {
this.lambdas[s] = this.add(operator(null));
}
return ref(this.lambdas[s]);
};
prototype$71.parseLambdas = function() {
var code = Object.keys(this.lambdas);
for (var i=0, n=code.length; i<n; ++i) {
var s = code[i],
e = parseExpression(s, this),
op = this.lambdas[s];
op.params = e.$params;
op.update = e.$expr;
}
};
prototype$71.property = function(spec) {
return spec && spec.signal ? this.signalRef(spec.signal) : spec;
};
prototype$71.addBinding = function(name, bind) {
if (!this.bindings) {
error('Nested signals do not support binding: ' + $(name));
}
this.bindings.push(extend({signal: name}, bind));
};
// ----
prototype$71.addScaleProj = function(name, transform) {
if (this.scales.hasOwnProperty(name)) {
error('Duplicate scale or projection name: ' + $(name));
}
this.scales[name] = this.add(transform);
}
prototype$71.addScale = function(name, params) {
this.addScaleProj(name, Scale$1(params));
};
prototype$71.addProjection = function(name, params) {
this.addScaleProj(name, Projection$1(params));
};
prototype$71.getScale = function(name) {
if (!this.scales[name]) {
error('Unrecognized scale name: ' + $(name));
}
return this.scales[name];
};
prototype$71.projectionRef =
prototype$71.scaleRef = function(name) {
return ref(this.getScale(name));
};
prototype$71.projectionType =
prototype$71.scaleType = function(name) {
return this.getScale(name).params.type;
};
// ----
prototype$71.addData = function(name, dataScope) {
if (this.data.hasOwnProperty(name)) {
error('Duplicate data set name: ' + $(name));
}
return (this.data[name] = dataScope);
};
prototype$71.getData = function(name) {
if (!this.data[name]) {
error('Undefined data set name: ' + $(name));
}
return this.data[name];
};
prototype$71.addDataPipeline = function(name, entries) {
if (this.data.hasOwnProperty(name)) {
error('Duplicate data set name: ' + $(name));
}
return this.addData(name, DataScope.fromEntries(this, entries));
};
function defaults(userConfig) {
var config = defaults$1(), key;
for (key in userConfig) {
config[key] = isObject(config[key])
? extend(config[key], userConfig[key])
: config[key] = userConfig[key];
}
return config;
}
var defaultSymbolSize = 30;
var defaultStrokeWidth = 2;
var defaultColor = '#4c78a8';
var black = "#000";
var gray = '#888';
var lightGray = '#ddd';
/**
* Standard configuration defaults for Vega specification parsing.
* Users can provide their own (sub-)set of these default values
* by passing in a config object to the top-level parse method.
*/
function defaults$1() {
return {
// default padding around visualization
padding: 0,
// default for automatic sizing; options: "none", "pad", "fit"
// or provide an object (e.g., {"type": "pad", "resize": true})
autosize: 'pad',
// default view background color
// covers the entire view component
background: null,
// defaults for top-level group marks
// accepts mark properties (fill, stroke, etc)
// covers the data rectangle within group width/height
group: null,
// defaults for basic mark types
// each subset accepts mark properties (fill, stroke, etc)
mark: null,
arc: { fill: defaultColor },
area: { fill: defaultColor },
image: null,
line: {
stroke: defaultColor,
strokeWidth: defaultStrokeWidth
},
path: { stroke: defaultColor },
rect: { fill: defaultColor },
rule: { stroke: black },
shape: { stroke: defaultColor },
symbol: {
fill: defaultColor,
size: 64
},
text: {
fill: black,
font: 'sans-serif',
fontSize: 11
},
// defaults for marks using special roles
point: {
size: defaultSymbolSize,
strokeWidth: defaultStrokeWidth,
shape: 'circle'
},
circle: {
size: defaultSymbolSize,
strokeWidth: defaultStrokeWidth
},
square: {
size: defaultSymbolSize,
strokeWidth: defaultStrokeWidth
},
// defaults for axes
axis: {
minExtent: 0,
maxExtent: 200,
bandPosition: 0.5,
domain: true,
domainWidth: 1,
domainColor: black,
grid: false,
gridWidth: 1,
gridColor: lightGray,
gridDash: [],
gridOpacity: 1,
labels: true,
labelAngle: 0,
labelColor: black,
labelFont: 'sans-serif',
labelFontSize: 10,
labelPadding: 2,
labelLimit: 180,
ticks: true,
tickRound: true,
tickSize: 5,
tickWidth: 1,
tickColor: black,
titleAlign: 'center',
titlePadding: 2,
titleColor: black,
titleFont: 'sans-serif',
titleFontSize: 11,
titleFontWeight: 'bold'
},
// defaults for legends
legend: {
orient: 'right',
offset: 18,
padding: 0,
entryPadding: 5,
titlePadding: 5,
gradientWidth: 100,
gradientHeight: 20,
gradientStrokeColor: lightGray,
gradientStrokeWidth: 0,
gradientLabelBaseline: 'top',
gradientLabelOffset: 2,
labelColor: black,
labelFontSize: 10,
labelFont: 'sans-serif',
labelAlign: 'left',
labelBaseline: 'middle',
labelOffset: 8,
labelLimit: 160,
symbolType: 'circle',
symbolSize: 100,
symbolColor: gray,
symbolStrokeWidth: 1.5,
titleColor: black,
titleFont: 'sans-serif',
titleFontSize: 11,
titleFontWeight: 'bold',
titleAlign: 'left',
titleBaseline: 'top',
titleLimit: 180
},
// defaults for scale ranges
range: {
category: {
scheme: 'tableau10'
},
ordinal: {
scheme: 'blues',
extent: [0.2, 1]
},
heatmap: {
scheme: 'viridis'
},
ramp: {
scheme: 'blues',
extent: [0.2, 1]
},
diverging: {
scheme: 'blueorange'
},
symbol: [
'circle',
'square',
'triangle-up',
'cross',
'diamond',
'triangle-right',
'triangle-down',
'triangle-left'
]
}
};
}
function parse$2(spec, config) {
return parseView(spec, new Scope(defaults(config || spec.config)))
.toRuntime();
}
/**
* Parse an expression given the argument signature and body code.
*/
function expression$1(args, code, ctx) {
// wrap code in return statement if expression does not terminate
if (code[code.length-1] !== ';') {
code = 'return(' + code + ');';
}
var fn = Function.apply(null, args.concat(code));
return ctx && ctx.functions ? fn.bind(ctx.functions) : fn;
}
/**
* Parse an expression used to update an operator value.
*/
function operatorExpression(code, ctx) {
return expression$1(['_'], code, ctx);
}
/**
* Parse an expression provided as an operator parameter value.
*/
function parameterExpression(code, ctx) {
return expression$1(['datum', '_'], code, ctx);
}
/**
* Parse an expression applied to an event stream.
*/
function eventExpression(code, ctx) {
return expression$1(['event'], code, ctx);
}
/**
* Parse an expression used to handle an event-driven operator update.
*/
function handlerExpression(code, ctx) {
return expression$1(['_', 'event'], code, ctx);
}
/**
* Parse an expression that performs visual encoding.
*/
function encodeExpression(code, ctx) {
return expression$1(['item', '_'], code, ctx);
}
/**
* Parse a set of operator parameters.
*/
function parseParameters$1(spec, ctx, params) {
params = params || {};
var key, value;
for (key in spec) {
value = spec[key];
if (value && value.$expr && value.$params) {
// if expression, parse its parameters
parseParameters$1(value.$params, ctx, params);
}
params[key] = isArray(value)
? value.map(function(v) { return parseParameter$2(v, ctx); })
: parseParameter$2(value, ctx);
}
return params;
}
/**
* Parse a single parameter.
*/
function parseParameter$2(spec, ctx) {
if (!spec || !isObject(spec)) return spec;
for (var i=0, n=PARSERS.length, p; i<n; ++i) {
p = PARSERS[i];
if (spec.hasOwnProperty(p.key)) {
return p.parse(spec, ctx);
}
}
return spec;
}
/** Reference parsers. */
var PARSERS = [
{key: '$ref', parse: getOperator},
{key: '$key', parse: getKey},
{key: '$expr', parse: getExpression},
{key: '$field', parse: getField$1},
{key: '$encode', parse: getEncode},
{key: '$compare', parse: getCompare},
{key: '$subflow', parse: getSubflow},
{key: '$itempath', parse: getItemPath}
];
/**
* Resolve an operator reference.
*/
function getOperator(_, ctx) {
return ctx.get(_.$ref) || error('Operator not defined: ' + _.$ref);
}
/**
* Resolve an expression reference.
*/
function getExpression(_, ctx) {
var k = 'e:' + _.$expr;
return ctx.fn[k]
|| (ctx.fn[k] = accessor(parameterExpression(_.$expr, ctx), _.$fields, _.$name));
}
/**
* Resolve a key accessor reference.
*/
function getKey(_, ctx) {
var k = 'k:' + _.$key;
return ctx.fn[k] || (ctx.fn[k] = key(_.$key));
}
/**
* Resolve a field accessor reference.
*/
function getField$1(_, ctx) {
var k = 'f:' + _.$field + '_' + _.$name;
return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name));
}
/**
* Resolve a comparator function reference.
*/
function getCompare(_, ctx) {
var k = 'c:' + _.$compare + '_' + _.$order;
return ctx.fn[k] || (ctx.fn[k] = compare(_.$compare, _.$order));
}
/**
* Resolve an encode operator reference.
*/
function getEncode(_, ctx) {
var spec = _.$encode,
encode = {}, name, enc;
for (name in spec) {
enc = spec[name];
encode[name] = accessor(encodeExpression(enc.$expr, ctx), enc.$fields);
encode[name].output = enc.$output;
}
return encode;
}
/**
* Resolve a recursive subflow specification.
*/
function getSubflow(_, ctx) {
var spec = _.$subflow;
return function(dataflow, key, index, parent) {
var subctx = parseDataflow(spec, ctx.fork(index)),
op = subctx.get(spec.operators[0].id),
p = subctx.signals.parent;
if (p) p.set(parent);
return op;
};
}
/**
* Resolve an iteration index reference.
*/
function getItemPath(_, ctx) {
return {
marks: _.$itempath,
items: ctx.itempath,
context: ctx
};
}
/**
* Parse a dataflow operator.
*/
function parseOperator(spec, ctx) {
if (spec.type === 'Operator' || !spec.type) {
ctx.operator(spec,
spec.update ? operatorExpression(spec.update, ctx) : null);
} else {
ctx.transform(spec, spec.type);
}
}
/**
* Parse and assign operator parameters.
*/
function parseOperatorParameters(spec, ctx) {
var op, params;
if (spec.params) {
if (!(op = ctx.get(spec.id))) {
error('Invalid operator id: ' + spec.id);
}
params = parseParameters$1(spec.params, ctx);
ctx.dataflow.connect(op, op.parameters(params));
}
}
/**
* Parse an event stream specification.
*/
function parseStream$3(spec, ctx) {
var filter = spec.filter != null ? eventExpression(spec.filter, ctx) : undefined,
stream = spec.stream != null ? ctx.get(spec.stream) : undefined,
args;
if (spec.source) {
stream = ctx.events(spec.source, spec.type, filter);
}
else if (spec.merge) {
args = spec.merge.map(ctx.get.bind(ctx));
stream = args[0].merge.apply(args[0], args.slice(1));
}
if (spec.between) {
args = spec.between.map(ctx.get.bind(ctx));
stream = stream.between(args[0], args[1]);
}
if (spec.filter) {
stream = stream.filter(filter);
}
if (spec.throttle != null) {
stream = stream.throttle(+spec.throttle);
}
if (spec.debounce != null) {
stream = stream.debounce(+spec.debounce);
}
if (stream == null) {
error('Invalid stream definition: ' + JSON.stringify(spec));
}
if (spec.consume) stream.consume(true);
ctx.stream(spec, stream);
}
/**
* Parse an event-driven operator update.
*/
function parseUpdate$1(spec, ctx) {
var source = ctx.get(spec.source),
target = null,
update = spec.update,
params = undefined;
if (!source) error('Source not defined: ' + spec.source);
if (spec.target && spec.target.$expr) {
target = eventExpression(spec.target.$expr, ctx);
} else {
target = ctx.get(spec.target);
}
if (update && update.$expr) {
if (update.$params) {
params = parseParameters$1(update.$params, ctx);
}
update = handlerExpression(update.$expr, ctx);
}
ctx.update(spec, source, target, update, params);
}
/**
* Parse a serialized dataflow specification.
*/
function parseDataflow(spec, ctx) {
var operators = spec.operators || [];
// parse background
if (spec.background) {
ctx.background = spec.background;
}
// parse operators
operators.forEach(function(entry) {
parseOperator(entry, ctx);
});
// parse operator parameters
operators.forEach(function(entry) {
parseOperatorParameters(entry, ctx);
});
// parse streams
(spec.streams || []).forEach(function(entry) {
parseStream$3(entry, ctx);
});
// parse updates
(spec.updates || []).forEach(function(entry) {
parseUpdate$1(entry, ctx);
});
return ctx;
}
var SKIP$3 = {skip: true};
function getState(options) {
var ctx = this,
state = {};
if (options.signals) {
var signals = (state.signals = {});
Object.keys(ctx.signals).forEach(function(key) {
var op = ctx.signals[key];
if (options.signals(key, op)) {
signals[key] = op.value;
}
});
}
if (options.data) {
var data = (state.data = {});
Object.keys(ctx.data).forEach(function(key) {
var dataset = ctx.data[key];
if (options.data(key, dataset)) {
data[key] = dataset.input.value;
}
});
}
if (ctx.subcontext && options.recurse !== false) {
state.subcontext = ctx.subcontext.map(function(ctx) {
return ctx.getState(options);
});
}
return state;
}
function setState(state) {
var ctx = this,
df = ctx.dataflow,
data = state.data,
signals = state.signals;
Object.keys(signals || {}).forEach(function(key) {
df.update(ctx.signals[key], signals[key], SKIP$3);
});
Object.keys(data || {}).forEach(function(key) {
df.pulse(
ctx.data[key].input,
df.changeset().remove(truthy).insert(data[key])
);
});
(state.subcontext || []).forEach(function(substate, i) {
var ctx = ctx.subcontext[i];
if (ctx) ctx.setState(substate);
});
}
/**
* Context objects store the current parse state.
* Enables lookup of parsed operators, event streams, accessors, etc.
* Provides a 'fork' method for creating child contexts for subflows.
*/
function context$2(df, transforms, functions) {
return new Context(df, transforms, functions);
}
function Context(df, transforms, functions) {
this.dataflow = df;
this.transforms = transforms;
this.events = df.events.bind(df);
this.signals = {};
this.scales = {};
this.nodes = {};
this.data = {};
this.fn = {};
this.itempath = [];
if (functions) {
this.functions = Object.create(functions);
this.functions.context = this;
}
}
function ContextFork(ctx, index) {
this.dataflow = ctx.dataflow;
this.transforms = ctx.transforms;
this.functions = ctx.functions;
this.events = ctx.events;
this.signals = Object.create(ctx.signals);
this.scales = Object.create(ctx.scales);
this.nodes = Object.create(ctx.nodes);
this.data = Object.create(ctx.data);
this.fn = Object.create(ctx.fn);
this.itempath = ctx.itempath.concat(index);
if (ctx.functions) {
this.functions = Object.create(ctx.functions);
this.functions.context = this;
}
}
Context.prototype = ContextFork.prototype = {
fork: function(index) {
var ctx = new ContextFork(this, index);
(this.subcontext || (this.subcontext = [])).push(ctx);
return ctx;
},
get: function(id) {
return this.nodes[id];
},
set: function(id, node) {
return this.nodes[id] = node;
},
add: function(spec, op) {
var ctx = this,
df = ctx.dataflow,
data;
ctx.set(spec.id, op);
if (spec.type === 'Collect' && (data = spec.value)) {
if (data.$ingest) {
df.ingest(op, data.$ingest, data.$format);
} else if (data.$request) {
df.request(op, data.$request, data.$format);
} else {
df.pulse(op, df.changeset().insert(data));
}
}
if (spec.root) {
ctx.root = op;
}
if (spec.parent) {
var p = ctx.get(spec.parent.$ref);
df.connect(p, [op]);
op.targets().add(p);
}
if (spec.signal) {
ctx.signals[spec.signal] = op;
}
if (spec.scale) {
ctx.scales[spec.scale] = op;
}
if (spec.data) {
for (var name in spec.data) {
data = ctx.data[name] || (ctx.data[name] = {});
spec.data[name].forEach(function(role) { data[role] = op; });
}
}
},
operator: function(spec, update, params) {
this.add(spec, this.dataflow.add(spec.value, update, params, spec.react));
},
transform: function(spec, type, params) {
this.add(spec, this.dataflow.add(this.transforms[type], params));
},
stream: function(spec, stream) {
this.set(spec.id, stream);
},
update: function(spec, stream, target, update, params) {
this.dataflow.on(stream, target, update, params, spec.options);
},
getState: getState,
setState: setState
};
function runtime(view, spec, functions) {
var fn = functions || functionContext;
return parseDataflow(spec, context$2(view, transforms, fn));
}
function resizer(view, field) {
var op = view.add(null,
function(_) {
view['_' + field] = _.size;
view._autosize = view._resize = 1;
},
{size: view._signals[field]}
);
// set rank to ensure operator runs as soon as possible
// size parameters should be reset prior to view layout
return op.rank = 0, op;
}
function autosize(viewWidth, viewHeight, width, height, origin, auto) {
this.runAfter(function(view) {
var rerun = 0;
// reset autosize flag
view._autosize = 0;
// width value changed: update signal, skip resize op
if (view.width() !== width) {
rerun = 1;
view.width(width);
view._resizeWidth.skip(true);
}
// height value changed: update signal, skip resize op
if (view.height() !== height) {
rerun = 1;
view.height(height);
view._resizeHeight.skip(true);
}
// view width changed: update view property, set resize flag
if (view._width !== viewWidth) {
view._resize = 1;
view._width = viewWidth;
}
// view height changed: update view property, set resize flag
if (view._height !== viewHeight) {
view._resize = 1;
view._height = viewHeight;
}
// origin changed: update view property, set resize flag
if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) {
view._resize = 1;
view._origin = origin;
}
// run dataflow on width/height signal change
if (rerun) view.run('enter');
if (auto) view.runAfter(function() { view._autosize = 1; });
});
}
/**
* Get the current view state, consisting of signal values and/or data sets.
* @param {object} [options] - Options flags indicating which state to export.
* If unspecified, all signals and data sets will be exported.
* @param {function(string, Operator):boolean} [options.signals] - Optional
* predicate function for testing if a signal should be included in the
* exported state. If unspecified, all signals will be included, except for
* those named 'parent' or those which refer to a Transform value.
* @param {function(string, object):boolean} [options.data] - Optional
* predicate function for testing if a data set's input should be included
* in the exported state. If unspecified, all data sets that have been
* explicitly modified will be included.
* @param {boolean} [options.recurse=true] - Flag indicating if the exported
* state should recursively include state from group mark sub-contexts.
* @return {object} - An object containing the exported state values.
*/
function getState$1(options) {
return this._runtime.getState(options || {
data: dataTest,
signals: signalTest,
recurse: true
});
}
function dataTest(name, data) {
return data.modified
&& isArray(data.input.value)
&& name.indexOf('_:vega:_');
}
function signalTest(name, op) {
return !(name === 'parent' || op instanceof transforms.Proxy);
}
/**
* Sets the current view state and updates the view by invoking run.
* @param {object} state - A state object containing signal and/or
* data set values, following the format used by the getState method.
* @return {View} - This view instance.
*/
function setState$1(state) {
var view = this;
view._trigger = false;
view._runtime.setState(state);
view.run().runAfter(function() { view._trigger = true; });
return this;
}
/**
* Create a new View instance from a Vega dataflow runtime specification.
* The generated View will not immediately be ready for display. Callers
* should also invoke the initialize method (e.g., to set the parent
* DOM element in browser-based deployment) and then invoke the run
* method to evaluate the dataflow graph. Rendering will automatically
* be peformed upon dataflow runs.
* @constructor
* @param {object} spec - The Vega dataflow runtime specification.
*/
function View(spec, options) {
options = options || {};
Dataflow.call(this);
this.loader(options.loader || this._loader);
this.logLevel(options.logLevel || 0);
this._el = null;
this._renderType = options.renderer || RenderType.Canvas;
this._scenegraph = new Scenegraph();
var root = this._scenegraph.root;
// initialize renderer and render queue
this._renderer = null;
this._queue = null;
// initialize handler and event management
this._handler = new CanvasHandler().scene(root);
this._eventListeners = [];
this._preventDefault = true;
// initialize dataflow graph
var ctx = runtime(this, spec, options.functions);
this._runtime = ctx;
this._signals = ctx.signals;
this._bind = (spec.bindings || [])
.map(function(_) { return {state: null, param: _}; });
// initialize scenegraph
if (ctx.root) ctx.root.set(root);
root.source = ctx.data.root.input;
this.pulse(
ctx.data.root.input,
this.changeset().insert(root.items)
);
// initialize background color
this._background = ctx.background || null;
// initialize view size
this._width = this.width();
this._height = this.height();
this._origin = [0, 0];
this._resize = 0;
this._autosize = 1;
// initialize resize operators
this._resizeWidth = resizer(this, 'width');
this._resizeHeight = resizer(this, 'height');
// initialize cursor
cursor(this);
}
var prototype$69 = inherits(View, Dataflow);
// -- DATAFLOW / RENDERING ----
prototype$69.run = function(encode) {
Dataflow.prototype.run.call(this, encode);
var q = this._queue;
if (this._resize || !q || q.length) {
this.render(q);
this._queue = [];
}
return this;
};
prototype$69.render = function(update) {
if (this._renderer) {
if (this._resize) this._resize = 0, resizeRenderer(this);
this._renderer.render(this._scenegraph.root, update);
}
return this;
};
prototype$69.enqueue = function(items) {
if (this._queue && items && items.length) {
this._queue = this._queue.concat(items);
}
};
// -- GET / SET ----
function lookupSignal(view, name) {
return view._signals.hasOwnProperty(name)
? view._signals[name]
: view.error('Unrecognized signal name: ' + $(name));
}
prototype$69.signal = function(name, value, options) {
var op = lookupSignal(this, name);
return arguments.length === 1
? op.value
: this.update(op, value, options);
};
prototype$69.scenegraph = function() {
return this._scenegraph;
};
prototype$69.background = function(_) {
return arguments.length ? (this._background = _, this._resize = 1, this) : this._background;
};
prototype$69.width = function(_) {
return arguments.length ? this.signal('width', _) : this.signal('width');
};
prototype$69.height = function(_) {
return arguments.length ? this.signal('height', _) : this.signal('height');
};
prototype$69.padding = function(_) {
return arguments.length ? this.signal('padding', _) : this.signal('padding');
};
prototype$69.renderer = function(type) {
if (!arguments.length) return this._renderType;
if (!renderModule(type)) this.error('Unrecognized renderer type: ' + type);
if (type !== this._renderType) {
this._renderType = type;
if (this._renderer) {
this._renderer = this._queue = null;
this.initialize(this._el);
}
}
return this;
};
// -- EVENT HANDLING ----
prototype$69.addEventListener = function(type, handler) {
this._handler.on(type, handler);
};
prototype$69.removeEventListener = function(type, handler) {
this._handler.off(type, handler);
};
prototype$69.addSignalListener = function(name, handler) {
var s = lookupSignal(this, name),
h = function() { handler(name, s.value); };
this.on(s, null, (h.handler = handler, h));
};
prototype$69.removeSignalListener = function(name, handler) {
var s = lookupSignal(this, name),
t = s._targets || [],
h = t.filter(function(op) {
var u = op._update;
return u && u.handler === handler;
});
if (h.length) t.remove(h[0]);
};
prototype$69.preventDefault = function(_) {
return arguments.length ? (this._preventDefault = _, this) : this._preventDefault;
};
prototype$69.tooltipHandler = function(_) {
var h = this._handler;
return !arguments.length ? h.handleTooltip
: (h.handleTooltip = (_ || Handler.prototype.handleTooltip), this);
};
prototype$69.events = events$1;
prototype$69.finalize = finalize;
prototype$69.hover = hover;
// -- SIZING ----
prototype$69.autosize = autosize;
// -- DATA ----
prototype$69.data = data;
prototype$69.change = change;
prototype$69.insert = insert;
prototype$69.remove = remove;
// -- INITIALIZATION ----
prototype$69.initialize = initialize$1;
// -- HEADLESS RENDERING ----
prototype$69.toImageURL = renderToImageURL;
prototype$69.toCanvas = renderToCanvas;
prototype$69.toSVG = renderToSVG;
// -- SAVE / RESTORE STATE ----
prototype$69.getState = getState$1;
prototype$69.setState = setState$1;
transform('Bound', Bound);
transform('Mark', Mark);
transform('Render', Render);
transform('ViewLayout', ViewLayout);
/* eslint-disable no-unused-vars */
exports.version = version;
exports.Dataflow = Dataflow;
exports.EventStream = EventStream;
exports.Parameters = Parameters;
exports.Pulse = Pulse;
exports.MultiPulse = MultiPulse;
exports.Operator = Operator;
exports.Transform = Transform;
exports.changeset = changeset;
exports.ingest = ingest;
exports.register = register;
exports.definition = definition;
exports.definitions = definitions;
exports.transform = transform;
exports.transforms = transforms;
exports.tupleid = tupleid;
exports.scale = scale$1;
exports.scheme = getScheme;
exports.interpolate = getInterpolate;
exports.interpolateRange = interpolateRange;
exports.projection = projection$1;
exports.View = View;
exports.parse = parse$2;
exports.expressionFunction = expressionFunction;
exports.formatLocale = defaultLocale$1;
exports.timeFormatLocale = defaultLocale;
exports.runtime = parseDataflow;
exports.runtimeContext = context$2;
exports.bin = bin$1;
exports.bootstrapCI = bootstrapCI;
exports.randomInteger = integer;
exports.randomKDE = randomKDE;
exports.randomMixture = randomMixture;
exports.randomNormal = randomNormal;
exports.randomUniform = randomUniform;
exports.quartiles = quartiles;
exports.accessor = accessor;
exports.accessorName = accessorName;
exports.accessorFields = accessorFields;
exports.id = id;
exports.identity = identity$1;
exports.zero = zero;
exports.one = one;
exports.truthy = truthy;
exports.falsy = falsy;
exports.logger = logger;
exports.None = None;
exports.Warn = Warn;
exports.Info = Info;
exports.Debug = Debug;
exports.array = array$1;
exports.compare = compare;
exports.constant = constant$1;
exports.error = error;
exports.extend = extend;
exports.extentIndex = extentIndex;
exports.fastmap = fastmap;
exports.field = field;
exports.inherits = inherits;
exports.isArray = isArray;
exports.isFunction = isFunction;
exports.isNumber = isNumber;
exports.isObject = isObject;
exports.isString = isString;
exports.key = key;
exports.merge = merge$1;
exports.pad = pad;
exports.peek = peek;
exports.repeat = repeat;
exports.splitAccessPath = splitAccessPath;
exports.stringValue = $;
exports.toSet = toSet;
exports.truncate = truncate;
exports.visitArray = visitArray;
exports.loader = loader;
exports.read = read;
exports.inferType = inferType;
exports.inferTypes = inferTypes;
exports.typeParsers = typeParsers;
exports.formats = formats$1;
exports.Bounds = Bounds;
exports.Gradient = Gradient;
exports.GroupItem = GroupItem;
exports.ResourceLoader = ResourceLoader;
exports.Item = Item;
exports.Scenegraph = Scenegraph;
exports.Handler = Handler;
exports.Renderer = Renderer;
exports.CanvasHandler = CanvasHandler;
exports.CanvasRenderer = CanvasRenderer;
exports.SVGHandler = SVGHandler;
exports.SVGRenderer = SVGRenderer;
exports.SVGStringRenderer = SVGStringRenderer;
exports.RenderType = RenderType;
exports.renderModule = renderModule;
exports.Marks = Marks;
exports.boundContext = context;
exports.boundStroke = boundStroke;
exports.boundItem = boundItem;
exports.boundMark = boundMark;
exports.pathCurves = curves;
exports.pathSymbols = symbols$1;
exports.pathRectangle = vg_rect;
exports.pathTrail = vg_trail;
exports.pathParse = pathParse;
exports.pathRender = pathRender;
exports.point = point$4;
exports.canvas = Canvas$1;
exports.domCreate = domCreate;
exports.domFind = domFind;
exports.domChild = domChild;
exports.domClear = domClear;
exports.openTag = openTag;
exports.closeTag = closeTag;
exports.font = font;
exports.textMetrics = textMetrics;
exports.sceneEqual = sceneEqual;
exports.pathEqual = pathEqual;
exports.sceneToJSON = sceneToJSON;
exports.sceneFromJSON = sceneFromJSON;
exports.sceneZOrder = zorder;
exports.sceneVisit = visit;
exports.scenePickVisit = pickVisit;
Object.defineProperty(exports, '__esModule', { value: true });
})));
|
js/app.js
|
orionwei/mygit
|
import 'babel-polyfill';
import Index from './components/index';
import AppHomeRoute from './routes/AppHomeRoute';
import React from 'react';
import ReactDOM from 'react-dom';
import Relay from 'react-relay';
ReactDOM.render(
<Relay.Renderer
environment={Relay.Store}
Container={Index}
queryConfig={new AppHomeRoute()}
/>,
document.getElementById('root')
);
|
tests/client/admin/components/TestSearchResult.js
|
squarewave/addons-frontend
|
import React from 'react';
import { renderIntoDocument } from 'react-addons-test-utils';
import AdminSearchResult from 'admin/components/SearchResult';
describe('<AdminSearchResult />', () => {
const result = {
name: 'A search result',
type: 'Extension',
slug: 'a-search-result',
status: 'Fully Reviewed',
current_version: {
files: [{}, {}],
},
};
const root = renderIntoDocument(<AdminSearchResult addon={result} />);
it('renders the name', () => {
assert.equal(root.name.props.children, 'A search result');
});
it('renders the type', () => {
assert.equal(root.type.textContent, 'Extension');
});
it('renders the status', () => {
assert.equal(root.status.textContent, 'Fully Reviewed');
});
it('renders the number of files', () => {
assert.equal(root.fileCount.textContent, '2 files');
});
it('outputs zero if no files exist', () => {
const thisResult = { ...result, current_version: { } };
const thisRoot = renderIntoDocument(
<AdminSearchResult addon={thisResult} />);
assert.equal(thisRoot.fileCount.textContent, '0 files');
});
it('links to the detail page', () => {
assert.equal(root.name.props.to, '/search/addons/a-search-result');
});
it('renders the number of files singularly', () => {
const thisResult = { ...result, current_version: { files: [{}] } };
const thisRoot = renderIntoDocument(
<AdminSearchResult addon={thisResult} />);
assert.equal(thisRoot.fileCount.textContent, '1 file');
});
});
|
app/js/pages/Page1.js
|
catxuxiang/amt-starter-kit
|
import React from 'react';
import {
Container,
Group,
} from 'amazeui-touch';
const Page1 = React.createClass({
getInitialState: function() {
return {
result: null,
};
},
componentDidMount: function() {
let nocache = require('superagent-no-cache');
let request = require('superagent');
request
.get("http://192.168.0.105:6699/mysql")
.use(nocache)
.withCredentials()
.end(function(err, res){
if (err != null) {
alert(err);
} else {
if (this.isMounted()) {
this.setState({
result: JSON.parse(res.text)
});
}
}
}.bind(this));
},
render() {
if (this.state.result == null) {
return (
<Container {...this.props}>
<Group>
</Group>
</Container>
);
} else {
var repos = this.state.result;
var repoList = repos.map(function (repo) {
return (
<div>
<h2>{ repo.id }</h2>
<p>{ repo.comment }</p>
</div>
);
});
return (
<Container {...this.props}>
<Group>
{repoList}
</Group>
</Container>
);
}
},
});
export default Page1;
|
src/components/Feedback/Feedback.js
|
victoryancn/react-starter-kit
|
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
import React from 'react';
import styles from './Feedback.css';
import withStyles from '../../decorators/withStyles';
@withStyles(styles)
class Feedback {
render() {
return (
<div className="Feedback">
<div className="Feedback-container">
<a className="Feedback-link" href="https://gitter.im/kriasoft/react-starter-kit">Ask a question</a>
<span className="Feedback-spacer">|</span>
<a className="Feedback-link" href="https://github.com/kriasoft/react-starter-kit/issues/new">Report an issue</a>
</div>
</div>
);
}
}
export default Feedback;
|
src/component/TableRowComponent.js
|
NHAAHNA/hms
|
import React from 'react';
export class TableRow extends React.Component {
constructor(props){
super(props);
console.log("TableRow -> constructor -> ",this.props)
}
render() {
return (
<tr>
<td>{this.props.data.username}</td>
<td>{this.props.data.name}</td>
<td>{this.props.data.emailId}</td>
<td>{this.props.data.contactNumber}</td>
</tr>
);
}
}
|
ajax/libs/rxjs/3.1.1/rx.lite.extras.js
|
hare1039/cdnjs
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (factory) {
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;
// Because of build optimizers
if (typeof define === 'function' && define.amd) {
define(['./rx.lite'], function (Rx, exports) {
return factory(root, exports, Rx);
});
} else if (typeof module === 'object' && module && module.exports === freeExports) {
module.exports = factory(root, module.exports, require('rx-lite'));
} else {
root.Rx = factory(root, {}, root.Rx);
}
}.call(this, function (root, exp, Rx, undefined) {
// References
var Observable = Rx.Observable,
observableProto = Observable.prototype,
observableNever = Observable.never,
observableThrow = Observable['throw'],
AnonymousObservable = Rx.AnonymousObservable,
AnonymousObserver = Rx.AnonymousObserver,
notificationCreateOnNext = Rx.Notification.createOnNext,
notificationCreateOnError = Rx.Notification.createOnError,
notificationCreateOnCompleted = Rx.Notification.createOnCompleted,
Observer = Rx.Observer,
observerCreate = Observer.create,
Subject = Rx.Subject,
internals = Rx.internals,
helpers = Rx.helpers,
ScheduledObserver = internals.ScheduledObserver,
SerialDisposable = Rx.SerialDisposable,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
CompositeDisposable = Rx.CompositeDisposable,
RefCountDisposable = Rx.RefCountDisposable,
disposableEmpty = Rx.Disposable.empty,
immediateScheduler = Rx.Scheduler.immediate,
defaultKeySerializer = helpers.defaultKeySerializer,
addRef = Rx.internals.addRef,
identity = helpers.identity,
isPromise = helpers.isPromise,
isFunction = helpers.isFunction,
inherits = internals.inherits,
bindCallback = internals.bindCallback,
noop = helpers.noop,
isScheduler = Rx.Scheduler.isScheduler,
observableFromPromise = Observable.fromPromise,
ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError;
var errorObj = {e: {}};
var tryCatchTarget;
function tryCatcher() {
try {
return tryCatchTarget.apply(this, arguments);
} catch (e) {
errorObj.e = e;
return errorObj;
}
}
function tryCatch(fn) {
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
tryCatchTarget = fn;
return tryCatcher;
}
function thrower(e) {
throw e;
}
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler;
this.disposable = disposable;
this.isDisposed = false;
}
function scheduleItem(s, self) {
if (!self.isDisposed) {
self.isDisposed = true;
self.disposable.dispose();
}
}
ScheduledDisposable.prototype.dispose = function () {
this.scheduler.scheduleWithState(this, scheduleItem);
};
var CheckedObserver = (function (__super__) {
inherits(CheckedObserver, __super__);
function CheckedObserver(observer) {
__super__.call(this);
this._observer = observer;
this._state = 0; // 0 - idle, 1 - busy, 2 - done
}
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();
var res = tryCatch(this._observer.onNext).call(this._observer, value);
this._state = 0;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
var res = tryCatch(this._observer.onError).call(this._observer, err);
this._state = 2;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
var res = tryCatch(this._observer.onCompleted).call(this._observer);
this._state = 2;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
if (this._state === 2) { throw new Error('Observer completed'); }
if (this._state === 0) { this._state = 1; }
};
return CheckedObserver;
}(Observer));
var ObserveOnObserver = (function (__super__) {
inherits(ObserveOnObserver, __super__);
function ObserveOnObserver(scheduler, observer, cancel) {
__super__.call(this, scheduler, observer);
this._cancel = cancel;
}
ObserveOnObserver.prototype.next = function (value) {
__super__.prototype.next.call(this, value);
this.ensureActive();
};
ObserveOnObserver.prototype.error = function (e) {
__super__.prototype.error.call(this, e);
this.ensureActive();
};
ObserveOnObserver.prototype.completed = function () {
__super__.prototype.completed.call(this);
this.ensureActive();
};
ObserveOnObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this._cancel && this._cancel.dispose();
this._cancel = null;
};
return ObserveOnObserver;
})(ScheduledObserver);
/**
* 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); };
/**
* 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);
};
/**
* 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) {
var handlerFunc = bindCallback(handler, thisArg, 1);
return new AnonymousObserver(function (x) {
return handlerFunc(notificationCreateOnNext(x));
}, function (e) {
return handlerFunc(notificationCreateOnError(e));
}, function () {
return handlerFunc(notificationCreateOnCompleted());
});
};
/**
* 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 () {
var source = this;
return new AnonymousObserver(
function (x) { source.onNext(x); },
function (e) { source.onError(e); },
function () { source.onCompleted(); }
);
};
/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/
observableProto.observeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(new ObserveOnObserver(scheduler, observer));
}, source);
};
/**
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
d.setDisposable(m);
m.setDisposable(scheduler.schedule(function () {
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
}));
return d;
}, source);
};
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (o) {
var first = true;
return scheduler.scheduleRecursiveWithState(initialState, function (state, self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
hasResult && (result = resultSelector(state));
} catch (e) {
return o.onError(e);
}
if (hasResult) {
o.onNext(result);
self(state);
} else {
o.onCompleted();
}
});
});
};
/**
* 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 (o) {
var disposable = disposableEmpty;
var resource = tryCatch(resourceFactory)();
if (resource === errorObj) {
return new CompositeDisposable(observableThrow(resource.e).subscribe(o), disposable);
}
resource && (disposable = resource);
var source = tryCatch(observableFactory)(resource);
if (source === errorObj) {
return new CompositeDisposable(observableThrow(source.e).subscribe(o), disposable);
}
return new CompositeDisposable(source.subscribe(o), 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();
}
}
var leftSubscribe = observerCreate(
function (left) {
choiceL();
choice === leftChoice && observer.onNext(left);
},
function (e) {
choiceL();
choice === leftChoice && observer.onError(e);
},
function () {
choiceL();
choice === leftChoice && observer.onCompleted();
}
);
var rightSubscribe = observerCreate(
function (right) {
choiceR();
choice === rightChoice && observer.onNext(right);
},
function (e) {
choiceR();
choice === rightChoice && observer.onError(e);
},
function () {
choiceR();
choice === rightChoice && observer.onCompleted();
}
);
leftSubscription.setDisposable(leftSource.subscribe(leftSubscribe));
rightSubscription.setDisposable(rightSource.subscribe(rightSubscribe));
return new CompositeDisposable(leftSubscription, rightSubscription);
});
};
function amb(p, c) { return p.amb(c); }
/**
* Propagates the observable sequence or Promise that reacts first.
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/
Observable.amb = function () {
var acc = observableNever(), items;
if (Array.isArray(arguments[0])) {
items = arguments[0];
} else {
var len = arguments.length;
items = new Array(items);
for(var i = 0; i < len; i++) { items[i] = arguments[i]; }
}
for (var i = 0, len = items.length; i < len; i++) {
acc = amb(acc, items[i]);
}
return acc;
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
* @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.
* @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
*/
observableProto.onErrorResumeNext = function (second) {
if (!second) { throw new Error('Second observable is required'); }
return onErrorResumeNext([this, second]);
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs);
* 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]);
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
var onErrorResumeNext = Observable.onErrorResumeNext = function () {
var sources = [];
if (Array.isArray(arguments[0])) {
sources = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
}
return new AnonymousObservable(function (observer) {
var pos = 0, subscription = new SerialDisposable(),
cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, d;
if (pos < sources.length) {
current = sources[pos++];
isPromise(current) && (current = observableFromPromise(current));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(observer.onNext.bind(observer), self, self));
} else {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, cancelable);
});
};
function toArray(x) { return x.toArray(); }
function notEmpty(x) { return x.length > 0; }
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
* @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) {
typeof skip !== 'number' && (skip = count);
return this.windowWithCount(count, skip)
.flatMap(toArray)
.filter(notEmpty);
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
*
* var res = xs.windowWithCount(10);
* var res = xs.windowWithCount(10, 1);
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithCount = function (count, skip) {
var source = this;
+count || (count = 0);
Math.abs(count) === Infinity && (count = 0);
if (count <= 0) { throw new ArgumentOutOfRangeError(); }
skip == null && (skip = count);
+skip || (skip = 0);
Math.abs(skip) === Infinity && (skip = 0);
if (skip <= 0) { throw new ArgumentOutOfRangeError(); }
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [];
function createWindow () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
}
createWindow();
m.setDisposable(source.subscribe(
function (x) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
var c = n - count + 1;
c >= 0 && c % skip === 0 && q.shift().onCompleted();
++n % skip === 0 && createWindow();
},
function (e) {
while (q.length > 0) { q.shift().onError(e); }
observer.onError(e);
},
function () {
while (q.length > 0) { q.shift().onCompleted(); }
observer.onCompleted();
}
));
return refCountDisposable;
}, source);
};
/**
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, function (e) { o.onError(e); }, function () {
o.onNext(q);
o.onCompleted();
});
}, source);
};
/**
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
*
* var res = obs = xs.defaultIfEmpty();
* 2 - obs = xs.defaultIfEmpty(false);
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/
observableProto.defaultIfEmpty = function (defaultValue) {
var source = this;
defaultValue === undefined && (defaultValue = null);
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
},
function (e) { observer.onError(e); },
function () {
!found && observer.onNext(defaultValue);
observer.onCompleted();
});
}, source);
};
// Swap out for Array.findIndex
function arrayIndexOfComparer(array, item, comparer) {
for (var i = 0, len = array.length; i < len; i++) {
if (comparer(array[i], item)) { return i; }
}
return -1;
}
function HashSet(comparer) {
this.comparer = comparer;
this.set = [];
}
HashSet.prototype.push = function(value) {
var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1;
retValue && this.set.push(value);
return retValue;
};
/**
* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @example
* var res = obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; });
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [comparer] Used to compare items in the collection.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/
observableProto.distinct = function (keySelector, comparer) {
var source = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (o) {
var hashSet = new HashSet(comparer);
return source.subscribe(function (x) {
var key = x;
if (keySelector) {
try {
key = keySelector(x);
} catch (e) {
o.onError(e);
return;
}
}
hashSet.push(key) && o.onNext(x);
},
function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence. This observable sequence
* can be resubscribed to, even if all prior subscriptions have ended. (unlike `.publish().refCount()`)
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source.
*/
observableProto.singleInstance = function() {
var source = this, hasObservable = false, observable;
function getObservable() {
if (!hasObservable) {
hasObservable = true;
observable = source.finally(function() { hasObservable = false; }).publish().refCount();
}
return observable;
};
return new AnonymousObservable(function(o) {
return getObservable().subscribe(o);
});
};
return Rx;
}));
|
packages/material-ui-icons/src/ArrowDropUp.js
|
AndriusBil/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
let ArrowDropUp = props =>
<SvgIcon {...props}>
<path d="M7 14l5-5 5 5z" />
</SvgIcon>;
ArrowDropUp = pure(ArrowDropUp);
ArrowDropUp.muiName = 'SvgIcon';
export default ArrowDropUp;
|
js/components/AdminMenu.js
|
nathanjameshill/ReefWatchPrototype
|
import React from 'react'
import $ from 'jquery'
import { Button, Navbar, NavItem, Nav, Glyphicon } from 'react-bootstrap'
var AdminMenu = React.createClass({
closePanel: function () {
$("div.contentPage").animate({
left: '100%'
});
},
render() {
return (
<Navbar>
<Navbar.Header>
<Navbar.Brand>
Administration
</Navbar.Brand>
</Navbar.Header>
<Nav>
<NavItem eventKey={1} href="#/observation">Observation</NavItem>
</Nav>
</Navbar>
)
}
});
module.exports = AdminMenu;
|
src/components/Modal/Modal.js
|
jmlweb/paskman
|
import React from 'react';
import PT from 'prop-types';
import styled, { css } from 'styled-components';
import styledMap from 'styled-map';
import Heading from '../Heading/Heading';
import ModalBtn from './ModalBtn/ModalBtn';
import colors from '../../styles/colors';
import spacing from '../../styles/spacing';
import timings from '../../styles/timings';
import topBarHeight from '../../styles/topBarHeight';
const activeModalStyle = css`
border-radius: 0;
bottom: 0;
left: 0;
opacity: 1;
right: 0;
top: 0;
z-index: 99;
transform: translateY(0);
transition: all 0.3s ${timings.easeOutBack};
`;
const inactiveModalStyle = css`
border-radius: 50%;
bottom: 50%;
left: 50%;
opacity: 0;
right: 50%;
top: 50%;
transition: all 0.3s ${timings.easeInBack};
transform: translateY(-25vh);
z-index: 1;
`;
const StyledModal = styled.div`
background: #fff;
overflow: hidden;
position: fixed;
box-shadow: 0 0 8px ${colors.blackA3};
${styledMap({
isOpen: activeModalStyle,
default: inactiveModalStyle,
})};
`;
const ModalBar = styled.div`
align-items: center;
background: ${colors.primary};
color: ${colors.secondary};
display: flex;
height: ${topBarHeight};
justify-content: space-between;
padding: 0 ${spacing.sm};
`;
const ModalHeading = styled(Heading)`
&& {
margin: 0;
}
`;
const ModalContent = styled.div`
padding: ${spacing.md} ${spacing.sm};
`;
const Modal = ({
isOpen,
title,
handleClose,
children,
}) => (
<StyledModal isOpen={isOpen}>
<ModalBar>
<ModalHeading weight="700">{title}</ModalHeading>
<ModalBtn handleClick={handleClose} />
</ModalBar>
<ModalContent>{children}</ModalContent>
</StyledModal>
);
Modal.propTypes = {
isOpen: PT.bool,
title: PT.string.isRequired,
handleClose: PT.func.isRequired,
children: PT.node.isRequired,
};
Modal.defaultProps = {
isOpen: false,
};
export default Modal;
|
ajax/libs/vue/2.4.0/vue.runtime.common.js
|
sashberd/cdnjs
|
/*!
* Vue.js v2.4.0
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
'use strict';
/* */
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
function isUndef (v) {
return v === undefined || v === null
}
function isDef (v) {
return v !== undefined && v !== null
}
function isTrue (v) {
return v === true
}
function isFalse (v) {
return v === false
}
/**
* Check if value is primitive
*/
function isPrimitive (value) {
return typeof value === 'string' || typeof value === 'number'
}
/**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.
*/
function isObject (obj) {
return obj !== null && typeof obj === 'object'
}
var _toString = Object.prototype.toString;
/**
* Strict object type check. Only returns true
* for plain JavaScript objects.
*/
function isPlainObject (obj) {
return _toString.call(obj) === '[object Object]'
}
function isRegExp (v) {
return _toString.call(v) === '[object RegExp]'
}
/**
* Check if val is a valid array index.
*/
function isValidArrayIndex (val) {
var n = parseFloat(val);
return n >= 0 && Math.floor(n) === n && isFinite(val)
}
/**
* Convert a value to a string that is actually rendered.
*/
function toString (val) {
return val == null
? ''
: typeof val === 'object'
? JSON.stringify(val, null, 2)
: String(val)
}
/**
* Convert a input value to a number for persistence.
* If the conversion fails, return original string.
*/
function toNumber (val) {
var n = parseFloat(val);
return isNaN(n) ? val : n
}
/**
* Make a map and return a function for checking if a key
* is in that map.
*/
function makeMap (
str,
expectsLowerCase
) {
var map = Object.create(null);
var list = str.split(',');
for (var i = 0; i < list.length; i++) {
map[list[i]] = true;
}
return expectsLowerCase
? function (val) { return map[val.toLowerCase()]; }
: function (val) { return map[val]; }
}
/**
* Check if a tag is a built-in tag.
*/
var isBuiltInTag = makeMap('slot,component', true);
/**
* Check if a attribute is a reserved attribute.
*/
var isReservedAttribute = makeMap('key,ref,slot,is');
/**
* Remove an item from an array
*/
function remove (arr, item) {
if (arr.length) {
var index = arr.indexOf(item);
if (index > -1) {
return arr.splice(index, 1)
}
}
}
/**
* Check whether the object has the property.
*/
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn (obj, key) {
return hasOwnProperty.call(obj, key)
}
/**
* Create a cached version of a pure function.
*/
function cached (fn) {
var cache = Object.create(null);
return (function cachedFn (str) {
var hit = cache[str];
return hit || (cache[str] = fn(str))
})
}
/**
* Camelize a hyphen-delimited string.
*/
var camelizeRE = /-(\w)/g;
var camelize = cached(function (str) {
return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
});
/**
* Capitalize a string.
*/
var capitalize = cached(function (str) {
return str.charAt(0).toUpperCase() + str.slice(1)
});
/**
* Hyphenate a camelCase string.
*/
var hyphenateRE = /([^-])([A-Z])/g;
var hyphenate = cached(function (str) {
return str
.replace(hyphenateRE, '$1-$2')
.replace(hyphenateRE, '$1-$2')
.toLowerCase()
});
/**
* Simple bind, faster than native
*/
function bind (fn, ctx) {
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
// record original fn length
boundFn._length = fn.length;
return boundFn
}
/**
* Convert an Array-like object to a real Array.
*/
function toArray (list, start) {
start = start || 0;
var i = list.length - start;
var ret = new Array(i);
while (i--) {
ret[i] = list[i + start];
}
return ret
}
/**
* Mix properties into target object.
*/
function extend (to, _from) {
for (var key in _from) {
to[key] = _from[key];
}
return to
}
/**
* Merge an Array of Objects into a single Object.
*/
function toObject (arr) {
var res = {};
for (var i = 0; i < arr.length; i++) {
if (arr[i]) {
extend(res, arr[i]);
}
}
return res
}
/**
* Perform no operation.
* Stubbing args to make Flow happy without leaving useless transpiled code
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
*/
function noop (a, b, c) {}
/**
* Always return false.
*/
var no = function (a, b, c) { return false; };
/**
* Return same value
*/
var identity = function (_) { return _; };
/**
* Generate a static keys string from compiler modules.
*/
/**
* Check if two values are loosely equal - that is,
* if they are plain objects, do they have the same shape?
*/
function looseEqual (a, b) {
var isObjectA = isObject(a);
var isObjectB = isObject(b);
if (isObjectA && isObjectB) {
try {
return JSON.stringify(a) === JSON.stringify(b)
} catch (e) {
// possible circular reference
return a === b
}
} else if (!isObjectA && !isObjectB) {
return String(a) === String(b)
} else {
return false
}
}
function looseIndexOf (arr, val) {
for (var i = 0; i < arr.length; i++) {
if (looseEqual(arr[i], val)) { return i }
}
return -1
}
/**
* Ensure a function is called only once.
*/
function once (fn) {
var called = false;
return function () {
if (!called) {
called = true;
fn.apply(this, arguments);
}
}
}
var SSR_ATTR = 'data-server-rendered';
var ASSET_TYPES = [
'component',
'directive',
'filter'
];
var LIFECYCLE_HOOKS = [
'beforeCreate',
'created',
'beforeMount',
'mounted',
'beforeUpdate',
'updated',
'beforeDestroy',
'destroyed',
'activated',
'deactivated'
];
/* */
var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
optionMergeStrategies: Object.create(null),
/**
* Whether to suppress warnings.
*/
silent: false,
/**
* Show production mode tip message on boot?
*/
productionTip: process.env.NODE_ENV !== 'production',
/**
* Whether to enable devtools
*/
devtools: process.env.NODE_ENV !== 'production',
/**
* Whether to record perf
*/
performance: false,
/**
* Error handler for watcher errors
*/
errorHandler: null,
/**
* Warn handler for watcher warns
*/
warnHandler: null,
/**
* Ignore certain custom elements
*/
ignoredElements: [],
/**
* Custom user key aliases for v-on
*/
keyCodes: Object.create(null),
/**
* Check if a tag is reserved so that it cannot be registered as a
* component. This is platform-dependent and may be overwritten.
*/
isReservedTag: no,
/**
* Check if an attribute is reserved so that it cannot be used as a component
* prop. This is platform-dependent and may be overwritten.
*/
isReservedAttr: no,
/**
* Check if a tag is an unknown element.
* Platform-dependent.
*/
isUnknownElement: no,
/**
* Get the namespace of an element
*/
getTagNamespace: noop,
/**
* Parse the real tag name for the specific platform.
*/
parsePlatformTagName: identity,
/**
* Check if an attribute must be bound using property, e.g. value
* Platform-dependent.
*/
mustUseProp: no,
/**
* Exposed for legacy reasons
*/
_lifecycleHooks: LIFECYCLE_HOOKS
});
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
function isReserved (str) {
var c = (str + '').charCodeAt(0);
return c === 0x24 || c === 0x5F
}
/**
* Define a property.
*/
function def (obj, key, val, enumerable) {
Object.defineProperty(obj, key, {
value: val,
enumerable: !!enumerable,
writable: true,
configurable: true
});
}
/**
* Parse simple path.
*/
var bailRE = /[^\w.$]/;
function parsePath (path) {
if (bailRE.test(path)) {
return
}
var segments = path.split('.');
return function (obj) {
for (var i = 0; i < segments.length; i++) {
if (!obj) { return }
obj = obj[segments[i]];
}
return obj
}
}
/* */
var warn = noop;
var tip = noop;
var formatComponentName = (null); // work around flow check
if (process.env.NODE_ENV !== 'production') {
var hasConsole = typeof console !== 'undefined';
var classifyRE = /(?:^|[-_])(\w)/g;
var classify = function (str) { return str
.replace(classifyRE, function (c) { return c.toUpperCase(); })
.replace(/[-_]/g, ''); };
warn = function (msg, vm) {
var trace = vm ? generateComponentTrace(vm) : '';
if (config.warnHandler) {
config.warnHandler.call(null, msg, vm, trace);
} else if (hasConsole && (!config.silent)) {
console.error(("[Vue warn]: " + msg + trace));
}
};
tip = function (msg, vm) {
if (hasConsole && (!config.silent)) {
console.warn("[Vue tip]: " + msg + (
vm ? generateComponentTrace(vm) : ''
));
}
};
formatComponentName = function (vm, includeFile) {
if (vm.$root === vm) {
return '<Root>'
}
var name = typeof vm === 'string'
? vm
: typeof vm === 'function' && vm.options
? vm.options.name
: vm._isVue
? vm.$options.name || vm.$options._componentTag
: vm.name;
var file = vm._isVue && vm.$options.__file;
if (!name && file) {
var match = file.match(/([^/\\]+)\.vue$/);
name = match && match[1];
}
return (
(name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
(file && includeFile !== false ? (" at " + file) : '')
)
};
var repeat = function (str, n) {
var res = '';
while (n) {
if (n % 2 === 1) { res += str; }
if (n > 1) { str += str; }
n >>= 1;
}
return res
};
var generateComponentTrace = function (vm) {
if (vm._isVue && vm.$parent) {
var tree = [];
var currentRecursiveSequence = 0;
while (vm) {
if (tree.length > 0) {
var last = tree[tree.length - 1];
if (last.constructor === vm.constructor) {
currentRecursiveSequence++;
vm = vm.$parent;
continue
} else if (currentRecursiveSequence > 0) {
tree[tree.length - 1] = [last, currentRecursiveSequence];
currentRecursiveSequence = 0;
}
}
tree.push(vm);
vm = vm.$parent;
}
return '\n\nfound in\n\n' + tree
.map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
: formatComponentName(vm))); })
.join('\n')
} else {
return ("\n\n(found in " + (formatComponentName(vm)) + ")")
}
};
}
/* */
function handleError (err, vm, info) {
if (config.errorHandler) {
config.errorHandler.call(null, err, vm, info);
} else {
if (process.env.NODE_ENV !== 'production') {
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
console.error(err);
} else {
throw err
}
}
}
/* */
/* globals MutationObserver */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefix has a "watch" function on Object.prototype...
var nativeWatch = ({}).watch;
var supportsPassive = false;
if (inBrowser) {
try {
var opts = {};
Object.defineProperty(opts, 'passive', ({
get: function get () {
/* istanbul ignore next */
supportsPassive = true;
}
})); // https://github.com/facebook/flow/issues/285
window.addEventListener('test-passive', null, opts);
} catch (e) {}
}
// this needs to be lazy-evaled because vue may be required before
// vue-server-renderer can set VUE_ENV
var _isServer;
var isServerRendering = function () {
if (_isServer === undefined) {
/* istanbul ignore if */
if (!inBrowser && typeof global !== 'undefined') {
// detect presence of vue-server-renderer and avoid
// Webpack shimming the process
_isServer = global['process'].env.VUE_ENV === 'server';
} else {
_isServer = false;
}
}
return _isServer
};
// detect devtools
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
/* istanbul ignore next */
function isNative (Ctor) {
return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
}
var hasSymbol =
typeof Symbol !== 'undefined' && isNative(Symbol) &&
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
/**
* Defer a task to execute it asynchronously.
*/
var nextTick = (function () {
var callbacks = [];
var pending = false;
var timerFunc;
function nextTickHandler () {
pending = false;
var copies = callbacks.slice(0);
callbacks.length = 0;
for (var i = 0; i < copies.length; i++) {
copies[i]();
}
}
// the nextTick behavior leverages the microtask queue, which can be accessed
// via either native Promise.then or MutationObserver.
// MutationObserver has wider support, however it is seriously bugged in
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
// completely stops working after triggering a few times... so, if native
// Promise is available, we will use it:
/* istanbul ignore if */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
var p = Promise.resolve();
var logError = function (err) { console.error(err); };
timerFunc = function () {
p.then(nextTickHandler).catch(logError);
// in problematic UIWebViews, Promise.then doesn't completely break, but
// it can get stuck in a weird state where callbacks are pushed into the
// microtask queue but the queue isn't being flushed, until the browser
// needs to do some other work, e.g. handle a timer. Therefore we can
// "force" the microtask queue to be flushed by adding an empty timer.
if (isIOS) { setTimeout(noop); }
};
} else if (typeof MutationObserver !== 'undefined' && (
isNative(MutationObserver) ||
// PhantomJS and iOS 7.x
MutationObserver.toString() === '[object MutationObserverConstructor]'
)) {
// use MutationObserver where native Promise is not available,
// e.g. PhantomJS IE11, iOS7, Android 4.4
var counter = 1;
var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(String(counter));
observer.observe(textNode, {
characterData: true
});
timerFunc = function () {
counter = (counter + 1) % 2;
textNode.data = String(counter);
};
} else {
// fallback to setTimeout
/* istanbul ignore next */
timerFunc = function () {
setTimeout(nextTickHandler, 0);
};
}
return function queueNextTick (cb, ctx) {
var _resolve;
callbacks.push(function () {
if (cb) {
try {
cb.call(ctx);
} catch (e) {
handleError(e, ctx, 'nextTick');
}
} else if (_resolve) {
_resolve(ctx);
}
});
if (!pending) {
pending = true;
timerFunc();
}
if (!cb && typeof Promise !== 'undefined') {
return new Promise(function (resolve, reject) {
_resolve = resolve;
})
}
}
})();
var _Set;
/* istanbul ignore if */
if (typeof Set !== 'undefined' && isNative(Set)) {
// use native Set when available.
_Set = Set;
} else {
// a non-standard Set polyfill that only works with primitive keys.
_Set = (function () {
function Set () {
this.set = Object.create(null);
}
Set.prototype.has = function has (key) {
return this.set[key] === true
};
Set.prototype.add = function add (key) {
this.set[key] = true;
};
Set.prototype.clear = function clear () {
this.set = Object.create(null);
};
return Set;
}());
}
/* */
var uid$1 = 0;
/**
* A dep is an observable that can have multiple
* directives subscribing to it.
*/
var Dep = function Dep () {
this.id = uid$1++;
this.subs = [];
};
Dep.prototype.addSub = function addSub (sub) {
this.subs.push(sub);
};
Dep.prototype.removeSub = function removeSub (sub) {
remove(this.subs, sub);
};
Dep.prototype.depend = function depend () {
if (Dep.target) {
Dep.target.addDep(this);
}
};
Dep.prototype.notify = function notify () {
// stabilize the subscriber list first
var subs = this.subs.slice();
for (var i = 0, l = subs.length; i < l; i++) {
subs[i].update();
}
};
// the current target watcher being evaluated.
// this is globally unique because there could be only one
// watcher being evaluated at any time.
Dep.target = null;
var targetStack = [];
function pushTarget (_target) {
if (Dep.target) { targetStack.push(Dep.target); }
Dep.target = _target;
}
function popTarget () {
Dep.target = targetStack.pop();
}
/*
* not type checking this file because flow doesn't play well with
* dynamically accessing methods on Array prototype
*/
var arrayProto = Array.prototype;
var arrayMethods = Object.create(arrayProto);[
'push',
'pop',
'shift',
'unshift',
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var result = original.apply(this, args);
var ob = this.__ob__;
var inserted;
switch (method) {
case 'push':
case 'unshift':
inserted = args;
break
case 'splice':
inserted = args.slice(2);
break
}
if (inserted) { ob.observeArray(inserted); }
// notify change
ob.dep.notify();
return result
});
});
/* */
var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
/**
* By default, when a reactive property is set, the new value is
* also converted to become reactive. However when passing down props,
* we don't want to force conversion because the value may be a nested value
* under a frozen data structure. Converting it would defeat the optimization.
*/
var observerState = {
shouldConvert: true
};
/**
* Observer class that are attached to each observed
* object. Once attached, the observer converts target
* object's property keys into getter/setters that
* collect dependencies and dispatches updates.
*/
var Observer = function Observer (value) {
this.value = value;
this.dep = new Dep();
this.vmCount = 0;
def(value, '__ob__', this);
if (Array.isArray(value)) {
var augment = hasProto
? protoAugment
: copyAugment;
augment(value, arrayMethods, arrayKeys);
this.observeArray(value);
} else {
this.walk(value);
}
};
/**
* Walk through each property and convert them into
* getter/setters. This method should only be called when
* value type is Object.
*/
Observer.prototype.walk = function walk (obj) {
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
defineReactive$$1(obj, keys[i], obj[keys[i]]);
}
};
/**
* Observe a list of Array items.
*/
Observer.prototype.observeArray = function observeArray (items) {
for (var i = 0, l = items.length; i < l; i++) {
observe(items[i]);
}
};
// helpers
/**
* Augment an target Object or Array by intercepting
* the prototype chain using __proto__
*/
function protoAugment (target, src, keys) {
/* eslint-disable no-proto */
target.__proto__ = src;
/* eslint-enable no-proto */
}
/**
* Augment an target Object or Array by defining
* hidden properties.
*/
/* istanbul ignore next */
function copyAugment (target, src, keys) {
for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i];
def(target, key, src[key]);
}
}
/**
* Attempt to create an observer instance for a value,
* returns the new observer if successfully observed,
* or the existing observer if the value already has one.
*/
function observe (value, asRootData) {
if (!isObject(value)) {
return
}
var ob;
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
ob = value.__ob__;
} else if (
observerState.shouldConvert &&
!isServerRendering() &&
(Array.isArray(value) || isPlainObject(value)) &&
Object.isExtensible(value) &&
!value._isVue
) {
ob = new Observer(value);
}
if (asRootData && ob) {
ob.vmCount++;
}
return ob
}
/**
* Define a reactive property on an Object.
*/
function defineReactive$$1 (
obj,
key,
val,
customSetter,
shallow
) {
var dep = new Dep();
var property = Object.getOwnPropertyDescriptor(obj, key);
if (property && property.configurable === false) {
return
}
// cater for pre-defined getter/setters
var getter = property && property.get;
var setter = property && property.set;
var childOb = !shallow && observe(val);
Object.defineProperty(obj, key, {
enumerable: true,
configurable: true,
get: function reactiveGetter () {
var value = getter ? getter.call(obj) : val;
if (Dep.target) {
dep.depend();
if (childOb) {
childOb.dep.depend();
}
if (Array.isArray(value)) {
dependArray(value);
}
}
return value
},
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
if (process.env.NODE_ENV !== 'production' && customSetter) {
customSetter();
}
if (setter) {
setter.call(obj, newVal);
} else {
val = newVal;
}
childOb = !shallow && observe(newVal);
dep.notify();
}
});
}
/**
* Set a property on an object. Adds the new property and
* triggers change notification if the property doesn't
* already exist.
*/
function set (target, key, val) {
if (Array.isArray(target) && isValidArrayIndex(key)) {
target.length = Math.max(target.length, key);
target.splice(key, 1, val);
return val
}
if (hasOwn(target, key)) {
target[key] = val;
return val
}
var ob = (target).__ob__;
if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn(
'Avoid adding reactive properties to a Vue instance or its root $data ' +
'at runtime - declare it upfront in the data option.'
);
return val
}
if (!ob) {
target[key] = val;
return val
}
defineReactive$$1(ob.value, key, val);
ob.dep.notify();
return val
}
/**
* Delete a property and trigger change if necessary.
*/
function del (target, key) {
if (Array.isArray(target) && isValidArrayIndex(key)) {
target.splice(key, 1);
return
}
var ob = (target).__ob__;
if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn(
'Avoid deleting properties on a Vue instance or its root $data ' +
'- just set it to null.'
);
return
}
if (!hasOwn(target, key)) {
return
}
delete target[key];
if (!ob) {
return
}
ob.dep.notify();
}
/**
* Collect dependencies on array elements when the array is touched, since
* we cannot intercept array element access like property getters.
*/
function dependArray (value) {
for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
e = value[i];
e && e.__ob__ && e.__ob__.dep.depend();
if (Array.isArray(e)) {
dependArray(e);
}
}
}
/* */
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
* value into the final value.
*/
var strats = config.optionMergeStrategies;
/**
* Options with restrictions
*/
if (process.env.NODE_ENV !== 'production') {
strats.el = strats.propsData = function (parent, child, vm, key) {
if (!vm) {
warn(
"option \"" + key + "\" can only be used during instance " +
'creation with the `new` keyword.'
);
}
return defaultStrat(parent, child)
};
}
/**
* Helper that recursively merges two data objects together.
*/
function mergeData (to, from) {
if (!from) { return to }
var key, toVal, fromVal;
var keys = Object.keys(from);
for (var i = 0; i < keys.length; i++) {
key = keys[i];
toVal = to[key];
fromVal = from[key];
if (!hasOwn(to, key)) {
set(to, key, fromVal);
} else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
mergeData(toVal, fromVal);
}
}
return to
}
/**
* Data
*/
function mergeDataOrFn (
parentVal,
childVal,
vm
) {
if (!vm) {
// in a Vue.extend merge, both should be functions
if (!childVal) {
return parentVal
}
if (!parentVal) {
return childVal
}
// when parentVal & childVal are both present,
// we need to return a function that returns the
// merged result of both functions... no need to
// check if parentVal is a function here because
// it has to be a function to pass previous merges.
return function mergedDataFn () {
return mergeData(
typeof childVal === 'function' ? childVal.call(this) : childVal,
parentVal.call(this)
)
}
} else if (parentVal || childVal) {
return function mergedInstanceDataFn () {
// instance merge
var instanceData = typeof childVal === 'function'
? childVal.call(vm)
: childVal;
var defaultData = typeof parentVal === 'function'
? parentVal.call(vm)
: undefined;
if (instanceData) {
return mergeData(instanceData, defaultData)
} else {
return defaultData
}
}
}
}
strats.data = function (
parentVal,
childVal,
vm
) {
if (!vm) {
if (childVal && typeof childVal !== 'function') {
process.env.NODE_ENV !== 'production' && warn(
'The "data" option should be a function ' +
'that returns a per-instance value in component ' +
'definitions.',
vm
);
return parentVal
}
return mergeDataOrFn.call(this, parentVal, childVal)
}
return mergeDataOrFn(parentVal, childVal, vm)
};
/**
* Hooks and props are merged as arrays.
*/
function mergeHook (
parentVal,
childVal
) {
return childVal
? parentVal
? parentVal.concat(childVal)
: Array.isArray(childVal)
? childVal
: [childVal]
: parentVal
}
LIFECYCLE_HOOKS.forEach(function (hook) {
strats[hook] = mergeHook;
});
/**
* Assets
*
* When a vm is present (instance creation), we need to do
* a three-way merge between constructor options, instance
* options and parent options.
*/
function mergeAssets (parentVal, childVal) {
var res = Object.create(parentVal || null);
return childVal
? extend(res, childVal)
: res
}
ASSET_TYPES.forEach(function (type) {
strats[type + 's'] = mergeAssets;
});
/**
* Watchers.
*
* Watchers hashes should not overwrite one
* another, so we merge them as arrays.
*/
strats.watch = function (parentVal, childVal) {
// work around Firefox's Object.prototype.watch...
if (parentVal === nativeWatch) { parentVal = undefined; }
if (childVal === nativeWatch) { childVal = undefined; }
/* istanbul ignore if */
if (!childVal) { return Object.create(parentVal || null) }
if (!parentVal) { return childVal }
var ret = {};
extend(ret, parentVal);
for (var key in childVal) {
var parent = ret[key];
var child = childVal[key];
if (parent && !Array.isArray(parent)) {
parent = [parent];
}
ret[key] = parent
? parent.concat(child)
: Array.isArray(child) ? child : [child];
}
return ret
};
/**
* Other object hashes.
*/
strats.props =
strats.methods =
strats.inject =
strats.computed = function (parentVal, childVal) {
if (!childVal) { return Object.create(parentVal || null) }
if (!parentVal) { return childVal }
var ret = Object.create(null);
extend(ret, parentVal);
extend(ret, childVal);
return ret
};
strats.provide = mergeDataOrFn;
/**
* Default strategy.
*/
var defaultStrat = function (parentVal, childVal) {
return childVal === undefined
? parentVal
: childVal
};
/**
* Validate component names
*/
function checkComponents (options) {
for (var key in options.components) {
var lower = key.toLowerCase();
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + key
);
}
}
}
/**
* Ensure all props option syntax are normalized into the
* Object-based format.
*/
function normalizeProps (options) {
var props = options.props;
if (!props) { return }
var res = {};
var i, val, name;
if (Array.isArray(props)) {
i = props.length;
while (i--) {
val = props[i];
if (typeof val === 'string') {
name = camelize(val);
res[name] = { type: null };
} else if (process.env.NODE_ENV !== 'production') {
warn('props must be strings when using array syntax.');
}
}
} else if (isPlainObject(props)) {
for (var key in props) {
val = props[key];
name = camelize(key);
res[name] = isPlainObject(val)
? val
: { type: val };
}
}
options.props = res;
}
/**
* Normalize all injections into Object-based format
*/
function normalizeInject (options) {
var inject = options.inject;
if (Array.isArray(inject)) {
var normalized = options.inject = {};
for (var i = 0; i < inject.length; i++) {
normalized[inject[i]] = inject[i];
}
}
}
/**
* Normalize raw function directives into object format.
*/
function normalizeDirectives (options) {
var dirs = options.directives;
if (dirs) {
for (var key in dirs) {
var def = dirs[key];
if (typeof def === 'function') {
dirs[key] = { bind: def, update: def };
}
}
}
}
/**
* Merge two option objects into a new one.
* Core utility used in both instantiation and inheritance.
*/
function mergeOptions (
parent,
child,
vm
) {
if (process.env.NODE_ENV !== 'production') {
checkComponents(child);
}
if (typeof child === 'function') {
child = child.options;
}
normalizeProps(child);
normalizeInject(child);
normalizeDirectives(child);
var extendsFrom = child.extends;
if (extendsFrom) {
parent = mergeOptions(parent, extendsFrom, vm);
}
if (child.mixins) {
for (var i = 0, l = child.mixins.length; i < l; i++) {
parent = mergeOptions(parent, child.mixins[i], vm);
}
}
var options = {};
var key;
for (key in parent) {
mergeField(key);
}
for (key in child) {
if (!hasOwn(parent, key)) {
mergeField(key);
}
}
function mergeField (key) {
var strat = strats[key] || defaultStrat;
options[key] = strat(parent[key], child[key], vm, key);
}
return options
}
/**
* Resolve an asset.
* This function is used because child instances need access
* to assets defined in its ancestor chain.
*/
function resolveAsset (
options,
type,
id,
warnMissing
) {
/* istanbul ignore if */
if (typeof id !== 'string') {
return
}
var assets = options[type];
// check local registration variations first
if (hasOwn(assets, id)) { return assets[id] }
var camelizedId = camelize(id);
if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
var PascalCaseId = capitalize(camelizedId);
if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
// fallback to prototype chain
var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
warn(
'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
options
);
}
return res
}
/* */
function validateProp (
key,
propOptions,
propsData,
vm
) {
var prop = propOptions[key];
var absent = !hasOwn(propsData, key);
var value = propsData[key];
// handle boolean props
if (isType(Boolean, prop.type)) {
if (absent && !hasOwn(prop, 'default')) {
value = false;
} else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
value = true;
}
}
// check default value
if (value === undefined) {
value = getPropDefaultValue(vm, prop, key);
// since the default value is a fresh copy,
// make sure to observe it.
var prevShouldConvert = observerState.shouldConvert;
observerState.shouldConvert = true;
observe(value);
observerState.shouldConvert = prevShouldConvert;
}
if (process.env.NODE_ENV !== 'production') {
assertProp(prop, key, value, vm, absent);
}
return value
}
/**
* Get the default value of a prop.
*/
function getPropDefaultValue (vm, prop, key) {
// no default, return undefined
if (!hasOwn(prop, 'default')) {
return undefined
}
var def = prop.default;
// warn against non-factory defaults for Object & Array
if (process.env.NODE_ENV !== 'production' && isObject(def)) {
warn(
'Invalid default value for prop "' + key + '": ' +
'Props with type Object/Array must use a factory function ' +
'to return the default value.',
vm
);
}
// the raw prop value was also undefined from previous render,
// return previous default value to avoid unnecessary watcher trigger
if (vm && vm.$options.propsData &&
vm.$options.propsData[key] === undefined &&
vm._props[key] !== undefined
) {
return vm._props[key]
}
// call factory function for non-Function types
// a value is Function if its prototype is function even across different execution context
return typeof def === 'function' && getType(prop.type) !== 'Function'
? def.call(vm)
: def
}
/**
* Assert whether a prop is valid.
*/
function assertProp (
prop,
name,
value,
vm,
absent
) {
if (prop.required && absent) {
warn(
'Missing required prop: "' + name + '"',
vm
);
return
}
if (value == null && !prop.required) {
return
}
var type = prop.type;
var valid = !type || type === true;
var expectedTypes = [];
if (type) {
if (!Array.isArray(type)) {
type = [type];
}
for (var i = 0; i < type.length && !valid; i++) {
var assertedType = assertType(value, type[i]);
expectedTypes.push(assertedType.expectedType || '');
valid = assertedType.valid;
}
}
if (!valid) {
warn(
'Invalid prop: type check failed for prop "' + name + '".' +
' Expected ' + expectedTypes.map(capitalize).join(', ') +
', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
vm
);
return
}
var validator = prop.validator;
if (validator) {
if (!validator(value)) {
warn(
'Invalid prop: custom validator check failed for prop "' + name + '".',
vm
);
}
}
}
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
function assertType (value, type) {
var valid;
var expectedType = getType(type);
if (simpleCheckRE.test(expectedType)) {
valid = typeof value === expectedType.toLowerCase();
} else if (expectedType === 'Object') {
valid = isPlainObject(value);
} else if (expectedType === 'Array') {
valid = Array.isArray(value);
} else {
valid = value instanceof type;
}
return {
valid: valid,
expectedType: expectedType
}
}
/**
* Use function string name to check built-in types,
* because a simple equality check will fail when running
* across different vms / iframes.
*/
function getType (fn) {
var match = fn && fn.toString().match(/^\s*function (\w+)/);
return match ? match[1] : ''
}
function isType (type, fn) {
if (!Array.isArray(fn)) {
return getType(fn) === getType(type)
}
for (var i = 0, len = fn.length; i < len; i++) {
if (getType(fn[i]) === getType(type)) {
return true
}
}
/* istanbul ignore next */
return false
}
/* */
/* not type checking this file because flow doesn't play well with Proxy */
var initProxy;
if (process.env.NODE_ENV !== 'production') {
var allowedGlobals = makeMap(
'Infinity,undefined,NaN,isFinite,isNaN,' +
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
'require' // for Webpack/Browserify
);
var warnNonPresent = function (target, key) {
warn(
"Property or method \"" + key + "\" is not defined on the instance but " +
"referenced during render. Make sure to declare reactive data " +
"properties in the data option.",
target
);
};
var hasProxy =
typeof Proxy !== 'undefined' &&
Proxy.toString().match(/native code/);
if (hasProxy) {
var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
config.keyCodes = new Proxy(config.keyCodes, {
set: function set (target, key, value) {
if (isBuiltInModifier(key)) {
warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
return false
} else {
target[key] = value;
return true
}
}
});
}
var hasHandler = {
has: function has (target, key) {
var has = key in target;
var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
if (!has && !isAllowed) {
warnNonPresent(target, key);
}
return has || !isAllowed
}
};
var getHandler = {
get: function get (target, key) {
if (typeof key === 'string' && !(key in target)) {
warnNonPresent(target, key);
}
return target[key]
}
};
initProxy = function initProxy (vm) {
if (hasProxy) {
// determine which proxy handler to use
var options = vm.$options;
var handlers = options.render && options.render._withStripped
? getHandler
: hasHandler;
vm._renderProxy = new Proxy(vm, handlers);
} else {
vm._renderProxy = vm;
}
};
}
var mark;
var measure;
if (process.env.NODE_ENV !== 'production') {
var perf = inBrowser && window.performance;
/* istanbul ignore if */
if (
perf &&
perf.mark &&
perf.measure &&
perf.clearMarks &&
perf.clearMeasures
) {
mark = function (tag) { return perf.mark(tag); };
measure = function (name, startTag, endTag) {
perf.measure(name, startTag, endTag);
perf.clearMarks(startTag);
perf.clearMarks(endTag);
perf.clearMeasures(name);
};
}
}
/* */
var VNode = function VNode (
tag,
data,
children,
text,
elm,
context,
componentOptions,
asyncFactory
) {
this.tag = tag;
this.data = data;
this.children = children;
this.text = text;
this.elm = elm;
this.ns = undefined;
this.context = context;
this.functionalContext = undefined;
this.key = data && data.key;
this.componentOptions = componentOptions;
this.componentInstance = undefined;
this.parent = undefined;
this.raw = false;
this.isStatic = false;
this.isRootInsert = true;
this.isComment = false;
this.isCloned = false;
this.isOnce = false;
this.asyncFactory = asyncFactory;
this.asyncMeta = undefined;
this.isAsyncPlaceholder = false;
};
var prototypeAccessors = { child: {} };
// DEPRECATED: alias for componentInstance for backwards compat.
/* istanbul ignore next */
prototypeAccessors.child.get = function () {
return this.componentInstance
};
Object.defineProperties( VNode.prototype, prototypeAccessors );
var createEmptyVNode = function (text) {
if ( text === void 0 ) text = '';
var node = new VNode();
node.text = text;
node.isComment = true;
return node
};
function createTextVNode (val) {
return new VNode(undefined, undefined, undefined, String(val))
}
// optimized shallow clone
// used for static nodes and slot nodes because they may be reused across
// multiple renders, cloning them avoids errors when DOM manipulations rely
// on their elm reference.
function cloneVNode (vnode) {
var cloned = new VNode(
vnode.tag,
vnode.data,
vnode.children,
vnode.text,
vnode.elm,
vnode.context,
vnode.componentOptions,
vnode.asyncFactory
);
cloned.ns = vnode.ns;
cloned.isStatic = vnode.isStatic;
cloned.key = vnode.key;
cloned.isComment = vnode.isComment;
cloned.isCloned = true;
return cloned
}
function cloneVNodes (vnodes) {
var len = vnodes.length;
var res = new Array(len);
for (var i = 0; i < len; i++) {
res[i] = cloneVNode(vnodes[i]);
}
return res
}
/* */
var normalizeEvent = cached(function (name) {
var passive = name.charAt(0) === '&';
name = passive ? name.slice(1) : name;
var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
name = once$$1 ? name.slice(1) : name;
var capture = name.charAt(0) === '!';
name = capture ? name.slice(1) : name;
return {
name: name,
once: once$$1,
capture: capture,
passive: passive
}
});
function createFnInvoker (fns) {
function invoker () {
var arguments$1 = arguments;
var fns = invoker.fns;
if (Array.isArray(fns)) {
var cloned = fns.slice();
for (var i = 0; i < cloned.length; i++) {
cloned[i].apply(null, arguments$1);
}
} else {
// return handler return value for single handlers
return fns.apply(null, arguments)
}
}
invoker.fns = fns;
return invoker
}
function updateListeners (
on,
oldOn,
add,
remove$$1,
vm
) {
var name, cur, old, event;
for (name in on) {
cur = on[name];
old = oldOn[name];
event = normalizeEvent(name);
if (isUndef(cur)) {
process.env.NODE_ENV !== 'production' && warn(
"Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
vm
);
} else if (isUndef(old)) {
if (isUndef(cur.fns)) {
cur = on[name] = createFnInvoker(cur);
}
add(event.name, cur, event.once, event.capture, event.passive);
} else if (cur !== old) {
old.fns = cur;
on[name] = old;
}
}
for (name in oldOn) {
if (isUndef(on[name])) {
event = normalizeEvent(name);
remove$$1(event.name, oldOn[name], event.capture);
}
}
}
/* */
function mergeVNodeHook (def, hookKey, hook) {
var invoker;
var oldHook = def[hookKey];
function wrappedHook () {
hook.apply(this, arguments);
// important: remove merged hook to ensure it's called only once
// and prevent memory leak
remove(invoker.fns, wrappedHook);
}
if (isUndef(oldHook)) {
// no existing hook
invoker = createFnInvoker([wrappedHook]);
} else {
/* istanbul ignore if */
if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
// already a merged invoker
invoker = oldHook;
invoker.fns.push(wrappedHook);
} else {
// existing plain hook
invoker = createFnInvoker([oldHook, wrappedHook]);
}
}
invoker.merged = true;
def[hookKey] = invoker;
}
/* */
function extractPropsFromVNodeData (
data,
Ctor,
tag
) {
// we are only extracting raw values here.
// validation and default values are handled in the child
// component itself.
var propOptions = Ctor.options.props;
if (isUndef(propOptions)) {
return
}
var res = {};
var attrs = data.attrs;
var props = data.props;
if (isDef(attrs) || isDef(props)) {
for (var key in propOptions) {
var altKey = hyphenate(key);
if (process.env.NODE_ENV !== 'production') {
var keyInLowerCase = key.toLowerCase();
if (
key !== keyInLowerCase &&
attrs && hasOwn(attrs, keyInLowerCase)
) {
tip(
"Prop \"" + keyInLowerCase + "\" is passed to component " +
(formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
" \"" + key + "\". " +
"Note that HTML attributes are case-insensitive and camelCased " +
"props need to use their kebab-case equivalents when using in-DOM " +
"templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
);
}
}
checkProp(res, props, key, altKey, true) ||
checkProp(res, attrs, key, altKey, false);
}
}
return res
}
function checkProp (
res,
hash,
key,
altKey,
preserve
) {
if (isDef(hash)) {
if (hasOwn(hash, key)) {
res[key] = hash[key];
if (!preserve) {
delete hash[key];
}
return true
} else if (hasOwn(hash, altKey)) {
res[key] = hash[altKey];
if (!preserve) {
delete hash[altKey];
}
return true
}
}
return false
}
/* */
// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
// For plain HTML markup, normalization can be completely skipped because the
// generated render function is guaranteed to return Array<VNode>. There are
// two cases where extra normalization is needed:
// 1. When the children contains components - because a functional component
// may return an Array instead of a single root. In this case, just a simple
// normalization is needed - if any child is an Array, we flatten the whole
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
// because functional components already normalize their own children.
function simpleNormalizeChildren (children) {
for (var i = 0; i < children.length; i++) {
if (Array.isArray(children[i])) {
return Array.prototype.concat.apply([], children)
}
}
return children
}
// 2. When the children contains constructs that always generated nested Arrays,
// e.g. <template>, <slot>, v-for, or when the children is provided by user
// with hand-written render functions / JSX. In such cases a full normalization
// is needed to cater to all possible types of children values.
function normalizeChildren (children) {
return isPrimitive(children)
? [createTextVNode(children)]
: Array.isArray(children)
? normalizeArrayChildren(children)
: undefined
}
function isTextNode (node) {
return isDef(node) && isDef(node.text) && isFalse(node.isComment)
}
function normalizeArrayChildren (children, nestedIndex) {
var res = [];
var i, c, last;
for (i = 0; i < children.length; i++) {
c = children[i];
if (isUndef(c) || typeof c === 'boolean') { continue }
last = res[res.length - 1];
// nested
if (Array.isArray(c)) {
res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
} else if (isPrimitive(c)) {
if (isTextNode(last)) {
// merge adjacent text nodes
// this is necessary for SSR hydration because text nodes are
// essentially merged when rendered to HTML strings
(last).text += String(c);
} else if (c !== '') {
// convert primitive to vnode
res.push(createTextVNode(c));
}
} else {
if (isTextNode(c) && isTextNode(last)) {
// merge adjacent text nodes
res[res.length - 1] = createTextVNode(last.text + c.text);
} else {
// default key for nested array children (likely generated by v-for)
if (isTrue(children._isVList) &&
isDef(c.tag) &&
isUndef(c.key) &&
isDef(nestedIndex)) {
c.key = "__vlist" + nestedIndex + "_" + i + "__";
}
res.push(c);
}
}
}
return res
}
/* */
function ensureCtor (comp, base) {
if (comp.__esModule && comp.default) {
comp = comp.default;
}
return isObject(comp)
? base.extend(comp)
: comp
}
function createAsyncPlaceholder (
factory,
data,
context,
children,
tag
) {
var node = createEmptyVNode();
node.asyncFactory = factory;
node.asyncMeta = { data: data, context: context, children: children, tag: tag };
return node
}
function resolveAsyncComponent (
factory,
baseCtor,
context
) {
if (isTrue(factory.error) && isDef(factory.errorComp)) {
return factory.errorComp
}
if (isDef(factory.resolved)) {
return factory.resolved
}
if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
return factory.loadingComp
}
if (isDef(factory.contexts)) {
// already pending
factory.contexts.push(context);
} else {
var contexts = factory.contexts = [context];
var sync = true;
var forceRender = function () {
for (var i = 0, l = contexts.length; i < l; i++) {
contexts[i].$forceUpdate();
}
};
var resolve = once(function (res) {
// cache resolved
factory.resolved = ensureCtor(res, baseCtor);
// invoke callbacks only if this is not a synchronous resolve
// (async resolves are shimmed as synchronous during SSR)
if (!sync) {
forceRender();
}
});
var reject = once(function (reason) {
process.env.NODE_ENV !== 'production' && warn(
"Failed to resolve async component: " + (String(factory)) +
(reason ? ("\nReason: " + reason) : '')
);
if (isDef(factory.errorComp)) {
factory.error = true;
forceRender();
}
});
var res = factory(resolve, reject);
if (isObject(res)) {
if (typeof res.then === 'function') {
// () => Promise
if (isUndef(factory.resolved)) {
res.then(resolve, reject);
}
} else if (isDef(res.component) && typeof res.component.then === 'function') {
res.component.then(resolve, reject);
if (isDef(res.error)) {
factory.errorComp = ensureCtor(res.error, baseCtor);
}
if (isDef(res.loading)) {
factory.loadingComp = ensureCtor(res.loading, baseCtor);
if (res.delay === 0) {
factory.loading = true;
} else {
setTimeout(function () {
if (isUndef(factory.resolved) && isUndef(factory.error)) {
factory.loading = true;
forceRender();
}
}, res.delay || 200);
}
}
if (isDef(res.timeout)) {
setTimeout(function () {
if (isUndef(factory.resolved)) {
reject(
process.env.NODE_ENV !== 'production'
? ("timeout (" + (res.timeout) + "ms)")
: null
);
}
}, res.timeout);
}
}
}
sync = false;
// return in case resolved synchronously
return factory.loading
? factory.loadingComp
: factory.resolved
}
}
/* */
function getFirstComponentChild (children) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
var c = children[i];
if (isDef(c) && isDef(c.componentOptions)) {
return c
}
}
}
}
/* */
/* */
function initEvents (vm) {
vm._events = Object.create(null);
vm._hasHookEvent = false;
// init parent attached events
var listeners = vm.$options._parentListeners;
if (listeners) {
updateComponentListeners(vm, listeners);
}
}
var target;
function add (event, fn, once$$1) {
if (once$$1) {
target.$once(event, fn);
} else {
target.$on(event, fn);
}
}
function remove$1 (event, fn) {
target.$off(event, fn);
}
function updateComponentListeners (
vm,
listeners,
oldListeners
) {
target = vm;
updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
}
function eventsMixin (Vue) {
var hookRE = /^hook:/;
Vue.prototype.$on = function (event, fn) {
var this$1 = this;
var vm = this;
if (Array.isArray(event)) {
for (var i = 0, l = event.length; i < l; i++) {
this$1.$on(event[i], fn);
}
} else {
(vm._events[event] || (vm._events[event] = [])).push(fn);
// optimize hook:event cost by using a boolean flag marked at registration
// instead of a hash lookup
if (hookRE.test(event)) {
vm._hasHookEvent = true;
}
}
return vm
};
Vue.prototype.$once = function (event, fn) {
var vm = this;
function on () {
vm.$off(event, on);
fn.apply(vm, arguments);
}
on.fn = fn;
vm.$on(event, on);
return vm
};
Vue.prototype.$off = function (event, fn) {
var this$1 = this;
var vm = this;
// all
if (!arguments.length) {
vm._events = Object.create(null);
return vm
}
// array of events
if (Array.isArray(event)) {
for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
this$1.$off(event[i$1], fn);
}
return vm
}
// specific event
var cbs = vm._events[event];
if (!cbs) {
return vm
}
if (arguments.length === 1) {
vm._events[event] = null;
return vm
}
// specific handler
var cb;
var i = cbs.length;
while (i--) {
cb = cbs[i];
if (cb === fn || cb.fn === fn) {
cbs.splice(i, 1);
break
}
}
return vm
};
Vue.prototype.$emit = function (event) {
var vm = this;
if (process.env.NODE_ENV !== 'production') {
var lowerCaseEvent = event.toLowerCase();
if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
tip(
"Event \"" + lowerCaseEvent + "\" is emitted in component " +
(formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
"Note that HTML attributes are case-insensitive and you cannot use " +
"v-on to listen to camelCase events when using in-DOM templates. " +
"You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
);
}
}
var cbs = vm._events[event];
if (cbs) {
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
var args = toArray(arguments, 1);
for (var i = 0, l = cbs.length; i < l; i++) {
try {
cbs[i].apply(vm, args);
} catch (e) {
handleError(e, vm, ("event handler for \"" + event + "\""));
}
}
}
return vm
};
}
/* */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
function resolveSlots (
children,
context
) {
var slots = {};
if (!children) {
return slots
}
var defaultSlot = [];
for (var i = 0, l = children.length; i < l; i++) {
var child = children[i];
// named slots should only be respected if the vnode was rendered in the
// same context.
if ((child.context === context || child.functionalContext === context) &&
child.data && child.data.slot != null
) {
var name = child.data.slot;
var slot = (slots[name] || (slots[name] = []));
if (child.tag === 'template') {
slot.push.apply(slot, child.children);
} else {
slot.push(child);
}
} else {
defaultSlot.push(child);
}
}
// ignore whitespace
if (!defaultSlot.every(isWhitespace)) {
slots.default = defaultSlot;
}
return slots
}
function isWhitespace (node) {
return node.isComment || node.text === ' '
}
function resolveScopedSlots (
fns, // see flow/vnode
res
) {
res = res || {};
for (var i = 0; i < fns.length; i++) {
if (Array.isArray(fns[i])) {
resolveScopedSlots(fns[i], res);
} else {
res[fns[i].key] = fns[i].fn;
}
}
return res
}
/* */
var activeInstance = null;
var isUpdatingChildComponent = false;
function initLifecycle (vm) {
var options = vm.$options;
// locate first non-abstract parent
var parent = options.parent;
if (parent && !options.abstract) {
while (parent.$options.abstract && parent.$parent) {
parent = parent.$parent;
}
parent.$children.push(vm);
}
vm.$parent = parent;
vm.$root = parent ? parent.$root : vm;
vm.$children = [];
vm.$refs = {};
vm._watcher = null;
vm._inactive = null;
vm._directInactive = false;
vm._isMounted = false;
vm._isDestroyed = false;
vm._isBeingDestroyed = false;
}
function lifecycleMixin (Vue) {
Vue.prototype._update = function (vnode, hydrating) {
var vm = this;
if (vm._isMounted) {
callHook(vm, 'beforeUpdate');
}
var prevEl = vm.$el;
var prevVnode = vm._vnode;
var prevActiveInstance = activeInstance;
activeInstance = vm;
vm._vnode = vnode;
// Vue.prototype.__patch__ is injected in entry points
// based on the rendering backend used.
if (!prevVnode) {
// initial render
vm.$el = vm.__patch__(
vm.$el, vnode, hydrating, false /* removeOnly */,
vm.$options._parentElm,
vm.$options._refElm
);
// no need for the ref nodes after initial patch
// this prevents keeping a detached DOM tree in memory (#5851)
vm.$options._parentElm = vm.$options._refElm = null;
} else {
// updates
vm.$el = vm.__patch__(prevVnode, vnode);
}
activeInstance = prevActiveInstance;
// update __vue__ reference
if (prevEl) {
prevEl.__vue__ = null;
}
if (vm.$el) {
vm.$el.__vue__ = vm;
}
// if parent is an HOC, update its $el as well
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
vm.$parent.$el = vm.$el;
}
// updated hook is called by the scheduler to ensure that children are
// updated in a parent's updated hook.
};
Vue.prototype.$forceUpdate = function () {
var vm = this;
if (vm._watcher) {
vm._watcher.update();
}
};
Vue.prototype.$destroy = function () {
var vm = this;
if (vm._isBeingDestroyed) {
return
}
callHook(vm, 'beforeDestroy');
vm._isBeingDestroyed = true;
// remove self from parent
var parent = vm.$parent;
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
remove(parent.$children, vm);
}
// teardown watchers
if (vm._watcher) {
vm._watcher.teardown();
}
var i = vm._watchers.length;
while (i--) {
vm._watchers[i].teardown();
}
// remove reference from data ob
// frozen object may not have observer.
if (vm._data.__ob__) {
vm._data.__ob__.vmCount--;
}
// call the last hook...
vm._isDestroyed = true;
// invoke destroy hooks on current rendered tree
vm.__patch__(vm._vnode, null);
// fire destroyed hook
callHook(vm, 'destroyed');
// turn off all instance listeners.
vm.$off();
// remove __vue__ reference
if (vm.$el) {
vm.$el.__vue__ = null;
}
};
}
function mountComponent (
vm,
el,
hydrating
) {
vm.$el = el;
if (!vm.$options.render) {
vm.$options.render = createEmptyVNode;
if (process.env.NODE_ENV !== 'production') {
/* istanbul ignore if */
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
vm.$options.el || el) {
warn(
'You are using the runtime-only build of Vue where the template ' +
'compiler is not available. Either pre-compile the templates into ' +
'render functions, or use the compiler-included build.',
vm
);
} else {
warn(
'Failed to mount component: template or render function not defined.',
vm
);
}
}
}
callHook(vm, 'beforeMount');
var updateComponent;
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
updateComponent = function () {
var name = vm._name;
var id = vm._uid;
var startTag = "vue-perf-start:" + id;
var endTag = "vue-perf-end:" + id;
mark(startTag);
var vnode = vm._render();
mark(endTag);
measure((name + " render"), startTag, endTag);
mark(startTag);
vm._update(vnode, hydrating);
mark(endTag);
measure((name + " patch"), startTag, endTag);
};
} else {
updateComponent = function () {
vm._update(vm._render(), hydrating);
};
}
vm._watcher = new Watcher(vm, updateComponent, noop);
hydrating = false;
// manually mounted instance, call mounted on self
// mounted is called for render-created child components in its inserted hook
if (vm.$vnode == null) {
vm._isMounted = true;
callHook(vm, 'mounted');
}
return vm
}
function updateChildComponent (
vm,
propsData,
listeners,
parentVnode,
renderChildren
) {
if (process.env.NODE_ENV !== 'production') {
isUpdatingChildComponent = true;
}
// determine whether component has slot children
// we need to do this before overwriting $options._renderChildren
var hasChildren = !!(
renderChildren || // has new static slots
vm.$options._renderChildren || // has old static slots
parentVnode.data.scopedSlots || // has new scoped slots
vm.$scopedSlots !== emptyObject // has old scoped slots
);
vm.$options._parentVnode = parentVnode;
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
if (vm._vnode) { // update child tree's parent
vm._vnode.parent = parentVnode;
}
vm.$options._renderChildren = renderChildren;
// update $attrs and $listensers hash
// these are also reactive so they may trigger child update if the child
// used them during render
vm.$attrs = parentVnode.data && parentVnode.data.attrs;
vm.$listeners = listeners;
// update props
if (propsData && vm.$options.props) {
observerState.shouldConvert = false;
var props = vm._props;
var propKeys = vm.$options._propKeys || [];
for (var i = 0; i < propKeys.length; i++) {
var key = propKeys[i];
props[key] = validateProp(key, vm.$options.props, propsData, vm);
}
observerState.shouldConvert = true;
// keep a copy of raw propsData
vm.$options.propsData = propsData;
}
// update listeners
if (listeners) {
var oldListeners = vm.$options._parentListeners;
vm.$options._parentListeners = listeners;
updateComponentListeners(vm, listeners, oldListeners);
}
// resolve slots + force update if has children
if (hasChildren) {
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
vm.$forceUpdate();
}
if (process.env.NODE_ENV !== 'production') {
isUpdatingChildComponent = false;
}
}
function isInInactiveTree (vm) {
while (vm && (vm = vm.$parent)) {
if (vm._inactive) { return true }
}
return false
}
function activateChildComponent (vm, direct) {
if (direct) {
vm._directInactive = false;
if (isInInactiveTree(vm)) {
return
}
} else if (vm._directInactive) {
return
}
if (vm._inactive || vm._inactive === null) {
vm._inactive = false;
for (var i = 0; i < vm.$children.length; i++) {
activateChildComponent(vm.$children[i]);
}
callHook(vm, 'activated');
}
}
function deactivateChildComponent (vm, direct) {
if (direct) {
vm._directInactive = true;
if (isInInactiveTree(vm)) {
return
}
}
if (!vm._inactive) {
vm._inactive = true;
for (var i = 0; i < vm.$children.length; i++) {
deactivateChildComponent(vm.$children[i]);
}
callHook(vm, 'deactivated');
}
}
function callHook (vm, hook) {
var handlers = vm.$options[hook];
if (handlers) {
for (var i = 0, j = handlers.length; i < j; i++) {
try {
handlers[i].call(vm);
} catch (e) {
handleError(e, vm, (hook + " hook"));
}
}
}
if (vm._hasHookEvent) {
vm.$emit('hook:' + hook);
}
}
/* */
var MAX_UPDATE_COUNT = 100;
var queue = [];
var activatedChildren = [];
var has = {};
var circular = {};
var waiting = false;
var flushing = false;
var index = 0;
/**
* Reset the scheduler's state.
*/
function resetSchedulerState () {
index = queue.length = activatedChildren.length = 0;
has = {};
if (process.env.NODE_ENV !== 'production') {
circular = {};
}
waiting = flushing = false;
}
/**
* Flush both queues and run the watchers.
*/
function flushSchedulerQueue () {
flushing = true;
var watcher, id;
// Sort queue before flush.
// This ensures that:
// 1. Components are updated from parent to child. (because parent is always
// created before the child)
// 2. A component's user watchers are run before its render watcher (because
// user watchers are created before the render watcher)
// 3. If a component is destroyed during a parent component's watcher run,
// its watchers can be skipped.
queue.sort(function (a, b) { return a.id - b.id; });
// do not cache length because more watchers might be pushed
// as we run existing watchers
for (index = 0; index < queue.length; index++) {
watcher = queue[index];
id = watcher.id;
has[id] = null;
watcher.run();
// in dev build, check and stop circular updates.
if (process.env.NODE_ENV !== 'production' && has[id] != null) {
circular[id] = (circular[id] || 0) + 1;
if (circular[id] > MAX_UPDATE_COUNT) {
warn(
'You may have an infinite update loop ' + (
watcher.user
? ("in watcher with expression \"" + (watcher.expression) + "\"")
: "in a component render function."
),
watcher.vm
);
break
}
}
}
// keep copies of post queues before resetting state
var activatedQueue = activatedChildren.slice();
var updatedQueue = queue.slice();
resetSchedulerState();
// call component updated and activated hooks
callActivatedHooks(activatedQueue);
callUpdatedHooks(updatedQueue);
// devtool hook
/* istanbul ignore if */
if (devtools && config.devtools) {
devtools.emit('flush');
}
}
function callUpdatedHooks (queue) {
var i = queue.length;
while (i--) {
var watcher = queue[i];
var vm = watcher.vm;
if (vm._watcher === watcher && vm._isMounted) {
callHook(vm, 'updated');
}
}
}
/**
* Queue a kept-alive component that was activated during patch.
* The queue will be processed after the entire tree has been patched.
*/
function queueActivatedComponent (vm) {
// setting _inactive to false here so that a render function can
// rely on checking whether it's in an inactive tree (e.g. router-view)
vm._inactive = false;
activatedChildren.push(vm);
}
function callActivatedHooks (queue) {
for (var i = 0; i < queue.length; i++) {
queue[i]._inactive = true;
activateChildComponent(queue[i], true /* true */);
}
}
/**
* Push a watcher into the watcher queue.
* Jobs with duplicate IDs will be skipped unless it's
* pushed when the queue is being flushed.
*/
function queueWatcher (watcher) {
var id = watcher.id;
if (has[id] == null) {
has[id] = true;
if (!flushing) {
queue.push(watcher);
} else {
// if already flushing, splice the watcher based on its id
// if already past its id, it will be run next immediately.
var i = queue.length - 1;
while (i > index && queue[i].id > watcher.id) {
i--;
}
queue.splice(i + 1, 0, watcher);
}
// queue the flush
if (!waiting) {
waiting = true;
nextTick(flushSchedulerQueue);
}
}
}
/* */
var uid$2 = 0;
/**
* A watcher parses an expression, collects dependencies,
* and fires callback when the expression value changes.
* This is used for both the $watch() api and directives.
*/
var Watcher = function Watcher (
vm,
expOrFn,
cb,
options
) {
this.vm = vm;
vm._watchers.push(this);
// options
if (options) {
this.deep = !!options.deep;
this.user = !!options.user;
this.lazy = !!options.lazy;
this.sync = !!options.sync;
} else {
this.deep = this.user = this.lazy = this.sync = false;
}
this.cb = cb;
this.id = ++uid$2; // uid for batching
this.active = true;
this.dirty = this.lazy; // for lazy watchers
this.deps = [];
this.newDeps = [];
this.depIds = new _Set();
this.newDepIds = new _Set();
this.expression = process.env.NODE_ENV !== 'production'
? expOrFn.toString()
: '';
// parse expression for getter
if (typeof expOrFn === 'function') {
this.getter = expOrFn;
} else {
this.getter = parsePath(expOrFn);
if (!this.getter) {
this.getter = function () {};
process.env.NODE_ENV !== 'production' && warn(
"Failed watching path: \"" + expOrFn + "\" " +
'Watcher only accepts simple dot-delimited paths. ' +
'For full control, use a function instead.',
vm
);
}
}
this.value = this.lazy
? undefined
: this.get();
};
/**
* Evaluate the getter, and re-collect dependencies.
*/
Watcher.prototype.get = function get () {
pushTarget(this);
var value;
var vm = this.vm;
try {
value = this.getter.call(vm, vm);
} catch (e) {
if (this.user) {
handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
} else {
throw e
}
} finally {
// "touch" every property so they are all tracked as
// dependencies for deep watching
if (this.deep) {
traverse(value);
}
popTarget();
this.cleanupDeps();
}
return value
};
/**
* Add a dependency to this directive.
*/
Watcher.prototype.addDep = function addDep (dep) {
var id = dep.id;
if (!this.newDepIds.has(id)) {
this.newDepIds.add(id);
this.newDeps.push(dep);
if (!this.depIds.has(id)) {
dep.addSub(this);
}
}
};
/**
* Clean up for dependency collection.
*/
Watcher.prototype.cleanupDeps = function cleanupDeps () {
var this$1 = this;
var i = this.deps.length;
while (i--) {
var dep = this$1.deps[i];
if (!this$1.newDepIds.has(dep.id)) {
dep.removeSub(this$1);
}
}
var tmp = this.depIds;
this.depIds = this.newDepIds;
this.newDepIds = tmp;
this.newDepIds.clear();
tmp = this.deps;
this.deps = this.newDeps;
this.newDeps = tmp;
this.newDeps.length = 0;
};
/**
* Subscriber interface.
* Will be called when a dependency changes.
*/
Watcher.prototype.update = function update () {
/* istanbul ignore else */
if (this.lazy) {
this.dirty = true;
} else if (this.sync) {
this.run();
} else {
queueWatcher(this);
}
};
/**
* Scheduler job interface.
* Will be called by the scheduler.
*/
Watcher.prototype.run = function run () {
if (this.active) {
var value = this.get();
if (
value !== this.value ||
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
isObject(value) ||
this.deep
) {
// set new value
var oldValue = this.value;
this.value = value;
if (this.user) {
try {
this.cb.call(this.vm, value, oldValue);
} catch (e) {
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
}
} else {
this.cb.call(this.vm, value, oldValue);
}
}
}
};
/**
* Evaluate the value of the watcher.
* This only gets called for lazy watchers.
*/
Watcher.prototype.evaluate = function evaluate () {
this.value = this.get();
this.dirty = false;
};
/**
* Depend on all deps collected by this watcher.
*/
Watcher.prototype.depend = function depend () {
var this$1 = this;
var i = this.deps.length;
while (i--) {
this$1.deps[i].depend();
}
};
/**
* Remove self from all dependencies' subscriber list.
*/
Watcher.prototype.teardown = function teardown () {
var this$1 = this;
if (this.active) {
// remove self from vm's watcher list
// this is a somewhat expensive operation so we skip it
// if the vm is being destroyed.
if (!this.vm._isBeingDestroyed) {
remove(this.vm._watchers, this);
}
var i = this.deps.length;
while (i--) {
this$1.deps[i].removeSub(this$1);
}
this.active = false;
}
};
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
var seenObjects = new _Set();
function traverse (val) {
seenObjects.clear();
_traverse(val, seenObjects);
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var sharedPropertyDefinition = {
enumerable: true,
configurable: true,
get: noop,
set: noop
};
function proxy (target, sourceKey, key) {
sharedPropertyDefinition.get = function proxyGetter () {
return this[sourceKey][key]
};
sharedPropertyDefinition.set = function proxySetter (val) {
this[sourceKey][key] = val;
};
Object.defineProperty(target, key, sharedPropertyDefinition);
}
function initState (vm) {
vm._watchers = [];
var opts = vm.$options;
if (opts.props) { initProps(vm, opts.props); }
if (opts.methods) { initMethods(vm, opts.methods); }
if (opts.data) {
initData(vm);
} else {
observe(vm._data = {}, true /* asRootData */);
}
if (opts.computed) { initComputed(vm, opts.computed); }
if (opts.watch && opts.watch !== nativeWatch) {
initWatch(vm, opts.watch);
}
}
function checkOptionType (vm, name) {
var option = vm.$options[name];
if (!isPlainObject(option)) {
warn(
("component option \"" + name + "\" should be an object."),
vm
);
}
}
function initProps (vm, propsOptions) {
var propsData = vm.$options.propsData || {};
var props = vm._props = {};
// cache prop keys so that future props updates can iterate using Array
// instead of dynamic object key enumeration.
var keys = vm.$options._propKeys = [];
var isRoot = !vm.$parent;
// root instance props should be converted
observerState.shouldConvert = isRoot;
var loop = function ( key ) {
keys.push(key);
var value = validateProp(key, propsOptions, propsData, vm);
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
if (isReservedAttribute(key) || config.isReservedAttr(key)) {
warn(
("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
vm
);
}
defineReactive$$1(props, key, value, function () {
if (vm.$parent && !isUpdatingChildComponent) {
warn(
"Avoid mutating a prop directly since the value will be " +
"overwritten whenever the parent component re-renders. " +
"Instead, use a data or computed property based on the prop's " +
"value. Prop being mutated: \"" + key + "\"",
vm
);
}
});
} else {
defineReactive$$1(props, key, value);
}
// static props are already proxied on the component's prototype
// during Vue.extend(). We only need to proxy props defined at
// instantiation here.
if (!(key in vm)) {
proxy(vm, "_props", key);
}
};
for (var key in propsOptions) loop( key );
observerState.shouldConvert = true;
}
function initData (vm) {
var data = vm.$options.data;
data = vm._data = typeof data === 'function'
? getData(data, vm)
: data || {};
if (!isPlainObject(data)) {
data = {};
process.env.NODE_ENV !== 'production' && warn(
'data functions should return an object:\n' +
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
vm
);
}
// proxy data on instance
var keys = Object.keys(data);
var props = vm.$options.props;
var methods = vm.$options.methods;
var i = keys.length;
while (i--) {
var key = keys[i];
if (process.env.NODE_ENV !== 'production') {
if (methods && hasOwn(methods, key)) {
warn(
("method \"" + key + "\" has already been defined as a data property."),
vm
);
}
}
if (props && hasOwn(props, key)) {
process.env.NODE_ENV !== 'production' && warn(
"The data property \"" + key + "\" is already declared as a prop. " +
"Use prop default value instead.",
vm
);
} else if (!isReserved(key)) {
proxy(vm, "_data", key);
}
}
// observe data
observe(data, true /* asRootData */);
}
function getData (data, vm) {
try {
return data.call(vm)
} catch (e) {
handleError(e, vm, "data()");
return {}
}
}
var computedWatcherOptions = { lazy: true };
function initComputed (vm, computed) {
process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'computed');
var watchers = vm._computedWatchers = Object.create(null);
for (var key in computed) {
var userDef = computed[key];
var getter = typeof userDef === 'function' ? userDef : userDef.get;
if (process.env.NODE_ENV !== 'production') {
if (getter === undefined) {
warn(
("No getter function has been defined for computed property \"" + key + "\"."),
vm
);
getter = noop;
}
}
// create internal watcher for the computed property.
watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions);
// component-defined computed properties are already defined on the
// component prototype. We only need to define computed properties defined
// at instantiation here.
if (!(key in vm)) {
defineComputed(vm, key, userDef);
} else if (process.env.NODE_ENV !== 'production') {
if (key in vm.$data) {
warn(("The computed property \"" + key + "\" is already defined in data."), vm);
} else if (vm.$options.props && key in vm.$options.props) {
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
}
}
}
}
function defineComputed (target, key, userDef) {
if (typeof userDef === 'function') {
sharedPropertyDefinition.get = createComputedGetter(key);
sharedPropertyDefinition.set = noop;
} else {
sharedPropertyDefinition.get = userDef.get
? userDef.cache !== false
? createComputedGetter(key)
: userDef.get
: noop;
sharedPropertyDefinition.set = userDef.set
? userDef.set
: noop;
}
Object.defineProperty(target, key, sharedPropertyDefinition);
}
function createComputedGetter (key) {
return function computedGetter () {
var watcher = this._computedWatchers && this._computedWatchers[key];
if (watcher) {
if (watcher.dirty) {
watcher.evaluate();
}
if (Dep.target) {
watcher.depend();
}
return watcher.value
}
}
}
function initMethods (vm, methods) {
process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'methods');
var props = vm.$options.props;
for (var key in methods) {
vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
if (process.env.NODE_ENV !== 'production') {
if (methods[key] == null) {
warn(
"method \"" + key + "\" has an undefined value in the component definition. " +
"Did you reference the function correctly?",
vm
);
}
if (props && hasOwn(props, key)) {
warn(
("method \"" + key + "\" has already been defined as a prop."),
vm
);
}
}
}
}
function initWatch (vm, watch) {
process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'watch');
for (var key in watch) {
var handler = watch[key];
if (Array.isArray(handler)) {
for (var i = 0; i < handler.length; i++) {
createWatcher(vm, key, handler[i]);
}
} else {
createWatcher(vm, key, handler);
}
}
}
function createWatcher (
vm,
keyOrFn,
handler,
options
) {
if (isPlainObject(handler)) {
options = handler;
handler = handler.handler;
}
if (typeof handler === 'string') {
handler = vm[handler];
}
return vm.$watch(keyOrFn, handler, options)
}
function stateMixin (Vue) {
// flow somehow has problems with directly declared definition object
// when using Object.defineProperty, so we have to procedurally build up
// the object here.
var dataDef = {};
dataDef.get = function () { return this._data };
var propsDef = {};
propsDef.get = function () { return this._props };
if (process.env.NODE_ENV !== 'production') {
dataDef.set = function (newData) {
warn(
'Avoid replacing instance root $data. ' +
'Use nested data properties instead.',
this
);
};
propsDef.set = function () {
warn("$props is readonly.", this);
};
}
Object.defineProperty(Vue.prototype, '$data', dataDef);
Object.defineProperty(Vue.prototype, '$props', propsDef);
Vue.prototype.$set = set;
Vue.prototype.$delete = del;
Vue.prototype.$watch = function (
expOrFn,
cb,
options
) {
var vm = this;
if (isPlainObject(cb)) {
return createWatcher(vm, expOrFn, cb, options)
}
options = options || {};
options.user = true;
var watcher = new Watcher(vm, expOrFn, cb, options);
if (options.immediate) {
cb.call(vm, watcher.value);
}
return function unwatchFn () {
watcher.teardown();
}
};
}
/* */
function initProvide (vm) {
var provide = vm.$options.provide;
if (provide) {
vm._provided = typeof provide === 'function'
? provide.call(vm)
: provide;
}
}
function initInjections (vm) {
var result = resolveInject(vm.$options.inject, vm);
if (result) {
observerState.shouldConvert = false;
Object.keys(result).forEach(function (key) {
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
defineReactive$$1(vm, key, result[key], function () {
warn(
"Avoid mutating an injected value directly since the changes will be " +
"overwritten whenever the provided component re-renders. " +
"injection being mutated: \"" + key + "\"",
vm
);
});
} else {
defineReactive$$1(vm, key, result[key]);
}
});
observerState.shouldConvert = true;
}
}
function resolveInject (inject, vm) {
if (inject) {
// inject is :any because flow is not smart enough to figure out cached
var result = Object.create(null);
var keys = hasSymbol
? Reflect.ownKeys(inject)
: Object.keys(inject);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var provideKey = inject[key];
var source = vm;
while (source) {
if (source._provided && provideKey in source._provided) {
result[key] = source._provided[provideKey];
break
}
source = source.$parent;
}
if (process.env.NODE_ENV !== 'production' && !hasOwn(result, key)) {
warn(("Injection \"" + key + "\" not found"), vm);
}
}
return result
}
}
/* */
function createFunctionalComponent (
Ctor,
propsData,
data,
context,
children
) {
var props = {};
var propOptions = Ctor.options.props;
if (isDef(propOptions)) {
for (var key in propOptions) {
props[key] = validateProp(key, propOptions, propsData || {});
}
} else {
if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
if (isDef(data.props)) { mergeProps(props, data.props); }
}
// ensure the createElement function in functional components
// gets a unique context - this is necessary for correct named slot check
var _context = Object.create(context);
var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
var vnode = Ctor.options.render.call(null, h, {
data: data,
props: props,
children: children,
parent: context,
listeners: data.on || {},
injections: resolveInject(Ctor.options.inject, context),
slots: function () { return resolveSlots(children, context); }
});
if (vnode instanceof VNode) {
vnode.functionalContext = context;
vnode.functionalOptions = Ctor.options;
if (data.slot) {
(vnode.data || (vnode.data = {})).slot = data.slot;
}
}
return vnode
}
function mergeProps (to, from) {
for (var key in from) {
to[camelize(key)] = from[key];
}
}
/* */
// hooks to be invoked on component VNodes during patch
var componentVNodeHooks = {
init: function init (
vnode,
hydrating,
parentElm,
refElm
) {
if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
var child = vnode.componentInstance = createComponentInstanceForVnode(
vnode,
activeInstance,
parentElm,
refElm
);
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
} else if (vnode.data.keepAlive) {
// kept-alive components, treat as a patch
var mountedNode = vnode; // work around flow
componentVNodeHooks.prepatch(mountedNode, mountedNode);
}
},
prepatch: function prepatch (oldVnode, vnode) {
var options = vnode.componentOptions;
var child = vnode.componentInstance = oldVnode.componentInstance;
updateChildComponent(
child,
options.propsData, // updated props
options.listeners, // updated listeners
vnode, // new parent vnode
options.children // new children
);
},
insert: function insert (vnode) {
var context = vnode.context;
var componentInstance = vnode.componentInstance;
if (!componentInstance._isMounted) {
componentInstance._isMounted = true;
callHook(componentInstance, 'mounted');
}
if (vnode.data.keepAlive) {
if (context._isMounted) {
// vue-router#1212
// During updates, a kept-alive component's child components may
// change, so directly walking the tree here may call activated hooks
// on incorrect children. Instead we push them into a queue which will
// be processed after the whole patch process ended.
queueActivatedComponent(componentInstance);
} else {
activateChildComponent(componentInstance, true /* direct */);
}
}
},
destroy: function destroy (vnode) {
var componentInstance = vnode.componentInstance;
if (!componentInstance._isDestroyed) {
if (!vnode.data.keepAlive) {
componentInstance.$destroy();
} else {
deactivateChildComponent(componentInstance, true /* direct */);
}
}
}
};
var hooksToMerge = Object.keys(componentVNodeHooks);
function createComponent (
Ctor,
data,
context,
children,
tag
) {
if (isUndef(Ctor)) {
return
}
var baseCtor = context.$options._base;
// plain options object: turn it into a constructor
if (isObject(Ctor)) {
Ctor = baseCtor.extend(Ctor);
}
// if at this stage it's not a constructor or an async component factory,
// reject.
if (typeof Ctor !== 'function') {
if (process.env.NODE_ENV !== 'production') {
warn(("Invalid Component definition: " + (String(Ctor))), context);
}
return
}
// async component
var asyncFactory;
if (isUndef(Ctor.cid)) {
asyncFactory = Ctor;
Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
if (Ctor === undefined) {
// return a placeholder node for async component, which is rendered
// as a comment node but preserves all the raw information for the node.
// the information will be used for async server-rendering and hydration.
return createAsyncPlaceholder(
asyncFactory,
data,
context,
children,
tag
)
}
}
data = data || {};
// resolve constructor options in case global mixins are applied after
// component constructor creation
resolveConstructorOptions(Ctor);
// transform component v-model data into props & events
if (isDef(data.model)) {
transformModel(Ctor.options, data);
}
// extract props
var propsData = extractPropsFromVNodeData(data, Ctor, tag);
// functional component
if (isTrue(Ctor.options.functional)) {
return createFunctionalComponent(Ctor, propsData, data, context, children)
}
// keep listeners
var listeners = data.on;
if (isTrue(Ctor.options.abstract)) {
// abstract components do not keep anything
// other than props & listeners & slot
// work around flow
var slot = data.slot;
data = {};
if (slot) {
data.slot = slot;
}
}
// merge component management hooks onto the placeholder node
mergeHooks(data);
// return a placeholder vnode
var name = Ctor.options.name || tag;
var vnode = new VNode(
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
data, undefined, undefined, undefined, context,
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
asyncFactory
);
return vnode
}
function createComponentInstanceForVnode (
vnode, // we know it's MountedComponentVNode but flow doesn't
parent, // activeInstance in lifecycle state
parentElm,
refElm
) {
var vnodeComponentOptions = vnode.componentOptions;
var options = {
_isComponent: true,
parent: parent,
propsData: vnodeComponentOptions.propsData,
_componentTag: vnodeComponentOptions.tag,
_parentVnode: vnode,
_parentListeners: vnodeComponentOptions.listeners,
_renderChildren: vnodeComponentOptions.children,
_parentElm: parentElm || null,
_refElm: refElm || null
};
// check inline-template render functions
var inlineTemplate = vnode.data.inlineTemplate;
if (isDef(inlineTemplate)) {
options.render = inlineTemplate.render;
options.staticRenderFns = inlineTemplate.staticRenderFns;
}
return new vnodeComponentOptions.Ctor(options)
}
function mergeHooks (data) {
if (!data.hook) {
data.hook = {};
}
for (var i = 0; i < hooksToMerge.length; i++) {
var key = hooksToMerge[i];
var fromParent = data.hook[key];
var ours = componentVNodeHooks[key];
data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
}
}
function mergeHook$1 (one, two) {
return function (a, b, c, d) {
one(a, b, c, d);
two(a, b, c, d);
}
}
// transform component v-model info (value and callback) into
// prop and event handler respectively.
function transformModel (options, data) {
var prop = (options.model && options.model.prop) || 'value';
var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
var on = data.on || (data.on = {});
if (isDef(on[event])) {
on[event] = [data.model.callback].concat(on[event]);
} else {
on[event] = data.model.callback;
}
}
/* */
var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;
// wrapper function for providing a more flexible interface
// without getting yelled at by flow
function createElement (
context,
tag,
data,
children,
normalizationType,
alwaysNormalize
) {
if (Array.isArray(data) || isPrimitive(data)) {
normalizationType = children;
children = data;
data = undefined;
}
if (isTrue(alwaysNormalize)) {
normalizationType = ALWAYS_NORMALIZE;
}
return _createElement(context, tag, data, children, normalizationType)
}
function _createElement (
context,
tag,
data,
children,
normalizationType
) {
if (isDef(data) && isDef((data).__ob__)) {
process.env.NODE_ENV !== 'production' && warn(
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
'Always create fresh vnode data objects in each render!',
context
);
return createEmptyVNode()
}
// object syntax in v-bind
if (isDef(data) && isDef(data.is)) {
tag = data.is;
}
if (!tag) {
// in case of component :is set to falsy value
return createEmptyVNode()
}
// warn against non-primitive key
if (process.env.NODE_ENV !== 'production' &&
isDef(data) && isDef(data.key) && !isPrimitive(data.key)
) {
warn(
'Avoid using non-primitive value as key, ' +
'use string/number value instead.',
context
);
}
// support single function children as default scoped slot
if (Array.isArray(children) &&
typeof children[0] === 'function'
) {
data = data || {};
data.scopedSlots = { default: children[0] };
children.length = 0;
}
if (normalizationType === ALWAYS_NORMALIZE) {
children = normalizeChildren(children);
} else if (normalizationType === SIMPLE_NORMALIZE) {
children = simpleNormalizeChildren(children);
}
var vnode, ns;
if (typeof tag === 'string') {
var Ctor;
ns = config.getTagNamespace(tag);
if (config.isReservedTag(tag)) {
// platform built-in elements
vnode = new VNode(
config.parsePlatformTagName(tag), data, children,
undefined, undefined, context
);
} else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
// component
vnode = createComponent(Ctor, data, context, children, tag);
} else {
// unknown or unlisted namespaced elements
// check at runtime because it may get assigned a namespace when its
// parent normalizes children
vnode = new VNode(
tag, data, children,
undefined, undefined, context
);
}
} else {
// direct component options / constructor
vnode = createComponent(tag, data, context, children);
}
if (isDef(vnode)) {
if (ns) { applyNS(vnode, ns); }
return vnode
} else {
return createEmptyVNode()
}
}
function applyNS (vnode, ns) {
vnode.ns = ns;
if (vnode.tag === 'foreignObject') {
// use default namespace inside foreignObject
return
}
if (isDef(vnode.children)) {
for (var i = 0, l = vnode.children.length; i < l; i++) {
var child = vnode.children[i];
if (isDef(child.tag) && isUndef(child.ns)) {
applyNS(child, ns);
}
}
}
}
/* */
/**
* Runtime helper for rendering v-for lists.
*/
function renderList (
val,
render
) {
var ret, i, l, keys, key;
if (Array.isArray(val) || typeof val === 'string') {
ret = new Array(val.length);
for (i = 0, l = val.length; i < l; i++) {
ret[i] = render(val[i], i);
}
} else if (typeof val === 'number') {
ret = new Array(val);
for (i = 0; i < val; i++) {
ret[i] = render(i + 1, i);
}
} else if (isObject(val)) {
keys = Object.keys(val);
ret = new Array(keys.length);
for (i = 0, l = keys.length; i < l; i++) {
key = keys[i];
ret[i] = render(val[key], key, i);
}
}
if (isDef(ret)) {
(ret)._isVList = true;
}
return ret
}
/* */
/**
* Runtime helper for rendering <slot>
*/
function renderSlot (
name,
fallback,
props,
bindObject
) {
var scopedSlotFn = this.$scopedSlots[name];
if (scopedSlotFn) { // scoped slot
props = props || {};
if (bindObject) {
props = extend(extend({}, bindObject), props);
}
return scopedSlotFn(props) || fallback
} else {
var slotNodes = this.$slots[name];
// warn duplicate slot usage
if (slotNodes && process.env.NODE_ENV !== 'production') {
slotNodes._rendered && warn(
"Duplicate presence of slot \"" + name + "\" found in the same render tree " +
"- this will likely cause render errors.",
this
);
slotNodes._rendered = true;
}
return slotNodes || fallback
}
}
/* */
/**
* Runtime helper for resolving filters
*/
function resolveFilter (id) {
return resolveAsset(this.$options, 'filters', id, true) || identity
}
/* */
/**
* Runtime helper for checking keyCodes from config.
*/
function checkKeyCodes (
eventKeyCode,
key,
builtInAlias
) {
var keyCodes = config.keyCodes[key] || builtInAlias;
if (Array.isArray(keyCodes)) {
return keyCodes.indexOf(eventKeyCode) === -1
} else {
return keyCodes !== eventKeyCode
}
}
/* */
/**
* Runtime helper for merging v-bind="object" into a VNode's data.
*/
function bindObjectProps (
data,
tag,
value,
asProp,
isSync
) {
if (value) {
if (!isObject(value)) {
process.env.NODE_ENV !== 'production' && warn(
'v-bind without argument expects an Object or Array value',
this
);
} else {
if (Array.isArray(value)) {
value = toObject(value);
}
var hash;
var loop = function ( key ) {
if (
key === 'class' ||
key === 'style' ||
isReservedAttribute(key)
) {
hash = data;
} else {
var type = data.attrs && data.attrs.type;
hash = asProp || config.mustUseProp(tag, type, key)
? data.domProps || (data.domProps = {})
: data.attrs || (data.attrs = {});
}
if (!(key in hash)) {
hash[key] = value[key];
if (isSync) {
var on = data.on || (data.on = {});
on[("update:" + key)] = function ($event) {
value[key] = $event;
};
}
}
};
for (var key in value) loop( key );
}
}
return data
}
/* */
/**
* Runtime helper for rendering static trees.
*/
function renderStatic (
index,
isInFor
) {
var tree = this._staticTrees[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
if (tree && !isInFor) {
return Array.isArray(tree)
? cloneVNodes(tree)
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = this._staticTrees[index] =
this.$options.staticRenderFns[index].call(this._renderProxy);
markStatic(tree, ("__static__" + index), false);
return tree
}
/**
* Runtime helper for v-once.
* Effectively it means marking the node as static with a unique key.
*/
function markOnce (
tree,
index,
key
) {
markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
return tree
}
function markStatic (
tree,
key,
isOnce
) {
if (Array.isArray(tree)) {
for (var i = 0; i < tree.length; i++) {
if (tree[i] && typeof tree[i] !== 'string') {
markStaticNode(tree[i], (key + "_" + i), isOnce);
}
}
} else {
markStaticNode(tree, key, isOnce);
}
}
function markStaticNode (node, key, isOnce) {
node.isStatic = true;
node.key = key;
node.isOnce = isOnce;
}
/* */
function bindObjectListeners (data, value) {
if (value) {
if (!isPlainObject(value)) {
process.env.NODE_ENV !== 'production' && warn(
'v-on without argument expects an Object value',
this
);
} else {
var on = data.on = data.on ? extend({}, data.on) : {};
for (var key in value) {
var existing = on[key];
var ours = value[key];
on[key] = existing ? [].concat(ours, existing) : ours;
}
}
}
return data
}
/* */
function initRender (vm) {
vm._vnode = null; // the root of the child tree
vm._staticTrees = null;
var parentVnode = vm.$vnode = vm.$options._parentVnode; // the placeholder node in parent tree
var renderContext = parentVnode && parentVnode.context;
vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
vm.$scopedSlots = emptyObject;
// bind the createElement fn to this instance
// so that we get proper render context inside it.
// args order: tag, data, children, normalizationType, alwaysNormalize
// internal version is used by render functions compiled from templates
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
// normalization is always applied for the public version, used in
// user-written render functions.
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
// $attrs & $listeners are exposed for easier HOC creation.
// they need to be reactive so that HOCs using them are always updated
var parentData = parentVnode && parentVnode.data;
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, function () {
!isUpdatingChildComponent && warn("$attrs is readonly.", vm);
}, true);
defineReactive$$1(vm, '$listeners', parentData && parentData.on, function () {
!isUpdatingChildComponent && warn("$listeners is readonly.", vm);
}, true);
} else {
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, null, true);
defineReactive$$1(vm, '$listeners', parentData && parentData.on, null, true);
}
}
function renderMixin (Vue) {
Vue.prototype.$nextTick = function (fn) {
return nextTick(fn, this)
};
Vue.prototype._render = function () {
var vm = this;
var ref = vm.$options;
var render = ref.render;
var staticRenderFns = ref.staticRenderFns;
var _parentVnode = ref._parentVnode;
if (vm._isMounted) {
// clone slot nodes on re-renders
for (var key in vm.$slots) {
vm.$slots[key] = cloneVNodes(vm.$slots[key]);
}
}
vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
if (staticRenderFns && !vm._staticTrees) {
vm._staticTrees = [];
}
// set parent vnode. this allows render functions to have access
// to the data on the placeholder node.
vm.$vnode = _parentVnode;
// render self
var vnode;
try {
vnode = render.call(vm._renderProxy, vm.$createElement);
} catch (e) {
handleError(e, vm, "render function");
// return error render result,
// or previous vnode to prevent render error causing blank component
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
vnode = vm.$options.renderError
? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e)
: vm._vnode;
} else {
vnode = vm._vnode;
}
}
// return empty vnode in case the render function errored out
if (!(vnode instanceof VNode)) {
if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
warn(
'Multiple root nodes returned from render function. Render function ' +
'should return a single root node.',
vm
);
}
vnode = createEmptyVNode();
}
// set parent
vnode.parent = _parentVnode;
return vnode
};
// internal render helpers.
// these are exposed on the instance prototype to reduce generated render
// code size.
Vue.prototype._o = markOnce;
Vue.prototype._n = toNumber;
Vue.prototype._s = toString;
Vue.prototype._l = renderList;
Vue.prototype._t = renderSlot;
Vue.prototype._q = looseEqual;
Vue.prototype._i = looseIndexOf;
Vue.prototype._m = renderStatic;
Vue.prototype._f = resolveFilter;
Vue.prototype._k = checkKeyCodes;
Vue.prototype._b = bindObjectProps;
Vue.prototype._v = createTextVNode;
Vue.prototype._e = createEmptyVNode;
Vue.prototype._u = resolveScopedSlots;
Vue.prototype._g = bindObjectListeners;
}
/* */
var uid = 0;
function initMixin (Vue) {
Vue.prototype._init = function (options) {
var vm = this;
// a uid
vm._uid = uid++;
var startTag, endTag;
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
startTag = "vue-perf-init:" + (vm._uid);
endTag = "vue-perf-end:" + (vm._uid);
mark(startTag);
}
// a flag to avoid this being observed
vm._isVue = true;
// merge options
if (options && options._isComponent) {
// optimize internal component instantiation
// since dynamic options merging is pretty slow, and none of the
// internal component options needs special treatment.
initInternalComponent(vm, options);
} else {
vm.$options = mergeOptions(
resolveConstructorOptions(vm.constructor),
options || {},
vm
);
}
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
initProxy(vm);
} else {
vm._renderProxy = vm;
}
// expose real self
vm._self = vm;
initLifecycle(vm);
initEvents(vm);
initRender(vm);
callHook(vm, 'beforeCreate');
initInjections(vm); // resolve injections before data/props
initState(vm);
initProvide(vm); // resolve provide after data/props
callHook(vm, 'created');
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
vm._name = formatComponentName(vm, false);
mark(endTag);
measure(((vm._name) + " init"), startTag, endTag);
}
if (vm.$options.el) {
vm.$mount(vm.$options.el);
}
};
}
function initInternalComponent (vm, options) {
var opts = vm.$options = Object.create(vm.constructor.options);
// doing this because it's faster than dynamic enumeration.
opts.parent = options.parent;
opts.propsData = options.propsData;
opts._parentVnode = options._parentVnode;
opts._parentListeners = options._parentListeners;
opts._renderChildren = options._renderChildren;
opts._componentTag = options._componentTag;
opts._parentElm = options._parentElm;
opts._refElm = options._refElm;
if (options.render) {
opts.render = options.render;
opts.staticRenderFns = options.staticRenderFns;
}
}
function resolveConstructorOptions (Ctor) {
var options = Ctor.options;
if (Ctor.super) {
var superOptions = resolveConstructorOptions(Ctor.super);
var cachedSuperOptions = Ctor.superOptions;
if (superOptions !== cachedSuperOptions) {
// super option changed,
// need to resolve new options.
Ctor.superOptions = superOptions;
// check if there are any late-modified/attached options (#4976)
var modifiedOptions = resolveModifiedOptions(Ctor);
// update base extend options
if (modifiedOptions) {
extend(Ctor.extendOptions, modifiedOptions);
}
options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
if (options.name) {
options.components[options.name] = Ctor;
}
}
}
return options
}
function resolveModifiedOptions (Ctor) {
var modified;
var latest = Ctor.options;
var extended = Ctor.extendOptions;
var sealed = Ctor.sealedOptions;
for (var key in latest) {
if (latest[key] !== sealed[key]) {
if (!modified) { modified = {}; }
modified[key] = dedupe(latest[key], extended[key], sealed[key]);
}
}
return modified
}
function dedupe (latest, extended, sealed) {
// compare latest and sealed to ensure lifecycle hooks won't be duplicated
// between merges
if (Array.isArray(latest)) {
var res = [];
sealed = Array.isArray(sealed) ? sealed : [sealed];
extended = Array.isArray(extended) ? extended : [extended];
for (var i = 0; i < latest.length; i++) {
// push original options and not sealed options to exclude duplicated options
if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
res.push(latest[i]);
}
}
return res
} else {
return latest
}
}
function Vue$3 (options) {
if (process.env.NODE_ENV !== 'production' &&
!(this instanceof Vue$3)
) {
warn('Vue is a constructor and should be called with the `new` keyword');
}
this._init(options);
}
initMixin(Vue$3);
stateMixin(Vue$3);
eventsMixin(Vue$3);
lifecycleMixin(Vue$3);
renderMixin(Vue$3);
/* */
function initUse (Vue) {
Vue.use = function (plugin) {
var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
if (installedPlugins.indexOf(plugin) > -1) {
return this
}
// additional parameters
var args = toArray(arguments, 1);
args.unshift(this);
if (typeof plugin.install === 'function') {
plugin.install.apply(plugin, args);
} else if (typeof plugin === 'function') {
plugin.apply(null, args);
}
installedPlugins.push(plugin);
return this
};
}
/* */
function initMixin$1 (Vue) {
Vue.mixin = function (mixin) {
this.options = mergeOptions(this.options, mixin);
return this
};
}
/* */
function initExtend (Vue) {
/**
* Each instance constructor, including Vue, has a unique
* cid. This enables us to create wrapped "child
* constructors" for prototypal inheritance and cache them.
*/
Vue.cid = 0;
var cid = 1;
/**
* Class inheritance
*/
Vue.extend = function (extendOptions) {
extendOptions = extendOptions || {};
var Super = this;
var SuperId = Super.cid;
var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
if (cachedCtors[SuperId]) {
return cachedCtors[SuperId]
}
var name = extendOptions.name || Super.options.name;
if (process.env.NODE_ENV !== 'production') {
if (!/^[a-zA-Z][\w-]*$/.test(name)) {
warn(
'Invalid component name: "' + name + '". Component names ' +
'can only contain alphanumeric characters and the hyphen, ' +
'and must start with a letter.'
);
}
}
var Sub = function VueComponent (options) {
this._init(options);
};
Sub.prototype = Object.create(Super.prototype);
Sub.prototype.constructor = Sub;
Sub.cid = cid++;
Sub.options = mergeOptions(
Super.options,
extendOptions
);
Sub['super'] = Super;
// For props and computed properties, we define the proxy getters on
// the Vue instances at extension time, on the extended prototype. This
// avoids Object.defineProperty calls for each instance created.
if (Sub.options.props) {
initProps$1(Sub);
}
if (Sub.options.computed) {
initComputed$1(Sub);
}
// allow further extension/mixin/plugin usage
Sub.extend = Super.extend;
Sub.mixin = Super.mixin;
Sub.use = Super.use;
// create asset registers, so extended classes
// can have their private assets too.
ASSET_TYPES.forEach(function (type) {
Sub[type] = Super[type];
});
// enable recursive self-lookup
if (name) {
Sub.options.components[name] = Sub;
}
// keep a reference to the super options at extension time.
// later at instantiation we can check if Super's options have
// been updated.
Sub.superOptions = Super.options;
Sub.extendOptions = extendOptions;
Sub.sealedOptions = extend({}, Sub.options);
// cache constructor
cachedCtors[SuperId] = Sub;
return Sub
};
}
function initProps$1 (Comp) {
var props = Comp.options.props;
for (var key in props) {
proxy(Comp.prototype, "_props", key);
}
}
function initComputed$1 (Comp) {
var computed = Comp.options.computed;
for (var key in computed) {
defineComputed(Comp.prototype, key, computed[key]);
}
}
/* */
function initAssetRegisters (Vue) {
/**
* Create asset registration methods.
*/
ASSET_TYPES.forEach(function (type) {
Vue[type] = function (
id,
definition
) {
if (!definition) {
return this.options[type + 's'][id]
} else {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production') {
if (type === 'component' && config.isReservedTag(id)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + id
);
}
}
if (type === 'component' && isPlainObject(definition)) {
definition.name = definition.name || id;
definition = this.options._base.extend(definition);
}
if (type === 'directive' && typeof definition === 'function') {
definition = { bind: definition, update: definition };
}
this.options[type + 's'][id] = definition;
return definition
}
};
});
}
/* */
var patternTypes = [String, RegExp, Array];
function getComponentName (opts) {
return opts && (opts.Ctor.options.name || opts.tag)
}
function matches (pattern, name) {
if (Array.isArray(pattern)) {
return pattern.indexOf(name) > -1
} else if (typeof pattern === 'string') {
return pattern.split(',').indexOf(name) > -1
} else if (isRegExp(pattern)) {
return pattern.test(name)
}
/* istanbul ignore next */
return false
}
function pruneCache (cache, current, filter) {
for (var key in cache) {
var cachedNode = cache[key];
if (cachedNode) {
var name = getComponentName(cachedNode.componentOptions);
if (name && !filter(name)) {
if (cachedNode !== current) {
pruneCacheEntry(cachedNode);
}
cache[key] = null;
}
}
}
}
function pruneCacheEntry (vnode) {
if (vnode) {
vnode.componentInstance.$destroy();
}
}
var KeepAlive = {
name: 'keep-alive',
abstract: true,
props: {
include: patternTypes,
exclude: patternTypes
},
created: function created () {
this.cache = Object.create(null);
},
destroyed: function destroyed () {
var this$1 = this;
for (var key in this$1.cache) {
pruneCacheEntry(this$1.cache[key]);
}
},
watch: {
include: function include (val) {
pruneCache(this.cache, this._vnode, function (name) { return matches(val, name); });
},
exclude: function exclude (val) {
pruneCache(this.cache, this._vnode, function (name) { return !matches(val, name); });
}
},
render: function render () {
var vnode = getFirstComponentChild(this.$slots.default);
var componentOptions = vnode && vnode.componentOptions;
if (componentOptions) {
// check pattern
var name = getComponentName(componentOptions);
if (name && (
(this.include && !matches(this.include, name)) ||
(this.exclude && matches(this.exclude, name))
)) {
return vnode
}
var key = vnode.key == null
// same constructor may get registered as different local components
// so cid alone is not enough (#3269)
? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
: vnode.key;
if (this.cache[key]) {
vnode.componentInstance = this.cache[key].componentInstance;
} else {
this.cache[key] = vnode;
}
vnode.data.keepAlive = true;
}
return vnode
}
};
var builtInComponents = {
KeepAlive: KeepAlive
};
/* */
function initGlobalAPI (Vue) {
// config
var configDef = {};
configDef.get = function () { return config; };
if (process.env.NODE_ENV !== 'production') {
configDef.set = function () {
warn(
'Do not replace the Vue.config object, set individual fields instead.'
);
};
}
Object.defineProperty(Vue, 'config', configDef);
// exposed util methods.
// NOTE: these are not considered part of the public API - avoid relying on
// them unless you are aware of the risk.
Vue.util = {
warn: warn,
extend: extend,
mergeOptions: mergeOptions,
defineReactive: defineReactive$$1
};
Vue.set = set;
Vue.delete = del;
Vue.nextTick = nextTick;
Vue.options = Object.create(null);
ASSET_TYPES.forEach(function (type) {
Vue.options[type + 's'] = Object.create(null);
});
// this is used to identify the "base" constructor to extend all plain-object
// components with in Weex's multi-instance scenarios.
Vue.options._base = Vue;
extend(Vue.options.components, builtInComponents);
initUse(Vue);
initMixin$1(Vue);
initExtend(Vue);
initAssetRegisters(Vue);
}
initGlobalAPI(Vue$3);
Object.defineProperty(Vue$3.prototype, '$isServer', {
get: isServerRendering
});
Object.defineProperty(Vue$3.prototype, '$ssrContext', {
get: function get () {
/* istanbul ignore next */
return this.$vnode && this.$vnode.ssrContext
}
});
Vue$3.version = '2.4.0';
/* */
// these are reserved for web because they are directly compiled away
// during template compilation
var isReservedAttr = makeMap('style,class');
// attributes that should be using props for binding
var acceptValue = makeMap('input,textarea,option,select');
var mustUseProp = function (tag, type, attr) {
return (
(attr === 'value' && acceptValue(tag)) && type !== 'button' ||
(attr === 'selected' && tag === 'option') ||
(attr === 'checked' && tag === 'input') ||
(attr === 'muted' && tag === 'video')
)
};
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
'required,reversed,scoped,seamless,selected,sortable,translate,' +
'truespeed,typemustmatch,visible'
);
var xlinkNS = 'http://www.w3.org/1999/xlink';
var isXlink = function (name) {
return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
};
var getXlinkProp = function (name) {
return isXlink(name) ? name.slice(6, name.length) : ''
};
var isFalsyAttrValue = function (val) {
return val == null || val === false
};
/* */
function genClassForVnode (vnode) {
var data = vnode.data;
var parentNode = vnode;
var childNode = vnode;
while (isDef(childNode.componentInstance)) {
childNode = childNode.componentInstance._vnode;
if (childNode.data) {
data = mergeClassData(childNode.data, data);
}
}
while (isDef(parentNode = parentNode.parent)) {
if (parentNode.data) {
data = mergeClassData(data, parentNode.data);
}
}
return renderClass(data.staticClass, data.class)
}
function mergeClassData (child, parent) {
return {
staticClass: concat(child.staticClass, parent.staticClass),
class: isDef(child.class)
? [child.class, parent.class]
: parent.class
}
}
function renderClass (
staticClass,
dynamicClass
) {
if (isDef(staticClass) || isDef(dynamicClass)) {
return concat(staticClass, stringifyClass(dynamicClass))
}
/* istanbul ignore next */
return ''
}
function concat (a, b) {
return a ? b ? (a + ' ' + b) : a : (b || '')
}
function stringifyClass (value) {
if (Array.isArray(value)) {
return stringifyArray(value)
}
if (isObject(value)) {
return stringifyObject(value)
}
if (typeof value === 'string') {
return value
}
/* istanbul ignore next */
return ''
}
function stringifyArray (value) {
var res = '';
var stringified;
for (var i = 0, l = value.length; i < l; i++) {
if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
if (res) { res += ' '; }
res += stringified;
}
}
return res
}
function stringifyObject (value) {
var res = '';
for (var key in value) {
if (value[key]) {
if (res) { res += ' '; }
res += key;
}
}
return res
}
/* */
var namespaceMap = {
svg: 'http://www.w3.org/2000/svg',
math: 'http://www.w3.org/1998/Math/MathML'
};
var isHTMLTag = makeMap(
'html,body,base,head,link,meta,style,title,' +
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
'embed,object,param,source,canvas,script,noscript,del,ins,' +
'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
'output,progress,select,textarea,' +
'details,dialog,menu,menuitem,summary,' +
'content,element,shadow,template,blockquote,iframe,tfoot'
);
// this map is intentionally selective, only covering SVG elements that may
// contain child elements.
var isSVG = makeMap(
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
true
);
var isReservedTag = function (tag) {
return isHTMLTag(tag) || isSVG(tag)
};
function getTagNamespace (tag) {
if (isSVG(tag)) {
return 'svg'
}
// basic support for MathML
// note it doesn't support other MathML elements being component roots
if (tag === 'math') {
return 'math'
}
}
var unknownElementCache = Object.create(null);
function isUnknownElement (tag) {
/* istanbul ignore if */
if (!inBrowser) {
return true
}
if (isReservedTag(tag)) {
return false
}
tag = tag.toLowerCase();
/* istanbul ignore if */
if (unknownElementCache[tag] != null) {
return unknownElementCache[tag]
}
var el = document.createElement(tag);
if (tag.indexOf('-') > -1) {
// http://stackoverflow.com/a/28210364/1070244
return (unknownElementCache[tag] = (
el.constructor === window.HTMLUnknownElement ||
el.constructor === window.HTMLElement
))
} else {
return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
}
}
/* */
/**
* Query an element selector if it's not an element already.
*/
function query (el) {
if (typeof el === 'string') {
var selected = document.querySelector(el);
if (!selected) {
process.env.NODE_ENV !== 'production' && warn(
'Cannot find element: ' + el
);
return document.createElement('div')
}
return selected
} else {
return el
}
}
/* */
function createElement$1 (tagName, vnode) {
var elm = document.createElement(tagName);
if (tagName !== 'select') {
return elm
}
// false or null will remove the attribute but undefined will not
if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
elm.setAttribute('multiple', 'multiple');
}
return elm
}
function createElementNS (namespace, tagName) {
return document.createElementNS(namespaceMap[namespace], tagName)
}
function createTextNode (text) {
return document.createTextNode(text)
}
function createComment (text) {
return document.createComment(text)
}
function insertBefore (parentNode, newNode, referenceNode) {
parentNode.insertBefore(newNode, referenceNode);
}
function removeChild (node, child) {
node.removeChild(child);
}
function appendChild (node, child) {
node.appendChild(child);
}
function parentNode (node) {
return node.parentNode
}
function nextSibling (node) {
return node.nextSibling
}
function tagName (node) {
return node.tagName
}
function setTextContent (node, text) {
node.textContent = text;
}
function setAttribute (node, key, val) {
node.setAttribute(key, val);
}
var nodeOps = Object.freeze({
createElement: createElement$1,
createElementNS: createElementNS,
createTextNode: createTextNode,
createComment: createComment,
insertBefore: insertBefore,
removeChild: removeChild,
appendChild: appendChild,
parentNode: parentNode,
nextSibling: nextSibling,
tagName: tagName,
setTextContent: setTextContent,
setAttribute: setAttribute
});
/* */
var ref = {
create: function create (_, vnode) {
registerRef(vnode);
},
update: function update (oldVnode, vnode) {
if (oldVnode.data.ref !== vnode.data.ref) {
registerRef(oldVnode, true);
registerRef(vnode);
}
},
destroy: function destroy (vnode) {
registerRef(vnode, true);
}
};
function registerRef (vnode, isRemoval) {
var key = vnode.data.ref;
if (!key) { return }
var vm = vnode.context;
var ref = vnode.componentInstance || vnode.elm;
var refs = vm.$refs;
if (isRemoval) {
if (Array.isArray(refs[key])) {
remove(refs[key], ref);
} else if (refs[key] === ref) {
refs[key] = undefined;
}
} else {
if (vnode.data.refInFor) {
if (!Array.isArray(refs[key])) {
refs[key] = [ref];
} else if (refs[key].indexOf(ref) < 0) {
// $flow-disable-line
refs[key].push(ref);
}
} else {
refs[key] = ref;
}
}
}
/**
* Virtual DOM patching algorithm based on Snabbdom by
* Simon Friis Vindum (@paldepind)
* Licensed under the MIT License
* https://github.com/paldepind/snabbdom/blob/master/LICENSE
*
* modified by Evan You (@yyx990803)
*
/*
* Not type-checking this because this file is perf-critical and the cost
* of making flow understand it is not worth it.
*/
var emptyNode = new VNode('', {}, []);
var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
function sameVnode (a, b) {
return (
a.key === b.key && (
(
a.tag === b.tag &&
a.isComment === b.isComment &&
isDef(a.data) === isDef(b.data) &&
sameInputType(a, b)
) || (
isTrue(a.isAsyncPlaceholder) &&
a.asyncFactory === b.asyncFactory &&
isUndef(b.asyncFactory.error)
)
)
)
}
// Some browsers do not support dynamically changing type for <input>
// so they need to be treated as different nodes
function sameInputType (a, b) {
if (a.tag !== 'input') { return true }
var i;
var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
return typeA === typeB
}
function createKeyToOldIdx (children, beginIdx, endIdx) {
var i, key;
var map = {};
for (i = beginIdx; i <= endIdx; ++i) {
key = children[i].key;
if (isDef(key)) { map[key] = i; }
}
return map
}
function createPatchFunction (backend) {
var i, j;
var cbs = {};
var modules = backend.modules;
var nodeOps = backend.nodeOps;
for (i = 0; i < hooks.length; ++i) {
cbs[hooks[i]] = [];
for (j = 0; j < modules.length; ++j) {
if (isDef(modules[j][hooks[i]])) {
cbs[hooks[i]].push(modules[j][hooks[i]]);
}
}
}
function emptyNodeAt (elm) {
return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
}
function createRmCb (childElm, listeners) {
function remove$$1 () {
if (--remove$$1.listeners === 0) {
removeNode(childElm);
}
}
remove$$1.listeners = listeners;
return remove$$1
}
function removeNode (el) {
var parent = nodeOps.parentNode(el);
// element may have already been removed due to v-html / v-text
if (isDef(parent)) {
nodeOps.removeChild(parent, el);
}
}
var inPre = 0;
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
vnode.isRootInsert = !nested; // for transition enter check
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
return
}
var data = vnode.data;
var children = vnode.children;
var tag = vnode.tag;
if (isDef(tag)) {
if (process.env.NODE_ENV !== 'production') {
if (data && data.pre) {
inPre++;
}
if (
!inPre &&
!vnode.ns &&
!(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
config.isUnknownElement(tag)
) {
warn(
'Unknown custom element: <' + tag + '> - did you ' +
'register the component correctly? For recursive components, ' +
'make sure to provide the "name" option.',
vnode.context
);
}
}
vnode.elm = vnode.ns
? nodeOps.createElementNS(vnode.ns, tag)
: nodeOps.createElement(tag, vnode);
setScope(vnode);
/* istanbul ignore if */
{
createChildren(vnode, children, insertedVnodeQueue);
if (isDef(data)) {
invokeCreateHooks(vnode, insertedVnodeQueue);
}
insert(parentElm, vnode.elm, refElm);
}
if (process.env.NODE_ENV !== 'production' && data && data.pre) {
inPre--;
}
} else if (isTrue(vnode.isComment)) {
vnode.elm = nodeOps.createComment(vnode.text);
insert(parentElm, vnode.elm, refElm);
} else {
vnode.elm = nodeOps.createTextNode(vnode.text);
insert(parentElm, vnode.elm, refElm);
}
}
function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
var i = vnode.data;
if (isDef(i)) {
var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
if (isDef(i = i.hook) && isDef(i = i.init)) {
i(vnode, false /* hydrating */, parentElm, refElm);
}
// after calling the init hook, if the vnode is a child component
// it should've created a child instance and mounted it. the child
// component also has set the placeholder vnode's elm.
// in that case we can just return the element and be done.
if (isDef(vnode.componentInstance)) {
initComponent(vnode, insertedVnodeQueue);
if (isTrue(isReactivated)) {
reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
}
return true
}
}
}
function initComponent (vnode, insertedVnodeQueue) {
if (isDef(vnode.data.pendingInsert)) {
insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
vnode.data.pendingInsert = null;
}
vnode.elm = vnode.componentInstance.$el;
if (isPatchable(vnode)) {
invokeCreateHooks(vnode, insertedVnodeQueue);
setScope(vnode);
} else {
// empty component root.
// skip all element-related modules except for ref (#3455)
registerRef(vnode);
// make sure to invoke the insert hook
insertedVnodeQueue.push(vnode);
}
}
function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
var i;
// hack for #4339: a reactivated component with inner transition
// does not trigger because the inner node's created hooks are not called
// again. It's not ideal to involve module-specific logic in here but
// there doesn't seem to be a better way to do it.
var innerNode = vnode;
while (innerNode.componentInstance) {
innerNode = innerNode.componentInstance._vnode;
if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
for (i = 0; i < cbs.activate.length; ++i) {
cbs.activate[i](emptyNode, innerNode);
}
insertedVnodeQueue.push(innerNode);
break
}
}
// unlike a newly created component,
// a reactivated keep-alive component doesn't insert itself
insert(parentElm, vnode.elm, refElm);
}
function insert (parent, elm, ref$$1) {
if (isDef(parent)) {
if (isDef(ref$$1)) {
if (ref$$1.parentNode === parent) {
nodeOps.insertBefore(parent, elm, ref$$1);
}
} else {
nodeOps.appendChild(parent, elm);
}
}
}
function createChildren (vnode, children, insertedVnodeQueue) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; ++i) {
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
}
} else if (isPrimitive(vnode.text)) {
nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
}
}
function isPatchable (vnode) {
while (vnode.componentInstance) {
vnode = vnode.componentInstance._vnode;
}
return isDef(vnode.tag)
}
function invokeCreateHooks (vnode, insertedVnodeQueue) {
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
cbs.create[i$1](emptyNode, vnode);
}
i = vnode.data.hook; // Reuse variable
if (isDef(i)) {
if (isDef(i.create)) { i.create(emptyNode, vnode); }
if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
}
}
// set scope id attribute for scoped CSS.
// this is implemented as a special case to avoid the overhead
// of going through the normal attribute patching process.
function setScope (vnode) {
var i;
var ancestor = vnode;
while (ancestor) {
if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
nodeOps.setAttribute(vnode.elm, i, '');
}
ancestor = ancestor.parent;
}
// for slot content they should also get the scopeId from the host instance.
if (isDef(i = activeInstance) &&
i !== vnode.context &&
isDef(i = i.$options._scopeId)
) {
nodeOps.setAttribute(vnode.elm, i, '');
}
}
function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
for (; startIdx <= endIdx; ++startIdx) {
createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
}
}
function invokeDestroyHook (vnode) {
var i, j;
var data = vnode.data;
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
}
if (isDef(i = vnode.children)) {
for (j = 0; j < vnode.children.length; ++j) {
invokeDestroyHook(vnode.children[j]);
}
}
}
function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
for (; startIdx <= endIdx; ++startIdx) {
var ch = vnodes[startIdx];
if (isDef(ch)) {
if (isDef(ch.tag)) {
removeAndInvokeRemoveHook(ch);
invokeDestroyHook(ch);
} else { // Text node
removeNode(ch.elm);
}
}
}
}
function removeAndInvokeRemoveHook (vnode, rm) {
if (isDef(rm) || isDef(vnode.data)) {
var i;
var listeners = cbs.remove.length + 1;
if (isDef(rm)) {
// we have a recursively passed down rm callback
// increase the listeners count
rm.listeners += listeners;
} else {
// directly removing
rm = createRmCb(vnode.elm, listeners);
}
// recursively invoke hooks on child component root node
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
removeAndInvokeRemoveHook(i, rm);
}
for (i = 0; i < cbs.remove.length; ++i) {
cbs.remove[i](vnode, rm);
}
if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
i(vnode, rm);
} else {
rm();
}
} else {
removeNode(vnode.elm);
}
}
function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
var oldStartIdx = 0;
var newStartIdx = 0;
var oldEndIdx = oldCh.length - 1;
var oldStartVnode = oldCh[0];
var oldEndVnode = oldCh[oldEndIdx];
var newEndIdx = newCh.length - 1;
var newStartVnode = newCh[0];
var newEndVnode = newCh[newEndIdx];
var oldKeyToIdx, idxInOld, elmToMove, refElm;
// removeOnly is a special flag used only by <transition-group>
// to ensure removed elements stay in correct relative positions
// during leaving transitions
var canMove = !removeOnly;
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
if (isUndef(oldStartVnode)) {
oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
} else if (isUndef(oldEndVnode)) {
oldEndVnode = oldCh[--oldEndIdx];
} else if (sameVnode(oldStartVnode, newStartVnode)) {
patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
} else if (sameVnode(oldEndVnode, newEndVnode)) {
patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
} else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
} else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
} else {
if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
if (isUndef(idxInOld)) { // New element
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
newStartVnode = newCh[++newStartIdx];
} else {
elmToMove = oldCh[idxInOld];
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && !elmToMove) {
warn(
'It seems there are duplicate keys that is causing an update error. ' +
'Make sure each v-for item has a unique key.'
);
}
if (sameVnode(elmToMove, newStartVnode)) {
patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
oldCh[idxInOld] = undefined;
canMove && nodeOps.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
newStartVnode = newCh[++newStartIdx];
} else {
// same key but different element. treat as new element
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
newStartVnode = newCh[++newStartIdx];
}
}
}
}
if (oldStartIdx > oldEndIdx) {
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
} else if (newStartIdx > newEndIdx) {
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
}
}
function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
if (oldVnode === vnode) {
return
}
var elm = vnode.elm = oldVnode.elm;
if (isTrue(oldVnode.isAsyncPlaceholder)) {
if (isDef(vnode.asyncFactory.resolved)) {
hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
} else {
vnode.isAsyncPlaceholder = true;
}
return
}
// reuse element for static trees.
// note we only do this if the vnode is cloned -
// if the new node is not cloned it means the render functions have been
// reset by the hot-reload-api and we need to do a proper re-render.
if (isTrue(vnode.isStatic) &&
isTrue(oldVnode.isStatic) &&
vnode.key === oldVnode.key &&
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
) {
vnode.componentInstance = oldVnode.componentInstance;
return
}
var i;
var data = vnode.data;
if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
i(oldVnode, vnode);
}
var oldCh = oldVnode.children;
var ch = vnode.children;
if (isDef(data) && isPatchable(vnode)) {
for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
}
if (isUndef(vnode.text)) {
if (isDef(oldCh) && isDef(ch)) {
if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
} else if (isDef(ch)) {
if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
} else if (isDef(oldCh)) {
removeVnodes(elm, oldCh, 0, oldCh.length - 1);
} else if (isDef(oldVnode.text)) {
nodeOps.setTextContent(elm, '');
}
} else if (oldVnode.text !== vnode.text) {
nodeOps.setTextContent(elm, vnode.text);
}
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
}
}
function invokeInsertHook (vnode, queue, initial) {
// delay insert hooks for component root nodes, invoke them after the
// element is really inserted
if (isTrue(initial) && isDef(vnode.parent)) {
vnode.parent.data.pendingInsert = queue;
} else {
for (var i = 0; i < queue.length; ++i) {
queue[i].data.hook.insert(queue[i]);
}
}
}
var bailed = false;
// list of modules that can skip create hook during hydration because they
// are already rendered on the client or has no need for initialization
var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
// Note: this is a browser-only function so we can assume elms are DOM nodes.
function hydrate (elm, vnode, insertedVnodeQueue) {
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.elm = elm;
vnode.isAsyncPlaceholder = true;
return true
}
if (process.env.NODE_ENV !== 'production') {
if (!assertNodeMatch(elm, vnode)) {
return false
}
}
vnode.elm = elm;
var tag = vnode.tag;
var data = vnode.data;
var children = vnode.children;
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
if (isDef(i = vnode.componentInstance)) {
// child component. it should have hydrated its own tree.
initComponent(vnode, insertedVnodeQueue);
return true
}
}
if (isDef(tag)) {
if (isDef(children)) {
// empty element, allow client to pick up and populate children
if (!elm.hasChildNodes()) {
createChildren(vnode, children, insertedVnodeQueue);
} else {
var childrenMatch = true;
var childNode = elm.firstChild;
for (var i$1 = 0; i$1 < children.length; i$1++) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
childrenMatch = false;
break
}
childNode = childNode.nextSibling;
}
// if childNode is not null, it means the actual childNodes list is
// longer than the virtual children list.
if (!childrenMatch || childNode) {
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed
) {
bailed = true;
console.warn('Parent: ', elm);
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
}
return false
}
}
}
if (isDef(data)) {
for (var key in data) {
if (!isRenderedModule(key)) {
invokeCreateHooks(vnode, insertedVnodeQueue);
break
}
}
}
} else if (elm.data !== vnode.text) {
elm.data = vnode.text;
}
return true
}
function assertNodeMatch (node, vnode) {
if (isDef(vnode.tag)) {
return (
vnode.tag.indexOf('vue-component') === 0 ||
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
)
} else {
return node.nodeType === (vnode.isComment ? 8 : 3)
}
}
return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
if (isUndef(vnode)) {
if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
return
}
var isInitialPatch = false;
var insertedVnodeQueue = [];
if (isUndef(oldVnode)) {
// empty mount (likely as component), create new root element
isInitialPatch = true;
createElm(vnode, insertedVnodeQueue, parentElm, refElm);
} else {
var isRealElement = isDef(oldVnode.nodeType);
if (!isRealElement && sameVnode(oldVnode, vnode)) {
// patch existing root node
patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
} else {
if (isRealElement) {
// mounting to a real element
// check if this is server-rendered content and if we can perform
// a successful hydration.
if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
oldVnode.removeAttribute(SSR_ATTR);
hydrating = true;
}
if (isTrue(hydrating)) {
if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
invokeInsertHook(vnode, insertedVnodeQueue, true);
return oldVnode
} else if (process.env.NODE_ENV !== 'production') {
warn(
'The client-side rendered virtual DOM tree is not matching ' +
'server-rendered content. This is likely caused by incorrect ' +
'HTML markup, for example nesting block-level elements inside ' +
'<p>, or missing <tbody>. Bailing hydration and performing ' +
'full client-side render.'
);
}
}
// either not server-rendered, or hydration failed.
// create an empty node and replace it
oldVnode = emptyNodeAt(oldVnode);
}
// replacing existing element
var oldElm = oldVnode.elm;
var parentElm$1 = nodeOps.parentNode(oldElm);
createElm(
vnode,
insertedVnodeQueue,
// extremely rare edge case: do not insert if old element is in a
// leaving transition. Only happens when combining transition +
// keep-alive + HOCs. (#4590)
oldElm._leaveCb ? null : parentElm$1,
nodeOps.nextSibling(oldElm)
);
if (isDef(vnode.parent)) {
// component root element replaced.
// update parent placeholder node element, recursively
var ancestor = vnode.parent;
while (ancestor) {
ancestor.elm = vnode.elm;
ancestor = ancestor.parent;
}
if (isPatchable(vnode)) {
for (var i = 0; i < cbs.create.length; ++i) {
cbs.create[i](emptyNode, vnode.parent);
}
}
}
if (isDef(parentElm$1)) {
removeVnodes(parentElm$1, [oldVnode], 0, 0);
} else if (isDef(oldVnode.tag)) {
invokeDestroyHook(oldVnode);
}
}
}
invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
return vnode.elm
}
}
/* */
var directives = {
create: updateDirectives,
update: updateDirectives,
destroy: function unbindDirectives (vnode) {
updateDirectives(vnode, emptyNode);
}
};
function updateDirectives (oldVnode, vnode) {
if (oldVnode.data.directives || vnode.data.directives) {
_update(oldVnode, vnode);
}
}
function _update (oldVnode, vnode) {
var isCreate = oldVnode === emptyNode;
var isDestroy = vnode === emptyNode;
var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
var dirsWithInsert = [];
var dirsWithPostpatch = [];
var key, oldDir, dir;
for (key in newDirs) {
oldDir = oldDirs[key];
dir = newDirs[key];
if (!oldDir) {
// new directive, bind
callHook$1(dir, 'bind', vnode, oldVnode);
if (dir.def && dir.def.inserted) {
dirsWithInsert.push(dir);
}
} else {
// existing directive, update
dir.oldValue = oldDir.value;
callHook$1(dir, 'update', vnode, oldVnode);
if (dir.def && dir.def.componentUpdated) {
dirsWithPostpatch.push(dir);
}
}
}
if (dirsWithInsert.length) {
var callInsert = function () {
for (var i = 0; i < dirsWithInsert.length; i++) {
callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
}
};
if (isCreate) {
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert);
} else {
callInsert();
}
}
if (dirsWithPostpatch.length) {
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
for (var i = 0; i < dirsWithPostpatch.length; i++) {
callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
}
});
}
if (!isCreate) {
for (key in oldDirs) {
if (!newDirs[key]) {
// no longer present, unbind
callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
}
}
}
}
var emptyModifiers = Object.create(null);
function normalizeDirectives$1 (
dirs,
vm
) {
var res = Object.create(null);
if (!dirs) {
return res
}
var i, dir;
for (i = 0; i < dirs.length; i++) {
dir = dirs[i];
if (!dir.modifiers) {
dir.modifiers = emptyModifiers;
}
res[getRawDirName(dir)] = dir;
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
}
return res
}
function getRawDirName (dir) {
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
}
function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
var fn = dir.def && dir.def[hook];
if (fn) {
try {
fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
} catch (e) {
handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
}
}
}
var baseModules = [
ref,
directives
];
/* */
function updateAttrs (oldVnode, vnode) {
var opts = vnode.componentOptions;
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
return
}
if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
return
}
var key, cur, old;
var elm = vnode.elm;
var oldAttrs = oldVnode.data.attrs || {};
var attrs = vnode.data.attrs || {};
// clone observed objects, as the user probably wants to mutate it
if (isDef(attrs.__ob__)) {
attrs = vnode.data.attrs = extend({}, attrs);
}
for (key in attrs) {
cur = attrs[key];
old = oldAttrs[key];
if (old !== cur) {
setAttr(elm, key, cur);
}
}
// #4391: in IE9, setting type can reset value for input[type=radio]
/* istanbul ignore if */
if (isIE9 && attrs.value !== oldAttrs.value) {
setAttr(elm, 'value', attrs.value);
}
for (key in oldAttrs) {
if (isUndef(attrs[key])) {
if (isXlink(key)) {
elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
} else if (!isEnumeratedAttr(key)) {
elm.removeAttribute(key);
}
}
}
}
function setAttr (el, key, value) {
if (isBooleanAttr(key)) {
// set attribute for blank value
// e.g. <option disabled>Select one</option>
if (isFalsyAttrValue(value)) {
el.removeAttribute(key);
} else {
el.setAttribute(key, key);
}
} else if (isEnumeratedAttr(key)) {
el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
} else if (isXlink(key)) {
if (isFalsyAttrValue(value)) {
el.removeAttributeNS(xlinkNS, getXlinkProp(key));
} else {
el.setAttributeNS(xlinkNS, key, value);
}
} else {
if (isFalsyAttrValue(value)) {
el.removeAttribute(key);
} else {
el.setAttribute(key, value);
}
}
}
var attrs = {
create: updateAttrs,
update: updateAttrs
};
/* */
function updateClass (oldVnode, vnode) {
var el = vnode.elm;
var data = vnode.data;
var oldData = oldVnode.data;
if (
isUndef(data.staticClass) &&
isUndef(data.class) && (
isUndef(oldData) || (
isUndef(oldData.staticClass) &&
isUndef(oldData.class)
)
)
) {
return
}
var cls = genClassForVnode(vnode);
// handle transition classes
var transitionClass = el._transitionClasses;
if (isDef(transitionClass)) {
cls = concat(cls, stringifyClass(transitionClass));
}
// set the class
if (cls !== el._prevClass) {
el.setAttribute('class', cls);
el._prevClass = cls;
}
}
var klass = {
create: updateClass,
update: updateClass
};
/* */
var validDivisionCharRE = /[\w).+\-_$\]]/;
function wrapFilter (exp, filter) {
var i = filter.indexOf('(');
if (i < 0) {
// _f: resolveFilter
return ("_f(\"" + filter + "\")(" + exp + ")")
} else {
var name = filter.slice(0, i);
var args = filter.slice(i + 1);
return ("_f(\"" + name + "\")(" + exp + "," + args)
}
}
/* */
/* */
/**
* Cross-platform code generation for component v-model
*/
/**
* Cross-platform codegen helper for generating v-model value assignment code.
*/
/**
* parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
*
* for loop possible cases:
*
* - test
* - test[idx]
* - test[test1[idx]]
* - test["a"][idx]
* - xxx.test[a[a].test1[idx]]
* - test.xxx.a["asa"][test1[idx]]
*
*/
var str;
var index$1;
/* */
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
var RANGE_TOKEN = '__r';
var CHECKBOX_RADIO_TOKEN = '__c';
/* */
// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
// user-attached handlers.
function normalizeEvents (on) {
var event;
/* istanbul ignore if */
if (isDef(on[RANGE_TOKEN])) {
// IE input[type=range] only supports `change` event
event = isIE ? 'change' : 'input';
on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
delete on[RANGE_TOKEN];
}
if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
// Chrome fires microtasks in between click/change, leads to #4521
event = isChrome ? 'click' : 'change';
on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []);
delete on[CHECKBOX_RADIO_TOKEN];
}
}
var target$1;
function add$1 (
event,
handler,
once$$1,
capture,
passive
) {
if (once$$1) {
var oldHandler = handler;
var _target = target$1; // save current target element in closure
handler = function (ev) {
var res = arguments.length === 1
? oldHandler(ev)
: oldHandler.apply(null, arguments);
if (res !== null) {
remove$2(event, handler, capture, _target);
}
};
}
target$1.addEventListener(
event,
handler,
supportsPassive
? { capture: capture, passive: passive }
: capture
);
}
function remove$2 (
event,
handler,
capture,
_target
) {
(_target || target$1).removeEventListener(event, handler, capture);
}
function updateDOMListeners (oldVnode, vnode) {
var isComponentRoot = isDef(vnode.componentOptions);
var oldOn = isComponentRoot ? oldVnode.data.nativeOn : oldVnode.data.on;
var on = isComponentRoot ? vnode.data.nativeOn : vnode.data.on;
if (isUndef(oldOn) && isUndef(on)) {
return
}
on = on || {};
oldOn = oldOn || {};
target$1 = vnode.elm;
normalizeEvents(on);
updateListeners(on, oldOn, add$1, remove$2, vnode.context);
}
var events = {
create: updateDOMListeners,
update: updateDOMListeners
};
/* */
function updateDOMProps (oldVnode, vnode) {
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
return
}
var key, cur;
var elm = vnode.elm;
var oldProps = oldVnode.data.domProps || {};
var props = vnode.data.domProps || {};
// clone observed objects, as the user probably wants to mutate it
if (isDef(props.__ob__)) {
props = vnode.data.domProps = extend({}, props);
}
for (key in oldProps) {
if (isUndef(props[key])) {
elm[key] = '';
}
}
for (key in props) {
cur = props[key];
// ignore children if the node has textContent or innerHTML,
// as these will throw away existing DOM nodes and cause removal errors
// on subsequent patches (#3360)
if (key === 'textContent' || key === 'innerHTML') {
if (vnode.children) { vnode.children.length = 0; }
if (cur === oldProps[key]) { continue }
}
if (key === 'value') {
// store value as _value as well since
// non-string values will be stringified
elm._value = cur;
// avoid resetting cursor position when value is the same
var strCur = isUndef(cur) ? '' : String(cur);
if (shouldUpdateValue(elm, vnode, strCur)) {
elm.value = strCur;
}
} else {
elm[key] = cur;
}
}
}
// check platforms/web/util/attrs.js acceptValue
function shouldUpdateValue (
elm,
vnode,
checkVal
) {
return (!elm.composing && (
vnode.tag === 'option' ||
isDirty(elm, checkVal) ||
isInputChanged(elm, checkVal)
))
}
function isDirty (elm, checkVal) {
// return true when textbox (.number and .trim) loses focus and its value is
// not equal to the updated value
return document.activeElement !== elm && elm.value !== checkVal
}
function isInputChanged (elm, newVal) {
var value = elm.value;
var modifiers = elm._vModifiers; // injected by v-model runtime
if (isDef(modifiers) && modifiers.number) {
return toNumber(value) !== toNumber(newVal)
}
if (isDef(modifiers) && modifiers.trim) {
return value.trim() !== newVal.trim()
}
return value !== newVal
}
var domProps = {
create: updateDOMProps,
update: updateDOMProps
};
/* */
var parseStyleText = cached(function (cssText) {
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
var propertyDelimiter = /:(.+)/;
cssText.split(listDelimiter).forEach(function (item) {
if (item) {
var tmp = item.split(propertyDelimiter);
tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
}
});
return res
});
// merge static and dynamic style data on the same vnode
function normalizeStyleData (data) {
var style = normalizeStyleBinding(data.style);
// static style is pre-processed into an object during compilation
// and is always a fresh object, so it's safe to merge into it
return data.staticStyle
? extend(data.staticStyle, style)
: style
}
// normalize possible array / string values into Object
function normalizeStyleBinding (bindingStyle) {
if (Array.isArray(bindingStyle)) {
return toObject(bindingStyle)
}
if (typeof bindingStyle === 'string') {
return parseStyleText(bindingStyle)
}
return bindingStyle
}
/**
* parent component style should be after child's
* so that parent component's style could override it
*/
function getStyle (vnode, checkChild) {
var res = {};
var styleData;
if (checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
extend(res, styleData);
}
}
}
if ((styleData = normalizeStyleData(vnode.data))) {
extend(res, styleData);
}
var parentNode = vnode;
while ((parentNode = parentNode.parent)) {
if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
extend(res, styleData);
}
}
return res
}
/* */
var cssVarRE = /^--/;
var importantRE = /\s*!important$/;
var setProp = function (el, name, val) {
/* istanbul ignore if */
if (cssVarRE.test(name)) {
el.style.setProperty(name, val);
} else if (importantRE.test(val)) {
el.style.setProperty(name, val.replace(importantRE, ''), 'important');
} else {
var normalizedName = normalize(name);
if (Array.isArray(val)) {
// Support values array created by autoprefixer, e.g.
// {display: ["-webkit-box", "-ms-flexbox", "flex"]}
// Set them one by one, and the browser will only set those it can recognize
for (var i = 0, len = val.length; i < len; i++) {
el.style[normalizedName] = val[i];
}
} else {
el.style[normalizedName] = val;
}
}
};
var vendorNames = ['Webkit', 'Moz', 'ms'];
var emptyStyle;
var normalize = cached(function (prop) {
emptyStyle = emptyStyle || document.createElement('div').style;
prop = camelize(prop);
if (prop !== 'filter' && (prop in emptyStyle)) {
return prop
}
var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
for (var i = 0; i < vendorNames.length; i++) {
var name = vendorNames[i] + capName;
if (name in emptyStyle) {
return name
}
}
});
function updateStyle (oldVnode, vnode) {
var data = vnode.data;
var oldData = oldVnode.data;
if (isUndef(data.staticStyle) && isUndef(data.style) &&
isUndef(oldData.staticStyle) && isUndef(oldData.style)
) {
return
}
var cur, name;
var el = vnode.elm;
var oldStaticStyle = oldData.staticStyle;
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
// if static style exists, stylebinding already merged into it when doing normalizeStyleData
var oldStyle = oldStaticStyle || oldStyleBinding;
var style = normalizeStyleBinding(vnode.data.style) || {};
// store normalized style under a different key for next diff
// make sure to clone it if it's reactive, since the user likley wants
// to mutate it.
vnode.data.normalizedStyle = isDef(style.__ob__)
? extend({}, style)
: style;
var newStyle = getStyle(vnode, true);
for (name in oldStyle) {
if (isUndef(newStyle[name])) {
setProp(el, name, '');
}
}
for (name in newStyle) {
cur = newStyle[name];
if (cur !== oldStyle[name]) {
// ie9 setting to null has no effect, must use empty string
setProp(el, name, cur == null ? '' : cur);
}
}
}
var style = {
create: updateStyle,
update: updateStyle
};
/* */
/**
* Add class with compatibility for SVG since classList is not supported on
* SVG elements in IE
*/
function addClass (el, cls) {
/* istanbul ignore if */
if (!cls || !(cls = cls.trim())) {
return
}
/* istanbul ignore else */
if (el.classList) {
if (cls.indexOf(' ') > -1) {
cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
} else {
el.classList.add(cls);
}
} else {
var cur = " " + (el.getAttribute('class') || '') + " ";
if (cur.indexOf(' ' + cls + ' ') < 0) {
el.setAttribute('class', (cur + cls).trim());
}
}
}
/**
* Remove class with compatibility for SVG since classList is not supported on
* SVG elements in IE
*/
function removeClass (el, cls) {
/* istanbul ignore if */
if (!cls || !(cls = cls.trim())) {
return
}
/* istanbul ignore else */
if (el.classList) {
if (cls.indexOf(' ') > -1) {
cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
} else {
el.classList.remove(cls);
}
if (!el.classList.length) {
el.removeAttribute('class');
}
} else {
var cur = " " + (el.getAttribute('class') || '') + " ";
var tar = ' ' + cls + ' ';
while (cur.indexOf(tar) >= 0) {
cur = cur.replace(tar, ' ');
}
cur = cur.trim();
if (cur) {
el.setAttribute('class', cur);
} else {
el.removeAttribute('class');
}
}
}
/* */
function resolveTransition (def$$1) {
if (!def$$1) {
return
}
/* istanbul ignore else */
if (typeof def$$1 === 'object') {
var res = {};
if (def$$1.css !== false) {
extend(res, autoCssTransition(def$$1.name || 'v'));
}
extend(res, def$$1);
return res
} else if (typeof def$$1 === 'string') {
return autoCssTransition(def$$1)
}
}
var autoCssTransition = cached(function (name) {
return {
enterClass: (name + "-enter"),
enterToClass: (name + "-enter-to"),
enterActiveClass: (name + "-enter-active"),
leaveClass: (name + "-leave"),
leaveToClass: (name + "-leave-to"),
leaveActiveClass: (name + "-leave-active")
}
});
var hasTransition = inBrowser && !isIE9;
var TRANSITION = 'transition';
var ANIMATION = 'animation';
// Transition property/event sniffing
var transitionProp = 'transition';
var transitionEndEvent = 'transitionend';
var animationProp = 'animation';
var animationEndEvent = 'animationend';
if (hasTransition) {
/* istanbul ignore if */
if (window.ontransitionend === undefined &&
window.onwebkittransitionend !== undefined
) {
transitionProp = 'WebkitTransition';
transitionEndEvent = 'webkitTransitionEnd';
}
if (window.onanimationend === undefined &&
window.onwebkitanimationend !== undefined
) {
animationProp = 'WebkitAnimation';
animationEndEvent = 'webkitAnimationEnd';
}
}
// binding to window is necessary to make hot reload work in IE in strict mode
var raf = inBrowser && window.requestAnimationFrame
? window.requestAnimationFrame.bind(window)
: setTimeout;
function nextFrame (fn) {
raf(function () {
raf(fn);
});
}
function addTransitionClass (el, cls) {
var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
if (transitionClasses.indexOf(cls) < 0) {
transitionClasses.push(cls);
addClass(el, cls);
}
}
function removeTransitionClass (el, cls) {
if (el._transitionClasses) {
remove(el._transitionClasses, cls);
}
removeClass(el, cls);
}
function whenTransitionEnds (
el,
expectedType,
cb
) {
var ref = getTransitionInfo(el, expectedType);
var type = ref.type;
var timeout = ref.timeout;
var propCount = ref.propCount;
if (!type) { return cb() }
var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
var ended = 0;
var end = function () {
el.removeEventListener(event, onEnd);
cb();
};
var onEnd = function (e) {
if (e.target === el) {
if (++ended >= propCount) {
end();
}
}
};
setTimeout(function () {
if (ended < propCount) {
end();
}
}, timeout + 1);
el.addEventListener(event, onEnd);
}
var transformRE = /\b(transform|all)(,|$)/;
function getTransitionInfo (el, expectedType) {
var styles = window.getComputedStyle(el);
var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
var animationDelays = styles[animationProp + 'Delay'].split(', ');
var animationDurations = styles[animationProp + 'Duration'].split(', ');
var animationTimeout = getTimeout(animationDelays, animationDurations);
var type;
var timeout = 0;
var propCount = 0;
/* istanbul ignore if */
if (expectedType === TRANSITION) {
if (transitionTimeout > 0) {
type = TRANSITION;
timeout = transitionTimeout;
propCount = transitionDurations.length;
}
} else if (expectedType === ANIMATION) {
if (animationTimeout > 0) {
type = ANIMATION;
timeout = animationTimeout;
propCount = animationDurations.length;
}
} else {
timeout = Math.max(transitionTimeout, animationTimeout);
type = timeout > 0
? transitionTimeout > animationTimeout
? TRANSITION
: ANIMATION
: null;
propCount = type
? type === TRANSITION
? transitionDurations.length
: animationDurations.length
: 0;
}
var hasTransform =
type === TRANSITION &&
transformRE.test(styles[transitionProp + 'Property']);
return {
type: type,
timeout: timeout,
propCount: propCount,
hasTransform: hasTransform
}
}
function getTimeout (delays, durations) {
/* istanbul ignore next */
while (delays.length < durations.length) {
delays = delays.concat(delays);
}
return Math.max.apply(null, durations.map(function (d, i) {
return toMs(d) + toMs(delays[i])
}))
}
function toMs (s) {
return Number(s.slice(0, -1)) * 1000
}
/* */
function enter (vnode, toggleDisplay) {
var el = vnode.elm;
// call leave callback now
if (isDef(el._leaveCb)) {
el._leaveCb.cancelled = true;
el._leaveCb();
}
var data = resolveTransition(vnode.data.transition);
if (isUndef(data)) {
return
}
/* istanbul ignore if */
if (isDef(el._enterCb) || el.nodeType !== 1) {
return
}
var css = data.css;
var type = data.type;
var enterClass = data.enterClass;
var enterToClass = data.enterToClass;
var enterActiveClass = data.enterActiveClass;
var appearClass = data.appearClass;
var appearToClass = data.appearToClass;
var appearActiveClass = data.appearActiveClass;
var beforeEnter = data.beforeEnter;
var enter = data.enter;
var afterEnter = data.afterEnter;
var enterCancelled = data.enterCancelled;
var beforeAppear = data.beforeAppear;
var appear = data.appear;
var afterAppear = data.afterAppear;
var appearCancelled = data.appearCancelled;
var duration = data.duration;
// activeInstance will always be the <transition> component managing this
// transition. One edge case to check is when the <transition> is placed
// as the root node of a child component. In that case we need to check
// <transition>'s parent for appear check.
var context = activeInstance;
var transitionNode = activeInstance.$vnode;
while (transitionNode && transitionNode.parent) {
transitionNode = transitionNode.parent;
context = transitionNode.context;
}
var isAppear = !context._isMounted || !vnode.isRootInsert;
if (isAppear && !appear && appear !== '') {
return
}
var startClass = isAppear && appearClass
? appearClass
: enterClass;
var activeClass = isAppear && appearActiveClass
? appearActiveClass
: enterActiveClass;
var toClass = isAppear && appearToClass
? appearToClass
: enterToClass;
var beforeEnterHook = isAppear
? (beforeAppear || beforeEnter)
: beforeEnter;
var enterHook = isAppear
? (typeof appear === 'function' ? appear : enter)
: enter;
var afterEnterHook = isAppear
? (afterAppear || afterEnter)
: afterEnter;
var enterCancelledHook = isAppear
? (appearCancelled || enterCancelled)
: enterCancelled;
var explicitEnterDuration = toNumber(
isObject(duration)
? duration.enter
: duration
);
if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
checkDuration(explicitEnterDuration, 'enter', vnode);
}
var expectsCSS = css !== false && !isIE9;
var userWantsControl = getHookArgumentsLength(enterHook);
var cb = el._enterCb = once(function () {
if (expectsCSS) {
removeTransitionClass(el, toClass);
removeTransitionClass(el, activeClass);
}
if (cb.cancelled) {
if (expectsCSS) {
removeTransitionClass(el, startClass);
}
enterCancelledHook && enterCancelledHook(el);
} else {
afterEnterHook && afterEnterHook(el);
}
el._enterCb = null;
});
if (!vnode.data.show) {
// remove pending leave element on enter by injecting an insert hook
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
var parent = el.parentNode;
var pendingNode = parent && parent._pending && parent._pending[vnode.key];
if (pendingNode &&
pendingNode.tag === vnode.tag &&
pendingNode.elm._leaveCb
) {
pendingNode.elm._leaveCb();
}
enterHook && enterHook(el, cb);
});
}
// start enter transition
beforeEnterHook && beforeEnterHook(el);
if (expectsCSS) {
addTransitionClass(el, startClass);
addTransitionClass(el, activeClass);
nextFrame(function () {
addTransitionClass(el, toClass);
removeTransitionClass(el, startClass);
if (!cb.cancelled && !userWantsControl) {
if (isValidDuration(explicitEnterDuration)) {
setTimeout(cb, explicitEnterDuration);
} else {
whenTransitionEnds(el, type, cb);
}
}
});
}
if (vnode.data.show) {
toggleDisplay && toggleDisplay();
enterHook && enterHook(el, cb);
}
if (!expectsCSS && !userWantsControl) {
cb();
}
}
function leave (vnode, rm) {
var el = vnode.elm;
// call enter callback now
if (isDef(el._enterCb)) {
el._enterCb.cancelled = true;
el._enterCb();
}
var data = resolveTransition(vnode.data.transition);
if (isUndef(data)) {
return rm()
}
/* istanbul ignore if */
if (isDef(el._leaveCb) || el.nodeType !== 1) {
return
}
var css = data.css;
var type = data.type;
var leaveClass = data.leaveClass;
var leaveToClass = data.leaveToClass;
var leaveActiveClass = data.leaveActiveClass;
var beforeLeave = data.beforeLeave;
var leave = data.leave;
var afterLeave = data.afterLeave;
var leaveCancelled = data.leaveCancelled;
var delayLeave = data.delayLeave;
var duration = data.duration;
var expectsCSS = css !== false && !isIE9;
var userWantsControl = getHookArgumentsLength(leave);
var explicitLeaveDuration = toNumber(
isObject(duration)
? duration.leave
: duration
);
if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
checkDuration(explicitLeaveDuration, 'leave', vnode);
}
var cb = el._leaveCb = once(function () {
if (el.parentNode && el.parentNode._pending) {
el.parentNode._pending[vnode.key] = null;
}
if (expectsCSS) {
removeTransitionClass(el, leaveToClass);
removeTransitionClass(el, leaveActiveClass);
}
if (cb.cancelled) {
if (expectsCSS) {
removeTransitionClass(el, leaveClass);
}
leaveCancelled && leaveCancelled(el);
} else {
rm();
afterLeave && afterLeave(el);
}
el._leaveCb = null;
});
if (delayLeave) {
delayLeave(performLeave);
} else {
performLeave();
}
function performLeave () {
// the delayed leave may have already been cancelled
if (cb.cancelled) {
return
}
// record leaving element
if (!vnode.data.show) {
(el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
}
beforeLeave && beforeLeave(el);
if (expectsCSS) {
addTransitionClass(el, leaveClass);
addTransitionClass(el, leaveActiveClass);
nextFrame(function () {
addTransitionClass(el, leaveToClass);
removeTransitionClass(el, leaveClass);
if (!cb.cancelled && !userWantsControl) {
if (isValidDuration(explicitLeaveDuration)) {
setTimeout(cb, explicitLeaveDuration);
} else {
whenTransitionEnds(el, type, cb);
}
}
});
}
leave && leave(el, cb);
if (!expectsCSS && !userWantsControl) {
cb();
}
}
}
// only used in dev mode
function checkDuration (val, name, vnode) {
if (typeof val !== 'number') {
warn(
"<transition> explicit " + name + " duration is not a valid number - " +
"got " + (JSON.stringify(val)) + ".",
vnode.context
);
} else if (isNaN(val)) {
warn(
"<transition> explicit " + name + " duration is NaN - " +
'the duration expression might be incorrect.',
vnode.context
);
}
}
function isValidDuration (val) {
return typeof val === 'number' && !isNaN(val)
}
/**
* Normalize a transition hook's argument length. The hook may be:
* - a merged hook (invoker) with the original in .fns
* - a wrapped component method (check ._length)
* - a plain function (.length)
*/
function getHookArgumentsLength (fn) {
if (isUndef(fn)) {
return false
}
var invokerFns = fn.fns;
if (isDef(invokerFns)) {
// invoker
return getHookArgumentsLength(
Array.isArray(invokerFns)
? invokerFns[0]
: invokerFns
)
} else {
return (fn._length || fn.length) > 1
}
}
function _enter (_, vnode) {
if (vnode.data.show !== true) {
enter(vnode);
}
}
var transition = inBrowser ? {
create: _enter,
activate: _enter,
remove: function remove$$1 (vnode, rm) {
/* istanbul ignore else */
if (vnode.data.show !== true) {
leave(vnode, rm);
} else {
rm();
}
}
} : {};
var platformModules = [
attrs,
klass,
events,
domProps,
style,
transition
];
/* */
// the directive module should be applied last, after all
// built-in modules have been applied.
var modules = platformModules.concat(baseModules);
var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
/**
* Not type checking this file because flow doesn't like attaching
* properties to Elements.
*/
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
/* istanbul ignore if */
if (isIE9) {
// http://www.matts411.com/post/internet-explorer-9-oninput/
document.addEventListener('selectionchange', function () {
var el = document.activeElement;
if (el && el.vmodel) {
trigger(el, 'input');
}
});
}
var model$1 = {
inserted: function inserted (el, binding, vnode) {
if (vnode.tag === 'select') {
var cb = function () {
setSelected(el, binding, vnode.context);
};
cb();
/* istanbul ignore if */
if (isIE || isEdge) {
setTimeout(cb, 0);
}
} else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
el._vModifiers = binding.modifiers;
if (!binding.modifiers.lazy) {
// Safari < 10.2 & UIWebView doesn't fire compositionend when
// switching focus before confirming composition choice
// this also fixes the issue where some browsers e.g. iOS Chrome
// fires "change" instead of "input" on autocomplete.
el.addEventListener('change', onCompositionEnd);
if (!isAndroid) {
el.addEventListener('compositionstart', onCompositionStart);
el.addEventListener('compositionend', onCompositionEnd);
}
/* istanbul ignore if */
if (isIE9) {
el.vmodel = true;
}
}
}
},
componentUpdated: function componentUpdated (el, binding, vnode) {
if (vnode.tag === 'select') {
setSelected(el, binding, vnode.context);
// in case the options rendered by v-for have changed,
// it's possible that the value is out-of-sync with the rendered options.
// detect such cases and filter out values that no longer has a matching
// option in the DOM.
var needReset = el.multiple
? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
: binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
if (needReset) {
trigger(el, 'change');
}
}
}
};
function setSelected (el, binding, vm) {
var value = binding.value;
var isMultiple = el.multiple;
if (isMultiple && !Array.isArray(value)) {
process.env.NODE_ENV !== 'production' && warn(
"<select multiple v-model=\"" + (binding.expression) + "\"> " +
"expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
vm
);
return
}
var selected, option;
for (var i = 0, l = el.options.length; i < l; i++) {
option = el.options[i];
if (isMultiple) {
selected = looseIndexOf(value, getValue(option)) > -1;
if (option.selected !== selected) {
option.selected = selected;
}
} else {
if (looseEqual(getValue(option), value)) {
if (el.selectedIndex !== i) {
el.selectedIndex = i;
}
return
}
}
}
if (!isMultiple) {
el.selectedIndex = -1;
}
}
function hasNoMatchingOption (value, options) {
for (var i = 0, l = options.length; i < l; i++) {
if (looseEqual(getValue(options[i]), value)) {
return false
}
}
return true
}
function getValue (option) {
return '_value' in option
? option._value
: option.value
}
function onCompositionStart (e) {
e.target.composing = true;
}
function onCompositionEnd (e) {
// prevent triggering an input event for no reason
if (!e.target.composing) { return }
e.target.composing = false;
trigger(e.target, 'input');
}
function trigger (el, type) {
var e = document.createEvent('HTMLEvents');
e.initEvent(type, true, true);
el.dispatchEvent(e);
}
/* */
// recursively search for possible transition defined inside the component root
function locateNode (vnode) {
return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
? locateNode(vnode.componentInstance._vnode)
: vnode
}
var show = {
bind: function bind (el, ref, vnode) {
var value = ref.value;
vnode = locateNode(vnode);
var transition$$1 = vnode.data && vnode.data.transition;
var originalDisplay = el.__vOriginalDisplay =
el.style.display === 'none' ? '' : el.style.display;
if (value && transition$$1 && !isIE9) {
vnode.data.show = true;
enter(vnode, function () {
el.style.display = originalDisplay;
});
} else {
el.style.display = value ? originalDisplay : 'none';
}
},
update: function update (el, ref, vnode) {
var value = ref.value;
var oldValue = ref.oldValue;
/* istanbul ignore if */
if (value === oldValue) { return }
vnode = locateNode(vnode);
var transition$$1 = vnode.data && vnode.data.transition;
if (transition$$1 && !isIE9) {
vnode.data.show = true;
if (value) {
enter(vnode, function () {
el.style.display = el.__vOriginalDisplay;
});
} else {
leave(vnode, function () {
el.style.display = 'none';
});
}
} else {
el.style.display = value ? el.__vOriginalDisplay : 'none';
}
},
unbind: function unbind (
el,
binding,
vnode,
oldVnode,
isDestroy
) {
if (!isDestroy) {
el.style.display = el.__vOriginalDisplay;
}
}
};
var platformDirectives = {
model: model$1,
show: show
};
/* */
// Provides transition support for a single element/component.
// supports transition mode (out-in / in-out)
var transitionProps = {
name: String,
appear: Boolean,
css: Boolean,
mode: String,
type: String,
enterClass: String,
leaveClass: String,
enterToClass: String,
leaveToClass: String,
enterActiveClass: String,
leaveActiveClass: String,
appearClass: String,
appearActiveClass: String,
appearToClass: String,
duration: [Number, String, Object]
};
// in case the child is also an abstract component, e.g. <keep-alive>
// we want to recursively retrieve the real component to be rendered
function getRealChild (vnode) {
var compOptions = vnode && vnode.componentOptions;
if (compOptions && compOptions.Ctor.options.abstract) {
return getRealChild(getFirstComponentChild(compOptions.children))
} else {
return vnode
}
}
function extractTransitionData (comp) {
var data = {};
var options = comp.$options;
// props
for (var key in options.propsData) {
data[key] = comp[key];
}
// events.
// extract listeners and pass them directly to the transition methods
var listeners = options._parentListeners;
for (var key$1 in listeners) {
data[camelize(key$1)] = listeners[key$1];
}
return data
}
function placeholder (h, rawChild) {
if (/\d-keep-alive$/.test(rawChild.tag)) {
return h('keep-alive', {
props: rawChild.componentOptions.propsData
})
}
}
function hasParentTransition (vnode) {
while ((vnode = vnode.parent)) {
if (vnode.data.transition) {
return true
}
}
}
function isSameChild (child, oldChild) {
return oldChild.key === child.key && oldChild.tag === child.tag
}
function isAsyncPlaceholder (node) {
return node.isComment && node.asyncFactory
}
var Transition = {
name: 'transition',
props: transitionProps,
abstract: true,
render: function render (h) {
var this$1 = this;
var children = this.$options._renderChildren;
if (!children) {
return
}
// filter out text nodes (possible whitespaces)
children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
/* istanbul ignore if */
if (!children.length) {
return
}
// warn multiple elements
if (process.env.NODE_ENV !== 'production' && children.length > 1) {
warn(
'<transition> can only be used on a single element. Use ' +
'<transition-group> for lists.',
this.$parent
);
}
var mode = this.mode;
// warn invalid mode
if (process.env.NODE_ENV !== 'production' &&
mode && mode !== 'in-out' && mode !== 'out-in'
) {
warn(
'invalid <transition> mode: ' + mode,
this.$parent
);
}
var rawChild = children[0];
// if this is a component root node and the component's
// parent container node also has transition, skip.
if (hasParentTransition(this.$vnode)) {
return rawChild
}
// apply transition data to child
// use getRealChild() to ignore abstract components e.g. keep-alive
var child = getRealChild(rawChild);
/* istanbul ignore if */
if (!child) {
return rawChild
}
if (this._leaving) {
return placeholder(h, rawChild)
}
// ensure a key that is unique to the vnode type and to this transition
// component instance. This key will be used to remove pending leaving nodes
// during entering.
var id = "__transition-" + (this._uid) + "-";
child.key = child.key == null
? child.isComment
? id + 'comment'
: id + child.tag
: isPrimitive(child.key)
? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
: child.key;
var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
var oldRawChild = this._vnode;
var oldChild = getRealChild(oldRawChild);
// mark v-show
// so that the transition module can hand over the control to the directive
if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
child.data.show = true;
}
if (
oldChild &&
oldChild.data &&
!isSameChild(child, oldChild) &&
!isAsyncPlaceholder(oldChild)
) {
// replace old child transition data with fresh one
// important for dynamic transitions!
var oldData = oldChild && (oldChild.data.transition = extend({}, data));
// handle transition mode
if (mode === 'out-in') {
// return placeholder node and queue update when leave finishes
this._leaving = true;
mergeVNodeHook(oldData, 'afterLeave', function () {
this$1._leaving = false;
this$1.$forceUpdate();
});
return placeholder(h, rawChild)
} else if (mode === 'in-out') {
if (isAsyncPlaceholder(child)) {
return oldRawChild
}
var delayedLeave;
var performLeave = function () { delayedLeave(); };
mergeVNodeHook(data, 'afterEnter', performLeave);
mergeVNodeHook(data, 'enterCancelled', performLeave);
mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
}
}
return rawChild
}
};
/* */
// Provides transition support for list items.
// supports move transitions using the FLIP technique.
// Because the vdom's children update algorithm is "unstable" - i.e.
// it doesn't guarantee the relative positioning of removed elements,
// we force transition-group to update its children into two passes:
// in the first pass, we remove all nodes that need to be removed,
// triggering their leaving transition; in the second pass, we insert/move
// into the final desired state. This way in the second pass removed
// nodes will remain where they should be.
var props = extend({
tag: String,
moveClass: String
}, transitionProps);
delete props.mode;
var TransitionGroup = {
props: props,
render: function render (h) {
var tag = this.tag || this.$vnode.data.tag || 'span';
var map = Object.create(null);
var prevChildren = this.prevChildren = this.children;
var rawChildren = this.$slots.default || [];
var children = this.children = [];
var transitionData = extractTransitionData(this);
for (var i = 0; i < rawChildren.length; i++) {
var c = rawChildren[i];
if (c.tag) {
if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
children.push(c);
map[c.key] = c
;(c.data || (c.data = {})).transition = transitionData;
} else if (process.env.NODE_ENV !== 'production') {
var opts = c.componentOptions;
var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
warn(("<transition-group> children must be keyed: <" + name + ">"));
}
}
}
if (prevChildren) {
var kept = [];
var removed = [];
for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
var c$1 = prevChildren[i$1];
c$1.data.transition = transitionData;
c$1.data.pos = c$1.elm.getBoundingClientRect();
if (map[c$1.key]) {
kept.push(c$1);
} else {
removed.push(c$1);
}
}
this.kept = h(tag, null, kept);
this.removed = removed;
}
return h(tag, null, children)
},
beforeUpdate: function beforeUpdate () {
// force removing pass
this.__patch__(
this._vnode,
this.kept,
false, // hydrating
true // removeOnly (!important, avoids unnecessary moves)
);
this._vnode = this.kept;
},
updated: function updated () {
var children = this.prevChildren;
var moveClass = this.moveClass || ((this.name || 'v') + '-move');
if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
return
}
// we divide the work into three loops to avoid mixing DOM reads and writes
// in each iteration - which helps prevent layout thrashing.
children.forEach(callPendingCbs);
children.forEach(recordPosition);
children.forEach(applyTranslation);
// force reflow to put everything in position
var body = document.body;
var f = body.offsetHeight; // eslint-disable-line
children.forEach(function (c) {
if (c.data.moved) {
var el = c.elm;
var s = el.style;
addTransitionClass(el, moveClass);
s.transform = s.WebkitTransform = s.transitionDuration = '';
el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
if (!e || /transform$/.test(e.propertyName)) {
el.removeEventListener(transitionEndEvent, cb);
el._moveCb = null;
removeTransitionClass(el, moveClass);
}
});
}
});
},
methods: {
hasMove: function hasMove (el, moveClass) {
/* istanbul ignore if */
if (!hasTransition) {
return false
}
/* istanbul ignore if */
if (this._hasMove) {
return this._hasMove
}
// Detect whether an element with the move class applied has
// CSS transitions. Since the element may be inside an entering
// transition at this very moment, we make a clone of it and remove
// all other transition classes applied to ensure only the move class
// is applied.
var clone = el.cloneNode();
if (el._transitionClasses) {
el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
}
addClass(clone, moveClass);
clone.style.display = 'none';
this.$el.appendChild(clone);
var info = getTransitionInfo(clone);
this.$el.removeChild(clone);
return (this._hasMove = info.hasTransform)
}
}
};
function callPendingCbs (c) {
/* istanbul ignore if */
if (c.elm._moveCb) {
c.elm._moveCb();
}
/* istanbul ignore if */
if (c.elm._enterCb) {
c.elm._enterCb();
}
}
function recordPosition (c) {
c.data.newPos = c.elm.getBoundingClientRect();
}
function applyTranslation (c) {
var oldPos = c.data.pos;
var newPos = c.data.newPos;
var dx = oldPos.left - newPos.left;
var dy = oldPos.top - newPos.top;
if (dx || dy) {
c.data.moved = true;
var s = c.elm.style;
s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
s.transitionDuration = '0s';
}
}
var platformComponents = {
Transition: Transition,
TransitionGroup: TransitionGroup
};
/* */
// install platform specific utils
Vue$3.config.mustUseProp = mustUseProp;
Vue$3.config.isReservedTag = isReservedTag;
Vue$3.config.isReservedAttr = isReservedAttr;
Vue$3.config.getTagNamespace = getTagNamespace;
Vue$3.config.isUnknownElement = isUnknownElement;
// install platform runtime directives & components
extend(Vue$3.options.directives, platformDirectives);
extend(Vue$3.options.components, platformComponents);
// install platform patch function
Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
// public mount method
Vue$3.prototype.$mount = function (
el,
hydrating
) {
el = el && inBrowser ? query(el) : undefined;
return mountComponent(this, el, hydrating)
};
// devtools global hook
/* istanbul ignore next */
setTimeout(function () {
if (config.devtools) {
if (devtools) {
devtools.emit('init', Vue$3);
} else if (process.env.NODE_ENV !== 'production' && isChrome) {
console[console.info ? 'info' : 'log'](
'Download the Vue Devtools extension for a better development experience:\n' +
'https://github.com/vuejs/vue-devtools'
);
}
}
if (process.env.NODE_ENV !== 'production' &&
config.productionTip !== false &&
inBrowser && typeof console !== 'undefined'
) {
console[console.info ? 'info' : 'log'](
"You are running Vue in development mode.\n" +
"Make sure to turn on production mode when deploying for production.\n" +
"See more tips at https://vuejs.org/guide/deployment.html"
);
}
}, 0);
/* */
module.exports = Vue$3;
|
node_modules/material-ui/internal/ClearFix.js
|
SerendpityZOEY/Solr-Search-React-UI
|
'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 _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _BeforeAfterWrapper = require('./BeforeAfterWrapper');
var _BeforeAfterWrapper2 = _interopRequireDefault(_BeforeAfterWrapper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var styles = {
before: {
content: "' '",
display: 'table'
},
after: {
content: "' '",
clear: 'both',
display: 'table'
}
};
var ClearFix = function ClearFix(_ref) {
var style = _ref.style;
var children = _ref.children;
var other = _objectWithoutProperties(_ref, ['style', 'children']);
return _react2.default.createElement(
_BeforeAfterWrapper2.default,
_extends({}, other, {
beforeStyle: styles.before,
afterStyle: styles.after,
style: style
}),
children
);
};
ClearFix.muiName = 'ClearFix';
ClearFix.propTypes = {
children: _react.PropTypes.node,
/**
* Override the inline-styles of the root element.
*/
style: _react.PropTypes.object
};
exports.default = ClearFix;
|
packages/cf-component-table/src/TableFoot.js
|
jroyal/cf-ui
|
import React from 'react';
import PropTypes from 'prop-types';
class TableFoot extends React.Component {
render() {
let className = 'cf-table__foot';
if (this.props.className.trim())
className += ' ' + this.props.className.trim();
return (
<tfoot className={className}>
{this.props.children}
</tfoot>
);
}
}
TableFoot.propTypes = {
className: PropTypes.string,
children: PropTypes.node
};
TableFoot.defaultProps = {
className: ''
};
export default TableFoot;
|
node_modules/eslint-config-airbnb/test/test-react-order.js
|
bikebaba/AOCalendarWebhook
|
import test from 'tape';
import { CLIEngine } from 'eslint';
import eslintrc from '../';
import reactRules from '../rules/react';
const cli = new CLIEngine({
useEslintrc: false,
baseConfig: eslintrc,
// This rule fails when executing on text.
rules: { indent: 0 },
});
function lint(text) {
// @see http://eslint.org/docs/developer-guide/nodejs-api.html#executeonfiles
// @see http://eslint.org/docs/developer-guide/nodejs-api.html#executeontext
const linter = cli.executeOnText(text);
return linter.results[0];
}
function wrapComponent(body) {
return `
import React from 'react';
export default class MyComponent extends React.Component {
${body}
}
`;
}
test('validate react prop order', t => {
t.test('make sure our eslintrc has React linting dependencies', t => {
t.plan(1);
t.equal(reactRules.plugins[0], 'react', 'uses eslint-plugin-react');
});
t.test('passes a good component', t => {
t.plan(3);
const result = lint(wrapComponent(`
componentWillMount() {}
componentDidMount() {}
setFoo() {}
getFoo() {}
setBar() {}
someMethod() {}
renderDogs() {}
render() { return <div />; }
`));
t.notOk(result.warningCount, 'no warnings');
t.notOk(result.errorCount, 'no errors');
t.deepEquals(result.messages, [], 'no messages in results');
});
t.test('order: when random method is first', t => {
t.plan(2);
const result = lint(wrapComponent(`
someMethod() {}
componentWillMount() {}
componentDidMount() {}
setFoo() {}
getFoo() {}
setBar() {}
renderDogs() {}
render() { return <div />; }
`));
t.ok(result.errorCount, 'fails');
t.equal(result.messages[0].ruleId, 'react/sort-comp', 'fails due to sort');
});
t.test('order: when random method after lifecycle methods', t => {
t.plan(2);
const result = lint(wrapComponent(`
componentWillMount() {}
componentDidMount() {}
someMethod() {}
setFoo() {}
getFoo() {}
setBar() {}
renderDogs() {}
render() { return <div />; }
`));
t.ok(result.errorCount, 'fails');
t.equal(result.messages[0].ruleId, 'react/sort-comp', 'fails due to sort');
});
});
|
src/index.js
|
opensourcery-io/app
|
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import 'normalize.css/normalize.css';
import './index.css';
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
|
src/routes/Home/components/Home/Home-Main.js
|
Ryana513/ccproject
|
import React from 'react'
import { Slider, Slide } from 'react-materialize'
import compCoff from '../../../../img/comp_coff.jpg'
import tech from '../../assets/slide2tech-100.jpg'
import hero from '../../assets/bg-home-technologies.jpg'
// import { BrowserRouter as NavLink } from "react-router-dom";
export const HomeMain = props => {
return (
<div>
<div>
<Slider indicators={false}>
<Slide src={compCoff} title="In Need of a Web Developer ?">
Log-In to hire a developer for your next project.
</Slide>
<Slide src={tech} title="Fullstack Developers" placement="left">
Equipped with the latest technologies.
</Slide>
<Slide src={hero} title="Our Developers Are..." placement="right">
A great addition to any team.
</Slide>
</Slider>
</div>
</div>
)
}
export default HomeMain
|
src/react/src/index.js
|
madeITBelgium/vesta
|
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'
import configureStore from './store';
import './index.css';
import App from './containers/App/App';
import * as serviceWorker from './containers/App/serviceWorker';
import { BrowserRouter as Router } from 'react-router-dom';
ReactDOM.render(
<Provider store={configureStore()}>
<Router>
<App />
</Router>
</Provider>,
document.getElementById('root')
);
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();
|
app/components/inputText/index.js
|
12go/client-app
|
import React from 'react'
import app from '../../app.js'
const styles = {
input: {
width: '200px',
},
}
export default React.createClass({
handleKeyUp(event) {
event.preventDefault()
app.router.navigate('http://localhost:3000/search?filter[contains]=' + input.value)
},
render() {
const { name, title } = this.props
return (
<input style={styles.input} placeholder={title} type="text" name={name} className={name} onkeyup={this.handleKeyUp}/>
)
},
})
|
examples/reactnative/rn063example/App.js
|
bugsnag/bugsnag-js
|
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React from 'react';
import {
Button,
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
} from 'react-native';
import { NativeModules } from 'react-native';
// Setup Bugsnag client to capture errors automatically
import Bugsnag from '@bugsnag/react-native'
Bugsnag.start();
function triggerException() {
bogusFunction(); // eslint-disable-line no-undef
}
function triggerHandledException() {
bogusHandledFunction(); // eslint-disable-line no-undef
}
async function triggerPromiseRejection() {
try {
await NativeModules.CrashyCrashy.generatePromiseRejection();
} catch (e) {
Bugsnag.notify(e)
}
}
function triggerNativeException() {
NativeModules.CrashyCrashy.generateCrash()
}
function triggerNativeHandledError() {
NativeModules.CrashyCrashy.handledError()
}
const App: () => React$Node = () => {
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={styles.scrollView}>
{global.HermesInternal == null ? null : (
<View style={styles.engine}>
<Text style={styles.footer}>Engine: Hermes</Text>
</View>
)}
<View style={styles.container}>
<Text style= {{
paddingTop: 40,
margin: 20,
}}>Press the buttons below to test examples of Bugsnag functionality. Make sure you have changed the API key in Info.plist or AndroidManifest.xml.</Text>
<ScrollView>
<View style={styles.buttonContainer}>
<Button
title="Trigger JS Exception"
onPress={triggerException} />
<Text style={styles.info}>
Tap this button to send a JS crash to Bugsnag
</Text>
<Button
title="Trigger Native Exception"
onPress={triggerNativeException} />
<Text style={styles.info}>
Tap this button to send a native {Platform.OS} crash to Bugsnag
</Text>
<Button
title="Send Handled JS Exception"
onPress={() => {
try { // execute crashy code
triggerHandledException();
} catch (error) {
Bugsnag.notify(error);
}
}} />
<Text style={styles.info}>
Tap this button to send a handled error to Bugsnag
</Text>
<Button
title="Trigger Promise Rejection"
onPress={() => {
try { // execute crashy code
triggerPromiseRejection();
} catch (error) {
Bugsnag.notify(error);
}
}} />
<Text style={styles.info}>
Tap this button to send a native promise rejection to Bugsnag
</Text>
<Button
title="Send Handled Native Exception"
onPress={() => {
triggerNativeHandledError()
}} />
<Text style={styles.info}>
Tap this button to send a native handled error to Bugsnag
</Text>
<Button
title="Set user"
onPress={() => {
try { // execute crashy code
throw new Error("Error with user");
} catch (error) {
Bugsnag.setUser("user-5fab67", "john@example.com", "John Smith");
Bugsnag.notify(error);
}
}} />
<Text style={styles.info}>
Tap this button to send a handled error with user information to Bugsnag
</Text>
<Button
title="Leave breadcrumbs"
onPress={() => {
// log a breadcrumb, which will be attached to the error report
Bugsnag.leaveBreadcrumb('About to execute crashy code', {
type: 'user'
});
try { // execute crashy code
throw new Error("Error with breadcrumbs");
} catch (error) {
Bugsnag.notify(error);
}
}} />
<Text style={styles.info}>
Tap this button to send a handled error with manual breadcrumbs
</Text>
</View>
</ScrollView>
</View>
</ScrollView>
</SafeAreaView>
</>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#eeeeee',
},
buttonContainer: {
margin: 20
},
info: {
textAlign: 'center',
color: '#666',
fontSize: 11,
marginBottom: 20
}
})
export default App;
|
src/svg-icons/content/flag.js
|
frnk94/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ContentFlag = (props) => (
<SvgIcon {...props}>
<path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"/>
</SvgIcon>
);
ContentFlag = pure(ContentFlag);
ContentFlag.displayName = 'ContentFlag';
ContentFlag.muiName = 'SvgIcon';
export default ContentFlag;
|
src/svg-icons/social/group-add.js
|
mmrtnz/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let SocialGroupAdd = (props) => (
<SvgIcon {...props}>
<path d="M8 10H5V7H3v3H0v2h3v3h2v-3h3v-2zm10 1c1.66 0 2.99-1.34 2.99-3S19.66 5 18 5c-.32 0-.63.05-.91.14.57.81.9 1.79.9 2.86s-.34 2.04-.9 2.86c.28.09.59.14.91.14zm-5 0c1.66 0 2.99-1.34 2.99-3S14.66 5 13 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm6.62 2.16c.83.73 1.38 1.66 1.38 2.84v2h3v-2c0-1.54-2.37-2.49-4.38-2.84zM13 13c-2 0-6 1-6 3v2h12v-2c0-2-4-3-6-3z"/>
</SvgIcon>
);
SocialGroupAdd = pure(SocialGroupAdd);
SocialGroupAdd.displayName = 'SocialGroupAdd';
SocialGroupAdd.muiName = 'SvgIcon';
export default SocialGroupAdd;
|
Router/route-transition/src/index.js
|
imuntil/React
|
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import './index.css';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
|
app/src/components/Header/index.js
|
fikrimuhal/animated-potato
|
import React from 'react';
import SubHeader from './SubHeader';
import styles from './style';
import logoURL from './images/react-logo.svg';
const Header = () => {
return <header className={styles.main}>
<img className={styles.logo} src={logoURL} height="125"/>
<div className={styles.wrap}>
<h1 className={styles.title}>FİKRİMUHAL TEKNOLOJİ</h1>
<SubHeader>Animated Potato</SubHeader>
</div>
</header>;
};
Header.displayName = 'Header';
export default Header;
|
ajax/libs/react-native-web/0.0.0-c7dd1cc7e/exports/createElement/index.js
|
cdnjs/cdnjs
|
/**
* Copyright (c) Nicolas Gallagher.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
import AccessibilityUtil from '../../modules/AccessibilityUtil';
import createDOMProps from '../../modules/createDOMProps';
import React from 'react';
var createElement = function createElement(component, props) {
// Use equivalent platform elements where possible.
var accessibilityComponent;
if (component && component.constructor === String) {
accessibilityComponent = AccessibilityUtil.propsToAccessibilityComponent(props);
}
var Component = accessibilityComponent || component;
var domProps = createDOMProps(Component, props);
for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
children[_key - 2] = arguments[_key];
}
return React.createElement.apply(React, [Component, domProps].concat(children));
};
export default createElement;
|
maodou/wechat/client/components/sign-in-button.js
|
maodouio/meteor-react-redux-base
|
import React from 'react';
export const UIState = {
IDLE: 'idle',
LOGGING_IN: 'loggingIn',
LOGGED_IN: 'loggedIn',
ERROR: 'error'
};
export default (props) => {
switch (props.uiState) {
case UIState.IDLE:
return <a href={props.authUrl}>微信一键登录</a>;
case UIState.LOGGED_IN:
return <span>已登录</span>;
case UIState.LOGGING_IN:
return <span>正在登录...</span>;
default:
return <div>登录失败 <a href={props.authUrl}>重试登录</a></div>;
}
}
|
node_modules/antd/es/collapse/Collapse.js
|
ZSMingNB/react-news
|
import _extends from 'babel-runtime/helpers/extends';
import _defineProperty from 'babel-runtime/helpers/defineProperty';
import _createClass from 'babel-runtime/helpers/createClass';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import React from 'react';
import RcCollapse from 'rc-collapse';
import classNames from 'classnames';
import animation from '../_util/openAnimation';
export var CollapsePanel = function (_React$Component) {
_inherits(CollapsePanel, _React$Component);
function CollapsePanel() {
_classCallCheck(this, CollapsePanel);
return _possibleConstructorReturn(this, (CollapsePanel.__proto__ || Object.getPrototypeOf(CollapsePanel)).apply(this, arguments));
}
return CollapsePanel;
}(React.Component);
var Collapse = function (_React$Component2) {
_inherits(Collapse, _React$Component2);
function Collapse() {
_classCallCheck(this, Collapse);
return _possibleConstructorReturn(this, (Collapse.__proto__ || Object.getPrototypeOf(Collapse)).apply(this, arguments));
}
_createClass(Collapse, [{
key: 'render',
value: function render() {
var _props = this.props,
prefixCls = _props.prefixCls,
_props$className = _props.className,
className = _props$className === undefined ? '' : _props$className,
bordered = _props.bordered;
var collapseClassName = classNames(_defineProperty({}, prefixCls + '-borderless', !bordered), className);
return React.createElement(RcCollapse, _extends({}, this.props, { className: collapseClassName }));
}
}]);
return Collapse;
}(React.Component);
export default Collapse;
Collapse.Panel = RcCollapse.Panel;
Collapse.defaultProps = {
prefixCls: 'ant-collapse',
bordered: true,
openAnimation: _extends({}, animation, {
appear: function appear() {}
})
};
|
examples/huge-apps/routes/Grades/components/Grades.js
|
tikotzky/react-router
|
import React from 'react';
class Grades extends React.Component {
render () {
return (
<div>
<h2>Grades</h2>
</div>
);
}
}
export default Grades;
|
src/layouts/CoreLayout/CoreLayout.js
|
bingomanatee/wonderworld
|
import React from 'react';
import Header from '../../containers/HeaderContainer';
import './CoreLayout.scss';
import '../../styles/core.scss';
export const CoreLayout = ({children}) => (
<div className='core-layout'>
<Header />
<div className='core-layout__viewport'>
{children}
</div>
</div>
);
CoreLayout.propTypes = {
children: React.PropTypes.element.isRequired
};
export default CoreLayout;
|
src/Portal.js
|
rapilabs/react-bootstrap
|
import React from 'react';
import CustomPropTypes from './utils/CustomPropTypes';
import domUtils from './utils/domUtils';
let Portal = React.createClass({
displayName: 'Portal',
propTypes: {
/**
* The DOM Node that the Component will render it's children into
*/
container: CustomPropTypes.mountable
},
componentDidMount() {
this._renderOverlay();
},
componentDidUpdate() {
this._renderOverlay();
},
componentWillUnmount() {
this._unrenderOverlay();
this._unmountOverlayTarget();
},
_mountOverlayTarget() {
if (!this._overlayTarget) {
this._overlayTarget = document.createElement('div');
this.getContainerDOMNode()
.appendChild(this._overlayTarget);
}
},
_unmountOverlayTarget() {
if (this._overlayTarget) {
this.getContainerDOMNode()
.removeChild(this._overlayTarget);
this._overlayTarget = null;
}
},
_renderOverlay() {
let overlay = !this.props.children
? null
: React.Children.only(this.props.children);
// Save reference for future access.
if (overlay !== null) {
this._mountOverlayTarget();
this._overlayInstance = React.render(overlay, this._overlayTarget);
} else {
// Unrender if the component is null for transitions to null
this._unrenderOverlay();
this._unmountOverlayTarget();
}
},
_unrenderOverlay() {
if (this._overlayTarget) {
React.unmountComponentAtNode(this._overlayTarget);
this._overlayInstance = null;
}
},
render() {
return null;
},
getOverlayDOMNode() {
if (!this.isMounted()) {
throw new Error('getOverlayDOMNode(): A component must be mounted to have a DOM node.');
}
if (this._overlayInstance) {
if (this._overlayInstance.getWrappedDOMNode) {
return this._overlayInstance.getWrappedDOMNode();
} else {
return React.findDOMNode(this._overlayInstance);
}
}
return null;
},
getContainerDOMNode() {
return React.findDOMNode(this.props.container) || domUtils.ownerDocument(this).body;
}
});
export default Portal;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.